btrfs: Attempt to fix GCC2 build.
[haiku.git] / src / apps / switcher / LaunchButton.h
blobc9f95cf89c58a2776145e49029a6e0d5aff6707e
1 /*
2 * Copyright 2006-2011, Stephan Aßmus <superstippi@gmx.de>
3 * All rights reserved. Distributed under the terms of the MIT License.
4 */
5 #ifndef LAUNCH_BUTTON_H
6 #define LAUNCH_BUTTON_H
9 #include <IconButton.h>
10 #include <List.h>
11 #include <String.h>
14 enum {
15 MSG_ADD_SLOT = 'adsl',
16 MSG_CLEAR_SLOT = 'clsl',
17 MSG_REMOVE_SLOT = 'rmsl',
18 MSG_LAUNCH = 'lnch',
22 class LaunchButton : public BIconButton {
23 public:
24 LaunchButton(const char* name,
25 const char* label = NULL,
26 BMessage* message = NULL,
27 BHandler* target = NULL);
28 virtual ~LaunchButton();
30 // BIconButton interface
31 virtual void AttachedToWindow();
32 virtual void Draw(BRect updateRect);
33 virtual void MessageReceived(BMessage* message);
34 virtual void MouseDown(BPoint where);
35 virtual void MouseUp(BPoint where);
36 virtual void MouseMoved(BPoint where, uint32 transit,
37 const BMessage* dragMessage);
39 virtual BSize MinSize();
40 virtual BSize PreferredSize();
41 virtual BSize MaxSize();
43 // LaunchButton
44 void SetTo(const entry_ref* ref);
45 entry_ref* Ref() const;
47 void SetTo(const char* appSig, bool updateIcon);
48 const char* AppSignature() const
49 { return fAppSig; }
51 void SetDescription(const char* text);
52 const char* Description() const
53 { return fDescription.String(); }
55 void SetIconSize(uint32 size);
56 uint32 IconSize() const
57 { return fIconSize; }
59 static void SetIgnoreDoubleClick(bool refuse);
60 static bool IgnoreDoubleClick()
61 { return sIgnoreDoubleClick; }
63 private:
64 void _UpdateToolTip();
65 void _UpdateIcon(const entry_ref* ref);
67 void _DrawFrame(BRect frame,
68 rgb_color left, rgb_color top,
69 rgb_color right, rgb_color bottom);
71 private:
72 entry_ref* fRef;
73 char* fAppSig;
74 BString fDescription;
76 bool fAnticipatingDrop;
77 bigtime_t fLastClickTime;
78 BPoint fDragStart;
80 uint32 fIconSize;
82 static bigtime_t sClickSpeed;
83 static bool sIgnoreDoubleClick;
86 #endif // LAUNCH_BUTTON_H