From 325a50a0c0ec92b3e0dc4dba039c688734876e80 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stephan=20A=C3=9Fmus?= Date: Thu, 27 May 2010 10:57:59 +0000 Subject: [PATCH] Set the background color in AttachedToWindow instead of repeatedly in Draw(). Try harder to avoid B_TRANSPARENT_COLOR of the parent. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36945 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/apps/launchbox/IconButton.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/apps/launchbox/IconButton.cpp b/src/apps/launchbox/IconButton.cpp index ae21bdfd6a..85eaf35407 100644 --- a/src/apps/launchbox/IconButton.cpp +++ b/src/apps/launchbox/IconButton.cpp @@ -69,6 +69,16 @@ IconButton::MessageReceived(BMessage* message) void IconButton::AttachedToWindow() { + rgb_color background = B_TRANSPARENT_COLOR; + if (BView* parent = Parent()) { + background = parent->ViewColor(); + if (background == B_TRANSPARENT_COLOR) + background = parent->LowColor(); + } + if (background == B_TRANSPARENT_COLOR) + background = ui_color(B_PANEL_BACKGROUND_COLOR); + SetLowColor(background); + SetTarget(fTargetCache); if (!Target()) SetTarget(Window()); @@ -79,8 +89,6 @@ void IconButton::Draw(BRect area) { rgb_color background = LowColor(); - if (BView* parent = Parent()) - background = parent->LowColor(); BRect r(Bounds());