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',
19 MSG_OPEN_CONTAINING_FOLDER
= 'opcf',
23 class LaunchButton
: public BIconButton
{
25 LaunchButton(const char* name
,
26 const char* label
= NULL
,
27 BMessage
* message
= NULL
,
28 BHandler
* target
= NULL
);
29 virtual ~LaunchButton();
31 // BIconButton interface
32 virtual void AttachedToWindow();
33 virtual void Draw(BRect updateRect
);
34 virtual void MessageReceived(BMessage
* message
);
35 virtual void MouseDown(BPoint where
);
36 virtual void MouseUp(BPoint where
);
37 virtual void MouseMoved(BPoint where
, uint32 transit
,
38 const BMessage
* dragMessage
);
40 virtual BSize
MinSize();
41 virtual BSize
PreferredSize();
42 virtual BSize
MaxSize();
45 void SetTo(const entry_ref
* ref
);
46 entry_ref
* Ref() const;
48 void SetTo(const char* appSig
, bool updateIcon
);
49 const char* AppSignature() const
52 void SetDescription(const char* text
);
53 const char* Description() const
54 { return fDescription
.String(); }
56 void SetIconSize(uint32 size
);
57 uint32
IconSize() const
60 static void SetIgnoreDoubleClick(bool refuse
);
61 static bool IgnoreDoubleClick()
62 { return sIgnoreDoubleClick
; }
65 void _UpdateToolTip();
66 void _UpdateIcon(const entry_ref
* ref
);
68 void _NotifySettingsChanged();
70 void _DrawFrame(BRect frame
,
71 rgb_color left
, rgb_color top
,
72 rgb_color right
, rgb_color bottom
);
79 bool fAnticipatingDrop
;
80 bigtime_t fLastClickTime
;
85 static bigtime_t sClickSpeed
;
86 static bool sIgnoreDoubleClick
;
89 #endif // LAUNCH_BUTTON_H