BAbstractSpinner Colors
Adopted parent colors for the text view - should not have done so. Disabled colors were incorrect, so I also corrected those in this patch. Fixes #12574. Signed-off-by: Jessica Hamilton <[email protected]>
This commit is contained in:
committed by
Jessica Hamilton
parent
5bc6713473
commit
f9f16ddb2c
@@ -59,6 +59,7 @@ public:
|
|||||||
virtual void Draw(BRect updateRect);
|
virtual void Draw(BRect updateRect);
|
||||||
virtual void FrameResized(float width, float height);
|
virtual void FrameResized(float width, float height);
|
||||||
virtual void ValueChanged();
|
virtual void ValueChanged();
|
||||||
|
virtual void MessageReceived(BMessage* message);
|
||||||
|
|
||||||
virtual void Decrement() = 0;
|
virtual void Decrement() = 0;
|
||||||
virtual void Increment() = 0;
|
virtual void Increment() = 0;
|
||||||
|
|||||||
@@ -545,7 +545,6 @@ SpinnerTextView::AttachedToWindow()
|
|||||||
{
|
{
|
||||||
fParent = static_cast<BAbstractSpinner*>(Parent());
|
fParent = static_cast<BAbstractSpinner*>(Parent());
|
||||||
|
|
||||||
AdoptParentColors();
|
|
||||||
BTextView::AttachedToWindow();
|
BTextView::AttachedToWindow();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1069,6 +1068,16 @@ BAbstractSpinner::ValueChanged()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
BAbstractSpinner::MessageReceived(BMessage* message)
|
||||||
|
{
|
||||||
|
if (!IsEnabled() && message->what == B_COLORS_UPDATED)
|
||||||
|
_UpdateTextViewColors(false);
|
||||||
|
|
||||||
|
BControl::MessageReceived(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
BAbstractSpinner::MakeFocus(bool focus)
|
BAbstractSpinner::MakeFocus(bool focus)
|
||||||
{
|
{
|
||||||
@@ -1585,36 +1594,24 @@ BAbstractSpinner::_UpdateFrame()
|
|||||||
void
|
void
|
||||||
BAbstractSpinner::_UpdateTextViewColors(bool enable)
|
BAbstractSpinner::_UpdateTextViewColors(bool enable)
|
||||||
{
|
{
|
||||||
rgb_color textColor;
|
// Mimick BTextControl's appearance.
|
||||||
BFont font;
|
rgb_color textColor = ui_color(B_DOCUMENT_TEXT_COLOR);
|
||||||
|
|
||||||
fTextView->GetFontAndColor(0, &font);
|
|
||||||
|
|
||||||
if (enable)
|
|
||||||
textColor = ui_color(B_DOCUMENT_TEXT_COLOR);
|
|
||||||
else {
|
|
||||||
textColor = tint_color(ui_color(B_PANEL_BACKGROUND_COLOR),
|
|
||||||
B_DISABLED_LABEL_TINT);
|
|
||||||
}
|
|
||||||
|
|
||||||
fTextView->SetFontAndColor(&font, B_FONT_ALL, &textColor);
|
|
||||||
|
|
||||||
if (enable) {
|
if (enable) {
|
||||||
fTextView->SetViewUIColor(B_DOCUMENT_BACKGROUND_COLOR);
|
fTextView->SetViewUIColor(B_DOCUMENT_BACKGROUND_COLOR);
|
||||||
fTextView->SetLowUIColor(ViewUIColor());
|
fTextView->SetLowUIColor(ViewUIColor());
|
||||||
} else {
|
} else {
|
||||||
color_which which = ViewUIColor();
|
rgb_color color = ui_color(B_DOCUMENT_BACKGROUND_COLOR);
|
||||||
|
color = disable_color(ViewColor(), color);
|
||||||
|
textColor = disable_color(textColor, ViewColor());
|
||||||
|
|
||||||
if (which != B_NO_COLOR) {
|
fTextView->SetViewColor(color);
|
||||||
fTextView->SetViewUIColor(which, B_LIGHTEN_2_TINT);
|
fTextView->SetLowColor(color);
|
||||||
fTextView->SetLowUIColor(which, B_LIGHTEN_2_TINT);
|
|
||||||
} else {
|
|
||||||
rgb_color color = tint_color(ViewColor(), B_LIGHTEN_2_TINT);
|
|
||||||
fTextView->SetViewColor(color);
|
|
||||||
fTextView->SetLowColor(color);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BFont font;
|
||||||
|
fTextView->GetFontAndColor(0, &font);
|
||||||
|
fTextView->SetFontAndColor(&font, B_FONT_ALL, &textColor);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user