1 /* 2 * Copyright 2011-2023 Haiku, Inc. All rights reserved. 3 * Distributed under the terms of the MIT License. 4 * 5 * Authors: 6 * John Scipione, jscipione@gmail.com 7 * Jorge Acereda, jacereda@gmail.com 8 */ 9 #ifndef MODIFIER_KEYS_WINDOW_H 10 #define MODIFIER_KEYS_WINDOW_H 11 12 13 #include <View.h> 14 #include <Window.h> 15 16 17 class BMenuField; 18 class BPopUpMenu; 19 20 21 class ConflictView : public BView { 22 public: 23 ConflictView(const char* name); 24 ~ConflictView(); 25 26 virtual void Draw(BRect updateRect); 27 28 BBitmap* Icon(); 29 void SetStopIcon(bool show); 30 void SetWarnIcon(bool show); 31 32 private: 33 void _FillIcons(); 34 35 BBitmap* fIcon; 36 BBitmap* fStopIcon; 37 BBitmap* fWarnIcon; 38 }; 39 40 41 class ModifierKeysWindow : public BWindow { 42 public: 43 ModifierKeysWindow(); 44 virtual ~ModifierKeysWindow(); 45 46 virtual void MessageReceived(BMessage* message); 47 48 private: 49 void _CreateMenuField( 50 BPopUpMenu** outMenu, BMenuField** outField, 51 uint32 inKey, const char* comment); 52 53 void _MarkMenuItems(); 54 void _MarkMenuItem(BPopUpMenu* menu, ConflictView* conflictView, 55 uint32 leftKey, uint32 rightKey); 56 const char* _KeyToString(int32 key); 57 uint32 _KeyToKeyCode(int32 key, 58 bool right = false); 59 int32 _LastKey(); 60 void _ValidateDuplicateKeys(); 61 void _ValidateDuplicateKey(ConflictView* view, uint32 mask); 62 uint32 _DuplicateKeys(); 63 64 BPopUpMenu* fCapsMenu; 65 BPopUpMenu* fShiftMenu; 66 BPopUpMenu* fControlMenu; 67 BPopUpMenu* fOptionMenu; 68 BPopUpMenu* fCommandMenu; 69 70 ConflictView* fCapsConflictView; 71 ConflictView* fShiftConflictView; 72 ConflictView* fControlConflictView; 73 ConflictView* fOptionConflictView; 74 ConflictView* fCommandConflictView; 75 76 BButton* fRevertButton; 77 BButton* fCancelButton; 78 BButton* fOkButton; 79 80 key_map* fCurrentMap; 81 key_map* fSavedMap; 82 83 char* fCurrentBuffer; 84 char* fSavedBuffer; 85 }; 86 87 88 #endif // MODIFIER_KEYS_WINDOW_H 89