mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-09 16:48:27 +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
|
||||
);
|
||||
|
||||
BorderShadowWidth: array[TBorderStyle] of gint = (0, 1);
|
||||
|
||||
// signals ------------------------------------------------------------------
|
||||
type
|
||||
|
@ -145,6 +145,7 @@ type
|
||||
class function CreateHandle(const AWinControl: TWinControl; const AParams: TCreateParams): TLCLIntfHandle; override;
|
||||
class function GetDefaultColor(const {%H-}AControl: TControl; const ADefaultColorType: TDefaultColorType): TColor; override;
|
||||
class procedure SetColor(const AWinControl: TWinControl); override;
|
||||
class procedure SetBorderStyle(const AWinControl: TWinControl; const ABorderStyle: TBorderStyle); override;
|
||||
end;
|
||||
|
||||
{ TGtk2WSPanel }
|
||||
@ -187,7 +188,6 @@ var
|
||||
Frame, WidgetClient: PGtkWidget;
|
||||
WidgetInfo: PWidgetInfo;
|
||||
Allocation: TGTKAllocation;
|
||||
bwidth: gint;
|
||||
Style: PGtkRCStyle;
|
||||
BorderStyle: TBorderStyle;
|
||||
begin
|
||||
@ -195,15 +195,9 @@ begin
|
||||
BorderStyle:=TCustomControl(AWinControl).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^.xthickness := bwidth;
|
||||
Style^.ythickness := bwidth;
|
||||
Style^.xthickness := BorderShadowWidth[BorderStyle];
|
||||
Style^.ythickness := BorderShadowWidth[BorderStyle];
|
||||
gtk_widget_modify_style(Frame, Style);
|
||||
|
||||
{$IFDEF DebugLCLComponents}
|
||||
@ -273,6 +267,21 @@ begin
|
||||
UpdateWidgetStyleOfControl(AWinControl);
|
||||
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}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user