vfs: check userland buffers before reading them.
[haiku.git] / src / preferences / mouse / MouseSettings.h
blobd5d1c805f2f2ef6a5333364e9dd9e7c5b04147f6
1 /*
2 * Copyright 2003-2009 Haiku Inc. All rights reserved.
3 * Distributed under the terms of the MIT License.
5 * Authors:
6 * Jérôme Duval,
7 * Axel Dörfler (axeld@pinc-software.de)
8 * Andrew McCall (mccall@digitalparadise.co.uk)
9 * Brecht Machiels (brecht@mos6581.org)
11 #ifndef MOUSE_SETTINGS_H
12 #define MOUSE_SETTINGS_H
15 #include <InterfaceDefs.h>
16 #include <Point.h>
17 #include <SupportDefs.h>
19 #include "kb_mouse_settings.h"
22 class BPath;
24 class MouseSettings {
25 public:
26 MouseSettings();
27 ~MouseSettings();
29 void Revert();
30 bool IsRevertable();
31 void Defaults();
32 bool IsDefaultable();
33 void Dump();
35 BPoint WindowPosition() const { return fWindowPosition; }
36 void SetWindowPosition(BPoint corner);
38 int32 MouseType() const { return fSettings.type; }
39 void SetMouseType(int32 type);
41 bigtime_t ClickSpeed() const;
42 void SetClickSpeed(bigtime_t click_speed);
44 int32 MouseSpeed() const { return fSettings.accel.speed; }
45 void SetMouseSpeed(int32 speed);
47 int32 AccelerationFactor() const { return fSettings.accel.accel_factor; }
48 void SetAccelerationFactor(int32 factor);
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);
55 mode_mouse MouseMode() const { return fMode; }
56 void SetMouseMode(mode_mouse mode);
58 mode_focus_follows_mouse FocusFollowsMouseMode() const {
59 return fFocusFollowsMouseMode;
61 void SetFocusFollowsMouseMode(mode_focus_follows_mouse mode);
63 bool AcceptFirstClick() const { return fAcceptFirstClick; }
64 void SetAcceptFirstClick(bool accept_first_click);
66 private:
67 static status_t _GetSettingsPath(BPath &path);
68 void _RetrieveSettings();
69 status_t _SaveSettings();
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;
79 #endif // MOUSE_SETTINGS_H