📄 mapcommandbase.h
字号:
// MapCommandBase.h: interface for the CMapCommandBase class.
//
//////////////////////////////////////////////////////////////////////
#pragma once
#include "HookHelper.h"
//
// Provides basic implementation of a command that requires a focus map
// Inherit this into your command object, then override any required functions
//
// Default behaviour
// Enabled - True if there is a focus map
// Checked - False
// Name - Combination of Caption and category
// Caption - supplied from constructor
// Tooltip - defaults to Caption if not supplied
// Message - defaults to Caption is not supplied
// OnCreate - Initialises hook
// all others just return S_OK
//
// The constructor will initialise the base class with bitmaps and
// strings specified by resource ID's
//
class CMapCommandBase : public ICommand
{
public:
CMapCommandBase(UINT bitmapID = NULL,
UINT caption = NULL,
UINT category = NULL,
UINT tooltip = NULL,
UINT message = NULL,
UINT helpfile = NULL,
LONG helpID = 0);
virtual ~CMapCommandBase();
// ICommand
public:
STDMETHOD(get_Enabled)(VARIANT_BOOL * Enabled);
STDMETHOD(get_Checked)(VARIANT_BOOL * Checked);
STDMETHOD(get_Name)(BSTR * Name);
STDMETHOD(get_Caption)(BSTR * Caption);
STDMETHOD(get_Tooltip)(BSTR * Tooltip);
STDMETHOD(get_Message)(BSTR * Message);
STDMETHOD(get_HelpFile)(BSTR * HelpFile);
STDMETHOD(get_HelpContextID)(LONG * helpID);
STDMETHOD(get_Bitmap)(OLE_HANDLE * Bitmap);
STDMETHOD(get_Category)(BSTR * categoryName);
STDMETHOD(OnCreate)(IDispatch * hook);
STDMETHOD(OnClick)();
// Helper functions
protected:
HRESULT GetFocusMapActiveView(IActiveView** ppActiveView);
HRESULT GetFocusMapScreenDisplay(IScreenDisplay** ppScreenDisplay);
HRESULT ToFocusMapPoint(LONG X, LONG Y, IPoint** ppPoint);
protected:
CHookHelper m_hookHelper;
HBITMAP m_hBitmap;
CComBSTR m_bstrCaption;
CComBSTR m_bstrCategory;
CComBSTR m_bstrName;
CComBSTR m_bstrTooltip;
CComBSTR m_bstrMessage;
CComBSTR m_bstrHelpfile;
LONG m_lHelpID;
};
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -