xref: /haiku/src/preferences/keymap/ModifierKeysWindow.h (revision 2b76973fa2401f7a5edf68e6470f3d3210cbcff3)
1 /*
2  * Copyright 2011-2013 Haiku Inc. All rights reserved.
3  * Distributed under the terms of the MIT License.
4  *
5  * Authors:
6  *		John Scipione, jscipione@gmail.com
7  */
8 #ifndef MODIFIER_KEYS_WINDOW_H
9 #define MODIFIER_KEYS_WINDOW_H
10 
11 
12 #include <Window.h>
13 
14 
15 class BMenuField;
16 class BPopUpMenu;
17 
18 
19 class ConflictView : public BView {
20 public:
21 								ConflictView(const char* name);
22 								~ConflictView();
23 
24 	virtual	void				Draw(BRect updateRect);
25 
26 			BBitmap*			Icon();
27 			void				ShowIcon(bool show);
28 
29 private:
30 	void						_FillSavedIcon();
31 
32 	BBitmap*					fIcon;
33 	BBitmap*					fSavedIcon;
34 };
35 
36 
37 class ModifierKeysWindow : public BWindow {
38 public:
39 									ModifierKeysWindow();
40 	virtual							~ModifierKeysWindow();
41 
42 	virtual	void					MessageReceived(BMessage* message);
43 
44 private:
45 			BMenuField*				_CreateShiftMenuField();
46 			BMenuField*				_CreateControlMenuField();
47 			BMenuField*				_CreateOptionMenuField();
48 			BMenuField*				_CreateCommandMenuField();
49 
50 			void					_MarkMenuItems();
51 			const char*				_KeyToString(int32 key);
52 			uint32					_KeyToKeyCode(int32 key,
53 										bool right = false);
54 			int32					_LastKey();
55 			void					_ValidateDuplicateKeys();
56 			uint32					_DuplicateKeys();
57 
58 			BPopUpMenu*				fShiftMenu;
59 			BPopUpMenu*				fControlMenu;
60 			BPopUpMenu*				fOptionMenu;
61 			BPopUpMenu*				fCommandMenu;
62 
63 			ConflictView*			fShiftConflictView;
64 			ConflictView*			fControlConflictView;
65 			ConflictView*			fOptionConflictView;
66 			ConflictView*			fCommandConflictView;
67 
68 			BButton*				fRevertButton;
69 			BButton*				fCancelButton;
70 			BButton*				fOkButton;
71 
72 			key_map*				fCurrentMap;
73 			key_map*				fSavedMap;
74 
75 			char*					fCurrentBuffer;
76 			char*					fSavedBuffer;
77 };
78 
79 
80 #endif	// MODIFIER_KEYS_WINDOW_H
81