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 virtual ~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 void _AddKeyboardLayoutMenu(BMenu* menu, 44 BDirectory directory); 45 status_t _SetKeyboardLayout(const char* path); 46 void _MarkKeyboardLayoutItem(const char* path, 47 BMenu* menu); 48 49 void _UpdateSwitchShortcutButton(); 50 void _UpdateButtons(); 51 void _SwitchShortcutKeys(); 52 53 void _UseKeymap(); 54 void _DefaultKeymap(); 55 void _RevertKeymap(); 56 57 BMenuField* _CreateDeadKeyMenuField(); 58 void _UpdateDeadKeyMenu(); 59 60 void _FillSystemMaps(); 61 void _FillUserMaps(); 62 void _SetListViewSize(BListView* listView); 63 64 status_t _GetCurrentKeymap(entry_ref& ref); 65 BString _GetActiveKeymapName(); 66 bool _SelectCurrentMap(BListView *list); 67 void _SelectCurrentMap(); 68 69 status_t _GetSettings(BFile& file, int mode) const; 70 status_t _LoadSettings(BRect& frame, 71 BString& keyboardLayout); 72 status_t _SaveSettings(); 73 BPath _GetMarkedKeyboardLayoutPath(BMenu* menu); 74 75 private: 76 BListView* fSystemListView; 77 BListView* fUserListView; 78 BButton* fDefaultsButton; 79 BButton* fRevertButton; 80 BMenu* fLayoutMenu; 81 BMenu* fFontMenu; 82 KeyboardLayoutView* fKeyboardLayoutView; 83 BTextControl* fTextControl; 84 BButton* fSwitchShortcutsButton; 85 BMenu* fAcuteMenu; 86 BMenu* fCircumflexMenu; 87 BMenu* fDiaeresisMenu; 88 BMenu* fGraveMenu; 89 BMenu* fTildeMenu; 90 91 Keymap fCurrentMap; 92 Keymap fPreviousMap; 93 Keymap fAppliedMap; 94 BString fCurrentMapName; 95 96 BFilePanel* fOpenPanel; 97 BFilePanel* fSavePanel; 98 }; 99 100 #endif // KEYMAP_WINDOW_H 101