Patch from Grzegorz Zakrzewski. Fixes #10108

git-svn-id: trunk@14853 -
This commit is contained in:
sekelsenmat 2008-04-17 01:28:56 +00:00
parent 95ed4902e7
commit 341d9e3850
3 changed files with 43 additions and 4 deletions

View File

@ -627,10 +627,22 @@ begin
end;
end;
csGroupBox : if AText <> '' then
gtk_frame_set_label(pgtkFrame(P), pLabel)
else
gtk_frame_set_label(pgtkFrame(P), nil);
csGroupBox:
{$IFDEF Gtk1}
if AText <> '' then
gtk_frame_set_label(pgtkFrame(P), pLabel)
else
gtk_frame_set_label(pgtkFrame(P), nil);
{$ELSE}
begin
aLabel := Ampersands2Underscore(pLabel);
try
gtk_label_set_text_with_mnemonic(PGtkLabel(gtk_frame_get_label_widget(pgtkFrame(P))), aLabel);
finally
StrDispose(aLabel);
end;
end;
{$ENDIF}
csEdit : begin
LockOnChange(PGtkObject(p),+1);

View File

@ -1818,13 +1818,23 @@ var
{$endif}
TempWidget: PGTKWidget; // pointer to gtk-widget (local use when neccessary)
p : pointer; // ptr to the newly created GtkWidget
{$IFDEF Gtk2}
L : PGTKWidget;
{$ENDIF}
Allocation: TGTKAllocation;
WidgetInfo: PWidgetInfo;
begin
{$IFDEF Gtk1}
if AParams.Caption <> '' then
P := gtk_frame_new(AParams.Caption)
else
P := gtk_frame_new(nil);
{$ELSE}
L := gtk_label_new(AParams.Caption);
gtk_widget_show(L);
P := gtk_frame_new(nil);
gtk_frame_set_label_widget(GTK_FRAME(P), GTK_WIDGET(L));
{$ENDIF}
WidgetInfo := CreateWidgetInfo(P, AWinControl, AParams);
{$if defined(gtk1) or defined(GtkFixedWithWindow)}
TempWidget := CreateFixedClientWidget;

View File

@ -89,6 +89,7 @@ type
class function GetDefaultClientRect(const AWinControl: TWinControl;
const aLeft, aTop, aWidth, aHeight: integer; var aClientRect: TRect
): boolean; override;
class procedure SetFont(const AWinControl: TWinControl; const AFont : tFont); override;
end;
{ TGtk2WSGroupBox }
@ -1565,6 +1566,22 @@ begin
//if Result then DebugLn(['TGtk2WSCustomGroupBox.GetDefaultClientRect END FrameBorders=',dbgs(FrameBorders),' aClientRect=',dbgs(aClientRect)]);
end;
class procedure TGtk2WSCustomGroupBox.SetFont(const AWinControl: TWinControl;
const AFont: tFont);
var
Frame: PGtkFrame;
Lbl: PGtkWidget;
begin
Frame:=PGtkFrame(Pointer(AWinControl.Handle));
Lbl := gtk_frame_get_label_widget(Frame);
if Lbl <> nil then begin
Gtk2WidgetSet.SetWidgetColor(Lbl, AWinControl.Font.Color, clNone,
[GTK_STATE_NORMAL,GTK_STATE_ACTIVE,GTK_STATE_PRELIGHT,GTK_STATE_SELECTED]);
Gtk2WidgetSet.SetWidgetFont(Lbl, AFont);
end;
inherited SetFont(AWinControl, AFont);
end;
function Gtk2WSButton_Clicked(AWidget: PGtkWidget; AInfo: PWidgetInfo): GBoolean; cdecl;
var
Msg: TLMessage;