xref: /haiku/src/preferences/keymap/KeymapWindow.h (revision 9760dcae2038d47442f4658c2575844c6cf92c40)
1 /*
2  * Copyright 2004-2009 Haiku Inc. All rights reserved.
3  * Distributed under the terms of the MIT License.
4  *
5  * Authors:
6  *		Sandor Vroemisse
7  *		Jérôme Duval
8  *		Alexandre Deckner, alex@zappotek.com
9  *		Axel Dörfler, axeld@pinc-software.de.
10  */
11 #ifndef KEYMAP_WINDOW_H
12 #define KEYMAP_WINDOW_H
13 
14 
15 #include <FilePanel.h>
16 #include <ListView.h>
17 #include <String.h>
18 #include <Window.h>
19 
20 #include "Keymap.h"
21 
22 
23 class BMenu;
24 class BMenuBar;
25 class BMenuField;
26 class BTextControl;
27 class KeyboardLayoutView;
28 class KeymapListItem;
29 
30 
31 class KeymapWindow : public BWindow {
32 public:
33 								KeymapWindow();
34 								~KeymapWindow();
35 
36 	virtual	bool				QuitRequested();
37 	virtual void				MessageReceived(BMessage* message);
38 
39 protected:
40 			BMenuBar*			_CreateMenu();
41 			BView*				_CreateMapLists();
42 			void				_AddKeyboardLayouts(BMenu* menu);
43 			status_t			_SetKeyboardLayout(const char* path);
44 
45 			void				_UpdateSwitchShortcutButton();
46 			void				_UpdateButtons();
47 			void				_SwitchShortcutKeys();
48 
49 			void				_UseKeymap();
50 			void				_RevertKeymap();
51 
52 			BMenuField*			_CreateDeadKeyMenuField();
53 			void				_UpdateDeadKeyMenu();
54 
55 			void 				_FillSystemMaps();
56 			void				_FillUserMaps();
57 			void				_SetListViewSize(BListView* listView);
58 
59 			status_t			_GetCurrentKeymap(entry_ref& ref);
60 			BString				_GetActiveKeymapName();
61 			bool				_SelectCurrentMap(BListView *list);
62 			void				_SelectCurrentMap();
63 
64 			status_t			_GetSettings(BFile& file, int mode) const;
65 			status_t			_LoadSettings(BRect& frame,
66 									BString& keyboardLayout);
67 			status_t			_SaveSettings() const;
68 
69 private:
70 			BListView*			fSystemListView;
71 			BListView*			fUserListView;
72 			BButton*			fRevertButton;
73 			BMenu*				fLayoutMenu;
74 			BMenu*				fFontMenu;
75 			KeyboardLayoutView*	fKeyboardLayoutView;
76 			BTextControl*		fTextControl;
77 			BButton*			fSwitchShortcutsButton;
78 			BMenu*				fAcuteMenu;
79 			BMenu*				fCircumflexMenu;
80 			BMenu*				fDiaeresisMenu;
81 			BMenu*				fGraveMenu;
82 			BMenu*				fTildeMenu;
83 
84 			Keymap				fCurrentMap;
85 			Keymap				fPreviousMap;
86 			Keymap				fAppliedMap;
87 			BString				fCurrentMapName;
88 
89 			BFilePanel*			fOpenPanel;
90 			BFilePanel*			fSavePanel;
91 };
92 
93 #endif	// KEYMAP_WINDOW_H
94