* improve look of drop target indicator in Locale prefs, as it was too ugly even for

my not so visually inclined taste - we now use a gradient which IMHO gives much
  more pleasant results
* add TODO about whether or not code for drawing drop target inidicators should be
  added to ControlLook (or some other class with similar purpose)


  

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42689 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Oliver Tappe
2011-08-25 20:20:32 +00:00
parent 51a01ea03b
commit a3ab429e07
+20 -2
View File
@@ -19,7 +19,9 @@
#include <Bitmap.h>
#include <Catalog.h>
#include <FormattingConventions.h>
#include <GradientLinear.h>
#include <LocaleRoster.h>
#include <Region.h>
#include <Window.h>
@@ -264,8 +266,24 @@ LanguageListView::Draw(BRect updateRect)
BOutlineListView::Draw(updateRect);
if (fDropIndex >= 0 && fDropTargetHighlightFrame.IsValid()) {
SetHighColor(ui_color(B_CONTROL_HIGHLIGHT_COLOR));
StrokeRect(fDropTargetHighlightFrame);
// TODO: decide if drawing of a drop target indicator should be moved
// into ControlLook
BGradientLinear gradient;
int step = fGlobalDropTargetIndicator ? 64 : 128;
for (int i = 0; i < 256; i += step)
gradient.AddColor(i % (step * 2) == 0
? ViewColor() : ui_color(B_CONTROL_HIGHLIGHT_COLOR), i);
gradient.AddColor(ViewColor(), 255);
gradient.SetStart(fDropTargetHighlightFrame.LeftTop());
gradient.SetEnd(fDropTargetHighlightFrame.RightBottom());
if (fGlobalDropTargetIndicator) {
BRegion region(fDropTargetHighlightFrame);
region.Exclude(fDropTargetHighlightFrame.InsetByCopy(2.0, 2.0));
ConstrainClippingRegion(&region);
FillRect(fDropTargetHighlightFrame, gradient);
ConstrainClippingRegion(NULL);
} else
FillRect(fDropTargetHighlightFrame, gradient);
}
}