BControl: Style fixes, variable renaming for consistency, docs.
Also some other style fixes, no functional changes intended.
This commit is contained in:
@@ -33,10 +33,9 @@ public:
|
|||||||
BMessage* message, uint32 flags);
|
BMessage* message, uint32 flags);
|
||||||
virtual ~BControl();
|
virtual ~BControl();
|
||||||
|
|
||||||
BControl(BMessage* archive);
|
BControl(BMessage* data);
|
||||||
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 WindowActivated(bool active);
|
virtual void WindowActivated(bool active);
|
||||||
|
|
||||||
@@ -49,10 +48,10 @@ public:
|
|||||||
virtual void MakeFocus(bool focused = true);
|
virtual void MakeFocus(bool focused = true);
|
||||||
|
|
||||||
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 *message);
|
const BMessage* dragMessage);
|
||||||
|
|
||||||
virtual void SetLabel(const char* string);
|
virtual void SetLabel(const char* string);
|
||||||
const char* Label() const;
|
const char* Label() const;
|
||||||
|
|||||||
@@ -7,7 +7,8 @@
|
|||||||
* Ingo Weinhold, [email protected]
|
* Ingo Weinhold, [email protected]
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*! BControl is the base class for user-event handling objects. */
|
|
||||||
|
// BControl is the base class for user-event handling objects.
|
||||||
|
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
@@ -49,7 +50,8 @@ static property_info sPropertyList[] = {
|
|||||||
|
|
||||||
BControl::BControl(BRect frame, const char* name, const char* label,
|
BControl::BControl(BRect frame, const char* name, const char* label,
|
||||||
BMessage* message, uint32 resizingMode, uint32 flags)
|
BMessage* message, uint32 resizingMode, uint32 flags)
|
||||||
: BView(frame, name, resizingMode, flags)
|
:
|
||||||
|
BView(frame, name, resizingMode, flags)
|
||||||
{
|
{
|
||||||
InitData(NULL);
|
InitData(NULL);
|
||||||
|
|
||||||
@@ -60,7 +62,8 @@ BControl::BControl(BRect frame, const char *name, const char *label,
|
|||||||
|
|
||||||
BControl::BControl(const char* name, const char* label, BMessage* message,
|
BControl::BControl(const char* name, const char* label, BMessage* message,
|
||||||
uint32 flags)
|
uint32 flags)
|
||||||
: BView(name, flags)
|
:
|
||||||
|
BView(name, flags)
|
||||||
{
|
{
|
||||||
InitData(NULL);
|
InitData(NULL);
|
||||||
|
|
||||||
@@ -77,58 +80,59 @@ BControl::~BControl()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
BControl::BControl(BMessage *archive)
|
BControl::BControl(BMessage* data)
|
||||||
: BView(archive)
|
:
|
||||||
|
BView(data)
|
||||||
{
|
{
|
||||||
InitData(archive);
|
InitData(data);
|
||||||
|
|
||||||
BMessage message;
|
BMessage message;
|
||||||
if (archive->FindMessage("_msg", &message) == B_OK)
|
if (data->FindMessage("_msg", &message) == B_OK)
|
||||||
SetMessage(new BMessage(message));
|
SetMessage(new BMessage(message));
|
||||||
|
|
||||||
const char* label;
|
const char* label;
|
||||||
if (archive->FindString("_label", &label) == B_OK)
|
if (data->FindString("_label", &label) == B_OK)
|
||||||
SetLabel(label);
|
SetLabel(label);
|
||||||
|
|
||||||
int32 value;
|
int32 value;
|
||||||
if (archive->FindInt32("_val", &value) == B_OK)
|
if (data->FindInt32("_val", &value) == B_OK)
|
||||||
SetValue(value);
|
SetValue(value);
|
||||||
|
|
||||||
bool toggle;
|
bool toggle;
|
||||||
if (archive->FindBool("_disable", &toggle) == B_OK)
|
if (data->FindBool("_disable", &toggle) == B_OK)
|
||||||
SetEnabled(!toggle);
|
SetEnabled(!toggle);
|
||||||
|
|
||||||
if (archive->FindBool("be:wants_nav", &toggle) == B_OK)
|
if (data->FindBool("be:wants_nav", &toggle) == B_OK)
|
||||||
fWantsNav = toggle;
|
fWantsNav = toggle;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
BArchivable*
|
BArchivable*
|
||||||
BControl::Instantiate(BMessage *archive)
|
BControl::Instantiate(BMessage* data)
|
||||||
{
|
{
|
||||||
if (validate_instantiation(archive, "BControl"))
|
if (validate_instantiation(data, "BControl"))
|
||||||
return new BControl(archive);
|
return new BControl(data);
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
BControl::Archive(BMessage *archive, bool deep) const
|
BControl::Archive(BMessage* data, bool deep) const
|
||||||
{
|
{
|
||||||
status_t status = BView::Archive(archive, deep);
|
status_t status = BView::Archive(data, deep);
|
||||||
|
|
||||||
if (status == B_OK && Message())
|
if (status == B_OK && Message())
|
||||||
status = archive->AddMessage("_msg", Message());
|
status = data->AddMessage("_msg", Message());
|
||||||
|
|
||||||
if (status == B_OK && fLabel)
|
if (status == B_OK && fLabel)
|
||||||
status = archive->AddString("_label", fLabel);
|
status = data->AddString("_label", fLabel);
|
||||||
|
|
||||||
if (status == B_OK && fValue != B_CONTROL_OFF)
|
if (status == B_OK && fValue != B_CONTROL_OFF)
|
||||||
status = archive->AddInt32("_val", fValue);
|
status = data->AddInt32("_val", fValue);
|
||||||
|
|
||||||
if (status == B_OK && !fEnabled)
|
if (status == B_OK && !fEnabled)
|
||||||
status = archive->AddBool("_disable", true);
|
status = data->AddBool("_disable", true);
|
||||||
|
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
@@ -285,23 +289,23 @@ BControl::KeyDown(const char *bytes, int32 numBytes)
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
BControl::MouseDown(BPoint point)
|
BControl::MouseDown(BPoint where)
|
||||||
{
|
{
|
||||||
BView::MouseDown(point);
|
BView::MouseDown(where);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
BControl::MouseUp(BPoint point)
|
BControl::MouseUp(BPoint where)
|
||||||
{
|
{
|
||||||
BView::MouseUp(point);
|
BView::MouseUp(where);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
BControl::MouseMoved(BPoint point, uint32 transit, const BMessage *message)
|
BControl::MouseMoved(BPoint where, uint32 code, const BMessage* dragMessage)
|
||||||
{
|
{
|
||||||
BView::MouseMoved(point, transit, message);
|
BView::MouseMoved(where, code, dragMessage);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user