BButton style fixes for docs.

No functional change intended.
This commit is contained in:
John Scipione
2014-05-28 14:21:06 -04:00
parent 0a813c73fe
commit 8ad6baf789
2 changed files with 38 additions and 40 deletions
+15 -15
View File
@@ -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.
*/
#ifndef _BUTTON_H
#define _BUTTON_H
#include <Control.h>
@@ -24,22 +25,20 @@ public:
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);
BMessage* message,
uint32 flags = B_WILL_DRAW | B_NAVIGABLE
| B_FULL_UPDATE_ON_RESIZE);
BButton(const char* label,
BMessage* message = NULL);
BButton(BMessage *archive);
BButton(BMessage* data);
virtual ~BButton();
static BArchivable* Instantiate(BMessage* archive);
virtual status_t Archive(BMessage* archive,
bool deep = true) const;
static BArchivable* Instantiate(BMessage* data);
virtual status_t Archive(BMessage* data, bool deep = true) const;
virtual void Draw(BRect updateRect);
virtual void MouseDown(BPoint point);
virtual void MouseDown(BPoint where);
virtual void AttachedToWindow();
virtual void KeyDown(const char* bytes, int32 numBytes);
virtual void MakeDefault(bool flag);
@@ -57,16 +56,16 @@ public:
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 MouseMoved(BPoint where, uint32 code,
const BMessage* dragMessage);
virtual void MouseUp(BPoint where);
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 FrameMoved(BPoint newPosition);
virtual void FrameResized(float width, float height);
virtual void MakeFocus(bool focused = true);
@@ -110,4 +109,5 @@ private:
BMessage* fPopUpMessage;
};
#endif // _BUTTON_H
#endif // _BUTTON_H
+23 -25
View File
@@ -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.
*
* Authors:
@@ -88,16 +88,16 @@ BButton::~BButton()
}
BButton::BButton(BMessage* archive)
BButton::BButton(BMessage* data)
:
BControl(archive),
BControl(data),
fPreferredSize(-1, -1),
fFlags(0),
fBehavior(B_BUTTON_BEHAVIOR),
fPopUpMessage(NULL)
{
bool isDefault = false;
if (archive->FindBool("_default", &isDefault) == B_OK && isDefault)
if (data->FindBool("_default", &isDefault) == B_OK && isDefault)
_SetFlag(FLAG_DEFAULT, true);
// NOTE: Default button state will be synchronized with the window
// in AttachedToWindow().
@@ -105,25 +105,25 @@ BButton::BButton(BMessage* archive)
BArchivable*
BButton::Instantiate(BMessage* archive)
BButton::Instantiate(BMessage* data)
{
if (validate_instantiation(archive, "BButton"))
return new(std::nothrow) BButton(archive);
if (validate_instantiation(data, "BButton"))
return new(std::nothrow) BButton(data);
return NULL;
}
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)
return err;
if (IsDefault())
err = archive->AddBool("_default", true);
err = data->AddBool("_default", true);
return err;
}
@@ -167,12 +167,12 @@ BButton::Draw(BRect updateRect)
void
BButton::MouseDown(BPoint point)
BButton::MouseDown(BPoint where)
{
if (!IsEnabled())
return;
if (fBehavior == B_POP_UP_BEHAVIOR && _PopUpRect().Contains(point)) {
if (fBehavior == B_POP_UP_BEHAVIOR && _PopUpRect().Contains(where)) {
InvokeNotify(fPopUpMessage, B_CONTROL_MODIFIED);
return;
}
@@ -199,9 +199,8 @@ BButton::MouseDown(BPoint point)
Window()->UpdateIfNeeded();
snooze(40000);
GetMouse(&point, &buttons, true);
inside = bounds.Contains(point);
GetMouse(&where, &buttons, true);
inside = bounds.Contains(where);
if (toggleBehavior) {
bool pressed = inside ^ _Flag(FLAG_WAS_PRESSED);
@@ -252,7 +251,6 @@ BButton::KeyDown(const char* bytes, int32 numBytes)
snooze(25000);
Invoke();
} else
BControl::KeyDown(bytes, numBytes);
}
@@ -264,7 +262,7 @@ BButton::MakeDefault(bool flag)
BButton* oldDefault = NULL;
BWindow* window = Window();
if (window)
if (window != NULL)
oldDefault = window->DefaultButton();
if (flag) {
@@ -300,9 +298,9 @@ BButton::MakeDefault(bool flag)
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
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))
Invalidate();
@@ -396,12 +394,12 @@ BButton::MouseMoved(BPoint point, uint32 transit, const BMessage* message)
void
BButton::MouseUp(BPoint point)
BButton::MouseUp(BPoint where)
{
if (!IsTracking())
return;
if (Bounds().Contains(point)) {
if (Bounds().Contains(where)) {
if (fBehavior == B_TOGGLE_BEHAVIOR)
SetValue(_Flag(FLAG_WAS_PRESSED) ? B_CONTROL_OFF : B_CONTROL_ON);
@@ -464,9 +462,9 @@ BButton::Invoke(BMessage* message)
void
BButton::FrameMoved(BPoint newLocation)
BButton::FrameMoved(BPoint newPosition)
{
BControl::FrameMoved(newLocation);
BControl::FrameMoved(newPosition);
}