mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-05-01 20:24:01 +02:00
- merging part of gtk2themes with gtkthemes
- adjusting splitter drawing (may fix gtk bug with wrong dots alignment) git-svn-id: trunk@11277 -
This commit is contained in:
parent
7523e184b2
commit
d30b9718ac
@ -715,7 +715,7 @@ begin
|
||||
begin
|
||||
if (GripperRect.Bottom - GripperRect.Top) > GripperSize then
|
||||
begin
|
||||
GripperRect.Top := (GripperRect.Top + GripperRect.Bottom - GripperSize) shr 1;
|
||||
GripperRect.Top := (GripperRect.Top + GripperRect.Bottom - GripperSize) div 2;
|
||||
GripperRect.Bottom := GripperRect.Top + GripperSize;
|
||||
end;
|
||||
end
|
||||
@ -723,12 +723,12 @@ begin
|
||||
begin
|
||||
if (GripperRect.Right - GripperRect.Left) > GripperSize then
|
||||
begin
|
||||
GripperRect.Left := (GripperRect.Left + GripperRect.Right - GripperSize) shr 1;
|
||||
GripperRect.Left := (GripperRect.Left + GripperRect.Right - GripperSize) div 2;
|
||||
GripperRect.Right := GripperRect.Left + GripperSize;
|
||||
end;
|
||||
end;
|
||||
|
||||
ThemeServices.DrawElement(Canvas.Handle, GripperDetails, GripperRect, nil);
|
||||
ThemeServices.DrawElement(Canvas.Handle, GripperDetails, GripperRect, @GripperRect);
|
||||
end;
|
||||
|
||||
procedure TCustomSplitter.MouseEnter;
|
||||
|
@ -188,7 +188,7 @@ begin
|
||||
|
||||
Result.IsHot:= Result.State = GTK_STATE_PRELIGHT;
|
||||
|
||||
Result.Detail := 'treeview';
|
||||
Result.Detail := 'button';
|
||||
Result.Painter := gptBox;
|
||||
end;
|
||||
teToolBar:
|
||||
@ -264,7 +264,9 @@ begin
|
||||
Result := BoundingRect;
|
||||
StyleParams := GetGtkStyleParams(DC, Details);
|
||||
if StyleParams.Style <> nil then
|
||||
InflateRect(Result, -1, -1);
|
||||
InflateRect(Result,
|
||||
-StyleParams.Style^.{$ifndef gtk2}klass^.{$endif}xthickness,
|
||||
-StyleParams.Style^.{$ifndef gtk2}klass^.{$endif}ythickness);
|
||||
end;
|
||||
|
||||
procedure TGtkThemeServices.DrawElement(DC: HDC;
|
||||
|
@ -21,7 +21,6 @@ type
|
||||
protected
|
||||
function GetGtkStyleParams(DC: HDC; Details: TThemedElementDetails): TGtkStyleParams; override;
|
||||
public
|
||||
function ContentRect(DC: HDC; Details: TThemedElementDetails; BoundingRect: TRect): TRect; override;
|
||||
end;
|
||||
|
||||
implementation
|
||||
@ -33,142 +32,49 @@ function TGtk2ThemeServices.GetGtkStyleParams(DC: HDC;
|
||||
var
|
||||
ClientWidget: PGtkWidget;
|
||||
begin
|
||||
Result.Style := nil;
|
||||
Result := inherited GetGtkStyleParams(DC, Details);
|
||||
|
||||
if GTK2WidgetSet.IsValidDC(DC) then
|
||||
with TDeviceContext(DC) do
|
||||
begin
|
||||
Result.Widget := DCWidget;
|
||||
ClientWidget := GetFixedWidget(Result.Widget);
|
||||
if ClientWidget <> nil then
|
||||
Result.Widget := ClientWidget;
|
||||
Result.Window := Drawable;
|
||||
Result.Origin := GetDCOffset(TDeviceContext(DC));
|
||||
Result.Style := gtk_widget_get_style(Result.Widget);
|
||||
if Result.Style = nil then
|
||||
Result.Style := gtk_widget_get_default_style();
|
||||
// override some styles
|
||||
if Result.Style <> nil then
|
||||
case Details.Element of
|
||||
teHeader:
|
||||
begin
|
||||
Result.State := GtkButtonMap[Details.State];
|
||||
if Details.State = PBS_PRESSED then
|
||||
Result.Shadow := GTK_SHADOW_IN
|
||||
else
|
||||
Result.Shadow := GTK_SHADOW_OUT;
|
||||
|
||||
Result.Painter := gptDefault;
|
||||
Result.State := GTK_STATE_NORMAL;
|
||||
Result.Detail := '';
|
||||
Result.Shadow := GTK_SHADOW_NONE;
|
||||
Result.IsHot := False;
|
||||
Result.IsHot:= Result.State = GTK_STATE_PRELIGHT;
|
||||
|
||||
case Details.Element of
|
||||
teButton:
|
||||
begin
|
||||
case Details.Part of
|
||||
BP_PUSHBUTTON:
|
||||
begin
|
||||
Result.State := GtkButtonMap[Details.State];
|
||||
if Details.State = PBS_PRESSED then
|
||||
Result.Shadow := GTK_SHADOW_IN
|
||||
else
|
||||
Result.Shadow := GTK_SHADOW_OUT;
|
||||
|
||||
Result.IsHot:= Result.State = GTK_STATE_PRELIGHT;
|
||||
|
||||
Result.Detail := 'button';
|
||||
Result.Painter := gptBox;
|
||||
end;
|
||||
BP_RADIOBUTTON:
|
||||
begin
|
||||
Result.State := GtkRadioMap[Details.State];
|
||||
if Details.State >= RBS_CHECKEDNORMAL then
|
||||
Result.Shadow := GTK_SHADOW_IN
|
||||
else
|
||||
Result.Shadow := GTK_SHADOW_OUT;
|
||||
Result.Detail := 'radiobutton';
|
||||
Result.Painter := gptOption;
|
||||
end;
|
||||
BP_CHECKBOX:
|
||||
begin
|
||||
Result.State := GtkRadioMap[Details.State];
|
||||
Result.Detail := 'checkbutton';
|
||||
if Details.State >= CBS_CHECKEDNORMAL then
|
||||
Result.Shadow := GTK_SHADOW_IN
|
||||
else
|
||||
Result.Shadow := GTK_SHADOW_OUT;
|
||||
Result.Painter := gptCheck;
|
||||
end;
|
||||
end;
|
||||
Result.Detail := 'treeview';
|
||||
Result.Painter := gptBox;
|
||||
end;
|
||||
teRebar:
|
||||
begin
|
||||
case Details.Part of
|
||||
RP_GRIPPER, RP_GRIPPERVERT:
|
||||
begin
|
||||
Result.State := GTK_STATE_NORMAL;
|
||||
Result.Shadow := GTK_SHADOW_NONE;
|
||||
Result.Detail := 'paned';
|
||||
Result.Painter := gptHandle;
|
||||
if Details.Part = RP_GRIPPER then
|
||||
Result.Orientation := GTK_ORIENTATION_VERTICAL
|
||||
else
|
||||
Result.Orientation := GTK_ORIENTATION_HORIZONTAL;
|
||||
end;
|
||||
RP_BAND:
|
||||
begin
|
||||
Result.State := GtkButtonMap[Details.State];
|
||||
Result.Shadow := GTK_SHADOW_NONE;
|
||||
Result.Detail := 'paned';
|
||||
Result.Painter := gptFlatBox;
|
||||
end;
|
||||
end;
|
||||
teHeader:
|
||||
begin
|
||||
Result.State := GtkButtonMap[Details.State];
|
||||
if Details.State = PBS_PRESSED then
|
||||
Result.Shadow := GTK_SHADOW_IN
|
||||
else
|
||||
Result.Shadow := GTK_SHADOW_OUT;
|
||||
|
||||
Result.IsHot:= Result.State = GTK_STATE_PRELIGHT;
|
||||
|
||||
Result.Detail := 'treeview';
|
||||
Result.Painter := gptBox;
|
||||
end;
|
||||
teToolBar:
|
||||
begin
|
||||
case Details.Part of
|
||||
TP_BUTTON:
|
||||
begin
|
||||
Result.State := GtkButtonMap[Details.State];
|
||||
if Details.State in [TS_PRESSED, TS_CHECKED, TS_HOTCHECKED] then
|
||||
Result.Shadow := GTK_SHADOW_IN
|
||||
else
|
||||
if Details.State in [TS_HOT] then
|
||||
Result.Shadow := GTK_SHADOW_ETCHED_IN
|
||||
else
|
||||
Result.Shadow := GTK_SHADOW_NONE;
|
||||
|
||||
Result.IsHot := Details.State in [TS_HOT, TS_HOTCHECKED];
|
||||
|
||||
Result.Detail := 'togglebutton';
|
||||
if Result.Shadow = GTK_SHADOW_NONE then
|
||||
Result.Painter := gptNone
|
||||
else
|
||||
Result.Painter := gptBox;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
teRebar:
|
||||
begin
|
||||
case Details.Part of
|
||||
RP_GRIPPER, RP_GRIPPERVERT:
|
||||
begin
|
||||
Result.State := GTK_STATE_NORMAL;
|
||||
Result.Shadow := GTK_SHADOW_NONE;
|
||||
Result.Detail := 'paned';
|
||||
Result.Painter := gptHandle;
|
||||
if Details.Part = RP_GRIPPER then
|
||||
Result.Orientation := GTK_ORIENTATION_VERTICAL
|
||||
else
|
||||
Result.Orientation := GTK_ORIENTATION_HORIZONTAL;
|
||||
end;
|
||||
RP_BAND:
|
||||
begin
|
||||
Result.State := GtkButtonMap[Details.State];
|
||||
Result.Shadow := GTK_SHADOW_NONE;
|
||||
Result.Detail := 'paned';
|
||||
Result.Painter := gptFlatBox;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
function TGtk2ThemeServices.ContentRect(DC: HDC;
|
||||
Details: TThemedElementDetails; BoundingRect: TRect): TRect;
|
||||
var
|
||||
StyleParams: TGtkStyleParams;
|
||||
begin
|
||||
Result := BoundingRect;
|
||||
StyleParams := GetGtkStyleParams(DC, Details);
|
||||
if StyleParams.Style <> nil then
|
||||
InflateRect(Result,
|
||||
-StyleParams.Style^.xthickness,
|
||||
-StyleParams.Style^.ythickness);
|
||||
end;
|
||||
|
||||
end.
|
||||
|
||||
|
@ -1744,7 +1744,10 @@ end;
|
||||
function TThemeServices.ContentRect(DC: HDC; Details: TThemedElementDetails; BoundingRect: TRect): TRect;
|
||||
begin
|
||||
Result := BoundingRect;
|
||||
InflateRect(Result, -1, -1);
|
||||
if Details.Element in [teHeader, teButton] then
|
||||
InflateRect(Result, -2, -2)
|
||||
else
|
||||
InflateRect(Result, -1, -1);
|
||||
end;
|
||||
|
||||
//----------------------------------------------------------------------------------------------------------------------
|
||||
|
Loading…
Reference in New Issue
Block a user