mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-12-04 14:37:26 +01:00
dockmanager example: made client windows visible in MakeSite project
git-svn-id: trunk@25518 -
This commit is contained in:
parent
fa75807b76
commit
0d8b6c26e0
@ -1,11 +1,9 @@
|
||||
inherited EditorSite: TEditorSite
|
||||
object EditorSite: TEditorSite
|
||||
Left = 354
|
||||
Height = 300
|
||||
Top = 156
|
||||
Width = 400
|
||||
Caption = 'EditorSite'
|
||||
ClientHeight = 281
|
||||
ClientWidth = 400
|
||||
Menu = MainMenu1
|
||||
OnActivate = FormActivate
|
||||
OnCreate = FormCreate
|
||||
@ -13,7 +11,8 @@ inherited EditorSite: TEditorSite
|
||||
OnHide = FormHide
|
||||
OnResize = FormResize
|
||||
OnWindowStateChange = FormWindowStateChange
|
||||
object MainMenu1: TMainMenu[7]
|
||||
LCLVersion = '0.9.29'
|
||||
object MainMenu1: TMainMenu
|
||||
left = 240
|
||||
top = 48
|
||||
object mnFile: TMenuItem
|
||||
@ -96,7 +95,7 @@ inherited EditorSite: TEditorSite
|
||||
end
|
||||
end
|
||||
end
|
||||
object OpenDialog1: TOpenDialog[8]
|
||||
object OpenDialog1: TOpenDialog
|
||||
Filter = '*.pas|*.pas|All Files|*.*'
|
||||
left = 309
|
||||
top = 48
|
||||
|
||||
@ -1,33 +1,34 @@
|
||||
{ This is an automatically generated lazarus resource file }
|
||||
|
||||
LazarusResources.Add('TEditorSite','FORMDATA',[
|
||||
'TPF0'#241#11'TEditorSite'#10'EditorSite'#4'Left'#3'b'#1#6'Height'#3','#1#3'T'
|
||||
+'op'#3#156#0#5'Width'#3#144#1#7'Caption'#6#10'EditorSite'#12'ClientHeight'#3
|
||||
+#25#1#11'ClientWidth'#3#144#1#4'Menu'#7#9'MainMenu1'#10'OnActivate'#7#12'For'
|
||||
+'mActivate'#8'OnCreate'#7#10'FormCreate'#12'OnDeactivate'#7#14'FormDeactivat'
|
||||
+'e'#6'OnHide'#7#8'FormHide'#8'OnResize'#7#10'FormResize'#19'OnWindowStateCha'
|
||||
+'nge'#7#21'FormWindowStateChange'#0#242#2#7#9'TMainMenu'#9'MainMenu1'#4'left'
|
||||
+#3#240#0#3'top'#2'0'#0#9'TMenuItem'#6'mnFile'#7'Caption'#6#5'&File'#0#9'TMen'
|
||||
+'uItem'#6'mnOpen'#7'Caption'#6#5'&Open'#7'OnClick'#7#11'mnOpenClick'#0#0#9'T'
|
||||
+'MenuItem'#9'MenuItem1'#7'Caption'#6#1'-'#0#0#9'TMenuItem'#6'mnExit'#7'Capti'
|
||||
+'on'#6#5'E&xit'#7'OnClick'#7#11'mnExitClick'#0#0#0#9'TMenuItem'#6'mnView'#7
|
||||
+'Caption'#6#5'&View'#0#9'TMenuItem'#9'MenuItem2'#7'Caption'#6#16'Object Insp'
|
||||
+'ector'#7'OnClick'#7#13'ViewMenuClick'#0#0#9'TMenuItem'#9'MenuItem3'#7'Capti'
|
||||
+'on'#6#8'Messages'#7'OnClick'#7#13'ViewMenuClick'#0#0#9'TMenuItem'#9'MenuIte'
|
||||
+'m4'#7'Caption'#6#13'Code Explorer'#7'OnClick'#7#13'ViewMenuClick'#0#0#9'TMe'
|
||||
+'nuItem'#9'MenuItem5'#7'Caption'#6#9'ToDo List'#7'OnClick'#7#13'ViewMenuClic'
|
||||
+'k'#0#0#9'TMenuItem'#9'MenuItem6'#7'Caption'#6#13'Debug windows'#0#9'TMenuIt'
|
||||
+'em'#9'MenuItem7'#7'Caption'#6#7'Watches'#7'OnClick'#7#13'ViewMenuClick'#0#0
|
||||
+#9'TMenuItem'#9'MenuItem8'#7'Caption'#6#11'BreakPoints'#7'OnClick'#7#13'View'
|
||||
+'MenuClick'#0#0#9'TMenuItem'#9'MenuItem9'#7'Caption'#6#15'Local Variables'#7
|
||||
+'OnClick'#7#13'ViewMenuClick'#0#0#9'TMenuItem'#10'MenuItem10'#7'Caption'#6#9
|
||||
+'Registers'#7'OnClick'#7#13'ViewMenuClick'#0#0#9'TMenuItem'#10'MenuItem11'#7
|
||||
+'Caption'#6#10'Call Stack'#7'OnClick'#7#13'ViewMenuClick'#0#0#9'TMenuItem'#10
|
||||
+'MenuItem12'#7'Caption'#6#9'Assembler'#7'OnClick'#7#13'ViewMenuClick'#0#0#9
|
||||
+'TMenuItem'#10'MenuItem13'#7'Caption'#6#12'Debug Output'#7'OnClick'#7#13'Vie'
|
||||
+'wMenuClick'#0#0#0#0#9'TMenuItem'#10'MenuItem14'#7'Caption'#6#8'&Windows'#0#9
|
||||
+'TMenuItem'#12'mnWindowDump'#7'Caption'#6#5'&Dump'#7'OnClick'#7#17'mnWindowD'
|
||||
+'umpClick'#0#0#9'TMenuItem'#10'mnMinimize'#7'Caption'#6#12'Minimize all'#7'O'
|
||||
+'nClick'#7#15'mnMinimizeClick'#0#0#9'TMenuItem'#9'mnRestore'#7'Caption'#6#11
|
||||
+'Restore all'#7'OnClick'#7#14'mnRestoreClick'#0#0#0#0#242#2#8#11'TOpenDialog'
|
||||
+#11'OpenDialog1'#6'Filter'#6#25'*.pas|*.pas|All Files|*.*'#4'left'#3'5'#1#3
|
||||
+'top'#2'0'#0#0#0
|
||||
'TPF0'#11'TEditorSite'#10'EditorSite'#4'Left'#3'b'#1#6'Height'#3','#1#3'Top'#3
|
||||
+#156#0#5'Width'#3#144#1#7'Caption'#6#10'EditorSite'#4'Menu'#7#9'MainMenu1'#10
|
||||
+'OnActivate'#7#12'FormActivate'#8'OnCreate'#7#10'FormCreate'#12'OnDeactivate'
|
||||
+#7#14'FormDeactivate'#6'OnHide'#7#8'FormHide'#8'OnResize'#7#10'FormResize'#19
|
||||
+'OnWindowStateChange'#7#21'FormWindowStateChange'#10'LCLVersion'#6#6'0.9.29'
|
||||
+#0#9'TMainMenu'#9'MainMenu1'#4'left'#3#240#0#3'top'#2'0'#0#9'TMenuItem'#6'mn'
|
||||
+'File'#7'Caption'#6#5'&File'#0#9'TMenuItem'#6'mnOpen'#7'Caption'#6#5'&Open'#7
|
||||
+'OnClick'#7#11'mnOpenClick'#0#0#9'TMenuItem'#9'MenuItem1'#7'Caption'#6#1'-'#0
|
||||
+#0#9'TMenuItem'#6'mnExit'#7'Caption'#6#5'E&xit'#7'OnClick'#7#11'mnExitClick'
|
||||
+#0#0#0#9'TMenuItem'#6'mnView'#7'Caption'#6#5'&View'#0#9'TMenuItem'#9'MenuIte'
|
||||
+'m2'#7'Caption'#6#16'Object Inspector'#7'OnClick'#7#13'ViewMenuClick'#0#0#9
|
||||
+'TMenuItem'#9'MenuItem3'#7'Caption'#6#8'Messages'#7'OnClick'#7#13'ViewMenuCl'
|
||||
+'ick'#0#0#9'TMenuItem'#9'MenuItem4'#7'Caption'#6#13'Code Explorer'#7'OnClick'
|
||||
+#7#13'ViewMenuClick'#0#0#9'TMenuItem'#9'MenuItem5'#7'Caption'#6#9'ToDo List'
|
||||
+#7'OnClick'#7#13'ViewMenuClick'#0#0#9'TMenuItem'#9'MenuItem6'#7'Caption'#6#13
|
||||
+'Debug windows'#0#9'TMenuItem'#9'MenuItem7'#7'Caption'#6#7'Watches'#7'OnClic'
|
||||
+'k'#7#13'ViewMenuClick'#0#0#9'TMenuItem'#9'MenuItem8'#7'Caption'#6#11'BreakP'
|
||||
+'oints'#7'OnClick'#7#13'ViewMenuClick'#0#0#9'TMenuItem'#9'MenuItem9'#7'Capti'
|
||||
+'on'#6#15'Local Variables'#7'OnClick'#7#13'ViewMenuClick'#0#0#9'TMenuItem'#10
|
||||
+'MenuItem10'#7'Caption'#6#9'Registers'#7'OnClick'#7#13'ViewMenuClick'#0#0#9
|
||||
+'TMenuItem'#10'MenuItem11'#7'Caption'#6#10'Call Stack'#7'OnClick'#7#13'ViewM'
|
||||
+'enuClick'#0#0#9'TMenuItem'#10'MenuItem12'#7'Caption'#6#9'Assembler'#7'OnCli'
|
||||
+'ck'#7#13'ViewMenuClick'#0#0#9'TMenuItem'#10'MenuItem13'#7'Caption'#6#12'Deb'
|
||||
+'ug Output'#7'OnClick'#7#13'ViewMenuClick'#0#0#0#0#9'TMenuItem'#10'MenuItem1'
|
||||
+'4'#7'Caption'#6#8'&Windows'#0#9'TMenuItem'#12'mnWindowDump'#7'Caption'#6#5
|
||||
+'&Dump'#7'OnClick'#7#17'mnWindowDumpClick'#0#0#9'TMenuItem'#10'mnMinimize'#7
|
||||
+'Caption'#6#12'Minimize all'#7'OnClick'#7#15'mnMinimizeClick'#0#0#9'TMenuIte'
|
||||
+'m'#9'mnRestore'#7'Caption'#6#11'Restore all'#7'OnClick'#7#14'mnRestoreClick'
|
||||
+#0#0#0#0#11'TOpenDialog'#11'OpenDialog1'#6'Filter'#6#25'*.pas|*.pas|All File'
|
||||
+'s|*.*'#4'left'#3'5'#1#3'top'#2'0'#0#0#0
|
||||
]);
|
||||
|
||||
@ -135,6 +135,7 @@ begin
|
||||
//Client.FloatingDockSiteClass := TFloatingSite;
|
||||
Site := TFloatingSite.Create(Application);
|
||||
Client.ManualDock(Site, nil, alClient);
|
||||
Site.Show;
|
||||
Result := Client;
|
||||
end;
|
||||
|
||||
|
||||
@ -53,13 +53,14 @@ LCL TODO:
|
||||
|
||||
{$DEFINE ctlType} //save <name>:<classname>=<caption>
|
||||
{$DEFINE RootDock} //allow docking into the root zone?
|
||||
{.$DEFINE freeImages} //free dockheader images on finalization? (can cause exception)
|
||||
//{$DEFINE newSplitter} //exclude splitter from remaining zone
|
||||
{.$DEFINE handle_existing} //dock controls existing in the dock site?
|
||||
{.$DEFINE splitter_color} //use colored splitter, for debugging?
|
||||
{.$DEFINE visibility} //handling of invisible clients deserves dock manager notification!
|
||||
{.$DEFINE restore} //restore button?
|
||||
//looks useless: how to restore a hidden zone?
|
||||
{.$DEFINE singleTab} //allow to create notebooks with 1 tab (in the topzone)?
|
||||
{$DEFINE singleTab} //allow to create notebooks with 1 tab (in the topzone)?
|
||||
//doesn't look nice, with both a header AND a button list
|
||||
|
||||
//depending on widgetset or patched LCL
|
||||
@ -726,11 +727,12 @@ begin
|
||||
{$ENDIF}
|
||||
NoteBook.Show;
|
||||
end; //else use existing control
|
||||
DebugLn('DM:add to existing notebook ', DbgSName(NoteBook));
|
||||
NoteBookAdd(NoteBook, Control);
|
||||
FDockSite.Invalidate; //update notebook caption
|
||||
exit;
|
||||
{$IFDEF singleTab}
|
||||
end else if SingleTab and not (DropCtl is TEasyBook) then begin
|
||||
end else if SingleTab and not (DropCtl is TEasyDockBook) then begin
|
||||
//empty root zone, create new notebook
|
||||
NoteBook := NoteBookCreate;
|
||||
NoteBook.ManualDock(FDockSite, nil, alClient);
|
||||
|
||||
@ -98,6 +98,7 @@ type
|
||||
Tabs: TTabs;
|
||||
CurTab: TTabButton;
|
||||
protected
|
||||
procedure DoAddDockClient(Client: TControl; const ARect: TRect); override;
|
||||
function GetFloatingDockSiteClass: TWinControlClass; override;
|
||||
function GetDefaultDockCaption: string; override;
|
||||
function GetControlTab(AControl: TControl): TTabButton;
|
||||
@ -109,6 +110,7 @@ type
|
||||
{$IFDEF closeFix}
|
||||
destructor Destroy; override;
|
||||
{$ENDIF}
|
||||
procedure Clear; virtual;
|
||||
procedure LoadFromStream(strm: TStream); override;
|
||||
procedure SaveToStream(strm: TStream); override;
|
||||
end;
|
||||
@ -160,12 +162,24 @@ end;
|
||||
|
||||
{$IFDEF closeFix}
|
||||
destructor TEasyDockBook.Destroy;
|
||||
begin
|
||||
(* Close docked forms, make all docked controls visible - or hidden?
|
||||
*)
|
||||
Clear; //allow for override
|
||||
inherited Destroy;
|
||||
end;
|
||||
{$ELSE}
|
||||
//pure option
|
||||
{$ENDIF}
|
||||
|
||||
procedure TEasyDockBook.Clear;
|
||||
var
|
||||
i: integer;
|
||||
ctl: TControl;
|
||||
frm: TCustomForm absolute ctl;
|
||||
begin
|
||||
(* Close docked forms, make all docked controls visible - or hidden?
|
||||
(* Remove all docked clients.
|
||||
By default the clients are made visible (debug feature)
|
||||
*)
|
||||
for i := DockClientCount - 1 downto 0 do begin
|
||||
ctl := DockClients[i];
|
||||
@ -174,19 +188,15 @@ begin
|
||||
ctl.Visible := True; //make hidden notebook pages visible
|
||||
if ctl is TCustomForm then
|
||||
if frm.CloseQuery then
|
||||
frm.Close
|
||||
else
|
||||
ctl.Visible := True; //make hidden notebook pages visible
|
||||
frm.Close;
|
||||
//else ctl.Visible := True; //make hidden notebook pages visible
|
||||
{$ELSE}
|
||||
ctl.Visible := False; //hide notebook page
|
||||
ctl.Visible := True; //show notebook page
|
||||
{$ENDIF}
|
||||
end;
|
||||
end;
|
||||
inherited Destroy;
|
||||
end;
|
||||
{$ELSE}
|
||||
//pure option
|
||||
{$ENDIF}
|
||||
|
||||
|
||||
procedure TEasyDockBook.FormClose(Sender: TObject;
|
||||
var CloseAction: TCloseAction);
|
||||
@ -212,12 +222,19 @@ begin
|
||||
Visible := True; //immediately?
|
||||
end;
|
||||
|
||||
procedure TEasyDockBook.DoAddDockClient(Client: TControl; const ARect: TRect);
|
||||
begin
|
||||
if False then inherited DoAddDockClient(Client, ARect);
|
||||
Client.Parent := pnlDock;
|
||||
end;
|
||||
|
||||
procedure TEasyDockBook.FormDockDrop(Sender: TObject; Source: TDragDockObject;
|
||||
X, Y: Integer);
|
||||
var
|
||||
btn: TTabButton;
|
||||
begin
|
||||
Source.Control.Parent := pnlDock; //overwrite DoAddDockClient behaviour
|
||||
{ TODO : set Parent in DoAddDockClient }
|
||||
//Source.Control.Parent := pnlDock; //overwrite DoAddDockClient behaviour???
|
||||
|
||||
btn := TTabButton.Create(Tabs);
|
||||
btn.Control := Source.Control;
|
||||
|
||||
@ -30,10 +30,13 @@ procedure DestroyDockHeaderImages;
|
||||
var
|
||||
ImageKind: TDockHeaderImageKind;
|
||||
begin
|
||||
{$IFDEF freeImages}
|
||||
//called from unit finalization only!
|
||||
// this code can result in crashes, due to missing handles!
|
||||
for ImageKind := Low(TDockHeaderImageKind) to High(TDockHeaderImageKind) do
|
||||
FreeAndNil(DockBtnImages[ImageKind]);
|
||||
{$ELSE}
|
||||
{$ENDIF}
|
||||
end;
|
||||
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user