www.pudn.com > uoth_src.zip > MapWnd.h


#ifndef DSSI_MAPWND_H 
#define DSSI_MAPWND_H 
 
//----------------------------------------------------------------------------- 
//  
// @doc 
// 
// @module	MapWnd.h - Map window | 
// 
// This module contains the definition of the map window. 
// 
// Copyright (c) 2002 - Descartes Systems Sciences, Inc. 
// 
// All rights reserved. 
// 
// Redistribution and use in source and binary forms, with or without  
// modification, are permitted provided that the following conditions are  
// met: 
//  
// 1. Redistributions of source code must retain the above copyright notice,  
//    this list of conditions and the following disclaimer.  
// 2. Neither the name of Descartes Systems Sciences, Inc nor the names of  
//    its contributors may be used to endorse or promote products derived  
//    from this software without specific prior written permission. 
// 
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS  
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT  
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR  
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT  
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,  
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED  
// TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR  
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF  
// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING  
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS  
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
// 
// @end 
// 
// $History: CnfMainWnd.h $ 
//       
//----------------------------------------------------------------------------- 
 
//----------------------------------------------------------------------------- 
// 
// Required include files 
// 
//----------------------------------------------------------------------------- 
 
#include "resource.h" 
 
//----------------------------------------------------------------------------- 
// 
// Forward definitions 
// 
//----------------------------------------------------------------------------- 
 
class CMainWnd; 
 
//----------------------------------------------------------------------------- 
// 
// Class definition 
// 
//----------------------------------------------------------------------------- 
 
class CMapWnd : 
	public CScrollWindowImpl  
{ 
// @access Constructors and destructors 
public: 
 
	// @cmember General constructor 
	 
	CMapWnd (); 
 
	// @cmember General destructor 
 
	~CMapWnd (); 
 
// @access Public methods 
public: 
 
	// @cmember Create the window 
 
	HWND Create (CMainWnd *pMainWnd); 
 
	// @cmember Idle update 
 
	BOOL OnIdle (CUpdateUIBase *pUpdateUI); 
 
// @access ATL interface list 
public: 
 
	BEGIN_MSG_MAP (CMapWnd) 
	    MESSAGE_HANDLER (WM_CREATE, OnCreate) 
	    MESSAGE_HANDLER (WM_ERASEBKGND, OnEraseBackground) 
	    MESSAGE_HANDLER (WM_PAINT, OnPaint) 
		MESSAGE_HANDLER (WM_MOUSEMOVE, OnMouseMove) 
		MESSAGE_HANDLER (WM_MOUSELEAVE, OnMouseLeave) 
	    MESSAGE_HANDLER (WM_LBUTTONDOWN, OnLButtonDown) 
	    MESSAGE_HANDLER (WM_LBUTTONUP, OnLButtonUp) 
	    MESSAGE_HANDLER (WM_SETCURSOR, OnSetCursor) 
		MESSAGE_HANDLER (WM_SHOWWINDOW, OnShowWindow) 
 
		CHAIN_MSG_MAP (CScrollWindowImpl); 
 
		DEFAULT_REFLECTION_HANDLER (); 
	END_MSG_MAP () 
 
// @access ATL message handlers 
public: 
 
	// @cmember Handle post creation actions 
 
	LRESULT OnCreate (UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled); 
 
	// @cmember Handle paint 
 
	LRESULT OnPaint (UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled); 
 
	// @cmember Don't erase the background 
 
	LRESULT OnEraseBackground (UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled) 
	{ 
		return 1; 
	} 
 
	// @cmember Handle mouse leaving client area 
 
	LRESULT OnMouseLeave (UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled); 
 
	// @cmember Handle mouse move 
 
	LRESULT OnMouseMove (UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled); 
 
	// @cmember Handle a mouse left button down event 
 
	LRESULT OnLButtonDown (UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled); 
 
	// @cmember Handle a mouse left button down event 
 
	LRESULT OnLButtonUp (UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled); 
 
	// @cmember Handle a set cursor 
 
	LRESULT OnSetCursor (UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled); 
 
	// @cmember Handle a change in show status 
 
	LRESULT OnShowWindow (UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled); 
 
// @access Protected methods 
protected: 
 
	// @cmember Invalidate a map region 
 
	void InvalidateMapRegion (int nRegion); 
 
	// @cmember Region hit test 
 
	int RegionHitTest (POINT pt); 
 
	// @cmember Draw the window 
 
	void Draw (HDC hDC); 
 
// @access Protected variables 
protected: 
	 
	// @cmember Pointer to the main window 
 
	CMainWnd				*m_pMainWnd; 
 
	// @cmember Over region number 
 
	int						m_nOverRegion; 
 
	// @cmember Left click on region 
 
	int						m_nOverRegionClick; 
}; 
 
#endif // DSSI_MAPWND_H