Applied patch [ 758687 ] RegisterHotkey implemented

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@21842 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Julian Smart
2003-07-10 09:16:00 +00:00
parent fda7962d02
commit 5048c832bb
10 changed files with 164 additions and 1 deletions

View File

@@ -1737,6 +1737,17 @@ enum wxKeyCode
WXK_WINDOWS_MENU
};
#if wxUSE_HOTKEY
enum wxHotkeyModifier
{
wxMOD_NONE = 0,
wxMOD_ALT = 1,
wxMOD_CONTROL = 2,
wxMOD_SHIFT = 4,
wxMOD_WIN = 8
};
#endif
// Mapping modes (same values as used by Windows, don't change)
enum
{

View File

@@ -186,7 +186,9 @@ BEGIN_DECLARE_EVENT_TYPES()
DECLARE_EVENT_TYPE(wxEVT_NAVIGATION_KEY, 214)
DECLARE_EVENT_TYPE(wxEVT_KEY_DOWN, 215)
DECLARE_EVENT_TYPE(wxEVT_KEY_UP, 216)
#if wxUSE_HOTKEY
DECLARE_EVENT_TYPE(wxEVT_HOTKEY, 217)
#endif
// Set cursor event
DECLARE_EVENT_TYPE(wxEVT_SET_CURSOR, 230)
@@ -819,6 +821,7 @@ private:
wxEVT_CHAR_HOOK
wxEVT_KEY_DOWN
wxEVT_KEY_UP
wxEVT_HOTKEY
*/
class WXDLLIMPEXP_CORE wxKeyEvent : public wxEvent
@@ -2332,6 +2335,9 @@ typedef void (wxEvtHandler::*wxMouseCaptureChangedEventFunction)(wxMouseCaptureC
#define EVT_CHAR(func) DECLARE_EVENT_TABLE_ENTRY( wxEVT_CHAR, wxID_ANY, wxID_ANY, (wxObjectEventFunction) (wxEventFunction) (wxCharEventFunction) & func, (wxObject *) NULL ),
#define EVT_KEY_DOWN(func) DECLARE_EVENT_TABLE_ENTRY( wxEVT_KEY_DOWN, wxID_ANY, wxID_ANY, (wxObjectEventFunction) (wxEventFunction) (wxCharEventFunction) & func, (wxObject *) NULL ),
#define EVT_KEY_UP(func) DECLARE_EVENT_TABLE_ENTRY( wxEVT_KEY_UP, wxID_ANY, wxID_ANY, (wxObjectEventFunction) (wxEventFunction) (wxCharEventFunction) & func, (wxObject *) NULL ),
#if wxUSE_HOTKEY
#define EVT_HOTKEY(id, func) DECLARE_EVENT_TABLE_ENTRY( wxEVT_HOTKEY, id, wxID_ANY, (wxObjectEventFunction) (wxEventFunction) (wxCharEventFunction) & func, (wxObject *) NULL ),
#endif
#define EVT_CHAR_HOOK(func) DECLARE_EVENT_TABLE_ENTRY( wxEVT_CHAR_HOOK, wxID_ANY, wxID_ANY, (wxObjectEventFunction) (wxEventFunction) (wxCharEventFunction) & func, NULL ),
#define EVT_MENU_OPEN(func) DECLARE_EVENT_TABLE_ENTRY( wxEVT_MENU_OPEN, wxID_ANY, wxID_ANY, (wxObjectEventFunction) (wxEventFunction) (wxMenuEventFunction) & func, (wxObject *) NULL ),
#define EVT_MENU_CLOSE(func) DECLARE_EVENT_TABLE_ENTRY( wxEVT_MENU_CLOSE, wxID_ANY, wxID_ANY, (wxObjectEventFunction) (wxEventFunction) (wxMenuEventFunction) & func, (wxObject *) NULL ),

View File

@@ -569,6 +569,9 @@
// wxAcceleratorTable/Entry classes and support for them in wxMenu(Bar)
#define wxUSE_ACCEL 1
// Hotkey support (currently Windows only)
#define wxUSE_HOTKEY 1
// Use wxCaret: a class implementing a "cursor" in a text control (called caret
// under Windows).
//

View File

@@ -177,6 +177,12 @@ public:
wxWindow* GetWindowChild(wxWindowID id);
#endif // __WXUNIVERSAL__
#if wxUSE_ACCEL
// install and deinstall a system wide hotkey
virtual bool RegisterHotKey(int hotkeyId, int modifiers, int virtualKeyCode);
virtual bool UnregisterHotKey(int hotkeyId);
#endif
// implementation from now on
// --------------------------
@@ -362,6 +368,9 @@ public:
bool HandleChar(WXWPARAM wParam, WXLPARAM lParam, bool isASCII = FALSE);
bool HandleKeyDown(WXWPARAM wParam, WXLPARAM lParam);
bool HandleKeyUp(WXWPARAM wParam, WXLPARAM lParam);
#if wxUSE_ACCEL
bool HandleHotKey(WXWPARAM wParam, WXLPARAM lParam);
#endif
#ifdef __WIN32__
int HandleMenuChar(int chAccel, WXLPARAM lParam);
#endif

View File

@@ -516,6 +516,11 @@ public:
{ m_acceleratorTable = accel; }
wxAcceleratorTable *GetAcceleratorTable()
{ return &m_acceleratorTable; }
// install and deinstall a system wide hotkey
virtual bool RegisterHotKey(int hotkeyId, int modifiers, int virtualKeyCode);
virtual bool UnregisterHotKey(int hotkeyId);
#endif // wxUSE_ACCEL
// dialog units translations