diff --git a/src/kits/interface/Box.cpp b/src/kits/interface/Box.cpp index abf5070160..26eb9cfc0d 100644 --- a/src/kits/interface/Box.cpp +++ b/src/kits/interface/Box.cpp @@ -273,9 +273,15 @@ BBox::Draw(BRect updateRect) void BBox::AttachedToWindow() { - if (Parent()) { - SetViewColor(Parent()->ViewColor()); - SetLowColor(Parent()->ViewColor()); + BView* parent = Parent(); + if (parent != NULL) { + // inherit the color from parent + rgb_color color = parent->ViewColor(); + if (color == B_TRANSPARENT_COLOR) + color = ui_color(B_PANEL_BACKGROUND_COLOR); + + SetViewColor(color); + SetLowColor(color); } // The box could have been resized in the mean time diff --git a/src/kits/interface/Control.cpp b/src/kits/interface/Control.cpp index d293c6c1e7..0697b55417 100644 --- a/src/kits/interface/Control.cpp +++ b/src/kits/interface/Control.cpp @@ -142,9 +142,10 @@ BControl::WindowActivated(bool active) void BControl::AttachedToWindow() { - if (Parent()) { + BView* parent = Parent(); + if (parent != NULL) { // inherit the color from parent - rgb_color color = Parent()->ViewColor(); + rgb_color color = parent->ViewColor(); if (color == B_TRANSPARENT_COLOR) color = ui_color(B_PANEL_BACKGROUND_COLOR); diff --git a/src/kits/interface/MenuField.cpp b/src/kits/interface/MenuField.cpp index d0f6a19c63..9affa1e270 100644 --- a/src/kits/interface/MenuField.cpp +++ b/src/kits/interface/MenuField.cpp @@ -280,9 +280,15 @@ BMenuField::Draw(BRect update) void BMenuField::AttachedToWindow() { - if (Parent()) { - SetViewColor(Parent()->ViewColor()); - SetLowColor(Parent()->ViewColor()); + BView* parent = Parent(); + if (parent != NULL) { + // inherit the color from parent + rgb_color color = parent->ViewColor(); + if (color == B_TRANSPARENT_COLOR) + color = ui_color(B_PANEL_BACKGROUND_COLOR); + + SetViewColor(color); + SetLowColor(color); } } diff --git a/src/kits/interface/Slider.cpp b/src/kits/interface/Slider.cpp index e3f4e8c090..730e107261 100644 --- a/src/kits/interface/Slider.cpp +++ b/src/kits/interface/Slider.cpp @@ -330,19 +330,9 @@ BSlider::AttachedToWindow() BControl::AttachedToWindow(); BView* view = OffscreenView(); - if (view) { - rgb_color color = ViewColor(); - if (Parent() != NULL) - color = Parent()->ViewColor(); - -/* fOffScreenBits->Lock(); - fOffScreenView->SetViewColor(color); - fOffScreenView->SetLowColor(color); - fOffScreenBits->Unlock();*/ - - view->LockLooper(); + if (view && view->LockLooper()) { view->SetViewColor(B_TRANSPARENT_COLOR); - view->SetLowColor(color); + view->SetLowColor(ViewColor()); view->UnlockLooper(); } diff --git a/src/kits/interface/StatusBar.cpp b/src/kits/interface/StatusBar.cpp index e70181fe78..5aba252e79 100644 --- a/src/kits/interface/StatusBar.cpp +++ b/src/kits/interface/StatusBar.cpp @@ -146,9 +146,16 @@ BStatusBar::AttachedToWindow() ResizeTo(Bounds().Width(), height); SetViewColor(B_TRANSPARENT_COLOR); + rgb_color lowColor = B_TRANSPARENT_COLOR; - if (Parent()) - SetLowColor(Parent()->ViewColor()); + BView* parent = Parent(); + if (parent != NULL) + lowColor = parent->ViewColor(); + + if (lowColor == B_TRANSPARENT_COLOR) + lowColor = ui_color(B_PANEL_BACKGROUND_COLOR); + + SetLowColor(lowColor); fTextDivider = Bounds().Width(); }