git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@5879 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61pull/1/head
@ -1,32 +1,56 @@ |
|||||||
<DockingManager version="1.2.1"> |
<DockingManager version="1.3.0"> |
||||||
<ResizingPanel ResizeWidth="*" ResizeHeight="*" EffectiveSize="1076,904.08" Orientation="Vertical"> |
<ResizingPanel ResizeWidth="*" ResizeHeight="*" EffectiveSize="0,0" Orientation="Vertical"> |
||||||
<ResizingPanel ResizeWidth="*" ResizeHeight="*" EffectiveSize="1257.04,717.08" Orientation="Horizontal"> |
<ResizingPanel ResizeWidth="*" ResizeHeight="*" EffectiveSize="1280,670" Orientation="Horizontal"> |
||||||
<DockablePane ResizeWidth="200" ResizeHeight="*" EffectiveSize="200,717.08" Anchor="Left"> |
<DockablePane ResizeWidth="200" ResizeHeight="*" EffectiveSize="200,670" ID="4b6a1236-66d8-480d-80c2-5fb4e6236fef" Anchor="Left" IsAutoHidden="false" /> |
||||||
<DockableContent Name="ICSharpCode_SharpDevelop_Project_ProjectBrowserPad" AutoHide="false" /> |
<ResizingPanel ResizeWidth="*" ResizeHeight="*" EffectiveSize="1280,670" Orientation="Vertical"> |
||||||
<DockableContent Name="ICSharpCode_SharpDevelop_Gui_ToolsPad" AutoHide="false" /> |
<ResizingPanel ResizeWidth="0.5*" ResizeHeight="*" EffectiveSize="1280,476" Orientation="Horizontal"> |
||||||
|
<DockablePane ResizeWidth="211" ResizeHeight="*" EffectiveSize="211,476" ID="58b37d24-baec-4f73-9fc9-9d65d0e17d4f" Anchor="Left" IsAutoHidden="false"> |
||||||
|
<DockableContent Name="ICSharpCode_SharpDevelop_Project_ProjectBrowserPad" FloatingWindowSize="250,400" ChildIndex="0" Width="200" Height="670" Anchor="Left" State="Docked" ContainerPaneID="4b6a1236-66d8-480d-80c2-5fb4e6236fef" /> |
||||||
|
<DockableContent Name="ICSharpCode_SharpDevelop_Gui_ToolsPad" FloatingWindowSize="250,400" ChildIndex="0" Width="200" Height="670" Anchor="Left" State="Docked" ContainerPaneID="4b6a1236-66d8-480d-80c2-5fb4e6236fef" /> |
||||||
</DockablePane> |
</DockablePane> |
||||||
<DocumentPanePlaceHolder /> |
<DocumentPaneResizingPanel ResizeWidth="0.142857142857143*" ResizeHeight="*" EffectiveSize="807,476" Orientation="Vertical"> |
||||||
<DockablePane ResizeWidth="200" ResizeHeight="*" EffectiveSize="200,717.08" Anchor="Right"> |
<DocumentPane IsMain="true" /> |
||||||
<DockableContent Name="ICSharpCode_SharpDevelop_Gui_ClassBrowser_ClassBrowserPad" AutoHide="true" /> |
</DocumentPaneResizingPanel> |
||||||
<DockableContent Name="ICSharpCode_SharpDevelop_Gui_PropertyPad" AutoHide="true" /> |
<DockablePane ResizeWidth="250" ResizeHeight="*" EffectiveSize="250,476" ID="561f0563-1c7e-4618-a813-871b21848f4e" Anchor="Right" IsAutoHidden="false"> |
||||||
|
<DockableContent Name="ICSharpCode_SharpDevelop_Gui_ClassBrowser_ClassBrowserPad" FloatingWindowSize="250,400" ChildIndex="0" Width="200" Height="670" Anchor="Right" State="Docked" ContainerPaneID="9bb68751-4ad1-4e6e-8f46-a9830486c40f" /> |
||||||
|
<DockableContent Name="ICSharpCode_SharpDevelop_Gui_PropertyPad" FloatingWindowSize="250,400" ChildIndex="0" Width="200" Height="670" Anchor="Right" State="Docked" ContainerPaneID="9bb68751-4ad1-4e6e-8f46-a9830486c40f" /> |
||||||
</DockablePane> |
</DockablePane> |
||||||
</ResizingPanel> |
</ResizingPanel> |
||||||
<ResizingPanel ResizeWidth="*" ResizeHeight="183" EffectiveSize="1257.04,183" Orientation="Horizontal"> |
<ResizingPanel ResizeWidth="*" ResizeHeight="188" EffectiveSize="1280,188" Orientation="Horizontal"> |
||||||
<DockablePane ResizeWidth="0.516044590840343*" ResizeHeight="150" EffectiveSize="646.624514106583,183" Anchor="Bottom"> |
<DockablePane ResizeWidth="0.244949068363451*" ResizeHeight="188" EffectiveSize="624.130226190072,188" ID="77255f09-b21a-490d-83a7-af0d08551048" Anchor="Bottom" IsAutoHidden="false"> |
||||||
<DockableContent Name="ICSharpCode_SharpDevelop_Gui_ErrorListPad" AutoHide="false" FloatingWindowSize="1280,150" /> |
<DockableContent Name="ICSharpCode_SharpDevelop_Gui_CompilerMessageView" FloatingWindowSize="250,400" ChildIndex="1" Width="650" Height="188" Anchor="Bottom" State="Docked" ContainerPaneID="3963d998-99b8-4c60-9211-f99636755607" /> |
||||||
<DockableContent Name="ICSharpCode_SharpDevelop_Gui_CompilerMessageView" AutoHide="false" FloatingWindowSize="1280,150" /> |
<DockableContent Name="ICSharpCode_SharpDevelop_Gui_ErrorListPad" FloatingWindowSize="250,400" ChildIndex="0" Width="1280" Height="147" Anchor="Bottom" State="Docked" /> |
||||||
<DockableContent Name="ICSharpCode_SharpDevelop_Gui_Pads_RunningThreadsPad" AutoHide="false" FloatingWindowSize="128,904.08" /> |
<DockableContent Name="ICSharpCode_SharpDevelop_Gui_Pads_RunningThreadsPad" FloatingWindowSize="250,400" ChildIndex="2" Width="624" Height="188" Anchor="Bottom" State="Docked" ContainerPaneID="77255f09-b21a-490d-83a7-af0d08551048" /> |
||||||
<DockableContent Name="ICSharpCode_SharpDevelop_Gui_Pads_LocalVarPad" AutoHide="false" FloatingWindowSize="123,904.08" /> |
<DockableContent Name="ICSharpCode_SharpDevelop_Gui_Pads_LocalVarPad" FloatingWindowSize="250,400" ChildIndex="3" Width="624" Height="188" Anchor="Bottom" State="Docked" ContainerPaneID="77255f09-b21a-490d-83a7-af0d08551048" /> |
||||||
</DockablePane> |
</DockablePane> |
||||||
<DockablePane ResizeWidth="0.483955409159657*" ResizeHeight="*" EffectiveSize="606.415485893417,183" Anchor="Bottom"> |
<DockablePane ResizeWidth="0.255050931636549*" ResizeHeight="*" EffectiveSize="649.869773809928,188" ID="3963d998-99b8-4c60-9211-f99636755607" Anchor="Bottom" IsAutoHidden="false"> |
||||||
<DockableContent Name="ICSharpCode_SharpDevelop_Gui_Pads_CallStackPad" AutoHide="false" FloatingWindowSize="640,904.08" /> |
<DockableContent Name="ICSharpCode_SharpDevelop_Gui_Pads_CallStackPad" FloatingWindowSize="250,400" ChildIndex="3" Width="1074" Height="188" Anchor="Bottom" State="Docked" ContainerPaneID="77255f09-b21a-490d-83a7-af0d08551048" /> |
||||||
<DockableContent Name="ICSharpCode_SharpDevelop_Gui_Pads_ConsolePad" AutoHide="false" FloatingWindowSize="175,904.08" /> |
<DockableContent Name="ICSharpCode_SharpDevelop_Gui_Pads_WatchPad" FloatingWindowSize="250,400" ChildIndex="4" Width="624" Height="188" Anchor="Bottom" State="Docked" ContainerPaneID="77255f09-b21a-490d-83a7-af0d08551048" /> |
||||||
<DockableContent Name="ICSharpCode_SharpDevelop_Gui_Pads_WatchPad" AutoHide="false" FloatingWindowSize="200,904.08" /> |
<DockableContent Name="ICSharpCode_SharpDevelop_Gui_Pads_ConsolePad" FloatingWindowSize="250,400" ChildIndex="4" Width="624" Height="188" Anchor="Bottom" State="Docked" ContainerPaneID="77255f09-b21a-490d-83a7-af0d08551048" /> |
||||||
</DockablePane> |
</DockablePane> |
||||||
</ResizingPanel> |
</ResizingPanel> |
||||||
</ResizingPanel> |
</ResizingPanel> |
||||||
|
<DockablePane ResizeWidth="200" ResizeHeight="*" EffectiveSize="200,670" ID="9bb68751-4ad1-4e6e-8f46-a9830486c40f" Anchor="Right" IsAutoHidden="false" /> |
||||||
|
</ResizingPanel> |
||||||
|
</ResizingPanel> |
||||||
<Hidden> |
<Hidden> |
||||||
<DockableContent Name="ICSharpCode_SharpDevelop_Gui_TaskListPad" AutoHide="false"/> |
<DockableContent Name="ICSharpCode_SharpDevelop_Gui_OutlinePad" FloatingWindowSize="250,400" ChildIndex="2" Width="100" Height="100" Anchor="Left" State="Docked" ContainerPaneID="c22bd528-c3d5-45c7-a0bd-729b614beb3f" /> |
||||||
|
<DockableContent Name="ICSharpCode_SharpDevelop_Gui_FileScout" FloatingWindowSize="250,400" ChildIndex="2" Width="100" Height="100" Anchor="Left" State="Docked" ContainerPaneID="c22bd528-c3d5-45c7-a0bd-729b614beb3f" /> |
||||||
|
<DockableContent Name="ICSharpCode_SharpDevelop_Editor_Search_SearchResultsPad" FloatingWindowSize="250,400" ChildIndex="3" Width="100" Height="100" Anchor="Bottom" State="Docked" ContainerPaneID="ae0442d7-e21f-4495-ba4a-45949a882be3" /> |
||||||
|
<DockableContent Name="ICSharpCode_SharpDevelop_Bookmarks_BookmarkPad" FloatingWindowSize="250,400" ChildIndex="3" Width="100" Height="100" Anchor="Bottom" State="Docked" ContainerPaneID="ae0442d7-e21f-4495-ba4a-45949a882be3" /> |
||||||
|
<DockableContent Name="ICSharpCode_PythonBinding_PythonConsolePad" FloatingWindowSize="250,400" ChildIndex="3" Width="100" Height="100" Anchor="Bottom" State="Docked" ContainerPaneID="ae0442d7-e21f-4495-ba4a-45949a882be3" /> |
||||||
|
<DockableContent Name="ICSharpCode_RubyBinding_RubyConsolePad" FloatingWindowSize="250,400" ChildIndex="3" Width="100" Height="100" Anchor="Bottom" State="Docked" ContainerPaneID="ae0442d7-e21f-4495-ba4a-45949a882be3" /> |
||||||
|
<DockableContent Name="ICSharpCode_CodeCoverage_CodeCoveragePad" FloatingWindowSize="250,400" ChildIndex="3" Width="100" Height="100" Anchor="Bottom" State="Docked" ContainerPaneID="ae0442d7-e21f-4495-ba4a-45949a882be3" /> |
||||||
|
<DockableContent Name="ICSharpCode_SharpDevelop_Gui_DefinitionViewPad" FloatingWindowSize="250,400" ChildIndex="3" Width="100" Height="100" Anchor="Bottom" State="Docked" ContainerPaneID="ae0442d7-e21f-4495-ba4a-45949a882be3" /> |
||||||
|
<DockableContent Name="Grunwald_BooBinding_InteractiveInterpreterPad" FloatingWindowSize="250,400" ChildIndex="3" Width="100" Height="100" Anchor="Bottom" State="Docked" ContainerPaneID="ae0442d7-e21f-4495-ba4a-45949a882be3" /> |
||||||
|
<DockableContent Name="FSharpBinding_FSharpInteractive" FloatingWindowSize="250,400" ChildIndex="3" Width="100" Height="100" Anchor="Bottom" State="Docked" ContainerPaneID="ae0442d7-e21f-4495-ba4a-45949a882be3" /> |
||||||
|
<DockableContent Name="ICSharpCode_WixBinding_SetupDialogListPad" FloatingWindowSize="250,400" ChildIndex="3" Width="100" Height="100" Anchor="Bottom" State="Docked" ContainerPaneID="ae0442d7-e21f-4495-ba4a-45949a882be3" /> |
||||||
|
<DockableContent Name="ICSharpCode_SharpDevelop_Gui_Pads_BreakPointsPad" FloatingWindowSize="250,400" ChildIndex="3" Width="100" Height="100" Anchor="Bottom" State="Docked" ContainerPaneID="ae0442d7-e21f-4495-ba4a-45949a882be3" /> |
||||||
|
<DockableContent Name="ICSharpCode_SharpDevelop_Gui_Pads_LoadedModulesPad" FloatingWindowSize="250,400" ChildIndex="3" Width="100" Height="100" Anchor="Bottom" State="Docked" ContainerPaneID="ae0442d7-e21f-4495-ba4a-45949a882be3" /> |
||||||
|
<DockableContent Name="ICSharpCode_Data_Addin_Pad_DatabasesTreeViewPad" FloatingWindowSize="250,400" ChildIndex="2" Width="100" Height="100" Anchor="Right" State="Docked" ContainerPaneID="d9952f44-e5ad-47c0-add8-beb79f601550" /> |
||||||
|
<DockableContent Name="ICSharpCode_UnitTesting_UnitTestsPad" FloatingWindowSize="250,400" ChildIndex="2" Width="100" Height="100" Anchor="Right" State="Docked" ContainerPaneID="d9952f44-e5ad-47c0-add8-beb79f601550" /> |
||||||
|
<DockableContent Name="ICSharpCode_XmlEditor_XPathQueryPad" FloatingWindowSize="250,400" ChildIndex="3" Width="100" Height="100" Anchor="Bottom" State="Docked" ContainerPaneID="ae0442d7-e21f-4495-ba4a-45949a882be3" /> |
||||||
|
<DockableContent Name="ICSharpCode_SharpDevelop_Gui_TaskListPad" FloatingWindowSize="250,400" ChildIndex="1" Width="624" Height="188" Anchor="Bottom" State="Docked" ContainerPaneID="77255f09-b21a-490d-83a7-af0d08551048" /> |
||||||
</Hidden> |
</Hidden> |
||||||
<Windows /> |
<Windows /> |
||||||
</DockingManager> |
</DockingManager> |
||||||
@ -1,22 +1,49 @@ |
|||||||
<DockingManager version="1.2.1"> |
<DockingManager version="1.3.0"> |
||||||
<ResizingPanel ResizeWidth="*" ResizeHeight="*" EffectiveSize="0,0" Orientation="Horizontal"> |
<ResizingPanel ResizeWidth="*" ResizeHeight="*" EffectiveSize="0,0" Orientation="Vertical"> |
||||||
<DockablePane ResizeWidth="200" ResizeHeight="*" EffectiveSize="200,904.08" Anchor="Left"> |
<ResizingPanel ResizeWidth="*" ResizeHeight="*" EffectiveSize="1280,670" Orientation="Horizontal"> |
||||||
<DockableContent Name="ICSharpCode_SharpDevelop_Project_ProjectBrowserPad" AutoHide="false" /> |
<DockablePane ResizeWidth="200" ResizeHeight="*" EffectiveSize="200,670" ID="4b6a1236-66d8-480d-80c2-5fb4e6236fef" Anchor="Left" IsAutoHidden="false"> |
||||||
<DockableContent Name="ICSharpCode_SharpDevelop_Gui_ToolsPad" AutoHide="false" /> |
<DockableContent Name="ICSharpCode_SharpDevelop_Project_ProjectBrowserPad" FloatingWindowSize="250,400" /> |
||||||
|
<DockableContent Name="ICSharpCode_SharpDevelop_Gui_ToolsPad" FloatingWindowSize="250,400" /> |
||||||
</DockablePane> |
</DockablePane> |
||||||
<ResizingPanel ResizeWidth="*" ResizeHeight="*" EffectiveSize="872,904.08" Orientation="Vertical"> |
<ResizingPanel ResizeWidth="0.142857142857143*" ResizeHeight="*" EffectiveSize="868,670" Orientation="Vertical"> |
||||||
<DocumentPanePlaceHolder /> |
<DocumentPaneResizingPanel ResizeWidth="0.5*" ResizeHeight="*" EffectiveSize="868,476" Orientation="Vertical"> |
||||||
<DockablePane ResizeWidth="*" ResizeHeight="150" EffectiveSize="872,150" Anchor="Bottom"> |
<DocumentPane IsMain="true" /> |
||||||
<DockableContent Name="ICSharpCode_SharpDevelop_Gui_ErrorListPad" AutoHide="false" FloatingWindowSize="1280,150" /> |
</DocumentPaneResizingPanel> |
||||||
<DockableContent Name="ICSharpCode_SharpDevelop_Gui_TaskListPad" AutoHide="false" FloatingWindowSize="1280,150" /> |
<DockablePane ResizeWidth="*" ResizeHeight="188" EffectiveSize="868,188" ID="77255f09-b21a-490d-83a7-af0d08551048" Anchor="Bottom" IsAutoHidden="false"> |
||||||
<DockableContent Name="ICSharpCode_SharpDevelop_Gui_CompilerMessageView" AutoHide="false" FloatingWindowSize="1280,150" /> |
<DockableContent Name="ICSharpCode_SharpDevelop_Gui_ErrorListPad" FloatingWindowSize="250,400" ChildIndex="0" Width="1280" Height="147" Anchor="Bottom" State="Docked" ContainerPaneID="5c97c37d-9f06-41e7-80f1-e2894cbbb501" /> |
||||||
|
<DockableContent Name="ICSharpCode_SharpDevelop_Gui_TaskListPad" FloatingWindowSize="250,400" ChildIndex="0" Width="1280" Height="147" Anchor="Bottom" State="Docked" ContainerPaneID="5c97c37d-9f06-41e7-80f1-e2894cbbb501" /> |
||||||
|
<DockableContent Name="ICSharpCode_SharpDevelop_Gui_CompilerMessageView" FloatingWindowSize="250,400" ChildIndex="0" Width="1280" Height="147" Anchor="Bottom" State="Docked" ContainerPaneID="5c97c37d-9f06-41e7-80f1-e2894cbbb501" /> |
||||||
</DockablePane> |
</DockablePane> |
||||||
</ResizingPanel> |
</ResizingPanel> |
||||||
<DockablePane ResizeWidth="200" ResizeHeight="*" EffectiveSize="200,904.08" Anchor="Right"> |
<DockablePane ResizeWidth="200" ResizeHeight="*" EffectiveSize="200,670" ID="9bb68751-4ad1-4e6e-8f46-a9830486c40f" Anchor="Right" IsAutoHidden="false"> |
||||||
<DockableContent Name="ICSharpCode_SharpDevelop_Gui_ClassBrowser_ClassBrowserPad" AutoHide="false" /> |
<DockableContent Name="ICSharpCode_SharpDevelop_Gui_ClassBrowser_ClassBrowserPad" FloatingWindowSize="250,400" /> |
||||||
<DockableContent Name="ICSharpCode_SharpDevelop_Gui_PropertyPad" AutoHide="false" /> |
<DockableContent Name="ICSharpCode_SharpDevelop_Gui_PropertyPad" FloatingWindowSize="250,400" /> |
||||||
</DockablePane> |
</DockablePane> |
||||||
</ResizingPanel> |
</ResizingPanel> |
||||||
<Hidden /> |
<DockablePane ResizeWidth="*" ResizeHeight="147" EffectiveSize="1280,147" ID="5c97c37d-9f06-41e7-80f1-e2894cbbb501" Anchor="Bottom" IsAutoHidden="false" /> |
||||||
|
</ResizingPanel> |
||||||
|
<Hidden> |
||||||
|
<DockableContent Name="ICSharpCode_SharpDevelop_Gui_OutlinePad" FloatingWindowSize="250,400" ChildIndex="2" Width="100" Height="100" Anchor="Left" State="Docked" ContainerPaneID="4b6a1236-66d8-480d-80c2-5fb4e6236fef" /> |
||||||
|
<DockableContent Name="ICSharpCode_SharpDevelop_Gui_FileScout" FloatingWindowSize="250,400" ChildIndex="2" Width="100" Height="100" Anchor="Left" State="Docked" ContainerPaneID="4b6a1236-66d8-480d-80c2-5fb4e6236fef" /> |
||||||
|
<DockableContent Name="ICSharpCode_SharpDevelop_Editor_Search_SearchResultsPad" FloatingWindowSize="250,400" ChildIndex="3" Width="100" Height="100" Anchor="Bottom" State="Docked" ContainerPaneID="5c97c37d-9f06-41e7-80f1-e2894cbbb501" /> |
||||||
|
<DockableContent Name="ICSharpCode_SharpDevelop_Bookmarks_BookmarkPad" FloatingWindowSize="250,400" ChildIndex="3" Width="100" Height="100" Anchor="Bottom" State="Docked" ContainerPaneID="5c97c37d-9f06-41e7-80f1-e2894cbbb501" /> |
||||||
|
<DockableContent Name="ICSharpCode_PythonBinding_PythonConsolePad" FloatingWindowSize="250,400" ChildIndex="3" Width="100" Height="100" Anchor="Bottom" State="Docked" ContainerPaneID="5c97c37d-9f06-41e7-80f1-e2894cbbb501" /> |
||||||
|
<DockableContent Name="ICSharpCode_RubyBinding_RubyConsolePad" FloatingWindowSize="250,400" ChildIndex="3" Width="100" Height="100" Anchor="Bottom" State="Docked" ContainerPaneID="5c97c37d-9f06-41e7-80f1-e2894cbbb501" /> |
||||||
|
<DockableContent Name="ICSharpCode_CodeCoverage_CodeCoveragePad" FloatingWindowSize="250,400" ChildIndex="3" Width="100" Height="100" Anchor="Bottom" State="Docked" ContainerPaneID="5c97c37d-9f06-41e7-80f1-e2894cbbb501" /> |
||||||
|
<DockableContent Name="ICSharpCode_SharpDevelop_Gui_DefinitionViewPad" FloatingWindowSize="250,400" ChildIndex="3" Width="100" Height="100" Anchor="Bottom" State="Docked" ContainerPaneID="5c97c37d-9f06-41e7-80f1-e2894cbbb501" /> |
||||||
|
<DockableContent Name="Grunwald_BooBinding_InteractiveInterpreterPad" FloatingWindowSize="250,400" ChildIndex="3" Width="100" Height="100" Anchor="Bottom" State="Docked" ContainerPaneID="5c97c37d-9f06-41e7-80f1-e2894cbbb501" /> |
||||||
|
<DockableContent Name="FSharpBinding_FSharpInteractive" FloatingWindowSize="250,400" ChildIndex="3" Width="100" Height="100" Anchor="Bottom" State="Docked" ContainerPaneID="5c97c37d-9f06-41e7-80f1-e2894cbbb501" /> |
||||||
|
<DockableContent Name="ICSharpCode_WixBinding_SetupDialogListPad" FloatingWindowSize="250,400" ChildIndex="3" Width="100" Height="100" Anchor="Bottom" State="Docked" ContainerPaneID="5c97c37d-9f06-41e7-80f1-e2894cbbb501" /> |
||||||
|
<DockableContent Name="ICSharpCode_SharpDevelop_Gui_Pads_BreakPointsPad" FloatingWindowSize="250,400" ChildIndex="3" Width="100" Height="100" Anchor="Bottom" State="Docked" ContainerPaneID="5c97c37d-9f06-41e7-80f1-e2894cbbb501" /> |
||||||
|
<DockableContent Name="ICSharpCode_SharpDevelop_Gui_Pads_CallStackPad" FloatingWindowSize="250,400" ChildIndex="3" Width="100" Height="100" Anchor="Bottom" State="Docked" ContainerPaneID="5c97c37d-9f06-41e7-80f1-e2894cbbb501" /> |
||||||
|
<DockableContent Name="ICSharpCode_SharpDevelop_Gui_Pads_LoadedModulesPad" FloatingWindowSize="250,400" ChildIndex="3" Width="100" Height="100" Anchor="Bottom" State="Docked" ContainerPaneID="5c97c37d-9f06-41e7-80f1-e2894cbbb501" /> |
||||||
|
<DockableContent Name="ICSharpCode_SharpDevelop_Gui_Pads_RunningThreadsPad" FloatingWindowSize="250,400" ChildIndex="3" Width="100" Height="100" Anchor="Bottom" State="Docked" ContainerPaneID="5c97c37d-9f06-41e7-80f1-e2894cbbb501" /> |
||||||
|
<DockableContent Name="ICSharpCode_SharpDevelop_Gui_Pads_LocalVarPad" FloatingWindowSize="250,400" ChildIndex="3" Width="100" Height="100" Anchor="Bottom" State="Docked" ContainerPaneID="5c97c37d-9f06-41e7-80f1-e2894cbbb501" /> |
||||||
|
<DockableContent Name="ICSharpCode_SharpDevelop_Gui_Pads_ConsolePad" FloatingWindowSize="250,400" ChildIndex="3" Width="100" Height="100" Anchor="Bottom" State="Docked" ContainerPaneID="5c97c37d-9f06-41e7-80f1-e2894cbbb501" /> |
||||||
|
<DockableContent Name="ICSharpCode_SharpDevelop_Gui_Pads_WatchPad" FloatingWindowSize="250,400" ChildIndex="3" Width="100" Height="100" Anchor="Bottom" State="Docked" ContainerPaneID="5c97c37d-9f06-41e7-80f1-e2894cbbb501" /> |
||||||
|
<DockableContent Name="ICSharpCode_Data_Addin_Pad_DatabasesTreeViewPad" FloatingWindowSize="250,400" ChildIndex="2" Width="100" Height="100" Anchor="Right" State="Docked" ContainerPaneID="9bb68751-4ad1-4e6e-8f46-a9830486c40f" /> |
||||||
|
<DockableContent Name="ICSharpCode_UnitTesting_UnitTestsPad" FloatingWindowSize="250,400" ChildIndex="2" Width="100" Height="100" Anchor="Right" State="Docked" ContainerPaneID="9bb68751-4ad1-4e6e-8f46-a9830486c40f" /> |
||||||
|
<DockableContent Name="ICSharpCode_XmlEditor_XPathQueryPad" FloatingWindowSize="250,400" ChildIndex="3" Width="100" Height="100" Anchor="Bottom" State="Docked" ContainerPaneID="5c97c37d-9f06-41e7-80f1-e2894cbbb501" /> |
||||||
|
</Hidden> |
||||||
<Windows /> |
<Windows /> |
||||||
</DockingManager> |
</DockingManager> |
||||||
@ -1,5 +1,43 @@ |
|||||||
<DockingManager version="1.2.1"> |
<DockingManager version="1.3.0"> |
||||||
<DocumentPanePlaceHolder /> |
<ResizingPanel ResizeWidth="*" ResizeHeight="*" EffectiveSize="1280,670" Orientation="Horizontal"> |
||||||
<Hidden /> |
<DockablePane ResizeWidth="200" ResizeHeight="*" EffectiveSize="200,670" ID="4b6a1236-66d8-480d-80c2-5fb4e6236fef" Anchor="Left" IsAutoHidden="false" /> |
||||||
|
<ResizingPanel ResizeWidth="*" ResizeHeight="*" EffectiveSize="1280,670" Orientation="Vertical"> |
||||||
|
<DocumentPaneResizingPanel ResizeWidth="*" ResizeHeight="*" EffectiveSize="1280,670" Orientation="Vertical"> |
||||||
|
<DocumentPane IsMain="true" /> |
||||||
|
</DocumentPaneResizingPanel> |
||||||
|
<DockablePane ResizeWidth="*" ResizeHeight="188" EffectiveSize="1074,188" ID="77255f09-b21a-490d-83a7-af0d08551048" Anchor="Bottom" IsAutoHidden="false" /> |
||||||
|
</ResizingPanel> |
||||||
|
<DockablePane ResizeWidth="200" ResizeHeight="*" EffectiveSize="200,670" ID="9bb68751-4ad1-4e6e-8f46-a9830486c40f" Anchor="Right" IsAutoHidden="false" /> |
||||||
|
</ResizingPanel> |
||||||
|
<Hidden> |
||||||
|
<DockableContent Name="ICSharpCode_SharpDevelop_Gui_OutlinePad" FloatingWindowSize="250,400" ChildIndex="2" Width="100" Height="100" Anchor="Left" State="Docked" ContainerPaneID="9f120566-38aa-4659-bebb-c206e105433c" /> |
||||||
|
<DockableContent Name="ICSharpCode_SharpDevelop_Gui_FileScout" FloatingWindowSize="250,400" ChildIndex="2" Width="100" Height="100" Anchor="Left" State="Docked" ContainerPaneID="9f120566-38aa-4659-bebb-c206e105433c" /> |
||||||
|
<DockableContent Name="ICSharpCode_SharpDevelop_Editor_Search_SearchResultsPad" FloatingWindowSize="250,400" ChildIndex="3" Width="100" Height="100" Anchor="Bottom" State="Docked" ContainerPaneID="43258c58-277d-45a4-b3b6-148958df7e55" /> |
||||||
|
<DockableContent Name="ICSharpCode_SharpDevelop_Bookmarks_BookmarkPad" FloatingWindowSize="250,400" ChildIndex="3" Width="100" Height="100" Anchor="Bottom" State="Docked" ContainerPaneID="43258c58-277d-45a4-b3b6-148958df7e55" /> |
||||||
|
<DockableContent Name="ICSharpCode_PythonBinding_PythonConsolePad" FloatingWindowSize="250,400" ChildIndex="3" Width="100" Height="100" Anchor="Bottom" State="Docked" ContainerPaneID="43258c58-277d-45a4-b3b6-148958df7e55" /> |
||||||
|
<DockableContent Name="ICSharpCode_RubyBinding_RubyConsolePad" FloatingWindowSize="250,400" ChildIndex="3" Width="100" Height="100" Anchor="Bottom" State="Docked" ContainerPaneID="43258c58-277d-45a4-b3b6-148958df7e55" /> |
||||||
|
<DockableContent Name="ICSharpCode_CodeCoverage_CodeCoveragePad" FloatingWindowSize="250,400" ChildIndex="3" Width="100" Height="100" Anchor="Bottom" State="Docked" ContainerPaneID="43258c58-277d-45a4-b3b6-148958df7e55" /> |
||||||
|
<DockableContent Name="ICSharpCode_SharpDevelop_Gui_DefinitionViewPad" FloatingWindowSize="250,400" ChildIndex="3" Width="100" Height="100" Anchor="Bottom" State="Docked" ContainerPaneID="43258c58-277d-45a4-b3b6-148958df7e55" /> |
||||||
|
<DockableContent Name="Grunwald_BooBinding_InteractiveInterpreterPad" FloatingWindowSize="250,400" ChildIndex="3" Width="100" Height="100" Anchor="Bottom" State="Docked" ContainerPaneID="43258c58-277d-45a4-b3b6-148958df7e55" /> |
||||||
|
<DockableContent Name="FSharpBinding_FSharpInteractive" FloatingWindowSize="250,400" ChildIndex="3" Width="100" Height="100" Anchor="Bottom" State="Docked" ContainerPaneID="43258c58-277d-45a4-b3b6-148958df7e55" /> |
||||||
|
<DockableContent Name="ICSharpCode_WixBinding_SetupDialogListPad" FloatingWindowSize="250,400" ChildIndex="3" Width="100" Height="100" Anchor="Bottom" State="Docked" ContainerPaneID="43258c58-277d-45a4-b3b6-148958df7e55" /> |
||||||
|
<DockableContent Name="ICSharpCode_SharpDevelop_Gui_Pads_BreakPointsPad" FloatingWindowSize="250,400" ChildIndex="3" Width="100" Height="100" Anchor="Bottom" State="Docked" ContainerPaneID="43258c58-277d-45a4-b3b6-148958df7e55" /> |
||||||
|
<DockableContent Name="ICSharpCode_SharpDevelop_Gui_Pads_CallStackPad" FloatingWindowSize="250,400" ChildIndex="3" Width="100" Height="100" Anchor="Bottom" State="Docked" ContainerPaneID="43258c58-277d-45a4-b3b6-148958df7e55" /> |
||||||
|
<DockableContent Name="ICSharpCode_SharpDevelop_Gui_Pads_LoadedModulesPad" FloatingWindowSize="250,400" ChildIndex="3" Width="100" Height="100" Anchor="Bottom" State="Docked" ContainerPaneID="43258c58-277d-45a4-b3b6-148958df7e55" /> |
||||||
|
<DockableContent Name="ICSharpCode_SharpDevelop_Gui_Pads_RunningThreadsPad" FloatingWindowSize="250,400" ChildIndex="3" Width="100" Height="100" Anchor="Bottom" State="Docked" ContainerPaneID="43258c58-277d-45a4-b3b6-148958df7e55" /> |
||||||
|
<DockableContent Name="ICSharpCode_SharpDevelop_Gui_Pads_LocalVarPad" FloatingWindowSize="250,400" ChildIndex="3" Width="100" Height="100" Anchor="Bottom" State="Docked" ContainerPaneID="43258c58-277d-45a4-b3b6-148958df7e55" /> |
||||||
|
<DockableContent Name="ICSharpCode_SharpDevelop_Gui_Pads_ConsolePad" FloatingWindowSize="250,400" ChildIndex="3" Width="100" Height="100" Anchor="Bottom" State="Docked" ContainerPaneID="43258c58-277d-45a4-b3b6-148958df7e55" /> |
||||||
|
<DockableContent Name="ICSharpCode_SharpDevelop_Gui_Pads_WatchPad" FloatingWindowSize="250,400" ChildIndex="3" Width="100" Height="100" Anchor="Bottom" State="Docked" ContainerPaneID="43258c58-277d-45a4-b3b6-148958df7e55" /> |
||||||
|
<DockableContent Name="ICSharpCode_Data_Addin_Pad_DatabasesTreeViewPad" FloatingWindowSize="250,400" ChildIndex="2" Width="100" Height="100" Anchor="Right" State="Docked" ContainerPaneID="d097e079-2391-47cc-b140-4d53b775ce6e" /> |
||||||
|
<DockableContent Name="ICSharpCode_UnitTesting_UnitTestsPad" FloatingWindowSize="250,400" ChildIndex="2" Width="100" Height="100" Anchor="Right" State="Docked" ContainerPaneID="d097e079-2391-47cc-b140-4d53b775ce6e" /> |
||||||
|
<DockableContent Name="ICSharpCode_XmlEditor_XPathQueryPad" FloatingWindowSize="250,400" ChildIndex="3" Width="100" Height="100" Anchor="Bottom" State="Docked" ContainerPaneID="43258c58-277d-45a4-b3b6-148958df7e55" /> |
||||||
|
<DockableContent Name="ICSharpCode_SharpDevelop_Project_ProjectBrowserPad" FloatingWindowSize="250,400" ChildIndex="0" Width="200" Height="670" Anchor="Left" State="Docked" ContainerPaneID="4b6a1236-66d8-480d-80c2-5fb4e6236fef" /> |
||||||
|
<DockableContent Name="ICSharpCode_SharpDevelop_Gui_ToolsPad" FloatingWindowSize="250,400" ChildIndex="0" Width="200" Height="670" Anchor="Left" State="Docked" ContainerPaneID="4b6a1236-66d8-480d-80c2-5fb4e6236fef" /> |
||||||
|
<DockableContent Name="ICSharpCode_SharpDevelop_Gui_ErrorListPad" FloatingWindowSize="250,400" ChildIndex="0" Width="1074" Height="188" Anchor="Bottom" State="Docked" ContainerPaneID="77255f09-b21a-490d-83a7-af0d08551048" /> |
||||||
|
<DockableContent Name="ICSharpCode_SharpDevelop_Gui_TaskListPad" FloatingWindowSize="250,400" ChildIndex="0" Width="1074" Height="188" Anchor="Bottom" State="Docked" ContainerPaneID="77255f09-b21a-490d-83a7-af0d08551048" /> |
||||||
|
<DockableContent Name="ICSharpCode_SharpDevelop_Gui_CompilerMessageView" FloatingWindowSize="250,400" ChildIndex="0" Width="1074" Height="188" Anchor="Bottom" State="Docked" ContainerPaneID="77255f09-b21a-490d-83a7-af0d08551048" /> |
||||||
|
<DockableContent Name="ICSharpCode_SharpDevelop_Gui_ClassBrowser_ClassBrowserPad" FloatingWindowSize="250,400" ChildIndex="0" Width="200" Height="670" Anchor="Right" State="Docked" ContainerPaneID="9bb68751-4ad1-4e6e-8f46-a9830486c40f" /> |
||||||
|
<DockableContent Name="ICSharpCode_SharpDevelop_Gui_PropertyPad" FloatingWindowSize="250,400" ChildIndex="0" Width="200" Height="670" Anchor="Right" State="Docked" ContainerPaneID="9bb68751-4ad1-4e6e-8f46-a9830486c40f" /> |
||||||
|
</Hidden> |
||||||
<Windows /> |
<Windows /> |
||||||
</DockingManager> |
</DockingManager> |
||||||
@ -0,0 +1,129 @@ |
|||||||
|
<?xml version="1.0" encoding="utf-8"?> |
||||||
|
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> |
||||||
|
<PropertyGroup> |
||||||
|
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> |
||||||
|
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> |
||||||
|
<ProductVersion>8.0.30703</ProductVersion> |
||||||
|
<SchemaVersion>2.0</SchemaVersion> |
||||||
|
<ProjectGuid>{3836F4A8-4B35-4F5E-BB0F-DAD374297525}</ProjectGuid> |
||||||
|
<OutputType>library</OutputType> |
||||||
|
<AppDesignerFolder>Properties</AppDesignerFolder> |
||||||
|
<RootNamespace>AvalonDock.Themes</RootNamespace> |
||||||
|
<AssemblyName>AvalonDock.Themes</AssemblyName> |
||||||
|
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion> |
||||||
|
<TargetFrameworkProfile>Client</TargetFrameworkProfile> |
||||||
|
<FileAlignment>512</FileAlignment> |
||||||
|
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> |
||||||
|
<WarningLevel>4</WarningLevel> |
||||||
|
</PropertyGroup> |
||||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> |
||||||
|
<DebugSymbols>true</DebugSymbols> |
||||||
|
<DebugType>full</DebugType> |
||||||
|
<Optimize>false</Optimize> |
||||||
|
<OutputPath>bin\Debug\</OutputPath> |
||||||
|
<DefineConstants>DEBUG;TRACE</DefineConstants> |
||||||
|
<ErrorReport>prompt</ErrorReport> |
||||||
|
<WarningLevel>4</WarningLevel> |
||||||
|
</PropertyGroup> |
||||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> |
||||||
|
<DebugType>pdbonly</DebugType> |
||||||
|
<Optimize>true</Optimize> |
||||||
|
<OutputPath>bin\Release\</OutputPath> |
||||||
|
<DefineConstants>TRACE</DefineConstants> |
||||||
|
<ErrorReport>prompt</ErrorReport> |
||||||
|
<WarningLevel>4</WarningLevel> |
||||||
|
</PropertyGroup> |
||||||
|
<ItemGroup> |
||||||
|
<Reference Include="System" /> |
||||||
|
<Reference Include="System.Data" /> |
||||||
|
<Reference Include="System.Xml" /> |
||||||
|
<Reference Include="Microsoft.CSharp" /> |
||||||
|
<Reference Include="System.Core" /> |
||||||
|
<Reference Include="System.Xml.Linq" /> |
||||||
|
<Reference Include="System.Data.DataSetExtensions" /> |
||||||
|
<Reference Include="System.Xaml"> |
||||||
|
<RequiredTargetFramework>4.0</RequiredTargetFramework> |
||||||
|
</Reference> |
||||||
|
<Reference Include="WindowsBase" /> |
||||||
|
<Reference Include="PresentationCore" /> |
||||||
|
<Reference Include="PresentationFramework" /> |
||||||
|
</ItemGroup> |
||||||
|
<ItemGroup> |
||||||
|
<Page Include="Themes\ExpressionDark.xaml"> |
||||||
|
<Generator>MSBuild:Compile</Generator> |
||||||
|
<SubType>Designer</SubType> |
||||||
|
</Page> |
||||||
|
<Page Include="Themes\dev2010.xaml"> |
||||||
|
<Generator>MSBuild:Compile</Generator> |
||||||
|
<SubType>Designer</SubType> |
||||||
|
</Page> |
||||||
|
</ItemGroup> |
||||||
|
<ItemGroup> |
||||||
|
<Compile Include="Properties\AssemblyInfo.cs"> |
||||||
|
<SubType>Code</SubType> |
||||||
|
</Compile> |
||||||
|
<Compile Include="Properties\Resources.Designer.cs"> |
||||||
|
<AutoGen>True</AutoGen> |
||||||
|
<DesignTime>True</DesignTime> |
||||||
|
<DependentUpon>Resources.resx</DependentUpon> |
||||||
|
</Compile> |
||||||
|
<Compile Include="Properties\Settings.Designer.cs"> |
||||||
|
<AutoGen>True</AutoGen> |
||||||
|
<DependentUpon>Settings.settings</DependentUpon> |
||||||
|
<DesignTimeSharedInput>True</DesignTimeSharedInput> |
||||||
|
</Compile> |
||||||
|
<EmbeddedResource Include="Properties\Resources.resx"> |
||||||
|
<Generator>ResXFileCodeGenerator</Generator> |
||||||
|
<LastGenOutput>Resources.Designer.cs</LastGenOutput> |
||||||
|
</EmbeddedResource> |
||||||
|
<None Include="Properties\Settings.settings"> |
||||||
|
<Generator>SettingsSingleFileGenerator</Generator> |
||||||
|
<LastGenOutput>Settings.Designer.cs</LastGenOutput> |
||||||
|
</None> |
||||||
|
<AppDesigner Include="Properties\" /> |
||||||
|
</ItemGroup> |
||||||
|
<ItemGroup> |
||||||
|
<Resource Include="Images\ExpDark\HTabGroup.png" /> |
||||||
|
</ItemGroup> |
||||||
|
<ItemGroup> |
||||||
|
<Resource Include="Images\dev2010\HTabGroup.png" /> |
||||||
|
<Resource Include="Images\dev2010\Locked.png" /> |
||||||
|
<Resource Include="Images\dev2010\PinAutoHide.png" /> |
||||||
|
<Resource Include="Images\dev2010\PinClose.png" /> |
||||||
|
<Resource Include="Images\dev2010\PinDocMenu.png" /> |
||||||
|
<Resource Include="Images\dev2010\PinMenu.png" /> |
||||||
|
<Resource Include="Images\dev2010\VTabGroup.png" /> |
||||||
|
</ItemGroup> |
||||||
|
<ItemGroup> |
||||||
|
<Resource Include="Images\ExpDark\VTabGroup.png" /> |
||||||
|
</ItemGroup> |
||||||
|
<ItemGroup> |
||||||
|
<Resource Include="Images\ExpDark\Locked.png" /> |
||||||
|
</ItemGroup> |
||||||
|
<ItemGroup> |
||||||
|
<Resource Include="Images\ExpDark\PinAutoHide.png" /> |
||||||
|
</ItemGroup> |
||||||
|
<ItemGroup> |
||||||
|
<Resource Include="Images\ExpDark\PinClose.png" /> |
||||||
|
</ItemGroup> |
||||||
|
<ItemGroup> |
||||||
|
<Resource Include="Images\ExpDark\PinDocMenu.png" /> |
||||||
|
</ItemGroup> |
||||||
|
<ItemGroup> |
||||||
|
<Resource Include="Images\ExpDark\PinMenu.png" /> |
||||||
|
</ItemGroup> |
||||||
|
<ItemGroup> |
||||||
|
<ProjectReference Include="..\AvalonDock\AvalonDock.csproj"> |
||||||
|
<Project>{87E61430-4243-45F2-B74E-0A4C096CEBF3}</Project> |
||||||
|
<Name>AvalonDock</Name> |
||||||
|
</ProjectReference> |
||||||
|
</ItemGroup> |
||||||
|
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> |
||||||
|
<!-- To modify your build process, add your task inside one of the targets below and uncomment it. |
||||||
|
Other similar extension points exist, see Microsoft.Common.targets. |
||||||
|
<Target Name="BeforeBuild"> |
||||||
|
</Target> |
||||||
|
<Target Name="AfterBuild"> |
||||||
|
</Target> |
||||||
|
--> |
||||||
|
</Project> |
||||||
@ -0,0 +1,6 @@ |
|||||||
|
<?xml version="1.0" encoding="utf-8"?> |
||||||
|
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> |
||||||
|
<PropertyGroup> |
||||||
|
<ProjectView>ProjectFiles</ProjectView> |
||||||
|
</PropertyGroup> |
||||||
|
</Project> |
||||||
|
After Width: | Height: | Size: 358 B |
|
After Width: | Height: | Size: 357 B |
|
After Width: | Height: | Size: 1.2 KiB |
|
After Width: | Height: | Size: 1.2 KiB |
|
After Width: | Height: | Size: 1.2 KiB |
|
After Width: | Height: | Size: 1.2 KiB |
|
After Width: | Height: | Size: 403 B |
|
After Width: | Height: | Size: 358 B |
|
After Width: | Height: | Size: 357 B |
|
After Width: | Height: | Size: 1.2 KiB |
|
After Width: | Height: | Size: 1.2 KiB |
|
After Width: | Height: | Size: 1.2 KiB |
|
After Width: | Height: | Size: 1.2 KiB |
|
After Width: | Height: | Size: 403 B |
@ -0,0 +1,55 @@ |
|||||||
|
using System.Reflection; |
||||||
|
using System.Resources; |
||||||
|
using System.Runtime.CompilerServices; |
||||||
|
using System.Runtime.InteropServices; |
||||||
|
using System.Windows; |
||||||
|
|
||||||
|
// General Information about an assembly is controlled through the following
|
||||||
|
// set of attributes. Change these attribute values to modify the information
|
||||||
|
// associated with an assembly.
|
||||||
|
[assembly: AssemblyTitle("AvalonDock.Themes")] |
||||||
|
[assembly: AssemblyDescription("")] |
||||||
|
[assembly: AssemblyConfiguration("")] |
||||||
|
[assembly: AssemblyCompany("")] |
||||||
|
[assembly: AssemblyProduct("AvalonDock.Themes")] |
||||||
|
[assembly: AssemblyCopyright("Copyright © Adolfo Marinucci 2010")] |
||||||
|
[assembly: AssemblyTrademark("")] |
||||||
|
[assembly: AssemblyCulture("")] |
||||||
|
|
||||||
|
// Setting ComVisible to false makes the types in this assembly not visible
|
||||||
|
// to COM components. If you need to access a type in this assembly from
|
||||||
|
// COM, set the ComVisible attribute to true on that type.
|
||||||
|
[assembly: ComVisible(false)] |
||||||
|
|
||||||
|
//In order to begin building localizable applications, set
|
||||||
|
//<UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file
|
||||||
|
//inside a <PropertyGroup>. For example, if you are using US english
|
||||||
|
//in your source files, set the <UICulture> to en-US. Then uncomment
|
||||||
|
//the NeutralResourceLanguage attribute below. Update the "en-US" in
|
||||||
|
//the line below to match the UICulture setting in the project file.
|
||||||
|
|
||||||
|
//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
|
||||||
|
|
||||||
|
|
||||||
|
[assembly: ThemeInfo( |
||||||
|
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
|
||||||
|
//(used if a resource is not found in the page,
|
||||||
|
// or application resource dictionaries)
|
||||||
|
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
|
||||||
|
//(used if a resource is not found in the page,
|
||||||
|
// app, or any theme specific resource dictionaries)
|
||||||
|
)] |
||||||
|
|
||||||
|
|
||||||
|
// Version information for an assembly consists of the following four values:
|
||||||
|
//
|
||||||
|
// Major Version
|
||||||
|
// Minor Version
|
||||||
|
// Build Number
|
||||||
|
// Revision
|
||||||
|
//
|
||||||
|
// You can specify all the values or you can default the Build and Revision Numbers
|
||||||
|
// by using the '*' as shown below:
|
||||||
|
// [assembly: AssemblyVersion("1.0.*")]
|
||||||
|
[assembly: AssemblyVersion("1.0.0.0")] |
||||||
|
[assembly: AssemblyFileVersion("1.0.0.0")] |
||||||
@ -0,0 +1,71 @@ |
|||||||
|
//------------------------------------------------------------------------------
|
||||||
|
// <auto-generated>
|
||||||
|
// This code was generated by a tool.
|
||||||
|
// Runtime Version:4.0.30319.1
|
||||||
|
//
|
||||||
|
// Changes to this file may cause incorrect behavior and will be lost if
|
||||||
|
// the code is regenerated.
|
||||||
|
// </auto-generated>
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
namespace AvalonDock.Themes.Properties |
||||||
|
{ |
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// A strongly-typed resource class, for looking up localized strings, etc.
|
||||||
|
/// </summary>
|
||||||
|
// This class was auto-generated by the StronglyTypedResourceBuilder
|
||||||
|
// class via a tool like ResGen or Visual Studio.
|
||||||
|
// To add or remove a member, edit your .ResX file then rerun ResGen
|
||||||
|
// with the /str option, or rebuild your VS project.
|
||||||
|
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] |
||||||
|
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()] |
||||||
|
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] |
||||||
|
internal class Resources |
||||||
|
{ |
||||||
|
|
||||||
|
private static global::System.Resources.ResourceManager resourceMan; |
||||||
|
|
||||||
|
private static global::System.Globalization.CultureInfo resourceCulture; |
||||||
|
|
||||||
|
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] |
||||||
|
internal Resources() |
||||||
|
{ |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns the cached ResourceManager instance used by this class.
|
||||||
|
/// </summary>
|
||||||
|
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] |
||||||
|
internal static global::System.Resources.ResourceManager ResourceManager |
||||||
|
{ |
||||||
|
get |
||||||
|
{ |
||||||
|
if ((resourceMan == null)) |
||||||
|
{ |
||||||
|
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("AvalonDock.Themes.Properties.Resources", typeof(Resources).Assembly); |
||||||
|
resourceMan = temp; |
||||||
|
} |
||||||
|
return resourceMan; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Overrides the current thread's CurrentUICulture property for all
|
||||||
|
/// resource lookups using this strongly typed resource class.
|
||||||
|
/// </summary>
|
||||||
|
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] |
||||||
|
internal static global::System.Globalization.CultureInfo Culture |
||||||
|
{ |
||||||
|
get |
||||||
|
{ |
||||||
|
return resourceCulture; |
||||||
|
} |
||||||
|
set |
||||||
|
{ |
||||||
|
resourceCulture = value; |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,117 @@ |
|||||||
|
<?xml version="1.0" encoding="utf-8"?> |
||||||
|
<root> |
||||||
|
<!-- |
||||||
|
Microsoft ResX Schema |
||||||
|
|
||||||
|
Version 2.0 |
||||||
|
|
||||||
|
The primary goals of this format is to allow a simple XML format |
||||||
|
that is mostly human readable. The generation and parsing of the |
||||||
|
various data types are done through the TypeConverter classes |
||||||
|
associated with the data types. |
||||||
|
|
||||||
|
Example: |
||||||
|
|
||||||
|
... ado.net/XML headers & schema ... |
||||||
|
<resheader name="resmimetype">text/microsoft-resx</resheader> |
||||||
|
<resheader name="version">2.0</resheader> |
||||||
|
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader> |
||||||
|
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader> |
||||||
|
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data> |
||||||
|
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data> |
||||||
|
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64"> |
||||||
|
<value>[base64 mime encoded serialized .NET Framework object]</value> |
||||||
|
</data> |
||||||
|
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> |
||||||
|
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value> |
||||||
|
<comment>This is a comment</comment> |
||||||
|
</data> |
||||||
|
|
||||||
|
There are any number of "resheader" rows that contain simple |
||||||
|
name/value pairs. |
||||||
|
|
||||||
|
Each data row contains a name, and value. The row also contains a |
||||||
|
type or mimetype. Type corresponds to a .NET class that support |
||||||
|
text/value conversion through the TypeConverter architecture. |
||||||
|
Classes that don't support this are serialized and stored with the |
||||||
|
mimetype set. |
||||||
|
|
||||||
|
The mimetype is used for serialized objects, and tells the |
||||||
|
ResXResourceReader how to depersist the object. This is currently not |
||||||
|
extensible. For a given mimetype the value must be set accordingly: |
||||||
|
|
||||||
|
Note - application/x-microsoft.net.object.binary.base64 is the format |
||||||
|
that the ResXResourceWriter will generate, however the reader can |
||||||
|
read any of the formats listed below. |
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.binary.base64 |
||||||
|
value : The object must be serialized with |
||||||
|
: System.Serialization.Formatters.Binary.BinaryFormatter |
||||||
|
: and then encoded with base64 encoding. |
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.soap.base64 |
||||||
|
value : The object must be serialized with |
||||||
|
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter |
||||||
|
: and then encoded with base64 encoding. |
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.bytearray.base64 |
||||||
|
value : The object must be serialized into a byte array |
||||||
|
: using a System.ComponentModel.TypeConverter |
||||||
|
: and then encoded with base64 encoding. |
||||||
|
--> |
||||||
|
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"> |
||||||
|
<xsd:element name="root" msdata:IsDataSet="true"> |
||||||
|
<xsd:complexType> |
||||||
|
<xsd:choice maxOccurs="unbounded"> |
||||||
|
<xsd:element name="metadata"> |
||||||
|
<xsd:complexType> |
||||||
|
<xsd:sequence> |
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" /> |
||||||
|
</xsd:sequence> |
||||||
|
<xsd:attribute name="name" type="xsd:string" /> |
||||||
|
<xsd:attribute name="type" type="xsd:string" /> |
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" /> |
||||||
|
</xsd:complexType> |
||||||
|
</xsd:element> |
||||||
|
<xsd:element name="assembly"> |
||||||
|
<xsd:complexType> |
||||||
|
<xsd:attribute name="alias" type="xsd:string" /> |
||||||
|
<xsd:attribute name="name" type="xsd:string" /> |
||||||
|
</xsd:complexType> |
||||||
|
</xsd:element> |
||||||
|
<xsd:element name="data"> |
||||||
|
<xsd:complexType> |
||||||
|
<xsd:sequence> |
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> |
||||||
|
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" /> |
||||||
|
</xsd:sequence> |
||||||
|
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" /> |
||||||
|
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" /> |
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" /> |
||||||
|
</xsd:complexType> |
||||||
|
</xsd:element> |
||||||
|
<xsd:element name="resheader"> |
||||||
|
<xsd:complexType> |
||||||
|
<xsd:sequence> |
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> |
||||||
|
</xsd:sequence> |
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" /> |
||||||
|
</xsd:complexType> |
||||||
|
</xsd:element> |
||||||
|
</xsd:choice> |
||||||
|
</xsd:complexType> |
||||||
|
</xsd:element> |
||||||
|
</xsd:schema> |
||||||
|
<resheader name="resmimetype"> |
||||||
|
<value>text/microsoft-resx</value> |
||||||
|
</resheader> |
||||||
|
<resheader name="version"> |
||||||
|
<value>2.0</value> |
||||||
|
</resheader> |
||||||
|
<resheader name="reader"> |
||||||
|
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> |
||||||
|
</resheader> |
||||||
|
<resheader name="writer"> |
||||||
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> |
||||||
|
</resheader> |
||||||
|
</root> |
||||||
@ -0,0 +1,30 @@ |
|||||||
|
//------------------------------------------------------------------------------
|
||||||
|
// <auto-generated>
|
||||||
|
// This code was generated by a tool.
|
||||||
|
// Runtime Version:4.0.30319.1
|
||||||
|
//
|
||||||
|
// Changes to this file may cause incorrect behavior and will be lost if
|
||||||
|
// the code is regenerated.
|
||||||
|
// </auto-generated>
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
namespace AvalonDock.Themes.Properties |
||||||
|
{ |
||||||
|
|
||||||
|
|
||||||
|
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] |
||||||
|
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "10.0.0.0")] |
||||||
|
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase |
||||||
|
{ |
||||||
|
|
||||||
|
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); |
||||||
|
|
||||||
|
public static Settings Default |
||||||
|
{ |
||||||
|
get |
||||||
|
{ |
||||||
|
return defaultInstance; |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,7 @@ |
|||||||
|
<?xml version='1.0' encoding='utf-8'?> |
||||||
|
<SettingsFile xmlns="uri:settings" CurrentProfile="(Default)"> |
||||||
|
<Profiles> |
||||||
|
<Profile Name="(Default)" /> |
||||||
|
</Profiles> |
||||||
|
<Settings /> |
||||||
|
</SettingsFile> |
||||||
@ -0,0 +1,960 @@ |
|||||||
|
<ResourceDictionary |
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" |
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
||||||
|
xmlns:ad="clr-namespace:AvalonDock;assembly=AvalonDock" |
||||||
|
xmlns:adRes="clr-namespace:AvalonDock.Properties;assembly=AvalonDock" |
||||||
|
> |
||||||
|
|
||||||
|
|
||||||
|
<ResourceDictionary.MergedDictionaries> |
||||||
|
<ResourceDictionary Source="/AvalonDock;component/themes/generic.xaml"/> |
||||||
|
</ResourceDictionary.MergedDictionaries> |
||||||
|
|
||||||
|
|
||||||
|
<!--Default brushes--> |
||||||
|
<!-- ManagedContentTabControlNormalBorderBrush --> |
||||||
|
<SolidColorBrush x:Key="ManagedContentTabControlNormalBorderBrush" |
||||||
|
Color="Transparent"/> |
||||||
|
|
||||||
|
<!-- ad:AvalonDockBrushes.DefaultBackgroundBrush --> |
||||||
|
<SolidColorBrush |
||||||
|
x:Key="{ComponentResourceKey TypeInTargetAssembly={x:Type ad:DockingManager}, ResourceId={x:Static ad:AvalonDockBrushes.DefaultBackgroundBrush}}" |
||||||
|
Color="#444444"/> |
||||||
|
|
||||||
|
<!--Foregroung Colors--> |
||||||
|
<SolidColorBrush x:Key="LightForegroundBrush" Color="White"/> |
||||||
|
|
||||||
|
<SolidColorBrush x:Key="DarkForegroundBrush" Color="Black"/> |
||||||
|
|
||||||
|
<!--Brushes for tab item header--> |
||||||
|
<!-- ManagedContentTabItemNormalBackground --> |
||||||
|
<SolidColorBrush x:Key="ManagedContentTabItemNormalBackground" Color="#333333"/> |
||||||
|
|
||||||
|
<!-- ManagedContentTabItemInvNormalBackground --> |
||||||
|
<LinearGradientBrush x:Key="ManagedContentTabItemInvNormalBackground" |
||||||
|
StartPoint="0,0" |
||||||
|
EndPoint="0,1"> |
||||||
|
<LinearGradientBrush.GradientStops> |
||||||
|
<GradientStop Color="#FFFFFFFF" |
||||||
|
Offset="0"/> |
||||||
|
<GradientStop Color="#FFECEBE6" |
||||||
|
Offset="1"/> |
||||||
|
</LinearGradientBrush.GradientStops> |
||||||
|
</LinearGradientBrush> |
||||||
|
|
||||||
|
<!-- ManagedContentTabItemHotBackground --> |
||||||
|
<SolidColorBrush x:Key="ManagedContentTabItemHotBackground" |
||||||
|
Color="#595959"/> |
||||||
|
|
||||||
|
<!-- ManagedContentTabItemInvHotBackground --> |
||||||
|
<LinearGradientBrush x:Key="ManagedContentTabItemInvHotBackground" |
||||||
|
StartPoint="0,1" |
||||||
|
EndPoint="0,0"> |
||||||
|
<LinearGradientBrush.GradientStops> |
||||||
|
<GradientStop Color="#50FFFCF2" Offset="0" /> |
||||||
|
<GradientStop Color="#50FFEDBA" Offset="0.5" /> |
||||||
|
<GradientStop Color="#50FFE8A6" Offset="0.5" /> |
||||||
|
<GradientStop Color="#50FFE8A6" Offset="1" /> |
||||||
|
</LinearGradientBrush.GradientStops> |
||||||
|
</LinearGradientBrush> |
||||||
|
|
||||||
|
<!-- ManagedContentTabItemSelectedBackground --> |
||||||
|
<SolidColorBrush x:Key="ManagedContentTabItemSelectedBackground" |
||||||
|
Color="#595959"/> |
||||||
|
|
||||||
|
<!-- ManagedContentTabItemDisabledBackground --> |
||||||
|
<SolidColorBrush x:Key="ManagedContentTabItemDisabledBackground" |
||||||
|
Color="#FFF5F4EA"/> |
||||||
|
|
||||||
|
<!-- ManagedContentTabItemSelectedBorderBackround --> |
||||||
|
<SolidColorBrush x:Key="ManagedContentTabItemSelectedBorderBackround" |
||||||
|
Color="White"/> |
||||||
|
|
||||||
|
<!--ManagedContentTabItemNormalBorderBrush--> |
||||||
|
<SolidColorBrush x:Key="ManagedContentTabItemNormalBorderBrush" |
||||||
|
Color="Transparent" /> |
||||||
|
|
||||||
|
<!--ManagedContentTabItemSelectedBorderBrush --> |
||||||
|
<SolidColorBrush x:Key="ManagedContentTabItemSelectedBorderBrush" |
||||||
|
Color="White"/> |
||||||
|
|
||||||
|
<!--ManagedContentTabItemHotBorderBrush --> |
||||||
|
<SolidColorBrush x:Key="ManagedContentTabItemHotBorderBrush" |
||||||
|
Color="White"/> |
||||||
|
|
||||||
|
<!--ManagedContentTabItemDisabledBorderBrush --> |
||||||
|
<SolidColorBrush x:Key="ManagedContentTabItemDisabledBorderBrush" |
||||||
|
Color="White"/> |
||||||
|
|
||||||
|
<!--Brushes for dockable pane headers--> |
||||||
|
<LinearGradientBrush x:Key="{ComponentResourceKey TypeInTargetAssembly={x:Type ad:DockingManager}, ResourceId={x:Static ad:AvalonDockBrushes.DockablePaneTitleBackgroundSelected}}" |
||||||
|
StartPoint="0,0" |
||||||
|
EndPoint="0,1"> |
||||||
|
<GradientStop Color="#FFFCF2" Offset="0" /> |
||||||
|
<GradientStop Color="#FFEDBA" Offset="0.5" /> |
||||||
|
<GradientStop Color="#FFE8A6" Offset="0.5" /> |
||||||
|
<GradientStop Color="#FFE8A6" Offset="1" /> |
||||||
|
</LinearGradientBrush> |
||||||
|
|
||||||
|
|
||||||
|
<!--DockablePaneTitleBackground--> |
||||||
|
<SolidColorBrush x:Key="{ComponentResourceKey TypeInTargetAssembly={x:Type ad:DockingManager}, ResourceId={x:Static ad:AvalonDockBrushes.DockablePaneTitleBackground}}" |
||||||
|
Color="Transparent"/> |
||||||
|
|
||||||
|
<!--DockablePaneTitleForeground--> |
||||||
|
<SolidColorBrush |
||||||
|
x:Key="{ComponentResourceKey TypeInTargetAssembly={x:Type ad:DockingManager}, ResourceId={x:Static ad:AvalonDockBrushes.DockablePaneTitleForeground}}" |
||||||
|
Color="White"/> |
||||||
|
|
||||||
|
<!--DockablePaneTitleForegroundSelected--> |
||||||
|
<SolidColorBrush |
||||||
|
x:Key="{ComponentResourceKey TypeInTargetAssembly={x:Type ad:DockingManager}, ResourceId={x:Static ad:AvalonDockBrushes.DockablePaneTitleForegroundSelected}}" |
||||||
|
Color="White"/> |
||||||
|
|
||||||
|
<!--Brushes for document headers--> |
||||||
|
<!--DocumentHeaderBackground--> |
||||||
|
<SolidColorBrush x:Key="{ComponentResourceKey TypeInTargetAssembly={x:Type ad:DockingManager}, ResourceId={x:Static ad:AvalonDockBrushes.DocumentHeaderBackground}}" |
||||||
|
Color="#333333"/> |
||||||
|
|
||||||
|
<!--DocumentHeaderBorderBrushMouseOver--> |
||||||
|
<SolidColorBrush x:Key="{ComponentResourceKey TypeInTargetAssembly={x:Type ad:DockingManager}, ResourceId={x:Static ad:AvalonDockBrushes.DocumentHeaderBorderBrushMouseOver}}" |
||||||
|
Color="#595959"/> |
||||||
|
|
||||||
|
<!--DocumentHeaderForeground--> |
||||||
|
<SolidColorBrush |
||||||
|
x:Key="{ComponentResourceKey TypeInTargetAssembly={x:Type ad:DockingManager}, ResourceId={x:Static ad:AvalonDockBrushes.DocumentHeaderForeground}}" |
||||||
|
Color="White"/> |
||||||
|
|
||||||
|
<!--DocumentHeaderForegroundSelected--> |
||||||
|
<SolidColorBrush |
||||||
|
x:Key="{ComponentResourceKey TypeInTargetAssembly={x:Type ad:DockingManager}, ResourceId={x:Static ad:AvalonDockBrushes.DocumentHeaderForegroundSelected}}" |
||||||
|
Color="White"/> |
||||||
|
|
||||||
|
<!--DocumentHeaderForegroundSelectedActivated--> |
||||||
|
<SolidColorBrush |
||||||
|
x:Key="{ComponentResourceKey TypeInTargetAssembly={x:Type ad:DockingManager}, ResourceId={x:Static ad:AvalonDockBrushes.DocumentHeaderForegroundSelectedActivated}}" |
||||||
|
Color="White"/> |
||||||
|
|
||||||
|
<!--DefaultDocumentPaneBackground--> |
||||||
|
<DrawingBrush x:Key="DefaultDocumentPaneBackground" |
||||||
|
TileMode="Tile" |
||||||
|
Viewport="0 0 20 20" |
||||||
|
ViewportUnits="Absolute" |
||||||
|
Stretch="None"> |
||||||
|
<DrawingBrush.Drawing> |
||||||
|
<DrawingGroup> |
||||||
|
<GeometryDrawing Brush="#2F2F2F"> |
||||||
|
<GeometryDrawing.Geometry> |
||||||
|
<RectangleGeometry Rect="0,0,10,10"/> |
||||||
|
</GeometryDrawing.Geometry> |
||||||
|
</GeometryDrawing> |
||||||
|
<GeometryDrawing Brush="#2D2D2D"> |
||||||
|
<GeometryDrawing.Geometry> |
||||||
|
<RectangleGeometry Rect="0,10,10,10"/> |
||||||
|
</GeometryDrawing.Geometry> |
||||||
|
</GeometryDrawing> |
||||||
|
<GeometryDrawing Brush="#2D2D2D"> |
||||||
|
<GeometryDrawing.Geometry> |
||||||
|
<RectangleGeometry Rect="10,0,10,10"/> |
||||||
|
</GeometryDrawing.Geometry> |
||||||
|
</GeometryDrawing> |
||||||
|
<GeometryDrawing Brush="#2F2F2F"> |
||||||
|
<GeometryDrawing.Geometry> |
||||||
|
<RectangleGeometry Rect="10,10,10,10"/> |
||||||
|
</GeometryDrawing.Geometry> |
||||||
|
</GeometryDrawing> |
||||||
|
</DrawingGroup> |
||||||
|
</DrawingBrush.Drawing> |
||||||
|
</DrawingBrush> |
||||||
|
|
||||||
|
<!--DocumentHeaderBackgroundSelected--> |
||||||
|
<SolidColorBrush x:Key="{ComponentResourceKey TypeInTargetAssembly={x:Type ad:DockingManager}, ResourceId={x:Static ad:AvalonDockBrushes.DocumentHeaderBackgroundSelected}}" |
||||||
|
Color="#595959"/> |
||||||
|
|
||||||
|
<!--DocumentHeaderBackgroundSelectedActivated--> |
||||||
|
<SolidColorBrush x:Key="{ComponentResourceKey TypeInTargetAssembly={x:Type ad:DockingManager}, ResourceId={x:Static ad:AvalonDockBrushes.DocumentHeaderBackgroundSelectedActivated}}" |
||||||
|
Color="#595959"/> |
||||||
|
|
||||||
|
<!--DocumentHeaderBackgroundMouseOver--> |
||||||
|
<SolidColorBrush x:Key="{ComponentResourceKey TypeInTargetAssembly={x:Type ad:DockingManager}, ResourceId={x:Static ad:AvalonDockBrushes.DocumentHeaderBackgroundMouseOver}}" |
||||||
|
Color="#595959"/> |
||||||
|
|
||||||
|
<!--PaneHeaderCommandBorderBrush--> |
||||||
|
<LinearGradientBrush x:Key="{ComponentResourceKey TypeInTargetAssembly={x:Type ad:DockingManager}, ResourceId={x:Static ad:AvalonDockBrushes.PaneHeaderCommandBorderBrush}}" |
||||||
|
StartPoint="0,0" EndPoint="0,1"> |
||||||
|
<LinearGradientBrush.GradientStops> |
||||||
|
<GradientStop Color="#50FFE8A6" Offset="0" /> |
||||||
|
<GradientStop Color="#50FFE8A6" Offset="0.5" /> |
||||||
|
<GradientStop Color="#50FFEDBA" Offset="0.5" /> |
||||||
|
<GradientStop Color="#50FFFCF2" Offset="1" /> |
||||||
|
</LinearGradientBrush.GradientStops> |
||||||
|
</LinearGradientBrush> |
||||||
|
|
||||||
|
<SolidColorBrush x:Key="{ComponentResourceKey TypeInTargetAssembly={x:Type ad:DockingManager}, ResourceId={x:Static ad:AvalonDockBrushes.PaneHeaderCommandBackground}}" |
||||||
|
Color="White"/> |
||||||
|
|
||||||
|
<!--DocumentHeaderBorderSelected--> |
||||||
|
<SolidColorBrush |
||||||
|
x:Key="{ComponentResourceKey TypeInTargetAssembly={x:Type ad:DockingManager}, ResourceId={x:Static ad:AvalonDockBrushes.DocumentHeaderBorderSelected}}" |
||||||
|
Color="#CED4DF"/> |
||||||
|
|
||||||
|
<!--DocumentHeaderBorderSelectedActivated--> |
||||||
|
<SolidColorBrush |
||||||
|
x:Key="{ComponentResourceKey TypeInTargetAssembly={x:Type ad:DockingManager}, ResourceId={x:Static ad:AvalonDockBrushes.DocumentHeaderBorderSelectedActivated}}" |
||||||
|
Color="#FFE8A6"/> |
||||||
|
|
||||||
|
<!--DockingManager--> |
||||||
|
<Style x:Key="{x:Type ad:DockingManager}" TargetType="{x:Type ad:DockingManager}"> |
||||||
|
<Setter Property="Background" Value="{DynamicResource {ComponentResourceKey {x:Type ad:DockingManager}, {x:Static ad:AvalonDockBrushes.DefaultBackgroundBrush}}}"/> |
||||||
|
<Setter Property="FocusVisualStyle" Value="{x:Null}"/> |
||||||
|
<Setter Property="Template"> |
||||||
|
<Setter.Value> |
||||||
|
<ControlTemplate TargetType="{x:Type ad:DockingManager}"> |
||||||
|
<Grid |
||||||
|
Background="{TemplateBinding Background}" |
||||||
|
> |
||||||
|
<Grid.ColumnDefinitions> |
||||||
|
<ColumnDefinition Width="Auto"/> |
||||||
|
<ColumnDefinition/> |
||||||
|
<ColumnDefinition Width="Auto"/> |
||||||
|
</Grid.ColumnDefinitions> |
||||||
|
<Grid.RowDefinitions> |
||||||
|
<RowDefinition Height="Auto"/> |
||||||
|
<RowDefinition/> |
||||||
|
<RowDefinition Height="Auto"/> |
||||||
|
</Grid.RowDefinitions> |
||||||
|
<StackPanel Name="PART_LeftAnchorTabPanel" |
||||||
|
Grid.Column="0" Grid.Row="1" Orientation="Vertical"> |
||||||
|
<StackPanel.Resources> |
||||||
|
<Style TargetType="{x:Type ad:DockablePaneAnchorTabGroup}"> |
||||||
|
<Setter Property="LayoutTransform"> |
||||||
|
<Setter.Value > |
||||||
|
<RotateTransform Angle="90"/> |
||||||
|
</Setter.Value> |
||||||
|
</Setter> |
||||||
|
<Setter Property="Margin" Value="0,2,2,0"/> |
||||||
|
</Style> |
||||||
|
<Style TargetType="Border"> |
||||||
|
<Setter Property="CornerRadius" Value="0,0,3,3"/> |
||||||
|
</Style> |
||||||
|
</StackPanel.Resources> |
||||||
|
</StackPanel> |
||||||
|
<StackPanel Name="PART_RightAnchorTabPanel" Grid.Column="2" Grid.Row="1" Orientation="Vertical"> |
||||||
|
<StackPanel.Resources> |
||||||
|
<Style TargetType="{x:Type ad:DockablePaneAnchorTabGroup}"> |
||||||
|
<Setter Property="LayoutTransform"> |
||||||
|
<Setter.Value > |
||||||
|
<RotateTransform Angle="90"/> |
||||||
|
</Setter.Value> |
||||||
|
</Setter> |
||||||
|
<Setter Property="Margin" Value="2,2,0,0"/> |
||||||
|
</Style> |
||||||
|
<Style TargetType="Border"> |
||||||
|
<Setter Property="CornerRadius" Value="3,3,0,0"/> |
||||||
|
</Style> |
||||||
|
</StackPanel.Resources> |
||||||
|
</StackPanel> |
||||||
|
<StackPanel Name="PART_TopAnchorTabPanel" Grid.Column="1" Grid.Row="0" Orientation="Horizontal"/> |
||||||
|
<StackPanel Name="PART_BottomAnchorTabPanel" Grid.Column="1" Grid.Row="2" Orientation="Horizontal"/> |
||||||
|
<Border |
||||||
|
x:Name="PART_InternalContainer" |
||||||
|
Background="{TemplateBinding Background}" |
||||||
|
Grid.Column="1" Grid.Row="1" |
||||||
|
Padding="4"> |
||||||
|
<ContentPresenter /> |
||||||
|
</Border> |
||||||
|
</Grid> |
||||||
|
</ControlTemplate> |
||||||
|
</Setter.Value> |
||||||
|
</Setter> |
||||||
|
</Style> |
||||||
|
|
||||||
|
<!--DockableContentTabItemStyle--> |
||||||
|
<Style x:Key="DockableContentTabItemStyle" TargetType="{x:Type ad:DockableContent}"> |
||||||
|
<Setter Property="Template"> |
||||||
|
<Setter.Value> |
||||||
|
<ControlTemplate TargetType="{x:Type ad:DockableContent}"> |
||||||
|
<Grid SnapsToDevicePixels="True" Margin="0,0,-10, 0"> |
||||||
|
<Grid.ColumnDefinitions> |
||||||
|
<ColumnDefinition Width="*"/> |
||||||
|
<ColumnDefinition Width="20"/> |
||||||
|
</Grid.ColumnDefinitions> |
||||||
|
<Border |
||||||
|
x:Name="PART_DragArea" |
||||||
|
Background="{StaticResource ManagedContentTabItemNormalBackground}" |
||||||
|
CornerRadius="3,0,0,0" |
||||||
|
ContextMenu="{DynamicResource {ComponentResourceKey {x:Type ad:DockingManager}, {x:Static ad:ContextMenuElement.DockablePane}}}" |
||||||
|
> |
||||||
|
<Grid Margin="4,2,4,2"> |
||||||
|
<Grid.ColumnDefinitions> |
||||||
|
<ColumnDefinition Width="*"/> |
||||||
|
<ColumnDefinition Width="Auto"/> |
||||||
|
</Grid.ColumnDefinitions> |
||||||
|
<TextBlock |
||||||
|
x:Name="tabItemTitle" |
||||||
|
Grid.Column="0" |
||||||
|
TextTrimming="CharacterEllipsis" |
||||||
|
TextWrapping="NoWrap" |
||||||
|
Text="{TemplateBinding Title}" |
||||||
|
Margin="2,0,0,0" VerticalAlignment="Center" |
||||||
|
Foreground="{StaticResource ResourceKey=LightForegroundBrush}"/> |
||||||
|
<Button Grid.Column="1" |
||||||
|
x:Name="intCloseButton" |
||||||
|
Visibility="Collapsed" |
||||||
|
Margin="2,0,0,0" |
||||||
|
Style="{StaticResource PaneHeaderCommandStyle}" |
||||||
|
Command="ad:ManagedContentCommands.Close" |
||||||
|
Width="13" Height="13" Opacity="0.6"> |
||||||
|
<Image Source="/AvalonDock;component/resources/Images/PinClose.png"/> |
||||||
|
</Button> |
||||||
|
</Grid> |
||||||
|
</Border> |
||||||
|
<Path x:Name="intPathLabel" Stretch="Fill" Grid.Column="1" Fill="{StaticResource ManagedContentTabItemNormalBackground}" Data="M0,0 L20,20 L0,20 L0,0"/> |
||||||
|
</Grid> |
||||||
|
<ControlTemplate.Triggers> |
||||||
|
<Trigger Property="Selector.IsSelected" |
||||||
|
Value="true"> |
||||||
|
<Setter Property="BorderBrush" |
||||||
|
Value="{StaticResource ManagedContentTabItemSelectedBorderBrush}" TargetName="PART_DragArea"/> |
||||||
|
<Setter Property="Background" |
||||||
|
Value="{StaticResource ManagedContentTabItemSelectedBackground}" TargetName="PART_DragArea"/> |
||||||
|
<Setter Property="Fill" |
||||||
|
Value="{StaticResource ManagedContentTabItemSelectedBackground}" TargetName="intPathLabel"/> |
||||||
|
<Setter Property="Panel.ZIndex" |
||||||
|
Value="100" /> |
||||||
|
</Trigger> |
||||||
|
<MultiDataTrigger> |
||||||
|
<MultiDataTrigger.Conditions> |
||||||
|
<Condition Binding="{Binding RelativeSource={RelativeSource Self}, Path=ContainerPane.HasSingleItem}" Value="false"/> |
||||||
|
<Condition Binding="{Binding RelativeSource={RelativeSource Self}, Path=(Selector.IsSelected)}" Value="true"/> |
||||||
|
</MultiDataTrigger.Conditions> |
||||||
|
<Setter Property="Visibility" |
||||||
|
TargetName="intCloseButton" |
||||||
|
Value="Visible" /> |
||||||
|
</MultiDataTrigger> |
||||||
|
<MultiTrigger> |
||||||
|
<MultiTrigger.Conditions> |
||||||
|
<Condition Property="IsMouseOver" Value="true"/> |
||||||
|
<Condition Property="Selector.IsSelected" Value="false"/> |
||||||
|
</MultiTrigger.Conditions> |
||||||
|
<Setter Property="BorderBrush" Value="{StaticResource ManagedContentTabItemHotBorderBrush}" |
||||||
|
TargetName="PART_DragArea" /> |
||||||
|
<Setter Property="Background" Value="{StaticResource ManagedContentTabItemHotBackground}" |
||||||
|
TargetName="PART_DragArea" /> |
||||||
|
<Setter Property="Fill" |
||||||
|
Value="{StaticResource ManagedContentTabItemSelectedBackground}" TargetName="intPathLabel"/> |
||||||
|
<Setter Property="Panel.ZIndex" Value="99" /> |
||||||
|
</MultiTrigger> |
||||||
|
<Trigger Property="IsEnabled" Value="false"> |
||||||
|
<Setter Property="BorderBrush" Value="{StaticResource ManagedContentTabItemDisabledBorderBrush}" |
||||||
|
TargetName="PART_DragArea" /> |
||||||
|
<Setter Property="Background" Value="{StaticResource ManagedContentTabItemDisabledBackground}" |
||||||
|
TargetName="PART_DragArea" /> |
||||||
|
<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}" |
||||||
|
TargetName="tabItemTitle" /> |
||||||
|
</Trigger> |
||||||
|
</ControlTemplate.Triggers> |
||||||
|
</ControlTemplate> |
||||||
|
</Setter.Value> |
||||||
|
</Setter> |
||||||
|
</Style> |
||||||
|
|
||||||
|
<!--DockablePane--> |
||||||
|
<Style x:Key="{x:Type ad:DockablePane}" TargetType="{x:Type ad:DockablePane}"> |
||||||
|
<Setter Property="Background" Value="{DynamicResource {ComponentResourceKey {x:Type ad:DockingManager}, {x:Static ad:AvalonDockBrushes.DefaultBackgroundBrush}}}"/> |
||||||
|
<Setter Property="Template"> |
||||||
|
<Setter.Value> |
||||||
|
<ControlTemplate TargetType="{x:Type ad:DockablePane}"> |
||||||
|
<Border Focusable="False" |
||||||
|
Background="{TemplateBinding Background}" |
||||||
|
> |
||||||
|
<Grid FocusManager.FocusedElement="{Binding ElementName=PART_SelectedContent}"> |
||||||
|
<Grid.RowDefinitions> |
||||||
|
<RowDefinition Height="Auto"/> |
||||||
|
<RowDefinition Height="*"/> |
||||||
|
</Grid.RowDefinitions> |
||||||
|
<Border |
||||||
|
Grid.Row="0" Focusable="False" |
||||||
|
Background="{DynamicResource {ComponentResourceKey {x:Type ad:DockingManager}, {x:Static ad:AvalonDockBrushes.DockablePaneTitleBackground}}}" |
||||||
|
MinHeight="20"> |
||||||
|
<Grid > |
||||||
|
<Grid.ColumnDefinitions> |
||||||
|
<ColumnDefinition Width="*"/> |
||||||
|
<ColumnDefinition Width="Auto"/> |
||||||
|
<ColumnDefinition Width="Auto"/> |
||||||
|
</Grid.ColumnDefinitions> |
||||||
|
<Button x:Name="btnPinAutoHide" Grid.Column="1" Style="{StaticResource PaneHeaderCommandStyle}" Command="ad:DockablePaneCommands.ToggleAutoHide" |
||||||
|
Width="15" Height="15" VerticalAlignment="Center" Opacity="0.6"> |
||||||
|
<Image Source="/AvalonDock.Themes;component/Images/ExpDark/PinAutoHide.png" Width="13" Height="13" Stretch="None"/> |
||||||
|
</Button> |
||||||
|
<Button x:Name="PART_CloseButton" Grid.Column="2" Margin="6,0,2,0" |
||||||
|
Style="{StaticResource PaneHeaderCommandStyle}" |
||||||
|
Width="14" |
||||||
|
Height="13" |
||||||
|
Command="ad:DockablePaneCommands.Close" Opacity="0.8"> |
||||||
|
<Image Source="/AvalonDock.Themes;component/Images/ExpDark/PinClose.png" Stretch="None"/> |
||||||
|
</Button> |
||||||
|
<ad:DockableTabPanel |
||||||
|
IsItemsHost="True" |
||||||
|
TabItemStyle="{DynamicResource DockableContentTabItemStyle}"/> |
||||||
|
</Grid> |
||||||
|
</Border> |
||||||
|
<Border Grid.Row="1" Background="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=SelectedItem.Background}" |
||||||
|
> |
||||||
|
<ContentPresenter |
||||||
|
x:Name="PART_SelectedContent" |
||||||
|
Content="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=SelectedItem.Content}" |
||||||
|
KeyboardNavigation.TabNavigation="Local" |
||||||
|
KeyboardNavigation.DirectionalNavigation="Contained" |
||||||
|
KeyboardNavigation.TabIndex="1" |
||||||
|
/> |
||||||
|
</Border> |
||||||
|
</Grid> |
||||||
|
</Border> |
||||||
|
<ControlTemplate.Triggers> |
||||||
|
<Trigger Property ="CanAutohide" Value="False"> |
||||||
|
<Setter Property="Visibility" Value="Collapsed" TargetName="btnPinAutoHide"/> |
||||||
|
</Trigger> |
||||||
|
<DataTrigger Binding="{Binding RelativeSource={RelativeSource Self}, Path=SelectedItem.State}" Value="AutoHide"> |
||||||
|
<Setter Property="LayoutTransform" TargetName="btnPinAutoHide"> |
||||||
|
<Setter.Value> |
||||||
|
<RotateTransform Angle="90"/> |
||||||
|
</Setter.Value> |
||||||
|
</Setter> |
||||||
|
</DataTrigger> |
||||||
|
</ControlTemplate.Triggers> |
||||||
|
</ControlTemplate> |
||||||
|
</Setter.Value> |
||||||
|
</Setter> |
||||||
|
</Style> |
||||||
|
|
||||||
|
<!--DocumentTabItemStyle--> |
||||||
|
<Style x:Key="DocumentTabItemStyle" TargetType="{x:Type ad:ManagedContent}"> |
||||||
|
<Setter Property="Template"> |
||||||
|
<Setter.Value> |
||||||
|
<ControlTemplate TargetType="{x:Type ad:ManagedContent}"> |
||||||
|
<Grid SnapsToDevicePixels="True"> |
||||||
|
<Border x:Name="tabItemIntBorder" |
||||||
|
BorderThickness="1,1,1,0" |
||||||
|
Padding="5,0,5,4" |
||||||
|
Margin="-1,0,2,-4" |
||||||
|
CornerRadius="3,3,0,0" |
||||||
|
Background="{DynamicResource {ComponentResourceKey {x:Type ad:DockingManager}, {x:Static ad:AvalonDockBrushes.DocumentHeaderBackground}}}"> |
||||||
|
<StackPanel x:Name="PART_DragArea" |
||||||
|
Orientation="Horizontal" |
||||||
|
Margin="0,2,0,2" |
||||||
|
ContextMenu="{DynamicResource {ComponentResourceKey {x:Type ad:DockingManager}, {x:Static ad:ContextMenuElement.DocumentPane}}}"> |
||||||
|
<!--This image with width=0 is required to connect the icon visual to the presentation source, |
||||||
|
without this navigatorwindow won't work--> |
||||||
|
<Image Source="{TemplateBinding Icon}" Width="0"/> |
||||||
|
<TextBlock |
||||||
|
x:Name="tabItemTitle" |
||||||
|
TextTrimming="CharacterEllipsis" |
||||||
|
TextWrapping="NoWrap" |
||||||
|
Text="{TemplateBinding Title}" |
||||||
|
Foreground="{DynamicResource {ComponentResourceKey {x:Type ad:DockingManager}, {x:Static ad:AvalonDockBrushes.DocumentHeaderForeground}}}"/> |
||||||
|
|
||||||
|
<Image Source="/AvalonDock;component/resources/Images/Locked.png" x:Name="PART_LockedIcon" Margin="2,0,0,0" Visibility="Collapsed" VerticalAlignment="Center" HorizontalAlignment="Center" Width="6" UseLayoutRounding="True"/> |
||||||
|
|
||||||
|
<Button x:Name="PART_CloseButton" Visibility="Collapsed" Margin="6,0,2,0" |
||||||
|
Style="{StaticResource PaneHeaderCommandStyle}" |
||||||
|
Width="14" |
||||||
|
Height="13" |
||||||
|
ToolTip="{x:Static adRes:Resources.ManagedContentCommands_Close}" |
||||||
|
Command="ad:ManagedContentCommands.Close" Opacity="0.8"> |
||||||
|
<Image Source="/AvalonDock.Themes;component/Images/ExpDark/PinClose.png" Stretch="None"/> |
||||||
|
</Button> |
||||||
|
</StackPanel> |
||||||
|
</Border> |
||||||
|
</Grid> |
||||||
|
<ControlTemplate.Triggers> |
||||||
|
<Trigger Property="Selector.IsSelected" Value="True"> |
||||||
|
<Setter Property="Background" |
||||||
|
TargetName="tabItemIntBorder" |
||||||
|
Value="{DynamicResource {ComponentResourceKey {x:Type ad:DockingManager}, {x:Static ad:AvalonDockBrushes.DocumentHeaderBackgroundSelectedActivated}}}" |
||||||
|
/> |
||||||
|
<Setter Property="Visibility" |
||||||
|
TargetName="PART_CloseButton" |
||||||
|
Value="Visible"/> |
||||||
|
</Trigger> |
||||||
|
|
||||||
|
<MultiTrigger> |
||||||
|
<MultiTrigger.Conditions> |
||||||
|
<Condition Property="IsMouseOver" SourceName="tabItemIntBorder" Value="True"/> |
||||||
|
<Condition Property="Selector.IsSelected" Value="False"/> |
||||||
|
</MultiTrigger.Conditions> |
||||||
|
<Setter Property="Background" |
||||||
|
TargetName="tabItemIntBorder" |
||||||
|
Value="{DynamicResource {ComponentResourceKey {x:Type ad:DockingManager}, {x:Static ad:AvalonDockBrushes.DocumentHeaderBackgroundMouseOver}}}" |
||||||
|
/> |
||||||
|
<Setter Property="BorderBrush" |
||||||
|
TargetName="tabItemIntBorder" |
||||||
|
Value="{DynamicResource {ComponentResourceKey {x:Type ad:DockingManager}, {x:Static ad:AvalonDockBrushes.DocumentHeaderBorderBrushMouseOver}}}" |
||||||
|
/> |
||||||
|
</MultiTrigger> |
||||||
|
<Trigger Property="IsLocked" Value="True"> |
||||||
|
<Setter Property="Visibility" Value="Visible" TargetName="PART_LockedIcon"/> |
||||||
|
</Trigger> |
||||||
|
</ControlTemplate.Triggers> |
||||||
|
</ControlTemplate> |
||||||
|
</Setter.Value> |
||||||
|
</Setter> |
||||||
|
</Style> |
||||||
|
|
||||||
|
<!--DocumentPane--> |
||||||
|
<Style x:Key="{x:Type ad:DocumentPane}" TargetType="{x:Type ad:DocumentPane}"> |
||||||
|
<Setter Property="Background" Value="{DynamicResource {ComponentResourceKey {x:Type ad:DockingManager}, {x:Static ad:AvalonDockBrushes.DefaultBackgroundBrush}}}"/> |
||||||
|
<Setter Property="FocusVisualStyle" Value="{x:Null}"/> |
||||||
|
<Setter Property="Template"> |
||||||
|
<Setter.Value> |
||||||
|
<ControlTemplate TargetType="{x:Type ad:DocumentPane}" > |
||||||
|
<ControlTemplate.Resources> |
||||||
|
<ContextMenu x:Key="DocumentsListMenu" StaysOpen="True" ItemContainerStyle="{StaticResource ResourceKey=DocumentPaneMenuItemStyle}" /> |
||||||
|
</ControlTemplate.Resources> |
||||||
|
<Border |
||||||
|
Background="{TemplateBinding Background}"> |
||||||
|
<Grid> |
||||||
|
<Grid.RowDefinitions> |
||||||
|
<RowDefinition Height="Auto"/> |
||||||
|
<RowDefinition Height="*"/> |
||||||
|
</Grid.RowDefinitions> |
||||||
|
<Border x:Name="PART_Header" |
||||||
|
Grid.Row="0" |
||||||
|
Focusable="False"> |
||||||
|
<Grid> |
||||||
|
<Grid.ColumnDefinitions> |
||||||
|
<ColumnDefinition Width="*"/> |
||||||
|
<ColumnDefinition Width="18"/> |
||||||
|
</Grid.ColumnDefinitions> |
||||||
|
<ad:DocumentTabPanel |
||||||
|
x:Name="paneTabsPanel" |
||||||
|
Panel.ZIndex ="1" |
||||||
|
IsItemsHost="True" |
||||||
|
TabItemStyle="{StaticResource DocumentTabItemStyle}"/> |
||||||
|
<Button x:Name="PART_ShowContextMenuButton" |
||||||
|
Grid.Column="1" |
||||||
|
Width="15" Height="15" |
||||||
|
Style="{StaticResource PaneHeaderCommandStyle}"> |
||||||
|
<Image x:Name="ShowContextMenuIcon" Source="/AvalonDock;component/resources/Images/PinMenu.png" Width="13" Height="13" Stretch="None"/> |
||||||
|
</Button> |
||||||
|
</Grid> |
||||||
|
</Border> |
||||||
|
<Grid Grid.Row="1"> |
||||||
|
<Border |
||||||
|
Background="{StaticResource DefaultDocumentPaneBackground}"> |
||||||
|
<ContentPresenter |
||||||
|
FocusManager.IsFocusScope="True" |
||||||
|
Content="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=SelectedItem.Content}" |
||||||
|
KeyboardNavigation.TabNavigation="Local" |
||||||
|
KeyboardNavigation.DirectionalNavigation="Contained"/> |
||||||
|
</Border> |
||||||
|
</Grid> |
||||||
|
</Grid> |
||||||
|
</Border> |
||||||
|
<ControlTemplate.Triggers> |
||||||
|
<Trigger Property="HasItems" Value="False"> |
||||||
|
<Setter Property="Visibility" Value="Hidden"/> |
||||||
|
</Trigger> |
||||||
|
<Trigger Property="ShowHeader" Value="False"> |
||||||
|
<Setter Property="Visibility" Value="Collapsed" TargetName="PART_Header" /> |
||||||
|
</Trigger> |
||||||
|
<DataTrigger Binding="{Binding Path=IsMainDocumentPane, RelativeSource={RelativeSource Self}}" Value="True"> |
||||||
|
<Setter Property="Source" Value="/AvalonDock;component/resources/Images\PinDocMenu.png" TargetName="ShowContextMenuIcon"/> |
||||||
|
</DataTrigger> |
||||||
|
|
||||||
|
|
||||||
|
<EventTrigger RoutedEvent="Window.Loaded"> |
||||||
|
<BeginStoryboard> |
||||||
|
<Storyboard> |
||||||
|
<DoubleAnimation |
||||||
|
Storyboard.TargetProperty="Opacity" |
||||||
|
From="0" To="1" Duration="0:0:0.200" /> |
||||||
|
</Storyboard> |
||||||
|
</BeginStoryboard> |
||||||
|
</EventTrigger> |
||||||
|
</ControlTemplate.Triggers> |
||||||
|
</ControlTemplate> |
||||||
|
</Setter.Value> |
||||||
|
</Setter> |
||||||
|
</Style> |
||||||
|
|
||||||
|
<!--DockablePaneAnchorTab--> |
||||||
|
<Style x:Key="{x:Type ad:DockablePaneAnchorTab}" TargetType="{x:Type ad:DockablePaneAnchorTab}"> |
||||||
|
<Setter Property="Template"> |
||||||
|
<Setter.Value> |
||||||
|
<ControlTemplate TargetType="{x:Type ad:DockablePaneAnchorTab}"> |
||||||
|
<Grid> |
||||||
|
<Border |
||||||
|
Name="PART_Border" |
||||||
|
Background="{DynamicResource ManagedContentTabItemNormalBackground}" |
||||||
|
TextBlock.Foreground="{StaticResource ResourceKey=LightForegroundBrush}" |
||||||
|
Padding="4,0,4,0"> |
||||||
|
<TextBlock |
||||||
|
Grid.Column="1" |
||||||
|
Text="{TemplateBinding Title}" |
||||||
|
Margin="4,2,2,2"/> |
||||||
|
</Border> |
||||||
|
</Grid> |
||||||
|
<ControlTemplate.Triggers> |
||||||
|
<Trigger Property="Anchor" > |
||||||
|
<Trigger.Value> |
||||||
|
<ad:AnchorStyle> |
||||||
|
Left |
||||||
|
</ad:AnchorStyle> |
||||||
|
</Trigger.Value> |
||||||
|
<Setter TargetName="PART_Border" Property="CornerRadius" Value="2,2,0,0"/> |
||||||
|
</Trigger> |
||||||
|
<Trigger Property="Anchor" > |
||||||
|
<Trigger.Value> |
||||||
|
<ad:AnchorStyle> |
||||||
|
Right |
||||||
|
</ad:AnchorStyle> |
||||||
|
</Trigger.Value> |
||||||
|
<Setter TargetName="PART_Border" Property="CornerRadius" Value="0,0,2,2"/> |
||||||
|
</Trigger> |
||||||
|
<Trigger Property="Anchor" > |
||||||
|
<Trigger.Value> |
||||||
|
<ad:AnchorStyle> |
||||||
|
Bottom |
||||||
|
</ad:AnchorStyle> |
||||||
|
</Trigger.Value> |
||||||
|
<Setter TargetName="PART_Border" Property="CornerRadius" Value="2,2,0,0"/> |
||||||
|
</Trigger> |
||||||
|
<Trigger Property="Anchor" > |
||||||
|
<Trigger.Value> |
||||||
|
<ad:AnchorStyle> |
||||||
|
Top |
||||||
|
</ad:AnchorStyle> |
||||||
|
</Trigger.Value> |
||||||
|
<Setter TargetName="PART_Border" Property="CornerRadius" Value="0,0,2,2"/> |
||||||
|
</Trigger> |
||||||
|
|
||||||
|
|
||||||
|
<Trigger Property="IsMouseOver" |
||||||
|
Value="true"> |
||||||
|
<Setter Property="Background" |
||||||
|
Value="{DynamicResource ManagedContentTabItemSelectedBackground}" |
||||||
|
TargetName="PART_Border" /> |
||||||
|
</Trigger> |
||||||
|
</ControlTemplate.Triggers> |
||||||
|
</ControlTemplate> |
||||||
|
</Setter.Value> |
||||||
|
</Setter> |
||||||
|
</Style> |
||||||
|
|
||||||
|
<!--DockablePaneAnchorTabGroup--> |
||||||
|
<Style x:Key="{x:Type ad:DockablePaneAnchorTabGroup}" TargetType="{x:Type ad:DockablePaneAnchorTabGroup}"> |
||||||
|
<Setter Property="Orientation" Value="Horizontal"/> |
||||||
|
<Setter Property="Margin" Value="0,0,0,0"/> |
||||||
|
</Style> |
||||||
|
|
||||||
|
<!--OverlayWindow--> |
||||||
|
<Style x:Key="{x:Type ad:OverlayWindow}" TargetType="{x:Type ad:OverlayWindow}"> |
||||||
|
<Setter Property="Background" Value="Transparent"/> |
||||||
|
<Setter Property="Focusable" Value="False"/> |
||||||
|
<Setter Property="Template"> |
||||||
|
<Setter.Value> |
||||||
|
<ControlTemplate TargetType="{x:Type ad:OverlayWindow}"> |
||||||
|
<Grid SnapsToDevicePixels="True" Opacity="0.9"> |
||||||
|
<Canvas> |
||||||
|
<Border x:Name="PART_SelectionBox" Background="#333333" BorderBrush="#6495ED" BorderThickness="2" Opacity="0.4" Visibility="Hidden"/> |
||||||
|
</Canvas> |
||||||
|
<Grid x:Name="panelDrag" > |
||||||
|
<Border x:Name="PART_btnDockLeft" Width="10" VerticalAlignment="Stretch" HorizontalAlignment="Left"/> |
||||||
|
<Border x:Name="PART_btnDockRight" Width="10" VerticalAlignment="Stretch" HorizontalAlignment="Right"/> |
||||||
|
<Border x:Name="PART_btnDockBottom" Height="10" VerticalAlignment="Bottom" HorizontalAlignment="Stretch"/> |
||||||
|
<Border x:Name="PART_btnDockTop" Height="10" VerticalAlignment="Top" HorizontalAlignment="Stretch"/> |
||||||
|
</Grid> |
||||||
|
<Canvas> |
||||||
|
<Grid Name="PART_gridPaneRelativeDockingOptions" Visibility="Collapsed" ><!--Width="103" Height="101"--> |
||||||
|
<Grid.ColumnDefinitions> |
||||||
|
<ColumnDefinition MaxWidth="20"/> |
||||||
|
<ColumnDefinition MaxWidth="20"/> |
||||||
|
<ColumnDefinition Width="*"/> |
||||||
|
<ColumnDefinition MaxWidth="20"/> |
||||||
|
<ColumnDefinition MaxWidth="20"/> |
||||||
|
</Grid.ColumnDefinitions> |
||||||
|
<Grid.RowDefinitions> |
||||||
|
<RowDefinition MaxHeight="20"/> |
||||||
|
<RowDefinition MaxHeight="20"/> |
||||||
|
<RowDefinition Height="*"/> |
||||||
|
<RowDefinition MaxHeight="20"/> |
||||||
|
<RowDefinition MaxHeight="20"/> |
||||||
|
</Grid.RowDefinitions> |
||||||
|
<Border Name="PART_btnDockPaneTop" Grid.Column="0" Grid.Row="1" Grid.ColumnSpan="5"/> |
||||||
|
<Border Name="PART_btnDockPaneRight" Grid.Column="4" Grid.Row="1" Grid.RowSpan="4"/> |
||||||
|
<Border Name="PART_btnDockPaneBottom" Grid.Column="0" Grid.Row="4" Grid.ColumnSpan="5"/> |
||||||
|
<Border Name="PART_btnDockPaneLeft" Grid.Column="0" Grid.Row="1" Grid.RowSpan="4"/> |
||||||
|
<Border Name="PART_btnDockPaneInto" Grid.Column="0" Grid.Row="0" Grid.ColumnSpan="5"/> |
||||||
|
</Grid> |
||||||
|
</Canvas> |
||||||
|
</Grid> |
||||||
|
<ControlTemplate.Triggers> |
||||||
|
<!--<Trigger Property="OverlayButtonHover" Value="DropBorderLeft"> |
||||||
|
<Setter Property="Source" Value="/AvalonDock;component/resources/Images/Aero/AeroDockLeftHover.PNG" TargetName="IMG_DockLeft"/> |
||||||
|
</Trigger> |
||||||
|
<Trigger Property="OverlayButtonHover" Value="DropBorderRight"> |
||||||
|
<Setter Property="Source" Value="/AvalonDock;component/resources/Images/Aero/AeroDockRightHover.PNG" TargetName="IMG_DockRight"/> |
||||||
|
</Trigger> |
||||||
|
<Trigger Property="OverlayButtonHover" Value="DropBorderTop"> |
||||||
|
<Setter Property="Source" Value="/AvalonDock;component/resources/Images/Aero/AeroDockTopHover.PNG" TargetName="IMG_DockTop"/> |
||||||
|
</Trigger> |
||||||
|
<Trigger Property="OverlayButtonHover" Value="DropBorderBottom"> |
||||||
|
<Setter Property="Source" Value="/AvalonDock;component/resources/Images/Aero/AeroDockBottomHover.PNG" TargetName="IMG_DockBottom"/> |
||||||
|
</Trigger> |
||||||
|
<Trigger Property="OverlayButtonHover" Value="DropPaneInto"> |
||||||
|
<Setter Property="Source" Value="/AvalonDock;component/resources/Images/Aero/AeroDockPaneInto.PNG" TargetName="IMG_DockPane"/> |
||||||
|
</Trigger> |
||||||
|
<Trigger Property="OverlayButtonHover" Value="DropPaneLeft"> |
||||||
|
<Setter Property="Source" Value="/AvalonDock;component/resources/Images/Aero/AeroDockPaneLeft.PNG" TargetName="IMG_DockPane"/> |
||||||
|
</Trigger> |
||||||
|
<Trigger Property="OverlayButtonHover" Value="DropPaneRight"> |
||||||
|
<Setter Property="Source" Value="/AvalonDock;component/resources/Images/Aero/AeroDockPaneRight.PNG" TargetName="IMG_DockPane"/> |
||||||
|
</Trigger> |
||||||
|
<Trigger Property="OverlayButtonHover" Value="DropPaneTop"> |
||||||
|
<Setter Property="Source" Value="/AvalonDock;component/resources/Images/Aero/AeroDockPaneTop.PNG" TargetName="IMG_DockPane"/> |
||||||
|
</Trigger> |
||||||
|
<Trigger Property="OverlayButtonHover" Value="DropPaneBottom"> |
||||||
|
<Setter Property="Source" Value="/AvalonDock;component/resources/Images/Aero/AeroDockPaneBottom.PNG" TargetName="IMG_DockPane"/> |
||||||
|
</Trigger> |
||||||
|
<Trigger Property="OverlayButtonHover" Value="None"> |
||||||
|
<Setter Property="Source" Value="/AvalonDock;component/resources/Images/Aero/AeroDockPane.PNG" TargetName="IMG_DockPane"/> |
||||||
|
</Trigger>--> |
||||||
|
</ControlTemplate.Triggers> |
||||||
|
</ControlTemplate> |
||||||
|
</Setter.Value> |
||||||
|
</Setter> |
||||||
|
</Style> |
||||||
|
|
||||||
|
<!--DockableFloatingWindow--> |
||||||
|
<Style x:Key="{x:Type ad:DockableFloatingWindow}" TargetType="{x:Type ad:DockableFloatingWindow}"> |
||||||
|
<Setter Property="ResizeMode" Value="NoResize" /> |
||||||
|
<Setter Property="WindowStyle" Value="None" /> |
||||||
|
<Setter Property="Background" Value="{x:Null}"/> |
||||||
|
<Setter Property="Template"> |
||||||
|
<Setter.Value> |
||||||
|
<ControlTemplate TargetType="{x:Type ad:DockableFloatingWindow}"> |
||||||
|
<Border x:Name="ExtBorder" |
||||||
|
Background="{DynamicResource {ComponentResourceKey {x:Type ad:DockingManager}, {x:Static ad:AvalonDockBrushes.DefaultBackgroundBrush}}}" |
||||||
|
CornerRadius="2"> |
||||||
|
<Grid> |
||||||
|
<Grid.ColumnDefinitions> |
||||||
|
<ColumnDefinition Width="5"/> |
||||||
|
<ColumnDefinition Width="*"/> |
||||||
|
<ColumnDefinition Width="5"/> |
||||||
|
</Grid.ColumnDefinitions> |
||||||
|
<Grid.RowDefinitions> |
||||||
|
<RowDefinition Height="5"/> |
||||||
|
<RowDefinition Height="20"/> |
||||||
|
<RowDefinition Height="*"/> |
||||||
|
<RowDefinition Height="5"/> |
||||||
|
</Grid.RowDefinitions> |
||||||
|
|
||||||
|
<ad:Resizer x:Name="PART_LeftAnchor" Cursor="SizeWE" VerticalAlignment="Stretch" Width="4" Grid.Column="0" Grid.Row="1" Grid.RowSpan="2"/> |
||||||
|
<ad:Resizer x:Name="PART_RightAnchor" Cursor="SizeWE" VerticalAlignment="Stretch" Width="4" Grid.Column="2" Grid.Row="1" Grid.RowSpan="2"/> |
||||||
|
<ad:Resizer x:Name="PART_TopAnchor" Cursor="SizeNS" HorizontalAlignment="Stretch" Height="4" Grid.Row="0" Grid.Column="1"/> |
||||||
|
<ad:Resizer x:Name="PART_BottomAnchor" Cursor="SizeNS" HorizontalAlignment="Stretch" Height="4" Grid.Row="3" Grid.Column="1"/> |
||||||
|
|
||||||
|
<ad:Resizer x:Name="PART_LeftTopAnchor" Cursor="SizeNWSE" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Width="4" Height="4" |
||||||
|
Grid.Row="0" Grid.Column="0"/> |
||||||
|
<ad:Resizer x:Name="PART_LeftBottomAnchor" Cursor="SizeNESW" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Width="4" Height="4" |
||||||
|
Grid.Row="3" Grid.Column="0"/> |
||||||
|
<ad:Resizer x:Name="PART_RightTopAnchor" Cursor="SizeNESW" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Width="4" Height="4" |
||||||
|
Grid.Row="0" Grid.Column="2"/> |
||||||
|
<ad:Resizer x:Name="PART_RightBottomAnchor" Cursor="SizeNWSE" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Width="4" Height="4" |
||||||
|
Grid.Row="3" Grid.Column="3"/> |
||||||
|
<Border |
||||||
|
Grid.Row="1" |
||||||
|
Grid.RowSpan="2" |
||||||
|
Grid.Column="1" |
||||||
|
Background="{TemplateBinding Background}" |
||||||
|
BorderBrush="{TemplateBinding BorderBrush}" |
||||||
|
BorderThickness="{TemplateBinding BorderThickness}" > |
||||||
|
<ContentPresenter/> |
||||||
|
</Border> |
||||||
|
|
||||||
|
<Border x:Name="PART_MoveAnchor" |
||||||
|
Grid.Row="1" |
||||||
|
Grid.Column="1" |
||||||
|
CornerRadius="2,2,0,0" |
||||||
|
Margin="0,0,20,0" |
||||||
|
Background="Transparent"> |
||||||
|
</Border> |
||||||
|
</Grid> |
||||||
|
</Border> |
||||||
|
<ControlTemplate.Triggers> |
||||||
|
</ControlTemplate.Triggers> |
||||||
|
</ControlTemplate> |
||||||
|
</Setter.Value> |
||||||
|
</Setter> |
||||||
|
</Style> |
||||||
|
|
||||||
|
<!--DocumentFloatingWindow--> |
||||||
|
<Style x:Key="{x:Type ad:DocumentFloatingWindow}" TargetType="{x:Type ad:DocumentFloatingWindow}"> |
||||||
|
<Setter Property="ResizeMode" Value="NoResize" /> |
||||||
|
<Setter Property="WindowStyle" Value="None" /> |
||||||
|
<Setter Property="Template"> |
||||||
|
<Setter.Value> |
||||||
|
<ControlTemplate TargetType="{x:Type ad:DocumentFloatingWindow}"> |
||||||
|
<Border x:Name="ExtBorder"> |
||||||
|
<Grid> |
||||||
|
<Grid.ColumnDefinitions> |
||||||
|
<ColumnDefinition Width="5"/> |
||||||
|
<ColumnDefinition Width="*"/> |
||||||
|
<ColumnDefinition Width="5"/> |
||||||
|
</Grid.ColumnDefinitions> |
||||||
|
<Grid.RowDefinitions> |
||||||
|
<RowDefinition Height="5"/> |
||||||
|
<RowDefinition Height="20"/> |
||||||
|
<RowDefinition Height="*"/> |
||||||
|
<RowDefinition Height="5"/> |
||||||
|
</Grid.RowDefinitions> |
||||||
|
<Border x:Name="PART_MoveAnchor" Grid.Row="0" Grid.Column="0" Grid.RowSpan="2" Grid.ColumnSpan="3" |
||||||
|
Background="{DynamicResource {ComponentResourceKey {x:Type ad:DockingManager}, {x:Static ad:AvalonDockBrushes.DocumentHeaderBackgroundSelected}}}"> |
||||||
|
<Grid x:Name="intTitleGrid"> |
||||||
|
<Grid.ColumnDefinitions> |
||||||
|
<ColumnDefinition Width="*"/> |
||||||
|
<ColumnDefinition Width="16"/> |
||||||
|
<ColumnDefinition Width="16"/> |
||||||
|
</Grid.ColumnDefinitions> |
||||||
|
<TextBlock x:Name="intTitle" VerticalAlignment="Center" HorizontalAlignment="Stretch" |
||||||
|
Text="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=HostedPane.SelectedItem.Title}" |
||||||
|
IsHitTestVisible="False" Margin="2,0,0,0" |
||||||
|
Foreground="{DynamicResource {ComponentResourceKey {x:Type ad:DockingManager}, {x:Static ad:AvalonDockBrushes.DocumentHeaderForeground}}}" |
||||||
|
/> |
||||||
|
<Border x:Name="PART_ShowContextMenuButton" Grid.Column="1" Style="{StaticResource PaneHeaderContextMenuCommandStyle}" |
||||||
|
Width="15" Height="15" VerticalAlignment="Center" HorizontalAlignment="Center" Opacity="0.6"> |
||||||
|
<Image Source="/AvalonDock;component/resources/Images/PinMenu.png" Width="13" Height="13" VerticalAlignment="Center" HorizontalAlignment="Center" Stretch="None"/> |
||||||
|
</Border> |
||||||
|
<Button x:Name="PART_CloseButton" Grid.Column="2" Style="{StaticResource PaneHeaderCommandStyle}" |
||||||
|
Command="ad:DocumentPaneCommands.CloseThis" CommandTarget="{TemplateBinding Content}" |
||||||
|
Width="15" Height="15" VerticalAlignment="Center" HorizontalAlignment="Center" Opacity="0.6"> |
||||||
|
<Image Source="/AvalonDock;component/resources/Images/PinClose.png" Width="13" Height="13" VerticalAlignment="Center" HorizontalAlignment="Center" Stretch="None"/> |
||||||
|
</Button> |
||||||
|
</Grid> |
||||||
|
</Border> |
||||||
|
|
||||||
|
<Border |
||||||
|
x:Name="intContentBorder" |
||||||
|
Grid.Row="2" Grid.RowSpan="2" |
||||||
|
Grid.Column="0" Grid.ColumnSpan="3" |
||||||
|
Background="{TemplateBinding Background}" |
||||||
|
BorderBrush="{DynamicResource {ComponentResourceKey {x:Type ad:DockingManager}, {x:Static ad:AvalonDockBrushes.DocumentHeaderBackground}}}" |
||||||
|
BorderThickness="4"> |
||||||
|
</Border> |
||||||
|
<ContentPresenter |
||||||
|
Grid.Row="2" Grid.RowSpan="2" |
||||||
|
Grid.Column="0" Grid.ColumnSpan="3" |
||||||
|
Margin="4" |
||||||
|
Content="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=HostedPane.SelectedItem.Content}" |
||||||
|
/> |
||||||
|
<ad:Resizer x:Name="PART_LeftAnchor" Cursor="SizeWE" VerticalAlignment="Stretch" Width="4" Grid.Column="0" Grid.Row="1" Grid.RowSpan="2"/> |
||||||
|
<ad:Resizer x:Name="PART_RightAnchor" Cursor="SizeWE" VerticalAlignment="Stretch" Width="4" Grid.Column="2" Grid.Row="1" Grid.RowSpan="2"/> |
||||||
|
<ad:Resizer x:Name="PART_TopAnchor" Cursor="SizeNS" HorizontalAlignment="Stretch" Height="4" Grid.Row="0" Grid.Column="1"/> |
||||||
|
<ad:Resizer x:Name="PART_BottomAnchor" Cursor="SizeNS" HorizontalAlignment="Stretch" Height="4" Grid.Row="3" Grid.Column="1"/> |
||||||
|
|
||||||
|
<ad:Resizer x:Name="PART_LeftTopAnchor" Cursor="SizeNWSE" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Width="4" Height="4" |
||||||
|
Grid.Row="0" Grid.Column="0"/> |
||||||
|
<ad:Resizer x:Name="PART_LeftBottomAnchor" Cursor="SizeNESW" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Width="4" Height="4" |
||||||
|
Grid.Row="3" Grid.Column="0"/> |
||||||
|
<ad:Resizer x:Name="PART_RightTopAnchor" Cursor="SizeNESW" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Width="4" Height="4" |
||||||
|
Grid.Row="0" Grid.Column="2"/> |
||||||
|
<ad:Resizer x:Name="PART_RightBottomAnchor" Cursor="SizeNWSE" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Width="4" Height="4" |
||||||
|
Grid.Row="3" Grid.Column="3"/> |
||||||
|
</Grid> |
||||||
|
</Border> |
||||||
|
<ControlTemplate.Triggers> |
||||||
|
</ControlTemplate.Triggers> |
||||||
|
</ControlTemplate> |
||||||
|
</Setter.Value> |
||||||
|
</Setter> |
||||||
|
</Style> |
||||||
|
|
||||||
|
<!--Navigator Window START --> |
||||||
|
<SolidColorBrush x:Key="NavigatorWindowBackground" Color="#666666"/> |
||||||
|
|
||||||
|
<SolidColorBrush x:Key="NavigatorWindowDocumentsBackground" Color="#333333"/> |
||||||
|
|
||||||
|
<SolidColorBrush x:Key="NavigatorWindowSelectedContentBackground" Color="#BDBDBD"/> |
||||||
|
|
||||||
|
<DataTemplate x:Key="NavigatorWindowDocumentsListItemTemplate" DataType="{x:Type ad:NavigatorWindowDocumentItem}"> |
||||||
|
<Border Background="Transparent" Padding="0,2,0,2"> |
||||||
|
<Grid> |
||||||
|
<TextBlock Text="{Binding Title}" TextTrimming="CharacterEllipsis" Margin="4,0,0,0" TextWrapping="NoWrap" Grid.Column="1"/> |
||||||
|
</Grid> |
||||||
|
</Border> |
||||||
|
</DataTemplate> |
||||||
|
|
||||||
|
<Style x:Key="NavigatorWindowDocumentsListItemContainerStyle" TargetType="ListBoxItem"> |
||||||
|
<Setter Property="Template"> |
||||||
|
<Setter.Value> |
||||||
|
<ControlTemplate TargetType="ListBoxItem"> |
||||||
|
<Grid> |
||||||
|
<Border |
||||||
|
x:Name="intMouseOverBorder" |
||||||
|
Grid.ColumnSpan="2" |
||||||
|
CornerRadius="2" |
||||||
|
BorderThickness="1" |
||||||
|
Opacity="0.5" |
||||||
|
Background="{StaticResource NavigatorWindowSelectedContentBackground}" |
||||||
|
Visibility="Collapsed"> |
||||||
|
</Border> |
||||||
|
<ContentPresenter TextBlock.Foreground="{StaticResource ResourceKey=LightForegroundBrush}" x:Name="intContent"/> |
||||||
|
</Grid> |
||||||
|
<ControlTemplate.Triggers> |
||||||
|
<Trigger Property="IsMouseOver" Value="True"> |
||||||
|
<Setter Property="Visibility" Value="Visible" TargetName="intMouseOverBorder"/> |
||||||
|
</Trigger> |
||||||
|
<Trigger Property="IsSelected" Value="True"> |
||||||
|
<Setter Property="Visibility" Value="Visible" TargetName="intMouseOverBorder"/> |
||||||
|
<Setter Property="Opacity" Value="1.0" TargetName="intMouseOverBorder"/> |
||||||
|
<Setter Property="TextBlock.Foreground" TargetName="intContent" Value="{StaticResource ResourceKey=DarkForegroundBrush}"/> |
||||||
|
</Trigger> |
||||||
|
</ControlTemplate.Triggers> |
||||||
|
</ControlTemplate> |
||||||
|
</Setter.Value> |
||||||
|
</Setter> |
||||||
|
</Style> |
||||||
|
|
||||||
|
<Style x:Key="NavigatorWindowDocumentsListStyle" TargetType="ListBox"> |
||||||
|
<Setter Property="ItemTemplate" Value="{StaticResource NavigatorWindowDocumentsListItemTemplate}"/> |
||||||
|
<Setter Property="ItemContainerStyle" Value="{StaticResource NavigatorWindowDocumentsListItemContainerStyle}"/> |
||||||
|
<Setter Property="Background" Value="{x:Null}"/> |
||||||
|
<Setter Property="BorderThickness" Value="0"/> |
||||||
|
<Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Disabled"/> |
||||||
|
</Style> |
||||||
|
|
||||||
|
<Style x:Key="{x:Type ad:NavigatorWindow}" TargetType="{x:Type ad:NavigatorWindow}"> |
||||||
|
<Setter Property="SizeToContent" Value="WidthAndHeight"/> |
||||||
|
<Setter Property="Template"> |
||||||
|
<Setter.Value> |
||||||
|
<ControlTemplate TargetType="{x:Type ad:NavigatorWindow}"> |
||||||
|
<Border MinWidth="400" MaxHeight="500" TextBlock.Foreground="{StaticResource ResourceKey=LightForegroundBrush}" Background="{StaticResource NavigatorWindowBackground}" BorderBrush="{StaticResource NavigatorWindowBorderBrush}" BorderThickness="0"> |
||||||
|
<Grid> |
||||||
|
<Grid.RowDefinitions> |
||||||
|
<RowDefinition Height="24"/> |
||||||
|
<RowDefinition Height="*"/> |
||||||
|
<RowDefinition Height="22"/> |
||||||
|
</Grid.RowDefinitions> |
||||||
|
<Border Margin="2"> |
||||||
|
<TextBlock Text="Switch To"/> |
||||||
|
</Border> |
||||||
|
<Border Grid.Row="1" Background="{StaticResource NavigatorWindowDocumentsBackground}" CornerRadius="3"> |
||||||
|
<ListBox x:Name="activeFileList" |
||||||
|
ItemsSource="{TemplateBinding Documents}" |
||||||
|
Style="{StaticResource NavigatorWindowDocumentsListStyle}"> |
||||||
|
</ListBox> |
||||||
|
</Border> |
||||||
|
|
||||||
|
<Border Grid.Row="2" Margin="2"> |
||||||
|
<TextBlock Text="{Binding Path=SelectedItem.InfoTip, ElementName=activeFileList}" VerticalAlignment="Center" TextWrapping="Wrap"/> |
||||||
|
</Border> |
||||||
|
</Grid> |
||||||
|
</Border> |
||||||
|
</ControlTemplate> |
||||||
|
|
||||||
|
</Setter.Value> |
||||||
|
</Setter> |
||||||
|
</Style> |
||||||
|
<!--NavigatorWindow END--> |
||||||
|
</ResourceDictionary> |
||||||
@ -0,0 +1,5 @@ |
|||||||
|
[{000214A0-0000-0000-C000-000000000046}] |
||||||
|
Prop3=19,2 |
||||||
|
[InternetShortcut] |
||||||
|
URL=http://avalondock.codeplex.com/ |
||||||
|
IDList= |
||||||
@ -0,0 +1,187 @@ |
|||||||
|
//Copyright (c) 2007-2010, Adolfo Marinucci
|
||||||
|
//All rights reserved.
|
||||||
|
|
||||||
|
//Redistribution and use in source and binary forms, with or without modification,
|
||||||
|
//are permitted provided that the following conditions are met:
|
||||||
|
//
|
||||||
|
//* Redistributions of source code must retain the above copyright notice,
|
||||||
|
// this list of conditions and the following disclaimer.
|
||||||
|
//* Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
// this list of conditions and the following disclaimer in the documentation
|
||||||
|
// and/or other materials provided with the distribution.
|
||||||
|
//* Neither the name of Adolfo Marinucci nor the names of its contributors may
|
||||||
|
// be used to endorse or promote products derived from this software without
|
||||||
|
// specific prior written permission.
|
||||||
|
//
|
||||||
|
//THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||||
|
//AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
//WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||||
|
//IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||||
|
//INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||||
|
//PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||||
|
//HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||||
|
//OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
||||||
|
//EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
|
|
||||||
|
using System; |
||||||
|
using System.Collections.Generic; |
||||||
|
using System.Linq; |
||||||
|
using System.Text; |
||||||
|
using System.Windows.Controls; |
||||||
|
using System.Windows; |
||||||
|
using System.Windows.Media; |
||||||
|
|
||||||
|
namespace AvalonDock |
||||||
|
{ |
||||||
|
public class AlignedImage : Decorator |
||||||
|
{ |
||||||
|
public AlignedImage() |
||||||
|
{ |
||||||
|
this.LayoutUpdated += new EventHandler(OnLayoutUpdated); |
||||||
|
} |
||||||
|
|
||||||
|
protected override System.Windows.Size MeasureOverride(Size constraint) |
||||||
|
{ |
||||||
|
Size desideredSize = new Size(); |
||||||
|
|
||||||
|
if (Child != null) |
||||||
|
{ |
||||||
|
Child.Measure(constraint); |
||||||
|
|
||||||
|
PresentationSource ps = PresentationSource.FromVisual(this); |
||||||
|
if (ps != null) |
||||||
|
{ |
||||||
|
Matrix fromDevice = ps.CompositionTarget.TransformFromDevice; |
||||||
|
|
||||||
|
Vector pixelSize = new Vector(Child.DesiredSize.Width, Child.DesiredSize.Height); |
||||||
|
Vector measureSizeV = fromDevice.Transform(pixelSize); |
||||||
|
desideredSize = new Size(measureSizeV.X, measureSizeV.Y); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
return desideredSize; |
||||||
|
} |
||||||
|
|
||||||
|
protected override Size ArrangeOverride(Size arrangeBounds) |
||||||
|
{ |
||||||
|
Size finalSize = new Size(); |
||||||
|
|
||||||
|
if (Child != null) |
||||||
|
{ |
||||||
|
_pixelOffset = GetPixelOffset(); |
||||||
|
Child.Arrange(new Rect(_pixelOffset, Child.DesiredSize)); |
||||||
|
finalSize = arrangeBounds; |
||||||
|
} |
||||||
|
|
||||||
|
return finalSize; |
||||||
|
} |
||||||
|
|
||||||
|
private Point _pixelOffset; |
||||||
|
|
||||||
|
private void OnLayoutUpdated(object sender, EventArgs e) |
||||||
|
{ |
||||||
|
// This event just means that layout happened somewhere. However, this is
|
||||||
|
// what we need since layout anywhere could affect our pixel positioning.
|
||||||
|
Point pixelOffset = GetPixelOffset(); |
||||||
|
if (!AreClose(pixelOffset, _pixelOffset)) |
||||||
|
{ |
||||||
|
InvalidateArrange(); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
// Gets the matrix that will convert a point from "above" the
|
||||||
|
// coordinate space of a visual into the the coordinate space
|
||||||
|
// "below" the visual.
|
||||||
|
private Matrix GetVisualTransform(Visual v) |
||||||
|
{ |
||||||
|
if (v != null) |
||||||
|
{ |
||||||
|
Matrix m = Matrix.Identity; |
||||||
|
|
||||||
|
Transform transform = VisualTreeHelper.GetTransform(v); |
||||||
|
if (transform != null) |
||||||
|
{ |
||||||
|
Matrix cm = transform.Value; |
||||||
|
m = Matrix.Multiply(m, cm); |
||||||
|
} |
||||||
|
|
||||||
|
Vector offset = VisualTreeHelper.GetOffset(v); |
||||||
|
m.Translate(offset.X, offset.Y); |
||||||
|
|
||||||
|
return m; |
||||||
|
} |
||||||
|
|
||||||
|
return Matrix.Identity; |
||||||
|
} |
||||||
|
|
||||||
|
private Point TryApplyVisualTransform(Point point, Visual v, bool inverse, bool throwOnError, out bool success) |
||||||
|
{ |
||||||
|
success = true; |
||||||
|
if (v != null) |
||||||
|
{ |
||||||
|
Matrix visualTransform = GetVisualTransform(v); |
||||||
|
if (inverse) |
||||||
|
{ |
||||||
|
if (!throwOnError && !visualTransform.HasInverse) |
||||||
|
{ |
||||||
|
success = false; |
||||||
|
return new Point(0, 0); |
||||||
|
} |
||||||
|
visualTransform.Invert(); |
||||||
|
} |
||||||
|
point = visualTransform.Transform(point); |
||||||
|
} |
||||||
|
return point; |
||||||
|
} |
||||||
|
|
||||||
|
private Point ApplyVisualTransform(Point point, Visual v, bool inverse) |
||||||
|
{ |
||||||
|
bool success = true; |
||||||
|
return TryApplyVisualTransform(point, v, inverse, true, out success); |
||||||
|
} |
||||||
|
|
||||||
|
private Point GetPixelOffset() |
||||||
|
{ |
||||||
|
Point pixelOffset = new Point(); |
||||||
|
|
||||||
|
PresentationSource ps = PresentationSource.FromVisual(this); |
||||||
|
if (ps != null) |
||||||
|
{ |
||||||
|
Visual rootVisual = ps.RootVisual; |
||||||
|
|
||||||
|
// Transform (0,0) from this element up to pixels.
|
||||||
|
pixelOffset = this.TransformToAncestor(rootVisual).Transform(pixelOffset); |
||||||
|
pixelOffset = ApplyVisualTransform(pixelOffset, rootVisual, false); |
||||||
|
pixelOffset = ps.CompositionTarget.TransformToDevice.Transform(pixelOffset); |
||||||
|
|
||||||
|
// Round the origin to the nearest whole pixel.
|
||||||
|
pixelOffset.X = Math.Round(pixelOffset.X); |
||||||
|
pixelOffset.Y = Math.Round(pixelOffset.Y); |
||||||
|
|
||||||
|
// Transform the whole-pixel back to this element.
|
||||||
|
pixelOffset = ps.CompositionTarget.TransformFromDevice.Transform(pixelOffset); |
||||||
|
pixelOffset = ApplyVisualTransform(pixelOffset, rootVisual, true); |
||||||
|
pixelOffset = rootVisual.TransformToDescendant(this).Transform(pixelOffset); |
||||||
|
} |
||||||
|
|
||||||
|
return pixelOffset; |
||||||
|
} |
||||||
|
|
||||||
|
private bool AreClose(Point point1, Point point2) |
||||||
|
{ |
||||||
|
return AreClose(point1.X, point2.X) && AreClose(point1.Y, point2.Y); |
||||||
|
} |
||||||
|
|
||||||
|
private bool AreClose(double value1, double value2) |
||||||
|
{ |
||||||
|
if (value1 == value2) |
||||||
|
{ |
||||||
|
return true; |
||||||
|
} |
||||||
|
double delta = value1 - value2; |
||||||
|
return ((delta < 1.53E-06) && (delta > -1.53E-06)); |
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,261 @@ |
|||||||
|
<?xml version="1.0" encoding="utf-8"?> |
||||||
|
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> |
||||||
|
<PropertyGroup> |
||||||
|
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> |
||||||
|
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> |
||||||
|
<ProductVersion>8.0.30703</ProductVersion> |
||||||
|
<SchemaVersion>2.0</SchemaVersion> |
||||||
|
<ProjectGuid>{87E61430-4243-45F2-B74E-0A4C096CEBF3}</ProjectGuid> |
||||||
|
<OutputType>Library</OutputType> |
||||||
|
<AppDesignerFolder>Properties</AppDesignerFolder> |
||||||
|
<RootNamespace>AvalonDock</RootNamespace> |
||||||
|
<AssemblyName>AvalonDock</AssemblyName> |
||||||
|
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion> |
||||||
|
<TargetFrameworkProfile>Client</TargetFrameworkProfile> |
||||||
|
<FileAlignment>512</FileAlignment> |
||||||
|
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> |
||||||
|
<WarningLevel>4</WarningLevel> |
||||||
|
<DelaySign>False</DelaySign> |
||||||
|
<AssemblyOriginatorKeyMode>File</AssemblyOriginatorKeyMode> |
||||||
|
<OutputPath>..\..\..\..\bin\</OutputPath> |
||||||
|
<AllowUnsafeBlocks>False</AllowUnsafeBlocks> |
||||||
|
<NoStdLib>False</NoStdLib> |
||||||
|
<TreatWarningsAsErrors>false</TreatWarningsAsErrors> |
||||||
|
</PropertyGroup> |
||||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> |
||||||
|
<DebugSymbols>true</DebugSymbols> |
||||||
|
<DebugType>Full</DebugType> |
||||||
|
<Optimize>false</Optimize> |
||||||
|
<DefineConstants>DEBUG;TRACE</DefineConstants> |
||||||
|
<ErrorReport>prompt</ErrorReport> |
||||||
|
<WarningLevel>4</WarningLevel> |
||||||
|
</PropertyGroup> |
||||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> |
||||||
|
<DebugType>pdbonly</DebugType> |
||||||
|
<Optimize>true</Optimize> |
||||||
|
<DefineConstants>TRACE</DefineConstants> |
||||||
|
<ErrorReport>prompt</ErrorReport> |
||||||
|
<WarningLevel>4</WarningLevel> |
||||||
|
</PropertyGroup> |
||||||
|
<PropertyGroup> |
||||||
|
<SignAssembly>true</SignAssembly> |
||||||
|
</PropertyGroup> |
||||||
|
<PropertyGroup> |
||||||
|
<AssemblyOriginatorKeyFile>AvalonDock.snk</AssemblyOriginatorKeyFile> |
||||||
|
</PropertyGroup> |
||||||
|
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' "> |
||||||
|
<CheckForOverflowUnderflow>False</CheckForOverflowUnderflow> |
||||||
|
</PropertyGroup> |
||||||
|
<PropertyGroup Condition=" '$(Platform)' == 'AnyCPU' "> |
||||||
|
<RegisterForComInterop>False</RegisterForComInterop> |
||||||
|
<GenerateSerializationAssemblies>Auto</GenerateSerializationAssemblies> |
||||||
|
<BaseAddress>4194304</BaseAddress> |
||||||
|
<PlatformTarget>AnyCPU</PlatformTarget> |
||||||
|
</PropertyGroup> |
||||||
|
<ItemGroup> |
||||||
|
<Reference Include="System" /> |
||||||
|
<Reference Include="System.Data" /> |
||||||
|
<Reference Include="System.Xml" /> |
||||||
|
<Reference Include="Microsoft.CSharp" /> |
||||||
|
<Reference Include="System.Core" /> |
||||||
|
<Reference Include="System.Xml.Linq" /> |
||||||
|
<Reference Include="System.Data.DataSetExtensions" /> |
||||||
|
<Reference Include="System.Xaml"> |
||||||
|
<RequiredTargetFramework>4.0</RequiredTargetFramework> |
||||||
|
</Reference> |
||||||
|
<Reference Include="WindowsBase" /> |
||||||
|
<Reference Include="PresentationCore" /> |
||||||
|
<Reference Include="PresentationFramework" /> |
||||||
|
<Reference Include="WindowsFormsIntegration" /> |
||||||
|
</ItemGroup> |
||||||
|
<ItemGroup> |
||||||
|
<Compile Include="AvalonDockWindow.cs" /> |
||||||
|
<Compile Include="FloatingDocumentPane.cs" /> |
||||||
|
<Compile Include="DockableFloatingWindowCommands.cs" /> |
||||||
|
<Compile Include="LogicalTreeAdapter.cs" /> |
||||||
|
<Compile Include="ManagedContentCollection.cs" /> |
||||||
|
<Compile Include="DockableContentCommands.cs" /> |
||||||
|
<Compile Include="DockablePaneCommands.cs" /> |
||||||
|
<Compile Include="DocumentContentCommands.cs" /> |
||||||
|
<Compile Include="DocumentPaneCommands.cs" /> |
||||||
|
<Compile Include="GreyableImage.cs" /> |
||||||
|
<Compile Include="InteropHelper.cs" /> |
||||||
|
<Compile Include="ManagedContentCommands.cs" /> |
||||||
|
<Compile Include="PaneCommands.cs" /> |
||||||
|
<Compile Include="RequestDocumentCloseEventArgs.cs" /> |
||||||
|
<Compile Include="ResizingPanel.cs" /> |
||||||
|
<Compile Include="Resizer.cs" /> |
||||||
|
<Compile Include="RoutedEventHandler.cs" /> |
||||||
|
<Compile Include="RoutedEventHelper.cs" /> |
||||||
|
<Compile Include="WindowInteropWrapper.cs" /> |
||||||
|
<Page Include="Resources\Brushes.xaml"> |
||||||
|
<Generator>MSBuild:Compile</Generator> |
||||||
|
<SubType>Designer</SubType> |
||||||
|
</Page> |
||||||
|
<Page Include="Resources\Common.xaml"> |
||||||
|
<Generator>MSBuild:Compile</Generator> |
||||||
|
<SubType>Designer</SubType> |
||||||
|
</Page> |
||||||
|
<Page Include="Resources\DockablePaneStyles.xaml"> |
||||||
|
<Generator>MSBuild:Compile</Generator> |
||||||
|
<SubType>Designer</SubType> |
||||||
|
</Page> |
||||||
|
<Page Include="Resources\DockingManagerStyles.xaml"> |
||||||
|
<Generator>MSBuild:Compile</Generator> |
||||||
|
<SubType>Designer</SubType> |
||||||
|
</Page> |
||||||
|
<Page Include="Resources\DocumentNavigatorWindowStyle.xaml"> |
||||||
|
<Generator>MSBuild:Compile</Generator> |
||||||
|
<SubType>Designer</SubType> |
||||||
|
</Page> |
||||||
|
<Page Include="Resources\DocumentPaneStyles.xaml"> |
||||||
|
<Generator>MSBuild:Compile</Generator> |
||||||
|
<SubType>Designer</SubType> |
||||||
|
</Page> |
||||||
|
<Page Include="Resources\FloatingWindowStyle.xaml"> |
||||||
|
<Generator>MSBuild:Compile</Generator> |
||||||
|
<SubType>Designer</SubType> |
||||||
|
</Page> |
||||||
|
<Page Include="Resources\ManagedContentStyle.xaml"> |
||||||
|
<Generator>MSBuild:Compile</Generator> |
||||||
|
<SubType>Designer</SubType> |
||||||
|
</Page> |
||||||
|
<Page Include="Resources\NavigatorWindowStyle.xaml"> |
||||||
|
<Generator>MSBuild:Compile</Generator> |
||||||
|
<SubType>Designer</SubType> |
||||||
|
</Page> |
||||||
|
<Page Include="Resources\OverlayWindowStyle.xaml"> |
||||||
|
<Generator>MSBuild:Compile</Generator> |
||||||
|
<SubType>Designer</SubType> |
||||||
|
</Page> |
||||||
|
<Page Include="Themes\aero.normalcolor.brushes.xaml"> |
||||||
|
<Generator>MSBuild:Compile</Generator> |
||||||
|
<SubType>Designer</SubType> |
||||||
|
</Page> |
||||||
|
<Page Include="Themes\aero.normalcolor.xaml"> |
||||||
|
<Generator>MSBuild:Compile</Generator> |
||||||
|
<SubType>Designer</SubType> |
||||||
|
</Page> |
||||||
|
<Page Include="Themes\classic.brushes.xaml"> |
||||||
|
<Generator>MSBuild:Compile</Generator> |
||||||
|
<SubType>Designer</SubType> |
||||||
|
</Page> |
||||||
|
<Page Include="Themes\classic.xaml"> |
||||||
|
<Generator>MSBuild:Compile</Generator> |
||||||
|
<SubType>Designer</SubType> |
||||||
|
</Page> |
||||||
|
<Page Include="Themes\generic.xaml"> |
||||||
|
<Generator>MSBuild:Compile</Generator> |
||||||
|
<SubType>Designer</SubType> |
||||||
|
</Page> |
||||||
|
<Compile Include="AlignedImage.cs" /> |
||||||
|
<Compile Include="AvalonDockBrushes.cs" /> |
||||||
|
<Compile Include="ThemeFactory.cs" /> |
||||||
|
<Compile Include="ContextMenuElement.cs" /> |
||||||
|
<Compile Include="Converters.cs" /> |
||||||
|
<Page Include="Themes\luna.normalcolor.xaml"> |
||||||
|
<Generator>MSBuild:Compile</Generator> |
||||||
|
<SubType>Designer</SubType> |
||||||
|
</Page> |
||||||
|
</ItemGroup> |
||||||
|
<ItemGroup> |
||||||
|
<Compile Include="DeserializationCallbackEventArgs.cs" /> |
||||||
|
<Compile Include="DockableContent.cs" /> |
||||||
|
<Compile Include="DockableFloatingWindow.cs" /> |
||||||
|
<Compile Include="DockablePane.cs" /> |
||||||
|
<Compile Include="DockablePaneAnchorTab.cs" /> |
||||||
|
<Compile Include="DockablePaneAnchorTabGroup.cs" /> |
||||||
|
<Compile Include="DockableTabPanel.cs" /> |
||||||
|
<Compile Include="DockingManager.cs" /> |
||||||
|
<Compile Include="DocumentContent.cs" /> |
||||||
|
<Compile Include="DocumentFloatingWindow.cs" /> |
||||||
|
<Compile Include="DocumentNavigatorWindow.cs" /> |
||||||
|
<Compile Include="DocumentPane.cs" /> |
||||||
|
<Compile Include="DocumentPaneResizingPanel.cs" /> |
||||||
|
<Compile Include="DocumentTabPanel.cs" /> |
||||||
|
<Compile Include="DragPaneServices.cs" /> |
||||||
|
<Compile Include="FloatingDockablePane.cs" /> |
||||||
|
<Compile Include="FloatingWindow.cs" /> |
||||||
|
<Compile Include="FlyoutDockablePane.cs" /> |
||||||
|
<Compile Include="FlyoutPaneWindow.cs" /> |
||||||
|
<Compile Include="HelperFunc.cs" /> |
||||||
|
<Compile Include="IDockableControl.cs" /> |
||||||
|
<Compile Include="IDropSurface.cs" /> |
||||||
|
<Compile Include="ManagedContent.cs" /> |
||||||
|
<Compile Include="NavigatorWindow.cs" /> |
||||||
|
<Compile Include="OverlayWindow.cs" /> |
||||||
|
<Compile Include="OverlayWindowAnchorButton.cs" /> |
||||||
|
<Compile Include="Pane.cs" /> |
||||||
|
<Compile Include="PaneTabPanel.cs" /> |
||||||
|
<Compile Include="Properties\AssemblyInfo.cs"> |
||||||
|
<SubType>Code</SubType> |
||||||
|
</Compile> |
||||||
|
<Compile Include="Properties\Resources.Designer.cs"> |
||||||
|
<AutoGen>True</AutoGen> |
||||||
|
<DesignTime>True</DesignTime> |
||||||
|
<DependentUpon>Resources.resx</DependentUpon> |
||||||
|
</Compile> |
||||||
|
<Compile Include="Properties\Settings.Designer.cs"> |
||||||
|
<AutoGen>True</AutoGen> |
||||||
|
<DependentUpon>Settings.settings</DependentUpon> |
||||||
|
<DesignTimeSharedInput>True</DesignTimeSharedInput> |
||||||
|
</Compile> |
||||||
|
<EmbeddedResource Include="Properties\Resources.resx"> |
||||||
|
<Generator>PublicResXFileCodeGenerator</Generator> |
||||||
|
<LastGenOutput>Resources.Designer.cs</LastGenOutput> |
||||||
|
</EmbeddedResource> |
||||||
|
<None Include="AvalonDock.snk" /> |
||||||
|
<None Include="Properties\Settings.settings"> |
||||||
|
<Generator>SettingsSingleFileGenerator</Generator> |
||||||
|
<LastGenOutput>Settings.Designer.cs</LastGenOutput> |
||||||
|
</None> |
||||||
|
<AppDesigner Include="Properties\" /> |
||||||
|
</ItemGroup> |
||||||
|
<ItemGroup> |
||||||
|
<Resource Include="Resources\Images\DockBottom.PNG" /> |
||||||
|
<Resource Include="Resources\Images\DockLeft.PNG" /> |
||||||
|
<Resource Include="Resources\Images\DockPane.PNG" /> |
||||||
|
<Resource Include="Resources\Images\DockRight.PNG" /> |
||||||
|
<Resource Include="Resources\Images\DockTop.PNG" /> |
||||||
|
<Resource Include="Resources\Images\HTabGroup.png" /> |
||||||
|
<Resource Include="Resources\Images\Locked.png" /> |
||||||
|
<Resource Include="Resources\Images\PinAutoHide.png" /> |
||||||
|
<Resource Include="Resources\Images\PinClose.png" /> |
||||||
|
<Resource Include="Resources\Images\PinDocMenu.png" /> |
||||||
|
<Resource Include="Resources\Images\PinMenu.png" /> |
||||||
|
<Resource Include="Resources\Images\VTabGroup.png" /> |
||||||
|
</ItemGroup> |
||||||
|
<ItemGroup /> |
||||||
|
<ItemGroup> |
||||||
|
<Resource Include="Resources\Images\Aero\AeroDockBottom.png" /> |
||||||
|
<Resource Include="Resources\Images\Aero\AeroDockBottomHover.png" /> |
||||||
|
<Resource Include="Resources\Images\Aero\AeroDockLeft.png" /> |
||||||
|
<Resource Include="Resources\Images\Aero\AeroDockLeftHover.png" /> |
||||||
|
<Resource Include="Resources\Images\Aero\AeroDockPane.png" /> |
||||||
|
<Resource Include="Resources\Images\Aero\AeroDockPaneBottom.png" /> |
||||||
|
<Resource Include="Resources\Images\Aero\AeroDockPaneInto.png" /> |
||||||
|
<Resource Include="Resources\Images\Aero\AeroDockPaneLeft.png" /> |
||||||
|
<Resource Include="Resources\Images\Aero\AeroDockPaneRight.png" /> |
||||||
|
<Resource Include="Resources\Images\Aero\AeroDockPaneTop.png" /> |
||||||
|
<Resource Include="Resources\Images\Aero\AeroDockRight.png" /> |
||||||
|
<Resource Include="Resources\Images\Aero\AeroDockRightHover.png" /> |
||||||
|
<Resource Include="Resources\Images\Aero\AeroDockTop.png" /> |
||||||
|
<Resource Include="Resources\Images\Aero\AeroDockTopHover.png" /> |
||||||
|
</ItemGroup> |
||||||
|
<ItemGroup> |
||||||
|
<Resource Include="Resources\Images\Classic\PinAutoHide.png" /> |
||||||
|
<Resource Include="Resources\Images\Classic\PinAutoHideSelected.png" /> |
||||||
|
<Resource Include="Resources\Images\Classic\PinClose.png" /> |
||||||
|
<Resource Include="Resources\Images\Classic\PinCloseSelected.png" /> |
||||||
|
<Resource Include="Resources\Images\Classic\PinMenu.png" /> |
||||||
|
<Resource Include="Resources\Images\Classic\PinMenuSelected.png" /> |
||||||
|
</ItemGroup> |
||||||
|
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> |
||||||
|
<!-- To modify your build process, add your task inside one of the targets below and uncomment it. |
||||||
|
Other similar extension points exist, see Microsoft.Common.targets. |
||||||
|
<Target Name="BeforeBuild"> |
||||||
|
</Target> |
||||||
|
<Target Name="AfterBuild"> |
||||||
|
</Target> |
||||||
|
--> |
||||||
|
</Project> |
||||||
@ -0,0 +1,148 @@ |
|||||||
|
//Copyright (c) 2007-2010, Adolfo Marinucci
|
||||||
|
//All rights reserved.
|
||||||
|
|
||||||
|
//Redistribution and use in source and binary forms, with or without modification,
|
||||||
|
//are permitted provided that the following conditions are met:
|
||||||
|
//
|
||||||
|
//* Redistributions of source code must retain the above copyright notice,
|
||||||
|
// this list of conditions and the following disclaimer.
|
||||||
|
//* Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
// this list of conditions and the following disclaimer in the documentation
|
||||||
|
// and/or other materials provided with the distribution.
|
||||||
|
//* Neither the name of Adolfo Marinucci nor the names of its contributors may
|
||||||
|
// be used to endorse or promote products derived from this software without
|
||||||
|
// specific prior written permission.
|
||||||
|
//
|
||||||
|
//THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||||
|
//AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
//WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||||
|
//IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||||
|
//INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||||
|
//PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||||
|
//HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||||
|
//OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
||||||
|
//EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
|
using System; |
||||||
|
using System.Collections.Generic; |
||||||
|
using System.Linq; |
||||||
|
using System.Text; |
||||||
|
|
||||||
|
namespace AvalonDock |
||||||
|
{ |
||||||
|
/// <summary>
|
||||||
|
/// Defines a list of brushes used by AvalonDock templates
|
||||||
|
/// </summary>
|
||||||
|
public enum AvalonDockBrushes |
||||||
|
{ |
||||||
|
/// <summary>
|
||||||
|
/// Default brush for DockingManager background
|
||||||
|
/// </summary>
|
||||||
|
DefaultBackgroundBrush, |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Brush used for the title background of a <see cref="DockablePane"/>.
|
||||||
|
/// </summary>
|
||||||
|
DockablePaneTitleBackground, |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Brush used for the title background of a <see cref="DockablePane"/> when is focused.
|
||||||
|
/// </summary>
|
||||||
|
DockablePaneTitleBackgroundSelected, |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Brush used for the title foreground of a <see cref="DockablePane"/>.
|
||||||
|
/// </summary>
|
||||||
|
DockablePaneTitleForeground, |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Brush used for the title foreground of a <see cref="DockablePane"/> when is focused.
|
||||||
|
/// </summary>
|
||||||
|
DockablePaneTitleForegroundSelected, |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Brush used for the background of the pane command pins.
|
||||||
|
/// </summary>
|
||||||
|
PaneHeaderCommandBackground, |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Brush used for the border of the pane command pins.
|
||||||
|
/// </summary>
|
||||||
|
PaneHeaderCommandBorderBrush, |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Brush used for the background of a document header.
|
||||||
|
/// </summary>
|
||||||
|
DocumentHeaderBackground, |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Brush used for the foreground of a document header.
|
||||||
|
/// </summary>
|
||||||
|
DocumentHeaderForeground, |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Brush used for fonts while a document header is selected but not activated
|
||||||
|
/// </summary>
|
||||||
|
DocumentHeaderForegroundSelected, |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Brush used for fonts while a document header is selected and activated
|
||||||
|
/// </summary>
|
||||||
|
DocumentHeaderForegroundSelectedActivated, |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Brush used for the background of a document header when selected (<see cref="ManagedContent.IsActiveContent"/>).
|
||||||
|
/// </summary>
|
||||||
|
DocumentHeaderBackgroundSelected, |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Brush used for the background of a document header when active and selected (<see cref="ManagedContent.IsActiveDocument"/>).
|
||||||
|
/// </summary>
|
||||||
|
DocumentHeaderBackgroundSelectedActivated, |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Brush used for the background of a document header when mouse is over it.
|
||||||
|
/// </summary>
|
||||||
|
DocumentHeaderBackgroundMouseOver, |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Brush used for the border brush of a document header when mouse is over it (but is not selected).
|
||||||
|
/// </summary>
|
||||||
|
DocumentHeaderBorderBrushMouseOver, |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Brush for the document header border
|
||||||
|
/// </summary>
|
||||||
|
DocumentHeaderBorder, |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Brush for the document header border when contains a document selected
|
||||||
|
/// </summary>
|
||||||
|
DocumentHeaderBorderSelected, |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Brush for the document header border when contains a document selected and activated
|
||||||
|
/// </summary>
|
||||||
|
DocumentHeaderBorderSelectedActivated, |
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
NavigatorWindowTopBackground, |
||||||
|
|
||||||
|
NavigatorWindowTitleForeground, |
||||||
|
|
||||||
|
NavigatorWindowDocumentTypeForeground, |
||||||
|
|
||||||
|
NavigatorWindowInfoTipForeground, |
||||||
|
|
||||||
|
NavigatorWindowForeground, |
||||||
|
|
||||||
|
NavigatorWindowBackground, |
||||||
|
|
||||||
|
NavigatorWindowSelectionBackground, |
||||||
|
|
||||||
|
NavigatorWindowSelectionBorderbrush, |
||||||
|
|
||||||
|
NavigatorWindowBottomBackground, |
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,20 @@ |
|||||||
|
using System; |
||||||
|
using System.Collections.Generic; |
||||||
|
using System.Linq; |
||||||
|
using System.Text; |
||||||
|
using System.Windows; |
||||||
|
|
||||||
|
namespace AvalonDock |
||||||
|
{ |
||||||
|
public class AvalonDockWindow : Window |
||||||
|
{ |
||||||
|
static AvalonDockWindow() |
||||||
|
{ |
||||||
|
ShowInTaskbarProperty.OverrideMetadata(typeof(AvalonDockWindow), new FrameworkPropertyMetadata(false)); |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
internal AvalonDockWindow() |
||||||
|
{ } |
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,58 @@ |
|||||||
|
//Copyright (c) 2007-2010, Adolfo Marinucci
|
||||||
|
//All rights reserved.
|
||||||
|
|
||||||
|
//Redistribution and use in source and binary forms, with or without modification,
|
||||||
|
//are permitted provided that the following conditions are met:
|
||||||
|
//
|
||||||
|
//* Redistributions of source code must retain the above copyright notice,
|
||||||
|
// this list of conditions and the following disclaimer.
|
||||||
|
//* Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
// this list of conditions and the following disclaimer in the documentation
|
||||||
|
// and/or other materials provided with the distribution.
|
||||||
|
//* Neither the name of Adolfo Marinucci nor the names of its contributors may
|
||||||
|
// be used to endorse or promote products derived from this software without
|
||||||
|
// specific prior written permission.
|
||||||
|
//
|
||||||
|
//THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||||
|
//AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
//WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||||
|
//IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||||
|
//INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||||
|
//PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||||
|
//HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||||
|
//OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
||||||
|
//EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
|
using System; |
||||||
|
using System.Collections.Generic; |
||||||
|
using System.Text; |
||||||
|
|
||||||
|
namespace AvalonDock |
||||||
|
{ |
||||||
|
/// <summary>
|
||||||
|
/// Defines a list of context menu resources
|
||||||
|
/// </summary>
|
||||||
|
public enum ContextMenuElement |
||||||
|
{ |
||||||
|
/// <summary>
|
||||||
|
/// Context menu related to a <see cref="DockablePane"/>
|
||||||
|
/// </summary>
|
||||||
|
DockablePane, |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Context menu related to a <see cref="DocumentPane"/>
|
||||||
|
/// </summary>
|
||||||
|
DocumentPane, |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Context menu related to a <see cref="DockableFloatingWindow"/>
|
||||||
|
/// </summary>
|
||||||
|
DockableFloatingWindow, |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Context menu related to a <see cref="DocumentFloatingWindow"/>
|
||||||
|
/// </summary>
|
||||||
|
DocumentFloatingWindow |
||||||
|
|
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,167 @@ |
|||||||
|
//Copyright (c) 2007-2010, Adolfo Marinucci
|
||||||
|
//All rights reserved.
|
||||||
|
|
||||||
|
//Redistribution and use in source and binary forms, with or without modification,
|
||||||
|
//are permitted provided that the following conditions are met:
|
||||||
|
//
|
||||||
|
//* Redistributions of source code must retain the above copyright notice,
|
||||||
|
// this list of conditions and the following disclaimer.
|
||||||
|
//* Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
// this list of conditions and the following disclaimer in the documentation
|
||||||
|
// and/or other materials provided with the distribution.
|
||||||
|
//* Neither the name of Adolfo Marinucci nor the names of its contributors may
|
||||||
|
// be used to endorse or promote products derived from this software without
|
||||||
|
// specific prior written permission.
|
||||||
|
//
|
||||||
|
//THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||||
|
//AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
//WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||||
|
//IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||||
|
//INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||||
|
//PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||||
|
//HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||||
|
//OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
||||||
|
//EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
|
using System; |
||||||
|
using System.Collections.Generic; |
||||||
|
using System.Text; |
||||||
|
using System.Windows.Data; |
||||||
|
using System.IO; |
||||||
|
using System.Reflection; |
||||||
|
using System.Windows.Media; |
||||||
|
using System.Windows; |
||||||
|
using System.Windows.Controls; |
||||||
|
using System.Windows.Media.Imaging; |
||||||
|
|
||||||
|
namespace AvalonDock |
||||||
|
{ |
||||||
|
//public class FindResourcePathConverter : IValueConverter
|
||||||
|
//{
|
||||||
|
// #region IValueConverter Members
|
||||||
|
|
||||||
|
// public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
|
||||||
|
// {
|
||||||
|
// if (value == null)
|
||||||
|
// {
|
||||||
|
// return null;
|
||||||
|
// //return new Uri(@"DocumentHS.png", UriKind.Relative);
|
||||||
|
// }
|
||||||
|
|
||||||
|
// return value;
|
||||||
|
// }
|
||||||
|
|
||||||
|
// public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
|
||||||
|
// {
|
||||||
|
// throw new NotImplementedException();
|
||||||
|
// }
|
||||||
|
|
||||||
|
// #endregion
|
||||||
|
//}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Converter from boolean values to visibility (inverse mode)
|
||||||
|
/// </summary>
|
||||||
|
[ValueConversion(typeof(object), typeof(Visibility))] |
||||||
|
public class BoolToVisibilityConverter : IValueConverter |
||||||
|
{ |
||||||
|
public object Convert(object value, Type targetType, object parameter, |
||||||
|
System.Globalization.CultureInfo culture) |
||||||
|
{ |
||||||
|
return System.Convert.ToBoolean(value) ? Visibility.Visible : |
||||||
|
(parameter != null && ((string)parameter) == "Hidden" ? Visibility.Hidden : Visibility.Collapsed); |
||||||
|
} |
||||||
|
|
||||||
|
public object ConvertBack(object value, Type targetType, object parameter, |
||||||
|
System.Globalization.CultureInfo culture) |
||||||
|
{ |
||||||
|
return null; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
[ValueConversion(typeof(object), typeof(Image))] |
||||||
|
public class ObjectToImageConverter : IValueConverter |
||||||
|
{ |
||||||
|
|
||||||
|
#region IValueConverter Members
|
||||||
|
|
||||||
|
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) |
||||||
|
{ |
||||||
|
double width = 16.0; |
||||||
|
if (parameter != null && |
||||||
|
parameter is double) |
||||||
|
width = (double)parameter; |
||||||
|
|
||||||
|
if (value is string) |
||||||
|
{ |
||||||
|
Uri iconUri; |
||||||
|
// try to resolve given value as an absolute URI
|
||||||
|
if (Uri.TryCreate(value as String, UriKind.RelativeOrAbsolute, out iconUri)) |
||||||
|
{ |
||||||
|
var img = new BitmapImage(iconUri); |
||||||
|
if (img != null) |
||||||
|
{ |
||||||
|
return new Image() |
||||||
|
{ |
||||||
|
UseLayoutRounding = true, |
||||||
|
Width = width, |
||||||
|
Source = img |
||||||
|
}; |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
else if (value is BitmapImage) |
||||||
|
{ |
||||||
|
var img = value as BitmapImage; |
||||||
|
return new Image() |
||||||
|
{ |
||||||
|
UseLayoutRounding = true, |
||||||
|
Width = width, |
||||||
|
Source = new BitmapImage(img.UriSource) |
||||||
|
}; |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
return value; |
||||||
|
} |
||||||
|
|
||||||
|
public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) |
||||||
|
{ |
||||||
|
throw new NotImplementedException(); |
||||||
|
} |
||||||
|
|
||||||
|
#endregion
|
||||||
|
} |
||||||
|
|
||||||
|
public static class Converters |
||||||
|
{ |
||||||
|
static BoolToVisibilityConverter _BoolToVisibilityConverter = null; |
||||||
|
|
||||||
|
public static BoolToVisibilityConverter BoolToVisibilityConverter |
||||||
|
{ |
||||||
|
get |
||||||
|
{ |
||||||
|
if (_BoolToVisibilityConverter == null) |
||||||
|
_BoolToVisibilityConverter = new BoolToVisibilityConverter(); |
||||||
|
|
||||||
|
|
||||||
|
return _BoolToVisibilityConverter; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
static ObjectToImageConverter _ObjectToImageConverter = null; |
||||||
|
|
||||||
|
public static ObjectToImageConverter ObjectToImageConverter |
||||||
|
{ |
||||||
|
get |
||||||
|
{ |
||||||
|
if (_ObjectToImageConverter == null) |
||||||
|
_ObjectToImageConverter = new ObjectToImageConverter(); |
||||||
|
|
||||||
|
|
||||||
|
return _ObjectToImageConverter; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,25 @@ |
|||||||
|
using System; |
||||||
|
using System.Collections.Generic; |
||||||
|
using System.Linq; |
||||||
|
using System.Text; |
||||||
|
|
||||||
|
namespace AvalonDock |
||||||
|
{ |
||||||
|
public class DeserializationCallbackEventArgs : EventArgs |
||||||
|
{ |
||||||
|
public DeserializationCallbackEventArgs(string contentName) |
||||||
|
{ |
||||||
|
Name = contentName; |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the name of the content to deserialize
|
||||||
|
/// </summary>
|
||||||
|
public string Name { get; protected set; } |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets/Sets the content manually deserialized
|
||||||
|
/// </summary>
|
||||||
|
public ManagedContent Content { get; set; } |
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,954 @@ |
|||||||
|
//Copyright (c) 2007-2010, Adolfo Marinucci
|
||||||
|
//All rights reserved.
|
||||||
|
|
||||||
|
//Redistribution and use in source and binary forms, with or without modification,
|
||||||
|
//are permitted provided that the following conditions are met:
|
||||||
|
//
|
||||||
|
//* Redistributions of source code must retain the above copyright notice,
|
||||||
|
// this list of conditions and the following disclaimer.
|
||||||
|
//* Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
// this list of conditions and the following disclaimer in the documentation
|
||||||
|
// and/or other materials provided with the distribution.
|
||||||
|
//* Neither the name of Adolfo Marinucci nor the names of its contributors may
|
||||||
|
// be used to endorse or promote products derived from this software without
|
||||||
|
// specific prior written permission.
|
||||||
|
//
|
||||||
|
//THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||||
|
//AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
//WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||||
|
//IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||||
|
//INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||||
|
//PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||||
|
//HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||||
|
//OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
||||||
|
//EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
|
using System; |
||||||
|
using System.Collections.Generic; |
||||||
|
using System.Text; |
||||||
|
using System.Windows; |
||||||
|
using System.Windows.Controls; |
||||||
|
using System.Windows.Controls.Primitives; |
||||||
|
using System.Windows.Data; |
||||||
|
using System.Windows.Documents; |
||||||
|
using System.Windows.Input; |
||||||
|
using System.Windows.Media; |
||||||
|
using System.Windows.Media.Imaging; |
||||||
|
using System.Windows.Shapes; |
||||||
|
using System.Diagnostics; |
||||||
|
using System.Xml; |
||||||
|
using System.ComponentModel; |
||||||
|
using System.Linq; |
||||||
|
|
||||||
|
namespace AvalonDock |
||||||
|
{ |
||||||
|
/// <summary>
|
||||||
|
/// Enumerates all the possible states of <see cref="DockableContent"/>
|
||||||
|
/// </summary>
|
||||||
|
public enum DockableContentState |
||||||
|
{ |
||||||
|
/// <summary>
|
||||||
|
/// Content is not associated with any <see cref="DockingManager"/> (Default State)
|
||||||
|
/// </summary>
|
||||||
|
None, |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Content is docked to a border of a <see cref="ResizingPanel"/> within as <see cref="DockingManager"/> control
|
||||||
|
/// </summary>
|
||||||
|
Docked, |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Content is hosted by a flyout window and is visible only when user move mouse over an anchor thumb located to a <see cref="DockingManager"/> controlo border
|
||||||
|
/// </summary>
|
||||||
|
AutoHide, |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Content is hosted by a floating window and user can redock is on its <see cref="DockingManager"/> container control
|
||||||
|
/// </summary>
|
||||||
|
DockableWindow, |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Content is hosted by a floating window that can't be docked to a its <see cref="DockingManager"/> container control
|
||||||
|
/// </summary>
|
||||||
|
FloatingWindow, |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Content is hosted into a <see cref="DocmumentPane"/>
|
||||||
|
/// </summary>
|
||||||
|
Document, |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Content is hidden
|
||||||
|
/// </summary>
|
||||||
|
Hidden, |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Defines how a dockable content can be dragged over a docking manager
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>This style can be composed with the 'or' operator.</remarks>
|
||||||
|
public enum DockableStyle : uint |
||||||
|
{ |
||||||
|
/// <summary>
|
||||||
|
/// Content is not dockable at all
|
||||||
|
/// </summary>
|
||||||
|
None = 0x0000, |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Dockable as document
|
||||||
|
/// </summary>
|
||||||
|
Document = 0x0001, |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Dockable to the left border of <see cref="DockingManager"/>
|
||||||
|
/// </summary>
|
||||||
|
LeftBorder = 0x0002, |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Dockable to the right border of <see cref="DockingManager"/>
|
||||||
|
/// </summary>
|
||||||
|
RightBorder = 0x0004, |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Dockable to the top border of <see cref="DockingManager"/>
|
||||||
|
/// </summary>
|
||||||
|
TopBorder = 0x0008, |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Dockable to the bottom border of <see cref="DockingManager"/>
|
||||||
|
/// </summary>
|
||||||
|
BottomBorder= 0x0010, |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// A <see cref="DockableContent"/> with this style can be hosted in a <see cref="FloatingWindow"/>
|
||||||
|
/// </summary>
|
||||||
|
Floating = 0x0020, |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// A <see cref="DockableContent"/> with this style can be the only one content in a <see cref="DockablePane"/> pane (NOT YET SUPPORTED)
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>This style is not compatible with <see cref="DockableStyle.Document"/> style</remarks>
|
||||||
|
Single = 0x0040, |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// A <see cref="DockableContet"/> with this style can be autohidden.
|
||||||
|
/// </summary>
|
||||||
|
AutoHide = 0x0080, |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Dockable only to a border of a <see cref="DockingManager"/>
|
||||||
|
/// </summary>
|
||||||
|
DockableToBorders = LeftBorder | RightBorder | TopBorder | BottomBorder | AutoHide, |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Dockable to a border of a <see cref="DockingManager"/> and into a <see cref="DocumentPane"/>
|
||||||
|
/// </summary>
|
||||||
|
Dockable = DockableToBorders | Document | Floating, |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Dockable to a border of a <see cref="DockingManager"/> and into a <see cref="DocumentPane"/> but not in autohidden mode (WinForms controls)
|
||||||
|
/// </summary>
|
||||||
|
DockableButNotAutoHidden = Dockable & ~AutoHide |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Represent a state of a dockable content that can be used to restore it after it's hidden
|
||||||
|
/// </summary>
|
||||||
|
internal class DockableContentStateAndPosition |
||||||
|
{ |
||||||
|
public readonly Pane ContainerPane = null; |
||||||
|
public readonly Guid ContainerPaneID; |
||||||
|
public readonly int ChildIndex = -1; |
||||||
|
public readonly double Width; |
||||||
|
public readonly double Height; |
||||||
|
public readonly DockableContentState State; |
||||||
|
public readonly AnchorStyle Anchor = AnchorStyle.None; |
||||||
|
|
||||||
|
public DockableContentStateAndPosition( |
||||||
|
Pane containerPane, |
||||||
|
int childIndex, |
||||||
|
double width, |
||||||
|
double height, |
||||||
|
AnchorStyle anchor, |
||||||
|
DockableContentState state) |
||||||
|
{ |
||||||
|
ContainerPane = containerPane; |
||||||
|
ChildIndex = childIndex; |
||||||
|
Width = Math.Max(width, 100.0); |
||||||
|
Height = Math.Max(height, 100.0); |
||||||
|
Anchor = anchor; |
||||||
|
State = state; |
||||||
|
} |
||||||
|
|
||||||
|
public DockableContentStateAndPosition( |
||||||
|
Guid containerPaneID, |
||||||
|
int childIndex, |
||||||
|
double width, |
||||||
|
double height, |
||||||
|
AnchorStyle anchor, |
||||||
|
DockableContentState state) |
||||||
|
{ |
||||||
|
ContainerPaneID = containerPaneID; |
||||||
|
ChildIndex = childIndex; |
||||||
|
Width = Math.Max(width, 100.0); |
||||||
|
Height = Math.Max(height, 100.0); |
||||||
|
Anchor = anchor; |
||||||
|
State = state; |
||||||
|
} |
||||||
|
|
||||||
|
public DockableContentStateAndPosition( |
||||||
|
DockableContent cntToSave) |
||||||
|
{ |
||||||
|
ContainerPane = cntToSave.ContainerPane; |
||||||
|
ChildIndex = ContainerPane.Items.IndexOf(cntToSave); |
||||||
|
Width = Math.Max(ContainerPane.ActualWidth, 100.0); |
||||||
|
Height = Math.Max(ContainerPane.ActualHeight, 100.0); |
||||||
|
State = cntToSave.State; |
||||||
|
|
||||||
|
DockablePane dockablePane = ContainerPane as DockablePane; |
||||||
|
if (dockablePane != null) |
||||||
|
{ |
||||||
|
Anchor = dockablePane.Anchor; |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Identifies a content that can be drag over a <see cref="DockingManager"/> control or hosted by a window floating over it (<see cref="FloatingWindow"/>).
|
||||||
|
/// </summary>
|
||||||
|
public class DockableContent : ManagedContent |
||||||
|
{ |
||||||
|
static DockableContent() |
||||||
|
{ |
||||||
|
DefaultStyleKeyProperty.OverrideMetadata(typeof(DockableContent), new FrameworkPropertyMetadata(typeof(DockableContent))); |
||||||
|
} |
||||||
|
|
||||||
|
public DockableContent() |
||||||
|
{ |
||||||
|
} |
||||||
|
|
||||||
|
protected override void OnContentLoaded() |
||||||
|
{ |
||||||
|
//now the logical tree is up
|
||||||
|
DockingManager manager = GetParentManager(null); |
||||||
|
|
||||||
|
//if can't find the manager there is a problem
|
||||||
|
//if (manager == null)
|
||||||
|
// throw new InvalidOperationException("Unable to find DockingManager object in the logical tree");
|
||||||
|
//if (manager != null)
|
||||||
|
// manager.DockableContents.Add(this);
|
||||||
|
|
||||||
|
base.OnContentLoaded(); |
||||||
|
} |
||||||
|
|
||||||
|
protected override void OnContentUnloaded() |
||||||
|
{ |
||||||
|
//if (Manager != null && !Manager.HiddenContents.Contains(this))
|
||||||
|
// Manager.DockableContents.Remove(this);
|
||||||
|
|
||||||
|
base.OnContentUnloaded(); |
||||||
|
} |
||||||
|
|
||||||
|
SizeToContent _floatingWindowSizeToContent = SizeToContent.Manual; |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets a value indicating if this dockable content should change the size of a FloatingWindow when undocked
|
||||||
|
/// </summary>
|
||||||
|
public SizeToContent FloatingWindowSizeToContent |
||||||
|
{ |
||||||
|
get { return _floatingWindowSizeToContent; } |
||||||
|
set |
||||||
|
{ |
||||||
|
_floatingWindowSizeToContent = value; |
||||||
|
RaisePropertyChanged("FloatingWindowSizeToContent"); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
#region Drag content
|
||||||
|
protected override void OnDragMouseMove(object sender, MouseEventArgs e) |
||||||
|
{ |
||||||
|
base.OnDragMouseMove(sender, e); |
||||||
|
} |
||||||
|
|
||||||
|
protected override void OnDragStart(Point ptMouse, Point ptRelativeMouse) |
||||||
|
{ |
||||||
|
if (DockableStyle != DockableStyle.None && |
||||||
|
(State == DockableContentState.Docked || State == DockableContentState.Document || State == DockableContentState.DockableWindow) && |
||||||
|
!Manager.DragPaneServices.IsDragging) |
||||||
|
{ |
||||||
|
Manager.Drag(this, HelperFunc.PointToScreenWithoutFlowDirection(this, ptMouse), ptRelativeMouse); |
||||||
|
} |
||||||
|
|
||||||
|
base.OnDragStart(ptMouse, ptRelativeMouse); |
||||||
|
} |
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region State Properties & Events
|
||||||
|
|
||||||
|
#region StateChanged
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// StateChanged Routed Event
|
||||||
|
/// </summary>
|
||||||
|
public static readonly RoutedEvent StateChangedEvent = EventManager.RegisterRoutedEvent("StateChanged", |
||||||
|
RoutingStrategy.Bubble, typeof(RoutedEventHandler), typeof(DockableContent)); |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Occurs when State property changes
|
||||||
|
/// </summary>
|
||||||
|
public event RoutedEventHandler StateChanged |
||||||
|
{ |
||||||
|
add { AddHandler(StateChangedEvent, value); } |
||||||
|
remove { RemoveHandler(StateChangedEvent, value); } |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// A helper method to raise the StateChanged event.
|
||||||
|
/// </summary>
|
||||||
|
protected RoutedEventArgs RaiseStateChangedEvent() |
||||||
|
{ |
||||||
|
return RaiseStateChangedEvent(this); |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// A static helper method to raise the StateChanged event on a target element.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="target">UIElement or ContentElement on which to raise the event</param>
|
||||||
|
static RoutedEventArgs RaiseStateChangedEvent(DependencyObject target) |
||||||
|
{ |
||||||
|
if (target == null) return null; |
||||||
|
|
||||||
|
RoutedEventArgs args = new RoutedEventArgs(); |
||||||
|
args.RoutedEvent = StateChangedEvent; |
||||||
|
RoutedEventHelper.RaiseEvent(target, args); |
||||||
|
return args; |
||||||
|
} |
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the state of <see cref="DockableContent"/>
|
||||||
|
/// </summary>
|
||||||
|
public DockableContentState State |
||||||
|
{ |
||||||
|
get { return (DockableContentState)GetValue(StatePropertyKey.DependencyProperty); } |
||||||
|
protected set { SetValue(StatePropertyKey, value); } |
||||||
|
} |
||||||
|
|
||||||
|
// Using a DependencyProperty as the backing store for State. This enables animation, styling, binding, etc...
|
||||||
|
public static readonly DependencyPropertyKey StatePropertyKey = |
||||||
|
DependencyProperty.RegisterReadOnly("State", |
||||||
|
typeof(DockableContentState), |
||||||
|
typeof(DockableContent), |
||||||
|
new FrameworkPropertyMetadata( |
||||||
|
DockableContentState.None, |
||||||
|
new PropertyChangedCallback( |
||||||
|
(s, e) => |
||||||
|
{ |
||||||
|
((DockableContent)s).OnStateChanged((DockableContentState)e.OldValue, (DockableContentState)e.NewValue); |
||||||
|
} |
||||||
|
))); |
||||||
|
|
||||||
|
protected virtual void OnStateChanged(DockableContentState oldState, DockableContentState newState) |
||||||
|
{ |
||||||
|
RaiseStateChangedEvent(this); |
||||||
|
|
||||||
|
if (ContainerPane is DockablePane) |
||||||
|
((DockablePane)ContainerPane).UpdateCanAutohideProperty(); |
||||||
|
} |
||||||
|
|
||||||
|
public static readonly DependencyProperty StateProperty = |
||||||
|
StatePropertyKey.DependencyProperty; |
||||||
|
|
||||||
|
#region DockableStyle
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// DockableStyle Dependency Property
|
||||||
|
/// </summary>
|
||||||
|
public static readonly DependencyProperty DockableStyleProperty = |
||||||
|
DependencyProperty.Register("DockableStyle", typeof(DockableStyle), typeof(DockableContent), |
||||||
|
new FrameworkPropertyMetadata(DockableStyle.Dockable)); |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Get or sets a value that indicates how a dockable content can be dragged over and docked to a <see cref="DockingManager"/>
|
||||||
|
/// </summary>
|
||||||
|
public DockableStyle DockableStyle |
||||||
|
{ |
||||||
|
get { return (DockableStyle)GetValue(DockableStyleProperty); } |
||||||
|
set { SetValue(DockableStyleProperty, value); } |
||||||
|
} |
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
protected override void OnVisualParentChanged(DependencyObject oldParent) |
||||||
|
{ |
||||||
|
|
||||||
|
base.OnVisualParentChanged(oldParent); |
||||||
|
|
||||||
|
//if (oldParent == null && State == DockableContentState.None)
|
||||||
|
//{
|
||||||
|
// if (Parent is FloatingDockablePane)
|
||||||
|
// {
|
||||||
|
// throw new InvalidOperationException();
|
||||||
|
// }
|
||||||
|
|
||||||
|
// SetStateToDock();
|
||||||
|
//}
|
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region StateMachine
|
||||||
|
|
||||||
|
internal void SetStateToAutoHide() |
||||||
|
{ |
||||||
|
State = DockableContentState.AutoHide; |
||||||
|
} |
||||||
|
|
||||||
|
internal void SetStateToDock() |
||||||
|
{ |
||||||
|
State = DockableContentState.Docked; |
||||||
|
} |
||||||
|
|
||||||
|
internal void SetStateToDockableWindow() |
||||||
|
{ |
||||||
|
if (State == DockableContentState.DockableWindow) |
||||||
|
return; |
||||||
|
|
||||||
|
Debug.Assert( |
||||||
|
State == DockableContentState.None || |
||||||
|
State == DockableContentState.Document || |
||||||
|
State == DockableContentState.Docked || |
||||||
|
State == DockableContentState.FloatingWindow || |
||||||
|
State == DockableContentState.Hidden); |
||||||
|
|
||||||
|
State = DockableContentState.DockableWindow; |
||||||
|
} |
||||||
|
|
||||||
|
internal void SetStateToFloatingWindow() |
||||||
|
{ |
||||||
|
if (State == DockableContentState.FloatingWindow) |
||||||
|
return; |
||||||
|
|
||||||
|
Debug.Assert( |
||||||
|
State == DockableContentState.Document || |
||||||
|
State == DockableContentState.Docked || |
||||||
|
State == DockableContentState.DockableWindow); |
||||||
|
|
||||||
|
State = DockableContentState.FloatingWindow; |
||||||
|
} |
||||||
|
|
||||||
|
internal void SetStateToHidden() |
||||||
|
{ |
||||||
|
State = DockableContentState.Hidden; |
||||||
|
} |
||||||
|
|
||||||
|
internal void SetStateToDocument() |
||||||
|
{ |
||||||
|
State = DockableContentState.Document; |
||||||
|
} |
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region HideOnClose
|
||||||
|
public static DependencyProperty HideOnCloseKey = DependencyProperty.Register("HideOnClose", typeof(bool), typeof(DockableContent), new PropertyMetadata(true)); |
||||||
|
|
||||||
|
public bool HideOnClose |
||||||
|
{ |
||||||
|
get { return (bool)GetValue(HideOnCloseKey); } |
||||||
|
set { SetValue(HideOnCloseKey, value); } |
||||||
|
} |
||||||
|
#endregion
|
||||||
|
|
||||||
|
//#region OnIsActiveContentChanged (flyout windows)
|
||||||
|
//protected override void OnIsActiveContentChanged(DependencyPropertyChangedEventArgs e)
|
||||||
|
//{
|
||||||
|
// if (State == DockableContentState.AutoHide)
|
||||||
|
// Manager.ShowFlyoutWindow(this, null);
|
||||||
|
|
||||||
|
// base.OnIsActiveContentChanged(e);
|
||||||
|
//}
|
||||||
|
//#endregion
|
||||||
|
|
||||||
|
protected override void OnInitialized(EventArgs e) |
||||||
|
{ |
||||||
|
base.OnInitialized(e); |
||||||
|
|
||||||
|
this.CommandBindings.Add( |
||||||
|
new CommandBinding(DockableContentCommands.FloatingWindow, this.OnExecuteCommand, this.OnCanExecuteCommand)); |
||||||
|
this.CommandBindings.Add( |
||||||
|
new CommandBinding(DockableContentCommands.DockableFloatingWindow, this.OnExecuteCommand, this.OnCanExecuteCommand)); |
||||||
|
this.CommandBindings.Add( |
||||||
|
new CommandBinding(ManagedContentCommands.Show, this.OnExecuteCommand, this.OnCanExecuteCommand)); |
||||||
|
this.CommandBindings.Add( |
||||||
|
new CommandBinding(DockableContentCommands.ShowAsDocument, this.OnExecuteCommand, this.OnCanExecuteCommand)); |
||||||
|
this.CommandBindings.Add( |
||||||
|
new CommandBinding(DockableContentCommands.ToggleAutoHide, this.OnExecuteCommand, this.OnCanExecuteCommand)); |
||||||
|
this.CommandBindings.Add( |
||||||
|
new CommandBinding(ManagedContentCommands.Hide, this.OnExecuteCommand, this.OnCanExecuteCommand)); |
||||||
|
} |
||||||
|
|
||||||
|
#region Commands
|
||||||
|
|
||||||
|
void OnExecuteCommand(object sender, ExecutedRoutedEventArgs e) |
||||||
|
{ |
||||||
|
if (!e.Handled && |
||||||
|
e.Command == DockableContentCommands.ToggleAutoHide) |
||||||
|
{ |
||||||
|
ToggleAutoHide(); |
||||||
|
|
||||||
|
e.Handled = true; |
||||||
|
} |
||||||
|
else if (!e.Handled && e.Command == DockableContentCommands.FloatingWindow) |
||||||
|
{ |
||||||
|
ShowAsFloatingWindow(false); |
||||||
|
|
||||||
|
e.Handled = true; |
||||||
|
} |
||||||
|
else if (!e.Handled && e.Command == DockableContentCommands.DockableFloatingWindow) |
||||||
|
{ |
||||||
|
ShowAsFloatingWindow(true); |
||||||
|
|
||||||
|
e.Handled = true; |
||||||
|
} |
||||||
|
else if (!e.Handled && e.Command == DockableContentCommands.ShowAsDocument) |
||||||
|
{ |
||||||
|
ShowAsDocument(); |
||||||
|
e.Handled = true; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
void OnCanExecuteCommand(object sender, CanExecuteRoutedEventArgs e) |
||||||
|
{ |
||||||
|
e.CanExecute = CanExecuteCommand(e.Command); |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Show <see cref="DockableContent"/> as docked pane
|
||||||
|
/// </summary>
|
||||||
|
public override void Show() |
||||||
|
{ |
||||||
|
Show(Manager); |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Show <see cref="DockableContent"/> as docked pane within provided <see cref="DockingManager"/>
|
||||||
|
/// </summary>
|
||||||
|
public override void Show(DockingManager manager) |
||||||
|
{ |
||||||
|
if (SavedStateAndPosition != null && State == DockableContentState.Hidden) |
||||||
|
Show(manager, SavedStateAndPosition.Anchor); |
||||||
|
else |
||||||
|
Show(manager, AnchorStyle.None); |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Show <see cref="DockableContent"/> as docked pane
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="desideredAnchor">Desidered anchor position</param>
|
||||||
|
public void Show(AnchorStyle desideredAnchor) |
||||||
|
{ |
||||||
|
Show(Manager, desideredAnchor); |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Show <see cref="DockableContent"/> as docked pane
|
||||||
|
/// </summary>
|
||||||
|
public void Show(DockingManager manager, AnchorStyle desideredAnchor) |
||||||
|
{ |
||||||
|
if (Manager != null && Manager != manager) |
||||||
|
throw new InvalidOperationException("Please remove the content from previous DockingManager (using the Close method)"); |
||||||
|
|
||||||
|
if (manager == null && !CanExecuteCommand(ManagedContentCommands.Show)) |
||||||
|
throw new InvalidOperationException("This operation can be executed in this state"); |
||||||
|
|
||||||
|
if (State == DockableContentState.Docked) |
||||||
|
{ |
||||||
|
//if already shown as docked content just activate it
|
||||||
|
Activate(); |
||||||
|
} |
||||||
|
else |
||||||
|
{ |
||||||
|
if (SavedStateAndPosition != null && State == DockableContentState.Hidden) |
||||||
|
manager.Show(this, SavedStateAndPosition.State, desideredAnchor); |
||||||
|
else |
||||||
|
manager.Show(this, DockableContentState.Docked, desideredAnchor); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Show as <see cref="DockableContent"/> as a tabbed document
|
||||||
|
/// </summary>
|
||||||
|
public void ShowAsDocument() |
||||||
|
{ |
||||||
|
ShowAsDocument(Manager); |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Show as <see cref="DockableContent"/> as a tabbed document under the provided <see cref="DockingManager"/>
|
||||||
|
/// </summary>
|
||||||
|
public void ShowAsDocument(DockingManager manager) |
||||||
|
{ |
||||||
|
if (Manager != null && Manager != manager) |
||||||
|
throw new InvalidOperationException("Please remove the content from previous DockingManager (using the Close method)"); |
||||||
|
|
||||||
|
//Manager = manager;
|
||||||
|
|
||||||
|
if (manager == null && !CanExecuteCommand(DockableContentCommands.ShowAsDocument)) |
||||||
|
throw new InvalidOperationException("This operation can be executed in this state"); |
||||||
|
|
||||||
|
manager.Show(this, DockableContentState.Document); |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Show the content as floating window inside the provided <see cref="DockingManager"/>
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="dockableWindow">True if the resulting floating window can the be re-docked to the docking manager.</param>
|
||||||
|
public void ShowAsFloatingWindow(bool dockableWindow) |
||||||
|
{ |
||||||
|
ShowAsFloatingWindow(Manager, dockableWindow); |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Show the content ad floating window
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="dockableWindow">True if the resulting floating window can the be re-docked to the docking manager.</param>
|
||||||
|
public void ShowAsFloatingWindow(DockingManager manager, bool dockableWindow) |
||||||
|
{ |
||||||
|
if (Manager != null && Manager != manager) |
||||||
|
throw new InvalidOperationException("Please remove the content from previous DockingManager (using the Close method)"); |
||||||
|
|
||||||
|
//Manager = manager;
|
||||||
|
|
||||||
|
if (manager == null) |
||||||
|
{ |
||||||
|
if (dockableWindow && |
||||||
|
!CanExecuteCommand(DockableContentCommands.DockableFloatingWindow)) |
||||||
|
throw new InvalidOperationException("This operation can be executed in this state"); |
||||||
|
if (!dockableWindow && |
||||||
|
!CanExecuteCommand(DockableContentCommands.FloatingWindow)) |
||||||
|
throw new InvalidOperationException("This operation can be executed in this state"); |
||||||
|
} |
||||||
|
|
||||||
|
manager.Show(this, dockableWindow ? DockableContentState.DockableWindow : DockableContentState.FloatingWindow); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Hides this content
|
||||||
|
/// </summary>
|
||||||
|
public override bool Hide() |
||||||
|
{ |
||||||
|
if (!CanExecuteCommand(ManagedContentCommands.Hide)) |
||||||
|
return false; |
||||||
|
|
||||||
|
Manager.Hide(this); |
||||||
|
return true; |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Close content
|
||||||
|
/// </summary>
|
||||||
|
public override bool Close() |
||||||
|
{ |
||||||
|
return CloseOrHide(); |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Close content
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="forceClose">If true forces the content closing regardless of the <see cref="HideOnClose"/> property.</param>
|
||||||
|
public bool Close(bool forceClose) |
||||||
|
{ |
||||||
|
return CloseOrHide(true); |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Closes or hides provided content depending on HideOnClose property
|
||||||
|
/// </summary>
|
||||||
|
internal virtual bool CloseOrHide() |
||||||
|
{ |
||||||
|
return CloseOrHide(false); |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Closes or hides content depending on HideOnClose property
|
||||||
|
/// </summary>
|
||||||
|
internal virtual bool CloseOrHide(bool force) |
||||||
|
{ |
||||||
|
if (!force && |
||||||
|
!IsCloseable) |
||||||
|
return false; |
||||||
|
|
||||||
|
if (HideOnClose) |
||||||
|
{ |
||||||
|
Hide(); |
||||||
|
return true; |
||||||
|
} |
||||||
|
else |
||||||
|
{ |
||||||
|
if (!CanExecuteCommand(ManagedContentCommands.Close)) |
||||||
|
throw new InvalidOperationException("This operation can be executed in this state"); |
||||||
|
|
||||||
|
CancelEventArgs e = new CancelEventArgs(false); |
||||||
|
OnClosing(e); |
||||||
|
|
||||||
|
if (e.Cancel) |
||||||
|
return false; |
||||||
|
|
||||||
|
DockingManager oldManager = Manager; |
||||||
|
|
||||||
|
if (e.Cancel) |
||||||
|
return false; |
||||||
|
|
||||||
|
((DockablePane)ContainerPane).RemoveContent( |
||||||
|
ContainerPane.Items.IndexOf(this)); |
||||||
|
|
||||||
|
OnClosed(); |
||||||
|
return true; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Slides out this content to a border of the containing docking manager
|
||||||
|
/// </summary>
|
||||||
|
public void ToggleAutoHide() |
||||||
|
{ |
||||||
|
if (!CanExecuteCommand(DockableContentCommands.ToggleAutoHide)) |
||||||
|
throw new InvalidOperationException("This operation can be executed in this state"); |
||||||
|
|
||||||
|
(ContainerPane as DockablePane).ToggleAutoHide(); |
||||||
|
} |
||||||
|
|
||||||
|
public override void Activate() |
||||||
|
{ |
||||||
|
if (State == DockableContentState.AutoHide) |
||||||
|
{ |
||||||
|
if (Manager != null && this.IsLoaded) |
||||||
|
{ |
||||||
|
Manager.ShowFlyoutWindow(this, null); |
||||||
|
} |
||||||
|
} |
||||||
|
else if (State == DockableContentState.Document) |
||||||
|
{ |
||||||
|
if (!DocumentTabPanel.GetIsHeaderVisible(this)) |
||||||
|
{ |
||||||
|
DocumentPane parentPane = this.ContainerPane as DocumentPane; |
||||||
|
if (parentPane != null && |
||||||
|
parentPane.GetManager() != null && |
||||||
|
parentPane.Items.IndexOf(this) != 0) |
||||||
|
{ |
||||||
|
parentPane.Items.Remove(this); |
||||||
|
parentPane.Items.Insert(0, this); |
||||||
|
parentPane.SelectedIndex = 0; |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
base.Activate(); |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Retrive a value indicating if the command can be executed based to the dockable content state
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="command"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
protected override bool CanExecuteCommand(ICommand command) |
||||||
|
{ |
||||||
|
//if (State == DockableContentState.None)
|
||||||
|
// return false;
|
||||||
|
|
||||||
|
if (command == ManagedContentCommands.Hide) |
||||||
|
{ |
||||||
|
if (State == DockableContentState.Hidden) |
||||||
|
{ |
||||||
|
return false; |
||||||
|
} |
||||||
|
} |
||||||
|
else if (command == DockableContentCommands.ShowAsDocument) |
||||||
|
{ |
||||||
|
if (State == DockableContentState.Document) |
||||||
|
{ |
||||||
|
return false; |
||||||
|
} |
||||||
|
} |
||||||
|
else if (command == DockableContentCommands.FloatingWindow) |
||||||
|
{ |
||||||
|
if (State == DockableContentState.FloatingWindow || |
||||||
|
State == DockableContentState.DockableWindow) |
||||||
|
{ |
||||||
|
return false; |
||||||
|
} |
||||||
|
} |
||||||
|
else if (command == DockableContentCommands.ToggleAutoHide) |
||||||
|
{ |
||||||
|
if (State == DockableContentState.AutoHide || |
||||||
|
State == DockableContentState.Document || |
||||||
|
State == DockableContentState.FloatingWindow || |
||||||
|
State == DockableContentState.DockableWindow) |
||||||
|
{ |
||||||
|
return false; |
||||||
|
} |
||||||
|
} |
||||||
|
else if (command == DockableContentCommands.ShowAsDocument) |
||||||
|
{ |
||||||
|
if (State == DockableContentState.Document) |
||||||
|
{ |
||||||
|
return false; |
||||||
|
} |
||||||
|
} |
||||||
|
else if (command == DockableContentCommands.DockableFloatingWindow) |
||||||
|
{ |
||||||
|
if (State == DockableContentState.FloatingWindow || |
||||||
|
State == DockableContentState.DockableWindow) |
||||||
|
{ |
||||||
|
return false; |
||||||
|
} |
||||||
|
} |
||||||
|
else if (command == ManagedContentCommands.Show) |
||||||
|
{ |
||||||
|
if (State == DockableContentState.Docked) |
||||||
|
{ |
||||||
|
return false; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
return base.CanExecuteCommand(command); |
||||||
|
} |
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Operations on content
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
DockableContentStateAndPosition _savedStateAndPosition = null; |
||||||
|
|
||||||
|
internal DockableContentStateAndPosition SavedStateAndPosition |
||||||
|
{ |
||||||
|
get { return _savedStateAndPosition; } |
||||||
|
set { _savedStateAndPosition = value; } |
||||||
|
} |
||||||
|
|
||||||
|
internal void SaveCurrentStateAndPosition() |
||||||
|
{ |
||||||
|
SavedStateAndPosition = new DockableContentStateAndPosition( |
||||||
|
this); |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Reset internal state and position of the content
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>After a <see cref="DockableContent"/> is hidden AvalonDock save its state and position in order to
|
||||||
|
/// restore it correctly when user wants to reshow it calling <see cref="DockingManager.Show"/> function. Call this method
|
||||||
|
/// if you want to reset these data and provide your state and anchor style calling one of the overloads of the function
|
||||||
|
/// <see cref="DockingManager.Show"/>.</remarks>
|
||||||
|
public void ResetSavedStateAndPosition() |
||||||
|
{ |
||||||
|
SavedStateAndPosition = null; |
||||||
|
} |
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Save/Restore Content Layout
|
||||||
|
/// <summary>
|
||||||
|
/// Save content specific layout settings
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="storeWriter">Backend store writer</param>
|
||||||
|
/// <remarks>Custom derived class can overloads this method to handle custom layout persistence.</remarks>
|
||||||
|
public override void SaveLayout(XmlWriter storeWriter) |
||||||
|
{ |
||||||
|
if (!FloatingWindowSize.IsEmpty) |
||||||
|
{ |
||||||
|
storeWriter.WriteAttributeString( |
||||||
|
"FloatingWindowSize", new SizeConverter().ConvertToInvariantString(FloatingWindowSize)); |
||||||
|
} |
||||||
|
|
||||||
|
if (SavedStateAndPosition != null) |
||||||
|
{ |
||||||
|
storeWriter.WriteAttributeString( |
||||||
|
"ChildIndex", SavedStateAndPosition.ChildIndex.ToString()); |
||||||
|
storeWriter.WriteAttributeString( |
||||||
|
"Width", SavedStateAndPosition.Width.ToString()); |
||||||
|
storeWriter.WriteAttributeString( |
||||||
|
"Height", SavedStateAndPosition.Height.ToString()); |
||||||
|
storeWriter.WriteAttributeString( |
||||||
|
"Anchor", SavedStateAndPosition.Anchor.ToString()); |
||||||
|
storeWriter.WriteAttributeString( |
||||||
|
"State", SavedStateAndPosition.State.ToString()); |
||||||
|
|
||||||
|
if (SavedStateAndPosition.ContainerPane is DockablePane) |
||||||
|
{ |
||||||
|
Guid idToSave = (SavedStateAndPosition.ContainerPane as DockablePane).ID; |
||||||
|
storeWriter.WriteAttributeString( |
||||||
|
"ContainerPaneID", idToSave.ToString()); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Restore content specific layout settings
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="storeReader">Saved xml element containg content layout settings</param>
|
||||||
|
/// <remarks>Custom derived class must overload this method to restore custom layout settings previously saved trought <see cref="SaveLayout"/>.</remarks>
|
||||||
|
public override void RestoreLayout(XmlElement contentElement) |
||||||
|
{ |
||||||
|
if (contentElement.HasAttribute("FloatingWindowSize")) |
||||||
|
FloatingWindowSize = (Size)(new SizeConverter()).ConvertFromInvariantString(contentElement.GetAttribute("FloatingWindowSize")); |
||||||
|
|
||||||
|
Size effectiveSize = new Size(0d, 0d); |
||||||
|
if (contentElement.HasAttribute("EffectiveSize")) |
||||||
|
{ |
||||||
|
// Store
|
||||||
|
effectiveSize = (Size)(new SizeConverter()).ConvertFromInvariantString(contentElement.GetAttribute("EffectiveSize")); |
||||||
|
} |
||||||
|
|
||||||
|
ResizingPanel.SetEffectiveSize(this, effectiveSize); |
||||||
|
|
||||||
|
if (contentElement.HasAttribute("ChildIndex")) |
||||||
|
{ |
||||||
|
Pane paneRef = null; |
||||||
|
Guid containerPaneGuid = Guid.Empty; |
||||||
|
if (contentElement.HasAttribute("ContainerPaneID")) |
||||||
|
{ |
||||||
|
containerPaneGuid = Guid.Parse(contentElement.GetAttribute("ContainerPaneID")); |
||||||
|
|
||||||
|
if (Manager != null) |
||||||
|
{ |
||||||
|
ILinqToTree<DependencyObject> itemFound = new LogicalTreeAdapter(Manager).Descendants().FirstOrDefault(el => el.Item is DockablePane && ((el.Item as DockablePane).ID == containerPaneGuid)); |
||||||
|
paneRef = itemFound != null ? itemFound.Item as DockablePane : null; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
if (paneRef != null) |
||||||
|
{ |
||||||
|
_savedStateAndPosition = new DockableContentStateAndPosition( |
||||||
|
paneRef, |
||||||
|
int.Parse(contentElement.GetAttribute("ChildIndex")), |
||||||
|
double.Parse(contentElement.GetAttribute("Width")), |
||||||
|
double.Parse(contentElement.GetAttribute("Height")), |
||||||
|
(AnchorStyle)Enum.Parse(typeof(AnchorStyle), contentElement.GetAttribute("Anchor")), |
||||||
|
(DockableContentState)Enum.Parse(typeof(DockableContentState), contentElement.GetAttribute("State"))); |
||||||
|
} |
||||||
|
else |
||||||
|
{ |
||||||
|
_savedStateAndPosition = new DockableContentStateAndPosition( |
||||||
|
containerPaneGuid, |
||||||
|
int.Parse(contentElement.GetAttribute("ChildIndex")), |
||||||
|
double.Parse(contentElement.GetAttribute("Width")), |
||||||
|
double.Parse(contentElement.GetAttribute("Height")), |
||||||
|
(AnchorStyle)Enum.Parse(typeof(AnchorStyle), contentElement.GetAttribute("Anchor")), |
||||||
|
(DockableContentState)Enum.Parse(typeof(DockableContentState), contentElement.GetAttribute("State"))); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
#endregion
|
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,128 @@ |
|||||||
|
//Copyright (c) 2007-2010, Adolfo Marinucci
|
||||||
|
//All rights reserved.
|
||||||
|
|
||||||
|
//Redistribution and use in source and binary forms, with or without modification,
|
||||||
|
//are permitted provided that the following conditions are met:
|
||||||
|
//
|
||||||
|
//* Redistributions of source code must retain the above copyright notice,
|
||||||
|
// this list of conditions and the following disclaimer.
|
||||||
|
//* Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
// this list of conditions and the following disclaimer in the documentation
|
||||||
|
// and/or other materials provided with the distribution.
|
||||||
|
//* Neither the name of Adolfo Marinucci nor the names of its contributors may
|
||||||
|
// be used to endorse or promote products derived from this software without
|
||||||
|
// specific prior written permission.
|
||||||
|
//
|
||||||
|
//THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||||
|
//AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
//WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||||
|
//IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||||
|
//INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||||
|
//PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||||
|
//HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||||
|
//OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
||||||
|
//EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
|
using System; |
||||||
|
using System.Collections.Generic; |
||||||
|
using System.Linq; |
||||||
|
using System.Text; |
||||||
|
using System.Windows.Input; |
||||||
|
|
||||||
|
namespace AvalonDock |
||||||
|
{ |
||||||
|
/// <summary>
|
||||||
|
/// Defines commands that can be executed against a DockableContent
|
||||||
|
/// </summary>
|
||||||
|
public sealed class DockableContentCommands |
||||||
|
{ |
||||||
|
static object syncRoot = new object(); |
||||||
|
|
||||||
|
private static RoutedUICommand documentCommand = null; |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Shows the DockableContent as a tabbed document
|
||||||
|
/// </summary>
|
||||||
|
public static RoutedUICommand ShowAsDocument |
||||||
|
{ |
||||||
|
get |
||||||
|
{ |
||||||
|
lock (syncRoot) |
||||||
|
{ |
||||||
|
if (null == documentCommand) |
||||||
|
{ |
||||||
|
documentCommand = new RoutedUICommand(AvalonDock.Properties.Resources.DockableContentCommands_ShowAsDocument, "Document", typeof(DockableContentCommands)); |
||||||
|
} |
||||||
|
} |
||||||
|
return documentCommand; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
private static RoutedUICommand floatingWindowCommand = null; |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Shows the <see cref="DockableContent"/> as a <see cref="FloatingWindow"/> which overlays the <see cref="DockingManager"/>
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>A floating window can't be redocked to the docking manager.</remarks>
|
||||||
|
public static RoutedUICommand FloatingWindow |
||||||
|
{ |
||||||
|
get |
||||||
|
{ |
||||||
|
lock (syncRoot) |
||||||
|
{ |
||||||
|
if (null == floatingWindowCommand) |
||||||
|
{ |
||||||
|
floatingWindowCommand = new RoutedUICommand(AvalonDock.Properties.Resources.DockableContentCommands_FloatingWindow, "FloatingWindow", typeof(DockableContentCommands)); |
||||||
|
} |
||||||
|
} |
||||||
|
return floatingWindowCommand; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
private static RoutedUICommand dockableWindowCommand = null; |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Shows the <see cref="DockableContent"/> as a <see cref="DockableFloatingWindow"/> which overlays the <see cref="DockingManager"/>
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>A floating window can't be redocked to the docking manager.</remarks>
|
||||||
|
public static RoutedUICommand DockableFloatingWindow |
||||||
|
{ |
||||||
|
get |
||||||
|
{ |
||||||
|
lock (syncRoot) |
||||||
|
{ |
||||||
|
if (null == dockableWindowCommand) |
||||||
|
{ |
||||||
|
dockableWindowCommand = new RoutedUICommand(AvalonDock.Properties.Resources.DockableContentCommands_DockableFloatingWindow, "DockableFloatingWindow", typeof(DockableContentCommands)); |
||||||
|
} |
||||||
|
} |
||||||
|
return dockableWindowCommand; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
private static RoutedUICommand autoHideCommand = null; |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Switch the state of a <see cref="DockableContent"/> from <see cref="DockableContentState.AutoHidden"/> to <see cref="DockableContentState.Docked"/> and viceversa
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>This command has the same effect as applying command <see cref="DockablePaneCommands.ToggleAutoHide"/> to container pane
|
||||||
|
public static RoutedUICommand ToggleAutoHide |
||||||
|
{ |
||||||
|
get |
||||||
|
{ |
||||||
|
lock (syncRoot) |
||||||
|
{ |
||||||
|
if (null == autoHideCommand) |
||||||
|
{ |
||||||
|
autoHideCommand = new RoutedUICommand(AvalonDock.Properties.Resources.DockableContentCommands_ToggleAutoHide, "AutoHide", typeof(DockableContentCommands)); |
||||||
|
} |
||||||
|
} |
||||||
|
return autoHideCommand; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,303 @@ |
|||||||
|
//Copyright (c) 2007-2010, Adolfo Marinucci
|
||||||
|
//All rights reserved.
|
||||||
|
|
||||||
|
//Redistribution and use in source and binary forms, with or without modification,
|
||||||
|
//are permitted provided that the following conditions are met:
|
||||||
|
//
|
||||||
|
//* Redistributions of source code must retain the above copyright notice,
|
||||||
|
// this list of conditions and the following disclaimer.
|
||||||
|
//* Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
// this list of conditions and the following disclaimer in the documentation
|
||||||
|
// and/or other materials provided with the distribution.
|
||||||
|
//* Neither the name of Adolfo Marinucci nor the names of its contributors may
|
||||||
|
// be used to endorse or promote products derived from this software without
|
||||||
|
// specific prior written permission.
|
||||||
|
//
|
||||||
|
//THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||||
|
//AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
//WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||||
|
//IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||||
|
//INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||||
|
//PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||||
|
//HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||||
|
//OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
||||||
|
//EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
|
using System; |
||||||
|
using System.Collections.Generic; |
||||||
|
using System.Text; |
||||||
|
using System.Windows; |
||||||
|
using System.Windows.Controls; |
||||||
|
using System.Windows.Controls.Primitives; |
||||||
|
using System.Windows.Data; |
||||||
|
using System.Windows.Documents; |
||||||
|
using System.Windows.Input; |
||||||
|
using System.Windows.Media; |
||||||
|
using System.Windows.Media.Imaging; |
||||||
|
using System.Windows.Shapes; |
||||||
|
using System.ComponentModel; |
||||||
|
using System.Windows.Markup; |
||||||
|
using System.Diagnostics; |
||||||
|
using System.Windows.Threading; |
||||||
|
using System.Windows.Media.Animation; |
||||||
|
using System.Windows.Interop; |
||||||
|
using System.Linq; |
||||||
|
|
||||||
|
namespace AvalonDock |
||||||
|
{ |
||||||
|
public class DockableFloatingWindow : FloatingWindow |
||||||
|
{ |
||||||
|
static DockableFloatingWindow() |
||||||
|
{ |
||||||
|
//This OverrideMetadata call tells the system that this element wants to provide a style that is different than its base class.
|
||||||
|
//This style is defined in themes\generic.xaml
|
||||||
|
DefaultStyleKeyProperty.OverrideMetadata(typeof(DockableFloatingWindow), new FrameworkPropertyMetadata(typeof(DockableFloatingWindow))); |
||||||
|
|
||||||
|
ContentControl.ContentProperty.OverrideMetadata(typeof(DockableFloatingWindow), |
||||||
|
new FrameworkPropertyMetadata( |
||||||
|
new PropertyChangedCallback(OnContentPropertyChanged), |
||||||
|
new CoerceValueCallback(OnCoerceValueContentProperty))); |
||||||
|
} |
||||||
|
|
||||||
|
//Pane _previousPane = null;
|
||||||
|
|
||||||
|
//int _arrayIndexPreviousPane = -1;
|
||||||
|
|
||||||
|
|
||||||
|
internal DockableFloatingWindow(DockingManager manager) |
||||||
|
: base(manager) |
||||||
|
{ |
||||||
|
if (manager == null) |
||||||
|
throw new ArgumentNullException("manager"); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
//protected override void OnClosed(EventArgs e)
|
||||||
|
//{
|
||||||
|
// base.OnClosed(e);
|
||||||
|
|
||||||
|
// DockableContent[] cntsToClose = new DockableContent[HostedPane.Items.Count];
|
||||||
|
// HostedPane.Items.CopyTo(cntsToClose, 0);
|
||||||
|
|
||||||
|
// foreach (DockableContent cntToClose in cntsToClose)
|
||||||
|
// {
|
||||||
|
// //HostedPane.CloseOrHide(HostedPane.Items[0] as DockableContent, ForcedClosing);
|
||||||
|
// cntToClose.CloseOrHide(ForcedClosing);
|
||||||
|
// }
|
||||||
|
|
||||||
|
// Manager.UnregisterFloatingWindow(this);
|
||||||
|
//}
|
||||||
|
|
||||||
|
public override Pane ClonePane() |
||||||
|
{ |
||||||
|
DockablePane paneToAnchor = new DockablePane(); |
||||||
|
|
||||||
|
ResizingPanel.SetEffectiveSize(paneToAnchor, new Size(Width, Height)); |
||||||
|
|
||||||
|
//if (HostedPane.Style != null)
|
||||||
|
// paneToAnchor.Style = HostedPane.Style;
|
||||||
|
|
||||||
|
int selectedIndex = HostedPane.SelectedIndex; |
||||||
|
|
||||||
|
//transfer contents from hosted pane in the floating window and
|
||||||
|
//the new created dockable pane
|
||||||
|
while (HostedPane.Items.Count > 0) |
||||||
|
{ |
||||||
|
paneToAnchor.Items.Add( |
||||||
|
HostedPane.RemoveContent(0)); |
||||||
|
} |
||||||
|
|
||||||
|
paneToAnchor.SelectedIndex = selectedIndex; |
||||||
|
|
||||||
|
return paneToAnchor; |
||||||
|
} |
||||||
|
|
||||||
|
#region IsDockableWindow
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// IsDockableWindow Dependency Property
|
||||||
|
/// </summary>
|
||||||
|
public static readonly DependencyProperty IsDockableWindowProperty = |
||||||
|
DependencyProperty.Register("IsDockableWindow", typeof(bool), typeof(DockableFloatingWindow), |
||||||
|
new FrameworkPropertyMetadata(true, |
||||||
|
new PropertyChangedCallback(OnIsDockableWindowChanged))); |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the IsDockableWindow property. This dependency property
|
||||||
|
/// indicates that <see cref="FloatingWindow"/> can be docked to <see cref="DockingManager"/>.
|
||||||
|
/// </summary>
|
||||||
|
public bool IsDockableWindow |
||||||
|
{ |
||||||
|
get { return (bool)GetValue(IsDockableWindowProperty); } |
||||||
|
set { SetValue(IsDockableWindowProperty, value); } |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Handles changes to the IsDockableWindow property.
|
||||||
|
/// </summary>
|
||||||
|
private static void OnIsDockableWindowChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) |
||||||
|
{ |
||||||
|
((DockableFloatingWindow)d).OnIsDockableWindowChanged(e); |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Provides derived classes an opportunity to handle changes to the IsDockableWindow property.
|
||||||
|
/// </summary>
|
||||||
|
protected virtual void OnIsDockableWindowChanged(DependencyPropertyChangedEventArgs e) |
||||||
|
{ |
||||||
|
if ((bool)e.NewValue) |
||||||
|
{ |
||||||
|
foreach (DockableContent content in HostedPane.Items) |
||||||
|
content.SetStateToDockableWindow(); |
||||||
|
} |
||||||
|
else |
||||||
|
{ |
||||||
|
foreach (DockableContent content in HostedPane.Items) |
||||||
|
content.SetStateToFloatingWindow(); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Commands
|
||||||
|
|
||||||
|
protected virtual void OnExecuteCommand(object sender, ExecutedRoutedEventArgs e) |
||||||
|
{ |
||||||
|
if (e.Command == DockableFloatingWindowCommands.SetAsDockableWindow) |
||||||
|
{ |
||||||
|
IsDockableWindow = true; |
||||||
|
e.Handled = true; |
||||||
|
} |
||||||
|
else if (e.Command == DockableFloatingWindowCommands.SetAsFloatingWindow) |
||||||
|
{ |
||||||
|
IsDockableWindow = false; |
||||||
|
e.Handled = true; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
protected virtual void OnCanExecuteCommand(object sender, CanExecuteRoutedEventArgs e) |
||||||
|
{ |
||||||
|
if (e.Command == DockableFloatingWindowCommands.SetAsDockableWindow) |
||||||
|
e.CanExecute = !IsDockableWindow; |
||||||
|
else if (e.Command == DockableFloatingWindowCommands.SetAsFloatingWindow) |
||||||
|
e.CanExecute = IsDockableWindow; |
||||||
|
} |
||||||
|
#endregion
|
||||||
|
|
||||||
|
protected override void OnInitialized(EventArgs e) |
||||||
|
{ |
||||||
|
this.CommandBindings.Add(new CommandBinding(DockableFloatingWindowCommands.SetAsDockableWindow, OnExecuteCommand, OnCanExecuteCommand)); |
||||||
|
this.CommandBindings.Add(new CommandBinding(DockableFloatingWindowCommands.SetAsFloatingWindow, OnExecuteCommand, OnCanExecuteCommand)); |
||||||
|
|
||||||
|
base.OnInitialized(e); |
||||||
|
} |
||||||
|
|
||||||
|
protected override bool OpenContextMenu(UIElement popupButton, Point ptMouse) |
||||||
|
{ |
||||||
|
ContextMenu cxMenu = FindResource(new ComponentResourceKey(typeof(DockingManager), |
||||||
|
ContextMenuElement.DockableFloatingWindow)) as ContextMenu; |
||||||
|
if (cxMenu != null) |
||||||
|
{ |
||||||
|
foreach (var menuItem in cxMenu.Items.OfType<MenuItem>()) |
||||||
|
menuItem.CommandTarget = HostedPane.SelectedItem as IInputElement; |
||||||
|
|
||||||
|
if (popupButton != null) |
||||||
|
{ |
||||||
|
cxMenu.Placement = PlacementMode.Bottom; |
||||||
|
cxMenu.PlacementTarget = popupButton; |
||||||
|
} |
||||||
|
else |
||||||
|
{ |
||||||
|
cxMenu.Placement = PlacementMode.Bottom; |
||||||
|
cxMenu.PlacementRectangle = new Rect(ptMouse, new Size(0, 0)); |
||||||
|
} |
||||||
|
cxMenu.IsOpen = true; |
||||||
|
|
||||||
|
return true; |
||||||
|
} |
||||||
|
|
||||||
|
return base.OpenContextMenu(popupButton, ptMouse); |
||||||
|
} |
||||||
|
|
||||||
|
protected override void FilterMessage(object sender, FilterMessageEventArgs e) |
||||||
|
{ |
||||||
|
e.Handled = false; |
||||||
|
|
||||||
|
if (Manager == null) |
||||||
|
return; |
||||||
|
|
||||||
|
switch (e.Msg) |
||||||
|
{ |
||||||
|
case WM_NCLBUTTONDOWN: //Left button down on title -> start dragging over docking manager
|
||||||
|
if (IsDockableWindow && e.WParam.ToInt32() == HTCAPTION) |
||||||
|
{ |
||||||
|
short x = (short)((e.LParam.ToInt32() & 0xFFFF)); |
||||||
|
short y = (short)((e.LParam.ToInt32() >> 16)); |
||||||
|
|
||||||
|
Point clickPoint = this.TransformToDeviceDPI(new Point(x, y)); |
||||||
|
Manager.Drag(this, clickPoint, new Point(clickPoint.X - Left, clickPoint.Y - Top)); |
||||||
|
|
||||||
|
e.Handled = true; |
||||||
|
} |
||||||
|
break; |
||||||
|
case WM_NCLBUTTONDBLCLK: //Left Button Double Click -> dock to docking manager
|
||||||
|
if (IsDockableWindow && e.WParam.ToInt32() == HTCAPTION) |
||||||
|
{ |
||||||
|
if (IsDockableWindow) |
||||||
|
{ |
||||||
|
Dock(); |
||||||
|
e.Handled = true; |
||||||
|
} |
||||||
|
} |
||||||
|
break; |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
base.FilterMessage(sender, e); |
||||||
|
} |
||||||
|
|
||||||
|
static void OnContentPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) |
||||||
|
{ |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
static object OnCoerceValueContentProperty(DependencyObject d, object baseValue) |
||||||
|
{ |
||||||
|
DockableFloatingWindow fl = ((DockableFloatingWindow)d); |
||||||
|
|
||||||
|
if (fl.Content != null) |
||||||
|
{ |
||||||
|
throw new InvalidOperationException("Content on floating windows can't be set more than one time."); |
||||||
|
} |
||||||
|
|
||||||
|
if (!(baseValue is DockableContent) && |
||||||
|
!(baseValue is DockablePane)) |
||||||
|
{ |
||||||
|
throw new InvalidOperationException("Content must be of type DockableContent or DockablePane"); |
||||||
|
} |
||||||
|
|
||||||
|
FloatingDockablePane paneToReturn = null; |
||||||
|
|
||||||
|
if (baseValue is DockableContent) |
||||||
|
paneToReturn = new FloatingDockablePane(fl, baseValue as DockableContent); |
||||||
|
else if (baseValue is DockablePane) |
||||||
|
paneToReturn = new FloatingDockablePane(fl, baseValue as DockablePane); |
||||||
|
|
||||||
|
return paneToReturn; |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
public override void Dock() |
||||||
|
{ |
||||||
|
var dockablePane = HostedPane as FloatingDockablePane; |
||||||
|
|
||||||
|
Debug.Assert(dockablePane != null); |
||||||
|
|
||||||
|
if (dockablePane != null) |
||||||
|
dockablePane.Dock(); |
||||||
|
|
||||||
|
base.Dock(); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,80 @@ |
|||||||
|
using System; |
||||||
|
using System.Collections.Generic; |
||||||
|
using System.Linq; |
||||||
|
using System.Text; |
||||||
|
using System.Windows.Input; |
||||||
|
|
||||||
|
namespace AvalonDock |
||||||
|
{ |
||||||
|
/// <summary>
|
||||||
|
/// Encapsulates the
|
||||||
|
/// </summary>
|
||||||
|
public sealed class DockableFloatingWindowCommands |
||||||
|
{ |
||||||
|
private static object syncRoot = new object(); |
||||||
|
|
||||||
|
private static RoutedUICommand dockableCommand = null; |
||||||
|
public static RoutedUICommand SetAsDockableWindow |
||||||
|
{ |
||||||
|
get |
||||||
|
{ |
||||||
|
lock (syncRoot) |
||||||
|
{ |
||||||
|
if (null == dockableCommand) |
||||||
|
{ |
||||||
|
dockableCommand = new RoutedUICommand(AvalonDock.Properties.Resources.DockableContentCommands_DockableFloatingWindow, "DockableWindow", typeof(DockableFloatingWindowCommands)); |
||||||
|
} |
||||||
|
} |
||||||
|
return dockableCommand; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
private static RoutedUICommand floatingCommand = null; |
||||||
|
public static RoutedUICommand SetAsFloatingWindow |
||||||
|
{ |
||||||
|
get |
||||||
|
{ |
||||||
|
lock (syncRoot) |
||||||
|
{ |
||||||
|
if (null == floatingCommand) |
||||||
|
{ |
||||||
|
floatingCommand = new RoutedUICommand(AvalonDock.Properties.Resources.DockableContentCommands_FloatingWindow, "FloatingWindow", typeof(DockableFloatingWindowCommands)); |
||||||
|
} |
||||||
|
} |
||||||
|
return floatingCommand; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
//private static RoutedUICommand closeCommand = null;
|
||||||
|
//public static RoutedUICommand Close
|
||||||
|
//{
|
||||||
|
// get
|
||||||
|
// {
|
||||||
|
// lock (syncRoot)
|
||||||
|
// {
|
||||||
|
// if (null == closeCommand)
|
||||||
|
// {
|
||||||
|
// closeCommand = new RoutedUICommand("Close", "Close", typeof(FloatingWindowCommands));
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// return closeCommand;
|
||||||
|
// }
|
||||||
|
//}
|
||||||
|
|
||||||
|
//private static RoutedUICommand dockCommand = null;
|
||||||
|
//public static RoutedUICommand Dock
|
||||||
|
//{
|
||||||
|
// get
|
||||||
|
// {
|
||||||
|
// lock (syncRoot)
|
||||||
|
// {
|
||||||
|
// if (null == dockCommand)
|
||||||
|
// {
|
||||||
|
// dockCommand = new RoutedUICommand("Dock", "Dock", typeof(FloatingWindowCommands));
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// return dockCommand;
|
||||||
|
// }
|
||||||
|
//}
|
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,610 @@ |
|||||||
|
//Copyright (c) 2007-2010, Adolfo Marinucci
|
||||||
|
//All rights reserved.
|
||||||
|
|
||||||
|
//Redistribution and use in source and binary forms, with or without modification,
|
||||||
|
//are permitted provided that the following conditions are met:
|
||||||
|
//
|
||||||
|
//* Redistributions of source code must retain the above copyright notice,
|
||||||
|
// this list of conditions and the following disclaimer.
|
||||||
|
//* Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
// this list of conditions and the following disclaimer in the documentation
|
||||||
|
// and/or other materials provided with the distribution.
|
||||||
|
//* Neither the name of Adolfo Marinucci nor the names of its contributors may
|
||||||
|
// be used to endorse or promote products derived from this software without
|
||||||
|
// specific prior written permission.
|
||||||
|
//
|
||||||
|
//THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||||
|
//AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
//WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||||
|
//IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||||
|
//INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||||
|
//PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||||
|
//HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||||
|
//OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
||||||
|
//EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
|
using System; |
||||||
|
using System.Collections.Generic; |
||||||
|
using System.Text; |
||||||
|
using System.Windows; |
||||||
|
using System.Windows.Controls; |
||||||
|
using System.Windows.Controls.Primitives; |
||||||
|
using System.Windows.Data; |
||||||
|
using System.Windows.Documents; |
||||||
|
using System.Windows.Input; |
||||||
|
using System.Windows.Media; |
||||||
|
using System.Windows.Media.Imaging; |
||||||
|
using System.Windows.Shapes; |
||||||
|
using System.Diagnostics; |
||||||
|
using System.ComponentModel; |
||||||
|
using System.Collections; |
||||||
|
using System.Linq; |
||||||
|
|
||||||
|
namespace AvalonDock |
||||||
|
{ |
||||||
|
/// <summary>
|
||||||
|
/// Anchor types
|
||||||
|
/// </summary>
|
||||||
|
public enum AnchorStyle |
||||||
|
{ |
||||||
|
/// <summary>
|
||||||
|
/// No anchor style, while content is hosted in a <see cref="DocumentPane"/> or a <see cref="FloatingWindow"/>
|
||||||
|
/// </summary>
|
||||||
|
None, |
||||||
|
/// <summary>
|
||||||
|
/// Top border anchor
|
||||||
|
/// </summary>
|
||||||
|
Top, |
||||||
|
/// <summary>
|
||||||
|
/// Left border anchor
|
||||||
|
/// </summary>
|
||||||
|
Left, |
||||||
|
/// <summary>
|
||||||
|
/// Bottom border anchor
|
||||||
|
/// </summary>
|
||||||
|
Bottom, |
||||||
|
/// <summary>
|
||||||
|
/// Right border anchor
|
||||||
|
/// </summary>
|
||||||
|
Right |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Defines a pane that can contain contents of type <see cref="DockableContent"/>
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>Usually a <see cref="DockablePane"/> is used to arrange a series of <see cref="DockableContent"/> in TabControl like model.
|
||||||
|
/// A DockablePane can be redocked to a border of the parent <see cref="DockingManager"/>, can be floated in an external window and can be autohidden.
|
||||||
|
/// When docked into a docking manager the <see cref="DockablePane.Anchor"/> property gives the border to which it's docked.
|
||||||
|
/// See <see cref="DockablePaneCommands"/> to get commands that are supported by DockablePane objects.</remarks>
|
||||||
|
/// <seealso cref="DockableContent"/>
|
||||||
|
/// <seealso cref="DockingManager"/>
|
||||||
|
public class DockablePane : Pane |
||||||
|
{ |
||||||
|
static DockablePane() |
||||||
|
{ |
||||||
|
//This OverrideMetadata call tells the system that this element wants to provide a style that is different than its base class.
|
||||||
|
//This style is defined in themes\generic.xaml
|
||||||
|
DefaultStyleKeyProperty.OverrideMetadata(typeof(DockablePane), new FrameworkPropertyMetadata(typeof(DockablePane))); |
||||||
|
} |
||||||
|
|
||||||
|
public DockablePane() |
||||||
|
{ |
||||||
|
this.Loaded += new RoutedEventHandler(DockablePane_Loaded); |
||||||
|
this.Unloaded += new RoutedEventHandler(DockablePane_Unloaded); |
||||||
|
|
||||||
|
KeyboardNavigation.SetTabNavigation(this, KeyboardNavigationMode.Cycle); |
||||||
|
} |
||||||
|
|
||||||
|
protected override void OnInitialized(EventArgs e) |
||||||
|
{ |
||||||
|
base.OnInitialized(e); |
||||||
|
|
||||||
|
this.CommandBindings.Add( |
||||||
|
new CommandBinding(DockablePaneCommands.ToggleAutoHide, this.OnExecuteCommand, this.OnCanExecuteCommand)); |
||||||
|
this.CommandBindings.Add( |
||||||
|
new CommandBinding(DockablePaneCommands.Close, this.OnExecuteCommand, this.OnCanExecuteCommand)); |
||||||
|
} |
||||||
|
|
||||||
|
protected override void OnItemsChanged(System.Collections.Specialized.NotifyCollectionChangedEventArgs e) |
||||||
|
{ |
||||||
|
if (e.NewItems != null) |
||||||
|
{ |
||||||
|
e.NewItems.Cast<DockableContent>().ForEach(c => |
||||||
|
{ |
||||||
|
if (c.State == DockableContentState.None) |
||||||
|
c.SetStateToDock(); |
||||||
|
}); |
||||||
|
} |
||||||
|
|
||||||
|
UpdateCanAutohideProperty(); |
||||||
|
base.OnItemsChanged(e); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
void DockablePane_Loaded(object sender, RoutedEventArgs e) |
||||||
|
{ |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
void DockablePane_Unloaded(object sender, RoutedEventArgs e) |
||||||
|
{ |
||||||
|
CloseOptionsMenu(); |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// This guid is saved with the dockable content so that can be restored in the case is
|
||||||
|
/// referenced by a dockable content
|
||||||
|
/// </summary>
|
||||||
|
internal Guid ID = Guid.NewGuid(); |
||||||
|
|
||||||
|
#region Dependency properties
|
||||||
|
|
||||||
|
public bool ShowTabs |
||||||
|
{ |
||||||
|
get { return (bool)GetValue(ShowTabsProperty); } |
||||||
|
set { SetValue(ShowTabsProperty, value); } |
||||||
|
} |
||||||
|
|
||||||
|
// Using a DependencyProperty as the backing store for ShowTabs. This enables animation, styling, binding, etc...
|
||||||
|
public static readonly DependencyProperty ShowTabsProperty = |
||||||
|
DependencyProperty.Register("ShowTabs", typeof(bool), typeof(DockablePane), new UIPropertyMetadata(true)); |
||||||
|
|
||||||
|
|
||||||
|
public AnchorStyle Anchor |
||||||
|
{ |
||||||
|
get { return (AnchorStyle)GetValue(AnchorPropertyKey.DependencyProperty); } |
||||||
|
internal set { SetValue(AnchorPropertyKey, value); } |
||||||
|
} |
||||||
|
|
||||||
|
// Using a DependencyProperty as the backing store for Anchor. This enables animation, styling, binding, etc...
|
||||||
|
public static readonly DependencyPropertyKey AnchorPropertyKey = |
||||||
|
DependencyProperty.RegisterAttachedReadOnly("Anchor", typeof(AnchorStyle), typeof(DockablePane), new UIPropertyMetadata(AnchorStyle.None)); |
||||||
|
|
||||||
|
|
||||||
|
public override void OnApplyTemplate() |
||||||
|
{ |
||||||
|
base.OnApplyTemplate(); |
||||||
|
|
||||||
|
if (_partHeader != null) |
||||||
|
{ |
||||||
|
_partHeader.MouseDown += new MouseButtonEventHandler(OnHeaderMouseDown); |
||||||
|
_partHeader.MouseMove += new MouseEventHandler(OnHeaderMouseMove); |
||||||
|
_partHeader.MouseUp += new MouseButtonEventHandler(OnHeaderMouseUp); |
||||||
|
_partHeader.MouseEnter += new MouseEventHandler(OnHeaderMouseEnter); |
||||||
|
_partHeader.MouseLeave += new MouseEventHandler(OnHeaderMouseLeave); |
||||||
|
|
||||||
|
_partHeader.MouseRightButtonDown += (s, e) => |
||||||
|
{ |
||||||
|
OpenOptionsMenu(null); e.Handled = true; |
||||||
|
}; |
||||||
|
} |
||||||
|
|
||||||
|
var optionsMenuPopupElement = GetTemplateChild("PART_ShowContextMenuButton") as Border; |
||||||
|
|
||||||
|
if (optionsMenuPopupElement != null) |
||||||
|
{ |
||||||
|
optionsMenuPopupElement.MouseLeftButtonDown += (s, e) => { OpenOptionsMenu(s as UIElement); e.Handled = true; }; |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
#region CanAutohide
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// CanAutohide Read-Only Dependency Property
|
||||||
|
/// </summary>
|
||||||
|
private static readonly DependencyPropertyKey CanAutohidePropertyKey |
||||||
|
= DependencyProperty.RegisterReadOnly("CanAutohide", typeof(bool), typeof(DockablePane), |
||||||
|
new FrameworkPropertyMetadata((bool)false)); |
||||||
|
|
||||||
|
public static readonly DependencyProperty CanAutohideProperty |
||||||
|
= CanAutohidePropertyKey.DependencyProperty; |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the CanAutohide property. This dependency property
|
||||||
|
/// indicates if contents inside pane can be autohidden.
|
||||||
|
/// </summary>
|
||||||
|
public bool CanAutohide |
||||||
|
{ |
||||||
|
get { return (bool)GetValue(CanAutohideProperty); } |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Provides a secure method for setting the CanAutohide property.
|
||||||
|
/// This dependency property indicates if contents inside pane can be autohidden.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="value">The new value for the property.</param>
|
||||||
|
protected void SetCanAutohide(bool value) |
||||||
|
{ |
||||||
|
SetValue(CanAutohidePropertyKey, value); |
||||||
|
} |
||||||
|
|
||||||
|
internal void UpdateCanAutohideProperty() |
||||||
|
{ |
||||||
|
SetCanAutohide( |
||||||
|
Items.Cast<DockableContent>().All(c => |
||||||
|
{ |
||||||
|
bool flag = c.State == DockableContentState.Docked || |
||||||
|
c.State == DockableContentState.Document || |
||||||
|
c.State == DockableContentState.AutoHide; |
||||||
|
|
||||||
|
flag = flag && ((c.DockableStyle & DockableStyle.AutoHide) > 0); |
||||||
|
#if DEBUG
|
||||||
|
Debug.WriteLine("{0} CanAutohide()= {1}", c.Title, flag); |
||||||
|
#endif
|
||||||
|
return flag; |
||||||
|
}) |
||||||
|
); |
||||||
|
} |
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
|
protected override bool IsSurfaceVisible |
||||||
|
{ |
||||||
|
get |
||||||
|
{ |
||||||
|
foreach (ManagedContent managedContent in Items) |
||||||
|
{ |
||||||
|
if (managedContent is DocumentContent) |
||||||
|
continue; |
||||||
|
|
||||||
|
if (((DockableContent)managedContent).State == DockableContentState.Docked || |
||||||
|
((DockableContent)managedContent).State == DockableContentState.None) |
||||||
|
return true; |
||||||
|
} |
||||||
|
|
||||||
|
return false; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
#region OptionsContextMenu
|
||||||
|
ContextMenu cxOptions = null; |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Open the option context menu
|
||||||
|
/// </summary>
|
||||||
|
public bool OpenOptionsMenu(UIElement menuTarget) |
||||||
|
{ |
||||||
|
if (cxOptions == null) |
||||||
|
{ |
||||||
|
Debug.Assert(cxOptions == null); |
||||||
|
cxOptions = TryFindResource(new ComponentResourceKey(typeof(DockingManager), ContextMenuElement.DockablePane)) as ContextMenu; |
||||||
|
if (cxOptions != null) |
||||||
|
{ |
||||||
|
cxOptions.Opened += (s, e) => IsOptionsMenuOpen = true; |
||||||
|
cxOptions.Closed += (s, e) => IsOptionsMenuOpen = false; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
if (cxOptions != null) |
||||||
|
{ |
||||||
|
cxOptions.DataContext = this.SelectedItem as DockableContent; |
||||||
|
|
||||||
|
foreach (MenuItem menuItem in cxOptions.Items.OfType<MenuItem>()) |
||||||
|
menuItem.CommandTarget = this.SelectedItem as DockableContent; |
||||||
|
|
||||||
|
if (menuTarget != null) |
||||||
|
{ |
||||||
|
cxOptions.Placement = PlacementMode.Bottom; |
||||||
|
cxOptions.PlacementTarget = menuTarget; |
||||||
|
} |
||||||
|
else |
||||||
|
{ |
||||||
|
cxOptions.Placement = PlacementMode.MousePoint; |
||||||
|
cxOptions.PlacementTarget = this; |
||||||
|
} |
||||||
|
|
||||||
|
FocusContent(); |
||||||
|
cxOptions.IsOpen = true; |
||||||
|
} |
||||||
|
|
||||||
|
return (cxOptions != null && cxOptions.IsOpen); |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Close the options context menu
|
||||||
|
/// </summary>
|
||||||
|
public void CloseOptionsMenu() |
||||||
|
{ |
||||||
|
if (cxOptions != null) |
||||||
|
{ |
||||||
|
cxOptions.IsOpen = false; |
||||||
|
cxOptions = null; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets a value indicating if the options context menu is open
|
||||||
|
/// </summary>
|
||||||
|
public bool IsOptionsMenuOpen |
||||||
|
{ |
||||||
|
get { return (bool)GetValue(IsOptionsMenuOpenProperty); } |
||||||
|
protected set { SetValue(IsOptionsMenuOpenPropertyKey, value); } |
||||||
|
} |
||||||
|
|
||||||
|
// Using a DependencyProperty as the backing store for IsOptionsMenuOpen. This enables animation, styling, binding, etc...
|
||||||
|
static readonly DependencyPropertyKey IsOptionsMenuOpenPropertyKey = |
||||||
|
DependencyProperty.RegisterReadOnly("IsOptionsMenuOpen", typeof(bool), typeof(DockablePane), new UIPropertyMetadata(false)); |
||||||
|
|
||||||
|
public static readonly DependencyProperty IsOptionsMenuOpenProperty = IsOptionsMenuOpenPropertyKey.DependencyProperty; |
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Mouse management
|
||||||
|
|
||||||
|
void FocusContent() |
||||||
|
{ |
||||||
|
ManagedContent selectedContent = SelectedItem as ManagedContent; |
||||||
|
if (selectedContent != null)// && selectedContent.Content is UIElement)
|
||||||
|
{ |
||||||
|
UIElement internalContent = selectedContent.Content as UIElement; |
||||||
|
bool res = Focus(); |
||||||
|
//Keyboard.Focus(internalContent);
|
||||||
|
selectedContent.Activate(); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
Point ptStartDrag; |
||||||
|
bool isMouseDown = false; |
||||||
|
protected virtual void OnHeaderMouseDown(object sender, MouseButtonEventArgs e) |
||||||
|
{ |
||||||
|
if (!e.Handled && SelectedItem != null) |
||||||
|
{ |
||||||
|
FocusContent(); |
||||||
|
|
||||||
|
if (((DockableContent)SelectedItem).State != DockableContentState.AutoHide) |
||||||
|
{ |
||||||
|
//ptStartDrag = e.MouseDevice.GetPosition(this);
|
||||||
|
ptStartDrag = e.GetPosition((IInputElement)System.Windows.Media.VisualTreeHelper.GetParent(this)); |
||||||
|
|
||||||
|
isMouseDown = true; |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
protected virtual void OnHeaderMouseMove(object sender, MouseEventArgs e) |
||||||
|
{ |
||||||
|
//Point ptMouseMove = e.GetPosition(this);
|
||||||
|
Point ptMouseMove = e.GetPosition((IInputElement)System.Windows.Media.VisualTreeHelper.GetParent(this)); |
||||||
|
|
||||||
|
|
||||||
|
if (!e.Handled && isMouseDown && e.LeftButton == MouseButtonState.Pressed) |
||||||
|
{ |
||||||
|
if (_partHeader != null && |
||||||
|
_partHeader.IsMouseOver) |
||||||
|
{ |
||||||
|
DockingManager manager = GetManager(); |
||||||
|
if (!manager.DragPaneServices.IsDragging && |
||||||
|
!IsMouseCaptured) |
||||||
|
{ |
||||||
|
if (Math.Abs(ptMouseMove.X - ptStartDrag.X) > SystemParameters.MinimumHorizontalDragDistance || |
||||||
|
Math.Abs(ptMouseMove.Y - ptStartDrag.Y) > SystemParameters.MinimumVerticalDragDistance) |
||||||
|
{ |
||||||
|
isMouseDown = false; |
||||||
|
ReleaseMouseCapture(); |
||||||
|
|
||||||
|
manager.Drag(this, this.PointToScreenDPI(e.GetPosition(this)), e.GetPosition(this)); |
||||||
|
e.Handled = true; |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
protected virtual void OnHeaderMouseUp(object sender, MouseButtonEventArgs e) |
||||||
|
{ |
||||||
|
isMouseDown = false; |
||||||
|
ReleaseMouseCapture(); |
||||||
|
} |
||||||
|
|
||||||
|
protected virtual void OnHeaderMouseEnter(object sender, MouseEventArgs e) |
||||||
|
{ |
||||||
|
isMouseDown = false; |
||||||
|
|
||||||
|
} |
||||||
|
protected virtual void OnHeaderMouseLeave(object sender, MouseEventArgs e) |
||||||
|
{ |
||||||
|
isMouseDown = false; |
||||||
|
|
||||||
|
} |
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Commands
|
||||||
|
|
||||||
|
|
||||||
|
protected override void OnExecuteCommand(object sender, ExecutedRoutedEventArgs e) |
||||||
|
{ |
||||||
|
if (e.Command == DockablePaneCommands.Close) |
||||||
|
{ |
||||||
|
Close(); |
||||||
|
e.Handled = true; |
||||||
|
} |
||||||
|
else if (e.Command == DockablePaneCommands.Hide) |
||||||
|
{ |
||||||
|
Hide(); |
||||||
|
e.Handled = true; |
||||||
|
} |
||||||
|
else if (e.Command == DockablePaneCommands.ToggleAutoHide) |
||||||
|
{ |
||||||
|
ToggleAutoHide(); |
||||||
|
e.Handled = true; |
||||||
|
} |
||||||
|
//else if (e.Command == ShowOptionsCommand)
|
||||||
|
//{
|
||||||
|
// OpenOptionsContextMenu();
|
||||||
|
// e.Handled = true;
|
||||||
|
//}
|
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
protected override void OnCanExecuteCommand(object sender, CanExecuteRoutedEventArgs e) |
||||||
|
{ |
||||||
|
e.CanExecute = true; |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Retrive a value indicating if the command can be executed based to the dockable content state
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="command"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
protected virtual bool CanExecuteCommand(ICommand command) |
||||||
|
{ |
||||||
|
//Test by DockableStyle
|
||||||
|
if (command == DockablePaneCommands.Close) |
||||||
|
{ |
||||||
|
return true; |
||||||
|
} |
||||||
|
else if (command == DockablePaneCommands.Hide) |
||||||
|
{ |
||||||
|
return true; |
||||||
|
} |
||||||
|
else if (command == DockablePaneCommands.ToggleAutoHide) |
||||||
|
{ |
||||||
|
return true; |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
return true; |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
|
public override bool IsDocked |
||||||
|
{ |
||||||
|
get { return IsSurfaceVisible; } |
||||||
|
} |
||||||
|
|
||||||
|
public bool IsAutoHidden |
||||||
|
{ |
||||||
|
get |
||||||
|
{ |
||||||
|
return Items.Cast<DockableContent>().FirstOrDefault(c => c.State == DockableContentState.AutoHide) != null; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
public DockableStyle GetCumulativeDockableStyle() |
||||||
|
{ |
||||||
|
DockableStyle style = DockableStyle.Dockable; |
||||||
|
|
||||||
|
if (Items.Count == 1 && |
||||||
|
Items[0] is DocumentContent) |
||||||
|
style = DockableStyle.Document; |
||||||
|
else |
||||||
|
{ |
||||||
|
foreach (DockableContent content in this.Items) |
||||||
|
{ |
||||||
|
style &= content.DockableStyle; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
return style; |
||||||
|
} |
||||||
|
|
||||||
|
internal override ManagedContent RemoveContent(int index) |
||||||
|
{ |
||||||
|
ManagedContent content = base.RemoveContent(index); |
||||||
|
DockableContent dockableContent = content as DockableContent; |
||||||
|
|
||||||
|
if (((dockableContent == null) |
||||||
|
|| (dockableContent != null && dockableContent.SavedStateAndPosition == null) |
||||||
|
|| (dockableContent != null && dockableContent.SavedStateAndPosition.ContainerPane != this)) |
||||||
|
&& Items.Count == 0) |
||||||
|
{ |
||||||
|
ResizingPanel containerPanel = Parent as ResizingPanel; |
||||||
|
if (containerPanel != null) |
||||||
|
containerPanel.RemoveChild(this); |
||||||
|
} |
||||||
|
|
||||||
|
return content; |
||||||
|
} |
||||||
|
|
||||||
|
protected override void CheckItems(IList newItems) |
||||||
|
{ |
||||||
|
foreach (object newItem in newItems) |
||||||
|
{ |
||||||
|
if (!(newItem is DockableContent)) |
||||||
|
throw new InvalidOperationException("DockablePane can contain only DockableContents!"); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
#region Dockable Pane operations
|
||||||
|
/// <summary>
|
||||||
|
/// Toggle auto hide state to all content inside the pane
|
||||||
|
/// </summary>
|
||||||
|
public virtual void ToggleAutoHide() |
||||||
|
{ |
||||||
|
bool flag = Items.OfType<DockableContent>().FirstOrDefault(c => (c.DockableStyle & DockableStyle.AutoHide) == 0) == null; |
||||||
|
|
||||||
|
if (flag && GetManager() != null) |
||||||
|
GetManager().ToggleAutoHide(this); |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Close pane and all contained contents
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>True if all content has been closed, false if at least one content couldn't be closed.</returns>
|
||||||
|
/// <remarks></remarks>
|
||||||
|
public virtual bool Close() |
||||||
|
{ |
||||||
|
DockableContent[] cntsToClose = Items.OfType<DockableContent>().ToArray(); |
||||||
|
bool res = true; |
||||||
|
foreach (var cnt in cntsToClose) |
||||||
|
{ |
||||||
|
if (!cnt.Close()) |
||||||
|
res = false; |
||||||
|
} |
||||||
|
|
||||||
|
return res; |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Close pane and hide all contained contents
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>True if all content has been hidden, false if at least one content couldn't be hidden.</returns>
|
||||||
|
/// <remarks></remarks>
|
||||||
|
public virtual bool Hide() |
||||||
|
{ |
||||||
|
DockableContent[] cntsToClose = Items.OfType<DockableContent>().ToArray(); |
||||||
|
bool res = true; |
||||||
|
foreach (var cnt in cntsToClose) |
||||||
|
{ |
||||||
|
if (!cnt.Hide()) |
||||||
|
res = false; |
||||||
|
} |
||||||
|
|
||||||
|
return res; |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Closes or hides current content depending on HideOnClose property
|
||||||
|
/// </summary>
|
||||||
|
internal void CloseOrHideCurrentContent() |
||||||
|
{ |
||||||
|
(SelectedItem as DockableContent).CloseOrHide(false); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,248 @@ |
|||||||
|
//Copyright (c) 2007-2010, Adolfo Marinucci
|
||||||
|
//All rights reserved.
|
||||||
|
|
||||||
|
//Redistribution and use in source and binary forms, with or without modification,
|
||||||
|
//are permitted provided that the following conditions are met:
|
||||||
|
//
|
||||||
|
//* Redistributions of source code must retain the above copyright notice,
|
||||||
|
// this list of conditions and the following disclaimer.
|
||||||
|
//* Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
// this list of conditions and the following disclaimer in the documentation
|
||||||
|
// and/or other materials provided with the distribution.
|
||||||
|
//* Neither the name of Adolfo Marinucci nor the names of its contributors may
|
||||||
|
// be used to endorse or promote products derived from this software without
|
||||||
|
// specific prior written permission.
|
||||||
|
//
|
||||||
|
//THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||||
|
//AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
//WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||||
|
//IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||||
|
//INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||||
|
//PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||||
|
//HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||||
|
//OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
||||||
|
//EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
|
using System; |
||||||
|
using System.Collections.Generic; |
||||||
|
using System.Text; |
||||||
|
using System.Windows; |
||||||
|
using System.Windows.Controls; |
||||||
|
using System.Windows.Controls.Primitives; |
||||||
|
using System.Windows.Data; |
||||||
|
using System.Windows.Documents; |
||||||
|
using System.Windows.Input; |
||||||
|
using System.Windows.Media; |
||||||
|
using System.Windows.Media.Imaging; |
||||||
|
using System.Windows.Shapes; |
||||||
|
using System.ComponentModel; |
||||||
|
using System.Diagnostics; |
||||||
|
|
||||||
|
namespace AvalonDock |
||||||
|
{ |
||||||
|
/// <summary>
|
||||||
|
/// Represents a tab displayed in a border of the docking manager
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks></remarks>
|
||||||
|
[EditorBrowsable(EditorBrowsableState.Never)] |
||||||
|
public class DockablePaneAnchorTab : System.Windows.Controls.Control//, INotifyPropertyChanged
|
||||||
|
{ |
||||||
|
static DockablePaneAnchorTab() |
||||||
|
{ |
||||||
|
//This OverrideMetadata call tells the system that this element wants to provide a style that is different than its base class.
|
||||||
|
//This style is defined in themes\generic.xaml
|
||||||
|
DefaultStyleKeyProperty.OverrideMetadata(typeof(DockablePaneAnchorTab), new FrameworkPropertyMetadata(typeof(DockablePaneAnchorTab))); |
||||||
|
} |
||||||
|
|
||||||
|
public DockablePaneAnchorTab() |
||||||
|
{ |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the referenced content
|
||||||
|
/// </summary>
|
||||||
|
public DockableContent ReferencedContent |
||||||
|
{ |
||||||
|
get { return (DockableContent)GetValue(ReferencedContentPropertyKey.DependencyProperty); } |
||||||
|
set { SetValue(ReferencedContentPropertyKey, value); } |
||||||
|
} |
||||||
|
|
||||||
|
// Using a DependencyProperty as the backing store for DockableContent. This enables animation, styling, binding, etc...
|
||||||
|
public static readonly DependencyPropertyKey ReferencedContentPropertyKey = |
||||||
|
DependencyProperty.RegisterReadOnly("ReferencedContent", typeof(DockableContent), typeof(DockablePaneAnchorTab), new UIPropertyMetadata(null, new PropertyChangedCallback(OnPaneAttached))); |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Handles the referencedContent property changes in order to update the Anchor property
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="depObj"></param>
|
||||||
|
/// <param name="e"></param>
|
||||||
|
static void OnPaneAttached(DependencyObject depObj, DependencyPropertyChangedEventArgs e) |
||||||
|
{ |
||||||
|
//Update Anchor, Title and Icon property
|
||||||
|
DockablePaneAnchorTab _this = depObj as DockablePaneAnchorTab; |
||||||
|
_this.SetAnchor(((DockablePane)_this.ReferencedContent.ContainerPane).Anchor); |
||||||
|
_this.SetIcon(_this.ReferencedContent.Icon); |
||||||
|
_this.SetTitle(_this.ReferencedContent.Title); |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
///// <summary>
|
||||||
|
///// Gets anchor style of the referenced content
|
||||||
|
///// </summary>
|
||||||
|
///// <remarks>This proprety is exposed to facilitate the control template binding.</remarks>
|
||||||
|
//public AnchorStyle Anchor
|
||||||
|
//{
|
||||||
|
// get { return (AnchorStyle)GetValue(AnchorPropertyKey.DependencyProperty); }
|
||||||
|
// protected set { SetValue(AnchorPropertyKey, value); }
|
||||||
|
//}
|
||||||
|
|
||||||
|
//// Using a DependencyProperty as the backing store for IsSelected. This enables animation, styling, binding, etc...
|
||||||
|
//public static readonly DependencyPropertyKey AnchorPropertyKey =
|
||||||
|
// DependencyProperty.RegisterAttachedReadOnly("Anchor", typeof(AnchorStyle), typeof(DockablePaneAnchorTab), new PropertyMetadata(AnchorStyle.Left));
|
||||||
|
|
||||||
|
///// <summary>
|
||||||
|
///// Gets icon of the referenced content
|
||||||
|
///// </summary>
|
||||||
|
///// <remarks>This proprety is exposed to facilitate the control template binding.</remarks>
|
||||||
|
//public object Icon
|
||||||
|
//{
|
||||||
|
// get { return (object)GetValue(IconPropertyKey.DependencyProperty); }
|
||||||
|
// protected set { SetValue(IconPropertyKey, value); }
|
||||||
|
//}
|
||||||
|
|
||||||
|
//// Using a DependencyProperty as the backing store for IsSelected. This enables animation, styling, binding, etc...
|
||||||
|
//public static readonly DependencyPropertyKey IconPropertyKey =
|
||||||
|
// DependencyProperty.RegisterAttachedReadOnly("Icon", typeof(object), typeof(DockablePaneAnchorTab), new PropertyMetadata(null));
|
||||||
|
|
||||||
|
#region Anchor
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Anchor Read-Only Dependency Property
|
||||||
|
/// </summary>
|
||||||
|
private static readonly DependencyPropertyKey AnchorPropertyKey |
||||||
|
= DependencyProperty.RegisterReadOnly("Anchor", typeof(AnchorStyle), typeof(DockablePaneAnchorTab), |
||||||
|
new FrameworkPropertyMetadata((AnchorStyle)AnchorStyle.None)); |
||||||
|
|
||||||
|
public static readonly DependencyProperty AnchorProperty |
||||||
|
= AnchorPropertyKey.DependencyProperty; |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the Anchor property. This dependency property
|
||||||
|
/// indicates the achor style of referenced content that is in autohidden state.
|
||||||
|
/// </summary>
|
||||||
|
public AnchorStyle Anchor |
||||||
|
{ |
||||||
|
get { return (AnchorStyle)GetValue(AnchorProperty); } |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Provides a secure method for setting the Anchor property.
|
||||||
|
/// This dependency property indicates the achor style of referenced content that is in autohidden state.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="value">The new value for the property.</param>
|
||||||
|
protected void SetAnchor(AnchorStyle value) |
||||||
|
{ |
||||||
|
SetValue(AnchorPropertyKey, value); |
||||||
|
} |
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Icon
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Icon Read-Only Dependency Property
|
||||||
|
/// </summary>
|
||||||
|
private static readonly DependencyPropertyKey IconPropertyKey |
||||||
|
= DependencyProperty.RegisterReadOnly("Icon", typeof(object), typeof(DockablePaneAnchorTab), |
||||||
|
new FrameworkPropertyMetadata((object)null)); |
||||||
|
|
||||||
|
public static readonly DependencyProperty IconProperty |
||||||
|
= IconPropertyKey.DependencyProperty; |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the Icon property. This dependency property
|
||||||
|
/// indicates icon of the referenced content in autohidden state.
|
||||||
|
/// </summary>
|
||||||
|
public object Icon |
||||||
|
{ |
||||||
|
get { return (object)GetValue(IconProperty); } |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Provides a secure method for setting the Icon property.
|
||||||
|
/// This dependency property indicates icon of the referenced content in autohidden state.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="value">The new value for the property.</param>
|
||||||
|
protected void SetIcon(object value) |
||||||
|
{ |
||||||
|
SetValue(IconPropertyKey, value); |
||||||
|
} |
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Title
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Title Read-Only Dependency Property
|
||||||
|
/// </summary>
|
||||||
|
private static readonly DependencyPropertyKey TitlePropertyKey |
||||||
|
= DependencyProperty.RegisterReadOnly("Title", typeof(object), typeof(DockablePaneAnchorTab), |
||||||
|
new FrameworkPropertyMetadata((string)null)); |
||||||
|
|
||||||
|
public static readonly DependencyProperty TitleProperty |
||||||
|
= TitlePropertyKey.DependencyProperty; |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the Title property. This dependency property
|
||||||
|
/// indicates title of the content that is hosted in autohidden pane.
|
||||||
|
/// </summary>
|
||||||
|
public object Title |
||||||
|
{ |
||||||
|
get { return (object)GetValue(TitleProperty); } |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Provides a secure method for setting the Title property.
|
||||||
|
/// This dependency property indicates title of the content that is hosted in autohidden pane.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="value">The new value for the property.</param>
|
||||||
|
protected void SetTitle(object value) |
||||||
|
{ |
||||||
|
SetValue(TitlePropertyKey, value); |
||||||
|
} |
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Handles the MouseMove event
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="e"></param>
|
||||||
|
/// <remarks>Notify the docking manager that the referenced content should appears</remarks>
|
||||||
|
protected override void OnMouseMove(MouseEventArgs e) |
||||||
|
{ |
||||||
|
if (ReferencedContent != null) |
||||||
|
ReferencedContent.Manager.ShowFlyoutWindow(ReferencedContent, this); |
||||||
|
|
||||||
|
base.OnMouseMove(e); |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Handles the MouseDown event
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="e"></param>
|
||||||
|
/// <remarks>Notify the docking manager that the referenced content should appears and should be activated</remarks>
|
||||||
|
protected override void OnMouseLeftButtonDown(MouseButtonEventArgs e) |
||||||
|
{ |
||||||
|
if (ReferencedContent != null) |
||||||
|
{ |
||||||
|
ReferencedContent.Manager.ShowFlyoutWindow(ReferencedContent, this); |
||||||
|
ReferencedContent.Activate(); |
||||||
|
} |
||||||
|
|
||||||
|
base.OnMouseLeftButtonDown(e); |
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
@ -0,0 +1,64 @@ |
|||||||
|
//Copyright (c) 2007-2010, Adolfo Marinucci
|
||||||
|
//All rights reserved.
|
||||||
|
|
||||||
|
//Redistribution and use in source and binary forms, with or without modification,
|
||||||
|
//are permitted provided that the following conditions are met:
|
||||||
|
//
|
||||||
|
//* Redistributions of source code must retain the above copyright notice,
|
||||||
|
// this list of conditions and the following disclaimer.
|
||||||
|
//* Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
// this list of conditions and the following disclaimer in the documentation
|
||||||
|
// and/or other materials provided with the distribution.
|
||||||
|
//* Neither the name of Adolfo Marinucci nor the names of its contributors may
|
||||||
|
// be used to endorse or promote products derived from this software without
|
||||||
|
// specific prior written permission.
|
||||||
|
//
|
||||||
|
//THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||||
|
//AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
//WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||||
|
//IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||||
|
//INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||||
|
//PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||||
|
//HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||||
|
//OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
||||||
|
//EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
|
using System; |
||||||
|
using System.Collections.Generic; |
||||||
|
using System.Text; |
||||||
|
using System.Windows; |
||||||
|
using System.Windows.Controls; |
||||||
|
using System.Windows.Controls.Primitives; |
||||||
|
using System.Windows.Data; |
||||||
|
using System.Windows.Documents; |
||||||
|
using System.Windows.Input; |
||||||
|
using System.Windows.Media; |
||||||
|
using System.Windows.Media.Imaging; |
||||||
|
using System.Windows.Shapes; |
||||||
|
|
||||||
|
namespace AvalonDock |
||||||
|
{ |
||||||
|
public class DockablePaneAnchorTabGroup : System.Windows.Controls.StackPanel |
||||||
|
{ |
||||||
|
static DockablePaneAnchorTabGroup() |
||||||
|
{ |
||||||
|
//This OverrideMetadata call tells the system that this element wants to provide a style that is different than its base class.
|
||||||
|
//This style is defined in themes\generic.xaml
|
||||||
|
DefaultStyleKeyProperty.OverrideMetadata(typeof(DockablePaneAnchorTabGroup), new FrameworkPropertyMetadata(typeof(DockablePaneAnchorTabGroup))); |
||||||
|
} |
||||||
|
|
||||||
|
DockablePane _pane = null; |
||||||
|
|
||||||
|
internal DockablePane ReferencedPane |
||||||
|
{ |
||||||
|
get |
||||||
|
{ return _pane; } |
||||||
|
set { _pane = value; } |
||||||
|
} |
||||||
|
|
||||||
|
protected override void OnVisualChildrenChanged(DependencyObject visualAdded, DependencyObject visualRemoved) |
||||||
|
{ |
||||||
|
base.OnVisualChildrenChanged(visualAdded, visualRemoved); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,102 @@ |
|||||||
|
//Copyright (c) 2007-2010, Adolfo Marinucci
|
||||||
|
//All rights reserved.
|
||||||
|
|
||||||
|
//Redistribution and use in source and binary forms, with or without modification,
|
||||||
|
//are permitted provided that the following conditions are met:
|
||||||
|
//
|
||||||
|
//* Redistributions of source code must retain the above copyright notice,
|
||||||
|
// this list of conditions and the following disclaimer.
|
||||||
|
//* Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
// this list of conditions and the following disclaimer in the documentation
|
||||||
|
// and/or other materials provided with the distribution.
|
||||||
|
//* Neither the name of Adolfo Marinucci nor the names of its contributors may
|
||||||
|
// be used to endorse or promote products derived from this software without
|
||||||
|
// specific prior written permission.
|
||||||
|
//
|
||||||
|
//THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||||
|
//AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
//WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||||
|
//IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||||
|
//INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||||
|
//PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||||
|
//HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||||
|
//OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
||||||
|
//EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
|
using System; |
||||||
|
using System.Collections.Generic; |
||||||
|
using System.Linq; |
||||||
|
using System.Text; |
||||||
|
using System.Windows.Input; |
||||||
|
|
||||||
|
namespace AvalonDock |
||||||
|
{ |
||||||
|
/// <summary>
|
||||||
|
/// Defines commands that can be applied to a dockable pane
|
||||||
|
/// </summary>
|
||||||
|
public sealed class DockablePaneCommands |
||||||
|
{ |
||||||
|
private static object syncRoot = new object(); |
||||||
|
|
||||||
|
private static RoutedUICommand closeCommand = null; |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// This command closes the <see cref="DockablePane"/> and closes all the contained <see cref="DockableContent"/>s inside it
|
||||||
|
/// </summary>
|
||||||
|
public static RoutedUICommand Close |
||||||
|
{ |
||||||
|
get |
||||||
|
{ |
||||||
|
lock (syncRoot) |
||||||
|
{ |
||||||
|
if (null == closeCommand) |
||||||
|
{ |
||||||
|
closeCommand = new RoutedUICommand(AvalonDock.Properties.Resources.DockablePaneCommands_Close, "Close", typeof(DockablePaneCommands)); |
||||||
|
} |
||||||
|
} |
||||||
|
return closeCommand; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
private static RoutedUICommand hideCommand = null; |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// This command closes the <see cref="DockablePane"/> and hides all the contained <see cref="DockableContent"/>s inside it
|
||||||
|
/// </summary>
|
||||||
|
public static RoutedUICommand Hide |
||||||
|
{ |
||||||
|
get |
||||||
|
{ |
||||||
|
lock (syncRoot) |
||||||
|
{ |
||||||
|
if (null == hideCommand) |
||||||
|
{ |
||||||
|
hideCommand = new RoutedUICommand(AvalonDock.Properties.Resources.DockablePaneCommands_Hide, "Hide", typeof(DockablePaneCommands)); |
||||||
|
} |
||||||
|
} |
||||||
|
return hideCommand; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
private static RoutedUICommand autoHideCommand = null; |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// This commands auto-hides the pane with all contained <see cref="DockableContent"/>s inside it
|
||||||
|
/// </summary>
|
||||||
|
public static RoutedUICommand ToggleAutoHide |
||||||
|
{ |
||||||
|
get |
||||||
|
{ |
||||||
|
lock (syncRoot) |
||||||
|
{ |
||||||
|
if (null == autoHideCommand) |
||||||
|
{ |
||||||
|
autoHideCommand = new RoutedUICommand(AvalonDock.Properties.Resources.DockablePaneCommands_ToggleAutoHide, "AutoHide", typeof(DockablePaneCommands)); |
||||||
|
} |
||||||
|
} |
||||||
|
return autoHideCommand; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,87 @@ |
|||||||
|
//Copyright (c) 2007-2010, Adolfo Marinucci
|
||||||
|
//All rights reserved.
|
||||||
|
|
||||||
|
//Redistribution and use in source and binary forms, with or without modification,
|
||||||
|
//are permitted provided that the following conditions are met:
|
||||||
|
//
|
||||||
|
//* Redistributions of source code must retain the above copyright notice,
|
||||||
|
// this list of conditions and the following disclaimer.
|
||||||
|
//* Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
// this list of conditions and the following disclaimer in the documentation
|
||||||
|
// and/or other materials provided with the distribution.
|
||||||
|
//* Neither the name of Adolfo Marinucci nor the names of its contributors may
|
||||||
|
// be used to endorse or promote products derived from this software without
|
||||||
|
// specific prior written permission.
|
||||||
|
//
|
||||||
|
//THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||||
|
//AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
//WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||||
|
//IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||||
|
//INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||||
|
//PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||||
|
//HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||||
|
//OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
||||||
|
//EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
|
using System; |
||||||
|
using System.Collections.Generic; |
||||||
|
using System.Text; |
||||||
|
using System.Windows; |
||||||
|
using System.Windows.Controls; |
||||||
|
using System.Windows.Controls.Primitives; |
||||||
|
using System.Windows.Data; |
||||||
|
using System.Windows.Documents; |
||||||
|
using System.Windows.Input; |
||||||
|
using System.Windows.Media; |
||||||
|
using System.Windows.Media.Imaging; |
||||||
|
using System.Windows.Shapes; |
||||||
|
|
||||||
|
namespace AvalonDock |
||||||
|
{ |
||||||
|
public class DockableTabPanel : PaneTabPanel |
||||||
|
{ |
||||||
|
protected override Size MeasureOverride(Size availableSize) |
||||||
|
{ |
||||||
|
double totWidth = 0; |
||||||
|
|
||||||
|
if (base.VisualChildrenCount == 0) |
||||||
|
return base.MeasureOverride(availableSize); |
||||||
|
|
||||||
|
|
||||||
|
var childsOrderedByWidth = new List<FrameworkElement>(); |
||||||
|
|
||||||
|
foreach (FrameworkElement child in Children) |
||||||
|
{ |
||||||
|
child.Measure(new Size(double.PositiveInfinity, availableSize.Height)); |
||||||
|
totWidth += child.DesiredSize.Width - child.Margin.Left - child.Margin.Right; |
||||||
|
childsOrderedByWidth.Add(child); |
||||||
|
} |
||||||
|
|
||||||
|
if (totWidth > availableSize.Width) |
||||||
|
{ |
||||||
|
foreach (FrameworkElement child in Children) |
||||||
|
{ |
||||||
|
child.Measure(new Size(availableSize.Width / Children.Count, availableSize.Height)); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
return base.MeasureOverride(availableSize); |
||||||
|
} |
||||||
|
|
||||||
|
protected override Size ArrangeOverride(Size finalSize) |
||||||
|
{ |
||||||
|
double offsetX = 0; |
||||||
|
|
||||||
|
foreach (FrameworkElement child in Children) |
||||||
|
{ |
||||||
|
double childFinalWidth = child.DesiredSize.Width; |
||||||
|
child.Arrange(new Rect(offsetX, 0, childFinalWidth, finalSize.Height)); |
||||||
|
|
||||||
|
offsetX += child.DesiredSize.Width; |
||||||
|
} |
||||||
|
|
||||||
|
return base.ArrangeOverride(finalSize); |
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,442 @@ |
|||||||
|
//Copyright (c) 2007-2010, Adolfo Marinucci
|
||||||
|
//All rights reserved.
|
||||||
|
|
||||||
|
//Redistribution and use in source and binary forms, with or without modification,
|
||||||
|
//are permitted provided that the following conditions are met:
|
||||||
|
//
|
||||||
|
//* Redistributions of source code must retain the above copyright notice,
|
||||||
|
// this list of conditions and the following disclaimer.
|
||||||
|
//* Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
// this list of conditions and the following disclaimer in the documentation
|
||||||
|
// and/or other materials provided with the distribution.
|
||||||
|
//* Neither the name of Adolfo Marinucci nor the names of its contributors may
|
||||||
|
// be used to endorse or promote products derived from this software without
|
||||||
|
// specific prior written permission.
|
||||||
|
//
|
||||||
|
//THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||||
|
//AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
//WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||||
|
//IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||||
|
//INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||||
|
//PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||||
|
//HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||||
|
//OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
||||||
|
//EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
|
using System; |
||||||
|
using System.Collections.Generic; |
||||||
|
using System.Text; |
||||||
|
using System.Windows; |
||||||
|
using System.Windows.Controls; |
||||||
|
using System.Windows.Controls.Primitives; |
||||||
|
using System.Windows.Data; |
||||||
|
using System.Windows.Documents; |
||||||
|
using System.Windows.Input; |
||||||
|
using System.Windows.Media; |
||||||
|
using System.Windows.Media.Imaging; |
||||||
|
using System.Windows.Shapes; |
||||||
|
using System.ComponentModel; |
||||||
|
using System.Diagnostics; |
||||||
|
|
||||||
|
|
||||||
|
namespace AvalonDock |
||||||
|
{ |
||||||
|
/// <summary>
|
||||||
|
/// Represent a document which can be host by a <see cref="DocumentPane"/>.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>A document is always hosted by a <see cref="DocumentPane"/> usually in the central area of <see cref="DockingManager"/>.
|
||||||
|
/// It has limited dragging features becaus it can be only moved to an other <see cref="DocumentPane"/> and can't float as a separate window.
|
||||||
|
/// You can access all documents within <see cref="DockingManager"/> with property <see cref="DockingManager.Documents"/>.</remarks>
|
||||||
|
public class DocumentContent : ManagedContent |
||||||
|
{ |
||||||
|
|
||||||
|
static DocumentContent() |
||||||
|
{ |
||||||
|
DefaultStyleKeyProperty.OverrideMetadata(typeof(DocumentContent), new FrameworkPropertyMetadata(typeof(DocumentContent))); |
||||||
|
|
||||||
|
//Control.WidthProperty.OverrideMetadata(typeof(DocumentContent),
|
||||||
|
// new FrameworkPropertyMetadata(new PropertyChangedCallback(OnSizePropertyChanged), new CoerceValueCallback(CourceSizeToNaN)));
|
||||||
|
//Control.HeightProperty.OverrideMetadata(typeof(DocumentContent),
|
||||||
|
// new FrameworkPropertyMetadata(new PropertyChangedCallback(OnSizePropertyChanged), new CoerceValueCallback(CourceSizeToNaN)));
|
||||||
|
} |
||||||
|
|
||||||
|
public DocumentContent() |
||||||
|
{ |
||||||
|
//base.PropertyChanged += new PropertyChangedEventHandler(DocumentContent_PropertyChanged);
|
||||||
|
} |
||||||
|
|
||||||
|
protected override void OnContentLoaded() |
||||||
|
{ |
||||||
|
//now the logical tree is up
|
||||||
|
DockingManager manager = GetParentManager(null); |
||||||
|
|
||||||
|
//if can't find the manager there is a problem
|
||||||
|
//if (manager == null)
|
||||||
|
// throw new InvalidOperationException(string.Format(
|
||||||
|
// "Unable to find DockingManager object in the logical tree of document '{0}'", Title));
|
||||||
|
|
||||||
|
//manager.Documents.Add(this);
|
||||||
|
|
||||||
|
base.OnContentLoaded(); |
||||||
|
} |
||||||
|
|
||||||
|
protected override void OnContentUnloaded() |
||||||
|
{ |
||||||
|
//if (Manager != null)
|
||||||
|
// Manager.Documents.Remove(this);
|
||||||
|
|
||||||
|
base.OnContentUnloaded(); |
||||||
|
} |
||||||
|
|
||||||
|
#region InfoTip
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// InfoTip Dependency Property
|
||||||
|
/// </summary>
|
||||||
|
public static readonly DependencyProperty InfoTipProperty = |
||||||
|
DependencyProperty.Register("InfoTip", typeof(string), typeof(DocumentContent), |
||||||
|
new FrameworkPropertyMetadata(null)); |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the InfoTip property. This dependency property
|
||||||
|
/// indicates information text attached to the document content.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>This text is usually displayed when users switch between documents and helps them to choose the right one.</remarks>
|
||||||
|
public string InfoTip |
||||||
|
{ |
||||||
|
get { return (string)GetValue(InfoTipProperty); } |
||||||
|
set { SetValue(InfoTipProperty, value); } |
||||||
|
} |
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region ContentTypeDescription
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// ContentTypeDescription Dependency Property
|
||||||
|
/// </summary>
|
||||||
|
public static readonly DependencyProperty ContentTypeDescriptionProperty = |
||||||
|
DependencyProperty.Register("ContentTypeDescription", typeof(string), typeof(DocumentContent), |
||||||
|
new FrameworkPropertyMetadata((string)string.Empty)); |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the ContentTypeDescription property. This dependency property
|
||||||
|
/// indicates a text which describes the type of content contained in this document.
|
||||||
|
/// </summary>
|
||||||
|
public string ContentTypeDescription |
||||||
|
{ |
||||||
|
get { return (string)GetValue(ContentTypeDescriptionProperty); } |
||||||
|
set { SetValue(ContentTypeDescriptionProperty, value); } |
||||||
|
} |
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets a value indicating if this document can float over main window (VS2010 Feature).
|
||||||
|
/// </summary>
|
||||||
|
public bool IsFloatingAllowed |
||||||
|
{ |
||||||
|
get { return (bool)GetValue(IsFloatingAllowedProperty); } |
||||||
|
set { SetValue(IsFloatingAllowedProperty, value); } |
||||||
|
} |
||||||
|
|
||||||
|
// Using a DependencyProperty as the backing store for IsFloatingAllowed. This enables animation, styling, binding, etc...
|
||||||
|
public static readonly DependencyProperty IsFloatingAllowedProperty = |
||||||
|
DependencyProperty.Register("IsFloatingAllowed", typeof(bool), typeof(DocumentContent), new PropertyMetadata(true)); |
||||||
|
|
||||||
|
|
||||||
|
#region IsFloating
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// IsFloating Read-Only Dependency Property
|
||||||
|
/// </summary>
|
||||||
|
private static readonly DependencyPropertyKey IsFloatingPropertyKey |
||||||
|
= DependencyProperty.RegisterReadOnly("IsFloating", typeof(bool), typeof(DocumentContent), |
||||||
|
new FrameworkPropertyMetadata((bool)false)); |
||||||
|
|
||||||
|
public static readonly DependencyProperty IsFloatingProperty |
||||||
|
= IsFloatingPropertyKey.DependencyProperty; |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the IsFloating property. This dependency property
|
||||||
|
/// indicates if the DocumentContent is floating inside an external window.
|
||||||
|
/// </summary>
|
||||||
|
public bool IsFloating |
||||||
|
{ |
||||||
|
get { return (bool)GetValue(IsFloatingProperty); } |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Provides a secure method for setting the IsFloating property.
|
||||||
|
/// This dependency property indicates if the DocumentContent is floating inside an external window.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="value">The new value for the property.</param>
|
||||||
|
internal void SetIsFloating(bool value) |
||||||
|
{ |
||||||
|
SetValue(IsFloatingPropertyKey, value); |
||||||
|
} |
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
|
protected override void OnDragStart(Point ptMouse, Point ptRelativeMouse) |
||||||
|
{ |
||||||
|
if (IsFloatingAllowed) |
||||||
|
{ |
||||||
|
Manager.Drag(this, HelperFunc.PointToScreenWithoutFlowDirection(this, ptMouse), ptRelativeMouse); |
||||||
|
} |
||||||
|
|
||||||
|
base.OnDragStart(ptMouse, ptRelativeMouse); |
||||||
|
} |
||||||
|
|
||||||
|
protected override void OnDragMouseMove(object sender, MouseEventArgs e) |
||||||
|
{ |
||||||
|
base.OnDragMouseMove(sender, e); |
||||||
|
} |
||||||
|
|
||||||
|
protected override void OnDragMouseLeave(object sender, MouseEventArgs e) |
||||||
|
{ |
||||||
|
|
||||||
|
base.OnDragMouseLeave(sender, e); |
||||||
|
} |
||||||
|
|
||||||
|
public override void OnApplyTemplate() |
||||||
|
{ |
||||||
|
base.OnApplyTemplate(); |
||||||
|
|
||||||
|
if (DragEnabledArea != null) |
||||||
|
{ |
||||||
|
if (string.IsNullOrEmpty((string)DragEnabledArea.ToolTip)) |
||||||
|
DragEnabledArea.ToolTip = InfoTip; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
protected override void OnInitialized(EventArgs e) |
||||||
|
{ |
||||||
|
base.OnInitialized(e); |
||||||
|
|
||||||
|
this.CommandBindings.Add( |
||||||
|
new CommandBinding(DocumentContentCommands.FloatingDocument, this.OnExecuteCommand, this.OnCanExecuteCommand)); |
||||||
|
this.CommandBindings.Add( |
||||||
|
new CommandBinding(DocumentContentCommands.TabbedDocument, this.OnExecuteCommand, this.OnCanExecuteCommand)); |
||||||
|
} |
||||||
|
|
||||||
|
void OnExecuteCommand(object sender, ExecutedRoutedEventArgs e) |
||||||
|
{ |
||||||
|
if (!e.Handled && e.Command == DocumentContentCommands.FloatingDocument) |
||||||
|
{ |
||||||
|
this.Show(true); |
||||||
|
|
||||||
|
e.Handled = true; |
||||||
|
} |
||||||
|
else if (!e.Handled && e.Command == DocumentContentCommands.TabbedDocument) |
||||||
|
{ |
||||||
|
this.Show(false); |
||||||
|
|
||||||
|
e.Handled = true; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
void OnCanExecuteCommand(object sender, CanExecuteRoutedEventArgs e) |
||||||
|
{ |
||||||
|
e.CanExecute = CanExecuteCommand(e.Command); |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Show <see cref="DocumentContent"/> as tabbed document
|
||||||
|
/// </summary>
|
||||||
|
public override void Show() |
||||||
|
{ |
||||||
|
Show(false); |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Show <see cref="DocumentContent"/> as tabbed document inside the provided <see cref="DockingManager"/>
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="manager">Docking manager target</param>
|
||||||
|
public override void Show(DockingManager manager) |
||||||
|
{ |
||||||
|
Show(manager, false); |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Show <see cref="DocumentContent"/> as tabbed document or inside a floating window
|
||||||
|
/// </summary>
|
||||||
|
public void Show(bool showAsFloatingWindow) |
||||||
|
{ |
||||||
|
if (!CanExecuteCommand(ManagedContentCommands.Show)) |
||||||
|
throw new InvalidOperationException("This operation can be executed in this state"); |
||||||
|
|
||||||
|
Manager.Show(this, showAsFloatingWindow); |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Show <see cref="DocumentContent"/> as tabbed document inside the provided <see cref="DockingManager"/>
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="manager">Docking manager target</param>
|
||||||
|
/// <param name="showAsFloatingWindow">True if document should be shown inside a floating window (<see cref="DocumentFloatingWindow"/>)</param>
|
||||||
|
public void Show(DockingManager manager, bool showAsFloatingWindow) |
||||||
|
{ |
||||||
|
if (Manager != null && Manager != manager) |
||||||
|
throw new InvalidOperationException("Please remove the content from previous DockingManager (using the Close method)"); |
||||||
|
|
||||||
|
if (!CanExecuteCommand(ManagedContentCommands.Show)) |
||||||
|
throw new InvalidOperationException("This operation can be executed in this state"); |
||||||
|
|
||||||
|
manager.Show(this, showAsFloatingWindow); |
||||||
|
|
||||||
|
manager.Documents.Add(this); |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Activate the document showing its header if it's not visible
|
||||||
|
/// </summary>
|
||||||
|
public override void Activate() |
||||||
|
{ |
||||||
|
base.Activate(); |
||||||
|
|
||||||
|
if (!DocumentTabPanel.GetIsHeaderVisible(this)) |
||||||
|
{ |
||||||
|
DocumentPane parentPane = this.ContainerPane as DocumentPane; |
||||||
|
if (parentPane != null && |
||||||
|
parentPane.GetManager() != null && |
||||||
|
parentPane.Items.IndexOf(this) != 0) |
||||||
|
{ |
||||||
|
parentPane.Items.Remove(this); |
||||||
|
parentPane.Items.Insert(0, this); |
||||||
|
parentPane.SelectedIndex = 0; |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Retrive a value indicating if the command can be executed based to the dockable content state
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="command"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
protected override bool CanExecuteCommand(ICommand command) |
||||||
|
{ |
||||||
|
if (command == DocumentContentCommands.FloatingDocument) |
||||||
|
{ |
||||||
|
return !IsFloating && IsFloatingAllowed; |
||||||
|
} |
||||||
|
else if (command == DocumentContentCommands.TabbedDocument) |
||||||
|
{ |
||||||
|
return IsFloating; |
||||||
|
} |
||||||
|
|
||||||
|
return true; |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Close this content without notifications
|
||||||
|
/// </summary>
|
||||||
|
internal void InternalClose() |
||||||
|
{ |
||||||
|
DockingManager manager = Manager; |
||||||
|
|
||||||
|
if (manager != null) |
||||||
|
{ |
||||||
|
if (manager.ActiveContent == this) |
||||||
|
manager.ActiveContent = null; |
||||||
|
|
||||||
|
if (manager.ActiveDocument == this) |
||||||
|
manager.ActiveDocument = null; |
||||||
|
} |
||||||
|
|
||||||
|
DocumentPane parentPane = ContainerPane as DocumentPane; |
||||||
|
FloatingDocumentPane floatingParentPane = ContainerPane as FloatingDocumentPane; |
||||||
|
|
||||||
|
if (floatingParentPane != null) |
||||||
|
{ |
||||||
|
floatingParentPane.RemoveContent(0); |
||||||
|
if (floatingParentPane.FloatingWindow != null && |
||||||
|
!floatingParentPane.FloatingWindow.IsClosing) |
||||||
|
floatingParentPane.FloatingWindow.Close(); |
||||||
|
} |
||||||
|
else if (parentPane != null) |
||||||
|
{ |
||||||
|
parentPane.Items.Remove(this); |
||||||
|
|
||||||
|
parentPane.CheckContentsEmpty(); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Close this document removing it from its parent container
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>Use this function to close a document and remove it from its parent container. Please note
|
||||||
|
/// that if you simply remove it from its parent <see cref="DocumentPane"/> without call this method, events like
|
||||||
|
/// <see cref="OnClosing"/>/<see cref="OnClosed"/> are not called.
|
||||||
|
/// </remarks>
|
||||||
|
public override bool Close() |
||||||
|
{ |
||||||
|
if (!IsCloseable) |
||||||
|
return false; |
||||||
|
|
||||||
|
////if documents are attached to an external source via DockingManager.DocumentsSource
|
||||||
|
////let application host handle the document closing by itself
|
||||||
|
//if (Manager.DocumentsSource != null)
|
||||||
|
//{
|
||||||
|
// //return Manager.FireRequestDocumentCloseEvent(this);
|
||||||
|
// Manager.HandleDocumentClose(this);
|
||||||
|
//}
|
||||||
|
|
||||||
|
|
||||||
|
CancelEventArgs e = new CancelEventArgs(false); |
||||||
|
OnClosing(e); |
||||||
|
|
||||||
|
if (e.Cancel) |
||||||
|
return false; |
||||||
|
|
||||||
|
DockingManager oldManager = Manager; |
||||||
|
|
||||||
|
if (Manager != null) |
||||||
|
Manager.FireDocumentClosingEvent(e); |
||||||
|
|
||||||
|
if (e.Cancel) |
||||||
|
return false; |
||||||
|
|
||||||
|
InternalClose(); |
||||||
|
|
||||||
|
OnClosed(); |
||||||
|
|
||||||
|
//if documents are attached to an external source via DockingManager.DocumentsSource
|
||||||
|
//let application host handle the document closing by itself
|
||||||
|
if (Manager.DocumentsSource != null) |
||||||
|
{ |
||||||
|
Manager.HandleDocumentClose(this); |
||||||
|
} |
||||||
|
|
||||||
|
if (oldManager != null) |
||||||
|
oldManager.FireDocumentClosedEvent(); |
||||||
|
|
||||||
|
|
||||||
|
Debug.Assert(Parent == null, "Parent MUST bu null after Doc is closed"); |
||||||
|
return true; |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Hide the <see cref="DocumentContent"/> (Close the document)
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
public override bool Hide() |
||||||
|
{ |
||||||
|
return Close(); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#region Save/RestoreLayout
|
||||||
|
public override void SaveLayout(System.Xml.XmlWriter storeWriter) |
||||||
|
{ |
||||||
|
base.SaveLayout(storeWriter); |
||||||
|
} |
||||||
|
|
||||||
|
public override void RestoreLayout(System.Xml.XmlElement contentElement) |
||||||
|
{ |
||||||
|
base.RestoreLayout(contentElement); |
||||||
|
} |
||||||
|
#endregion
|
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,83 @@ |
|||||||
|
//Copyright (c) 2007-2010, Adolfo Marinucci
|
||||||
|
//All rights reserved.
|
||||||
|
|
||||||
|
//Redistribution and use in source and binary forms, with or without modification,
|
||||||
|
//are permitted provided that the following conditions are met:
|
||||||
|
//
|
||||||
|
//* Redistributions of source code must retain the above copyright notice,
|
||||||
|
// this list of conditions and the following disclaimer.
|
||||||
|
//* Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
// this list of conditions and the following disclaimer in the documentation
|
||||||
|
// and/or other materials provided with the distribution.
|
||||||
|
//* Neither the name of Adolfo Marinucci nor the names of its contributors may
|
||||||
|
// be used to endorse or promote products derived from this software without
|
||||||
|
// specific prior written permission.
|
||||||
|
//
|
||||||
|
//THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||||
|
//AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
//WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||||
|
//IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||||
|
//INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||||
|
//PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||||
|
//HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||||
|
//OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
||||||
|
//EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
|
using System; |
||||||
|
using System.Collections.Generic; |
||||||
|
using System.Linq; |
||||||
|
using System.Text; |
||||||
|
using System.Windows.Input; |
||||||
|
|
||||||
|
namespace AvalonDock |
||||||
|
{ |
||||||
|
/// <summary>
|
||||||
|
/// Contains a list of commands that can be applied to a <see cref="DocumentContent"/>
|
||||||
|
/// </summary>
|
||||||
|
public sealed class DocumentContentCommands |
||||||
|
{ |
||||||
|
static object syncRoot = new object(); |
||||||
|
|
||||||
|
private static RoutedUICommand _floatingDocumentCommand = null; |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Shows the <see cref="DocumentContent"/> as a floating window document
|
||||||
|
/// </summary>
|
||||||
|
public static RoutedUICommand FloatingDocument |
||||||
|
{ |
||||||
|
get |
||||||
|
{ |
||||||
|
lock (syncRoot) |
||||||
|
{ |
||||||
|
if (null == _floatingDocumentCommand) |
||||||
|
{ |
||||||
|
_floatingDocumentCommand = new RoutedUICommand(AvalonDock.Properties.Resources.DocumentContentCommands_FloatingDocument, "FloatingDocument", typeof(DocumentContentCommands)); |
||||||
|
} |
||||||
|
} |
||||||
|
return _floatingDocumentCommand; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
private static RoutedUICommand _tabbedDocumentCommand = null; |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Shows the <see cref="DocumentContent"/> as a tabbed document
|
||||||
|
/// </summary>
|
||||||
|
public static RoutedUICommand TabbedDocument |
||||||
|
{ |
||||||
|
get |
||||||
|
{ |
||||||
|
lock (syncRoot) |
||||||
|
{ |
||||||
|
if (null == _tabbedDocumentCommand) |
||||||
|
{ |
||||||
|
_tabbedDocumentCommand = new RoutedUICommand(AvalonDock.Properties.Resources.DocumentContentCommands_TabbedDocument, "TabbedDocument", typeof(DocumentContentCommands)); |
||||||
|
} |
||||||
|
} |
||||||
|
return _tabbedDocumentCommand; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,295 @@ |
|||||||
|
//Copyright (c) 2007-2010, Adolfo Marinucci
|
||||||
|
//All rights reserved.
|
||||||
|
|
||||||
|
//Redistribution and use in source and binary forms, with or without modification,
|
||||||
|
//are permitted provided that the following conditions are met:
|
||||||
|
//
|
||||||
|
//* Redistributions of source code must retain the above copyright notice,
|
||||||
|
// this list of conditions and the following disclaimer.
|
||||||
|
//* Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
// this list of conditions and the following disclaimer in the documentation
|
||||||
|
// and/or other materials provided with the distribution.
|
||||||
|
//* Neither the name of Adolfo Marinucci nor the names of its contributors may
|
||||||
|
// be used to endorse or promote products derived from this software without
|
||||||
|
// specific prior written permission.
|
||||||
|
//
|
||||||
|
//THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||||
|
//AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
//WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||||
|
//IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||||
|
//INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||||
|
//PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||||
|
//HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||||
|
//OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
||||||
|
//EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
|
using System; |
||||||
|
using System.Collections.Generic; |
||||||
|
using System.Text; |
||||||
|
using System.Windows; |
||||||
|
using System.Windows.Controls; |
||||||
|
using System.Windows.Controls.Primitives; |
||||||
|
using System.Windows.Data; |
||||||
|
using System.Windows.Documents; |
||||||
|
using System.Windows.Input; |
||||||
|
using System.Windows.Media; |
||||||
|
using System.Windows.Media.Imaging; |
||||||
|
using System.Windows.Shapes; |
||||||
|
using System.ComponentModel; |
||||||
|
using System.Windows.Markup; |
||||||
|
using System.Diagnostics; |
||||||
|
using System.Windows.Threading; |
||||||
|
using System.Windows.Media.Animation; |
||||||
|
using System.Windows.Interop; |
||||||
|
using System.Linq; |
||||||
|
|
||||||
|
namespace AvalonDock |
||||||
|
{ |
||||||
|
public class DocumentFloatingWindow : FloatingWindow |
||||||
|
{ |
||||||
|
static DocumentFloatingWindow() |
||||||
|
{ |
||||||
|
//This OverrideMetadata call tells the system that this element wants to provide a style that is different than its base class.
|
||||||
|
//This style is defined in themes\generic.xaml
|
||||||
|
DefaultStyleKeyProperty.OverrideMetadata(typeof(DocumentFloatingWindow), new FrameworkPropertyMetadata(typeof(DocumentFloatingWindow))); |
||||||
|
|
||||||
|
ContentProperty.OverrideMetadata(typeof(DocumentFloatingWindow), |
||||||
|
new FrameworkPropertyMetadata( |
||||||
|
new PropertyChangedCallback(OnContentPropertyChanged), |
||||||
|
new CoerceValueCallback(OnCoerceValueContentProperty))); |
||||||
|
} |
||||||
|
|
||||||
|
//DocumentPane _previousPane = null;
|
||||||
|
|
||||||
|
//int _arrayIndexPreviousPane = -1;
|
||||||
|
|
||||||
|
internal DocumentFloatingWindow(DockingManager manager) |
||||||
|
:base(manager) |
||||||
|
{ |
||||||
|
} |
||||||
|
|
||||||
|
//public DocumentFloatingWindow(DockingManager manager, DocumentContent content)
|
||||||
|
// : this(manager)
|
||||||
|
//{
|
||||||
|
// //create a new temporary pane
|
||||||
|
// FloatingDocumentPane pane = new FloatingDocumentPane(this);
|
||||||
|
|
||||||
|
// //setup window size
|
||||||
|
// Width = content.ContainerPane.ActualWidth;
|
||||||
|
// Height = content.ContainerPane.ActualHeight;
|
||||||
|
|
||||||
|
// //save current content position in container pane
|
||||||
|
// _previousPane = content.ContainerPane as DocumentPane;
|
||||||
|
// _arrayIndexPreviousPane = _previousPane.Items.IndexOf(content);
|
||||||
|
// pane.SetValue(ResizingPanel.ResizeWidthProperty, _previousPane.GetValue(ResizingPanel.ResizeWidthProperty));
|
||||||
|
// pane.SetValue(ResizingPanel.ResizeHeightProperty, _previousPane.GetValue(ResizingPanel.ResizeHeightProperty));
|
||||||
|
|
||||||
|
// pane.Style = _previousPane.Style;
|
||||||
|
|
||||||
|
// //remove content from container pane
|
||||||
|
// _previousPane.RemoveContent(_arrayIndexPreviousPane);
|
||||||
|
|
||||||
|
// //add content to my temporary pane
|
||||||
|
// pane.Items.Add(content);
|
||||||
|
|
||||||
|
// //let templates access this pane
|
||||||
|
// SetHostedPane(pane);
|
||||||
|
|
||||||
|
// //if (IsDocumentFloatingAllowed)
|
||||||
|
// //{
|
||||||
|
// // AllowsTransparency = false;
|
||||||
|
// // WindowStyle = WindowStyle.ToolWindow;
|
||||||
|
// //}
|
||||||
|
//}
|
||||||
|
|
||||||
|
//public bool IsDocumentFloatingAllowed
|
||||||
|
//{
|
||||||
|
// get
|
||||||
|
// {
|
||||||
|
// if (HostedPane != null &&
|
||||||
|
// HostedPane.Items.Count > 0)
|
||||||
|
// return ((DocumentContent)HostedPane.Items[0]).IsFloatingAllowed;
|
||||||
|
|
||||||
|
// return false;
|
||||||
|
// }
|
||||||
|
//}
|
||||||
|
|
||||||
|
|
||||||
|
internal override void OnEndDrag() |
||||||
|
{ |
||||||
|
//if (HostedPane.Items.Count > 0)
|
||||||
|
//{
|
||||||
|
// DocumentContent content = HostedPane.Items[0] as DocumentContent;
|
||||||
|
// if (!content.IsFloatingAllowed)
|
||||||
|
// {
|
||||||
|
// HostedPane.Items.RemoveAt(0);
|
||||||
|
// _previousPane.Items.Insert(_arrayIndexPreviousPane, content);
|
||||||
|
// _previousPane.SelectedItem = content;
|
||||||
|
// Close();
|
||||||
|
// }
|
||||||
|
// else
|
||||||
|
// {
|
||||||
|
// DocumentPane originalDocumentPane = _previousPane as DocumentPane;
|
||||||
|
// originalDocumentPane.CheckContentsEmpty();
|
||||||
|
// }
|
||||||
|
//}
|
||||||
|
//else
|
||||||
|
//{
|
||||||
|
// DocumentPane originalDocumentPane = _previousPane as DocumentPane;
|
||||||
|
// originalDocumentPane.CheckContentsEmpty();
|
||||||
|
// Close();
|
||||||
|
//}
|
||||||
|
|
||||||
|
((FloatingDocumentPane)HostedPane).PreviousPane.CheckContentsEmpty(); |
||||||
|
|
||||||
|
if (HostedPane.Items.Count == 0) |
||||||
|
Close(); |
||||||
|
|
||||||
|
base.OnEndDrag(); |
||||||
|
} |
||||||
|
|
||||||
|
public override Pane ClonePane() |
||||||
|
{ |
||||||
|
DocumentPane paneToAnchor = new DocumentPane(); |
||||||
|
|
||||||
|
ResizingPanel.SetEffectiveSize(paneToAnchor, new Size(Width, Height)); |
||||||
|
|
||||||
|
//transfer contents from hosted pane in the floating window and
|
||||||
|
//the new created dockable pane
|
||||||
|
while (HostedPane.Items.Count > 0) |
||||||
|
{ |
||||||
|
paneToAnchor.Items.Add( |
||||||
|
HostedPane.RemoveContent(0)); |
||||||
|
} |
||||||
|
paneToAnchor.ApplyTemplate(); |
||||||
|
|
||||||
|
return paneToAnchor; |
||||||
|
} |
||||||
|
|
||||||
|
internal override void OnShowSelectionBox() |
||||||
|
{ |
||||||
|
this.Visibility = Visibility.Hidden; |
||||||
|
base.OnShowSelectionBox(); |
||||||
|
} |
||||||
|
|
||||||
|
internal override void OnHideSelectionBox() |
||||||
|
{ |
||||||
|
this.Visibility = Visibility.Visible; |
||||||
|
base.OnHideSelectionBox(); |
||||||
|
} |
||||||
|
|
||||||
|
public override void Dock() |
||||||
|
{ |
||||||
|
//if (_previousPane != null)
|
||||||
|
//{
|
||||||
|
// if (_previousPane.GetManager() == null)
|
||||||
|
// {
|
||||||
|
// Manager.MainDocumentPane.Items.Insert(0, HostedPane.RemoveContent(0));
|
||||||
|
// }
|
||||||
|
// else
|
||||||
|
// {
|
||||||
|
// if (_arrayIndexPreviousPane > _previousPane.Items.Count)
|
||||||
|
// _arrayIndexPreviousPane = _previousPane.Items.Count;
|
||||||
|
|
||||||
|
// _previousPane.Items.Insert(_arrayIndexPreviousPane, HostedPane.RemoveContent(0));
|
||||||
|
// _previousPane.SelectedIndex = _arrayIndexPreviousPane;
|
||||||
|
// }
|
||||||
|
// this.Close();
|
||||||
|
//}
|
||||||
|
|
||||||
|
((DocumentContent)HostedPane.Items[0]).Show(); |
||||||
|
|
||||||
|
base.Dock(); |
||||||
|
} |
||||||
|
|
||||||
|
protected override void FilterMessage(object sender, FilterMessageEventArgs e) |
||||||
|
{ |
||||||
|
e.Handled = false; |
||||||
|
|
||||||
|
if (Manager == null) |
||||||
|
return; |
||||||
|
|
||||||
|
switch (e.Msg) |
||||||
|
{ |
||||||
|
case WM_NCLBUTTONDOWN: //Left button down on title -> start dragging over docking manager
|
||||||
|
if (e.WParam.ToInt32() == HTCAPTION) |
||||||
|
{ |
||||||
|
short x = (short)((e.LParam.ToInt32() & 0xFFFF)); |
||||||
|
short y = (short)((e.LParam.ToInt32() >> 16)); |
||||||
|
|
||||||
|
Point clickPoint = this.TransformToDeviceDPI(new Point(x, y)); |
||||||
|
Manager.Drag(this, clickPoint, new Point(clickPoint.X - Left, clickPoint.Y - Top)); |
||||||
|
|
||||||
|
e.Handled = true; |
||||||
|
} |
||||||
|
break; |
||||||
|
case WM_NCLBUTTONDBLCLK: //Left Button Double Click -> Maximixe/Normal
|
||||||
|
if (e.WParam.ToInt32() == HTCAPTION) |
||||||
|
{ |
||||||
|
WindowState = WindowState == System.Windows.WindowState.Maximized ? |
||||||
|
System.Windows.WindowState.Normal : System.Windows.WindowState.Maximized; |
||||||
|
e.Handled = true; |
||||||
|
} |
||||||
|
break; |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
base.FilterMessage(sender, e); |
||||||
|
} |
||||||
|
|
||||||
|
protected override bool OpenContextMenu(UIElement popupButton, Point ptMouse) |
||||||
|
{ |
||||||
|
ContextMenu cxMenu = FindResource(new ComponentResourceKey(typeof(DockingManager), |
||||||
|
ContextMenuElement.DocumentFloatingWindow)) as ContextMenu; |
||||||
|
if (cxMenu != null) |
||||||
|
{ |
||||||
|
foreach (var menuItem in cxMenu.Items.OfType<MenuItem>()) |
||||||
|
menuItem.CommandTarget = HostedPane.SelectedItem as IInputElement; |
||||||
|
|
||||||
|
if (popupButton != null) |
||||||
|
{ |
||||||
|
cxMenu.Placement = PlacementMode.Bottom; |
||||||
|
cxMenu.PlacementTarget = popupButton; |
||||||
|
} |
||||||
|
else |
||||||
|
{ |
||||||
|
cxMenu.Placement = PlacementMode.Bottom; |
||||||
|
cxMenu.PlacementRectangle = new Rect(ptMouse, new Size(0, 0)); |
||||||
|
} |
||||||
|
|
||||||
|
cxMenu.IsOpen = true; |
||||||
|
return true; |
||||||
|
} |
||||||
|
|
||||||
|
return base.OpenContextMenu(popupButton, ptMouse); |
||||||
|
} |
||||||
|
|
||||||
|
static void OnContentPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) |
||||||
|
{ |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
static object OnCoerceValueContentProperty(DependencyObject d, object baseValue) |
||||||
|
{ |
||||||
|
DocumentFloatingWindow fl = ((DocumentFloatingWindow)d); |
||||||
|
|
||||||
|
if (fl.Content != null) |
||||||
|
{ |
||||||
|
throw new InvalidOperationException("Content on floating windows can't be set more than one time."); |
||||||
|
} |
||||||
|
|
||||||
|
if (!(baseValue is DocumentContent)) |
||||||
|
{ |
||||||
|
throw new InvalidOperationException("Content must be of type DocumentContent"); |
||||||
|
} |
||||||
|
|
||||||
|
FloatingDocumentPane paneToReturn = null; |
||||||
|
|
||||||
|
if (baseValue is DocumentContent) |
||||||
|
paneToReturn = new FloatingDocumentPane(fl, baseValue as DocumentContent); |
||||||
|
|
||||||
|
return paneToReturn; |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,254 @@ |
|||||||
|
//Copyright (c) 2007-2010, Adolfo Marinucci
|
||||||
|
//All rights reserved.
|
||||||
|
|
||||||
|
//Redistribution and use in source and binary forms, with or without modification,
|
||||||
|
//are permitted provided that the following conditions are met:
|
||||||
|
//
|
||||||
|
//* Redistributions of source code must retain the above copyright notice,
|
||||||
|
// this list of conditions and the following disclaimer.
|
||||||
|
//* Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
// this list of conditions and the following disclaimer in the documentation
|
||||||
|
// and/or other materials provided with the distribution.
|
||||||
|
//* Neither the name of Adolfo Marinucci nor the names of its contributors may
|
||||||
|
// be used to endorse or promote products derived from this software without
|
||||||
|
// specific prior written permission.
|
||||||
|
//
|
||||||
|
//THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||||
|
//AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
//WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||||
|
//IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||||
|
//INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||||
|
//PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||||
|
//HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||||
|
//OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
||||||
|
//EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
|
|
||||||
|
using System; |
||||||
|
using System.Collections.Generic; |
||||||
|
using System.Linq; |
||||||
|
using System.Text; |
||||||
|
using System.ComponentModel; |
||||||
|
using System.Windows; |
||||||
|
using System.Windows.Controls; |
||||||
|
using System.Windows.Media; |
||||||
|
using System.Windows.Input; |
||||||
|
using System.Windows.Controls.Primitives; |
||||||
|
|
||||||
|
namespace AvalonDock |
||||||
|
{ |
||||||
|
public class DocumentNavigatorWindow : AvalonDockWindow, INotifyPropertyChanged |
||||||
|
{ |
||||||
|
static DocumentNavigatorWindow() |
||||||
|
{ |
||||||
|
//DefaultStyleKeyProperty.OverrideMetadata(typeof(DocumentNavigatorWindow), new FrameworkPropertyMetadata(typeof(DocumentNavigatorWindow)));
|
||||||
|
|
||||||
|
|
||||||
|
AllowsTransparencyProperty.OverrideMetadata(typeof(DocumentNavigatorWindow), new FrameworkPropertyMetadata(true)); |
||||||
|
WindowStyleProperty.OverrideMetadata(typeof(DocumentNavigatorWindow), new FrameworkPropertyMetadata(WindowStyle.None)); |
||||||
|
ShowInTaskbarProperty.OverrideMetadata(typeof(DocumentNavigatorWindow), new FrameworkPropertyMetadata(false)); |
||||||
|
BackgroundProperty.OverrideMetadata(typeof(DocumentNavigatorWindow), new FrameworkPropertyMetadata(Brushes.Transparent)); |
||||||
|
} |
||||||
|
|
||||||
|
public static object Theme; |
||||||
|
|
||||||
|
internal DocumentNavigatorWindow() |
||||||
|
{ |
||||||
|
} |
||||||
|
|
||||||
|
void OnKeyUp(object sender, KeyEventArgs e) |
||||||
|
{ |
||||||
|
if (e.Key != Key.Tab) |
||||||
|
CloseThisWindow();//Hide();
|
||||||
|
else |
||||||
|
{ |
||||||
|
e.Handled = true; |
||||||
|
MoveNextSelectedContent(); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
void OnKeyDown(object sender, KeyEventArgs e) |
||||||
|
{ |
||||||
|
if (e.Key != Key.Tab) |
||||||
|
CloseThisWindow();//Hide();
|
||||||
|
else |
||||||
|
{ |
||||||
|
e.Handled = true; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
void CloseThisWindow() |
||||||
|
{ |
||||||
|
Window wndParent = this.Owner; |
||||||
|
Close(); |
||||||
|
wndParent.Activate(); |
||||||
|
} |
||||||
|
|
||||||
|
DockingManager _manager; |
||||||
|
public DocumentNavigatorWindow(DockingManager manager) |
||||||
|
:this() |
||||||
|
{ |
||||||
|
_manager = manager; |
||||||
|
Keyboard.AddKeyUpHandler(this, new KeyEventHandler(this.OnKeyUp)); |
||||||
|
Keyboard.AddKeyDownHandler(this, new KeyEventHandler(this.OnKeyDown)); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
protected override void OnActivated(EventArgs e) |
||||||
|
{ |
||||||
|
base.OnActivated(e); |
||||||
|
|
||||||
|
//List<DocumentContent> listOfDocuments = _manager.FindContents<DocumentContent>();
|
||||||
|
List<NavigatorWindowDocumentItem> docs = new List<NavigatorWindowDocumentItem>(); |
||||||
|
_manager.Documents.ForEach((DocumentContent doc) => |
||||||
|
{ |
||||||
|
docs.Add(new NavigatorWindowDocumentItem(doc)); |
||||||
|
}); |
||||||
|
|
||||||
|
//docs.Sort((NavigatorWindowDocumentItem item1, NavigatorWindowDocumentItem item2) =>
|
||||||
|
//{
|
||||||
|
// if (item1 == item2 ||
|
||||||
|
// item1.LastActivation == item2.LastActivation)
|
||||||
|
// return 0;
|
||||||
|
// return (item1.LastActivation < item2.LastActivation) ? 1 : -1;
|
||||||
|
//});
|
||||||
|
|
||||||
|
Documents = docs; |
||||||
|
|
||||||
|
_internalSelect = true; |
||||||
|
|
||||||
|
SelectedContent = Documents.Find((NavigatorWindowDocumentItem docItem) => |
||||||
|
{ |
||||||
|
return docItem.ItemContent == _manager.ActiveDocument; |
||||||
|
}); |
||||||
|
|
||||||
|
_internalSelect = false; |
||||||
|
} |
||||||
|
|
||||||
|
protected override void OnDeactivated(EventArgs e) |
||||||
|
{ |
||||||
|
if (_manager != null) |
||||||
|
{ |
||||||
|
Window mainWindow = Window.GetWindow(_manager); |
||||||
|
if (mainWindow != null) |
||||||
|
{ |
||||||
|
mainWindow.Activate(); |
||||||
|
if (SelectedContent != null) |
||||||
|
{ |
||||||
|
_manager.Show(SelectedContent.ItemContent as DocumentContent); |
||||||
|
SelectedContent.ItemContent.Activate(); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
if (!_isClosing) |
||||||
|
CloseThisWindow(); |
||||||
|
|
||||||
|
base.OnDeactivated(e); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
ListBox _itemsControl; |
||||||
|
|
||||||
|
public override void OnApplyTemplate() |
||||||
|
{ |
||||||
|
base.OnApplyTemplate(); |
||||||
|
|
||||||
|
_itemsControl = GetTemplateChild("PART_ScrollingPanel") as ListBox; |
||||||
|
} |
||||||
|
|
||||||
|
List<NavigatorWindowDocumentItem> _documents = new List<NavigatorWindowDocumentItem>(); |
||||||
|
|
||||||
|
public List<NavigatorWindowDocumentItem> Documents |
||||||
|
{ |
||||||
|
get { return _documents; } |
||||||
|
private |
||||||
|
set |
||||||
|
{ |
||||||
|
_documents = value; |
||||||
|
NotifyPropertyChanged("Documents"); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
NavigatorWindowDocumentItem _selectedContent; |
||||||
|
|
||||||
|
bool _internalSelect = false; |
||||||
|
|
||||||
|
public NavigatorWindowDocumentItem SelectedContent |
||||||
|
{ |
||||||
|
get |
||||||
|
{ |
||||||
|
return _selectedContent; |
||||||
|
} |
||||||
|
set |
||||||
|
{ |
||||||
|
if (_selectedContent != value) |
||||||
|
{ |
||||||
|
_selectedContent = value; |
||||||
|
NotifyPropertyChanged("SelectedContent"); |
||||||
|
|
||||||
|
if (!_internalSelect && _selectedContent != null) |
||||||
|
CloseThisWindow();//Hide();
|
||||||
|
|
||||||
|
if (_internalSelect && _itemsControl != null) |
||||||
|
_itemsControl.ScrollIntoView(_selectedContent); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
public void MoveNextSelectedContent() |
||||||
|
{ |
||||||
|
if (_selectedContent == null) |
||||||
|
return; |
||||||
|
|
||||||
|
if (Documents.Contains(SelectedContent)) |
||||||
|
{ |
||||||
|
int indexOfSelecteContent = Documents.IndexOf(_selectedContent); |
||||||
|
|
||||||
|
if (indexOfSelecteContent == Documents.Count - 1) |
||||||
|
{ |
||||||
|
indexOfSelecteContent = 0; |
||||||
|
} |
||||||
|
else |
||||||
|
indexOfSelecteContent++; |
||||||
|
|
||||||
|
_internalSelect = true; |
||||||
|
SelectedContent = Documents[indexOfSelecteContent]; |
||||||
|
_internalSelect = false; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
bool _isClosing = false; |
||||||
|
protected override void OnClosing(CancelEventArgs e) |
||||||
|
{ |
||||||
|
_isClosing = true; |
||||||
|
|
||||||
|
base.OnClosing(e); |
||||||
|
} |
||||||
|
|
||||||
|
protected override void OnClosed(EventArgs e) |
||||||
|
{ |
||||||
|
//reset documents list to avoid WPF Bug:
|
||||||
|
//http://social.msdn.microsoft.com/forums/en/wpf/thread/f3fc5b7e-e035-4821-908c-b6c07e5c7042/
|
||||||
|
//http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=321955
|
||||||
|
Documents = new List<NavigatorWindowDocumentItem>(); |
||||||
|
|
||||||
|
base.OnClosed(e); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
#region INotifyPropertyChanged Members
|
||||||
|
|
||||||
|
public event PropertyChangedEventHandler PropertyChanged; |
||||||
|
|
||||||
|
void NotifyPropertyChanged(string propertyName) |
||||||
|
{ |
||||||
|
if (PropertyChanged != null) |
||||||
|
PropertyChanged(this, new PropertyChangedEventArgs(propertyName)); |
||||||
|
} |
||||||
|
#endregion
|
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
@ -0,0 +1,525 @@ |
|||||||
|
//Copyright (c) 2007-2010, Adolfo Marinucci
|
||||||
|
//All rights reserved.
|
||||||
|
|
||||||
|
//Redistribution and use in source and binary forms, with or without modification,
|
||||||
|
//are permitted provided that the following conditions are met:
|
||||||
|
//
|
||||||
|
//* Redistributions of source code must retain the above copyright notice,
|
||||||
|
// this list of conditions and the following disclaimer.
|
||||||
|
//* Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
// this list of conditions and the following disclaimer in the documentation
|
||||||
|
// and/or other materials provided with the distribution.
|
||||||
|
//* Neither the name of Adolfo Marinucci nor the names of its contributors may
|
||||||
|
// be used to endorse or promote products derived from this software without
|
||||||
|
// specific prior written permission.
|
||||||
|
//
|
||||||
|
//THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||||
|
//AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
//WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||||
|
//IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||||
|
//INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||||
|
//PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||||
|
//HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||||
|
//OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
||||||
|
//EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
|
using System; |
||||||
|
using System.Collections.Generic; |
||||||
|
using System.Text; |
||||||
|
using System.Windows; |
||||||
|
using System.Windows.Controls; |
||||||
|
using System.Windows.Controls.Primitives; |
||||||
|
using System.Windows.Data; |
||||||
|
using System.Windows.Documents; |
||||||
|
using System.Windows.Input; |
||||||
|
using System.Windows.Media; |
||||||
|
using System.Windows.Media.Imaging; |
||||||
|
using System.Windows.Shapes; |
||||||
|
using System.Diagnostics; |
||||||
|
using System.Linq; |
||||||
|
|
||||||
|
namespace AvalonDock |
||||||
|
{ |
||||||
|
public class DocumentPane : Pane |
||||||
|
{ |
||||||
|
static DocumentPane() |
||||||
|
{ |
||||||
|
//This OverrideMetadata call tells the system that this element wants to provide a style that is different than its base class.
|
||||||
|
//This style is defined in themes\generic.xaml
|
||||||
|
DefaultStyleKeyProperty.OverrideMetadata(typeof(DocumentPane), new FrameworkPropertyMetadata(typeof(DocumentPane))); |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
public DocumentPane() |
||||||
|
{ |
||||||
|
this.Loaded += new RoutedEventHandler(DocumentPane_Loaded); |
||||||
|
} |
||||||
|
|
||||||
|
void DocumentPane_Loaded(object sender, RoutedEventArgs e) |
||||||
|
{ |
||||||
|
if (Parent == null) |
||||||
|
return; |
||||||
|
|
||||||
|
if (GetManager() == null) |
||||||
|
return; |
||||||
|
//throw new InvalidOperationException("DocumentPane must be put under a DockingManager!");
|
||||||
|
|
||||||
|
//try to set this as main document pane
|
||||||
|
if (GetManager().MainDocumentPane == null) |
||||||
|
{ |
||||||
|
GetManager().MainDocumentPane = this; |
||||||
|
NotifyPropertyChanged("IsMainDocumentPane"); |
||||||
|
} |
||||||
|
else |
||||||
|
{ |
||||||
|
//or ensure that this document pane is under or at the same level of the MainDocumentPane
|
||||||
|
GetManager().EnsurePanePositionIsValid(this); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns a value indicating if this pane is the main document pane
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>The main document pane is the default pane that remains always visible.</remarks>
|
||||||
|
public bool? IsMainDocumentPane |
||||||
|
{ |
||||||
|
get |
||||||
|
{ |
||||||
|
if (GetManager() == null) |
||||||
|
return null; |
||||||
|
|
||||||
|
return GetManager().MainDocumentPane == this; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
#region ContainsActiveDocument
|
||||||
|
|
||||||
|
internal void RefreshContainsActiveDocumentProperty() |
||||||
|
{ |
||||||
|
SetContainsActiveDocument( |
||||||
|
Items.Cast<ManagedContent>().FirstOrDefault(d => d.IsActiveDocument) != null); |
||||||
|
|
||||||
|
if (Items.Count > 0) |
||||||
|
Debug.WriteLine("{0} ContainsActiveDocument ={1}", (Items[0] as ManagedContent).Title, ContainsActiveDocument); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// ContainsActiveDocument Read-Only Dependency Property
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>This property is especially intended for use in restyling.</remarks>
|
||||||
|
private static readonly DependencyPropertyKey ContainsActiveDocumentPropertyKey |
||||||
|
= DependencyProperty.RegisterReadOnly("ContainsActiveDocument", typeof(bool), typeof(DocumentPane), |
||||||
|
new FrameworkPropertyMetadata((bool)false, |
||||||
|
new PropertyChangedCallback(OnContainsActiveDocumentChanged))); |
||||||
|
|
||||||
|
public static readonly DependencyProperty ContainsActiveDocumentProperty |
||||||
|
= ContainsActiveDocumentPropertyKey.DependencyProperty; |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the ContainsActiveDocument property. This dependency property
|
||||||
|
/// indicates if this pane contains a <see cref="DocumentPane"/> that has <see cref="ManagedContent.IsActiveDocument"/> property set to true.
|
||||||
|
/// </summary>
|
||||||
|
public bool ContainsActiveDocument |
||||||
|
{ |
||||||
|
get { return (bool)GetValue(ContainsActiveDocumentProperty); } |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Provides a secure method for setting the ContainsActiveDocument property.
|
||||||
|
/// This dependency property indicates if this pane contains a <see cref="DocumentPane"/> that has <see cref="ManagedContent.IsActiveDocument"/> property set to true.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="value">The new value for the property.</param>
|
||||||
|
protected void SetContainsActiveDocument(bool value) |
||||||
|
{ |
||||||
|
SetValue(ContainsActiveDocumentPropertyKey, value); |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Handles changes to the ContainsActiveDocument property.
|
||||||
|
/// </summary>
|
||||||
|
private static void OnContainsActiveDocumentChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) |
||||||
|
{ |
||||||
|
((DocumentPane)d).OnContainsActiveDocumentChanged(e); |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Provides derived classes an opportunity to handle changes to the ContainsActiveDocument property.
|
||||||
|
/// </summary>
|
||||||
|
protected virtual void OnContainsActiveDocumentChanged(DependencyPropertyChangedEventArgs e) |
||||||
|
{ |
||||||
|
NotifyPropertyChanged("ContainsActiveDocument"); |
||||||
|
} |
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
protected override void OnInitialized(EventArgs e) |
||||||
|
{ |
||||||
|
this.CommandBindings.Add( |
||||||
|
new CommandBinding(DocumentPaneCommands.CloseThis, OnExecuteCommand, OnCanExecuteCommand)); |
||||||
|
this.CommandBindings.Add( |
||||||
|
new CommandBinding(DocumentPaneCommands.CloseAllButThis, this.OnExecuteCommand, this.OnCanExecuteCommand)); |
||||||
|
this.CommandBindings.Add( |
||||||
|
new CommandBinding(DocumentPaneCommands.NewHorizontalTabGroup, this.OnExecuteCommand, this.OnCanExecuteCommand)); |
||||||
|
this.CommandBindings.Add( |
||||||
|
new CommandBinding(DocumentPaneCommands.NewVerticalTabGroup, this.OnExecuteCommand, this.OnCanExecuteCommand)); |
||||||
|
|
||||||
|
|
||||||
|
base.OnInitialized(e); |
||||||
|
} |
||||||
|
|
||||||
|
#region DocumentPane Commands
|
||||||
|
|
||||||
|
//#region Show Document Window List Command
|
||||||
|
|
||||||
|
//public static RoutedCommand ShowDocumentsListMenuCommand = new RoutedCommand();
|
||||||
|
|
||||||
|
//public void ExecutedShowDocumentsListMenuCommand(object sender,
|
||||||
|
// ExecutedRoutedEventArgs e)
|
||||||
|
//{
|
||||||
|
// //MessageBox.Show("ShowOptionsMenu");
|
||||||
|
// ShowDocumentsListMenu();
|
||||||
|
//}
|
||||||
|
|
||||||
|
|
||||||
|
//public void CanExecuteShowDocumentsListMenuCommand(object sender,
|
||||||
|
// CanExecuteRoutedEventArgs e)
|
||||||
|
//{
|
||||||
|
// e.CanExecute = true;
|
||||||
|
//}
|
||||||
|
|
||||||
|
//#endregion
|
||||||
|
|
||||||
|
//#region Close Command
|
||||||
|
|
||||||
|
////ApplicationCommands.Close command....
|
||||||
|
|
||||||
|
//public void ExecutedCloseCommand(object sender,
|
||||||
|
// ExecutedRoutedEventArgs e)
|
||||||
|
//{
|
||||||
|
//}
|
||||||
|
|
||||||
|
|
||||||
|
//public void CanExecuteCloseCommand(object sender,
|
||||||
|
// CanExecuteRoutedEventArgs e)
|
||||||
|
//{
|
||||||
|
// e.CanExecute = true;
|
||||||
|
//}
|
||||||
|
|
||||||
|
//#endregion
|
||||||
|
|
||||||
|
#region Commands
|
||||||
|
|
||||||
|
protected override void OnExecuteCommand(object sender, ExecutedRoutedEventArgs e) |
||||||
|
{ |
||||||
|
if (e.Command == DocumentPaneCommands.CloseThis) |
||||||
|
{ |
||||||
|
CloseThis(e.Parameter as ManagedContent); |
||||||
|
e.Handled = true; |
||||||
|
} |
||||||
|
else if (e.Command == DocumentPaneCommands.CloseAllButThis) |
||||||
|
{ |
||||||
|
CloseAllButThis(); |
||||||
|
e.Handled = true; |
||||||
|
} |
||||||
|
else if (e.Command == DocumentPaneCommands.NewHorizontalTabGroup) |
||||||
|
{ |
||||||
|
CreateNewHorizontalTabGroup(); |
||||||
|
e.Handled = true; |
||||||
|
} |
||||||
|
else if (e.Command == DocumentPaneCommands.NewVerticalTabGroup) |
||||||
|
{ |
||||||
|
CreateNewVerticalTabGroup(); |
||||||
|
e.Handled = true; |
||||||
|
} |
||||||
|
//else if (e.Command == DocumentPaneCommands.ActivateDocument)
|
||||||
|
//{
|
||||||
|
// ManagedContent doc = e.Parameter as ManagedContent;
|
||||||
|
// if (doc != null)
|
||||||
|
// {
|
||||||
|
// doc.Activate();
|
||||||
|
// }
|
||||||
|
//}
|
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
protected override void OnCanExecuteCommand(object sender, CanExecuteRoutedEventArgs e) |
||||||
|
{ |
||||||
|
e.CanExecute = this.GetManager() != null; |
||||||
|
|
||||||
|
if (e.CanExecute) |
||||||
|
{ |
||||||
|
if (e.Command == DocumentPaneCommands.NewHorizontalTabGroup || |
||||||
|
e.Command == DocumentPaneCommands.NewVerticalTabGroup || |
||||||
|
e.Command == DocumentPaneCommands.CloseAllButThis) |
||||||
|
{ |
||||||
|
if (this.Items.Count <= 1) |
||||||
|
e.CanExecute = false; |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public void Close() |
||||||
|
{ |
||||||
|
CloseThis(null); |
||||||
|
} |
||||||
|
|
||||||
|
void CloseThis(ManagedContent contentToClose) |
||||||
|
{ |
||||||
|
if (GetManager() == null) |
||||||
|
return; |
||||||
|
|
||||||
|
if (contentToClose == null) |
||||||
|
contentToClose = SelectedItem as ManagedContent; |
||||||
|
|
||||||
|
DockableContent dockableContent = contentToClose as DockableContent; |
||||||
|
|
||||||
|
if (dockableContent != null) |
||||||
|
dockableContent.Close(); |
||||||
|
else |
||||||
|
{ |
||||||
|
DocumentContent documentContent = contentToClose as DocumentContent; |
||||||
|
documentContent.Close(); |
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
void CloseAllButThis() |
||||||
|
{ |
||||||
|
DocumentContent activeContent = GetManager().ActiveDocument as DocumentContent; |
||||||
|
foreach (DocumentContent cnt in this.GetManager().Documents.ToArray()) |
||||||
|
{ |
||||||
|
if (cnt != activeContent) |
||||||
|
cnt.Close(); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public DocumentPane CreateNewHorizontalTabGroup() |
||||||
|
{ |
||||||
|
ManagedContent activeContent = SelectedItem as ManagedContent; |
||||||
|
DocumentPane newContainerPane = new DocumentPane(); |
||||||
|
|
||||||
|
int indexOfDocumentInItsContainer = activeContent.ContainerPane.Items.IndexOf(activeContent); |
||||||
|
activeContent.ContainerPane.RemoveContent(indexOfDocumentInItsContainer); |
||||||
|
newContainerPane.Items.Add(activeContent); |
||||||
|
|
||||||
|
GetManager().Anchor(newContainerPane, this, AnchorStyle.Bottom); |
||||||
|
|
||||||
|
return newContainerPane; |
||||||
|
} |
||||||
|
|
||||||
|
public DocumentPane CreateNewVerticalTabGroup() |
||||||
|
{ |
||||||
|
ManagedContent activeContent = SelectedItem as ManagedContent; |
||||||
|
DocumentPane newContainerPane = new DocumentPane(); |
||||||
|
|
||||||
|
int indexOfDocumentInItsContainer = activeContent.ContainerPane.Items.IndexOf(activeContent); |
||||||
|
activeContent.ContainerPane.RemoveContent(indexOfDocumentInItsContainer); |
||||||
|
newContainerPane.Items.Add(activeContent); |
||||||
|
|
||||||
|
GetManager().Anchor(newContainerPane, this, AnchorStyle.Right); |
||||||
|
|
||||||
|
return newContainerPane; |
||||||
|
} |
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
Button _optionsContextMenuPlacementTarget; |
||||||
|
|
||||||
|
public override void OnApplyTemplate() |
||||||
|
{ |
||||||
|
_optionsContextMenuPlacementTarget = GetTemplateChild("PART_ShowContextMenuButton") as Button; |
||||||
|
|
||||||
|
if (_optionsContextMenuPlacementTarget != null) |
||||||
|
{ |
||||||
|
_optionsContextMenuPlacementTarget.Click += (s, e) => { ShowDocumentsListMenu(); }; |
||||||
|
} |
||||||
|
|
||||||
|
base.OnApplyTemplate(); |
||||||
|
} |
||||||
|
|
||||||
|
void ShowDocumentsListMenu() |
||||||
|
{ |
||||||
|
if (Items.Count == 0) |
||||||
|
return; //nothings to show
|
||||||
|
|
||||||
|
ContextMenu cxMenuDocuments = (ContextMenu)TryFindResource("DocumentsListMenu"); |
||||||
|
if (cxMenuDocuments != null) |
||||||
|
{ |
||||||
|
cxMenuDocuments.ItemsSource = Items.OfType<ManagedContent>().OrderBy(c => c.Title); |
||||||
|
//cxMenuDocuments.CommandBindings.Add(new CommandBinding(ActivateDocumentCommand, new ExecutedRoutedEventHandler(this.ExecutedActivateDocumentCommand), new CanExecuteRoutedEventHandler(CanExecuteActivateDocumentCommand)));
|
||||||
|
|
||||||
|
if (_optionsContextMenuPlacementTarget != null) |
||||||
|
{ |
||||||
|
cxMenuDocuments.Placement = PlacementMode.Bottom; |
||||||
|
cxMenuDocuments.PlacementTarget = _optionsContextMenuPlacementTarget; |
||||||
|
} |
||||||
|
else |
||||||
|
{ |
||||||
|
cxMenuDocuments.Placement = PlacementMode.MousePoint; |
||||||
|
cxMenuDocuments.PlacementTarget = this; |
||||||
|
} |
||||||
|
|
||||||
|
cxMenuDocuments.IsOpen = true; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
protected override void OnMouseDown(MouseButtonEventArgs e) |
||||||
|
{ |
||||||
|
base.OnMouseDown(e); |
||||||
|
|
||||||
|
if (!e.Handled) |
||||||
|
{ |
||||||
|
if (_partHeader != null && |
||||||
|
!_partHeader.IsMouseOver) |
||||||
|
{ |
||||||
|
//prevent document content to start dragging when it is clicked outside of the header area
|
||||||
|
e.Handled = true; |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
internal void CheckContentsEmpty() |
||||||
|
{ |
||||||
|
if (Items.Count == 0) |
||||||
|
{ |
||||||
|
bool isMainDocPaneToBeClose = IsMainDocumentPane.HasValue && |
||||||
|
IsMainDocumentPane.Value; |
||||||
|
|
||||||
|
if (isMainDocPaneToBeClose) |
||||||
|
{ |
||||||
|
DockingManager manager = GetManager(); |
||||||
|
DocumentPane candidateNewMainDocPane = manager.FindAnotherLogicalChildContained<DocumentPane>(this); |
||||||
|
if (candidateNewMainDocPane != null) |
||||||
|
{ |
||||||
|
ResizingPanel containerPanel = Parent as ResizingPanel; |
||||||
|
if (containerPanel != null) |
||||||
|
containerPanel.RemoveChild(this); |
||||||
|
|
||||||
|
manager.MainDocumentPane = candidateNewMainDocPane; |
||||||
|
candidateNewMainDocPane.NotifyPropertyChanged("IsMainDocumentPane"); |
||||||
|
} |
||||||
|
} |
||||||
|
else |
||||||
|
{ |
||||||
|
ResizingPanel containerPanel = Parent as ResizingPanel; |
||||||
|
if (containerPanel != null) |
||||||
|
containerPanel.RemoveChild(this); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
internal override ResizingPanel GetContainerPanel() |
||||||
|
{ |
||||||
|
return GetParentDocumentPaneResizingPanel(); |
||||||
|
} |
||||||
|
|
||||||
|
internal DocumentPaneResizingPanel GetParentDocumentPaneResizingPanel() |
||||||
|
{ |
||||||
|
ResizingPanel parentPanel = LogicalTreeHelper.GetParent(this) as ResizingPanel; |
||||||
|
|
||||||
|
if (parentPanel == null) |
||||||
|
return null; |
||||||
|
|
||||||
|
while (!(parentPanel is DocumentPaneResizingPanel)) |
||||||
|
{ |
||||||
|
parentPanel = LogicalTreeHelper.GetParent(parentPanel) as ResizingPanel; |
||||||
|
|
||||||
|
if (parentPanel == null) |
||||||
|
return null; |
||||||
|
} |
||||||
|
|
||||||
|
return parentPanel as DocumentPaneResizingPanel; |
||||||
|
} |
||||||
|
|
||||||
|
protected override bool IsSurfaceVisible |
||||||
|
{ |
||||||
|
get |
||||||
|
{ |
||||||
|
if (IsMainDocumentPane.HasValue && |
||||||
|
!IsMainDocumentPane.Value && |
||||||
|
Items.Count == 0) |
||||||
|
return false; |
||||||
|
|
||||||
|
return true; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
protected override Rect SurfaceRectangle |
||||||
|
{ |
||||||
|
get |
||||||
|
{ |
||||||
|
return base.SurfaceRectangle; |
||||||
|
//it is dragging a document let drop in this document pane
|
||||||
|
//if (GetManager().DragPaneServices.FloatingWindow is DocumentFloatingWindow)
|
||||||
|
// return base.SurfaceRectangle;
|
||||||
|
|
||||||
|
////otherwise we should provide a drop surface for all the DocumentPaneResizingPanel
|
||||||
|
//DocumentPaneResizingPanel parentPanel = GetParentDocumentPaneResizingPanel();
|
||||||
|
|
||||||
|
//if (parentPanel == null)
|
||||||
|
// return base.SurfaceRectangle;
|
||||||
|
|
||||||
|
//return new Rect(HelperFunc.PointToScreenWithoutFlowDirection(parentPanel, new Point(0, 0)), new Size(parentPanel.ActualWidth, parentPanel.ActualHeight));
|
||||||
|
//return new Rect(parentPanel.PointToScreen(new Point(0, 0)), new Size(parentPanel.ActualWidth, parentPanel.ActualHeight));
|
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
protected override void OnItemsChanged(System.Collections.Specialized.NotifyCollectionChangedEventArgs e) |
||||||
|
{ |
||||||
|
if (e.NewItems != null) |
||||||
|
{ |
||||||
|
foreach (object newItem in e.NewItems) |
||||||
|
{ |
||||||
|
if (!(newItem is DockableContent) && |
||||||
|
!(newItem is DocumentContent)) |
||||||
|
throw new InvalidOperationException("DocumentPane can contain only DockableContents or DocumentContents!"); |
||||||
|
|
||||||
|
if (newItem is DockableContent && |
||||||
|
(((DockableContent)newItem).DockableStyle & DockableStyle.Document) == 0) |
||||||
|
{ |
||||||
|
((DockableContent)newItem).DockableStyle |= DockableStyle.Document; |
||||||
|
} |
||||||
|
|
||||||
|
var dockContent = newItem as DockableContent; |
||||||
|
if (dockContent != null) |
||||||
|
dockContent.SetStateToDocument(); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
RefreshContainsActiveDocumentProperty(); |
||||||
|
|
||||||
|
//if (Items.Count > 0 &&
|
||||||
|
// SelectedItem == null &&
|
||||||
|
// GetManager() != null)
|
||||||
|
//{
|
||||||
|
// //get previously activated content
|
||||||
|
// var documentToActivate = Items.OrderBy(d => d.LastActivation).LastOrDefault(d => d != cntDeactivated);
|
||||||
|
|
||||||
|
// Debug.WriteLine(string.Format("Activated Document '{0}'", documentToActivate != null ? documentToActivate.Title : "<none>"));
|
||||||
|
|
||||||
|
// if (documentToActivate != null)
|
||||||
|
// documentToActivate.Activate();
|
||||||
|
// //ActiveDocument = MainDocumentPane.SelectedItem as ManagedContent;
|
||||||
|
//}
|
||||||
|
|
||||||
|
base.OnItemsChanged(e); |
||||||
|
} |
||||||
|
|
||||||
|
protected override void OnSelectionChanged(SelectionChangedEventArgs e) |
||||||
|
{ |
||||||
|
ManagedContent selectedContent = this.SelectedItem as ManagedContent; |
||||||
|
if (selectedContent != null && GetManager() != null) |
||||||
|
GetManager().ActiveDocument = selectedContent; |
||||||
|
|
||||||
|
base.OnSelectionChanged(e); |
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,142 @@ |
|||||||
|
//Copyright (c) 2007-2010, Adolfo Marinucci
|
||||||
|
//All rights reserved.
|
||||||
|
|
||||||
|
//Redistribution and use in source and binary forms, with or without modification,
|
||||||
|
//are permitted provided that the following conditions are met:
|
||||||
|
//
|
||||||
|
//* Redistributions of source code must retain the above copyright notice,
|
||||||
|
// this list of conditions and the following disclaimer.
|
||||||
|
//* Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
// this list of conditions and the following disclaimer in the documentation
|
||||||
|
// and/or other materials provided with the distribution.
|
||||||
|
//* Neither the name of Adolfo Marinucci nor the names of its contributors may
|
||||||
|
// be used to endorse or promote products derived from this software without
|
||||||
|
// specific prior written permission.
|
||||||
|
//
|
||||||
|
//THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||||
|
//AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
//WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||||
|
//IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||||
|
//INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||||
|
//PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||||
|
//HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||||
|
//OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
||||||
|
//EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
|
using System; |
||||||
|
using System.Collections.Generic; |
||||||
|
using System.Linq; |
||||||
|
using System.Text; |
||||||
|
using System.Windows.Input; |
||||||
|
|
||||||
|
namespace AvalonDock |
||||||
|
{ |
||||||
|
public sealed class DocumentPaneCommands |
||||||
|
{ |
||||||
|
private static object syncRoot = new object(); |
||||||
|
|
||||||
|
|
||||||
|
private static RoutedUICommand closeAllButThisCommand = null; |
||||||
|
public static RoutedUICommand CloseAllButThis |
||||||
|
{ |
||||||
|
get |
||||||
|
{ |
||||||
|
lock (syncRoot) |
||||||
|
{ |
||||||
|
if (null == closeAllButThisCommand) |
||||||
|
{ |
||||||
|
closeAllButThisCommand = new RoutedUICommand(AvalonDock.Properties.Resources.DocumentPaneCommands_CloseAllButThis, "CloseAllButThis", typeof(DocumentPaneCommands)); |
||||||
|
} |
||||||
|
} |
||||||
|
return closeAllButThisCommand; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
private static RoutedUICommand closeThisCommand = null; |
||||||
|
public static RoutedUICommand CloseThis |
||||||
|
{ |
||||||
|
get |
||||||
|
{ |
||||||
|
lock (syncRoot) |
||||||
|
{ |
||||||
|
if (null == closeThisCommand) |
||||||
|
{ |
||||||
|
closeThisCommand = new RoutedUICommand(AvalonDock.Properties.Resources.DocumentPaneCommands_CloseThis, "Close", typeof(DocumentPaneCommands)); |
||||||
|
} |
||||||
|
} |
||||||
|
return closeThisCommand; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
private static RoutedUICommand newHTabGroupCommand = null; |
||||||
|
public static RoutedUICommand NewHorizontalTabGroup |
||||||
|
{ |
||||||
|
get |
||||||
|
{ |
||||||
|
lock (syncRoot) |
||||||
|
{ |
||||||
|
if (null == newHTabGroupCommand) |
||||||
|
{ |
||||||
|
newHTabGroupCommand = new RoutedUICommand(AvalonDock.Properties.Resources.DocumentPaneCommands_NewHorizontalTabGroup, "NewHorizontalTabGroup", typeof(DocumentPaneCommands)); |
||||||
|
} |
||||||
|
} |
||||||
|
return newHTabGroupCommand; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
private static RoutedUICommand newVTabGroupCommand = null; |
||||||
|
public static RoutedUICommand NewVerticalTabGroup |
||||||
|
{ |
||||||
|
get |
||||||
|
{ |
||||||
|
lock (syncRoot) |
||||||
|
{ |
||||||
|
if (null == newVTabGroupCommand) |
||||||
|
{ |
||||||
|
newVTabGroupCommand = new RoutedUICommand(AvalonDock.Properties.Resources.DocumentPaneCommands_NewVerticalTabGroup, "NewVerticalTabGroup", typeof(DocumentPaneCommands)); |
||||||
|
} |
||||||
|
} |
||||||
|
return newVTabGroupCommand; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
//private static RoutedUICommand activateDocument = null;
|
||||||
|
//public static RoutedUICommand ActivateDocument
|
||||||
|
//{
|
||||||
|
// get
|
||||||
|
// {
|
||||||
|
// lock (syncRoot)
|
||||||
|
// {
|
||||||
|
// if (null == activateDocument)
|
||||||
|
// {
|
||||||
|
// activateDocument = new RoutedUICommand("Activate Document", "ActivateDocuement", typeof(DocumentPaneCommands));
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// return activateDocument;
|
||||||
|
// }
|
||||||
|
//}
|
||||||
|
|
||||||
|
//#region Activate Document Command
|
||||||
|
//public static RoutedCommand ActivateDocumentCommand = new RoutedCommand();
|
||||||
|
|
||||||
|
//public void ExecutedActivateDocumentCommand(object sender,
|
||||||
|
// ExecutedRoutedEventArgs e)
|
||||||
|
//{
|
||||||
|
// ManagedContent doc = e.Parameter as ManagedContent;
|
||||||
|
// if (doc != null)
|
||||||
|
// {
|
||||||
|
// doc.Activate();
|
||||||
|
// }
|
||||||
|
//}
|
||||||
|
|
||||||
|
//public void CanExecuteActivateDocumentCommand(object sender,
|
||||||
|
// CanExecuteRoutedEventArgs e)
|
||||||
|
//{
|
||||||
|
// e.CanExecute = true;
|
||||||
|
//}
|
||||||
|
|
||||||
|
//#endregion
|
||||||
|
|
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,55 @@ |
|||||||
|
//Copyright (c) 2007-2010, Adolfo Marinucci
|
||||||
|
//All rights reserved.
|
||||||
|
|
||||||
|
//Redistribution and use in source and binary forms, with or without modification,
|
||||||
|
//are permitted provided that the following conditions are met:
|
||||||
|
//
|
||||||
|
//* Redistributions of source code must retain the above copyright notice,
|
||||||
|
// this list of conditions and the following disclaimer.
|
||||||
|
//* Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
// this list of conditions and the following disclaimer in the documentation
|
||||||
|
// and/or other materials provided with the distribution.
|
||||||
|
//* Neither the name of Adolfo Marinucci nor the names of its contributors may
|
||||||
|
// be used to endorse or promote products derived from this software without
|
||||||
|
// specific prior written permission.
|
||||||
|
//
|
||||||
|
//THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||||
|
//AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
//WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||||
|
//IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||||
|
//INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||||
|
//PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||||
|
//HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||||
|
//OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
||||||
|
//EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
|
using System; |
||||||
|
using System.Collections.Generic; |
||||||
|
using System.Text; |
||||||
|
using System.Windows; |
||||||
|
using System.Windows.Controls; |
||||||
|
using System.Windows.Controls.Primitives; |
||||||
|
using System.Windows.Data; |
||||||
|
using System.Windows.Documents; |
||||||
|
using System.Windows.Input; |
||||||
|
using System.Windows.Media; |
||||||
|
using System.Windows.Media.Imaging; |
||||||
|
using System.Windows.Shapes; |
||||||
|
using System.Windows.Markup; |
||||||
|
using System.Diagnostics; |
||||||
|
|
||||||
|
namespace AvalonDock |
||||||
|
{ |
||||||
|
public class DocumentPaneResizingPanel : ResizingPanel |
||||||
|
{ |
||||||
|
|
||||||
|
//#if DEBUG
|
||||||
|
// static int inst = 0;
|
||||||
|
// public DocumentPaneResizingPanel()
|
||||||
|
// {
|
||||||
|
// inst++;
|
||||||
|
// Debug.Assert(inst < 2);
|
||||||
|
// }
|
||||||
|
//#endif
|
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,131 @@ |
|||||||
|
//Copyright (c) 2007-2010, Adolfo Marinucci
|
||||||
|
//All rights reserved.
|
||||||
|
|
||||||
|
//Redistribution and use in source and binary forms, with or without modification,
|
||||||
|
//are permitted provided that the following conditions are met:
|
||||||
|
//
|
||||||
|
//* Redistributions of source code must retain the above copyright notice,
|
||||||
|
// this list of conditions and the following disclaimer.
|
||||||
|
//* Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
// this list of conditions and the following disclaimer in the documentation
|
||||||
|
// and/or other materials provided with the distribution.
|
||||||
|
//* Neither the name of Adolfo Marinucci nor the names of its contributors may
|
||||||
|
// be used to endorse or promote products derived from this software without
|
||||||
|
// specific prior written permission.
|
||||||
|
//
|
||||||
|
//THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||||
|
//AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
//WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||||
|
//IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||||
|
//INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||||
|
//PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||||
|
//HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||||
|
//OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
||||||
|
//EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
|
|
||||||
|
using System; |
||||||
|
using System.Collections.Generic; |
||||||
|
using System.Text; |
||||||
|
using System.Windows; |
||||||
|
using System.Windows.Controls; |
||||||
|
using System.Windows.Controls.Primitives; |
||||||
|
using System.Windows.Data; |
||||||
|
using System.Windows.Documents; |
||||||
|
using System.Windows.Input; |
||||||
|
using System.Windows.Media; |
||||||
|
using System.Windows.Media.Imaging; |
||||||
|
using System.Windows.Shapes; |
||||||
|
using System.Diagnostics; |
||||||
|
using System.ComponentModel; |
||||||
|
|
||||||
|
namespace AvalonDock |
||||||
|
{ |
||||||
|
[EditorBrowsable(EditorBrowsableState.Never)] |
||||||
|
public class DocumentTabPanel : PaneTabPanel |
||||||
|
{ |
||||||
|
public static bool GetIsHeaderVisible(DependencyObject obj) |
||||||
|
{ |
||||||
|
return (bool)obj.GetValue(IsHeaderVisibleProperty); |
||||||
|
} |
||||||
|
|
||||||
|
public static void SetIsHeaderVisible(DependencyObject obj, bool value) |
||||||
|
{ |
||||||
|
obj.SetValue(IsHeaderVisibleProperty, value); |
||||||
|
} |
||||||
|
|
||||||
|
// Using a DependencyProperty as the backing store for IsHeaderVisible. This enables animation, styling, binding, etc...
|
||||||
|
public static readonly DependencyProperty IsHeaderVisibleProperty = |
||||||
|
DependencyProperty.RegisterAttached("IsHeaderVisible", typeof(bool), typeof(DocumentTabPanel), new UIPropertyMetadata(false)); |
||||||
|
|
||||||
|
|
||||||
|
protected override Size MeasureOverride(Size availableSize) |
||||||
|
{ |
||||||
|
Size desideredSize = new Size(); |
||||||
|
int i = 1; |
||||||
|
|
||||||
|
foreach (ManagedContent child in Children) |
||||||
|
{ |
||||||
|
Panel.SetZIndex(child, Selector.GetIsSelected(child)?1:-i); |
||||||
|
i++; |
||||||
|
//child.Width = double.NaN;
|
||||||
|
//child.Height = double.NaN;
|
||||||
|
child.Measure(new Size(double.PositiveInfinity, double.PositiveInfinity)); |
||||||
|
desideredSize.Width += child.DesiredSize.Width; |
||||||
|
desideredSize.Height = Math.Max(desideredSize.Height, child.DesiredSize.Height); |
||||||
|
} |
||||||
|
|
||||||
|
return new Size(Math.Min(desideredSize.Width, availableSize.Width), desideredSize.Height); |
||||||
|
//return base.MeasureOverride(availableSize);
|
||||||
|
//return desideredSize;
|
||||||
|
} |
||||||
|
|
||||||
|
protected override Size ArrangeOverride(Size finalSize) |
||||||
|
{ |
||||||
|
double offset = 0.0; |
||||||
|
bool skipAllOthers = false; |
||||||
|
foreach (ManagedContent doc in Children) |
||||||
|
{ |
||||||
|
if (skipAllOthers || offset + doc.DesiredSize.Width > finalSize.Width) |
||||||
|
{ |
||||||
|
SetIsHeaderVisible(doc, false); |
||||||
|
doc.Arrange(new Rect()); |
||||||
|
skipAllOthers = true; |
||||||
|
} |
||||||
|
else |
||||||
|
{ |
||||||
|
SetIsHeaderVisible(doc, true); |
||||||
|
doc.Arrange(new Rect(offset, 0.0, doc.DesiredSize.Width, finalSize.Height)); |
||||||
|
offset += doc.ActualWidth; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
return finalSize; |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
//#region Padding
|
||||||
|
|
||||||
|
///// <summary>
|
||||||
|
///// Padding Dependency Property
|
||||||
|
///// </summary>
|
||||||
|
//public static readonly DependencyProperty PaddingProperty =
|
||||||
|
// DependencyProperty.Register("Padding", typeof(Thickness), typeof(DocumentTabPanel),
|
||||||
|
// new FrameworkPropertyMetadata((Thickness)new Thickness(),
|
||||||
|
// FrameworkPropertyMetadataOptions.AffectsMeasure));
|
||||||
|
|
||||||
|
///// <summary>
|
||||||
|
///// Gets or sets the Padding property. This dependency property
|
||||||
|
///// indicates internal padding of the panel.
|
||||||
|
///// </summary>
|
||||||
|
//public Thickness Padding
|
||||||
|
//{
|
||||||
|
// get { return (Thickness)GetValue(PaddingProperty); }
|
||||||
|
// set { SetValue(PaddingProperty, value); }
|
||||||
|
//}
|
||||||
|
|
||||||
|
//#endregion
|
||||||
|
|
||||||
|
|
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,195 @@ |
|||||||
|
//Copyright (c) 2007-2010, Adolfo Marinucci
|
||||||
|
//All rights reserved.
|
||||||
|
|
||||||
|
//Redistribution and use in source and binary forms, with or without modification,
|
||||||
|
//are permitted provided that the following conditions are met:
|
||||||
|
//
|
||||||
|
//* Redistributions of source code must retain the above copyright notice,
|
||||||
|
// this list of conditions and the following disclaimer.
|
||||||
|
//* Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
// this list of conditions and the following disclaimer in the documentation
|
||||||
|
// and/or other materials provided with the distribution.
|
||||||
|
//* Neither the name of Adolfo Marinucci nor the names of its contributors may
|
||||||
|
// be used to endorse or promote products derived from this software without
|
||||||
|
// specific prior written permission.
|
||||||
|
//
|
||||||
|
//THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||||
|
//AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
//WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||||
|
//IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||||
|
//INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||||
|
//PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||||
|
//HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||||
|
//OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
||||||
|
//EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
|
using System; |
||||||
|
using System.Collections.Generic; |
||||||
|
using System.Text; |
||||||
|
using System.Windows; |
||||||
|
using System.Diagnostics; |
||||||
|
using System.ComponentModel; |
||||||
|
|
||||||
|
namespace AvalonDock |
||||||
|
{ |
||||||
|
/// <summary>
|
||||||
|
/// Provides drag-drop functionalities for dockable panes
|
||||||
|
/// </summary>
|
||||||
|
internal sealed class DragPaneServices |
||||||
|
{ |
||||||
|
List<IDropSurface> Surfaces = new List<IDropSurface>(); |
||||||
|
List<IDropSurface> SurfacesWithDragOver = new List<IDropSurface>(); |
||||||
|
|
||||||
|
DockingManager _owner; |
||||||
|
|
||||||
|
public DockingManager DockManager |
||||||
|
{ |
||||||
|
get { return _owner; } |
||||||
|
} |
||||||
|
|
||||||
|
public DragPaneServices(DockingManager owner) |
||||||
|
{ |
||||||
|
if (DesignerProperties.GetIsInDesignMode(owner)) |
||||||
|
throw new NotSupportedException("DragPaneServices not valid in design mode"); |
||||||
|
|
||||||
|
if (owner == null) |
||||||
|
throw new ArgumentNullException("owner"); |
||||||
|
|
||||||
|
_owner = owner; |
||||||
|
} |
||||||
|
|
||||||
|
public void Register(IDropSurface surface) |
||||||
|
{ |
||||||
|
if (!Surfaces.Contains(surface)) |
||||||
|
Surfaces.Add(surface); |
||||||
|
} |
||||||
|
|
||||||
|
public void Unregister(IDropSurface surface) |
||||||
|
{ |
||||||
|
Surfaces.Remove(surface); |
||||||
|
} |
||||||
|
|
||||||
|
Point Offset; |
||||||
|
|
||||||
|
public bool IsDragging { get; private set; } |
||||||
|
|
||||||
|
public void StartDrag(FloatingWindow wnd, Point point, Point offset) |
||||||
|
{ |
||||||
|
Debug.Assert(!IsDragging); |
||||||
|
|
||||||
|
IsDragging = true; |
||||||
|
|
||||||
|
Offset = offset; |
||||||
|
|
||||||
|
_wnd = wnd; |
||||||
|
|
||||||
|
if (Offset.X >= _wnd.Width) |
||||||
|
Offset.X = _wnd.Width / 2; |
||||||
|
|
||||||
|
|
||||||
|
_wnd.Left = point.X - Offset.X; |
||||||
|
_wnd.Top = point.Y - Offset.Y; |
||||||
|
_wnd.Show(); |
||||||
|
|
||||||
|
int surfaceCount = 0; |
||||||
|
restart: |
||||||
|
surfaceCount = Surfaces.Count; |
||||||
|
foreach (IDropSurface surface in Surfaces) |
||||||
|
{ |
||||||
|
if (surface.SurfaceRectangle.Contains(point)) |
||||||
|
{ |
||||||
|
SurfacesWithDragOver.Add(surface); |
||||||
|
surface.OnDragEnter(point); |
||||||
|
Debug.WriteLine("Enter " + surface.ToString()); |
||||||
|
if (surfaceCount != Surfaces.Count) |
||||||
|
{ |
||||||
|
//Surfaces list has been changed restart cycle
|
||||||
|
SurfacesWithDragOver.Clear(); |
||||||
|
goto restart; |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
public void MoveDrag(Point point) |
||||||
|
{ |
||||||
|
if (_wnd == null) |
||||||
|
return; |
||||||
|
|
||||||
|
_wnd.Left = point.X - Offset.X; |
||||||
|
_wnd.Top = point.Y - Offset.Y; |
||||||
|
|
||||||
|
List<IDropSurface> enteringSurfaces = new List<IDropSurface>(); |
||||||
|
foreach (IDropSurface surface in Surfaces) |
||||||
|
{ |
||||||
|
if (surface.SurfaceRectangle.Contains(point)) |
||||||
|
{ |
||||||
|
if (!SurfacesWithDragOver.Contains(surface)) |
||||||
|
enteringSurfaces.Add(surface); |
||||||
|
else |
||||||
|
surface.OnDragOver(point); |
||||||
|
} |
||||||
|
else if (SurfacesWithDragOver.Contains(surface)) |
||||||
|
{ |
||||||
|
SurfacesWithDragOver.Remove(surface); |
||||||
|
surface.OnDragLeave(point); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
foreach (IDropSurface surface in enteringSurfaces) |
||||||
|
{ |
||||||
|
SurfacesWithDragOver.Add(surface); |
||||||
|
surface.OnDragEnter(point); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public void EndDrag(Point point) |
||||||
|
{ |
||||||
|
IDropSurface dropSufrace = null; |
||||||
|
foreach (IDropSurface surface in Surfaces) |
||||||
|
{ |
||||||
|
if (surface.SurfaceRectangle.Contains(point)) |
||||||
|
{ |
||||||
|
if (surface.OnDrop(point)) |
||||||
|
{ |
||||||
|
dropSufrace = surface; |
||||||
|
break; |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
foreach (IDropSurface surface in SurfacesWithDragOver) |
||||||
|
{ |
||||||
|
if (surface != dropSufrace) |
||||||
|
{ |
||||||
|
surface.OnDragLeave(point); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
SurfacesWithDragOver.Clear(); |
||||||
|
|
||||||
|
_wnd.OnEndDrag();//notify floating window that drag operation is coming to end
|
||||||
|
|
||||||
|
if (dropSufrace != null) |
||||||
|
_wnd.Close(); |
||||||
|
else |
||||||
|
{ |
||||||
|
_wnd.Visibility = Visibility.Visible; |
||||||
|
_wnd.Activate(); |
||||||
|
} |
||||||
|
|
||||||
|
_wnd = null; |
||||||
|
|
||||||
|
IsDragging = false; |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
FloatingWindow _wnd; |
||||||
|
public FloatingWindow FloatingWindow |
||||||
|
{ |
||||||
|
get { return _wnd; } |
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,216 @@ |
|||||||
|
//Copyright (c) 2007-2010, Adolfo Marinucci
|
||||||
|
//All rights reserved.
|
||||||
|
|
||||||
|
//Redistribution and use in source and binary forms, with or without modification,
|
||||||
|
//are permitted provided that the following conditions are met:
|
||||||
|
//
|
||||||
|
//* Redistributions of source code must retain the above copyright notice,
|
||||||
|
// this list of conditions and the following disclaimer.
|
||||||
|
//* Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
// this list of conditions and the following disclaimer in the documentation
|
||||||
|
// and/or other materials provided with the distribution.
|
||||||
|
//* Neither the name of Adolfo Marinucci nor the names of its contributors may
|
||||||
|
// be used to endorse or promote products derived from this software without
|
||||||
|
// specific prior written permission.
|
||||||
|
//
|
||||||
|
//THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||||
|
//AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
//WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||||
|
//IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||||
|
//INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||||
|
//PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||||
|
//HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||||
|
//OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
||||||
|
//EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
|
using System; |
||||||
|
using System.Collections.Generic; |
||||||
|
using System.Text; |
||||||
|
using System.Windows; |
||||||
|
using System.Linq; |
||||||
|
using System.Windows.Data; |
||||||
|
|
||||||
|
namespace AvalonDock |
||||||
|
{ |
||||||
|
public class FloatingDockablePane : DockablePane |
||||||
|
{ |
||||||
|
static FloatingDockablePane() |
||||||
|
{ |
||||||
|
//DefaultStyleKeyProperty.OverrideMetadata(typeof(FloatingDockablePane), new FrameworkPropertyMetadata(typeof(FloatingDockablePane)));
|
||||||
|
//by design avoid style change
|
||||||
|
|
||||||
|
Pane.ShowHeaderProperty.OverrideMetadata(typeof(FloatingDockablePane), new FrameworkPropertyMetadata(false)); |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
internal FloatingDockablePane(DockableFloatingWindow floatingWindow, DockablePane paneToTransfer) |
||||||
|
{ |
||||||
|
_floatingWindow = floatingWindow; |
||||||
|
_paneToTransfer = paneToTransfer; |
||||||
|
} |
||||||
|
|
||||||
|
internal FloatingDockablePane(DockableFloatingWindow floatingWindow, DockableContent contentToTransfer) |
||||||
|
{ |
||||||
|
_floatingWindow = floatingWindow; |
||||||
|
_contentToTransfer = contentToTransfer; |
||||||
|
} |
||||||
|
|
||||||
|
protected override void OnInitialized(EventArgs e) |
||||||
|
{ |
||||||
|
if (_paneToTransfer != null) |
||||||
|
{ |
||||||
|
//setup window size
|
||||||
|
ManagedContent selectedContent = _paneToTransfer.SelectedItem as ManagedContent; |
||||||
|
if (selectedContent is DockableContent) |
||||||
|
{ |
||||||
|
_floatingWindow.SizeToContent = (selectedContent as DockableContent).FloatingWindowSizeToContent; |
||||||
|
} |
||||||
|
|
||||||
|
if (selectedContent != null && selectedContent.FloatingWindowSize.IsEmpty) |
||||||
|
selectedContent.FloatingWindowSize = new Size(_paneToTransfer.ActualWidth, _paneToTransfer.ActualHeight); |
||||||
|
|
||||||
|
if (selectedContent != null) |
||||||
|
{ |
||||||
|
_floatingWindow.Width = selectedContent.FloatingWindowSize.Width; |
||||||
|
_floatingWindow.Height = selectedContent.FloatingWindowSize.Height; |
||||||
|
} |
||||||
|
else |
||||||
|
{ |
||||||
|
_floatingWindow.Width = _paneToTransfer.ActualWidth; |
||||||
|
_floatingWindow.Height = _paneToTransfer.ActualHeight; |
||||||
|
} |
||||||
|
|
||||||
|
int selectedIndex = _paneToTransfer.SelectedIndex; |
||||||
|
|
||||||
|
//remove contents from container pane and insert in hosted pane
|
||||||
|
while (_paneToTransfer.Items.Count > 0) |
||||||
|
{ |
||||||
|
DockableContent contentToTranser = _paneToTransfer.Items[0] as DockableContent; |
||||||
|
|
||||||
|
contentToTranser.SaveCurrentStateAndPosition(); |
||||||
|
|
||||||
|
_paneToTransfer.RemoveContent(0); |
||||||
|
|
||||||
|
//add content to my temporary pane
|
||||||
|
Items.Add(contentToTranser); |
||||||
|
|
||||||
|
contentToTranser.SetStateToDockableWindow(); |
||||||
|
} |
||||||
|
|
||||||
|
SelectedIndex = selectedIndex; |
||||||
|
|
||||||
|
//transfer the style from the original dockablepane
|
||||||
|
//Style = _paneToTransfer.Style;
|
||||||
|
AttachStyleFromPane(_paneToTransfer); |
||||||
|
|
||||||
|
ApplyTemplate(); |
||||||
|
} |
||||||
|
else if (_contentToTransfer != null) |
||||||
|
{ |
||||||
|
//setup window size
|
||||||
|
if (_contentToTransfer.FloatingWindowSize.IsEmpty) |
||||||
|
_contentToTransfer.FloatingWindowSize = new Size(_contentToTransfer.ContainerPane.ActualWidth, _contentToTransfer.ContainerPane.ActualHeight); |
||||||
|
|
||||||
|
_floatingWindow.Width = _contentToTransfer.FloatingWindowSize.Width; |
||||||
|
_floatingWindow.Height = _contentToTransfer.FloatingWindowSize.Height; |
||||||
|
|
||||||
|
//save current content position in container pane
|
||||||
|
_previousPane = _contentToTransfer.ContainerPane; |
||||||
|
|
||||||
|
_arrayIndexPreviousPane = _previousPane.Items.IndexOf(_contentToTransfer); |
||||||
|
|
||||||
|
_contentToTransfer.SaveCurrentStateAndPosition(); |
||||||
|
|
||||||
|
//remove content from container pane
|
||||||
|
_contentToTransfer.ContainerPane.RemoveContent(_arrayIndexPreviousPane); |
||||||
|
|
||||||
|
//add content to this pane
|
||||||
|
Items.Add(_contentToTransfer); |
||||||
|
|
||||||
|
SelectedIndex = 0; |
||||||
|
|
||||||
|
//if (_previousPane is DockablePane)
|
||||||
|
//{
|
||||||
|
// Style = _previousPane.Style;
|
||||||
|
//}
|
||||||
|
AttachStyleFromPane(_previousPane as DockablePane); |
||||||
|
|
||||||
|
DocumentPane originalDocumentPane = _previousPane as DocumentPane; |
||||||
|
if (originalDocumentPane != null) |
||||||
|
originalDocumentPane.CheckContentsEmpty(); |
||||||
|
|
||||||
|
|
||||||
|
_contentToTransfer.SetStateToDockableWindow(); |
||||||
|
} |
||||||
|
|
||||||
|
base.OnInitialized(e); |
||||||
|
} |
||||||
|
|
||||||
|
void AttachStyleFromPane(DockablePane copyFromPane) |
||||||
|
{ |
||||||
|
if (copyFromPane == null) |
||||||
|
return; |
||||||
|
|
||||||
|
Binding bnd = new Binding("Style"); |
||||||
|
bnd.Source = copyFromPane; |
||||||
|
bnd.Mode = BindingMode.OneWay; |
||||||
|
|
||||||
|
SetBinding(StyleProperty, bnd); |
||||||
|
} |
||||||
|
|
||||||
|
DockablePane _paneToTransfer = null; |
||||||
|
DockableContent _contentToTransfer = null; |
||||||
|
|
||||||
|
Pane _previousPane = null; |
||||||
|
int _arrayIndexPreviousPane = -1; |
||||||
|
|
||||||
|
DockableFloatingWindow _floatingWindow = null; |
||||||
|
|
||||||
|
public DockableFloatingWindow FloatingWindow |
||||||
|
{ |
||||||
|
get { return _floatingWindow; } |
||||||
|
} |
||||||
|
|
||||||
|
public override DockingManager GetManager() |
||||||
|
{ |
||||||
|
return _floatingWindow.Manager; |
||||||
|
} |
||||||
|
|
||||||
|
protected override void CheckItems(System.Collections.IList newItems) |
||||||
|
{ |
||||||
|
if (Items.Count == 0 && FloatingWindow != null) |
||||||
|
FloatingWindow.Close(true); |
||||||
|
} |
||||||
|
|
||||||
|
protected override void OnItemsChanged(System.Collections.Specialized.NotifyCollectionChangedEventArgs e) |
||||||
|
{ |
||||||
|
if (e.NewItems != null) |
||||||
|
{ |
||||||
|
e.NewItems.Cast<DockableContent>().ForEach(c => |
||||||
|
{ |
||||||
|
if (c.State == DockableContentState.None) |
||||||
|
{ |
||||||
|
if (FloatingWindow.IsDockableWindow) |
||||||
|
c.SetStateToDockableWindow(); |
||||||
|
else |
||||||
|
c.SetStateToFloatingWindow(); |
||||||
|
} |
||||||
|
}); |
||||||
|
} |
||||||
|
|
||||||
|
base.OnItemsChanged(e); |
||||||
|
} |
||||||
|
|
||||||
|
public override void Dock() |
||||||
|
{ |
||||||
|
DockableContent[] contentsToRedock = Items.Cast<DockableContent>().ToArray(); |
||||||
|
|
||||||
|
foreach (var cntToRedock in contentsToRedock) |
||||||
|
cntToRedock.Show(); |
||||||
|
|
||||||
|
base.Dock(); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,126 @@ |
|||||||
|
using System; |
||||||
|
using System.Collections.Generic; |
||||||
|
using System.Linq; |
||||||
|
using System.Text; |
||||||
|
using System.Windows; |
||||||
|
using System.Windows.Data; |
||||||
|
|
||||||
|
namespace AvalonDock |
||||||
|
{ |
||||||
|
internal class FloatingDocumentPane : DocumentPane |
||||||
|
{ |
||||||
|
static FloatingDocumentPane() |
||||||
|
{ |
||||||
|
Pane.ShowHeaderProperty.OverrideMetadata(typeof(FloatingDocumentPane), new FrameworkPropertyMetadata(false)); |
||||||
|
} |
||||||
|
|
||||||
|
internal FloatingDocumentPane(DocumentFloatingWindow floatingWindow, DocumentContent documentToTransfer) |
||||||
|
{ |
||||||
|
_floatingWindow = floatingWindow; |
||||||
|
_documentToTransfer = documentToTransfer; |
||||||
|
} |
||||||
|
|
||||||
|
DocumentContent _documentToTransfer = null; |
||||||
|
DocumentPane _previousPane = null; |
||||||
|
|
||||||
|
internal DocumentPane PreviousPane |
||||||
|
{ |
||||||
|
get |
||||||
|
{ return _previousPane; } |
||||||
|
} |
||||||
|
|
||||||
|
int _arrayIndexPreviousPane = -1; |
||||||
|
|
||||||
|
internal int ArrayIndexPreviousPane |
||||||
|
{ |
||||||
|
get { return _arrayIndexPreviousPane; } |
||||||
|
} |
||||||
|
|
||||||
|
protected override void OnInitialized(EventArgs e) |
||||||
|
{ |
||||||
|
//setup window size
|
||||||
|
_floatingWindow.Width = _documentToTransfer.ContainerPane.ActualWidth; |
||||||
|
_floatingWindow.Height = _documentToTransfer.ContainerPane.ActualHeight; |
||||||
|
|
||||||
|
//save current content position in container pane
|
||||||
|
_previousPane = _documentToTransfer.ContainerPane as DocumentPane; |
||||||
|
_arrayIndexPreviousPane = _previousPane.Items.IndexOf(_documentToTransfer); |
||||||
|
SetValue(ResizingPanel.ResizeWidthProperty, _previousPane.GetValue(ResizingPanel.ResizeWidthProperty)); |
||||||
|
SetValue(ResizingPanel.ResizeHeightProperty, _previousPane.GetValue(ResizingPanel.ResizeHeightProperty)); |
||||||
|
|
||||||
|
//Style = _previousPane.Style;
|
||||||
|
AttachStyleFromPane(_previousPane); |
||||||
|
|
||||||
|
//remove content from container pane
|
||||||
|
_previousPane.RemoveContent(_arrayIndexPreviousPane); |
||||||
|
|
||||||
|
//add content to my temporary pane
|
||||||
|
Items.Add(_documentToTransfer); |
||||||
|
|
||||||
|
_documentToTransfer.SetIsFloating(true); |
||||||
|
|
||||||
|
base.OnInitialized(e); |
||||||
|
} |
||||||
|
|
||||||
|
void AttachStyleFromPane(DocumentPane copyFromPane) |
||||||
|
{ |
||||||
|
if (copyFromPane == null) |
||||||
|
return; |
||||||
|
|
||||||
|
Binding bnd = new Binding("Style"); |
||||||
|
bnd.Source = copyFromPane; |
||||||
|
bnd.Mode = BindingMode.OneWay; |
||||||
|
|
||||||
|
SetBinding(StyleProperty, bnd); |
||||||
|
} |
||||||
|
|
||||||
|
protected override void OnUnloaded(object sender, RoutedEventArgs e) |
||||||
|
{ |
||||||
|
_documentToTransfer.SetIsFloating(false); |
||||||
|
base.OnUnloaded(sender, e); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
DocumentFloatingWindow _floatingWindow = null; |
||||||
|
|
||||||
|
public DocumentFloatingWindow FloatingWindow |
||||||
|
{ |
||||||
|
get { return _floatingWindow; } |
||||||
|
} |
||||||
|
|
||||||
|
public override DockingManager GetManager() |
||||||
|
{ |
||||||
|
return _floatingWindow.Manager; |
||||||
|
} |
||||||
|
|
||||||
|
protected override bool IsSurfaceVisible |
||||||
|
{ |
||||||
|
get |
||||||
|
{ |
||||||
|
return false; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
protected override void CheckItems(System.Collections.IList newItems) |
||||||
|
{ |
||||||
|
foreach (object newItem in newItems) |
||||||
|
{ |
||||||
|
if (!(newItem is DocumentContent)) |
||||||
|
throw new InvalidOperationException("FloatingDocumentPane can contain only DocumentContents!"); |
||||||
|
} |
||||||
|
|
||||||
|
if (Items.Count == 0 && FloatingWindow != null) |
||||||
|
FloatingWindow.Close(true); |
||||||
|
} |
||||||
|
|
||||||
|
public override void Dock() |
||||||
|
{ |
||||||
|
var contentsToRedock = Items.Cast<DocumentContent>().ToArray(); |
||||||
|
|
||||||
|
foreach (var cntToRedock in contentsToRedock) |
||||||
|
cntToRedock.Show(); |
||||||
|
|
||||||
|
base.Dock(); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,617 @@ |
|||||||
|
//Copyright (c) 2007-2010, Adolfo Marinucci
|
||||||
|
//All rights reserved.
|
||||||
|
|
||||||
|
//Redistribution and use in source and binary forms, with or without modification,
|
||||||
|
//are permitted provided that the following conditions are met:
|
||||||
|
//
|
||||||
|
//* Redistributions of source code must retain the above copyright notice,
|
||||||
|
// this list of conditions and the following disclaimer.
|
||||||
|
//* Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
// this list of conditions and the following disclaimer in the documentation
|
||||||
|
// and/or other materials provided with the distribution.
|
||||||
|
//* Neither the name of Adolfo Marinucci nor the names of its contributors may
|
||||||
|
// be used to endorse or promote products derived from this software without
|
||||||
|
// specific prior written permission.
|
||||||
|
//
|
||||||
|
//THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||||
|
//AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
//WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||||
|
//IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||||
|
//INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||||
|
//PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||||
|
//HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||||
|
//OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
||||||
|
//EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
|
using System; |
||||||
|
using System.Collections.Generic; |
||||||
|
using System.Text; |
||||||
|
using System.Windows; |
||||||
|
using System.Windows.Controls; |
||||||
|
using System.Windows.Controls.Primitives; |
||||||
|
using System.Windows.Data; |
||||||
|
using System.Windows.Documents; |
||||||
|
using System.Windows.Input; |
||||||
|
using System.Windows.Media; |
||||||
|
using System.Windows.Media.Imaging; |
||||||
|
using System.Windows.Shapes; |
||||||
|
using System.ComponentModel; |
||||||
|
using System.Windows.Markup; |
||||||
|
using System.Diagnostics; |
||||||
|
using System.Windows.Threading; |
||||||
|
using System.Windows.Media.Animation; |
||||||
|
using System.Windows.Interop; |
||||||
|
using System.Runtime.InteropServices; |
||||||
|
using System.Linq; |
||||||
|
|
||||||
|
namespace AvalonDock |
||||||
|
{ |
||||||
|
/// <summary>
|
||||||
|
/// Represents the base class for <see cref="DockableFloatingWindow"/> and <see cref="DocumentFloatingWindow"/> classes
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>Provides base services for floating windows</remarks>
|
||||||
|
public abstract class FloatingWindow : AvalonDockWindow |
||||||
|
{ |
||||||
|
static FloatingWindow() |
||||||
|
{ |
||||||
|
Window.ShowInTaskbarProperty.OverrideMetadata(typeof(FloatingWindow), new FrameworkPropertyMetadata(false)); |
||||||
|
Window.WindowStyleProperty.OverrideMetadata(typeof(FloatingWindow), new FrameworkPropertyMetadata(WindowStyle.ToolWindow)); |
||||||
|
|
||||||
|
//DefaultStyleKeyProperty.OverrideMetadata(typeof(FloatingWindow), new FrameworkPropertyMetadata(typeof(FloatingWindow)));
|
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
internal FloatingWindow() |
||||||
|
{ |
||||||
|
this.Loaded += new RoutedEventHandler(OnLoaded); |
||||||
|
this.Unloaded += new RoutedEventHandler(OnUnloaded); |
||||||
|
|
||||||
|
this.SizeChanged += new SizeChangedEventHandler(FloatingWindow_SizeChanged); |
||||||
|
} |
||||||
|
|
||||||
|
internal FloatingWindow(DockingManager manager) |
||||||
|
: this() |
||||||
|
{ |
||||||
|
//save manager ref
|
||||||
|
_manager = manager; |
||||||
|
} |
||||||
|
|
||||||
|
void FloatingWindow_SizeChanged(object sender, SizeChangedEventArgs e) |
||||||
|
{ |
||||||
|
if (HostedPane != null) |
||||||
|
{ |
||||||
|
foreach (ManagedContent c in HostedPane.Items) |
||||||
|
c.FloatingWindowSize = new Size(Width, Height); |
||||||
|
|
||||||
|
ResizingPanel.SetEffectiveSize(HostedPane, new Size(Width, Height)); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
DockingManager _manager = null; |
||||||
|
|
||||||
|
internal DockingManager Manager |
||||||
|
{ |
||||||
|
get { return _manager; } |
||||||
|
} |
||||||
|
|
||||||
|
public Pane HostedPane |
||||||
|
{ |
||||||
|
get { return Content as Pane; } |
||||||
|
} |
||||||
|
|
||||||
|
#region ContentTitle
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// ContentTitle Read-Only Dependency Property
|
||||||
|
/// </summary>
|
||||||
|
private static readonly DependencyPropertyKey ContentTitlePropertyKey |
||||||
|
= DependencyProperty.RegisterReadOnly("ContentTitle", typeof(object), typeof(FloatingWindow), |
||||||
|
new FrameworkPropertyMetadata((object)null)); |
||||||
|
|
||||||
|
public static readonly DependencyProperty ContentTitleProperty |
||||||
|
= ContentTitlePropertyKey.DependencyProperty; |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the ContentTitle property. This dependency property
|
||||||
|
/// indicates title of the content currectly hosted in the floating window.
|
||||||
|
/// </summary>
|
||||||
|
public object ContentTitle |
||||||
|
{ |
||||||
|
get { return (object)GetValue(ContentTitleProperty); } |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Provides a secure method for setting the ContentTitle property.
|
||||||
|
/// This dependency property indicates title of the content currectly hosted in the floating window.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="value">The new value for the property.</param>
|
||||||
|
protected void SetContentTitle(object value) |
||||||
|
{ |
||||||
|
SetValue(ContentTitlePropertyKey, value); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
private void UpdateContentTitle() |
||||||
|
{ |
||||||
|
if (HostedPane == null) |
||||||
|
return; |
||||||
|
|
||||||
|
var cnt = HostedPane.SelectedItem as ManagedContent; |
||||||
|
if (cnt != null) |
||||||
|
SetContentTitle(cnt.Title); |
||||||
|
} |
||||||
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//#region HostedPane
|
||||||
|
|
||||||
|
///// <summary>
|
||||||
|
///// HostedPane Read-Only Dependency Property
|
||||||
|
///// </summary>
|
||||||
|
//private static readonly DependencyPropertyKey HostedPanePropertyKey
|
||||||
|
// = DependencyProperty.RegisterReadOnly("HostedPane", typeof(Pane), typeof(FloatingWindow),
|
||||||
|
// new FrameworkPropertyMetadata((Pane)null,
|
||||||
|
// new PropertyChangedCallback(OnHostedPaneChanged)));
|
||||||
|
|
||||||
|
//public static readonly DependencyProperty HostedPaneProperty
|
||||||
|
// = HostedPanePropertyKey.DependencyProperty;
|
||||||
|
|
||||||
|
///// <summary>
|
||||||
|
///// Gets the HostedPane property. This dependency property
|
||||||
|
///// indicates the hosted pane contained into the floating window (an hosted pane can be of type <see cref="FloatingDocumentPane"/> or type <see cref="FloatingDockablePane"/>.
|
||||||
|
///// </summary>
|
||||||
|
//public Pane HostedPane
|
||||||
|
//{
|
||||||
|
// get { return (Pane)GetValue(HostedPaneProperty); }
|
||||||
|
//}
|
||||||
|
|
||||||
|
///// <summary>
|
||||||
|
///// Provides a secure method for setting the HostedPane property.
|
||||||
|
///// This dependency property indicates the hosted pane contained into the floating window (an hosted pane can be of type <see cref="FloatingDocumentPane"/> or type <see cref="FloatingDockablePane"/>.
|
||||||
|
///// </summary>
|
||||||
|
///// <param name="value">The new value for the property.</param>
|
||||||
|
//protected void SetHostedPane(Pane value)
|
||||||
|
//{
|
||||||
|
// SetValue(HostedPanePropertyKey, value);
|
||||||
|
//}
|
||||||
|
|
||||||
|
///// <summary>
|
||||||
|
///// Handles changes to the HostedPane property.
|
||||||
|
///// </summary>
|
||||||
|
//private static void OnHostedPaneChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
|
||||||
|
//{
|
||||||
|
// ((FloatingWindow)d).OnHostedPaneChanged(e);
|
||||||
|
//}
|
||||||
|
|
||||||
|
///// <summary>
|
||||||
|
///// Provides derived classes an opportunity to handle changes to the HostedPane property.
|
||||||
|
///// </summary>
|
||||||
|
//protected virtual void OnHostedPaneChanged(DependencyPropertyChangedEventArgs e)
|
||||||
|
//{
|
||||||
|
//}
|
||||||
|
|
||||||
|
//#endregion
|
||||||
|
|
||||||
|
protected override void OnInitialized(EventArgs e) |
||||||
|
{ |
||||||
|
|
||||||
|
base.OnInitialized(e); |
||||||
|
} |
||||||
|
|
||||||
|
protected override void OnContentChanged(object oldContent, object newContent) |
||||||
|
{ |
||||||
|
base.OnContentChanged(oldContent, newContent); |
||||||
|
|
||||||
|
if (_manager != null) |
||||||
|
{ |
||||||
|
_manager.RegisterFloatingWindow(this); |
||||||
|
_manager.RefreshContents(); |
||||||
|
} |
||||||
|
|
||||||
|
UpdateContentTitle(); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
internal virtual void OnEndDrag() |
||||||
|
{ |
||||||
|
} |
||||||
|
|
||||||
|
internal virtual void OnShowSelectionBox() |
||||||
|
{ |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
internal virtual void OnHideSelectionBox() |
||||||
|
{ |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
#region Move/Resize
|
||||||
|
|
||||||
|
public override void OnApplyTemplate() |
||||||
|
{ |
||||||
|
base.OnApplyTemplate(); |
||||||
|
|
||||||
|
Resizer resLeftAnchor = GetTemplateChild("PART_LeftAnchor") as Resizer; |
||||||
|
Resizer resTopAnchor = GetTemplateChild("PART_TopAnchor") as Resizer; |
||||||
|
Resizer resBottomAnchor = GetTemplateChild("PART_BottomAnchor") as Resizer; |
||||||
|
Resizer resRightAnchor = GetTemplateChild("PART_RightAnchor") as Resizer; |
||||||
|
|
||||||
|
Resizer resLeftTopAnchor = GetTemplateChild("PART_LeftTopAnchor") as Resizer; |
||||||
|
Resizer resLeftBottomAnchor = GetTemplateChild("PART_LeftBottomAnchor") as Resizer; |
||||||
|
|
||||||
|
Resizer resRightTopAnchor = GetTemplateChild("PART_RightTopAnchor") as Resizer; |
||||||
|
Resizer resRightBottomAnchor = GetTemplateChild("PART_RightBottomAnchor") as Resizer; |
||||||
|
|
||||||
|
//Resizer resMoveAnchor = GetTemplateChild("PART_MoveAnchor") as Resizer;
|
||||||
|
Border resMoveAnchor = GetTemplateChild("PART_MoveAnchor") as Border; |
||||||
|
|
||||||
|
if (resLeftAnchor != null) resLeftAnchor.DragDelta += (s, e) => |
||||||
|
{ |
||||||
|
double delta = Math.Max(MinWidth, Width - e.HorizontalChange) - Width; |
||||||
|
this.Left -= delta; |
||||||
|
this.Width += delta; |
||||||
|
}; |
||||||
|
if (resRightAnchor != null) resRightAnchor.DragDelta += (s, e) => |
||||||
|
{ |
||||||
|
double delta = Math.Max(MinWidth, Width + e.HorizontalChange) - Width; |
||||||
|
this.Width += delta; |
||||||
|
}; |
||||||
|
if (resTopAnchor != null) resTopAnchor.DragDelta += (s, e) => |
||||||
|
{ |
||||||
|
double delta = Math.Max(MinHeight, Height - e.VerticalChange) - Height; |
||||||
|
this.Top -= delta; |
||||||
|
this.Height += delta; |
||||||
|
}; |
||||||
|
if (resBottomAnchor != null) resBottomAnchor.DragDelta += (s, e) => |
||||||
|
{ |
||||||
|
double delta = Math.Max(MinHeight, Height + e.VerticalChange) - Height; |
||||||
|
this.Height += delta; |
||||||
|
}; |
||||||
|
|
||||||
|
if (resLeftTopAnchor != null) resLeftTopAnchor.DragDelta += (s, e) => |
||||||
|
{ |
||||||
|
double delta = Math.Max(MinWidth, Width - e.HorizontalChange) - Width; |
||||||
|
this.Left -= delta; |
||||||
|
this.Width += delta; |
||||||
|
|
||||||
|
delta = Math.Max(MinHeight, Height - e.VerticalChange) - Height; |
||||||
|
this.Top -= delta; |
||||||
|
this.Height += delta; |
||||||
|
}; |
||||||
|
if (resLeftBottomAnchor != null) resLeftBottomAnchor.DragDelta += (s, e) => |
||||||
|
{ |
||||||
|
double delta = Math.Max(MinWidth, Width - e.HorizontalChange) - Width; |
||||||
|
this.Left -= delta; |
||||||
|
this.Width += delta; |
||||||
|
|
||||||
|
delta = Math.Max(MinHeight, Height + e.VerticalChange) - Height; |
||||||
|
this.Height += delta; |
||||||
|
}; |
||||||
|
if (resRightTopAnchor != null) resRightTopAnchor.DragDelta += (s, e) => |
||||||
|
{ |
||||||
|
double delta = Math.Max(MinWidth, Width + e.HorizontalChange) - Width; |
||||||
|
this.Width += delta; |
||||||
|
|
||||||
|
delta = Math.Max(MinHeight, Height - e.VerticalChange) - Height; |
||||||
|
this.Top -= delta; |
||||||
|
this.Height += delta; |
||||||
|
}; |
||||||
|
if (resRightBottomAnchor != null) resRightBottomAnchor.DragDelta += (s, e) => |
||||||
|
{ |
||||||
|
double delta = Math.Max(MinWidth, Width + e.HorizontalChange) - Width; |
||||||
|
this.Width += delta; |
||||||
|
|
||||||
|
delta = Math.Max(MinHeight, Height + e.VerticalChange) - Height; |
||||||
|
this.Height += delta; |
||||||
|
}; |
||||||
|
|
||||||
|
if (resMoveAnchor != null) |
||||||
|
{ |
||||||
|
bool isMouseDown = false; |
||||||
|
Point ptStartDrag = new Point(); |
||||||
|
resMoveAnchor.MouseLeftButtonDown += (s, e) => |
||||||
|
{ |
||||||
|
isMouseDown = true; |
||||||
|
ptStartDrag = e.GetPosition(s as IInputElement); |
||||||
|
resMoveAnchor.CaptureMouse(); |
||||||
|
}; |
||||||
|
|
||||||
|
resMoveAnchor.MouseMove += (s, e) => |
||||||
|
{ |
||||||
|
if (isMouseDown && resMoveAnchor.IsMouseCaptured) |
||||||
|
{ |
||||||
|
Point ptMouseMove = e.GetPosition(s as IInputElement); |
||||||
|
if (Math.Abs(ptMouseMove.X - ptStartDrag.X) > SystemParameters.MinimumHorizontalDragDistance || |
||||||
|
Math.Abs(ptMouseMove.Y - ptStartDrag.Y) > SystemParameters.MinimumVerticalDragDistance) |
||||||
|
{ |
||||||
|
isMouseDown = false; |
||||||
|
resMoveAnchor.ReleaseMouseCapture(); |
||||||
|
HandleMove(); |
||||||
|
} |
||||||
|
} |
||||||
|
}; |
||||||
|
|
||||||
|
resMoveAnchor.MouseLeftButtonUp += (s, e)=> |
||||||
|
{ |
||||||
|
isMouseDown = false; |
||||||
|
resMoveAnchor.ReleaseMouseCapture(); |
||||||
|
}; |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
var pupupButton = GetTemplateChild("PART_ShowContextMenuButton") as FrameworkElement; |
||||||
|
|
||||||
|
if (pupupButton != null) |
||||||
|
pupupButton.MouseLeftButtonDown += (s, e) => |
||||||
|
{ |
||||||
|
e.Handled = OpenContextMenu(s as Border, e.GetPosition(s as IInputElement)); |
||||||
|
}; |
||||||
|
|
||||||
|
var titleAnchor = GetTemplateChild("PART_MoveAnchor") as FrameworkElement; |
||||||
|
if (titleAnchor != null) |
||||||
|
titleAnchor.MouseRightButtonDown += (s, e) => |
||||||
|
{ |
||||||
|
e.Handled = OpenContextMenu(s as Border, e.GetPosition(s as IInputElement)); |
||||||
|
}; |
||||||
|
|
||||||
|
|
||||||
|
base.OnApplyTemplate(); |
||||||
|
} |
||||||
|
|
||||||
|
protected virtual bool OpenContextMenu(UIElement popupButton, Point ptMouse) |
||||||
|
{ |
||||||
|
return false; |
||||||
|
} |
||||||
|
|
||||||
|
protected virtual void HandleMove() |
||||||
|
{ |
||||||
|
Point mousePosition = PointToScreen(Mouse.GetPosition(null)); |
||||||
|
Point clickPoint = this.TransformToDeviceDPI(mousePosition); |
||||||
|
if (!Manager.DragPaneServices.IsDragging) |
||||||
|
Manager.Drag(this, clickPoint, new Point(clickPoint.X - Left, clickPoint.Y - Top)); |
||||||
|
} |
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Active Content Management
|
||||||
|
ManagedContent lastActiveContent = null; |
||||||
|
|
||||||
|
protected override void OnActivated(EventArgs e) |
||||||
|
{ |
||||||
|
if (Manager != null) |
||||||
|
{ |
||||||
|
lastActiveContent = Manager.ActiveContent; |
||||||
|
Manager.ActiveContent = HostedPane.SelectedItem as ManagedContent; |
||||||
|
} |
||||||
|
|
||||||
|
base.OnActivated(e); |
||||||
|
} |
||||||
|
|
||||||
|
protected override void OnDeactivated(EventArgs e) |
||||||
|
{ |
||||||
|
if (Manager != null && lastActiveContent != null) |
||||||
|
{ |
||||||
|
Manager.ActiveContent = lastActiveContent; |
||||||
|
} |
||||||
|
base.OnDeactivated(e); |
||||||
|
} |
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region IsClosing Flag Management
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Closes the window regardless of result of contents CanClose method call
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="force"></param>
|
||||||
|
internal void Close(bool force) |
||||||
|
{ |
||||||
|
ForcedClosing = force; |
||||||
|
base.Close(); |
||||||
|
} |
||||||
|
|
||||||
|
protected bool ForcedClosing { get; private set; } |
||||||
|
|
||||||
|
internal bool IsClosing { get; private set; } |
||||||
|
|
||||||
|
protected override void OnClosing(CancelEventArgs e) |
||||||
|
{ |
||||||
|
IsClosing = true; |
||||||
|
|
||||||
|
if (HostedPane.Items.Count > 0) |
||||||
|
{ |
||||||
|
var contentsToClose = HostedPane.Items.Cast<ManagedContent>().ToArray(); |
||||||
|
foreach (var cntToClose in contentsToClose) |
||||||
|
{ |
||||||
|
//if even a content can't close than cancel the close process, but continue try closing other contents
|
||||||
|
if (!cntToClose.Close()) |
||||||
|
{ |
||||||
|
//forced closing continues the window close process
|
||||||
|
if (!ForcedClosing) |
||||||
|
e.Cancel = true; |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
if (e.Cancel) |
||||||
|
IsClosing = false; |
||||||
|
else if (_manager != null) |
||||||
|
{ |
||||||
|
_manager.UnregisterFloatingWindow(this); |
||||||
|
} |
||||||
|
|
||||||
|
base.OnClosing(e); |
||||||
|
} |
||||||
|
|
||||||
|
protected override void OnClosed(EventArgs e) |
||||||
|
{ |
||||||
|
IsClosing = false; |
||||||
|
base.OnClosed(e); |
||||||
|
} |
||||||
|
#endregion
|
||||||
|
|
||||||
|
public abstract Pane ClonePane(); |
||||||
|
|
||||||
|
|
||||||
|
#region Enable/Disable window Close Button
|
||||||
|
[DllImport("User32.dll", CharSet = CharSet.Auto)] |
||||||
|
private static extern IntPtr GetSystemMenu( |
||||||
|
IntPtr hWnd, |
||||||
|
Int32 bRevert |
||||||
|
); |
||||||
|
|
||||||
|
[DllImport("User32.dll", CharSet = CharSet.Auto)] |
||||||
|
private static extern int GetMenuItemCount( |
||||||
|
IntPtr hMenu |
||||||
|
); |
||||||
|
|
||||||
|
[DllImport("User32.dll", CharSet = CharSet.Auto)] |
||||||
|
private static extern int DrawMenuBar( |
||||||
|
IntPtr hWnd |
||||||
|
); |
||||||
|
|
||||||
|
[DllImport("User32.dll", CharSet = CharSet.Auto)] |
||||||
|
private static extern bool EnableMenuItem( |
||||||
|
IntPtr hMenu, |
||||||
|
Int32 uIDEnableItem, |
||||||
|
Int32 uEnable |
||||||
|
); |
||||||
|
|
||||||
|
private const Int32 MF_BYPOSITION = 0x400; |
||||||
|
private const Int32 MF_ENABLED = 0x0000; |
||||||
|
private const Int32 MF_GRAYED = 0x0001; |
||||||
|
private const Int32 MF_DISABLED = 0x0002; |
||||||
|
|
||||||
|
void EnableXButton() |
||||||
|
{ |
||||||
|
WindowInteropHelper helper = new WindowInteropHelper(this); |
||||||
|
IntPtr hMenu = GetSystemMenu(helper.Handle, 0); |
||||||
|
|
||||||
|
int menuItemCount = GetMenuItemCount(hMenu); |
||||||
|
|
||||||
|
EnableMenuItem(hMenu, menuItemCount - 1, MF_BYPOSITION | MF_ENABLED); |
||||||
|
DrawMenuBar(helper.Handle); |
||||||
|
} |
||||||
|
|
||||||
|
void DisableXButton() |
||||||
|
{ |
||||||
|
WindowInteropHelper helper = new WindowInteropHelper(this); |
||||||
|
IntPtr hMenu = GetSystemMenu(helper.Handle, 0); |
||||||
|
|
||||||
|
int menuItemCount = GetMenuItemCount(hMenu); |
||||||
|
|
||||||
|
EnableMenuItem(hMenu, menuItemCount - 1, MF_BYPOSITION | MF_DISABLED | MF_GRAYED); |
||||||
|
DrawMenuBar(helper.Handle); |
||||||
|
} |
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Non-Client area management
|
||||||
|
|
||||||
|
protected const int WM_MOVE = 0x0003; |
||||||
|
protected const int WM_SIZE = 0x0005; |
||||||
|
protected const int WM_NCMOUSEMOVE = 0xa0; |
||||||
|
protected const int WM_NCLBUTTONDOWN = 0xA1; |
||||||
|
protected const int WM_NCLBUTTONUP = 0xA2; |
||||||
|
protected const int WM_NCLBUTTONDBLCLK = 0xA3; |
||||||
|
protected const int WM_NCRBUTTONDOWN = 0xA4; |
||||||
|
protected const int WM_NCRBUTTONUP = 0xA5; |
||||||
|
protected const int HTCAPTION = 2; |
||||||
|
protected const int SC_MOVE = 0xF010; |
||||||
|
protected const int WM_SYSCOMMAND = 0x0112; |
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#region Load/Unload window events
|
||||||
|
|
||||||
|
|
||||||
|
protected void OnLoaded(object sender, EventArgs e) |
||||||
|
{ |
||||||
|
WindowInteropWrapper wih = new WindowInteropWrapper(this); |
||||||
|
|
||||||
|
//wih.WindowActivating += (s, ce) => ce.Cancel = true;//prevent window activating
|
||||||
|
wih.FilterMessage += new EventHandler<FilterMessageEventArgs>(FilterMessage); |
||||||
|
|
||||||
|
if (HostedPane.Items.Count > 0) |
||||||
|
{ |
||||||
|
ManagedContent cntHosted = HostedPane.Items[0] as ManagedContent; |
||||||
|
if (!cntHosted.IsCloseable) |
||||||
|
{ |
||||||
|
DisableXButton(); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
protected void OnUnloaded(object sender, EventArgs e) |
||||||
|
{ } |
||||||
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
|
protected virtual void FilterMessage(object sender, FilterMessageEventArgs e) |
||||||
|
{ |
||||||
|
if (e.Handled) |
||||||
|
return; |
||||||
|
|
||||||
|
if (Manager == null) |
||||||
|
return; |
||||||
|
|
||||||
|
switch (e.Msg) |
||||||
|
{ |
||||||
|
case WM_SIZE: |
||||||
|
case WM_MOVE: |
||||||
|
break; |
||||||
|
case WM_NCRBUTTONDOWN: //Right button click on title area -> show context menu
|
||||||
|
if (e.WParam.ToInt32() == HTCAPTION) |
||||||
|
{ |
||||||
|
short x = (short)((e.LParam.ToInt32() & 0xFFFF)); |
||||||
|
short y = (short)((e.LParam.ToInt32() >> 16)); |
||||||
|
OpenContextMenu(null, new Point(x, y)); |
||||||
|
e.Handled = true; |
||||||
|
} |
||||||
|
break; |
||||||
|
case WM_NCRBUTTONUP: //set as handled right button click on title area (after showing context menu)
|
||||||
|
if (e.WParam.ToInt32() == HTCAPTION) |
||||||
|
{ |
||||||
|
e.Handled = true; |
||||||
|
} |
||||||
|
break; |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Floating/dockable window state
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Redock contained <see cref="ManagedContent"/> object to the <see cref="DcokingManager"/>
|
||||||
|
/// </summary>
|
||||||
|
public virtual void Dock() |
||||||
|
{ |
||||||
|
|
||||||
|
} |
||||||
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
internal void CheckContents() |
||||||
|
{ |
||||||
|
if (HostedPane == null) |
||||||
|
return; |
||||||
|
|
||||||
|
ManagedContent[] cntsToCheck = HostedPane.Items.Cast<ManagedContent>().ToArray(); |
||||||
|
|
||||||
|
cntsToCheck.ForEach(cnt => |
||||||
|
{ |
||||||
|
if (cnt.Manager == null || |
||||||
|
cnt.Manager != Manager || |
||||||
|
(!cnt.Manager.DockableContents.Contains(cnt) && |
||||||
|
!cnt.Manager.Documents.Contains(cnt))) |
||||||
|
cnt.ContainerPane.RemoveContent(cnt); |
||||||
|
}); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,106 @@ |
|||||||
|
//Copyright (c) 2007-2010, Adolfo Marinucci
|
||||||
|
//All rights reserved.
|
||||||
|
|
||||||
|
//Redistribution and use in source and binary forms, with or without modification,
|
||||||
|
//are permitted provided that the following conditions are met:
|
||||||
|
//
|
||||||
|
//* Redistributions of source code must retain the above copyright notice,
|
||||||
|
// this list of conditions and the following disclaimer.
|
||||||
|
//* Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
// this list of conditions and the following disclaimer in the documentation
|
||||||
|
// and/or other materials provided with the distribution.
|
||||||
|
//* Neither the name of Adolfo Marinucci nor the names of its contributors may
|
||||||
|
// be used to endorse or promote products derived from this software without
|
||||||
|
// specific prior written permission.
|
||||||
|
//
|
||||||
|
//THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||||
|
//AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
//WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||||
|
//IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||||
|
//INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||||
|
//PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||||
|
//HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||||
|
//OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
||||||
|
//EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
|
using System; |
||||||
|
using System.Collections.Generic; |
||||||
|
using System.Text; |
||||||
|
using System.Windows; |
||||||
|
using System.Windows.Input; |
||||||
|
|
||||||
|
namespace AvalonDock |
||||||
|
{ |
||||||
|
internal class FlyoutDockablePane : DockablePane |
||||||
|
{ |
||||||
|
static FlyoutDockablePane() |
||||||
|
{ |
||||||
|
DockablePane.ShowTabsProperty.AddOwner(typeof(FlyoutDockablePane), new FrameworkPropertyMetadata(false)); |
||||||
|
} |
||||||
|
|
||||||
|
int _arrayIndexPreviousPane = -1; |
||||||
|
|
||||||
|
|
||||||
|
public FlyoutDockablePane() |
||||||
|
{ } |
||||||
|
|
||||||
|
public FlyoutDockablePane(DockableContent content) |
||||||
|
{ |
||||||
|
_referencedPane = content.ContainerPane as DockablePane; |
||||||
|
_manager = _referencedPane.GetManager(); |
||||||
|
|
||||||
|
//save current content position in container pane
|
||||||
|
_arrayIndexPreviousPane = _referencedPane.Items.IndexOf(content); |
||||||
|
Anchor = _referencedPane.Anchor; |
||||||
|
|
||||||
|
SetValue(ResizingPanel.ResizeWidthProperty, new GridLength(ResizingPanel.GetEffectiveSize(_referencedPane).Width)); |
||||||
|
SetValue(ResizingPanel.ResizeHeightProperty, new GridLength(ResizingPanel.GetEffectiveSize(_referencedPane).Height)); |
||||||
|
|
||||||
|
this.Style = _referencedPane.Style; |
||||||
|
|
||||||
|
//remove content from container pane
|
||||||
|
//and add content to my temporary pane
|
||||||
|
_referencedPane.Items.RemoveAt(_arrayIndexPreviousPane); |
||||||
|
this.Items.Add(content); |
||||||
|
|
||||||
|
|
||||||
|
//select the single content in this pane
|
||||||
|
SelectedItem = this.Items[0]; |
||||||
|
} |
||||||
|
|
||||||
|
public override void OnApplyTemplate() |
||||||
|
{ |
||||||
|
base.OnApplyTemplate(); |
||||||
|
} |
||||||
|
|
||||||
|
internal void RestoreOriginalPane() |
||||||
|
{ |
||||||
|
if (this.Items.Count == 1) |
||||||
|
{ |
||||||
|
_referencedPane.Items.Insert(_arrayIndexPreviousPane, RemoveContent(0)); |
||||||
|
ResizingPanel.SetResizeWidth(_referencedPane, ResizingPanel.GetResizeWidth(this)); |
||||||
|
ResizingPanel.SetResizeHeight(_referencedPane, ResizingPanel.GetResizeHeight(this)); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
DockablePane _referencedPane = null; |
||||||
|
|
||||||
|
internal DockablePane ReferencedPane |
||||||
|
{ |
||||||
|
get { return _referencedPane; } |
||||||
|
} |
||||||
|
|
||||||
|
DockingManager _manager = null; |
||||||
|
|
||||||
|
public override DockingManager GetManager() |
||||||
|
{ |
||||||
|
return _manager; |
||||||
|
} |
||||||
|
|
||||||
|
public override void ToggleAutoHide() |
||||||
|
{ |
||||||
|
GetManager().ToggleAutoHide(_referencedPane); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,121 @@ |
|||||||
|
using System; |
||||||
|
|
||||||
|
using System.Windows; |
||||||
|
using System.Windows.Controls; |
||||||
|
using System.Windows.Media; |
||||||
|
using System.Windows.Media.Imaging; |
||||||
|
using System.ComponentModel; |
||||||
|
|
||||||
|
|
||||||
|
namespace AvalonDock |
||||||
|
{ |
||||||
|
/// <summary>
|
||||||
|
/// Image control that get's greyed out when disabled.
|
||||||
|
/// This control is intended to be used for toolbar, menu or button icons where ability of an icon to
|
||||||
|
/// grey itself out when disabled is essential.
|
||||||
|
/// <remarks>
|
||||||
|
/// 1) Greyscale image is created using FormatConvertedBitmap class. Unfortunately when converting the
|
||||||
|
/// image to greyscale this class does n0t preserve transparency information. To overcome that, there is
|
||||||
|
/// an opacity mask created from original image that is applied to greyscale image in order to preserve
|
||||||
|
/// transparency information. Because of that if an OpacityMask is applied to original image that mask
|
||||||
|
/// has to be combined with that special opacity mask of greyscale image in order to make a proper
|
||||||
|
/// greyscale image look. If you know how to combine two opacity masks please let me know.
|
||||||
|
/// 2) DrawingImage source is not supported at the moment.
|
||||||
|
/// 3) Have not tried to use any BitmapSource derived sources accept for BitmapImage so it may not be
|
||||||
|
/// able to convert some of them to greyscale.
|
||||||
|
/// 4) When specifying source Uri from XAML try to use Absolute Uri otherwise the greyscale image
|
||||||
|
/// may not be created in some scenarious. There is some code to improve the situation but I cannot
|
||||||
|
/// guarantee it will work in all possible scenarious.
|
||||||
|
/// 5) In case the greyscaled version cannot be created for whatever reason the original image with
|
||||||
|
/// 60% opacity (i.e. dull colours) will be used instead (that will work even with the DrawingImage
|
||||||
|
/// source).
|
||||||
|
/// </remarks>
|
||||||
|
/// </summary>
|
||||||
|
public class GreyableImage : Image |
||||||
|
{ |
||||||
|
// these are holding references to original and greyscale ImageSources
|
||||||
|
private ImageSource _sourceC, _sourceG; |
||||||
|
// these are holding original and greyscale opacity masks
|
||||||
|
private Brush _opacityMaskC, _opacityMaskG; |
||||||
|
|
||||||
|
static GreyableImage() |
||||||
|
{ |
||||||
|
DefaultStyleKeyProperty.OverrideMetadata(typeof(GreyableImage), new FrameworkPropertyMetadata(typeof(GreyableImage))); |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Overwritten to handle changes of IsEnabled, Source and OpacityMask properties
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="e"></param>
|
||||||
|
protected override void OnPropertyChanged(DependencyPropertyChangedEventArgs e) |
||||||
|
{ |
||||||
|
if (e.Property.Name.Equals("IsEnabled")) |
||||||
|
{ |
||||||
|
if ((e.NewValue as bool?) == false) |
||||||
|
{ |
||||||
|
Source = _sourceG; |
||||||
|
OpacityMask = _opacityMaskG; |
||||||
|
} |
||||||
|
else if ((e.NewValue as bool?) == true) |
||||||
|
{ |
||||||
|
Source = _sourceC; |
||||||
|
OpacityMask = _opacityMaskC; |
||||||
|
} |
||||||
|
} |
||||||
|
else if (e.Property.Name.Equals("Source") && |
||||||
|
!object.ReferenceEquals(Source, _sourceC) && |
||||||
|
!object.ReferenceEquals(Source, _sourceG)) // only recache Source if it's the new one from outside
|
||||||
|
{ |
||||||
|
SetSources(); |
||||||
|
} |
||||||
|
else if (e.Property.Name.Equals("OpacityMask") && |
||||||
|
!object.ReferenceEquals(OpacityMask, _opacityMaskC) && |
||||||
|
!object.ReferenceEquals(OpacityMask, _opacityMaskG)) // only recache opacityMask if it's the new one from outside
|
||||||
|
{ |
||||||
|
_opacityMaskC = OpacityMask; |
||||||
|
} |
||||||
|
|
||||||
|
base.OnPropertyChanged(e); |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Cashes original ImageSource, creates and caches greyscale ImageSource and greyscale opacity mask
|
||||||
|
/// </summary>
|
||||||
|
private void SetSources() |
||||||
|
{ |
||||||
|
// in case greyscale image cannot be created set greyscale source to original Source first
|
||||||
|
_sourceG = _sourceC = Source; |
||||||
|
|
||||||
|
// create Opacity Mask for greyscale image as FormatConvertedBitmap does not keep transparency info
|
||||||
|
_opacityMaskG = new ImageBrush(_sourceC); |
||||||
|
_opacityMaskG.Opacity = 0.6; |
||||||
|
|
||||||
|
try |
||||||
|
{ |
||||||
|
// get the string Uri for the original image source first
|
||||||
|
String stringUri = TypeDescriptor.GetConverter(Source).ConvertTo(Source, typeof(string)) as string; |
||||||
|
Uri uri = null; |
||||||
|
// try to resolve it as an absolute Uri (if it is relative and used it as is
|
||||||
|
// it is likely to point in a wrong direction)
|
||||||
|
if (!Uri.TryCreate(stringUri, UriKind.Absolute, out uri)) |
||||||
|
{ |
||||||
|
// it seems that the Uri is relative, at this stage we can only assume that
|
||||||
|
// the image requested is in the same assembly as this oblect,
|
||||||
|
// so we modify the string Uri to make it absolute ...
|
||||||
|
stringUri = "pack://application:,,,/" + stringUri.TrimStart(new char[2] { System.IO.Path.DirectorySeparatorChar, System.IO.Path.AltDirectorySeparatorChar }); |
||||||
|
|
||||||
|
// ... and try to resolve again
|
||||||
|
uri = new Uri(stringUri); |
||||||
|
} |
||||||
|
|
||||||
|
// create and cache greyscale ImageSource
|
||||||
|
_sourceG = new FormatConvertedBitmap(new BitmapImage(uri), PixelFormats.Gray8, null, 0); |
||||||
|
} |
||||||
|
catch (Exception e) |
||||||
|
{ |
||||||
|
System.Diagnostics.Debug.Fail("The Image used cannot be greyed out.", |
||||||
|
"Use BitmapImage or URI as a Source in order to allow greyscaling. Make sure the absolute Uri is used as relative Uri may sometimes resolve incorrectly.\n\nException: " + e.Message); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,204 @@ |
|||||||
|
using System; |
||||||
|
using System.Collections.Generic; |
||||||
|
using System.Text; |
||||||
|
using System.Windows; |
||||||
|
using System.Windows.Media; |
||||||
|
using System.Windows.Controls; |
||||||
|
using System.Windows.Threading; |
||||||
|
using System.Threading; |
||||||
|
|
||||||
|
namespace AvalonDock |
||||||
|
{ |
||||||
|
internal static class HelperFunc |
||||||
|
{ |
||||||
|
public static void ForEach<T>(this IEnumerable<T> collection, Action<T> action) |
||||||
|
{ |
||||||
|
foreach (T v in collection) |
||||||
|
action(v); |
||||||
|
} |
||||||
|
|
||||||
|
public static bool AreClose(double v1, double v2) |
||||||
|
{ |
||||||
|
if (v1 == v2) |
||||||
|
{ |
||||||
|
return true; |
||||||
|
} |
||||||
|
double num = ((Math.Abs(v1) + Math.Abs(v2)) + 10.0) * 2.2204460492503131E-16; |
||||||
|
double num2 = v1 - v2; |
||||||
|
return ((-num < num2) && (num > num2)); |
||||||
|
} |
||||||
|
|
||||||
|
public static double MultiplyCheckNaN(double v1, double v2) |
||||||
|
{ |
||||||
|
//inf * 0 = 1
|
||||||
|
if (double.IsInfinity(v1) && |
||||||
|
v2 == 0.0) |
||||||
|
return 1.0; |
||||||
|
if (double.IsInfinity(v2) && |
||||||
|
v1 == 0.0) |
||||||
|
return 1.0; |
||||||
|
|
||||||
|
return v1 * v2; |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
public static bool IsLessThen(double v1, double v2) |
||||||
|
{ |
||||||
|
if (AreClose(v1, v2)) |
||||||
|
return false; |
||||||
|
|
||||||
|
return v1 < v2; |
||||||
|
} |
||||||
|
|
||||||
|
public static Point PointToScreenWithoutFlowDirection(FrameworkElement element, Point point) |
||||||
|
{ |
||||||
|
if (FrameworkElement.GetFlowDirection(element) == FlowDirection.RightToLeft) |
||||||
|
{ |
||||||
|
Point leftToRightPoint = new Point( |
||||||
|
element.ActualWidth - point.X, |
||||||
|
point.Y); |
||||||
|
return element.PointToScreenDPI(leftToRightPoint); |
||||||
|
} |
||||||
|
|
||||||
|
return element.PointToScreenDPI(point); |
||||||
|
} |
||||||
|
|
||||||
|
public static T FindVisualAncestor<T>(this DependencyObject obj, bool includeThis) where T : DependencyObject |
||||||
|
{ |
||||||
|
if (!includeThis) |
||||||
|
obj = VisualTreeHelper.GetParent(obj); |
||||||
|
|
||||||
|
while (obj != null && (!(obj is T))) |
||||||
|
{ |
||||||
|
obj = VisualTreeHelper.GetParent(obj); |
||||||
|
} |
||||||
|
|
||||||
|
return obj as T; |
||||||
|
} |
||||||
|
|
||||||
|
public static bool IsLogicalChildContained<T>(this DependencyObject obj) where T : DependencyObject |
||||||
|
{ |
||||||
|
foreach (object child in LogicalTreeHelper.GetChildren(obj)) |
||||||
|
{ |
||||||
|
if (child is T) |
||||||
|
return true; |
||||||
|
|
||||||
|
if (child is DependencyObject) |
||||||
|
{ |
||||||
|
|
||||||
|
bool res = (child as DependencyObject).IsLogicalChildContained<T>(); |
||||||
|
if (res) |
||||||
|
return true; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
return false; |
||||||
|
} |
||||||
|
|
||||||
|
public static T GetLogicalChildContained<T>(this DependencyObject obj) where T : DependencyObject |
||||||
|
{ |
||||||
|
foreach (object child in LogicalTreeHelper.GetChildren(obj)) |
||||||
|
{ |
||||||
|
if (child is T) |
||||||
|
return child as T; |
||||||
|
|
||||||
|
if (child is DependencyObject) |
||||||
|
{ |
||||||
|
T childFound = (child as DependencyObject).GetLogicalChildContained<T>(); |
||||||
|
if (childFound != null) |
||||||
|
return childFound; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
return null; |
||||||
|
} |
||||||
|
|
||||||
|
public static T FindAnotherLogicalChildContained<T>(this DependencyObject obj, UIElement childToExclude) where T : DependencyObject |
||||||
|
{ |
||||||
|
foreach (object child in LogicalTreeHelper.GetChildren(obj)) |
||||||
|
{ |
||||||
|
if (child is T && child != childToExclude) |
||||||
|
return child as T; |
||||||
|
|
||||||
|
if (child is DependencyObject) |
||||||
|
{ |
||||||
|
T childFound = (child as DependencyObject).FindAnotherLogicalChildContained<T>(childToExclude); |
||||||
|
if (childFound != null) |
||||||
|
return childFound; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
return null; |
||||||
|
} |
||||||
|
|
||||||
|
public static IEnumerable<DockablePane> DockablePanes(this UIElement element) |
||||||
|
{ |
||||||
|
if (element is DockablePane) |
||||||
|
yield return element as DockablePane; |
||||||
|
|
||||||
|
foreach (UIElement childObject in LogicalTreeHelper.GetChildren(element)) |
||||||
|
{ |
||||||
|
if (element is DockablePane) |
||||||
|
yield return element as DockablePane; |
||||||
|
|
||||||
|
yield return FindChildDockablePane(childObject); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
static DockablePane FindChildDockablePane(UIElement parent) |
||||||
|
{ |
||||||
|
if (parent is ResizingPanel) |
||||||
|
{ |
||||||
|
foreach (UIElement childObject in ((ResizingPanel)parent).Children) |
||||||
|
{ |
||||||
|
DockablePane foundPane = FindChildDockablePane(childObject); |
||||||
|
if (foundPane != null) |
||||||
|
return foundPane; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
return null; |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
public static Point PointToScreenDPI(this Visual visual, Point pt) |
||||||
|
{ |
||||||
|
Point resultPt = visual.PointToScreen(pt); |
||||||
|
return TransformToDeviceDPI(visual, resultPt); |
||||||
|
} |
||||||
|
|
||||||
|
public static Point TransformToDeviceDPI(this Visual visual, Point pt) |
||||||
|
{ |
||||||
|
Matrix m = PresentationSource.FromVisual(visual).CompositionTarget.TransformToDevice; |
||||||
|
return new Point(pt.X / m.M11, pt.Y /m.M22); |
||||||
|
} |
||||||
|
|
||||||
|
public static Size TransformFromDeviceDPI(this Visual visual, Size size) |
||||||
|
{ |
||||||
|
Matrix m = PresentationSource.FromVisual(visual).CompositionTarget.TransformToDevice; |
||||||
|
return new Size(size.Width * m.M11, size.Height * m.M22); |
||||||
|
} |
||||||
|
|
||||||
|
public static Point TransformFromDeviceDPI(this Visual visual, Point pt) |
||||||
|
{ |
||||||
|
Matrix m = PresentationSource.FromVisual(visual).CompositionTarget.TransformToDevice; |
||||||
|
return new Point(pt.X * m.M11, pt.Y * m.M22); |
||||||
|
} |
||||||
|
|
||||||
|
public static bool CanTransform(this Visual visual) |
||||||
|
{ |
||||||
|
return PresentationSource.FromVisual(visual) != null; |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
public static void CallMethod(this object o, string methodName, object[] args) |
||||||
|
{ |
||||||
|
o.GetType().GetMethod(methodName).Invoke(o, null); |
||||||
|
} |
||||||
|
|
||||||
|
public static T GetPropertyValue<T>(this object o, string propertyName) |
||||||
|
{ |
||||||
|
return (T)o.GetType().GetProperty(propertyName).GetValue(o, null); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,36 @@ |
|||||||
|
//Copyright (c) 2007-2010, Adolfo Marinucci
|
||||||
|
//All rights reserved.
|
||||||
|
|
||||||
|
//Redistribution and use in source and binary forms, with or without modification,
|
||||||
|
//are permitted provided that the following conditions are met:
|
||||||
|
//
|
||||||
|
//* Redistributions of source code must retain the above copyright notice,
|
||||||
|
// this list of conditions and the following disclaimer.
|
||||||
|
//* Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
// this list of conditions and the following disclaimer in the documentation
|
||||||
|
// and/or other materials provided with the distribution.
|
||||||
|
//* Neither the name of Adolfo Marinucci nor the names of its contributors may
|
||||||
|
// be used to endorse or promote products derived from this software without
|
||||||
|
// specific prior written permission.
|
||||||
|
//
|
||||||
|
//THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||||
|
//AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
//WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||||
|
//IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||||
|
//INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||||
|
//PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||||
|
//HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||||
|
//OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
||||||
|
//EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
|
using System; |
||||||
|
using System.Collections.Generic; |
||||||
|
using System.Text; |
||||||
|
|
||||||
|
namespace AvalonDock |
||||||
|
{ |
||||||
|
interface IDockableControl |
||||||
|
{ |
||||||
|
bool IsDocked { get; } |
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,72 @@ |
|||||||
|
//Copyright (c) 2007-2010, Adolfo Marinucci
|
||||||
|
//All rights reserved.
|
||||||
|
|
||||||
|
//Redistribution and use in source and binary forms, with or without modification,
|
||||||
|
//are permitted provided that the following conditions are met:
|
||||||
|
//
|
||||||
|
//* Redistributions of source code must retain the above copyright notice,
|
||||||
|
// this list of conditions and the following disclaimer.
|
||||||
|
//* Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
// this list of conditions and the following disclaimer in the documentation
|
||||||
|
// and/or other materials provided with the distribution.
|
||||||
|
//* Neither the name of Adolfo Marinucci nor the names of its contributors may
|
||||||
|
// be used to endorse or promote products derived from this software without
|
||||||
|
// specific prior written permission.
|
||||||
|
//
|
||||||
|
//THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||||
|
//AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
//WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||||
|
//IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||||
|
//INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||||
|
//PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||||
|
//HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||||
|
//OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
||||||
|
//EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
|
using System; |
||||||
|
using System.Collections.Generic; |
||||||
|
using System.Text; |
||||||
|
using System.Windows; |
||||||
|
|
||||||
|
namespace AvalonDock |
||||||
|
{ |
||||||
|
/// <summary>
|
||||||
|
/// Defines an interface that must be implemented by objects that can host dragged panes
|
||||||
|
/// </summary>
|
||||||
|
internal interface IDropSurface |
||||||
|
{ |
||||||
|
/// <summary>
|
||||||
|
/// Gets a value indicating if this area is avilable for drop a dockable pane
|
||||||
|
/// </summary>
|
||||||
|
bool IsSurfaceVisible { get; } |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the sensible area for drop a pane
|
||||||
|
/// </summary>
|
||||||
|
Rect SurfaceRectangle { get; } |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Called by <see cref="DragPaneService"/> when user dragged pane enter this surface
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="point">Location of the mouse</param>
|
||||||
|
void OnDragEnter(Point point); |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Called by <see cref="DragPaneService"/> when user dragged pane is over this surface
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="point">Location of the mouse</param>
|
||||||
|
void OnDragOver(Point point); |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Called by <see cref="DragPaneService"/> when user dragged pane leave this surface
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="point">Location of the mouse</param>
|
||||||
|
void OnDragLeave(Point point); |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Called by <see cref="DragPaneService"/> when user drops a pane to this surface
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="point">Location of the mouse</param>
|
||||||
|
bool OnDrop(Point point); |
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,71 @@ |
|||||||
|
//Copyright (c) 2007-2010, Adolfo Marinucci
|
||||||
|
//All rights reserved.
|
||||||
|
|
||||||
|
//Redistribution and use in source and binary forms, with or without modification,
|
||||||
|
//are permitted provided that the following conditions are met:
|
||||||
|
//
|
||||||
|
//* Redistributions of source code must retain the above copyright notice,
|
||||||
|
// this list of conditions and the following disclaimer.
|
||||||
|
//* Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
// this list of conditions and the following disclaimer in the documentation
|
||||||
|
// and/or other materials provided with the distribution.
|
||||||
|
//* Neither the name of Adolfo Marinucci nor the names of its contributors may
|
||||||
|
// be used to endorse or promote products derived from this software without
|
||||||
|
// specific prior written permission.
|
||||||
|
//
|
||||||
|
//THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||||
|
//AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
//WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||||
|
//IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||||
|
//INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||||
|
//PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||||
|
//HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||||
|
//OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
||||||
|
//EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
|
|
||||||
|
using System; |
||||||
|
using System.Collections.Generic; |
||||||
|
using System.Linq; |
||||||
|
using System.Text; |
||||||
|
using System.Runtime.InteropServices; |
||||||
|
|
||||||
|
namespace AvalonDock |
||||||
|
{ |
||||||
|
internal sealed class InteropHelper |
||||||
|
{ |
||||||
|
[DllImport("user32.dll")] |
||||||
|
public static extern int SetWindowRgn(IntPtr hWnd, IntPtr hRgn, bool bRedraw); |
||||||
|
|
||||||
|
[DllImport("gdi32.dll")] |
||||||
|
public static extern IntPtr CreateRectRgn(int left, int top, int right, int bottom); |
||||||
|
|
||||||
|
[DllImport("gdi32.dll")] |
||||||
|
public static extern int CombineRgn(IntPtr hrgnDest, IntPtr hrgnSrc1, IntPtr hrgnSrc2, int fnCombineMode); |
||||||
|
|
||||||
|
public enum CombineRgnStyles : int |
||||||
|
{ |
||||||
|
RGN_AND = 1, |
||||||
|
RGN_OR = 2, |
||||||
|
RGN_XOR = 3, |
||||||
|
RGN_DIFF = 4, |
||||||
|
RGN_COPY = 5, |
||||||
|
RGN_MIN = RGN_AND, |
||||||
|
RGN_MAX = RGN_COPY |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
[StructLayout(LayoutKind.Sequential)] |
||||||
|
internal struct Win32Point |
||||||
|
{ |
||||||
|
public Int32 X; |
||||||
|
public Int32 Y; |
||||||
|
}; |
||||||
|
|
||||||
|
[DllImport("user32.dll")] |
||||||
|
internal static extern bool GetCursorPos(ref Win32Point pt); |
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,159 @@ |
|||||||
|
using System; |
||||||
|
using System.Collections.Generic; |
||||||
|
using System.Linq; |
||||||
|
using System.Text; |
||||||
|
using System.Windows; |
||||||
|
using System.Windows.Media; |
||||||
|
using System.Collections; |
||||||
|
|
||||||
|
namespace AvalonDock |
||||||
|
{ |
||||||
|
/// <summary>
|
||||||
|
/// Defines an adapter that must be implemented in order to use the LinqToTree
|
||||||
|
/// extension methods
|
||||||
|
/// </summary>
|
||||||
|
/// <typeparam name="T"></typeparam>
|
||||||
|
internal interface ILinqToTree<T> |
||||||
|
{ |
||||||
|
/// <summary>
|
||||||
|
/// Obtains all the children of the Item.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
IEnumerable<ILinqToTree<T>> Children(); |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The parent of the Item.
|
||||||
|
/// </summary>
|
||||||
|
ILinqToTree<T> Parent { get; } |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The item being adapted.
|
||||||
|
/// </summary>
|
||||||
|
T Item { get; } |
||||||
|
} |
||||||
|
|
||||||
|
internal static class ILinqToTreeExts |
||||||
|
{ |
||||||
|
/// <summary>
|
||||||
|
/// Returns a collection of descendant elements.
|
||||||
|
/// </summary>
|
||||||
|
public static IEnumerable<ILinqToTree<T>> |
||||||
|
Descendants<T>(this ILinqToTree<T> adapter) |
||||||
|
{ |
||||||
|
foreach (var child in adapter.Children()) |
||||||
|
{ |
||||||
|
yield return child; |
||||||
|
|
||||||
|
foreach (var grandChild in child.Descendants()) |
||||||
|
{ |
||||||
|
yield return grandChild; |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns a collection of ancestor elements.
|
||||||
|
/// </summary>
|
||||||
|
public static IEnumerable<ILinqToTree<T>> |
||||||
|
Ancestors<T>(this ILinqToTree<T> adapter) |
||||||
|
{ |
||||||
|
var parent = adapter.Parent; |
||||||
|
while (parent != null) |
||||||
|
{ |
||||||
|
yield return parent; |
||||||
|
parent = parent.Parent; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns a collection of child elements.
|
||||||
|
/// </summary>
|
||||||
|
public static IEnumerable<ILinqToTree<T>> |
||||||
|
Elements<T>(this ILinqToTree<T> adapter) |
||||||
|
{ |
||||||
|
foreach (var child in adapter.Children()) |
||||||
|
{ |
||||||
|
yield return child; |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// An adapter for DependencyObject which implements ILinqToTree in
|
||||||
|
/// order to allow Linq queries on the visual tree
|
||||||
|
/// </summary>
|
||||||
|
internal class VisualTreeAdapter : ILinqToTree<DependencyObject> |
||||||
|
{ |
||||||
|
private DependencyObject _item; |
||||||
|
|
||||||
|
public VisualTreeAdapter(DependencyObject item) |
||||||
|
{ |
||||||
|
_item = item; |
||||||
|
} |
||||||
|
|
||||||
|
public IEnumerable<ILinqToTree<DependencyObject>> Children() |
||||||
|
{ |
||||||
|
int childrenCount = VisualTreeHelper.GetChildrenCount(_item); |
||||||
|
for (int i = 0; i < childrenCount; i++) |
||||||
|
{ |
||||||
|
yield return new VisualTreeAdapter(VisualTreeHelper.GetChild(_item, i)); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public ILinqToTree<DependencyObject> Parent |
||||||
|
{ |
||||||
|
get |
||||||
|
{ |
||||||
|
return new VisualTreeAdapter(VisualTreeHelper.GetParent(_item)); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public DependencyObject Item |
||||||
|
{ |
||||||
|
get |
||||||
|
{ |
||||||
|
return _item; |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// An adapter for DependencyObject which implements ILinqToTree in
|
||||||
|
/// order to allow Linq queries on the logical tree
|
||||||
|
/// </summary>
|
||||||
|
internal class LogicalTreeAdapter : ILinqToTree<DependencyObject> |
||||||
|
{ |
||||||
|
private DependencyObject _item; |
||||||
|
|
||||||
|
public LogicalTreeAdapter(DependencyObject item) |
||||||
|
{ |
||||||
|
_item = item; |
||||||
|
} |
||||||
|
|
||||||
|
public IEnumerable<ILinqToTree<DependencyObject>> Children() |
||||||
|
{ |
||||||
|
IEnumerable<DependencyObject> children = LogicalTreeHelper.GetChildren(_item).OfType<DependencyObject>(); |
||||||
|
foreach (DependencyObject child in children) |
||||||
|
{ |
||||||
|
yield return new LogicalTreeAdapter(child); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public ILinqToTree<DependencyObject> Parent |
||||||
|
{ |
||||||
|
get |
||||||
|
{ |
||||||
|
return new VisualTreeAdapter(LogicalTreeHelper.GetParent(_item)); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public DependencyObject Item |
||||||
|
{ |
||||||
|
get |
||||||
|
{ |
||||||
|
return _item; |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
@ -0,0 +1,961 @@ |
|||||||
|
//Copyright (c) 2007-2010, Adolfo Marinucci
|
||||||
|
//All rights reserved.
|
||||||
|
|
||||||
|
//Redistribution and use in source and binary forms, with or without modification,
|
||||||
|
//are permitted provided that the following conditions are met:
|
||||||
|
//
|
||||||
|
//* Redistributions of source code must retain the above copyright notice,
|
||||||
|
// this list of conditions and the following disclaimer.
|
||||||
|
//* Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
// this list of conditions and the following disclaimer in the documentation
|
||||||
|
// and/or other materials provided with the distribution.
|
||||||
|
//* Neither the name of Adolfo Marinucci nor the names of its contributors may
|
||||||
|
// be used to endorse or promote products derived from this software without
|
||||||
|
// specific prior written permission.
|
||||||
|
//
|
||||||
|
//THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||||
|
//AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
//WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||||
|
//IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||||
|
//INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||||
|
//PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||||
|
//HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||||
|
//OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
||||||
|
//EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
|
using System; |
||||||
|
using System.Collections.Generic; |
||||||
|
using System.Text; |
||||||
|
using System.Windows; |
||||||
|
using System.Windows.Controls; |
||||||
|
using System.Windows.Controls.Primitives; |
||||||
|
using System.Windows.Data; |
||||||
|
using System.Windows.Documents; |
||||||
|
using System.Windows.Input; |
||||||
|
using System.Windows.Media; |
||||||
|
using System.Windows.Media.Imaging; |
||||||
|
using System.Windows.Shapes; |
||||||
|
using System.ComponentModel; |
||||||
|
using System.Xml; |
||||||
|
using System.Windows.Forms.Integration; |
||||||
|
using System.Diagnostics; |
||||||
|
using System.Windows.Threading; |
||||||
|
using System.Threading; |
||||||
|
using System.Reflection; |
||||||
|
using System.Net.Cache; |
||||||
|
|
||||||
|
|
||||||
|
namespace AvalonDock |
||||||
|
{ |
||||||
|
|
||||||
|
public abstract class ManagedContent : ContentControl, INotifyPropertyChanged |
||||||
|
{ |
||||||
|
static ManagedContent() |
||||||
|
{ |
||||||
|
//This OverrideMetadata call tells the system that this element wants to provide a style that is different than its base class.
|
||||||
|
//This style is defined in themes\generic.xaml
|
||||||
|
DefaultStyleKeyProperty.OverrideMetadata(typeof(ManagedContent), new FrameworkPropertyMetadata(typeof(ManagedContent))); |
||||||
|
|
||||||
|
WidthProperty.OverrideMetadata(typeof(ManagedContent), new FrameworkPropertyMetadata(double.NaN, null, new CoerceValueCallback( |
||||||
|
(s, v) => |
||||||
|
{ |
||||||
|
if (!DesignerProperties.GetIsInDesignMode(s as DependencyObject)) |
||||||
|
return double.NaN; |
||||||
|
|
||||||
|
return v; |
||||||
|
}))); |
||||||
|
HeightProperty.OverrideMetadata(typeof(ManagedContent), new FrameworkPropertyMetadata(double.NaN, null, new CoerceValueCallback( |
||||||
|
(s, v) => |
||||||
|
{ |
||||||
|
if (!DesignerProperties.GetIsInDesignMode(s as DependencyObject)) |
||||||
|
return double.NaN; |
||||||
|
|
||||||
|
return v; |
||||||
|
}))); |
||||||
|
|
||||||
|
FocusableProperty.OverrideMetadata(typeof(ManagedContent), new FrameworkPropertyMetadata(true)); |
||||||
|
} |
||||||
|
|
||||||
|
public ManagedContent() |
||||||
|
{ |
||||||
|
this.Loaded += new RoutedEventHandler(ManagedContent_Loaded); |
||||||
|
this.Unloaded += new RoutedEventHandler(ManagedContent_Unloaded); |
||||||
|
} |
||||||
|
|
||||||
|
//WindowsFormsHost GetWinFormsHost()
|
||||||
|
//{
|
||||||
|
// WindowsFormsHost contentHost = null;
|
||||||
|
|
||||||
|
// if (this.Content is UserControl)
|
||||||
|
// {
|
||||||
|
// UserControl usTemp = this.Content as UserControl;
|
||||||
|
|
||||||
|
// if (usTemp.Content is WindowsFormsHost)
|
||||||
|
// contentHost = usTemp.Content as WindowsFormsHost;
|
||||||
|
// }
|
||||||
|
// else if (this.Content is WindowsFormsHost)
|
||||||
|
// {
|
||||||
|
// contentHost = this.Content as WindowsFormsHost;
|
||||||
|
// }
|
||||||
|
|
||||||
|
// return contentHost;
|
||||||
|
//}
|
||||||
|
|
||||||
|
void ManagedContent_SizeChanged(object sender, SizeChangedEventArgs e) |
||||||
|
{ |
||||||
|
//WindowsFormsHost contentHost = GetWinFormsHost();
|
||||||
|
|
||||||
|
//if (contentHost != null)
|
||||||
|
//{
|
||||||
|
// object childCtrl = contentHost.GetType().GetProperty("Child").GetValue(contentHost, null);
|
||||||
|
|
||||||
|
// if (childCtrl != null)
|
||||||
|
// {
|
||||||
|
// this.Dispatcher.Invoke(new Action<object>((o) => o.CallMethod("Refresh", null)), DispatcherPriority.Render, childCtrl);
|
||||||
|
// }
|
||||||
|
//}
|
||||||
|
} |
||||||
|
|
||||||
|
protected virtual void OnContentLoaded() |
||||||
|
{ |
||||||
|
RaisePropertyChanged("ContainerPane"); |
||||||
|
} |
||||||
|
|
||||||
|
protected virtual void OnContentUnloaded() |
||||||
|
{ |
||||||
|
RaisePropertyChanged("ContainerPane"); |
||||||
|
} |
||||||
|
|
||||||
|
void ManagedContent_Loaded(object sender, RoutedEventArgs e) |
||||||
|
{ |
||||||
|
OnContentLoaded(); |
||||||
|
|
||||||
|
//WindowsFormsHost contentHost = GetWinFormsHost();
|
||||||
|
|
||||||
|
//if (contentHost != null)
|
||||||
|
//{
|
||||||
|
// contentHost.SizeChanged += new SizeChangedEventHandler(ManagedContent_SizeChanged);
|
||||||
|
//}
|
||||||
|
} |
||||||
|
|
||||||
|
void ManagedContent_Unloaded(object sender, RoutedEventArgs e) |
||||||
|
{ |
||||||
|
OnContentUnloaded(); |
||||||
|
|
||||||
|
//WindowsFormsHost contentHost = GetWinFormsHost();
|
||||||
|
|
||||||
|
//if (contentHost != null)
|
||||||
|
//{
|
||||||
|
// contentHost.SizeChanged -= new SizeChangedEventHandler(ManagedContent_SizeChanged);
|
||||||
|
//}
|
||||||
|
} |
||||||
|
|
||||||
|
#region Title
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or set the title of the content
|
||||||
|
/// </summary>
|
||||||
|
public string Title |
||||||
|
{ |
||||||
|
get { return (string)GetValue(TitleProperty); } |
||||||
|
set { SetValue(TitleProperty, value); } |
||||||
|
} |
||||||
|
|
||||||
|
// Using a DependencyProperty as the backing store for Title. This enables animation, styling, binding, etc...
|
||||||
|
public static readonly DependencyProperty TitleProperty = |
||||||
|
DependencyProperty.Register("Title", typeof(string), typeof(ManagedContent)); |
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Icon
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Access to <see cref="IconProperty"/> dependency property
|
||||||
|
/// </summary>
|
||||||
|
public ImageSource Icon |
||||||
|
{ |
||||||
|
get { return (ImageSource)GetValue(IconProperty); } |
||||||
|
set { SetValue(IconProperty, value); } |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Select an icon object for the content
|
||||||
|
/// </summary>
|
||||||
|
public static readonly DependencyProperty IconProperty = |
||||||
|
DependencyProperty.Register("Icon", typeof(ImageSource), typeof(ManagedContent), |
||||||
|
new FrameworkPropertyMetadata(null, new CoerceValueCallback(OnCoerce_Icon))); |
||||||
|
|
||||||
|
private static object OnCoerce_Icon(DependencyObject o, object value) |
||||||
|
{ |
||||||
|
//if (value is string)
|
||||||
|
//{
|
||||||
|
// Uri iconUri;
|
||||||
|
// //// try to resolve given value as an absolute URI
|
||||||
|
// if (Uri.TryCreate(value as String, UriKind.Relative, out iconUri))
|
||||||
|
// {
|
||||||
|
// ImageSource img = new BitmapImage(iconUri);
|
||||||
|
// if (img != null)
|
||||||
|
// return img;//new Image() { Source = img };
|
||||||
|
|
||||||
|
// //GreyableImage seems to be not compatible with .net 4
|
||||||
|
// //if (null != img)
|
||||||
|
// //{
|
||||||
|
// // GreyableImage icon = (o as ManagedContent).Icon as GreyableImage;
|
||||||
|
// // if (null == icon)
|
||||||
|
// // icon = new GreyableImage();
|
||||||
|
|
||||||
|
// // icon.Source = img;
|
||||||
|
// // //icon.Stretch = Stretch.None;
|
||||||
|
// // //icon.SnapsToDevicePixels = true;
|
||||||
|
|
||||||
|
// // return icon;
|
||||||
|
// //}
|
||||||
|
// }
|
||||||
|
//}
|
||||||
|
return value; |
||||||
|
} |
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region DefaultElement
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Access to <see cref="DefaultFocusedElementProperty"/>
|
||||||
|
/// </summary>
|
||||||
|
public IInputElement DefaultElement |
||||||
|
{ |
||||||
|
|
||||||
|
get { return (IInputElement)GetValue(DefaultFocusedElementProperty); } |
||||||
|
|
||||||
|
set { SetValue(DefaultFocusedElementProperty, value); } |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets an element which is focused by default when content is activated
|
||||||
|
/// </summary>
|
||||||
|
public static readonly DependencyProperty DefaultFocusedElementProperty = DependencyProperty.Register("DefaultElement", typeof(IInputElement), typeof(ManagedContent)); |
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
FrameworkElement _dragEnabledArea; |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the draggable area of the document
|
||||||
|
/// </summary>
|
||||||
|
protected FrameworkElement DragEnabledArea |
||||||
|
{ |
||||||
|
get { return _dragEnabledArea; } |
||||||
|
} |
||||||
|
|
||||||
|
public override void OnApplyTemplate() |
||||||
|
{ |
||||||
|
base.OnApplyTemplate(); |
||||||
|
|
||||||
|
_dragEnabledArea = GetTemplateChild("PART_DragArea") as FrameworkElement; |
||||||
|
|
||||||
|
if (_dragEnabledArea != null) |
||||||
|
{ |
||||||
|
_dragEnabledArea.MouseDown += new MouseButtonEventHandler(OnDragMouseDown); |
||||||
|
_dragEnabledArea.MouseMove += new MouseEventHandler(OnDragMouseMove); |
||||||
|
_dragEnabledArea.MouseUp += new MouseButtonEventHandler(OnDragMouseUp); |
||||||
|
_dragEnabledArea.MouseLeave += new MouseEventHandler(OnDragMouseLeave); |
||||||
|
} |
||||||
|
|
||||||
|
if (_dragEnabledArea != null) |
||||||
|
_dragEnabledArea.InputBindings.Add(new InputBinding(ManagedContentCommands.Close, new MouseGesture(MouseAction.MiddleClick))); |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
#region Mouse management
|
||||||
|
|
||||||
|
protected virtual void OnDragStart(Point ptMouse, Point ptrelativeMouse) |
||||||
|
{ |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
Point ptStartDrag; |
||||||
|
bool isMouseDown = false; |
||||||
|
|
||||||
|
protected Point StartDragPoint |
||||||
|
{ |
||||||
|
get { return ptStartDrag; } |
||||||
|
} |
||||||
|
|
||||||
|
protected bool IsMouseDown |
||||||
|
{ |
||||||
|
get { return isMouseDown; } |
||||||
|
} |
||||||
|
|
||||||
|
protected void ResetIsMouseDownFlag() |
||||||
|
{ |
||||||
|
isMouseDown = false; |
||||||
|
} |
||||||
|
|
||||||
|
protected virtual void OnDragMouseDown(object sender, MouseButtonEventArgs e) |
||||||
|
{ |
||||||
|
if (!e.Handled && Manager != null)// && State != DockableContentState.AutoHide)
|
||||||
|
{ |
||||||
|
isMouseDown = true; |
||||||
|
ptStartDrag = e.GetPosition((IInputElement)System.Windows.Media.VisualTreeHelper.GetParent(this)); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
protected virtual void OnDragMouseMove(object sender, MouseEventArgs e) |
||||||
|
{ |
||||||
|
} |
||||||
|
|
||||||
|
protected virtual void OnDragMouseUp(object sender, MouseButtonEventArgs e) |
||||||
|
{ |
||||||
|
isMouseDown = false; |
||||||
|
} |
||||||
|
|
||||||
|
Point ptRelativePosition; |
||||||
|
|
||||||
|
protected virtual void OnDragMouseLeave(object sender, MouseEventArgs e) |
||||||
|
{ |
||||||
|
if (!e.Handled && e.LeftButton == MouseButtonState.Pressed && Manager != null) |
||||||
|
{ |
||||||
|
if (!IsMouseCaptured) |
||||||
|
{ |
||||||
|
//Point ptMouseMove = e.GetPosition(this);
|
||||||
|
Point ptMouseMove = e.GetPosition((IInputElement)System.Windows.Media.VisualTreeHelper.GetParent(this)); |
||||||
|
ManagedContent contentToSwap = null; |
||||||
|
if (ContainerPane != null) |
||||||
|
{ |
||||||
|
foreach (ManagedContent content in ContainerPane.Items) |
||||||
|
{ |
||||||
|
if (content == this) |
||||||
|
continue; |
||||||
|
|
||||||
|
HitTestResult res = VisualTreeHelper.HitTest(content, e.GetPosition(content)); |
||||||
|
if (res != null) |
||||||
|
{ |
||||||
|
contentToSwap = content; |
||||||
|
break; |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
if (contentToSwap != null) |
||||||
|
{ |
||||||
|
Pane containerPane = ContainerPane; |
||||||
|
int myIndex = containerPane.Items.IndexOf(this); |
||||||
|
|
||||||
|
ContainerPane.Items.RemoveAt(myIndex); |
||||||
|
|
||||||
|
int otherIndex = containerPane.Items.IndexOf(contentToSwap); |
||||||
|
containerPane.Items.RemoveAt(otherIndex); |
||||||
|
|
||||||
|
containerPane.Items.Insert(otherIndex, this); |
||||||
|
|
||||||
|
containerPane.Items.Insert(myIndex, contentToSwap); |
||||||
|
|
||||||
|
containerPane.SelectedItem = this; |
||||||
|
|
||||||
|
e.Handled = false; |
||||||
|
return; |
||||||
|
} |
||||||
|
else if (Math.Abs(ptMouseMove.X - StartDragPoint.X) > SystemParameters.MinimumHorizontalDragDistance || |
||||||
|
Math.Abs(ptMouseMove.Y - StartDragPoint.Y) > SystemParameters.MinimumVerticalDragDistance) |
||||||
|
{ |
||||||
|
ptRelativePosition = e.GetPosition(DragEnabledArea); |
||||||
|
|
||||||
|
ResetIsMouseDownFlag(); |
||||||
|
OnDragStart(StartDragPoint, ptRelativePosition); |
||||||
|
e.Handled = true; |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
isMouseDown = false; |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
protected override void OnMouseDown(MouseButtonEventArgs e) |
||||||
|
{ |
||||||
|
base.OnMouseDown(e); |
||||||
|
|
||||||
|
if (!e.Handled) |
||||||
|
{ |
||||||
|
Activate(); |
||||||
|
//FocusManager.SetFocusedElement(Content as DependencyObject, DefaultElement);
|
||||||
|
//IInputElement focusedElement = e.Source as IInputElement;
|
||||||
|
//if (focusedElement != null) Keyboard.Focus(focusedElement);
|
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
protected override void OnKeyDown(KeyEventArgs e) |
||||||
|
{ |
||||||
|
if (e.Key == Key.Enter) |
||||||
|
{ |
||||||
|
if (ContainerPane != null) |
||||||
|
ContainerPane.SelectedItem = this; |
||||||
|
} |
||||||
|
|
||||||
|
base.OnKeyDown(e); |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets container pane currently hosting the content
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>Please note that this value could change as user move the content around the <see cref="DockingManager"/>.</remarks>
|
||||||
|
public Pane ContainerPane |
||||||
|
{ |
||||||
|
get |
||||||
|
{ |
||||||
|
Pane containerPane = Parent as Pane; |
||||||
|
if (containerPane != null) |
||||||
|
return containerPane; |
||||||
|
|
||||||
|
return this.FindVisualAncestor<Pane>(false); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Remove this content from its parent container pane
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
internal virtual ManagedContent DetachFromContainerPane() |
||||||
|
{ |
||||||
|
if (ContainerPane != null) |
||||||
|
{ |
||||||
|
int indexOfContent = ContainerPane.Items.IndexOf(this); |
||||||
|
return ContainerPane.RemoveContent(indexOfContent) as ManagedContent; |
||||||
|
} |
||||||
|
|
||||||
|
return null; |
||||||
|
} |
||||||
|
|
||||||
|
protected override void OnVisualParentChanged(DependencyObject oldParent) |
||||||
|
{ |
||||||
|
RaisePropertyChanged("ContainerPane"); |
||||||
|
base.OnVisualParentChanged(oldParent); |
||||||
|
} |
||||||
|
|
||||||
|
#region Manager
|
||||||
|
|
||||||
|
private DockingManager _manager = null; |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Get current hosting docking manager (<see cref="DockingManager"/>)
|
||||||
|
/// </summary>
|
||||||
|
public DockingManager Manager |
||||||
|
{ |
||||||
|
get { return _manager; } |
||||||
|
internal set |
||||||
|
{ |
||||||
|
if (_manager != value) |
||||||
|
{ |
||||||
|
DockingManager oldValue = _manager; |
||||||
|
_manager = value; |
||||||
|
OnManagerChanged(oldValue, value); |
||||||
|
RaisePropertyChanged("Manager"); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Provides derived classes an opportunity to handle changes to the Manager property.
|
||||||
|
/// </summary>
|
||||||
|
protected virtual void OnManagerChanged(DockingManager oldValue, DockingManager newValue) |
||||||
|
{ |
||||||
|
} |
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
protected DockingManager GetParentManager(Pane containerPane) |
||||||
|
{ |
||||||
|
if (containerPane == null) |
||||||
|
containerPane = ContainerPane; |
||||||
|
|
||||||
|
if (containerPane != null) |
||||||
|
return ContainerPane.GetManager(); |
||||||
|
|
||||||
|
return null; |
||||||
|
} |
||||||
|
|
||||||
|
protected override void OnGotKeyboardFocus(KeyboardFocusChangedEventArgs e) |
||||||
|
{ |
||||||
|
base.OnGotKeyboardFocus(e); |
||||||
|
|
||||||
|
Debug.WriteLine(string.Format("[{0}].OnGotKeyboardFocus() Source={1} NewFocus={2} OldFocus={3}", this.Name, e.Source.GetType().ToString(), e.NewFocus.GetType().ToString(), e.OldFocus == null ? "<null>" : e.OldFocus.GetType().ToString())); |
||||||
|
|
||||||
|
if (Manager != null && |
||||||
|
this.IsKeyboardFocusWithin) |
||||||
|
{ |
||||||
|
Manager.ActiveContent = this; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
protected override void OnLostKeyboardFocus(KeyboardFocusChangedEventArgs e) |
||||||
|
{ |
||||||
|
Debug.WriteLine(string.Format("[{0}].OnLostKeyboardFocus() Source={1} NewFocus={2} OldFocus={3}", this.Name, e.Source.GetType().ToString(), e.NewFocus == null ? "<null>" : e.NewFocus.GetType().ToString(), e.OldFocus == null ? "<null>" : e.OldFocus.GetType().ToString())); |
||||||
|
base.OnLostKeyboardFocus(e); |
||||||
|
} |
||||||
|
|
||||||
|
#region IsActiveContent
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// IsActiveContent Read-Only Dependency Property
|
||||||
|
/// </summary>
|
||||||
|
private static readonly DependencyPropertyKey IsActiveContentPropertyKey |
||||||
|
= DependencyProperty.RegisterReadOnly("IsActiveContent", typeof(bool), typeof(ManagedContent), |
||||||
|
new FrameworkPropertyMetadata((bool)false, |
||||||
|
new PropertyChangedCallback(OnIsActiveContentChanged))); |
||||||
|
|
||||||
|
public static readonly DependencyProperty IsActiveContentProperty |
||||||
|
= IsActiveContentPropertyKey.DependencyProperty; |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the IsActiveContent property. This dependency property
|
||||||
|
/// indicates the active (selected) content between all contents of the docking manager
|
||||||
|
/// </summary>
|
||||||
|
public bool IsActiveContent |
||||||
|
{ |
||||||
|
get { return (bool)GetValue(IsActiveContentProperty); } |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Provides a secure method for setting the IsActiveContent property.
|
||||||
|
/// This dependency property indicates the current content is the active content between all docking manager contents
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="value">The new value for the property.</param>
|
||||||
|
internal void SetIsActiveContent(bool value) |
||||||
|
{ |
||||||
|
SetValue(IsActiveContentPropertyKey, value); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Handles changes to the IsActiveContent property.
|
||||||
|
/// </summary>
|
||||||
|
private static void OnIsActiveContentChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) |
||||||
|
{ |
||||||
|
((ManagedContent)d).OnIsActiveContentChanged(e); |
||||||
|
} |
||||||
|
|
||||||
|
DateTime _lastActivation = DateTime.MinValue; |
||||||
|
|
||||||
|
internal DateTime LastActivation |
||||||
|
{ |
||||||
|
get { return _lastActivation; } |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Provides derived classes an opportunity to handle changes to the IsActiveContent property.
|
||||||
|
/// </summary>
|
||||||
|
protected virtual void OnIsActiveContentChanged(DependencyPropertyChangedEventArgs e) |
||||||
|
{ |
||||||
|
if (IsActiveContent) |
||||||
|
_lastActivation = DateTime.Now; |
||||||
|
|
||||||
|
FocusContent(); |
||||||
|
|
||||||
|
Pane parentPane = ContainerPane as Pane; |
||||||
|
if (parentPane != null) |
||||||
|
{ |
||||||
|
parentPane.RefreshContainsActiveContentProperty(); |
||||||
|
if (IsActiveContent) |
||||||
|
parentPane.SelectedItem = this; |
||||||
|
} |
||||||
|
|
||||||
|
//for backward compatibility
|
||||||
|
RaisePropertyChanged("IsActiveContent"); |
||||||
|
|
||||||
|
if (IsActiveContentChanged != null) |
||||||
|
IsActiveContentChanged(this, EventArgs.Empty); |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Provides derived classes an opportunity to manage custom focus strategy.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// Derived classes should not call base class if don't want AvalonDock to set focus on <see cref="DefaultElement"/> object
|
||||||
|
/// </remarks>
|
||||||
|
protected virtual void FocusContent() |
||||||
|
{ |
||||||
|
if (IsActiveContent && !IsKeyboardFocused) |
||||||
|
{ |
||||||
|
Dispatcher.BeginInvoke(DispatcherPriority.Input, new ThreadStart(delegate |
||||||
|
{ |
||||||
|
if (IsActiveContent && !IsKeyboardFocused) |
||||||
|
{ |
||||||
|
if (this.Content is WindowsFormsHost) |
||||||
|
{ |
||||||
|
//Use reflection in order to remove WinForms assembly reference
|
||||||
|
WindowsFormsHost contentHost = this.Content as WindowsFormsHost; |
||||||
|
|
||||||
|
object childCtrl = contentHost.GetType().GetProperty("Child").GetValue(contentHost, null); |
||||||
|
|
||||||
|
if (childCtrl != null) |
||||||
|
{ |
||||||
|
if (!childCtrl.GetPropertyValue<bool>("Focused")) |
||||||
|
{ |
||||||
|
childCtrl.CallMethod("Focus", null); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
else if (DefaultElement != null) |
||||||
|
{ |
||||||
|
Debug.WriteLine("Try to set kb focus to " + DefaultElement); |
||||||
|
|
||||||
|
IInputElement kbFocused = Keyboard.Focus(DefaultElement); |
||||||
|
|
||||||
|
if (kbFocused != null) |
||||||
|
Debug.WriteLine("Focused element " + kbFocused); |
||||||
|
else |
||||||
|
Debug.WriteLine("No focused element"); |
||||||
|
|
||||||
|
} |
||||||
|
else if (this.Content is IInputElement) |
||||||
|
{ |
||||||
|
Debug.WriteLine("Try to set kb focus to " + this.Content.ToString()); |
||||||
|
IInputElement kbFocused = Keyboard.Focus(this.Content as IInputElement); |
||||||
|
if (kbFocused != null) |
||||||
|
Debug.WriteLine("Focused element " + kbFocused); |
||||||
|
else |
||||||
|
Debug.WriteLine("No focused element"); |
||||||
|
} |
||||||
|
} |
||||||
|
})); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Event fired when the <see cref="IsActiveContent"/> property changes
|
||||||
|
/// </summary>
|
||||||
|
public event EventHandler IsActiveContentChanged; |
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region IsActiveDocument
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// IsActiveDocument Read-Only Dependency Property
|
||||||
|
/// </summary>
|
||||||
|
private static readonly DependencyPropertyKey IsActiveDocumentPropertyKey |
||||||
|
= DependencyProperty.RegisterReadOnly("IsActiveDocument", typeof(bool), typeof(ManagedContent), |
||||||
|
new FrameworkPropertyMetadata((bool)false, |
||||||
|
new PropertyChangedCallback(OnIsActiveDocumentChanged))); |
||||||
|
|
||||||
|
public static readonly DependencyProperty IsActiveDocumentProperty |
||||||
|
= IsActiveDocumentPropertyKey.DependencyProperty; |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the IsActiveDocument property. This dependency property
|
||||||
|
/// indicates is content is the active document.
|
||||||
|
/// </summary>
|
||||||
|
public bool IsActiveDocument |
||||||
|
{ |
||||||
|
get { return (bool)GetValue(IsActiveDocumentProperty); } |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Provides a secure method for setting the IsActiveDocument property.
|
||||||
|
/// This dependency property indicates is content is the active document.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="value">The new value for the property.</param>
|
||||||
|
internal void SetIsActiveDocument(bool value) |
||||||
|
{ |
||||||
|
SetValue(IsActiveDocumentPropertyKey, value); |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Handles changes to the IsActiveDocument property.
|
||||||
|
/// </summary>
|
||||||
|
private static void OnIsActiveDocumentChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) |
||||||
|
{ |
||||||
|
((ManagedContent)d).OnIsActiveDocumentChanged(e); |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Provides derived classes an opportunity to handle changes to the IsActiveDocument property.
|
||||||
|
/// </summary>
|
||||||
|
protected virtual void OnIsActiveDocumentChanged(DependencyPropertyChangedEventArgs e) |
||||||
|
{ |
||||||
|
if ((bool)e.NewValue) |
||||||
|
{ |
||||||
|
if (ContainerPane != null) |
||||||
|
ContainerPane.SelectedItem = this; |
||||||
|
} |
||||||
|
|
||||||
|
DocumentPane parentDocumentPane = ContainerPane as DocumentPane; |
||||||
|
if (parentDocumentPane != null) |
||||||
|
{ |
||||||
|
parentDocumentPane.RefreshContainsActiveDocumentProperty(); |
||||||
|
} |
||||||
|
|
||||||
|
Debug.WriteLine("{0}-{1}-{2}", IsFocused, IsKeyboardFocused, IsKeyboardFocusWithin); |
||||||
|
|
||||||
|
//for backward compatibility
|
||||||
|
RaisePropertyChanged("IsActiveDocumentChanged"); |
||||||
|
|
||||||
|
if (IsActiveDocumentChanged != null) |
||||||
|
IsActiveDocumentChanged(this, EventArgs.Empty); |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Event fired when the <see cref="IsActiveContent"/> property changes
|
||||||
|
/// </summary>
|
||||||
|
public event EventHandler IsActiveDocumentChanged; |
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region IsLocked
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// IsLocked Dependency Property
|
||||||
|
/// </summary>
|
||||||
|
public static readonly DependencyProperty IsLockedProperty = |
||||||
|
DependencyProperty.Register("IsLocked", typeof(bool), typeof(ManagedContent), |
||||||
|
new FrameworkPropertyMetadata((bool)false)); |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the IsLocked property. This dependency property
|
||||||
|
/// indicates if this content is locked (for <see cref="DocumentContent"/> objects this often means that it's readonly).
|
||||||
|
/// </summary>
|
||||||
|
public bool IsLocked |
||||||
|
{ |
||||||
|
get { return (bool)GetValue(IsLockedProperty); } |
||||||
|
set { SetValue(IsLockedProperty, value); } |
||||||
|
} |
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region FloatingWindowSize
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// FloatingWindowSize Dependency Property
|
||||||
|
/// </summary>
|
||||||
|
public static readonly DependencyProperty FloatingWindowSizeProperty = |
||||||
|
DependencyProperty.Register("FloatingWindowSize", typeof(Size), typeof(ManagedContent), |
||||||
|
new FrameworkPropertyMetadata(new Size(250,400), |
||||||
|
new PropertyChangedCallback(OnFloatingWindowSizeChanged))); |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the FloatingWindowSize property. This dependency property
|
||||||
|
/// indicates the size of the floating window hosting the content when it's floating.
|
||||||
|
/// </summary>
|
||||||
|
public Size FloatingWindowSize |
||||||
|
{ |
||||||
|
get { return (Size)GetValue(FloatingWindowSizeProperty); } |
||||||
|
set { SetValue(FloatingWindowSizeProperty, value); } |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Handles changes to the FloatingWindowSize property.
|
||||||
|
/// </summary>
|
||||||
|
private static void OnFloatingWindowSizeChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) |
||||||
|
{ |
||||||
|
((ManagedContent)d).OnFloatingWindowSizeChanged(e); |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Provides derived classes an opportunity to handle changes to the FloatingWindowSize property.
|
||||||
|
/// </summary>
|
||||||
|
protected virtual void OnFloatingWindowSizeChanged(DependencyPropertyChangedEventArgs e) |
||||||
|
{ |
||||||
|
} |
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region INotifyPropertyChanged Members
|
||||||
|
|
||||||
|
public event PropertyChangedEventHandler PropertyChanged; |
||||||
|
|
||||||
|
protected void RaisePropertyChanged(string propertyName) |
||||||
|
{ |
||||||
|
if (PropertyChanged != null) |
||||||
|
PropertyChanged(this, new PropertyChangedEventArgs(propertyName)); |
||||||
|
} |
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region IsCloseable
|
||||||
|
/// <summary>
|
||||||
|
/// Get or set a value indicating if this content can be closed or hidden
|
||||||
|
/// </summary>
|
||||||
|
public bool IsCloseable |
||||||
|
{ |
||||||
|
get { return (bool)GetValue(IsCloseableProperty); } |
||||||
|
set { SetValue(IsCloseableProperty, value); } |
||||||
|
} |
||||||
|
|
||||||
|
// Using a DependencyProperty as the backing store for IsCloseable. This enables animation, styling, binding, etc...
|
||||||
|
public static readonly DependencyProperty IsCloseableProperty = |
||||||
|
DependencyProperty.Register("IsCloseable", typeof(bool), typeof(ManagedContent), new UIPropertyMetadata(true)); |
||||||
|
|
||||||
|
internal virtual bool CanClose() |
||||||
|
{ |
||||||
|
if (!IsCloseable) |
||||||
|
return false; |
||||||
|
|
||||||
|
return true; |
||||||
|
} |
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Commands
|
||||||
|
|
||||||
|
protected override void OnInitialized(EventArgs e) |
||||||
|
{ |
||||||
|
base.OnInitialized(e); |
||||||
|
|
||||||
|
this.CommandBindings.Add( |
||||||
|
new CommandBinding(ManagedContentCommands.Hide, this.OnExecuteCommand, this.OnCanExecuteCommand)); |
||||||
|
this.CommandBindings.Add( |
||||||
|
new CommandBinding(ManagedContentCommands.Close, this.OnExecuteCommand, this.OnCanExecuteCommand)); |
||||||
|
this.CommandBindings.Add( |
||||||
|
new CommandBinding(ManagedContentCommands.Show, this.OnExecuteCommand, this.OnCanExecuteCommand)); |
||||||
|
this.CommandBindings.Add( |
||||||
|
new CommandBinding(ManagedContentCommands.Activate, this.OnExecuteCommand, this.OnCanExecuteCommand)); |
||||||
|
|
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
void OnExecuteCommand(object sender, ExecutedRoutedEventArgs e) |
||||||
|
{ |
||||||
|
if (e.Command == ManagedContentCommands.Show) |
||||||
|
{ |
||||||
|
Show(); |
||||||
|
e.Handled = true; |
||||||
|
} |
||||||
|
else if (e.Command == ManagedContentCommands.Hide) |
||||||
|
{ |
||||||
|
e.Handled = Hide(); |
||||||
|
} |
||||||
|
else if (e.Command == ManagedContentCommands.Close) |
||||||
|
{ |
||||||
|
e.Handled = Close(); |
||||||
|
} |
||||||
|
else if (e.Command == ManagedContentCommands.Activate) |
||||||
|
{ |
||||||
|
Activate(); |
||||||
|
e.Handled = true; |
||||||
|
} |
||||||
|
|
||||||
|
//else if (e.Command == ShowOptionsCommand)
|
||||||
|
//{
|
||||||
|
// OpenOptionsContextMenu();
|
||||||
|
// e.Handled = true;
|
||||||
|
//}
|
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
void OnCanExecuteCommand(object sender, CanExecuteRoutedEventArgs e) |
||||||
|
{ |
||||||
|
e.CanExecute = CanExecuteCommand(e.Command); |
||||||
|
|
||||||
|
//Debug.WriteLine("ManagedContent.OnCanExecuteCommand({0}) = {1} (ContinueRouting={2})", (e.Command as RoutedUICommand).Name, e.CanExecute, e.ContinueRouting);
|
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Retrive a value indicating if the command passed can be executed based to the content state
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="command">Command to execute</param>
|
||||||
|
/// <returns>True if the command can be execute, false otherwise.</returns>
|
||||||
|
protected virtual bool CanExecuteCommand(ICommand command) |
||||||
|
{ |
||||||
|
if (Manager == null) |
||||||
|
return false; |
||||||
|
|
||||||
|
return true; |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Shows the content
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>How content is shows depends from the type of the content.</remarks>
|
||||||
|
public abstract void Show(); |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Shows the content inside a <see cref="DockingManager"/> object
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>How content is shows depends from the type of the content.</remarks>
|
||||||
|
public abstract void Show(DockingManager manager); |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Event fired when the content is about to be closed
|
||||||
|
/// </summary>
|
||||||
|
public event EventHandler<CancelEventArgs> Closing; |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Event fired when the content has been closed
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>Note that when a document is closed property like <see cref="ManagedContent.ContainerPane"/> or <see cref="ManagedContent.Manager"/> returns null.</remarks>
|
||||||
|
public event EventHandler Closed; |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Ovveride this method to handle <see cref="DocumentContent.OnClosing"/> event.
|
||||||
|
/// </summary>
|
||||||
|
protected virtual void OnClosing(CancelEventArgs e) |
||||||
|
{ |
||||||
|
if (Closing != null && !e.Cancel) |
||||||
|
{ |
||||||
|
Closing(this, e); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Ovveride this method to handle <see cref="DocumentContent.OnClose"/> event.
|
||||||
|
/// </summary>
|
||||||
|
protected virtual void OnClosed() |
||||||
|
{ |
||||||
|
if (Closed != null) |
||||||
|
Closed(this, EventArgs.Empty); |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Close the content
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>Returns true if the content was succesfully closed, false otherwise.</returns>
|
||||||
|
public abstract bool Close(); |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Hide the content
|
||||||
|
/// </summary>
|
||||||
|
public abstract bool Hide(); |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Set the content as the active content
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>After this method returns property <see cref="IsActiveContent"/> returns true.</remarks>
|
||||||
|
public virtual void Activate() |
||||||
|
{ |
||||||
|
if (ContainerPane != null && Manager != null)// && Manager.ActiveContent != this)
|
||||||
|
{ |
||||||
|
ContainerPane.SelectedItem = this; |
||||||
|
ContainerPane.Focus(); |
||||||
|
if (Manager != null) |
||||||
|
Manager.ActiveContent = this; |
||||||
|
} |
||||||
|
} |
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Save/Restore Content Layout
|
||||||
|
/// <summary>
|
||||||
|
/// Save content specific layout settings
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="storeWriter">Backend store writer</param>
|
||||||
|
/// <remarks>Custom derived class can overloads this method to handle custom layout persistence.</remarks>
|
||||||
|
public virtual void SaveLayout(XmlWriter storeWriter) |
||||||
|
{ |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Restore content specific layout settings
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="storeReader">Saved xml element containg content layout settings</param>
|
||||||
|
/// <remarks>Custom derived class must overload this method to restore custom layout settings previously saved trought <see cref="SaveLayout"/>.</remarks>
|
||||||
|
public virtual void RestoreLayout(XmlElement contentElement) |
||||||
|
{ |
||||||
|
} |
||||||
|
#endregion
|
||||||
|
|
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,53 @@ |
|||||||
|
using System; |
||||||
|
using System.Collections.Generic; |
||||||
|
using System.Linq; |
||||||
|
using System.Text; |
||||||
|
using System.Collections.ObjectModel; |
||||||
|
|
||||||
|
namespace AvalonDock |
||||||
|
{ |
||||||
|
public class ManagedContentCollection<T> : ReadOnlyObservableCollection<T> where T : ManagedContent |
||||||
|
{ |
||||||
|
internal ManagedContentCollection(DockingManager manager) |
||||||
|
: base(new ObservableCollection<T>()) |
||||||
|
{ |
||||||
|
Manager = manager; |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Get associated <see cref="DockingManager"/> object
|
||||||
|
/// </summary>
|
||||||
|
public DockingManager Manager { get; private set; } |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Override collection changed event to setup manager property on <see cref="ManagedContent"/> objects
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="e"></param>
|
||||||
|
protected override void OnCollectionChanged(System.Collections.Specialized.NotifyCollectionChangedEventArgs e) |
||||||
|
{ |
||||||
|
if (e.NewItems != null) |
||||||
|
{ |
||||||
|
foreach (T cntAdded in e.NewItems) |
||||||
|
cntAdded.Manager = Manager; |
||||||
|
} |
||||||
|
|
||||||
|
base.OnCollectionChanged(e); |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Add a content to the list
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="contentToAdd"></param>
|
||||||
|
internal void Add(T contentToAdd) |
||||||
|
{ |
||||||
|
if (!Items.Contains(contentToAdd)) |
||||||
|
Items.Add(contentToAdd); |
||||||
|
} |
||||||
|
|
||||||
|
internal void Remove(T contentToRemove) |
||||||
|
{ |
||||||
|
Items.Remove(contentToRemove); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,126 @@ |
|||||||
|
//Copyright (c) 2007-2010, Adolfo Marinucci
|
||||||
|
//All rights reserved.
|
||||||
|
|
||||||
|
//Redistribution and use in source and binary forms, with or without modification,
|
||||||
|
//are permitted provided that the following conditions are met:
|
||||||
|
//
|
||||||
|
//* Redistributions of source code must retain the above copyright notice,
|
||||||
|
// this list of conditions and the following disclaimer.
|
||||||
|
//* Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
// this list of conditions and the following disclaimer in the documentation
|
||||||
|
// and/or other materials provided with the distribution.
|
||||||
|
//* Neither the name of Adolfo Marinucci nor the names of its contributors may
|
||||||
|
// be used to endorse or promote products derived from this software without
|
||||||
|
// specific prior written permission.
|
||||||
|
//
|
||||||
|
//THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||||
|
//AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
//WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||||
|
//IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||||
|
//INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||||
|
//PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||||
|
//HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||||
|
//OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
||||||
|
//EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
|
using System; |
||||||
|
using System.Collections.Generic; |
||||||
|
using System.Linq; |
||||||
|
using System.Text; |
||||||
|
using System.Windows.Input; |
||||||
|
|
||||||
|
namespace AvalonDock |
||||||
|
{ |
||||||
|
/// <summary>
|
||||||
|
/// Defines commands shared beteween all contents (Dockable or Documents)
|
||||||
|
/// </summary>
|
||||||
|
public sealed class ManagedContentCommands |
||||||
|
{ |
||||||
|
private static object syncRoot = new object(); |
||||||
|
|
||||||
|
|
||||||
|
private static RoutedUICommand closeCommand = null; |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// This command closes the content
|
||||||
|
/// </summary>
|
||||||
|
public static RoutedUICommand Close |
||||||
|
{ |
||||||
|
get |
||||||
|
{ |
||||||
|
lock (syncRoot) |
||||||
|
{ |
||||||
|
if (null == closeCommand) |
||||||
|
{ |
||||||
|
closeCommand = new RoutedUICommand(AvalonDock.Properties.Resources.ManagedContentCommands_Close, "Close", typeof(ManagedContentCommands)); |
||||||
|
} |
||||||
|
} |
||||||
|
return closeCommand; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
private static RoutedUICommand hideCommand = null; |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// This command hides the content
|
||||||
|
/// </summary>
|
||||||
|
public static RoutedUICommand Hide |
||||||
|
{ |
||||||
|
get |
||||||
|
{ |
||||||
|
lock (syncRoot) |
||||||
|
{ |
||||||
|
if (null == hideCommand) |
||||||
|
{ |
||||||
|
hideCommand = new RoutedUICommand(AvalonDock.Properties.Resources.ManagedContentCommands_Hide, "Hide", typeof(ManagedContentCommands)); |
||||||
|
} |
||||||
|
} |
||||||
|
return hideCommand; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
private static RoutedUICommand showCommand = null; |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// This command shows the content
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>How content is shown by default depends from the type of content. A <see cref="DockableContent"/> is shown as docked pane, instead
|
||||||
|
/// a <see cref="DocumentContent"/> is shown as tabbed document</remarks>
|
||||||
|
public static RoutedUICommand Show |
||||||
|
{ |
||||||
|
get |
||||||
|
{ |
||||||
|
lock (syncRoot) |
||||||
|
{ |
||||||
|
if (null == showCommand) |
||||||
|
{ |
||||||
|
showCommand = new RoutedUICommand(AvalonDock.Properties.Resources.ManagedContentCommands_Show, "Show", typeof(ManagedContentCommands)); |
||||||
|
} |
||||||
|
} |
||||||
|
return showCommand; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
private static RoutedUICommand activateCommand = null; |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// This command activate the commands (i.e. select it inside the conatiner pane)
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>Activating a content means essentially putting it in evidence. For a content that is auto-hidden this command opens a flyout window containing the content.</remarks>
|
||||||
|
public static RoutedUICommand Activate |
||||||
|
{ |
||||||
|
get |
||||||
|
{ |
||||||
|
lock (syncRoot) |
||||||
|
{ |
||||||
|
if (null == activateCommand) |
||||||
|
{ |
||||||
|
activateCommand = new RoutedUICommand(AvalonDock.Properties.Resources.ManagedContentCommands_Activate, "Activate", typeof(ManagedContentCommands)); |
||||||
|
} |
||||||
|
} |
||||||
|
return activateCommand; |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,338 @@ |
|||||||
|
//Copyright (c) 2007-2010, Adolfo Marinucci
|
||||||
|
//All rights reserved.
|
||||||
|
|
||||||
|
//Redistribution and use in source and binary forms, with or without modification,
|
||||||
|
//are permitted provided that the following conditions are met:
|
||||||
|
//
|
||||||
|
//* Redistributions of source code must retain the above copyright notice,
|
||||||
|
// this list of conditions and the following disclaimer.
|
||||||
|
//* Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
// this list of conditions and the following disclaimer in the documentation
|
||||||
|
// and/or other materials provided with the distribution.
|
||||||
|
//* Neither the name of Adolfo Marinucci nor the names of its contributors may
|
||||||
|
// be used to endorse or promote products derived from this software without
|
||||||
|
// specific prior written permission.
|
||||||
|
//
|
||||||
|
//THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||||
|
//AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
//WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||||
|
//IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||||
|
//INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||||
|
//PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||||
|
//HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||||
|
//OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
||||||
|
//EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
|
using System; |
||||||
|
using System.Collections.Generic; |
||||||
|
using System.Text; |
||||||
|
using System.Windows; |
||||||
|
using System.Windows.Controls; |
||||||
|
using System.Windows.Data; |
||||||
|
using System.Windows.Documents; |
||||||
|
using System.Windows.Input; |
||||||
|
using System.Windows.Media; |
||||||
|
using System.Windows.Media.Imaging; |
||||||
|
using System.Windows.Navigation; |
||||||
|
using System.Windows.Shapes; |
||||||
|
using System.ComponentModel; |
||||||
|
using System.Linq; |
||||||
|
using System.Collections.ObjectModel; |
||||||
|
using System.Diagnostics; |
||||||
|
|
||||||
|
namespace AvalonDock |
||||||
|
{ |
||||||
|
/// <summary>
|
||||||
|
/// Represent an navigator item within lists of contents that user can choose from the <see cref="NavigatorWindow"/>
|
||||||
|
/// </summary>
|
||||||
|
public class NavigatorWindowItem |
||||||
|
{ |
||||||
|
private string _title; |
||||||
|
|
||||||
|
public string Title |
||||||
|
{ |
||||||
|
get |
||||||
|
{ |
||||||
|
return _title; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
private object _icon; |
||||||
|
|
||||||
|
public object Icon |
||||||
|
{ |
||||||
|
get |
||||||
|
{ |
||||||
|
return _icon; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
protected ManagedContent _content; |
||||||
|
|
||||||
|
public ManagedContent ItemContent |
||||||
|
{ |
||||||
|
get { return _content; } |
||||||
|
} |
||||||
|
|
||||||
|
internal NavigatorWindowItem(ManagedContent content) |
||||||
|
{ |
||||||
|
_title = content.Title; |
||||||
|
_icon = content.Icon; |
||||||
|
_content = content; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Specialized class of <see cref="NavigatorWindowItem"/> for <see cref="DocumentContent"/> objects
|
||||||
|
/// </summary>
|
||||||
|
public class NavigatorWindowDocumentItem : NavigatorWindowItem |
||||||
|
{ |
||||||
|
private string _infoTip; |
||||||
|
|
||||||
|
public string InfoTip |
||||||
|
{ |
||||||
|
get |
||||||
|
{ |
||||||
|
return _infoTip; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
private string _contentTypeDescription; |
||||||
|
|
||||||
|
public string ContentTypeDescription |
||||||
|
{ |
||||||
|
get |
||||||
|
{ |
||||||
|
return _contentTypeDescription; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
private DateTime _lastActivation; |
||||||
|
|
||||||
|
public DateTime LastActivation |
||||||
|
{ |
||||||
|
get { return _lastActivation; } |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
internal NavigatorWindowDocumentItem(DocumentContent document) |
||||||
|
: base(document) |
||||||
|
{ |
||||||
|
_infoTip = document.InfoTip; |
||||||
|
if (_infoTip == null && document.ToolTip != null && document.ToolTip is string) |
||||||
|
_infoTip = document.ToolTip.ToString(); |
||||||
|
|
||||||
|
_contentTypeDescription = document.ContentTypeDescription; |
||||||
|
_lastActivation = document.LastActivation; |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Window that is automatically shown when user press Ctrl+Tab combination
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>This window allow user to rapidly select a <see cref="DockableContent"/> object or a <see cref="DocumentContent"/> object.
|
||||||
|
/// When selected a content is also activate with the function <see cref="ManagedContent.Activate"/></remarks>
|
||||||
|
public class NavigatorWindow : AvalonDockWindow |
||||||
|
{ |
||||||
|
#region Constructors
|
||||||
|
static NavigatorWindow() |
||||||
|
{ |
||||||
|
DefaultStyleKeyProperty.OverrideMetadata(typeof(NavigatorWindow), new FrameworkPropertyMetadata(typeof(NavigatorWindow))); |
||||||
|
|
||||||
|
AllowsTransparencyProperty.OverrideMetadata(typeof(NavigatorWindow), new FrameworkPropertyMetadata(true)); |
||||||
|
WindowStyleProperty.OverrideMetadata(typeof(NavigatorWindow), new FrameworkPropertyMetadata(WindowStyle.None)); |
||||||
|
ShowInTaskbarProperty.OverrideMetadata(typeof(NavigatorWindow), new FrameworkPropertyMetadata(false)); |
||||||
|
BackgroundProperty.OverrideMetadata(typeof(NavigatorWindow), new FrameworkPropertyMetadata(Brushes.Transparent)); |
||||||
|
} |
||||||
|
|
||||||
|
DockingManager _manager; |
||||||
|
internal NavigatorWindow(DockingManager manager) |
||||||
|
{ |
||||||
|
WindowStartupLocation = System.Windows.WindowStartupLocation.CenterOwner; |
||||||
|
|
||||||
|
_manager = manager; |
||||||
|
|
||||||
|
List<NavigatorWindowDocumentItem> docs = new List<NavigatorWindowDocumentItem>(); |
||||||
|
_manager.Documents.ForEach((DocumentContent doc) => |
||||||
|
{ |
||||||
|
docs.Add(new NavigatorWindowDocumentItem(doc)); |
||||||
|
}); |
||||||
|
|
||||||
|
docs.Sort((NavigatorWindowDocumentItem item1, NavigatorWindowDocumentItem item2) => |
||||||
|
{ |
||||||
|
if (item1 == item2 || |
||||||
|
item1.LastActivation == item2.LastActivation) |
||||||
|
return 0; |
||||||
|
return (item1.LastActivation < item2.LastActivation) ? 1 : -1; |
||||||
|
}); |
||||||
|
|
||||||
|
SetDocuments(new CollectionView(docs)); |
||||||
|
|
||||||
|
List<NavigatorWindowItem> cnts = new List<NavigatorWindowItem>(); |
||||||
|
_manager.DockableContents.Where(c => c.State != DockableContentState.Hidden).ForEach((DockableContent cnt) => |
||||||
|
{ |
||||||
|
cnts.Add(new NavigatorWindowItem(cnt)); |
||||||
|
}); |
||||||
|
|
||||||
|
SetDockableContents(new CollectionView(cnts)); |
||||||
|
|
||||||
|
Documents.MoveCurrentTo(Documents.OfType<NavigatorWindowDocumentItem>().FirstOrDefault(cntItem => |
||||||
|
{ |
||||||
|
return cntItem.ItemContent == _manager.ActiveDocument; |
||||||
|
})); |
||||||
|
|
||||||
|
DockableContents.MoveCurrentTo(null); |
||||||
|
|
||||||
|
Loaded += new RoutedEventHandler(NavigatorWindow_Loaded); |
||||||
|
} |
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Handlers for Tab+ctrl keys events
|
||||||
|
protected override void OnPreviewKeyDown(KeyEventArgs e) |
||||||
|
{ |
||||||
|
if (e.Key != Key.Tab) |
||||||
|
Hide(); |
||||||
|
else |
||||||
|
{ |
||||||
|
e.Handled = true; |
||||||
|
MoveNextSelectedContent(); |
||||||
|
} |
||||||
|
|
||||||
|
base.OnKeyDown(e); |
||||||
|
} |
||||||
|
|
||||||
|
protected override void OnPreviewKeyUp(KeyEventArgs e) |
||||||
|
{ |
||||||
|
if (e.Key != Key.Tab) |
||||||
|
{ |
||||||
|
var docSelected = (Documents.CurrentItem as NavigatorWindowDocumentItem).ItemContent as DocumentContent; |
||||||
|
docSelected.Activate(); |
||||||
|
Hide(); |
||||||
|
} |
||||||
|
else |
||||||
|
{ |
||||||
|
e.Handled = true; |
||||||
|
} |
||||||
|
|
||||||
|
base.OnPreviewKeyUp(e); |
||||||
|
} |
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Current Document/Content changed
|
||||||
|
void NavigatorWindow_Loaded(object sender, RoutedEventArgs e) |
||||||
|
{ |
||||||
|
Documents.CurrentChanged += new EventHandler(Documents_CurrentChanged); |
||||||
|
DockableContents.CurrentChanged += new EventHandler(DockableContents_CurrentChanged); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
void DockableContents_CurrentChanged(object sender, EventArgs e) |
||||||
|
{ |
||||||
|
if (DockableContents.CurrentItem == null) |
||||||
|
return; |
||||||
|
|
||||||
|
Debug.WriteLine(string.Format("DockContent current changed to {0}", (DockableContents.CurrentItem as NavigatorWindowItem).ItemContent.Title)); |
||||||
|
var dockCntSelected = (DockableContents.CurrentItem as NavigatorWindowItem).ItemContent as DockableContent; |
||||||
|
Hide(); |
||||||
|
dockCntSelected.Activate(); |
||||||
|
} |
||||||
|
|
||||||
|
void Documents_CurrentChanged(object sender, EventArgs e) |
||||||
|
{ |
||||||
|
if (Documents.CurrentItem == null) |
||||||
|
return; |
||||||
|
if (_intMoveFlag) |
||||||
|
return; |
||||||
|
|
||||||
|
Debug.WriteLine(string.Format("Document current changed to {0}", (Documents.CurrentItem as NavigatorWindowItem).ItemContent.Title)); |
||||||
|
|
||||||
|
var docSelected = (Documents.CurrentItem as NavigatorWindowDocumentItem).ItemContent as DocumentContent; |
||||||
|
docSelected.Activate(); |
||||||
|
Hide(); |
||||||
|
} |
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Documents
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Documents Read-Only Dependency Property
|
||||||
|
/// </summary>
|
||||||
|
private static readonly DependencyPropertyKey DocumentsPropertyKey |
||||||
|
= DependencyProperty.RegisterReadOnly("Documents", typeof(CollectionView), typeof(NavigatorWindow), |
||||||
|
new FrameworkPropertyMetadata(null)); |
||||||
|
|
||||||
|
public static readonly DependencyProperty DocumentsProperty |
||||||
|
= DocumentsPropertyKey.DependencyProperty; |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the Documents property. This dependency property
|
||||||
|
/// indicates documents currently hosted by parent <see cref="DockingManager"/>.
|
||||||
|
/// </summary>
|
||||||
|
public CollectionView Documents |
||||||
|
{ |
||||||
|
get { return (CollectionView)GetValue(DocumentsProperty); } |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Provides a secure method for setting the Documents property.
|
||||||
|
/// This dependency property indicates documents currently hosted by parent <see cref="DockingManager"/>.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="value">The new value for the property.</param>
|
||||||
|
protected void SetDocuments(CollectionView value) |
||||||
|
{ |
||||||
|
SetValue(DocumentsPropertyKey, value); |
||||||
|
} |
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region DockableContents
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// DockableContents Read-Only Dependency Property
|
||||||
|
/// </summary>
|
||||||
|
private static readonly DependencyPropertyKey DockableContentsPropertyKey |
||||||
|
= DependencyProperty.RegisterReadOnly("DockableContents", typeof(CollectionView), typeof(NavigatorWindow), |
||||||
|
new FrameworkPropertyMetadata((CollectionView)null)); |
||||||
|
|
||||||
|
public static readonly DependencyProperty DockableContentsProperty |
||||||
|
= DockableContentsPropertyKey.DependencyProperty; |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the DockableContents property. This dependency property
|
||||||
|
/// indicates dockable contents hosted in parent <see cref="DockingManager"/> object.
|
||||||
|
/// </summary>
|
||||||
|
public CollectionView DockableContents |
||||||
|
{ |
||||||
|
get { return (CollectionView)GetValue(DockableContentsProperty); } |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Provides a secure method for setting the DockableContents property.
|
||||||
|
/// This dependency property indicates dockable contents hosted in parent <see cref="DockingManager"/> object.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="value">The new value for the property.</param>
|
||||||
|
protected void SetDockableContents(CollectionView value) |
||||||
|
{ |
||||||
|
SetValue(DockableContentsPropertyKey, value); |
||||||
|
} |
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Move to Next document
|
||||||
|
bool _intMoveFlag = false; |
||||||
|
public void MoveNextSelectedContent() |
||||||
|
{ |
||||||
|
_intMoveFlag = true; |
||||||
|
if (!Documents.MoveCurrentToNext()) |
||||||
|
Documents.MoveCurrentToFirst(); |
||||||
|
if (Documents.IsCurrentAfterLast) |
||||||
|
Documents.MoveCurrentToFirst(); |
||||||
|
_intMoveFlag = false; |
||||||
|
} |
||||||
|
#endregion
|
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,518 @@ |
|||||||
|
//Copyright (c) 2007-2010, Adolfo Marinucci
|
||||||
|
//All rights reserved.
|
||||||
|
|
||||||
|
//Redistribution and use in source and binary forms, with or without modification,
|
||||||
|
//are permitted provided that the following conditions are met:
|
||||||
|
//
|
||||||
|
//* Redistributions of source code must retain the above copyright notice,
|
||||||
|
// this list of conditions and the following disclaimer.
|
||||||
|
//* Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
// this list of conditions and the following disclaimer in the documentation
|
||||||
|
// and/or other materials provided with the distribution.
|
||||||
|
//* Neither the name of Adolfo Marinucci nor the names of its contributors may
|
||||||
|
// be used to endorse or promote products derived from this software without
|
||||||
|
// specific prior written permission.
|
||||||
|
//
|
||||||
|
//THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||||
|
//AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
//WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||||
|
//IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||||
|
//INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||||
|
//PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||||
|
//HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||||
|
//OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
||||||
|
//EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
|
using System; |
||||||
|
using System.Collections.Generic; |
||||||
|
using System.Text; |
||||||
|
using System.Windows; |
||||||
|
using System.Windows.Controls; |
||||||
|
using System.Windows.Controls.Primitives; |
||||||
|
using System.Windows.Data; |
||||||
|
using System.Windows.Documents; |
||||||
|
using System.Windows.Input; |
||||||
|
using System.Windows.Media; |
||||||
|
using System.Windows.Media.Imaging; |
||||||
|
using System.Windows.Shapes; |
||||||
|
using System.ComponentModel; |
||||||
|
using System.Windows.Markup; |
||||||
|
using System.Diagnostics; |
||||||
|
using System.Windows.Threading; |
||||||
|
using System.Windows.Media.Animation; |
||||||
|
|
||||||
|
namespace AvalonDock |
||||||
|
{ |
||||||
|
public enum OverlayButtonHover |
||||||
|
{ |
||||||
|
None, |
||||||
|
DropPaneInto, |
||||||
|
DropPaneLeft, |
||||||
|
DropPaneRight, |
||||||
|
DropPaneTop, |
||||||
|
DropPaneBottom, |
||||||
|
DropBorderLeft, |
||||||
|
DropBorderRight, |
||||||
|
DropBorderTop, |
||||||
|
DropBorderBottom, |
||||||
|
DropMainPaneLeft, |
||||||
|
DropMainPaneRight, |
||||||
|
DropMainPaneTop, |
||||||
|
DropMainPaneBottom, |
||||||
|
} |
||||||
|
|
||||||
|
public class OverlayWindow : AvalonDockWindow//, INotifyPropertyChanged
|
||||||
|
{ |
||||||
|
static OverlayWindow() |
||||||
|
{ |
||||||
|
DefaultStyleKeyProperty.OverrideMetadata(typeof(OverlayWindow), new FrameworkPropertyMetadata(typeof(OverlayWindow))); |
||||||
|
|
||||||
|
Window.AllowsTransparencyProperty.OverrideMetadata(typeof(OverlayWindow), new FrameworkPropertyMetadata(true)); |
||||||
|
Window.WindowStyleProperty.OverrideMetadata(typeof(OverlayWindow), new FrameworkPropertyMetadata(WindowStyle.None)); |
||||||
|
Window.ShowInTaskbarProperty.OverrideMetadata(typeof(OverlayWindow), new FrameworkPropertyMetadata(false)); |
||||||
|
Window.ShowActivatedProperty.OverrideMetadata(typeof(OverlayWindow), new FrameworkPropertyMetadata(false)); |
||||||
|
} |
||||||
|
|
||||||
|
public static object Theme; |
||||||
|
|
||||||
|
internal OverlayWindow() |
||||||
|
{ |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
DockingManager _manager = null; |
||||||
|
|
||||||
|
internal OverlayWindow(DockingManager manager) |
||||||
|
{ |
||||||
|
_manager = manager; |
||||||
|
} |
||||||
|
|
||||||
|
FrameworkElement gridPaneRelativeDockingOptions; |
||||||
|
FrameworkElement selectionBox; |
||||||
|
|
||||||
|
OverlayWindowDockingButton owdBottom; |
||||||
|
OverlayWindowDockingButton owdTop; |
||||||
|
OverlayWindowDockingButton owdLeft; |
||||||
|
OverlayWindowDockingButton owdRight; |
||||||
|
OverlayWindowDockingButton owdPaneBottom; |
||||||
|
OverlayWindowDockingButton owdPaneTop; |
||||||
|
OverlayWindowDockingButton owdPaneLeft; |
||||||
|
OverlayWindowDockingButton owdPaneRight; |
||||||
|
OverlayWindowDockingButton owdPaneInto; |
||||||
|
|
||||||
|
OverlayWindowDockingButton owdMainPaneBottom; |
||||||
|
OverlayWindowDockingButton owdMainPaneTop; |
||||||
|
OverlayWindowDockingButton owdMainPaneLeft; |
||||||
|
OverlayWindowDockingButton owdMainPaneRight; |
||||||
|
|
||||||
|
public override void OnApplyTemplate() |
||||||
|
{ |
||||||
|
base.OnApplyTemplate(); |
||||||
|
|
||||||
|
gridPaneRelativeDockingOptions = GetTemplateChild("PART_gridPaneRelativeDockingOptions") as FrameworkElement; |
||||||
|
selectionBox = GetTemplateChild("PART_SelectionBox") as FrameworkElement; |
||||||
|
|
||||||
|
owdBottom = new OverlayWindowDockingButton(GetTemplateChild("PART_btnDockBottom") as FrameworkElement, this); |
||||||
|
owdTop = new OverlayWindowDockingButton(GetTemplateChild("PART_btnDockTop") as FrameworkElement, this); |
||||||
|
owdLeft = new OverlayWindowDockingButton(GetTemplateChild("PART_btnDockLeft") as FrameworkElement, this); |
||||||
|
owdRight = new OverlayWindowDockingButton(GetTemplateChild("PART_btnDockRight") as FrameworkElement, this); |
||||||
|
|
||||||
|
owdPaneBottom = new OverlayWindowDockingButton(GetTemplateChild("PART_btnDockPaneBottom") as FrameworkElement, this); |
||||||
|
owdPaneTop = new OverlayWindowDockingButton(GetTemplateChild("PART_btnDockPaneTop") as FrameworkElement, this); |
||||||
|
owdPaneLeft = new OverlayWindowDockingButton(GetTemplateChild("PART_btnDockPaneLeft") as FrameworkElement, this); |
||||||
|
owdPaneRight = new OverlayWindowDockingButton(GetTemplateChild("PART_btnDockPaneRight") as FrameworkElement, this); |
||||||
|
owdPaneInto = new OverlayWindowDockingButton(GetTemplateChild("PART_btnDockPaneInto") as FrameworkElement, this); |
||||||
|
|
||||||
|
var btn = GetTemplateChild("PART_btnDockMainPaneBottom") as FrameworkElement; |
||||||
|
if (btn != null) owdMainPaneBottom = new OverlayWindowDockingButton(btn, this); |
||||||
|
|
||||||
|
btn = GetTemplateChild("PART_btnDockMainPaneTop") as FrameworkElement; |
||||||
|
if (btn != null) owdMainPaneTop = new OverlayWindowDockingButton(btn, this); |
||||||
|
|
||||||
|
btn = GetTemplateChild("PART_btnDockMainPaneLeft") as FrameworkElement; |
||||||
|
if (btn != null) owdMainPaneLeft = new OverlayWindowDockingButton(btn, this); |
||||||
|
|
||||||
|
btn = GetTemplateChild("PART_btnDockMainPaneRight") as FrameworkElement; |
||||||
|
if (btn != null) owdMainPaneRight = new OverlayWindowDockingButton(btn, this); |
||||||
|
|
||||||
|
|
||||||
|
_manager.DragPaneServices.Register(owdPaneBottom); |
||||||
|
_manager.DragPaneServices.Register(owdPaneTop); |
||||||
|
_manager.DragPaneServices.Register(owdPaneLeft); |
||||||
|
_manager.DragPaneServices.Register(owdPaneRight); |
||||||
|
_manager.DragPaneServices.Register(owdPaneInto); |
||||||
|
_manager.DragPaneServices.Register(owdBottom); |
||||||
|
_manager.DragPaneServices.Register(owdTop); |
||||||
|
_manager.DragPaneServices.Register(owdLeft); |
||||||
|
_manager.DragPaneServices.Register(owdRight); |
||||||
|
|
||||||
|
if (owdMainPaneTop != null) _manager.DragPaneServices.Register(owdMainPaneTop); |
||||||
|
if (owdMainPaneLeft != null) _manager.DragPaneServices.Register(owdMainPaneLeft); |
||||||
|
if (owdMainPaneRight != null) _manager.DragPaneServices.Register(owdMainPaneRight); |
||||||
|
if (owdMainPaneBottom != null) _manager.DragPaneServices.Register(owdMainPaneBottom); |
||||||
|
} |
||||||
|
|
||||||
|
internal bool OnDrop(OverlayWindowDockingButton owdDock, Point point) |
||||||
|
{ |
||||||
|
//calculate desidered size
|
||||||
|
Rect rectPane; |
||||||
|
|
||||||
|
switch (OverlayButtonHover) |
||||||
|
{ |
||||||
|
case AvalonDock.OverlayButtonHover.DropBorderBottom: |
||||||
|
case AvalonDock.OverlayButtonHover.DropBorderLeft: |
||||||
|
case AvalonDock.OverlayButtonHover.DropBorderTop: |
||||||
|
case AvalonDock.OverlayButtonHover.DropBorderRight: |
||||||
|
rectPane = (_manager as IDropSurface).SurfaceRectangle; |
||||||
|
break; |
||||||
|
default: |
||||||
|
rectPane = (CurrentDropPane as IDropSurface).SurfaceRectangle; |
||||||
|
break; |
||||||
|
} |
||||||
|
|
||||||
|
var desideredWidth = Math.Min( |
||||||
|
rectPane.Width / 2.0, |
||||||
|
ResizingPanel.GetEffectiveSize(_manager.DragPaneServices.FloatingWindow.HostedPane).Width); |
||||||
|
var desideredHeight = Math.Min( |
||||||
|
rectPane.Height / 2.0, |
||||||
|
ResizingPanel.GetEffectiveSize(_manager.DragPaneServices.FloatingWindow.HostedPane).Height); |
||||||
|
|
||||||
|
var desideredSize = new Size( |
||||||
|
desideredWidth, |
||||||
|
desideredHeight); |
||||||
|
|
||||||
|
//user has dropped the floating window over a anchor button
|
||||||
|
//create a new dockable pane to insert in the main layout
|
||||||
|
//FIX: clone pane and return true only if overlayButtonOver is not set to None!!
|
||||||
|
|
||||||
|
|
||||||
|
//floating window is going to be closed..
|
||||||
|
selectionBox.Visibility = Visibility.Hidden; |
||||||
|
|
||||||
|
//take the overlaybutton hover property to get the right button highlighted
|
||||||
|
switch (OverlayButtonHover) |
||||||
|
{ |
||||||
|
case AvalonDock.OverlayButtonHover.DropBorderBottom: |
||||||
|
_manager.Anchor( |
||||||
|
_manager.DragPaneServices.FloatingWindow.ClonePane() as DockablePane, |
||||||
|
AnchorStyle.Bottom); |
||||||
|
break; |
||||||
|
case AvalonDock.OverlayButtonHover.DropBorderTop: |
||||||
|
_manager.Anchor( |
||||||
|
_manager.DragPaneServices.FloatingWindow.ClonePane() as DockablePane, |
||||||
|
AnchorStyle.Top); |
||||||
|
break; |
||||||
|
case AvalonDock.OverlayButtonHover.DropBorderLeft: |
||||||
|
_manager.Anchor( |
||||||
|
_manager.DragPaneServices.FloatingWindow.ClonePane() as DockablePane, |
||||||
|
AnchorStyle.Left); |
||||||
|
break; |
||||||
|
case AvalonDock.OverlayButtonHover.DropBorderRight: |
||||||
|
_manager.Anchor( |
||||||
|
_manager.DragPaneServices.FloatingWindow.ClonePane() as DockablePane, |
||||||
|
AnchorStyle.Right); |
||||||
|
break; |
||||||
|
case AvalonDock.OverlayButtonHover.DropPaneBottom: |
||||||
|
_manager.Anchor( |
||||||
|
_manager.DragPaneServices.FloatingWindow.ClonePane(), |
||||||
|
CurrentDropPane, AnchorStyle.Bottom); |
||||||
|
break; |
||||||
|
case AvalonDock.OverlayButtonHover.DropPaneTop: |
||||||
|
_manager.Anchor( |
||||||
|
_manager.DragPaneServices.FloatingWindow.ClonePane(), |
||||||
|
CurrentDropPane, AnchorStyle.Top); |
||||||
|
break; |
||||||
|
case AvalonDock.OverlayButtonHover.DropPaneLeft: |
||||||
|
_manager.Anchor( |
||||||
|
_manager.DragPaneServices.FloatingWindow.ClonePane(), |
||||||
|
CurrentDropPane, AnchorStyle.Left); |
||||||
|
break; |
||||||
|
case AvalonDock.OverlayButtonHover.DropPaneRight: |
||||||
|
_manager.Anchor( |
||||||
|
_manager.DragPaneServices.FloatingWindow.ClonePane(), |
||||||
|
CurrentDropPane, AnchorStyle.Right); |
||||||
|
break; |
||||||
|
case AvalonDock.OverlayButtonHover.DropPaneInto: |
||||||
|
_manager.DropInto( |
||||||
|
_manager.DragPaneServices.FloatingWindow.ClonePane(), |
||||||
|
CurrentDropPane); |
||||||
|
break; |
||||||
|
default: |
||||||
|
return false; |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
return true; |
||||||
|
} |
||||||
|
|
||||||
|
Pane CurrentDropPane = null; |
||||||
|
|
||||||
|
internal void ShowOverlayPaneDockingOptions(Pane paneOvering) |
||||||
|
{ |
||||||
|
var draggingPane = _manager.DragPaneServices.FloatingWindow.HostedPane; |
||||||
|
var isDraggingADocumentPane = draggingPane is DocumentPane; |
||||||
|
var isDraggingADockablePane = draggingPane is DockablePane; |
||||||
|
|
||||||
|
|
||||||
|
HideOverlayPaneDockingOptions(paneOvering); |
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//check if dockable on a document pane
|
||||||
|
DockableStyle currentPaneDockableStyle = |
||||||
|
isDraggingADocumentPane ? |
||||||
|
DockableStyle.Document : |
||||||
|
(draggingPane as DockablePane).GetCumulativeDockableStyle(); |
||||||
|
|
||||||
|
//if current drop pane is a DocumentPane ...
|
||||||
|
if (paneOvering is DocumentPane && |
||||||
|
(currentPaneDockableStyle & DockableStyle.Document) == 0) |
||||||
|
return; |
||||||
|
if (paneOvering is DockablePane && |
||||||
|
(currentPaneDockableStyle & DockableStyle.Dockable) == 0) |
||||||
|
return; |
||||||
|
|
||||||
|
|
||||||
|
Rect rectPane = (paneOvering as IDropSurface).SurfaceRectangle; |
||||||
|
|
||||||
|
Point myScreenTopLeft = this.PointToScreenDPI(new Point(0, 0)); |
||||||
|
rectPane.Offset(-myScreenTopLeft.X, -myScreenTopLeft.Y);//relative to me
|
||||||
|
|
||||||
|
gridPaneRelativeDockingOptions.SetValue(Canvas.LeftProperty, rectPane.Left); |
||||||
|
gridPaneRelativeDockingOptions.SetValue(Canvas.TopProperty, rectPane.Top); |
||||||
|
gridPaneRelativeDockingOptions.Width = rectPane.Width; |
||||||
|
gridPaneRelativeDockingOptions.Height = rectPane.Height; |
||||||
|
//gridPaneRelativeDockingOptions.SetValue(Canvas.LeftProperty, rectPane.Left + rectPane.Width / 2 - gridPaneRelativeDockingOptions.Width / 2);
|
||||||
|
//gridPaneRelativeDockingOptions.SetValue(Canvas.TopProperty, rectPane.Top + rectPane.Height / 2 - gridPaneRelativeDockingOptions.Height / 2);
|
||||||
|
|
||||||
|
if (paneOvering is DocumentPane) |
||||||
|
gridPaneRelativeDockingOptions.Visibility = Visibility.Visible; |
||||||
|
else |
||||||
|
{ |
||||||
|
gridPaneRelativeDockingOptions.Visibility = !isDraggingADocumentPane ? Visibility.Visible : Visibility.Hidden; |
||||||
|
} |
||||||
|
|
||||||
|
owdBottom.Enabled = ((currentPaneDockableStyle & DockableStyle.BottomBorder) > 0); |
||||||
|
owdTop.Enabled = ((currentPaneDockableStyle & DockableStyle.TopBorder) > 0); |
||||||
|
owdLeft.Enabled = ((currentPaneDockableStyle & DockableStyle.LeftBorder) > 0); |
||||||
|
owdRight.Enabled = ((currentPaneDockableStyle & DockableStyle.RightBorder) > 0); |
||||||
|
|
||||||
|
|
||||||
|
if (paneOvering is DocumentPane) |
||||||
|
owdPaneInto.Enabled = true; |
||||||
|
else |
||||||
|
owdPaneInto.Enabled = !(_manager.DragPaneServices.FloatingWindow is DocumentFloatingWindow); |
||||||
|
|
||||||
|
|
||||||
|
if (paneOvering is DockablePane || isDraggingADocumentPane) |
||||||
|
{ |
||||||
|
if (owdMainPaneBottom != null) owdMainPaneBottom.Enabled = false; |
||||||
|
if (owdMainPaneTop != null) owdMainPaneTop.Enabled = false; |
||||||
|
if (owdMainPaneLeft != null) owdMainPaneLeft.Enabled = false; |
||||||
|
if (owdMainPaneRight != null) owdMainPaneRight.Enabled = false; |
||||||
|
} |
||||||
|
else if (isDraggingADockablePane) |
||||||
|
{ |
||||||
|
if (owdMainPaneBottom != null) owdMainPaneBottom.Enabled = true; |
||||||
|
if (owdMainPaneTop != null) owdMainPaneTop.Enabled = true; |
||||||
|
if (owdMainPaneLeft != null) owdMainPaneLeft.Enabled = true; |
||||||
|
if (owdMainPaneRight != null) owdMainPaneRight.Enabled = true; |
||||||
|
} |
||||||
|
|
||||||
|
int destPaneChildCount = paneOvering.Items.Count; |
||||||
|
|
||||||
|
owdPaneBottom.Enabled = owdPaneInto.Enabled && destPaneChildCount > 0; |
||||||
|
owdPaneTop.Enabled = owdPaneInto.Enabled && destPaneChildCount > 0; |
||||||
|
owdPaneLeft.Enabled = owdPaneInto.Enabled && destPaneChildCount > 0; |
||||||
|
owdPaneRight.Enabled = owdPaneInto.Enabled && destPaneChildCount > 0; |
||||||
|
|
||||||
|
CurrentDropPane = paneOvering; |
||||||
|
} |
||||||
|
|
||||||
|
internal void HideOverlayPaneDockingOptions(Pane surfaceElement) |
||||||
|
{ |
||||||
|
owdPaneBottom.Enabled = false; |
||||||
|
owdPaneTop.Enabled = false; |
||||||
|
owdPaneLeft.Enabled = false; |
||||||
|
owdPaneRight.Enabled = false; |
||||||
|
owdPaneInto.Enabled = false; |
||||||
|
|
||||||
|
gridPaneRelativeDockingOptions.Visibility = Visibility.Collapsed; |
||||||
|
CurrentDropPane = null; |
||||||
|
SetOverlayButtonHover(OverlayButtonHover.None); |
||||||
|
} |
||||||
|
|
||||||
|
protected override void OnDeactivated(EventArgs e) |
||||||
|
{ |
||||||
|
selectionBox.Visibility = Visibility.Hidden; |
||||||
|
|
||||||
|
base.OnDeactivated(e); |
||||||
|
} |
||||||
|
|
||||||
|
protected override void OnActivated(EventArgs e) |
||||||
|
{ |
||||||
|
DockableStyle currentPaneDockableStyle = |
||||||
|
_manager.DragPaneServices.FloatingWindow.HostedPane is FloatingDocumentPane ? |
||||||
|
DockableStyle.Document : |
||||||
|
(_manager.DragPaneServices.FloatingWindow.HostedPane as DockablePane).GetCumulativeDockableStyle(); |
||||||
|
|
||||||
|
selectionBox.Visibility = Visibility.Hidden; |
||||||
|
|
||||||
|
owdBottom.Enabled = (currentPaneDockableStyle & DockableStyle.BottomBorder) > 0; |
||||||
|
owdTop.Enabled = (currentPaneDockableStyle & DockableStyle.TopBorder) > 0; |
||||||
|
owdLeft.Enabled = (currentPaneDockableStyle & DockableStyle.LeftBorder) > 0; |
||||||
|
owdRight.Enabled = (currentPaneDockableStyle & DockableStyle.RightBorder) > 0; |
||||||
|
|
||||||
|
|
||||||
|
base.OnActivated(e); |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Shows a highlighting rectangle
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="overlayWindowDockingButton"></param>
|
||||||
|
/// <param name="point"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
internal void OnDragEnter(OverlayWindowDockingButton owdDock, Point point) |
||||||
|
{ |
||||||
|
OnDragOver(owdDock, point); |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Hides the highlighting rectangle
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="overlayWindowDockingButton"></param>
|
||||||
|
/// <param name="point"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
internal void OnDragLeave(OverlayWindowDockingButton owdDock, Point point) |
||||||
|
{ |
||||||
|
selectionBox.Visibility = Visibility.Hidden; |
||||||
|
_manager.DragPaneServices.FloatingWindow.OnHideSelectionBox(); |
||||||
|
SetOverlayButtonHover(OverlayButtonHover.None); |
||||||
|
} |
||||||
|
|
||||||
|
internal void OnDragOver(OverlayWindowDockingButton owdDock, Point point) |
||||||
|
{ |
||||||
|
if (selectionBox == null) |
||||||
|
return; |
||||||
|
|
||||||
|
Rect rectPane; |
||||||
|
|
||||||
|
if (owdDock == owdBottom || |
||||||
|
owdDock == owdLeft || |
||||||
|
owdDock == owdTop || |
||||||
|
owdDock == owdRight) |
||||||
|
rectPane = (_manager as IDropSurface).SurfaceRectangle; |
||||||
|
else |
||||||
|
rectPane = (CurrentDropPane as IDropSurface).SurfaceRectangle; |
||||||
|
|
||||||
|
double selectionBoxWidth = Math.Min( |
||||||
|
rectPane.Width / 2.0, |
||||||
|
ResizingPanel.GetEffectiveSize(_manager.DragPaneServices.FloatingWindow.HostedPane).Width); |
||||||
|
double selectionBoxHeight = Math.Min( |
||||||
|
rectPane.Height / 2.0, |
||||||
|
ResizingPanel.GetEffectiveSize(_manager.DragPaneServices.FloatingWindow.HostedPane).Height); |
||||||
|
|
||||||
|
|
||||||
|
Point myScreenTopLeft = this.PointToScreenDPI(new Point()); |
||||||
|
rectPane.Offset(-myScreenTopLeft.X, -myScreenTopLeft.Y);//relative to me
|
||||||
|
|
||||||
|
if (owdDock == owdBottom || owdDock == owdPaneBottom) |
||||||
|
{ |
||||||
|
selectionBox.SetValue(Canvas.LeftProperty, rectPane.Left); |
||||||
|
selectionBox.SetValue(Canvas.TopProperty, rectPane.Top + rectPane.Height - selectionBoxHeight); |
||||||
|
selectionBox.Width = rectPane.Width; |
||||||
|
selectionBox.Height = selectionBoxHeight; |
||||||
|
} |
||||||
|
if (owdDock == owdLeft || owdDock == owdPaneLeft) |
||||||
|
{ |
||||||
|
selectionBox.SetValue(Canvas.LeftProperty, rectPane.Left); |
||||||
|
selectionBox.SetValue(Canvas.TopProperty, rectPane.Top); |
||||||
|
selectionBox.Width = selectionBoxWidth; |
||||||
|
selectionBox.Height = rectPane.Height; |
||||||
|
} |
||||||
|
if (owdDock == owdRight || owdDock == owdPaneRight) |
||||||
|
{ |
||||||
|
selectionBox.SetValue(Canvas.LeftProperty, rectPane.Left + rectPane.Width - selectionBoxWidth); |
||||||
|
selectionBox.SetValue(Canvas.TopProperty, rectPane.Top); |
||||||
|
selectionBox.Width = selectionBoxWidth; |
||||||
|
selectionBox.Height = rectPane.Height; |
||||||
|
} |
||||||
|
if (owdDock == owdTop || owdDock == owdPaneTop) |
||||||
|
{ |
||||||
|
selectionBox.SetValue(Canvas.LeftProperty, rectPane.Left); |
||||||
|
selectionBox.SetValue(Canvas.TopProperty, rectPane.Top); |
||||||
|
selectionBox.Width = rectPane.Width; |
||||||
|
selectionBox.Height = selectionBoxHeight; |
||||||
|
} |
||||||
|
if (owdDock == owdPaneInto) |
||||||
|
{ |
||||||
|
selectionBox.SetValue(Canvas.LeftProperty, rectPane.Left); |
||||||
|
selectionBox.SetValue(Canvas.TopProperty, rectPane.Top); |
||||||
|
selectionBox.Width = rectPane.Width; |
||||||
|
selectionBox.Height = rectPane.Height; |
||||||
|
} |
||||||
|
|
||||||
|
if (owdDock == owdLeft) |
||||||
|
SetOverlayButtonHover(OverlayButtonHover.DropBorderLeft);//OverlayButtonHover = OverlayButtonHover.DropBorderLeft;
|
||||||
|
else if (owdDock == owdRight) |
||||||
|
SetOverlayButtonHover(OverlayButtonHover.DropBorderRight);//OverlayButtonHover = OverlayButtonHover.DropBorderRight;
|
||||||
|
else if (owdDock == owdTop) |
||||||
|
SetOverlayButtonHover(OverlayButtonHover.DropBorderTop);//OverlayButtonHover = OverlayButtonHover.DropBorderTop;
|
||||||
|
else if (owdDock == owdBottom) |
||||||
|
SetOverlayButtonHover(OverlayButtonHover.DropBorderBottom);//OverlayButtonHover = OverlayButtonHover.DropBorderBottom;
|
||||||
|
else if (owdDock == owdPaneInto) |
||||||
|
SetOverlayButtonHover(OverlayButtonHover.DropPaneInto);//OverlayButtonHover = OverlayButtonHover.DropPaneInto;
|
||||||
|
else if (owdDock == owdPaneRight) |
||||||
|
SetOverlayButtonHover(OverlayButtonHover.DropPaneRight);//OverlayButtonHover = OverlayButtonHover.DropPaneRight;
|
||||||
|
else if (owdDock == owdPaneTop) |
||||||
|
SetOverlayButtonHover(OverlayButtonHover.DropPaneTop);//OverlayButtonHover = OverlayButtonHover.DropPaneTop;
|
||||||
|
else if (owdDock == owdPaneLeft) |
||||||
|
SetOverlayButtonHover(OverlayButtonHover.DropPaneLeft);//OverlayButtonHover = OverlayButtonHover.DropPaneLeft;
|
||||||
|
else if (owdDock == owdPaneBottom) |
||||||
|
SetOverlayButtonHover(OverlayButtonHover.DropPaneBottom);//OverlayButtonHover = OverlayButtonHover.DropPaneBottom;
|
||||||
|
else |
||||||
|
SetOverlayButtonHover(OverlayButtonHover.None);//OverlayButtonHover = OverlayButtonHover.None;
|
||||||
|
|
||||||
|
|
||||||
|
selectionBox.Visibility = Visibility.Visible; |
||||||
|
|
||||||
|
_manager.DragPaneServices.FloatingWindow.OnShowSelectionBox(); |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
#region OverlayButtonHover
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// OverlayButtonHover Read-Only Dependency Property
|
||||||
|
/// </summary>
|
||||||
|
private static readonly DependencyPropertyKey OverlayButtonHoverPropertyKey |
||||||
|
= DependencyProperty.RegisterReadOnly("OverlayButtonHover", typeof(OverlayButtonHover), typeof(OverlayWindow), |
||||||
|
new FrameworkPropertyMetadata(OverlayButtonHover.None)); |
||||||
|
|
||||||
|
public static readonly DependencyProperty OverlayButtonHoverProperty |
||||||
|
= OverlayButtonHoverPropertyKey.DependencyProperty; |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the OverlayButtonHover property. This dependency property
|
||||||
|
/// indicates ....
|
||||||
|
/// </summary>
|
||||||
|
public OverlayButtonHover OverlayButtonHover |
||||||
|
{ |
||||||
|
get { return (OverlayButtonHover)GetValue(OverlayButtonHoverProperty); } |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Provides a secure method for setting the OverlayButtonHover property.
|
||||||
|
/// This dependency property indicates indicates which anchor button is currently highlighted by user.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="value">The new value for the property.</param>
|
||||||
|
protected void SetOverlayButtonHover(OverlayButtonHover value) |
||||||
|
{ |
||||||
|
SetValue(OverlayButtonHoverPropertyKey, value); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,130 @@ |
|||||||
|
//Copyright (c) 2007-2010, Adolfo Marinucci
|
||||||
|
//All rights reserved.
|
||||||
|
|
||||||
|
//Redistribution and use in source and binary forms, with or without modification,
|
||||||
|
//are permitted provided that the following conditions are met:
|
||||||
|
//
|
||||||
|
//* Redistributions of source code must retain the above copyright notice,
|
||||||
|
// this list of conditions and the following disclaimer.
|
||||||
|
//* Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
// this list of conditions and the following disclaimer in the documentation
|
||||||
|
// and/or other materials provided with the distribution.
|
||||||
|
//* Neither the name of Adolfo Marinucci nor the names of its contributors may
|
||||||
|
// be used to endorse or promote products derived from this software without
|
||||||
|
// specific prior written permission.
|
||||||
|
//
|
||||||
|
//THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||||
|
//AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
//WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||||
|
//IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||||
|
//INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||||
|
//PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||||
|
//HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||||
|
//OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
||||||
|
//EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
|
using System; |
||||||
|
using System.Collections.Generic; |
||||||
|
using System.Text; |
||||||
|
using System.Windows; |
||||||
|
|
||||||
|
namespace AvalonDock |
||||||
|
{ |
||||||
|
class OverlayWindowDockingButton : IDropSurface |
||||||
|
{ |
||||||
|
OverlayWindow _owner; |
||||||
|
FrameworkElement _btnDock; |
||||||
|
|
||||||
|
public OverlayWindowDockingButton(FrameworkElement btnDock, OverlayWindow owner) |
||||||
|
: this(btnDock, owner, true) |
||||||
|
{ |
||||||
|
|
||||||
|
} |
||||||
|
public OverlayWindowDockingButton(FrameworkElement btnDock, OverlayWindow owner, bool enabled) |
||||||
|
{ |
||||||
|
if (btnDock == null) |
||||||
|
throw new ArgumentNullException("btnDock"); |
||||||
|
if (owner == null) |
||||||
|
throw new ArgumentNullException("owner"); |
||||||
|
|
||||||
|
_btnDock = btnDock; |
||||||
|
_owner = owner; |
||||||
|
Enabled = enabled; |
||||||
|
} |
||||||
|
|
||||||
|
bool _enabled = true; |
||||||
|
|
||||||
|
public bool Enabled |
||||||
|
{ |
||||||
|
get { return _enabled; } |
||||||
|
set |
||||||
|
{ |
||||||
|
_enabled = value; |
||||||
|
|
||||||
|
if (_enabled) |
||||||
|
_btnDock.Visibility = Visibility.Visible; |
||||||
|
else |
||||||
|
_btnDock.Visibility = Visibility.Hidden; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#region IDropSurface Membri di
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Rect IDropSurface.SurfaceRectangle |
||||||
|
{ |
||||||
|
get |
||||||
|
{ |
||||||
|
if (!(this as IDropSurface).IsSurfaceVisible) |
||||||
|
return Rect.Empty; |
||||||
|
|
||||||
|
if (PresentationSource.FromVisual(_btnDock) == null) |
||||||
|
return Rect.Empty; |
||||||
|
|
||||||
|
return new Rect(HelperFunc.PointToScreenWithoutFlowDirection(_btnDock, new Point()), new Size(_btnDock.ActualWidth, _btnDock.ActualHeight)); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
void IDropSurface.OnDragEnter(Point point) |
||||||
|
{ |
||||||
|
if (!Enabled) |
||||||
|
return; |
||||||
|
|
||||||
|
_owner.OnDragEnter(this, point); |
||||||
|
} |
||||||
|
|
||||||
|
void IDropSurface.OnDragOver(Point point) |
||||||
|
{ |
||||||
|
if (!Enabled) |
||||||
|
return; |
||||||
|
|
||||||
|
_owner.OnDragOver(this, point); |
||||||
|
} |
||||||
|
|
||||||
|
void IDropSurface.OnDragLeave(Point point) |
||||||
|
{ |
||||||
|
if (!Enabled) |
||||||
|
return; |
||||||
|
|
||||||
|
_owner.OnDragLeave(this, point); |
||||||
|
} |
||||||
|
|
||||||
|
bool IDropSurface.OnDrop(Point point) |
||||||
|
{ |
||||||
|
if (!Enabled) |
||||||
|
return false; |
||||||
|
|
||||||
|
return _owner.OnDrop(this, point); |
||||||
|
} |
||||||
|
|
||||||
|
bool IDropSurface.IsSurfaceVisible |
||||||
|
{ |
||||||
|
get { return (_owner.IsLoaded && _btnDock != null); } |
||||||
|
} |
||||||
|
|
||||||
|
#endregion
|
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,472 @@ |
|||||||
|
//Copyright (c) 2007-2010, Adolfo Marinucci
|
||||||
|
//All rights reserved.
|
||||||
|
|
||||||
|
//Redistribution and use in source and binary forms, with or without modification,
|
||||||
|
//are permitted provided that the following conditions are met:
|
||||||
|
//
|
||||||
|
//* Redistributions of source code must retain the above copyright notice,
|
||||||
|
// this list of conditions and the following disclaimer.
|
||||||
|
//* Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
// this list of conditions and the following disclaimer in the documentation
|
||||||
|
// and/or other materials provided with the distribution.
|
||||||
|
//* Neither the name of Adolfo Marinucci nor the names of its contributors may
|
||||||
|
// be used to endorse or promote products derived from this software without
|
||||||
|
// specific prior written permission.
|
||||||
|
//
|
||||||
|
//THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||||
|
//AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
//WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||||
|
//IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||||
|
//INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||||
|
//PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||||
|
//HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||||
|
//OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
||||||
|
//EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
|
using System; |
||||||
|
using System.Windows; |
||||||
|
using System.Windows.Controls; |
||||||
|
using System.Windows.Input; |
||||||
|
using System.Diagnostics; |
||||||
|
using System.ComponentModel; |
||||||
|
using System.Collections; |
||||||
|
using System.Linq; |
||||||
|
|
||||||
|
namespace AvalonDock |
||||||
|
{ |
||||||
|
public abstract class Pane : |
||||||
|
System.Windows.Controls.Primitives.Selector, |
||||||
|
IDropSurface, |
||||||
|
IDockableControl, |
||||||
|
INotifyPropertyChanged |
||||||
|
{ |
||||||
|
static Pane() |
||||||
|
{ |
||||||
|
//FocusableProperty.OverrideMetadata(typeof(Pane), new FrameworkPropertyMetadata(false));
|
||||||
|
} |
||||||
|
|
||||||
|
internal Pane() |
||||||
|
{ |
||||||
|
this.Loaded += new RoutedEventHandler(OnLoaded); |
||||||
|
this.Unloaded += new RoutedEventHandler(OnUnloaded); |
||||||
|
} |
||||||
|
|
||||||
|
protected virtual void OnLoaded(object sender, RoutedEventArgs e) |
||||||
|
{ |
||||||
|
//if (GetManager() == null && Parent != null)
|
||||||
|
// throw new InvalidOperationException("Pane must be put under a DockingManager!");
|
||||||
|
|
||||||
|
AddDragPaneReferences(); |
||||||
|
} |
||||||
|
|
||||||
|
protected virtual void OnUnloaded(object sender, RoutedEventArgs e) |
||||||
|
{ |
||||||
|
RemoveDragPaneReferences(); |
||||||
|
} |
||||||
|
|
||||||
|
#region Contents management
|
||||||
|
public bool HasSingleItem |
||||||
|
{ |
||||||
|
get |
||||||
|
{ |
||||||
|
return (bool)GetValue(HasSingleItemProperty); |
||||||
|
} |
||||||
|
protected set { SetValue(HasSingleItemPropertyKey, value); } |
||||||
|
} |
||||||
|
|
||||||
|
// Using a DependencyProperty as the backing store for HasSingleItem. This enables animation, styling, binding, etc...
|
||||||
|
private static readonly DependencyPropertyKey HasSingleItemPropertyKey = |
||||||
|
DependencyProperty.RegisterReadOnly("HasSingleItem", typeof(bool), typeof(Pane), new PropertyMetadata(false)); |
||||||
|
|
||||||
|
public static readonly DependencyProperty HasSingleItemProperty = HasSingleItemPropertyKey.DependencyProperty; |
||||||
|
|
||||||
|
|
||||||
|
ManagedContent _lastSelectedContent = null; |
||||||
|
protected override void OnSelectionChanged(SelectionChangedEventArgs e) |
||||||
|
{ |
||||||
|
if (e.RemovedItems != null && |
||||||
|
e.RemovedItems.Count > 0 && |
||||||
|
e.AddedItems != null && |
||||||
|
e.AddedItems.Count > 0) |
||||||
|
_lastSelectedContent = e.RemovedItems[0] as ManagedContent; |
||||||
|
|
||||||
|
base.OnSelectionChanged(e); |
||||||
|
} |
||||||
|
|
||||||
|
protected override void OnItemsChanged(System.Collections.Specialized.NotifyCollectionChangedEventArgs e) |
||||||
|
{ |
||||||
|
DockingManager dockManager = GetManager(); |
||||||
|
if (dockManager != null) |
||||||
|
dockManager.RefreshContents(); |
||||||
|
|
||||||
|
if (e.NewItems != null) |
||||||
|
CheckItems(e.NewItems); |
||||||
|
|
||||||
|
HasSingleItem = (Items.Count == 1); |
||||||
|
|
||||||
|
if (_lastSelectedContent != null && |
||||||
|
!Items.Contains(_lastSelectedContent)) |
||||||
|
_lastSelectedContent = null; |
||||||
|
|
||||||
|
if ((e.NewItems == null || e.NewItems.Count == 0) && |
||||||
|
(e.OldItems != null && e.OldItems.Count > 0)) |
||||||
|
{ |
||||||
|
if (_lastSelectedContent != null && |
||||||
|
Items.Contains(_lastSelectedContent)) |
||||||
|
SelectedItem = _lastSelectedContent; |
||||||
|
} |
||||||
|
|
||||||
|
if (Items.Count > 0) |
||||||
|
{ |
||||||
|
int currentIndex = SelectedIndex; |
||||||
|
|
||||||
|
if (currentIndex < 0 || |
||||||
|
currentIndex >= Items.Count) |
||||||
|
currentIndex = Items.Count - 1; |
||||||
|
|
||||||
|
SelectedItem = Items.GetItemAt(currentIndex); |
||||||
|
} |
||||||
|
|
||||||
|
RefreshContainsActiveContentProperty(); |
||||||
|
|
||||||
|
if (Items.Count > 0) |
||||||
|
{ |
||||||
|
var parentPanel = Parent as ResizingPanel; |
||||||
|
while (parentPanel != null && parentPanel.IsLoaded) |
||||||
|
{ |
||||||
|
parentPanel.UpdateLayout(); |
||||||
|
parentPanel.InvalidateMeasure(); |
||||||
|
parentPanel = parentPanel.Parent as ResizingPanel; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
base.OnItemsChanged(e); |
||||||
|
} |
||||||
|
|
||||||
|
protected override void OnVisualParentChanged(DependencyObject oldParent) |
||||||
|
{ |
||||||
|
DockingManager dockManager = GetManager(); |
||||||
|
if (dockManager != null) |
||||||
|
dockManager.RefreshContents(); |
||||||
|
|
||||||
|
base.OnVisualParentChanged(oldParent); |
||||||
|
} |
||||||
|
|
||||||
|
protected virtual void CheckItems(IList newItems) |
||||||
|
{ |
||||||
|
foreach (object newItem in newItems) |
||||||
|
{ |
||||||
|
if (!(newItem is ManagedContent)) |
||||||
|
throw new InvalidOperationException("Pane can contain only ManagedContents!"); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
//void RefreshContentsSelectedProperty()
|
||||||
|
//{
|
||||||
|
// //foreach (ManagedContent mc in Items)
|
||||||
|
// //{
|
||||||
|
// // //mc.IsSelected = (mc == SelectedItem);
|
||||||
|
// // //Selector.SetIsSelected(mc
|
||||||
|
|
||||||
|
// // if (Selector.GetIsSelected(mc))
|
||||||
|
// // mc.FocusContent();
|
||||||
|
// //}
|
||||||
|
//}
|
||||||
|
|
||||||
|
//protected override void OnPropertyChanged(DependencyPropertyChangedEventArgs e)
|
||||||
|
//{
|
||||||
|
// if (e.Property == SelectedItemProperty)
|
||||||
|
// RefreshContentsSelectedProperty();
|
||||||
|
// // SetValue(ActiveContentProperty, SelectedItem);
|
||||||
|
|
||||||
|
// //if (e.Property == ActiveContentProperty)
|
||||||
|
// //{
|
||||||
|
// // //SetValue(SelectedItemProperty, ActiveContent);
|
||||||
|
|
||||||
|
// //}
|
||||||
|
|
||||||
|
// base.OnPropertyChanged(e);
|
||||||
|
//}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region IDockableControl Members
|
||||||
|
|
||||||
|
public virtual bool IsDocked |
||||||
|
{ |
||||||
|
get { return true; } |
||||||
|
} |
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
public virtual DockingManager GetManager() |
||||||
|
{ |
||||||
|
DependencyObject parent = LogicalTreeHelper.GetParent(this); |
||||||
|
|
||||||
|
while (parent != null && |
||||||
|
(!(parent is DockingManager))) |
||||||
|
parent = LogicalTreeHelper.GetParent(parent); |
||||||
|
|
||||||
|
return parent as DockingManager; |
||||||
|
} |
||||||
|
|
||||||
|
#region ContainsActiveContent
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// ContainsActiveContent Read-Only Dependency Property
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>This property is specially intended for use in restyling.</remarks>
|
||||||
|
private static readonly DependencyPropertyKey ContainsActiveContentPropertyKey |
||||||
|
= DependencyProperty.RegisterReadOnly("ContainsActiveContent", typeof(bool), typeof(Pane), |
||||||
|
new FrameworkPropertyMetadata(false, |
||||||
|
new PropertyChangedCallback(OnContainsActiveContentChanged))); |
||||||
|
|
||||||
|
public static readonly DependencyProperty ContainsActiveContentProperty |
||||||
|
= ContainsActiveContentPropertyKey.DependencyProperty; |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the ContainsActiveContent property. This dependency property
|
||||||
|
/// indicates if this <see cref="Pane"/> contains a <see cref="ManagedContent"/> set as active content into the parent <see cref="DockingManager"/> object.
|
||||||
|
/// </summary>
|
||||||
|
public bool ContainsActiveContent |
||||||
|
{ |
||||||
|
get { return (bool)GetValue(ContainsActiveContentProperty); } |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Provides a secure method for setting the ContainsActiveContent property.
|
||||||
|
/// This dependency property indicates if this <see cref="Pane"/> contains a <see cref="ManagedContent"/> set as active content into the parent <see cref="DockingManager"/> object.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="value">The new value for the property.</param>
|
||||||
|
protected void SetContainsActiveContent(bool value) |
||||||
|
{ |
||||||
|
SetValue(ContainsActiveContentPropertyKey, value); |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Handles changes to the ContainsActiveContent property.
|
||||||
|
/// </summary>
|
||||||
|
private static void OnContainsActiveContentChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) |
||||||
|
{ |
||||||
|
((Pane)d).OnContainsActiveContentChanged(e); |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Provides derived classes an opportunity to handle changes to the ContainsActiveContent property.
|
||||||
|
/// </summary>
|
||||||
|
protected virtual void OnContainsActiveContentChanged(DependencyPropertyChangedEventArgs e) |
||||||
|
{ |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
internal void RefreshContainsActiveContentProperty() |
||||||
|
{ |
||||||
|
SetContainsActiveContent( |
||||||
|
Items.Cast<ManagedContent>().FirstOrDefault(d => d.IsActiveContent) != null); |
||||||
|
|
||||||
|
if (Items.Count> 0) |
||||||
|
Debug.WriteLine("{0} ContainsActiveContent ={1}", (Items[0] as ManagedContent).Title, ContainsActiveContent); |
||||||
|
} |
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region IDockableControl Members
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Membri di IDropSurface
|
||||||
|
#region Drag pane services
|
||||||
|
|
||||||
|
DockingManager _oldManager = null; |
||||||
|
|
||||||
|
protected void RemoveDragPaneReferences() |
||||||
|
{ |
||||||
|
if (!DesignerProperties.GetIsInDesignMode(this)) |
||||||
|
{ |
||||||
|
if (_oldManager != null) |
||||||
|
{ |
||||||
|
_oldManager.DragPaneServices.Unregister(this); |
||||||
|
_oldManager = null; |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
protected void AddDragPaneReferences() |
||||||
|
{ |
||||||
|
if (!DesignerProperties.GetIsInDesignMode(this)) |
||||||
|
{ |
||||||
|
_oldManager = GetManager(); |
||||||
|
if (_oldManager != null) |
||||||
|
_oldManager.DragPaneServices.Register(this); |
||||||
|
} |
||||||
|
} |
||||||
|
#endregion
|
||||||
|
|
||||||
|
protected abstract bool IsSurfaceVisible |
||||||
|
{ |
||||||
|
get; |
||||||
|
} |
||||||
|
|
||||||
|
bool IDropSurface.IsSurfaceVisible { get { return IsSurfaceVisible; } } |
||||||
|
|
||||||
|
|
||||||
|
protected virtual Rect SurfaceRectangle |
||||||
|
{ |
||||||
|
get |
||||||
|
{ |
||||||
|
if (!IsSurfaceVisible) |
||||||
|
return new Rect(); |
||||||
|
|
||||||
|
if (PresentationSource.FromVisual(this) == null) |
||||||
|
return new Rect(); |
||||||
|
|
||||||
|
return new Rect(HelperFunc.PointToScreenWithoutFlowDirection(this, new Point()), new Size(ActualWidth, ActualHeight)); |
||||||
|
} |
||||||
|
} |
||||||
|
Rect IDropSurface.SurfaceRectangle |
||||||
|
{ |
||||||
|
get { return SurfaceRectangle; } |
||||||
|
} |
||||||
|
|
||||||
|
protected virtual void OnDragEnter(Point point) |
||||||
|
{ |
||||||
|
GetManager().OverlayWindow.ShowOverlayPaneDockingOptions(this); |
||||||
|
} |
||||||
|
void IDropSurface.OnDragEnter(Point point) |
||||||
|
{ |
||||||
|
OnDragEnter(point); |
||||||
|
} |
||||||
|
|
||||||
|
protected virtual void OnDragOver(Point point) |
||||||
|
{ |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
void IDropSurface.OnDragOver(Point point) |
||||||
|
{ |
||||||
|
OnDragOver(point); |
||||||
|
} |
||||||
|
|
||||||
|
protected virtual void OnDragLeave(Point point) |
||||||
|
{ |
||||||
|
GetManager().OverlayWindow.HideOverlayPaneDockingOptions(this); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
void IDropSurface.OnDragLeave(Point point) |
||||||
|
{ |
||||||
|
OnDragLeave(point); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
protected virtual bool OnDrop(Point point) |
||||||
|
{ |
||||||
|
return false; |
||||||
|
} |
||||||
|
|
||||||
|
bool IDropSurface.OnDrop(Point point) |
||||||
|
{ |
||||||
|
return OnDrop(point); |
||||||
|
} |
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Commands
|
||||||
|
protected override void OnInitialized(EventArgs e) |
||||||
|
{ |
||||||
|
this.CommandBindings.Add( |
||||||
|
new CommandBinding(PaneCommands.Dock, this.OnExecuteCommand, this.OnCanExecuteCommand)); |
||||||
|
|
||||||
|
base.OnInitialized(e); |
||||||
|
} |
||||||
|
|
||||||
|
protected virtual void OnExecuteCommand(object sender, ExecutedRoutedEventArgs e) |
||||||
|
{ |
||||||
|
if (e.Command == PaneCommands.Dock) |
||||||
|
{ |
||||||
|
Dock(); |
||||||
|
e.Handled = true; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
protected virtual void OnCanExecuteCommand(object sender, CanExecuteRoutedEventArgs e) |
||||||
|
{ |
||||||
|
e.CanExecute = this.GetManager() != null; |
||||||
|
|
||||||
|
if (e.CanExecute) |
||||||
|
{ |
||||||
|
if (e.Command == PaneCommands.Dock) |
||||||
|
{ |
||||||
|
e.CanExecute = true; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
Debug.WriteLine("Pane.OnCanExecuteCommand({0}) = {1} (ContinueRouting={2})", e.Command, e.CanExecute, e.ContinueRouting); |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Dock contained contents to the container <see cref="DockingManager"/>
|
||||||
|
/// </summary>
|
||||||
|
public virtual void Dock() |
||||||
|
{ |
||||||
|
|
||||||
|
} |
||||||
|
#endregion
|
||||||
|
|
||||||
|
internal virtual ManagedContent RemoveContent(ManagedContent contentToRemove) |
||||||
|
{ |
||||||
|
Items.Remove(contentToRemove); |
||||||
|
|
||||||
|
return contentToRemove; |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
internal virtual ManagedContent RemoveContent(int index) |
||||||
|
{ |
||||||
|
ManagedContent contentToRemove = Items[index] as ManagedContent; |
||||||
|
|
||||||
|
return RemoveContent(contentToRemove); |
||||||
|
} |
||||||
|
|
||||||
|
protected FrameworkElement _partHeader = null; |
||||||
|
|
||||||
|
public override void OnApplyTemplate() |
||||||
|
{ |
||||||
|
base.OnApplyTemplate(); |
||||||
|
|
||||||
|
//gets a reference to the header for the pane
|
||||||
|
_partHeader = GetTemplateChild("PART_Header") as FrameworkElement; |
||||||
|
} |
||||||
|
|
||||||
|
internal virtual ResizingPanel GetContainerPanel() |
||||||
|
{ |
||||||
|
return LogicalTreeHelper.GetParent(this) as ResizingPanel; |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gest or set a value indicating if pane should show the tab header
|
||||||
|
/// </summary>
|
||||||
|
public bool ShowHeader |
||||||
|
{ |
||||||
|
get { return (bool)GetValue(ShowHeaderProperty); } |
||||||
|
set { SetValue(ShowHeaderProperty, value); } |
||||||
|
} |
||||||
|
|
||||||
|
// Using a DependencyProperty as the backing store for ActiveContent. This enables animation, styling, binding, etc...
|
||||||
|
public static readonly DependencyProperty ShowHeaderProperty = |
||||||
|
DependencyProperty.Register("ShowHeader", typeof(bool), typeof(Pane), new UIPropertyMetadata(true)); |
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#region INotifyPropertyChanged Members
|
||||||
|
|
||||||
|
public event PropertyChangedEventHandler PropertyChanged; |
||||||
|
|
||||||
|
internal void NotifyPropertyChanged(string propertyName) |
||||||
|
{ |
||||||
|
if (PropertyChanged != null) |
||||||
|
PropertyChanged(this, new PropertyChangedEventArgs(propertyName)); |
||||||
|
} |
||||||
|
#endregion
|
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,37 @@ |
|||||||
|
using System; |
||||||
|
using System.Collections.Generic; |
||||||
|
using System.Linq; |
||||||
|
using System.Text; |
||||||
|
using System.Windows.Input; |
||||||
|
|
||||||
|
namespace AvalonDock |
||||||
|
{ |
||||||
|
public sealed class PaneCommands |
||||||
|
{ |
||||||
|
static object syncRoot = new object(); |
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
private static RoutedUICommand dockCommand = null; |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Dock <see cref="Pane"/> to container <see cref="DockingManager"/>
|
||||||
|
/// </summary>
|
||||||
|
public static RoutedUICommand Dock |
||||||
|
{ |
||||||
|
get |
||||||
|
{ |
||||||
|
lock (syncRoot) |
||||||
|
{ |
||||||
|
if (null == dockCommand) |
||||||
|
{ |
||||||
|
dockCommand = new RoutedUICommand("Dock", "Dock", typeof(PaneCommands)); |
||||||
|
} |
||||||
|
} |
||||||
|
return dockCommand; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,120 @@ |
|||||||
|
//Copyright (c) 2007-2010, Adolfo Marinucci
|
||||||
|
//All rights reserved.
|
||||||
|
|
||||||
|
//Redistribution and use in source and binary forms, with or without modification,
|
||||||
|
//are permitted provided that the following conditions are met:
|
||||||
|
//
|
||||||
|
//* Redistributions of source code must retain the above copyright notice,
|
||||||
|
// this list of conditions and the following disclaimer.
|
||||||
|
//* Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
// this list of conditions and the following disclaimer in the documentation
|
||||||
|
// and/or other materials provided with the distribution.
|
||||||
|
//* Neither the name of Adolfo Marinucci nor the names of its contributors may
|
||||||
|
// be used to endorse or promote products derived from this software without
|
||||||
|
// specific prior written permission.
|
||||||
|
//
|
||||||
|
//THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||||
|
//AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
//WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||||
|
//IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||||
|
//INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||||
|
//PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||||
|
//HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||||
|
//OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
||||||
|
//EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
|
using System; |
||||||
|
using System.Collections.Generic; |
||||||
|
using System.Text; |
||||||
|
using System.Windows; |
||||||
|
using System.Windows.Controls; |
||||||
|
using System.Windows.Controls.Primitives; |
||||||
|
using System.Windows.Data; |
||||||
|
using System.Windows.Documents; |
||||||
|
using System.Windows.Input; |
||||||
|
using System.Windows.Media; |
||||||
|
using System.Windows.Media.Imaging; |
||||||
|
using System.Windows.Shapes; |
||||||
|
using System.Linq; |
||||||
|
using System.Windows.Markup; |
||||||
|
|
||||||
|
namespace AvalonDock |
||||||
|
{ |
||||||
|
public abstract class PaneTabPanel : Panel |
||||||
|
{ |
||||||
|
//static PaneTabPanel()
|
||||||
|
//{
|
||||||
|
// //This OverrideMetadata call tells the system that this element wants to provide a style that is different than its base class.
|
||||||
|
// //This style is defined in themes\generic.xaml
|
||||||
|
// DefaultStyleKeyProperty.OverrideMetadata(typeof(PaneTabPanel), new FrameworkPropertyMetadata(typeof(PaneTabPanel)));
|
||||||
|
//}
|
||||||
|
|
||||||
|
protected override void OnVisualChildrenChanged(DependencyObject visualAdded, DependencyObject visualRemoved) |
||||||
|
{ |
||||||
|
base.OnVisualChildrenChanged(visualAdded, visualRemoved); |
||||||
|
|
||||||
|
ManagedContent mc = visualAdded as ManagedContent; |
||||||
|
if (mc != null) |
||||||
|
{ |
||||||
|
mc.Style = TabItemStyle; |
||||||
|
mc.ApplyTemplate(); |
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
internal PaneTabPanel() |
||||||
|
{ |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
#region TabItemStyle
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// TabItemStyle Dependency Property
|
||||||
|
/// </summary>
|
||||||
|
public static readonly DependencyProperty TabItemStyleProperty = |
||||||
|
DependencyProperty.Register("TabItemStyle", typeof(Style), typeof(PaneTabPanel), |
||||||
|
new FrameworkPropertyMetadata((Style)null, |
||||||
|
new PropertyChangedCallback(OnTabItemStyleChanged))); |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the TabItemStyle property. This dependency property
|
||||||
|
/// indicates style to use for tabs.
|
||||||
|
/// </summary>
|
||||||
|
public Style TabItemStyle |
||||||
|
{ |
||||||
|
get { return (Style)GetValue(TabItemStyleProperty); } |
||||||
|
set { SetValue(TabItemStyleProperty, value); } |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Handles changes to the TabItemStyle property.
|
||||||
|
/// </summary>
|
||||||
|
private static void OnTabItemStyleChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) |
||||||
|
{ |
||||||
|
((PaneTabPanel)d).OnTabItemStyleChanged(e); |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Provides derived classes an opportunity to handle changes to the TabItemStyle property.
|
||||||
|
/// </summary>
|
||||||
|
protected virtual void OnTabItemStyleChanged(DependencyPropertyChangedEventArgs e) |
||||||
|
{ |
||||||
|
//Children.Cast<ManagedContent>().ForEach(c =>
|
||||||
|
// {
|
||||||
|
// Binding bnd = new Binding("TabItemStyle");
|
||||||
|
// bnd.Source = this;
|
||||||
|
// bnd.Mode = BindingMode.OneWay;
|
||||||
|
|
||||||
|
// c.SetBinding(StyleProperty, bnd);
|
||||||
|
|
||||||
|
// //c.Style = TabItemStyle;
|
||||||
|
// });
|
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,55 @@ |
|||||||
|
using System.Reflection; |
||||||
|
using System.Resources; |
||||||
|
using System.Runtime.CompilerServices; |
||||||
|
using System.Runtime.InteropServices; |
||||||
|
using System.Windows; |
||||||
|
|
||||||
|
// General Information about an assembly is controlled through the following
|
||||||
|
// set of attributes. Change these attribute values to modify the information
|
||||||
|
// associated with an assembly.
|
||||||
|
[assembly: AssemblyTitle("AvalonDock")] |
||||||
|
[assembly: AssemblyDescription("")] |
||||||
|
[assembly: AssemblyConfiguration("")] |
||||||
|
[assembly: AssemblyCompany("Adolfo Marinucci")] |
||||||
|
[assembly: AssemblyProduct("AvalonDock")] |
||||||
|
[assembly: AssemblyCopyright("Copyright © Adolfo Marinucci 2010")] |
||||||
|
[assembly: AssemblyTrademark("")] |
||||||
|
[assembly: AssemblyCulture("")] |
||||||
|
|
||||||
|
// Setting ComVisible to false makes the types in this assembly not visible
|
||||||
|
// to COM components. If you need to access a type in this assembly from
|
||||||
|
// COM, set the ComVisible attribute to true on that type.
|
||||||
|
[assembly: ComVisible(false)] |
||||||
|
|
||||||
|
//In order to begin building localizable applications, set
|
||||||
|
//<UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file
|
||||||
|
//inside a <PropertyGroup>. For example, if you are using US english
|
||||||
|
//in your source files, set the <UICulture> to en-US. Then uncomment
|
||||||
|
//the NeutralResourceLanguage attribute below. Update the "en-US" in
|
||||||
|
//the line below to match the UICulture setting in the project file.
|
||||||
|
|
||||||
|
//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
|
||||||
|
|
||||||
|
|
||||||
|
[assembly: ThemeInfo( |
||||||
|
ResourceDictionaryLocation.SourceAssembly, //where theme specific resource dictionaries are located
|
||||||
|
//(used if a resource is not found in the page,
|
||||||
|
// or application resource dictionaries)
|
||||||
|
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
|
||||||
|
//(used if a resource is not found in the page,
|
||||||
|
// app, or any theme specific resource dictionaries)
|
||||||
|
)] |
||||||
|
|
||||||
|
|
||||||
|
// Version information for an assembly consists of the following four values:
|
||||||
|
//
|
||||||
|
// Major Version
|
||||||
|
// Minor Version
|
||||||
|
// Build Number
|
||||||
|
// Revision
|
||||||
|
//
|
||||||
|
// You can specify all the values or you can default the Build and Revision Numbers
|
||||||
|
// by using the '*' as shown below:
|
||||||
|
// [assembly: AssemblyVersion("1.0.*")]
|
||||||
|
[assembly: AssemblyVersion("1.3.3391")] |
||||||
|
[assembly: AssemblyFileVersion("1.3.3391")] |
||||||
@ -0,0 +1,252 @@ |
|||||||
|
//------------------------------------------------------------------------------
|
||||||
|
// <auto-generated>
|
||||||
|
// This code was generated by a tool.
|
||||||
|
// Runtime Version:4.0.30319.1
|
||||||
|
//
|
||||||
|
// Changes to this file may cause incorrect behavior and will be lost if
|
||||||
|
// the code is regenerated.
|
||||||
|
// </auto-generated>
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
namespace AvalonDock.Properties { |
||||||
|
using System; |
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// A strongly-typed resource class, for looking up localized strings, etc.
|
||||||
|
/// </summary>
|
||||||
|
// This class was auto-generated by the StronglyTypedResourceBuilder
|
||||||
|
// class via a tool like ResGen or Visual Studio.
|
||||||
|
// To add or remove a member, edit your .ResX file then rerun ResGen
|
||||||
|
// with the /str option, or rebuild your VS project.
|
||||||
|
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] |
||||||
|
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()] |
||||||
|
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] |
||||||
|
public class Resources { |
||||||
|
|
||||||
|
private static global::System.Resources.ResourceManager resourceMan; |
||||||
|
|
||||||
|
private static global::System.Globalization.CultureInfo resourceCulture; |
||||||
|
|
||||||
|
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] |
||||||
|
internal Resources() { |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns the cached ResourceManager instance used by this class.
|
||||||
|
/// </summary>
|
||||||
|
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] |
||||||
|
public static global::System.Resources.ResourceManager ResourceManager { |
||||||
|
get { |
||||||
|
if (object.ReferenceEquals(resourceMan, null)) { |
||||||
|
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("AvalonDock.Properties.Resources", typeof(Resources).Assembly); |
||||||
|
resourceMan = temp; |
||||||
|
} |
||||||
|
return resourceMan; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Overrides the current thread's CurrentUICulture property for all
|
||||||
|
/// resource lookups using this strongly typed resource class.
|
||||||
|
/// </summary>
|
||||||
|
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] |
||||||
|
public static global::System.Globalization.CultureInfo Culture { |
||||||
|
get { |
||||||
|
return resourceCulture; |
||||||
|
} |
||||||
|
set { |
||||||
|
resourceCulture = value; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized string similar to Float.
|
||||||
|
/// </summary>
|
||||||
|
public static string DockableContentCommands_DockableFloatingWindow { |
||||||
|
get { |
||||||
|
return ResourceManager.GetString("DockableContentCommands_DockableFloatingWindow", resourceCulture); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized string similar to Float.
|
||||||
|
/// </summary>
|
||||||
|
public static string DockableContentCommands_FloatingWindow { |
||||||
|
get { |
||||||
|
return ResourceManager.GetString("DockableContentCommands_FloatingWindow", resourceCulture); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized string similar to Dock as Tabbed Document.
|
||||||
|
/// </summary>
|
||||||
|
public static string DockableContentCommands_ShowAsDocument { |
||||||
|
get { |
||||||
|
return ResourceManager.GetString("DockableContentCommands_ShowAsDocument", resourceCulture); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized string similar to Auto Hide.
|
||||||
|
/// </summary>
|
||||||
|
public static string DockableContentCommands_ToggleAutoHide { |
||||||
|
get { |
||||||
|
return ResourceManager.GetString("DockableContentCommands_ToggleAutoHide", resourceCulture); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized string similar to Window Position.
|
||||||
|
/// </summary>
|
||||||
|
public static string DockablePane_ShowOptionsMenu { |
||||||
|
get { |
||||||
|
return ResourceManager.GetString("DockablePane_ShowOptionsMenu", resourceCulture); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized string similar to Close.
|
||||||
|
/// </summary>
|
||||||
|
public static string DockablePaneCommands_Close { |
||||||
|
get { |
||||||
|
return ResourceManager.GetString("DockablePaneCommands_Close", resourceCulture); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized string similar to Hide.
|
||||||
|
/// </summary>
|
||||||
|
public static string DockablePaneCommands_Hide { |
||||||
|
get { |
||||||
|
return ResourceManager.GetString("DockablePaneCommands_Hide", resourceCulture); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized string similar to Auto Hide.
|
||||||
|
/// </summary>
|
||||||
|
public static string DockablePaneCommands_ToggleAutoHide { |
||||||
|
get { |
||||||
|
return ResourceManager.GetString("DockablePaneCommands_ToggleAutoHide", resourceCulture); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized string similar to Float.
|
||||||
|
/// </summary>
|
||||||
|
public static string DocumentContentCommands_FloatingDocument { |
||||||
|
get { |
||||||
|
return ResourceManager.GetString("DocumentContentCommands_FloatingDocument", resourceCulture); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized string similar to Dock as Tabbed Document.
|
||||||
|
/// </summary>
|
||||||
|
public static string DocumentContentCommands_TabbedDocument { |
||||||
|
get { |
||||||
|
return ResourceManager.GetString("DocumentContentCommands_TabbedDocument", resourceCulture); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized string similar to Close All But This.
|
||||||
|
/// </summary>
|
||||||
|
public static string DocumentPaneCommands_CloseAllButThis { |
||||||
|
get { |
||||||
|
return ResourceManager.GetString("DocumentPaneCommands_CloseAllButThis", resourceCulture); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized string similar to Close.
|
||||||
|
/// </summary>
|
||||||
|
public static string DocumentPaneCommands_CloseThis { |
||||||
|
get { |
||||||
|
return ResourceManager.GetString("DocumentPaneCommands_CloseThis", resourceCulture); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized string similar to New Horizontal Tab Group.
|
||||||
|
/// </summary>
|
||||||
|
public static string DocumentPaneCommands_NewHorizontalTabGroup { |
||||||
|
get { |
||||||
|
return ResourceManager.GetString("DocumentPaneCommands_NewHorizontalTabGroup", resourceCulture); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized string similar to New VerticalTab Group.
|
||||||
|
/// </summary>
|
||||||
|
public static string DocumentPaneCommands_NewVerticalTabGroup { |
||||||
|
get { |
||||||
|
return ResourceManager.GetString("DocumentPaneCommands_NewVerticalTabGroup", resourceCulture); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized string similar to Activate.
|
||||||
|
/// </summary>
|
||||||
|
public static string ManagedContentCommands_Activate { |
||||||
|
get { |
||||||
|
return ResourceManager.GetString("ManagedContentCommands_Activate", resourceCulture); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized string similar to Close.
|
||||||
|
/// </summary>
|
||||||
|
public static string ManagedContentCommands_Close { |
||||||
|
get { |
||||||
|
return ResourceManager.GetString("ManagedContentCommands_Close", resourceCulture); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized string similar to Hide.
|
||||||
|
/// </summary>
|
||||||
|
public static string ManagedContentCommands_Hide { |
||||||
|
get { |
||||||
|
return ResourceManager.GetString("ManagedContentCommands_Hide", resourceCulture); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized string similar to Show.
|
||||||
|
/// </summary>
|
||||||
|
public static string ManagedContentCommands_Show { |
||||||
|
get { |
||||||
|
return ResourceManager.GetString("ManagedContentCommands_Show", resourceCulture); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized string similar to Active Files.
|
||||||
|
/// </summary>
|
||||||
|
public static string NavigatorWindow_ActiveFiles { |
||||||
|
get { |
||||||
|
return ResourceManager.GetString("NavigatorWindow_ActiveFiles", resourceCulture); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized string similar to Active Tool Windows.
|
||||||
|
/// </summary>
|
||||||
|
public static string NavigatorWindow_ActiveToolWindows { |
||||||
|
get { |
||||||
|
return ResourceManager.GetString("NavigatorWindow_ActiveToolWindows", resourceCulture); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized string similar to Dock.
|
||||||
|
/// </summary>
|
||||||
|
public static string PaneCommands_Dock { |
||||||
|
get { |
||||||
|
return ResourceManager.GetString("PaneCommands_Dock", resourceCulture); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,183 @@ |
|||||||
|
<?xml version="1.0" encoding="utf-8"?> |
||||||
|
<root> |
||||||
|
<!-- |
||||||
|
Microsoft ResX Schema |
||||||
|
|
||||||
|
Version 2.0 |
||||||
|
|
||||||
|
The primary goals of this format is to allow a simple XML format |
||||||
|
that is mostly human readable. The generation and parsing of the |
||||||
|
various data types are done through the TypeConverter classes |
||||||
|
associated with the data types. |
||||||
|
|
||||||
|
Example: |
||||||
|
|
||||||
|
... ado.net/XML headers & schema ... |
||||||
|
<resheader name="resmimetype">text/microsoft-resx</resheader> |
||||||
|
<resheader name="version">2.0</resheader> |
||||||
|
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader> |
||||||
|
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader> |
||||||
|
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data> |
||||||
|
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data> |
||||||
|
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64"> |
||||||
|
<value>[base64 mime encoded serialized .NET Framework object]</value> |
||||||
|
</data> |
||||||
|
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> |
||||||
|
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value> |
||||||
|
<comment>This is a comment</comment> |
||||||
|
</data> |
||||||
|
|
||||||
|
There are any number of "resheader" rows that contain simple |
||||||
|
name/value pairs. |
||||||
|
|
||||||
|
Each data row contains a name, and value. The row also contains a |
||||||
|
type or mimetype. Type corresponds to a .NET class that support |
||||||
|
text/value conversion through the TypeConverter architecture. |
||||||
|
Classes that don't support this are serialized and stored with the |
||||||
|
mimetype set. |
||||||
|
|
||||||
|
The mimetype is used for serialized objects, and tells the |
||||||
|
ResXResourceReader how to depersist the object. This is currently not |
||||||
|
extensible. For a given mimetype the value must be set accordingly: |
||||||
|
|
||||||
|
Note - application/x-microsoft.net.object.binary.base64 is the format |
||||||
|
that the ResXResourceWriter will generate, however the reader can |
||||||
|
read any of the formats listed below. |
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.binary.base64 |
||||||
|
value : The object must be serialized with |
||||||
|
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter |
||||||
|
: and then encoded with base64 encoding. |
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.soap.base64 |
||||||
|
value : The object must be serialized with |
||||||
|
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter |
||||||
|
: and then encoded with base64 encoding. |
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.bytearray.base64 |
||||||
|
value : The object must be serialized into a byte array |
||||||
|
: using a System.ComponentModel.TypeConverter |
||||||
|
: and then encoded with base64 encoding. |
||||||
|
--> |
||||||
|
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"> |
||||||
|
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" /> |
||||||
|
<xsd:element name="root" msdata:IsDataSet="true"> |
||||||
|
<xsd:complexType> |
||||||
|
<xsd:choice maxOccurs="unbounded"> |
||||||
|
<xsd:element name="metadata"> |
||||||
|
<xsd:complexType> |
||||||
|
<xsd:sequence> |
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" /> |
||||||
|
</xsd:sequence> |
||||||
|
<xsd:attribute name="name" use="required" type="xsd:string" /> |
||||||
|
<xsd:attribute name="type" type="xsd:string" /> |
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" /> |
||||||
|
<xsd:attribute ref="xml:space" /> |
||||||
|
</xsd:complexType> |
||||||
|
</xsd:element> |
||||||
|
<xsd:element name="assembly"> |
||||||
|
<xsd:complexType> |
||||||
|
<xsd:attribute name="alias" type="xsd:string" /> |
||||||
|
<xsd:attribute name="name" type="xsd:string" /> |
||||||
|
</xsd:complexType> |
||||||
|
</xsd:element> |
||||||
|
<xsd:element name="data"> |
||||||
|
<xsd:complexType> |
||||||
|
<xsd:sequence> |
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> |
||||||
|
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" /> |
||||||
|
</xsd:sequence> |
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" /> |
||||||
|
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" /> |
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" /> |
||||||
|
<xsd:attribute ref="xml:space" /> |
||||||
|
</xsd:complexType> |
||||||
|
</xsd:element> |
||||||
|
<xsd:element name="resheader"> |
||||||
|
<xsd:complexType> |
||||||
|
<xsd:sequence> |
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> |
||||||
|
</xsd:sequence> |
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" /> |
||||||
|
</xsd:complexType> |
||||||
|
</xsd:element> |
||||||
|
</xsd:choice> |
||||||
|
</xsd:complexType> |
||||||
|
</xsd:element> |
||||||
|
</xsd:schema> |
||||||
|
<resheader name="resmimetype"> |
||||||
|
<value>text/microsoft-resx</value> |
||||||
|
</resheader> |
||||||
|
<resheader name="version"> |
||||||
|
<value>2.0</value> |
||||||
|
</resheader> |
||||||
|
<resheader name="reader"> |
||||||
|
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> |
||||||
|
</resheader> |
||||||
|
<resheader name="writer"> |
||||||
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> |
||||||
|
</resheader> |
||||||
|
<data name="DockableContentCommands_DockableFloatingWindow" xml:space="preserve"> |
||||||
|
<value>Float</value> |
||||||
|
</data> |
||||||
|
<data name="DockableContentCommands_FloatingWindow" xml:space="preserve"> |
||||||
|
<value>Float</value> |
||||||
|
</data> |
||||||
|
<data name="DockableContentCommands_ShowAsDocument" xml:space="preserve"> |
||||||
|
<value>Dock as Tabbed Document</value> |
||||||
|
</data> |
||||||
|
<data name="DockableContentCommands_ToggleAutoHide" xml:space="preserve"> |
||||||
|
<value>Auto Hide</value> |
||||||
|
</data> |
||||||
|
<data name="DockablePaneCommands_Close" xml:space="preserve"> |
||||||
|
<value>Close</value> |
||||||
|
</data> |
||||||
|
<data name="DockablePaneCommands_Hide" xml:space="preserve"> |
||||||
|
<value>Hide</value> |
||||||
|
</data> |
||||||
|
<data name="DockablePaneCommands_ToggleAutoHide" xml:space="preserve"> |
||||||
|
<value>Auto Hide</value> |
||||||
|
</data> |
||||||
|
<data name="DockablePane_ShowOptionsMenu" xml:space="preserve"> |
||||||
|
<value>Window Position</value> |
||||||
|
</data> |
||||||
|
<data name="DocumentContentCommands_FloatingDocument" xml:space="preserve"> |
||||||
|
<value>Float</value> |
||||||
|
</data> |
||||||
|
<data name="DocumentContentCommands_TabbedDocument" xml:space="preserve"> |
||||||
|
<value>Dock as Tabbed Document</value> |
||||||
|
</data> |
||||||
|
<data name="DocumentPaneCommands_CloseAllButThis" xml:space="preserve"> |
||||||
|
<value>Close All But This</value> |
||||||
|
</data> |
||||||
|
<data name="DocumentPaneCommands_CloseThis" xml:space="preserve"> |
||||||
|
<value>Close</value> |
||||||
|
</data> |
||||||
|
<data name="DocumentPaneCommands_NewHorizontalTabGroup" xml:space="preserve"> |
||||||
|
<value>New Horizontal Tab Group</value> |
||||||
|
</data> |
||||||
|
<data name="DocumentPaneCommands_NewVerticalTabGroup" xml:space="preserve"> |
||||||
|
<value>New VerticalTab Group</value> |
||||||
|
</data> |
||||||
|
<data name="ManagedContentCommands_Activate" xml:space="preserve"> |
||||||
|
<value>Activate</value> |
||||||
|
</data> |
||||||
|
<data name="ManagedContentCommands_Close" xml:space="preserve"> |
||||||
|
<value>Close</value> |
||||||
|
</data> |
||||||
|
<data name="ManagedContentCommands_Hide" xml:space="preserve"> |
||||||
|
<value>Hide</value> |
||||||
|
</data> |
||||||
|
<data name="ManagedContentCommands_Show" xml:space="preserve"> |
||||||
|
<value>Show</value> |
||||||
|
</data> |
||||||
|
<data name="NavigatorWindow_ActiveFiles" xml:space="preserve"> |
||||||
|
<value>Active Files</value> |
||||||
|
</data> |
||||||
|
<data name="NavigatorWindow_ActiveToolWindows" xml:space="preserve"> |
||||||
|
<value>Active Tool Windows</value> |
||||||
|
</data> |
||||||
|
<data name="PaneCommands_Dock" xml:space="preserve"> |
||||||
|
<value>Dock</value> |
||||||
|
</data> |
||||||
|
</root> |
||||||
@ -0,0 +1,30 @@ |
|||||||
|
//------------------------------------------------------------------------------
|
||||||
|
// <auto-generated>
|
||||||
|
// This code was generated by a tool.
|
||||||
|
// Runtime Version:4.0.30319.1
|
||||||
|
//
|
||||||
|
// Changes to this file may cause incorrect behavior and will be lost if
|
||||||
|
// the code is regenerated.
|
||||||
|
// </auto-generated>
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
namespace AvalonDock.Properties |
||||||
|
{ |
||||||
|
|
||||||
|
|
||||||
|
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] |
||||||
|
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "10.0.0.0")] |
||||||
|
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase |
||||||
|
{ |
||||||
|
|
||||||
|
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); |
||||||
|
|
||||||
|
public static Settings Default |
||||||
|
{ |
||||||
|
get |
||||||
|
{ |
||||||
|
return defaultInstance; |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,7 @@ |
|||||||
|
<?xml version='1.0' encoding='utf-8'?> |
||||||
|
<SettingsFile xmlns="uri:settings" CurrentProfile="(Default)"> |
||||||
|
<Profiles> |
||||||
|
<Profile Name="(Default)" /> |
||||||
|
</Profiles> |
||||||
|
<Settings /> |
||||||
|
</SettingsFile> |
||||||
@ -0,0 +1,21 @@ |
|||||||
|
using System; |
||||||
|
using System.Collections.Generic; |
||||||
|
using System.Linq; |
||||||
|
using System.Text; |
||||||
|
using System.ComponentModel; |
||||||
|
|
||||||
|
namespace AvalonDock |
||||||
|
{ |
||||||
|
public class RequestDocumentCloseEventArgs : CancelEventArgs |
||||||
|
{ |
||||||
|
public RequestDocumentCloseEventArgs(DocumentContent doc) |
||||||
|
{ |
||||||
|
DocumentToClose = doc; |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Document content that user wants to close
|
||||||
|
/// </summary>
|
||||||
|
public DocumentContent DocumentToClose { get; private set; } |
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,55 @@ |
|||||||
|
//Copyright (c) 2007-2010, Adolfo Marinucci
|
||||||
|
//All rights reserved.
|
||||||
|
|
||||||
|
//Redistribution and use in source and binary forms, with or without modification,
|
||||||
|
//are permitted provided that the following conditions are met:
|
||||||
|
//
|
||||||
|
//* Redistributions of source code must retain the above copyright notice,
|
||||||
|
// this list of conditions and the following disclaimer.
|
||||||
|
//* Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
// this list of conditions and the following disclaimer in the documentation
|
||||||
|
// and/or other materials provided with the distribution.
|
||||||
|
//* Neither the name of Adolfo Marinucci nor the names of its contributors may
|
||||||
|
// be used to endorse or promote products derived from this software without
|
||||||
|
// specific prior written permission.
|
||||||
|
//
|
||||||
|
//THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||||
|
//AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
//WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||||
|
//IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||||
|
//INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||||
|
//PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||||
|
//HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||||
|
//OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
||||||
|
//EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
|
using System; |
||||||
|
using System.Collections.Generic; |
||||||
|
using System.Text; |
||||||
|
using System.Windows; |
||||||
|
using System.Windows.Controls; |
||||||
|
using System.Windows.Controls.Primitives; |
||||||
|
using System.Windows.Data; |
||||||
|
using System.Windows.Documents; |
||||||
|
using System.Windows.Input; |
||||||
|
using System.Windows.Media; |
||||||
|
using System.Windows.Media.Imaging; |
||||||
|
using System.Windows.Shapes; |
||||||
|
|
||||||
|
namespace AvalonDock |
||||||
|
{ |
||||||
|
public class Resizer : Thumb |
||||||
|
{ |
||||||
|
static Resizer() |
||||||
|
{ |
||||||
|
//This OverrideMetadata call tells the system that this element wants to provide a style that is different than its base class.
|
||||||
|
//This style is defined in themes\generic.xaml
|
||||||
|
DefaultStyleKeyProperty.OverrideMetadata(typeof(Resizer), new FrameworkPropertyMetadata(typeof(Resizer))); |
||||||
|
MinWidthProperty.OverrideMetadata(typeof(Resizer), new FrameworkPropertyMetadata(6.0, FrameworkPropertyMetadataOptions.AffectsParentMeasure)); |
||||||
|
MinHeightProperty.OverrideMetadata(typeof(Resizer), new FrameworkPropertyMetadata(6.0, FrameworkPropertyMetadataOptions.AffectsParentMeasure)); |
||||||
|
HorizontalAlignmentProperty.OverrideMetadata(typeof(Resizer), new FrameworkPropertyMetadata(HorizontalAlignment.Stretch, FrameworkPropertyMetadataOptions.AffectsParentMeasure)); |
||||||
|
VerticalAlignmentProperty.OverrideMetadata(typeof(Resizer), new FrameworkPropertyMetadata(VerticalAlignment.Stretch, FrameworkPropertyMetadataOptions.AffectsParentMeasure)); |
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,116 @@ |
|||||||
|
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" |
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
||||||
|
xmlns:ad="clr-namespace:AvalonDock"> |
||||||
|
|
||||||
|
<!--Default brushes--> |
||||||
|
<SolidColorBrush x:Key="ManagedContentTabControlNormalBorderBrush" |
||||||
|
Color="#919B9C"/> |
||||||
|
|
||||||
|
<SolidColorBrush x:Key="{ComponentResourceKey TypeInTargetAssembly={x:Type ad:DockingManager}, ResourceId={x:Static ad:AvalonDockBrushes.DefaultBackgroundBrush}}" |
||||||
|
Color="#FFF4F2E8"/> |
||||||
|
|
||||||
|
<!--Brushes for tab item header--> |
||||||
|
<LinearGradientBrush x:Key="ManagedContentTabItemNormalBackground" |
||||||
|
StartPoint="0,0" |
||||||
|
EndPoint="0,1"> |
||||||
|
<LinearGradientBrush.GradientStops> |
||||||
|
<GradientStop Color="#FFECEBE6" |
||||||
|
Offset="0"/> |
||||||
|
<GradientStop Color="#FFFFFFFF" |
||||||
|
Offset="1"/> |
||||||
|
</LinearGradientBrush.GradientStops> |
||||||
|
</LinearGradientBrush> |
||||||
|
<LinearGradientBrush x:Key="ManagedContentTabItemInvNormalBackground" |
||||||
|
StartPoint="0,0" |
||||||
|
EndPoint="0,1"> |
||||||
|
<LinearGradientBrush.GradientStops> |
||||||
|
<GradientStop Color="#FFFFFFFF" |
||||||
|
Offset="0"/> |
||||||
|
<GradientStop Color="#FFECEBE6" |
||||||
|
Offset="1"/> |
||||||
|
</LinearGradientBrush.GradientStops> |
||||||
|
</LinearGradientBrush> |
||||||
|
|
||||||
|
<LinearGradientBrush x:Key="ManagedContentTabItemHotBackground" |
||||||
|
StartPoint="0,0" |
||||||
|
EndPoint="0,1"> |
||||||
|
<LinearGradientBrush.GradientStops> |
||||||
|
<GradientStop Color="#FFFFFFFF" |
||||||
|
Offset="0"/> |
||||||
|
<GradientStop Color="#FFECEBE6" |
||||||
|
Offset="1"/> |
||||||
|
</LinearGradientBrush.GradientStops> |
||||||
|
</LinearGradientBrush> |
||||||
|
|
||||||
|
<SolidColorBrush x:Key="ManagedContentTabItemSelectedBackground" |
||||||
|
Color="#FFFCFCFE"/> |
||||||
|
<SolidColorBrush x:Key="ManagedContentTabItemDisabledBackground" |
||||||
|
Color="#FFF5F4EA"/> |
||||||
|
<LinearGradientBrush x:Key="ManagedContentTabItemSelectedBorderBackround" StartPoint="0,0" EndPoint="0,1"> |
||||||
|
<GradientStop Color="#FFFFC73C" Offset="0"/> |
||||||
|
<GradientStop Color="#FFE68B2C" Offset="1"/> |
||||||
|
</LinearGradientBrush> |
||||||
|
|
||||||
|
<SolidColorBrush x:Key="ManagedContentTabItemSelectedBorderBrush" |
||||||
|
Color="#FFE68B2C"/> |
||||||
|
<SolidColorBrush x:Key="ManagedContentTabItemHotBorderBackround" |
||||||
|
Color="#FFFFC73C"/> |
||||||
|
<SolidColorBrush x:Key="ManagedContentTabItemHotBorderBrush" |
||||||
|
Color="#FFE68B2C"/> |
||||||
|
<SolidColorBrush x:Key="ManagedContentTabItemDisabledBorderBrush" |
||||||
|
Color="#FFC9C7BA"/> |
||||||
|
|
||||||
|
<!--Brushes for dockable pane headers--> |
||||||
|
<LinearGradientBrush x:Key="{ComponentResourceKey TypeInTargetAssembly={x:Type ad:DockingManager}, ResourceId={x:Static ad:AvalonDockBrushes.DockablePaneTitleBackgroundSelected}}" |
||||||
|
StartPoint="0,0" |
||||||
|
EndPoint="0,1"> |
||||||
|
<LinearGradientBrush.GradientStops> |
||||||
|
<GradientStop Color="#FF3B80ED" |
||||||
|
Offset="0"/> |
||||||
|
<GradientStop Color="#FF316AC5" |
||||||
|
Offset="1"/> |
||||||
|
</LinearGradientBrush.GradientStops> |
||||||
|
</LinearGradientBrush> |
||||||
|
|
||||||
|
<SolidColorBrush |
||||||
|
x:Key="{ComponentResourceKey TypeInTargetAssembly={x:Type ad:DockingManager}, ResourceId={x:Static ad:AvalonDockBrushes.DockablePaneTitleBackground}}" |
||||||
|
Color="#FFCCC5BA"/> |
||||||
|
|
||||||
|
<SolidColorBrush |
||||||
|
x:Key="{ComponentResourceKey TypeInTargetAssembly={x:Type ad:DockingManager}, ResourceId={x:Static ad:AvalonDockBrushes.DockablePaneTitleForeground}}" |
||||||
|
Color="Black"/> |
||||||
|
|
||||||
|
<SolidColorBrush |
||||||
|
x:Key="{ComponentResourceKey TypeInTargetAssembly={x:Type ad:DockingManager}, ResourceId={x:Static ad:AvalonDockBrushes.DockablePaneTitleForegroundSelected}}" |
||||||
|
Color="White"/> |
||||||
|
|
||||||
|
|
||||||
|
<SolidColorBrush |
||||||
|
x:Key="{ComponentResourceKey TypeInTargetAssembly={x:Type ad:DockingManager}, ResourceId={x:Static ad:AvalonDockBrushes.PaneHeaderCommandBackground}}" |
||||||
|
Color="{x:Static SystemColors.ControlLightLightColor}" Opacity="0.5" /> |
||||||
|
|
||||||
|
<SolidColorBrush |
||||||
|
x:Key="{ComponentResourceKey TypeInTargetAssembly={x:Type ad:DockingManager}, ResourceId={x:Static ad:AvalonDockBrushes.PaneHeaderCommandBorderBrush}}" |
||||||
|
Color="{x:Static SystemColors.ControlDarkColor}"/> |
||||||
|
|
||||||
|
|
||||||
|
<!--Brushes for document headers--> |
||||||
|
<LinearGradientBrush x:Key="{ComponentResourceKey TypeInTargetAssembly={x:Type ad:DockingManager}, ResourceId={x:Static ad:AvalonDockBrushes.DocumentHeaderBackground}}" StartPoint="0,0" EndPoint="0,1"> |
||||||
|
<GradientStop Color="#FFFFFFFF" Offset="0" /> |
||||||
|
<GradientStop Color="#FFE0E0E0" Offset="1" /> |
||||||
|
</LinearGradientBrush> |
||||||
|
|
||||||
|
<SolidColorBrush |
||||||
|
x:Key="{ComponentResourceKey TypeInTargetAssembly={x:Type ad:DockingManager}, ResourceId={x:Static ad:AvalonDockBrushes.DocumentHeaderForeground}}" |
||||||
|
Color="{x:Static SystemColors.WindowTextColor}"/> |
||||||
|
|
||||||
|
<LinearGradientBrush x:Key="{ComponentResourceKey TypeInTargetAssembly={x:Type ad:DockingManager}, ResourceId={x:Static ad:AvalonDockBrushes.DocumentHeaderBackgroundSelected}}" StartPoint="0,0" EndPoint="0,1"> |
||||||
|
<GradientStop Color="#FFFFFFFF" Offset="0" /> |
||||||
|
<GradientStop Color="#FFC1D2EE" Offset="1" /> |
||||||
|
</LinearGradientBrush> |
||||||
|
|
||||||
|
<SolidColorBrush |
||||||
|
x:Key="{ComponentResourceKey TypeInTargetAssembly={x:Type ad:DockingManager}, ResourceId={x:Static ad:AvalonDockBrushes.DocumentHeaderBackgroundMouseOver}}" |
||||||
|
Color="White"/> |
||||||
|
|
||||||
|
</ResourceDictionary> |
||||||
@ -0,0 +1,88 @@ |
|||||||
|
<ResourceDictionary |
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" |
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
||||||
|
xmlns:ad="clr-namespace:AvalonDock"> |
||||||
|
|
||||||
|
<ResourceDictionary.MergedDictionaries> |
||||||
|
<ResourceDictionary Source="/AvalonDock;component/Resources/Brushes.xaml"/> |
||||||
|
</ResourceDictionary.MergedDictionaries> |
||||||
|
|
||||||
|
<ContextMenu |
||||||
|
x:Key="{ComponentResourceKey TypeInTargetAssembly={x:Type ad:DockingManager}, ResourceId={x:Static ad:ContextMenuElement.DockableFloatingWindow}}"> |
||||||
|
<MenuItem Command="ad:ManagedContentCommands.Show"/> |
||||||
|
<MenuItem Command="ad:ManagedContentCommands.Hide"/> |
||||||
|
<MenuItem Command="ad:DockableContentCommands.ShowAsDocument"/> |
||||||
|
<Separator/> |
||||||
|
<MenuItem Command="ad:DockableFloatingWindowCommands.SetAsFloatingWindow"/> |
||||||
|
<MenuItem Command="ad:DockableFloatingWindowCommands.SetAsDockableWindow"/> |
||||||
|
</ContextMenu> |
||||||
|
|
||||||
|
<ContextMenu |
||||||
|
x:Key="{ComponentResourceKey TypeInTargetAssembly={x:Type ad:DockingManager}, ResourceId={x:Static ad:ContextMenuElement.DocumentFloatingWindow}}"> |
||||||
|
<MenuItem Command="ad:ManagedContentCommands.Close"/> |
||||||
|
<Separator/> |
||||||
|
<MenuItem Command="ad:DocumentContentCommands.FloatingDocument"/> |
||||||
|
<MenuItem Command="ad:DocumentContentCommands.TabbedDocument"/> |
||||||
|
</ContextMenu> |
||||||
|
|
||||||
|
<!--Resizer--> |
||||||
|
<Style x:Key="{x:Type ad:Resizer}" TargetType="{x:Type ad:Resizer}"> |
||||||
|
<Setter Property="Background" Value="Transparent"/> |
||||||
|
<Setter Property="Template"> |
||||||
|
<Setter.Value> |
||||||
|
<ControlTemplate TargetType="{x:Type ad:Resizer}"> |
||||||
|
<Border Background="{TemplateBinding Background}"/> |
||||||
|
</ControlTemplate> |
||||||
|
</Setter.Value> |
||||||
|
</Setter> |
||||||
|
</Style> |
||||||
|
|
||||||
|
<!--PaneHeaderCommandStyle--> |
||||||
|
<Style x:Key="PaneHeaderCommandStyle" TargetType="{x:Type Button}"> |
||||||
|
<Setter Property="Template"> |
||||||
|
<Setter.Value> |
||||||
|
<ControlTemplate TargetType="{x:Type Button}"> |
||||||
|
<Border |
||||||
|
x:Name="PaneHeaderCommandIntBorder" |
||||||
|
Background="Transparent" |
||||||
|
BorderThickness="1" |
||||||
|
Margin="0" |
||||||
|
Opacity="0.8"> |
||||||
|
<ContentPresenter/> |
||||||
|
</Border> |
||||||
|
<ControlTemplate.Triggers> |
||||||
|
<Trigger Property="IsMouseOver" Value="True"> |
||||||
|
<Setter Property="BorderBrush" |
||||||
|
TargetName="PaneHeaderCommandIntBorder" |
||||||
|
Value="{DynamicResource {ComponentResourceKey {x:Type ad:DockingManager}, {x:Static ad:AvalonDockBrushes.PaneHeaderCommandBorderBrush}}}"/> |
||||||
|
<Setter Property="Background" |
||||||
|
TargetName="PaneHeaderCommandIntBorder" |
||||||
|
Value="{DynamicResource {ComponentResourceKey {x:Type ad:DockingManager}, {x:Static ad:AvalonDockBrushes.PaneHeaderCommandBackground}}}"/> |
||||||
|
<Setter Property="Opacity" |
||||||
|
TargetName="PaneHeaderCommandIntBorder" |
||||||
|
Value="1"/> |
||||||
|
</Trigger> |
||||||
|
</ControlTemplate.Triggers> |
||||||
|
</ControlTemplate> |
||||||
|
</Setter.Value> |
||||||
|
</Setter> |
||||||
|
</Style> |
||||||
|
|
||||||
|
<!--PaneHeaderContextMenuCommandStyle--> |
||||||
|
<Style x:Key="PaneHeaderContextMenuCommandStyle" |
||||||
|
TargetType="{x:Type Border}"> |
||||||
|
<Setter Property="Background" Value="Transparent"/> |
||||||
|
<Setter Property="BorderThickness" Value="1"/> |
||||||
|
<Style.Triggers> |
||||||
|
<Trigger Property="IsMouseOver" Value="True"> |
||||||
|
<Setter Property="BorderBrush" |
||||||
|
Value="{DynamicResource {ComponentResourceKey {x:Type ad:DockingManager}, {x:Static ad:AvalonDockBrushes.PaneHeaderCommandBorderBrush}}}"/> |
||||||
|
<Setter Property="Background" |
||||||
|
Value="{DynamicResource {ComponentResourceKey {x:Type ad:DockingManager}, {x:Static ad:AvalonDockBrushes.PaneHeaderCommandBackground}}}"/> |
||||||
|
<Setter Property="Opacity" |
||||||
|
Value="1"/> |
||||||
|
</Trigger> |
||||||
|
</Style.Triggers> |
||||||
|
|
||||||
|
</Style> |
||||||
|
</ResourceDictionary> |
||||||
@ -0,0 +1,232 @@ |
|||||||
|
<ResourceDictionary |
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" |
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
||||||
|
xmlns:ad="clr-namespace:AvalonDock" |
||||||
|
xmlns:adRes="clr-namespace:AvalonDock.Properties;assembly=AvalonDock" |
||||||
|
> |
||||||
|
|
||||||
|
<ResourceDictionary.MergedDictionaries> |
||||||
|
<ResourceDictionary Source="/AvalonDock;component/Resources/Brushes.xaml"/> |
||||||
|
<ResourceDictionary Source="/AvalonDock;component/Resources/Common.xaml"/> |
||||||
|
<ResourceDictionary Source="/AvalonDock;component/Resources/ManagedContentStyle.xaml"/> |
||||||
|
</ResourceDictionary.MergedDictionaries> |
||||||
|
|
||||||
|
|
||||||
|
<ContextMenu |
||||||
|
x:Key="{ComponentResourceKey TypeInTargetAssembly={x:Type ad:DockingManager}, ResourceId={x:Static ad:ContextMenuElement.DockablePane}}" |
||||||
|
> |
||||||
|
<MenuItem |
||||||
|
Command="ad:DockableContentCommands.FloatingWindow" /> |
||||||
|
<MenuItem |
||||||
|
Command="ad:ManagedContentCommands.Show" /> |
||||||
|
<MenuItem |
||||||
|
Command="ad:DockableContentCommands.ShowAsDocument" /> |
||||||
|
<MenuItem |
||||||
|
Command="ad:DockableContentCommands.ToggleAutoHide" /> |
||||||
|
<MenuItem |
||||||
|
Command="ad:ManagedContentCommands.Hide" |
||||||
|
Visibility="{Binding Path=IsCloseable, Converter={x:Static ad:Converters.BoolToVisibilityConverter}}" /> |
||||||
|
</ContextMenu> |
||||||
|
|
||||||
|
|
||||||
|
<!--DockableContentTabItemStyle--> |
||||||
|
<Style x:Key="DockableContentTabItemStyle" TargetType="{x:Type ad:DockableContent}"> |
||||||
|
<Setter Property="FocusVisualStyle" Value="{x:Null}"/> |
||||||
|
<Setter Property="Template"> |
||||||
|
<Setter.Value> |
||||||
|
<ControlTemplate TargetType="{x:Type ad:DockableContent}"> |
||||||
|
<Grid SnapsToDevicePixels="True"> |
||||||
|
<Border |
||||||
|
x:Name="PART_DragArea" |
||||||
|
BorderBrush="{StaticResource ManagedContentTabControlNormalBorderBrush}" |
||||||
|
BorderThickness="1,0,1,1" |
||||||
|
Margin="0,2,0,0" |
||||||
|
CornerRadius="0,0,3,3" |
||||||
|
Background="{StaticResource ManagedContentTabItemNormalBackground}" |
||||||
|
> |
||||||
|
<Border x:Name="tabItemIntBorder" |
||||||
|
Margin="0,1,0,2" |
||||||
|
BorderBrush="{StaticResource ManagedContentTabControlNormalBorderBrush}"> |
||||||
|
<Grid Margin="4,0,4,0"> |
||||||
|
<Grid.ColumnDefinitions> |
||||||
|
<ColumnDefinition Width="Auto"/> |
||||||
|
<ColumnDefinition Width="*"/> |
||||||
|
</Grid.ColumnDefinitions> |
||||||
|
<Image x:Name="Icon" Width="16" Source="{TemplateBinding Icon}" UseLayoutRounding="True"/> |
||||||
|
<TextBlock |
||||||
|
x:Name="tabItemTitle" |
||||||
|
Grid.Column="1" |
||||||
|
TextTrimming="CharacterEllipsis" TextWrapping="NoWrap" |
||||||
|
Text="{TemplateBinding Title}" |
||||||
|
Margin="2,0,0,0" VerticalAlignment="Center" |
||||||
|
Foreground="{DynamicResource {x:Static SystemColors.ControlDarkBrushKey}}"/> |
||||||
|
</Grid> |
||||||
|
</Border> |
||||||
|
</Border> |
||||||
|
<Border x:Name="HighlightBorder" |
||||||
|
Height="3" |
||||||
|
VerticalAlignment="Bottom" |
||||||
|
BorderThickness="0,0,0,0" |
||||||
|
CornerRadius ="0,0,3,3" |
||||||
|
BorderBrush="#FFE68B2C" |
||||||
|
Background="{StaticResource ManagedContentTabItemSelectedBorderBackround}" |
||||||
|
Visibility="Hidden" |
||||||
|
/> |
||||||
|
</Grid> |
||||||
|
|
||||||
|
<ControlTemplate.Triggers> |
||||||
|
<Trigger Property="Selector.IsSelected" |
||||||
|
Value="true"> |
||||||
|
<Setter Property="BorderThickness" |
||||||
|
Value="0" TargetName="tabItemIntBorder"/> |
||||||
|
<Setter Property="BorderThickness" |
||||||
|
Value="1,0,1,0" TargetName="PART_DragArea"/> |
||||||
|
<Setter Property="Background" |
||||||
|
Value="#FFFCFCFE" TargetName="PART_DragArea"/> |
||||||
|
<Setter Property="CornerRadius" |
||||||
|
Value="0,0,3,3" TargetName="PART_DragArea"/> |
||||||
|
<Setter Property="Visibility" |
||||||
|
Value="Visible" TargetName="HighlightBorder"/> |
||||||
|
<Setter Property="Foreground" |
||||||
|
Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" TargetName="tabItemTitle"/> |
||||||
|
<Setter Property="Margin" |
||||||
|
Value="0,3,0,2" TargetName="tabItemIntBorder"/> |
||||||
|
<Setter Property="Margin" |
||||||
|
Value="0,1,0,0" TargetName="PART_DragArea"/> |
||||||
|
</Trigger> |
||||||
|
<Trigger Property="IsMouseOver" |
||||||
|
Value="true"> |
||||||
|
<Setter Property="Visibility" |
||||||
|
Value="Visible" TargetName="HighlightBorder"/> |
||||||
|
</Trigger> |
||||||
|
<Trigger Property="Icon" |
||||||
|
Value="{x:Null}"> |
||||||
|
<Setter TargetName="Icon" |
||||||
|
Property="Visibility" |
||||||
|
Value="Collapsed"/> |
||||||
|
</Trigger> |
||||||
|
</ControlTemplate.Triggers> |
||||||
|
</ControlTemplate> |
||||||
|
</Setter.Value> |
||||||
|
</Setter> |
||||||
|
</Style> |
||||||
|
|
||||||
|
<!--DockablePane--> |
||||||
|
<Style x:Key="{x:Type ad:DockablePane}" TargetType="{x:Type ad:DockablePane}"> |
||||||
|
<Setter Property="Background" Value="{DynamicResource {ComponentResourceKey {x:Type ad:DockingManager}, {x:Static ad:AvalonDockBrushes.DefaultBackgroundBrush}}}"/> |
||||||
|
<Setter Property="FocusVisualStyle" Value="{x:Null}"/> |
||||||
|
<Setter Property="Template"> |
||||||
|
<Setter.Value> |
||||||
|
<ControlTemplate TargetType="{x:Type ad:DockablePane}"><!--Background="{TemplateBinding Background}"--> |
||||||
|
<Border |
||||||
|
Focusable="False" |
||||||
|
Background="{TemplateBinding Background}"> |
||||||
|
<Grid FocusManager.FocusedElement="{Binding ElementName=PART_SelectedContent}"> |
||||||
|
<Grid.RowDefinitions> |
||||||
|
<RowDefinition Height="Auto"/> |
||||||
|
<RowDefinition Height="*"/> |
||||||
|
<RowDefinition Height="Auto"/> |
||||||
|
</Grid.RowDefinitions> |
||||||
|
<Border x:Name="PART_Header" |
||||||
|
Grid.Row="0" Focusable="False" |
||||||
|
Background="{DynamicResource {ComponentResourceKey {x:Type ad:DockingManager}, {x:Static ad:AvalonDockBrushes.DockablePaneTitleBackground}}}" |
||||||
|
BorderThickness="1,1,1,0" |
||||||
|
BorderBrush="DarkGray" |
||||||
|
Height="18"> |
||||||
|
<DockPanel LastChildFill="True"> |
||||||
|
<Button DockPanel.Dock="Right" Width="15" Height="15" Style="{StaticResource PaneHeaderCommandStyle}" Command="ad:DockablePaneCommands.Close" Visibility="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=SelectedItem.IsCloseable, Converter={x:Static ad:Converters.BoolToVisibilityConverter}}" ToolTip="{x:Static adRes:Resources.DockablePaneCommands_Close}"> |
||||||
|
<!--<ad:AlignedImage>--> |
||||||
|
<Image Source="Images\PinClose.png" Width="13" UseLayoutRounding="True"/> |
||||||
|
<!--</ad:AlignedImage>--> |
||||||
|
</Button> |
||||||
|
<Button x:Name="btnPinAutoHide" DockPanel.Dock="Right" Width="15" Height="15" Style="{StaticResource PaneHeaderCommandStyle}" Command="ad:DockablePaneCommands.ToggleAutoHide" ToolTip="{x:Static adRes:Resources.DockablePaneCommands_ToggleAutoHide}"> |
||||||
|
<!--<ad:AlignedImage>--> |
||||||
|
<Image Source="Images\PinAutoHide.png" Width="13" UseLayoutRounding="True"/> |
||||||
|
<!--</ad:AlignedImage>--> |
||||||
|
</Button> |
||||||
|
<Border x:Name="PART_ShowContextMenuButton" DockPanel.Dock="Right" Width="15" Height="15" Style="{StaticResource PaneHeaderContextMenuCommandStyle}" ToolTip="{x:Static adRes:Resources.DockablePane_ShowOptionsMenu}"> |
||||||
|
<!--<ad:AlignedImage>--> |
||||||
|
<Image Source="Images\PinMenu.png" Width="13" UseLayoutRounding="True"/> |
||||||
|
<!--</ad:AlignedImage>--> |
||||||
|
</Border> |
||||||
|
<TextBlock |
||||||
|
Text="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=SelectedItem.Title}" |
||||||
|
x:Name="paneTitle" |
||||||
|
Grid.Row="0" |
||||||
|
Margin="2,0,0,0" TextTrimming="CharacterEllipsis" TextWrapping="NoWrap" |
||||||
|
VerticalAlignment="Center" |
||||||
|
Foreground="{DynamicResource {ComponentResourceKey {x:Type ad:DockingManager}, {x:Static ad:AvalonDockBrushes.DockablePaneTitleForeground}}}"/> |
||||||
|
</DockPanel> |
||||||
|
</Border> |
||||||
|
<Border Grid.Row="1" |
||||||
|
BorderThickness="1,0,1,1" |
||||||
|
BorderBrush="DarkGray" |
||||||
|
Background="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=SelectedItem.Background}"> |
||||||
|
<ContentPresenter |
||||||
|
x:Name="PART_SelectedContent" |
||||||
|
Content="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=SelectedItem.Content}" |
||||||
|
KeyboardNavigation.TabNavigation="Local" |
||||||
|
KeyboardNavigation.DirectionalNavigation="Contained" |
||||||
|
KeyboardNavigation.TabIndex="1" |
||||||
|
/> |
||||||
|
</Border> |
||||||
|
<Border x:Name="PART_Tabs" |
||||||
|
Grid.Row="2" |
||||||
|
Margin ="0,2,0,0" |
||||||
|
Height ="25" |
||||||
|
BorderThickness="0,1,0,0" |
||||||
|
BorderBrush="{StaticResource ManagedContentTabControlNormalBorderBrush}" |
||||||
|
> |
||||||
|
</Border> |
||||||
|
<ad:DockableTabPanel |
||||||
|
Grid.Row="2" |
||||||
|
Height ="24" |
||||||
|
KeyboardNavigation.TabIndex="2" |
||||||
|
IsItemsHost="True" |
||||||
|
x:Name="paneTabsPanel" |
||||||
|
Margin="0,0,0,2" |
||||||
|
TabItemStyle="{StaticResource DockableContentTabItemStyle}"/> |
||||||
|
</Grid> |
||||||
|
</Border> |
||||||
|
|
||||||
|
<ControlTemplate.Triggers> |
||||||
|
<!--<Trigger Property="IsKeyboardFocusWithin" Value="True"> |
||||||
|
<Setter Property="Background" Value="{StaticResource DockablePaneTitleBackground}" TargetName="PART_Header"/> |
||||||
|
<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ActiveCaptionTextBrushKey}}" TargetName="paneTitle"/> |
||||||
|
</Trigger>--> |
||||||
|
<DataTrigger Binding="{Binding RelativeSource={RelativeSource Self}, Path=SelectedItem.IsActiveContent}" Value="True" > |
||||||
|
<Setter Property="Background" Value="{DynamicResource {ComponentResourceKey {x:Type ad:DockingManager}, {x:Static ad:AvalonDockBrushes.DockablePaneTitleBackgroundSelected}}}" TargetName="PART_Header"/> |
||||||
|
<Setter Property="Foreground" Value="{DynamicResource {ComponentResourceKey {x:Type ad:DockingManager}, {x:Static ad:AvalonDockBrushes.DockablePaneTitleForegroundSelected}}}" TargetName="paneTitle"/> |
||||||
|
</DataTrigger> |
||||||
|
<!--<DataTrigger Binding="{Binding RelativeSource={RelativeSource Self}, Path=IsOptionsMenuOpened}" Value="True" > |
||||||
|
<Setter Property="Background" Value="{DynamicResource {x:Static SystemColors.ActiveCaptionBrushKey}}" TargetName="PART_Header"/> |
||||||
|
<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ActiveCaptionTextBrushKey}}" TargetName="paneTitle"/> |
||||||
|
</DataTrigger>--> |
||||||
|
<Trigger Property ="ShowHeader" Value="False"> |
||||||
|
<Setter Property="Visibility" Value="Collapsed" TargetName="PART_Header"/> |
||||||
|
</Trigger> |
||||||
|
<Trigger Property ="ShowTabs" Value="False"> |
||||||
|
<Setter Property="Visibility" Value="Collapsed" TargetName="PART_Tabs"/> |
||||||
|
</Trigger> |
||||||
|
<Trigger Property ="HasSingleItem" Value="True"> |
||||||
|
<Setter Property="Visibility" Value="Collapsed" TargetName="PART_Tabs"/> |
||||||
|
<Setter Property="Visibility" Value="Collapsed" TargetName="paneTabsPanel"/> |
||||||
|
</Trigger> |
||||||
|
|
||||||
|
<DataTrigger Binding="{Binding RelativeSource={RelativeSource Self}, Path=SelectedItem.State}" Value="AutoHide"> |
||||||
|
<Setter Property="LayoutTransform" TargetName="btnPinAutoHide"> |
||||||
|
<Setter.Value> |
||||||
|
<RotateTransform Angle="90"/> |
||||||
|
</Setter.Value> |
||||||
|
</Setter> |
||||||
|
</DataTrigger> |
||||||
|
|
||||||
|
|
||||||
|
</ControlTemplate.Triggers> |
||||||
|
|
||||||
|
|
||||||
|
</ControlTemplate> |
||||||
|
</Setter.Value> |
||||||
|
</Setter> |
||||||
|
</Style> |
||||||
|
</ResourceDictionary> |
||||||
@ -0,0 +1,141 @@ |
|||||||
|
<ResourceDictionary |
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" |
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
||||||
|
xmlns:ad="clr-namespace:AvalonDock" |
||||||
|
> |
||||||
|
|
||||||
|
<ResourceDictionary.MergedDictionaries> |
||||||
|
<ResourceDictionary Source="/AvalonDock;component/Resources/Brushes.xaml"/> |
||||||
|
</ResourceDictionary.MergedDictionaries> |
||||||
|
|
||||||
|
<!--DockablePaneAnchorTab--> |
||||||
|
<Style x:Key="{x:Type ad:DockablePaneAnchorTab}" TargetType="{x:Type ad:DockablePaneAnchorTab}"> |
||||||
|
<Setter Property="Template"> |
||||||
|
<Setter.Value> |
||||||
|
<ControlTemplate TargetType="{x:Type ad:DockablePaneAnchorTab}"> |
||||||
|
<Grid> |
||||||
|
<Border |
||||||
|
Name="PART_Border" CornerRadius="0,0,3,3" BorderThickness="1" |
||||||
|
BorderBrush="{StaticResource ManagedContentTabControlNormalBorderBrush}" |
||||||
|
Background="{StaticResource ManagedContentTabItemNormalBackground}"> |
||||||
|
<StackPanel Orientation="Horizontal"> |
||||||
|
<Image x:Name="borderIcon" Width="16" Source="{TemplateBinding Icon}" UseLayoutRounding="True"/> |
||||||
|
<TextBlock |
||||||
|
Text="{TemplateBinding Title}" |
||||||
|
Foreground="{DynamicResource {x:Static SystemColors.WindowTextBrushKey}}" |
||||||
|
Margin="4,2,2,2"/> |
||||||
|
</StackPanel> |
||||||
|
</Border> |
||||||
|
<Border x:Name="HighlightBorder" |
||||||
|
Height="3" |
||||||
|
VerticalAlignment="Bottom" |
||||||
|
BorderThickness="0,0,0,0" |
||||||
|
CornerRadius ="0,0,3,3" |
||||||
|
BorderBrush="#FFE68B2C" |
||||||
|
Background="{StaticResource ManagedContentTabItemSelectedBorderBackround}" |
||||||
|
Visibility="Hidden" |
||||||
|
/> |
||||||
|
</Grid> |
||||||
|
<ControlTemplate.Triggers> |
||||||
|
<Trigger Property="Anchor" > |
||||||
|
<Trigger.Value> |
||||||
|
<ad:AnchorStyle> |
||||||
|
Left |
||||||
|
</ad:AnchorStyle> |
||||||
|
</Trigger.Value> |
||||||
|
<Setter TargetName="PART_Border" Property="CornerRadius" Value="3,3,0,0"/> |
||||||
|
<Setter TargetName="PART_Border" Property="Background" Value="{StaticResource ManagedContentTabItemInvNormalBackground}"/> |
||||||
|
<Setter TargetName="HighlightBorder" Property="CornerRadius" Value="3,3,0,0"/> |
||||||
|
<Setter Property="VerticalAlignment" Value="Top" TargetName="HighlightBorder"/> |
||||||
|
</Trigger> |
||||||
|
<Trigger Property="Anchor"> |
||||||
|
<Trigger.Value> |
||||||
|
<ad:AnchorStyle> |
||||||
|
Bottom |
||||||
|
</ad:AnchorStyle> |
||||||
|
</Trigger.Value> |
||||||
|
<Setter TargetName="PART_Border" Property="CornerRadius" Value="3,3,0,0"/> |
||||||
|
<Setter TargetName="PART_Border" Property="Background" Value="{StaticResource ManagedContentTabItemInvNormalBackground}"/> |
||||||
|
<Setter TargetName="HighlightBorder" Property="CornerRadius" Value="3,3,0,0"/> |
||||||
|
<Setter Property="VerticalAlignment" Value="Top" TargetName="HighlightBorder"/> |
||||||
|
</Trigger> |
||||||
|
|
||||||
|
<Trigger Property="IsMouseOver" Value="True"> |
||||||
|
<Setter Property="Visibility" Value="Visible" TargetName="HighlightBorder"/> |
||||||
|
</Trigger> |
||||||
|
</ControlTemplate.Triggers> |
||||||
|
</ControlTemplate> |
||||||
|
</Setter.Value> |
||||||
|
</Setter> |
||||||
|
</Style> |
||||||
|
|
||||||
|
<!--DockablePaneAnchorTabGroup--> |
||||||
|
<Style x:Key="{x:Type ad:DockablePaneAnchorTabGroup}" TargetType="{x:Type ad:DockablePaneAnchorTabGroup}"> |
||||||
|
<Setter Property="Orientation" Value="Horizontal"/> |
||||||
|
<Setter Property="Margin" Value="3,0,0,0"/> |
||||||
|
</Style> |
||||||
|
|
||||||
|
<!--DockingManager--> |
||||||
|
<Style x:Key="{x:Type ad:DockingManager}" TargetType="{x:Type ad:DockingManager}"> |
||||||
|
<Setter Property="Background" Value="{DynamicResource {ComponentResourceKey {x:Type ad:DockingManager}, {x:Static ad:AvalonDockBrushes.DefaultBackgroundBrush}}}"/> |
||||||
|
<Setter Property="FocusVisualStyle" Value="{x:Null}"/> |
||||||
|
<Setter Property="Template"> |
||||||
|
<Setter.Value> |
||||||
|
<ControlTemplate TargetType="{x:Type ad:DockingManager}"> |
||||||
|
<Grid |
||||||
|
Background="{TemplateBinding Background}" |
||||||
|
> |
||||||
|
<Grid.ColumnDefinitions> |
||||||
|
<ColumnDefinition Width="Auto"/> |
||||||
|
<ColumnDefinition/> |
||||||
|
<ColumnDefinition Width="Auto"/> |
||||||
|
</Grid.ColumnDefinitions> |
||||||
|
<Grid.RowDefinitions> |
||||||
|
<RowDefinition Height="Auto"/> |
||||||
|
<RowDefinition/> |
||||||
|
<RowDefinition Height="Auto"/> |
||||||
|
</Grid.RowDefinitions> |
||||||
|
<StackPanel Name="PART_LeftAnchorTabPanel" |
||||||
|
Grid.Column="0" Grid.Row="1" Orientation="Vertical"> |
||||||
|
<StackPanel.Resources> |
||||||
|
<Style TargetType="{x:Type ad:DockablePaneAnchorTabGroup}"> |
||||||
|
<Setter Property="LayoutTransform"> |
||||||
|
<Setter.Value > |
||||||
|
<RotateTransform Angle="90"/> |
||||||
|
</Setter.Value> |
||||||
|
</Setter> |
||||||
|
<Setter Property="Margin" Value="0,2,2,0"/> |
||||||
|
</Style> |
||||||
|
<Style TargetType="Border"> |
||||||
|
<Setter Property="CornerRadius" Value="0,0,3,3"/> |
||||||
|
</Style> |
||||||
|
</StackPanel.Resources> |
||||||
|
</StackPanel> |
||||||
|
<StackPanel Name="PART_RightAnchorTabPanel" Grid.Column="2" Grid.Row="1" Orientation="Vertical"> |
||||||
|
<StackPanel.Resources> |
||||||
|
<Style TargetType="{x:Type ad:DockablePaneAnchorTabGroup}"> |
||||||
|
<Setter Property="LayoutTransform"> |
||||||
|
<Setter.Value > |
||||||
|
<RotateTransform Angle="90"/> |
||||||
|
</Setter.Value> |
||||||
|
</Setter> |
||||||
|
<Setter Property="Margin" Value="2,2,0,0"/> |
||||||
|
</Style> |
||||||
|
<Style TargetType="Border"> |
||||||
|
<Setter Property="CornerRadius" Value="3,3,0,0"/> |
||||||
|
</Style> |
||||||
|
</StackPanel.Resources> |
||||||
|
</StackPanel> |
||||||
|
<StackPanel Name="PART_TopAnchorTabPanel" Grid.Column="1" Grid.Row="0" Orientation="Horizontal"/> |
||||||
|
<StackPanel Name="PART_BottomAnchorTabPanel" Grid.Column="1" Grid.Row="2" Orientation="Horizontal"/> |
||||||
|
<Border |
||||||
|
Background="{TemplateBinding Background}" |
||||||
|
Grid.Column="1" Grid.Row="1"> |
||||||
|
<ContentPresenter /> |
||||||
|
</Border> |
||||||
|
</Grid> |
||||||
|
</ControlTemplate> |
||||||
|
</Setter.Value> |
||||||
|
</Setter> |
||||||
|
</Style> |
||||||
|
</ResourceDictionary> |
||||||
@ -0,0 +1,131 @@ |
|||||||
|
<ResourceDictionary |
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" |
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
||||||
|
xmlns:ad="clr-namespace:AvalonDock"> |
||||||
|
|
||||||
|
<ResourceDictionary.MergedDictionaries> |
||||||
|
<ResourceDictionary Source="/AvalonDock;component/Resources/Brushes.xaml"/> |
||||||
|
<ResourceDictionary Source="/AvalonDock;component/Resources/Common.xaml"/> |
||||||
|
</ResourceDictionary.MergedDictionaries> |
||||||
|
|
||||||
|
<!--DocumentNavigatorWindow--> |
||||||
|
<Style x:Key="{x:Type ad:DocumentNavigatorWindow}" TargetType="{x:Type ad:DocumentNavigatorWindow}"> |
||||||
|
<Style.Resources> |
||||||
|
<Style x:Key="listItemStyle" TargetType="ListBoxItem"> |
||||||
|
<Setter Property="Template"> |
||||||
|
<Setter.Value> |
||||||
|
<ControlTemplate TargetType="ListBoxItem"> |
||||||
|
<Border x:Name="extBorder" > |
||||||
|
<ContentPresenter Margin="0,2,0,2"/> |
||||||
|
</Border> |
||||||
|
<ControlTemplate.Triggers> |
||||||
|
<Trigger Property="IsSelected" Value="True"> |
||||||
|
<Setter Property="Background" TargetName="extBorder" Value="{DynamicResource {x:Static SystemColors.ActiveCaptionBrushKey}}"/> |
||||||
|
</Trigger> |
||||||
|
</ControlTemplate.Triggers> |
||||||
|
</ControlTemplate> |
||||||
|
</Setter.Value> |
||||||
|
</Setter> |
||||||
|
</Style> |
||||||
|
|
||||||
|
<Style x:Key="listBoxStyle" TargetType="ListBox"> |
||||||
|
<Setter Property="Template"> |
||||||
|
<Setter.Value> |
||||||
|
<ControlTemplate TargetType="ListBox"> |
||||||
|
<ScrollViewer> |
||||||
|
<ItemsPresenter/> |
||||||
|
</ScrollViewer> |
||||||
|
</ControlTemplate> |
||||||
|
</Setter.Value> |
||||||
|
</Setter> |
||||||
|
</Style> |
||||||
|
|
||||||
|
<DataTemplate x:Key="listContentTemplate" DataType="{x:Type ad:NavigatorWindowItem}"> |
||||||
|
<StackPanel |
||||||
|
Orientation="Vertical" |
||||||
|
HorizontalAlignment="Center" |
||||||
|
Margin="5" |
||||||
|
|
||||||
|
> |
||||||
|
|
||||||
|
<Border x:Name="intBorder" CornerRadius="2" BorderThickness="1" > |
||||||
|
<Border BorderThickness="1" BorderBrush="DarkGray" Background="{DynamicResource {ComponentResourceKey {x:Type ad:DockingManager}, {x:Static ad:AvalonDockBrushes.DefaultBackgroundBrush}}}" HorizontalAlignment="Right" Width="200" Height="200" Margin="5"> |
||||||
|
<Border> |
||||||
|
<Border.Background> |
||||||
|
<VisualBrush AlignmentX="Left" AlignmentY="Top" Stretch="Uniform" Visual="{Binding Path=ItemContent.Content, Mode=OneWay}"/> |
||||||
|
</Border.Background> |
||||||
|
</Border> |
||||||
|
<Border.BitmapEffect> |
||||||
|
<DropShadowBitmapEffect Color="DarkGray" ShadowDepth="4"/> |
||||||
|
</Border.BitmapEffect> |
||||||
|
</Border> |
||||||
|
</Border> |
||||||
|
|
||||||
|
<TextBlock HorizontalAlignment="Center" Margin="0,4,0,0" Text="{Binding Path=Title}"/> |
||||||
|
|
||||||
|
</StackPanel> |
||||||
|
<DataTemplate.Triggers> |
||||||
|
<Trigger Property="IsMouseOver" Value="True"> |
||||||
|
<Setter Property="BorderBrush" TargetName="intBorder" Value="{DynamicResource {x:Static SystemColors.ActiveCaptionBrushKey}}"/> |
||||||
|
<Setter Property="Background" TargetName="intBorder" Value="{DynamicResource {x:Static SystemColors.ActiveCaptionBrushKey}}"/> |
||||||
|
</Trigger> |
||||||
|
</DataTemplate.Triggers> |
||||||
|
|
||||||
|
</DataTemplate> |
||||||
|
</Style.Resources> |
||||||
|
<Setter Property="Template"> |
||||||
|
<Setter.Value> |
||||||
|
<ControlTemplate TargetType="{x:Type ad:DocumentNavigatorWindow}"> |
||||||
|
<Grid> |
||||||
|
<Border |
||||||
|
BorderThickness="1" |
||||||
|
BorderBrush="DarkGray" |
||||||
|
CornerRadius="5" |
||||||
|
Background="{DynamicResource {ComponentResourceKey {x:Type ad:DockingManager}, {x:Static ad:AvalonDockBrushes.DefaultBackgroundBrush}}}" |
||||||
|
> |
||||||
|
<Grid> |
||||||
|
<Grid.RowDefinitions> |
||||||
|
<RowDefinition Height="20"/> |
||||||
|
<RowDefinition Height="*"/> |
||||||
|
</Grid.RowDefinitions> |
||||||
|
<TextBlock |
||||||
|
Text="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=SelectedContent.Title}" |
||||||
|
FontSize="20" |
||||||
|
HorizontalAlignment="Center" |
||||||
|
VerticalAlignment="Center" |
||||||
|
Grid.Row="0" |
||||||
|
> |
||||||
|
<TextBlock.BitmapEffect> |
||||||
|
<OuterGlowBitmapEffect GlowColor="White" GlowSize="10" /> |
||||||
|
</TextBlock.BitmapEffect> |
||||||
|
|
||||||
|
</TextBlock> |
||||||
|
<ListBox |
||||||
|
x:Name="PART_ScrollingPanel" |
||||||
|
Grid.Row="1" |
||||||
|
ItemsSource="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Documents}" |
||||||
|
ItemTemplate="{StaticResource listContentTemplate}" |
||||||
|
ItemContainerStyle="{StaticResource listItemStyle}" |
||||||
|
SelectedItem="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=SelectedContent, Mode=TwoWay}" |
||||||
|
ScrollViewer.VerticalScrollBarVisibility="Auto" |
||||||
|
ScrollViewer.HorizontalScrollBarVisibility="Disabled" |
||||||
|
ScrollViewer.IsDeferredScrollingEnabled="True" |
||||||
|
Style="{StaticResource listBoxStyle}" |
||||||
|
> |
||||||
|
<ListBox.ItemsPanel> |
||||||
|
<ItemsPanelTemplate> |
||||||
|
<WrapPanel /> |
||||||
|
</ItemsPanelTemplate> |
||||||
|
</ListBox.ItemsPanel> |
||||||
|
</ListBox> |
||||||
|
|
||||||
|
</Grid> |
||||||
|
</Border> |
||||||
|
</Grid> |
||||||
|
</ControlTemplate> |
||||||
|
</Setter.Value> |
||||||
|
</Setter> |
||||||
|
</Style> |
||||||
|
|
||||||
|
|
||||||
|
</ResourceDictionary> |
||||||
@ -0,0 +1,219 @@ |
|||||||
|
<ResourceDictionary |
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" |
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
||||||
|
xmlns:ad="clr-namespace:AvalonDock"> |
||||||
|
|
||||||
|
<ResourceDictionary.MergedDictionaries> |
||||||
|
<ResourceDictionary Source="/AvalonDock;component/Resources/Brushes.xaml"/> |
||||||
|
<ResourceDictionary Source="/AvalonDock;component/Resources/Common.xaml"/> |
||||||
|
</ResourceDictionary.MergedDictionaries> |
||||||
|
|
||||||
|
<ContextMenu x:Key="{ComponentResourceKey TypeInTargetAssembly={x:Type ad:DockingManager}, ResourceId={x:Static ad:ContextMenuElement.DocumentPane}}"> |
||||||
|
<MenuItem Command="ad:DocumentPaneCommands.CloseThis" /> |
||||||
|
<MenuItem Command="ad:DocumentPaneCommands.CloseAllButThis" /> |
||||||
|
<Separator/> |
||||||
|
<MenuItem Command="ad:DocumentPaneCommands.NewHorizontalTabGroup"> |
||||||
|
<MenuItem.Icon> |
||||||
|
<Image Source="/AvalonDock;component/resources/Images/HTabGroup.png" Width="13" Height="14" UseLayoutRounding="True"/> |
||||||
|
</MenuItem.Icon> |
||||||
|
</MenuItem> |
||||||
|
<MenuItem |
||||||
|
Command="ad:DocumentPaneCommands.NewVerticalTabGroup"> |
||||||
|
<MenuItem.Icon> |
||||||
|
<Image Source="/AvalonDock;component/resources/Images/VTabGroup.png" Width="13" UseLayoutRounding="True" /> |
||||||
|
</MenuItem.Icon> |
||||||
|
</MenuItem> |
||||||
|
</ContextMenu> |
||||||
|
|
||||||
|
|
||||||
|
<!--DocumentTabItemStyle--> |
||||||
|
<Style x:Key="DocumentTabItemStyle" TargetType="{x:Type ad:ManagedContent}"> |
||||||
|
<Setter Property="Background" |
||||||
|
Value="Transparent"/> |
||||||
|
<Setter Property="FocusVisualStyle" Value="{x:Null}"/> |
||||||
|
<Setter Property="Template"> |
||||||
|
<Setter.Value> |
||||||
|
<ControlTemplate TargetType="{x:Type ad:ManagedContent}"> |
||||||
|
<Border |
||||||
|
x:Name="PART_DragArea" |
||||||
|
BorderBrush="{StaticResource ManagedContentTabControlNormalBorderBrush}" |
||||||
|
Margin="0,0,-10,0" |
||||||
|
SnapsToDevicePixels="True" |
||||||
|
ContextMenu="{DynamicResource {ComponentResourceKey {x:Type ad:DockingManager}, {x:Static ad:ContextMenuElement.DocumentPane}}}" |
||||||
|
> |
||||||
|
<Grid> |
||||||
|
<Grid.ColumnDefinitions> |
||||||
|
<ColumnDefinition Width="20"/> |
||||||
|
<ColumnDefinition Width="*"/> |
||||||
|
</Grid.ColumnDefinitions> |
||||||
|
<!--This image with width=0 is required to connect the icon visual to the presentation source, |
||||||
|
without this navigatorwindow won't work--> |
||||||
|
<Image Source="{TemplateBinding Icon}" Width="0"/> |
||||||
|
<Path Data="M 20,0.5 Q 16,0.5 10,10 Q 5,19.5 0,19.5 L 20,19.5" |
||||||
|
x:Name="tabItemIntPathBackground" |
||||||
|
Fill="{DynamicResource {ComponentResourceKey {x:Type ad:DockingManager}, {x:Static ad:AvalonDockBrushes.DocumentHeaderBackground}}}"/> |
||||||
|
<Path |
||||||
|
x:Name="tabItemIntPathBorder" |
||||||
|
Stroke="{StaticResource ManagedContentTabControlNormalBorderBrush}" |
||||||
|
Data="M 20,0.5 Q 16,0.5 10,10 Q 5,19.5 0, 19.5" |
||||||
|
/> |
||||||
|
<Border |
||||||
|
x:Name="tabItemIntBorder" |
||||||
|
Grid.Column="1" |
||||||
|
BorderThickness="0,1,1,0" |
||||||
|
Margin="-0.5,0,0,0" |
||||||
|
CornerRadius="0,3,0,0" |
||||||
|
BorderBrush="{StaticResource ManagedContentTabControlNormalBorderBrush}" |
||||||
|
Background="{DynamicResource {ComponentResourceKey {x:Type ad:DockingManager}, {x:Static ad:AvalonDockBrushes.DocumentHeaderBackground}}}" |
||||||
|
> |
||||||
|
<StackPanel Orientation="Horizontal" |
||||||
|
Margin="5,0,4,0"> |
||||||
|
<TextBlock |
||||||
|
x:Name="tabItemTitle" |
||||||
|
TextTrimming="CharacterEllipsis" |
||||||
|
TextWrapping="NoWrap" |
||||||
|
Text="{TemplateBinding Title}" |
||||||
|
Margin="5,0,4,0" |
||||||
|
Foreground="{DynamicResource {ComponentResourceKey {x:Type ad:DockingManager}, {x:Static ad:AvalonDockBrushes.DocumentHeaderForeground}}}"/> |
||||||
|
<ad:AlignedImage x:Name="PART_LockedIcon" Margin="2,0,0,0" Visibility="Collapsed" VerticalAlignment="Center" HorizontalAlignment="Center"> |
||||||
|
<Image Source="/AvalonDock;component/resources/Images/Locked.png" Width="6" Height="8" Stretch="Uniform"/> |
||||||
|
</ad:AlignedImage> |
||||||
|
</StackPanel> |
||||||
|
</Border> |
||||||
|
</Grid> |
||||||
|
|
||||||
|
</Border> |
||||||
|
<ControlTemplate.Triggers> |
||||||
|
<Trigger Property="Selector.IsSelected" Value="True"> |
||||||
|
<Setter Property="Background" |
||||||
|
TargetName="tabItemIntBorder" |
||||||
|
Value="{DynamicResource {ComponentResourceKey {x:Type ad:DockingManager}, {x:Static ad:AvalonDockBrushes.DocumentHeaderBackgroundSelected}}}" |
||||||
|
/> |
||||||
|
<Setter Property="Fill" |
||||||
|
TargetName="tabItemIntPathBackground" |
||||||
|
Value="{DynamicResource {ComponentResourceKey {x:Type ad:DockingManager}, {x:Static ad:AvalonDockBrushes.DocumentHeaderBackgroundSelected}}}" |
||||||
|
/> |
||||||
|
<Setter Property="BorderBrush" TargetName="tabItemIntBorder" Value="#FFC1D2EE"/> |
||||||
|
<Setter Property="Stroke" TargetName="tabItemIntPathBorder" Value="#FFC1D2EE"/> |
||||||
|
</Trigger> |
||||||
|
<DataTrigger Binding="{Binding Path=IsActiveDocument, RelativeSource={RelativeSource Self}}" Value="True"> |
||||||
|
<Setter Property="TextBlock.FontWeight" TargetName="tabItemTitle" Value="Bold"/> |
||||||
|
</DataTrigger> |
||||||
|
<MultiTrigger> |
||||||
|
<MultiTrigger.Conditions> |
||||||
|
<Condition Property="IsMouseOver" SourceName="tabItemIntBorder" Value="True"/> |
||||||
|
<Condition Property="Selector.IsSelected" Value="False"/> |
||||||
|
</MultiTrigger.Conditions> |
||||||
|
<Setter Property="Background" |
||||||
|
TargetName="tabItemIntBorder" |
||||||
|
Value="{DynamicResource {ComponentResourceKey {x:Type ad:DockingManager}, {x:Static ad:AvalonDockBrushes.DocumentHeaderBackgroundMouseOver}}}" |
||||||
|
/> |
||||||
|
<Setter Property="Fill" |
||||||
|
TargetName="tabItemIntPathBackground" |
||||||
|
Value="{DynamicResource {ComponentResourceKey {x:Type ad:DockingManager}, {x:Static ad:AvalonDockBrushes.DocumentHeaderBackgroundMouseOver}}}" |
||||||
|
/> |
||||||
|
</MultiTrigger> |
||||||
|
<Trigger Property="IsLocked" Value="True"> |
||||||
|
<Setter Property="Visibility" Value="Visible" TargetName="PART_LockedIcon"/> |
||||||
|
</Trigger> |
||||||
|
<DataTrigger Binding="{Binding Path=IsLocked, RelativeSource={RelativeSource Self}}" Value="True"> |
||||||
|
<Setter Property="Visibility" Value="Visible" TargetName="PART_LockedIcon"/> |
||||||
|
</DataTrigger> |
||||||
|
|
||||||
|
</ControlTemplate.Triggers> |
||||||
|
</ControlTemplate> |
||||||
|
</Setter.Value> |
||||||
|
</Setter> |
||||||
|
</Style> |
||||||
|
|
||||||
|
|
||||||
|
<!--DocumentPane MenuItem Style--> |
||||||
|
<Style x:Key="DocumentPaneMenuItemStyle" TargetType="{x:Type MenuItem}"> |
||||||
|
<Setter Property="MenuItem.CommandTarget" Value="{Binding}"/> |
||||||
|
<Setter Property="MenuItem.Command" Value="{x:Static ad:ManagedContentCommands.Activate}"/> |
||||||
|
<Setter Property="MenuItem.Header" Value="{Binding Path=Title}"/> |
||||||
|
<Setter Property="MenuItem.Icon" Value="{Binding Icon, Converter={x:Static ad:Converters.ObjectToImageConverter}}"/> |
||||||
|
</Style> |
||||||
|
|
||||||
|
<!--DocumentPane--> |
||||||
|
<Style x:Key="{x:Type ad:DocumentPane}" TargetType="{x:Type ad:DocumentPane}"> |
||||||
|
<Setter Property="Background" Value="{DynamicResource {ComponentResourceKey {x:Type ad:DockingManager}, {x:Static ad:AvalonDockBrushes.DefaultBackgroundBrush}}}"/> |
||||||
|
<Setter Property="Focusable" Value="False"/> |
||||||
|
<Setter Property="Template"> |
||||||
|
<Setter.Value> |
||||||
|
<ControlTemplate TargetType="{x:Type ad:DocumentPane}" > |
||||||
|
<ControlTemplate.Resources> |
||||||
|
<ContextMenu x:Key="DocumentsListMenu" StaysOpen="True" ItemContainerStyle="{StaticResource DocumentPaneMenuItemStyle}"/> |
||||||
|
</ControlTemplate.Resources> |
||||||
|
<Border |
||||||
|
Focusable="False" |
||||||
|
Background="{TemplateBinding Background}" |
||||||
|
> |
||||||
|
<Grid> |
||||||
|
<Grid.RowDefinitions> |
||||||
|
<RowDefinition Height="20"/> |
||||||
|
<RowDefinition Height="*"/> |
||||||
|
</Grid.RowDefinitions> |
||||||
|
<Grid Grid.Row="1" Margin="0,-1,0,0"> |
||||||
|
<Border |
||||||
|
BorderThickness="5" |
||||||
|
BorderBrush="#FFC1D2EE" |
||||||
|
CornerRadius="3" |
||||||
|
Background="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=SelectedItem.Background}" Focusable="False"/> |
||||||
|
<Border BorderThickness="2" BorderBrush="#FFD6E2F8" CornerRadius="3" Margin="1" Focusable="False"> |
||||||
|
<ContentPresenter |
||||||
|
Content="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=SelectedItem.Content}" |
||||||
|
Margin="2" |
||||||
|
KeyboardNavigation.TabNavigation="Local" |
||||||
|
KeyboardNavigation.DirectionalNavigation="Contained"/> |
||||||
|
</Border> |
||||||
|
</Grid> |
||||||
|
<Border x:Name="PART_Header" |
||||||
|
Grid.Row="0" |
||||||
|
Focusable="False" |
||||||
|
BorderThickness="1,1,1,0"> |
||||||
|
<DockPanel LastChildFill="True"> |
||||||
|
<Button DockPanel.Dock="Right" Width="18" Height="18" Style="{StaticResource PaneHeaderCommandStyle}" |
||||||
|
Command="ad:ManagedContentCommands.Close" |
||||||
|
CommandTarget="{TemplateBinding SelectedItem}"> |
||||||
|
<Image Source="Images\PinClose.png" Width="13" UseLayoutRounding="True"/> |
||||||
|
</Button> |
||||||
|
<Button x:Name="PART_ShowContextMenuButton" DockPanel.Dock="Right" Width="18" Height="18" Style="{StaticResource PaneHeaderCommandStyle}"> |
||||||
|
<Image x:Name="ShowContextMenuIcon" Source="Images\PinMenu.png" Width="13" UseLayoutRounding="True"/> |
||||||
|
</Button> |
||||||
|
<ad:DocumentTabPanel |
||||||
|
x:Name="paneTabsPanel" |
||||||
|
Panel.ZIndex ="1" |
||||||
|
IsItemsHost="True" |
||||||
|
Margin="0,2,0,0" |
||||||
|
TabItemStyle="{StaticResource DocumentTabItemStyle}"/> |
||||||
|
</DockPanel> |
||||||
|
</Border> |
||||||
|
</Grid> |
||||||
|
</Border> |
||||||
|
<ControlTemplate.Triggers> |
||||||
|
<Trigger Property="HasItems" Value="False"> |
||||||
|
<Setter Property="Visibility" Value="Hidden"/> |
||||||
|
</Trigger> |
||||||
|
<Trigger Property ="ShowHeader" Value="False"> |
||||||
|
<Setter Property="Visibility" Value="Collapsed" TargetName="PART_Header"/> |
||||||
|
</Trigger> |
||||||
|
<DataTrigger Binding="{Binding Path=IsMainDocumentPane, RelativeSource={RelativeSource Self}}" Value="True"> |
||||||
|
<Setter Property="Source" Value="Images\PinDocMenu.png" TargetName="ShowContextMenuIcon"/> |
||||||
|
</DataTrigger> |
||||||
|
<EventTrigger RoutedEvent="Window.Loaded"> |
||||||
|
<BeginStoryboard> |
||||||
|
<Storyboard> |
||||||
|
<DoubleAnimation |
||||||
|
Storyboard.TargetProperty="Opacity" |
||||||
|
From="0" To="1" Duration="0:0:0.200" /> |
||||||
|
</Storyboard> |
||||||
|
</BeginStoryboard> |
||||||
|
</EventTrigger> |
||||||
|
</ControlTemplate.Triggers> |
||||||
|
</ControlTemplate> |
||||||
|
</Setter.Value> |
||||||
|
</Setter> |
||||||
|
</Style> |
||||||
|
|
||||||
|
</ResourceDictionary> |
||||||
@ -0,0 +1,112 @@ |
|||||||
|
<ResourceDictionary |
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" |
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
||||||
|
xmlns:primitives="clr-namespace:System.Windows.Controls.Primitives;assembly=PresentationFramework" |
||||||
|
xmlns:ad="clr-namespace:AvalonDock" |
||||||
|
|
||||||
|
> |
||||||
|
|
||||||
|
<ResourceDictionary.MergedDictionaries> |
||||||
|
<ResourceDictionary Source="/AvalonDock;component/Resources/Brushes.xaml"/> |
||||||
|
<ResourceDictionary Source="/AvalonDock;component/Resources/Common.xaml"/> |
||||||
|
</ResourceDictionary.MergedDictionaries> |
||||||
|
|
||||||
|
|
||||||
|
<!--DockableFloatingWindow--> |
||||||
|
<Style x:Key="{x:Type ad:DockableFloatingWindow}" TargetType="{x:Type ad:DockableFloatingWindow}"> |
||||||
|
<Setter Property="Title" Value="{Binding RelativeSource={x:Static RelativeSource.Self}, Path=HostedPane.SelectedItem.Title}"/> |
||||||
|
<Setter Property="Background" Value="{DynamicResource {ComponentResourceKey {x:Type ad:DockingManager}, {x:Static ad:AvalonDockBrushes.DefaultBackgroundBrush}}}"/> |
||||||
|
<Setter Property="Template"> |
||||||
|
<Setter.Value> |
||||||
|
<ControlTemplate TargetType="{x:Type ad:DockableFloatingWindow}"> |
||||||
|
<Border Background="{TemplateBinding Background}"> |
||||||
|
<ContentPresenter/> |
||||||
|
</Border> |
||||||
|
</ControlTemplate> |
||||||
|
</Setter.Value> |
||||||
|
</Setter> |
||||||
|
</Style> |
||||||
|
|
||||||
|
<!--DocumentFloatingWindow--> |
||||||
|
<Style x:Key="{x:Type ad:DocumentFloatingWindow}" TargetType="{x:Type ad:DocumentFloatingWindow}"> |
||||||
|
<Setter Property="Background" Value = "Transparent"/> |
||||||
|
<Setter Property="Width" Value="100"/> |
||||||
|
<Setter Property="Height" Value="100"/> |
||||||
|
<Setter Property="Title" Value="{Binding RelativeSource={x:Static RelativeSource.Self}, Path=HostedPane.SelectedItem.Title}"/> |
||||||
|
<Setter Property="Template"> |
||||||
|
<Setter.Value> |
||||||
|
<ControlTemplate TargetType="{x:Type ad:DocumentFloatingWindow}"> |
||||||
|
<Grid> |
||||||
|
<Border |
||||||
|
x:Name="PART_HighlighBorder" |
||||||
|
Visibility="Collapsed" |
||||||
|
Background="{DynamicResource {x:Static SystemColors.ActiveCaptionBrushKey}}" |
||||||
|
Opacity="0.2"/> |
||||||
|
<ContentPresenter |
||||||
|
x:Name="PART_Content" |
||||||
|
ad:ResizingPanel.ResizeWidth="{TemplateBinding ad:ResizingPanel.ResizeWidth}" |
||||||
|
ad:ResizingPanel.ResizeHeight="{TemplateBinding ad:ResizingPanel.ResizeHeight}"/> |
||||||
|
</Grid> |
||||||
|
<!--<ControlTemplate.Triggers> |
||||||
|
<DataTrigger Binding="{Binding RelativeSource={RelativeSource Self}, Path=IsDocumentFloatingAllowed}" Value="True"> |
||||||
|
<Setter Property="Visibility" Value="Collapsed" TargetName="PART_HighlighBorder"/> |
||||||
|
<Setter Property="Visibility" Value="Visible" TargetName="PART_Content"/> |
||||||
|
</DataTrigger> |
||||||
|
</ControlTemplate.Triggers>--> |
||||||
|
</ControlTemplate> |
||||||
|
</Setter.Value> |
||||||
|
</Setter> |
||||||
|
</Style> |
||||||
|
|
||||||
|
<!--FlyoutPaneWindow--> |
||||||
|
<Style x:Key="{x:Type ad:FlyoutPaneWindow}" TargetType="{x:Type ad:FlyoutPaneWindow}"> |
||||||
|
<Setter Property="Background" Value="{DynamicResource {ComponentResourceKey {x:Type ad:DockingManager}, {x:Static ad:AvalonDockBrushes.DefaultBackgroundBrush}}}"/> |
||||||
|
<Setter Property="Template"> |
||||||
|
<Setter.Value> |
||||||
|
<ControlTemplate TargetType="{x:Type ad:FlyoutPaneWindow}"> |
||||||
|
<Grid Name="INT_resizePanel" Background="{TemplateBinding Background}"> |
||||||
|
<Grid.ColumnDefinitions> |
||||||
|
<ColumnDefinition Width="Auto"/> |
||||||
|
<ColumnDefinition Width="*"/> |
||||||
|
<ColumnDefinition Width="Auto"/> |
||||||
|
</Grid.ColumnDefinitions> |
||||||
|
<Grid.RowDefinitions> |
||||||
|
<RowDefinition Height="Auto"/> |
||||||
|
<RowDefinition Height="*"/> |
||||||
|
<RowDefinition Height="Auto"/> |
||||||
|
</Grid.RowDefinitions> |
||||||
|
<ContentPresenter Name="INT_pane" Grid.Column="1" Grid.Row="1"/> |
||||||
|
<ad:Resizer x:Name="PART_Resizer" Grid.Column="2" Grid.Row="1" |
||||||
|
Background="Transparent"/> |
||||||
|
</Grid> |
||||||
|
<ControlTemplate.Triggers> |
||||||
|
<DataTrigger Binding="{Binding RelativeSource={RelativeSource Self}, Path=Anchor}" Value="Right"> |
||||||
|
<Setter Property="Grid.Row" Value="1" TargetName="PART_Resizer"/> |
||||||
|
<Setter Property="Grid.Column" Value="0" TargetName="PART_Resizer"/> |
||||||
|
<Setter Property="Width" Value="4" TargetName="PART_Resizer"/> |
||||||
|
<Setter Property="Cursor" Value="SizeWE" TargetName="PART_Resizer"/> |
||||||
|
</DataTrigger> |
||||||
|
<DataTrigger Binding="{Binding RelativeSource={RelativeSource Self}, Path=Anchor}" Value="Left"> |
||||||
|
<Setter Property="Grid.Row" Value="1" TargetName="PART_Resizer"/> |
||||||
|
<Setter Property="Grid.Column" Value="2" TargetName="PART_Resizer"/> |
||||||
|
<Setter Property="Width" Value="4" TargetName="PART_Resizer"/> |
||||||
|
<Setter Property="Cursor" Value="SizeWE" TargetName="PART_Resizer"/> |
||||||
|
</DataTrigger> |
||||||
|
<DataTrigger Binding="{Binding RelativeSource={RelativeSource Self}, Path=Anchor}" Value="Bottom"> |
||||||
|
<Setter Property="Grid.Column" Value="1" TargetName="PART_Resizer"/> |
||||||
|
<Setter Property="Grid.Row" Value="0" TargetName="PART_Resizer"/> |
||||||
|
<Setter Property="Height" Value="4" TargetName="PART_Resizer"/> |
||||||
|
<Setter Property="Cursor" Value="SizeNS" TargetName="PART_Resizer"/> |
||||||
|
</DataTrigger> |
||||||
|
<DataTrigger Binding="{Binding RelativeSource={RelativeSource Self}, Path=Anchor}" Value="Top"> |
||||||
|
<Setter Property="Grid.Row" Value="2" TargetName="PART_Resizer"/> |
||||||
|
<Setter Property="Grid.Column" Value="1" TargetName="PART_Resizer"/> |
||||||
|
<Setter Property="Height" Value="4" TargetName="PART_Resizer"/> |
||||||
|
<Setter Property="Cursor" Value="SizeNS" TargetName="PART_Resizer"/> |
||||||
|
</DataTrigger> |
||||||
|
</ControlTemplate.Triggers> |
||||||
|
</ControlTemplate> |
||||||
|
</Setter.Value> |
||||||
|
</Setter> |
||||||
|
</Style> |
||||||
|
</ResourceDictionary> |
||||||
|
After Width: | Height: | Size: 699 B |
|
After Width: | Height: | Size: 1.2 KiB |
|
After Width: | Height: | Size: 747 B |
|
After Width: | Height: | Size: 1.2 KiB |
|
After Width: | Height: | Size: 3.5 KiB |
|
After Width: | Height: | Size: 4.3 KiB |
|
After Width: | Height: | Size: 4.2 KiB |