1 // ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ 2 // 3 // Copyright (c) 2004, Haiku 4 // 5 // This software is part of the Haiku distribution and is covered 6 // by the Haiku license. 7 // 8 // 9 // File: KeymapWindow.h 10 // Author: Sandor Vroemisse, Jérôme Duval 11 // Description: Keymap Preferences 12 // Created : July 12, 2004 13 // 14 // ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ 15 16 #ifndef KEYMAP_WINDOW_H 17 #define KEYMAP_WINDOW_H 18 19 #include <Control.h> 20 #include <FilePanel.h> 21 #include <ListView.h> 22 #include <Window.h> 23 #include <MenuBar.h> 24 #include "KeymapTextView.h" 25 #include "Keymap.h" 26 27 class KeymapListItem; 28 29 class MapView : public BControl 30 { 31 public: 32 MapView(BRect rect, const char *name, Keymap *keymap); 33 void Draw(BRect rect); 34 void DrawKey(uint32 keyCode); 35 void DrawBorder(BRect borderRect); 36 void AttachedToWindow(); 37 void KeyDown(const char* bytes, int32 numBytes); 38 void KeyUp(const char* bytes, int32 numBytes); 39 void MessageReceived(BMessage *msg); 40 void SetFontFamily(const font_family family); 41 void MouseDown(BPoint point); 42 void MouseUp(BPoint point); 43 void MouseMoved(BPoint point, uint32 transit, const BMessage *msg); 44 void InvalidateKeys(); 45 void DrawLocks(); 46 private: 47 key_info fOldKeyInfo; 48 BRect fKeysRect[128]; 49 bool fKeysVertical[128]; 50 bool fKeysToDraw[128]; 51 uint8 fKeyState[16]; 52 BFont fCurrentFont; 53 54 Keymap *fCurrentMap; 55 KeymapTextView *fTextView; 56 uint32 fCurrentMouseKey; 57 uint8 fActiveDeadKey; // 0 : none, 1 : acute , ... 58 }; 59 60 61 class KeymapWindow : public BWindow { 62 public: 63 KeymapWindow(); 64 ~KeymapWindow(); 65 bool QuitRequested(); 66 void MessageReceived( BMessage* message ); 67 68 protected: 69 BListView *fSystemListView; 70 BListView *fUserListView; 71 // the map that's currently highlighted 72 BButton *fUseButton; 73 BButton *fRevertButton; 74 BMenu *fFontMenu; 75 76 MapView *fMapView; 77 78 BMenuBar *AddMenuBar(); 79 void AddMaps(BView *placeholderView); 80 void UseKeymap(); 81 82 void FillSystemMaps(); 83 void FillUserMaps(); 84 85 BEntry* CurrentMap(); 86 87 Keymap fCurrentMap; 88 89 BFilePanel *fOpenPanel; // the file panel to open 90 BFilePanel *fSavePanel; // the file panel to save 91 }; 92 93 #endif // KEYMAP_WINDOW_H 94