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: MouseSettings.h 10 // Authors: Jérôme Duval, 11 // Andrew McCall (mccall@digitalparadise.co.uk), 12 // Axel Dörfler (axeld@pinc-software.de) 13 // Description: Input Server 14 // Created: August 29, 2004 15 // 16 // ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ 17 18 #ifndef MOUSE_SETTINGS_H_ 19 #define MOUSE_SETTINGS_H_ 20 21 #include <InterfaceDefs.h> 22 #include <kb_mouse_settings.h> 23 #include <Path.h> 24 #include <SupportDefs.h> 25 26 27 class MouseSettings { 28 public: 29 MouseSettings(); 30 ~MouseSettings(); 31 32 void Defaults(); 33 void Dump(); 34 35 int32 MouseType() const { return fSettings.type; } 36 void SetMouseType(int32 type); 37 38 bigtime_t ClickSpeed() const; 39 void SetClickSpeed(bigtime_t click_speed); 40 41 int32 MouseSpeed() const { return fSettings.accel.speed; } 42 void SetMouseSpeed(int32 speed); 43 44 int32 AccelerationFactor() const 45 { return fSettings.accel.accel_factor; } 46 void SetAccelerationFactor(int32 factor); 47 48 uint32 Mapping(int32 index) const; 49 void Mapping(mouse_map &map) const; 50 void SetMapping(int32 index, uint32 button); 51 void SetMapping(mouse_map &map); 52 53 mode_mouse MouseMode() const { return fMode; } 54 void SetMouseMode(mode_mouse mode); 55 56 mode_focus_follows_mouse FocusFollowsMouseMode() const 57 { return fFocusFollowsMouseMode; } 58 void SetFocusFollowsMouseMode(mode_focus_follows_mouse mode); 59 60 bool AcceptFirstClick() const { return fAcceptFirstClick; } 61 void SetAcceptFirstClick(bool acceptFirstClick); 62 63 status_t SaveSettings(); 64 65 private: 66 static status_t GetSettingsPath(BPath &path); 67 void RetrieveSettings(); 68 69 mouse_settings fSettings, fOriginalSettings; 70 mode_mouse fMode, fOriginalMode; 71 mode_focus_follows_mouse fFocusFollowsMouseMode; 72 mode_focus_follows_mouse fOriginalFocusFollowsMouseMode; 73 bool fAcceptFirstClick; 74 bool fOriginalAcceptFirstClick; 75 }; 76 77 #endif 78