xref: /haiku/src/preferences/keymap/ModifierKeysWindow.h (revision 4fc18643b9646e41a5ec98e1b046c6c1a8303399)
1 /*
2  * Copyright 2011-2023 Haiku, Inc. All rights reserved.
3  * Distributed under the terms of the MIT License.
4  *
5  * Authors:
6  *		John Scipione, jscipione@gmail.com
7  *		Jorge Acereda, jacereda@gmail.com
8  */
9 #ifndef MODIFIER_KEYS_WINDOW_H
10 #define MODIFIER_KEYS_WINDOW_H
11 
12 
13 #include <Window.h>
14 
15 
16 class BButton;
17 class BMenuField;
18 class BPopUpMenu;
19 class StatusMenuField;
20 
21 
22 class ModifierKeysWindow : public BWindow {
23 public:
24 									ModifierKeysWindow();
25 	virtual							~ModifierKeysWindow();
26 
27 	virtual	void					MessageReceived(BMessage* message);
28 
29 private:
30 			void					_CreateMenuField(BPopUpMenu** _menu, BMenuField** _field,
31 										uint32 key, const char* label);
32 			void					_MarkMenuItems();
33 			bool					_MarkMenuItem(const char*, BPopUpMenu*, uint32 l, uint32 r);
34 			const char*				_KeyToString(int32 key);
35 			int32					_KeyToKeyCode(int32 key, bool right = false);
36 			int32					_LastKey();
37 			void					_ValidateDuplicateKeys();
38 			void					_ValidateDuplicateKey(StatusMenuField*, uint32);
39 			uint32					_DuplicateKeys();
40 			void					_UpdateStatus();
41 
42 			BPopUpMenu*				fCapsMenu;
43 			BPopUpMenu*				fShiftMenu;
44 			BPopUpMenu*				fControlMenu;
45 			BPopUpMenu*				fOptionMenu;
46 			BPopUpMenu*				fCommandMenu;
47 
48 			StatusMenuField*		fCapsField;
49 			StatusMenuField*		fShiftField;
50 			StatusMenuField*		fControlField;
51 			StatusMenuField*		fOptionField;
52 			StatusMenuField*		fCommandField;
53 
54 			BButton*				fRevertButton;
55 			BButton*				fCancelButton;
56 			BButton*				fOkButton;
57 
58 			key_map*				fCurrentMap;
59 			key_map*				fSavedMap;
60 
61 			char*					fCurrentBuffer;
62 			char*					fSavedBuffer;
63 };
64 
65 
66 #endif	// MODIFIER_KEYS_WINDOW_H
67