[haiku-development] Re: [RFC] BStringView HighColor

  • From: John Scipione <jscipione@xxxxxxxxx>
  • To: "haiku-development@xxxxxxxxxxxxx" <haiku-development@xxxxxxxxxxxxx>
  • Date: Tue, 14 Jan 2014 12:18:06 -0500

On Tuesday, January 14, 2014, François Revol wrote:

> On 14/01/2014 03:55, John Scipione wrote:
> > On Monday, January 13, 2014, François Revol wrote:
> >
> >> On 14/01/2014 01:57, John Scipione wrote:
> >>
> >>>>> And those themes should set their B_PANEL_TEXT_COLOR to something
> >>>>> light so that it shows up correctly.
> >>>>
> >>>> And they do.
> >>>> The problem is in most cases the ViewColor is set correctly but the
> text
> >>>> color is just ignored, so falls back to black.
> >>>>
> >>>> This is the case in AboutSystem, and BStringView itself, which sets
> the
> >>>> bg color but not the text color.
> >>>
> >>> Okay, well, then set the text color in AboutSystem, it's not a bug in
> >>> BStringView.
> >>
> >> It is, since it already tries to use ui_color(), but not completely.
> >>
> >
> > BStringView uses ui_color() to set the view color based on the parent
> view
> > on AttachedToWindow() but inherits it's low color and high color from
> > BView. That's the intended behavior. There's no bug in BStringView.
> Someone
> > please correct me if I'm wrong here.
>
> No, it tries to use the parent's ViewColor, but if also transparent it
> uses ui_color(B_PANEL_BACKGROUND_COLOR).
>
> So it is not completely black and white.


 It seems you may have a point here. From the BeBook:
AttachedToWindow()
virtual void AttachedToWindow();

Sets the BStringView's low color and its background view color to match the
background color of its new parent view.

See also: 
BView::AttachedToWindow()<http://www.haiku-os.org/legacy-docs/bebook/BView.html#BView_AttachedToWindow>
So it seems that BStringView should set its view color AND low color based
on the parent view.

Unlike the ViewColor though, HighColor is often changed when drawing
> things in controls, so just setting it at first doesn't always work...
> But at least for BStringView it should.


If that happens someplace it should be fixed there by saving the high color
to a variable, setting a new high color, draw, and then set the high color
back. Alternatively one could use PushState() and PopState() minding the
performance overhead those methods imply.

Other related posts: