rewrite code for align button on TToolPanel

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@538 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
alexs75
2008-09-01 13:30:17 +00:00
parent 6b911011c0
commit b78fd41e93
3 changed files with 46 additions and 39 deletions

View File

@ -2,6 +2,7 @@
+ Исправлено создание ресурсов из XPM файлов + Исправлено создание ресурсов из XPM файлов
+ Доработана отрисовка тени у кнопки на TToolPanel + Доработана отрисовка тени у кнопки на TToolPanel
- Исправлена ошибка в TDBComboBox.EditingDone; если не присвоен DataSet - Исправлена ошибка в TDBComboBox.EditingDone; если не присвоен DataSet
- Переработан код выравнивания кнопок на TToolPanel
22.05.2008 - версия 2.0.0.136 (svn revision 100) 22.05.2008 - версия 2.0.0.136 (svn revision 100)
+ У объекта TRxCustomDBLookupCombo введён контроль на CircularDataLink + У объекта TRxCustomDBLookupCombo введён контроль на CircularDataLink
+ У объекта TRxCustomDBLookupCombo ускорена отрисовка данных + У объекта TRxCustomDBLookupCombo ускорена отрисовка данных

View File

@ -1,5 +1,7 @@
{ ���� ���� ��� ������������� ������ Lazarus. �� �������������! { Этот файл был автоматически создан Lazarus. Н�
�������� ��� ������������ ������ ��� ���������� � ��������� ������. � редактировать!
Исходный код используется только для комп�
�ляции и установки пакета.
} }
unit rxnew; unit rxnew;
@ -8,12 +10,12 @@ interface
uses uses
rxlookup, vclutils, dateutil, dbutils, rxapputils, rxdconst, rxstrutils, rxlookup, vclutils, dateutil, dbutils, rxapputils, rxdconst, rxstrutils,
dbdateedit, registerrx, curredit, folderlister, rxdbgrid, rxmemds, dbdateedit, registerrx, curredit, folderlister, rxdbgrid, rxmemds, duallist,
duallist, boxprocs, tooledit, rxswitch, rxdice, rxdbcomb, rxtoolbar, boxprocs, tooledit, rxswitch, rxdice, rxdbcomb, rxtoolbar, rxtbrsetup,
rxtbrsetup, fduallst, rxxpman, pagemngr, rxappicon, seldsfrm, rxctrls, fduallst, rxxpman, pagemngr, rxappicon, seldsfrm, rxctrls, rxlogin,
rxlogin, rxdbgrid_findunit, rxdbgrid_columsunit, rxpopupunit, rxdbgrid_findunit, rxdbgrid_columsunit, rxpopupunit, rxcustomchartpanel,
rxcustomchartpanel, rxsortmemds, AutoPanel, pickdate, rxiconv, rxsortmemds, AutoPanel, pickdate, rxiconv, rxceEditLookupFields, rxclock,
rxceEditLookupFields, LazarusPackageIntf; LazarusPackageIntf;
implementation implementation

View File

@ -178,6 +178,7 @@ type
procedure OnIniSave(Sender: TObject); procedure OnIniSave(Sender: TObject);
procedure OnIniLoad(Sender: TObject); procedure OnIniLoad(Sender: TObject);
procedure SetToolBarStyle(const AValue: TToolBarStyle); procedure SetToolBarStyle(const AValue: TToolBarStyle);
procedure ReAlignToolBtn;
protected protected
FCustomizer:TForm; FCustomizer:TForm;
procedure Notification(AComponent: TComponent; procedure Notification(AComponent: TComponent;
@ -186,7 +187,7 @@ type
procedure DoAutoSize; Override; procedure DoAutoSize; Override;
procedure MouseUp(Button: TMouseButton; Shift: TShiftState; procedure MouseUp(Button: TMouseButton; Shift: TShiftState;
X, Y: Integer); override; X, Y: Integer); override;
procedure Loaded; override; procedure RequestAlign; override;
public public
constructor Create(AOwner: TComponent); override; constructor Create(AOwner: TComponent); override;
destructor Destroy; override; destructor Destroy; override;
@ -966,6 +967,19 @@ begin
Invalidate; Invalidate;
end; end;
procedure TToolPanel.ReAlignToolBtn;
var
i, L:integer;
begin
L:=0;
for i:=0 to FToolbarItems.Count - 1 do
begin
FToolbarItems[i].FButton.Left:=L;
FToolbarItems[i].FButton.Align:=BtnAl2Align[FButtonAllign];
L:=L + FToolbarItems[i].FButton.Width;
end;
end;
procedure TToolPanel.Notification(AComponent: TComponent; Operation: TOperation); procedure TToolPanel.Notification(AComponent: TComponent; Operation: TOperation);
var var
i:integer; i:integer;
@ -1005,20 +1019,21 @@ var
i, H:integer; i, H:integer;
begin begin
if not AutoSizeCanStart then exit; if not AutoSizeCanStart then exit;
{ if AutoSizeDelayed then
begin
Include(FControlFlags,cfAutoSizeNeeded);
exit;
end;}
if Items.Count > 0 then if Items.Count > 0 then
begin begin
H:=0; H:=0;
for i:=0 to Items.Count-1 do for i:=0 to Items.Count-1 do
if Assigned(Items[i].FButton) then if Assigned(Items[i].FButton) and Items[i].FButton.HandleObjectShouldBeVisible then
H:=Max(H, Items[i].Height); H:=Max(H, Items[i].Height);
if H>0 then
begin
H:=H +BorderWidth * 2; H:=H +BorderWidth * 2;
SetBoundsKeepBase(Left,Top,Width,H,true); SetBoundsKeepBase(Left,Top,Width,H,true);
ReAlignToolBtn;
end;
// Exclude(FControlFlags,cfAutoSizeNeeded); // Exclude(FControlFlags,cfAutoSizeNeeded);
end end
else else
@ -1033,29 +1048,15 @@ begin
Customize(HelpContext); Customize(HelpContext);
end; end;
procedure TToolPanel.Loaded; procedure TToolPanel.RequestAlign;
var var
i, L:integer; i, L:integer;
begin begin
inherited Loaded; inherited RequestAlign;
{ L:=0; if (Parent = nil) or (csDestroying in ComponentState) or (csLoading in ComponentState) or (not Parent.HandleAllocated) then
for i:=0 to FToolbarItems.Count - 1 do exit;
begin if not Parent.HandleAllocated then exit;
if ButtonAllign = tbaLeft then ReAlignToolBtn;
begin
FToolbarItems[i].FSaveLeft:=L;
FToolbarItems[i].UpdateLeftAfterLoad;
Inc(L, FToolbarItems[i].Left + FToolbarItems[i].Width);
end
else
FToolbarItems[i].UpdateLeftAfterLoad;
end;
}
for i:=0 to FToolbarItems.Count - 1 do
begin
FToolbarItems[i].FButton.Align:=BtnAl2Align[FButtonAllign];
end;
end; end;
constructor TToolPanel.Create(AOwner: TComponent); constructor TToolPanel.Create(AOwner: TComponent);
@ -1293,6 +1294,9 @@ var
begin begin
inherited Create(ACollection); inherited Create(ACollection);
FButton:=TToolbarButton.Create(TToolbarItems(ACollection).FToolPanel); FButton:=TToolbarButton.Create(TToolbarItems(ACollection).FToolPanel);
FButton.Align:=BtnAl2Align[TToolbarItems(ACollection).FToolPanel.ButtonAllign];
FButton.Parent:=TToolbarItems(ACollection).FToolPanel; FButton.Parent:=TToolbarItems(ACollection).FToolPanel;
FButton.FImageList:=TToolbarItems(ACollection).FToolPanel.ImageList; FButton.FImageList:=TToolbarItems(ACollection).FToolPanel.ImageList;
FButton.Flat:=tpFlatBtns in TToolbarItems(ACollection).FToolPanel.Options; FButton.Flat:=tpFlatBtns in TToolbarItems(ACollection).FToolPanel.Options;
@ -1301,8 +1305,8 @@ begin
FButton.FAutoSize:=true; FButton.FAutoSize:=true;
FButton.FOwnerItem:=Self; FButton.FOwnerItem:=Self;
FButton.FFullPush:=true; FButton.FFullPush:=true;
if not (csLoading in TToolbarItems(ACollection).FToolPanel.ComponentState) then // if not (csLoading in TToolbarItems(ACollection).FToolPanel.ComponentState) then
FButton.Align:=BtnAl2Align[TToolbarItems(ACollection).FToolPanel.ButtonAllign]; // FButton.Align:=BtnAl2Align[TToolbarItems(ACollection).FToolPanel.ButtonAllign];
{ if TToolbarItems(ACollection).FToolPanel.ButtonAllign = tbaLeft then { if TToolbarItems(ACollection).FToolPanel.ButtonAllign = tbaLeft then
begin begin
W:=0; W:=0;