Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2014-05

Colourful Themes

6 messages · 2 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Vojtěch Čihák

Hello,
?
I've got one question. Would it be possible to have colors in Themes? Now, when I set color of buttons to -for example- yellow, then TButton and TBitBtn are yellow while TSpeeddBtn remains "default". It is case of Qt4 and GTK2, while (unluckily) in Windows (Wine) it does not work with any of buttons. ?
Currently, there is (Themes.TThemeServices):
?
procedure DrawElement(DC: HDC; Details: TThemedElementDetails; const R: TRect; ClipRect: PRect = nil); virtual; ?
I think simply overload this method with one which will have one additional parameter - TColor. ?
Are widgetsets capable do it? I mean if there is support in libQT4pas and other bindings. ?
Thanks.
?
Vojt?ch?

Reply by email

zeljko
to Vojtěch Čihák
Vojt?ch ?ih?k wrote 9 lines
Hello, I've got one question. Would it be possible to have colors in Themes? Now, when I set color of buttons to -for example- yellow, then TButton and TBitBtn are yellow while TSpeeddBtn remains "default". It is case of Qt4 and GTK2, while (unluckily) in Windows (Wine) it does not work with any of buttons. Currently, there is (Themes.TThemeServices): procedure DrawElement(DC: HDC; Details: TThemedElementDetails; const R: TRect; ClipRect: PRect = nil); virtual; I think simply overload this method with one which will have one additional parameter - TColor.

hm...I don't think that color param is needed. If you set TWidgetSet.SetBgColor() DC brush is setted up to that color, so DC have information about brush color and can pass it to theme drawer (if ws supports overriding default theme brush).

Are widgetsets capable do it? I mean if there is support in libQT4pas and other bindings.

Qt can do that, don't know abot others.

zeljko

Reply by email

Vojtěch Čihák
to zeljko

Thanks,
?
I tried LCLIntf.SetBkColor(Canvas.Handle, clRed); and no visual change. And if I try writeln(ColorToString(LCLIntf.SetBkColor(HANDLE, $00FF0000))); it never returns the color that I set (Qt4, GTK2), so it seems widgetsets doesn't support it. ?
Vojt?ch?

Reply by email

zeljko
to Vojtěch Čihák
Vojt?ch ?ih?k wrote
Thanks, I tried LCLIntf.SetBkColor(Canvas.Handle, clRed); and no visual change. And if I try writeln(ColorToString(LCLIntf.SetBkColor(HANDLE, $00FF0000))); it never returns the color that I set (Qt4, GTK2), so it seems widgetsets doesn't support it.
1.SetBkColor as param uses TColorRef, not TColor
2.When setting new color with SetBkColor, old TColorRef is returned as
result.
var
   AOldColor, ANewColorRef: TColorRef;
begin
   ANewColorRef := ColorToRGB(clRed);
   AOldColor := LCLIntf.SetBkColor(Canvas.Handle, ANewColorRef);
   ...do something
   LCLIntf.SetBkColor(Canvas.Handle, AOldColor);
end;

zeljko

Reply by email

Vojtěch Čihák
to zeljko

I tried:
?
var aNewColor, aOldColor: TColorRef;
begin
aNewColor:=ColorToRGB(clRed);
aOldColor:=LCLIntf.SetBkColor(Canvas.Handle, aNewColor); ThemeServices.DrawElement(Canvas.Handle, ThemeServices.GetElementDetails(caThemedItems[AItemState]), ARect, nil); ? writeln(ColorToString(LCLIntf.SetBkColor(Canvas.Handle, AOldColor))); ? ?
Now the output is now clRed, which means that clRed was set during DrawElement but painted element (tbPushButtonNormal) is still default. ?
Vojt?ch?

Reply by email

zeljko
to Vojtěch Čihák
Vojt?ch ?ih?k wrote 10 lines
I tried: var aNewColor, aOldColor: TColorRef; begin aNewColor:=ColorToRGB(clRed); aOldColor:=LCLIntf.SetBkColor(Canvas.Handle, aNewColor); ThemeServices.DrawElement(Canvas.Handle, ThemeServices.GetElementDetails(caThemedItems[AItemState]), ARect, nil); writeln(ColorToString(LCLIntf.SetBkColor(Canvas.Handle, AOldColor))); Now the output is now clRed, which means that clRed was set during DrawElement but painted element (tbPushButtonNormal) is still default.

if you doing that in Qt, then you should set palette brush from current painter (in DrawElement) brush. That's not implemented, I've just said that it's maybe possible to implement it in that way.

zeljko

Show quoted text 34 lines
Vojt?ch ______________________________________________________________ > Od: zeljko > Komu: Lazarus mailing list > Datum: 12.05.2014 11:23 > P?edm?t: Re: [Lazarus] Colourful Themes > On 05/12/2014 10:54 AM, Vojt?ch ?ih?k wrote: > Thanks, > > I tried LCLIntf.SetBkColor(Canvas.Handle, clRed); and no visual change. > And if I try writeln(ColorToString(LCLIntf.SetBkColor(HANDLE, $00FF0000))); it never returns the color that I set (Qt4, GTK2), so it seems widgetsets doesn't support it. 1.SetBkColor as param uses TColorRef, not TColor 2.When setting new color with SetBkColor, old TColorRef is returned as result. var AOldColor, ANewColorRef: TColorRef; begin ANewColorRef := ColorToRGB(clRed); AOldColor := LCLIntf.SetBkColor(Canvas.Handle, ANewColorRef); ...do something LCLIntf.SetBkColor(Canvas.Handle, AOldColor); end; zeljko -- _______________________________________________ Lazarus mailing list http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply by email