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?
Mailing lists / lazarus / 2014-05
Colourful Themes
6 messages · 2 people · –
- VVojtěch Čihák 3
- Zzeljko 3
Reply by email Subscribe to this list Your subscription
Read-only archive. Use j and k to move between messages.
Vojt?ch ?ih?k wrote 9 lines
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
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?
Vojt?ch ?ih?k wroteThanks, 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
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?
Vojt?ch ?ih?k wrote 10 lines
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
