git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@5878 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61pull/1/head
@ -1,190 +0,0 @@
@@ -1,190 +0,0 @@
|
||||
//Copyright (c) 2007-2009, 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 |
||||
{ |
||||
/* |
||||
* Disabled because we use WPF 4.0 layout rounding instead. |
||||
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)); |
||||
} |
||||
*/ |
||||
} |
||||
} |
@ -1,256 +0,0 @@
@@ -1,256 +0,0 @@
|
||||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0"> |
||||
<PropertyGroup> |
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> |
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> |
||||
<ProjectGuid>{2FF700C2-A38A-48BD-A637-8CAFD4FE6237}</ProjectGuid> |
||||
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> |
||||
<RootNamespace>AvalonDock</RootNamespace> |
||||
<AssemblyName>AvalonDock</AssemblyName> |
||||
<WarningLevel>4</WarningLevel> |
||||
<OutputType>library</OutputType> |
||||
<ApplicationVersion>1.0.0.*</ApplicationVersion> |
||||
<!-- Most people will use Publish dialog in Visual Studio to increment this --> |
||||
<MinFrameworkVersionRequired>3.0</MinFrameworkVersionRequired> |
||||
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion> <!-- required as workaround for bug compiling with 32-bit MSBuild 4.0 on 64-bit Windows without having VS2010 installed --> |
||||
<FileUpgradeFlags> |
||||
</FileUpgradeFlags> |
||||
<OldToolsVersion>2.0</OldToolsVersion> |
||||
<UpgradeBackupLocation> |
||||
</UpgradeBackupLocation> |
||||
<SignAssembly>true</SignAssembly> |
||||
<AssemblyOriginatorKeyFile>AvalonDock.snk</AssemblyOriginatorKeyFile> |
||||
<SourceAnalysisOverrideSettingsFile>C:\Users\Daniel\AppData\Roaming\ICSharpCode/SharpDevelop3.0\Settings.SourceAnalysis</SourceAnalysisOverrideSettingsFile> |
||||
<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> |
||||
</PropertyGroup> |
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> |
||||
<DebugSymbols>false</DebugSymbols> |
||||
<Optimize>true</Optimize> |
||||
<DefineConstants>TRACE</DefineConstants> |
||||
<DebugType>None</DebugType> |
||||
</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> |
||||
<FileAlignment>4096</FileAlignment> |
||||
</PropertyGroup> |
||||
<ItemGroup> |
||||
<Reference Include="System" /> |
||||
<Reference Include="System.Core"> |
||||
<RequiredTargetFramework>3.5</RequiredTargetFramework> |
||||
</Reference> |
||||
<Reference Include="System.Data" /> |
||||
<Reference Include="System.Xml" /> |
||||
<Reference Include="WindowsBase"> |
||||
<RequiredTargetFramework>3.0</RequiredTargetFramework> |
||||
</Reference> |
||||
<Reference Include="PresentationCore"> |
||||
<RequiredTargetFramework>3.0</RequiredTargetFramework> |
||||
</Reference> |
||||
<Reference Include="PresentationFramework"> |
||||
<RequiredTargetFramework>3.0</RequiredTargetFramework> |
||||
</Reference> |
||||
<Reference Include="UIAutomationProvider"> |
||||
<RequiredTargetFramework>3.0</RequiredTargetFramework> |
||||
</Reference> |
||||
<Reference Include="UIAutomationTypes" /> |
||||
<Reference Include="ReachFramework" /> |
||||
<Reference Include="WindowsFormsIntegration"> |
||||
<RequiredTargetFramework>3.0</RequiredTargetFramework> |
||||
</Reference> |
||||
<Reference Include="System.Xaml"> |
||||
<RequiredTargetFramework>4.0</RequiredTargetFramework> |
||||
</Reference> |
||||
</ItemGroup> |
||||
<ItemGroup> |
||||
<Compile Include="AlignedImage.cs" /> |
||||
<Compile Include="AvalonDockBrushes.cs" /> |
||||
<Compile Include="ColorFactory.cs" /> |
||||
<Compile Include="ContextMenuElement.cs" /> |
||||
<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="DocumentNavigator.cs" /> |
||||
<Compile Include="DocumentPane.cs" /> |
||||
<Compile Include="DocumentPaneResizingPanel.cs" /> |
||||
<Compile Include="DocumentTabPanel.cs" /> |
||||
<Compile Include="DragPaneServices.cs" /> |
||||
<Compile Include="Converters.cs" /> |
||||
<Compile Include="FloatingDockablePane.cs" /> |
||||
<Compile Include="FloatingWindow.cs" /> |
||||
<Compile Include="FlyoutDockablePane.cs" /> |
||||
<Compile Include="FlyoutPaneWindow.cs" /> |
||||
<Compile Include="GreyableImage\GreyableImage.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" /> |
||||
<EmbeddedResource Include="Properties\Resources.resx"> |
||||
<Generator>ResXFileCodeGenerator</Generator> |
||||
<SubType>Designer</SubType> |
||||
<LastGenOutput>Resources.Designer.cs</LastGenOutput> |
||||
</EmbeddedResource> |
||||
<None Include="AvalonDock.snk" /> |
||||
<None Include="Properties\Settings.settings"> |
||||
<Generator>SettingsSingleFileGenerator</Generator> |
||||
<LastGenOutput>Settings.Designer.cs</LastGenOutput> |
||||
</None> |
||||
<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> |
||||
<DesignTimeSharedInput>True</DesignTimeSharedInput> |
||||
<DependentUpon>Settings.settings</DependentUpon> |
||||
</Compile> |
||||
<Compile Include="RequestDocumentCloseEventArgs.cs" /> |
||||
<Compile Include="ResizingPanel.cs" /> |
||||
<Compile Include="ResizingPanelSplitter.cs" /> |
||||
<Compile Include="WindowInteropWrapper.cs" /> |
||||
<Compile Include="WpfApplication.cs" /> |
||||
<AppDesigner Include="Properties\" /> |
||||
</ItemGroup> |
||||
<ItemGroup> |
||||
<Page Include="Resources\Brushes.xaml"> |
||||
<SubType>Designer</SubType> |
||||
<Generator>MSBuild:Compile</Generator> |
||||
</Page> |
||||
<Page Include="Resources\Common.xaml"> |
||||
<SubType>Designer</SubType> |
||||
<Generator>MSBuild:Compile</Generator> |
||||
</Page> |
||||
<Page Include="Resources\DockablePaneStyles.xaml"> |
||||
<SubType>Designer</SubType> |
||||
<Generator>MSBuild:Compile</Generator> |
||||
</Page> |
||||
<Page Include="Resources\DockingManagerStyles.xaml"> |
||||
<SubType>Designer</SubType> |
||||
<Generator>MSBuild:Compile</Generator> |
||||
</Page> |
||||
<Page Include="Resources\DocumentNavigatorWindowStyle.xaml"> |
||||
<SubType>Designer</SubType> |
||||
<Generator>MSBuild:Compile</Generator> |
||||
</Page> |
||||
<Page Include="Resources\DocumentPaneStyles.xaml"> |
||||
<SubType>Designer</SubType> |
||||
<Generator>MSBuild:Compile</Generator> |
||||
</Page> |
||||
<Page Include="Resources\FloatingWindowStyle.xaml"> |
||||
<SubType>Designer</SubType> |
||||
<Generator>MSBuild:Compile</Generator> |
||||
</Page> |
||||
<Page Include="Resources\ManagedContentStyle.xaml"> |
||||
<SubType>Designer</SubType> |
||||
<Generator>MSBuild:Compile</Generator> |
||||
</Page> |
||||
<Page Include="Resources\NavigatorWindowStyle.xaml"> |
||||
<SubType>Designer</SubType> |
||||
<Generator>MSBuild:Compile</Generator> |
||||
</Page> |
||||
<Page Include="Resources\OverlayWindowStyle.xaml"> |
||||
<SubType>Designer</SubType> |
||||
<Generator>MSBuild:Compile</Generator> |
||||
</Page> |
||||
<Page Include="themes\aero.normalcolor.brushes.xaml"> |
||||
<SubType>Designer</SubType> |
||||
<Generator>MSBuild:Compile</Generator> |
||||
</Page> |
||||
<Page Include="themes\aero.normalcolor.xaml"> |
||||
<SubType>Designer</SubType> |
||||
<Generator>MSBuild:Compile</Generator> |
||||
</Page> |
||||
<Page Include="themes\classic.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\generic.xaml"> |
||||
<Generator>MSBuild:Compile</Generator> |
||||
<SubType>Designer</SubType> |
||||
</Page> |
||||
<Page Include="themes\luna.normalcolor.xaml"> |
||||
<SubType>Designer</SubType> |
||||
<Generator>MSBuild:Compile</Generator> |
||||
</Page> |
||||
</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" /> |
||||
</ItemGroup> |
||||
<ItemGroup> |
||||
<Resource Include="Resources\images\PinClose.png" /> |
||||
</ItemGroup> |
||||
<ItemGroup> |
||||
<Resource Include="Resources\images\PinAutoHide.png" /> |
||||
<Resource Include="Resources\images\PinMenu.png" /> |
||||
</ItemGroup> |
||||
<ItemGroup> |
||||
<Resource Include="Resources\images\PinDocMenu.png" /> |
||||
</ItemGroup> |
||||
<ItemGroup> |
||||
<Resource Include="Resources\images\Locked.png" /> |
||||
</ItemGroup> |
||||
<ItemGroup> |
||||
<Resource Include="Resources\images\HTabGroup.png" /> |
||||
<Resource Include="Resources\images\VTabGroup.png" /> |
||||
</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="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> |
||||
</Project> |
@ -1,116 +0,0 @@
@@ -1,116 +0,0 @@
|
||||
//Copyright (c) 2007-2009, 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 the background of a document header when active (<see cref="ManagedContent.IsActiveDocument"/>).
|
||||
/// </summary>
|
||||
DocumentHeaderBackgroundSelected, |
||||
|
||||
/// <summary>
|
||||
/// Brush used for the background of a document header when mouse is over it.
|
||||
/// </summary>
|
||||
DocumentHeaderBackgroundMouseOver, |
||||
|
||||
|
||||
DocumentHeaderBorder, |
||||
|
||||
DocumentHeaderBorder2, |
||||
|
||||
NavigatorWindowTopBackground, |
||||
|
||||
NavigatorWindowTitleForeground, |
||||
|
||||
NavigatorWindowDocumentTypeForeground, |
||||
|
||||
NavigatorWindowInfoTipForeground, |
||||
|
||||
NavigatorWindowForeground, |
||||
|
||||
NavigatorWindowBackground, |
||||
|
||||
NavigatorWindowSelectionBackground, |
||||
|
||||
NavigatorWindowSelectionBorderbrush, |
||||
|
||||
NavigatorWindowBottomBackground, |
||||
} |
||||
} |
@ -1,261 +0,0 @@
@@ -1,261 +0,0 @@
|
||||
//Copyright (c) 2009, Juergen Schildmann
|
||||
//Copyright (c) 2007-2009, 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.IO; |
||||
using System.Collections.Generic; |
||||
using System.Text; |
||||
using System.Windows; |
||||
using System.Windows.Media; |
||||
|
||||
namespace AvalonDock |
||||
{ |
||||
/// <summary>
|
||||
/// Is used for color-support to change the colors depending on a base theme.
|
||||
/// </summary>
|
||||
public sealed class ColorFactory |
||||
{ |
||||
/// Change the theme to one from AvalonDock.
|
||||
/// </summary>
|
||||
/// <param name="theme">for example: "aero.normalcolor" (default style)</param>
|
||||
public static void ChangeTheme(string theme) |
||||
{ |
||||
ResourceDictionary rd = new ResourceDictionary(); |
||||
rd.Source = new Uri("/AvalonDock;component/themes/" + theme + ".xaml", UriKind.RelativeOrAbsolute); |
||||
|
||||
// first search and remove old one
|
||||
ResetColors(); |
||||
|
||||
Application.Current.Resources.MergedDictionaries.Add(rd); |
||||
} |
||||
|
||||
/// <summary>
|
||||
/// Change the colors based on the aero-theme from AvalonDock.
|
||||
/// <para>
|
||||
/// <example>Example: ChangeColors(Colors.DarkGreen)</example>
|
||||
/// </para>
|
||||
/// </summary>
|
||||
/// <param name="color">the new Color</param>
|
||||
public static void ChangeColors(Color color) |
||||
{ |
||||
ChangeColors("aero.normalcolor", color); |
||||
} |
||||
|
||||
/// <summary>
|
||||
/// Change the colors based on a theme-name from AvalonDock.
|
||||
/// <para>
|
||||
/// <example>Example: ChangeColors("classic", Colors.DarkGreen)</example>
|
||||
/// </para>
|
||||
/// </summary>
|
||||
/// <param name="baseTheme">the string of the base theme we want to change</param>
|
||||
/// <param name="color">the new Color</param>
|
||||
public static void ChangeColors(string baseTheme, Color color) |
||||
{ |
||||
ResourceDictionary rd = new ResourceDictionary(); |
||||
rd.Source = new Uri("/AvalonDock;component/themes/" + baseTheme + ".xaml", UriKind.RelativeOrAbsolute); |
||||
|
||||
ChangeKeysInResourceDictionary(rd, color); |
||||
foreach (ResourceDictionary rd2 in rd.MergedDictionaries) |
||||
{ |
||||
ChangeKeysInResourceDictionary(rd2, color); |
||||
} |
||||
|
||||
//ResourceDictionary parent = Application.Current.Resources;
|
||||
// first search and remove old one
|
||||
//foreach (ResourceDictionary res in Application.Current.Resources.MergedDictionaries)
|
||||
//{
|
||||
// string source = res.Source.ToString();
|
||||
// if (source.Contains("/AvalonDock;component/themes/"))
|
||||
// {
|
||||
// Application.Current.Resources.MergedDictionaries.Remove(res);
|
||||
// break;
|
||||
// }
|
||||
//}
|
||||
ResetColors(); |
||||
|
||||
Application.Current.Resources.MergedDictionaries.Add(rd); |
||||
} |
||||
|
||||
/// <summary>
|
||||
/// Reset custom colors to theme defaults
|
||||
/// </summary>
|
||||
public static void ResetColors() |
||||
{ |
||||
//- foreach (ResourceDictionary res in Application.Current.Resources.MergedDictionaries)
|
||||
ResourceDictionary res = GetActualResourceDictionary(); |
||||
if (res != null) |
||||
Application.Current.Resources.MergedDictionaries.Remove(res); |
||||
} |
||||
|
||||
/// <summary>
|
||||
/// Change a specified brush inside the actual theme.
|
||||
/// Look at AvalonDockBrushes.cs for possible values.
|
||||
/// </summary>
|
||||
/// <param name="brushName">an AvalonDockBrushes value</param>
|
||||
/// <param name="brush">The new brush. It can be every brush type that is derived from Brush-class.</param>
|
||||
public static void ChangeBrush(AvalonDockBrushes brushName, Brush brush) |
||||
{ |
||||
ChangeBrush(brushName.ToString(), brush); |
||||
} |
||||
|
||||
/// <summary>
|
||||
/// Change a specified brush inside the actual theme.
|
||||
/// </summary>
|
||||
/// <param name="brushName">a brush name</param>
|
||||
/// <param name="brush">The new brush. It can be every brush type that is derived from Brush-class.</param>
|
||||
public static void ChangeBrush(string brushName, Brush brush) |
||||
{ |
||||
// get the actual ResourceDictionary
|
||||
ResourceDictionary rd = GetActualResourceDictionary(); |
||||
if (rd == null) |
||||
{ |
||||
//- string source = res.Source.ToString();
|
||||
//- if (source.Contains("/AvalonDock;component/themes/"))
|
||||
ChangeTheme("aero.normalcolor"); |
||||
rd = GetActualResourceDictionary(); |
||||
} |
||||
|
||||
if (rd != null) |
||||
{ |
||||
foreach (ResourceDictionary rd2 in rd.MergedDictionaries) |
||||
{ |
||||
//- Application.Current.Resources.MergedDictionaries.Remove(res);
|
||||
//- break;
|
||||
foreach (object key in rd2.Keys) |
||||
{ |
||||
object item = rd2[key]; |
||||
string keyTypeName = key.GetType().Name; |
||||
|
||||
string str = ""; |
||||
switch (keyTypeName) |
||||
{ |
||||
case "ComponentResourceKey": |
||||
str = ((ComponentResourceKey)key).ResourceId.ToString(); |
||||
break; |
||||
case "String": |
||||
str = (string)key; |
||||
break; |
||||
} |
||||
if (str == brushName) |
||||
{ |
||||
rd[key] = brush; |
||||
return; |
||||
} |
||||
} |
||||
} |
||||
} |
||||
} |
||||
|
||||
|
||||
// {
|
||||
// string source = res.Source.ToString();
|
||||
// if (source.Contains("/AvalonDock;component/themes/"))
|
||||
// {
|
||||
// Application.Current.Resources.MergedDictionaries.Remove(res);
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Searches for keys in the ResourceDictionary for brushes and changes the color-values
|
||||
/// </summary>
|
||||
/// <param name="rd">the ResourceDictionary</param>
|
||||
/// <param name="color">the new Color</param>
|
||||
static void ChangeKeysInResourceDictionary(ResourceDictionary rd, Color color) |
||||
{ |
||||
foreach (object key in rd.Keys) |
||||
{ |
||||
object item = rd[key]; |
||||
|
||||
if (item is SolidColorBrush) |
||||
{ |
||||
SolidColorBrush sb = item as SolidColorBrush; |
||||
sb.Color = GetColor(sb.Color, color); |
||||
} |
||||
else if (item is LinearGradientBrush) |
||||
{ |
||||
LinearGradientBrush lg = item as LinearGradientBrush; |
||||
foreach (GradientStop gs in lg.GradientStops) |
||||
{ |
||||
gs.Color = GetColor(gs.Color, color); |
||||
} |
||||
} |
||||
else if (item is RadialGradientBrush) |
||||
{ |
||||
RadialGradientBrush rb = item as RadialGradientBrush; |
||||
foreach (GradientStop gs in rb.GradientStops) |
||||
{ |
||||
gs.Color = GetColor(gs.Color, color); |
||||
} |
||||
} |
||||
} |
||||
} |
||||
|
||||
static ResourceDictionary GetActualResourceDictionary() |
||||
{ |
||||
// get the actual ResourceDictionary
|
||||
foreach (ResourceDictionary res in Application.Current.Resources.MergedDictionaries) |
||||
{ |
||||
if (res.Source != null) |
||||
{ |
||||
string source = res.Source.ToString(); |
||||
if (source.Contains("/AvalonDock;component/themes/")) |
||||
{ |
||||
return res; |
||||
} |
||||
} |
||||
} |
||||
return null; |
||||
} |
||||
|
||||
static Color GetColor(Color c, Color newCol) |
||||
{ |
||||
if (c.A == 0) return c; |
||||
|
||||
// get brightness for RGB values
|
||||
byte brighness = (byte)(c.R * 0.2126 + c.G * 0.7152 + c.B * 0.0722); |
||||
|
||||
return Color.FromArgb(c.A, |
||||
GetSmoothColor(brighness, newCol.R), |
||||
GetSmoothColor(brighness, newCol.G), |
||||
GetSmoothColor(brighness, newCol.B)); |
||||
} |
||||
|
||||
static byte GetSmoothColor(int a, int b) |
||||
{ |
||||
int c = a * b / 255; |
||||
return (byte)(c + a * (255 - ((255 - a) * (255 - b) / 255) - c) / 255); |
||||
} |
||||
|
||||
static Color GetSmoothColor(Color c, Color light) |
||||
{ |
||||
return Color.FromArgb(c.A, GetSmoothColor(c.R, light.R), GetSmoothColor(c.G, light.G), GetSmoothColor(c.B, light.B)); |
||||
} |
||||
} |
||||
} |
@ -1,53 +0,0 @@
@@ -1,53 +0,0 @@
|
||||
//Copyright (c) 2007-2009, 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="FloatingWindow"/>
|
||||
/// </summary>
|
||||
FloatingWindow, |
||||
|
||||
} |
||||
} |
@ -1,99 +0,0 @@
@@ -1,99 +0,0 @@
|
||||
//Copyright (c) 2007-2009, 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; |
||||
|
||||
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; |
||||
} |
||||
} |
||||
|
||||
|
||||
public static class Converters |
||||
{ |
||||
static BoolToVisibilityConverter _BoolToVisibilityConverter = null; |
||||
|
||||
public static BoolToVisibilityConverter BoolToVisibilityConverter |
||||
{ |
||||
get |
||||
{ |
||||
if (_BoolToVisibilityConverter == null) |
||||
_BoolToVisibilityConverter = new BoolToVisibilityConverter(); |
||||
|
||||
|
||||
return _BoolToVisibilityConverter; |
||||
} |
||||
} |
||||
|
||||
} |
||||
} |
@ -1,25 +0,0 @@
@@ -1,25 +0,0 @@
|
||||
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 DockableContent Content { get; set; } |
||||
} |
||||
} |
@ -1,581 +0,0 @@
@@ -1,581 +0,0 @@
|
||||
//Copyright (c) 2007-2009, 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; |
||||
|
||||
namespace AvalonDock |
||||
{ |
||||
/// <summary>
|
||||
/// Enumerates all the possible states of <see cref="DockableContent"/>
|
||||
/// </summary>
|
||||
public enum DockableContentState |
||||
{ |
||||
/// <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 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( |
||||
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() |
||||
{ |
||||
} |
||||
|
||||
#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.AutoHide) |
||||
{ |
||||
Manager.Drag(this, HelperFunc.PointToScreenWithoutFlowDirection(this, ptMouse), ptRelativeMouse); |
||||
} |
||||
|
||||
base.OnDragStart(ptMouse, ptRelativeMouse); |
||||
} |
||||
|
||||
#endregion
|
||||
|
||||
#region State Properties & Events
|
||||
|
||||
public delegate void DockableContentStateHandler(object sender, DockableContentState state); |
||||
public event DockableContentStateHandler StateChanged; |
||||
|
||||
public DockableContentState State |
||||
{ |
||||
get { return (DockableContentState)GetValue(StatePropertyKey.DependencyProperty); } |
||||
//protected set { SetValue(StatePropertyKey, value); }
|
||||
protected set |
||||
{ |
||||
SetValue(StatePropertyKey, value); |
||||
if (StateChanged != null) |
||||
StateChanged(this, 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 UIPropertyMetadata(DockableContentState.Docked)); |
||||
|
||||
DockableStyle _dockableStyle = 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; } |
||||
set { _dockableStyle = value; } |
||||
} |
||||
|
||||
|
||||
|
||||
#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.Document || |
||||
State == DockableContentState.Docked || |
||||
State == DockableContentState.FloatingWindow); |
||||
|
||||
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
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
protected override void OnInitialized(EventArgs e) |
||||
{ |
||||
base.OnInitialized(e); |
||||
|
||||
this.CommandBindings.Add( |
||||
new CommandBinding(FloatingCommand, this.OnExecuteCommand, this.OnCanExecuteCommand)); |
||||
this.CommandBindings.Add( |
||||
new CommandBinding(DockableCommand, this.OnExecuteCommand, this.OnCanExecuteCommand)); |
||||
this.CommandBindings.Add( |
||||
new CommandBinding(ShowAsDocumentCommand, this.OnExecuteCommand, this.OnCanExecuteCommand)); |
||||
this.CommandBindings.Add( |
||||
new CommandBinding(DockablePane.ToggleAutoHideCommand, this.OnExecuteCommand, this.OnCanExecuteCommand)); |
||||
this.CommandBindings.Add( |
||||
new CommandBinding(HideCommand, this.OnExecuteCommand, this.OnCanExecuteCommand)); |
||||
} |
||||
|
||||
#region Commands
|
||||
|
||||
static object syncRoot = new object(); |
||||
|
||||
|
||||
private static RoutedUICommand documentCommand = null; |
||||
public static RoutedUICommand ShowAsDocumentCommand |
||||
{ |
||||
get |
||||
{ |
||||
lock (syncRoot) |
||||
{ |
||||
if (null == documentCommand) |
||||
{ |
||||
documentCommand = new RoutedUICommand("Tabbed Document", "Document", typeof(DockableContent)); |
||||
} |
||||
} |
||||
return documentCommand; |
||||
} |
||||
} |
||||
|
||||
private static RoutedUICommand dockableCommand = null; |
||||
public static RoutedUICommand DockableCommand |
||||
{ |
||||
get |
||||
{ |
||||
lock (syncRoot) |
||||
{ |
||||
if (null == dockableCommand) |
||||
{ |
||||
dockableCommand = new RoutedUICommand("Dockable", "Dockable", typeof(DockablePane)); |
||||
} |
||||
} |
||||
return dockableCommand; |
||||
} |
||||
} |
||||
|
||||
private static RoutedUICommand floatingCommand = null; |
||||
public static RoutedUICommand FloatingCommand |
||||
{ |
||||
get |
||||
{ |
||||
lock (syncRoot) |
||||
{ |
||||
if (null == floatingCommand) |
||||
{ |
||||
floatingCommand = new RoutedUICommand("F_loating", "Floating", typeof(DockableContent)); |
||||
} |
||||
} |
||||
return floatingCommand; |
||||
} |
||||
} |
||||
|
||||
private static RoutedUICommand hideCommand = null; |
||||
public static RoutedUICommand HideCommand |
||||
{ |
||||
get |
||||
{ |
||||
lock (syncRoot) |
||||
{ |
||||
if (null == hideCommand) |
||||
{ |
||||
hideCommand = new RoutedUICommand("H_ide", "Hide", typeof(DockableContent)); |
||||
} |
||||
} |
||||
return hideCommand; |
||||
} |
||||
} |
||||
|
||||
internal virtual void OnExecuteCommand(object sender, ExecutedRoutedEventArgs e) |
||||
{ |
||||
if (!e.Handled && |
||||
e.Command == DockablePane.ToggleAutoHideCommand) |
||||
{ |
||||
if ((DockableStyle & DockableStyle.AutoHide) > 0) |
||||
{ |
||||
((ContainerPane as DockablePane)).ToggleAutoHide(); |
||||
e.Handled = true; |
||||
} |
||||
} |
||||
else if (!e.Handled && e.Command == DockableContent.HideCommand) |
||||
{ |
||||
Manager.Hide(this); |
||||
|
||||
e.Handled = true; |
||||
} |
||||
else if (!e.Handled && e.Command == DockableContent.FloatingCommand) |
||||
{ |
||||
Manager.Show(this, DockableContentState.FloatingWindow); |
||||
e.Handled = true; |
||||
} |
||||
else if (!e.Handled && e.Command == DockableContent.DockableCommand) |
||||
{ |
||||
Manager.Show(this, DockableContentState.DockableWindow); |
||||
e.Handled = true; |
||||
} |
||||
else if (!e.Handled && e.Command == DockableContent.ShowAsDocumentCommand) |
||||
{ |
||||
Manager.Show(this, DockableContentState.Document); |
||||
e.Handled = true; |
||||
} |
||||
|
||||
} |
||||
|
||||
protected virtual void OnCanExecuteCommand(object sender, CanExecuteRoutedEventArgs e) |
||||
{ |
||||
if (State == DockableContentState.AutoHide) |
||||
{ |
||||
if (e.Command == DockablePane.ToggleAutoHideCommand || |
||||
e.Command == DockablePane.CloseCommand || |
||||
e.Command == DockableContent.HideCommand) |
||||
e.CanExecute = true; |
||||
else |
||||
e.CanExecute = false; |
||||
} |
||||
else |
||||
e.CanExecute = true; |
||||
} |
||||
|
||||
#endregion
|
||||
|
||||
#region Operations on content
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Remove this content from its parent container pane
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
internal DockableContent DetachFromContainerPane() |
||||
{ |
||||
if (ContainerPane != null) |
||||
{ |
||||
int indexOfContent = ContainerPane.Items.IndexOf(this); |
||||
return ContainerPane.RemoveContent(indexOfContent) as DockableContent; |
||||
} |
||||
|
||||
return null; |
||||
} |
||||
|
||||
DockableContentStateAndPosition _savedStateAndPosition = null; |
||||
|
||||
internal DockableContentStateAndPosition SavedStateAndPosition |
||||
{ |
||||
get { return _savedStateAndPosition; } |
||||
} |
||||
|
||||
internal void SaveCurrentStateAndPosition() |
||||
{ |
||||
//if (State == DockableContentState.Docked)
|
||||
//{
|
||||
_savedStateAndPosition = new DockableContentStateAndPosition( |
||||
this); |
||||
//}
|
||||
//else
|
||||
//{
|
||||
// _savedStateAndPosition = null;
|
||||
//}
|
||||
} |
||||
|
||||
/// <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 virtual 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()); |
||||
} |
||||
|
||||
} |
||||
|
||||
/// <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) |
||||
{ |
||||
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")) |
||||
{ |
||||
_savedStateAndPosition = new DockableContentStateAndPosition( |
||||
ContainerPane, |
||||
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")) |
||||
); |
||||
//contentElement.HasAttribute("State") ? (DockableContentState)Enum.Parse(typeof(DockableContentState), contentElement.GetAttribute("State") );
|
||||
} |
||||
} |
||||
#endregion
|
||||
} |
||||
} |
@ -1,279 +0,0 @@
@@ -1,279 +0,0 @@
|
||||
//Copyright (c) 2007-2009, 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; |
||||
|
||||
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))); |
||||
} |
||||
|
||||
|
||||
public DockableFloatingWindow(DockingManager manager) |
||||
: base(manager) |
||||
{ |
||||
} |
||||
|
||||
|
||||
Pane _previousPane = null; |
||||
|
||||
int _arrayIndexPreviousPane = -1; |
||||
|
||||
|
||||
public DockableFloatingWindow(DockingManager manager, DockableContent content) |
||||
: this(manager) |
||||
{ |
||||
|
||||
//create a new temporary pane
|
||||
FloatingDockablePane pane = new FloatingDockablePane(this); |
||||
|
||||
//setup window size
|
||||
//Width = content.ContainerPane.ActualWidth;
|
||||
//Height = content.ContainerPane.ActualHeight;
|
||||
|
||||
if (content.FloatingWindowSize.IsEmpty) |
||||
content.FloatingWindowSize = new Size(content.ContainerPane.ActualWidth, content.ContainerPane.ActualHeight); |
||||
|
||||
Width = content.FloatingWindowSize.Width; |
||||
Height = content.FloatingWindowSize.Height; |
||||
|
||||
//save current content position in container pane
|
||||
_previousPane = content.ContainerPane; |
||||
_arrayIndexPreviousPane = _previousPane.Items.IndexOf(content); |
||||
|
||||
pane.Style = content.ContainerPane.Style; |
||||
|
||||
//remove content from container pane
|
||||
content.ContainerPane.RemoveContent(_arrayIndexPreviousPane); |
||||
|
||||
//add content to my temporary pane
|
||||
pane.Items.Add(content); |
||||
|
||||
//let templates access this pane
|
||||
HostedPane = pane; |
||||
|
||||
//Change state on contents
|
||||
IsDockableWindow = true; |
||||
|
||||
DocumentPane originalDocumentPane = _previousPane as DocumentPane; |
||||
if (originalDocumentPane != null) |
||||
originalDocumentPane.CheckContentsEmpty(); |
||||
} |
||||
|
||||
public DockableFloatingWindow(DockingManager manager, DockablePane dockablePane) |
||||
: this(manager) |
||||
{ |
||||
//create a new temporary pane
|
||||
FloatingDockablePane pane = new FloatingDockablePane(this); |
||||
|
||||
//setup window size
|
||||
ManagedContent selectedContent = dockablePane.SelectedItem as ManagedContent; |
||||
|
||||
if (selectedContent != null && selectedContent.FloatingWindowSize.IsEmpty) |
||||
selectedContent.FloatingWindowSize = new Size(dockablePane.ActualWidth, dockablePane.ActualHeight); |
||||
|
||||
if (selectedContent != null) |
||||
{ |
||||
Width = selectedContent.FloatingWindowSize.Width; |
||||
Height = selectedContent.FloatingWindowSize.Height; |
||||
this.ResizeMode = selectedContent.FloatingResizeMode; |
||||
} |
||||
else |
||||
{ |
||||
Width = dockablePane.ActualWidth; |
||||
Height = dockablePane.ActualHeight; |
||||
} |
||||
|
||||
//transfer the style from the original dockablepane
|
||||
pane.Style = dockablePane.Style; |
||||
|
||||
//Width = dockablePane.ActualWidth;
|
||||
//Height = dockablePane.ActualHeight;
|
||||
|
||||
////save current content position in container pane
|
||||
//pane.SetValue(ResizingPanel.ResizeWidthProperty, dockablePane.GetValue(ResizingPanel.ResizeWidthProperty));
|
||||
//pane.SetValue(ResizingPanel.ResizeHeightProperty, dockablePane.GetValue(ResizingPanel.ResizeHeightProperty));
|
||||
|
||||
int selectedIndex = dockablePane.SelectedIndex; |
||||
|
||||
//remove contents from container pane and insert in hosted pane
|
||||
while (dockablePane.Items.Count > 0) |
||||
{ |
||||
ManagedContent content = dockablePane.RemoveContent(0); |
||||
|
||||
//add content to my temporary pane
|
||||
pane.Items.Add(content); |
||||
} |
||||
|
||||
//let templates access this pane
|
||||
HostedPane = pane; |
||||
HostedPane.SelectedIndex = selectedIndex; |
||||
|
||||
//Change state on contents
|
||||
IsDockableWindow = true; |
||||
} |
||||
|
||||
|
||||
protected override void OnInitialized(EventArgs e) |
||||
{ |
||||
base.OnInitialized(e); |
||||
|
||||
if (HostedPane == null) |
||||
HostedPane = Content as FloatingDockablePane; |
||||
|
||||
if (HostedPane != null) |
||||
{ |
||||
Content = HostedPane; |
||||
} |
||||
} |
||||
|
||||
|
||||
|
||||
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); |
||||
} |
||||
|
||||
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; |
||||
} |
||||
|
||||
protected override void OnExecuteCommand(object sender, ExecutedRoutedEventArgs e) |
||||
{ |
||||
if (e.Command == TabbedDocumentCommand) |
||||
{ |
||||
DockableContent currentContent = HostedPane.SelectedItem as DockableContent; |
||||
|
||||
Manager.MainDocumentPane.Items.Insert(0, HostedPane.RemoveContent(HostedPane.SelectedIndex)); |
||||
Manager.MainDocumentPane.SelectedIndex = 0; |
||||
|
||||
currentContent.SetStateToDocument(); |
||||
|
||||
if (HostedPane.Items.Count == 0) |
||||
this.Close(); |
||||
e.Handled = true; |
||||
} |
||||
else if (e.Command == CloseCommand) |
||||
{ |
||||
//DockableContent currentContent = HostedPane.SelectedItem as DockableContent;
|
||||
//Manager.Hide(currentContent);
|
||||
HostedPane.CloseOrHide(); |
||||
if (HostedPane.Items.Count == 0) |
||||
this.Close(); |
||||
e.Handled = true; |
||||
} |
||||
|
||||
base.OnExecuteCommand(sender, e); |
||||
} |
||||
|
||||
protected override void Redock() |
||||
{ |
||||
if (_previousPane != null) |
||||
{ |
||||
if (_previousPane.GetManager() == null) |
||||
{ |
||||
DockablePane newContainerPane = new DockablePane(); |
||||
newContainerPane.Items.Add(HostedPane.RemoveContent(0)); |
||||
newContainerPane.SetValue(ResizingPanel.ResizeWidthProperty, _previousPane.GetValue(ResizingPanel.ResizeWidthProperty)); |
||||
newContainerPane.SetValue(ResizingPanel.ResizeHeightProperty, _previousPane.GetValue(ResizingPanel.ResizeHeightProperty)); |
||||
|
||||
if (_previousPane.Style != null) |
||||
newContainerPane.Style = _previousPane.Style; |
||||
|
||||
Manager.Anchor(newContainerPane, ((DockablePane)_previousPane).Anchor); |
||||
} |
||||
else |
||||
{ |
||||
if (_arrayIndexPreviousPane > _previousPane.Items.Count) |
||||
_arrayIndexPreviousPane = _previousPane.Items.Count; |
||||
|
||||
DockableContent currentContent = HostedPane.Items[0] as DockableContent; |
||||
_previousPane.Items.Insert(_arrayIndexPreviousPane, HostedPane.RemoveContent(0)); |
||||
_previousPane.SelectedIndex = _arrayIndexPreviousPane; |
||||
currentContent.SetStateToDock(); |
||||
|
||||
} |
||||
this.Close(); |
||||
} |
||||
|
||||
base.Redock(); |
||||
} |
||||
|
||||
|
||||
} |
||||
} |
@ -1,501 +0,0 @@
@@ -1,501 +0,0 @@
|
||||
//Copyright (c) 2007-2009, 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; |
||||
|
||||
|
||||
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 |
||||
} |
||||
|
||||
|
||||
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))); |
||||
} |
||||
|
||||
protected override void OnInitialized(EventArgs e) |
||||
{ |
||||
base.OnInitialized(e); |
||||
|
||||
this.CommandBindings.Add( |
||||
new CommandBinding(ShowOptionsCommand, this.OnExecuteCommand, this.OnCanExecuteCommand)); |
||||
this.CommandBindings.Add( |
||||
new CommandBinding(ToggleAutoHideCommand, this.OnExecuteCommand, this.OnCanExecuteCommand)); |
||||
this.CommandBindings.Add( |
||||
new CommandBinding(CloseCommand, this.OnExecuteCommand, this.OnCanExecuteCommand)); |
||||
} |
||||
|
||||
public DockablePane() |
||||
{ |
||||
this.Loaded += new RoutedEventHandler(DockablePane_Loaded); |
||||
this.Unloaded += new RoutedEventHandler(DockablePane_Unloaded); |
||||
} |
||||
|
||||
void DockablePane_Loaded(object sender, RoutedEventArgs e) |
||||
{ |
||||
|
||||
} |
||||
void DockablePane_Unloaded(object sender, RoutedEventArgs e) |
||||
{ |
||||
UnloadOptionsContextMenu(); |
||||
} |
||||
|
||||
|
||||
#region Dependency properties
|
||||
|
||||
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(DockablePane), new UIPropertyMetadata(true)); |
||||
|
||||
|
||||
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); |
||||
} |
||||
|
||||
_optionsContextMenuPlacementTarget = GetTemplateChild("PART_ShowContextMenuButton") as UIElement; |
||||
} |
||||
|
||||
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
public override bool IsSurfaceVisible |
||||
{ |
||||
get |
||||
{ |
||||
foreach (ManagedContent managedContent in Items) |
||||
{ |
||||
if (managedContent is DocumentContent) |
||||
continue; |
||||
|
||||
if (((DockableContent)managedContent).State == DockableContentState.Docked) |
||||
return true; |
||||
} |
||||
|
||||
return false; |
||||
} |
||||
} |
||||
|
||||
|
||||
#region OptionsContextMenu
|
||||
ContextMenu cxOptions = null; |
||||
|
||||
UIElement _optionsContextMenuPlacementTarget = null; |
||||
|
||||
void LoadOptionsContextMenu() |
||||
{ |
||||
Debug.Assert(cxOptions == null); |
||||
cxOptions = FindResource(new ComponentResourceKey(typeof(DockingManager), ContextMenuElement.DockablePane)) as ContextMenu; |
||||
cxOptions.Opened += new RoutedEventHandler(cxOptions_RefreshOpenState); |
||||
cxOptions.Closed += new RoutedEventHandler(cxOptions_RefreshOpenState); |
||||
} |
||||
|
||||
void UnloadOptionsContextMenu() |
||||
{ |
||||
if (cxOptions != null) |
||||
{ |
||||
cxOptions.Opened -= new RoutedEventHandler(cxOptions_RefreshOpenState); |
||||
cxOptions.Closed -= new RoutedEventHandler(cxOptions_RefreshOpenState); |
||||
cxOptions = null; |
||||
} |
||||
} |
||||
|
||||
|
||||
protected virtual void OpenOptionsContextMenu() |
||||
{ |
||||
if (cxOptions == null) |
||||
{ |
||||
LoadOptionsContextMenu(); |
||||
} |
||||
|
||||
if (cxOptions != null) |
||||
{ |
||||
cxOptions.DataContext = this.SelectedItem as DockableContent; |
||||
|
||||
foreach (MenuItem menuItem in cxOptions.Items) |
||||
menuItem.CommandTarget = this.SelectedItem as DockableContent; |
||||
|
||||
if (_optionsContextMenuPlacementTarget != null) |
||||
{ |
||||
cxOptions.Placement = PlacementMode.Bottom; |
||||
cxOptions.PlacementTarget = _optionsContextMenuPlacementTarget; |
||||
} |
||||
else |
||||
{ |
||||
cxOptions.Placement = PlacementMode.MousePoint; |
||||
cxOptions.PlacementTarget = this; |
||||
} |
||||
|
||||
cxOptions.IsOpen = true; |
||||
} |
||||
} |
||||
|
||||
void cxOptions_RefreshOpenState(object sender, RoutedEventArgs e) |
||||
{ |
||||
NotifyPropertyChanged("IsOptionsMenuOpened"); |
||||
} |
||||
|
||||
public bool IsOptionsMenuOpened |
||||
{ |
||||
get |
||||
{ |
||||
return cxOptions != null && cxOptions.IsOpen && ( |
||||
_optionsContextMenuPlacementTarget != null ? |
||||
cxOptions.PlacementTarget == _optionsContextMenuPlacementTarget : |
||||
cxOptions.PlacementTarget == this); |
||||
} |
||||
} |
||||
|
||||
#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 = internalContent.Focus();
|
||||
selectedContent.SetAsActive(); |
||||
} |
||||
} |
||||
|
||||
Point ptStartDrag; |
||||
bool isMouseDown = false; |
||||
protected virtual void OnHeaderMouseDown(object sender, MouseButtonEventArgs e) |
||||
{ |
||||
if (!e.Handled) |
||||
{ |
||||
FocusContent(); |
||||
|
||||
if (((DockableContent)SelectedItem).State != DockableContentState.AutoHide) |
||||
{ |
||||
ptStartDrag = e.MouseDevice.GetPosition(this); |
||||
isMouseDown = true; |
||||
} |
||||
} |
||||
} |
||||
|
||||
protected virtual void OnHeaderMouseMove(object sender, MouseEventArgs e) |
||||
{ |
||||
Point ptMouseMove = e.GetPosition(this); |
||||
|
||||
if (!e.Handled && isMouseDown) |
||||
{ |
||||
if (_partHeader != null && |
||||
_partHeader.IsMouseOver) |
||||
{ |
||||
if (!IsMouseCaptured) |
||||
{ |
||||
if (Math.Abs(ptMouseMove.X - ptStartDrag.X) > SystemParameters.MinimumHorizontalDragDistance || |
||||
Math.Abs(ptMouseMove.Y - ptStartDrag.Y) > SystemParameters.MinimumVerticalDragDistance) |
||||
{ |
||||
isMouseDown = false; |
||||
ReleaseMouseCapture(); |
||||
DockingManager manager = GetManager(); |
||||
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
|
||||
private static object syncRoot = new object(); |
||||
|
||||
|
||||
private static RoutedUICommand optionsCommand = null; |
||||
public static RoutedUICommand ShowOptionsCommand |
||||
{ |
||||
get |
||||
{ |
||||
lock (syncRoot) |
||||
{ |
||||
if (null == optionsCommand) |
||||
{ |
||||
optionsCommand = new RoutedUICommand("S_how options", "Options", typeof(DockablePane)); |
||||
} |
||||
} |
||||
return optionsCommand; |
||||
} |
||||
} |
||||
|
||||
private static RoutedUICommand autoHideCommand = null; |
||||
public static RoutedUICommand ToggleAutoHideCommand |
||||
{ |
||||
get |
||||
{ |
||||
lock (syncRoot) |
||||
{ |
||||
if (null == autoHideCommand) |
||||
{ |
||||
autoHideCommand = new RoutedUICommand("A_utohide", "AutoHide", typeof(DockablePane)); |
||||
} |
||||
} |
||||
return autoHideCommand; |
||||
} |
||||
} |
||||
|
||||
private static RoutedUICommand closeCommand = null; |
||||
public static RoutedUICommand CloseCommand |
||||
{ |
||||
get |
||||
{ |
||||
lock (syncRoot) |
||||
{ |
||||
if (null == closeCommand) |
||||
{ |
||||
closeCommand = new RoutedUICommand("C_lose", "Close", typeof(DockablePane)); |
||||
} |
||||
} |
||||
return closeCommand; |
||||
} |
||||
} |
||||
|
||||
|
||||
internal virtual void OnExecuteCommand(object sender, ExecutedRoutedEventArgs e) |
||||
{ |
||||
if (e.Command == ToggleAutoHideCommand) |
||||
{ |
||||
ToggleAutoHide(); |
||||
e.Handled = true; |
||||
} |
||||
else if (e.Command == CloseCommand) |
||||
{ |
||||
CloseOrHide(); |
||||
e.Handled = true; |
||||
} |
||||
else if (e.Command == ShowOptionsCommand) |
||||
{ |
||||
OpenOptionsContextMenu(); |
||||
e.Handled = true; |
||||
} |
||||
|
||||
} |
||||
|
||||
protected virtual void OnCanExecuteCommand(object sender, CanExecuteRoutedEventArgs e) |
||||
{ |
||||
e.CanExecute = true; |
||||
} |
||||
|
||||
#endregion
|
||||
|
||||
|
||||
public override bool IsDocked |
||||
{ |
||||
get { return IsSurfaceVisible; } |
||||
} |
||||
|
||||
|
||||
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; |
||||
} |
||||
|
||||
public override ManagedContent RemoveContent(int index) |
||||
{ |
||||
ManagedContent content = base.RemoveContent(index); |
||||
|
||||
if (Items.Count == 0) |
||||
{ |
||||
ResizingPanel containerPanel = Parent as ResizingPanel; |
||||
if (containerPanel != null) |
||||
containerPanel.RemoveChild(this); |
||||
} |
||||
|
||||
return content; |
||||
} |
||||
|
||||
protected virtual void CheckItems(IList newItems) |
||||
{ |
||||
foreach (object newItem in newItems) |
||||
{ |
||||
if (!(newItem is DockableContent)) |
||||
throw new InvalidOperationException("DockablePane can contain only DockableContents!"); |
||||
} |
||||
} |
||||
|
||||
protected override void OnItemsChanged(System.Collections.Specialized.NotifyCollectionChangedEventArgs e) |
||||
{ |
||||
if (e.NewItems != null) |
||||
CheckItems(e.NewItems); |
||||
|
||||
base.OnItemsChanged(e); |
||||
} |
||||
|
||||
|
||||
|
||||
#region Dockable Pane operations
|
||||
/// <summary>
|
||||
/// Show/Hide a flyout window containing this pane
|
||||
/// </summary>
|
||||
internal virtual void ToggleAutoHide() |
||||
{ |
||||
bool flag = true; |
||||
foreach (DockableContent cnt in this.Items) |
||||
{ |
||||
if ((cnt.DockableStyle & DockableStyle.AutoHide) == 0) |
||||
{ |
||||
flag = false; |
||||
break; |
||||
} |
||||
} |
||||
if (flag && GetManager() != null) |
||||
GetManager().ToggleAutoHide(this); |
||||
} |
||||
|
||||
|
||||
/// <summary>
|
||||
/// Closes or hides current content depending on HideOnClose property
|
||||
/// </summary>
|
||||
internal void CloseOrHide() |
||||
{ |
||||
CloseOrHide(SelectedItem as DockableContent, false); |
||||
} |
||||
|
||||
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
} |
||||
} |
@ -1,117 +0,0 @@
@@ -1,117 +0,0 @@
|
||||
//Copyright (c) 2007-2009, 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 |
||||
{ |
||||
[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 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))); |
||||
|
||||
|
||||
static void OnPaneAttached(DependencyObject depObj, DependencyPropertyChangedEventArgs e) |
||||
{ |
||||
if (e.Property == ReferencedContentPropertyKey.DependencyProperty) |
||||
{ |
||||
DockablePaneAnchorTab _this = depObj as DockablePaneAnchorTab; |
||||
if (_this.PropertyChanged != null) |
||||
{ |
||||
_this.PropertyChanged(depObj, new PropertyChangedEventArgs("Anchor")); |
||||
_this.PropertyChanged(depObj, new PropertyChangedEventArgs("Icon")); |
||||
_this.PropertyChanged(depObj, new PropertyChangedEventArgs("ReferencedContent")); |
||||
} |
||||
} |
||||
|
||||
} |
||||
|
||||
public AnchorStyle Anchor |
||||
{ |
||||
get { return (AnchorStyle)GetValue(AnchorPropertyKey.DependencyProperty); } |
||||
internal 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)); |
||||
|
||||
protected override void OnMouseMove(MouseEventArgs e) |
||||
{ |
||||
if (ReferencedContent != null) |
||||
ReferencedContent.Manager.ShowFlyoutWindow(ReferencedContent); |
||||
|
||||
base.OnMouseMove(e); |
||||
} |
||||
|
||||
|
||||
|
||||
public object Icon |
||||
{ |
||||
get { return (object)GetValue(IconProperty); } |
||||
set { SetValue(IconProperty, value); } |
||||
} |
||||
|
||||
// Using a DependencyProperty as the backing store for Icon. This enables animation, styling, binding, etc...
|
||||
public static readonly DependencyProperty IconProperty = |
||||
DependencyProperty.Register("Icon", typeof(object), typeof(DockablePaneAnchorTab)); |
||||
|
||||
#region INotifyPropertyChanged Members
|
||||
|
||||
public event PropertyChangedEventHandler PropertyChanged; |
||||
|
||||
#endregion
|
||||
|
||||
|
||||
} |
||||
} |
@ -1,64 +0,0 @@
@@ -1,64 +0,0 @@
|
||||
//Copyright (c) 2007-2009, 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); |
||||
} |
||||
} |
||||
} |
@ -1,113 +0,0 @@
@@ -1,113 +0,0 @@
|
||||
//Copyright (c) 2007-2009, 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; |
||||
//double maxHeight = 0;
|
||||
|
||||
if (Children.Count == 0) |
||||
return base.MeasureOverride(availableSize); |
||||
|
||||
|
||||
List<UIElement> childsOrderedByWidth = new List<UIElement>(); |
||||
|
||||
foreach (FrameworkElement child in Children) |
||||
{ |
||||
child.Width = double.NaN; |
||||
child.Height = double.NaN; |
||||
|
||||
child.Measure(new Size(double.PositiveInfinity, availableSize.Height)); |
||||
totWidth += child.DesiredSize.Width; |
||||
childsOrderedByWidth.Add(child); |
||||
} |
||||
|
||||
if (totWidth > availableSize.Width) |
||||
{ |
||||
childsOrderedByWidth.Sort(delegate(UIElement elem1, UIElement elem2) { return elem2.DesiredSize.Width.CompareTo(elem1.DesiredSize.Width); }); |
||||
|
||||
|
||||
int i = childsOrderedByWidth.Count - 1; |
||||
double sumWidth = 0; |
||||
|
||||
while (childsOrderedByWidth[i].DesiredSize.Width * (i + 1) + sumWidth < availableSize.Width) |
||||
{ |
||||
sumWidth += childsOrderedByWidth[i].DesiredSize.Width; |
||||
|
||||
i--; |
||||
|
||||
if (i < 0) |
||||
break; |
||||
|
||||
} |
||||
|
||||
double shWidth = (availableSize.Width - sumWidth) / (i + 1); |
||||
|
||||
|
||||
foreach (UIElement child in Children) |
||||
{ |
||||
if (shWidth < child.DesiredSize.Width) |
||||
child.Measure(new Size(shWidth, 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 += childFinalWidth; |
||||
} |
||||
|
||||
return base.ArrangeOverride(finalSize); |
||||
} |
||||
|
||||
} |
||||
} |
@ -1,298 +0,0 @@
@@ -1,298 +0,0 @@
|
||||
//Copyright (c) 2007-2009, 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); |
||||
} |
||||
|
||||
|
||||
|
||||
DateTime _lastActivation = DateTime.MinValue; |
||||
|
||||
internal DateTime LastActivation |
||||
{ |
||||
get { return _lastActivation; } |
||||
} |
||||
|
||||
void DocumentContent_PropertyChanged(object sender, PropertyChangedEventArgs e) |
||||
{ |
||||
if (e.PropertyName == "IsActiveContent") |
||||
{ |
||||
if (IsActiveContent) |
||||
_lastActivation = DateTime.Now; |
||||
} |
||||
} |
||||
|
||||
static void OnSizePropertyChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e) |
||||
{ } |
||||
|
||||
static object CourceSizeToNaN(DependencyObject sender, object value) |
||||
{ |
||||
//return double.NaN;
|
||||
return value; |
||||
} |
||||
|
||||
string _infoTip; |
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the 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 _infoTip; } |
||||
set |
||||
{ |
||||
_infoTip = value; |
||||
NotifyPropertyChanged("InfoTip"); |
||||
} |
||||
} |
||||
|
||||
string _contentTypeDescription; |
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a text which describes the type of content contained in this document.
|
||||
/// </summary>
|
||||
public string ContentTypeDescription |
||||
{ |
||||
get { return _contentTypeDescription; } |
||||
set |
||||
{ |
||||
_contentTypeDescription = value; |
||||
NotifyPropertyChanged("ContentTypeDescription"); |
||||
} |
||||
} |
||||
|
||||
bool _isFloatingAllowed; |
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating if this document can float over main window (VS2010 Feature).
|
||||
/// </summary>
|
||||
public bool IsFloatingAllowed |
||||
{ |
||||
get { return _isFloatingAllowed; } |
||||
set |
||||
{ |
||||
_isFloatingAllowed = value; |
||||
NotifyPropertyChanged("IsFloatingAllowed"); |
||||
} |
||||
} |
||||
|
||||
protected override void OnDragStart(Point ptMouse, Point ptRelativeMouse) |
||||
{ |
||||
//Manager.Drag(this, this.PointToScreenDPI(ptMouse), ptRelativeMouse);
|
||||
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) |
||||
{ |
||||
DragEnabledArea.InputBindings.Add(new InputBinding(ApplicationCommands.Close, new MouseGesture(MouseAction.MiddleClick))); |
||||
} |
||||
} |
||||
|
||||
/// <summary>
|
||||
/// Event fired when the document is about to be closed
|
||||
/// </summary>
|
||||
public event EventHandler<CancelEventArgs> Closing; |
||||
|
||||
/// <summary>
|
||||
/// Event fired when the document 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 this content without notifications
|
||||
/// </summary>
|
||||
internal void InternalClose() |
||||
{ |
||||
|
||||
|
||||
DocumentPane parentPane = ContainerPane as DocumentPane; |
||||
DockingManager manager = Manager; |
||||
|
||||
if (manager != null) |
||||
{ |
||||
if (manager.ActiveContent == this) |
||||
manager.ActiveContent = null; |
||||
|
||||
if (manager.ActiveDocument == this) |
||||
manager.ActiveDocument = null; |
||||
} |
||||
|
||||
if (parentPane != null) |
||||
{ |
||||
parentPane.Items.Remove(this); |
||||
|
||||
parentPane.CheckContentsEmpty(); |
||||
} |
||||
else |
||||
{ |
||||
FloatingDockablePane floatingParentPane = ContainerPane as FloatingDockablePane; |
||||
if (floatingParentPane != null) |
||||
{ |
||||
floatingParentPane.RemoveContent(0); |
||||
if (floatingParentPane.FloatingWindow != null && |
||||
!floatingParentPane.FloatingWindow.IsClosing) |
||||
floatingParentPane.FloatingWindow.Close(); |
||||
} |
||||
} |
||||
|
||||
|
||||
|
||||
|
||||
} |
||||
|
||||
/// <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.
|
||||
/// <para>
|
||||
/// Note:<see cref="DockableContent"/> cannot be closed: AvalonDock simply hide a <see cref="DockableContent"/> removing all the reference to it.
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
public 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); |
||||
} |
||||
|
||||
|
||||
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 (oldManager != null) |
||||
oldManager.FireDocumentClosedEvent(); |
||||
|
||||
|
||||
//if (Parent != null)
|
||||
// throw new InvalidOperationException();
|
||||
Debug.Assert(Parent == null, "Parent MUST bu null after Doc is closed"); |
||||
return true; |
||||
} |
||||
|
||||
|
||||
|
||||
} |
||||
} |
@ -1,357 +0,0 @@
@@ -1,357 +0,0 @@
|
||||
//Copyright (c) 2007-2009, 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; |
||||
|
||||
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))); |
||||
|
||||
Window.AllowsTransparencyProperty.OverrideMetadata(typeof(DocumentFloatingWindow), new FrameworkPropertyMetadata(true)); |
||||
Window.WindowStyleProperty.OverrideMetadata(typeof(DocumentFloatingWindow), new FrameworkPropertyMetadata(WindowStyle.None)); |
||||
Window.ShowInTaskbarProperty.OverrideMetadata(typeof(DocumentFloatingWindow), new FrameworkPropertyMetadata(false)); |
||||
} |
||||
|
||||
|
||||
public DocumentFloatingWindow(DockingManager manager) |
||||
:base(manager) |
||||
{ |
||||
} |
||||
|
||||
Pane _previousPane = null; |
||||
|
||||
int _arrayIndexPreviousPane = -1; |
||||
|
||||
public DocumentFloatingWindow(DockingManager manager, DocumentContent content) |
||||
: this(manager) |
||||
{ |
||||
//create a new temporary pane
|
||||
FloatingDockablePane pane = new FloatingDockablePane(this); |
||||
|
||||
//setup window size
|
||||
Width = content.ContainerPane.ActualWidth; |
||||
Height = content.ContainerPane.ActualHeight; |
||||
|
||||
//save current content position in container pane
|
||||
_previousPane = content.ContainerPane; |
||||
_arrayIndexPreviousPane = _previousPane.Items.IndexOf(content); |
||||
pane.SetValue(ResizingPanel.ResizeWidthProperty, _previousPane.GetValue(ResizingPanel.ResizeWidthProperty)); |
||||
pane.SetValue(ResizingPanel.ResizeHeightProperty, _previousPane.GetValue(ResizingPanel.ResizeHeightProperty)); |
||||
|
||||
//remove content from container pane
|
||||
content.ContainerPane.RemoveContent(_arrayIndexPreviousPane); |
||||
|
||||
//add content to my temporary pane
|
||||
pane.Items.Add(content); |
||||
|
||||
//let templates access this pane
|
||||
HostedPane = pane; |
||||
|
||||
if (IsDocumentFloatingAllowed) |
||||
{ |
||||
AllowsTransparency = false; |
||||
WindowStyle = WindowStyle.ToolWindow; |
||||
NotifyPropertyChanged("IsDocumentFloatingAllowed"); |
||||
} |
||||
} |
||||
|
||||
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(); |
||||
} |
||||
|
||||
|
||||
base.OnEndDrag(); |
||||
} |
||||
|
||||
|
||||
public override Pane ClonePane() |
||||
{ |
||||
DocumentPane paneToAnchor = new DocumentPane(); |
||||
|
||||
////transfer the resizing panel sizes
|
||||
//paneToAnchor.SetValue(ResizingPanel.ResizeWidthProperty,
|
||||
// HostedPane.GetValue(ResizingPanel.ResizeWidthProperty));
|
||||
//paneToAnchor.SetValue(ResizingPanel.ResizeHeightProperty,
|
||||
// HostedPane.GetValue(ResizingPanel.ResizeHeightProperty));
|
||||
|
||||
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)); |
||||
} |
||||
|
||||
return paneToAnchor; |
||||
} |
||||
|
||||
|
||||
protected override void OnInitialized(EventArgs e) |
||||
{ |
||||
|
||||
if (IsDocumentFloatingAllowed) |
||||
{ |
||||
if (HostedPane != null) |
||||
{ |
||||
Content = HostedPane; |
||||
} |
||||
} |
||||
|
||||
base.OnInitialized(e); |
||||
} |
||||
|
||||
internal override void OnShowSelectionBox() |
||||
{ |
||||
this.Visibility = Visibility.Hidden; |
||||
base.OnShowSelectionBox(); |
||||
} |
||||
|
||||
internal override void OnHideSelectionBox() |
||||
{ |
||||
this.Visibility = Visibility.Visible; |
||||
base.OnHideSelectionBox(); |
||||
} |
||||
#region Commands
|
||||
|
||||
protected override void OnExecuteCommand(object sender, ExecutedRoutedEventArgs e) |
||||
{ |
||||
if (e.Command == TabbedDocumentCommand) |
||||
{ |
||||
DocumentContent currentContent = HostedPane.SelectedItem as DocumentContent; |
||||
|
||||
_previousPane.Items.Insert(0, HostedPane.RemoveContent(HostedPane.SelectedIndex)); |
||||
_previousPane.SelectedIndex = 0; |
||||
|
||||
if (HostedPane.Items.Count == 0) |
||||
this.Close(); |
||||
e.Handled = true; |
||||
} |
||||
else if (e.Command == CloseCommand) |
||||
{ |
||||
DocumentContent docContent = this.HostedPane.Items[0] as DocumentContent; |
||||
e.Handled = docContent.Close(); |
||||
} |
||||
|
||||
base.OnExecuteCommand(sender, e); |
||||
} |
||||
|
||||
|
||||
#endregion
|
||||
//#region Drag
|
||||
//protected override IntPtr FilterMessage(IntPtr hwnd, int msg, IntPtr wParam, IntPtr lParam, ref bool handled)
|
||||
//{
|
||||
// handled = false;
|
||||
|
||||
// if (!IsDocumentFloatingAllowed)
|
||||
// return IntPtr.Zero;
|
||||
|
||||
// switch (msg)
|
||||
// {
|
||||
// case WM_SIZE:
|
||||
// case WM_MOVE:
|
||||
// //HostedPane.ReferencedPane.SaveFloatingWindowSizeAndPosition(this);
|
||||
// break;
|
||||
// case WM_NCLBUTTONDOWN:
|
||||
// if (IsDockableWindow && wParam.ToInt32() == HTCAPTION)
|
||||
// {
|
||||
// short x = (short)((lParam.ToInt32() & 0xFFFF));
|
||||
// short y = (short)((lParam.ToInt32() >> 16));
|
||||
|
||||
// Point clickPoint = this.TransformToDeviceDPI(new Point(x, y));
|
||||
// Manager.Drag(this, clickPoint, new Point(clickPoint.X - Left, clickPoint.Y - Top));
|
||||
|
||||
// handled = true;
|
||||
// }
|
||||
// break;
|
||||
// case WM_NCLBUTTONDBLCLK:
|
||||
// if (IsDockableWindow && wParam.ToInt32() == HTCAPTION)
|
||||
// {
|
||||
// if (IsDockableWindow)
|
||||
// {
|
||||
// if (_previousPane != null)
|
||||
// {
|
||||
// if (_previousPane.GetManager() == null)
|
||||
// {
|
||||
// DockablePane newContainerPane = new DockablePane();
|
||||
// newContainerPane.Items.Add(HostedPane.RemoveContent(0));
|
||||
// newContainerPane.SetValue(ResizingPanel.ResizeWidthProperty, _previousPane.GetValue(ResizingPanel.ResizeWidthProperty));
|
||||
// newContainerPane.SetValue(ResizingPanel.ResizeHeightProperty, _previousPane.GetValue(ResizingPanel.ResizeHeightProperty));
|
||||
// Manager.Anchor(newContainerPane, ((DockablePane)_previousPane).Anchor);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// if (_arrayIndexPreviousPane > _previousPane.Items.Count)
|
||||
// _arrayIndexPreviousPane = _previousPane.Items.Count;
|
||||
|
||||
// DockableContent currentContent = HostedPane.Items[0] as DockableContent;
|
||||
// _previousPane.Items.Insert(_arrayIndexPreviousPane, HostedPane.RemoveContent(0));
|
||||
// _previousPane.SelectedIndex = _arrayIndexPreviousPane;
|
||||
// currentContent.SetStateToDock();
|
||||
|
||||
// }
|
||||
// this.Close();
|
||||
// }
|
||||
|
||||
// handled = true;
|
||||
// }
|
||||
// }
|
||||
// break;
|
||||
// case WM_NCRBUTTONDOWN:
|
||||
// if (wParam.ToInt32() == HTCAPTION)
|
||||
// {
|
||||
// short x = (short)((lParam.ToInt32() & 0xFFFF));
|
||||
// short y = (short)((lParam.ToInt32() >> 16));
|
||||
|
||||
// ContextMenu cxMenu = FindResource(new ComponentResourceKey(typeof(DockingManager), ContextMenuElement.FloatingWindow)) as ContextMenu;
|
||||
// if (cxMenu != null)
|
||||
// {
|
||||
// foreach (MenuItem menuItem in cxMenu.Items)
|
||||
// menuItem.CommandTarget = this;
|
||||
|
||||
// cxMenu.Placement = PlacementMode.AbsolutePoint;
|
||||
// cxMenu.PlacementRectangle = new Rect(new Point(x, y), new Size(0, 0));
|
||||
// cxMenu.PlacementTarget = this;
|
||||
// cxMenu.IsOpen = true;
|
||||
// }
|
||||
|
||||
// handled = true;
|
||||
// }
|
||||
// break;
|
||||
// case WM_NCRBUTTONUP:
|
||||
// if (wParam.ToInt32() == HTCAPTION)
|
||||
// {
|
||||
|
||||
// handled = true;
|
||||
// }
|
||||
// break;
|
||||
|
||||
// }
|
||||
|
||||
|
||||
// return IntPtr.Zero;
|
||||
//}
|
||||
//#endregion
|
||||
|
||||
protected override void Redock() |
||||
{ |
||||
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(); |
||||
} |
||||
|
||||
base.Redock(); |
||||
} |
||||
|
||||
|
||||
protected override void OnClosing(CancelEventArgs e) |
||||
{ |
||||
base.OnClosing(e); |
||||
|
||||
if (e.Cancel) |
||||
return; |
||||
|
||||
if (this.HostedPane.Items.Count > 0) |
||||
{ |
||||
DocumentContent docContent = this.HostedPane.Items[0] as DocumentContent; |
||||
if (!docContent.Close()) |
||||
e.Cancel = true; |
||||
else |
||||
this.HostedPane.Items.Remove(docContent); |
||||
} |
||||
|
||||
} |
||||
} |
||||
} |
@ -1,252 +0,0 @@
@@ -1,252 +0,0 @@
|
||||
//Copyright (c) 2007-2009, 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 : Window, INotifyPropertyChanged |
||||
{ |
||||
static DocumentNavigatorWindow() |
||||
{ |
||||
DefaultStyleKeyProperty.OverrideMetadata(typeof(DocumentNavigatorWindow), new FrameworkPropertyMetadata(typeof(DocumentNavigatorWindow))); |
||||
|
||||
|
||||
Window.AllowsTransparencyProperty.OverrideMetadata(typeof(DocumentNavigatorWindow), new FrameworkPropertyMetadata(true)); |
||||
Window.WindowStyleProperty.OverrideMetadata(typeof(DocumentNavigatorWindow), new FrameworkPropertyMetadata(WindowStyle.None)); |
||||
Window.ShowInTaskbarProperty.OverrideMetadata(typeof(DocumentNavigatorWindow), new FrameworkPropertyMetadata(false)); |
||||
Control.BackgroundProperty.OverrideMetadata(typeof(DocumentNavigatorWindow), new FrameworkPropertyMetadata(Brushes.Transparent)); |
||||
} |
||||
|
||||
public 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>(); |
||||
listOfDocuments.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.SetAsActive(); |
||||
} |
||||
} |
||||
} |
||||
|
||||
if (!_isClosing) |
||||
CloseThisWindow();// Hide();
|
||||
|
||||
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
|
||||
} |
||||
|
||||
} |
@ -1,520 +0,0 @@
@@ -1,520 +0,0 @@
|
||||
//Copyright (c) 2007-2009, 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; |
||||
|
||||
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) |
||||
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); |
||||
} |
||||
} |
||||
|
||||
public bool? IsMainDocumentPane |
||||
{ |
||||
get |
||||
{ |
||||
if (GetManager() == null) |
||||
return null; |
||||
|
||||
return GetManager().MainDocumentPane == this; |
||||
} |
||||
} |
||||
|
||||
protected override void OnInitialized(EventArgs e) |
||||
{ |
||||
this.CommandBindings.Add( |
||||
new CommandBinding(ShowDocumentsListMenuCommand, ExecutedShowDocumentsListMenuCommand, CanExecuteShowDocumentsListMenuCommand)); |
||||
this.CommandBindings.Add( |
||||
new CommandBinding(ApplicationCommands.Close, ExecutedCloseCommand, CanExecuteCloseCommand)); |
||||
this.CommandBindings.Add( |
||||
new CommandBinding(CloseCommand, ExecutedCloseCommand, CanExecuteCloseCommand)); |
||||
|
||||
this.CommandBindings.Add( |
||||
new CommandBinding(CloseAllButThisCommand, this.OnExecuteCommand, this.OnCanExecuteCommand)); |
||||
this.CommandBindings.Add( |
||||
new CommandBinding(NewHorizontalTabGroupCommand, this.OnExecuteCommand, this.OnCanExecuteCommand)); |
||||
this.CommandBindings.Add( |
||||
new CommandBinding(NewVerticalTabGroupCommand, 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(this, null); |
||||
} |
||||
|
||||
|
||||
public void CanExecuteShowDocumentsListMenuCommand(object sender, |
||||
CanExecuteRoutedEventArgs e) |
||||
{ |
||||
e.CanExecute = true; |
||||
} |
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region Close Command
|
||||
|
||||
//ApplicationCommands.Close command....
|
||||
|
||||
public void ExecutedCloseCommand(object sender, |
||||
ExecutedRoutedEventArgs e) |
||||
{ |
||||
if (GetManager() == null) |
||||
return; |
||||
|
||||
ManagedContent contentToClose = SelectedItem as ManagedContent; |
||||
|
||||
if (e.Parameter is ManagedContent) |
||||
contentToClose = e.Parameter as ManagedContent; |
||||
|
||||
DockableContent dockableContent = contentToClose as DockableContent; |
||||
|
||||
if (dockableContent != null) |
||||
CloseOrHide(dockableContent); |
||||
else |
||||
{ |
||||
DocumentContent documentContent = contentToClose as DocumentContent; |
||||
documentContent.Close(); |
||||
|
||||
//if (documentContent != null)
|
||||
// Items.Remove(documentContent);
|
||||
|
||||
//CheckContentsEmpty();
|
||||
} |
||||
|
||||
} |
||||
|
||||
|
||||
public void CanExecuteCloseCommand(object sender, |
||||
CanExecuteRoutedEventArgs e) |
||||
{ |
||||
e.CanExecute = true; |
||||
} |
||||
|
||||
#endregion
|
||||
|
||||
#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) |
||||
{ |
||||
if (!DocumentTabPanel.GetIsHeaderVisible(doc)) |
||||
{ |
||||
DocumentPane parentPane = doc.ContainerPane as DocumentPane; |
||||
parentPane.Items.Remove(doc); |
||||
parentPane.Items.Insert(0, doc); |
||||
} |
||||
////doc.IsSelected = true;
|
||||
////Selector.SetIsSelected(doc, true);
|
||||
//if (this.GetManager() != null)
|
||||
// this.GetManager().ActiveContent = doc;
|
||||
doc.SetAsActive(); |
||||
} |
||||
} |
||||
|
||||
public void CanExecuteActivateDocumentCommand(object sender, |
||||
CanExecuteRoutedEventArgs e) |
||||
{ |
||||
//ManagedContent doc = e.Parameter as ManagedContent;
|
||||
//if (doc != null && !doc.IsSelected)
|
||||
e.CanExecute = true; |
||||
} |
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region Commands
|
||||
private static object syncRoot = new object(); |
||||
|
||||
|
||||
private static RoutedUICommand closeAllButThisCommand = null; |
||||
public static RoutedUICommand CloseAllButThisCommand |
||||
{ |
||||
get |
||||
{ |
||||
lock (syncRoot) |
||||
{ |
||||
if (null == closeAllButThisCommand) |
||||
{ |
||||
closeAllButThisCommand = new RoutedUICommand("Close All But This", "CloseAllButThis", typeof(DocumentPane)); |
||||
} |
||||
} |
||||
return closeAllButThisCommand; |
||||
} |
||||
} |
||||
|
||||
private static RoutedUICommand closeCommand = null; |
||||
public static RoutedUICommand CloseCommand |
||||
{ |
||||
get |
||||
{ |
||||
lock (syncRoot) |
||||
{ |
||||
if (null == closeCommand) |
||||
{ |
||||
closeCommand = new RoutedUICommand("C_lose", "Close", typeof(DocumentPane)); |
||||
} |
||||
} |
||||
return closeCommand; |
||||
} |
||||
} |
||||
|
||||
private static RoutedUICommand newHTabGroupCommand = null; |
||||
public static RoutedUICommand NewHorizontalTabGroupCommand |
||||
{ |
||||
get |
||||
{ |
||||
lock (syncRoot) |
||||
{ |
||||
if (null == newHTabGroupCommand) |
||||
{ |
||||
newHTabGroupCommand = new RoutedUICommand("New Horizontal Tab Group", "NewHorizontalTabGroup", typeof(DocumentPane)); |
||||
} |
||||
} |
||||
return newHTabGroupCommand; |
||||
} |
||||
} |
||||
|
||||
private static RoutedUICommand newVTabGroupCommand = null; |
||||
public static RoutedUICommand NewVerticalTabGroupCommand |
||||
{ |
||||
get |
||||
{ |
||||
lock (syncRoot) |
||||
{ |
||||
if (null == newVTabGroupCommand) |
||||
{ |
||||
newVTabGroupCommand = new RoutedUICommand("New Vertical Tab Group", "NewVerticalTabGroup", typeof(DocumentPane)); |
||||
} |
||||
} |
||||
return newVTabGroupCommand; |
||||
} |
||||
} |
||||
|
||||
|
||||
|
||||
internal virtual void OnExecuteCommand(object sender, ExecutedRoutedEventArgs e) |
||||
{ |
||||
if (e.Command == CloseAllButThisCommand) |
||||
{ |
||||
CloseAllButThis(); |
||||
e.Handled = true; |
||||
} |
||||
else if (e.Command == NewHorizontalTabGroupCommand) |
||||
{ |
||||
NewHorizontalTabGroup(); |
||||
e.Handled = true; |
||||
} |
||||
else if (e.Command == NewVerticalTabGroupCommand) |
||||
{ |
||||
NewVerticalTabGroup(); |
||||
e.Handled = true; |
||||
} |
||||
|
||||
} |
||||
|
||||
protected virtual void OnCanExecuteCommand(object sender, CanExecuteRoutedEventArgs e) |
||||
{ |
||||
e.CanExecute = this.GetManager() != null; |
||||
|
||||
if (e.CanExecute) |
||||
{ |
||||
if (e.Command == NewHorizontalTabGroupCommand || |
||||
e.Command == NewVerticalTabGroupCommand) |
||||
{ |
||||
if (this.Items.Count <= 1) |
||||
e.CanExecute = false; |
||||
} |
||||
} |
||||
} |
||||
|
||||
void CloseAllButThis() |
||||
{ |
||||
DocumentContent activeContent = GetManager().ActiveDocument as DocumentContent; |
||||
foreach (DocumentContent cnt in this.GetManager().Documents) |
||||
{ |
||||
if (cnt != activeContent) |
||||
cnt.Close(); |
||||
} |
||||
} |
||||
void NewHorizontalTabGroup() |
||||
{ |
||||
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); |
||||
|
||||
} |
||||
void NewVerticalTabGroup() |
||||
{ |
||||
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); |
||||
} |
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
UIElement _optionsContextMenuPlacementTarget; |
||||
|
||||
public override void OnApplyTemplate() |
||||
{ |
||||
_optionsContextMenuPlacementTarget = GetTemplateChild("PART_ShowContextMenuButton") as UIElement; |
||||
|
||||
|
||||
|
||||
base.OnApplyTemplate(); |
||||
} |
||||
|
||||
void ShowDocumentsListMenu(object sender, RoutedEventArgs e) |
||||
{ |
||||
if (Items.Count == 0) |
||||
return; //nothings to show
|
||||
|
||||
ContextMenu cxMenuDocuments = (ContextMenu)FindResource("DocumentsListMenu"); |
||||
if (cxMenuDocuments != null) |
||||
{ |
||||
cxMenuDocuments.ItemsSource = Items; |
||||
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; |
||||
} |
||||
} |
||||
|
||||
public override bool IsSurfaceVisible |
||||
{ |
||||
get |
||||
{ |
||||
if (IsMainDocumentPane.HasValue && |
||||
!IsMainDocumentPane.Value && |
||||
Items.Count == 0) |
||||
return false; |
||||
|
||||
return 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; |
||||
} |
||||
|
||||
public override Rect SurfaceRectangle |
||||
{ |
||||
get |
||||
{ |
||||
//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; |
||||
} |
||||
|
||||
} |
||||
} |
||||
|
||||
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); |
||||
} |
||||
|
||||
} |
||||
} |
@ -1,55 +0,0 @@
@@ -1,55 +0,0 @@
|
||||
//Copyright (c) 2007-2009, 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
|
||||
} |
||||
} |
@ -1,105 +0,0 @@
@@ -1,105 +0,0 @@
|
||||
//Copyright (c) 2007-2009, 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(0, availableSize.Height); |
||||
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, availableSize.Height)); |
||||
desideredSize.Width += child.DesiredSize.Width; |
||||
} |
||||
|
||||
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; |
||||
|
||||
} |
||||
} |
||||
} |
@ -1,120 +0,0 @@
@@ -1,120 +0,0 @@
|
||||
/* Copyright (c) 2008, Dr. WPF |
||||
* 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. |
||||
* |
||||
* * The name Dr. WPF may not be used to endorse or promote products |
||||
* derived from this software without specific prior written permission. |
||||
* |
||||
* THIS SOFTWARE IS PROVIDED BY Dr. WPF ``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 Dr. WPF 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.Collections.Specialized; |
||||
using System.Windows.Media; |
||||
|
||||
namespace DrWPF.Windows.Controls |
||||
{ |
||||
/// <summary>
|
||||
/// This panel maintains a collection of conceptual children that are neither logical
|
||||
/// children nor visual children of the panel. This allows those visuals to be connected
|
||||
/// to other parts of the UI, if necessary, or even to remain disconnected.
|
||||
/// </summary>
|
||||
public abstract class ConceptualPanel : Panel |
||||
{ |
||||
public ConceptualPanel() |
||||
{ |
||||
Loaded += OnLoaded; |
||||
} |
||||
|
||||
void OnLoaded(object sender, RoutedEventArgs e) |
||||
{ |
||||
Loaded -= OnLoaded; |
||||
(Children as DisconnectedUIElementCollection).Initialize(); |
||||
} |
||||
|
||||
protected override sealed UIElementCollection CreateUIElementCollection(FrameworkElement logicalParent) |
||||
{ |
||||
DisconnectedUIElementCollection children = new DisconnectedUIElementCollection(this); |
||||
children.CollectionChanged += new NotifyCollectionChangedEventHandler(OnChildrenCollectionChanged); |
||||
return children; |
||||
} |
||||
|
||||
protected virtual void OnChildAdded(UIElement child) |
||||
{ |
||||
} |
||||
|
||||
protected virtual void OnChildRemoved(UIElement child) |
||||
{ |
||||
} |
||||
|
||||
/// <summary>
|
||||
/// For simplicity, this class will listen to change notifications on the DisconnectedUIElementCollection
|
||||
/// and provide them to descendants through the OnChildAdded and OnChildRemoved members.
|
||||
/// </summary>
|
||||
private void OnChildrenCollectionChanged(object sender, NotifyCollectionChangedEventArgs e) |
||||
{ |
||||
switch (e.Action) |
||||
{ |
||||
case NotifyCollectionChangedAction.Add: |
||||
OnChildAdded(e.NewItems[0] as UIElement); |
||||
break; |
||||
|
||||
case NotifyCollectionChangedAction.Remove: |
||||
OnChildRemoved(e.OldItems[0] as UIElement); |
||||
break; |
||||
} |
||||
} |
||||
|
||||
protected override int VisualChildrenCount |
||||
{ |
||||
get { return VisualChildren.Count; } |
||||
} |
||||
|
||||
protected override Visual GetVisualChild(int index) |
||||
{ |
||||
if (index < 0 || index >= VisualChildren.Count) |
||||
throw new ArgumentOutOfRangeException(); |
||||
return VisualChildren[index]; |
||||
} |
||||
|
||||
protected override void OnVisualChildrenChanged(DependencyObject visualAdded, DependencyObject visualRemoved) |
||||
{ |
||||
if (visualAdded is Visual) |
||||
{ |
||||
VisualChildren.Add(visualAdded as Visual); |
||||
} |
||||
|
||||
if (visualRemoved is Visual) |
||||
{ |
||||
VisualChildren.Remove(visualRemoved as Visual); |
||||
} |
||||
|
||||
base.OnVisualChildrenChanged(visualAdded, visualRemoved); |
||||
} |
||||
|
||||
protected readonly List<Visual> VisualChildren = new List<Visual>(); |
||||
} |
||||
} |
@ -1,367 +0,0 @@
@@ -1,367 +0,0 @@
|
||||
/* Copyright (c) 2008, Dr. WPF |
||||
* 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. |
||||
* |
||||
* * The name Dr. WPF may not be used to endorse or promote products |
||||
* derived from this software without specific prior written permission. |
||||
* |
||||
* THIS SOFTWARE IS PROVIDED BY Dr. WPF ``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 Dr. WPF 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.Collections.ObjectModel; |
||||
using System.Collections; |
||||
using System.Windows.Media; |
||||
using System.Diagnostics; |
||||
using System.Collections.Specialized; |
||||
|
||||
namespace DrWPF.Windows.Controls |
||||
{ |
||||
public class DisconnectedUIElementCollection : UIElementCollection, INotifyCollectionChanged |
||||
{ |
||||
#region constructors
|
||||
|
||||
/// <summary>
|
||||
/// This collection can be used by a panel to maintain a collection of child elements
|
||||
/// that are *not* connected to their owner as visual children or logical children.
|
||||
/// </summary>
|
||||
public DisconnectedUIElementCollection(UIElement owner) |
||||
: this(owner, new SurrogateVisualParent()) |
||||
{ |
||||
} |
||||
|
||||
private DisconnectedUIElementCollection(UIElement owner, SurrogateVisualParent surrogateVisualParent) |
||||
: base(surrogateVisualParent, null) |
||||
{ |
||||
_ownerPanel = owner as Panel; |
||||
_surrogateVisualParent = surrogateVisualParent; |
||||
_surrogateVisualParent.InitializeOwner(this); |
||||
_elements = new Collection<UIElement>(); |
||||
} |
||||
|
||||
#endregion
|
||||
|
||||
#region UIElementCollection overrides
|
||||
|
||||
/// <summary>
|
||||
/// Adds the element to the DisconnectedUIElementCollection
|
||||
/// </summary>
|
||||
public override int Add(UIElement element) |
||||
{ |
||||
VerifyWriteAccess(); |
||||
return base.Add(element); |
||||
} |
||||
|
||||
public override int Capacity |
||||
{ |
||||
get { return base.Capacity; } |
||||
set |
||||
{ |
||||
VerifyWriteAccess(); |
||||
base.Capacity = value; |
||||
} |
||||
} |
||||
|
||||
/// <summary>
|
||||
/// Removes all elements from the DisconnectedUIElementCollection
|
||||
/// </summary>
|
||||
public override void Clear() |
||||
{ |
||||
VerifyWriteAccess(); |
||||
base.Clear(); |
||||
} |
||||
|
||||
/// <summary>
|
||||
/// Determines whether an element is in the DisconnectedUIElementCollection
|
||||
/// </summary>
|
||||
public override bool Contains(UIElement element) |
||||
{ |
||||
return _elements.Contains(element); |
||||
} |
||||
|
||||
/// <summary>
|
||||
/// Copies the collection into the Array
|
||||
/// </summary>
|
||||
public override void CopyTo(Array array, int index) |
||||
{ |
||||
((ICollection)_elements).CopyTo(array, index); |
||||
} |
||||
|
||||
/// <summary>
|
||||
/// Strongly typed version of CopyTo
|
||||
/// </summary>
|
||||
public override void CopyTo(UIElement[] array, int index) |
||||
{ |
||||
_elements.CopyTo(array, index); |
||||
} |
||||
|
||||
/// <summary>
|
||||
/// Gets the number of elements in the collection.
|
||||
/// </summary>
|
||||
public override int Count |
||||
{ |
||||
get { return _elements.Count; } |
||||
} |
||||
|
||||
/// <summary>
|
||||
/// Returns an enumerator that can iterate through the collection.
|
||||
/// </summary>
|
||||
public override IEnumerator GetEnumerator() |
||||
{ |
||||
return (_elements as ICollection).GetEnumerator(); |
||||
} |
||||
|
||||
/// <summary>
|
||||
/// Returns the index of the element in the DisconnectedUIElementCollection
|
||||
/// </summary>
|
||||
public override int IndexOf(UIElement element) |
||||
{ |
||||
return _elements.IndexOf(element); |
||||
} |
||||
|
||||
/// <summary>
|
||||
/// Inserts an element into the DisconnectedUIElementCollection at the specified index
|
||||
/// </summary>
|
||||
public override void Insert(int index, UIElement element) |
||||
{ |
||||
VerifyWriteAccess(); |
||||
base.Insert(index, element); |
||||
} |
||||
|
||||
/// <summary>
|
||||
/// Removes the specified element from the DisconnectedUIElementCollection
|
||||
/// </summary>
|
||||
public override void Remove(UIElement element) |
||||
{ |
||||
VerifyWriteAccess(); |
||||
base.Remove(_degenerateSiblings[element]); |
||||
} |
||||
|
||||
/// <summary>
|
||||
/// Removes the element at the specified index from the DisconnectedUIElementCollection
|
||||
/// </summary>
|
||||
public override void RemoveAt(int index) |
||||
{ |
||||
VerifyWriteAccess(); |
||||
base.RemoveAt(index); |
||||
} |
||||
|
||||
/// <summary>
|
||||
/// Removes the specified number of elements starting at the specified index from the DisconnectedUIElementCollection
|
||||
/// </summary>
|
||||
public override void RemoveRange(int index, int count) |
||||
{ |
||||
VerifyWriteAccess(); |
||||
base.RemoveRange(index, count); |
||||
} |
||||
|
||||
public override UIElement this[int index] |
||||
{ |
||||
get { return _elements[index] as UIElement; } |
||||
set |
||||
{ |
||||
VerifyWriteAccess(); |
||||
base[index] = value; |
||||
} |
||||
} |
||||
|
||||
#endregion
|
||||
|
||||
#region public methods
|
||||
|
||||
/// <summary>
|
||||
/// The Initialize method is simply exposed as an accessible member that can
|
||||
/// be called from the ConceptualPanel's Loaded event. Accessing this member
|
||||
/// via the Children property will implicitly cause CreateUIElementCollection
|
||||
/// to be called to create the disconnected collection. This method exists
|
||||
/// because simple access of a property like Count might be optimized away by
|
||||
/// an aggressive compiler.
|
||||
/// </summary>
|
||||
public void Initialize() |
||||
{ |
||||
// do nothing
|
||||
} |
||||
|
||||
#endregion
|
||||
|
||||
#region private methods
|
||||
|
||||
private int BaseIndexOf(UIElement element) |
||||
{ |
||||
return base.IndexOf(element); |
||||
} |
||||
|
||||
private void BaseInsert(int index, UIElement element) |
||||
{ |
||||
base.Insert(index, element); |
||||
} |
||||
|
||||
private void BaseRemoveAt(int index) |
||||
{ |
||||
base.RemoveAt(index); |
||||
} |
||||
|
||||
private UIElement EnsureUIElement(object value) |
||||
{ |
||||
if (value == null) |
||||
throw new ArgumentException("Cannot add a null value to a DisconnectedUIElementCollection"); |
||||
|
||||
if (!(value is UIElement)) |
||||
throw new ArgumentException("Only objects of type UIElement can be added to a DisconnectedUIElementCollection"); |
||||
|
||||
return value as UIElement; |
||||
} |
||||
|
||||
/// <summary>
|
||||
/// If the owner is an items host, we need to enforce the rule that elements
|
||||
/// cannot be explicitly added to the disconnected collection. However, it is still
|
||||
/// possible to modify the visual or logical "connected" children of a ConceptualPanel
|
||||
/// while it is an items host by simply calling the AddVisualChild, RemoveVisualChild,
|
||||
/// AddLogicalChild, or RemoveLogicalChild methods. Logic within ConceptualPanel
|
||||
/// ensures that any visual children added in this manner will be returned within
|
||||
/// a GetVisualChild() enumeration.
|
||||
/// </summary>
|
||||
private void VerifyWriteAccess() |
||||
{ |
||||
// if the owner is not a panel, just return
|
||||
if (_ownerPanel == null) return; |
||||
|
||||
// check whether the owner is an items host for an ItemsControl
|
||||
if (_ownerPanel.IsItemsHost && ItemsControl.GetItemsOwner(_ownerPanel) != null) |
||||
throw new InvalidOperationException("Disconnected children cannot be explicitly added to this " |
||||
+ "collection while the panel is serving as an items host. However, visual children can " |
||||
+ "be added by simply calling the AddVisualChild method."); |
||||
} |
||||
|
||||
#endregion
|
||||
|
||||
#region INotifyCollectionChanged Members
|
||||
|
||||
/// <summary>
|
||||
/// Since the owner of the collection is not the parent of the elements, it needs
|
||||
/// a mechanism by which to monitor its collection of child visuals.
|
||||
/// This class provides such notifications via INotifyCollectionChanged.
|
||||
/// </summary>
|
||||
public event NotifyCollectionChangedEventHandler CollectionChanged; |
||||
private void RaiseCollectionChanged(NotifyCollectionChangedAction action, object changedItem, int index) |
||||
{ |
||||
if (CollectionChanged != null) |
||||
CollectionChanged(this, new NotifyCollectionChangedEventArgs(action, changedItem, index)); |
||||
} |
||||
|
||||
#endregion
|
||||
|
||||
#region private supporting classes
|
||||
|
||||
#region DegenerateSibling
|
||||
|
||||
private class DegenerateSibling : UIElement |
||||
{ |
||||
public DegenerateSibling(UIElement element) |
||||
{ |
||||
_element = element; |
||||
} |
||||
|
||||
public UIElement Element |
||||
{ |
||||
get { return _element; } |
||||
} |
||||
|
||||
private UIElement _element; |
||||
} |
||||
|
||||
#endregion
|
||||
|
||||
#region SurrogateVisualParent
|
||||
|
||||
private class SurrogateVisualParent : UIElement |
||||
{ |
||||
internal void InitializeOwner(DisconnectedUIElementCollection owner) |
||||
{ |
||||
_owner = owner; |
||||
} |
||||
|
||||
protected override void OnVisualChildrenChanged(DependencyObject visualAdded, DependencyObject visualRemoved) |
||||
{ |
||||
// avoid reentrancy during internal updates
|
||||
if (_internalUpdate) return; |
||||
|
||||
_internalUpdate = true; |
||||
try |
||||
{ |
||||
// when a UIElement is added, replace it with its degenerate sibling
|
||||
if (visualAdded != null) |
||||
{ |
||||
Debug.Assert(!(visualAdded is DegenerateSibling), |
||||
"Unexpected addition of degenerate... All degenerates should be added during internal updates."); |
||||
|
||||
UIElement element = visualAdded as UIElement; |
||||
DegenerateSibling sibling = new DegenerateSibling(element); |
||||
int index = _owner.BaseIndexOf(element); |
||||
_owner.BaseRemoveAt(index); |
||||
_owner.BaseInsert(index, sibling); |
||||
_owner._degenerateSiblings[element] = sibling; |
||||
_owner._elements.Insert(index, element); |
||||
_owner.RaiseCollectionChanged(NotifyCollectionChangedAction.Add, element, index); |
||||
} |
||||
|
||||
// when a degenerate sibling is removed, remove its corresponding element
|
||||
if (visualRemoved != null) |
||||
{ |
||||
Debug.Assert(visualRemoved is DegenerateSibling, |
||||
"Unexpected removal of UIElement... All non degenerates should be removed during internal updates."); |
||||
|
||||
DegenerateSibling sibling = visualRemoved as DegenerateSibling; |
||||
int index = _owner._elements.IndexOf(sibling.Element); |
||||
_owner._elements.RemoveAt(index); |
||||
_owner.RaiseCollectionChanged(NotifyCollectionChangedAction.Remove, sibling.Element, index); |
||||
_owner._degenerateSiblings.Remove(sibling.Element); |
||||
} |
||||
} |
||||
finally |
||||
{ |
||||
_internalUpdate = false; |
||||
} |
||||
} |
||||
|
||||
private DisconnectedUIElementCollection _owner; |
||||
private bool _internalUpdate = false; |
||||
} |
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region fields
|
||||
|
||||
private Dictionary<UIElement, DegenerateSibling> _degenerateSiblings = new Dictionary<UIElement, DegenerateSibling>(); |
||||
private Collection<UIElement> _elements = new Collection<UIElement>(); |
||||
private Panel _ownerPanel; |
||||
private SurrogateVisualParent _surrogateVisualParent; |
||||
|
||||
#endregion
|
||||
} |
||||
} |
@ -1,78 +0,0 @@
@@ -1,78 +0,0 @@
|
||||
/* Copyright (c) 2008, Dr. WPF |
||||
* 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. |
||||
* |
||||
* * The name Dr. WPF may not be used to endorse or promote products |
||||
* derived from this software without specific prior written permission. |
||||
* |
||||
* THIS SOFTWARE IS PROVIDED BY Dr. WPF ``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 Dr. WPF 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.Collections.Specialized; |
||||
|
||||
namespace DrWPF.Windows.Controls |
||||
{ |
||||
/// <summary>
|
||||
/// This panel extends ConceptualPanel by ensuring that its conceptual children are also "logical" children.
|
||||
/// Because certain things like property inheritance and resource resolution work through the logical
|
||||
/// tree, this allows the disconnected visuals to be connected to the panel's ancestor tree
|
||||
/// in a logical manner without being part of it's visual tree.
|
||||
/// </summary>
|
||||
public abstract class LogicalPanel : ConceptualPanel |
||||
{ |
||||
protected sealed override void OnChildAdded(UIElement child) |
||||
{ |
||||
// if the child does not have a logical parent, assume the role
|
||||
if (LogicalTreeHelper.GetParent(child) == null) |
||||
{ |
||||
AddLogicalChild(child); |
||||
} |
||||
OnLogicalChildrenChanged(child, null); |
||||
} |
||||
|
||||
protected sealed override void OnChildRemoved(UIElement child) |
||||
{ |
||||
// if this panel is the logical parent, remove that relationship
|
||||
if (LogicalTreeHelper.GetParent(child) == this) |
||||
{ |
||||
RemoveLogicalChild(child); |
||||
} |
||||
OnLogicalChildrenChanged(null, child); |
||||
} |
||||
|
||||
/// <summary>
|
||||
/// This class uses the OnLogicalChildrenChanged method to provide notification to descendants
|
||||
/// when its logical children change. Note that this is intentionally
|
||||
/// similar to the OnVisualChildrenChanged approach supported by all visuals.
|
||||
/// </summary>
|
||||
/// <param name="childAdded"></param>
|
||||
/// <param name="childRemoved"></param>
|
||||
protected virtual void OnLogicalChildrenChanged(UIElement childAdded, UIElement childRemoved) |
||||
{ |
||||
} |
||||
} |
||||
} |
@ -1,177 +0,0 @@
@@ -1,177 +0,0 @@
|
||||
//Copyright (c) 2007-2009, 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; |
||||
|
||||
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) |
||||
{ |
||||
_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 void StartDrag(FloatingWindow wnd, Point point, Point offset) |
||||
{ |
||||
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.Activate(); |
||||
|
||||
_wnd = null; |
||||
} |
||||
|
||||
FloatingWindow _wnd; |
||||
public FloatingWindow FloatingWindow |
||||
{ |
||||
get { return _wnd; } |
||||
} |
||||
|
||||
} |
||||
} |
@ -1,68 +0,0 @@
@@ -1,68 +0,0 @@
|
||||
//Copyright (c) 2007-2009, 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 |
||||
{ |
||||
public class FloatingDockablePane : DockablePane |
||||
{ |
||||
static FloatingDockablePane() |
||||
{ |
||||
//DefaultStyleKeyProperty.OverrideMetadata(typeof(FloatingDockablePane), new FrameworkPropertyMetadata(typeof(FloatingDockablePane)));
|
||||
DockablePane.ShowHeaderProperty.OverrideMetadata(typeof(FloatingDockablePane), new FrameworkPropertyMetadata(false)); |
||||
} |
||||
|
||||
public FloatingDockablePane(FloatingWindow floatingWindow) |
||||
{ |
||||
_floatingWindow = floatingWindow; |
||||
} |
||||
|
||||
FloatingWindow _floatingWindow = null; |
||||
|
||||
public FloatingWindow FloatingWindow |
||||
{ |
||||
get { return _floatingWindow; } |
||||
} |
||||
|
||||
public override DockingManager GetManager() |
||||
{ |
||||
return _floatingWindow.Manager; |
||||
} |
||||
|
||||
protected override void CheckItems(System.Collections.IList newItems) |
||||
{ |
||||
foreach (object newItem in newItems) |
||||
{ |
||||
if (!(newItem is DockableContent) && !(newItem is DocumentContent)) |
||||
throw new InvalidOperationException("FloatingDockablePane can contain only DockableContents and DocumentContents!"); |
||||
} |
||||
} |
||||
|
||||
} |
||||
} |
@ -1,502 +0,0 @@
@@ -1,502 +0,0 @@
|
||||
//Copyright (c) 2007-2009, 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; |
||||
|
||||
namespace AvalonDock |
||||
{ |
||||
public abstract class FloatingWindow : Window, INotifyPropertyChanged |
||||
{ |
||||
static FloatingWindow() |
||||
{ |
||||
Window.ShowInTaskbarProperty.OverrideMetadata(typeof(FloatingWindow), new FrameworkPropertyMetadata(false)); |
||||
Window.WindowStyleProperty.OverrideMetadata(typeof(FloatingWindow), new FrameworkPropertyMetadata(WindowStyle.ToolWindow)); |
||||
} |
||||
|
||||
|
||||
public FloatingWindow() |
||||
{ |
||||
this.Loaded += new RoutedEventHandler(OnLoaded); |
||||
this.Unloaded += new RoutedEventHandler(OnUnloaded); |
||||
|
||||
this.SizeChanged += new SizeChangedEventHandler(FloatingWindow_SizeChanged); |
||||
|
||||
this.CommandBindings.Add(new CommandBinding(SetAsDockableWindowCommand, OnExecuteCommand, OnCanExecuteCommand)); |
||||
this.CommandBindings.Add(new CommandBinding(SetAsFloatingWindowCommand, OnExecuteCommand, OnCanExecuteCommand)); |
||||
this.CommandBindings.Add(new CommandBinding(TabbedDocumentCommand, OnExecuteCommand, OnCanExecuteCommand)); |
||||
this.CommandBindings.Add(new CommandBinding(CloseCommand, OnExecuteCommand, OnCanExecuteCommand)); |
||||
} |
||||
|
||||
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)); |
||||
} |
||||
} |
||||
|
||||
public FloatingWindow(DockingManager manager) |
||||
: this() |
||||
{ |
||||
//save manager ref
|
||||
_manager = manager; |
||||
} |
||||
|
||||
DockingManager _manager = null; |
||||
|
||||
internal DockingManager Manager |
||||
{ |
||||
get { return _manager; } |
||||
} |
||||
|
||||
|
||||
public FloatingDockablePane HostedPane |
||||
{ |
||||
get { return (FloatingDockablePane)GetValue(ReferencedPaneProperty); } |
||||
set { SetValue(ReferencedPaneProperty, value); } |
||||
} |
||||
|
||||
// Using a DependencyProperty as the backing store for HostedPane. This enables animation, styling, binding, etc...
|
||||
public static readonly DependencyProperty ReferencedPaneProperty = |
||||
DependencyProperty.Register("HostedPane", typeof(FloatingDockablePane), typeof(FlyoutPaneWindow)); |
||||
|
||||
|
||||
internal virtual void OnEndDrag() |
||||
{ |
||||
} |
||||
|
||||
internal virtual void OnShowSelectionBox() |
||||
{ |
||||
|
||||
} |
||||
|
||||
internal virtual void OnHideSelectionBox() |
||||
{ |
||||
|
||||
} |
||||
|
||||
#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
|
||||
public 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) |
||||
{ |
||||
if (HostedPane.Items.Count > 0 && !ForcedClosing) |
||||
{ |
||||
ManagedContent cntToClose = HostedPane.Items[0] as ManagedContent; |
||||
if (!cntToClose.IsCloseable) |
||||
{ |
||||
e.Cancel = true; |
||||
base.OnClosing(e); |
||||
return; |
||||
} |
||||
} |
||||
|
||||
IsClosing = true; |
||||
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
|
||||
HwndSource _hwndSource; |
||||
HwndSourceHook _wndProcHandler; |
||||
|
||||
protected void OnLoaded(object sender, EventArgs e) |
||||
{ |
||||
WindowInteropHelper helper = new WindowInteropHelper(this); |
||||
_hwndSource = HwndSource.FromHwnd(helper.Handle); |
||||
_wndProcHandler = new HwndSourceHook(FilterMessage); |
||||
_hwndSource.AddHook(_wndProcHandler); |
||||
|
||||
if (HostedPane.Items.Count > 0) |
||||
{ |
||||
ManagedContent cntHosted = HostedPane.Items[0] as ManagedContent; |
||||
if (!cntHosted.IsCloseable) |
||||
{ |
||||
DisableXButton(); |
||||
} |
||||
} |
||||
} |
||||
protected void OnUnloaded(object sender, EventArgs e) |
||||
{ |
||||
if (_hwndSource != null) |
||||
_hwndSource.RemoveHook(_wndProcHandler); |
||||
} |
||||
#endregion
|
||||
|
||||
|
||||
protected virtual IntPtr FilterMessage( |
||||
IntPtr hwnd, |
||||
int msg, |
||||
IntPtr wParam, |
||||
IntPtr lParam, |
||||
ref bool handled |
||||
) |
||||
{ |
||||
handled = false; |
||||
|
||||
if (Manager == null) |
||||
return IntPtr.Zero; |
||||
|
||||
switch (msg) |
||||
{ |
||||
case WM_SIZE: |
||||
case WM_MOVE: |
||||
//HostedPane.ReferencedPane.SaveFloatingWindowSizeAndPosition(this);
|
||||
break; |
||||
case WM_NCLBUTTONDOWN: |
||||
if (IsDockableWindow && wParam.ToInt32() == HTCAPTION) |
||||
{ |
||||
short x = (short)((lParam.ToInt32() & 0xFFFF)); |
||||
short y = (short)((lParam.ToInt32() >> 16)); |
||||
|
||||
Point clickPoint = this.TransformToDeviceDPI(new Point(x, y)); |
||||
Manager.Drag(this, clickPoint, new Point(clickPoint.X - Left, clickPoint.Y - Top)); |
||||
|
||||
handled = true; |
||||
} |
||||
break; |
||||
case WM_NCLBUTTONDBLCLK: |
||||
if (IsDockableWindow && wParam.ToInt32() == HTCAPTION) |
||||
{ |
||||
if (IsDockableWindow) |
||||
{ |
||||
Redock(); |
||||
handled = true; |
||||
} |
||||
} |
||||
break; |
||||
case WM_NCRBUTTONDOWN: |
||||
if (wParam.ToInt32() == HTCAPTION) |
||||
{ |
||||
short x = (short)((lParam.ToInt32() & 0xFFFF)); |
||||
short y = (short)((lParam.ToInt32() >> 16)); |
||||
|
||||
ContextMenu cxMenu = FindResource(new ComponentResourceKey(typeof(DockingManager), ContextMenuElement.FloatingWindow)) as ContextMenu; |
||||
if (cxMenu != null) |
||||
{ |
||||
foreach (MenuItem menuItem in cxMenu.Items) |
||||
menuItem.CommandTarget = this; |
||||
|
||||
cxMenu.Placement = PlacementMode.AbsolutePoint; |
||||
cxMenu.PlacementRectangle = new Rect(new Point(x, y), new Size(0, 0)); |
||||
cxMenu.PlacementTarget = this; |
||||
cxMenu.IsOpen = true; |
||||
} |
||||
|
||||
handled = true; |
||||
} |
||||
break; |
||||
case WM_NCRBUTTONUP: |
||||
if (wParam.ToInt32() == HTCAPTION) |
||||
{ |
||||
|
||||
handled = true; |
||||
} |
||||
break; |
||||
|
||||
} |
||||
|
||||
|
||||
return IntPtr.Zero; |
||||
} |
||||
#endregion
|
||||
|
||||
#region Floating/dockable window state
|
||||
bool _dockableWindow = true; |
||||
|
||||
public bool IsDockableWindow |
||||
{ |
||||
get { return _dockableWindow; } |
||||
set |
||||
{ |
||||
_dockableWindow = value; |
||||
|
||||
if (_dockableWindow) |
||||
{ |
||||
foreach (ManagedContent content in HostedPane.Items) |
||||
if (content is DockableContent) |
||||
((DockableContent)content).SetStateToDockableWindow(); |
||||
} |
||||
else |
||||
{ |
||||
foreach (ManagedContent content in HostedPane.Items) |
||||
if (content is DockableContent) |
||||
((DockableContent)content).SetStateToFloatingWindow(); |
||||
} |
||||
} |
||||
} |
||||
|
||||
public bool IsFloatingWindow |
||||
{ |
||||
get { return !IsDockableWindow; } |
||||
set { IsDockableWindow = !value; } |
||||
} |
||||
|
||||
protected virtual void Redock() |
||||
{ |
||||
|
||||
} |
||||
#endregion
|
||||
|
||||
#region Commands
|
||||
private static object syncRoot = new object(); |
||||
|
||||
private static RoutedUICommand tabbedDocumentCommand = null; |
||||
public static RoutedUICommand TabbedDocumentCommand |
||||
{ |
||||
get |
||||
{ |
||||
lock (syncRoot) |
||||
{ |
||||
if (null == tabbedDocumentCommand) |
||||
{ |
||||
tabbedDocumentCommand = new RoutedUICommand("T_abbed Document", "TabbedDocument", typeof(FloatingWindow)); |
||||
} |
||||
|
||||
} |
||||
return tabbedDocumentCommand; |
||||
} |
||||
} |
||||
|
||||
private static RoutedUICommand dockableCommand = null; |
||||
public static RoutedUICommand SetAsDockableWindowCommand |
||||
{ |
||||
get |
||||
{ |
||||
lock (syncRoot) |
||||
{ |
||||
if (null == dockableCommand) |
||||
{ |
||||
dockableCommand = new RoutedUICommand("D_ockable", "Dockable", typeof(FloatingWindow)); |
||||
} |
||||
|
||||
} |
||||
return dockableCommand; |
||||
} |
||||
} |
||||
|
||||
private static RoutedUICommand floatingCommand = null; |
||||
public static RoutedUICommand SetAsFloatingWindowCommand |
||||
{ |
||||
get |
||||
{ |
||||
lock (syncRoot) |
||||
{ |
||||
if (null == floatingCommand) |
||||
{ |
||||
floatingCommand = new RoutedUICommand("F_loating", "Floating", typeof(FloatingWindow)); |
||||
} |
||||
|
||||
} |
||||
return floatingCommand; |
||||
} |
||||
} |
||||
|
||||
private static RoutedUICommand closeCommand = null; |
||||
public static RoutedUICommand CloseCommand |
||||
{ |
||||
get |
||||
{ |
||||
lock (syncRoot) |
||||
{ |
||||
if (null == closeCommand) |
||||
{ |
||||
closeCommand = new RoutedUICommand("Close", "Close", typeof(FloatingWindow)); |
||||
} |
||||
|
||||
} |
||||
return closeCommand; |
||||
} |
||||
} |
||||
|
||||
protected virtual void OnExecuteCommand(object sender, ExecutedRoutedEventArgs e) |
||||
{ |
||||
if (e.Command == SetAsDockableWindowCommand) |
||||
{ |
||||
IsDockableWindow = true; |
||||
e.Handled = true; |
||||
} |
||||
else if (e.Command == SetAsFloatingWindowCommand) |
||||
{ |
||||
IsFloatingWindow = true; |
||||
e.Handled = true; |
||||
} |
||||
} |
||||
|
||||
protected virtual void OnCanExecuteCommand(object sender, CanExecuteRoutedEventArgs e) |
||||
{ |
||||
if (e.Command == SetAsDockableWindowCommand) |
||||
e.CanExecute = IsFloatingWindow; |
||||
else if (e.Command == SetAsFloatingWindowCommand) |
||||
e.CanExecute = IsDockableWindow; |
||||
else |
||||
e.CanExecute = true; |
||||
} |
||||
#endregion
|
||||
|
||||
#region INotifyPropertyChanged Members
|
||||
|
||||
public event PropertyChangedEventHandler PropertyChanged; |
||||
|
||||
protected void NotifyPropertyChanged(string propertyName) |
||||
{ |
||||
if (PropertyChanged != null) |
||||
PropertyChanged(this, new PropertyChangedEventArgs(propertyName)); |
||||
} |
||||
#endregion
|
||||
} |
||||
} |
@ -1,113 +0,0 @@
@@ -1,113 +0,0 @@
|
||||
//Copyright (c) 2007-2009, 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)); |
||||
|
||||
|
||||
//if (double.IsInfinity(ResizingPanel.GetResizeWidth(this)))
|
||||
// ResizingPanel.SetResizeWidth(this, 200);
|
||||
//if (double.IsInfinity(ResizingPanel.GetResizeHeight(this)))
|
||||
// ResizingPanel.SetResizeHeight(this, 200);
|
||||
|
||||
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; |
||||
|
||||
DockingManager _manager = null; |
||||
|
||||
public override DockingManager GetManager() |
||||
{ |
||||
return _manager; |
||||
} |
||||
|
||||
internal override void ToggleAutoHide() |
||||
{ |
||||
GetManager().ToggleAutoHide(_referencedPane); |
||||
} |
||||
//internal override void Close()
|
||||
//{
|
||||
// DockingManager manager = GetManager();
|
||||
// if (manager != null)
|
||||
// Manager.Hide(SelectedItem as DockableContent);
|
||||
//}
|
||||
} |
||||
} |
@ -1,923 +0,0 @@
@@ -1,923 +0,0 @@
|
||||
//Copyright (c) 2007-2009, 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.Forms.Integration; |
||||
using System.Runtime.InteropServices; |
||||
using System.Windows.Interop; |
||||
using System.Threading; |
||||
|
||||
namespace AvalonDock |
||||
{ |
||||
[ContentPropertyAttribute("ReferencedPane")] |
||||
public class FlyoutPaneWindow : System.Windows.Window |
||||
{ |
||||
static FlyoutPaneWindow() |
||||
{ |
||||
//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(FlyoutPaneWindow), new FrameworkPropertyMetadata(typeof(FlyoutPaneWindow))); |
||||
|
||||
//AllowsTransparency slow down perfomance under XP/VISTA because rendering is enterely perfomed using CPU
|
||||
//Window.AllowsTransparencyProperty.OverrideMetadata(typeof(FlyoutPaneWindow), new FrameworkPropertyMetadata(true));
|
||||
|
||||
Window.WindowStyleProperty.OverrideMetadata(typeof(FlyoutPaneWindow), new FrameworkPropertyMetadata(WindowStyle.None)); |
||||
Window.ShowInTaskbarProperty.OverrideMetadata(typeof(FlyoutPaneWindow), new FrameworkPropertyMetadata(false)); |
||||
Window.ResizeModeProperty.OverrideMetadata(typeof(FlyoutPaneWindow), new FrameworkPropertyMetadata(ResizeMode.NoResize)); |
||||
Control.BackgroundProperty.OverrideMetadata(typeof(FlyoutPaneWindow), new FrameworkPropertyMetadata(Brushes.Transparent)); |
||||
} |
||||
|
||||
public FlyoutPaneWindow() |
||||
{ |
||||
Title = "AvalonDock_FlyoutPaneWindow"; |
||||
} |
||||
|
||||
|
||||
WindowsFormsHost _winFormsHost = null; |
||||
double _targetWidth; |
||||
double _targetHeight; |
||||
|
||||
internal double TargetWidth |
||||
{ |
||||
get { return _targetWidth; } |
||||
set { _targetWidth = value; } |
||||
} |
||||
|
||||
internal double TargetHeight |
||||
{ |
||||
get { return _targetHeight; } |
||||
set { _targetHeight = value; } |
||||
} |
||||
|
||||
double _minLeft; |
||||
double _minTop; |
||||
|
||||
internal double MinLeft |
||||
{ |
||||
get { return _minLeft; } |
||||
set { _minLeft = value; } |
||||
} |
||||
|
||||
internal double MinTop |
||||
{ |
||||
get { return _minTop; } |
||||
set { _minTop = value; } |
||||
} |
||||
|
||||
DockingManager _dockingManager = null; |
||||
|
||||
public FlyoutPaneWindow(DockingManager manager, DockableContent content) |
||||
: this() |
||||
{ |
||||
//create a new temporary pane
|
||||
_refPane = new FlyoutDockablePane(content); |
||||
_dockingManager = manager; |
||||
|
||||
_winFormsHost = ReferencedPane.GetLogicalChildContained<WindowsFormsHost>(); |
||||
|
||||
if (_winFormsHost != null) |
||||
{ |
||||
AllowsTransparency = false; |
||||
} |
||||
|
||||
this.Loaded += new RoutedEventHandler(FlyoutPaneWindow_Loaded); |
||||
} |
||||
|
||||
|
||||
void FlyoutPaneWindow_Loaded(object sender, RoutedEventArgs e) |
||||
{ |
||||
StartOpenAnimation(); |
||||
//Storyboard storyBoard = new Storyboard();
|
||||
//double originalLeft = this.Left;
|
||||
//double originalTop = this.Top;
|
||||
|
||||
//AnchorStyle CorrectedAnchor = Anchor;
|
||||
|
||||
//if (CorrectedAnchor == AnchorStyle.Left && FlowDirection == FlowDirection.RightToLeft)
|
||||
// CorrectedAnchor = AnchorStyle.Right;
|
||||
//else if (CorrectedAnchor == AnchorStyle.Right && FlowDirection == FlowDirection.RightToLeft)
|
||||
// CorrectedAnchor = AnchorStyle.Left;
|
||||
|
||||
|
||||
//if (CorrectedAnchor == AnchorStyle.Left || CorrectedAnchor == AnchorStyle.Right)
|
||||
//{
|
||||
// DoubleAnimation anim = new DoubleAnimation(0.0, _targetWidth, new Duration(TimeSpan.FromMilliseconds(200)));
|
||||
// Storyboard.SetTargetProperty(anim, new PropertyPath("Width"));
|
||||
// this.Width = _targetWidth;
|
||||
// //storyBoard.Children.Add(anim);
|
||||
//}
|
||||
//if (CorrectedAnchor == AnchorStyle.Right)
|
||||
//{
|
||||
// //DoubleAnimation anim = new DoubleAnimation(this.Left, this.Left + this.ActualWidth, new Duration(TimeSpan.FromMilliseconds(500)));
|
||||
|
||||
// DoubleAnimation anim = new DoubleAnimation(this.Left, Left - _targetWidth, new Duration(TimeSpan.FromMilliseconds(200)));
|
||||
// Storyboard.SetTargetProperty(anim, new PropertyPath("Left"));
|
||||
// storyBoard.Children.Add(anim);
|
||||
//}
|
||||
|
||||
//if (CorrectedAnchor == AnchorStyle.Top || CorrectedAnchor == AnchorStyle.Bottom)
|
||||
//{
|
||||
// DoubleAnimation anim = new DoubleAnimation(0.0, _targetHeight, new Duration(TimeSpan.FromMilliseconds(200)));
|
||||
// Storyboard.SetTargetProperty(anim, new PropertyPath("Height"));
|
||||
// storyBoard.Children.Add(anim);
|
||||
//}
|
||||
//if (CorrectedAnchor == AnchorStyle.Bottom)
|
||||
//{
|
||||
// DoubleAnimation anim = new DoubleAnimation(originalTop, originalTop - _targetHeight, new Duration(TimeSpan.FromMilliseconds(200)));
|
||||
// Storyboard.SetTargetProperty(anim, new PropertyPath("Top"));
|
||||
// storyBoard.Children.Add(anim);
|
||||
//}
|
||||
|
||||
//{
|
||||
// DoubleAnimation anim = new DoubleAnimation(0.0, 1.0, new Duration(TimeSpan.FromMilliseconds(100)));
|
||||
// Storyboard.SetTargetProperty(anim, new PropertyPath("Opacity"));
|
||||
// //AllowsTransparency slow down perfomance under XP/VISTA because rendering is enterely perfomed using CPU
|
||||
// //storyBoard.Children.Add(anim);
|
||||
//}
|
||||
|
||||
//storyBoard.Completed += (anim, eventargs) =>
|
||||
// {
|
||||
// if (CorrectedAnchor == AnchorStyle.Left)
|
||||
// {
|
||||
// this.Left = originalLeft;
|
||||
// this.Width = _targetWidth;
|
||||
// }
|
||||
// if (CorrectedAnchor == AnchorStyle.Right)
|
||||
// {
|
||||
// this.Left = originalLeft - _targetWidth;
|
||||
// this.Width = _targetWidth;
|
||||
// }
|
||||
// if (CorrectedAnchor == AnchorStyle.Top)
|
||||
// {
|
||||
// this.Top = originalTop;
|
||||
// this.Height = _targetHeight;
|
||||
// }
|
||||
// if (CorrectedAnchor == AnchorStyle.Bottom)
|
||||
// {
|
||||
// this.Top = originalTop - _targetHeight;
|
||||
// this.Height = _targetHeight;
|
||||
// }
|
||||
// };
|
||||
|
||||
//foreach (AnimationTimeline animTimeLine in storyBoard.Children)
|
||||
//{
|
||||
// animTimeLine.FillBehavior = FillBehavior.Stop;
|
||||
//}
|
||||
|
||||
//storyBoard.Begin(this);
|
||||
} |
||||
|
||||
protected override void OnClosed(EventArgs e) |
||||
{ |
||||
ReferencedPane.RestoreOriginalPane(); |
||||
|
||||
base.OnClosed(e); |
||||
|
||||
_closed = true; |
||||
} |
||||
|
||||
bool _closed = false; |
||||
|
||||
internal bool IsClosed |
||||
{ |
||||
get { return _closed; } |
||||
} |
||||
|
||||
//public AnchorStyle Anchor
|
||||
//{
|
||||
// get { return (AnchorStyle)GetValue(AnchorPropertyKey.DependencyProperty); }
|
||||
// protected 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.RegisterReadOnly("Anchor", typeof(AnchorStyle), typeof(FlyoutPaneWindow), new UIPropertyMetadata(AnchorStyle.Right));
|
||||
|
||||
//public FlyoutDockablePane ReferencedPane
|
||||
//{
|
||||
// get { return (FlyoutDockablePane)GetValue(ReferencedPaneProperty); }
|
||||
// set { SetValue(ReferencedPaneProperty, value); }
|
||||
//}
|
||||
|
||||
//// Using a DependencyProperty as the backing store for EmbeddedPane. This enables animation, styling, binding, etc...
|
||||
//public static readonly DependencyProperty ReferencedPaneProperty =
|
||||
// DependencyProperty.Register("ReferencedPane", typeof(FlyoutDockablePane), typeof(FlyoutPaneWindow));
|
||||
|
||||
//AnchorStyle _anchor = AnchorStyle.Top;
|
||||
//public AnchorStyle Anchor
|
||||
//{
|
||||
// get { return _anchor; }
|
||||
// set { _anchor = value; }
|
||||
//}
|
||||
|
||||
public AnchorStyle Anchor |
||||
{ |
||||
get { return ReferencedPane.Anchor; } |
||||
} |
||||
|
||||
FlyoutDockablePane _refPane; |
||||
|
||||
internal FlyoutDockablePane ReferencedPane |
||||
{ |
||||
get { return _refPane; } |
||||
//set
|
||||
//{
|
||||
// _refPane = value;
|
||||
//}
|
||||
} |
||||
|
||||
|
||||
protected override void OnInitialized(EventArgs e) |
||||
{ |
||||
base.OnInitialized(e); |
||||
|
||||
if (ReferencedPane == null) |
||||
_refPane = this.Content as FlyoutDockablePane; |
||||
|
||||
if (ReferencedPane != null) |
||||
{ |
||||
|
||||
Content = ReferencedPane; |
||||
|
||||
_closingTimer = new DispatcherTimer( |
||||
new TimeSpan(0, 0, 2), |
||||
DispatcherPriority.Normal, |
||||
new EventHandler(OnCloseWindow), |
||||
Dispatcher.CurrentDispatcher); |
||||
} |
||||
|
||||
|
||||
} |
||||
|
||||
UIElement _resizer = null; |
||||
public override void OnApplyTemplate() |
||||
{ |
||||
base.OnApplyTemplate(); |
||||
|
||||
_resizer = GetTemplateChild("INT_Resizer") as UIElement; |
||||
|
||||
if (_resizer != null) |
||||
{ |
||||
_resizer.MouseDown += new MouseButtonEventHandler(_resizer_MouseDown); |
||||
_resizer.MouseMove += new MouseEventHandler(_resizer_MouseMove); |
||||
_resizer.MouseUp += new MouseButtonEventHandler(_resizer_MouseUp); |
||||
} |
||||
} |
||||
|
||||
|
||||
#region Resize management
|
||||
double originalWidth = 0.0; |
||||
double originalHeight = 0.0; |
||||
double originalLeft = 0.0; |
||||
double originalTop = 0.0; |
||||
Point ptStartDrag; |
||||
|
||||
private void _resizer_MouseDown(object sender, System.Windows.Input.MouseButtonEventArgs e) |
||||
{ |
||||
UIElement dragElement = sender as UIElement; |
||||
|
||||
originalLeft = Left; |
||||
originalTop = Top; |
||||
originalWidth = Width; |
||||
originalHeight = Height; |
||||
|
||||
ptStartDrag = e.GetPosition(dragElement); |
||||
dragElement.CaptureMouse(); |
||||
} |
||||
|
||||
private void _resizer_MouseMove(object sender, System.Windows.Input.MouseEventArgs e) |
||||
{ |
||||
UIElement dragElement = sender as UIElement; |
||||
|
||||
if (dragElement.IsMouseCaptured) |
||||
{ |
||||
Point ptMoveDrag = e.GetPosition(dragElement); |
||||
AnchorStyle CorrectedAnchor = Anchor; |
||||
|
||||
if (CorrectedAnchor == AnchorStyle.Left && FlowDirection == FlowDirection.RightToLeft) |
||||
CorrectedAnchor = AnchorStyle.Right; |
||||
else if (CorrectedAnchor == AnchorStyle.Right && FlowDirection == FlowDirection.RightToLeft) |
||||
CorrectedAnchor = AnchorStyle.Left; |
||||
|
||||
double deltaX = FlowDirection == FlowDirection.LeftToRight ? ptMoveDrag.X - ptStartDrag.X : ptStartDrag.X - ptMoveDrag.X; |
||||
|
||||
double newWidth = Width; |
||||
double newHeight = Height; |
||||
|
||||
double newLeft = Left; |
||||
double newTop = Top; |
||||
|
||||
if (CorrectedAnchor == AnchorStyle.Left) |
||||
{ |
||||
if (newWidth + deltaX < 4.0) |
||||
newWidth = 4.0; |
||||
else |
||||
newWidth += deltaX; |
||||
|
||||
} |
||||
else if (CorrectedAnchor == AnchorStyle.Top) |
||||
{ |
||||
if (newHeight + (ptMoveDrag.Y - ptStartDrag.Y) < 4.0) |
||||
newHeight = 4.0; |
||||
else |
||||
newHeight += ptMoveDrag.Y - ptStartDrag.Y; |
||||
|
||||
} |
||||
else if (CorrectedAnchor == AnchorStyle.Right) |
||||
{ |
||||
if (newWidth - (deltaX) < 4) |
||||
{ |
||||
newLeft = originalLeft + originalWidth - 4; |
||||
newWidth = 4; |
||||
} |
||||
else |
||||
{ |
||||
newLeft += deltaX; |
||||
newWidth -= deltaX; |
||||
} |
||||
|
||||
} |
||||
else if (CorrectedAnchor == AnchorStyle.Bottom) |
||||
{ |
||||
if (newHeight - (ptMoveDrag.Y - ptStartDrag.Y) < 4) |
||||
{ |
||||
newTop = originalTop + originalHeight - 4; |
||||
newHeight = 4; |
||||
} |
||||
else |
||||
{ |
||||
newTop += ptMoveDrag.Y - ptStartDrag.Y; |
||||
newHeight -= ptMoveDrag.Y - ptStartDrag.Y; |
||||
} |
||||
} |
||||
|
||||
//ResizingPanel.SetResizeHeight(ReferencedPane, ReferencedPane.ActualHeight);
|
||||
//ResizingPanel.SetResizeWidth(ReferencedPane, ReferencedPane.ActualWidth);
|
||||
|
||||
Width = Math.Min(newWidth, MaxWidth); |
||||
Height = Math.Min(newHeight, MaxHeight); |
||||
|
||||
Left = Math.Max(newLeft, MinLeft); |
||||
Top = Math.Max(newTop, MinTop); |
||||
|
||||
ApplyRegion(new Rect(0, 0, this.Width, this.Height)); |
||||
} |
||||
} |
||||
|
||||
private void _resizer_MouseUp(object sender, System.Windows.Input.MouseButtonEventArgs e) |
||||
{ |
||||
UIElement dragElement = sender as UIElement; |
||||
dragElement.ReleaseMouseCapture(); |
||||
|
||||
} |
||||
|
||||
#endregion
|
||||
|
||||
#region Closing window strategies
|
||||
|
||||
|
||||
DispatcherTimer _closingTimer = null; |
||||
|
||||
protected override void OnMouseLeave(MouseEventArgs e) |
||||
{ |
||||
base.OnMouseLeave(e); |
||||
|
||||
if (!IsFocused && !IsKeyboardFocusWithin && !ReferencedPane.IsOptionsMenuOpened) |
||||
_closingTimer.Start(); |
||||
} |
||||
|
||||
protected override void OnMouseMove(MouseEventArgs e) |
||||
{ |
||||
base.OnMouseMove(e); |
||||
|
||||
_closingTimer.Stop(); |
||||
} |
||||
|
||||
protected override void OnLostFocus(RoutedEventArgs e) |
||||
{ |
||||
base.OnLostFocus(e); |
||||
|
||||
if (!IsMouseOver && !ReferencedPane.IsOptionsMenuOpened) |
||||
_closingTimer.Start(); |
||||
} |
||||
|
||||
protected override void OnLostKeyboardFocus(KeyboardFocusChangedEventArgs e) |
||||
{ |
||||
base.OnLostKeyboardFocus(e); |
||||
|
||||
if (!IsMouseOver) |
||||
_closingTimer.Start(); |
||||
} |
||||
|
||||
protected override void OnGotFocus(RoutedEventArgs e) |
||||
{ |
||||
base.OnGotFocus(e); |
||||
_closingTimer.Stop(); |
||||
} |
||||
|
||||
protected override void OnGotKeyboardFocus(KeyboardFocusChangedEventArgs e) |
||||
{ |
||||
base.OnGotKeyboardFocus(e); |
||||
|
||||
_closingTimer.Stop(); |
||||
} |
||||
|
||||
internal void StartCloseWindow() |
||||
{ |
||||
_closingTimer.Start(); |
||||
} |
||||
|
||||
void OnCloseWindow(object sender, EventArgs e) |
||||
{ |
||||
//options menu is open don't close the flyout window
|
||||
if (ReferencedPane.IsOptionsMenuOpened || |
||||
IsMouseDirectlyOver || |
||||
(_winFormsHost != null && _winFormsHost.IsFocused && _refPane.Items.Count > 0 && ((ManagedContent)_refPane.Items[0]).IsActiveContent)) |
||||
{ |
||||
_closingTimer.Start(); |
||||
return; |
||||
} |
||||
|
||||
_closingTimer.Stop(); |
||||
|
||||
if (IsClosed) |
||||
return; |
||||
|
||||
StartCloseAnimation(); |
||||
} |
||||
|
||||
[DllImport("user32.dll")] |
||||
static extern int SetWindowRgn(IntPtr hWnd, IntPtr hRgn, bool bRedraw); |
||||
|
||||
[DllImport("gdi32.dll")] |
||||
static extern IntPtr CreateRectRgn(int left, int top, int right, int bottom); |
||||
|
||||
|
||||
[DllImport("gdi32.dll")] |
||||
static extern int CombineRgn(IntPtr hrgnDest, IntPtr hrgnSrc1, IntPtr hrgnSrc2, int fnCombineMode); |
||||
|
||||
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 |
||||
} |
||||
|
||||
|
||||
public bool IsClosing { get; private set; } |
||||
|
||||
internal void StartCloseAnimation() |
||||
{ |
||||
AnchorStyle CorrectedAnchor = Anchor; |
||||
|
||||
if (CorrectedAnchor == AnchorStyle.Left && FlowDirection == FlowDirection.RightToLeft) |
||||
CorrectedAnchor = AnchorStyle.Right; |
||||
else if (CorrectedAnchor == AnchorStyle.Right && FlowDirection == FlowDirection.RightToLeft) |
||||
CorrectedAnchor = AnchorStyle.Left; |
||||
|
||||
double wnd_Width = this.ActualWidth; |
||||
double wnd_Height = this.ActualHeight; |
||||
double wnd_Left = this.Left; |
||||
double wnd_Top = this.Top; |
||||
|
||||
int wnd_TrimWidth = (int)wnd_Width; |
||||
int wnd_TrimHeight = (int)wnd_Height; |
||||
|
||||
int stepWidth = (int)(wnd_Width / 20); |
||||
int stepHeight = (int)(wnd_Height / 20); |
||||
|
||||
DispatcherTimer animTimer = new DispatcherTimer(); |
||||
animTimer.Interval = TimeSpan.FromMilliseconds(1); |
||||
|
||||
animTimer.Tick += (sender, eventArgs) => |
||||
{ |
||||
bool stopTimer = false; |
||||
double newLeft = 0.0; |
||||
double newTop = 0.0; |
||||
switch (CorrectedAnchor) |
||||
{ |
||||
case AnchorStyle.Right: |
||||
newLeft = this.Left; |
||||
if (this.Left + stepWidth >= wnd_Left + wnd_Width) |
||||
{ |
||||
newLeft = wnd_Left + wnd_Width; |
||||
wnd_TrimWidth = 0; |
||||
stopTimer = true; |
||||
} |
||||
else |
||||
{ |
||||
newLeft += stepWidth; |
||||
wnd_TrimWidth -= stepWidth; |
||||
wnd_TrimWidth = Math.Max(wnd_TrimWidth, 0); |
||||
} |
||||
|
||||
//SetWindowRgn(new WindowInteropHelper(this).Handle, CreateRectRgn(0, 0, wnd_TrimWidth, wnd_TrimHeight), true);
|
||||
ApplyRegion(new Rect(0, 0, wnd_TrimWidth, wnd_TrimHeight)); |
||||
this.Left = newLeft; |
||||
break; |
||||
case AnchorStyle.Left: |
||||
newLeft = this.Left; |
||||
if (this.Left - stepWidth <= wnd_Left - wnd_Width) |
||||
{ |
||||
newLeft = wnd_Left - wnd_Width; |
||||
wnd_TrimWidth = 0; |
||||
stopTimer = true; |
||||
} |
||||
else |
||||
{ |
||||
newLeft -= stepWidth; |
||||
wnd_TrimWidth -= stepWidth; |
||||
wnd_TrimWidth = Math.Max(wnd_TrimWidth, 0); |
||||
} |
||||
|
||||
this.Left = newLeft; |
||||
//SetWindowRgn(new WindowInteropHelper(this).Handle, CreateRectRgn((int)(wnd_Left - this.Left), 0, (int)(wnd_Width), wnd_TrimHeight), true);
|
||||
ApplyRegion( |
||||
new Rect((int)(wnd_Left - this.Left), 0, (int)(wnd_Width), wnd_TrimHeight)); |
||||
break; |
||||
case AnchorStyle.Bottom: |
||||
newTop = this.Top; |
||||
if (this.Top + stepHeight >= wnd_Top + wnd_Height) |
||||
{ |
||||
newTop = wnd_Top + wnd_Height; |
||||
wnd_TrimHeight = 0; |
||||
stopTimer = true; |
||||
} |
||||
else |
||||
{ |
||||
newTop += stepHeight; |
||||
wnd_TrimHeight -= stepHeight; |
||||
wnd_TrimHeight = Math.Max(wnd_TrimHeight, 0); |
||||
} |
||||
|
||||
//SetWindowRgn(new WindowInteropHelper(this).Handle, CreateRectRgn(0, 0, wnd_TrimWidth, wnd_TrimHeight), true);
|
||||
ApplyRegion( |
||||
new Rect(0, 0, wnd_TrimWidth, wnd_TrimHeight)); |
||||
this.Top = newTop; |
||||
break; |
||||
case AnchorStyle.Top: |
||||
newTop = this.Top; |
||||
if (this.Top - stepHeight <= wnd_Top - wnd_Height) |
||||
{ |
||||
newTop = wnd_Top - wnd_Height; |
||||
wnd_TrimHeight = 0; |
||||
stopTimer = true; |
||||
} |
||||
else |
||||
{ |
||||
newTop -= stepHeight; |
||||
wnd_TrimHeight -= stepHeight; |
||||
wnd_TrimHeight = Math.Max(wnd_TrimWidth, 0); |
||||
} |
||||
|
||||
this.Top = newTop; |
||||
ApplyRegion( |
||||
new Rect(0, (int)(wnd_Top - this.Top), wnd_TrimWidth, (int)(wnd_Height))); |
||||
//SetWindowRgn(new WindowInteropHelper(this).Handle, CreateRectRgn(0, (int)(wnd_Top - this.Top), wnd_TrimWidth, (int)(wnd_Height)), true);
|
||||
break; |
||||
} |
||||
|
||||
if (stopTimer) |
||||
{ |
||||
//window is being closed
|
||||
Width = 0.0; |
||||
Height = 0.0; |
||||
animTimer.Stop(); |
||||
if (!IsClosed) |
||||
Close(); |
||||
IsClosing = false; |
||||
} |
||||
}; |
||||
|
||||
IsClosing = true; |
||||
animTimer.Start(); |
||||
} |
||||
|
||||
public bool IsOpening { get; private set; } |
||||
|
||||
internal void StartOpenAnimation() |
||||
{ |
||||
AnchorStyle CorrectedAnchor = Anchor; |
||||
|
||||
if (CorrectedAnchor == AnchorStyle.Left && FlowDirection == FlowDirection.RightToLeft) |
||||
CorrectedAnchor = AnchorStyle.Right; |
||||
else if (CorrectedAnchor == AnchorStyle.Right && FlowDirection == FlowDirection.RightToLeft) |
||||
CorrectedAnchor = AnchorStyle.Left; |
||||
|
||||
double wnd_Width = this._targetWidth > 0.0 ? this._targetWidth : this.ActualWidth; |
||||
double wnd_Height = this._targetHeight > 0.0 ? this._targetHeight : this.ActualHeight; |
||||
double wnd_Left = this.Left; |
||||
double wnd_Top = this.Top; |
||||
|
||||
|
||||
int wnd_TrimWidth = 0; |
||||
int wnd_TrimHeight = 0; |
||||
|
||||
int stepWidth = (int)(wnd_Width / 8); |
||||
int stepHeight = (int)(wnd_Height / 8); |
||||
|
||||
if (CorrectedAnchor == AnchorStyle.Left) |
||||
{ |
||||
SetWindowRgn(new WindowInteropHelper(this).Handle, CreateRectRgn(0, 0, 0, (int)wnd_Height - wnd_TrimHeight), true); |
||||
this.Left = wnd_Left - wnd_Width; |
||||
} |
||||
else if (CorrectedAnchor == AnchorStyle.Top) |
||||
{ |
||||
SetWindowRgn(new WindowInteropHelper(this).Handle, CreateRectRgn(0, 0, (int)wnd_Width - wnd_TrimWidth, 0), true); |
||||
this.Top = wnd_Top - wnd_Height; |
||||
} |
||||
|
||||
DispatcherTimer animTimer = new DispatcherTimer(); |
||||
animTimer.Interval = TimeSpan.FromMilliseconds(2); |
||||
|
||||
animTimer.Tick += (sender, eventArgs) => |
||||
{ |
||||
bool stopTimer = false; |
||||
switch (CorrectedAnchor) |
||||
{ |
||||
case AnchorStyle.Right: |
||||
double newLeft = this.Left; |
||||
if (this.Left - stepWidth <= wnd_Left - wnd_Width) |
||||
{ |
||||
newLeft = wnd_Left - wnd_Width; |
||||
wnd_TrimWidth = (int)wnd_Width; |
||||
stopTimer = true; |
||||
} |
||||
else |
||||
{ |
||||
newLeft -= stepWidth; |
||||
wnd_TrimWidth += stepWidth; |
||||
} |
||||
|
||||
//SetWindowRgn(new WindowInteropHelper(this).Handle, CreateRectRgn(0, 0, wnd_TrimWidth, (int)wnd_Height - wnd_TrimHeight), true);
|
||||
Width = _targetWidth; |
||||
this.Left = newLeft; |
||||
ApplyRegion(new Rect(0, 0, wnd_TrimWidth, (int)wnd_Height - wnd_TrimHeight)); |
||||
break; |
||||
case AnchorStyle.Left: |
||||
if (this.Left + stepWidth >= wnd_Left) |
||||
{ |
||||
this.Left = wnd_Left; |
||||
wnd_TrimWidth = (int)wnd_Width; |
||||
stopTimer = true; |
||||
} |
||||
else |
||||
{ |
||||
this.Left += stepWidth; |
||||
wnd_TrimWidth += stepWidth; |
||||
} |
||||
|
||||
//SetWindowRgn(new WindowInteropHelper(this).Handle, CreateRectRgn((int)(wnd_Left - this.Left), 0, (int)(wnd_Width), (int)wnd_Height - wnd_TrimHeight), true);
|
||||
ApplyRegion( |
||||
new Rect((int)(wnd_Left - this.Left), 0, (int)(wnd_Width), (int)wnd_Height - wnd_TrimHeight)); |
||||
Width = _targetWidth; |
||||
break; |
||||
case AnchorStyle.Bottom: |
||||
double newTop = this.Top; |
||||
if (this.Top - stepHeight <= wnd_Top - wnd_Height) |
||||
{ |
||||
newTop = wnd_Top - wnd_Height; |
||||
wnd_TrimHeight = (int)wnd_Height; |
||||
stopTimer = true; |
||||
} |
||||
else |
||||
{ |
||||
newTop -= stepHeight; |
||||
wnd_TrimHeight += stepHeight; |
||||
} |
||||
|
||||
//SetWindowRgn(new WindowInteropHelper(this).Handle, CreateRectRgn(0, 0, (int)wnd_Width - wnd_TrimWidth, wnd_TrimHeight), true);
|
||||
ApplyRegion( |
||||
new Rect(0, 0, (int)wnd_Width - wnd_TrimWidth, wnd_TrimHeight)); |
||||
|
||||
Height = _targetHeight; |
||||
this.Top = newTop; |
||||
break; |
||||
case AnchorStyle.Top: |
||||
if (this.Top + stepHeight >= wnd_Top) |
||||
{ |
||||
this.Top = wnd_Top; |
||||
wnd_TrimHeight = (int)wnd_Height; |
||||
stopTimer = true; |
||||
} |
||||
else |
||||
{ |
||||
this.Top += stepHeight; |
||||
wnd_TrimHeight += stepHeight; |
||||
} |
||||
|
||||
//SetWindowRgn(new WindowInteropHelper(this).Handle, CreateRectRgn(0, (int)(wnd_Top - this.Top), (int)wnd_Width - wnd_TrimWidth, (int)(wnd_Height)), true);
|
||||
ApplyRegion( |
||||
new Rect(0, (int)(wnd_Top - this.Top), (int)wnd_Width - wnd_TrimWidth, (int)(wnd_Height))); |
||||
|
||||
Height = _targetHeight; |
||||
break; |
||||
} |
||||
|
||||
if (stopTimer) |
||||
{ |
||||
//SetWindowRgn(new WindowInteropHelper(this).Handle, IntPtr.Zero, false);
|
||||
UpdateClipRegion(); |
||||
animTimer.Stop(); |
||||
IsOpening = false; |
||||
} |
||||
}; |
||||
|
||||
IsOpening = true; |
||||
animTimer.Start(); |
||||
|
||||
|
||||
} |
||||
|
||||
//internal void StartCloseAnimation()
|
||||
//{
|
||||
// AnchorStyle CorrectedAnchor = Anchor;
|
||||
|
||||
// if (CorrectedAnchor == AnchorStyle.Left && FlowDirection == FlowDirection.RightToLeft)
|
||||
// CorrectedAnchor = AnchorStyle.Right;
|
||||
// else if (CorrectedAnchor == AnchorStyle.Right && FlowDirection == FlowDirection.RightToLeft)
|
||||
// CorrectedAnchor = AnchorStyle.Left;
|
||||
|
||||
|
||||
// //Let closing animation to occur
|
||||
// //Here we get a reference to a storyboard resource with a name ClosingStoryboard and
|
||||
// //wait that it completes before closing the window
|
||||
// FrameworkElement targetElement = GetTemplateChild("INT_pane") as FrameworkElement;
|
||||
// if (targetElement != null)
|
||||
// {
|
||||
// Storyboard storyBoard = new Storyboard();
|
||||
|
||||
// if (CorrectedAnchor == AnchorStyle.Left || CorrectedAnchor == AnchorStyle.Right)
|
||||
// {
|
||||
// DoubleAnimation anim = new DoubleAnimation(this.ActualWidth, 0.0, new Duration(TimeSpan.FromMilliseconds(500)));
|
||||
// Storyboard.SetTargetProperty(anim, new PropertyPath("Width"));
|
||||
// //storyBoard.Children.Add(anim);
|
||||
// }
|
||||
// if (CorrectedAnchor == AnchorStyle.Right)
|
||||
// {
|
||||
// DoubleAnimation anim = new DoubleAnimation(this.Left, this.Left + this.ActualWidth, new Duration(TimeSpan.FromMilliseconds(500)));
|
||||
// Storyboard.SetTargetProperty(anim, new PropertyPath("Left"));
|
||||
// storyBoard.Children.Add(anim);
|
||||
// }
|
||||
// if (CorrectedAnchor == AnchorStyle.Top || CorrectedAnchor == AnchorStyle.Bottom)
|
||||
// {
|
||||
// DoubleAnimation anim = new DoubleAnimation(this.Height, 0.0, new Duration(TimeSpan.FromMilliseconds(500)));
|
||||
// Storyboard.SetTargetProperty(anim, new PropertyPath("Height"));
|
||||
// storyBoard.Children.Add(anim);
|
||||
// }
|
||||
// if (CorrectedAnchor == AnchorStyle.Bottom)
|
||||
// {
|
||||
// DoubleAnimation anim = new DoubleAnimation(this.Top, this.Top + this.Height, new Duration(TimeSpan.FromMilliseconds(500)));
|
||||
// Storyboard.SetTargetProperty(anim, new PropertyPath("Top"));
|
||||
// storyBoard.Children.Add(anim);
|
||||
// }
|
||||
|
||||
// {
|
||||
// //DoubleAnimation anim = new DoubleAnimation(1.0, 0.0, new Duration(TimeSpan.FromMilliseconds(500)));
|
||||
// //Storyboard.SetTargetProperty(anim, new PropertyPath("Opacity"));
|
||||
// //AllowsTransparency slow down perfomance under XP/VISTA because rendering is enterely perfomed using CPU
|
||||
// //storyBoard.Children.Add(anim);
|
||||
// }
|
||||
|
||||
// storyBoard.Completed += (animation, eventArgs) =>
|
||||
// {
|
||||
// if (!IsClosed)
|
||||
// Close();
|
||||
// };
|
||||
|
||||
// foreach (AnimationTimeline animTimeLine in storyBoard.Children)
|
||||
// {
|
||||
// animTimeLine.FillBehavior = FillBehavior.Stop;
|
||||
// }
|
||||
|
||||
// storyBoard.Begin(this);
|
||||
// }
|
||||
|
||||
//}
|
||||
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region Clipping Region
|
||||
|
||||
protected override void OnActivated(EventArgs e) |
||||
{ |
||||
if (!IsOpening && !IsClosing) |
||||
UpdateClipRegion(); |
||||
|
||||
base.OnActivated(e); |
||||
} |
||||
|
||||
internal void UpdateClipRegion() |
||||
{ |
||||
//ApplyRegion(_lastApplyRect.IsEmpty ? new Rect(0, 0, this.Width, this.Height) : _lastApplyRect);
|
||||
ApplyRegion(new Rect(0, 0, Width, Height)); |
||||
} |
||||
|
||||
Rect _lastApplyRect = Rect.Empty; |
||||
|
||||
void ApplyRegion(Rect wndRect) |
||||
{ |
||||
if (!this.CanTransform()) |
||||
return; |
||||
|
||||
wndRect = new Rect( |
||||
this.TransformFromDeviceDPI(wndRect.TopLeft), |
||||
this.TransformFromDeviceDPI(wndRect.Size)); |
||||
|
||||
_lastApplyRect = wndRect; |
||||
|
||||
if (PresentationSource.FromVisual(this) == null) |
||||
return; |
||||
|
||||
|
||||
if (_dockingManager != null) |
||||
{ |
||||
List<Rect> otherRects = new List<Rect>(); |
||||
|
||||
foreach (Window fl in Window.GetWindow(_dockingManager).OwnedWindows) |
||||
{ |
||||
//not with myself!
|
||||
if (fl == this) |
||||
continue; |
||||
|
||||
if (!fl.IsVisible) |
||||
continue; |
||||
|
||||
Rect flRect = new Rect( |
||||
PointFromScreen(new Point(fl.Left, fl.Top)), |
||||
PointFromScreen(new Point(fl.Left + fl.Width, fl.Top + fl.Height))); |
||||
|
||||
if (flRect.IntersectsWith(wndRect)) |
||||
otherRects.Add(Rect.Intersect(flRect, wndRect)); |
||||
} |
||||
|
||||
IntPtr hDestRegn = CreateRectRgn( |
||||
(int)wndRect.Left, |
||||
(int)wndRect.Top, |
||||
(int)wndRect.Right, |
||||
(int)wndRect.Bottom); |
||||
|
||||
foreach (Rect otherRect in otherRects) |
||||
{ |
||||
IntPtr otherWin32Rect = CreateRectRgn( |
||||
(int)otherRect.Left, |
||||
(int)otherRect.Top, |
||||
(int)otherRect.Right, |
||||
(int)otherRect.Bottom); |
||||
|
||||
CombineRgn(hDestRegn, hDestRegn, otherWin32Rect, (int)CombineRgnStyles.RGN_DIFF); |
||||
} |
||||
|
||||
|
||||
SetWindowRgn(new WindowInteropHelper(this).Handle, hDestRegn, true); |
||||
} |
||||
} |
||||
|
||||
#endregion
|
||||
} |
||||
} |
@ -1,121 +0,0 @@
@@ -1,121 +0,0 @@
|
||||
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); |
||||
} |
||||
} |
||||
} |
||||
} |
@ -1,206 +0,0 @@
@@ -1,206 +0,0 @@
|
||||
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 bool AreVeryClose(double v1, double v2)
|
||||
//{
|
||||
// if (Math.Abs(v1 - v2) < 0.000001)
|
||||
// return true;
|
||||
|
||||
// return false;
|
||||
//}
|
||||
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 DockablePane FindChildDockablePane(this DockingManager manager, AnchorStyle desideredAnchor) |
||||
{ |
||||
foreach (UIElement childObject in LogicalTreeHelper.GetChildren(manager)) |
||||
{ |
||||
DockablePane foundPane = FindChildDockablePane(childObject, desideredAnchor); |
||||
if (foundPane != null) |
||||
return foundPane; |
||||
} |
||||
|
||||
return null; |
||||
} |
||||
|
||||
static DockablePane FindChildDockablePane(UIElement parent, AnchorStyle desideredAnchor) |
||||
{ |
||||
if (parent is DockablePane && ((DockablePane)parent).Anchor == desideredAnchor) |
||||
return parent as DockablePane; |
||||
|
||||
if (parent is ResizingPanel) |
||||
{ |
||||
foreach (UIElement childObject in ((ResizingPanel)parent).Children) |
||||
{ |
||||
DockablePane foundPane = FindChildDockablePane(childObject, desideredAnchor); |
||||
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); |
||||
} |
||||
} |
||||
} |
@ -1,36 +0,0 @@
@@ -1,36 +0,0 @@
|
||||
//Copyright (c) 2007-2009, 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; } |
||||
} |
||||
} |
@ -1,72 +0,0 @@
@@ -1,72 +0,0 @@
|
||||
//Copyright (c) 2007-2009, 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>
|
||||
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); |
||||
} |
||||
} |
@ -1,534 +0,0 @@
@@ -1,534 +0,0 @@
|
||||
//Copyright (c) 2007-2009, 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; |
||||
|
||||
|
||||
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)));
|
||||
FocusableProperty.OverrideMetadata(typeof(ManagedContent), new FrameworkPropertyMetadata(true)); |
||||
} |
||||
|
||||
public ManagedContent() |
||||
{ |
||||
this.Loaded += new RoutedEventHandler(ManagedContent_Loaded); |
||||
this.Unloaded += new RoutedEventHandler(ManagedContent_Unloaded); |
||||
} |
||||
|
||||
void ManagedContent_Loaded(object sender, RoutedEventArgs e) |
||||
{ |
||||
} |
||||
|
||||
void ManagedContent_Unloaded(object sender, RoutedEventArgs e) |
||||
{ |
||||
} |
||||
|
||||
|
||||
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)); |
||||
|
||||
//public string IconSource
|
||||
//{
|
||||
// get { return (string)GetValue(IconSourceProperty); }
|
||||
// set { SetValue(IconSourceProperty, value); }
|
||||
//}
|
||||
|
||||
//// Using a DependencyProperty as the backing store for Icon. This enables animation, styling, binding, etc...
|
||||
//public static readonly DependencyProperty IconSourceProperty =
|
||||
// DependencyProperty.Register("IconSource", typeof(string), typeof(ManagedContent));
|
||||
|
||||
/// <summary>
|
||||
/// Access to <see cref="IconProperty"/> dependency property
|
||||
/// </summary>
|
||||
public object Icon |
||||
{ |
||||
get { return (object)GetValue(IconProperty); } |
||||
set { SetValue(IconProperty, value); } |
||||
} |
||||
|
||||
/// <summary>
|
||||
/// Select an icon object for the content
|
||||
/// </summary>
|
||||
public static readonly DependencyProperty IconProperty = |
||||
DependencyProperty.Register("Icon", typeof(object), 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.RelativeOrAbsolute, out iconUri)) |
||||
{ |
||||
ImageSource img = new BitmapImage(iconUri); |
||||
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; |
||||
} |
||||
|
||||
/// <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)); |
||||
|
||||
|
||||
FrameworkElement _dragEnabledArea; |
||||
|
||||
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); |
||||
} |
||||
} |
||||
|
||||
|
||||
#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 && IsMouseDown && Manager != null) |
||||
{ |
||||
if (!IsMouseCaptured) |
||||
{ |
||||
Point ptMouseMove = e.GetPosition(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) |
||||
{ |
||||
SetAsActive(); |
||||
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); |
||||
} |
||||
|
||||
public Pane ContainerPane |
||||
{ |
||||
get |
||||
{ |
||||
Pane containerPane = Parent as Pane; |
||||
if (containerPane != null) |
||||
return containerPane; |
||||
|
||||
return this.FindVisualAncestor<Pane>(false); |
||||
} |
||||
} |
||||
|
||||
internal DockingManager Manager |
||||
{ |
||||
get |
||||
{ |
||||
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)
|
||||
{ |
||||
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); |
||||
} |
||||
|
||||
bool _isActiveContent = false; |
||||
|
||||
/// <summary>
|
||||
/// Returns true if the content is the currently active content.
|
||||
/// </summary>
|
||||
/// <remarks>Use <see cref="SetAsActive"/> method to set a content as active.</remarks>
|
||||
public bool IsActiveContent |
||||
{ |
||||
get |
||||
{ |
||||
return _isActiveContent; |
||||
} |
||||
internal set |
||||
{ |
||||
if (_isActiveContent != value) |
||||
{ |
||||
_isActiveContent = value; |
||||
NotifyPropertyChanged("IsActiveContent"); |
||||
if (IsActiveContentChanged != null) |
||||
IsActiveContentChanged(this, EventArgs.Empty); |
||||
|
||||
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");
|
||||
} |
||||
} |
||||
})); |
||||
} |
||||
} |
||||
|
||||
} |
||||
} |
||||
|
||||
public event EventHandler IsActiveContentChanged; |
||||
|
||||
/// <summary>
|
||||
/// Set the content as the active content
|
||||
/// </summary>
|
||||
/// <remarks>After this method returns property <see cref="IsActiveContent"/> returns true.</remarks>
|
||||
public void SetAsActive() |
||||
{ |
||||
if (ContainerPane != null && Manager != null)// && Manager.ActiveContent != this)
|
||||
{ |
||||
ContainerPane.SelectedItem = this; |
||||
FocusContent(); |
||||
if (Manager != null) |
||||
Manager.ActiveContent = this; |
||||
} |
||||
} |
||||
|
||||
protected virtual void FocusContent() |
||||
{ |
||||
} |
||||
|
||||
bool _isActiveDocument = false; |
||||
|
||||
/// <summary>
|
||||
/// Returns true if the document is the currently active document.
|
||||
/// </summary>
|
||||
/// <remarks>Use <see cref="SetAsActive"/> method to set a content as active.</remarks>
|
||||
public bool IsActiveDocument |
||||
{ |
||||
get |
||||
{ |
||||
return _isActiveDocument; |
||||
} |
||||
internal set |
||||
{ |
||||
if (_isActiveDocument != value) |
||||
{ |
||||
if (value) |
||||
{ |
||||
if (ContainerPane != null) |
||||
ContainerPane.SelectedItem = this; |
||||
} |
||||
|
||||
_isActiveDocument = value; |
||||
NotifyPropertyChanged("IsActiveDocument"); |
||||
} |
||||
} |
||||
} |
||||
|
||||
bool _isLocked; |
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating if this content is locked (readonly).
|
||||
/// </summary>
|
||||
public bool IsLocked |
||||
{ |
||||
get { return _isLocked; } |
||||
set |
||||
{ |
||||
_isLocked = value; |
||||
NotifyPropertyChanged("IsLocked"); |
||||
} |
||||
} |
||||
|
||||
Size _floatingWindowSize = Size.Empty; |
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the size of the floating window which hosts this content
|
||||
/// </summary>
|
||||
public Size FloatingWindowSize |
||||
{ |
||||
get |
||||
{ return _floatingWindowSize; } |
||||
set |
||||
{ _floatingWindowSize = value; } |
||||
} |
||||
|
||||
|
||||
ResizeMode _floatingResizeMode = ResizeMode.CanResize; |
||||
public ResizeMode FloatingResizeMode |
||||
{ |
||||
get |
||||
{ return _floatingResizeMode; } |
||||
set |
||||
{ _floatingResizeMode = value; } |
||||
} |
||||
|
||||
#region INotifyPropertyChanged Members
|
||||
|
||||
public event PropertyChangedEventHandler PropertyChanged; |
||||
|
||||
protected void NotifyPropertyChanged(string propertyName) |
||||
{ |
||||
if (PropertyChanged != null) |
||||
PropertyChanged(this, new PropertyChangedEventArgs(propertyName)); |
||||
} |
||||
#endregion
|
||||
|
||||
|
||||
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)); |
||||
|
||||
|
||||
} |
||||
} |
@ -1,358 +0,0 @@
@@ -1,358 +0,0 @@
|
||||
//Copyright (c) 2007-2009, 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; |
||||
|
||||
namespace AvalonDock |
||||
{ |
||||
|
||||
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; |
||||
} |
||||
} |
||||
|
||||
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; |
||||
} |
||||
|
||||
|
||||
} |
||||
|
||||
public class NavigatorWindow : Window, INotifyPropertyChanged |
||||
{ |
||||
static NavigatorWindow() |
||||
{ |
||||
DefaultStyleKeyProperty.OverrideMetadata(typeof(NavigatorWindow), new FrameworkPropertyMetadata(typeof(NavigatorWindow))); |
||||
|
||||
|
||||
Window.AllowsTransparencyProperty.OverrideMetadata(typeof(NavigatorWindow), new FrameworkPropertyMetadata(true)); |
||||
Window.WindowStyleProperty.OverrideMetadata(typeof(NavigatorWindow), new FrameworkPropertyMetadata(WindowStyle.None)); |
||||
Window.ShowInTaskbarProperty.OverrideMetadata(typeof(NavigatorWindow), new FrameworkPropertyMetadata(false)); |
||||
Control.BackgroundProperty.OverrideMetadata(typeof(NavigatorWindow), new FrameworkPropertyMetadata(Brushes.Transparent)); |
||||
} |
||||
|
||||
public NavigatorWindow() |
||||
{ |
||||
} |
||||
|
||||
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; |
||||
} |
||||
} |
||||
|
||||
DockingManager _manager; |
||||
public NavigatorWindow(DockingManager manager) |
||||
{ |
||||
_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>(); |
||||
listOfDocuments.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; |
||||
|
||||
List<DockableContent> listOfContents = _manager.FindContents<DockableContent>(); |
||||
List<NavigatorWindowItem> cnts = new List<NavigatorWindowItem>(); |
||||
listOfContents.ForEach((DockableContent cnt) => |
||||
{ |
||||
cnts.Add(new NavigatorWindowItem(cnt)); |
||||
}); |
||||
|
||||
DockableContents = cnts; |
||||
|
||||
|
||||
SelectedContent = Documents.Find((NavigatorWindowDocumentItem docItem) => |
||||
{ |
||||
return docItem.ItemContent == _manager.ActiveDocument; |
||||
}); |
||||
|
||||
SelectedToolWindow = null; |
||||
} |
||||
|
||||
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.SetAsActive(); |
||||
} |
||||
else if (SelectedToolWindow != null) |
||||
{ |
||||
_manager.Show(SelectedToolWindow.ItemContent as DockableContent); |
||||
SelectedToolWindow.ItemContent.SetAsActive(); |
||||
} |
||||
} |
||||
} |
||||
|
||||
if (!_isClosing) |
||||
CloseThisWindow();//Hide();
|
||||
|
||||
base.OnDeactivated(e); |
||||
} |
||||
|
||||
void CloseThisWindow() |
||||
{ |
||||
Window wndParent = this.Owner; |
||||
Close(); |
||||
wndParent.Activate(); |
||||
} |
||||
|
||||
List<NavigatorWindowDocumentItem> _documents = new List<NavigatorWindowDocumentItem>(); |
||||
|
||||
public List<NavigatorWindowDocumentItem> Documents |
||||
{ |
||||
get { return _documents; } |
||||
private |
||||
set |
||||
{ |
||||
_documents = value; |
||||
NotifyPropertyChanged("Documents"); |
||||
} |
||||
} |
||||
|
||||
List<NavigatorWindowItem> _tools = new List<NavigatorWindowItem>(); |
||||
|
||||
public List<NavigatorWindowItem> DockableContents |
||||
{ |
||||
get { return _tools; } |
||||
private set |
||||
{ |
||||
_tools = value; |
||||
NotifyPropertyChanged("DockableContents"); |
||||
} |
||||
} |
||||
|
||||
NavigatorWindowDocumentItem _selectedContent; |
||||
|
||||
public NavigatorWindowDocumentItem SelectedContent |
||||
{ |
||||
get |
||||
{ |
||||
return _selectedContent; |
||||
} |
||||
set |
||||
{ |
||||
if (_selectedContent != value) |
||||
{ |
||||
_selectedContent = value; |
||||
NotifyPropertyChanged("SelectedContent"); |
||||
} |
||||
} |
||||
} |
||||
|
||||
NavigatorWindowItem _toolContent; |
||||
|
||||
public NavigatorWindowItem SelectedToolWindow |
||||
{ |
||||
get |
||||
{ |
||||
return _toolContent; |
||||
} |
||||
set |
||||
{ |
||||
if (_toolContent != value) |
||||
{ |
||||
_toolContent = value; |
||||
|
||||
NotifyPropertyChanged("SelectedToolWindow"); |
||||
|
||||
SelectedContent = null; |
||||
Close();// Hide();
|
||||
} |
||||
} |
||||
} |
||||
|
||||
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++; |
||||
|
||||
SelectedContent = Documents[indexOfSelecteContent]; |
||||
} |
||||
} |
||||
|
||||
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
|
||||
} |
||||
} |
@ -1,383 +0,0 @@
@@ -1,383 +0,0 @@
|
||||
//Copyright (c) 2007-2009, 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, |
||||
} |
||||
|
||||
public class OverlayWindow : Window, 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)); |
||||
} |
||||
|
||||
public OverlayWindow() |
||||
{ } |
||||
|
||||
DockingManager _manager = null; |
||||
|
||||
public OverlayWindow(DockingManager manager) |
||||
{ |
||||
_manager = manager; |
||||
} |
||||
|
||||
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); |
||||
|
||||
_manager.DragPaneServices.Register(owdBottom); |
||||
_manager.DragPaneServices.Register(owdTop); |
||||
_manager.DragPaneServices.Register(owdLeft); |
||||
_manager.DragPaneServices.Register(owdRight); |
||||
_manager.DragPaneServices.Register(owdPaneBottom); |
||||
_manager.DragPaneServices.Register(owdPaneTop); |
||||
_manager.DragPaneServices.Register(owdPaneLeft); |
||||
_manager.DragPaneServices.Register(owdPaneRight); |
||||
_manager.DragPaneServices.Register(owdPaneInto); |
||||
} |
||||
|
||||
FrameworkElement gridPaneRelativeDockingOptions; |
||||
FrameworkElement selectionBox; |
||||
|
||||
OverlayWindowDockingButton owdBottom; |
||||
OverlayWindowDockingButton owdTop; |
||||
OverlayWindowDockingButton owdLeft; |
||||
OverlayWindowDockingButton owdRight; |
||||
OverlayWindowDockingButton owdPaneBottom; |
||||
OverlayWindowDockingButton owdPaneTop; |
||||
OverlayWindowDockingButton owdPaneLeft; |
||||
OverlayWindowDockingButton owdPaneRight; |
||||
OverlayWindowDockingButton owdPaneInto; |
||||
|
||||
|
||||
internal bool OnDrop(OverlayWindowDockingButton owdDock, Point point) |
||||
{ |
||||
//user has dropped the floating window over a anchor button
|
||||
//create a new dockable pane to insert in the main layout
|
||||
Pane paneToAnchor = _manager.DragPaneServices.FloatingWindow.ClonePane(); |
||||
|
||||
//floating window is going to be closed..
|
||||
|
||||
if (owdDock == owdBottom) |
||||
_manager.Anchor(paneToAnchor, AnchorStyle.Bottom); |
||||
else if (owdDock == owdLeft) |
||||
_manager.Anchor(paneToAnchor, AnchorStyle.Left); |
||||
else if (owdDock == owdRight) |
||||
_manager.Anchor(paneToAnchor, AnchorStyle.Right); |
||||
else if (owdDock == owdTop) |
||||
_manager.Anchor(paneToAnchor, AnchorStyle.Top); |
||||
else if (owdDock == owdPaneTop) |
||||
_manager.Anchor(paneToAnchor, CurrentDropPane, AnchorStyle.Top); |
||||
else if (owdDock == owdPaneBottom) |
||||
_manager.Anchor(paneToAnchor, CurrentDropPane, AnchorStyle.Bottom); |
||||
else if (owdDock == owdPaneLeft) |
||||
_manager.Anchor(paneToAnchor, CurrentDropPane, AnchorStyle.Left); |
||||
else if (owdDock == owdPaneRight) |
||||
_manager.Anchor(paneToAnchor, CurrentDropPane, AnchorStyle.Right); |
||||
else if (owdDock == owdPaneInto) |
||||
_manager.DropInto(paneToAnchor, CurrentDropPane); |
||||
|
||||
selectionBox.Visibility = Visibility.Hidden; |
||||
|
||||
return true; |
||||
} |
||||
|
||||
Pane CurrentDropPane = null; |
||||
|
||||
public void ShowOverlayPaneDockingOptions(Pane pane) |
||||
{ |
||||
|
||||
HideOverlayPaneDockingOptions(pane); |
||||
|
||||
//check if dockable on a document pane
|
||||
DockableStyle currentPaneDockableStyle = |
||||
_manager.DragPaneServices.FloatingWindow.HostedPane.GetCumulativeDockableStyle(); |
||||
|
||||
//if current drop pane is a DocumentPane ...
|
||||
if (pane is DocumentPane && |
||||
(currentPaneDockableStyle & DockableStyle.Document) == 0) |
||||
return; |
||||
if (pane is DockablePane && |
||||
(currentPaneDockableStyle & DockableStyle.Dockable) == 0) |
||||
return; |
||||
|
||||
|
||||
Rect rectPane = pane.SurfaceRectangle; |
||||
|
||||
Point myScreenTopLeft = this.PointToScreenDPI(new Point(0, 0)); |
||||
rectPane.Offset(-myScreenTopLeft.X, -myScreenTopLeft.Y);//relative to me
|
||||
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 (pane is DocumentPane) |
||||
gridPaneRelativeDockingOptions.Visibility = Visibility.Visible; |
||||
else |
||||
{ |
||||
gridPaneRelativeDockingOptions.Visibility = !(_manager.DragPaneServices.FloatingWindow is DocumentFloatingWindow) ? 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 (pane is DocumentPane) |
||||
owdPaneInto.Enabled = true; |
||||
else |
||||
owdPaneInto.Enabled = !(_manager.DragPaneServices.FloatingWindow is DocumentFloatingWindow); |
||||
|
||||
int destPaneChildCount = pane.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 = pane; |
||||
} |
||||
|
||||
public 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; |
||||
OverlayButtonHover = OverlayButtonHover.None; |
||||
} |
||||
|
||||
protected override void OnDeactivated(EventArgs e) |
||||
{ |
||||
selectionBox.Visibility = Visibility.Hidden; |
||||
|
||||
base.OnDeactivated(e); |
||||
} |
||||
|
||||
protected override void OnActivated(EventArgs e) |
||||
{ |
||||
base.OnActivated(e); |
||||
|
||||
|
||||
DockableStyle currentPaneDockableStyle = |
||||
_manager.DragPaneServices.FloatingWindow.HostedPane.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; |
||||
} |
||||
|
||||
/// <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(); |
||||
OverlayButtonHover = 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.SurfaceRectangle; |
||||
else |
||||
rectPane = CurrentDropPane.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) |
||||
OverlayButtonHover = OverlayButtonHover.DropBorderLeft; |
||||
else if (owdDock == owdRight) |
||||
OverlayButtonHover = OverlayButtonHover.DropBorderRight; |
||||
else if (owdDock == owdTop) |
||||
OverlayButtonHover = OverlayButtonHover.DropBorderTop; |
||||
else if (owdDock == owdBottom) |
||||
OverlayButtonHover = OverlayButtonHover.DropBorderBottom; |
||||
else if (owdDock == owdPaneInto) |
||||
OverlayButtonHover = OverlayButtonHover.DropPaneInto; |
||||
else if (owdDock == owdPaneRight) |
||||
OverlayButtonHover = OverlayButtonHover.DropPaneRight; |
||||
else if (owdDock == owdPaneTop) |
||||
OverlayButtonHover = OverlayButtonHover.DropPaneTop; |
||||
else if (owdDock == owdPaneLeft) |
||||
OverlayButtonHover = OverlayButtonHover.DropPaneLeft; |
||||
else if (owdDock == owdPaneBottom) |
||||
OverlayButtonHover = OverlayButtonHover.DropPaneBottom; |
||||
else |
||||
OverlayButtonHover = OverlayButtonHover.None; |
||||
|
||||
|
||||
selectionBox.Visibility = Visibility.Visible; |
||||
|
||||
_manager.DragPaneServices.FloatingWindow.OnShowSelectionBox(); |
||||
|
||||
} |
||||
|
||||
OverlayButtonHover _overlayButtonHover = OverlayButtonHover.None; |
||||
|
||||
public OverlayButtonHover OverlayButtonHover |
||||
{ |
||||
get |
||||
{ return _overlayButtonHover; } |
||||
set |
||||
{ |
||||
_overlayButtonHover = value; |
||||
if (PropertyChanged != null) |
||||
PropertyChanged(this, new PropertyChangedEventArgs("OverlayButtonHover")); |
||||
} |
||||
} |
||||
|
||||
#region INotifyPropertyChanged Members
|
||||
|
||||
public event PropertyChangedEventHandler PropertyChanged; |
||||
|
||||
#endregion
|
||||
} |
||||
} |
@ -1,125 +0,0 @@
@@ -1,125 +0,0 @@
|
||||
//Copyright (c) 2007-2009, 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) |
||||
{ |
||||
_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
|
||||
|
||||
|
||||
|
||||
public Rect SurfaceRectangle |
||||
{ |
||||
get |
||||
{ |
||||
if (!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)); |
||||
} |
||||
} |
||||
|
||||
public void OnDragEnter(Point point) |
||||
{ |
||||
if (!Enabled) |
||||
return; |
||||
|
||||
_owner.OnDragEnter(this, point); |
||||
} |
||||
|
||||
public void OnDragOver(Point point) |
||||
{ |
||||
if (!Enabled) |
||||
return; |
||||
|
||||
_owner.OnDragOver(this, point); |
||||
} |
||||
|
||||
public void OnDragLeave(Point point) |
||||
{ |
||||
if (!Enabled) |
||||
return; |
||||
|
||||
_owner.OnDragLeave(this, point); |
||||
} |
||||
|
||||
public bool OnDrop(Point point) |
||||
{ |
||||
if (!Enabled) |
||||
return false; |
||||
|
||||
return _owner.OnDrop(this, point); |
||||
} |
||||
|
||||
public bool IsSurfaceVisible |
||||
{ |
||||
get { return (_owner.IsLoaded && _btnDock != null); } |
||||
} |
||||
|
||||
#endregion
|
||||
} |
||||
} |
@ -1,300 +0,0 @@
@@ -1,300 +0,0 @@
|
||||
//Copyright (c) 2007-2009, 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.Collections.Specialized; |
||||
using System.ComponentModel; |
||||
|
||||
namespace AvalonDock |
||||
{ |
||||
public abstract class Pane : |
||||
System.Windows.Controls.Primitives.Selector, |
||||
IDropSurface, |
||||
IDockableControl, |
||||
INotifyPropertyChanged |
||||
{ |
||||
|
||||
public Pane() |
||||
{ |
||||
this.Loaded += new RoutedEventHandler(Pane_Loaded); |
||||
this.Unloaded += new RoutedEventHandler(Pane_Unloaded); |
||||
} |
||||
|
||||
void Pane_Loaded(object sender, RoutedEventArgs e) |
||||
{ |
||||
//if (GetManager() == null && Parent != null)
|
||||
// throw new InvalidOperationException("Pane must be put under a DockingManager!");
|
||||
|
||||
AddDragPaneReferences(); |
||||
} |
||||
|
||||
void Pane_Unloaded(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; |
||||
|
||||
|
||||
protected override void OnItemsChanged(System.Collections.Specialized.NotifyCollectionChangedEventArgs e) |
||||
{ |
||||
HasSingleItem = (Items.Count == 1); |
||||
|
||||
if (Items.Count > 0) |
||||
{ |
||||
int currentIndex = SelectedIndex; |
||||
SelectedIndex = -1; |
||||
|
||||
if (currentIndex < 0 || |
||||
currentIndex >= Items.Count) |
||||
currentIndex = Items.Count - 1; |
||||
|
||||
SelectedIndex = currentIndex; |
||||
} |
||||
//else
|
||||
// RemoveDragPaneReferences();
|
||||
|
||||
base.OnItemsChanged(e); |
||||
} |
||||
|
||||
//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 IDockableControl Members
|
||||
|
||||
#endregion
|
||||
|
||||
#region Membri di IDropSurface
|
||||
#region Drag pane services
|
||||
|
||||
DockingManager _oldManager = null; |
||||
//protected override void OnVisualParentChanged(DependencyObject oldParent)
|
||||
//{
|
||||
// base.OnVisualParentChanged(oldParent);
|
||||
|
||||
// RemoveDragPaneReferences();
|
||||
|
||||
// AddDragPaneReferences();
|
||||
//}
|
||||
|
||||
protected void RemoveDragPaneReferences() |
||||
{ |
||||
if (_oldManager != null) |
||||
{ |
||||
_oldManager.DragPaneServices.Unregister(this); |
||||
_oldManager = null; |
||||
} |
||||
|
||||
} |
||||
|
||||
protected void AddDragPaneReferences() |
||||
{ |
||||
{ |
||||
_oldManager = GetManager(); |
||||
if (_oldManager != null) |
||||
_oldManager.DragPaneServices.Register(this); |
||||
} |
||||
} |
||||
#endregion
|
||||
|
||||
|
||||
public abstract bool IsSurfaceVisible {get;} |
||||
|
||||
public 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)); |
||||
} |
||||
} |
||||
|
||||
public virtual void OnDragEnter(Point point) |
||||
{ |
||||
GetManager().OverlayWindow.ShowOverlayPaneDockingOptions(this); |
||||
} |
||||
|
||||
public virtual void OnDragOver(Point point) |
||||
{ |
||||
|
||||
} |
||||
|
||||
public virtual void OnDragLeave(Point point) |
||||
{ |
||||
GetManager().OverlayWindow.HideOverlayPaneDockingOptions(this); |
||||
} |
||||
|
||||
public virtual bool OnDrop(Point point) |
||||
{ |
||||
return false; |
||||
} |
||||
|
||||
#endregion
|
||||
|
||||
|
||||
public virtual ManagedContent RemoveContent(int index) |
||||
{ |
||||
ManagedContent contentToRemove = Items[index] as ManagedContent; |
||||
|
||||
Items.RemoveAt(index); |
||||
|
||||
return 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>
|
||||
/// Closes or hides provided content depending on HideOnClose property
|
||||
/// </summary>
|
||||
internal virtual void CloseOrHide(DockableContent cntToCloseOrHide) |
||||
{ |
||||
CloseOrHide(cntToCloseOrHide, false); |
||||
} |
||||
|
||||
/// <summary>
|
||||
/// Closes or hides provided content depending on HideOnClose property
|
||||
/// </summary>
|
||||
internal virtual void CloseOrHide(DockableContent cntToCloseOrHide, bool force) |
||||
{ |
||||
Debug.Assert(cntToCloseOrHide != null); |
||||
|
||||
if (!force && !cntToCloseOrHide.IsCloseable) |
||||
return; |
||||
|
||||
DockingManager manager = GetManager(); |
||||
if (cntToCloseOrHide.HideOnClose && manager != null) |
||||
manager.Hide(cntToCloseOrHide); |
||||
else |
||||
RemoveContent(Items.IndexOf(cntToCloseOrHide)); |
||||
} |
||||
|
||||
|
||||
#region INotifyPropertyChanged Members
|
||||
|
||||
public event PropertyChangedEventHandler PropertyChanged; |
||||
|
||||
protected void NotifyPropertyChanged(string propertyName) |
||||
{ |
||||
if (PropertyChanged != null) |
||||
PropertyChanged(this, new PropertyChangedEventArgs(propertyName)); |
||||
} |
||||
#endregion
|
||||
} |
||||
} |
@ -1,77 +0,0 @@
@@ -1,77 +0,0 @@
|
||||
//Copyright (c) 2007-2009, 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 abstract class PaneTabPanel : System.Windows.Controls.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 = null; |
||||
mc.Style = TabItemStyle; |
||||
} |
||||
|
||||
} |
||||
|
||||
|
||||
|
||||
|
||||
public Style TabItemStyle |
||||
{ |
||||
get { return (Style)GetValue(TabItemStyleProperty); } |
||||
set { SetValue(TabItemStyleProperty, value); } |
||||
} |
||||
|
||||
// Using a DependencyProperty as the backing store for TabStyle. This enables animation, styling, binding, etc...
|
||||
public static readonly DependencyProperty TabItemStyleProperty = |
||||
DependencyProperty.Register("TabItemStyle", typeof(Style), typeof(PaneTabPanel)); |
||||
} |
||||
} |
@ -1,62 +0,0 @@
@@ -1,62 +0,0 @@
|
||||
#region Using directives
|
||||
|
||||
using System.Reflection; |
||||
using System.Runtime.CompilerServices; |
||||
using System.Resources; |
||||
using System.Globalization; |
||||
using System.Windows; |
||||
using System.Runtime.InteropServices; |
||||
|
||||
#endregion
|
||||
|
||||
// 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("WPF docking library")] |
||||
[assembly: AssemblyConfiguration("")] |
||||
[assembly: AssemblyCompany("")] |
||||
[assembly: AssemblyProduct("AvalonDock")] |
||||
[assembly: AssemblyCopyright("Copyright @ Adolfo Marinucci 2007-2009")] |
||||
[assembly: AssemblyTrademark("")] |
||||
[assembly: AssemblyCulture("")] |
||||
[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)]
|
||||
|
||||
|
||||
// Specifies the location in which theme dictionaries are stored for types in an assembly.
|
||||
[assembly: ThemeInfo( |
||||
// Specifies the location of system theme-specific resource dictionaries for this project.
|
||||
// The default setting in this project is "None" since this default project does not
|
||||
// include these user-defined theme files:
|
||||
// Themes\Aero.NormalColor.xaml
|
||||
// Themes\Classic.xaml
|
||||
// Themes\Luna.Homestead.xaml
|
||||
// Themes\Luna.Metallic.xaml
|
||||
// Themes\Luna.NormalColor.xaml
|
||||
// Themes\Royale.NormalColor.xaml
|
||||
ResourceDictionaryLocation.SourceAssembly, |
||||
|
||||
// Specifies the location of the system non-theme specific resource dictionary:
|
||||
// Themes\generic.xaml
|
||||
ResourceDictionaryLocation.SourceAssembly)] |
||||
|
||||
|
||||
// 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 Revision and Build Numbers
|
||||
// by using the '*' as shown below:
|
||||
[assembly: AssemblyVersion("1.2.2702")] |
@ -1,63 +0,0 @@
@@ -1,63 +0,0 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:2.0.50727.1433
|
||||
//
|
||||
// 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", "2.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 (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)] |
||||
internal static global::System.Globalization.CultureInfo Culture { |
||||
get { |
||||
return resourceCulture; |
||||
} |
||||
set { |
||||
resourceCulture = value; |
||||
} |
||||
} |
||||
} |
||||
} |
@ -1,117 +0,0 @@
@@ -1,117 +0,0 @@
|
||||
<?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.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> |
||||
</resheader> |
||||
<resheader name="writer"> |
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> |
||||
</resheader> |
||||
</root> |
@ -1,26 +0,0 @@
@@ -1,26 +0,0 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:2.0.50727.1433
|
||||
//
|
||||
// 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", "9.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; |
||||
} |
||||
} |
||||
} |
||||
} |
@ -1,7 +0,0 @@
@@ -1,7 +0,0 @@
|
||||
<?xml version='1.0' encoding='iso-8859-1'?> |
||||
<SettingsFile xmlns="uri:settings" CurrentProfile="(Default)"> |
||||
<Profiles> |
||||
<Profile Name="(Default)" /> |
||||
</Profiles> |
||||
<Settings /> |
||||
</SettingsFile> |
@ -1,21 +0,0 @@
@@ -1,21 +0,0 @@
|
||||
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; } |
||||
} |
||||
} |
@ -1,75 +0,0 @@
@@ -1,75 +0,0 @@
|
||||
//Copyright (c) 2007-2009, 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 ResizingPanelSplitter : System.Windows.Controls.Primitives.Thumb |
||||
{ |
||||
static ResizingPanelSplitter() |
||||
{ |
||||
//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(ResizingPanelSplitter), new FrameworkPropertyMetadata(typeof(ResizingPanelSplitter))); |
||||
MinWidthProperty.OverrideMetadata(typeof(ResizingPanelSplitter), new FrameworkPropertyMetadata(4.0, FrameworkPropertyMetadataOptions.AffectsParentMeasure)); |
||||
MinHeightProperty.OverrideMetadata(typeof(ResizingPanelSplitter), new FrameworkPropertyMetadata(4.0, FrameworkPropertyMetadataOptions.AffectsParentMeasure)); |
||||
HorizontalAlignmentProperty.OverrideMetadata(typeof(ResizingPanelSplitter), new FrameworkPropertyMetadata(HorizontalAlignment.Stretch, FrameworkPropertyMetadataOptions.AffectsParentMeasure)); |
||||
VerticalAlignmentProperty.OverrideMetadata(typeof(ResizingPanelSplitter), new FrameworkPropertyMetadata(VerticalAlignment.Stretch, FrameworkPropertyMetadataOptions.AffectsParentMeasure)); |
||||
} |
||||
|
||||
public Orientation Orientation |
||||
{ |
||||
get { return (Orientation)GetValue(OrientationProperty); } |
||||
protected set { SetValue(OrientationPropertyKey, value); } |
||||
} |
||||
|
||||
// Using a DependencyProperty as the backing store for Orientation. This enables animation, styling, binding, etc...
|
||||
private static readonly DependencyPropertyKey OrientationPropertyKey = |
||||
DependencyProperty.RegisterReadOnly("Orientation", typeof(Orientation), typeof(ResizingPanelSplitter), new UIPropertyMetadata(Orientation.Horizontal)); |
||||
|
||||
public static readonly DependencyProperty OrientationProperty = OrientationPropertyKey.DependencyProperty; |
||||
|
||||
protected override void OnVisualParentChanged(DependencyObject oldParent) |
||||
{ |
||||
ResizingPanel panel = Parent as ResizingPanel; |
||||
if (panel != null) |
||||
Orientation = panel.Orientation; |
||||
|
||||
base.OnVisualParentChanged(oldParent); |
||||
} |
||||
} |
||||
} |
@ -1,116 +0,0 @@
@@ -1,116 +0,0 @@
|
||||
<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> |
@ -1,95 +0,0 @@
@@ -1,95 +0,0 @@
|
||||
<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.FloatingWindow}}"> |
||||
<MenuItem Command="ad:FloatingWindow.SetAsFloatingWindowCommand"/> |
||||
<MenuItem Command="ad:FloatingWindow.SetAsDockableWindowCommand"/> |
||||
<MenuItem Command="ad:FloatingWindow.TabbedDocumentCommand"/> |
||||
<MenuItem Command="ad:FloatingWindow.CloseCommand"/> |
||||
</ContextMenu> |
||||
|
||||
<!--ResizingPanelSplitter--> |
||||
<Style TargetType="{x:Type ad:ResizingPanelSplitter}"> |
||||
<Setter Property="Background" Value="Transparent" /> <!--{DynamicResource {ComponentResourceKey {x:Type ad:DockingManager}, {x:Static ad:AvalonDockBrushes.DefaultBackgroundBrush}}}"/>--> |
||||
<Setter Property="Template"> |
||||
<Setter.Value> |
||||
<ControlTemplate TargetType="{x:Type ad:ResizingPanelSplitter}"> |
||||
<Grid> |
||||
<Border Background="{TemplateBinding Background}"/> |
||||
<Border Name="intBorder" Background="Transparent"/> |
||||
</Grid> |
||||
<ControlTemplate.Triggers> |
||||
<Trigger Property="Orientation" Value="Horizontal"> |
||||
<Setter Value="SizeWE" Property="Cursor" TargetName="intBorder"/> |
||||
</Trigger> |
||||
<Trigger Property="Orientation" Value="Vertical"> |
||||
<Setter Value="SizeNS" Property="Cursor" TargetName="intBorder"/> |
||||
</Trigger> |
||||
</ControlTemplate.Triggers> |
||||
</ControlTemplate> |
||||
</Setter.Value> |
||||
</Setter> |
||||
</Style> |
||||
|
||||
<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 ContentSource="Content"/> |
||||
</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}}}"/> |
||||
</Trigger> |
||||
</ControlTemplate.Triggers> |
||||
</ControlTemplate> |
||||
</Setter.Value> |
||||
</Setter> |
||||
</Style> |
||||
|
||||
<Style x:Key="PaneHeaderContextMenuCommandStyle" |
||||
TargetType="{x:Type Button}" |
||||
BasedOn="{StaticResource PaneHeaderCommandStyle}"> |
||||
<Style.Triggers> |
||||
<DataTrigger Value="True"> |
||||
<DataTrigger.Binding> |
||||
<Binding> |
||||
<Binding.RelativeSource> |
||||
<RelativeSource |
||||
Mode="FindAncestor" |
||||
AncestorType="{x:Type ad:DockablePane}" |
||||
/> |
||||
</Binding.RelativeSource> |
||||
<Binding.Path> |
||||
IsOptionsMenuOpened |
||||
</Binding.Path> |
||||
</Binding> |
||||
</DataTrigger.Binding> |
||||
<Setter Property="Border.BorderBrush" |
||||
Value="{DynamicResource {ComponentResourceKey {x:Type ad:DockingManager}, {x:Static ad:AvalonDockBrushes.PaneHeaderCommandBorderBrush}}}"/> |
||||
<Setter Property="Border.Background" |
||||
Value="{DynamicResource {ComponentResourceKey {x:Type ad:DockingManager}, {x:Static ad:AvalonDockBrushes.PaneHeaderCommandBackground}}}"/> |
||||
</DataTrigger> |
||||
|
||||
</Style.Triggers> |
||||
</Style> |
||||
</ResourceDictionary> |
@ -1,255 +0,0 @@
@@ -1,255 +0,0 @@
|
||||
<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 Source="/AvalonDock;component/Resources/ManagedContentStyle.xaml"/> |
||||
</ResourceDictionary.MergedDictionaries> |
||||
|
||||
|
||||
<ContextMenu |
||||
x:Key="{ComponentResourceKey TypeInTargetAssembly={x:Type ad:DockingManager}, ResourceId={x:Static ad:ContextMenuElement.DockablePane}}" |
||||
> |
||||
<MenuItem Header="Floating" |
||||
Command="ad:DockableContent.FloatingCommand" /> |
||||
<!--<MenuItem Header="Dockable" |
||||
Command="ad:DockableContent.DockableCommand" />--> |
||||
<MenuItem Header="Tabbed document" |
||||
Command="ad:DockableContent.ShowAsDocumentCommand" /> |
||||
<MenuItem Header="Auto Hide" |
||||
Command="ad:DockablePane.ToggleAutoHideCommand" /> |
||||
<MenuItem Header="Hide" |
||||
Command="ad:DockableContent.HideCommand" 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> |
||||
<ad:AlignedImage> |
||||
<ContentPresenter x:Name="Icon" |
||||
Grid.Column="0" |
||||
Margin="1" |
||||
VerticalAlignment="Center" |
||||
ContentSource="Icon" |
||||
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/> |
||||
</ad:AlignedImage> |
||||
<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 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:DockablePane.CloseCommand" Visibility="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=SelectedItem.IsCloseable, Converter={x:Static ad:Converters.BoolToVisibilityConverter}}"> |
||||
<ad:AlignedImage> |
||||
<Image Source="Images\PinClose.png" Width="13" Height="13" Stretch="None"/> |
||||
</ad:AlignedImage> |
||||
</Button> |
||||
<Button x:Name="btnPinAutoHide" DockPanel.Dock="Right" Width="15" Height="15" Style="{StaticResource PaneHeaderCommandStyle}" Command="ad:DockablePane.ToggleAutoHideCommand"> |
||||
<ad:AlignedImage> |
||||
<Image Source="Images\PinAutoHide.png" Width="13" Height="13" Stretch="None"/> |
||||
</ad:AlignedImage> |
||||
</Button> |
||||
<Button x:Name="PART_ShowContextMenuButton" DockPanel.Dock="Right" Width="15" Height="15" Style="{StaticResource PaneHeaderContextMenuCommandStyle}" Command="ad:DockablePane.ShowOptionsCommand"> |
||||
<ad:AlignedImage> |
||||
<Image Source="Images\PinMenu.png" Width="13" Height="13" Stretch="None"/> |
||||
</ad:AlignedImage> |
||||
</Button> |
||||
<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> |
||||
|
||||
<!--<EventTrigger RoutedEvent="FrameworkElement.Loaded"> |
||||
<BeginStoryboard> |
||||
<Storyboard> |
||||
<DoubleAnimation |
||||
Storyboard.TargetProperty="Opacity" |
||||
From="0" To="1" Duration="0:0:0.200" /> |
||||
</Storyboard> |
||||
</BeginStoryboard> |
||||
</EventTrigger>--> |
||||
|
||||
<DataTrigger Binding="{Binding RelativeSource={RelativeSource Self}, Path=SelectedItem.State}" Value="AutoHide"> |
||||
<!--<DataTrigger.Value> |
||||
<ad:DockableContentState> |
||||
AutoHide |
||||
</ad:DockableContentState> |
||||
</DataTrigger.Value>--> |
||||
<Setter Property="LayoutTransform" TargetName="btnPinAutoHide"> |
||||
<Setter.Value> |
||||
<RotateTransform Angle="90"/> |
||||
</Setter.Value> |
||||
</Setter> |
||||
</DataTrigger> |
||||
|
||||
|
||||
</ControlTemplate.Triggers> |
||||
|
||||
|
||||
</ControlTemplate> |
||||
</Setter.Value> |
||||
</Setter> |
||||
</Style> |
||||
|
||||
|
||||
|
||||
|
||||
</ResourceDictionary> |
@ -1,147 +0,0 @@
@@ -1,147 +0,0 @@
|
||||
<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 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"> |
||||
<ad:AlignedImage> |
||||
<Border Width="16" Height="16"> |
||||
<Border.Background> |
||||
<VisualBrush Stretch="None" Visual="{Binding Path=ReferencedContent.Icon, RelativeSource={RelativeSource TemplatedParent}}"/> |
||||
</Border.Background> |
||||
</Border> |
||||
</ad:AlignedImage> |
||||
<TextBlock |
||||
Text="{Binding Path=ReferencedContent.Title, RelativeSource={RelativeSource TemplatedParent}}" |
||||
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 TargetType="{x:Type ad:DockablePaneAnchorTabGroup}"> |
||||
<Setter Property="Orientation" Value="Horizontal"/> |
||||
<Setter Property="Margin" Value="3,0,0,0"/> |
||||
</Style> |
||||
|
||||
<!--DockingManager--> |
||||
<Style 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> |
@ -1,131 +0,0 @@
@@ -1,131 +0,0 @@
|
||||
<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 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> |
@ -1,267 +0,0 @@
@@ -1,267 +0,0 @@
|
||||
<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 Header="Close" |
||||
Command="ApplicationCommands.Close" /> |
||||
<MenuItem Command="ad:DocumentPane.CloseAllButThisCommand" /> |
||||
<Separator/> |
||||
<MenuItem Command="ad:DocumentPane.NewHorizontalTabGroupCommand"> |
||||
<MenuItem.Icon> |
||||
<ad:AlignedImage VerticalAlignment="Center" HorizontalAlignment="Center"> |
||||
<Image Source="/AvalonDock;component/resources/Images/HTabGroup.png" Width="13" Height="14"/> |
||||
</ad:AlignedImage> |
||||
</MenuItem.Icon> |
||||
</MenuItem> |
||||
<MenuItem Command="ad:DocumentPane.NewVerticalTabGroupCommand"> |
||||
<MenuItem.Icon> |
||||
<ad:AlignedImage VerticalAlignment="Center" HorizontalAlignment="Center"> |
||||
<Image Source="/AvalonDock;component/resources/Images/VTabGroup.png" Width="13" Height="14" /> |
||||
</ad:AlignedImage> |
||||
</MenuItem.Icon> |
||||
</MenuItem> |
||||
</ContextMenu> |
||||
|
||||
<!--ManagedContent--> |
||||
<Style TargetType="{x:Type ad:ManagedContent}"> |
||||
<Setter Property="FocusVisualStyle" Value="{x:Null}"/> |
||||
<Setter Property="Template"> |
||||
<Setter.Value> |
||||
<ControlTemplate TargetType="{x:Type ad:ManagedContent}"> |
||||
<Border |
||||
Background="{TemplateBinding Background}" |
||||
Margin="{TemplateBinding Padding}" |
||||
> |
||||
<ContentPresenter/> |
||||
</Border> |
||||
</ControlTemplate> |
||||
</Setter.Value> |
||||
</Setter> |
||||
</Style> |
||||
|
||||
|
||||
<!--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="-10,0,0,0" |
||||
SnapsToDevicePixels="True" |
||||
ContextMenu="{DynamicResource {ComponentResourceKey {x:Type ad:DockingManager}, {x:Static ad:ContextMenuElement.DocumentPane}}}" |
||||
> |
||||
<Grid> |
||||
<Grid.ColumnDefinitions> |
||||
<ColumnDefinition Width="20"/> |
||||
<ColumnDefinition Width="Auto"/> |
||||
</Grid.ColumnDefinitions> |
||||
<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"/> |
||||
<!--<Setter Property="Panel.ZIndex" Value="1"/> DOES NOT WORK! I DON'T KNOW WHY!!???--> |
||||
</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> |
||||
<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--> |
||||
<Style 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" ><!--ItemTemplate="{StaticResource ManagedContentHeaderDataTemplate}"--> |
||||
<ContextMenu.ItemContainerStyle> |
||||
<Style TargetType="{x:Type MenuItem}"> |
||||
<Setter Property="CommandParameter" Value="{Binding RelativeSource={x:Static RelativeSource.Self}, Path=Header}"/> |
||||
<Setter Property="Command" Value="ad:DocumentPane.ActivateDocumentCommand"/> |
||||
<Setter Property="Template"> |
||||
<Setter.Value> |
||||
<ControlTemplate TargetType="MenuItem"> |
||||
<Border x:Name="intBorder" BorderThickness="1" Background="{TemplateBinding Background}" CornerRadius="2"> |
||||
<Grid> |
||||
<Grid.ColumnDefinitions> |
||||
<ColumnDefinition Width="Auto" MinWidth="24"/> |
||||
<ColumnDefinition Width="*"/> |
||||
</Grid.ColumnDefinitions> |
||||
<ContentPresenter x:Name="Icon" Margin="2" Content="{Binding Path=Icon}" Grid.Column="0" VerticalAlignment="Center"/> |
||||
<TextBlock x:Name="intMenuTitle" Margin="5,2,20,2" Text="{Binding Path=Title}" Grid.Column="1" VerticalAlignment="Center"/> |
||||
</Grid> |
||||
</Border> |
||||
<ControlTemplate.Triggers> |
||||
<Trigger Property="IsMouseOver" Value="true"> |
||||
<Setter Property="Background" TargetName="intBorder"> |
||||
<Setter.Value> |
||||
<SolidColorBrush Color="{DynamicResource {x:Static SystemColors.ActiveCaptionColorKey}}" Opacity="0.3"/> |
||||
</Setter.Value> |
||||
</Setter> |
||||
<Setter Property="BorderBrush" TargetName="intBorder" Value="{DynamicResource {x:Static SystemColors.ActiveCaptionBrushKey}}"/> |
||||
</Trigger> |
||||
<DataTrigger Binding="{Binding Path=IsActiveDocument}" Value="True"> |
||||
<Setter Property="FontWeight" Value="Bold" TargetName="intMenuTitle"/> |
||||
</DataTrigger> |
||||
</ControlTemplate.Triggers> |
||||
</ControlTemplate> |
||||
</Setter.Value> |
||||
</Setter> |
||||
</Style> |
||||
</ContextMenu.ItemContainerStyle> |
||||
</ContextMenu> |
||||
</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" |
||||
KeyboardNavigation.TabIndex="1" |
||||
/> |
||||
</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="ApplicationCommands.Close"> |
||||
<ad:AlignedImage> |
||||
<Image Source="Images\PinClose.png" Width="13" Height="13" Stretch="Uniform"/> |
||||
</ad:AlignedImage> |
||||
</Button> |
||||
<Button x:Name="PART_ShowContextMenuButton" DockPanel.Dock="Right" Width="18" Height="18" Style="{StaticResource PaneHeaderCommandStyle}" Command="ad:DocumentPane.ShowDocumentsListMenuCommand"> |
||||
<ad:AlignedImage> |
||||
<Image x:Name="ShowContextMenuIcon" Source="Images\PinMenu.png" Width="13" Height="13" Stretch="Uniform"/> |
||||
</ad:AlignedImage> |
||||
</Button> |
||||
<ad:DocumentTabPanel |
||||
x:Name="paneTabsPanel" |
||||
Panel.ZIndex ="1" |
||||
KeyboardNavigation.TabIndex="2" |
||||
IsItemsHost="True" |
||||
Margin="10,2,0,0" |
||||
TabItemStyle="{StaticResource DocumentTabItemStyle}"/> |
||||
</DockPanel> |
||||
</Border> |
||||
</Grid> |
||||
</Border> |
||||
<ControlTemplate.Triggers> |
||||
<Trigger Property="HasItems" Value="False"> |
||||
<Setter Property="Visibility" Value="Hidden"/> |
||||
</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> |
@ -1,111 +0,0 @@
@@ -1,111 +0,0 @@
|
||||
<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> |
||||
|
||||
|
||||
<!--DockableFloatingWindow--> |
||||
<Style 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/> |
||||
<!--ad:ResizingPanel.ResizeWidth="{TemplateBinding ad:ResizingPanel.ResizeWidth}" |
||||
ad:ResizingPanel.ResizeHeight="{TemplateBinding ad:ResizingPanel.ResizeHeight}"/>--> |
||||
</Border><!----> |
||||
</ControlTemplate> |
||||
</Setter.Value> |
||||
</Setter> |
||||
</Style> |
||||
|
||||
<!--DocumentFloatingWindow--> |
||||
<Style 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="Visible" |
||||
Background="{DynamicResource {x:Static SystemColors.ActiveCaptionBrushKey}}" |
||||
Opacity="0.2"/> |
||||
<ContentPresenter |
||||
x:Name="PART_Content" |
||||
Visibility="Collapsed" |
||||
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 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"/> |
||||
<Border Name="INT_Resizer" Grid.Column="2" Grid.Row="1" |
||||
Background="Transparent"/> <!--{DynamicResource {ComponentResourceKey {x:Type ad:DockingManager}, {x:Static ad:AvalonDockBrushes.DefaultBackgroundBrush}}}"--> |
||||
</Grid> |
||||
<ControlTemplate.Triggers> |
||||
<DataTrigger Binding="{Binding RelativeSource={RelativeSource Self}, Path=Anchor}" Value="Right"> |
||||
<Setter Property="Grid.Row" Value="1" TargetName="INT_Resizer"/> |
||||
<Setter Property="Grid.Column" Value="0" TargetName="INT_Resizer"/> |
||||
<Setter Property="Width" Value="4" TargetName="INT_Resizer"/> |
||||
<Setter Property="Cursor" Value="SizeWE" TargetName="INT_Resizer"/> |
||||
</DataTrigger> |
||||
<DataTrigger Binding="{Binding RelativeSource={RelativeSource Self}, Path=Anchor}" Value="Left"> |
||||
<Setter Property="Grid.Row" Value="1" TargetName="INT_Resizer"/> |
||||
<Setter Property="Grid.Column" Value="2" TargetName="INT_Resizer"/> |
||||
<Setter Property="Width" Value="4" TargetName="INT_Resizer"/> |
||||
<Setter Property="Cursor" Value="SizeWE" TargetName="INT_Resizer"/> |
||||
</DataTrigger> |
||||
<DataTrigger Binding="{Binding RelativeSource={RelativeSource Self}, Path=Anchor}" Value="Bottom"> |
||||
<Setter Property="Grid.Column" Value="1" TargetName="INT_Resizer"/> |
||||
<Setter Property="Grid.Row" Value="0" TargetName="INT_Resizer"/> |
||||
<Setter Property="Height" Value="4" TargetName="INT_Resizer"/> |
||||
<Setter Property="Cursor" Value="SizeNS" TargetName="INT_Resizer"/> |
||||
</DataTrigger> |
||||
<DataTrigger Binding="{Binding RelativeSource={RelativeSource Self}, Path=Anchor}" Value="Top"> |
||||
<Setter Property="Grid.Row" Value="2" TargetName="INT_Resizer"/> |
||||
<Setter Property="Grid.Column" Value="1" TargetName="INT_Resizer"/> |
||||
<Setter Property="Height" Value="4" TargetName="INT_Resizer"/> |
||||
<Setter Property="Cursor" Value="SizeNS" TargetName="INT_Resizer"/> |
||||
</DataTrigger> |
||||
</ControlTemplate.Triggers> |
||||
</ControlTemplate> |
||||
</Setter.Value> |
||||
</Setter> |
||||
</Style> |
||||
</ResourceDictionary> |
@ -1,32 +0,0 @@
@@ -1,32 +0,0 @@
|
||||
<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> |
||||
|
||||
|
||||
|
||||
<!--ManagedContent--> |
||||
<Style TargetType="{x:Type ad:ManagedContent}"> |
||||
<Setter Property="FocusVisualStyle" Value="{x:Null}"/> |
||||
<Setter Property="Template"> |
||||
<Setter.Value> |
||||
<ControlTemplate TargetType="{x:Type ad:ManagedContent}"> |
||||
<Border |
||||
Background="{TemplateBinding Background}"> |
||||
<ContentPresenter |
||||
x:Name="PART_ContentPresenter" |
||||
Margin="{TemplateBinding Padding}" |
||||
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" |
||||
/> |
||||
|
||||
</Border> |
||||
</ControlTemplate> |
||||
</Setter.Value> |
||||
</Setter> |
||||
</Style> |
||||
|
||||
</ResourceDictionary> |
@ -1,145 +0,0 @@
@@ -1,145 +0,0 @@
|
||||
<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> |
||||
|
||||
<Style TargetType="{x:Type ad:NavigatorWindow}"> |
||||
<Style.Resources> |
||||
<Style x:Key="listItemStyle" TargetType="ListBoxItem"> |
||||
<Setter Property="Template"> |
||||
<Setter.Value> |
||||
<ControlTemplate TargetType="ListBoxItem"> |
||||
<Border x:Name="intBorder" > |
||||
<ContentPresenter Margin="0,2,0,2"/> |
||||
</Border> |
||||
<ControlTemplate.Triggers> |
||||
<Trigger Property="IsMouseOver" Value="True"> |
||||
<Setter Property="Background" TargetName="intBorder" Value="{DynamicResource {x:Static SystemColors.ActiveCaptionBrushKey}}"/> |
||||
</Trigger> |
||||
<Trigger Property="IsSelected" Value="True"> |
||||
<Setter Property="Background" TargetName="intBorder" 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="Horizontal" HorizontalAlignment="Stretch" Background="Transparent"> |
||||
<ad:AlignedImage> |
||||
<Border Width="16" Height="16"> |
||||
<Border.Background> |
||||
<VisualBrush Stretch="None" Visual="{Binding Path=Icon}"/> |
||||
</Border.Background> |
||||
</Border> |
||||
</ad:AlignedImage> |
||||
<TextBlock Margin="4,0,0,0" Text="{Binding Path=Title}"/> |
||||
|
||||
</StackPanel> |
||||
</DataTemplate> |
||||
|
||||
</Style.Resources> |
||||
<Setter Property="Template"> |
||||
<Setter.Value> |
||||
<ControlTemplate TargetType="{x:Type ad:NavigatorWindow}"> |
||||
<Border BorderThickness="1" BorderBrush="DarkGray" CornerRadius="5" Height="440" Width="550" > |
||||
<Border.Background> |
||||
<LinearGradientBrush StartPoint="0,0" EndPoint="0,1"> |
||||
<GradientStop Color="#FFFFFFFF" Offset="0" /> |
||||
<GradientStop Color="#FFCAD1FF" Offset="1" /> |
||||
</LinearGradientBrush> |
||||
</Border.Background> |
||||
<Grid> |
||||
<Border BorderThickness="0,0,0,1" CornerRadius="5,5,0,0" BorderBrush="DarkGray" Height="60" VerticalAlignment="Top"> |
||||
<Border.Background> |
||||
<LinearGradientBrush StartPoint="0,0" EndPoint="1,0"> |
||||
<GradientStop Color="#FF0018C7" Offset="0" /> |
||||
<GradientStop Color="#FFA5B0FF" Offset="1" /> |
||||
</LinearGradientBrush> |
||||
</Border.Background> |
||||
<Grid> |
||||
<WrapPanel Margin="10" Orientation="Horizontal"> |
||||
<!--<Image x:Name ="icon" Source="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=SelectedContent.IconSource}" Height="16" Width="16"/>--> |
||||
<Border Width="16" Height="16"> |
||||
<Border.Background> |
||||
<VisualBrush Stretch="None" Visual="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=SelectedContent.ItemContent.Icon, Mode=OneWay}"/> |
||||
</Border.Background> |
||||
</Border> |
||||
<TextBlock x:Name="title" Text="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=SelectedContent.Title}" Margin="5,0,0,0" FontSize="12" FontWeight="Bold" Foreground="White"/> |
||||
</WrapPanel> |
||||
<TextBlock Margin="20, 35, 0, 0" Text="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=SelectedContent.ContentTypeDescription}" /> |
||||
</Grid> |
||||
</Border> |
||||
|
||||
<StackPanel Orientation="Horizontal" Margin="20, 70, 230, 20"> |
||||
<StackPanel Orientation="Vertical"> |
||||
<TextBlock Text="Active Tool Windows" FontSize="11" FontWeight="Bold" Foreground="Black"/> |
||||
<ListBox |
||||
x:Name="ToolWindowsList" |
||||
Style="{StaticResource listBoxStyle}" |
||||
ItemContainerStyle="{StaticResource listItemStyle}" |
||||
Margin="0,10,0,0" |
||||
SelectedItem="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=SelectedToolWindow}" |
||||
ItemsSource="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=DockableContents}" |
||||
ItemTemplate="{StaticResource listContentTemplate}" |
||||
/> |
||||
</StackPanel> |
||||
<Grid> |
||||
<StackPanel Orientation="Vertical" Margin="20,0,0,0"> |
||||
<TextBlock Text="Active Documents" FontSize="11" FontWeight="Bold" Foreground="Black"/> |
||||
<ListBox |
||||
x:Name="DocumentList" |
||||
Style="{StaticResource listBoxStyle}" |
||||
ItemContainerStyle="{StaticResource listItemStyle}" |
||||
SelectionMode="Single" |
||||
Margin="0,10,0,0" |
||||
SelectedItem="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=SelectedContent}" |
||||
ItemsSource="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Documents}" |
||||
ItemTemplate="{StaticResource listContentTemplate}" |
||||
Height="300" |
||||
> |
||||
</ListBox> |
||||
|
||||
</StackPanel> |
||||
</Grid> |
||||
</StackPanel> |
||||
|
||||
<Border Margin="0,50,20,0" BorderThickness="1" BorderBrush="DarkGray" HorizontalAlignment="Right" Height="250" Width="200" Padding="4"> |
||||
<Border> |
||||
<Border.Background> |
||||
<VisualBrush AlignmentX="Left" AlignmentY="Top" Stretch="Uniform" Visual="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=SelectedContent.ItemContent.Content, Mode=OneWay}"/> |
||||
</Border.Background> |
||||
</Border> |
||||
</Border> |
||||
|
||||
<Border BorderThickness="0,0,0,1" CornerRadius="0,0,5,5" Background="#FFADD8E6" BorderBrush="DarkGray" Height="30" VerticalAlignment="Bottom"> |
||||
<TextBlock Margin="20, 5, 0, 0" Text="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=SelectedContent.InfoTip}" TextWrapping="Wrap" TextTrimming="WordEllipsis"/> |
||||
</Border> |
||||
</Grid> |
||||
|
||||
</Border> |
||||
</ControlTemplate> |
||||
</Setter.Value> |
||||
</Setter> |
||||
</Style> |
||||
|
||||
</ResourceDictionary> |
@ -1,58 +0,0 @@
@@ -1,58 +0,0 @@
|
||||
<ResourceDictionary |
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" |
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
||||
xmlns:ad="clr-namespace:AvalonDock" |
||||
> |
||||
<Style 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="{DynamicResource {x:Static SystemColors.ActiveCaptionBrushKey}}" BorderBrush="Gray" BorderThickness="3" Opacity="0.2" Visibility="Hidden"/> |
||||
</Canvas> |
||||
<Grid x:Name="panelDrag" > |
||||
<ad:AlignedImage Name="PART_btnDockLeft" VerticalAlignment="Center" HorizontalAlignment="Left"> |
||||
<Image Source="Images\DockLeft.PNG" Stretch="None"/> |
||||
</ad:AlignedImage> |
||||
<ad:AlignedImage Name="PART_btnDockRight" VerticalAlignment="Center" HorizontalAlignment="Right"> |
||||
<Image Source="Images\DockRight.PNG" Stretch="None" /> |
||||
</ad:AlignedImage> |
||||
<ad:AlignedImage Name="PART_btnDockBottom" VerticalAlignment="Bottom" HorizontalAlignment="Center"> |
||||
<Image Source="Images\DockBottom.PNG" Stretch="None" /> |
||||
</ad:AlignedImage> |
||||
<ad:AlignedImage Name="PART_btnDockTop" VerticalAlignment="Top" HorizontalAlignment="Center"> |
||||
<Image Source="Images\DockTop.PNG" Stretch="None"/> |
||||
</ad:AlignedImage> |
||||
</Grid> |
||||
<Canvas> |
||||
<Grid Name="PART_gridPaneRelativeDockingOptions" Visibility="Collapsed" Width="88" Height="88"> |
||||
<Grid.ColumnDefinitions> |
||||
<ColumnDefinition/> |
||||
<ColumnDefinition/> |
||||
<ColumnDefinition/> |
||||
</Grid.ColumnDefinitions> |
||||
<Grid.RowDefinitions> |
||||
<RowDefinition/> |
||||
<RowDefinition/> |
||||
<RowDefinition/> |
||||
</Grid.RowDefinitions> |
||||
<ad:AlignedImage Grid.ColumnSpan="3" Grid.RowSpan="3" > |
||||
<Image Source="Images\DockPane.png" Stretch="Uniform"/> |
||||
</ad:AlignedImage> |
||||
<Border Name="PART_btnDockPaneTop" Grid.Column="1" Grid.Row="0"/> |
||||
<Border Name="PART_btnDockPaneRight" Grid.Column="2" Grid.Row="1"/> |
||||
<Border Name="PART_btnDockPaneBottom" Grid.Column="1" Grid.Row="2"/> |
||||
<Border Name="PART_btnDockPaneLeft" Grid.Column="0" Grid.Row="1"/> |
||||
<Border Name="PART_btnDockPaneInto" Grid.Column="1" Grid.Row="1"/> |
||||
</Grid> |
||||
</Canvas> |
||||
</Grid> |
||||
</ControlTemplate> |
||||
</Setter.Value> |
||||
</Setter> |
||||
|
||||
</Style> |
||||
</ResourceDictionary> |
Before Width: | Height: | Size: 699 B |
Before Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 747 B |
Before Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 3.5 KiB |
Before Width: | Height: | Size: 4.3 KiB |
Before Width: | Height: | Size: 4.2 KiB |
Before Width: | Height: | Size: 4.1 KiB |
Before Width: | Height: | Size: 4.1 KiB |
Before Width: | Height: | Size: 4.3 KiB |
Before Width: | Height: | Size: 755 B |
Before Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 712 B |
Before Width: | Height: | Size: 1.3 KiB |
Before Width: | Height: | Size: 2.8 KiB |
Before Width: | Height: | Size: 2.8 KiB |
Before Width: | Height: | Size: 2.8 KiB |
Before Width: | Height: | Size: 2.8 KiB |
Before Width: | Height: | Size: 2.8 KiB |
Before Width: | Height: | Size: 2.8 KiB |
Before Width: | Height: | Size: 701 B |
Before Width: | Height: | Size: 697 B |
Before Width: | Height: | Size: 2.7 KiB |
Before Width: | Height: | Size: 691 B |
Before Width: | Height: | Size: 719 B |
Before Width: | Height: | Size: 358 B |
Before Width: | Height: | Size: 357 B |
Before Width: | Height: | Size: 99 B |
Before Width: | Height: | Size: 108 B |
Before Width: | Height: | Size: 99 B |
Before Width: | Height: | Size: 99 B |
Before Width: | Height: | Size: 403 B |
@ -1,146 +0,0 @@
@@ -1,146 +0,0 @@
|
||||
//Copyright (c) 2007-2009, 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.Interop; |
||||
using System.Runtime.InteropServices; |
||||
using System.Diagnostics; |
||||
|
||||
namespace AvalonDock |
||||
{ |
||||
class WindowInteropWrapper : IDisposable |
||||
{ |
||||
public WindowInteropWrapper() |
||||
{ |
||||
} |
||||
|
||||
DependencyObject _attachedObject; |
||||
|
||||
public DependencyObject AttachedObject |
||||
{ |
||||
get {return _attachedObject;} |
||||
set |
||||
{ |
||||
if (_attachedObject != value) |
||||
{ |
||||
if (_attachedObject != null) |
||||
{ |
||||
_hwndSrc.RemoveHook(_hwndSrcHook); |
||||
//_hwndSrc.Dispose();
|
||||
_hwndSrc = null; |
||||
_hwndSrcHook = null; |
||||
} |
||||
|
||||
_attachedObject = value; |
||||
|
||||
if (_attachedObject != null) |
||||
{ |
||||
_hwndSrc = HwndSource.FromDependencyObject(value) as HwndSource; |
||||
_hwndSrcHook = new HwndSourceHook(this.HookHandler); |
||||
_hwndSrc.AddHook(_hwndSrcHook); |
||||
} |
||||
} |
||||
} |
||||
} |
||||
|
||||
HwndSource _hwndSrc = null; |
||||
HwndSourceHook _hwndSrcHook = null; |
||||
|
||||
#region interop funtions and consts
|
||||
const int WM_NCACTIVATE = 0x86; |
||||
const int WM_ACTIVATEAPP = 0x1c; |
||||
const int WM_ACTIVATE = 6; |
||||
const int WM_WINDOWPOSCHANGING = 70; |
||||
const int WM_WINDOWPOSCHANGED = 0x47; |
||||
const int WM_MOVE = 0x0003; |
||||
const int WM_SIZE = 0x0005; |
||||
const int WM_NCMOUSEMOVE = 0xa0; |
||||
const int WM_NCLBUTTONDOWN = 0xA1; |
||||
const int WM_NCLBUTTONUP = 0xA2; |
||||
const int WM_NCLBUTTONDBLCLK = 0xA3; |
||||
const int WM_NCRBUTTONDOWN = 0xA4; |
||||
const int WM_NCRBUTTONUP = 0xA5; |
||||
const int HTCAPTION = 2; |
||||
const int SC_MOVE = 0xF010; |
||||
const int WM_SYSCOMMAND = 0x0112; |
||||
|
||||
|
||||
[DllImport("user32.dll", CharSet = CharSet.Auto)] |
||||
public static extern IntPtr SendMessage(HandleRef hWnd, int msg, IntPtr wParam, IntPtr lParam); |
||||
|
||||
[DllImport("user32.dll")] |
||||
public static extern bool LockWindowUpdate(IntPtr hWndLock); |
||||
|
||||
#endregion
|
||||
|
||||
private IntPtr HookHandler( |
||||
IntPtr hwnd, |
||||
int msg, |
||||
IntPtr wParam, |
||||
IntPtr lParam, |
||||
ref bool handled |
||||
) |
||||
{ |
||||
handled = false; |
||||
|
||||
switch (msg) |
||||
{ |
||||
case SC_MOVE: |
||||
case WM_WINDOWPOSCHANGING: |
||||
SafeFireEvent(OnWindowPosChanging, EventArgs.Empty); |
||||
break; |
||||
} |
||||
|
||||
return IntPtr.Zero; |
||||
} |
||||
|
||||
public event EventHandler OnWindowPosChanging; |
||||
|
||||
|
||||
void SafeFireEvent(EventHandler eventToFireup, EventArgs e) |
||||
{ |
||||
if (AttachedObject != null && |
||||
PresentationSource.FromDependencyObject(AttachedObject) != null) |
||||
{ |
||||
if (eventToFireup != null) |
||||
eventToFireup(this, e); |
||||
} |
||||
} |
||||
|
||||
|
||||
#region IDisposable Members
|
||||
|
||||
public void Dispose() |
||||
{ |
||||
AttachedObject = null; |
||||
GC.SuppressFinalize(this); |
||||
} |
||||
|
||||
#endregion
|
||||
} |
||||
} |
@ -1,96 +0,0 @@
@@ -1,96 +0,0 @@
|
||||
//Copyright (c) 2007-2009, 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.Threading; |
||||
|
||||
|
||||
|
||||
namespace AvalonDock |
||||
{ |
||||
|
||||
/// <summary>
|
||||
/// Designates a Windows Presentation Foundation application model with added functionalities.
|
||||
/// </summary>
|
||||
class WpfApplication : Application |
||||
{ |
||||
|
||||
private static DispatcherOperationCallback exitFrameCallback = new |
||||
DispatcherOperationCallback(ExitFrame); |
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Processes all UI messages currently in the message queue.
|
||||
/// </summary>
|
||||
public static void DoEvents() |
||||
{ |
||||
|
||||
// Create new nested message pump.
|
||||
DispatcherFrame nestedFrame = new DispatcherFrame(); |
||||
|
||||
|
||||
|
||||
// Dispatch a callback to the current message queue, when getting called,
|
||||
// this callback will end the nested message loop.
|
||||
// note that the priority of this callback should be lower than the that of UI event messages.
|
||||
DispatcherOperation exitOperation = Dispatcher.CurrentDispatcher.BeginInvoke( |
||||
DispatcherPriority.Background, exitFrameCallback, nestedFrame); |
||||
|
||||
|
||||
|
||||
// pump the nested message loop, the nested message loop will
|
||||
// immediately process the messages left inside the message queue.
|
||||
Dispatcher.PushFrame(nestedFrame); |
||||
|
||||
|
||||
|
||||
// If the "exitFrame" callback doesn't get finished, Abort it.
|
||||
if (exitOperation.Status != DispatcherOperationStatus.Completed) |
||||
{ |
||||
exitOperation.Abort(); |
||||
} |
||||
|
||||
} |
||||
|
||||
|
||||
|
||||
private static Object ExitFrame(Object state) |
||||
{ |
||||
DispatcherFrame frame = state as DispatcherFrame; |
||||
|
||||
|
||||
// Exit the nested message loop.
|
||||
frame.Continue = false; |
||||
|
||||
return null; |
||||
|
||||
} |
||||
|
||||
} |
||||
|
||||
} |
||||
|
@ -1,46 +0,0 @@
@@ -1,46 +0,0 @@
|
||||
<project schemaVersion="1.6.0.7"> |
||||
<assemblies> |
||||
<assembly assemblyPath="..\bin\Release\AvalonDock.dll" xmlCommentsPath="..\bin\Release\AvalonDock.xml" commentsOnly="False" /> |
||||
</assemblies> |
||||
<ProjectSummary /> |
||||
<MissingTags>Summary, Parameter, Returns, AutoDocumentCtors, Namespace, TypeParameter</MissingTags> |
||||
<VisibleItems>InheritedMembers, InheritedFrameworkMembers, Protected, SealedProtected</VisibleItems> |
||||
<HtmlHelp1xCompilerPath path="" /> |
||||
<HtmlHelp2xCompilerPath path="" /> |
||||
<OutputPath>.\Help\</OutputPath> |
||||
<SandcastlePath path="" /> |
||||
<WorkingPath path="" /> |
||||
<CleanIntermediates>True</CleanIntermediates> |
||||
<KeepLogFile>True</KeepLogFile> |
||||
<BuildLogFile path="" /> |
||||
<HelpFileFormat>HtmlHelp1x</HelpFileFormat> |
||||
<CppCommentsFixup>False</CppCommentsFixup> |
||||
<FrameworkVersion>3.5</FrameworkVersion> |
||||
<IndentHtml>False</IndentHtml> |
||||
<Preliminary>False</Preliminary> |
||||
<RootNamespaceContainer>False</RootNamespaceContainer> |
||||
<RootNamespaceTitle /> |
||||
<HelpTitle>AvalonDock Library Documentation</HelpTitle> |
||||
<HtmlHelpName>AvalonDock</HtmlHelpName> |
||||
<Language>en-US</Language> |
||||
<CopyrightHref>http://www.codeplex.com/AvalonDock/license</CopyrightHref> |
||||
<CopyrightText>(C)2008 Adolfo Marinucci</CopyrightText> |
||||
<FeedbackEMailAddress /> |
||||
<FeedbackEMailLinkText /> |
||||
<HeaderText /> |
||||
<FooterText /> |
||||
<ProjectLinkType>Local</ProjectLinkType> |
||||
<SdkLinkType>Msdn</SdkLinkType> |
||||
<SdkLinkTarget>Blank</SdkLinkTarget> |
||||
<PresentationStyle>Prototype</PresentationStyle> |
||||
<NamingMethod>Guid</NamingMethod> |
||||
<SyntaxFilters>Standard</SyntaxFilters> |
||||
<ShowFeedbackControl>False</ShowFeedbackControl> |
||||
<BinaryTOC>True</BinaryTOC> |
||||
<IncludeFavorites>False</IncludeFavorites> |
||||
<CollectionTocStyle>Hierarchical</CollectionTocStyle> |
||||
<IncludeStopWordList>True</IncludeStopWordList> |
||||
<PlugInNamespaces>ms.vsipcc+, ms.vsexpresscc+</PlugInNamespaces> |
||||
<HelpFileVersion>1.0.0.0</HelpFileVersion> |
||||
<ContentPlacement>AboveNamespaces</ContentPlacement> |
||||
</project> |
@ -1,154 +0,0 @@
@@ -1,154 +0,0 @@
|
||||
<ResourceDictionary x:Class ="AvalonDock.themes.aeroBrushes" |
||||
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="#E9ECFA"/> |
||||
|
||||
|
||||
<!--Brushes for tab item header--> |
||||
<LinearGradientBrush x:Key="ManagedContentTabItemNormalBackground" |
||||
StartPoint="0,0" |
||||
EndPoint="0,1"> |
||||
<LinearGradientBrush.GradientStops> |
||||
<GradientStop Color="#FFCFCFCF" |
||||
Offset="0" /> |
||||
<GradientStop Color="#FFDDDDDD" |
||||
Offset="0.5" /> |
||||
<GradientStop Color="#FFEBEBEB" |
||||
Offset="0.5" /> |
||||
<GradientStop Color="#FFFCFCFC" |
||||
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="#FFA7D9F5" |
||||
Offset="0" /> |
||||
<GradientStop Color="#FFBEE6FD" |
||||
Offset="0.5" /> |
||||
<GradientStop Color="#FFD9F0FC" |
||||
Offset="0.5" /> |
||||
<GradientStop Color="#FFFAFDFE" |
||||
Offset="1" /> |
||||
</LinearGradientBrush.GradientStops> |
||||
</LinearGradientBrush> |
||||
|
||||
<LinearGradientBrush x:Key="ManagedContentTabItemInvHotBackground" |
||||
StartPoint="0,1" |
||||
EndPoint="0,0"> |
||||
<LinearGradientBrush.GradientStops> |
||||
<GradientStop Color="#FFA7D9F5" |
||||
Offset="0" /> |
||||
<GradientStop Color="#FFBEE6FD" |
||||
Offset="0.5" /> |
||||
<GradientStop Color="#FFD9F0FC" |
||||
Offset="0.5" /> |
||||
<GradientStop Color="#FFFAFDFE" |
||||
Offset="1" /> |
||||
</LinearGradientBrush.GradientStops> |
||||
</LinearGradientBrush> |
||||
|
||||
|
||||
<SolidColorBrush x:Key="ManagedContentTabItemSelectedBackground" |
||||
Color="White"/> |
||||
<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="ManagedContentTabItemNormalBorderBrush" |
||||
Color="#FF898C95" /> |
||||
<SolidColorBrush x:Key="ManagedContentTabItemSelectedBorderBrush" |
||||
Color="#FF898C95"/> |
||||
<!--<SolidColorBrush x:Key="ManagedContentTabItemHotBorderBackround" |
||||
Color="#FFFFC73C"/>--> |
||||
<SolidColorBrush x:Key="ManagedContentTabItemHotBorderBrush" |
||||
Color="#FF3C7FB1"/> |
||||
<SolidColorBrush x:Key="ManagedContentTabItemDisabledBorderBrush" |
||||
Color="#FF898C95"/> |
||||
|
||||
|
||||
|
||||
<!--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="#FF8EADCE" Offset="0" /> |
||||
<GradientStop Color="#FFBDD3EF" Offset="1" /> |
||||
</LinearGradientBrush> |
||||
|
||||
|
||||
<LinearGradientBrush x:Key="{ComponentResourceKey TypeInTargetAssembly={x:Type ad:DockingManager}, ResourceId={x:Static ad:AvalonDockBrushes.DockablePaneTitleBackground}}" StartPoint="0,0" EndPoint="0,1"> |
||||
<GradientStop Color="#FFB7CAE0" Offset="0" /> |
||||
<GradientStop Color="#FFE8F0FF" Offset="1" /> |
||||
</LinearGradientBrush> |
||||
|
||||
<SolidColorBrush |
||||
x:Key="{ComponentResourceKey TypeInTargetAssembly={x:Type ad:DockingManager}, ResourceId={x:Static ad:AvalonDockBrushes.DockablePaneTitleForeground}}" |
||||
Color="{x:Static SystemColors.ActiveCaptionTextColor}"/> |
||||
|
||||
<SolidColorBrush |
||||
x:Key="{ComponentResourceKey TypeInTargetAssembly={x:Type ad:DockingManager}, ResourceId={x:Static ad:AvalonDockBrushes.DockablePaneTitleForegroundSelected}}" |
||||
Color="{x:Static SystemColors.WindowTextColor}"/> |
||||
|
||||
<SolidColorBrush |
||||
x:Key="{ComponentResourceKey TypeInTargetAssembly={x:Type ad:DockingManager}, ResourceId={x:Static ad:AvalonDockBrushes.PaneHeaderCommandBackground}}" |
||||
Color="#FFCEEDFA"/> |
||||
|
||||
<SolidColorBrush |
||||
x:Key="{ComponentResourceKey TypeInTargetAssembly={x:Type ad:DockingManager}, ResourceId={x:Static ad:AvalonDockBrushes.PaneHeaderCommandBorderBrush}}" |
||||
Color="#FF3299FF"/> |
||||
|
||||
|
||||
<!--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="#FFECF5FC" Offset="0" /> |
||||
<GradientStop Color="#FF98B4D2" 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="#FFFCFDFE" Offset="0" /> |
||||
<GradientStop Color="#FFD2E6FA" Offset="1" /> |
||||
</LinearGradientBrush> |
||||
|
||||
|
||||
<LinearGradientBrush x:Key="{ComponentResourceKey TypeInTargetAssembly={x:Type ad:DockingManager}, ResourceId={x:Static ad:AvalonDockBrushes.DocumentHeaderBackgroundMouseOver}}" StartPoint="0,0" EndPoint="0,1"> |
||||
<GradientStop Color="#FFF7FCFE" Offset="0" /> |
||||
<GradientStop Color="#FF81CFF1" Offset="1" /> |
||||
</LinearGradientBrush> |
||||
|
||||
<!--added by J.Schildmann--> |
||||
<SolidColorBrush |
||||
x:Key="{ComponentResourceKey TypeInTargetAssembly={x:Type ad:DockingManager}, ResourceId={x:Static ad:AvalonDockBrushes.DocumentHeaderBorder}}" |
||||
Color="#FFC1D2EE"/> |
||||
|
||||
<SolidColorBrush |
||||
x:Key="{ComponentResourceKey TypeInTargetAssembly={x:Type ad:DockingManager}, ResourceId={x:Static ad:AvalonDockBrushes.DocumentHeaderBorder2}}" |
||||
Color="#FFD6E2F8"/> |
||||
|
||||
</ResourceDictionary> |
@ -1,621 +0,0 @@
@@ -1,621 +0,0 @@
|
||||
<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/themes/generic.xaml"/> |
||||
|
||||
<!--Aero colors--> |
||||
<ResourceDictionary Source="/AvalonDock;component/themes/aero.normalcolor.brushes.xaml"/> |
||||
</ResourceDictionary.MergedDictionaries> |
||||
|
||||
|
||||
<!-- styles for Aero theme thanks to Alexey Potapov--> |
||||
|
||||
<!--DockableContentTabItemStyle--> |
||||
<Style x:Key="DockableContentTabItemStyle" TargetType="{x:Type ad:DockableContent}"> |
||||
<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,-1,0" |
||||
CornerRadius="0" |
||||
Background="{StaticResource ManagedContentTabItemNormalBackground}" |
||||
Padding="1" |
||||
> |
||||
<!--<StackPanel Orientation="Horizontal" Margin="4,0,4,0">--> |
||||
<Grid Margin="4,0,4,0"> |
||||
<Grid.ColumnDefinitions> |
||||
<ColumnDefinition Width="Auto"/> |
||||
<ColumnDefinition Width="*"/> |
||||
</Grid.ColumnDefinitions> |
||||
<ad:AlignedImage> |
||||
<ContentPresenter x:Name="Icon" |
||||
Grid.Column="0" |
||||
Margin="1" |
||||
VerticalAlignment="Center" |
||||
ContentSource="Icon" |
||||
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/> |
||||
</ad:AlignedImage> |
||||
<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.ControlTextBrushKey}}"/> |
||||
</Grid> |
||||
<!--</StackPanel>--> |
||||
</Border> |
||||
</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="Foreground" |
||||
Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" TargetName="tabItemTitle"/> |
||||
<Setter Property="Margin" |
||||
Value="0,1,-1,-2" TargetName="PART_DragArea"/> |
||||
<Setter Property="Padding" |
||||
Value="2" TargetName="PART_DragArea"/> |
||||
<Setter Property="Panel.ZIndex" |
||||
Value="100" /> |
||||
</Trigger> |
||||
<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="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" /> |
||||
<Setter TargetName="Icon" Property="IsEnabled" Value="false" /> |
||||
</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="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="*"/> |
||||
<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" Style="{StaticResource PaneHeaderCommandStyle}" Command="ad:DockablePane.CloseCommand" |
||||
Width="15" Height="15" Margin="2,0,2,0" VerticalAlignment="Center"> |
||||
<Image Source="/AvalonDock;component/resources/Images/PinClose.png" Width="13" Height="13" Stretch="None"/> |
||||
</Button> |
||||
<Button x:Name="btnPinAutoHide" DockPanel.Dock="Right" Style="{StaticResource PaneHeaderCommandStyle}" Command="ad:DockablePane.ToggleAutoHideCommand" |
||||
Width="15" Height="15" VerticalAlignment="Center"> |
||||
<Image Source="/AvalonDock;component/resources/Images/PinAutoHide.png" Width="13" Height="13" Stretch="None"/> |
||||
</Button> |
||||
<Button x:Name="PART_ShowContextMenuButton" DockPanel.Dock="Right" Style="{StaticResource PaneHeaderContextMenuCommandStyle}" Command="ad:DockablePane.ShowOptionsCommand" |
||||
Width="15" Height="15" VerticalAlignment="Center"> |
||||
<Image Source="/AvalonDock;component/resources/Images/PinMenu.png" Width="13" Height="13" Stretch="None"/> |
||||
</Button> |
||||
<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 ="23" |
||||
BorderThickness="0,1,0,0" |
||||
BorderBrush="{StaticResource ManagedContentTabControlNormalBorderBrush}" |
||||
> |
||||
</Border> |
||||
<ad:DockableTabPanel |
||||
Grid.Row="2" |
||||
Height ="22" |
||||
KeyboardNavigation.TabIndex="2" |
||||
IsItemsHost="True" |
||||
x:Name="paneTabsPanel" |
||||
Margin="0,0,0,2" |
||||
TabItemStyle="{StaticResource DockableContentTabItemStyle}"/> |
||||
</Grid> |
||||
</Border> |
||||
<ControlTemplate.Triggers> |
||||
<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> |
||||
<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> |
||||
|
||||
<!--DocumentTabItemStyle--> |
||||
<Style x:Key="DocumentTabItemStyle" TargetType="{x:Type ad:ManagedContent}"> |
||||
<Setter Property="Background" |
||||
Value="Transparent"/> |
||||
<Setter Property="Template"> |
||||
<Setter.Value> |
||||
<ControlTemplate TargetType="{x:Type ad:ManagedContent}"> |
||||
<Border |
||||
x:Name="PART_DragArea" |
||||
BorderBrush="{StaticResource ManagedContentTabControlNormalBorderBrush}" |
||||
Margin="-10,0,0,0" |
||||
SnapsToDevicePixels="True" |
||||
ContextMenu="{DynamicResource {ComponentResourceKey {x:Type ad:DockingManager}, {x:Static ad:ContextMenuElement.DocumentPane}}}" |
||||
> |
||||
<Grid Margin="0,0,0,0" > |
||||
<Grid.ColumnDefinitions> |
||||
<ColumnDefinition Width="20"/> |
||||
<ColumnDefinition Width="Auto"/> |
||||
</Grid.ColumnDefinitions> |
||||
<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}" |
||||
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="{DynamicResource {ComponentResourceKey {x:Type ad:DockingManager}, {x:Static ad:AvalonDockBrushes.DocumentHeaderBorder}}}"/> |
||||
<Setter Property="Stroke" TargetName="tabItemIntPathBorder" Value="{DynamicResource {ComponentResourceKey {x:Type ad:DockingManager}, {x:Static ad:AvalonDockBrushes.DocumentHeaderBorder}}}"/> |
||||
<!--<Setter Property="Panel.ZIndex" Value="1"/> DOES NOT WORK! I DON'T KNOW WHY!!???--> |
||||
</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> |
||||
|
||||
<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--> |
||||
<Style 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" > |
||||
<!--ItemTemplate="{StaticResource ManagedContentHeaderDataTemplate}"--> |
||||
<ContextMenu.ItemContainerStyle> |
||||
<Style TargetType="{x:Type MenuItem}"> |
||||
<Setter Property="CommandParameter" Value="{Binding RelativeSource={x:Static RelativeSource.Self}, Path=Header}"/> |
||||
<Setter Property="Command" Value="ad:DocumentPane.ActivateDocumentCommand"/> |
||||
<Setter Property="Template"> |
||||
<Setter.Value> |
||||
<ControlTemplate TargetType="MenuItem"> |
||||
<Border x:Name="intBorder" BorderThickness="1" Background="{TemplateBinding Background}" CornerRadius="2"> |
||||
<Grid> |
||||
<Grid.ColumnDefinitions> |
||||
<ColumnDefinition Width="Auto" MinWidth="24"/> |
||||
<ColumnDefinition Width="*"/> |
||||
</Grid.ColumnDefinitions> |
||||
<ContentPresenter x:Name="Icon" Margin="2" Content="{Binding Path=Icon}" Grid.Column="0" VerticalAlignment="Center"/> |
||||
<TextBlock x:Name="intMenuTitle" Margin="5,2,20,2" Text="{Binding Path=Title}" Grid.Column="1" VerticalAlignment="Center"/> |
||||
</Grid> |
||||
</Border> |
||||
<ControlTemplate.Triggers> |
||||
<Trigger Property="IsMouseOver" Value="true"> |
||||
<Setter Property="Background" TargetName="intBorder"> |
||||
<Setter.Value> |
||||
<SolidColorBrush Color="{DynamicResource {x:Static SystemColors.ActiveCaptionColorKey}}" Opacity="0.3"/> |
||||
</Setter.Value> |
||||
</Setter> |
||||
<Setter Property="BorderBrush" TargetName="intBorder" Value="{DynamicResource {x:Static SystemColors.ActiveCaptionBrushKey}}"/> |
||||
</Trigger> |
||||
<DataTrigger Binding="{Binding Path=IsActiveDocument}" Value="True"> |
||||
<Setter Property="FontWeight" Value="Bold" TargetName="intMenuTitle"/> |
||||
</DataTrigger> |
||||
<!--<Trigger Property="Icon" |
||||
Value="{x:Null}"> |
||||
<Setter TargetName="Icon" |
||||
Property="Visibility" |
||||
Value="Collapsed"/> |
||||
</Trigger>--> |
||||
</ControlTemplate.Triggers> |
||||
</ControlTemplate> |
||||
</Setter.Value> |
||||
</Setter> |
||||
</Style> |
||||
</ContextMenu.ItemContainerStyle> |
||||
</ContextMenu> |
||||
</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="{DynamicResource {ComponentResourceKey {x:Type ad:DockingManager}, {x:Static ad:AvalonDockBrushes.DocumentHeaderBorder}}}" |
||||
CornerRadius="3" |
||||
Focusable="False"> |
||||
</Border> |
||||
<Border BorderThickness="2" |
||||
BorderBrush="{DynamicResource {ComponentResourceKey {x:Type ad:DockingManager}, {x:Static ad:AvalonDockBrushes.DocumentHeaderBorder2}}}" |
||||
CornerRadius="3" |
||||
Margin="1" |
||||
Focusable="False" |
||||
Background="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=SelectedItem.Background}" |
||||
> |
||||
<ContentPresenter |
||||
Content="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=SelectedItem.Content}" |
||||
Margin="2" |
||||
KeyboardNavigation.TabNavigation="Local" |
||||
KeyboardNavigation.DirectionalNavigation="Contained" |
||||
KeyboardNavigation.TabIndex="1" |
||||
/> |
||||
</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="15" Height="15" Margin="2,0,2,0" Style="{StaticResource PaneHeaderCommandStyle}" Command="ApplicationCommands.Close"> |
||||
<Image Source="/AvalonDock;component/resources/Images/PinClose.png" Width="13" Height="13" Stretch="None"/> |
||||
</Button> |
||||
<Button x:Name="PART_ShowContextMenuButton" DockPanel.Dock="Right" Width="15" Height="15" Style="{StaticResource PaneHeaderCommandStyle}" Command="ad:DocumentPane.ShowDocumentsListMenuCommand"> |
||||
<Image x:Name="ShowContextMenuIcon" Source="/AvalonDock;component/resources/Images/PinMenu.png" Width="13" Height="13" Stretch="None"/> |
||||
</Button> |
||||
<ad:DocumentTabPanel |
||||
x:Name="paneTabsPanel" |
||||
Panel.ZIndex ="1" |
||||
KeyboardNavigation.TabIndex="2" |
||||
IsItemsHost="True" |
||||
Margin="10,2,0,0" |
||||
TabItemStyle="{StaticResource DocumentTabItemStyle}"/> |
||||
</DockPanel> |
||||
</Border> |
||||
</Grid> |
||||
</Border> |
||||
<ControlTemplate.Triggers> |
||||
<Trigger Property="HasItems" Value="False"> |
||||
<Setter Property="Visibility" Value="Hidden"/> |
||||
</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 TargetType="{x:Type ad:DockablePaneAnchorTab}"> |
||||
<Setter Property="Template"> |
||||
<Setter.Value> |
||||
<ControlTemplate TargetType="{x:Type ad:DockablePaneAnchorTab}"> |
||||
<Grid> |
||||
<Border |
||||
Name="PART_Border" |
||||
BorderThickness="1,0,1,1" |
||||
BorderBrush="{StaticResource ManagedContentTabControlNormalBorderBrush}" |
||||
Background="{StaticResource ManagedContentTabItemNormalBackground}"> |
||||
|
||||
<Grid> |
||||
<Grid.ColumnDefinitions> |
||||
<ColumnDefinition Width="Auto"/> |
||||
<ColumnDefinition Width="*"/> |
||||
</Grid.ColumnDefinitions> |
||||
|
||||
<Border Grid.Column="0" Width="16" Height="16"> |
||||
<Border.Background> |
||||
<VisualBrush Stretch="None" Visual="{Binding Path=ReferencedContent.Icon, RelativeSource={RelativeSource TemplatedParent}}"/> |
||||
</Border.Background> |
||||
</Border> |
||||
<TextBlock |
||||
Grid.Column="1" |
||||
Text="{Binding Path=ReferencedContent.Title, RelativeSource={RelativeSource TemplatedParent}}" |
||||
Foreground="{DynamicResource {x:Static SystemColors.WindowTextBrushKey}}" |
||||
Margin="4,2,2,2"/> |
||||
</Grid> |
||||
</Border> |
||||
</Grid> |
||||
<ControlTemplate.Triggers> |
||||
<Trigger Property="Anchor" > |
||||
<Trigger.Value> |
||||
<ad:AnchorStyle> |
||||
Left |
||||
</ad:AnchorStyle> |
||||
</Trigger.Value> |
||||
<Setter TargetName="PART_Border" Property="Background" Value="{StaticResource ManagedContentTabItemInvNormalBackground}"/> |
||||
<Setter TargetName="PART_Border" Property="BorderThickness" Value="1,1,1,0"/> |
||||
</Trigger> |
||||
<Trigger Property="Anchor"> |
||||
<Trigger.Value> |
||||
<ad:AnchorStyle> |
||||
Bottom |
||||
</ad:AnchorStyle> |
||||
</Trigger.Value> |
||||
<Setter TargetName="PART_Border" Property="Background" Value="{StaticResource ManagedContentTabItemInvNormalBackground}"/> |
||||
<Setter TargetName="PART_Border" Property="BorderThickness" Value="1,1,1,0"/> |
||||
</Trigger> |
||||
|
||||
<Trigger Property="IsMouseOver" |
||||
Value="true"> |
||||
<Setter Property="BorderBrush" Value="{StaticResource ManagedContentTabItemHotBorderBrush}" |
||||
TargetName="PART_Border" /> |
||||
<Setter Property="Background" Value="{StaticResource ManagedContentTabItemInvHotBackground}" |
||||
TargetName="PART_Border" /> |
||||
</Trigger> |
||||
|
||||
<MultiTrigger> |
||||
<MultiTrigger.Conditions> |
||||
<Condition Property="IsMouseOver" Value="True"/> |
||||
<Condition Property="Anchor"> |
||||
<Condition.Value> |
||||
<ad:AnchorStyle> |
||||
Top |
||||
</ad:AnchorStyle> |
||||
</Condition.Value> |
||||
</Condition> |
||||
</MultiTrigger.Conditions> |
||||
<Setter TargetName="PART_Border" Property="Background" Value="{StaticResource ManagedContentTabItemHotBackground}"/> |
||||
</MultiTrigger> |
||||
<MultiTrigger> |
||||
<MultiTrigger.Conditions> |
||||
<Condition Property="IsMouseOver" Value="True"/> |
||||
<Condition Property="Anchor"> |
||||
<Condition.Value> |
||||
<ad:AnchorStyle> |
||||
Right |
||||
</ad:AnchorStyle> |
||||
</Condition.Value> |
||||
</Condition> |
||||
</MultiTrigger.Conditions> |
||||
<Setter TargetName="PART_Border" Property="Background" Value="{StaticResource ManagedContentTabItemHotBackground}"/> |
||||
</MultiTrigger> |
||||
|
||||
</ControlTemplate.Triggers> |
||||
</ControlTemplate> |
||||
</Setter.Value> |
||||
</Setter> |
||||
</Style> |
||||
|
||||
<!--DockablePaneAnchorTabGroup--> |
||||
<Style TargetType="{x:Type ad:DockablePaneAnchorTabGroup}"> |
||||
<Setter Property="Orientation" Value="Horizontal"/> |
||||
<Setter Property="Margin" Value="7,0,0,0"/> |
||||
</Style> |
||||
|
||||
<!--OverlayWindow--> |
||||
<Style 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="{DynamicResource {x:Static SystemColors.ActiveCaptionBrushKey}}" BorderBrush="Gray" BorderThickness="3" Opacity="0.2" Visibility="Hidden"/> |
||||
</Canvas> |
||||
<Grid x:Name="panelDrag" > |
||||
<ad:AlignedImage Name="PART_btnDockLeft" VerticalAlignment="Center" HorizontalAlignment="Left"> |
||||
<Image x:Name="IMG_DockLeft" Source="/AvalonDock;component/resources/Images/Aero/AeroDockLeft.PNG" Stretch="Uniform" Width="32" Height="31"/> |
||||
</ad:AlignedImage> |
||||
<ad:AlignedImage Name="PART_btnDockRight" VerticalAlignment="Center" HorizontalAlignment="Right"> |
||||
<Image x:Name="IMG_DockRight" Source="/AvalonDock;component/resources/Images/Aero/AeroDockRight.PNG" Stretch="Uniform" Width="32" Height="31"/> |
||||
</ad:AlignedImage> |
||||
<ad:AlignedImage Name="PART_btnDockBottom" VerticalAlignment="Bottom" HorizontalAlignment="Center"> |
||||
<Image x:Name="IMG_DockBottom" Source="/AvalonDock;component/resources/Images/Aero/AeroDockBottom.PNG" Stretch="Uniform" Width="31" Height="32"/> |
||||
</ad:AlignedImage> |
||||
<ad:AlignedImage Name="PART_btnDockTop" VerticalAlignment="Top" HorizontalAlignment="Center"> |
||||
<Image x:Name="IMG_DockTop" Source="/AvalonDock;component/resources/Images/Aero/AeroDockTop.PNG" Stretch="Uniform" Width="31" Height="32"/> |
||||
</ad:AlignedImage> |
||||
</Grid> |
||||
<Canvas> |
||||
<Grid Name="PART_gridPaneRelativeDockingOptions" Visibility="Collapsed" Width="103" Height="101"> |
||||
<Grid.ColumnDefinitions> |
||||
<ColumnDefinition/> |
||||
<ColumnDefinition/> |
||||
<ColumnDefinition/> |
||||
</Grid.ColumnDefinitions> |
||||
<Grid.RowDefinitions> |
||||
<RowDefinition/> |
||||
<RowDefinition/> |
||||
<RowDefinition/> |
||||
</Grid.RowDefinitions> |
||||
<ad:AlignedImage Grid.ColumnSpan="3" Grid.RowSpan="3" > |
||||
<Image x:Name="IMG_DockPane" Source="/AvalonDock;component/resources/Images/Aero/AeroDockPane.png" Stretch="Uniform"/> |
||||
</ad:AlignedImage> |
||||
<Border Name="PART_btnDockPaneTop" Grid.Column="1" Grid.Row="0"/> |
||||
<Border Name="PART_btnDockPaneRight" Grid.Column="2" Grid.Row="1"/> |
||||
<Border Name="PART_btnDockPaneBottom" Grid.Column="1" Grid.Row="2"/> |
||||
<Border Name="PART_btnDockPaneLeft" Grid.Column="0" Grid.Row="1"/> |
||||
<Border Name="PART_btnDockPaneInto" Grid.Column="1" Grid.Row="1"/> |
||||
</Grid> |
||||
</Canvas> |
||||
</Grid> |
||||
<ControlTemplate.Triggers> |
||||
<DataTrigger Binding="{Binding Path=OverlayButtonHover, RelativeSource={RelativeSource Self}}" Value="DropBorderLeft"> |
||||
<Setter Property="Source" Value="/AvalonDock;component/resources/Images/Aero/AeroDockLeftHover.PNG" TargetName="IMG_DockLeft"/> |
||||
</DataTrigger> |
||||
<DataTrigger Binding="{Binding Path=OverlayButtonHover, RelativeSource={RelativeSource Self}}" Value="DropBorderRight"> |
||||
<Setter Property="Source" Value="/AvalonDock;component/resources/Images/Aero/AeroDockRightHover.PNG" TargetName="IMG_DockRight"/> |
||||
</DataTrigger> |
||||
<DataTrigger Binding="{Binding Path=OverlayButtonHover, RelativeSource={RelativeSource Self}}" Value="DropBorderTop"> |
||||
<Setter Property="Source" Value="/AvalonDock;component/resources/Images/Aero/AeroDockTopHover.PNG" TargetName="IMG_DockTop"/> |
||||
</DataTrigger> |
||||
<DataTrigger Binding="{Binding Path=OverlayButtonHover, RelativeSource={RelativeSource Self}}" Value="DropBorderBottom"> |
||||
<Setter Property="Source" Value="/AvalonDock;component/resources/Images/Aero/AeroDockBottomHover.PNG" TargetName="IMG_DockBottom"/> |
||||
</DataTrigger> |
||||
|
||||
<DataTrigger Binding="{Binding Path=OverlayButtonHover, RelativeSource={RelativeSource Self}}" Value="DropPaneInto"> |
||||
<Setter Property="Source" Value="/AvalonDock;component/resources/Images/Aero/AeroDockPaneInto.PNG" TargetName="IMG_DockPane"/> |
||||
</DataTrigger> |
||||
|
||||
<DataTrigger Binding="{Binding Path=OverlayButtonHover, RelativeSource={RelativeSource Self}}" Value="DropPaneLeft"> |
||||
<Setter Property="Source" Value="/AvalonDock;component/resources/Images/Aero/AeroDockPaneLeft.PNG" TargetName="IMG_DockPane"/> |
||||
</DataTrigger> |
||||
<DataTrigger Binding="{Binding Path=OverlayButtonHover, RelativeSource={RelativeSource Self}}" Value="DropPaneRight"> |
||||
<Setter Property="Source" Value="/AvalonDock;component/resources/Images/Aero/AeroDockPaneRight.PNG" TargetName="IMG_DockPane"/> |
||||
</DataTrigger> |
||||
<DataTrigger Binding="{Binding Path=OverlayButtonHover, RelativeSource={RelativeSource Self}}" Value="DropPaneTop"> |
||||
<Setter Property="Source" Value="/AvalonDock;component/resources/Images/Aero/AeroDockPaneTop.PNG" TargetName="IMG_DockPane"/> |
||||
</DataTrigger> |
||||
<DataTrigger Binding="{Binding Path=OverlayButtonHover, RelativeSource={RelativeSource Self}}" Value="DropPaneBottom"> |
||||
<Setter Property="Source" Value="/AvalonDock;component/resources/Images/Aero/AeroDockPaneBottom.PNG" TargetName="IMG_DockPane"/> |
||||
</DataTrigger> |
||||
|
||||
<DataTrigger Binding="{Binding Path=OverlayButtonHover, RelativeSource={RelativeSource Self}}" Value="None"> |
||||
<Setter Property="Source" Value="/AvalonDock;component/resources/Images/Aero/AeroDockPane.PNG" TargetName="IMG_DockPane"/> |
||||
</DataTrigger> |
||||
|
||||
</ControlTemplate.Triggers> |
||||
|
||||
</ControlTemplate> |
||||
</Setter.Value> |
||||
</Setter> |
||||
|
||||
</Style> |
||||
|
||||
|
||||
</ResourceDictionary> |
@ -1,100 +0,0 @@
@@ -1,100 +0,0 @@
|
||||
<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="#FF808080"/> |
||||
|
||||
<SolidColorBrush x:Key="ManagedContentTabItemInvHotBackground" |
||||
Color="White"/> |
||||
|
||||
<LinearGradientBrush x:Key="{ComponentResourceKey TypeInTargetAssembly={x:Type ad:DockingManager}, ResourceId={x:Static ad:AvalonDockBrushes.DefaultBackgroundBrush}}" |
||||
StartPoint="0,0" |
||||
EndPoint="1,0"> |
||||
<LinearGradientBrush.GradientStops> |
||||
<GradientStop Color="#FFD4D0C8" |
||||
Offset="0"/> |
||||
<GradientStop Color="#FFF5F5F5" |
||||
Offset="1"/> |
||||
</LinearGradientBrush.GradientStops> |
||||
</LinearGradientBrush> |
||||
|
||||
|
||||
<!--Brushes for tab item header--> |
||||
<SolidColorBrush x:Key="ManagedContentTabItemNormalBackground" |
||||
Color="Transparent"/> |
||||
|
||||
<SolidColorBrush x:Key="ManagedContentTabItemInvNormalBackground" |
||||
Color="Transparent"/> |
||||
|
||||
<SolidColorBrush x:Key="ManagedContentTabItemHotBackground" |
||||
Color="White"/> |
||||
|
||||
<SolidColorBrush x:Key="ManagedContentTabItemSelectedBackground" |
||||
Color="White"/> |
||||
|
||||
<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="ManagedContentTabItemNormalBorderBrush" |
||||
Color="#FFC7C4A7" /> |
||||
|
||||
<SolidColorBrush x:Key="ManagedContentTabItemSelectedBorderBrush" |
||||
Color="#FFC7C4A7"/> |
||||
|
||||
<SolidColorBrush x:Key="ManagedContentTabItemHotBorderBrush" |
||||
Color="#FFC7C4A7"/> |
||||
|
||||
<SolidColorBrush x:Key="ManagedContentTabItemDisabledBorderBrush" |
||||
Color="#FFC7C4A7"/> |
||||
|
||||
<!--Brushes for dockable pane headers--> |
||||
<SolidColorBrush x:Key="{ComponentResourceKey TypeInTargetAssembly={x:Type ad:DockingManager}, ResourceId={x:Static ad:AvalonDockBrushes.DockablePaneTitleBackgroundSelected}}" |
||||
Color="#FF0A246A"/> |
||||
|
||||
<SolidColorBrush x:Key="{ComponentResourceKey TypeInTargetAssembly={x:Type ad:DockingManager}, ResourceId={x:Static ad:AvalonDockBrushes.DockablePaneTitleBackground}}" |
||||
Color="#FF808080"/> |
||||
|
||||
<SolidColorBrush |
||||
x:Key="{ComponentResourceKey TypeInTargetAssembly={x:Type ad:DockingManager}, ResourceId={x:Static ad:AvalonDockBrushes.DockablePaneTitleForeground}}" |
||||
Color="#FFC7C4A7"/> |
||||
|
||||
<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="Transparent"/> |
||||
|
||||
<SolidColorBrush |
||||
x:Key="{ComponentResourceKey TypeInTargetAssembly={x:Type ad:DockingManager}, ResourceId={x:Static ad:AvalonDockBrushes.PaneHeaderCommandBorderBrush}}" |
||||
Color="White"/> |
||||
|
||||
|
||||
<!--Brushes for document headers--> |
||||
<SolidColorBrush |
||||
x:Key="{ComponentResourceKey TypeInTargetAssembly={x:Type ad:DockingManager}, ResourceId={x:Static ad:AvalonDockBrushes.DocumentHeaderBackground}}" |
||||
Color="#FFD4D0C8"/> |
||||
|
||||
<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="#FFFCFBFB" Offset="0" /> |
||||
<GradientStop Color="#FFD4D0C8" Offset="1" /> |
||||
</LinearGradientBrush> |
||||
|
||||
<SolidColorBrush |
||||
x:Key="{ComponentResourceKey TypeInTargetAssembly={x:Type ad:DockingManager}, ResourceId={x:Static ad:AvalonDockBrushes.DocumentHeaderBackgroundMouseOver}}" |
||||
Color="#FFFCFBFB"/> |
||||
|
||||
|
||||
</ResourceDictionary> |
@ -1,548 +0,0 @@
@@ -1,548 +0,0 @@
|
||||
<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/themes/generic.xaml"/> |
||||
|
||||
<!--Classic colors--> |
||||
<ResourceDictionary Source="/AvalonDock;component/themes/classic.brushes.xaml"/> |
||||
</ResourceDictionary.MergedDictionaries> |
||||
|
||||
|
||||
<!--DockableContentTabItemStyle--> |
||||
<Style x:Key="DockableContentTabItemStyle" TargetType="{x:Type ad:DockableContent}"> |
||||
<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,-1,0" |
||||
Background="{StaticResource ManagedContentTabItemNormalBackground}" |
||||
Padding="1" |
||||
> |
||||
<Grid Margin="4,0,4,0"> |
||||
<Grid.ColumnDefinitions> |
||||
<ColumnDefinition Width="Auto"/> |
||||
<ColumnDefinition Width="*"/> |
||||
</Grid.ColumnDefinitions> |
||||
<ad:AlignedImage> |
||||
<ContentPresenter x:Name="Icon" |
||||
Grid.Column="0" |
||||
Margin="1" |
||||
VerticalAlignment="Center" |
||||
ContentSource="Icon" |
||||
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/> |
||||
</ad:AlignedImage> |
||||
<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.WindowTextBrushKey}}"/> |
||||
</Grid> |
||||
</Border> |
||||
</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="Margin" |
||||
Value="0,1,-1,-2" TargetName="PART_DragArea"/> |
||||
<Setter Property="Padding" |
||||
Value="2" TargetName="PART_DragArea"/> |
||||
<Setter Property="Panel.ZIndex" |
||||
Value="100" /> |
||||
</Trigger> |
||||
<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="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" /> |
||||
<Setter TargetName="Icon" Property="IsEnabled" Value="false" /> |
||||
</Trigger> |
||||
<Trigger Property="Icon" |
||||
Value="{x:Null}"> |
||||
<Setter TargetName="Icon" |
||||
Property="Visibility" |
||||
Value="Collapsed"/> |
||||
</Trigger> |
||||
</ControlTemplate.Triggers> |
||||
</ControlTemplate> |
||||
</Setter.Value> |
||||
</Setter> |
||||
</Style> |
||||
|
||||
<!--DockablePane--> |
||||
<Style 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="True" |
||||
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" Style="{StaticResource PaneHeaderCommandStyle}" Command="ad:DockablePane.CloseCommand" |
||||
Width="15" Height="15" Margin="2,0,2,0" VerticalAlignment="Center"> |
||||
<ad:AlignedImage> |
||||
<Image x:Name="IMG_Close" Source="/AvalonDock;component/resources/Images/Classic/PinClose.png" Width="13" Height="13" Stretch="UniformToFill"/> |
||||
</ad:AlignedImage> |
||||
</Button> |
||||
<Button x:Name="btnPinAutoHide" DockPanel.Dock="Right" Style="{StaticResource PaneHeaderCommandStyle}" Command="ad:DockablePane.ToggleAutoHideCommand" |
||||
Width="15" Height="15" VerticalAlignment="Center"> |
||||
<ad:AlignedImage> |
||||
<Image x:Name="IMG_AutoHide" Source="/AvalonDock;component/resources/Images/Classic/PinAutoHide.png" Width="13" Height="13" Stretch="UniformToFill"/> |
||||
</ad:AlignedImage> |
||||
</Button> |
||||
<Button x:Name="PART_ShowContextMenuButton" DockPanel.Dock="Right" Style="{StaticResource PaneHeaderContextMenuCommandStyle}" Command="ad:DockablePane.ShowOptionsCommand" |
||||
Width="15" Height="15" VerticalAlignment="Center"> |
||||
<ad:AlignedImage> |
||||
<Image x:Name="IMG_ShowContextMenu" Source="/AvalonDock;component/resources/Images/Classic/PinMenu.png" Width="13" Height="13" Stretch="UniformToFill"/> |
||||
</ad:AlignedImage> |
||||
</Button> |
||||
<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 ="23" |
||||
BorderThickness="0,1,0,0" |
||||
BorderBrush="{StaticResource ManagedContentTabControlNormalBorderBrush}" |
||||
> |
||||
</Border> |
||||
<ad:DockableTabPanel |
||||
Grid.Row="2" |
||||
Height ="22" |
||||
KeyboardNavigation.TabIndex="2" |
||||
IsItemsHost="True" |
||||
x:Name="paneTabsPanel" |
||||
Margin="0,0,0,2" |
||||
TabItemStyle="{StaticResource DockableContentTabItemStyle}"/> |
||||
</Grid> |
||||
</Border> |
||||
|
||||
<ControlTemplate.Triggers> |
||||
<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"/> |
||||
<Setter Property="Source" Value="/AvalonDock;component/resources/Images/Classic/PinMenuSelected.png" TargetName="IMG_ShowContextMenu"/> |
||||
<Setter Property="Source" Value="/AvalonDock;component/resources/Images/Classic/PinAutoHideSelected.png" TargetName="IMG_AutoHide"/> |
||||
<Setter Property="Source" Value="/AvalonDock;component/resources/Images/Classic/PinCloseSelected.png" TargetName="IMG_Close"/> |
||||
</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> |
||||
|
||||
<!--DocumentTabItemStyle--> |
||||
<Style x:Key="DocumentTabItemStyle" TargetType="{x:Type ad:ManagedContent}"> |
||||
<Setter Property="Background" |
||||
Value="Transparent"/> |
||||
<Setter Property="Template"> |
||||
<Setter.Value> |
||||
<ControlTemplate TargetType="{x:Type ad:ManagedContent}"> |
||||
<Border |
||||
x:Name="PART_DragArea" |
||||
BorderBrush="{StaticResource ManagedContentTabControlNormalBorderBrush}" |
||||
Margin="-10,0,0,0" |
||||
SnapsToDevicePixels="True" |
||||
ContextMenu="{DynamicResource {ComponentResourceKey {x:Type ad:DockingManager}, {x:Static ad:ContextMenuElement.DocumentPane}}}" |
||||
> |
||||
<Grid> |
||||
<Grid.ColumnDefinitions> |
||||
<ColumnDefinition Width="20"/> |
||||
<ColumnDefinition Width="Auto"/> |
||||
</Grid.ColumnDefinitions> |
||||
<Path Data="M 20,0.5 Q 16,0.5 10,10 Q 0,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 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="Red"/>--> |
||||
<Path |
||||
x:Name="tabItemIntPathBorder" |
||||
Stroke="{StaticResource ManagedContentTabControlNormalBorderBrush}" |
||||
Data="M 20,0.5 Q 16,0.5 10,10 Q 4,19.5 0,19.5" |
||||
/> |
||||
<Line x:Name="tabItemIntLineBorder" |
||||
X1="4" X2="20" Y1="16.5" Y2="16.5" |
||||
Stroke="{StaticResource ManagedContentTabControlNormalBorderBrush}" |
||||
/> |
||||
<Border |
||||
x:Name="tabItemIntBorder" |
||||
Grid.Column="1" |
||||
BorderThickness="0,1,1,1" |
||||
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}" |
||||
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="Visibility" |
||||
TargetName="tabItemIntLineBorder" |
||||
Value="Hidden" |
||||
/> |
||||
<Setter Property="BorderThickness" |
||||
TargetName="tabItemIntBorder" |
||||
Value="0,1,1,0" |
||||
/> |
||||
|
||||
</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> |
||||
|
||||
<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--> |
||||
<Style TargetType="{x:Type ad:DocumentPane}"> |
||||
<Setter Property="Background" Value="Transparent"/> |
||||
<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" > |
||||
<!--ItemTemplate="{StaticResource ManagedContentHeaderDataTemplate}"--> |
||||
<ContextMenu.ItemContainerStyle> |
||||
<Style TargetType="{x:Type MenuItem}"> |
||||
<Setter Property="CommandParameter" Value="{Binding RelativeSource={x:Static RelativeSource.Self}, Path=Header}"/> |
||||
<Setter Property="Command" Value="ad:DocumentPane.ActivateDocumentCommand"/> |
||||
<Setter Property="Template"> |
||||
<Setter.Value> |
||||
<ControlTemplate TargetType="MenuItem"> |
||||
<Border x:Name="intBorder" BorderThickness="1" Background="{TemplateBinding Background}" CornerRadius="2"> |
||||
<Grid> |
||||
<Grid.ColumnDefinitions> |
||||
<ColumnDefinition Width="Auto" MinWidth="24"/> |
||||
<ColumnDefinition Width="*"/> |
||||
</Grid.ColumnDefinitions> |
||||
<ContentPresenter x:Name="Icon" Margin="2" Content="{Binding Path=Icon}" Grid.Column="0" VerticalAlignment="Center"/> |
||||
<TextBlock x:Name="intMenuTitle" Margin="5,2,20,2" Text="{Binding Path=Title}" Grid.Column="1" VerticalAlignment="Center"/> |
||||
</Grid> |
||||
</Border> |
||||
<ControlTemplate.Triggers> |
||||
<Trigger Property="IsMouseOver" Value="true"> |
||||
<Setter Property="Background" TargetName="intBorder"> |
||||
<Setter.Value> |
||||
<SolidColorBrush Color="{DynamicResource {x:Static SystemColors.ActiveCaptionColorKey}}" Opacity="0.3"/> |
||||
</Setter.Value> |
||||
</Setter> |
||||
<Setter Property="BorderBrush" TargetName="intBorder" Value="{DynamicResource {x:Static SystemColors.ActiveCaptionBrushKey}}"/> |
||||
</Trigger> |
||||
<DataTrigger Binding="{Binding Path=IsActiveDocument}" Value="True"> |
||||
<Setter Property="FontWeight" Value="Bold" TargetName="intMenuTitle"/> |
||||
</DataTrigger> |
||||
<!--<Trigger Property="Icon" |
||||
Value="{x:Null}"> |
||||
<Setter TargetName="Icon" |
||||
Property="Visibility" |
||||
Value="Collapsed"/> |
||||
</Trigger>--> |
||||
</ControlTemplate.Triggers> |
||||
</ControlTemplate> |
||||
</Setter.Value> |
||||
</Setter> |
||||
</Style> |
||||
</ContextMenu.ItemContainerStyle> |
||||
</ContextMenu> |
||||
</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="1" |
||||
BorderBrush="{StaticResource ManagedContentTabControlNormalBorderBrush}" |
||||
Background="#FFD4D0C8" |
||||
CornerRadius="3" |
||||
Focusable="False"> |
||||
</Border> |
||||
<Border BorderThickness="1" |
||||
BorderBrush="{StaticResource ManagedContentTabControlNormalBorderBrush}" |
||||
CornerRadius="1" |
||||
Margin="4" |
||||
Focusable="False" |
||||
Background="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=SelectedItem.Background}" |
||||
> |
||||
<ContentPresenter |
||||
Content="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=SelectedItem.Content}" |
||||
Margin="2" |
||||
KeyboardNavigation.TabNavigation="Local" |
||||
KeyboardNavigation.DirectionalNavigation="Contained" |
||||
KeyboardNavigation.TabIndex="1" |
||||
/> |
||||
</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="15" Height="15" Margin="2,0,2,0" Style="{StaticResource PaneHeaderCommandStyle}" Command="ApplicationCommands.Close"> |
||||
<Image Source="/AvalonDock;component/resources/Images/PinClose.png" Width="13" Height="13" Stretch="None"/> |
||||
</Button> |
||||
<Button x:Name="PART_ShowContextMenuButton" DockPanel.Dock="Right" Width="15" Height="15" Style="{StaticResource PaneHeaderCommandStyle}" Command="ad:DocumentPane.ShowDocumentsListMenuCommand"> |
||||
<Image x:Name="ShowContextMenuIcon" Source="/AvalonDock;component/resources/Images/PinMenu.png" Width="13" Height="13" Stretch="None"/> |
||||
</Button> |
||||
<ad:DocumentTabPanel |
||||
x:Name="paneTabsPanel" |
||||
Panel.ZIndex ="1" |
||||
KeyboardNavigation.TabIndex="2" |
||||
IsItemsHost="True" |
||||
Margin="10,2,0,0" |
||||
TabItemStyle="{StaticResource DocumentTabItemStyle}"/> |
||||
</DockPanel> |
||||
</Border> |
||||
</Grid> |
||||
</Border> |
||||
<ControlTemplate.Triggers> |
||||
<Trigger Property="HasItems" Value="False"> |
||||
<Setter Property="Visibility" Value="Hidden"/> |
||||
</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 TargetType="{x:Type ad:DockablePaneAnchorTab}"> |
||||
<Setter Property="Template"> |
||||
<Setter.Value> |
||||
<ControlTemplate TargetType="{x:Type ad:DockablePaneAnchorTab}"> |
||||
<Grid> |
||||
<Border |
||||
Name="PART_Border" |
||||
BorderThickness="1,0,1,1" |
||||
BorderBrush="{StaticResource ManagedContentTabControlNormalBorderBrush}" |
||||
Background="{StaticResource ManagedContentTabItemNormalBackground}"> |
||||
<!--<StackPanel Orientation="Horizontal">--> |
||||
<Grid> |
||||
<Grid.ColumnDefinitions> |
||||
<ColumnDefinition Width="Auto"/> |
||||
<ColumnDefinition Width="*"/> |
||||
</Grid.ColumnDefinitions> |
||||
|
||||
<Border Grid.Column="0" Width="18" Height="18"> |
||||
<Border.Background> |
||||
<VisualBrush Stretch="None" Visual="{Binding Path=ReferencedContent.Icon, RelativeSource={RelativeSource TemplatedParent}}"/> |
||||
</Border.Background> |
||||
</Border> |
||||
<TextBlock |
||||
Grid.Column="1" |
||||
Text="{Binding Path=ReferencedContent.Title, RelativeSource={RelativeSource TemplatedParent}}" |
||||
Foreground="{DynamicResource {x:Static SystemColors.WindowTextBrushKey}}" |
||||
Margin="4,2,2,2"/> |
||||
</Grid> |
||||
<!--</StackPanel>--> |
||||
</Border> |
||||
</Grid> |
||||
<ControlTemplate.Triggers> |
||||
|
||||
|
||||
<Trigger Property="Anchor" > |
||||
<Trigger.Value> |
||||
<ad:AnchorStyle> |
||||
Left |
||||
</ad:AnchorStyle> |
||||
</Trigger.Value> |
||||
<Setter TargetName="PART_Border" Property="Background" Value="{StaticResource ManagedContentTabItemInvNormalBackground}"/> |
||||
<Setter TargetName="PART_Border" Property="BorderThickness" Value="1,1,1,0"/> |
||||
|
||||
</Trigger> |
||||
<Trigger Property="Anchor"> |
||||
<Trigger.Value> |
||||
<ad:AnchorStyle> |
||||
Bottom |
||||
</ad:AnchorStyle> |
||||
</Trigger.Value> |
||||
<Setter TargetName="PART_Border" Property="Background" Value="{StaticResource ManagedContentTabItemInvNormalBackground}"/> |
||||
<Setter TargetName="PART_Border" Property="BorderThickness" Value="1,1,1,0"/> |
||||
</Trigger> |
||||
|
||||
<Trigger Property="IsMouseOver" |
||||
Value="true"> |
||||
<Setter Property="BorderBrush" Value="{StaticResource ManagedContentTabItemHotBorderBrush}" |
||||
TargetName="PART_Border" /> |
||||
<Setter Property="Background" Value="{StaticResource ManagedContentTabItemInvHotBackground}" |
||||
TargetName="PART_Border" /> |
||||
</Trigger> |
||||
|
||||
<MultiTrigger> |
||||
<MultiTrigger.Conditions> |
||||
<Condition Property="IsMouseOver" Value="True"/> |
||||
<Condition Property="Anchor"> |
||||
<Condition.Value> |
||||
<ad:AnchorStyle> |
||||
Top |
||||
</ad:AnchorStyle> |
||||
</Condition.Value> |
||||
</Condition> |
||||
</MultiTrigger.Conditions> |
||||
<Setter TargetName="PART_Border" Property="Background" Value="{StaticResource ManagedContentTabItemHotBackground}"/> |
||||
</MultiTrigger> |
||||
<MultiTrigger> |
||||
<MultiTrigger.Conditions> |
||||
<Condition Property="IsMouseOver" Value="True"/> |
||||
<Condition Property="Anchor"> |
||||
<Condition.Value> |
||||
<ad:AnchorStyle> |
||||
Right |
||||
</ad:AnchorStyle> |
||||
</Condition.Value> |
||||
</Condition> |
||||
</MultiTrigger.Conditions> |
||||
<Setter TargetName="PART_Border" Property="Background" Value="{StaticResource ManagedContentTabItemHotBackground}"/> |
||||
</MultiTrigger> |
||||
|
||||
</ControlTemplate.Triggers> |
||||
</ControlTemplate> |
||||
</Setter.Value> |
||||
</Setter> |
||||
</Style> |
||||
|
||||
<!--DockablePaneAnchorTabGroup--> |
||||
<Style TargetType="{x:Type ad:DockablePaneAnchorTabGroup}"> |
||||
<Setter Property="Orientation" Value="Horizontal"/> |
||||
<Setter Property="Margin" Value="7,0,0,0"/> |
||||
</Style> |
||||
|
||||
</ResourceDictionary> |
@ -1,548 +0,0 @@
@@ -1,548 +0,0 @@
|
||||
<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/themes/generic.xaml"/> |
||||
|
||||
<!--Aero colors--> |
||||
<ResourceDictionary Source="/AvalonDock;component/themes/classic.brushes.xaml"/> |
||||
</ResourceDictionary.MergedDictionaries> |
||||
|
||||
|
||||
<!--DockableContentTabItemStyle--> |
||||
<Style x:Key="DockableContentTabItemStyle" TargetType="{x:Type ad:DockableContent}"> |
||||
<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,-1,0" |
||||
Background="{StaticResource ManagedContentTabItemNormalBackground}" |
||||
Padding="1" |
||||
> |
||||
<Grid Margin="4,0,4,0"> |
||||
<Grid.ColumnDefinitions> |
||||
<ColumnDefinition Width="Auto"/> |
||||
<ColumnDefinition Width="*"/> |
||||
</Grid.ColumnDefinitions> |
||||
<ad:AlignedImage> |
||||
<ContentPresenter x:Name="Icon" |
||||
Grid.Column="0" |
||||
Margin="1" |
||||
VerticalAlignment="Center" |
||||
ContentSource="Icon" |
||||
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/> |
||||
</ad:AlignedImage> |
||||
<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.WindowTextBrushKey}}"/> |
||||
</Grid> |
||||
</Border> |
||||
</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="Margin" |
||||
Value="0,1,-1,-2" TargetName="PART_DragArea"/> |
||||
<Setter Property="Padding" |
||||
Value="2" TargetName="PART_DragArea"/> |
||||
<Setter Property="Panel.ZIndex" |
||||
Value="100" /> |
||||
</Trigger> |
||||
<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="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" /> |
||||
<Setter TargetName="Icon" Property="IsEnabled" Value="false" /> |
||||
</Trigger> |
||||
<Trigger Property="Icon" |
||||
Value="{x:Null}"> |
||||
<Setter TargetName="Icon" |
||||
Property="Visibility" |
||||
Value="Collapsed"/> |
||||
</Trigger> |
||||
</ControlTemplate.Triggers> |
||||
</ControlTemplate> |
||||
</Setter.Value> |
||||
</Setter> |
||||
</Style> |
||||
|
||||
<!--DockablePane--> |
||||
<Style 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="*"/> |
||||
<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" Style="{StaticResource PaneHeaderCommandStyle}" Command="ad:DockablePane.CloseCommand" |
||||
Width="15" Height="15" Margin="2,0,2,0" VerticalAlignment="Center"> |
||||
<ad:AlignedImage> |
||||
<Image x:Name="IMG_Close" Source="/AvalonDock;component/resources/Images/Classic/PinClose.png" Width="13" Height="13" Stretch="UniformToFill"/> |
||||
</ad:AlignedImage> |
||||
</Button> |
||||
<Button x:Name="btnPinAutoHide" DockPanel.Dock="Right" Style="{StaticResource PaneHeaderCommandStyle}" Command="ad:DockablePane.ToggleAutoHideCommand" |
||||
Width="15" Height="15" VerticalAlignment="Center"> |
||||
<ad:AlignedImage> |
||||
<Image x:Name="IMG_AutoHide" Source="/AvalonDock;component/resources/Images/Classic/PinAutoHide.png" Width="13" Height="13" Stretch="UniformToFill"/> |
||||
</ad:AlignedImage> |
||||
</Button> |
||||
<Button x:Name="PART_ShowContextMenuButton" DockPanel.Dock="Right" Style="{StaticResource PaneHeaderContextMenuCommandStyle}" Command="ad:DockablePane.ShowOptionsCommand" |
||||
Width="15" Height="15" VerticalAlignment="Center"> |
||||
<ad:AlignedImage> |
||||
<Image x:Name="IMG_ShowContextMenu" Source="/AvalonDock;component/resources/Images/Classic/PinMenu.png" Width="13" Height="13" Stretch="UniformToFill"/> |
||||
</ad:AlignedImage> |
||||
</Button> |
||||
<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 ="23" |
||||
BorderThickness="0,1,0,0" |
||||
BorderBrush="{StaticResource ManagedContentTabControlNormalBorderBrush}" |
||||
> |
||||
</Border> |
||||
<ad:DockableTabPanel |
||||
Grid.Row="2" |
||||
Height ="22" |
||||
KeyboardNavigation.TabIndex="2" |
||||
IsItemsHost="True" |
||||
x:Name="paneTabsPanel" |
||||
Margin="0,0,0,2" |
||||
TabItemStyle="{StaticResource DockableContentTabItemStyle}"/> |
||||
</Grid> |
||||
</Border> |
||||
|
||||
<ControlTemplate.Triggers> |
||||
<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"/> |
||||
<Setter Property="Source" Value="/AvalonDock;component/resources/Images/Classic/PinMenuSelected.png" TargetName="IMG_ShowContextMenu"/> |
||||
<Setter Property="Source" Value="/AvalonDock;component/resources/Images/Classic/PinAutoHideSelected.png" TargetName="IMG_AutoHide"/> |
||||
<Setter Property="Source" Value="/AvalonDock;component/resources/Images/Classic/PinCloseSelected.png" TargetName="IMG_Close"/> |
||||
</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> |
||||
|
||||
<!--DocumentTabItemStyle--> |
||||
<Style x:Key="DocumentTabItemStyle" TargetType="{x:Type ad:ManagedContent}"> |
||||
<Setter Property="Background" |
||||
Value="Transparent"/> |
||||
<Setter Property="Template"> |
||||
<Setter.Value> |
||||
<ControlTemplate TargetType="{x:Type ad:ManagedContent}"> |
||||
<Border |
||||
x:Name="PART_DragArea" |
||||
BorderBrush="{StaticResource ManagedContentTabControlNormalBorderBrush}" |
||||
Margin="-10,0,0,0" |
||||
SnapsToDevicePixels="True" |
||||
ContextMenu="{DynamicResource {ComponentResourceKey {x:Type ad:DockingManager}, {x:Static ad:ContextMenuElement.DocumentPane}}}" |
||||
> |
||||
<Grid> |
||||
<Grid.ColumnDefinitions> |
||||
<ColumnDefinition Width="20"/> |
||||
<ColumnDefinition Width="Auto"/> |
||||
</Grid.ColumnDefinitions> |
||||
<Path Data="M 20,0.5 Q 16,0.5 10,10 Q 0,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 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="Red"/>--> |
||||
<Path |
||||
x:Name="tabItemIntPathBorder" |
||||
Stroke="{StaticResource ManagedContentTabControlNormalBorderBrush}" |
||||
Data="M 20,0.5 Q 16,0.5 10,10 Q 4,19.5 0,19.5" |
||||
/> |
||||
<Line x:Name="tabItemIntLineBorder" |
||||
X1="4" X2="20" Y1="16.5" Y2="16.5" |
||||
Stroke="{StaticResource ManagedContentTabControlNormalBorderBrush}" |
||||
/> |
||||
<Border |
||||
x:Name="tabItemIntBorder" |
||||
Grid.Column="1" |
||||
BorderThickness="0,1,1,1" |
||||
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}" |
||||
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="Visibility" |
||||
TargetName="tabItemIntLineBorder" |
||||
Value="Hidden" |
||||
/> |
||||
<Setter Property="BorderThickness" |
||||
TargetName="tabItemIntBorder" |
||||
Value="0,1,1,0" |
||||
/> |
||||
|
||||
</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> |
||||
|
||||
<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--> |
||||
<Style TargetType="{x:Type ad:DocumentPane}"> |
||||
<Setter Property="Background" Value="Transparent"/> |
||||
<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" > |
||||
<!--ItemTemplate="{StaticResource ManagedContentHeaderDataTemplate}"--> |
||||
<ContextMenu.ItemContainerStyle> |
||||
<Style TargetType="{x:Type MenuItem}"> |
||||
<Setter Property="CommandParameter" Value="{Binding RelativeSource={x:Static RelativeSource.Self}, Path=Header}"/> |
||||
<Setter Property="Command" Value="ad:DocumentPane.ActivateDocumentCommand"/> |
||||
<Setter Property="Template"> |
||||
<Setter.Value> |
||||
<ControlTemplate TargetType="MenuItem"> |
||||
<Border x:Name="intBorder" BorderThickness="1" Background="{TemplateBinding Background}" CornerRadius="2"> |
||||
<Grid> |
||||
<Grid.ColumnDefinitions> |
||||
<ColumnDefinition Width="Auto" MinWidth="24"/> |
||||
<ColumnDefinition Width="*"/> |
||||
</Grid.ColumnDefinitions> |
||||
<ContentPresenter x:Name="Icon" Margin="2" Content="{Binding Path=Icon}" Grid.Column="0" VerticalAlignment="Center"/> |
||||
<TextBlock x:Name="intMenuTitle" Margin="5,2,20,2" Text="{Binding Path=Title}" Grid.Column="1" VerticalAlignment="Center"/> |
||||
</Grid> |
||||
</Border> |
||||
<ControlTemplate.Triggers> |
||||
<Trigger Property="IsMouseOver" Value="true"> |
||||
<Setter Property="Background" TargetName="intBorder"> |
||||
<Setter.Value> |
||||
<SolidColorBrush Color="{DynamicResource {x:Static SystemColors.ActiveCaptionColorKey}}" Opacity="0.3"/> |
||||
</Setter.Value> |
||||
</Setter> |
||||
<Setter Property="BorderBrush" TargetName="intBorder" Value="{DynamicResource {x:Static SystemColors.ActiveCaptionBrushKey}}"/> |
||||
</Trigger> |
||||
<DataTrigger Binding="{Binding Path=IsActiveDocument}" Value="True"> |
||||
<Setter Property="FontWeight" Value="Bold" TargetName="intMenuTitle"/> |
||||
</DataTrigger> |
||||
<!--<Trigger Property="Icon" |
||||
Value="{x:Null}"> |
||||
<Setter TargetName="Icon" |
||||
Property="Visibility" |
||||
Value="Collapsed"/> |
||||
</Trigger>--> |
||||
</ControlTemplate.Triggers> |
||||
</ControlTemplate> |
||||
</Setter.Value> |
||||
</Setter> |
||||
</Style> |
||||
</ContextMenu.ItemContainerStyle> |
||||
</ContextMenu> |
||||
</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="1" |
||||
BorderBrush="{StaticResource ManagedContentTabControlNormalBorderBrush}" |
||||
Background="#FFD4D0C8" |
||||
CornerRadius="3" |
||||
Focusable="False"> |
||||
</Border> |
||||
<Border BorderThickness="1" |
||||
BorderBrush="{StaticResource ManagedContentTabControlNormalBorderBrush}" |
||||
CornerRadius="1" |
||||
Margin="4" |
||||
Focusable="False" |
||||
Background="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=SelectedItem.Background}" |
||||
> |
||||
<ContentPresenter |
||||
Content="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=SelectedItem.Content}" |
||||
Margin="2" |
||||
KeyboardNavigation.TabNavigation="Local" |
||||
KeyboardNavigation.DirectionalNavigation="Contained" |
||||
KeyboardNavigation.TabIndex="1" |
||||
/> |
||||
</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="15" Height="15" Margin="2,0,2,0" Style="{StaticResource PaneHeaderCommandStyle}" Command="ApplicationCommands.Close"> |
||||
<Image Source="/AvalonDock;component/resources/Images/PinClose.png" Width="13" Height="13" Stretch="None"/> |
||||
</Button> |
||||
<Button x:Name="PART_ShowContextMenuButton" DockPanel.Dock="Right" Width="15" Height="15" Style="{StaticResource PaneHeaderCommandStyle}" Command="ad:DocumentPane.ShowDocumentsListMenuCommand"> |
||||
<Image x:Name="ShowContextMenuIcon" Source="/AvalonDock;component/resources/Images/PinMenu.png" Width="13" Height="13" Stretch="None"/> |
||||
</Button> |
||||
<ad:DocumentTabPanel |
||||
x:Name="paneTabsPanel" |
||||
Panel.ZIndex ="1" |
||||
KeyboardNavigation.TabIndex="2" |
||||
IsItemsHost="True" |
||||
Margin="10,2,0,0" |
||||
TabItemStyle="{StaticResource DocumentTabItemStyle}"/> |
||||
</DockPanel> |
||||
</Border> |
||||
</Grid> |
||||
</Border> |
||||
<ControlTemplate.Triggers> |
||||
<Trigger Property="HasItems" Value="False"> |
||||
<Setter Property="Visibility" Value="Hidden"/> |
||||
</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 TargetType="{x:Type ad:DockablePaneAnchorTab}"> |
||||
<Setter Property="Template"> |
||||
<Setter.Value> |
||||
<ControlTemplate TargetType="{x:Type ad:DockablePaneAnchorTab}"> |
||||
<Grid> |
||||
<Border |
||||
Name="PART_Border" |
||||
BorderThickness="1,0,1,1" |
||||
BorderBrush="{StaticResource ManagedContentTabControlNormalBorderBrush}" |
||||
Background="{StaticResource ManagedContentTabItemNormalBackground}"> |
||||
<!--<StackPanel Orientation="Horizontal">--> |
||||
<Grid> |
||||
<Grid.ColumnDefinitions> |
||||
<ColumnDefinition Width="Auto"/> |
||||
<ColumnDefinition Width="*"/> |
||||
</Grid.ColumnDefinitions> |
||||
|
||||
<Border Grid.Column="0" Width="18" Height="18"> |
||||
<Border.Background> |
||||
<VisualBrush Stretch="None" Visual="{Binding Path=ReferencedContent.Icon, RelativeSource={RelativeSource TemplatedParent}}"/> |
||||
</Border.Background> |
||||
</Border> |
||||
<TextBlock |
||||
Grid.Column="1" |
||||
Text="{Binding Path=ReferencedContent.Title, RelativeSource={RelativeSource TemplatedParent}}" |
||||
Foreground="{DynamicResource {x:Static SystemColors.WindowTextBrushKey}}" |
||||
Margin="4,2,2,2"/> |
||||
</Grid> |
||||
<!--</StackPanel>--> |
||||
</Border> |
||||
</Grid> |
||||
<ControlTemplate.Triggers> |
||||
|
||||
|
||||
<Trigger Property="Anchor" > |
||||
<Trigger.Value> |
||||
<ad:AnchorStyle> |
||||
Left |
||||
</ad:AnchorStyle> |
||||
</Trigger.Value> |
||||
<Setter TargetName="PART_Border" Property="Background" Value="{StaticResource ManagedContentTabItemInvNormalBackground}"/> |
||||
<Setter TargetName="PART_Border" Property="BorderThickness" Value="1,1,1,0"/> |
||||
|
||||
</Trigger> |
||||
<Trigger Property="Anchor"> |
||||
<Trigger.Value> |
||||
<ad:AnchorStyle> |
||||
Bottom |
||||
</ad:AnchorStyle> |
||||
</Trigger.Value> |
||||
<Setter TargetName="PART_Border" Property="Background" Value="{StaticResource ManagedContentTabItemInvNormalBackground}"/> |
||||
<Setter TargetName="PART_Border" Property="BorderThickness" Value="1,1,1,0"/> |
||||
</Trigger> |
||||
|
||||
<Trigger Property="IsMouseOver" |
||||
Value="true"> |
||||
<Setter Property="BorderBrush" Value="{StaticResource ManagedContentTabItemHotBorderBrush}" |
||||
TargetName="PART_Border" /> |
||||
<Setter Property="Background" Value="{StaticResource ManagedContentTabItemInvHotBackground}" |
||||
TargetName="PART_Border" /> |
||||
</Trigger> |
||||
|
||||
<MultiTrigger> |
||||
<MultiTrigger.Conditions> |
||||
<Condition Property="IsMouseOver" Value="True"/> |
||||
<Condition Property="Anchor"> |
||||
<Condition.Value> |
||||
<ad:AnchorStyle> |
||||
Top |
||||
</ad:AnchorStyle> |
||||
</Condition.Value> |
||||
</Condition> |
||||
</MultiTrigger.Conditions> |
||||
<Setter TargetName="PART_Border" Property="Background" Value="{StaticResource ManagedContentTabItemHotBackground}"/> |
||||
</MultiTrigger> |
||||
<MultiTrigger> |
||||
<MultiTrigger.Conditions> |
||||
<Condition Property="IsMouseOver" Value="True"/> |
||||
<Condition Property="Anchor"> |
||||
<Condition.Value> |
||||
<ad:AnchorStyle> |
||||
Right |
||||
</ad:AnchorStyle> |
||||
</Condition.Value> |
||||
</Condition> |
||||
</MultiTrigger.Conditions> |
||||
<Setter TargetName="PART_Border" Property="Background" Value="{StaticResource ManagedContentTabItemHotBackground}"/> |
||||
</MultiTrigger> |
||||
|
||||
</ControlTemplate.Triggers> |
||||
</ControlTemplate> |
||||
</Setter.Value> |
||||
</Setter> |
||||
</Style> |
||||
|
||||
<!--DockablePaneAnchorTabGroup--> |
||||
<Style TargetType="{x:Type ad:DockablePaneAnchorTabGroup}"> |
||||
<Setter Property="Orientation" Value="Horizontal"/> |
||||
<Setter Property="Margin" Value="7,0,0,0"/> |
||||
</Style> |
||||
|
||||
</ResourceDictionary> |
@ -1,18 +0,0 @@
@@ -1,18 +0,0 @@
|
||||
<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/Common.xaml"/> |
||||
<ResourceDictionary Source="/AvalonDock;component/Resources/DockablePaneStyles.xaml"/> |
||||
<ResourceDictionary Source="/AvalonDock;component/Resources/DocumentPaneStyles.xaml"/> |
||||
<ResourceDictionary Source="/AvalonDock;component/Resources/DockingManagerStyles.xaml"/> |
||||
<ResourceDictionary Source="/AvalonDock;component/Resources/OverlayWindowStyle.xaml"/> |
||||
<ResourceDictionary Source="/AvalonDock;component/Resources/FloatingWindowStyle.xaml"/> |
||||
<ResourceDictionary Source="/AvalonDock;component/Resources/NavigatorWindowStyle.xaml"/> |
||||
<ResourceDictionary Source="/AvalonDock;component/Resources/DocumentNavigatorWindowStyle.xaml"/> |
||||
</ResourceDictionary.MergedDictionaries> |
||||
|
||||
</ResourceDictionary> |
@ -1,18 +0,0 @@
@@ -1,18 +0,0 @@
|
||||
<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/Common.xaml"/> |
||||
<ResourceDictionary Source="/AvalonDock;component/Resources/DockablePaneStyles.xaml"/> |
||||
<ResourceDictionary Source="/AvalonDock;component/Resources/DocumentPaneStyles.xaml"/> |
||||
<ResourceDictionary Source="/AvalonDock;component/Resources/DockingManagerStyles.xaml"/> |
||||
<ResourceDictionary Source="/AvalonDock;component/Resources/OverlayWindowStyle.xaml"/> |
||||
<ResourceDictionary Source="/AvalonDock;component/Resources/FloatingWindowStyle.xaml"/> |
||||
<ResourceDictionary Source="/AvalonDock;component/Resources/NavigatorWindowStyle.xaml"/> |
||||
<ResourceDictionary Source="/AvalonDock;component/Resources/DocumentNavigatorWindowStyle.xaml"/> |
||||
</ResourceDictionary.MergedDictionaries> |
||||
|
||||
</ResourceDictionary> |