mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-13 10:49:16 +02:00
gtk3 fixed tpages caption being set on create
git-svn-id: trunk@43672 -
This commit is contained in:
parent
79d881edce
commit
9a1fb28534
@ -346,6 +346,8 @@ type
|
|||||||
{ TGtk3Page }
|
{ TGtk3Page }
|
||||||
|
|
||||||
TGtk3Page = class(TGtk3Container)
|
TGtk3Page = class(TGtk3Container)
|
||||||
|
private
|
||||||
|
FPageLabel: PGtkLabel;
|
||||||
protected
|
protected
|
||||||
procedure setText(AValue: String); override;
|
procedure setText(AValue: String); override;
|
||||||
function getText: String; override;
|
function getText: String; override;
|
||||||
@ -3840,34 +3842,28 @@ end;
|
|||||||
{ TGtk3Page }
|
{ TGtk3Page }
|
||||||
|
|
||||||
procedure TGtk3Page.setText(AValue: String);
|
procedure TGtk3Page.setText(AValue: String);
|
||||||
var
|
|
||||||
Parent: TGtk3NoteBook;
|
|
||||||
begin
|
begin
|
||||||
Parent := TGtk3NoteBook(getParent);
|
if Assigned(FPageLabel) then
|
||||||
if Parent <> nil then
|
FPageLabel^.set_text(PChar(AValue));
|
||||||
begin
|
|
||||||
Parent.SetTabLabelText(TCustomPage(LCLObject), AValue);
|
|
||||||
end;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TGtk3Page.getText: String;
|
function TGtk3Page.getText: String;
|
||||||
var
|
|
||||||
Parent: TGtk3NoteBook;
|
|
||||||
begin
|
begin
|
||||||
Parent := TGtk3NoteBook(getParent);
|
if Assigned(FPageLabel) then
|
||||||
if Parent <> nil then
|
Result := FPageLabel^.get_text
|
||||||
Result := Parent.GetTabLabelText(TCustomPage(LCLObject));
|
else
|
||||||
|
Result := '';
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TGtk3Page.CreateWidget(const Params: TCreateParams): PGtkWidget;
|
function TGtk3Page.CreateWidget(const Params: TCreateParams): PGtkWidget;
|
||||||
begin
|
begin
|
||||||
FWidgetType := FWidgetType + [wtContainer];
|
FWidgetType := FWidgetType + [wtContainer];
|
||||||
|
FPageLabel:= TGtkLabel.new(PChar(Params.Caption));
|
||||||
Result := TGtkHBox.new(GTK_ORIENTATION_HORIZONTAL, 0);
|
Result := TGtkHBox.new(GTK_ORIENTATION_HORIZONTAL, 0);
|
||||||
FCentralWidget := TGtkFixed.new;
|
FCentralWidget := TGtkFixed.new;
|
||||||
PGtkHBox(Result)^.pack_start(FCentralWidget, True , True, 0);
|
PGtkHBox(Result)^.pack_start(FCentralWidget, True , True, 0);
|
||||||
PGtkFixed(FCentralWidget)^.set_has_window(True);
|
PGtkFixed(FCentralWidget)^.set_has_window(True);
|
||||||
// PGtkFixed(FCentralWidget)^.set_can_focus(True);
|
// PGtkFixed(FCentralWidget)^.set_can_focus(True);
|
||||||
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TGtk3Page.getClientRect: TRect;
|
function TGtk3Page.getClientRect: TRect;
|
||||||
@ -4045,9 +4041,14 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TGtk3NoteBook.InsertPage(ACustomPage: TCustomPage; AIndex: Integer);
|
procedure TGtk3NoteBook.InsertPage(ACustomPage: TCustomPage; AIndex: Integer);
|
||||||
|
var
|
||||||
|
Gtk3Page: TGtk3Page;
|
||||||
begin
|
begin
|
||||||
if IsWidgetOK then
|
if IsWidgetOK then
|
||||||
PGtkNoteBook(GetContainerWidget)^.insert_page(TGtk3Widget(ACustomPage.Handle).Widget, nil, AIndex);
|
begin
|
||||||
|
Gtk3Page := TGtk3Page(ACustomPage.Handle);
|
||||||
|
PGtkNoteBook(GetContainerWidget)^.insert_page(Gtk3Page.Widget, Gtk3Page.FPageLabel, AIndex);
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TGtk3NoteBook.MovePage(ACustomPage: TCustomPage; ANewIndex: Integer);
|
procedure TGtk3NoteBook.MovePage(ACustomPage: TCustomPage; ANewIndex: Integer);
|
||||||
@ -4087,16 +4088,15 @@ end;
|
|||||||
procedure TGtk3NoteBook.SetTabLabelText(AChild: TCustomPage; AText: String);
|
procedure TGtk3NoteBook.SetTabLabelText(AChild: TCustomPage; AText: String);
|
||||||
begin
|
begin
|
||||||
if IsWidgetOK then
|
if IsWidgetOK then
|
||||||
PGtkNoteBook(GetContainerWidget)^.set_tab_label_text(TGtk3Widget(AChild.Handle).Widget, PgChar(AText));
|
TGtk3Widget(AChild.Handle).setText(AText);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TGtk3NoteBook.GetTabLabelText(AChild: TCustomPage): String;
|
function TGtk3NoteBook.GetTabLabelText(AChild: TCustomPage): String;
|
||||||
begin
|
begin
|
||||||
if IsWidgetOK then
|
if IsWidgetOK then
|
||||||
Result := PGtkNoteBook(GetContainerWidget)^.get_tab_label_text(TGtk3Widget(AChild.Handle).Widget)
|
Result := TGtk3Widget(AChild.Handle).getText
|
||||||
else
|
else
|
||||||
Result := '';
|
Result := '';
|
||||||
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{ TGtk3MenuShell }
|
{ TGtk3MenuShell }
|
||||||
|
Loading…
Reference in New Issue
Block a user