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