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