1 : /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 : /* ***** BEGIN LICENSE BLOCK *****
3 : * Version: MPL 1.1/GPL 2.0/LGPL 2.1
4 : *
5 : * The contents of this file are subject to the Mozilla Public License Version
6 : * 1.1 (the "License"); you may not use this file except in compliance with
7 : * the License. You may obtain a copy of the License at
8 : * http://www.mozilla.org/MPL/
9 : *
10 : * Software distributed under the License is distributed on an "AS IS" basis,
11 : * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12 : * for the specific language governing rights and limitations under the
13 : * License.
14 : *
15 : * The Original Code is Mozilla.
16 : *
17 : * The Initial Developer of the Original Code is
18 : * IBM Corporation.
19 : * Portions created by the Initial Developer are Copyright (C) 2004
20 : * the Initial Developer. All Rights Reserved.
21 : *
22 : * Contributor(s):
23 : * Brian Ryner <bryner@brianryner.com>
24 : *
25 : * Alternatively, the contents of this file may be used under the terms of
26 : * either the GNU General Public License Version 2 or later (the "GPL"), or
27 : * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
28 : * in which case the provisions of the GPL or the LGPL are applicable instead
29 : * of those above. If you wish to allow use of your version of this file only
30 : * under the terms of either the GPL or the LGPL, and not to allow others to
31 : * use your version of this file under the terms of the MPL, indicate your
32 : * decision by deleting the provisions above and replace them with the notice
33 : * and other provisions required by the GPL or the LGPL. If you do not delete
34 : * the provisions above, a recipient may use your version of this file under
35 : * the terms of any one of the MPL, the GPL or the LGPL.
36 : *
37 : * ***** END LICENSE BLOCK ***** */
38 :
39 : #ifndef nsNativeKeyBindings_h_
40 : #define nsNativeKeyBindings_h_
41 :
42 : // X.h defines KeyPress
43 : #ifdef KeyPress
44 : #undef KeyPress
45 : #endif
46 :
47 : #include "nsINativeKeyBindings.h"
48 : #include <gtk/gtk.h>
49 :
50 : enum NativeKeyBindingsType {
51 : eKeyBindings_Input,
52 : eKeyBindings_TextArea
53 : };
54 :
55 : #define NS_NATIVEKEYBINDINGSINPUT_CID \
56 : {0x5c337258, 0xa580, 0x472e, {0x86, 0x15, 0xf2, 0x77, 0xdd, 0xc5, 0xbb, 0x06}}
57 :
58 : #define NS_NATIVEKEYBINDINGSINPUT_CONTRACTID \
59 : NS_NATIVEKEYBINDINGS_CONTRACTID_PREFIX "input"
60 :
61 : #define NS_NATIVEKEYBINDINGSTEXTAREA_CID \
62 : {0x2a898043, 0x180f, 0x4c8b, {0x8e, 0x54, 0x41, 0x0c, 0x7a, 0x54, 0x0f, 0x27}}
63 :
64 : #define NS_NATIVEKEYBINDINGSTEXTAREA_CONTRACTID \
65 : NS_NATIVEKEYBINDINGS_CONTRACTID_PREFIX "textarea"
66 :
67 : #define NS_NATIVEKEYBINDINGSEDITOR_CID \
68 : {0xf916ebfb, 0x78ef, 0x464b, {0x94, 0xd0, 0xa6, 0xf2, 0xca, 0x32, 0x00, 0xae}}
69 :
70 : #define NS_NATIVEKEYBINDINGSEDITOR_CONTRACTID \
71 : NS_NATIVEKEYBINDINGS_CONTRACTID_PREFIX "editor"
72 :
73 : class nsNativeKeyBindings : public nsINativeKeyBindings
74 0 : {
75 : public:
76 : NS_HIDDEN_(void) Init(NativeKeyBindingsType aType);
77 :
78 : NS_DECL_ISUPPORTS
79 :
80 : // nsINativeKeyBindings
81 : virtual NS_HIDDEN_(bool) KeyDown(const nsNativeKeyEvent& aEvent,
82 : DoCommandCallback aCallback,
83 : void *aCallbackData);
84 :
85 : virtual NS_HIDDEN_(bool) KeyPress(const nsNativeKeyEvent& aEvent,
86 : DoCommandCallback aCallback,
87 : void *aCallbackData);
88 :
89 : virtual NS_HIDDEN_(bool) KeyUp(const nsNativeKeyEvent& aEvent,
90 : DoCommandCallback aCallback,
91 : void *aCallbackData);
92 :
93 : private:
94 : ~nsNativeKeyBindings() NS_HIDDEN;
95 :
96 : bool KeyPressInternal(const nsNativeKeyEvent& aEvent,
97 : DoCommandCallback aCallback,
98 : void *aCallbackData,
99 : PRUint32 aKeyCode);
100 :
101 : GtkWidget *mNativeTarget;
102 : };
103 :
104 : #endif
|