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