mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-15 17:59:26 +02:00
gtk2: implement themed drawing of +/- tree signs
git-svn-id: trunk@17232 -
This commit is contained in:
parent
c50c24cb56
commit
3b57a81d36
@ -58,6 +58,7 @@ type
|
||||
GapWidth : gint;
|
||||
{$ifdef gtk2}
|
||||
Expander : TGtkExpanderStyle; // treeview expander
|
||||
ExpanderSize: Integer;
|
||||
Edge : TGdkWindowEdge;
|
||||
{$endif}
|
||||
IsHot : Boolean;
|
||||
@ -448,9 +449,16 @@ begin
|
||||
// move to origin
|
||||
inc(Area.x, StyleParams.Origin.x);
|
||||
inc(Area.y, StyleParams.Origin.y);
|
||||
|
||||
|
||||
with StyleParams do
|
||||
begin
|
||||
{$ifndef gtk1}
|
||||
if Painter = gptExpander then
|
||||
begin
|
||||
Area.width := ExpanderSize;
|
||||
Area.height := ExpanderSize;
|
||||
end;
|
||||
{$endif}
|
||||
case Painter of
|
||||
gptDefault: inherited DrawElement(DC, Details, R, ClipRect);
|
||||
gptBox:
|
||||
@ -526,7 +534,7 @@ begin
|
||||
gptExpander: gtk_paint_expander(
|
||||
Style, Window, State,
|
||||
@Area, Widget, PChar(Detail),
|
||||
Area.x, Area.y,
|
||||
Area.x + Area.width shr 1, Area.y + Area.height shr 1,
|
||||
Expander);
|
||||
gptResizeGrip: gtk_paint_resize_grip(
|
||||
Style, Window, State,
|
||||
|
@ -44,6 +44,8 @@ end;
|
||||
|
||||
function TGtk2ThemeServices.GetGtkStyleParams(DC: HDC;
|
||||
Details: TThemedElementDetails; AIndex: Integer): TGtkStyleParams;
|
||||
var
|
||||
AValue: TGValue;
|
||||
begin
|
||||
Result := inherited GetGtkStyleParams(DC, Details, AIndex);
|
||||
|
||||
@ -96,6 +98,26 @@ begin
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
teTreeview:
|
||||
begin
|
||||
if Details.Part = TVP_GLYPH then
|
||||
begin
|
||||
Result.Painter := gptExpander;
|
||||
Result.Shadow := GTK_SHADOW_NONE;
|
||||
Result.State := GTK_STATE_NORMAL;
|
||||
Result.Widget := GetStyleWidget(lgsTreeView);
|
||||
Result.Detail := 'treeview';
|
||||
if Details.State = GLPS_CLOSED then
|
||||
Result.Expander := GTK_EXPANDER_COLLAPSED
|
||||
else
|
||||
Result.Expander := GTK_EXPANDER_EXPANDED;
|
||||
|
||||
FillChar(AValue, SizeOf(AValue), 0);
|
||||
g_value_init(@AValue, G_TYPE_INT);
|
||||
gtk_widget_style_get_property(Result.Widget, 'expander-size', @AValue);
|
||||
Result.ExpanderSize := AValue.data[0].v_int;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user