2 * Copyright 2008-2013 Haiku, Inc. All rights reserved.
3 * Distributed under the terms of the MIT License.
6 * John Scipione, jscipione@gmail.com
7 * Clemens Zeidler, haiku@Clemens-Zeidler.de
9 #ifndef TOUCHPAD_PREF_VIEW_H
10 #define TOUCHPAD_PREF_VIEW_H
19 #include <GroupView.h>
21 #include "TouchpadPref.h"
22 #include "touchpad_settings.h"
27 # define LOG(text...) PRINT((text))
32 const uint SCROLL_AREA_CHANGED
= '&sac';
33 const uint SCROLL_CONTROL_CHANGED
= '&scc';
34 const uint TAP_CONTROL_CHANGED
= '&tcc';
35 const uint DEFAULT_SETTINGS
= '&dse';
36 const uint REVERT_SETTINGS
= '&rse';
40 class TouchpadView
: public BView
, public BInvoker
{
42 TouchpadView(BRect frame
);
43 virtual ~TouchpadView();
44 virtual void Draw(BRect updateRect
);
45 virtual void MouseDown(BPoint point
);
46 virtual void MouseUp(BPoint point
);
47 virtual void MouseMoved(BPoint point
, uint32 transit
,
48 const BMessage
* dragMessage
);
50 virtual void AttachedToWindow();
51 virtual void GetPreferredSize(float* width
, float* height
);
53 void SetValues(float rightRange
, float bottomRange
);
54 float GetRightScrollRatio()
55 { return 1 - fXScrollRange
/ fPadRect
.Width(); }
56 float GetBottomScrollRatio()
58 - fYScrollRange
/ fPadRect
.Height(); }
60 virtual void DrawSliders();
64 BRect fXScrollDragZone
;
65 BRect fXScrollDragZone1
;
66 BRect fXScrollDragZone2
;
68 float fOldXScrollRange
;
69 BRect fYScrollDragZone
;
70 BRect fYScrollDragZone1
;
71 BRect fYScrollDragZone2
;
73 float fOldYScrollRange
;
77 BView
* fOffScreenView
;
78 BBitmap
* fOffScreenBitmap
;
82 class TouchpadPrefView
: public BGroupView
{
85 virtual ~TouchpadPrefView();
86 virtual void MessageReceived(BMessage
* message
);
87 virtual void AttachedToWindow();
88 virtual void DetachedFromWindow();
91 void SetValues(touchpad_settings
*settings
);
94 TouchpadView
* fTouchpadView
;
95 BCheckBox
* fTwoFingerBox
;
96 BCheckBox
* fTwoFingerHorizontalBox
;
97 BSlider
* fScrollStepXSlider
;
98 BSlider
* fScrollStepYSlider
;
99 BSlider
* fScrollAccelSlider
;
101 BButton
* fDefaultButton
;
102 BButton
* fRevertButton
;
104 TouchpadPref fTouchpadPref
;
108 #endif // TOUCHPAD_PREF_VIEW_H