BPictureButton: Style fixes related to documentation

Some variable renaming for consistency.
This commit is contained in:
John Scipione
2014-05-19 20:13:38 -04:00
parent df48d3f9a8
commit c109d7e06f
2 changed files with 32 additions and 42 deletions
+5 -5
View File
@@ -22,7 +22,7 @@ public:
BPicture* off, BPicture* on, BPicture* off, BPicture* on,
BMessage* message, BMessage* message,
uint32 behavior = B_ONE_STATE_BUTTON, uint32 behavior = B_ONE_STATE_BUTTON,
uint32 resizeMask = B_FOLLOW_LEFT uint32 resizingMode = B_FOLLOW_LEFT
| B_FOLLOW_TOP, | B_FOLLOW_TOP,
uint32 flgs = B_WILL_DRAW | B_NAVIGABLE); uint32 flgs = B_WILL_DRAW | B_NAVIGABLE);
BPictureButton(BMessage* archive); BPictureButton(BMessage* archive);
@@ -56,10 +56,10 @@ public:
virtual void MouseMoved(BPoint where, uint32 transit, virtual void MouseMoved(BPoint where, uint32 transit,
const BMessage* message); const BMessage* message);
virtual void SetEnabledOn(BPicture* on); virtual void SetEnabledOn(BPicture* picture);
virtual void SetEnabledOff(BPicture* off); virtual void SetEnabledOff(BPicture* picture);
virtual void SetDisabledOn(BPicture* on); virtual void SetDisabledOn(BPicture* picture);
virtual void SetDisabledOff(BPicture* off); virtual void SetDisabledOff(BPicture* picture);
BPicture* EnabledOn() const; BPicture* EnabledOn() const;
BPicture* EnabledOff() const; BPicture* EnabledOff() const;
+27 -37
View File
@@ -6,6 +6,7 @@
* Graham MacDonald ([email protected]) * Graham MacDonald ([email protected])
*/ */
#include <PictureButton.h> #include <PictureButton.h>
#include <new> #include <new>
@@ -14,10 +15,10 @@
BPictureButton::BPictureButton(BRect frame, const char* name, BPictureButton::BPictureButton(BRect frame, const char* name,
BPicture* off, BPicture* on, BMessage* message, BPicture* off, BPicture* on, BMessage* message,
uint32 behavior, uint32 resizeMask, uint32 flags) uint32 behavior, uint32 resizingMode, uint32 flags)
: :
BControl(frame, name, "", message, resizeMask, flags), BControl(frame, name, "", message, resizingMode, flags),
fEnabledOff(new(std::nothrow) BPicture(*off)), fEnabledOff(new(std::nothrow) BPicture(*off)),
fEnabledOn(new(std::nothrow) BPicture(*on)), fEnabledOn(new(std::nothrow) BPicture(*on)),
fDisabledOff(NULL), fDisabledOff(NULL),
@@ -38,7 +39,7 @@ BPictureButton::BPictureButton(BMessage* data)
BMessage pictureArchive; BMessage pictureArchive;
// Default to 1 state button if not here - is this valid? // Default to 1 state button if not here - is this valid?
if (data->FindInt32 ("_behave", (int32* )&fBehavior) != B_OK) if (data->FindInt32("_behave", (int32*)&fBehavior) != B_OK)
fBehavior = B_ONE_STATE_BUTTON; fBehavior = B_ONE_STATE_BUTTON;
// Now expand the pictures: // Now expand the pictures:
@@ -65,9 +66,6 @@ BPictureButton::~BPictureButton()
} }
// #pragma mark -
BArchivable* BArchivable*
BPictureButton::Instantiate(BMessage* data) BPictureButton::Instantiate(BMessage* data)
{ {
@@ -120,9 +118,6 @@ BPictureButton::Archive(BMessage* data, bool deep) const
} }
// #pragma mark -
void void
BPictureButton::AttachedToWindow() BPictureButton::AttachedToWindow()
{ {
@@ -151,9 +146,6 @@ BPictureButton::AllDetached()
} }
// #pragma mark -
void void
BPictureButton::ResizeToPreferred() BPictureButton::ResizeToPreferred()
{ {
@@ -182,9 +174,6 @@ BPictureButton::FrameResized(float newWidth, float newHeight)
} }
// #pragma mark -
void void
BPictureButton::WindowActivated(bool state) BPictureButton::WindowActivated(bool state)
{ {
@@ -227,9 +216,9 @@ BPictureButton::Draw(BRect updateRect)
void void
BPictureButton::MessageReceived(BMessage* msg) BPictureButton::MessageReceived(BMessage* message)
{ {
BControl::MessageReceived(msg); BControl::MessageReceived(message);
} }
@@ -260,10 +249,10 @@ BPictureButton::KeyDown(const char* bytes, int32 numBytes)
void void
BPictureButton::MouseDown(BPoint point) BPictureButton::MouseDown(BPoint where)
{ {
if (!IsEnabled()) { if (!IsEnabled()) {
BControl::MouseDown(point); BControl::MouseDown(where);
return; return;
} }
@@ -283,10 +272,10 @@ BPictureButton::MouseDown(BPoint point)
void void
BPictureButton::MouseUp(BPoint point) BPictureButton::MouseUp(BPoint where)
{ {
if (IsEnabled() && IsTracking()) { if (IsEnabled() && IsTracking()) {
if (Bounds().Contains(point)) { if (Bounds().Contains(where)) {
if (fBehavior == B_ONE_STATE_BUTTON) { if (fBehavior == B_ONE_STATE_BUTTON) {
if (Value() == B_CONTROL_ON) { if (Value() == B_CONTROL_ON) {
snooze(75000); snooze(75000);
@@ -302,7 +291,8 @@ BPictureButton::MouseUp(BPoint point)
void void
BPictureButton::MouseMoved(BPoint point, uint32 transit, const BMessage* msg) BPictureButton::MouseMoved(BPoint where, uint32 transit,
const BMessage* message)
{ {
if (IsEnabled() && IsTracking()) { if (IsEnabled() && IsTracking()) {
if (transit == B_EXITED_VIEW) if (transit == B_EXITED_VIEW)
@@ -310,7 +300,7 @@ BPictureButton::MouseMoved(BPoint point, uint32 transit, const BMessage* msg)
else if (transit == B_ENTERED_VIEW) else if (transit == B_ENTERED_VIEW)
SetValue(B_CONTROL_ON); SetValue(B_CONTROL_ON);
} else } else
BControl::MouseMoved(point, transit, msg); BControl::MouseMoved(where, transit, message);
} }
@@ -318,34 +308,34 @@ BPictureButton::MouseMoved(BPoint point, uint32 transit, const BMessage* msg)
void void
BPictureButton::SetEnabledOn(BPicture* on) BPictureButton::SetEnabledOn(BPicture* picture)
{ {
delete fEnabledOn; delete fEnabledOn;
fEnabledOn = new (std::nothrow) BPicture(*on); fEnabledOn = new (std::nothrow) BPicture(*picture);
} }
void void
BPictureButton::SetEnabledOff(BPicture* off) BPictureButton::SetEnabledOff(BPicture* picture)
{ {
delete fEnabledOff; delete fEnabledOff;
fEnabledOff = new (std::nothrow) BPicture(*off); fEnabledOff = new (std::nothrow) BPicture(*picture);
} }
void void
BPictureButton::SetDisabledOn(BPicture* on) BPictureButton::SetDisabledOn(BPicture* picture)
{ {
delete fDisabledOn; delete fDisabledOn;
fDisabledOn = new (std::nothrow) BPicture(*on); fDisabledOn = new (std::nothrow) BPicture(*picture);
} }
void void
BPictureButton::SetDisabledOff(BPicture* off) BPictureButton::SetDisabledOff(BPicture* picture)
{ {
delete fDisabledOff; delete fDisabledOff;
fDisabledOff = new (std::nothrow) BPicture(*off); fDisabledOff = new (std::nothrow) BPicture(*picture);
} }
@@ -399,17 +389,17 @@ BPictureButton::SetValue(int32 value)
status_t status_t
BPictureButton::Invoke(BMessage* msg) BPictureButton::Invoke(BMessage* message)
{ {
return BControl::Invoke(msg); return BControl::Invoke(message);
} }
BHandler* BHandler*
BPictureButton::ResolveSpecifier(BMessage* msg, int32 index, BPictureButton::ResolveSpecifier(BMessage* message, int32 index,
BMessage* specifier, int32 form, const char* property) BMessage* specifier, int32 form, const char* property)
{ {
return BControl::ResolveSpecifier(msg, index, specifier, form, property); return BControl::ResolveSpecifier(message, index, specifier, form, property);
} }
@@ -488,7 +478,7 @@ BPictureButton::SetIcon(const BBitmap* icon, uint32 flags)
} }
// #pragma mark - // #pragma mark - BPictureButton private methods
void BPictureButton::_ReservedPictureButton1() {} void BPictureButton::_ReservedPictureButton1() {}