moved method to widget base class

This commit is contained in:
Basile Burg 2015-05-21 21:02:48 +02:00
parent 006d375ec3
commit e6a3241ca3
2 changed files with 26 additions and 15 deletions

View File

@ -1606,24 +1606,11 @@ end;
procedure TCEMainForm.widgetShowFromAction(sender: TObject); procedure TCEMainForm.widgetShowFromAction(sender: TObject);
var var
widg: TCEWidget; widg: TCEWidget;
win: TControl;
begin begin
widg := TCEWidget( TComponent(sender).tag ); widg := TCEWidget( TComponent(sender).tag );
if widg = nil then exit; if widg = nil then exit;
// //
if widg.isDockable then widg.showWidget;
begin
win := DockMaster.GetAnchorSite(widg);
win.Show;
win.BringToFront;
end
else begin
if widg.isModal then widg.ShowModal else
begin
widg.Show;
widg.BringToFront;
end;
end;
end; end;
procedure TCEMainForm.layoutLoadFromFile(const aFilename: string); procedure TCEMainForm.layoutLoadFromFile(const aFilename: string);

View File

@ -6,7 +6,7 @@ interface
uses uses
Classes, SysUtils, FileUtil, Forms, Controls, ExtCtrls, ActnList, Menus, Classes, SysUtils, FileUtil, Forms, Controls, ExtCtrls, ActnList, Menus,
ce_interfaces; AnchorDocking, ce_interfaces;
type type
@ -72,6 +72,8 @@ type
// increment a flag used to indicate if updateLoop has to be called // increment a flag used to indicate if updateLoop has to be called
procedure IncLoopUpdate; procedure IncLoopUpdate;
procedure showWidget;
// returns true if one of the three updater is processing. // returns true if one of the three updater is processing.
property updating: boolean read fUpdating; property updating: boolean read fUpdating;
// true by default, allow a widget to be docked. // true by default, allow a widget to be docked.
@ -147,6 +149,28 @@ begin
if isDockable then result := false if isDockable then result := false
else result := fModal; else result := fModal;
end; end;
procedure TCEWidget.showWidget;
var
win: TControl;
begin
if isDockable then
begin
win := DockMaster.GetAnchorSite(self);
if win <> nil then
begin
win.Show;
win.BringToFront;
end;
end
else begin
if isModal then ShowModal else
begin
Show;
BringToFront;
end;
end;
end;
{$ENDREGION} {$ENDREGION}
{$REGION ICEContextualActions---------------------------------------------------} {$REGION ICEContextualActions---------------------------------------------------}