mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-13 21:19:18 +02:00
lcl gtk2: using translated button captions if resourcestrings translated, bug #22623
git-svn-id: trunk@38243 -
This commit is contained in:
parent
3f21a3c32a
commit
fe2701f866
@ -429,6 +429,8 @@ function GetDefaultButtonIcon(idButton: Integer): TCustomBitmap;
|
|||||||
function GetButtonIcon(idButton: Integer): TCustomBitmap;
|
function GetButtonIcon(idButton: Integer): TCustomBitmap;
|
||||||
function BidiAdjustButtonLayout(IsRightToLeft: Boolean; Layout: TButtonLayout): TButtonLayout;
|
function BidiAdjustButtonLayout(IsRightToLeft: Boolean; Layout: TButtonLayout): TButtonLayout;
|
||||||
|
|
||||||
|
function dbgs(Kind: TBitBtnKind): string; overload;
|
||||||
|
|
||||||
procedure Register;
|
procedure Register;
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
@ -566,6 +568,12 @@ begin
|
|||||||
Result := BtnBidiLayout[IsRightToLeft, Layout];
|
Result := BtnBidiLayout[IsRightToLeft, Layout];
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function dbgs(Kind: TBitBtnKind): string;
|
||||||
|
begin
|
||||||
|
Result:='';
|
||||||
|
writestr(Result,Kind);
|
||||||
|
end;
|
||||||
|
|
||||||
procedure Register;
|
procedure Register;
|
||||||
begin
|
begin
|
||||||
RegisterComponents('Additional',[TBitBtn,TSpeedButton]);
|
RegisterComponents('Additional',[TBitBtn,TSpeedButton]);
|
||||||
|
@ -184,8 +184,6 @@ begin
|
|||||||
end;
|
end;
|
||||||
if FCancelKind = bkCustom then FCancelKind := bkCancel; //default value if no mbCancel, mbNo or mbOk
|
if FCancelKind = bkCustom then FCancelKind := bkCancel; //default value if no mbCancel, mbNo or mbOk
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Assures a minimum text size
|
// Assures a minimum text size
|
||||||
if MSG = '' then MSG := ' ';
|
if MSG = '' then MSG := ' ';
|
||||||
|
|
||||||
|
@ -1120,11 +1120,19 @@ var
|
|||||||
|
|
||||||
procedure CreateButton(const ALabel : String; const AResponse: Integer);
|
procedure CreateButton(const ALabel : String; const AResponse: Integer);
|
||||||
var
|
var
|
||||||
NewButton: PGtkWidget;
|
NewButton: PGtkButton;
|
||||||
begin
|
begin
|
||||||
NewButton := gtk_dialog_add_button(PGtkDialog(Dialog),
|
NewButton := PGtkButton(gtk_dialog_add_button(PGtkDialog(Dialog),
|
||||||
PgChar(Ampersands2Underscore(ALabel)), AResponse);
|
PgChar(Ampersands2Underscore(ALabel)), AResponse));
|
||||||
gtk_button_set_use_underline(PGtkButton(NewButton), True);
|
gtk_button_set_use_underline(NewButton, True);
|
||||||
|
end;
|
||||||
|
|
||||||
|
function tr(UseWidgetStr: boolean; const TranslatedStr, WidgetStr: String): string;
|
||||||
|
begin
|
||||||
|
if UseWidgetStr then
|
||||||
|
Result:=WidgetStr
|
||||||
|
else
|
||||||
|
Result:=TranslatedStr;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function ResponseID(const AnID: Integer): Integer;
|
function ResponseID(const AnID: Integer): Integer;
|
||||||
@ -1185,12 +1193,12 @@ begin
|
|||||||
for BtnIdx := ButtonCount-1 downto 0 do
|
for BtnIdx := ButtonCount-1 downto 0 do
|
||||||
begin
|
begin
|
||||||
case Buttons[BtnIdx] of
|
case Buttons[BtnIdx] of
|
||||||
idButtonOK : CreateButton('gtk-ok', GTK_RESPONSE_OK);
|
idButtonOK : CreateButton(tr(rsmbOK='&OK',rsmbOK, 'gtk-ok'), GTK_RESPONSE_OK);
|
||||||
idButtonCancel : CreateButton('gtk-cancel', GTK_RESPONSE_CANCEL);
|
idButtonCancel : CreateButton(tr(rsmbCancel='Cancel',rsmbCancel,'gtk-cancel'), GTK_RESPONSE_CANCEL);
|
||||||
idButtonHelp : CreateButton('gtk-help', GTK_RESPONSE_HELP);
|
idButtonHelp : CreateButton(tr(rsmbHelp='&Help',rsmbHelp,'gtk-help'), GTK_RESPONSE_HELP);
|
||||||
idButtonYes : CreateButton('gtk-yes', GTK_RESPONSE_YES);
|
idButtonYes : CreateButton(tr(rsmbYes='&Yes',rsmbYes,'gtk-yes'), GTK_RESPONSE_YES);
|
||||||
idButtonNo : CreateButton('gtk-no', GTK_RESPONSE_NO);
|
idButtonNo : CreateButton(tr(rsmbNo='&No',rsmbNo,'gtk-no'), GTK_RESPONSE_NO);
|
||||||
idButtonClose : CreateButton('gtk-close', GTK_RESPONSE_CLOSE);
|
idButtonClose : CreateButton(tr(rsmbClose='&Close',rsmbClose,'gtk-close'), GTK_RESPONSE_CLOSE);
|
||||||
idButtonAbort : CreateButton(rsMBAbort, GTK_RESPONSE_REJECT);
|
idButtonAbort : CreateButton(rsMBAbort, GTK_RESPONSE_REJECT);
|
||||||
idButtonRetry : CreateButton(rsMBRetry, GTK_RESPONSE_LCL_RETRY);
|
idButtonRetry : CreateButton(rsMBRetry, GTK_RESPONSE_LCL_RETRY);
|
||||||
idButtonIgnore : CreateButton(rsMBIgnore, GTK_RESPONSE_LCL_IGNORE);
|
idButtonIgnore : CreateButton(rsMBIgnore, GTK_RESPONSE_LCL_IGNORE);
|
||||||
@ -1214,7 +1222,7 @@ begin
|
|||||||
Btn := PGtkButton(ChildList^.Data);
|
Btn := PGtkButton(ChildList^.Data);
|
||||||
|
|
||||||
if Buttons[BtnIdx] = idButtonCancel then
|
if Buttons[BtnIdx] = idButtonCancel then
|
||||||
g_object_set_data(PGObject(Dialog), 'modal_result', Pointer(idButtonCancel));
|
g_object_set_data(PGObject(Dialog), 'modal_result', Pointer(idButtonCancel));
|
||||||
|
|
||||||
X := Buttons[BtnIdx];
|
X := Buttons[BtnIdx];
|
||||||
g_object_set_data(PGObject(Btn), 'modal_result',
|
g_object_set_data(PGObject(Btn), 'modal_result',
|
||||||
|
Loading…
Reference in New Issue
Block a user