diff --git a/lcl/interfaces/gtk/gtkdef.pp b/lcl/interfaces/gtk/gtkdef.pp index 7a34812e97..cc7c2f396c 100644 --- a/lcl/interfaces/gtk/gtkdef.pp +++ b/lcl/interfaces/gtk/gtkdef.pp @@ -479,6 +479,7 @@ type PaintDepth: integer; // increased/decreased by Begin/EndPaint DataOwner: Boolean; // Set if the UserData should be freed when the info is freed UserData: Pointer; + FormBorderStyle: Integer; // used only for forms end; //TODO: remove diff --git a/lcl/interfaces/gtk2/gtk2wsforms.pp b/lcl/interfaces/gtk2/gtk2wsforms.pp index 333c917926..e433e5a855 100644 --- a/lcl/interfaces/gtk2/gtk2wsforms.pp +++ b/lcl/interfaces/gtk2/gtk2wsforms.pp @@ -77,6 +77,8 @@ type class procedure SetIcon(const AForm: TCustomForm; const Small, Big: HICON); override; class procedure SetAlphaBlend(const ACustomForm: TCustomForm; const AlphaBlend: Boolean; const Alpha: Byte); override; + class procedure SetFormBorderStyle(const AForm: TCustomForm; + const AFormBorderStyle: TFormBorderStyle); override; { class function GetDefaultClientRect(const AWinControl: TWinControl; const aLeft, aTop, aWidth, aHeight: integer; var aClientRect: TRect ): boolean; override; @@ -205,6 +207,7 @@ begin end; WidgetInfo := CreateWidgetInfo(P, AWinControl, AParams); + WidgetInfo^.FormBorderStyle := Ord(ABorderStyle); Box := CreateFormContents(ACustomForm, P, WidgetInfo); gtk_container_add(PGtkContainer(P), Box); @@ -269,6 +272,38 @@ begin gtk_window_set_opacity(PGtkWindow(ACustomForm.Handle), 1); end; +class procedure TGtk2WSCustomForm.SetFormBorderStyle(const AForm: TCustomForm; + const AFormBorderStyle: TFormBorderStyle); +var + Widget: PGtkWidget; + WidgetInfo: PWidgetInfo; + // WindowType: TGtkWindowType; + Resizable: gint; +begin + if not WSCheckHandleAllocated(AForm, 'SetFormBorderStyle') then + exit; + if (csDesigning in AForm.ComponentState) then + exit; + + Widget := PGtkWidget(AForm.Handle); + WidgetInfo := GetWidgetInfo(Widget); + + if (WidgetInfo^.FormBorderStyle <> Ord(AFormBorderStyle)) then + begin + if (AForm.Parent <> nil) or (AFormBorderStyle <> bsNone) then + RecreateWnd(AForm) + else + begin + // TODO: set window hint WindowType := FormStyleMap[AFormBorderStyle]; + Resizable := FormResizableMap[AFormBorderStyle]; + if (AFormBorderStyle = bsNone) then + gtk_window_set_decorated(PGtkWindow(Widget), False); + gtk_window_set_resizable(GTK_WINDOW(Widget), gboolean(Resizable)); + WidgetInfo^.FormBorderStyle := Ord(AFormBorderStyle); + end; + end; +end; + {class function TGtk2WSCustomForm.GetDefaultClientRect( const AWinControl: TWinControl; const aLeft, aTop, aWidth, aHeight: integer; var aClientRect: TRect): boolean;