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 <Input.h> 15 #include <InterfaceDefs.h> 16 #include <Point.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(); 27 ~MouseSettings(); 28 29 void Revert(); 30 bool IsRevertable(); 31 void Defaults(); 32 bool IsDefaultable(); 33 void Dump(); 34 35 BPoint WindowPosition() const { return fWindowPosition; } 36 void SetWindowPosition(BPoint corner); 37 38 int32 MouseType() const { return fSettings.type; } 39 void SetMouseType(int32 type); 40 41 bigtime_t ClickSpeed() const; 42 void SetClickSpeed(bigtime_t click_speed); 43 44 int32 MouseSpeed() const { return fSettings.accel.speed; } 45 void SetMouseSpeed(int32 speed); 46 47 int32 AccelerationFactor() const { return fSettings.accel.accel_factor; } 48 void SetAccelerationFactor(int32 factor); 49 50 uint32 Mapping(int32 index) const; 51 void Mapping(mouse_map &map) const; 52 void SetMapping(int32 index, uint32 button); 53 void SetMapping(mouse_map &map); 54 55 mode_mouse MouseMode() const { return fMode; } 56 void SetMouseMode(mode_mouse mode); 57 58 mode_focus_follows_mouse FocusFollowsMouseMode() const { 59 return fFocusFollowsMouseMode; 60 } 61 void SetFocusFollowsMouseMode(mode_focus_follows_mouse mode); 62 63 bool AcceptFirstClick() const { return fAcceptFirstClick; } 64 void SetAcceptFirstClick(bool accept_first_click); 65 66 private: 67 static status_t _GetSettingsPath(BPath &path); 68 void _RetrieveSettings(); 69 status_t _SaveSettings(); 70 71 mouse_settings fSettings, fOriginalSettings; 72 mode_mouse fMode, fOriginalMode; 73 mode_focus_follows_mouse fFocusFollowsMouseMode; 74 mode_focus_follows_mouse fOriginalFocusFollowsMouseMode; 75 bool fAcceptFirstClick, fOriginalAcceptFirstClick; 76 BPoint fWindowPosition; 77 }; 78 79 #endif // MOUSE_SETTINGS_H 80