2009-03-24 16:26:56 +03:00
|
|
|
/*
|
2009-08-27 15:12:41 +04:00
|
|
|
* Copyright 2001-2009, Haiku, Inc. All rights reserved.
|
|
|
|
* Distributed under the terms of the MIT License.
|
2009-03-24 16:26:56 +03:00
|
|
|
*/
|
2002-07-09 16:24:59 +04:00
|
|
|
#ifndef _BUTTON_H
|
|
|
|
#define _BUTTON_H
|
2005-06-30 13:14:08 +04:00
|
|
|
|
|
|
|
#include <Control.h>
|
|
|
|
|
|
|
|
|
|
|
|
class BButton : public BControl {
|
2002-07-09 16:24:59 +04:00
|
|
|
public:
|
2009-03-24 16:26:56 +03: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,
|
|
|
|
BMessage *message,
|
|
|
|
uint32 flags = B_WILL_DRAW | B_NAVIGABLE
|
|
|
|
| B_FULL_UPDATE_ON_RESIZE);
|
|
|
|
BButton(const char* label,
|
|
|
|
BMessage* message = NULL);
|
2005-06-30 13:14:08 +04:00
|
|
|
|
2009-03-24 16:26:56 +03:00
|
|
|
BButton(BMessage *archive);
|
2005-06-30 13:14:08 +04:00
|
|
|
|
2009-03-24 16:26:56 +03:00
|
|
|
virtual ~BButton();
|
2005-06-30 13:14:08 +04:00
|
|
|
|
2009-03-24 16:26:56 +03:00
|
|
|
static BArchivable* Instantiate(BMessage* archive);
|
|
|
|
virtual status_t Archive(BMessage* archive,
|
|
|
|
bool deep = true) const;
|
2005-06-30 13:14:08 +04:00
|
|
|
|
2009-03-24 16:26:56 +03:00
|
|
|
virtual void Draw(BRect updateRect);
|
|
|
|
virtual void MouseDown(BPoint point);
|
|
|
|
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;
|
|
|
|
|
|
|
|
virtual void MessageReceived(BMessage* message);
|
|
|
|
virtual void WindowActivated(bool active);
|
|
|
|
virtual void MouseMoved(BPoint point, uint32 transit,
|
|
|
|
const BMessage* message);
|
|
|
|
virtual void MouseUp(BPoint point);
|
|
|
|
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);
|
|
|
|
virtual void FrameMoved(BPoint newLocation);
|
|
|
|
virtual void FrameResized(float width, float height);
|
|
|
|
|
|
|
|
virtual void MakeFocus(bool focused = true);
|
|
|
|
virtual void AllAttached();
|
|
|
|
virtual void AllDetached();
|
2005-06-30 13:14:08 +04:00
|
|
|
|
2009-03-24 16:26:56 +03: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 13:14:08 +04:00
|
|
|
|
2007-06-09 14:51:15 +04:00
|
|
|
|
2009-03-24 16:26:56 +03:00
|
|
|
virtual BSize MinSize();
|
|
|
|
virtual BSize MaxSize();
|
|
|
|
virtual BSize PreferredSize();
|
2006-08-26 20:21:15 +04:00
|
|
|
|
|
|
|
|
2011-10-21 05:18:22 +04:00
|
|
|
protected:
|
|
|
|
virtual void LayoutInvalidated(bool descendants = false);
|
|
|
|
|
2005-06-30 13:14:08 +04:00
|
|
|
private:
|
2009-03-24 16:26:56 +03:00
|
|
|
virtual void _ReservedButton1();
|
|
|
|
virtual void _ReservedButton2();
|
|
|
|
virtual void _ReservedButton3();
|
2005-06-30 13:14:08 +04:00
|
|
|
|
2009-03-24 16:26:56 +03:00
|
|
|
private:
|
|
|
|
BButton& operator=(const BButton &);
|
2005-06-30 13:14:08 +04:00
|
|
|
|
2009-03-24 16:26:56 +03:00
|
|
|
BSize _ValidatePreferredSize();
|
|
|
|
|
|
|
|
BRect _DrawDefault(BRect bounds, bool enabled);
|
|
|
|
void _DrawFocusLine(float x, float y, float width,
|
|
|
|
bool bVisible);
|
2005-06-30 13:14:08 +04:00
|
|
|
|
2009-03-24 16:26:56 +03:00
|
|
|
BSize fPreferredSize;
|
|
|
|
bool fDrawAsDefault;
|
2005-06-30 13:14:08 +04:00
|
|
|
|
2009-03-24 16:26:56 +03:00
|
|
|
uint32 _reserved[2];
|
2005-06-30 13:14:08 +04:00
|
|
|
};
|
2002-07-09 16:24:59 +04:00
|
|
|
|
2005-06-30 13:14:08 +04:00
|
|
|
#endif // _BUTTON_H
|