BTextControl::AttachedToWindow() set wrong colors in case the control was
disabled (unlike SetEnabled()). They are now both using the correctly working _UpdateTextViewColors() method. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@16333 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
f3eeafa8b9
commit
3a3f6c1ee9
|
@ -81,6 +81,7 @@ class BTextControl : public BControl {
|
||||||
BTextControl& operator=(const BTextControl& other);
|
BTextControl& operator=(const BTextControl& other);
|
||||||
|
|
||||||
void _CommitValue();
|
void _CommitValue();
|
||||||
|
void _UpdateTextViewColors();
|
||||||
void _InitData(const char* label, const char* initialText,
|
void _InitData(const char* label, const char* initialText,
|
||||||
BMessage* archive = NULL);
|
BMessage* archive = NULL);
|
||||||
|
|
||||||
|
|
|
@ -324,31 +324,8 @@ BTextControl::AttachedToWindow()
|
||||||
{
|
{
|
||||||
BControl::AttachedToWindow();
|
BControl::AttachedToWindow();
|
||||||
|
|
||||||
bool enabled = IsEnabled();
|
_UpdateTextViewColors();
|
||||||
rgb_color textColor;
|
fText->MakeEditable(IsEnabled());
|
||||||
rgb_color color = HighColor();
|
|
||||||
BFont font;
|
|
||||||
|
|
||||||
fText->GetFontAndColor(0, &font, &color);
|
|
||||||
|
|
||||||
if (enabled)
|
|
||||||
textColor = color;
|
|
||||||
else
|
|
||||||
textColor = tint_color(color, B_LIGHTEN_2_TINT);
|
|
||||||
|
|
||||||
fText->SetFontAndColor(&font, B_FONT_ALL, &textColor);
|
|
||||||
|
|
||||||
if (enabled) {
|
|
||||||
color.red = 255;
|
|
||||||
color.green = 255;
|
|
||||||
color.blue = 255;
|
|
||||||
} else
|
|
||||||
color = tint_color(color, B_LIGHTEN_2_TINT);
|
|
||||||
|
|
||||||
fText->SetViewColor(color);
|
|
||||||
fText->SetLowColor(color);
|
|
||||||
|
|
||||||
fText->MakeEditable(enabled);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -373,29 +350,7 @@ BTextControl::SetEnabled(bool state)
|
||||||
if (Window()) {
|
if (Window()) {
|
||||||
fText->MakeEditable(state);
|
fText->MakeEditable(state);
|
||||||
|
|
||||||
rgb_color textColor;
|
_UpdateTextViewColors();
|
||||||
rgb_color color = {0, 0, 0, 255};
|
|
||||||
BFont font;
|
|
||||||
|
|
||||||
fText->GetFontAndColor(0, &font, &color);
|
|
||||||
|
|
||||||
if (state)
|
|
||||||
textColor = color;
|
|
||||||
else
|
|
||||||
textColor = tint_color(color, B_DISABLED_LABEL_TINT);
|
|
||||||
|
|
||||||
fText->SetFontAndColor(&font, B_FONT_ALL, &textColor);
|
|
||||||
|
|
||||||
if (state) {
|
|
||||||
color.red = 255;
|
|
||||||
color.green = 255;
|
|
||||||
color.blue = 255;
|
|
||||||
} else
|
|
||||||
color = tint_color(ui_color(B_PANEL_BACKGROUND_COLOR),
|
|
||||||
B_LIGHTEN_2_TINT);
|
|
||||||
|
|
||||||
fText->SetViewColor(color);
|
|
||||||
fText->SetLowColor(color);
|
|
||||||
|
|
||||||
fText->Invalidate();
|
fText->Invalidate();
|
||||||
Window()->UpdateIfNeeded();
|
Window()->UpdateIfNeeded();
|
||||||
|
@ -622,6 +577,37 @@ BTextControl::operator=(const BTextControl&)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
BTextControl::_UpdateTextViewColors()
|
||||||
|
{
|
||||||
|
bool enabled = IsEnabled();
|
||||||
|
rgb_color textColor;
|
||||||
|
rgb_color color = {0, 0, 0, 255};
|
||||||
|
BFont font;
|
||||||
|
|
||||||
|
fText->GetFontAndColor(0, &font, &color);
|
||||||
|
|
||||||
|
if (enabled)
|
||||||
|
textColor = color;
|
||||||
|
else
|
||||||
|
textColor = tint_color(color, B_DISABLED_LABEL_TINT);
|
||||||
|
|
||||||
|
fText->SetFontAndColor(&font, B_FONT_ALL, &textColor);
|
||||||
|
|
||||||
|
if (enabled) {
|
||||||
|
color.red = 255;
|
||||||
|
color.green = 255;
|
||||||
|
color.blue = 255;
|
||||||
|
} else {
|
||||||
|
color = tint_color(ui_color(B_PANEL_BACKGROUND_COLOR),
|
||||||
|
B_LIGHTEN_2_TINT);
|
||||||
|
}
|
||||||
|
|
||||||
|
fText->SetViewColor(color);
|
||||||
|
fText->SetLowColor(color);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
BTextControl::_CommitValue()
|
BTextControl::_CommitValue()
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue