implemented default height for gtk TStatusBar and set TStatusBar.AutoSize to true

git-svn-id: trunk@7275 -
This commit is contained in:
mattias 2005-06-22 23:04:47 +00:00
parent 2570d33d76
commit 341e0ee0f0
6 changed files with 63 additions and 18 deletions

View File

@ -128,6 +128,8 @@ type
procedure DestroyWnd; override;
procedure Loaded; override;
procedure UpdateHandleObject(PanelIndex: integer); virtual;
procedure CalculatePreferredSize(
var PreferredWidth, PreferredHeight: integer); override;
public
constructor Create(TheOwner: TComponent); override;
destructor Destroy; override;
@ -138,6 +140,7 @@ type
property Canvas: TCanvas read FCanvas;
published
property Action;
property AutoSize default true;
property Panels: TStatusPanels read FPanels write SetPanels;
property SimpleText: String read FSimpleText write SetSimpleText;
property SimplePanel: Boolean read FSimplePanel write SetSimplePanel default True;
@ -2411,6 +2414,9 @@ end.
{ =============================================================================
$Log$
Revision 1.173 2005/06/22 23:04:44 mattias
implemented default height for gtk TStatusBar and set TStatusBar.AutoSize to true
Revision 1.172 2005/04/22 08:19:39 mattias
added TListItems.FindCaption partstart parameter

View File

@ -3418,7 +3418,7 @@ end;
by the LCL autosizing algorithms as default size. Only positive values are
valid. Negative or 0 are treated as undefined and the LCL uses other sizes
instead.
If not Raw then then values be be adjusted by the constraints and undefined
If not Raw then the values will be adjusted by the constraints and undefined
values will be replaced by the current width and height.
TWinControl overrides this and asks the interface for theme dependent values.
See TWinControl.GetPreferredSize for more information.
@ -3536,6 +3536,9 @@ end;
{ =============================================================================
$Log$
Revision 1.259 2005/06/22 23:04:44 mattias
implemented default height for gtk TStatusBar and set TStatusBar.AutoSize to true
Revision 1.258 2005/06/02 12:11:54 micha
need to recreate form window when changing border flags
implement lock-flag when destroying handle, do not focus control that is destroying handles

View File

@ -29,7 +29,7 @@ begin
Color := clBtnFace;
Anchors:=[akLeft,akRight,akBottom];
Align := alBottom;
Height:=30;
AutoSize:=true;
end;
@ -130,6 +130,14 @@ begin
FHandleObjectNeedsUpdate:=false;
end;
procedure TStatusBar.CalculatePreferredSize(var PreferredWidth,
PreferredHeight: integer);
begin
inherited CalculatePreferredSize(PreferredWidth, PreferredHeight);
PreferredWidth:=0;
if PreferredHeight<=0 then PreferredHeight:=25;
end;
procedure TStatusBar.BeginUpdate;
begin
inc(FUpdateLock);

View File

@ -107,6 +107,7 @@ type
lgsVerticalPaned,
lgsHorizontalPaned,
lgsNotebook,
lgsStatusBar,
// user defined
lgsUserDefined
);
@ -128,6 +129,7 @@ const
'tooltip',
'vertical paned',
'horizontal paned',
'statusbar',
'notebook',
''
);

View File

@ -6698,17 +6698,17 @@ begin
Tp:=nil;
AddToStyleWindow:=true;
// create a style widget
If AnsiCompareText(WName,LazGtkStyleNames[lgsButton])=0 then begin
If CompareText(WName,LazGtkStyleNames[lgsButton])=0 then begin
StyleObject^.Widget := GTK_BUTTON_NEW;
lgs:=lgsButton;
end
else
If AnsiCompareText(WName,LazGtkStyleNames[lgsLabel])=0 then begin
If CompareText(WName,LazGtkStyleNames[lgsLabel])=0 then begin
StyleObject^.Widget := GTK_LABEL_NEW('StyleLabel');
lgs:=lgsLabel;
end
else
If AnsiCompareText(WName,LazGtkStyleNames[lgsDefault])=0 then begin
If CompareText(WName,LazGtkStyleNames[lgsDefault])=0 then begin
lgs:=lgsDefault;
AddToStyleWindow:=false;
NoName:=nil;
@ -6721,7 +6721,7 @@ begin
NoName,[]);
end
else
If AnsiCompareText(WName,LazGtkStyleNames[lgsWindow])=0 then begin
If CompareText(WName,LazGtkStyleNames[lgsWindow])=0 then begin
lgs:=lgsWindow;
StyleObject^.Widget := GTK_WINDOW_NEW(GTK_WINDOW_TOPLEVEL);
AddToStyleWindow:=false;
@ -6739,59 +6739,65 @@ begin
gtk_widget_realize(StyleObject^.Widget);
end
else
If AnsiCompareText(WName,LazGtkStyleNames[lgsCheckbox])=0 then begin
If CompareText(WName,LazGtkStyleNames[lgsCheckbox])=0 then begin
lgs:=lgsCheckbox;
StyleObject^.Widget := GTK_CHECK_BUTTON_NEW;
end
else
If AnsiCompareText(WName,LazGtkStyleNames[lgsRadiobutton])=0 then begin
If CompareText(WName,LazGtkStyleNames[lgsRadiobutton])=0 then begin
lgs:=lgsRadiobutton;
StyleObject^.Widget := GTK_RADIO_BUTTON_NEW(nil);
end
else
If AnsiCompareText(WName,LazGtkStyleNames[lgsMenu])=0 then begin
If CompareText(WName,LazGtkStyleNames[lgsMenu])=0 then begin
lgs:=lgsMenu;
AddToStyleWindow:=false;
StyleObject^.Widget := GTK_MENU_NEW;
end
else
If AnsiCompareText(WName,LazGtkStyleNames[lgsMenuitem])=0 then begin
If CompareText(WName,LazGtkStyleNames[lgsMenuitem])=0 then begin
lgs:=lgsMenuitem;
AddToStyleWindow:=false;
StyleObject^.Widget := GTK_MENU_ITEM_NEW;
end
else
If AnsiCompareText(WName,LazGtkStyleNames[lgsList])=0 then begin
If CompareText(WName,LazGtkStyleNames[lgsStatusBar])=0 then begin
lgs:=lgsStatusBar;
AddToStyleWindow:=true;
StyleObject^.Widget := gtk_statusbar_new;
end
else
If CompareText(WName,LazGtkStyleNames[lgsList])=0 then begin
lgs:=lgsList;
StyleObject^.Widget := GTK_LIST_NEW;
end
else
If AnsiCompareText(WName,LazGtkStyleNames[lgsVerticalScrollbar])=0 then begin
If CompareText(WName,LazGtkStyleNames[lgsVerticalScrollbar])=0 then begin
lgs:=lgsVerticalScrollbar;
StyleObject^.Widget := gtk_vscrollbar_new(nil);
end
else
If AnsiCompareText(WName,LazGtkStyleNames[lgsHorizontalScrollbar])=0 then begin
If CompareText(WName,LazGtkStyleNames[lgsHorizontalScrollbar])=0 then begin
lgs:=lgsHorizontalScrollbar;
StyleObject^.Widget := gtk_hscrollbar_new(nil);
end
else
If AnsiCompareText(WName,LazGtkStyleNames[lgsVerticalPaned])=0 then begin
If CompareText(WName,LazGtkStyleNames[lgsVerticalPaned])=0 then begin
lgs:=lgsVerticalPaned;
StyleObject^.Widget := gtk_vpaned_new;
end
else
If AnsiCompareText(WName,LazGtkStyleNames[lgsHorizontalPaned])=0 then begin
If CompareText(WName,LazGtkStyleNames[lgsHorizontalPaned])=0 then begin
lgs:=lgsHorizontalPaned;
StyleObject^.Widget := gtk_hpaned_new;
end
else
If AnsiCompareText(WName,LazGtkStyleNames[lgsNotebook])=0 then begin
If CompareText(WName,LazGtkStyleNames[lgsNotebook])=0 then begin
lgs:=lgsNotebook;
StyleObject^.Widget := CreateStyleNotebook;
end
else
If AnsiCompareText(WName,LazGtkStyleNames[lgsTooltip])=0 then begin
If CompareText(WName,LazGtkStyleNames[lgsTooltip])=0 then begin
lgs:=lgsTooltip;
AddToStyleWindow:=false;
TP := gtk_tooltips_new;
@ -6801,7 +6807,7 @@ begin
StyleObject^.Style:=gtk_widget_get_style(PGTKTooltips(TP)^.Tip_Window);
end
else
If AnsiCompareText(WName,LazGtkStyleNames[lgsGTK_Default])=0 then begin
If CompareText(WName,LazGtkStyleNames[lgsGTK_Default])=0 then begin
lgs:=lgsGTK_Default;
AddToStyleWindow:=false;
StyleObject^.Widget := nil;
@ -8223,6 +8229,9 @@ end;
{ =============================================================================
$Log$
Revision 1.364 2005/06/22 23:04:45 mattias
implemented default height for gtk TStatusBar and set TStatusBar.AutoSize to true
Revision 1.363 2005/06/20 09:07:09 mattias
gtk2 intf only showing one grip for last statusbar panel from Andrew Haines

View File

@ -50,6 +50,8 @@ type
class procedure PanelUpdate(const AStatusBar: TStatusBar; PanelIndex: integer); override;
class procedure SetPanelText(const AStatusBar: TStatusBar; PanelIndex: integer); override;
class procedure Update(const AStatusBar: TStatusBar); override;
class procedure GetPreferredSize(const AWinControl: TWinControl;
var PreferredWidth, PreferredHeight: integer); override;
end;
{ TGtkWSTabSheet }
@ -420,6 +422,21 @@ begin
UpdateStatusBarPanels(AStatusBar,PGtkWidget(AStatusBar.Handle));
end;
procedure TGtkWSStatusBar.GetPreferredSize(const AWinControl: TWinControl;
var PreferredWidth, PreferredHeight: integer);
var
StatusBarWidget: PGtkWidget;
Requisition: TGtkRequisition;
begin
StatusBarWidget:=GetStyleWidget(lgsStatusBar);
// set size to default
gtk_widget_set_usize(StatusBarWidget,-1,-1);
// ask default size
gtk_widget_size_request(StatusBarWidget,@Requisition);
PreferredHeight:=Requisition.height;
//debugln('TGtkWSStatusBar.GetPreferredSize END ',dbgs(PreferredHeight));
end;
initialization
////////////////////////////////////////////////////