adding panels to statusbar during designing now sets SimplePanel:=false

git-svn-id: trunk@6906 -
This commit is contained in:
mattias 2005-03-05 23:00:16 +00:00
parent 98d9003cad
commit 98490874de
7 changed files with 33 additions and 154 deletions

View File

@ -3553,6 +3553,7 @@ begin
Collection.Items[i].Index:=i+1;
CollectionListBox.ItemIndex:=i+1;
FillCollectionListBox;
SelectInObjectInspector(false);
Modified;
end;
@ -3566,6 +3567,7 @@ begin
Collection.Items[i].Index:=i-1;
CollectionListBox.ItemIndex:=i-1;
FillCollectionListBox;
SelectInObjectInspector(false);
Modified;
end;

View File

@ -109,7 +109,7 @@ type
{ TStatusBar }
TStatusBar = Class(TWinControl)
TStatusBar = class(TWinControl)
private
FCanvas: TCanvas;
FHandlePanelCount: integer; // realized panels in the Handle object
@ -2404,6 +2404,9 @@ end.
{ =============================================================================
$Log$
Revision 1.169 2005/03/05 23:00:16 mattias
adding panels to statusbar during designing now sets SimplePanel:=false
Revision 1.168 2005/02/28 22:05:06 vincents
listview fixes for fpc 1.0.x

View File

@ -51,6 +51,7 @@ Begin
if FSimplePanel <> Value then
Begin
FSimplePanel := Value;
//debugln('TStatusBar.SetSimplePanel FSimplePanel=',dbgs(FSimplePanel),' ',dbgsName(Self));
UpdateHandleObject(-1);
end;
End;
@ -119,6 +120,7 @@ begin
TWSStatusBarClass(WidgetSetClass).PanelUpdate(Self,PanelIndex);
end else begin
// update all panels
//DebugLn('TStatusBar.UpdateHandleObject C update all panels');
TWSStatusBarClass(WidgetSetClass).Update(Self);
if SimplePanel then
FHandlePanelCount:=1

View File

@ -18,12 +18,27 @@
*****************************************************************************
}
constructor TStatusPanel.Create(aCollection: TCollection);
var
AStatusBar: TStatusBar;
begin
FWidth := 50;
FBevel := pbLowered;
FParentBiDiMode := True;
FAlignment := taLeftJustify;
inherited Create(aCollection);
AStatusBar:=StatusBar;
//debugln('TStatusPanel.Create A ',dbgsName(AStatusBar),' ',dbgs(csDesigning in AStatusBar.ComponentState));
if (AStatusBar<>nil)
and ([csLoading,csDestroying]*AStatusBar.ComponentState=[]) then begin
if (csDesigning in AStatusBar.ComponentState)
and AStatusBar.SimplePanel and (AStatusBar.Panels.Count=1) then begin
// first added panel during designing
AStatusBar.SimplePanel:=false;
end else begin
AStatusBar.InvalidatePanel(Index,[ppText]);
end;
end;
end;
destructor TStatusPanel.Destroy;

View File

@ -230,10 +230,6 @@ type
Function GetCaption(Sender : TObject) : String; virtual;
procedure WordWrap(DC: HDC; AText: PChar; MaxWidthInPixel: integer;
var Lines: PPChar; var LineCount: integer);
procedure OldUpdateStatusBarPanels(StatusBar: TObject;
StatusBarWidget: PGtkWidget); virtual;
procedure OldUpdateStatusBarPanel(StatusBar: TObject; Index: integer;
StatusPanelWidget: PGtkWidget); virtual;
procedure ResizeChild(Sender : TObject; Left,Top,Width,Height : Integer);virtual;
procedure RemoveCallbacks(Widget: PGtkWidget); virtual;
@ -442,6 +438,9 @@ end.
{ =============================================================================
$Log$
Revision 1.223 2005/03/05 23:00:16 mattias
adding panels to statusbar during designing now sets SimplePanel:=false
Revision 1.222 2005/02/28 18:21:43 mattias
fixed gtk file dialog with empty filter from Collin

View File

@ -4805,154 +4805,6 @@ begin
// other properties are set in UpdateStatusBarPanels
end;
{------------------------------------------------------------------------------
procedure TGtkWidgetSet.UpdateStatusBarPanels(StatusBar: TObject;
StatusBarWidget: PGtkWidget);
Update the widget(s) of a TStatusBar.
------------------------------------------------------------------------------}
procedure TGtkWidgetSet.OldUpdateStatusBarPanels(StatusBar: TObject;
StatusBarWidget: PGtkWidget);
var
AStatusBar: TStatusBar;
HBox: PGtkWidget;
CurPanelCount: integer;
NewPanelCount: Integer;
CurStatusPanelWidget: PGtkWidget;
ListItem: PGList;
i: Integer;
ExpandItem: boolean;
begin
//DebugLn('TGtkWidgetSet.UpdateStatusBarPanels ',HexStr(Cardinal(StatusBar),8));
AStatusBar:=StatusBar as TStatusBar;
HBox:=PGtkWidget(StatusBarWidget);
if (not GtkWidgetIsA(StatusBarWidget,GTK_HBOX_GET_TYPE)) then
RaiseGDBException('');
// create needed panels
CurPanelCount:=integer(g_list_length(PGtkBox(HBox)^.children));
if AStatusBar.SimplePanel or (AStatusBar.Panels.Count<1) then
NewPanelCount:=1
else
NewPanelCount:=AStatusBar.Panels.Count;
while CurPanelCount<NewPanelCount do begin
CurStatusPanelWidget:=CreateStatusBarPanel(StatusBar,CurPanelCount);
ExpandItem:=(CurPanelCount=NewPanelCount-1);
gtk_box_pack_start(PGtkBox(HBox),CurStatusPanelWidget,
ExpandItem,ExpandItem,0);
inc(CurPanelCount);
end;
// remove unneeded panels
while CurPanelCount>NewPanelCount do begin
CurStatusPanelWidget:=PGtkBoxChild(
g_list_nth_data(PGtkBox(HBox)^.children,CurPanelCount-1))^.Widget;
DestroyConnectedWidget(CurStatusPanelWidget,true);
dec(CurPanelCount);
end;
// check new panel count
CurPanelCount:=integer(g_list_length(PGtkBox(HBox)^.children));
//DebugLn('TGtkWidgetSet.UpdateStatusBarPanels B ',HexStr(Cardinal(StatusBar),8),' NewPanelCount=',NewPanelCount,' CurPanelCount=',CurPanelCount);
if CurPanelCount<>NewPanelCount then
RaiseGDBException('');
// set panel properties
ListItem:=PGTKBox(HBox)^.children;
i:=0;
while ListItem<>nil do begin
CurStatusPanelWidget:=PGtkBoxChild(PGTKWidget(ListItem^.data))^.widget;
ExpandItem:=(ListItem^.next=nil);
gtk_box_set_child_packing(PGtkBox(HBox),CurStatusPanelWidget,
ExpandItem,ExpandItem,0,GTK_PACK_START);
UpdateStatusBarPanel(StatusBar,i,CurStatusPanelWidget);
inc(i);
ListItem:=ListItem^.next;
end;
end;
{------------------------------------------------------------------------------
procedure TGtkWidgetSet.UpdateStatusBarPanel(StatusBar: TObject; Index: integer;
StatusPanelWidget: PGtkWidget);
Update the widget(s) of a single TStatusBar panel.
------------------------------------------------------------------------------}
procedure TGtkWidgetSet.OldUpdateStatusBarPanel(StatusBar: TObject; Index: integer;
StatusPanelWidget: PGtkWidget);
var
AStatusBar: TStatusBar;
CurPanel: TStatusPanel;
FrameWidget: PGtkWidget;
LabelWidget: PGtkLabel;
PanelText: String;
ContextID: LongWord;
NewShadowType: TGtkShadowType;
NewJustification: TGtkJustification;
begin
//DebugLn('TGtkWidgetSet.UpdateStatusBarPanel ',HexStr(Cardinal(StatusBar),8),' Index=',dbgs(Index));
AStatusBar:=StatusBar as TStatusBar;
CurPanel:=nil;
if (not AStatusBar.SimplePanel) and (AStatusBar.Panels.Count>Index) then
CurPanel:=AStatusBar.Panels[Index];
//DebugLn('Panel ',Index,' ',GetWidgetClassName(StatusPanelWidget),
// ' frame=',GetWidgetClassName(PGTKStatusBar(StatusPanelWidget)^.frame),
// ' thelabel=',GetWidgetClassName(PGTKStatusBar(StatusPanelWidget)^.thelabel),
// '');
FrameWidget:=PGTKStatusBar(StatusPanelWidget)^.frame;
LabelWidget:=PGtkLabel({$ifdef gtk2}PGTKStatusBar(StatusPanelWidget)^._label{$else}PGTKStatusBar(StatusPanelWidget)^.thelabel{$endif});
// Text
if AStatusBar.SimplePanel then
PanelText:=AStatusBar.SimpleText
else if CurPanel<>nil then
PanelText:=CurPanel.Text
else
PanelText:='';
ContextID:=gtk_statusbar_get_context_id(PGTKStatusBar(StatusPanelWidget),
'state');
//DebugLn(' PanelText="',PanelText,'"');
if PanelText<>'' then
gtk_statusbar_push(PGTKStatusBar(StatusPanelWidget),ContextID,
PGChar(PanelText))
else
gtk_statusbar_push(PGTKStatusBar(StatusPanelWidget),ContextID,'');
// Alignment
if CurPanel<>nil then begin
//DebugLn(' Alignment="',ord(CurPanel.Alignment),'"');
case CurPanel.Alignment of
taLeftJustify: NewJustification:=GTK_JUSTIFY_LEFT;
taRightJustify: NewJustification:=GTK_JUSTIFY_RIGHT;
taCenter: NewJustification:=GTK_JUSTIFY_CENTER;
else
NewJustification:=GTK_JUSTIFY_LEFT;
end;
gtk_label_set_justify(LabelWidget,NewJustification);
end;
// Bevel
if CurPanel<>nil then begin
case CurPanel.Bevel of
pbNone: NewShadowType:=GTK_SHADOW_NONE;
pbLowered: NewShadowType:=GTK_SHADOW_IN;
pbRaised: NewShadowType:=GTK_SHADOW_OUT;
else
NewShadowType:=GTK_SHADOW_IN;
end;
gtk_frame_set_shadow_type(PGtkFrame(FrameWidget),NewShadowType);
end;
// Width
if (CurPanel<>nil) then begin
//DebugLn(' CurPanel.Width="',CurPanel.Width,'"');
gtk_widget_set_usize(StatusPanelWidget,CurPanel.Width,
StatusPanelWidget^.allocation.height);
end;
end;
{------------------------------------------------------------------------------
function TGtkWidgetSet.CreateSimpleClientAreaWidget(Sender: TObject;
NotOnParentsClientArea: boolean): PGtkWidget;
@ -7019,6 +6871,9 @@ end;
{ =============================================================================
$Log$
Revision 1.638 2005/03/05 23:00:16 mattias
adding panels to statusbar during designing now sets SimplePanel:=false
Revision 1.637 2005/03/05 14:44:00 mattias
fixed gtk1 font rotating from C Western

View File

@ -5656,7 +5656,7 @@ begin
// check new panel count
CurPanelCount:=integer(g_list_length(PGtkBox(HBox)^.children));
//DebugLn('TGtkWidgetSet.UpdateStatusBarPanels B ',HexStr(Cardinal(StatusBar),8),' NewPanelCount=',NewPanelCount,' CurPanelCount=',CurPanelCount);
//DebugLn('TGtkWidgetSet.UpdateStatusBarPanels B ',HexStr(Cardinal(StatusBar),8),' NewPanelCount=',dbgs(NewPanelCount),' CurPanelCount=',dbgs(CurPanelCount));
if CurPanelCount<>NewPanelCount then
RaiseGDBException('');
@ -8099,6 +8099,9 @@ end;
{ =============================================================================
$Log$
Revision 1.349 2005/03/05 23:00:16 mattias
adding panels to statusbar during designing now sets SimplePanel:=false
Revision 1.348 2005/03/05 20:40:57 mattias
allowing gtk1 ascii keys