BControl: Style fixes, variable renaming for consistency, docs.
Also some other style fixes, no functional changes intended.
This commit is contained in:
parent
9c244999df
commit
092e3093c3
@ -33,10 +33,9 @@ public:
|
||||
BMessage* message, uint32 flags);
|
||||
virtual ~BControl();
|
||||
|
||||
BControl(BMessage* archive);
|
||||
static BArchivable* Instantiate(BMessage* archive);
|
||||
virtual status_t Archive(BMessage* archive,
|
||||
bool deep = true) const;
|
||||
BControl(BMessage* data);
|
||||
static BArchivable* Instantiate(BMessage* data);
|
||||
virtual status_t Archive(BMessage* data, bool deep = true) const;
|
||||
|
||||
virtual void WindowActivated(bool active);
|
||||
|
||||
@ -49,10 +48,10 @@ public:
|
||||
virtual void MakeFocus(bool focused = true);
|
||||
|
||||
virtual void KeyDown(const char* bytes, int32 numBytes);
|
||||
virtual void MouseDown(BPoint point);
|
||||
virtual void MouseUp(BPoint point);
|
||||
virtual void MouseMoved(BPoint point, uint32 transit,
|
||||
const BMessage *message);
|
||||
virtual void MouseDown(BPoint where);
|
||||
virtual void MouseUp(BPoint where);
|
||||
virtual void MouseMoved(BPoint where, uint32 code,
|
||||
const BMessage* dragMessage);
|
||||
|
||||
virtual void SetLabel(const char* string);
|
||||
const char* Label() const;
|
||||
|
@ -7,7 +7,8 @@
|
||||
* Ingo Weinhold, ingo_weinhold@gmx.de
|
||||
*/
|
||||
|
||||
/*! BControl is the base class for user-event handling objects. */
|
||||
|
||||
// BControl is the base class for user-event handling objects.
|
||||
|
||||
|
||||
#include <stdlib.h>
|
||||
@ -47,9 +48,10 @@ static property_info sPropertyList[] = {
|
||||
};
|
||||
|
||||
|
||||
BControl::BControl(BRect frame, const char *name, const char *label,
|
||||
BMessage *message, uint32 resizingMode, uint32 flags)
|
||||
: BView(frame, name, resizingMode, flags)
|
||||
BControl::BControl(BRect frame, const char* name, const char* label,
|
||||
BMessage* message, uint32 resizingMode, uint32 flags)
|
||||
:
|
||||
BView(frame, name, resizingMode, flags)
|
||||
{
|
||||
InitData(NULL);
|
||||
|
||||
@ -58,9 +60,10 @@ 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)
|
||||
: BView(name, flags)
|
||||
:
|
||||
BView(name, flags)
|
||||
{
|
||||
InitData(NULL);
|
||||
|
||||
@ -77,58 +80,59 @@ BControl::~BControl()
|
||||
}
|
||||
|
||||
|
||||
BControl::BControl(BMessage *archive)
|
||||
: BView(archive)
|
||||
BControl::BControl(BMessage* data)
|
||||
:
|
||||
BView(data)
|
||||
{
|
||||
InitData(archive);
|
||||
InitData(data);
|
||||
|
||||
BMessage message;
|
||||
if (archive->FindMessage("_msg", &message) == B_OK)
|
||||
if (data->FindMessage("_msg", &message) == B_OK)
|
||||
SetMessage(new BMessage(message));
|
||||
|
||||
const char *label;
|
||||
if (archive->FindString("_label", &label) == B_OK)
|
||||
const char* label;
|
||||
if (data->FindString("_label", &label) == B_OK)
|
||||
SetLabel(label);
|
||||
|
||||
int32 value;
|
||||
if (archive->FindInt32("_val", &value) == B_OK)
|
||||
if (data->FindInt32("_val", &value) == B_OK)
|
||||
SetValue(value);
|
||||
|
||||
bool toggle;
|
||||
if (archive->FindBool("_disable", &toggle) == B_OK)
|
||||
if (data->FindBool("_disable", &toggle) == B_OK)
|
||||
SetEnabled(!toggle);
|
||||
|
||||
if (archive->FindBool("be:wants_nav", &toggle) == B_OK)
|
||||
if (data->FindBool("be:wants_nav", &toggle) == B_OK)
|
||||
fWantsNav = toggle;
|
||||
}
|
||||
|
||||
|
||||
BArchivable *
|
||||
BControl::Instantiate(BMessage *archive)
|
||||
BArchivable*
|
||||
BControl::Instantiate(BMessage* data)
|
||||
{
|
||||
if (validate_instantiation(archive, "BControl"))
|
||||
return new BControl(archive);
|
||||
if (validate_instantiation(data, "BControl"))
|
||||
return new BControl(data);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
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())
|
||||
status = archive->AddMessage("_msg", Message());
|
||||
status = data->AddMessage("_msg", Message());
|
||||
|
||||
if (status == B_OK && fLabel)
|
||||
status = archive->AddString("_label", fLabel);
|
||||
status = data->AddString("_label", fLabel);
|
||||
|
||||
if (status == B_OK && fValue != B_CONTROL_OFF)
|
||||
status = archive->AddInt32("_val", fValue);
|
||||
status = data->AddInt32("_val", fValue);
|
||||
|
||||
if (status == B_OK && !fEnabled)
|
||||
status = archive->AddBool("_disable", true);
|
||||
status = data->AddBool("_disable", true);
|
||||
|
||||
return status;
|
||||
}
|
||||
@ -190,7 +194,7 @@ BControl::AllDetached()
|
||||
|
||||
|
||||
void
|
||||
BControl::MessageReceived(BMessage *message)
|
||||
BControl::MessageReceived(BMessage* message)
|
||||
{
|
||||
if (message->what == B_GET_PROPERTY || message->what == B_SET_PROPERTY) {
|
||||
BMessage reply(B_REPLY);
|
||||
@ -199,7 +203,7 @@ BControl::MessageReceived(BMessage *message)
|
||||
BMessage specifier;
|
||||
int32 index;
|
||||
int32 form;
|
||||
const char *property;
|
||||
const char* property;
|
||||
if (message->GetCurrentSpecifier(&index, &specifier, &form, &property) == B_OK) {
|
||||
if (strcmp(property, "Label") == 0) {
|
||||
if (message->what == B_GET_PROPERTY) {
|
||||
@ -207,7 +211,7 @@ BControl::MessageReceived(BMessage *message)
|
||||
handled = true;
|
||||
} else {
|
||||
// B_SET_PROPERTY
|
||||
const char *label;
|
||||
const char* label;
|
||||
if (message->FindString("data", &label) == B_OK) {
|
||||
SetLabel(label);
|
||||
reply.AddInt32("error", B_OK);
|
||||
@ -271,7 +275,7 @@ BControl::MakeFocus(bool focused)
|
||||
|
||||
|
||||
void
|
||||
BControl::KeyDown(const char *bytes, int32 numBytes)
|
||||
BControl::KeyDown(const char* bytes, int32 numBytes)
|
||||
{
|
||||
if (*bytes == B_ENTER || *bytes == B_SPACE) {
|
||||
if (!fEnabled)
|
||||
@ -285,28 +289,28 @@ BControl::KeyDown(const char *bytes, int32 numBytes)
|
||||
|
||||
|
||||
void
|
||||
BControl::MouseDown(BPoint point)
|
||||
BControl::MouseDown(BPoint where)
|
||||
{
|
||||
BView::MouseDown(point);
|
||||
BView::MouseDown(where);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
BControl::MouseUp(BPoint point)
|
||||
BControl::MouseUp(BPoint where)
|
||||
{
|
||||
BView::MouseUp(point);
|
||||
BView::MouseUp(where);
|
||||
}
|
||||
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
BControl::SetLabel(const char *label)
|
||||
BControl::SetLabel(const char* label)
|
||||
{
|
||||
if (label != NULL && !label[0])
|
||||
label = NULL;
|
||||
@ -324,7 +328,7 @@ BControl::SetLabel(const char *label)
|
||||
}
|
||||
|
||||
|
||||
const char *
|
||||
const char*
|
||||
BControl::Label() const
|
||||
{
|
||||
return fLabel;
|
||||
@ -387,7 +391,7 @@ BControl::IsEnabled() const
|
||||
|
||||
|
||||
void
|
||||
BControl::GetPreferredSize(float *_width, float *_height)
|
||||
BControl::GetPreferredSize(float* _width, float* _height)
|
||||
{
|
||||
BView::GetPreferredSize(_width, _height);
|
||||
}
|
||||
@ -401,7 +405,7 @@ BControl::ResizeToPreferred()
|
||||
|
||||
|
||||
status_t
|
||||
BControl::Invoke(BMessage *message)
|
||||
BControl::Invoke(BMessage* message)
|
||||
{
|
||||
bool notify = false;
|
||||
uint32 kind = InvokeKind(¬ify);
|
||||
@ -436,9 +440,9 @@ BControl::Invoke(BMessage *message)
|
||||
}
|
||||
|
||||
|
||||
BHandler *
|
||||
BControl::ResolveSpecifier(BMessage *message, int32 index,
|
||||
BMessage *specifier, int32 what, const char *property)
|
||||
BHandler*
|
||||
BControl::ResolveSpecifier(BMessage* message, int32 index,
|
||||
BMessage* specifier, int32 what, const char* property)
|
||||
{
|
||||
BPropertyInfo propInfo(sPropertyList);
|
||||
|
||||
@ -451,7 +455,7 @@ BControl::ResolveSpecifier(BMessage *message, int32 index,
|
||||
|
||||
|
||||
status_t
|
||||
BControl::GetSupportedSuites(BMessage *message)
|
||||
BControl::GetSupportedSuites(BMessage* message)
|
||||
{
|
||||
message->AddString("suites", "suite/vnd.Be-control");
|
||||
|
||||
@ -604,7 +608,7 @@ BControl::operator=(const BControl &)
|
||||
|
||||
|
||||
void
|
||||
BControl::InitData(BMessage *data)
|
||||
BControl::InitData(BMessage* data)
|
||||
{
|
||||
fLabel = NULL;
|
||||
SetLabel(B_EMPTY_STRING);
|
||||
|
Loading…
Reference in New Issue
Block a user