2 * Copyright 2001-2015, Haiku, Inc. All rights reserved.
3 * Distributed under the terms of the MIT License.
5 #ifndef _PICTURE_BUTTON_H
6 #define _PICTURE_BUTTON_H
19 class BPictureButton
: public BControl
{
21 BPictureButton(BRect frame
, const char* name
,
22 BPicture
* off
, BPicture
* on
,
24 uint32 behavior
= B_ONE_STATE_BUTTON
,
25 uint32 resizingMode
= B_FOLLOW_LEFT_TOP
,
26 uint32 flgs
= B_WILL_DRAW
| B_NAVIGABLE
);
27 BPictureButton(BMessage
* archive
);
29 virtual ~BPictureButton();
31 static BArchivable
* Instantiate(BMessage
* archive
);
32 virtual status_t
Archive(BMessage
* archive
,
33 bool deep
= true) const;
35 virtual void AttachedToWindow();
36 virtual void DetachedFromWindow();
37 virtual void AllAttached();
38 virtual void AllDetached();
40 virtual void ResizeToPreferred();
41 virtual void GetPreferredSize(float* _width
,
43 virtual void FrameMoved(BPoint newPosition
);
44 virtual void FrameResized(float newWidth
, float newHeight
);
46 virtual void WindowActivated(bool active
);
47 virtual void MakeFocus(bool focus
= true);
49 virtual void Draw(BRect updateRect
);
51 virtual void MessageReceived(BMessage
* message
);
52 virtual void KeyDown(const char* bytes
, int32 numBytes
);
53 virtual void MouseDown(BPoint where
);
54 virtual void MouseUp(BPoint where
);
55 virtual void MouseMoved(BPoint where
, uint32 code
,
56 const BMessage
* dragMessage
);
58 virtual void SetEnabledOn(BPicture
* picture
);
59 virtual void SetEnabledOff(BPicture
* picture
);
60 virtual void SetDisabledOn(BPicture
* picture
);
61 virtual void SetDisabledOff(BPicture
* picture
);
63 BPicture
* EnabledOn() const;
64 BPicture
* EnabledOff() const;
65 BPicture
* DisabledOn() const;
66 BPicture
* DisabledOff() const;
68 virtual void SetBehavior(uint32 behavior
);
69 uint32
Behavior() const;
71 virtual void SetValue(int32 value
);
72 virtual status_t
Invoke(BMessage
* message
= NULL
);
74 virtual BHandler
* ResolveSpecifier(BMessage
* message
,
75 int32 index
, BMessage
* specifier
,
76 int32 what
, const char* property
);
77 virtual status_t
GetSupportedSuites(BMessage
* data
);
79 virtual status_t
Perform(perform_code code
, void* data
);
81 virtual status_t
SetIcon(const BBitmap
* icon
, uint32 flags
= 0);
84 // FBC padding and forbidden methods
85 virtual void _ReservedPictureButton1();
86 virtual void _ReservedPictureButton2();
87 virtual void _ReservedPictureButton3();
89 BPictureButton
& operator=(const BPictureButton
& other
);
92 BPicture
* fEnabledOff
;
94 BPicture
* fDisabledOff
;
95 BPicture
* fDisabledOn
;
104 #endif // _PICTURE_BUTTON_H