BButton style fixes

This commit is contained in:
John Scipione
2014-04-24 15:31:12 -04:00
parent c161ea9ac2
commit a631719fb4
+36 -24
View File
@@ -39,9 +39,10 @@ static const float kLabelMargin = 3;
BButton::BButton(BRect frame, const char* name, const char* label,
BMessage* message, uint32 resizingMode, uint32 flags)
: BControl(frame, name, label, message, resizingMode,
flags | B_WILL_DRAW | B_FULL_UPDATE_ON_RESIZE),
BMessage* message, uint32 resizingMode, uint32 flags)
:
BControl(frame, name, label, message, resizingMode,
flags | B_WILL_DRAW | B_FULL_UPDATE_ON_RESIZE),
fPreferredSize(-1, -1),
fFlags(0),
fBehavior(B_BUTTON_BEHAVIOR),
@@ -57,9 +58,10 @@ BButton::BButton(BRect frame, const char* name, const char* label,
BButton::BButton(const char* name, const char* label, BMessage* message,
uint32 flags)
: BControl(name, label, message,
flags | B_WILL_DRAW | B_FULL_UPDATE_ON_RESIZE),
uint32 flags)
:
BControl(name, label, message,
flags | B_WILL_DRAW | B_FULL_UPDATE_ON_RESIZE),
fPreferredSize(-1, -1),
fFlags(0),
fBehavior(B_BUTTON_BEHAVIOR),
@@ -69,8 +71,9 @@ BButton::BButton(const char* name, const char* label, BMessage* message,
BButton::BButton(const char* label, BMessage* message)
: BControl(NULL, label, message,
B_WILL_DRAW | B_NAVIGABLE | B_FULL_UPDATE_ON_RESIZE),
:
BControl(NULL, label, message,
B_WILL_DRAW | B_NAVIGABLE | B_FULL_UPDATE_ON_RESIZE),
fPreferredSize(-1, -1),
fFlags(0),
fBehavior(B_BUTTON_BEHAVIOR),
@@ -86,7 +89,8 @@ BButton::~BButton()
BButton::BButton(BMessage* archive)
: BControl(archive),
:
BControl(archive),
fPreferredSize(-1, -1),
fFlags(0),
fBehavior(B_BUTTON_BEHAVIOR),
@@ -235,7 +239,7 @@ BButton::AttachedToWindow()
void
BButton::KeyDown(const char *bytes, int32 numBytes)
BButton::KeyDown(const char* bytes, int32 numBytes)
{
if (*bytes == B_ENTER || *bytes == B_SPACE) {
if (!IsEnabled())
@@ -257,8 +261,8 @@ BButton::KeyDown(const char *bytes, int32 numBytes)
void
BButton::MakeDefault(bool flag)
{
BButton *oldDefault = NULL;
BWindow *window = Window();
BButton* oldDefault = NULL;
BWindow* window = Window();
if (window)
oldDefault = window->DefaultButton();
@@ -296,7 +300,7 @@ BButton::MakeDefault(bool flag)
void
BButton::SetLabel(const char *string)
BButton::SetLabel(const char* string)
{
BControl::SetLabel(string);
}
@@ -358,7 +362,7 @@ BButton::SetPopUpMessage(BMessage* message)
void
BButton::MessageReceived(BMessage *message)
BButton::MessageReceived(BMessage* message)
{
BControl::MessageReceived(message);
}
@@ -372,7 +376,7 @@ BButton::WindowActivated(bool active)
void
BButton::MouseMoved(BPoint point, uint32 transit, const BMessage *message)
BButton::MouseMoved(BPoint point, uint32 transit, const BMessage* message)
{
bool inside = Bounds().Contains(point);
if (_SetFlag(FLAG_INSIDE, inside))
@@ -425,7 +429,7 @@ BButton::SetValue(int32 value)
void
BButton::GetPreferredSize(float *_width, float *_height)
BButton::GetPreferredSize(float* _width, float* _height)
{
_ValidatePreferredSize();
@@ -445,7 +449,7 @@ BButton::ResizeToPreferred()
status_t
BButton::Invoke(BMessage *message)
BButton::Invoke(BMessage* message)
{
Sync();
snooze(50000);
@@ -494,17 +498,17 @@ BButton::AllDetached()
}
BHandler *
BButton::ResolveSpecifier(BMessage *message, int32 index,
BMessage *specifier, int32 what,
const char *property)
BHandler*
BButton::ResolveSpecifier(BMessage* message, int32 index,
BMessage* specifier, int32 what, const char* property)
{
return BControl::ResolveSpecifier(message, index, specifier, what, property);
return BControl::ResolveSpecifier(message, index, specifier, what,
property);
}
status_t
BButton::GetSupportedSuites(BMessage *message)
BButton::GetSupportedSuites(BMessage* message)
{
return BControl::GetSupportedSuites(message);
}
@@ -518,22 +522,27 @@ BButton::Perform(perform_code code, void* _data)
((perform_data_min_size*)_data)->return_value
= BButton::MinSize();
return B_OK;
case PERFORM_CODE_MAX_SIZE:
((perform_data_max_size*)_data)->return_value
= BButton::MaxSize();
return B_OK;
case PERFORM_CODE_PREFERRED_SIZE:
((perform_data_preferred_size*)_data)->return_value
= BButton::PreferredSize();
return B_OK;
case PERFORM_CODE_LAYOUT_ALIGNMENT:
((perform_data_layout_alignment*)_data)->return_value
= BButton::LayoutAlignment();
return B_OK;
case PERFORM_CODE_HAS_HEIGHT_FOR_WIDTH:
((perform_data_has_height_for_width*)_data)->return_value
= BButton::HasHeightForWidth();
return B_OK;
case PERFORM_CODE_GET_HEIGHT_FOR_WIDTH:
{
perform_data_get_height_for_width* data
@@ -542,12 +551,14 @@ BButton::Perform(perform_code code, void* _data)
&data->preferred);
return B_OK;
}
case PERFORM_CODE_SET_LAYOUT:
{
perform_data_set_layout* data = (perform_data_set_layout*)_data;
BButton::SetLayout(data->layout);
return B_OK;
}
case PERFORM_CODE_LAYOUT_INVALIDATED:
{
perform_data_layout_invalidated* data
@@ -555,11 +566,13 @@ BButton::Perform(perform_code code, void* _data)
BButton::LayoutInvalidated(data->descendants);
return B_OK;
}
case PERFORM_CODE_DO_LAYOUT:
{
BButton::DoLayout();
return B_OK;
}
case PERFORM_CODE_SET_ICON:
{
perform_data_set_icon* data = (perform_data_set_icon*)_data;
@@ -733,4 +746,3 @@ B_IF_GCC_2(InvalidateLayout__7BButtonb, _ZN7BButton16InvalidateLayoutEb)(
view->Perform(PERFORM_CODE_LAYOUT_INVALIDATED, &data);
}