BCheckBox: Style fixes, variable renaming for consistency, docs.
Also some other style fixes, no functional changes intended.
This commit is contained in:
@@ -1,10 +1,11 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2001-2009, 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 _CHECK_BOX_H
|
#ifndef _CHECK_BOX_H
|
||||||
#define _CHECK_BOX_H
|
#define _CHECK_BOX_H
|
||||||
|
|
||||||
|
|
||||||
#include <Control.h>
|
#include <Control.h>
|
||||||
|
|
||||||
|
|
||||||
@@ -20,13 +21,12 @@ public:
|
|||||||
= B_WILL_DRAW | B_NAVIGABLE);
|
= B_WILL_DRAW | B_NAVIGABLE);
|
||||||
BCheckBox(const char* label,
|
BCheckBox(const char* label,
|
||||||
BMessage* message = NULL);
|
BMessage* message = NULL);
|
||||||
BCheckBox(BMessage* archive);
|
BCheckBox(BMessage* data);
|
||||||
|
|
||||||
virtual ~BCheckBox();
|
virtual ~BCheckBox();
|
||||||
|
|
||||||
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);
|
||||||
|
|
||||||
@@ -35,7 +35,7 @@ public:
|
|||||||
virtual void AllAttached();
|
virtual void AllAttached();
|
||||||
virtual void AllDetached();
|
virtual void AllDetached();
|
||||||
|
|
||||||
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 WindowActivated(bool active);
|
virtual void WindowActivated(bool active);
|
||||||
|
|
||||||
@@ -43,9 +43,9 @@ public:
|
|||||||
|
|
||||||
virtual void KeyDown(const char* bytes, int32 numBytes);
|
virtual void KeyDown(const char* bytes, int32 numBytes);
|
||||||
|
|
||||||
virtual void MouseDown(BPoint point);
|
virtual void MouseDown(BPoint where);
|
||||||
virtual void MouseUp(BPoint point);
|
virtual void MouseUp(BPoint where);
|
||||||
virtual void MouseMoved(BPoint point, uint32 transit,
|
virtual void MouseMoved(BPoint where, uint32 code,
|
||||||
const BMessage* dragMessage);
|
const BMessage* dragMessage);
|
||||||
|
|
||||||
virtual void GetPreferredSize(float* _width,
|
virtual void GetPreferredSize(float* _width,
|
||||||
@@ -100,5 +100,5 @@ private:
|
|||||||
bool fPartialToOff;
|
bool fPartialToOff;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // _CHECK_BOX_H
|
|
||||||
|
|
||||||
|
#endif // _CHECK_BOX_H
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2001-2009, Haiku Inc.
|
* 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:
|
||||||
@@ -7,7 +7,8 @@
|
|||||||
* Stephan Aßmus <[email protected]>
|
* Stephan Aßmus <[email protected]>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*! BCheckBox displays an on/off control. */
|
|
||||||
|
// BCheckBox displays an on/off control.
|
||||||
|
|
||||||
|
|
||||||
#include <CheckBox.h>
|
#include <CheckBox.h>
|
||||||
@@ -62,9 +63,9 @@ BCheckBox::BCheckBox(const char *label, BMessage *message)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
BCheckBox::BCheckBox(BMessage *archive)
|
BCheckBox::BCheckBox(BMessage* data)
|
||||||
:
|
:
|
||||||
BControl(archive),
|
BControl(data),
|
||||||
fOutlined(false),
|
fOutlined(false),
|
||||||
fPartialToOff(false)
|
fPartialToOff(false)
|
||||||
{
|
{
|
||||||
@@ -76,27 +77,27 @@ BCheckBox::~BCheckBox()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// #pragma mark -
|
// #pragma mark - Archiving methods
|
||||||
|
|
||||||
|
|
||||||
BArchivable*
|
BArchivable*
|
||||||
BCheckBox::Instantiate(BMessage *archive)
|
BCheckBox::Instantiate(BMessage* data)
|
||||||
{
|
{
|
||||||
if (validate_instantiation(archive, "BCheckBox"))
|
if (validate_instantiation(data, "BCheckBox"))
|
||||||
return new(std::nothrow) BCheckBox(archive);
|
return new(std::nothrow) BCheckBox(data);
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
BCheckBox::Archive(BMessage *archive, bool deep) const
|
BCheckBox::Archive(BMessage* data, bool deep) const
|
||||||
{
|
{
|
||||||
return BControl::Archive(archive, deep);
|
return BControl::Archive(data, deep);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// #pragma mark -
|
// #pragma mark - Hook methods
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
@@ -153,9 +154,9 @@ BCheckBox::AllDetached()
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
BCheckBox::FrameMoved(BPoint newLocation)
|
BCheckBox::FrameMoved(BPoint newPosition)
|
||||||
{
|
{
|
||||||
BControl::FrameMoved(newLocation);
|
BControl::FrameMoved(newPosition);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -173,9 +174,6 @@ BCheckBox::WindowActivated(bool active)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// #pragma mark -
|
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
BCheckBox::MessageReceived(BMessage* message)
|
BCheckBox::MessageReceived(BMessage* message)
|
||||||
{
|
{
|
||||||
@@ -200,7 +198,7 @@ BCheckBox::KeyDown(const char *bytes, int32 numBytes)
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
BCheckBox::MouseDown(BPoint point)
|
BCheckBox::MouseDown(BPoint where)
|
||||||
{
|
{
|
||||||
if (!IsEnabled())
|
if (!IsEnabled())
|
||||||
return;
|
return;
|
||||||
@@ -221,9 +219,9 @@ BCheckBox::MouseDown(BPoint point)
|
|||||||
do {
|
do {
|
||||||
snooze(40000);
|
snooze(40000);
|
||||||
|
|
||||||
GetMouse(&point, &buttons, true);
|
GetMouse(&where, &buttons, true);
|
||||||
|
|
||||||
bool inside = bounds.Contains(point);
|
bool inside = bounds.Contains(where);
|
||||||
if (fOutlined != inside) {
|
if (fOutlined != inside) {
|
||||||
fOutlined = inside;
|
fOutlined = inside;
|
||||||
Invalidate();
|
Invalidate();
|
||||||
@@ -244,12 +242,12 @@ BCheckBox::MouseDown(BPoint point)
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
BCheckBox::MouseUp(BPoint point)
|
BCheckBox::MouseUp(BPoint where)
|
||||||
{
|
{
|
||||||
if (!IsTracking())
|
if (!IsTracking())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
bool inside = Bounds().Contains(point);
|
bool inside = Bounds().Contains(where);
|
||||||
|
|
||||||
if (fOutlined != inside) {
|
if (fOutlined != inside) {
|
||||||
fOutlined = inside;
|
fOutlined = inside;
|
||||||
@@ -269,12 +267,13 @@ BCheckBox::MouseUp(BPoint point)
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
BCheckBox::MouseMoved(BPoint point, uint32 transit, const BMessage *message)
|
BCheckBox::MouseMoved(BPoint where, uint32 code,
|
||||||
|
const BMessage* dragMessage)
|
||||||
{
|
{
|
||||||
if (!IsTracking())
|
if (!IsTracking())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
bool inside = Bounds().Contains(point);
|
bool inside = Bounds().Contains(where);
|
||||||
|
|
||||||
if (fOutlined != inside) {
|
if (fOutlined != inside) {
|
||||||
fOutlined = inside;
|
fOutlined = inside;
|
||||||
|
|||||||
Reference in New Issue
Block a user