mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-18 20:49:27 +02:00
gtk: use generic SetLabelCaption method to set TabControl tabs captions
git-svn-id: trunk@20044 -
This commit is contained in:
parent
9cd36bc5d4
commit
a2c07aa8cf
lcl/interfaces/gtk
@ -60,12 +60,17 @@ procedure TGtk1WidgetSet.SetLabelCaption(const ALabel: PGtkLabel; const ACaption
|
||||
const ASignal: PChar = nil);
|
||||
var
|
||||
Caption, Pattern: String;
|
||||
CurText: PChar;
|
||||
AccelKey: Char;
|
||||
begin
|
||||
Caption := ACaption;
|
||||
LabelFromAmpersands(Caption, Pattern, AccelKey);
|
||||
gtk_label_set_text(ALabel, PChar(Caption));
|
||||
gtk_label_set_pattern(ALabel, PChar(Pattern));
|
||||
gtk_label_get(ALabel, @CurText);
|
||||
if Caption <> StrPas(CurText) then
|
||||
begin
|
||||
gtk_label_set_text(ALabel, PChar(Caption));
|
||||
gtk_label_set_pattern(ALabel, PChar(Pattern));
|
||||
end;
|
||||
|
||||
if AComponent = nil then Exit;
|
||||
if ASignalWidget = nil then Exit;
|
||||
|
@ -4303,34 +4303,13 @@ var
|
||||
|
||||
procedure UpdateTabLabel;
|
||||
var
|
||||
TheCaption, TheLabel: PChar;
|
||||
CaptionStr, Pattern: String;
|
||||
AccelKey: Char;
|
||||
ACaption: String;
|
||||
begin
|
||||
CaptionStr := ThePage.Caption;
|
||||
LabelFromAmpersands(CaptionStr, Pattern, AccelKey);
|
||||
TheCaption := PChar(CaptionStr);
|
||||
if TheCaption = nil then
|
||||
TheCaption := #0;
|
||||
|
||||
gtk_label_get(PGtkLabel(TabLabelWidget), @TheLabel);
|
||||
|
||||
// uneeded pattern updates cause bugs: #0011306
|
||||
if CaptionStr <> StrPas(TheLabel) then
|
||||
begin
|
||||
gtk_label_set_text(PGtkLabel(TabLabelWidget), PChar(TheCaption));
|
||||
{$ifdef gtk1}
|
||||
gtk_label_set_pattern(PGtkLabel(TabLabelWidget), PChar(Pattern));
|
||||
{$endif gtk1}
|
||||
end;
|
||||
ACaption := ThePage.Caption;
|
||||
GTKWidgetSet.SetLabelCaption(PGtkLabel(TabLabelWidget), ACaption);
|
||||
|
||||
if MenuLabelWidget <> nil then
|
||||
begin
|
||||
gtk_label_set_text(PGtkLabel(MenuLabelWidget), TheCaption);
|
||||
{$ifdef gtk1}
|
||||
gtk_label_set_pattern(PGtkLabel(MenuLabelWidget), PChar(Pattern));
|
||||
{$endif gtk1}
|
||||
end;
|
||||
GTKWidgetSet.SetLabelCaption(PGtkLabel(MenuLabelWidget), ACaption);
|
||||
end;
|
||||
|
||||
procedure UpdateTabCloseBtn;
|
||||
|
Loading…
Reference in New Issue
Block a user