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>
|
||||||
@@ -23,8 +24,8 @@
|
|||||||
#include <binary_compatibility/Interface.h>
|
#include <binary_compatibility/Interface.h>
|
||||||
|
|
||||||
|
|
||||||
BCheckBox::BCheckBox(BRect frame, const char *name, const char *label,
|
BCheckBox::BCheckBox(BRect frame, const char* name, const char* label,
|
||||||
BMessage *message, uint32 resizingMode, uint32 flags)
|
BMessage* message, uint32 resizingMode, uint32 flags)
|
||||||
:
|
:
|
||||||
BControl(frame, name, label, message, resizingMode, flags),
|
BControl(frame, name, label, message, resizingMode, flags),
|
||||||
fPreferredSize(),
|
fPreferredSize(),
|
||||||
@@ -41,7 +42,7 @@ BCheckBox::BCheckBox(BRect frame, const char *name, const char *label,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
BCheckBox::BCheckBox(const char *name, const char *label, BMessage *message,
|
BCheckBox::BCheckBox(const char* name, const char* label, BMessage* message,
|
||||||
uint32 flags)
|
uint32 flags)
|
||||||
:
|
:
|
||||||
BControl(name, label, message, flags | B_WILL_DRAW | B_NAVIGABLE),
|
BControl(name, label, message, flags | B_WILL_DRAW | B_NAVIGABLE),
|
||||||
@@ -52,7 +53,7 @@ BCheckBox::BCheckBox(const char *name, const char *label, BMessage *message,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
BCheckBox::BCheckBox(const char *label, BMessage *message)
|
BCheckBox::BCheckBox(const char* label, BMessage* message)
|
||||||
:
|
:
|
||||||
BControl(NULL, label, message, B_WILL_DRAW | B_NAVIGABLE),
|
BControl(NULL, label, message, B_WILL_DRAW | B_NAVIGABLE),
|
||||||
fPreferredSize(),
|
fPreferredSize(),
|
||||||
@@ -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,18 +174,15 @@ BCheckBox::WindowActivated(bool active)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// #pragma mark -
|
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
BCheckBox::MessageReceived(BMessage *message)
|
BCheckBox::MessageReceived(BMessage* message)
|
||||||
{
|
{
|
||||||
BControl::MessageReceived(message);
|
BControl::MessageReceived(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
BCheckBox::KeyDown(const char *bytes, int32 numBytes)
|
BCheckBox::KeyDown(const char* bytes, int32 numBytes)
|
||||||
{
|
{
|
||||||
if (*bytes == B_ENTER || *bytes == B_SPACE) {
|
if (*bytes == B_ENTER || *bytes == B_SPACE) {
|
||||||
if (!IsEnabled())
|
if (!IsEnabled())
|
||||||
@@ -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;
|
||||||
@@ -370,15 +369,15 @@ BCheckBox::SetValue(int32 value)
|
|||||||
|
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
BCheckBox::Invoke(BMessage *message)
|
BCheckBox::Invoke(BMessage* message)
|
||||||
{
|
{
|
||||||
return BControl::Invoke(message);
|
return BControl::Invoke(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
BHandler *
|
BHandler*
|
||||||
BCheckBox::ResolveSpecifier(BMessage *message, int32 index,
|
BCheckBox::ResolveSpecifier(BMessage* message, int32 index,
|
||||||
BMessage *specifier, int32 what, const char *property)
|
BMessage* specifier, int32 what, const char* property)
|
||||||
{
|
{
|
||||||
return BControl::ResolveSpecifier(message, index, specifier, what,
|
return BControl::ResolveSpecifier(message, index, specifier, what,
|
||||||
property);
|
property);
|
||||||
@@ -386,7 +385,7 @@ BCheckBox::ResolveSpecifier(BMessage *message, int32 index,
|
|||||||
|
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
BCheckBox::GetSupportedSuites(BMessage *message)
|
BCheckBox::GetSupportedSuites(BMessage* message)
|
||||||
{
|
{
|
||||||
return BControl::GetSupportedSuites(message);
|
return BControl::GetSupportedSuites(message);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user