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