xref: /haiku/src/apps/launchbox/PadView.h (revision b518478165347c53b31b3242490f9e8dfd4bd35b)
1 /*
2  * Copyright 2006 - 2009, Stephan Aßmus <superstippi@gmx.de>
3  * All rights reserved. Distributed under the terms of the MIT License.
4  */
5 #ifndef PAD_VIEW_H
6 #define PAD_VIEW_H
7 
8 #include <View.h>
9 
10 class BGroupLayout;
11 class LaunchButton;
12 
13 #define DEFAULT_ICON_SIZE 32
14 
15 class PadView : public BView {
16 public:
17 								PadView(const char* name);
18 	virtual						~PadView();
19 
20 	// BView interface
21 	virtual	void				Draw(BRect updateRect);
22 	virtual	void				MessageReceived(BMessage* message);
23 	virtual	void				MouseDown(BPoint where);
24 	virtual	void				MouseUp(BPoint where);
25 	virtual	void				MouseMoved(BPoint where, uint32 transit,
26 									const BMessage* dragMessage);
27 
28 	// PadView
29 			void				AddButton(LaunchButton* button,
30 									LaunchButton* beforeButton = NULL);
31 			bool				RemoveButton(LaunchButton* button);
32 			LaunchButton*		ButtonAt(int32 index) const;
33 
34 			void				DisplayMenu(BPoint where,
35 									LaunchButton* button = NULL) const;
36 
37 			void				SetOrientation(enum orientation orientation);
38 			enum orientation	Orientation() const;
39 
40 			void				SetIconSize(uint32 size);
41 			uint32				IconSize() const;
42 
43 private:
44 			BPoint				fDragOffset;
45 			bool				fDragging;
46 			bigtime_t			fClickTime;
47 			BGroupLayout*		fButtonLayout;
48 			uint32				fIconSize;
49 };
50 
51 #endif // PAD_VIEW_H
52