Gtk3: fixed TCustomTabControl/TCustomPage sizing, fixed bug where Widget property getter initialized widget if it's destroyed.

This commit is contained in:
zeljan1 2025-01-22 23:07:57 +01:00
parent 6668cb44c4
commit 52468145b6
5 changed files with 378 additions and 74 deletions

View File

@ -0,0 +1,144 @@
{%MainUnit gtk3widgets.pas}
const
GTK_NOTEBOOK_CLASS_SIZE = SizeOf(TGtkNotebookClass);
GTK_NOTEBOOK_INSTANCE_SIZE = SizeOf(TGtkNotebook);
procedure LCLGtkNotebookGetPreferredWidth(widget: PGtkWidget; min_width, nat_width: Pgint); cdecl;
var
AControl: TGtk3Widget;
ParentClass: PGtkWidgetClass;
begin
if not Assigned(min_width) or not Assigned(nat_width) then
begin
DebugLn('Error: LCLGtkNotebookGetPreferredWidth invalid params.');
Exit;
end;
min_width^ := 0;
nat_width^ := 0;
if not Gtk3IsWidget(widget) then
begin
DebugLn('Error: LCLGtkNotebookGetPreferredWidth widget param is not PGtkWidget.');
Exit;
end;
ParentClass := PGtkWidgetClass(g_type_class_peek_parent(widget^.g_type_instance.g_class));
if not Assigned(ParentClass) then
begin
DebugLn('Error: LCLGtkNotebookGetPreferredWidth cannot get ParentClass !');
Exit;
end;
ParentClass^.get_preferred_width(widget, min_width, nat_width);
AControl := TGtk3Widget(HwndFromGtkWidget(widget));
if not Assigned(AControl) then
Exit;
// writeln('====> FGPW(',dbgsName(AControl.LCLObject),'): AutoSize=', AControl.LCLObject.AutoSize,' minW=',min_width^,' natW=',nat_width^,' LCLWidth=',AControl.LCLWidth,' LCLHeight=',AControl.LCLHeight);
if AControl.LCLWidth = 0 then
begin
min_width^ := 0;
nat_width^ := AControl.LCLObject.Width;
end else
begin
min_width^ := 0;
nat_width^ := AControl.LCLWidth;
end;
// writeln('<==== FGPW(',dbgsName(AControl.LCLObject),'): AutoSize=', AControl.LCLObject.AutoSize,' minW=',min_width^,' natW=',nat_width^,' LCLWidth=',AControl.LCLWidth,' LCLHeight=',AControl.LCLHeight,' LCLW=',AControl.LCLObject.Width,' LCLH=',AControl.LCLObject.Height);
end;
procedure LCLGtkNotebookGetPreferredHeight(widget: PGtkWidget; min_height, nat_height: Pgint); cdecl;
var
AControl: TGtk3Widget;
ParentClass: PGtkWidgetClass;
begin
if not Assigned(min_height) or not Assigned(nat_height) then
begin
DebugLn('Error: LCLGtkNotebookGetPreferredHeight invalid params.');
Exit;
end;
min_height^ := 0;
nat_height^ := 0;
if not Gtk3IsWidget(widget) then
begin
DebugLn('Error: LCLGtkNotebookGetPreferredHeight widget param is not PGtkWidget.');
Exit;
end;
ParentClass := PGtkWidgetClass(g_type_class_peek_parent(widget^.g_type_instance.g_class));
if not Assigned(ParentClass) then
begin
DebugLn('Error: LCLGtkNotebookGetPreferredHeight cannot get ParentClass !');
Exit;
end;
ParentClass^.get_preferred_height(widget, min_height, nat_height);
AControl := TGtk3Widget(HwndFromGtkWidget(widget));
if not Assigned(AControl) then
Exit;
// writeln('====> FGPH(',dbgsName(AControl.LCLObject),'): AutoSize=', AControl.LCLObject.AutoSize,' minH=',min_height^,' natH=',nat_height^,' LCLWidth=',AControl.LCLWidth,' Height=',AControl.LCLHeight);
if AControl.LCLHeight = 0 then
begin
min_height^ := 0; //, AControl.LCLObject.Height);
nat_height^ := Max(0, AControl.LCLObject.Height);
end else
begin
min_height^ := 0; // Max(36, AControl.LCLHeight);
nat_height^ := Max(0, AControl.LCLHeight);
end;
// writeln('<==== FGPH(',dbgsName(AControl.LCLObject),'): AutoSize=', AControl.LCLObject.AutoSize,' minH=',min_height^,' natH=',nat_height^,' LCLWidth=',AControl.LCLWidth,' Height=',AControl.LCLHeight);
end;
procedure LCLGtkNotebookClassInit(klass: PGTypeClass; {%H-}data: Pointer); cdecl;
var
AWidgetClass: PGtkWidgetClass;
begin
AWidgetClass := PGtkWidgetClass(klass);
AWidgetClass^.get_preferred_width := @LCLGtkNotebookGetPreferredWidth;
AWidgetClass^.get_preferred_height := @LCLGtkNotebookGetPreferredHeight;
end;
procedure LCLGtkNotebookInstanceInit({%H-}instance: PGTypeInstance; {%H-}klass: PGTypeClass); cdecl;
begin
//
end;
var
LCLGtkNotebookType: TGType = 0;
function LCLGtkNotebookGetType: TGType; cdecl;
const
lcl_Notebook_type_info: TGTypeInfo = (
class_size: GTK_NOTEBOOK_CLASS_SIZE;
base_init: nil;
base_finalize: nil;
class_init: @LCLGtkNotebookClassInit;
class_finalize: nil;
class_data: nil;
instance_size: GTK_NOTEBOOK_INSTANCE_SIZE;
n_preallocs: 0;
instance_init: @LCLGtkNotebookInstanceInit;
value_table: nil;
);
begin
if LCLGtkNotebookType = 0 then
LCLGtkNotebookType := g_type_register_static(gtk_notebook_get_type, 'LCLGtkNotebook', @lcl_notebook_type_info, G_TYPE_FLAG_NONE);
Result := LCLGtkNotebookType;
end;
function LCLGtkNotebookNew: PGtkNotebook;
begin {in gtk3 this is default}
Result := PGtkNotebook(g_object_new(LCLGtkNotebookGetType(),'show-tabs',[gboolean(True), nil]));
end;

View File

@ -416,10 +416,13 @@ type
{ TGtk3NoteBook }
TGtk3NoteBook = class (TGtk3Container)
private
FDefaultClientRect:TRect;
protected
function CreateWidget(const {%H-}Params: TCreateParams):PGtkWidget; override;
public
procedure InitializeWidget; override;
function GetTabSize(AWinControl: TWinControl): integer; {returns size of tab. Height if orientation is top/bottom, width if orientation is left/right}
function getClientRect: TRect; override;
function getPagesCount: integer;
procedure InsertPage(ACustomPage: TCustomPage; AIndex: Integer);
@ -429,7 +432,8 @@ type
procedure SetShowTabs(const AShowTabs: Boolean);
procedure SetTabPosition(const ATabPosition: TTabPosition);
procedure SetTabLabelText(AChild: TCustomPage; const AText: String);
function GetTabLabelText(AChild: TCustomPage): String;
function GetTabLabelText(AChild: TCustomPage): String;
property DefaultClientRect: TRect read FDefaultClientRect write FDefaultClientRect; //measured in gtk3wscomctrls.getDefaultClientRect
end;
{ TGtk3Bin }
@ -1065,6 +1069,7 @@ end;
{$i gtk3lclbutton.inc}
{$i gtk3lclspinbutton.inc}
{$i gtk3lclframe.inc}
{$i gtk3lclnotebook.inc}
class function TGtk3Widget.WidgetEvent(widget: PGtkWidget; event: PGdkEvent; data: GPointer): gboolean; cdecl;
begin
@ -1535,9 +1540,7 @@ begin
if ((NewSize.cx <> ACtl.LCLObject.Width) or (NewSize.cy <> ACtl.LCLObject.Height) or
ACtl.LCLObject.ClientRectNeedsInterfaceUpdate) then
begin
ACtl.LCLObject.DoAdjustClientRectChange;
end;
FillChar(Msg{%H-}, SizeOf(Msg), #0);
@ -2640,22 +2643,24 @@ end;
function TGtk3Widget.GetWidget:PGtkWidget;
begin
if not Assigned(fWidget) then
Self.InitializeWidget;
Result:=fWidget;
Result := FWidget;
end;
procedure TGtk3Widget.DestroyWidget;
var
ATemp: PGtkWidget;
begin
if IsValidHandle then
GTK3WidgetSet.DestroyCaret(HWND(Self));
if IsValidHandle and FOwnWidget then
begin
fOwnWidget:=false;
FOwnWidget:=false;
{$IFDEF GTK3DEBUGCORE}
DbgOut(#10'destroying '+Classname+' ... ');
{$ENDIF}
FWidget^.destroy_;
ATemp := FWidget;
FWidget := nil;
ATemp^.destroy_;
{$IFDEF GTK3DEBUGCORE}
DbgOut(Classname+' destroyed.'+#10);
{$ENDIF}
@ -3026,7 +3031,6 @@ begin
if (Widget=nil) then
exit;
//debugln(['TGtk3Widget.SetBounds ',DbgSName(LCLObject),' ',ALeft,',',ATop,',',AWidth,'x',AHeight]);
LCLWidth := AWidth;
LCLHeight := AHeight;
ARect.x := ALeft;
@ -3243,8 +3247,8 @@ begin
else
AWidget := getContainerWidget;
{$IFDEF GTK3DEBUGPREFERREDSIZE}
AWidget^.get_size_request(@AMinW, @AMinH);
DebugLn('>',dbgsName(LCLObject),'.preferredSize W=',dbgs(PreferredWidth),' H=',dbgs(PreferredHeight),' WithThemeSpace ',dbgs(WithThemeSpace),' AMinW=',dbgs(AMinW),' AMinH=',dbgs(AMinH));
AWidget^.get_size_request(@AMinW, @AMinH);
DebugLn('>',dbgsName(LCLObject),'.preferredSize W=',dbgs(PreferredWidth),' H=',dbgs(PreferredHeight),' WithThemeSpace ',dbgs(WithThemeSpace),' AMinW=',dbgs(AMinW),' AMinH=',dbgs(AMinH));
{$ENDIF}
AWidget^.get_preferred_height(@AMinH, @PreferredHeight);
AWidget^.get_preferred_width(@AMinW, @PreferredWidth);
@ -4913,13 +4917,22 @@ begin
Result := Point(Result.x + R.Left, Result.y + R.Top);
end;
function TGtk3Page.getClientRect: TRect;
var
AParent: PGtkWidget;
AParentObject: TGtk3Widget;
begin
if not getContainerWidget^.get_realized then
Result := Rect(0, 0, 0, 0);
if Assigned(LCLObject.Parent) and (LCLObject.Parent.HandleAllocated) then
begin
if not WidgetMapped then
begin
Result := TGtk3Widget(LCLObject.Parent.Handle).getClientRect;
exit;
end;
end;
if not WidgetMapped then
begin
AParent := Widget^.get_parent;
AParentObject := TGtk3Widget(HwndFromGtkWidget(AParent));
@ -4992,7 +5005,9 @@ begin
APageNum := {%H-}PtrInt(g_object_get_data(AWidget,'switch-page-signal-stopped'));
ACurrentPage := AWidget^.get_current_page;
g_object_set_data(AWidget,'switch-page-signal-stopped', nil);
{$IFDEF GTK3DEBUGNOTEBOOK}
DebugLn('BackNoteBookSignal back notebook switch-page signal currpage=',dbgs(AWidget^.get_current_page),' blockedPage ',dbgs(APageNum));
{$ENDIF}
if ACurrentPage<0 then ;
// must hook into notebook^.priv to unlock APageNum
// AWidget^.set_current_page(AWidget^.get_current_page);
@ -5014,8 +5029,9 @@ var
begin
if TGtk3Widget(Data).InUpdate then
exit;
{$IFDEF GTK3DEBUGNOTEBOOK}
DebugLn('GtkNotebookSwitchPage Data ',dbgHex({%H-}PtrUInt(Data)),' Realized ',dbgs(Widget^.get_realized),' pageNum=',dbgs(pageNum));
{$ENDIF}
{page is deleted}
{ c1:=TGtk3NoteBook(Data).getPagesCount;
@ -5053,21 +5069,30 @@ begin
if ANoteBook=nil then ;
if p1 then ;
if Data=nil then ;
{$IFDEF GTK3DEBUGNOTEBOOK}
DebugLn('GtkNotebookSelectPage ');
{$ENDIF}
Result:=true;
end;
function TGtk3NoteBook.CreateWidget(const Params: TCreateParams): PGtkWidget;
var
Alloc:TGtkAllocation;
begin
FWidgetType := FWidgetType + [wtNotebook];
Result := TGtkEventBox.new;
PGtkEventBox(Result)^.set_has_window(True);
FCentralWidget := TGtkNotebook.new;
FCentralWidget := LCLGtkNotebookNew; // TGtkNotebook.new; //LCLGtkNotebookNew;
PGtkEventBox(Result)^.add(FCentralWidget);
PGtkNoteBook(FCentralWidget)^.set_scrollable(True);
if (nboHidePageListPopup in TCustomTabControl(LCLObject).Options) then
PGtkNoteBook(FCentralWidget)^.popup_disable;
Alloc.x := Params.X;
Alloc.y := Params.Y;
Alloc.Width := Params.Width;
Alloc.Height := Params.Height;
g_signal_connect_data(FCentralWidget,'switch-page', TGCallback(@GtkNotebookSwitchPage), Self, nil, G_CONNECT_DEFAULT);
// this one triggers after above switch-page
g_signal_connect_data(FCentralWidget,'switch-page', TGCallback(@GtkNotebookAfterSwitchPage), Self, nil, G_CONNECT_DEFAULT);
@ -5076,21 +5101,53 @@ begin
// g_signal_connect_data(FCentralWidget,'change-current-page', TGCallback(@GtkNotebookAfterSwitchPage), Self, nil, 0);
// g_signal_connect_data(FCentralWidget,'select-page', TGCallback(@GtkNotebookSelectPage), Self, nil, 0);
FCentralWidget^.show_all;
FCentralWidget^.size_allocate(@Alloc);
end;
procedure TGtk3NoteBook.InitializeWidget;
begin
FDefaultClientRect := Rect(0, 0, 0, 0);
inherited;
SetTabPosition(TCustomTabControl(LCLObject).TabPosition);
end;
function TGtk3NoteBook.GetTabSize(AWinControl:TWinControl):integer;
var
AWidget: PGtkWidget;
Alloc:TGtkAllocation;
APage:PGtkWidget;
APageAlloc:TGtkAllocation;
R:TRect;
begin
Result := 0;
if not WidgetMapped then
Result := DefaultClientRect.Height
else
begin
R := getClientRect;
if PGtkNotebook(GetContainerWidget)^.tab_pos in [GTK_POS_TOP, GTK_POS_BOTTOM] then
Result := GetContainerWidget^.get_allocated_height - R.Height
else
Result := GetContainerWidget^.get_allocated_width - R.Width;
end;
end;
function TGtk3NoteBook.getClientRect: TRect;
var
AAlloc: TGtkAllocation;
ACurrentPage: gint;
APage: PGtkWidget;
ATabSheet:HWND;
begin
Result := Rect(0, 0, 0, 0);
ACurrentPage := -1;
if not WidgetMapped then
begin
if not IsRectEmpty(FDefaultClientRect) then
Result := DefaultClientRect
else
exit;
end else
if PGtkNoteBook(GetContainerWidget)^.get_n_pages = 0 then
begin
GetContainerWidget^.get_allocation(@AAlloc);
@ -5102,7 +5159,8 @@ begin
if (ACurrentPage >= 0) then
begin
APage := PGtkNoteBook(GetContainerWidget)^.get_nth_page(ACurrentPage);
if APage^.get_realized then
ATabSheet := HwndFromGtkWidget(APage);
if (ATabSheet <> 0) and TGtk3Widget(ATabSheet).WidgetMapped then
APage^.get_allocation(@AAlloc)
else
GetContainerWidget^.get_allocation(@AAlloc);
@ -5110,7 +5168,7 @@ begin
Types.OffsetRect(Result, -Result.Left, -Result.Top);
end;
end;
// DebugLn('TGtk3NoteBook.getClientRect Result ',dbgs(Result));
// DebugLn('<TGtk3NoteBook.getClientRect Style Result ',dbgs(Result),' ACurrentPage=',ACurrentPage.ToString);
end;
function TGtk3NoteBook.getPagesCount: integer;
@ -5120,6 +5178,7 @@ begin
Result := PGtkNoteBook(GetContainerWidget)^.get_n_pages;
end;
//debugging
procedure EnumerateChildren(ANotebook: PGtkNoteBook);
var
AList: PGList;

View File

@ -1915,7 +1915,7 @@ begin
if Handle = 0 then
Exit(False);
ARect := TGtk3Widget(handle).getClientRect;
Result := True;
Result := TGtk3Widget(Handle).WidgetMapped;
end;
function TGtk3WidgetSet.GetClipBox(DC: hDC; lpRect: PRect): Longint;

View File

@ -41,13 +41,14 @@ type
published
class function CreateHandle(const AWinControl: TWinControl;
const AParams: TCreateParams): TLCLHandle; override;
class procedure UpdateProperties(const ACustomPage: TCustomPage); override;
class procedure SetBounds(const {%H-}AWinControl: TWinControl; const {%H-}ALeft, {%H-}ATop, {%H-}AWidth, {%H-}AHeight: Integer); override;
class procedure SetFont(const AWinControl: TWinControl; const AFont: TFont); override;
class procedure ShowHide(const AWinControl: TWinControl); override;
class function GetDefaultClientRect(const AWinControl: TWinControl;
const {%H-}aLeft, {%H-}aTop, {%H-}aWidth, {%H-}aHeight: integer; var aClientRect: TRect
): boolean; override;
const aLeft, aTop, aWidth, aHeight: integer; var aClientRect: TRect
): boolean; override;
class procedure SetBounds(const AWinControl:TWinControl; const ALeft,ATop,AWidth,AHeight:
Integer); override;
class procedure SetFont(const AWinControl:TWinControl; const AFont:TFont); override;
class procedure ShowHide(const AWinControl: TWinControl); override;
class procedure UpdateProperties(const ACustomPage: TCustomPage); override;
end;
{ TGtk3WSCustomTabControl }
@ -56,11 +57,9 @@ type
published
class function CreateHandle(const AWinControl: TWinControl;
const AParams: TCreateParams): TLCLHandle; override;
(*
class function GetDefaultClientRect(const AWinControl: TWinControl;
const {%H-}aLeft, {%H-}aTop, aWidth, aHeight: integer; var aClientRect: TRect
const aLeft, aTop, aWidth, aHeight: integer; var aClientRect: TRect
): boolean; override;
*)
class procedure AddPage(const ATabControl: TCustomTabControl;
const AChild: TCustomPage; const AIndex: integer); override;
class procedure MovePage(const ATabControl: TCustomTabControl;
@ -1068,15 +1067,110 @@ begin
Result := TLCLHandle(TGtk3NoteBook.Create(AWinControl, AParams));
end;
(*
class function TGtk3WSCustomTabControl.GetDefaultClientRect(
const AWinControl: TWinControl; const aLeft, aTop, aWidth, aHeight: integer;
var aClientRect: TRect): boolean;
{used when handle of TCustomTabControl isn't allocated or TGt3Widget(Handle).WidgetMapped = false}
function MeasureClientRect(const {%H-}AWinControl: TWinControl; const {%H-}ALeft, {%H-}ATop, AWidth, AHeight: integer): TRect;
var
ANoteBook: PGtkNoteBook;
APage:PGtkBox;
AFixed:PGtkFixed;
Alloc:TGtkAllocation;
abox:PGtkBox;
AWindow:PGtkWindow;
begin
Result:=inherited GetDefaultClientRect(AWinControl, aLeft, aTop, aWidth,
aHeight, aClientRect);
Result := Rect(0, 0, 0, 0);
AWindow := TGtkWindow.new(GTK_WINDOW_TOPLEVEL);
gtk_window_set_decorated(awindow, False);
gtk_widget_set_app_paintable(awindow, gtk_true);
gtk_widget_set_size_request(awindow, 1, 1);
gtk_window_set_default_size(aWindow, AWidth, AHeight);
gtk_window_set_focus_on_map(aWindow, false);
gtk_window_set_position(AWindow, GTK_WIN_POS_NONE);
gtk_window_set_keep_below(AWindow, True);
abox := gtk_box_new(GTK_ORIENTATION_VERTICAL, 0);
gtk_container_add(aWindow, abox);
ANoteBook := TGtkNoteBook.new;
APage := TGtkHBox.new(GTK_ORIENTATION_HORIZONTAL, 0);
AFixed := TGtkFixed.new;
APage^.pack_start(AFixed, True, True, 0);
APage^.set_child_packing(AFixed, True, True, 0, GTK_PACK_START);
Alloc.x := 1;
Alloc.y := 1;
Alloc.width := 300;
Alloc.Height := 200;
ANoteBook^.append_page(APage, gtk_label_new('Tab1'));
ANoteBook^.set_current_page(0);
gtk_box_pack_start(abox, ANoteBook, True, True, 0);
aBox^.set_child_packing(aNoteBook, True, True, 0, GTK_PACK_START);
ANoteBook^.show_all;
ANoteBook^.set_allocation(@Alloc);
ANoteBook^.set_show_tabs(True);
AWindow^.realize;
AWindow^.show_all;
APage^.get_allocation(@Alloc);
Result := Bounds(0, 0, Alloc.Width, Alloc.Height);
AWindow^.set_visible(false);
AWindow^.destroy_;
end;
{used when handle of TCustomTabControl isn't allocated or TGt3Widget(Handle).WidgetMapped = false}
function GetTabSize(AWinControl: TCustomTabControl): integer;
var
ABounds:TRect;
begin
ABounds := AWinControl.BoundsRect;
if AWinControl.TabPosition in [tpTop, tpBottom] then
begin
with ABounds do
Result := Bottom - Top - MeasureClientRect(AWinControl, Left, Top, Right - Left, Bottom - Top).Height;
end else
begin
with ABounds do
Result := Right - Left - MeasureClientRect(AWinControl, Left, Top, Right - Left, Bottom - Top).Width;
end;
end;
class function TGtk3WSCustomTabControl.GetDefaultClientRect(const AWinControl:
TWinControl;const aLeft,aTop,aWidth,aHeight:integer;var aClientRect:TRect):
boolean;
var
dx:Integer;
begin
Result := False;
if AWinControl.HandleAllocated then
begin
if not (AWinControl is TTabControl) then
begin
if not TGtk3NoteBook(AWinControl.Handle).WidgetMapped then
begin
aClientRect := MeasureClientRect(AWinControl, ALeft, ATop, AWidth, AHeight);
if IsRectEmpty(aClientRect) then
begin
TGtk3NoteBook(AWinControl.Handle).DefaultClientRect := Rect(0, 0, 0, 0);
exit(False);
end;
TGtk3NoteBook(AWinControl.Handle).DefaultClientRect := aClientRect;
Result := True;
end;
end;
end else
begin
if AWinControl is TTabControl then
begin
dx := GetTabSize(TTabControl(AWinControl));
aClientRect := Rect(0,0, Max(0, aWidth - (dx * 2)), Max(0, aHeight - (dx * 2)));
end else
aClientRect := MeasureClientRect(AWinControl, ALeft, ATop, AWidth, AHeight);
Result := True;
end;
end;
*)
class procedure TGtk3WSCustomTabControl.AddPage(
const ATabControl: TCustomTabControl; const AChild: TCustomPage;
@ -1125,8 +1219,12 @@ end;
class function TGtk3WSCustomTabControl.GetNotebookMinTabHeight(
const AWinControl: TWinControl): integer;
begin
Result := inherited GetNotebookMinTabHeight(AWinControl);
// inherited GetNotebookMinTabHeight(AWinControl);
Result := TWSCustomTabControl.GetNotebookMinTabHeight(AWinControl);
if AWinControl.HandleAllocated then
begin
if not (AWinControl is TTabControl) then
Result := TGtk3Notebook(AWinControl.Handle).GetTabSize(AWinControl);
end;
end;
class function TGtk3WSCustomTabControl.GetNotebookMinTabWidth(
@ -1292,6 +1390,42 @@ begin
Result := TLCLHandle(TGtk3Page.Create(AWinControl, AParams));
end;
class function TGtk3WSCustomPage.GetDefaultClientRect(const AWinControl:
TWinControl;const aLeft,aTop,aWidth,aHeight:integer;var aClientRect:TRect):
boolean;
begin
Result := False;
if AWinControl.Parent = nil then
exit;
if AWinControl.HandleAllocated and AWinControl.Parent.HandleAllocated and
TGtk3Widget(AWinControl.Parent.Handle).WidgetMapped and TGtk3Widget(AWinControl.Handle).WidgetMapped then
exit
else
begin
aClientRect := AWinControl.Parent.ClientRect;
end;
end;
class procedure TGtk3WSCustomPage.SetBounds(const AWinControl:TWinControl;const
ALeft,ATop,AWidth,AHeight:Integer);
begin
//do nothing !
//inherited SetBounds(AWinControl,ALeft,ATop,AWidth,AHeight);
end;
class procedure TGtk3WSCustomPage.SetFont(const AWinControl:TWinControl;const
AFont:TFont);
begin
//do nothing !
//inherited SetFont(AWinControl,AFont);
end;
class procedure TGtk3WSCustomPage.ShowHide(const AWinControl:TWinControl);
begin
//do nothing !
//inherited ShowHide(AWinControl);
end;
class procedure TGtk3WSCustomPage.UpdateProperties(
const ACustomPage: TCustomPage);
begin
@ -1299,41 +1433,4 @@ begin
DebugLn('TGtk3WSCustomPage.UpdateProperties missing implementation ');
end;
class procedure TGtk3WSCustomPage.SetBounds(const AWinControl: TWinControl;
const ALeft, ATop, AWidth, AHeight: Integer);
begin
// ignore lcl bounds
// inherited SetBounds(AWinControl, ALeft, ATop, AWidth, AHeight);
end;
class procedure TGtk3WSCustomPage.SetFont(const AWinControl: TWinControl;
const AFont: TFont);
begin
inherited SetFont(AWinControl, AFont);
end;
class procedure TGtk3WSCustomPage.ShowHide(const AWinControl: TWinControl);
begin
// DebugLn('TGtk3WSCustomPage.ShowHide ',AWinControl.Caption);
inherited ShowHide(AWinControl);
end;
class function TGtk3WSCustomPage.GetDefaultClientRect(
const AWinControl: TWinControl; const aLeft, aTop, aWidth, aHeight: integer;
var aClientRect: TRect): boolean;
begin
Result:=false;
if AWinControl.Parent = nil then exit;
if AWinControl.HandleAllocated and AWinControl.Parent.HandleAllocated and
(TGtk3Widget(AWinControl.Handle).Widget^.parent <> nil) then
begin
end else
begin
Result := True;
aClientRect := AWinControl.Parent.ClientRect;
// DebugLn(['TGtk3WSCustomPage.GetDefaultClientRect ',DbgSName(AWinControl),' Parent=',DbgSName(AWinControl.Parent),' ParentBounds=',dbgs(AWinControl.Parent.BoundsRect),' ParentClient=',dbgs(AWinControl.Parent.ClientRect)]);
end;
end;
end.

View File

@ -131,7 +131,7 @@ end;"/>
<License Value="modified LGPL-2
"/>
<Version Major="4" Minor="99"/>
<Files Count="554">
<Files Count="555">
<Item1>
<Filename Value="carbon/agl.pp"/>
<AddToUsesPkgSection Value="False"/>
@ -2730,6 +2730,10 @@ end;"/>
<Filename Value="gtk3/gtk3lclframe.inc"/>
<Type Value="Include"/>
</Item554>
<Item555>
<Filename Value="gtk3/gtk3lclnotebook.inc"/>
<Type Value="Include"/>
</Item555>
</Files>
<CompatibilityMode Value="True"/>
<LazDoc Paths="../../docs/xml/lcl"/>