BButton style fixes for docs.
No functional change intended.
This commit is contained in:
@@ -1,10 +1,11 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2001-2013, Haiku, Inc. All rights reserved.
|
* Copyright 2001-2014 Haiku, Inc. All rights reserved.
|
||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
*/
|
*/
|
||||||
#ifndef _BUTTON_H
|
#ifndef _BUTTON_H
|
||||||
#define _BUTTON_H
|
#define _BUTTON_H
|
||||||
|
|
||||||
|
|
||||||
#include <Control.h>
|
#include <Control.h>
|
||||||
|
|
||||||
|
|
||||||
@@ -24,22 +25,20 @@ public:
|
|||||||
uint32 flags = B_WILL_DRAW | B_NAVIGABLE
|
uint32 flags = B_WILL_DRAW | B_NAVIGABLE
|
||||||
| B_FULL_UPDATE_ON_RESIZE);
|
| B_FULL_UPDATE_ON_RESIZE);
|
||||||
BButton(const char* name, const char* label,
|
BButton(const char* name, const char* label,
|
||||||
BMessage *message,
|
BMessage* message,
|
||||||
uint32 flags = B_WILL_DRAW | B_NAVIGABLE
|
uint32 flags = B_WILL_DRAW | B_NAVIGABLE
|
||||||
| B_FULL_UPDATE_ON_RESIZE);
|
| B_FULL_UPDATE_ON_RESIZE);
|
||||||
BButton(const char* label,
|
BButton(const char* label,
|
||||||
BMessage* message = NULL);
|
BMessage* message = NULL);
|
||||||
|
BButton(BMessage* data);
|
||||||
BButton(BMessage *archive);
|
|
||||||
|
|
||||||
virtual ~BButton();
|
virtual ~BButton();
|
||||||
|
|
||||||
static BArchivable* Instantiate(BMessage* archive);
|
static BArchivable* Instantiate(BMessage* data);
|
||||||
virtual status_t Archive(BMessage* archive,
|
virtual status_t Archive(BMessage* data, bool deep = true) const;
|
||||||
bool deep = true) const;
|
|
||||||
|
|
||||||
virtual void Draw(BRect updateRect);
|
virtual void Draw(BRect updateRect);
|
||||||
virtual void MouseDown(BPoint point);
|
virtual void MouseDown(BPoint where);
|
||||||
virtual void AttachedToWindow();
|
virtual void AttachedToWindow();
|
||||||
virtual void KeyDown(const char* bytes, int32 numBytes);
|
virtual void KeyDown(const char* bytes, int32 numBytes);
|
||||||
virtual void MakeDefault(bool flag);
|
virtual void MakeDefault(bool flag);
|
||||||
@@ -57,16 +56,16 @@ public:
|
|||||||
|
|
||||||
virtual void MessageReceived(BMessage* message);
|
virtual void MessageReceived(BMessage* message);
|
||||||
virtual void WindowActivated(bool active);
|
virtual void WindowActivated(bool active);
|
||||||
virtual void MouseMoved(BPoint point, uint32 transit,
|
virtual void MouseMoved(BPoint where, uint32 code,
|
||||||
const BMessage* message);
|
const BMessage* dragMessage);
|
||||||
virtual void MouseUp(BPoint point);
|
virtual void MouseUp(BPoint where);
|
||||||
virtual void DetachedFromWindow();
|
virtual void DetachedFromWindow();
|
||||||
virtual void SetValue(int32 value);
|
virtual void SetValue(int32 value);
|
||||||
virtual void GetPreferredSize (float* _width,
|
virtual void GetPreferredSize (float* _width,
|
||||||
float* _height);
|
float* _height);
|
||||||
virtual void ResizeToPreferred();
|
virtual void ResizeToPreferred();
|
||||||
virtual status_t Invoke(BMessage* message = NULL);
|
virtual status_t Invoke(BMessage* message = NULL);
|
||||||
virtual void FrameMoved(BPoint newLocation);
|
virtual void FrameMoved(BPoint newPosition);
|
||||||
virtual void FrameResized(float width, float height);
|
virtual void FrameResized(float width, float height);
|
||||||
|
|
||||||
virtual void MakeFocus(bool focused = true);
|
virtual void MakeFocus(bool focused = true);
|
||||||
@@ -110,4 +109,5 @@ private:
|
|||||||
BMessage* fPopUpMessage;
|
BMessage* fPopUpMessage;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // _BUTTON_H
|
|
||||||
|
#endif // _BUTTON_H
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2001-2013, Haiku Inc. All rights reserved.
|
* Copyright 2001-2014 Haiku Inc. All rights reserved.
|
||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
*
|
*
|
||||||
* Authors:
|
* Authors:
|
||||||
@@ -88,16 +88,16 @@ BButton::~BButton()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
BButton::BButton(BMessage* archive)
|
BButton::BButton(BMessage* data)
|
||||||
:
|
:
|
||||||
BControl(archive),
|
BControl(data),
|
||||||
fPreferredSize(-1, -1),
|
fPreferredSize(-1, -1),
|
||||||
fFlags(0),
|
fFlags(0),
|
||||||
fBehavior(B_BUTTON_BEHAVIOR),
|
fBehavior(B_BUTTON_BEHAVIOR),
|
||||||
fPopUpMessage(NULL)
|
fPopUpMessage(NULL)
|
||||||
{
|
{
|
||||||
bool isDefault = false;
|
bool isDefault = false;
|
||||||
if (archive->FindBool("_default", &isDefault) == B_OK && isDefault)
|
if (data->FindBool("_default", &isDefault) == B_OK && isDefault)
|
||||||
_SetFlag(FLAG_DEFAULT, true);
|
_SetFlag(FLAG_DEFAULT, true);
|
||||||
// NOTE: Default button state will be synchronized with the window
|
// NOTE: Default button state will be synchronized with the window
|
||||||
// in AttachedToWindow().
|
// in AttachedToWindow().
|
||||||
@@ -105,25 +105,25 @@ BButton::BButton(BMessage* archive)
|
|||||||
|
|
||||||
|
|
||||||
BArchivable*
|
BArchivable*
|
||||||
BButton::Instantiate(BMessage* archive)
|
BButton::Instantiate(BMessage* data)
|
||||||
{
|
{
|
||||||
if (validate_instantiation(archive, "BButton"))
|
if (validate_instantiation(data, "BButton"))
|
||||||
return new(std::nothrow) BButton(archive);
|
return new(std::nothrow) BButton(data);
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
BButton::Archive(BMessage* archive, bool deep) const
|
BButton::Archive(BMessage* data, bool deep) const
|
||||||
{
|
{
|
||||||
status_t err = BControl::Archive(archive, deep);
|
status_t err = BControl::Archive(data, deep);
|
||||||
|
|
||||||
if (err != B_OK)
|
if (err != B_OK)
|
||||||
return err;
|
return err;
|
||||||
|
|
||||||
if (IsDefault())
|
if (IsDefault())
|
||||||
err = archive->AddBool("_default", true);
|
err = data->AddBool("_default", true);
|
||||||
|
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
@@ -167,12 +167,12 @@ BButton::Draw(BRect updateRect)
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
BButton::MouseDown(BPoint point)
|
BButton::MouseDown(BPoint where)
|
||||||
{
|
{
|
||||||
if (!IsEnabled())
|
if (!IsEnabled())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (fBehavior == B_POP_UP_BEHAVIOR && _PopUpRect().Contains(point)) {
|
if (fBehavior == B_POP_UP_BEHAVIOR && _PopUpRect().Contains(where)) {
|
||||||
InvokeNotify(fPopUpMessage, B_CONTROL_MODIFIED);
|
InvokeNotify(fPopUpMessage, B_CONTROL_MODIFIED);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -199,9 +199,8 @@ BButton::MouseDown(BPoint point)
|
|||||||
Window()->UpdateIfNeeded();
|
Window()->UpdateIfNeeded();
|
||||||
snooze(40000);
|
snooze(40000);
|
||||||
|
|
||||||
GetMouse(&point, &buttons, true);
|
GetMouse(&where, &buttons, true);
|
||||||
|
inside = bounds.Contains(where);
|
||||||
inside = bounds.Contains(point);
|
|
||||||
|
|
||||||
if (toggleBehavior) {
|
if (toggleBehavior) {
|
||||||
bool pressed = inside ^ _Flag(FLAG_WAS_PRESSED);
|
bool pressed = inside ^ _Flag(FLAG_WAS_PRESSED);
|
||||||
@@ -252,7 +251,6 @@ BButton::KeyDown(const char* bytes, int32 numBytes)
|
|||||||
snooze(25000);
|
snooze(25000);
|
||||||
|
|
||||||
Invoke();
|
Invoke();
|
||||||
|
|
||||||
} else
|
} else
|
||||||
BControl::KeyDown(bytes, numBytes);
|
BControl::KeyDown(bytes, numBytes);
|
||||||
}
|
}
|
||||||
@@ -264,7 +262,7 @@ BButton::MakeDefault(bool flag)
|
|||||||
BButton* oldDefault = NULL;
|
BButton* oldDefault = NULL;
|
||||||
BWindow* window = Window();
|
BWindow* window = Window();
|
||||||
|
|
||||||
if (window)
|
if (window != NULL)
|
||||||
oldDefault = window->DefaultButton();
|
oldDefault = window->DefaultButton();
|
||||||
|
|
||||||
if (flag) {
|
if (flag) {
|
||||||
@@ -300,9 +298,9 @@ BButton::MakeDefault(bool flag)
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
BButton::SetLabel(const char* string)
|
BButton::SetLabel(const char* label)
|
||||||
{
|
{
|
||||||
BControl::SetLabel(string);
|
BControl::SetLabel(label);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -376,9 +374,9 @@ BButton::WindowActivated(bool active)
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
BButton::MouseMoved(BPoint point, uint32 transit, const BMessage* message)
|
BButton::MouseMoved(BPoint where, uint32 code, const BMessage* dragMessage)
|
||||||
{
|
{
|
||||||
bool inside = Bounds().Contains(point);
|
bool inside = Bounds().Contains(where);
|
||||||
if (_SetFlag(FLAG_INSIDE, inside))
|
if (_SetFlag(FLAG_INSIDE, inside))
|
||||||
Invalidate();
|
Invalidate();
|
||||||
|
|
||||||
@@ -396,12 +394,12 @@ BButton::MouseMoved(BPoint point, uint32 transit, const BMessage* message)
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
BButton::MouseUp(BPoint point)
|
BButton::MouseUp(BPoint where)
|
||||||
{
|
{
|
||||||
if (!IsTracking())
|
if (!IsTracking())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (Bounds().Contains(point)) {
|
if (Bounds().Contains(where)) {
|
||||||
if (fBehavior == B_TOGGLE_BEHAVIOR)
|
if (fBehavior == B_TOGGLE_BEHAVIOR)
|
||||||
SetValue(_Flag(FLAG_WAS_PRESSED) ? B_CONTROL_OFF : B_CONTROL_ON);
|
SetValue(_Flag(FLAG_WAS_PRESSED) ? B_CONTROL_OFF : B_CONTROL_ON);
|
||||||
|
|
||||||
@@ -464,9 +462,9 @@ BButton::Invoke(BMessage* message)
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
BButton::FrameMoved(BPoint newLocation)
|
BButton::FrameMoved(BPoint newPosition)
|
||||||
{
|
{
|
||||||
BControl::FrameMoved(newLocation);
|
BControl::FrameMoved(newPosition);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user