1/*
2 * Copyright 2011-2014 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 <View.h>
13#include <Window.h>
14
15
16class BMenuField;
17class BPopUpMenu;
18
19
20class ConflictView : public BView {
21public:
22								ConflictView(const char* name);
23								~ConflictView();
24
25	virtual	void				Draw(BRect updateRect);
26
27			BBitmap*			Icon();
28			void				SetStopIcon(bool show);
29			void				SetWarnIcon(bool show);
30
31private:
32			void				_FillIcons();
33
34			BBitmap*			fIcon;
35			BBitmap*			fStopIcon;
36			BBitmap*			fWarnIcon;
37};
38
39
40class ModifierKeysWindow : public BWindow {
41public:
42									ModifierKeysWindow();
43	virtual							~ModifierKeysWindow();
44
45	virtual	void					MessageReceived(BMessage* message);
46
47private:
48			BMenuField*				_CreateShiftMenuField();
49			BMenuField*				_CreateControlMenuField();
50			BMenuField*				_CreateOptionMenuField();
51			BMenuField*				_CreateCommandMenuField();
52
53			void					_MarkMenuItems();
54			const char*				_KeyToString(int32 key);
55			uint32					_KeyToKeyCode(int32 key,
56										bool right = false);
57			int32					_LastKey();
58			void					_ValidateDuplicateKeys();
59			uint32					_DuplicateKeys();
60			void					_HideShowIcons();
61
62			BPopUpMenu*				fShiftMenu;
63			BPopUpMenu*				fControlMenu;
64			BPopUpMenu*				fOptionMenu;
65			BPopUpMenu*				fCommandMenu;
66
67			ConflictView*			fShiftConflictView;
68			ConflictView*			fControlConflictView;
69			ConflictView*			fOptionConflictView;
70			ConflictView*			fCommandConflictView;
71
72			BButton*				fRevertButton;
73			BButton*				fCancelButton;
74			BButton*				fOkButton;
75
76			key_map*				fCurrentMap;
77			key_map*				fSavedMap;
78
79			char*					fCurrentBuffer;
80			char*					fSavedBuffer;
81};
82
83
84#endif	// MODIFIER_KEYS_WINDOW_H
85