xref: /haiku/src/preferences/input/InputDeviceView.h (revision 4a55cc230cf7566cadcbb23b1928eefff8aea9a2)
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 _INPUT_DEVICE_VIEW_H
11 #define _INPUT_DEVICE_VIEW_H
12 
13 #include <ListItem.h>
14 #include <ListView.h>
15 #include <Message.h>
16 #include <ScrollBar.h>
17 #include <ScrollView.h>
18 #include <String.h>
19 #include <StringItem.h>
20 #include <View.h>
21 
22 #include "InputIcons.h"
23 #include "InputTouchpadPref.h"
24 #include "MouseSettings.h"
25 
26 
27 #define ITEM_SELECTED 'I1s'
28 
29 #define kITEM_MARGIN	1
30 #define GREATER_THAN	-1
31 #define LESS_THAN	1
32 
33 
34 class InputIcons;
35 class TouchpadPref;
36 class MouseSettings;
37 
38 enum input_type {
39 	MOUSE_TYPE,
40 	TOUCHPAD_TYPE,
41 	KEYBOARD_TYPE
42 };
43 
44 class DeviceListItemView : public BListItem {
45 public:
46 						DeviceListItemView(BString title, input_type type);
47 
48 	void				Update(BView* owner, const BFont* font);
49 	void				DrawItem(BView* owner, BRect frame,
50 						bool complete = false);
51 
52 	const char*			Label() { return fTitle.String();}
53 
54 
55 	static	InputIcons*	Icons() { return sIcons; }
56 	static	void		SetIcons(InputIcons* icons) { sIcons = icons; }
57 
58 protected:
59 	struct Renderer;
60 
61 	void				SetRenderParameters(Renderer& renderer);
62 
63 private:
64 	static InputIcons*	sIcons;
65 	BString				fTitle;
66 	input_type			fInputType;
67 };
68 
69 
70 #endif	// _INPUT_DEVICE_VIEW_H */
71