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