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);
var
widg: TCEWidget;
win: TControl;
begin
widg := TCEWidget( TComponent(sender).tag );
if widg = nil then exit;
//
if widg.isDockable then
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;
widg.showWidget;
end;
procedure TCEMainForm.layoutLoadFromFile(const aFilename: string);

View File

@ -6,7 +6,7 @@ interface
uses
Classes, SysUtils, FileUtil, Forms, Controls, ExtCtrls, ActnList, Menus,
ce_interfaces;
AnchorDocking, ce_interfaces;
type
@ -72,6 +72,8 @@ type
// increment a flag used to indicate if updateLoop has to be called
procedure IncLoopUpdate;
procedure showWidget;
// returns true if one of the three updater is processing.
property updating: boolean read fUpdating;
// true by default, allow a widget to be docked.
@ -147,6 +149,28 @@ begin
if isDockable then result := false
else result := fModal;
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}
{$REGION ICEContextualActions---------------------------------------------------}