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


#ifndef DSSI_REGIONWND_H 
#define DSSI_REGIONWND_H 
 
//----------------------------------------------------------------------------- 
//  
// @doc 
// 
// @module	RegionWnd.h - Region window | 
// 
// This module contains the definition of the Region 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" 
#include "Scroll.h" 
 
//----------------------------------------------------------------------------- 
// 
// Forward definitions 
// 
//----------------------------------------------------------------------------- 
 
class CMainWnd; 
 
//----------------------------------------------------------------------------- 
// 
// Class definition 
// 
//----------------------------------------------------------------------------- 
 
class CRegionWnd : 
	public CScrollWindowImpl  
{ 
// @access Constructors and destructors 
public: 
 
	// @cmember General constructor 
	 
	CRegionWnd (); 
 
	// @cmember General destructor 
 
	~CRegionWnd (); 
 
// @access Public methods 
public: 
 
	// @cmember Create the window 
 
	HWND Create (CMainWnd *pMainWnd); 
 
	// @cmember Set region 
 
	void SetRegion (int nRegion, int nTreasure); 
 
	// @cmember Set treasure 
 
	void SetTreasure (int nTreasure); 
 
	// @cmember Idle update 
 
	BOOL OnIdle (CUpdateUIBase *pUpdateUI); 
 
// @access ATL interface list 
public: 
 
	BEGIN_MSG_MAP (CRegionWnd) 
	    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_SETCURSOR, OnSetCursor) 
	    MESSAGE_HANDLER (WM_LBUTTONDOWN, OnLButtonDown) 
	    MESSAGE_HANDLER (WM_LBUTTONUP, OnLButtonUp) 
	    MESSAGE_HANDLER (WM_KEYDOWN, OnKeyDown) 
	    MESSAGE_HANDLER (WM_SHOWWINDOW, OnShowWindow) 
	 
		COMMAND_ID_HANDLER (ID_VIEW_TREASURE_INFORMATION, OnViewTreasureInformation); 
		COMMAND_ID_HANDLER (ID_EDIT_I_JUST_GOT, OnEditIJustGot); 
		COMMAND_ID_HANDLER (ID_EDIT_I_JUST_COMPLETED, OnEditIJustGot); 
		COMMAND_ID_HANDLER (ID_EDIT_COPY, OnEditCopy); 
		COMMAND_ID_HANDLER (ID_EDIT_NEXT_REGION, OnEditNextRegion); 
		COMMAND_ID_HANDLER (ID_EDIT_PREVIOUS_REGION, OnEditPreviousRegion); 
		COMMAND_ID_HANDLER (ID_EDIT_NEXT_TREASURE, OnEditNextTreasure); 
		COMMAND_ID_HANDLER (ID_EDIT_PREVIOUS_TREASURE, OnEditPreviousTreasure); 
 
		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 set cursor 
 
	LRESULT OnSetCursor (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 key down 
 
	LRESULT OnKeyDown (UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled); 
 
	// @cmember Handle a show window 
 
	LRESULT OnShowWindow (UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled); 
 
// Command handlers 
public: 
 
	// @cmember View treasure information 
 
	LRESULT OnViewTreasureInformation (WORD wNotifyCode,  
		WORD wID, HWND hWndCtl, BOOL& bHandled); 
	 
	// @cmember Change map counts 
 
	LRESULT OnEditIJustGot (WORD wNotifyCode,  
		WORD wID, HWND hWndCtl, BOOL& bHandled); 
	 
	// @cmember Copy the current treasure information to the clipboard 
 
	LRESULT OnEditCopy (WORD wNotifyCode,  
		WORD wID, HWND hWndCtl, BOOL& bHandled); 
 
	// @cmember Handle next region 
 
	LRESULT OnEditNextRegion (WORD wNotifyCode,  
		WORD wID, HWND hWndCtl, BOOL& bHandled); 
 
	// @cmember Handle previous region 
 
	LRESULT OnEditPreviousRegion (WORD wNotifyCode,  
		WORD wID, HWND hWndCtl, BOOL& bHandled); 
 
	// @cmember Handle next treasure 
 
	LRESULT OnEditNextTreasure (WORD wNotifyCode,  
		WORD wID, HWND hWndCtl, BOOL& bHandled); 
 
	// @cmember Handle previous treasure 
 
	LRESULT OnEditPreviousTreasure (WORD wNotifyCode,  
		WORD wID, HWND hWndCtl, BOOL& bHandled); 
	 
// @access Protected methods 
protected: 
 
	// @cmember Treasure hit test 
 
	int TreasureHitTest (POINT pt); 
 
	// @cmember Draw the window 
 
	void Draw (HDC hDC); 
 
	// @cmember Get a default treasure 
 
    int GetDefaultTreasure (int nTreasure); 
 
// @access Protected variables 
protected: 
	 
	// @cmember Pointer to the main window 
 
	CMainWnd				*m_pMainWnd; 
 
	// @cmember Current region number 
 
	int						m_nRegion; 
 
	// @cmember Left pane rect 
 
	CRect					m_rectLeftPane; 
 
	// @cmember Right pane rect 
 
	CRect					m_rectRightPane; 
 
	// @cmember Rectangle of the region map 
 
	CRect					m_rectRegionMap; 
 
	// @cmember Scroll for the large map 
 
	CScroll					m_scrollRight; 
 
	// @cmember Scroll for the small map name 
 
	CScroll					m_scrollName; 
 
	// @cmember Scroll for the small map coords 
 
	CScroll					m_scrollCoords; 
 
	// @cmember Scroll for the left map 
 
	CScroll					m_scrollLeft; 
 
	// @cmember Treasure list 
 
	int						*m_panTreasures; 
 
	// @cmember Number of treasures 
 
	int						m_nTreasures; 
 
	// @cmember Current treasure number 
 
	int						m_nTreasure; 
 
	// @cmember Rectangle of the treasure map 
 
	CRect					m_rectTreasureMap; 
 
	// @cmember Over treasure 
 
	int						m_nOverTreasure; 
 
	// @cmember Over treasure 
 
	int						m_nOverTreasureClick; 
}; 
 
#endif // DSSI_REGIONWND_H