mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-29 23:30:22 +02:00
LCL-GTK2: Allow changing BorderStyle of TPanel at runtime. Issue #36634, patch from CudaText man.
git-svn-id: trunk@62595 -
This commit is contained in:
parent
187d646104
commit
d7f23ad916
@ -163,6 +163,7 @@ const
|
|||||||
{ bsSingle } GTK_SHADOW_ETCHED_IN
|
{ bsSingle } GTK_SHADOW_ETCHED_IN
|
||||||
);
|
);
|
||||||
|
|
||||||
|
BorderShadowWidth: array[TBorderStyle] of gint = (0, 1);
|
||||||
|
|
||||||
// signals ------------------------------------------------------------------
|
// signals ------------------------------------------------------------------
|
||||||
type
|
type
|
||||||
|
@ -145,6 +145,7 @@ type
|
|||||||
class function CreateHandle(const AWinControl: TWinControl; const AParams: TCreateParams): TLCLIntfHandle; override;
|
class function CreateHandle(const AWinControl: TWinControl; const AParams: TCreateParams): TLCLIntfHandle; override;
|
||||||
class function GetDefaultColor(const {%H-}AControl: TControl; const ADefaultColorType: TDefaultColorType): TColor; override;
|
class function GetDefaultColor(const {%H-}AControl: TControl; const ADefaultColorType: TDefaultColorType): TColor; override;
|
||||||
class procedure SetColor(const AWinControl: TWinControl); override;
|
class procedure SetColor(const AWinControl: TWinControl); override;
|
||||||
|
class procedure SetBorderStyle(const AWinControl: TWinControl; const ABorderStyle: TBorderStyle); override;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{ TGtk2WSPanel }
|
{ TGtk2WSPanel }
|
||||||
@ -187,7 +188,6 @@ var
|
|||||||
Frame, WidgetClient: PGtkWidget;
|
Frame, WidgetClient: PGtkWidget;
|
||||||
WidgetInfo: PWidgetInfo;
|
WidgetInfo: PWidgetInfo;
|
||||||
Allocation: TGTKAllocation;
|
Allocation: TGTKAllocation;
|
||||||
bwidth: gint;
|
|
||||||
Style: PGtkRCStyle;
|
Style: PGtkRCStyle;
|
||||||
BorderStyle: TBorderStyle;
|
BorderStyle: TBorderStyle;
|
||||||
begin
|
begin
|
||||||
@ -195,15 +195,9 @@ begin
|
|||||||
BorderStyle:=TCustomControl(AWinControl).BorderStyle;
|
BorderStyle:=TCustomControl(AWinControl).BorderStyle;
|
||||||
gtk_frame_set_shadow_type(PGtkFrame(Frame),BorderStyleShadowMap[BorderStyle]);
|
gtk_frame_set_shadow_type(PGtkFrame(Frame),BorderStyleShadowMap[BorderStyle]);
|
||||||
|
|
||||||
case BorderStyle of
|
|
||||||
bsSingle:
|
|
||||||
bwidth:=1;
|
|
||||||
else
|
|
||||||
bwidth:=0
|
|
||||||
end;
|
|
||||||
Style := gtk_widget_get_modifier_style(Frame);
|
Style := gtk_widget_get_modifier_style(Frame);
|
||||||
Style^.xthickness := bwidth;
|
Style^.xthickness := BorderShadowWidth[BorderStyle];
|
||||||
Style^.ythickness := bwidth;
|
Style^.ythickness := BorderShadowWidth[BorderStyle];
|
||||||
gtk_widget_modify_style(Frame, Style);
|
gtk_widget_modify_style(Frame, Style);
|
||||||
|
|
||||||
{$IFDEF DebugLCLComponents}
|
{$IFDEF DebugLCLComponents}
|
||||||
@ -273,6 +267,21 @@ begin
|
|||||||
UpdateWidgetStyleOfControl(AWinControl);
|
UpdateWidgetStyleOfControl(AWinControl);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
class procedure TGtk2WSCustomPanel.SetBorderStyle(
|
||||||
|
const AWinControl: TWinControl; const ABorderStyle: TBorderStyle);
|
||||||
|
var
|
||||||
|
Frame: PGtkWidget;
|
||||||
|
Style: PGtkRCStyle;
|
||||||
|
begin
|
||||||
|
Frame := PGtkWidget(AWinControl.Handle);
|
||||||
|
gtk_frame_set_shadow_type(PGtkFrame(Frame), BorderStyleShadowMap[ABorderStyle]);
|
||||||
|
|
||||||
|
Style := gtk_widget_get_modifier_style(Frame);
|
||||||
|
Style^.xthickness := BorderShadowWidth[ABorderStyle];
|
||||||
|
Style^.ythickness := BorderShadowWidth[ABorderStyle];
|
||||||
|
gtk_widget_modify_style(Frame, Style);
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
{$include gtk2trayicon.inc}
|
{$include gtk2trayicon.inc}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user