1 /* 2 * Copyright 2019, Haiku, Inc. 3 * Distributed under the terms of the MIT License. 4 * 5 * Author: 6 * Preetpal Kaur <preetpalok123@gmail.com> 7 */ 8 9 10 #ifndef MOUSE_SETTINGS_H 11 #define MOUSE_SETTINGS_H 12 13 14 #include <map> 15 16 #include <String.h> 17 #include <SupportDefs.h> 18 19 #include "kb_mouse_settings.h" 20 21 22 class BPath; 23 24 class MouseSettings { 25 public: 26 MouseSettings(BString name); 27 ~MouseSettings(); 28 29 void Revert(); 30 bool IsRevertable() const; 31 void Defaults(); 32 bool IsDefaultable() const; 33 34 int32 MouseType() const { return fSettings.type; } 35 void SetMouseType(int32 type); 36 37 bigtime_t ClickSpeed() const; 38 void SetClickSpeed(bigtime_t click_speed); 39 40 int32 MouseSpeed() const { return fSettings.accel.speed; } 41 void SetMouseSpeed(int32 speed); 42 43 int32 AccelerationFactor() const { return fSettings.accel.accel_factor; } 44 void SetAccelerationFactor(int32 factor); 45 46 uint32 Mapping(int32 index) const; 47 void Mapping(mouse_map &map) const; 48 void SetMapping(int32 index, uint32 button); 49 void SetMapping(mouse_map &map); 50 51 mode_mouse MouseMode() const { return fMode; } 52 void SetMouseMode(mode_mouse mode); 53 54 mode_focus_follows_mouse FocusFollowsMouseMode() const { 55 return fFocusFollowsMouseMode; 56 } 57 void SetFocusFollowsMouseMode(mode_focus_follows_mouse mode); 58 59 bool AcceptFirstClick() const { return fAcceptFirstClick; } 60 void SetAcceptFirstClick(bool accept_first_click); 61 62 mouse_settings* GetSettings(); 63 64 private: 65 status_t _RetrieveSettings(); 66 67 private: 68 BString fName; 69 mode_mouse fMode, fOriginalMode; 70 mode_focus_follows_mouse fFocusFollowsMouseMode; 71 mode_focus_follows_mouse fOriginalFocusFollowsMouseMode; 72 bool fAcceptFirstClick; 73 bool fOriginalAcceptFirstClick; 74 75 mouse_settings fSettings, fOriginalSettings; 76 }; 77 78 79 class MultipleMouseSettings 80 { 81 public: 82 MultipleMouseSettings(); 83 ~MultipleMouseSettings(); 84 85 MouseSettings* AddMouseSettings(BString mouse_name); 86 87 private: 88 typedef std::map<BString, MouseSettings*> mouse_settings_object; 89 mouse_settings_object fMouseSettingsObject; 90 }; 91 92 #endif // MOUSE_SETTINGS_H 93