1 | ///////////////////////////////////////////////////////////////////////////// |
---|
2 | // Name: wgetkey.h |
---|
3 | // Purpose: |
---|
4 | // Author: Cesar Mauri Loba (cesar at crea-si dot com) |
---|
5 | // Modified by: |
---|
6 | // Created: 01/07/2010 |
---|
7 | // Copyright: (C) 2008 Cesar Mauri Loba - CREA Software Systems |
---|
8 | // |
---|
9 | // This program is free software: you can redistribute it and/or modify |
---|
10 | // it under the terms of the GNU General Public License as published by |
---|
11 | // the Free Software Foundation, either version 3 of the License, or |
---|
12 | // (at your option) any later version. |
---|
13 | // |
---|
14 | // This program is distributed in the hope that it will be useful, |
---|
15 | // but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
16 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
17 | // GNU General Public License for more details. |
---|
18 | // |
---|
19 | // You should have received a copy of the GNU General Public License |
---|
20 | // along with this program. If not, see <http://www.gnu.org/licenses/>. |
---|
21 | ///////////////////////////////////////////////////////////////////////////// |
---|
22 | #ifndef _WGETKEY_H_ |
---|
23 | #define _WGETKEY_H_ |
---|
24 | |
---|
25 | |
---|
26 | /*! |
---|
27 | * Includes |
---|
28 | */ |
---|
29 | |
---|
30 | //#include <wx/timer.h> |
---|
31 | #include <wx/dialog.h> |
---|
32 | #include "ckeyboardcode.h" |
---|
33 | |
---|
34 | ////@begin includes |
---|
35 | ////@end includes |
---|
36 | |
---|
37 | /*! |
---|
38 | * Forward declarations |
---|
39 | */ |
---|
40 | |
---|
41 | ////@begin forward declarations |
---|
42 | ////@end forward declarations |
---|
43 | |
---|
44 | /*! |
---|
45 | * Control identifiers |
---|
46 | */ |
---|
47 | |
---|
48 | ////@begin control identifiers |
---|
49 | #define ID_ACTIVATIONKEY 10070 |
---|
50 | #define ID_TEXTCTRL 10041 |
---|
51 | #define SYMBOL_WGETKEY_STYLE wxCAPTION|wxRESIZE_BORDER|wxSYSTEM_MENU|wxWANTS_CHARS|wxTAB_TRAVERSAL |
---|
52 | #define SYMBOL_WGETKEY_TITLE _("Get key") |
---|
53 | #define SYMBOL_WGETKEY_IDNAME ID_ACTIVATIONKEY |
---|
54 | #define SYMBOL_WGETKEY_SIZE wxDefaultSize |
---|
55 | #define SYMBOL_WGETKEY_POSITION wxDefaultPosition |
---|
56 | ////@end control identifiers |
---|
57 | |
---|
58 | /*! |
---|
59 | * WGetKey class declaration |
---|
60 | */ |
---|
61 | |
---|
62 | class WGetKey: public wxDialog |
---|
63 | { |
---|
64 | DECLARE_DYNAMIC_CLASS( WGetKey ) |
---|
65 | DECLARE_EVENT_TABLE() |
---|
66 | |
---|
67 | public: |
---|
68 | /// Constructors |
---|
69 | WGetKey(); |
---|
70 | WGetKey( wxWindow* parent, wxWindowID id = SYMBOL_WGETKEY_IDNAME, const wxString& caption = SYMBOL_WGETKEY_TITLE, const wxPoint& pos = SYMBOL_WGETKEY_POSITION, const wxSize& size = SYMBOL_WGETKEY_SIZE, long style = SYMBOL_WGETKEY_STYLE ); |
---|
71 | |
---|
72 | /// Creation |
---|
73 | bool Create( wxWindow* parent, wxWindowID id = SYMBOL_WGETKEY_IDNAME, const wxString& caption = SYMBOL_WGETKEY_TITLE, const wxPoint& pos = SYMBOL_WGETKEY_POSITION, const wxSize& size = SYMBOL_WGETKEY_SIZE, long style = SYMBOL_WGETKEY_STYLE ); |
---|
74 | |
---|
75 | /// Destructor |
---|
76 | ~WGetKey(); |
---|
77 | |
---|
78 | CKeyboardCode GetKeyCode(); |
---|
79 | |
---|
80 | private: |
---|
81 | /// Initialises member variables |
---|
82 | void Init(); |
---|
83 | |
---|
84 | /// Creates the controls and sizers |
---|
85 | void CreateControls(); |
---|
86 | |
---|
87 | ////@begin WGetKey event handler declarations |
---|
88 | |
---|
89 | /// wxEVT_LEFT_DOWN event handler for ID_ACTIVATIONKEY |
---|
90 | void OnLeftDown( wxMouseEvent& event ); |
---|
91 | |
---|
92 | /// wxEVT_KEY_UP event handler for ID_TEXTCTRL |
---|
93 | void OnKeyUp( wxKeyEvent& event ); |
---|
94 | |
---|
95 | ////@end WGetKey event handler declarations |
---|
96 | // void OnTimer(wxTimerEvent& event); |
---|
97 | |
---|
98 | ////@begin WGetKey member function declarations |
---|
99 | |
---|
100 | /// Retrieves bitmap resources |
---|
101 | wxBitmap GetBitmapResource( const wxString& name ); |
---|
102 | |
---|
103 | /// Retrieves icon resources |
---|
104 | wxIcon GetIconResource( const wxString& name ); |
---|
105 | ////@end WGetKey member function declarations |
---|
106 | |
---|
107 | /// Should we show tooltips? |
---|
108 | static bool ShowToolTips(); |
---|
109 | |
---|
110 | ////@begin WGetKey member variables |
---|
111 | wxTextCtrl* m_txtKey; |
---|
112 | ////@end WGetKey member variables |
---|
113 | private: |
---|
114 | //wxTimer m_timer; |
---|
115 | CKeyboardCode m_keyCode; |
---|
116 | }; |
---|
117 | |
---|
118 | #endif |
---|
119 | // _ACTIVATIONKEY_H_ |
---|