vfs: check userland buffers before reading them.
[haiku.git] / src / preferences / keymap / KeymapWindow.h
blobbde6fe90ec3439b3d7bd3c1aac613539c63cd120
1 /*
2 * Copyright 2004-2014 Haiku, Inc. All rights reserved.
3 * Distributed under the terms of the MIT License.
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
12 #ifndef KEYMAP_WINDOW_H
13 #define KEYMAP_WINDOW_H
16 #include <FilePanel.h>
17 #include <ListView.h>
18 #include <String.h>
19 #include <Window.h>
21 #include "Keymap.h"
24 class BMenu;
25 class BMenuBar;
26 class BMenuField;
27 class BTextControl;
28 class KeyboardLayoutView;
29 class KeymapListItem;
32 class KeymapWindow : public BWindow {
33 public:
34 KeymapWindow();
35 virtual ~KeymapWindow();
37 virtual bool QuitRequested();
38 virtual void MessageReceived(BMessage* message);
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);
50 void _UpdateSwitchShortcutButton();
51 void _UpdateButtons();
52 void _SwitchShortcutKeys();
54 void _UseKeymap();
55 void _DefaultKeymap();
56 void _RevertKeymap();
58 BMenuField* _CreateDeadKeyMenuField();
59 void _UpdateDeadKeyMenu();
61 void _FillSystemMaps();
62 void _FillUserMaps();
63 void _SetListViewSize(BListView* listView);
65 status_t _GetCurrentKeymap(entry_ref& ref);
66 BString _GetActiveKeymapName();
67 bool _SelectCurrentMap(BListView* list);
68 void _SelectCurrentMap();
70 status_t _GetSettings(BFile& file, int mode) const;
71 status_t _LoadSettings(BRect& frame);
72 status_t _SaveSettings();
73 BPath _GetMarkedKeyboardLayoutPath(BMenu* menu);
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;
91 Keymap fCurrentMap;
92 Keymap fPreviousMap;
93 Keymap fAppliedMap;
94 BString fCurrentMapName;
96 BFilePanel* fOpenPanel;
97 BFilePanel* fSavePanel;
100 #endif // KEYMAP_WINDOW_H