mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-27 23:09:45 +02:00
gtk: simplify Frame3D
git-svn-id: trunk@18817 -
This commit is contained in:
parent
4931b03cdb
commit
aa768c5872
@ -4337,54 +4337,43 @@ const GTKStrongShadowType: array[TBevelCut] of integer =
|
|||||||
(GTK_SHADOW_NONE, GTK_SHADOW_ETCHED_IN, GTK_SHADOW_ETCHED_OUT, GTK_SHADOW_NONE);
|
(GTK_SHADOW_NONE, GTK_SHADOW_ETCHED_IN, GTK_SHADOW_ETCHED_OUT, GTK_SHADOW_NONE);
|
||||||
|
|
||||||
var
|
var
|
||||||
ClientWidget: PGtkWidget;
|
StyleWidget: PGtkWidget;
|
||||||
i : integer;
|
|
||||||
DCOrigin: TPoint;
|
|
||||||
TheStyle: PGtkStyle;
|
TheStyle: PGtkStyle;
|
||||||
|
i: integer;
|
||||||
Area: TGdkRectangle;
|
Area: TGdkRectangle;
|
||||||
ShadowType: Integer;
|
ShadowType: Integer;
|
||||||
AWindow: PGdkWindow;
|
|
||||||
begin
|
begin
|
||||||
Result := IsValidDC(DC);
|
Result := IsValidDC(DC);
|
||||||
if not Result then exit;
|
if not Result then exit;
|
||||||
if FrameWidth=0 then exit;
|
if FrameWidth = 0 then exit;
|
||||||
TheStyle:=GetStyle(lgsButton);
|
StyleWidget := GetStyleWidget(lgsButton);
|
||||||
//DebugLn('TGtkWidgetSet.Frame3d A ',DbgS(TheStyle));
|
TheStyle := gtk_widget_get_style(StyleWidget);
|
||||||
if TheStyle=nil then exit;
|
if TheStyle = nil then exit;
|
||||||
|
|
||||||
with TGtkDeviceContext(DC) do
|
with TGtkDeviceContext(DC) do
|
||||||
begin
|
begin
|
||||||
if Widget = nil
|
{DebugLn(['Frame3D: Drawable = ', dbgs(Drawable),
|
||||||
then ClientWidget :=nil
|
' StyleWidget = ', dbgs(StyleWidget), ' Style = ', dbgs(TheStyle),
|
||||||
else begin
|
' Offset = ', dbgs(Offset), ' ARect = ', dbgs(ARect)]);}
|
||||||
ClientWidget := GetFixedWidget(Widget);
|
Area.X := ARect.Left + Offset.X;
|
||||||
if ClientWidget = nil
|
Area.Y := ARect.Top + Offset.Y;
|
||||||
then ClientWidget := Widget;
|
Area.Width := ARect.Right - ARect.Left;
|
||||||
end;
|
Area.Height := ARect.Bottom - ARect.Top;
|
||||||
AWindow:=Drawable;
|
|
||||||
DCOrigin := Offset;
|
|
||||||
Area.X:=ARect.Left+DCOrigin.X;
|
|
||||||
Area.Y:=ARect.Top+DCOrigin.Y;
|
|
||||||
Area.Width:=ARect.Right-ARect.Left;
|
|
||||||
Area.Height:=ARect.Bottom-ARect.Top;
|
|
||||||
if FrameWidth = 1 then
|
if FrameWidth = 1 then
|
||||||
ShadowType := GTKThinShadowType[Style]
|
ShadowType := GTKThinShadowType[Style]
|
||||||
else
|
else
|
||||||
ShadowType := GTKStrongShadowType[Style];
|
ShadowType := GTKStrongShadowType[Style];
|
||||||
//DebugLn('ShadowType ',ShadowType,
|
|
||||||
//' dark_gc=',DbgS(TheStyle^.dark_gc[GTK_STATE_NORMAL]),
|
|
||||||
//' light_gc=',DbgS(TheStyle^.light_gc[GTK_STATE_NORMAL]),
|
|
||||||
//'');
|
|
||||||
|
|
||||||
for i:= 1 to FrameWidth do begin
|
for i := 1 to FrameWidth do
|
||||||
gtk_paint_shadow(theStyle,
|
begin
|
||||||
AWindow, GTK_STATE_NORMAL,
|
gtk_paint_shadow(TheStyle,
|
||||||
|
Drawable, GTK_STATE_NORMAL,
|
||||||
ShadowType,
|
ShadowType,
|
||||||
@Area,
|
@Area,
|
||||||
ClientWidget,
|
StyleWidget,
|
||||||
'button',
|
'button',
|
||||||
ARect.Left+DCOrigin.X, ARect.Top+DCOrigin.Y,
|
Area.X, Area.Y,
|
||||||
ARect.Right-ARect.Left, ARect.Bottom-ARect.Top);
|
Area.Width, Area.Height);
|
||||||
// inflate the rectangle (! ARect will be returned to the user with this)
|
// inflate the rectangle (! ARect will be returned to the user with this)
|
||||||
InflateRect(ARect, -1, -1);
|
InflateRect(ARect, -1, -1);
|
||||||
end;
|
end;
|
||||||
|
Loading…
Reference in New Issue
Block a user