Files
haiku-beta6/headers/os/interface/Button.h
T

113 lines
3.1 KiB
C++
Raw Normal View History

2009-03-24 13:26:56 +00:00
/*
2014-05-28 14:17:24 -04:00
* Copyright 2001-2014 Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT License.
2009-03-24 13:26:56 +00:00
*/
2002-07-09 12:24:59 +00:00
#ifndef _BUTTON_H
#define _BUTTON_H
2005-06-30 09:14:08 +00:00
2014-05-28 14:17:24 -04:00
2005-06-30 09:14:08 +00:00
#include <Control.h>
class BButton : public BControl {
public:
enum BBehavior {
B_BUTTON_BEHAVIOR,
B_TOGGLE_BEHAVIOR,
2013-12-30 04:42:52 +01:00
B_POP_UP_BEHAVIOR,
};
2002-07-09 12:24:59 +00:00
public:
2009-03-24 13:26:56 +00:00
BButton(BRect frame, const char* name,
const char* label, BMessage* message,
uint32 resizingMode
= B_FOLLOW_LEFT | B_FOLLOW_TOP,
uint32 flags = B_WILL_DRAW | B_NAVIGABLE
| B_FULL_UPDATE_ON_RESIZE);
BButton(const char* name, const char* label,
2014-05-28 14:17:24 -04:00
BMessage* message,
uint32 flags = B_WILL_DRAW | B_NAVIGABLE
| B_FULL_UPDATE_ON_RESIZE);
2009-03-24 13:26:56 +00:00
BButton(const char* label,
BMessage* message = NULL);
2014-05-28 14:17:24 -04:00
BButton(BMessage* data);
2005-06-30 09:14:08 +00:00
2009-03-24 13:26:56 +00:00
virtual ~BButton();
2005-06-30 09:14:08 +00:00
2014-05-28 14:17:24 -04:00
static BArchivable* Instantiate(BMessage* data);
virtual status_t Archive(BMessage* data, bool deep = true) const;
2005-06-30 09:14:08 +00:00
2009-03-24 13:26:56 +00:00
virtual void Draw(BRect updateRect);
2014-05-28 14:17:24 -04:00
virtual void MouseDown(BPoint where);
2009-03-24 13:26:56 +00:00
virtual void AttachedToWindow();
virtual void KeyDown(const char* bytes, int32 numBytes);
virtual void MakeDefault(bool flag);
virtual void SetLabel(const char* string);
bool IsDefault() const;
2013-12-29 00:02:35 +01:00
bool IsFlat() const;
void SetFlat(bool flat);
BBehavior Behavior() const;
void SetBehavior(BBehavior behavior);
2013-12-30 04:42:52 +01:00
BMessage* PopUpMessage() const;
void SetPopUpMessage(BMessage* message);
2009-03-24 13:26:56 +00:00
virtual void MessageReceived(BMessage* message);
virtual void WindowActivated(bool active);
2014-05-28 14:17:24 -04:00
virtual void MouseMoved(BPoint where, uint32 code,
const BMessage* dragMessage);
virtual void MouseUp(BPoint where);
2009-03-24 13:26:56 +00:00
virtual void DetachedFromWindow();
virtual void SetValue(int32 value);
virtual void GetPreferredSize (float* _width,
float* _height);
virtual void ResizeToPreferred();
virtual status_t Invoke(BMessage* message = NULL);
2014-05-28 14:17:24 -04:00
virtual void FrameMoved(BPoint newPosition);
2014-06-11 19:00:46 -04:00
virtual void FrameResized(float newWidth, float newHeight);
2009-03-24 13:26:56 +00:00
2014-06-11 19:00:46 -04:00
virtual void MakeFocus(bool focus = true);
2009-03-24 13:26:56 +00:00
virtual void AllAttached();
virtual void AllDetached();
2005-06-30 09:14:08 +00:00
2009-03-24 13:26:56 +00:00
virtual BHandler* ResolveSpecifier(BMessage* message,
int32 index, BMessage* specifier,
int32 what, const char* property);
virtual status_t GetSupportedSuites(BMessage* message);
virtual status_t Perform(perform_code d, void* arg);
2005-06-30 09:14:08 +00:00
2009-03-24 13:26:56 +00:00
virtual BSize MinSize();
virtual BSize MaxSize();
virtual BSize PreferredSize();
2006-08-26 16:21:15 +00:00
2013-12-22 02:31:47 +01:00
virtual status_t SetIcon(const BBitmap* icon, uint32 flags = 0);
protected:
virtual void LayoutInvalidated(bool descendants = false);
2005-06-30 09:14:08 +00:00
private:
2009-03-24 13:26:56 +00:00
virtual void _ReservedButton1();
virtual void _ReservedButton2();
virtual void _ReservedButton3();
2005-06-30 09:14:08 +00:00
2009-03-24 13:26:56 +00:00
BButton& operator=(const BButton &);
2005-06-30 09:14:08 +00:00
2009-03-24 13:26:56 +00:00
BSize _ValidatePreferredSize();
2013-12-29 00:02:35 +01:00
2013-12-30 04:42:52 +01:00
BRect _PopUpRect() const;
2013-12-29 00:02:35 +01:00
inline bool _Flag(uint32 flag) const;
inline bool _SetFlag(uint32 flag, bool set);
2005-06-30 09:14:08 +00:00
2013-12-29 00:02:35 +01:00
private:
2009-03-24 13:26:56 +00:00
BSize fPreferredSize;
2013-12-29 00:02:35 +01:00
uint32 fFlags;
BBehavior fBehavior;
2013-12-30 04:42:52 +01:00
BMessage* fPopUpMessage;
2005-06-30 09:14:08 +00:00
};
2002-07-09 12:24:59 +00:00
2014-05-28 14:17:24 -04:00
#endif // _BUTTON_H