GlobalHotkeys.h
Go to the documentation of this file.
1 /*
2 //
3 // BEGIN SONGBIRD GPL
4 //
5 // This file is part of the Songbird web player.
6 //
7 // Copyright(c) 2005-2008 POTI, Inc.
8 // http://songbirdnest.com
9 //
10 // This file may be licensed under the terms of of the
11 // GNU General Public License Version 2 (the "GPL").
12 //
13 // Software distributed under the License is distributed
14 // on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either
15 // express or implied. See the GPL for the specific language
16 // governing rights and limitations.
17 //
18 // You should have received a copy of the GPL along with this
19 // program. If not, go to http://www.gnu.org/licenses/gpl.html
20 // or write to the Free Software Foundation, Inc.,
21 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
22 //
23 // END SONGBIRD GPL
24 //
25  */
26 
32 #pragma once
33 
34 
35 // INCLUDES ===================================================================
36 
37 #include <nsStringGlue.h>
38 
39 #ifdef XP_WIN
40 #include <windows.h>
41 #endif
42 
43 #include "IGlobalHotkeys.h"
44 #include <list>
45 
46 #ifdef XP_WIN
47 #define HOTKEY_HANDLE int
48 #else
49 // set types for other platforms
50 #define HOTKEY_HANDLE int
51 #endif
52 
53 // DEFINES ====================================================================
54 #define SONGBIRD_GLOBALHOTKEYS_CONTRACTID "@songbirdnest.com/Songbird/GlobalHotkeys;1"
55 #define SONGBIRD_GLOBALHOTKEYS_CLASSNAME "Songbird Global Hotkeys Manager"
56 
57 // {284E14BF-5CE4-4434-A733-4379D27D799E}
58 #define SONGBIRD_GLOBALHOTKEYS_CID { 0x284e14bf, 0x5ce4, 0x4434, { 0xa7, 0x33, 0x43, 0x79, 0xd2, 0x7d, 0x79, 0x9e } }
59 
60 // CLASSES ====================================================================
61 
63 {
64 public:
66  nsString m_keyid;
68 };
69 
71 {
72 public:
74  virtual ~CGlobalHotkeys();
75 
77  NS_DECL_SBIGLOBALHOTKEYS
78 
79 #ifdef XP_WIN
80  LRESULT WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
81 #endif
82 
83 protected:
84 #ifdef XP_WIN
85  HWND m_window;
86  static PRInt32 m_autoinc;
87  UINT makeWin32Mask(PRBool altKey, PRBool ctrlKey, PRBool shiftKey, PRBool metaKey);
88 #endif
89 
90  HOTKEY_HANDLE registerHotkey(PRInt32 keyCode, PRBool altKey, PRBool ctrlKey, PRBool shiftKey, PRBool metaKey);
92  GlobalHotkeyEntry *findHotkeyById(const nsAString &keyid);
95 
96  static std::list<GlobalHotkeyEntry*> m_hotkeys;
97 };
98 
classDescription entry
Definition: FeedWriter.js:1427
sbIGlobalHotkeyCallback * m_callback
Definition: GlobalHotkeys.h:67
void removeEntry(GlobalHotkeyEntry *entry)
static std::list< GlobalHotkeyEntry * > m_hotkeys
Definition: GlobalHotkeys.h:96
Global hotkey registration/unregistration interface This interface is used to register or unregister ...
Global hotkeys callback interface This interface is used by callback objects to receive a notificatio...
function handle(request, response)
int registerHotkey(PRInt32 keyCode, PRBool altKey, PRBool ctrlKey, PRBool shiftKey, PRBool metaKey)
return e ctrlKey(chr<' '||!chars||chars.indexOf(chr)>-1)
GlobalHotkeyEntry * findHotkeyById(const nsAString &keyid)
GlobalHotkeyEntry * findHotkeyByHandle(int handle)
void unregisterHotkey(int handle)
Definition: GlobalHotkeys.h:62
#define HOTKEY_HANDLE
Definition: GlobalHotkeys.h:50
nsString m_keyid
Definition: GlobalHotkeys.h:66
int m_handle
Definition: GlobalHotkeys.h:65
virtual ~CGlobalHotkeys()