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 <Window.h> 22 #include <MenuBar.h> 23 #include "KeymapTextView.h" 24 #include "Keymap.h" 25 26 class KeymapListItem; 27 28 class MapView : public BControl 29 { 30 public: 31 MapView(BRect rect, const char *name, Keymap *keymap); 32 void Draw(BRect rect); 33 void DrawKey(uint32 keyCode); 34 void DrawBorder(BRect borderRect); 35 void AttachedToWindow(); 36 void KeyDown(const char* bytes, int32 numBytes); 37 void KeyUp(const char* bytes, int32 numBytes); 38 void MessageReceived(BMessage *msg); 39 void SetFontFamily(const font_family family); 40 void MouseDown(BPoint point); 41 void MouseUp(BPoint point); 42 void MouseMoved(BPoint point, uint32 transit, const BMessage *msg); 43 void InvalidateKeys(); 44 void DrawLocks(); 45 private: 46 key_info fOldKeyInfo; 47 BRect fKeysRect[128]; 48 bool fKeysVertical[128]; 49 bool fKeysToDraw[128]; 50 uint8 fKeyState[16]; 51 BFont fCurrentFont; 52 53 Keymap *fCurrentMap; 54 KeymapTextView *fTextView; 55 uint32 fCurrentMouseKey; 56 uint8 fActiveDeadKey; // 0 : none, 1 : acute , ... 57 }; 58 59 60 class KeymapWindow : public BWindow { 61 public: 62 KeymapWindow(); 63 ~KeymapWindow(); 64 bool QuitRequested(); 65 void MessageReceived( BMessage* message ); 66 67 protected: 68 BListView *fSystemListView; 69 BListView *fUserListView; 70 // the map that's currently highlighted 71 BButton *fUseButton; 72 BButton *fRevertButton; 73 BMenu *fFontMenu; 74 75 MapView *fMapView; 76 77 BMenuBar *AddMenuBar(); 78 void AddMaps(BView *placeholderView); 79 void UseKeymap(); 80 81 void FillSystemMaps(); 82 void FillUserMaps(); 83 84 BEntry* CurrentMap(); 85 86 Keymap fCurrentMap; 87 88 BFilePanel *fOpenPanel; // the file panel to open 89 BFilePanel *fSavePanel; // the file panel to save 90 }; 91 92 #endif // KEYMAP_WINDOW_H 93