BToolBar: Convert to using Set*UIColor.
This was a bigger change than many others as BButton now defaults to using control background colors, and we can not do that here without the buttons not appearing as we desire (blending in with the toolbar). Using the control background color for the toolbar would be unacceptable. Signed-off-by: Augustin Cavalier <waddlesplash@gmail.com> Patch 0041 from looncraz, unmodified.
This commit is contained in:
parent
c5b4dc4007
commit
f56d45ced4
@ -14,7 +14,38 @@
|
||||
namespace BPrivate {
|
||||
|
||||
|
||||
class LockableButton: public BButton {
|
||||
|
||||
// Button to adopt backgrond color of toolbar
|
||||
class ToolBarButton : public BButton {
|
||||
public:
|
||||
ToolBarButton(const char* name, const char* label,
|
||||
BMessage* message);
|
||||
|
||||
void AttachedToWindow();
|
||||
};
|
||||
|
||||
|
||||
ToolBarButton::ToolBarButton(const char* name, const char* label,
|
||||
BMessage* message)
|
||||
:
|
||||
BButton(name, label, message)
|
||||
{}
|
||||
|
||||
|
||||
void
|
||||
ToolBarButton::AttachedToWindow()
|
||||
{
|
||||
BButton::AttachedToWindow();
|
||||
SetLowUIColor(B_PANEL_BACKGROUND_COLOR);
|
||||
SetViewUIColor(B_PANEL_BACKGROUND_COLOR);
|
||||
// have to remove the darkening caused by BButton's drawing
|
||||
}
|
||||
|
||||
|
||||
//# pragma mark -
|
||||
|
||||
|
||||
class LockableButton: public ToolBarButton {
|
||||
public:
|
||||
LockableButton(const char* name, const char* label,
|
||||
BMessage* message);
|
||||
@ -26,7 +57,7 @@ public:
|
||||
LockableButton::LockableButton(const char* name, const char* label,
|
||||
BMessage* message)
|
||||
:
|
||||
BButton(name, label, message)
|
||||
ToolBarButton(name, label, message)
|
||||
{
|
||||
}
|
||||
|
||||
@ -40,10 +71,13 @@ LockableButton::MouseDown(BPoint point)
|
||||
SetBehavior(B_BUTTON_BEHAVIOR);
|
||||
|
||||
Message()->SetInt32("behavior", Behavior());
|
||||
BButton::MouseDown(point);
|
||||
ToolBarButton::MouseDown(point);
|
||||
}
|
||||
|
||||
|
||||
//#pragma mark -
|
||||
|
||||
|
||||
BToolBar::BToolBar(BRect frame, orientation ont)
|
||||
:
|
||||
BGroupView(ont),
|
||||
@ -94,11 +128,11 @@ BToolBar::AddAction(BMessage* message, BHandler* target,
|
||||
const BBitmap* icon, const char* toolTipText, const char* text,
|
||||
bool lockable)
|
||||
{
|
||||
BButton* button;
|
||||
ToolBarButton* button;
|
||||
if (lockable)
|
||||
button = new LockableButton(NULL, NULL, message);
|
||||
else
|
||||
button = new BButton(NULL, NULL, message);
|
||||
button = new ToolBarButton(NULL, NULL, message);
|
||||
button->SetIcon(icon);
|
||||
button->SetFlat(true);
|
||||
if (toolTipText != NULL)
|
||||
@ -186,7 +220,6 @@ BToolBar::FindButton(uint32 command) const
|
||||
|
||||
// #pragma mark - Private methods
|
||||
|
||||
|
||||
void
|
||||
BToolBar::Pulse()
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user