lcl gtk2: using translated button captions if resourcestrings translated, bug #22623

git-svn-id: trunk@38243 -
This commit is contained in:
mattias 2012-08-14 21:37:27 +00:00
parent 3f21a3c32a
commit fe2701f866
3 changed files with 27 additions and 13 deletions

View File

@ -429,6 +429,8 @@ function GetDefaultButtonIcon(idButton: Integer): TCustomBitmap;
function GetButtonIcon(idButton: Integer): TCustomBitmap;
function BidiAdjustButtonLayout(IsRightToLeft: Boolean; Layout: TButtonLayout): TButtonLayout;
function dbgs(Kind: TBitBtnKind): string; overload;
procedure Register;
implementation
@ -566,6 +568,12 @@ begin
Result := BtnBidiLayout[IsRightToLeft, Layout];
end;
function dbgs(Kind: TBitBtnKind): string;
begin
Result:='';
writestr(Result,Kind);
end;
procedure Register;
begin
RegisterComponents('Additional',[TBitBtn,TSpeedButton]);

View File

@ -184,8 +184,6 @@ begin
end;
if FCancelKind = bkCustom then FCancelKind := bkCancel; //default value if no mbCancel, mbNo or mbOk
// Assures a minimum text size
if MSG = '' then MSG := ' ';

View File

@ -1120,11 +1120,19 @@ var
procedure CreateButton(const ALabel : String; const AResponse: Integer);
var
NewButton: PGtkWidget;
NewButton: PGtkButton;
begin
NewButton := gtk_dialog_add_button(PGtkDialog(Dialog),
PgChar(Ampersands2Underscore(ALabel)), AResponse);
gtk_button_set_use_underline(PGtkButton(NewButton), True);
NewButton := PGtkButton(gtk_dialog_add_button(PGtkDialog(Dialog),
PgChar(Ampersands2Underscore(ALabel)), AResponse));
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;
function ResponseID(const AnID: Integer): Integer;
@ -1185,12 +1193,12 @@ begin
for BtnIdx := ButtonCount-1 downto 0 do
begin
case Buttons[BtnIdx] of
idButtonOK : CreateButton('gtk-ok', GTK_RESPONSE_OK);
idButtonCancel : CreateButton('gtk-cancel', GTK_RESPONSE_CANCEL);
idButtonHelp : CreateButton('gtk-help', GTK_RESPONSE_HELP);
idButtonYes : CreateButton('gtk-yes', GTK_RESPONSE_YES);
idButtonNo : CreateButton('gtk-no', GTK_RESPONSE_NO);
idButtonClose : CreateButton('gtk-close', GTK_RESPONSE_CLOSE);
idButtonOK : CreateButton(tr(rsmbOK='&OK',rsmbOK, 'gtk-ok'), GTK_RESPONSE_OK);
idButtonCancel : CreateButton(tr(rsmbCancel='Cancel',rsmbCancel,'gtk-cancel'), GTK_RESPONSE_CANCEL);
idButtonHelp : CreateButton(tr(rsmbHelp='&Help',rsmbHelp,'gtk-help'), GTK_RESPONSE_HELP);
idButtonYes : CreateButton(tr(rsmbYes='&Yes',rsmbYes,'gtk-yes'), GTK_RESPONSE_YES);
idButtonNo : CreateButton(tr(rsmbNo='&No',rsmbNo,'gtk-no'), GTK_RESPONSE_NO);
idButtonClose : CreateButton(tr(rsmbClose='&Close',rsmbClose,'gtk-close'), GTK_RESPONSE_CLOSE);
idButtonAbort : CreateButton(rsMBAbort, GTK_RESPONSE_REJECT);
idButtonRetry : CreateButton(rsMBRetry, GTK_RESPONSE_LCL_RETRY);
idButtonIgnore : CreateButton(rsMBIgnore, GTK_RESPONSE_LCL_IGNORE);
@ -1214,7 +1222,7 @@ begin
Btn := PGtkButton(ChildList^.Data);
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];
g_object_set_data(PGObject(Btn), 'modal_result',