2 * Copyright 2006-2011, Stephan Aßmus <superstippi@gmx.de>
3 * All rights reserved. Distributed under the terms of the MIT License.
5 #ifndef LAUNCH_BUTTON_H
6 #define LAUNCH_BUTTON_H
9 #include <IconButton.h>
15 MSG_ADD_SLOT
= 'adsl',
16 MSG_CLEAR_SLOT
= 'clsl',
17 MSG_REMOVE_SLOT
= 'rmsl',
22 class LaunchButton
: public BIconButton
{
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();
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
51 void SetDescription(const char* text
);
52 const char* Description() const
53 { return fDescription
.String(); }
55 void SetIconSize(uint32 size
);
56 uint32
IconSize() const
59 static void SetIgnoreDoubleClick(bool refuse
);
60 static bool IgnoreDoubleClick()
61 { return sIgnoreDoubleClick
; }
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
);
76 bool fAnticipatingDrop
;
77 bigtime_t fLastClickTime
;
82 static bigtime_t sClickSpeed
;
83 static bool sIgnoreDoubleClick
;
86 #endif // LAUNCH_BUTTON_H