Added the source code of Aga.Controls (TreeViewAdv for .Net) version 1.7.0.0.
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/External/Aga.Controls/Aga.Controls.csproj Sun May 27 15:16:19 2012 +0000
1.3 @@ -0,0 +1,221 @@
1.4 +<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5">
1.5 + <PropertyGroup>
1.6 + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
1.7 + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
1.8 + <ProductVersion>9.0.30729</ProductVersion>
1.9 + <SchemaVersion>2.0</SchemaVersion>
1.10 + <ProjectGuid>{E73BB233-D88B-44A7-A98F-D71EE158381D}</ProjectGuid>
1.11 + <OutputType>Library</OutputType>
1.12 + <AppDesignerFolder>Properties</AppDesignerFolder>
1.13 + <RootNamespace>Aga.Controls</RootNamespace>
1.14 + <AssemblyName>Aga.Controls</AssemblyName>
1.15 + <SccProjectName>
1.16 + </SccProjectName>
1.17 + <SccLocalPath>
1.18 + </SccLocalPath>
1.19 + <SccAuxPath>
1.20 + </SccAuxPath>
1.21 + <SccProvider>
1.22 + </SccProvider>
1.23 + <FileUpgradeFlags>
1.24 + </FileUpgradeFlags>
1.25 + <OldToolsVersion>2.0</OldToolsVersion>
1.26 + <UpgradeBackupLocation>
1.27 + </UpgradeBackupLocation>
1.28 + </PropertyGroup>
1.29 + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
1.30 + <DebugSymbols>true</DebugSymbols>
1.31 + <DebugType>full</DebugType>
1.32 + <Optimize>false</Optimize>
1.33 + <OutputPath>bin\Debug\</OutputPath>
1.34 + <DefineConstants>TRACE;DEBUG;PERF_TEST</DefineConstants>
1.35 + <ErrorReport>prompt</ErrorReport>
1.36 + <WarningLevel>4</WarningLevel>
1.37 + <CodeAnalysisRules>-Microsoft.Design#CA1020;-Microsoft.Design#CA1060;-Microsoft.Design#CA1062;-Microsoft.Globalization#CA1301;-Microsoft.Globalization#CA1302;-Microsoft.Globalization#CA1303;-Microsoft.Globalization#CA1306;-Microsoft.Globalization#CA1304;-Microsoft.Globalization#CA1305;-Microsoft.Globalization#CA1300;-Microsoft.Maintainability#CA1501;-Microsoft.Mobility#CA1601;-Microsoft.Performance#CA1805;-Microsoft.Performance#CA1815;-Microsoft.Performance#CA1819;-Microsoft.Usage#CA2208</CodeAnalysisRules>
1.38 + <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
1.39 + </PropertyGroup>
1.40 + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
1.41 + <DebugType>pdbonly</DebugType>
1.42 + <Optimize>true</Optimize>
1.43 + <OutputPath>bin\Release\</OutputPath>
1.44 + <DefineConstants>TRACE</DefineConstants>
1.45 + <ErrorReport>prompt</ErrorReport>
1.46 + <WarningLevel>4</WarningLevel>
1.47 + <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
1.48 + </PropertyGroup>
1.49 + <ItemGroup>
1.50 + <Reference Include="System" />
1.51 + <Reference Include="System.Data" />
1.52 + <Reference Include="System.Design" />
1.53 + <Reference Include="System.Drawing" />
1.54 + <Reference Include="System.Windows.Forms" />
1.55 + <Reference Include="System.Xml" />
1.56 + </ItemGroup>
1.57 + <ItemGroup>
1.58 + <Compile Include="GifDecoder.cs" />
1.59 + <Compile Include="PerformanceAnalyzer.cs" />
1.60 + <Compile Include="ResourceHelper.cs" />
1.61 + <Compile Include="StringCollectionEditor.cs" />
1.62 + <Compile Include="Properties\Resources.Designer.cs">
1.63 + <AutoGen>True</AutoGen>
1.64 + <DesignTime>True</DesignTime>
1.65 + <DependentUpon>Resources.resx</DependentUpon>
1.66 + </Compile>
1.67 + <Compile Include="BitmapHelper.cs" />
1.68 + <Compile Include="Threading\AbortableThreadPool.cs" />
1.69 + <Compile Include="Threading\WorkItemStatus.cs" />
1.70 + <Compile Include="Threading\WorkItem.cs" />
1.71 + <Compile Include="TimeCounter.cs" />
1.72 + <Compile Include="Tree\Input\ReorderColumnState.cs" />
1.73 + <Compile Include="Tree\ListModel.cs" />
1.74 + <Compile Include="Tree\NodeControls\EditEventArgs.cs" />
1.75 + <Compile Include="Tree\NodeControls\LabelEventArgs.cs" />
1.76 + <Compile Include="Tree\NodeControls\NodeIntegerTextBox.cs">
1.77 + <SubType>Component</SubType>
1.78 + </Compile>
1.79 + <Compile Include="Tree\NodeControls\NodeDecimalTextBox.cs">
1.80 + <SubType>Component</SubType>
1.81 + </Compile>
1.82 + <Compile Include="NumericTextBox.cs">
1.83 + <SubType>Component</SubType>
1.84 + </Compile>
1.85 + <Compile Include="Tree\NodeControls\ExpandingIcon.cs">
1.86 + <SubType>Component</SubType>
1.87 + </Compile>
1.88 + <Compile Include="Tree\NodeControls\InteractiveControl.cs">
1.89 + <SubType>Component</SubType>
1.90 + </Compile>
1.91 + <Compile Include="Tree\NodeControls\DrawEventArgs.cs" />
1.92 + <Compile Include="Tree\NodeControls\NodeEventArgs.cs" />
1.93 + <Compile Include="Tree\SortedTreeModel.cs" />
1.94 + <Compile Include="Tree\TreeModelBase.cs" />
1.95 + <Compile Include="Tree\AutoRowHeightLayout.cs" />
1.96 + <Compile Include="Tree\Input\ClickColumnState.cs" />
1.97 + <Compile Include="Tree\Input\ColumnState.cs" />
1.98 + <Compile Include="Tree\TreeViewAdv.Draw.cs">
1.99 + <SubType>Component</SubType>
1.100 + </Compile>
1.101 + <Compile Include="Tree\TreeViewAdv.Editor.cs">
1.102 + <SubType>Component</SubType>
1.103 + </Compile>
1.104 + <Compile Include="Tree\TreeViewAdv.Input.cs">
1.105 + <SubType>Component</SubType>
1.106 + </Compile>
1.107 + <Compile Include="Tree\IRowLayout.cs" />
1.108 + <Compile Include="Tree\FixedRowHeightLayout.cs" />
1.109 + <Compile Include="Tree\NodeControlInfo.cs" />
1.110 + <Compile Include="Tree\NodeControls\NodeControlValueEventArgs.cs" />
1.111 + <Compile Include="Tree\NodeControls\NodeNumericUpDown.cs">
1.112 + <SubType>Component</SubType>
1.113 + </Compile>
1.114 + <Compile Include="Tree\IncrementalSearch.cs" />
1.115 + <Compile Include="TextHelper.cs" />
1.116 + <Compile Include="Tree\TreeViewAdv.Properties.cs">
1.117 + <SubType>Component</SubType>
1.118 + </Compile>
1.119 + <Compile Include="Tree\TreeListAdapter.cs" />
1.120 + <Compile Include="Tree\TreeNodeAdvMouseEventArgs.cs" />
1.121 + <Compile Include="Tree\Node.cs" />
1.122 + <Compile Include="Tree\NodeControls\BaseTextControl.cs">
1.123 + <SubType>Component</SubType>
1.124 + </Compile>
1.125 + <Compile Include="Tree\NodeControls\EditableControl.cs">
1.126 + <SubType>Component</SubType>
1.127 + </Compile>
1.128 + <Compile Include="Tree\NodeControls\NodeComboBox.cs">
1.129 + <SubType>Component</SubType>
1.130 + </Compile>
1.131 + <Compile Include="Tree\NodeControls\NodeControlsCollection.cs" />
1.132 + <Compile Include="Tree\Input\InputState.cs" />
1.133 + <Compile Include="Tree\IToolTipProvider.cs" />
1.134 + <Compile Include="Tree\Input\ResizeColumnState.cs" />
1.135 + <Compile Include="Tree\TreeColumn.cs">
1.136 + <SubType>Component</SubType>
1.137 + </Compile>
1.138 + <Compile Include="Tree\TreeColumnCollection.cs" />
1.139 + <Compile Include="Tree\TreeColumnEventArgs.cs" />
1.140 + <Compile Include="Tree\TreeModel.cs" />
1.141 + <Compile Include="Tree\TreeViewAdvCancelEventArgs.cs" />
1.142 + <Compile Include="Tree\DropNodeValidatingEventArgs.cs" />
1.143 + <Compile Include="Tree\TreeViewAdvEventArgs.cs" />
1.144 + <Compile Include="Tree\TreePathEventArgs.cs" />
1.145 + <Compile Include="Tree\EditorContext.cs" />
1.146 + <Compile Include="Tree\Input\InputWithShift.cs" />
1.147 + <Compile Include="Tree\Enums.cs" />
1.148 + <Compile Include="Tree\Input\NormalInputState.cs" />
1.149 + <Compile Include="Tree\Input\InputWithControl.cs" />
1.150 + <Compile Include="Tree\NodeControls\NodeControl.cs">
1.151 + <SubType>Component</SubType>
1.152 + </Compile>
1.153 + <Compile Include="Tree\DropPosition.cs" />
1.154 + <Compile Include="Tree\NodeControls\BindableControl.cs">
1.155 + <SubType>Component</SubType>
1.156 + </Compile>
1.157 + <Compile Include="Tree\NodeControls\NodeCheckBox.cs">
1.158 + <SubType>Component</SubType>
1.159 + </Compile>
1.160 + <Compile Include="Tree\NodeControls\NodeIcon.cs">
1.161 + <SubType>Component</SubType>
1.162 + </Compile>
1.163 + <Compile Include="Tree\DrawContext.cs" />
1.164 + <Compile Include="Tree\ITreeModel.cs" />
1.165 + <Compile Include="Tree\NodeControls\NodePlusMinus.cs">
1.166 + <SubType>Component</SubType>
1.167 + </Compile>
1.168 + <Compile Include="Tree\NodeControls\NodeTextBox.cs">
1.169 + <SubType>Component</SubType>
1.170 + </Compile>
1.171 + <Compile Include="Properties\AssemblyInfo.cs" />
1.172 + <Compile Include="Tree\NodeControls\NodeStateIcon.cs">
1.173 + <SubType>Component</SubType>
1.174 + </Compile>
1.175 + <Compile Include="Tree\TreeModelEventArgs.cs" />
1.176 + <Compile Include="Tree\TreeNodeAdv.cs" />
1.177 + <Compile Include="Tree\TreePath.cs" />
1.178 + <Compile Include="Tree\TreeViewAdv.cs">
1.179 + <SubType>Component</SubType>
1.180 + </Compile>
1.181 + <Compile Include="Tree\TreeViewAdv.Designer.cs">
1.182 + <DependentUpon>TreeViewAdv.cs</DependentUpon>
1.183 + </Compile>
1.184 + <Compile Include="Tree\TreeViewRowDrawEventArgs.cs" />
1.185 + <Service Include="{94E38DFF-614B-4cbd-B67C-F211BB35CE8B}" />
1.186 + <Service Include="{B4F97281-0DBD-4835-9ED8-7DFB966E87FF}" />
1.187 + </ItemGroup>
1.188 + <ItemGroup>
1.189 + <Content Include="Resources\minus.bmp" />
1.190 + <Content Include="Resources\plus.bmp" />
1.191 + <Content Include="Resources\check.bmp" />
1.192 + <Content Include="Resources\uncheck.bmp" />
1.193 + <Content Include="Resources\Leaf.bmp" />
1.194 + <Content Include="Resources\Folder.bmp" />
1.195 + <Content Include="Resources\FolderClosed.bmp" />
1.196 + </ItemGroup>
1.197 + <ItemGroup>
1.198 + <EmbeddedResource Include="Properties\Resources.resx">
1.199 + <SubType>Designer</SubType>
1.200 + <Generator>ResXFileCodeGenerator</Generator>
1.201 + <LastGenOutput>Resources.Designer.cs</LastGenOutput>
1.202 + </EmbeddedResource>
1.203 + <EmbeddedResource Include="Tree\TreeViewAdv.resx">
1.204 + <DependentUpon>TreeViewAdv.cs</DependentUpon>
1.205 + </EmbeddedResource>
1.206 + </ItemGroup>
1.207 + <ItemGroup>
1.208 + <Content Include="Resources\loading_icon" />
1.209 + <None Include="Tree\ClassDiagram.cd" />
1.210 + <None Include="Tree\NodeControls\ClassDiagram.cd" />
1.211 + <Content Include="Resources\unknown.bmp" />
1.212 + </ItemGroup>
1.213 + <ItemGroup>
1.214 + <Content Include="Resources\DVSplit.cur" />
1.215 + </ItemGroup>
1.216 + <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
1.217 + <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
1.218 + Other similar extension points exist, see Microsoft.Common.targets.
1.219 + <Target Name="BeforeBuild">
1.220 + </Target>
1.221 + <Target Name="AfterBuild">
1.222 + </Target>
1.223 + -->
1.224 +</Project>
1.225 \ No newline at end of file
2.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
2.2 +++ b/External/Aga.Controls/BitmapHelper.cs Sun May 27 15:16:19 2012 +0000
2.3 @@ -0,0 +1,46 @@
2.4 +using System;
2.5 +using System.Collections.Generic;
2.6 +using System.Text;
2.7 +using System.Drawing;
2.8 +using System.Runtime.InteropServices;
2.9 +using System.Drawing.Imaging;
2.10 +
2.11 +namespace Aga.Controls
2.12 +{
2.13 + public static class BitmapHelper
2.14 + {
2.15 + [StructLayout(LayoutKind.Sequential)]
2.16 + private struct PixelData
2.17 + {
2.18 + public byte B;
2.19 + public byte G;
2.20 + public byte R;
2.21 + public byte A;
2.22 + }
2.23 +
2.24 + public static void SetAlphaChanelValue(Bitmap image, byte value)
2.25 + {
2.26 + if (image == null)
2.27 + throw new ArgumentNullException("image");
2.28 + if (image.PixelFormat != PixelFormat.Format32bppArgb)
2.29 + throw new ArgumentException("Wrong PixelFormat");
2.30 +
2.31 + BitmapData bitmapData = image.LockBits(new Rectangle(0, 0, image.Width, image.Height),
2.32 + ImageLockMode.ReadWrite, PixelFormat.Format32bppArgb);
2.33 + unsafe
2.34 + {
2.35 + PixelData* pPixel = (PixelData*)bitmapData.Scan0;
2.36 + for (int i = 0; i < bitmapData.Height; i++)
2.37 + {
2.38 + for (int j = 0; j < bitmapData.Width; j++)
2.39 + {
2.40 + pPixel->A = value;
2.41 + pPixel++;
2.42 + }
2.43 + pPixel += bitmapData.Stride - (bitmapData.Width * 4);
2.44 + }
2.45 + }
2.46 + image.UnlockBits(bitmapData);
2.47 + }
2.48 + }
2.49 +}
3.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
3.2 +++ b/External/Aga.Controls/GifDecoder.cs Sun May 27 15:16:19 2012 +0000
3.3 @@ -0,0 +1,864 @@
3.4 +#pragma warning disable 675 // Bitwise-or operator used on a sign-extended operand
3.5 +
3.6 +#region Java Info
3.7 +/**
3.8 + * Class GifDecoder - Decodes a GIF file into one or more frames.
3.9 + * <br><pre>
3.10 + * Example:
3.11 + * GifDecoder d = new GifDecoder();
3.12 + * d.read("sample.gif");
3.13 + * int n = d.getFrameCount();
3.14 + * for (int i = 0; i < n; i++) {
3.15 + * BufferedImage frame = d.getFrame(i); // frame i
3.16 + * int t = d.getDelay(i); // display duration of frame in milliseconds
3.17 + * // do something with frame
3.18 + * }
3.19 + * </pre>
3.20 + * No copyright asserted on the source code of this class. May be used for
3.21 + * any purpose, however, refer to the Unisys LZW patent for any additional
3.22 + * restrictions. Please forward any corrections to kweiner@fmsware.com.
3.23 + *
3.24 + * @author Kevin Weiner, FM Software; LZW decoder adapted from John Cristy's ImageMagick.
3.25 + * @version 1.03 November 2003
3.26 + *
3.27 + */
3.28 +#endregion
3.29 +
3.30 +using System;
3.31 +using System.Collections;
3.32 +using System.Drawing;
3.33 +using System.Drawing.Imaging;
3.34 +using System.IO;
3.35 +
3.36 +namespace Aga.Controls
3.37 +{
3.38 + public class GifFrame
3.39 + {
3.40 + private Image _image;
3.41 + public Image Image
3.42 + {
3.43 + get { return _image; }
3.44 + }
3.45 +
3.46 + private int _delay;
3.47 + public int Delay
3.48 + {
3.49 + get { return _delay; }
3.50 + }
3.51 +
3.52 + public GifFrame(Image im, int del)
3.53 + {
3.54 + _image = im;
3.55 + _delay = del;
3.56 + }
3.57 + }
3.58 +
3.59 + public class GifDecoder
3.60 + {
3.61 + public const int StatusOK = 0;//File read status: No errors.
3.62 + public const int StatusFormatError = 1; //File read status: Error decoding file (may be partially decoded)
3.63 + public const int StatusOpenError = 2; //Unable to open source.
3.64 +
3.65 + private Stream inStream;
3.66 + private int status;
3.67 +
3.68 + private int width; // full image width
3.69 + private int height; // full image height
3.70 + private bool gctFlag; // global color table used
3.71 + private int gctSize; // size of global color table
3.72 + private int loopCount = 1; // iterations; 0 = repeat forever
3.73 +
3.74 + private int[] gct; // global color table
3.75 + private int[] lct; // local color table
3.76 + private int[] act; // active color table
3.77 +
3.78 + private int bgIndex; // background color index
3.79 + private int bgColor; // background color
3.80 + private int lastBgColor; // previous bg color
3.81 + private int pixelAspect; // pixel aspect ratio
3.82 +
3.83 + private bool lctFlag; // local color table flag
3.84 + private bool interlace; // interlace flag
3.85 + private int lctSize; // local color table size
3.86 +
3.87 + private int ix, iy, iw, ih; // current image rectangle
3.88 + private Rectangle lastRect; // last image rect
3.89 + private Image image; // current frame
3.90 + private Bitmap bitmap;
3.91 + private Image lastImage; // previous frame
3.92 +
3.93 + private byte[] block = new byte[256]; // current data block
3.94 + private int blockSize = 0; // block size
3.95 +
3.96 + // last graphic control extension info
3.97 + private int dispose = 0;
3.98 + // 0=no action; 1=leave in place; 2=restore to bg; 3=restore to prev
3.99 + private int lastDispose = 0;
3.100 + private bool transparency = false; // use transparent color
3.101 + private int delay = 0; // delay in milliseconds
3.102 + private int transIndex; // transparent color index
3.103 +
3.104 + private const int MaxStackSize = 4096;
3.105 + // max decoder pixel stack size
3.106 +
3.107 + // LZW decoder working arrays
3.108 + private short[] prefix;
3.109 + private byte[] suffix;
3.110 + private byte[] pixelStack;
3.111 + private byte[] pixels;
3.112 +
3.113 + private ArrayList frames; // frames read from current file
3.114 + private int frameCount;
3.115 + private bool _makeTransparent;
3.116 +
3.117 + /**
3.118 + * Gets the number of frames read from file.
3.119 + * @return frame count
3.120 + */
3.121 + public int FrameCount
3.122 + {
3.123 + get
3.124 + {
3.125 + return frameCount;
3.126 + }
3.127 + }
3.128 +
3.129 + /**
3.130 + * Gets the first (or only) image read.
3.131 + *
3.132 + * @return BufferedImage containing first frame, or null if none.
3.133 + */
3.134 + public Image Image
3.135 + {
3.136 + get
3.137 + {
3.138 + return GetFrame(0).Image;
3.139 + }
3.140 + }
3.141 +
3.142 + /**
3.143 + * Gets the "Netscape" iteration count, if any.
3.144 + * A count of 0 means repeat indefinitiely.
3.145 + *
3.146 + * @return iteration count if one was specified, else 1.
3.147 + */
3.148 + public int LoopCount
3.149 + {
3.150 + get
3.151 + {
3.152 + return loopCount;
3.153 + }
3.154 + }
3.155 +
3.156 + public GifDecoder(Stream stream, bool makeTransparent)
3.157 + {
3.158 + _makeTransparent = makeTransparent;
3.159 + if (Read(stream) != 0)
3.160 + throw new InvalidOperationException();
3.161 + }
3.162 +
3.163 + /**
3.164 + * Creates new frame image from current data (and previous
3.165 + * frames as specified by their disposition codes).
3.166 + */
3.167 + private int[] GetPixels(Bitmap bitmap)
3.168 + {
3.169 + int [] pixels = new int [ 3 * image.Width * image.Height ];
3.170 + int count = 0;
3.171 + for (int th = 0; th < image.Height; th++)
3.172 + {
3.173 + for (int tw = 0; tw < image.Width; tw++)
3.174 + {
3.175 + Color color = bitmap.GetPixel(tw, th);
3.176 + pixels[count] = color.R;
3.177 + count++;
3.178 + pixels[count] = color.G;
3.179 + count++;
3.180 + pixels[count] = color.B;
3.181 + count++;
3.182 + }
3.183 + }
3.184 + return pixels;
3.185 + }
3.186 +
3.187 + private void SetPixels(int[] pixels)
3.188 + {
3.189 + int count = 0;
3.190 + for (int th = 0; th < image.Height; th++)
3.191 + {
3.192 + for (int tw = 0; tw < image.Width; tw++)
3.193 + {
3.194 + Color color = Color.FromArgb( pixels[count++] );
3.195 + bitmap.SetPixel( tw, th, color );
3.196 + }
3.197 + }
3.198 + if (_makeTransparent)
3.199 + bitmap.MakeTransparent(bitmap.GetPixel(0, 0));
3.200 + }
3.201 +
3.202 + private void SetPixels()
3.203 + {
3.204 + // expose destination image's pixels as int array
3.205 + // int[] dest =
3.206 + // (( int ) image.getRaster().getDataBuffer()).getData();
3.207 + int[] dest = GetPixels( bitmap );
3.208 +
3.209 + // fill in starting image contents based on last image's dispose code
3.210 + if (lastDispose > 0)
3.211 + {
3.212 + if (lastDispose == 3)
3.213 + {
3.214 + // use image before last
3.215 + int n = frameCount - 2;
3.216 + if (n > 0)
3.217 + {
3.218 + lastImage = GetFrame(n - 1).Image;
3.219 + }
3.220 + else
3.221 + {
3.222 + lastImage = null;
3.223 + }
3.224 + }
3.225 +
3.226 + if (lastImage != null)
3.227 + {
3.228 + // int[] prev =
3.229 + // ((DataBufferInt) lastImage.getRaster().getDataBuffer()).getData();
3.230 + int[] prev = GetPixels( new Bitmap( lastImage ) );
3.231 + Array.Copy(prev, 0, dest, 0, width * height);
3.232 + // copy pixels
3.233 +
3.234 + if (lastDispose == 2)
3.235 + {
3.236 + // fill last image rect area with background color
3.237 + Graphics g = Graphics.FromImage( image );
3.238 + Color c = Color.Empty;
3.239 + if (transparency)
3.240 + {
3.241 + c = Color.FromArgb( 0, 0, 0, 0 ); // assume background is transparent
3.242 + }
3.243 + else
3.244 + {
3.245 + c = Color.FromArgb( lastBgColor ) ;
3.246 + // c = new Color(lastBgColor); // use given background color
3.247 + }
3.248 + Brush brush = new SolidBrush( c );
3.249 + g.FillRectangle( brush, lastRect );
3.250 + brush.Dispose();
3.251 + g.Dispose();
3.252 + }
3.253 + }
3.254 + }
3.255 +
3.256 + // copy each source line to the appropriate place in the destination
3.257 + int pass = 1;
3.258 + int inc = 8;
3.259 + int iline = 0;
3.260 + for (int i = 0; i < ih; i++)
3.261 + {
3.262 + int line = i;
3.263 + if (interlace)
3.264 + {
3.265 + if (iline >= ih)
3.266 + {
3.267 + pass++;
3.268 + switch (pass)
3.269 + {
3.270 + case 2 :
3.271 + iline = 4;
3.272 + break;
3.273 + case 3 :
3.274 + iline = 2;
3.275 + inc = 4;
3.276 + break;
3.277 + case 4 :
3.278 + iline = 1;
3.279 + inc = 2;
3.280 + break;
3.281 + }
3.282 + }
3.283 + line = iline;
3.284 + iline += inc;
3.285 + }
3.286 + line += iy;
3.287 + if (line < height)
3.288 + {
3.289 + int k = line * width;
3.290 + int dx = k + ix; // start of line in dest
3.291 + int dlim = dx + iw; // end of dest line
3.292 + if ((k + width) < dlim)
3.293 + {
3.294 + dlim = k + width; // past dest edge
3.295 + }
3.296 + int sx = i * iw; // start of line in source
3.297 + while (dx < dlim)
3.298 + {
3.299 + // map color and insert in destination
3.300 + int index = ((int) pixels[sx++]) & 0xff;
3.301 + int c = act[index];
3.302 + if (c != 0)
3.303 + {
3.304 + dest[dx] = c;
3.305 + }
3.306 + dx++;
3.307 + }
3.308 + }
3.309 + }
3.310 + SetPixels( dest );
3.311 + }
3.312 +
3.313 + /**
3.314 + * Gets the image contents of frame n.
3.315 + *
3.316 + * @return BufferedImage representation of frame.
3.317 + */
3.318 + public GifFrame GetFrame(int n)
3.319 + {
3.320 + if ((n >= 0) && (n < frameCount))
3.321 + return (GifFrame)frames[n];
3.322 + else
3.323 + throw new ArgumentOutOfRangeException();
3.324 + }
3.325 +
3.326 + /**
3.327 + * Gets image size.
3.328 + *
3.329 + * @return GIF image dimensions
3.330 + */
3.331 + public Size FrameSize
3.332 + {
3.333 + get
3.334 + {
3.335 + return new Size(width, height);
3.336 + }
3.337 + }
3.338 +
3.339 + /**
3.340 + * Reads GIF image from stream
3.341 + *
3.342 + * @param BufferedInputStream containing GIF file.
3.343 + * @return read status code (0 = no errors)
3.344 + */
3.345 + private int Read( Stream inStream )
3.346 + {
3.347 + Init();
3.348 + if ( inStream != null)
3.349 + {
3.350 + this.inStream = inStream;
3.351 + ReadHeader();
3.352 + if (!Error())
3.353 + {
3.354 + ReadContents();
3.355 + if (frameCount < 0)
3.356 + {
3.357 + status = StatusFormatError;
3.358 + }
3.359 + }
3.360 + inStream.Close();
3.361 + }
3.362 + else
3.363 + {
3.364 + status = StatusOpenError;
3.365 + }
3.366 + return status;
3.367 + }
3.368 +
3.369 +
3.370 + /**
3.371 + * Decodes LZW image data into pixel array.
3.372 + * Adapted from John Cristy's ImageMagick.
3.373 + */
3.374 + private void DecodeImageData()
3.375 + {
3.376 + int NullCode = -1;
3.377 + int npix = iw * ih;
3.378 + int available,
3.379 + clear,
3.380 + code_mask,
3.381 + code_size,
3.382 + end_of_information,
3.383 + in_code,
3.384 + old_code,
3.385 + bits,
3.386 + code,
3.387 + count,
3.388 + i,
3.389 + datum,
3.390 + data_size,
3.391 + first,
3.392 + top,
3.393 + bi,
3.394 + pi;
3.395 +
3.396 + if ((pixels == null) || (pixels.Length < npix))
3.397 + {
3.398 + pixels = new byte[npix]; // allocate new pixel array
3.399 + }
3.400 + if (prefix == null) prefix = new short[MaxStackSize];
3.401 + if (suffix == null) suffix = new byte[MaxStackSize];
3.402 + if (pixelStack == null) pixelStack = new byte[MaxStackSize + 1];
3.403 +
3.404 + // Initialize GIF data stream decoder.
3.405 +
3.406 + data_size = Read();
3.407 + clear = 1 << data_size;
3.408 + end_of_information = clear + 1;
3.409 + available = clear + 2;
3.410 + old_code = NullCode;
3.411 + code_size = data_size + 1;
3.412 + code_mask = (1 << code_size) - 1;
3.413 + for (code = 0; code < clear; code++)
3.414 + {
3.415 + prefix[code] = 0;
3.416 + suffix[code] = (byte) code;
3.417 + }
3.418 +
3.419 + // Decode GIF pixel stream.
3.420 +
3.421 + datum = bits = count = first = top = pi = bi = 0;
3.422 +
3.423 + for (i = 0; i < npix;)
3.424 + {
3.425 + if (top == 0)
3.426 + {
3.427 + if (bits < code_size)
3.428 + {
3.429 + // Load bytes until there are enough bits for a code.
3.430 + if (count == 0)
3.431 + {
3.432 + // Read a new data block.
3.433 + count = ReadBlock();
3.434 + if (count <= 0)
3.435 + break;
3.436 + bi = 0;
3.437 + }
3.438 + datum += (((int) block[bi]) & 0xff) << bits;
3.439 + bits += 8;
3.440 + bi++;
3.441 + count--;
3.442 + continue;
3.443 + }
3.444 +
3.445 + // Get the next code.
3.446 +
3.447 + code = datum & code_mask;
3.448 + datum >>= code_size;
3.449 + bits -= code_size;
3.450 +
3.451 + // Interpret the code
3.452 +
3.453 + if ((code > available) || (code == end_of_information))
3.454 + break;
3.455 + if (code == clear)
3.456 + {
3.457 + // Reset decoder.
3.458 + code_size = data_size + 1;
3.459 + code_mask = (1 << code_size) - 1;
3.460 + available = clear + 2;
3.461 + old_code = NullCode;
3.462 + continue;
3.463 + }
3.464 + if (old_code == NullCode)
3.465 + {
3.466 + pixelStack[top++] = suffix[code];
3.467 + old_code = code;
3.468 + first = code;
3.469 + continue;
3.470 + }
3.471 + in_code = code;
3.472 + if (code == available)
3.473 + {
3.474 + pixelStack[top++] = (byte) first;
3.475 + code = old_code;
3.476 + }
3.477 + while (code > clear)
3.478 + {
3.479 + pixelStack[top++] = suffix[code];
3.480 + code = prefix[code];
3.481 + }
3.482 + first = ((int) suffix[code]) & 0xff;
3.483 +
3.484 + // Add a new string to the string table,
3.485 +
3.486 + if (available >= MaxStackSize)
3.487 + break;
3.488 + pixelStack[top++] = (byte) first;
3.489 + prefix[available] = (short) old_code;
3.490 + suffix[available] = (byte) first;
3.491 + available++;
3.492 + if (((available & code_mask) == 0)
3.493 + && (available < MaxStackSize))
3.494 + {
3.495 + code_size++;
3.496 + code_mask += available;
3.497 + }
3.498 + old_code = in_code;
3.499 + }
3.500 +
3.501 + // Pop a pixel off the pixel stack.
3.502 +
3.503 + top--;
3.504 + pixels[pi++] = pixelStack[top];
3.505 + i++;
3.506 + }
3.507 +
3.508 + for (i = pi; i < npix; i++)
3.509 + {
3.510 + pixels[i] = 0; // clear missing pixels
3.511 + }
3.512 +
3.513 + }
3.514 +
3.515 + /**
3.516 + * Returns true if an error was encountered during reading/decoding
3.517 + */
3.518 + private bool Error()
3.519 + {
3.520 + return status != StatusOK;
3.521 + }
3.522 +
3.523 + /**
3.524 + * Initializes or re-initializes reader
3.525 + */
3.526 + private void Init()
3.527 + {
3.528 + status = StatusOK;
3.529 + frameCount = 0;
3.530 + frames = new ArrayList();
3.531 + gct = null;
3.532 + lct = null;
3.533 + }
3.534 +
3.535 + /**
3.536 + * Reads a single byte from the input stream.
3.537 + */
3.538 + private int Read()
3.539 + {
3.540 + int curByte = 0;
3.541 + try
3.542 + {
3.543 + curByte = inStream.ReadByte();
3.544 + }
3.545 + catch (IOException)
3.546 + {
3.547 + status = StatusFormatError;
3.548 + }
3.549 + return curByte;
3.550 + }
3.551 +
3.552 + /**
3.553 + * Reads next variable length block from input.
3.554 + *
3.555 + * @return number of bytes stored in "buffer"
3.556 + */
3.557 + private int ReadBlock()
3.558 + {
3.559 + blockSize = Read();
3.560 + int n = 0;
3.561 + if (blockSize > 0)
3.562 + {
3.563 + try
3.564 + {
3.565 + int count = 0;
3.566 + while (n < blockSize)
3.567 + {
3.568 + count = inStream.Read(block, n, blockSize - n);
3.569 + if (count == -1)
3.570 + break;
3.571 + n += count;
3.572 + }
3.573 + }
3.574 + catch (IOException)
3.575 + {
3.576 + }
3.577 +
3.578 + if (n < blockSize)
3.579 + {
3.580 + status = StatusFormatError;
3.581 + }
3.582 + }
3.583 + return n;
3.584 + }
3.585 +
3.586 + /**
3.587 + * Reads color table as 256 RGB integer values
3.588 + *
3.589 + * @param ncolors int number of colors to read
3.590 + * @return int array containing 256 colors (packed ARGB with full alpha)
3.591 + */
3.592 + private int[] ReadColorTable(int ncolors)
3.593 + {
3.594 + int nbytes = 3 * ncolors;
3.595 + int[] tab = null;
3.596 + byte[] c = new byte[nbytes];
3.597 + int n = 0;
3.598 + try
3.599 + {
3.600 + n = inStream.Read(c, 0, c.Length );
3.601 + }
3.602 + catch (IOException)
3.603 + {
3.604 + }
3.605 + if (n < nbytes)
3.606 + {
3.607 + status = StatusFormatError;
3.608 + }
3.609 + else
3.610 + {
3.611 + tab = new int[256]; // max size to avoid bounds checks
3.612 + int i = 0;
3.613 + int j = 0;
3.614 + while (i < ncolors)
3.615 + {
3.616 + int r = ((int) c[j++]) & 0xff;
3.617 + int g = ((int) c[j++]) & 0xff;
3.618 + int b = ((int) c[j++]) & 0xff;
3.619 + tab[i++] = ( int ) ( 0xff000000 | (r << 16) | (g << 8) | b );
3.620 + }
3.621 + }
3.622 + return tab;
3.623 + }
3.624 +
3.625 + /**
3.626 + * Main file parser. Reads GIF content blocks.
3.627 + */
3.628 + private void ReadContents()
3.629 + {
3.630 + // read GIF file content blocks
3.631 + bool done = false;
3.632 + while (!(done || Error()))
3.633 + {
3.634 + int code = Read();
3.635 + switch (code)
3.636 + {
3.637 +
3.638 + case 0x2C : // image separator
3.639 + ReadImage();
3.640 + break;
3.641 +
3.642 + case 0x21 : // extension
3.643 + code = Read();
3.644 + switch (code)
3.645 + {
3.646 + case 0xf9 : // graphics control extension
3.647 + ReadGraphicControlExt();
3.648 + break;
3.649 +
3.650 + case 0xff : // application extension
3.651 + ReadBlock();
3.652 + String app = "";
3.653 + for (int i = 0; i < 11; i++)
3.654 + {
3.655 + app += (char) block[i];
3.656 + }
3.657 + if (app.Equals("NETSCAPE2.0"))
3.658 + {
3.659 + ReadNetscapeExt();
3.660 + }
3.661 + else
3.662 + Skip(); // don't care
3.663 + break;
3.664 +
3.665 + default : // uninteresting extension
3.666 + Skip();
3.667 + break;
3.668 + }
3.669 + break;
3.670 +
3.671 + case 0x3b : // terminator
3.672 + done = true;
3.673 + break;
3.674 +
3.675 + case 0x00 : // bad byte, but keep going and see what happens
3.676 + break;
3.677 +
3.678 + default :
3.679 + status = StatusFormatError;
3.680 + break;
3.681 + }
3.682 + }
3.683 + }
3.684 +
3.685 + /**
3.686 + * Reads Graphics Control Extension values
3.687 + */
3.688 + private void ReadGraphicControlExt()
3.689 + {
3.690 + Read(); // block size
3.691 + int packed = Read(); // packed fields
3.692 + dispose = (packed & 0x1c) >> 2; // disposal method
3.693 + if (dispose == 0)
3.694 + {
3.695 + dispose = 1; // elect to keep old image if discretionary
3.696 + }
3.697 + transparency = (packed & 1) != 0;
3.698 + delay = ReadShort() * 10; // delay in milliseconds
3.699 + transIndex = Read(); // transparent color index
3.700 + Read(); // block terminator
3.701 + }
3.702 +
3.703 + /**
3.704 + * Reads GIF file header information.
3.705 + */
3.706 + private void ReadHeader()
3.707 + {
3.708 + String id = "";
3.709 + for (int i = 0; i < 6; i++)
3.710 + {
3.711 + id += (char) Read();
3.712 + }
3.713 + if (!id.StartsWith("GIF"))
3.714 + {
3.715 + status = StatusFormatError;
3.716 + return;
3.717 + }
3.718 +
3.719 + ReadLSD();
3.720 + if (gctFlag && !Error())
3.721 + {
3.722 + gct = ReadColorTable(gctSize);
3.723 + bgColor = gct[bgIndex];
3.724 + }
3.725 + }
3.726 +
3.727 + /**
3.728 + * Reads next frame image
3.729 + */
3.730 + private void ReadImage()
3.731 + {
3.732 + ix = ReadShort(); // (sub)image position & size
3.733 + iy = ReadShort();
3.734 + iw = ReadShort();
3.735 + ih = ReadShort();
3.736 +
3.737 + int packed = Read();
3.738 + lctFlag = (packed & 0x80) != 0; // 1 - local color table flag
3.739 + interlace = (packed & 0x40) != 0; // 2 - interlace flag
3.740 + // 3 - sort flag
3.741 + // 4-5 - reserved
3.742 + lctSize = 2 << (packed & 7); // 6-8 - local color table size
3.743 +
3.744 + if (lctFlag)
3.745 + {
3.746 + lct = ReadColorTable(lctSize); // read table
3.747 + act = lct; // make local table active
3.748 + }
3.749 + else
3.750 + {
3.751 + act = gct; // make global table active
3.752 + if (bgIndex == transIndex)
3.753 + bgColor = 0;
3.754 + }
3.755 + int save = 0;
3.756 + if (transparency)
3.757 + {
3.758 + save = act[transIndex];
3.759 + act[transIndex] = 0; // set transparent color if specified
3.760 + }
3.761 +
3.762 + if (act == null)
3.763 + {
3.764 + status = StatusFormatError; // no color table defined
3.765 + }
3.766 +
3.767 + if (Error()) return;
3.768 +
3.769 + DecodeImageData(); // decode pixel data
3.770 + Skip();
3.771 +
3.772 + if (Error()) return;
3.773 +
3.774 + frameCount++;
3.775 +
3.776 + // create new image to receive frame data
3.777 + // image =
3.778 + // new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB_PRE);
3.779 +
3.780 + bitmap = new Bitmap( width, height );
3.781 + image = bitmap;
3.782 + SetPixels(); // transfer pixel data to image
3.783 +
3.784 + frames.Add(new GifFrame(bitmap, delay)); // add image to frame list
3.785 +
3.786 + if (transparency)
3.787 + {
3.788 + act[transIndex] = save;
3.789 + }
3.790 + ResetFrame();
3.791 +
3.792 + }
3.793 +
3.794 + /**
3.795 + * Reads Logical Screen Descriptor
3.796 + */
3.797 + private void ReadLSD()
3.798 + {
3.799 +
3.800 + // logical screen size
3.801 + width = ReadShort();
3.802 + height = ReadShort();
3.803 +
3.804 + // packed fields
3.805 + int packed = Read();
3.806 + gctFlag = (packed & 0x80) != 0; // 1 : global color table flag
3.807 + // 2-4 : color resolution
3.808 + // 5 : gct sort flag
3.809 + gctSize = 2 << (packed & 7); // 6-8 : gct size
3.810 +
3.811 + bgIndex = Read(); // background color index
3.812 + pixelAspect = Read(); // pixel aspect ratio
3.813 + }
3.814 +
3.815 + /**
3.816 + * Reads Netscape extenstion to obtain iteration count
3.817 + */
3.818 + private void ReadNetscapeExt()
3.819 + {
3.820 + do
3.821 + {
3.822 + ReadBlock();
3.823 + if (block[0] == 1)
3.824 + {
3.825 + // loop count sub-block
3.826 + int b1 = ((int) block[1]) & 0xff;
3.827 + int b2 = ((int) block[2]) & 0xff;
3.828 + loopCount = (b2 << 8) | b1;
3.829 + }
3.830 + } while ((blockSize > 0) && !Error());
3.831 + }
3.832 +
3.833 + /**
3.834 + * Reads next 16-bit value, LSB first
3.835 + */
3.836 + private int ReadShort()
3.837 + {
3.838 + // read 16-bit value, LSB first
3.839 + return Read() | (Read() << 8);
3.840 + }
3.841 +
3.842 + /**
3.843 + * Resets frame state for reading next image.
3.844 + */
3.845 + private void ResetFrame()
3.846 + {
3.847 + lastDispose = dispose;
3.848 + lastRect = new Rectangle(ix, iy, iw, ih);
3.849 + lastImage = image;
3.850 + lastBgColor = bgColor;
3.851 + // int dispose = 0;
3.852 + lct = null;
3.853 + }
3.854 +
3.855 + /**
3.856 + * Skips variable length blocks up to and including
3.857 + * next zero length block.
3.858 + */
3.859 + private void Skip()
3.860 + {
3.861 + do
3.862 + {
3.863 + ReadBlock();
3.864 + } while ((blockSize > 0) && !Error());
3.865 + }
3.866 + }
3.867 +}
4.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
4.2 +++ b/External/Aga.Controls/NumericTextBox.cs Sun May 27 15:16:19 2012 +0000
4.3 @@ -0,0 +1,189 @@
4.4 +using System;
4.5 +using System.ComponentModel;
4.6 +using System.Windows.Forms;
4.7 +using System.Globalization;
4.8 +
4.9 +
4.10 +namespace Aga.Controls
4.11 +{
4.12 + /// <summary>
4.13 + /// Restricts the entry of characters to digits, the negative sign,
4.14 + /// the decimal point, and editing keystrokes (backspace).
4.15 + /// It does not handle the AltGr key so any keys that can be created in any
4.16 + /// combination with AltGr these are not filtered
4.17 + /// </summary>
4.18 + public class NumericTextBox : TextBox
4.19 + {
4.20 + private const int WM_PASTE = 0x302;
4.21 + private NumberStyles numberStyle = NumberStyles.AllowDecimalPoint | NumberStyles.AllowLeadingSign;
4.22 +
4.23 + /// <summary>
4.24 + /// Restricts the entry of characters to digits, the negative sign,
4.25 + /// the decimal point, and editing keystrokes (backspace).
4.26 + /// It does not handle the AltGr key
4.27 + /// </summary>
4.28 + /// <param name="e"></param>
4.29 + protected override void OnKeyPress(KeyPressEventArgs e)
4.30 + {
4.31 + base.OnKeyPress(e);
4.32 +
4.33 + e.Handled = invalidNumeric(e.KeyChar);
4.34 + }
4.35 +
4.36 +
4.37 + /// <summary>
4.38 + /// Main method for verifying allowed keypresses.
4.39 + /// This does not catch cut paste copy ... operations.
4.40 + /// </summary>
4.41 + /// <param name="key"></param>
4.42 + /// <returns></returns>
4.43 + private bool invalidNumeric(char key)
4.44 + {
4.45 + bool handled = false;
4.46 +
4.47 + NumberFormatInfo numberFormatInfo = CultureInfo.CurrentCulture.NumberFormat;
4.48 + string decimalSeparator = numberFormatInfo.NumberDecimalSeparator;
4.49 + string negativeSign = numberFormatInfo.NegativeSign;
4.50 +
4.51 + string keyString = key.ToString();
4.52 +
4.53 + if (Char.IsDigit(key))
4.54 + {
4.55 + // Digits are OK
4.56 + }
4.57 + else if (AllowDecimalSeparator && keyString.Equals(decimalSeparator))
4.58 + {
4.59 + if (Text.IndexOf(decimalSeparator) >= 0)
4.60 + {
4.61 + handled = true;
4.62 + }
4.63 + }
4.64 + else if (AllowNegativeSign && keyString.Equals(negativeSign))
4.65 + {
4.66 + if (Text.IndexOf(negativeSign) >= 0)
4.67 + {
4.68 + handled = true;
4.69 + }
4.70 + }
4.71 + else if (key == '\b')
4.72 + {
4.73 + // Backspace key is OK
4.74 + }
4.75 + else if ((ModifierKeys & (Keys.Control)) != 0)
4.76 + {
4.77 + // Let the edit control handle control and alt key combinations
4.78 + }
4.79 + else
4.80 + {
4.81 + // Swallow this invalid key and beep
4.82 + handled = true;
4.83 + }
4.84 + return handled;
4.85 + }
4.86 +
4.87 +
4.88 + /// <summary>
4.89 + /// Method invoked when Windows sends a message.
4.90 + /// </summary>
4.91 + /// <param name="m">Message from Windows.</param>
4.92 + /// <remarks>
4.93 + /// This is over-ridden so that the user can not use
4.94 + /// cut or paste operations to bypass the TextChanging event.
4.95 + /// This catches ContextMenu Paste, Shift+Insert, Ctrl+V,
4.96 + /// While it is generally frowned upon to override WndProc, no
4.97 + /// other simple mechanism was apparent to simultaneously and
4.98 + /// transparently intercept so many different operations.
4.99 + /// </remarks>
4.100 + protected override void WndProc(ref Message m)
4.101 + {
4.102 + // Switch to handle message...
4.103 + switch (m.Msg)
4.104 + {
4.105 + case WM_PASTE:
4.106 + {
4.107 + // Get clipboard object to paste
4.108 + IDataObject clipboardData = Clipboard.GetDataObject();
4.109 +
4.110 + // Get text from clipboard data
4.111 + string pasteText = (string)clipboardData.GetData(
4.112 + DataFormats.UnicodeText);
4.113 +
4.114 + // Get the number of characters to replace
4.115 + int selectionLength = SelectionLength;
4.116 +
4.117 + // If no replacement or insertion, we are done
4.118 + if (pasteText.Length == 0)
4.119 + {
4.120 + break;
4.121 + }
4.122 + else if (selectionLength != 0)
4.123 + {
4.124 + base.Text = base.Text.Remove(SelectionStart, selectionLength);
4.125 + }
4.126 +
4.127 + bool containsInvalidChars = false;
4.128 + foreach (char c in pasteText)
4.129 + {
4.130 + if (containsInvalidChars)
4.131 + {
4.132 + break;
4.133 + }
4.134 + else if (invalidNumeric(c))
4.135 + {
4.136 + containsInvalidChars = true;
4.137 + }
4.138 + }
4.139 +
4.140 + if (!containsInvalidChars)
4.141 + {
4.142 + base.Text = base.Text.Insert(SelectionStart, pasteText);
4.143 + }
4.144 +
4.145 + return;
4.146 + }
4.147 +
4.148 + }
4.149 + base.WndProc(ref m);
4.150 + }
4.151 +
4.152 +
4.153 + public int IntValue
4.154 + {
4.155 + get
4.156 + {
4.157 + int intValue;
4.158 + Int32.TryParse(this.Text, numberStyle, CultureInfo.CurrentCulture.NumberFormat, out intValue);
4.159 + return intValue;
4.160 + }
4.161 + }
4.162 +
4.163 + public decimal DecimalValue
4.164 + {
4.165 + get
4.166 + {
4.167 + decimal decimalValue;
4.168 + Decimal.TryParse(this.Text, numberStyle, CultureInfo.CurrentCulture.NumberFormat, out decimalValue);
4.169 + return decimalValue;
4.170 + }
4.171 + }
4.172 +
4.173 +
4.174 + private bool allowNegativeSign;
4.175 + [DefaultValue(true)]
4.176 + public bool AllowNegativeSign
4.177 + {
4.178 + get { return allowNegativeSign; }
4.179 + set { allowNegativeSign = value; }
4.180 + }
4.181 +
4.182 + private bool allowDecimalSeparator;
4.183 + [DefaultValue(true)]
4.184 + public bool AllowDecimalSeparator
4.185 + {
4.186 + get { return allowDecimalSeparator; }
4.187 + set { allowDecimalSeparator = value; }
4.188 + }
4.189 +
4.190 + }
4.191 +
4.192 +}
5.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
5.2 +++ b/External/Aga.Controls/PerformanceAnalyzer.cs Sun May 27 15:16:19 2012 +0000
5.3 @@ -0,0 +1,136 @@
5.4 +using System;
5.5 +using System.Collections.Generic;
5.6 +using System.Text;
5.7 +using System.Diagnostics;
5.8 +
5.9 +namespace Aga.Controls
5.10 +{
5.11 + /// <summary>
5.12 + /// Is used to analyze code performance
5.13 + /// </summary>
5.14 + public static class PerformanceAnalyzer
5.15 + {
5.16 + public class PerformanceInfo
5.17 + {
5.18 + private string _name;
5.19 + public string Name
5.20 + {
5.21 + get { return _name; }
5.22 + }
5.23 +
5.24 + private int _count = 0;
5.25 + public int Count
5.26 + {
5.27 + get { return _count; }
5.28 + set { _count = value; }
5.29 + }
5.30 +
5.31 + private double _totalTime = 0;
5.32 + public double TotalTime
5.33 + {
5.34 + get { return _totalTime; }
5.35 + set { _totalTime = value; }
5.36 + }
5.37 +
5.38 + private Int64 _start;
5.39 + public Int64 Start
5.40 + {
5.41 + get { return _start; }
5.42 + set { _start = value; }
5.43 + }
5.44 +
5.45 + public PerformanceInfo(string name)
5.46 + {
5.47 + _name = name;
5.48 + }
5.49 + }
5.50 +
5.51 + private static Dictionary<string, PerformanceInfo> _performances = new Dictionary<string, PerformanceInfo>();
5.52 +
5.53 + public static IEnumerable<PerformanceInfo> Performances
5.54 + {
5.55 + get
5.56 + {
5.57 + return _performances.Values;
5.58 + }
5.59 + }
5.60 +
5.61 + [Conditional("DEBUG")]
5.62 + public static void Start(string pieceOfCode)
5.63 + {
5.64 + PerformanceInfo info = null;
5.65 + lock(_performances)
5.66 + {
5.67 + if (_performances.ContainsKey(pieceOfCode))
5.68 + info = _performances[pieceOfCode];
5.69 + else
5.70 + {
5.71 + info = new PerformanceInfo(pieceOfCode);
5.72 + _performances.Add(pieceOfCode, info);
5.73 + }
5.74 +
5.75 + info.Count++;
5.76 + info.Start = TimeCounter.GetStartValue();
5.77 + }
5.78 + }
5.79 +
5.80 + [Conditional("DEBUG")]
5.81 + public static void Finish(string pieceOfCode)
5.82 + {
5.83 + lock (_performances)
5.84 + {
5.85 + if (_performances.ContainsKey(pieceOfCode))
5.86 + {
5.87 + PerformanceInfo info = _performances[pieceOfCode];
5.88 + info.Count++;
5.89 + info.TotalTime += TimeCounter.Finish(info.Start);
5.90 + }
5.91 + }
5.92 + }
5.93 +
5.94 + public static void Reset()
5.95 + {
5.96 + _performances.Clear();
5.97 + }
5.98 +
5.99 + public static string GenerateReport()
5.100 + {
5.101 + return GenerateReport(0);
5.102 + }
5.103 +
5.104 + public static string GenerateReport(string mainPieceOfCode)
5.105 + {
5.106 + if (_performances.ContainsKey(mainPieceOfCode))
5.107 + return GenerateReport(_performances[mainPieceOfCode].TotalTime);
5.108 + else
5.109 + return GenerateReport(0);
5.110 + }
5.111 +
5.112 + public static string GenerateReport(double totalTime)
5.113 + {
5.114 + StringBuilder sb = new StringBuilder();
5.115 + int len = 0;
5.116 + foreach (PerformanceInfo info in Performances)
5.117 + len = Math.Max(info.Name.Length, len);
5.118 +
5.119 + sb.AppendLine("Name".PadRight(len) + " Count Total Time, ms Avg. Time, ms Percentage, %");
5.120 + sb.AppendLine("----------------------------------------------------------------------------------------------");
5.121 + foreach (PerformanceInfo info in Performances)
5.122 + {
5.123 + sb.Append(info.Name.PadRight(len));
5.124 + double p = 0;
5.125 + double avgt = 0;
5.126 + if (totalTime != 0)
5.127 + p = info.TotalTime / totalTime;
5.128 + if (info.Count > 0)
5.129 + avgt = info.TotalTime * 1000 / info.Count;
5.130 + string c = info.Count.ToString("0,0").PadRight(20);
5.131 + string tt = (info.TotalTime * 1000).ToString("0,0.00").PadRight(20);
5.132 + string t = avgt.ToString("0.0000").PadRight(20);
5.133 + string sp = (p * 100).ToString("###").PadRight(20);
5.134 + sb.AppendFormat(" " + c + tt + t + sp + "\n");
5.135 + }
5.136 + return sb.ToString();
5.137 + }
5.138 + }
5.139 +}
6.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
6.2 +++ b/External/Aga.Controls/Properties/AssemblyInfo.cs Sun May 27 15:16:19 2012 +0000
6.3 @@ -0,0 +1,15 @@
6.4 +using System.Reflection;
6.5 +using System.Runtime.CompilerServices;
6.6 +using System.Runtime.InteropServices;
6.7 +using System;
6.8 +using System.Security.Permissions;
6.9 +
6.10 +[assembly: ComVisible(false)]
6.11 +[assembly: CLSCompliant(false)]
6.12 +[assembly: SecurityPermission(SecurityAction.RequestMinimum, Execution = true)]
6.13 +
6.14 +[assembly: AssemblyTitle("Aga.Controls")]
6.15 +[assembly: AssemblyCopyright("Copyright © Andrey Gliznetsov 2006 - 2009")]
6.16 +[assembly: AssemblyDescription("http://sourceforge.net/projects/treeviewadv/")]
6.17 +
6.18 +[assembly: AssemblyVersion("1.7.0.0")]
7.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
7.2 +++ b/External/Aga.Controls/Properties/Resources.Designer.cs Sun May 27 15:16:19 2012 +0000
7.3 @@ -0,0 +1,133 @@
7.4 +//------------------------------------------------------------------------------
7.5 +// <auto-generated>
7.6 +// This code was generated by a tool.
7.7 +// Runtime Version:2.0.50727.3053
7.8 +//
7.9 +// Changes to this file may cause incorrect behavior and will be lost if
7.10 +// the code is regenerated.
7.11 +// </auto-generated>
7.12 +//------------------------------------------------------------------------------
7.13 +
7.14 +namespace Aga.Controls.Properties {
7.15 + using System;
7.16 +
7.17 +
7.18 + /// <summary>
7.19 + /// A strongly-typed resource class, for looking up localized strings, etc.
7.20 + /// </summary>
7.21 + // This class was auto-generated by the StronglyTypedResourceBuilder
7.22 + // class via a tool like ResGen or Visual Studio.
7.23 + // To add or remove a member, edit your .ResX file then rerun ResGen
7.24 + // with the /str option, or rebuild your VS project.
7.25 + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "2.0.0.0")]
7.26 + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
7.27 + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
7.28 + internal class Resources {
7.29 +
7.30 + private static global::System.Resources.ResourceManager resourceMan;
7.31 +
7.32 + private static global::System.Globalization.CultureInfo resourceCulture;
7.33 +
7.34 + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
7.35 + internal Resources() {
7.36 + }
7.37 +
7.38 + /// <summary>
7.39 + /// Returns the cached ResourceManager instance used by this class.
7.40 + /// </summary>
7.41 + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
7.42 + internal static global::System.Resources.ResourceManager ResourceManager {
7.43 + get {
7.44 + if (object.ReferenceEquals(resourceMan, null)) {
7.45 + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Aga.Controls.Properties.Resources", typeof(Resources).Assembly);
7.46 + resourceMan = temp;
7.47 + }
7.48 + return resourceMan;
7.49 + }
7.50 + }
7.51 +
7.52 + /// <summary>
7.53 + /// Overrides the current thread's CurrentUICulture property for all
7.54 + /// resource lookups using this strongly typed resource class.
7.55 + /// </summary>
7.56 + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
7.57 + internal static global::System.Globalization.CultureInfo Culture {
7.58 + get {
7.59 + return resourceCulture;
7.60 + }
7.61 + set {
7.62 + resourceCulture = value;
7.63 + }
7.64 + }
7.65 +
7.66 + internal static System.Drawing.Bitmap check {
7.67 + get {
7.68 + object obj = ResourceManager.GetObject("check", resourceCulture);
7.69 + return ((System.Drawing.Bitmap)(obj));
7.70 + }
7.71 + }
7.72 +
7.73 + internal static byte[] DVSplit {
7.74 + get {
7.75 + object obj = ResourceManager.GetObject("DVSplit", resourceCulture);
7.76 + return ((byte[])(obj));
7.77 + }
7.78 + }
7.79 +
7.80 + internal static System.Drawing.Bitmap Folder {
7.81 + get {
7.82 + object obj = ResourceManager.GetObject("Folder", resourceCulture);
7.83 + return ((System.Drawing.Bitmap)(obj));
7.84 + }
7.85 + }
7.86 +
7.87 + internal static System.Drawing.Bitmap FolderClosed {
7.88 + get {
7.89 + object obj = ResourceManager.GetObject("FolderClosed", resourceCulture);
7.90 + return ((System.Drawing.Bitmap)(obj));
7.91 + }
7.92 + }
7.93 +
7.94 + internal static System.Drawing.Bitmap Leaf {
7.95 + get {
7.96 + object obj = ResourceManager.GetObject("Leaf", resourceCulture);
7.97 + return ((System.Drawing.Bitmap)(obj));
7.98 + }
7.99 + }
7.100 +
7.101 + internal static byte[] loading_icon {
7.102 + get {
7.103 + object obj = ResourceManager.GetObject("loading_icon", resourceCulture);
7.104 + return ((byte[])(obj));
7.105 + }
7.106 + }
7.107 +
7.108 + internal static System.Drawing.Bitmap minus {
7.109 + get {
7.110 + object obj = ResourceManager.GetObject("minus", resourceCulture);
7.111 + return ((System.Drawing.Bitmap)(obj));
7.112 + }
7.113 + }
7.114 +
7.115 + internal static System.Drawing.Bitmap plus {
7.116 + get {
7.117 + object obj = ResourceManager.GetObject("plus", resourceCulture);
7.118 + return ((System.Drawing.Bitmap)(obj));
7.119 + }
7.120 + }
7.121 +
7.122 + internal static System.Drawing.Bitmap uncheck {
7.123 + get {
7.124 + object obj = ResourceManager.GetObject("uncheck", resourceCulture);
7.125 + return ((System.Drawing.Bitmap)(obj));
7.126 + }
7.127 + }
7.128 +
7.129 + internal static System.Drawing.Bitmap unknown {
7.130 + get {
7.131 + object obj = ResourceManager.GetObject("unknown", resourceCulture);
7.132 + return ((System.Drawing.Bitmap)(obj));
7.133 + }
7.134 + }
7.135 + }
7.136 +}
8.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
8.2 +++ b/External/Aga.Controls/Properties/Resources.resx Sun May 27 15:16:19 2012 +0000
8.3 @@ -0,0 +1,151 @@
8.4 +<?xml version="1.0" encoding="utf-8"?>
8.5 +<root>
8.6 + <!--
8.7 + Microsoft ResX Schema
8.8 +
8.9 + Version 2.0
8.10 +
8.11 + The primary goals of this format is to allow a simple XML format
8.12 + that is mostly human readable. The generation and parsing of the
8.13 + various data types are done through the TypeConverter classes
8.14 + associated with the data types.
8.15 +
8.16 + Example:
8.17 +
8.18 + ... ado.net/XML headers & schema ...
8.19 + <resheader name="resmimetype">text/microsoft-resx</resheader>
8.20 + <resheader name="version">2.0</resheader>
8.21 + <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
8.22 + <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
8.23 + <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
8.24 + <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
8.25 + <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
8.26 + <value>[base64 mime encoded serialized .NET Framework object]</value>
8.27 + </data>
8.28 + <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
8.29 + <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
8.30 + <comment>This is a comment</comment>
8.31 + </data>
8.32 +
8.33 + There are any number of "resheader" rows that contain simple
8.34 + name/value pairs.
8.35 +
8.36 + Each data row contains a name, and value. The row also contains a
8.37 + type or mimetype. Type corresponds to a .NET class that support
8.38 + text/value conversion through the TypeConverter architecture.
8.39 + Classes that don't support this are serialized and stored with the
8.40 + mimetype set.
8.41 +
8.42 + The mimetype is used for serialized objects, and tells the
8.43 + ResXResourceReader how to depersist the object. This is currently not
8.44 + extensible. For a given mimetype the value must be set accordingly:
8.45 +
8.46 + Note - application/x-microsoft.net.object.binary.base64 is the format
8.47 + that the ResXResourceWriter will generate, however the reader can
8.48 + read any of the formats listed below.
8.49 +
8.50 + mimetype: application/x-microsoft.net.object.binary.base64
8.51 + value : The object must be serialized with
8.52 + : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
8.53 + : and then encoded with base64 encoding.
8.54 +
8.55 + mimetype: application/x-microsoft.net.object.soap.base64
8.56 + value : The object must be serialized with
8.57 + : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
8.58 + : and then encoded with base64 encoding.
8.59 +
8.60 + mimetype: application/x-microsoft.net.object.bytearray.base64
8.61 + value : The object must be serialized into a byte array
8.62 + : using a System.ComponentModel.TypeConverter
8.63 + : and then encoded with base64 encoding.
8.64 + -->
8.65 + <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
8.66 + <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
8.67 + <xsd:element name="root" msdata:IsDataSet="true">
8.68 + <xsd:complexType>
8.69 + <xsd:choice maxOccurs="unbounded">
8.70 + <xsd:element name="metadata">
8.71 + <xsd:complexType>
8.72 + <xsd:sequence>
8.73 + <xsd:element name="value" type="xsd:string" minOccurs="0" />
8.74 + </xsd:sequence>
8.75 + <xsd:attribute name="name" use="required" type="xsd:string" />
8.76 + <xsd:attribute name="type" type="xsd:string" />
8.77 + <xsd:attribute name="mimetype" type="xsd:string" />
8.78 + <xsd:attribute ref="xml:space" />
8.79 + </xsd:complexType>
8.80 + </xsd:element>
8.81 + <xsd:element name="assembly">
8.82 + <xsd:complexType>
8.83 + <xsd:attribute name="alias" type="xsd:string" />
8.84 + <xsd:attribute name="name" type="xsd:string" />
8.85 + </xsd:complexType>
8.86 + </xsd:element>
8.87 + <xsd:element name="data">
8.88 + <xsd:complexType>
8.89 + <xsd:sequence>
8.90 + <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
8.91 + <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
8.92 + </xsd:sequence>
8.93 + <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
8.94 + <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
8.95 + <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
8.96 + <xsd:attribute ref="xml:space" />
8.97 + </xsd:complexType>
8.98 + </xsd:element>
8.99 + <xsd:element name="resheader">
8.100 + <xsd:complexType>
8.101 + <xsd:sequence>
8.102 + <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
8.103 + </xsd:sequence>
8.104 + <xsd:attribute name="name" type="xsd:string" use="required" />
8.105 + </xsd:complexType>
8.106 + </xsd:element>
8.107 + </xsd:choice>
8.108 + </xsd:complexType>
8.109 + </xsd:element>
8.110 + </xsd:schema>
8.111 + <resheader name="resmimetype">
8.112 + <value>text/microsoft-resx</value>
8.113 + </resheader>
8.114 + <resheader name="version">
8.115 + <value>2.0</value>
8.116 + </resheader>
8.117 + <resheader name="reader">
8.118 + <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
8.119 + </resheader>
8.120 + <resheader name="writer">
8.121 + <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
8.122 + </resheader>
8.123 + <assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
8.124 + <data name="check" type="System.Resources.ResXFileRef, System.Windows.Forms">
8.125 + <value>..\Resources\check.bmp;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
8.126 + </data>
8.127 + <data name="DVSplit" type="System.Resources.ResXFileRef, System.Windows.Forms">
8.128 + <value>..\resources\dvsplit.cur;System.Byte[], mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
8.129 + </data>
8.130 + <data name="Folder" type="System.Resources.ResXFileRef, System.Windows.Forms">
8.131 + <value>..\Resources\Folder.bmp;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
8.132 + </data>
8.133 + <data name="FolderClosed" type="System.Resources.ResXFileRef, System.Windows.Forms">
8.134 + <value>..\Resources\FolderClosed.bmp;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
8.135 + </data>
8.136 + <data name="Leaf" type="System.Resources.ResXFileRef, System.Windows.Forms">
8.137 + <value>..\resources\leaf.bmp;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
8.138 + </data>
8.139 + <data name="loading_icon" type="System.Resources.ResXFileRef, System.Windows.Forms">
8.140 + <value>..\Resources\loading_icon;System.Byte[], mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
8.141 + </data>
8.142 + <data name="minus" type="System.Resources.ResXFileRef, System.Windows.Forms">
8.143 + <value>..\Resources\minus.bmp;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
8.144 + </data>
8.145 + <data name="plus" type="System.Resources.ResXFileRef, System.Windows.Forms">
8.146 + <value>..\Resources\plus.bmp;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
8.147 + </data>
8.148 + <data name="uncheck" type="System.Resources.ResXFileRef, System.Windows.Forms">
8.149 + <value>..\Resources\uncheck.bmp;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
8.150 + </data>
8.151 + <data name="unknown" type="System.Resources.ResXFileRef, System.Windows.Forms">
8.152 + <value>..\resources\unknown.bmp;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
8.153 + </data>
8.154 +</root>
8.155 \ No newline at end of file
9.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
9.2 +++ b/External/Aga.Controls/ResourceHelper.cs Sun May 27 15:16:19 2012 +0000
9.3 @@ -0,0 +1,48 @@
9.4 +using System;
9.5 +using System.IO;
9.6 +using System.Reflection;
9.7 +using System.Windows.Forms;
9.8 +using System.Collections.Generic;
9.9 +using System.Text;
9.10 +
9.11 +namespace Aga.Controls
9.12 +{
9.13 + public static class ResourceHelper
9.14 + {
9.15 + // VSpilt Cursor with Innerline (symbolisize hidden column)
9.16 + private static Cursor _dVSplitCursor = GetCursor(Properties.Resources.DVSplit);
9.17 + public static Cursor DVSplitCursor
9.18 + {
9.19 + get { return _dVSplitCursor; }
9.20 + }
9.21 +
9.22 + private static GifDecoder _loadingIcon = GetGifDecoder(Properties.Resources.loading_icon);
9.23 + public static GifDecoder LoadingIcon
9.24 + {
9.25 + get { return _loadingIcon; }
9.26 + }
9.27 +
9.28 + /// <summary>
9.29 + /// Help function to convert byte[] from resource into Cursor Type
9.30 + /// </summary>
9.31 + /// <param name="data"></param>
9.32 + /// <returns></returns>
9.33 + private static Cursor GetCursor(byte[] data)
9.34 + {
9.35 + using (MemoryStream s = new MemoryStream(data))
9.36 + return new Cursor(s);
9.37 + }
9.38 +
9.39 + /// <summary>
9.40 + /// Help function to convert byte[] from resource into GifDecoder Type
9.41 + /// </summary>
9.42 + /// <param name="data"></param>
9.43 + /// <returns></returns>
9.44 + private static GifDecoder GetGifDecoder(byte[] data)
9.45 + {
9.46 + using(MemoryStream ms = new MemoryStream(data))
9.47 + return new GifDecoder(ms, true);
9.48 + }
9.49 +
9.50 + }
9.51 +}
10.1 Binary file External/Aga.Controls/Resources/DVSplit.cur has changed
11.1 Binary file External/Aga.Controls/Resources/Folder.bmp has changed
12.1 Binary file External/Aga.Controls/Resources/FolderClosed.bmp has changed
13.1 Binary file External/Aga.Controls/Resources/Leaf.bmp has changed
14.1 Binary file External/Aga.Controls/Resources/check.bmp has changed
15.1 Binary file External/Aga.Controls/Resources/loading_icon has changed
16.1 Binary file External/Aga.Controls/Resources/minus.bmp has changed
17.1 Binary file External/Aga.Controls/Resources/plus.bmp has changed
18.1 Binary file External/Aga.Controls/Resources/uncheck.bmp has changed
19.1 Binary file External/Aga.Controls/Resources/unknown.bmp has changed
20.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
20.2 +++ b/External/Aga.Controls/StringCollectionEditor.cs Sun May 27 15:16:19 2012 +0000
20.3 @@ -0,0 +1,24 @@
20.4 +using System;
20.5 +using System.Collections.Generic;
20.6 +using System.Text;
20.7 +using System.ComponentModel.Design;
20.8 +
20.9 +namespace Aga.Controls
20.10 +{
20.11 + public class StringCollectionEditor : CollectionEditor
20.12 + {
20.13 + public StringCollectionEditor(Type type): base(type)
20.14 + {
20.15 + }
20.16 +
20.17 + protected override Type CreateCollectionItemType()
20.18 + {
20.19 + return typeof(string);
20.20 + }
20.21 +
20.22 + protected override object CreateInstance(Type itemType)
20.23 + {
20.24 + return "";
20.25 + }
20.26 + }
20.27 +}
21.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
21.2 +++ b/External/Aga.Controls/TextHelper.cs Sun May 27 15:16:19 2012 +0000
21.3 @@ -0,0 +1,45 @@
21.4 +using System;
21.5 +using System.Collections.Generic;
21.6 +using System.Text;
21.7 +using System.Windows.Forms;
21.8 +using System.Drawing;
21.9 +
21.10 +namespace Aga.Controls
21.11 +{
21.12 + public static class TextHelper
21.13 + {
21.14 + public static StringAlignment TranslateAligment(HorizontalAlignment alignment)
21.15 + {
21.16 + if (alignment == HorizontalAlignment.Left)
21.17 + return StringAlignment.Near;
21.18 + else if (alignment == HorizontalAlignment.Right)
21.19 + return StringAlignment.Far;
21.20 + else
21.21 + return StringAlignment.Center;
21.22 + }
21.23 +
21.24 + public static TextFormatFlags TranslateAligmentToFlag(HorizontalAlignment alignment)
21.25 + {
21.26 + if (alignment == HorizontalAlignment.Left)
21.27 + return TextFormatFlags.Left;
21.28 + else if (alignment == HorizontalAlignment.Right)
21.29 + return TextFormatFlags.Right;
21.30 + else
21.31 + return TextFormatFlags.HorizontalCenter;
21.32 + }
21.33 +
21.34 + public static TextFormatFlags TranslateTrimmingToFlag(StringTrimming trimming)
21.35 + {
21.36 + if (trimming == StringTrimming.EllipsisCharacter)
21.37 + return TextFormatFlags.EndEllipsis;
21.38 + else if (trimming == StringTrimming.EllipsisPath)
21.39 + return TextFormatFlags.PathEllipsis;
21.40 + if (trimming == StringTrimming.EllipsisWord)
21.41 + return TextFormatFlags.WordEllipsis;
21.42 + if (trimming == StringTrimming.Word)
21.43 + return TextFormatFlags.WordBreak;
21.44 + else
21.45 + return TextFormatFlags.Default;
21.46 + }
21.47 + }
21.48 +}
22.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
22.2 +++ b/External/Aga.Controls/Threading/AbortableThreadPool.cs Sun May 27 15:16:19 2012 +0000
22.3 @@ -0,0 +1,118 @@
22.4 +// Stephen Toub
22.5 +// stoub@microsoft.com
22.6 +
22.7 +using System;
22.8 +using System.Collections.Generic;
22.9 +using System.Text;
22.10 +using System.Threading;
22.11 +
22.12 +namespace Aga.Controls.Threading
22.13 +{
22.14 + public class AbortableThreadPool
22.15 + {
22.16 + private LinkedList<WorkItem> _callbacks = new LinkedList<WorkItem>();
22.17 + private Dictionary<WorkItem, Thread> _threads = new Dictionary<WorkItem, Thread>();
22.18 +
22.19 + public WorkItem QueueUserWorkItem(WaitCallback callback)
22.20 + {
22.21 + return QueueUserWorkItem(callback, null);
22.22 + }
22.23 +
22.24 + public WorkItem QueueUserWorkItem(WaitCallback callback, object state)
22.25 + {
22.26 + if (callback == null) throw new ArgumentNullException("callback");
22.27 +
22.28 + WorkItem item = new WorkItem(callback, state, ExecutionContext.Capture());
22.29 + lock (_callbacks)
22.30 + {
22.31 + _callbacks.AddLast(item);
22.32 + }
22.33 + ThreadPool.QueueUserWorkItem(new WaitCallback(HandleItem));
22.34 + return item;
22.35 + }
22.36 +
22.37 + private void HandleItem(object ignored)
22.38 + {
22.39 + WorkItem item = null;
22.40 + try
22.41 + {
22.42 + lock (_callbacks)
22.43 + {
22.44 + if (_callbacks.Count > 0)
22.45 + {
22.46 + item = _callbacks.First.Value;
22.47 + _callbacks.RemoveFirst();
22.48 + }
22.49 + if (item == null)
22.50 + return;
22.51 + _threads.Add(item, Thread.CurrentThread);
22.52 +
22.53 + }
22.54 + ExecutionContext.Run(item.Context,
22.55 + delegate { item.Callback(item.State); }, null);
22.56 + }
22.57 + finally
22.58 + {
22.59 + lock (_callbacks)
22.60 + {
22.61 + if (item != null)
22.62 + _threads.Remove(item);
22.63 + }
22.64 + }
22.65 + }
22.66 +
22.67 + public bool IsMyThread(Thread thread)
22.68 + {
22.69 + lock (_callbacks)
22.70 + {
22.71 + foreach (Thread t in _threads.Values)
22.72 + {
22.73 + if (t == thread)
22.74 + return true;
22.75 + }
22.76 + return false;
22.77 + }
22.78 + }
22.79 +
22.80 + public WorkItemStatus Cancel(WorkItem item, bool allowAbort)
22.81 + {
22.82 + if (item == null)
22.83 + throw new ArgumentNullException("item");
22.84 + lock (_callbacks)
22.85 + {
22.86 + LinkedListNode<WorkItem> node = _callbacks.Find(item);
22.87 + if (node != null)
22.88 + {
22.89 + _callbacks.Remove(node);
22.90 + return WorkItemStatus.Queued;
22.91 + }
22.92 + else if (_threads.ContainsKey(item))
22.93 + {
22.94 + if (allowAbort)
22.95 + {
22.96 + _threads[item].Abort();
22.97 + _threads.Remove(item);
22.98 + return WorkItemStatus.Aborted;
22.99 + }
22.100 + else
22.101 + return WorkItemStatus.Executing;
22.102 + }
22.103 + else
22.104 + return WorkItemStatus.Completed;
22.105 + }
22.106 + }
22.107 +
22.108 + public void CancelAll(bool allowAbort)
22.109 + {
22.110 + lock (_callbacks)
22.111 + {
22.112 + _callbacks.Clear();
22.113 + if (allowAbort)
22.114 + {
22.115 + foreach (Thread t in _threads.Values)
22.116 + t.Abort();
22.117 + }
22.118 + }
22.119 + }
22.120 + }
22.121 +}
23.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
23.2 +++ b/External/Aga.Controls/Threading/WorkItem.cs Sun May 27 15:16:19 2012 +0000
23.3 @@ -0,0 +1,45 @@
23.4 +using System;
23.5 +using System.Collections.Generic;
23.6 +using System.Text;
23.7 +using System.Threading;
23.8 +
23.9 +namespace Aga.Controls.Threading
23.10 +{
23.11 + public sealed class WorkItem
23.12 + {
23.13 + private WaitCallback _callback;
23.14 + private object _state;
23.15 + private ExecutionContext _ctx;
23.16 +
23.17 + internal WorkItem(WaitCallback wc, object state, ExecutionContext ctx)
23.18 + {
23.19 + _callback = wc;
23.20 + _state = state;
23.21 + _ctx = ctx;
23.22 + }
23.23 +
23.24 + internal WaitCallback Callback
23.25 + {
23.26 + get
23.27 + {
23.28 + return _callback;
23.29 + }
23.30 + }
23.31 +
23.32 + internal object State
23.33 + {
23.34 + get
23.35 + {
23.36 + return _state;
23.37 + }
23.38 + }
23.39 +
23.40 + internal ExecutionContext Context
23.41 + {
23.42 + get
23.43 + {
23.44 + return _ctx;
23.45 + }
23.46 + }
23.47 + }
23.48 +}
24.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
24.2 +++ b/External/Aga.Controls/Threading/WorkItemStatus.cs Sun May 27 15:16:19 2012 +0000
24.3 @@ -0,0 +1,14 @@
24.4 +using System;
24.5 +using System.Collections.Generic;
24.6 +using System.Text;
24.7 +
24.8 +namespace Aga.Controls.Threading
24.9 +{
24.10 + public enum WorkItemStatus
24.11 + {
24.12 + Completed,
24.13 + Queued,
24.14 + Executing,
24.15 + Aborted
24.16 + }
24.17 +}
25.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
25.2 +++ b/External/Aga.Controls/TimeCounter.cs Sun May 27 15:16:19 2012 +0000
25.3 @@ -0,0 +1,59 @@
25.4 +using System;
25.5 +using System.Collections.Generic;
25.6 +using System.Text;
25.7 +using System.Runtime.InteropServices;
25.8 +using System.Diagnostics.CodeAnalysis;
25.9 +
25.10 +namespace Aga.Controls
25.11 +{
25.12 + /// <summary>
25.13 + /// High resolution timer, used to test performance
25.14 + /// </summary>
25.15 + public static class TimeCounter
25.16 + {
25.17 + private static Int64 _start;
25.18 +
25.19 + /// <summary>
25.20 + /// Start time counting
25.21 + /// </summary>
25.22 + public static void Start()
25.23 + {
25.24 + _start = 0;
25.25 + QueryPerformanceCounter(ref _start);
25.26 + }
25.27 +
25.28 + public static Int64 GetStartValue()
25.29 + {
25.30 + Int64 t = 0;
25.31 + QueryPerformanceCounter(ref t);
25.32 + return t;
25.33 + }
25.34 +
25.35 + /// <summary>
25.36 + /// Finish time counting
25.37 + /// </summary>
25.38 + /// <returns>time in seconds elapsed from Start till Finish </returns>
25.39 + public static double Finish()
25.40 + {
25.41 + return Finish(_start);
25.42 + }
25.43 +
25.44 + public static double Finish(Int64 start)
25.45 + {
25.46 + Int64 finish = 0;
25.47 + QueryPerformanceCounter(ref finish);
25.48 +
25.49 + Int64 freq = 0;
25.50 + QueryPerformanceFrequency(ref freq);
25.51 + return (finish - start) / (double)freq;
25.52 + }
25.53 +
25.54 + [DllImport("Kernel32.dll")]
25.55 + [return: MarshalAs(UnmanagedType.Bool)]
25.56 + static extern bool QueryPerformanceCounter(ref Int64 performanceCount);
25.57 +
25.58 + [DllImport("Kernel32.dll")]
25.59 + [return: MarshalAs(UnmanagedType.Bool)]
25.60 + static extern bool QueryPerformanceFrequency(ref Int64 frequency);
25.61 + }
25.62 +}
26.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
26.2 +++ b/External/Aga.Controls/Tree/AutoRowHeightLayout.cs Sun May 27 15:16:19 2012 +0000
26.3 @@ -0,0 +1,151 @@
26.4 +using System;
26.5 +using System.Collections.Generic;
26.6 +using System.Text;
26.7 +using System.Drawing;
26.8 +using Aga.Controls.Tree.NodeControls;
26.9 +
26.10 +namespace Aga.Controls.Tree
26.11 +{
26.12 + public class AutoRowHeightLayout: IRowLayout
26.13 + {
26.14 + private DrawContext _measureContext;
26.15 + private TreeViewAdv _treeView;
26.16 + private List<Rectangle> _rowCache;
26.17 +
26.18 + public AutoRowHeightLayout(TreeViewAdv treeView, int rowHeight)
26.19 + {
26.20 + _rowCache = new List<Rectangle>();
26.21 + _treeView = treeView;
26.22 + PreferredRowHeight = rowHeight;
26.23 + _measureContext = new DrawContext();
26.24 + _measureContext.Graphics = Graphics.FromImage(new Bitmap(1, 1));
26.25 + }
26.26 +
26.27 + private int _rowHeight;
26.28 + public int PreferredRowHeight
26.29 + {
26.30 + get { return _rowHeight; }
26.31 + set { _rowHeight = value; }
26.32 + }
26.33 +
26.34 +
26.35 + public int PageRowCount
26.36 + {
26.37 + get
26.38 + {
26.39 + if (_treeView.RowCount == 0)
26.40 + return 0;
26.41 + else
26.42 + {
26.43 + int pageHeight = _treeView.DisplayRectangle.Height - _treeView.ColumnHeaderHeight;
26.44 + int y = 0;
26.45 + for (int i = _treeView.RowCount - 1; i >= 0; i--)
26.46 + {
26.47 + y += GetRowHeight(i);
26.48 + if (y > pageHeight)
26.49 + return Math.Max(0, _treeView.RowCount - 1 - i);
26.50 + }
26.51 + return _treeView.RowCount;
26.52 + }
26.53 + }
26.54 + }
26.55 +
26.56 + public int CurrentPageSize
26.57 + {
26.58 + get
26.59 + {
26.60 + if (_treeView.RowCount == 0)
26.61 + return 0;
26.62 + else
26.63 + {
26.64 + int pageHeight = _treeView.DisplayRectangle.Height - _treeView.ColumnHeaderHeight;
26.65 + int y = 0;
26.66 + for (int i = _treeView.FirstVisibleRow; i < _treeView.RowCount; i++)
26.67 + {
26.68 + y += GetRowHeight(i);
26.69 + if (y > pageHeight)
26.70 + return Math.Max(0, i - _treeView.FirstVisibleRow);
26.71 + }
26.72 + return Math.Max(0, _treeView.RowCount - _treeView.FirstVisibleRow);
26.73 + }
26.74 + }
26.75 + }
26.76 +
26.77 + public Rectangle GetRowBounds(int rowNo)
26.78 + {
26.79 + if (rowNo >= _rowCache.Count)
26.80 + {
26.81 + int count = _rowCache.Count;
26.82 + int y = count > 0 ? _rowCache[count - 1].Bottom : 0;
26.83 + for (int i = count; i <= rowNo; i++)
26.84 + {
26.85 + int height = GetRowHeight(i);
26.86 + _rowCache.Add(new Rectangle(0, y, 0, height));
26.87 + y += height;
26.88 + }
26.89 + if (rowNo < _rowCache.Count - 1)
26.90 + return Rectangle.Empty;
26.91 + }
26.92 + if (rowNo >= 0 && rowNo < _rowCache.Count)
26.93 + return _rowCache[rowNo];
26.94 + else
26.95 + return Rectangle.Empty;
26.96 + }
26.97 +
26.98 + private int GetRowHeight(int rowNo)
26.99 + {
26.100 + if (rowNo < _treeView.RowMap.Count)
26.101 + {
26.102 + TreeNodeAdv node = _treeView.RowMap[rowNo];
26.103 + if (node.Height == null)
26.104 + {
26.105 + int res = 0;
26.106 + _measureContext.Font = _treeView.Font;
26.107 + foreach (NodeControl nc in _treeView.NodeControls)
26.108 + {
26.109 + int h = nc.GetActualSize(node, _measureContext).Height;
26.110 + if (h > res)
26.111 + res = h;
26.112 + }
26.113 + node.Height = res;
26.114 + }
26.115 + return node.Height.Value;
26.116 + }
26.117 + else
26.118 + return 0;
26.119 + }
26.120 +
26.121 + public int GetRowAt(Point point)
26.122 + {
26.123 + int py = point.Y - _treeView.ColumnHeaderHeight;
26.124 + int y = 0;
26.125 + for (int i = _treeView.FirstVisibleRow; i < _treeView.RowCount; i++)
26.126 + {
26.127 + int h = GetRowHeight(i);
26.128 + if (py >= y && py < y + h)
26.129 + return i;
26.130 + else
26.131 + y += h;
26.132 + }
26.133 + return -1;
26.134 + }
26.135 +
26.136 + public int GetFirstRow(int lastPageRow)
26.137 + {
26.138 + int pageHeight = _treeView.DisplayRectangle.Height - _treeView.ColumnHeaderHeight;
26.139 + int y = 0;
26.140 + for (int i = lastPageRow; i >= 0; i--)
26.141 + {
26.142 + y += GetRowHeight(i);
26.143 + if (y > pageHeight)
26.144 + return Math.Max(0, i + 1);
26.145 + }
26.146 + return 0;
26.147 + }
26.148 +
26.149 + public void ClearCache()
26.150 + {
26.151 + _rowCache.Clear();
26.152 + }
26.153 + }
26.154 +}
27.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
27.2 +++ b/External/Aga.Controls/Tree/ClassDiagram.cd Sun May 27 15:16:19 2012 +0000
27.3 @@ -0,0 +1,84 @@
27.4 +<?xml version="1.0" encoding="utf-8"?>
27.5 +<ClassDiagram MajorVersion="1" MinorVersion="1" MembersFormat="FullSignature">
27.6 + <Font Name="Microsoft Sans Serif" Size="8.25" />
27.7 + <Class Name="Aga.Controls.Tree.TreeModel" BaseTypeListCollapsed="true">
27.8 + <Position X="0.5" Y="7" Width="3.75" />
27.9 + <TypeIdentifier>
27.10 + <FileName>Tree\TreeModel.cs</FileName>
27.11 + <HashCode>AAAkgAAAAAAQAGQAAAAAEAAAEAACQAAAUAAAAAAAAQE=</HashCode>
27.12 + </TypeIdentifier>
27.13 + <Members>
27.14 + <Field Name="_root" Hidden="true" />
27.15 + </Members>
27.16 + <Compartments>
27.17 + <Compartment Name="Fields" Collapsed="true" />
27.18 + </Compartments>
27.19 + <Lollipop Position="0.2" />
27.20 + </Class>
27.21 + <Class Name="Aga.Controls.Tree.TreePath">
27.22 + <Position X="4.5" Y="4.25" Width="2" />
27.23 + <TypeIdentifier>
27.24 + <FileName>Tree\TreePath.cs</FileName>
27.25 + <HashCode>GABAAAAAAAACAAAAAAIAAAAAAAAACAAAAAAAAAAAAAA=</HashCode>
27.26 + </TypeIdentifier>
27.27 + <Members>
27.28 + <Field Name="_path" Hidden="true" />
27.29 + <Field Name="Empty" Hidden="true" />
27.30 + <Method Name="TreePath" Hidden="true" />
27.31 + </Members>
27.32 + <Compartments>
27.33 + <Compartment Name="Fields" Collapsed="true" />
27.34 + </Compartments>
27.35 + </Class>
27.36 + <Class Name="Aga.Controls.Tree.Node">
27.37 + <Position X="4.75" Y="7" Width="2.5" />
27.38 + <TypeIdentifier>
27.39 + <FileName>Tree\Node.cs</FileName>
27.40 + <HashCode>AAAgABAAgCAAAAAAAgAEVAAQAAAQAAAIAAsgCAAAAAA=</HashCode>
27.41 + </TypeIdentifier>
27.42 + <Members>
27.43 + <Field Name="_checkState" Hidden="true" />
27.44 + <Field Name="_model" Hidden="true" />
27.45 + <Field Name="_nodes" Hidden="true" />
27.46 + <Field Name="_parent" Hidden="true" />
27.47 + <Field Name="_text" Hidden="true" />
27.48 + </Members>
27.49 + <Compartments>
27.50 + <Compartment Name="Fields" Collapsed="true" />
27.51 + </Compartments>
27.52 + <NestedTypes>
27.53 + <Class Name="Aga.Controls.Tree.Node.NodeCollection" Collapsed="true">
27.54 + <TypeIdentifier>
27.55 + <NewMemberFileName>Tree\Node.cs</NewMemberFileName>
27.56 + </TypeIdentifier>
27.57 + </Class>
27.58 + </NestedTypes>
27.59 + </Class>
27.60 + <Class Name="Aga.Controls.Tree.NodeControls.NodeControl">
27.61 + <Position X="0.5" Y="0.5" Width="3.75" />
27.62 + <TypeIdentifier>
27.63 + <FileName>Tree\NodeControls\NodeControl.cs</FileName>
27.64 + <HashCode>AAAAAAAAgAAAgsIAAAhAQAAwAAAAEAAAAEAIAAAAAAA=</HashCode>
27.65 + </TypeIdentifier>
27.66 + <Members>
27.67 + <Field Name="_column" Hidden="true" />
27.68 + <Field Name="_parent" Hidden="true" />
27.69 + <Field Name="_toolTipProvider" Hidden="true" />
27.70 + <Method Name="AssignParent" Hidden="true" />
27.71 + </Members>
27.72 + </Class>
27.73 + <Interface Name="Aga.Controls.Tree.ITreeModel">
27.74 + <Position X="0.5" Y="4.25" Width="3.5" />
27.75 + <TypeIdentifier>
27.76 + <FileName>Tree\ITreeModel.cs</FileName>
27.77 + <HashCode>AAAEAAAAAAAAAEQAAAAAEAAAEAAAQAAAAAAAAAAAAAA=</HashCode>
27.78 + </TypeIdentifier>
27.79 + </Interface>
27.80 + <Interface Name="Aga.Controls.Tree.IToolTipProvider">
27.81 + <Position X="4.5" Y="0.5" Width="2.75" />
27.82 + <TypeIdentifier>
27.83 + <FileName>Tree\IToolTipProvider.cs</FileName>
27.84 + <HashCode>AAAAAAAAAAAAAAIAAAAAAAAAAAAAAAAAAAAAAAAAAAA=</HashCode>
27.85 + </TypeIdentifier>
27.86 + </Interface>
27.87 +</ClassDiagram>
27.88 \ No newline at end of file
28.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
28.2 +++ b/External/Aga.Controls/Tree/ColumnCollection.cs Sun May 27 15:16:19 2012 +0000
28.3 @@ -0,0 +1,21 @@
28.4 +using System;
28.5 +using System.Collections.Generic;
28.6 +using System.Text;
28.7 +using System.Collections.ObjectModel;
28.8 +
28.9 +namespace Aga.Controls.Tree
28.10 +{
28.11 + /*internal class ColumnCollection: Collection<Column>
28.12 + {
28.13 + public int TotalWidth
28.14 + {
28.15 + get
28.16 + {
28.17 + int res = 0;
28.18 + foreach (Column c in Items)
28.19 + res += c.Width;
28.20 + return res;
28.21 + }
28.22 + }
28.23 + }*/
28.24 +}
29.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
29.2 +++ b/External/Aga.Controls/Tree/DrawContext.cs Sun May 27 15:16:19 2012 +0000
29.3 @@ -0,0 +1,60 @@
29.4 +using System;
29.5 +using System.Collections.Generic;
29.6 +using System.Text;
29.7 +using System.Drawing;
29.8 +using Aga.Controls.Tree.NodeControls;
29.9 +
29.10 +namespace Aga.Controls.Tree
29.11 +{
29.12 + public struct DrawContext
29.13 + {
29.14 + private Graphics _graphics;
29.15 + public Graphics Graphics
29.16 + {
29.17 + get { return _graphics; }
29.18 + set { _graphics = value; }
29.19 + }
29.20 +
29.21 + private Rectangle _bounds;
29.22 + public Rectangle Bounds
29.23 + {
29.24 + get { return _bounds; }
29.25 + set { _bounds = value; }
29.26 + }
29.27 +
29.28 + private Font _font;
29.29 + public Font Font
29.30 + {
29.31 + get { return _font; }
29.32 + set { _font = value; }
29.33 + }
29.34 +
29.35 + private DrawSelectionMode _drawSelection;
29.36 + public DrawSelectionMode DrawSelection
29.37 + {
29.38 + get { return _drawSelection; }
29.39 + set { _drawSelection = value; }
29.40 + }
29.41 +
29.42 + private bool _drawFocus;
29.43 + public bool DrawFocus
29.44 + {
29.45 + get { return _drawFocus; }
29.46 + set { _drawFocus = value; }
29.47 + }
29.48 +
29.49 + private NodeControl _currentEditorOwner;
29.50 + public NodeControl CurrentEditorOwner
29.51 + {
29.52 + get { return _currentEditorOwner; }
29.53 + set { _currentEditorOwner = value; }
29.54 + }
29.55 +
29.56 + private bool _enabled;
29.57 + public bool Enabled
29.58 + {
29.59 + get { return _enabled; }
29.60 + set { _enabled = value; }
29.61 + }
29.62 + }
29.63 +}
30.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
30.2 +++ b/External/Aga.Controls/Tree/DropNodeValidatingEventArgs.cs Sun May 27 15:16:19 2012 +0000
30.3 @@ -0,0 +1,28 @@
30.4 +using System;
30.5 +using System.Drawing;
30.6 +
30.7 +namespace Aga.Controls.Tree
30.8 +{
30.9 + public class DropNodeValidatingEventArgs: EventArgs
30.10 + {
30.11 + Point _point;
30.12 + TreeNodeAdv _node;
30.13 +
30.14 + public DropNodeValidatingEventArgs(Point point, TreeNodeAdv node)
30.15 + {
30.16 + _point = point;
30.17 + _node = node;
30.18 + }
30.19 +
30.20 + public Point Point
30.21 + {
30.22 + get { return _point; }
30.23 + }
30.24 +
30.25 + public TreeNodeAdv Node
30.26 + {
30.27 + get { return _node; }
30.28 + set { _node = value; }
30.29 + }
30.30 + }
30.31 +}
31.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
31.2 +++ b/External/Aga.Controls/Tree/DropPosition.cs Sun May 27 15:16:19 2012 +0000
31.3 @@ -0,0 +1,23 @@
31.4 +using System;
31.5 +using System.Collections.Generic;
31.6 +using System.Text;
31.7 +
31.8 +namespace Aga.Controls.Tree
31.9 +{
31.10 + public struct DropPosition
31.11 + {
31.12 + private TreeNodeAdv _node;
31.13 + public TreeNodeAdv Node
31.14 + {
31.15 + get { return _node; }
31.16 + set { _node = value; }
31.17 + }
31.18 +
31.19 + private NodePosition _position;
31.20 + public NodePosition Position
31.21 + {
31.22 + get { return _position; }
31.23 + set { _position = value; }
31.24 + }
31.25 + }
31.26 +}
32.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
32.2 +++ b/External/Aga.Controls/Tree/EditorContext.cs Sun May 27 15:16:19 2012 +0000
32.3 @@ -0,0 +1,47 @@
32.4 +using System;
32.5 +using System.Collections.Generic;
32.6 +using System.Text;
32.7 +using System.Windows.Forms;
32.8 +using System.Drawing;
32.9 +using Aga.Controls.Tree.NodeControls;
32.10 +
32.11 +namespace Aga.Controls.Tree
32.12 +{
32.13 + public struct EditorContext
32.14 + {
32.15 + private TreeNodeAdv _currentNode;
32.16 + public TreeNodeAdv CurrentNode
32.17 + {
32.18 + get { return _currentNode; }
32.19 + set { _currentNode = value; }
32.20 + }
32.21 +
32.22 + private Control _editor;
32.23 + public Control Editor
32.24 + {
32.25 + get { return _editor; }
32.26 + set { _editor = value; }
32.27 + }
32.28 +
32.29 + private NodeControl _owner;
32.30 + public NodeControl Owner
32.31 + {
32.32 + get { return _owner; }
32.33 + set { _owner = value; }
32.34 + }
32.35 +
32.36 + private Rectangle _bounds;
32.37 + public Rectangle Bounds
32.38 + {
32.39 + get { return _bounds; }
32.40 + set { _bounds = value; }
32.41 + }
32.42 +
32.43 + private DrawContext _drawContext;
32.44 + public DrawContext DrawContext
32.45 + {
32.46 + get { return _drawContext; }
32.47 + set { _drawContext = value; }
32.48 + }
32.49 + }
32.50 +}
33.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
33.2 +++ b/External/Aga.Controls/Tree/Enums.cs Sun May 27 15:16:19 2012 +0000
33.3 @@ -0,0 +1,65 @@
33.4 +using System;
33.5 +using System.Collections.Generic;
33.6 +using System.Text;
33.7 +
33.8 +namespace Aga.Controls.Tree
33.9 +{
33.10 + public enum DrawSelectionMode
33.11 + {
33.12 + None, Active, Inactive, FullRowSelect
33.13 + }
33.14 +
33.15 + public enum TreeSelectionMode
33.16 + {
33.17 + Single, Multi, MultiSameParent
33.18 + }
33.19 +
33.20 + public enum NodePosition
33.21 + {
33.22 + Inside, Before, After
33.23 + }
33.24 +
33.25 + public enum VerticalAlignment
33.26 + {
33.27 + Top, Bottom, Center
33.28 + }
33.29 +
33.30 + public enum IncrementalSearchMode
33.31 + {
33.32 + None, Standard, Continuous
33.33 + }
33.34 +
33.35 + [Flags]
33.36 + public enum GridLineStyle
33.37 + {
33.38 + None = 0,
33.39 + Horizontal = 1,
33.40 + Vertical = 2,
33.41 + HorizontalAndVertical = 3
33.42 + }
33.43 +
33.44 + public enum ImageScaleMode
33.45 + {
33.46 + /// <summary>
33.47 + /// Don't scale
33.48 + /// </summary>
33.49 + Clip,
33.50 + /// <summary>
33.51 + /// Scales image to fit the display rectangle, aspect ratio is not fixed.
33.52 + /// </summary>
33.53 + Fit,
33.54 + /// <summary>
33.55 + /// Scales image down if it is larger than display rectangle, taking aspect ratio into account
33.56 + /// </summary>
33.57 + ScaleDown,
33.58 + /// <summary>
33.59 + /// Scales image up if it is smaller than display rectangle, taking aspect ratio into account
33.60 + /// </summary>
33.61 + ScaleUp,
33.62 + /// <summary>
33.63 + /// Scales image to match the display rectangle, taking aspect ratio into account
33.64 + /// </summary>
33.65 + AlwaysScale,
33.66 +
33.67 + }
33.68 +}
34.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
34.2 +++ b/External/Aga.Controls/Tree/FixedRowHeightLayout.cs Sun May 27 15:16:19 2012 +0000
34.3 @@ -0,0 +1,61 @@
34.4 +using System;
34.5 +using System.Collections.Generic;
34.6 +using System.Text;
34.7 +using System.Drawing;
34.8 +
34.9 +namespace Aga.Controls.Tree
34.10 +{
34.11 + internal class FixedRowHeightLayout : IRowLayout
34.12 + {
34.13 + private TreeViewAdv _treeView;
34.14 +
34.15 + public FixedRowHeightLayout(TreeViewAdv treeView, int rowHeight)
34.16 + {
34.17 + _treeView = treeView;
34.18 + PreferredRowHeight = rowHeight;
34.19 + }
34.20 +
34.21 + private int _rowHeight;
34.22 + public int PreferredRowHeight
34.23 + {
34.24 + get { return _rowHeight; }
34.25 + set { _rowHeight = value; }
34.26 + }
34.27 +
34.28 + public Rectangle GetRowBounds(int rowNo)
34.29 + {
34.30 + return new Rectangle(0, rowNo * _rowHeight, 0, _rowHeight);
34.31 + }
34.32 +
34.33 + public int PageRowCount
34.34 + {
34.35 + get
34.36 + {
34.37 + return Math.Max((_treeView.DisplayRectangle.Height - _treeView.ColumnHeaderHeight) / _rowHeight, 0);
34.38 + }
34.39 + }
34.40 +
34.41 + public int CurrentPageSize
34.42 + {
34.43 + get
34.44 + {
34.45 + return PageRowCount;
34.46 + }
34.47 + }
34.48 +
34.49 + public int GetRowAt(Point point)
34.50 + {
34.51 + point = new Point(point.X, point.Y + (_treeView.FirstVisibleRow * _rowHeight) - _treeView.ColumnHeaderHeight);
34.52 + return point.Y / _rowHeight;
34.53 + }
34.54 +
34.55 + public int GetFirstRow(int lastPageRow)
34.56 + {
34.57 + return Math.Max(0, lastPageRow - PageRowCount + 1);
34.58 + }
34.59 +
34.60 + public void ClearCache()
34.61 + {
34.62 + }
34.63 + }
34.64 +}
35.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
35.2 +++ b/External/Aga.Controls/Tree/IRowLayout.cs Sun May 27 15:16:19 2012 +0000
35.3 @@ -0,0 +1,34 @@
35.4 +using System;
35.5 +using System.Collections.Generic;
35.6 +using System.Text;
35.7 +using System.Drawing;
35.8 +
35.9 +namespace Aga.Controls.Tree
35.10 +{
35.11 + internal interface IRowLayout
35.12 + {
35.13 + int PreferredRowHeight
35.14 + {
35.15 + get;
35.16 + set;
35.17 + }
35.18 +
35.19 + int PageRowCount
35.20 + {
35.21 + get;
35.22 + }
35.23 +
35.24 + int CurrentPageSize
35.25 + {
35.26 + get;
35.27 + }
35.28 +
35.29 + Rectangle GetRowBounds(int rowNo);
35.30 +
35.31 + int GetRowAt(Point point);
35.32 +
35.33 + int GetFirstRow(int lastPageRow);
35.34 +
35.35 + void ClearCache();
35.36 + }
35.37 +}
36.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
36.2 +++ b/External/Aga.Controls/Tree/IToolTipProvider.cs Sun May 27 15:16:19 2012 +0000
36.3 @@ -0,0 +1,12 @@
36.4 +using System;
36.5 +using System.Collections.Generic;
36.6 +using System.Text;
36.7 +using Aga.Controls.Tree.NodeControls;
36.8 +
36.9 +namespace Aga.Controls.Tree
36.10 +{
36.11 + public interface IToolTipProvider
36.12 + {
36.13 + string GetToolTip(TreeNodeAdv node, NodeControl nodeControl);
36.14 + }
36.15 +}
37.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
37.2 +++ b/External/Aga.Controls/Tree/ITreeModel.cs Sun May 27 15:16:19 2012 +0000
37.3 @@ -0,0 +1,18 @@
37.4 +using System;
37.5 +using System.Collections.Generic;
37.6 +using System.Text;
37.7 +using System.Collections;
37.8 +
37.9 +namespace Aga.Controls.Tree
37.10 +{
37.11 + public interface ITreeModel
37.12 + {
37.13 + IEnumerable GetChildren(TreePath treePath);
37.14 + bool IsLeaf(TreePath treePath);
37.15 +
37.16 + event EventHandler<TreeModelEventArgs> NodesChanged;
37.17 + event EventHandler<TreeModelEventArgs> NodesInserted;
37.18 + event EventHandler<TreeModelEventArgs> NodesRemoved;
37.19 + event EventHandler<TreePathEventArgs> StructureChanged;
37.20 + }
37.21 +}
38.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
38.2 +++ b/External/Aga.Controls/Tree/IncrementalSearch.cs Sun May 27 15:16:19 2012 +0000
38.3 @@ -0,0 +1,144 @@
38.4 +using System;
38.5 +using System.Collections.Generic;
38.6 +using System.Text;
38.7 +using Aga.Controls.Tree.NodeControls;
38.8 +using System.ComponentModel;
38.9 +using System.Drawing;
38.10 +using System.Windows.Forms;
38.11 +
38.12 +namespace Aga.Controls.Tree
38.13 +{
38.14 + internal class IncrementalSearch
38.15 + {
38.16 + private const int SearchTimeout = 300; //end of incremental search timeot in msec
38.17 +
38.18 + private TreeViewAdv _tree;
38.19 + private TreeNodeAdv _currentNode;
38.20 + private string _searchString = "";
38.21 + private DateTime _lastKeyPressed = DateTime.Now;
38.22 +
38.23 + public IncrementalSearch(TreeViewAdv tree)
38.24 + {
38.25 + _tree = tree;
38.26 + }
38.27 +
38.28 + public void Search(Char value)
38.29 + {
38.30 + if (!Char.IsControl(value))
38.31 + {
38.32 + Char ch = Char.ToLowerInvariant(value);
38.33 + DateTime dt = DateTime.Now;
38.34 + TimeSpan ts = dt - _lastKeyPressed;
38.35 + _lastKeyPressed = dt;
38.36 + if (ts.TotalMilliseconds < SearchTimeout)
38.37 + {
38.38 + if (_searchString == value.ToString())
38.39 + FirstCharSearch(ch);
38.40 + else
38.41 + ContinuousSearch(ch);
38.42 + }
38.43 + else
38.44 + {
38.45 + FirstCharSearch(ch);
38.46 + }
38.47 + }
38.48 + }
38.49 +
38.50 + private void ContinuousSearch(Char value)
38.51 + {
38.52 + if (value == ' ' && String.IsNullOrEmpty(_searchString))
38.53 + return; //Ingnore leading space
38.54 +
38.55 + _searchString += value;
38.56 + DoContinuousSearch();
38.57 + }
38.58 +
38.59 + private void FirstCharSearch(Char value)
38.60 + {
38.61 + if (value == ' ')
38.62 + return;
38.63 +
38.64 + _searchString = value.ToString();
38.65 + TreeNodeAdv node = null;
38.66 + if (_tree.SelectedNode != null)
38.67 + node = _tree.SelectedNode.NextVisibleNode;
38.68 + if (node == null)
38.69 + node = _tree.Root.NextVisibleNode;
38.70 +
38.71 + if (node != null)
38.72 + foreach (string label in IterateNodeLabels(node))
38.73 + {
38.74 + if (label.StartsWith(_searchString))
38.75 + {
38.76 + _tree.SelectedNode = _currentNode;
38.77 + return;
38.78 + }
38.79 + }
38.80 + }
38.81 +
38.82 + public virtual void EndSearch()
38.83 + {
38.84 + _currentNode = null;
38.85 + _searchString = "";
38.86 + }
38.87 +
38.88 + protected IEnumerable<string> IterateNodeLabels(TreeNodeAdv start)
38.89 + {
38.90 + _currentNode = start;
38.91 + while(_currentNode != null)
38.92 + {
38.93 + foreach (string label in GetNodeLabels(_currentNode))
38.94 + yield return label;
38.95 +
38.96 + _currentNode = _currentNode.NextVisibleNode;
38.97 + if (_currentNode == null)
38.98 + _currentNode = _tree.Root;
38.99 +
38.100 + if (start == _currentNode)
38.101 + break;
38.102 + }
38.103 + }
38.104 +
38.105 + private IEnumerable<string> GetNodeLabels(TreeNodeAdv node)
38.106 + {
38.107 + foreach (NodeControl nc in _tree.NodeControls)
38.108 + {
38.109 + BindableControl bc = nc as BindableControl;
38.110 + if (bc != null && bc.IncrementalSearchEnabled)
38.111 + {
38.112 + object obj = bc.GetValue(node);
38.113 + if (obj != null)
38.114 + yield return obj.ToString().ToLowerInvariant();
38.115 + }
38.116 + }
38.117 + }
38.118 +
38.119 + private bool DoContinuousSearch()
38.120 + {
38.121 + bool found = false;
38.122 + if (!String.IsNullOrEmpty(_searchString))
38.123 + {
38.124 + TreeNodeAdv node = null;
38.125 + if (_tree.SelectedNode != null)
38.126 + node = _tree.SelectedNode;
38.127 + if (node == null)
38.128 + node = _tree.Root.NextVisibleNode;
38.129 +
38.130 + if (!String.IsNullOrEmpty(_searchString))
38.131 + {
38.132 + foreach (string label in IterateNodeLabels(node))
38.133 + {
38.134 + if (label.StartsWith(_searchString))
38.135 + {
38.136 + found = true;
38.137 + _tree.SelectedNode = _currentNode;
38.138 + break;
38.139 + }
38.140 + }
38.141 + }
38.142 + }
38.143 + return found;
38.144 + }
38.145 +
38.146 + }
38.147 +}
39.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
39.2 +++ b/External/Aga.Controls/Tree/Input/ClickColumnState.cs Sun May 27 15:16:19 2012 +0000
39.3 @@ -0,0 +1,45 @@
39.4 +using System;
39.5 +using System.Collections.Generic;
39.6 +using System.Text;
39.7 +using System.Windows.Forms;
39.8 +using System.Drawing;
39.9 +
39.10 +namespace Aga.Controls.Tree
39.11 +{
39.12 + internal class ClickColumnState : ColumnState
39.13 + {
39.14 + private Point _location;
39.15 +
39.16 + public ClickColumnState(TreeViewAdv tree, TreeColumn column, Point location)
39.17 + : base(tree, column)
39.18 + {
39.19 + _location = location;
39.20 + }
39.21 +
39.22 + public override void KeyDown(KeyEventArgs args)
39.23 + {
39.24 + }
39.25 +
39.26 + public override void MouseDown(TreeNodeAdvMouseEventArgs args)
39.27 + {
39.28 + }
39.29 +
39.30 + public override bool MouseMove(MouseEventArgs args)
39.31 + {
39.32 + if (TreeViewAdv.Dist(_location, args.Location) > TreeViewAdv.ItemDragSensivity
39.33 + && Tree.AllowColumnReorder)
39.34 + {
39.35 + Tree.Input = new ReorderColumnState(Tree, Column, args.Location);
39.36 + Tree.UpdateView();
39.37 + }
39.38 + return true;
39.39 + }
39.40 +
39.41 + public override void MouseUp(TreeNodeAdvMouseEventArgs args)
39.42 + {
39.43 + Tree.ChangeInput();
39.44 + Tree.UpdateView();
39.45 + Tree.OnColumnClicked(Column);
39.46 + }
39.47 + }
39.48 +}
40.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
40.2 +++ b/External/Aga.Controls/Tree/Input/ColumnState.cs Sun May 27 15:16:19 2012 +0000
40.3 @@ -0,0 +1,21 @@
40.4 +using System;
40.5 +using System.Collections.Generic;
40.6 +using System.Text;
40.7 +
40.8 +namespace Aga.Controls.Tree
40.9 +{
40.10 + internal abstract class ColumnState : InputState
40.11 + {
40.12 + private TreeColumn _column;
40.13 + public TreeColumn Column
40.14 + {
40.15 + get { return _column; }
40.16 + }
40.17 +
40.18 + public ColumnState(TreeViewAdv tree, TreeColumn column)
40.19 + : base(tree)
40.20 + {
40.21 + _column = column;
40.22 + }
40.23 + }
40.24 +}
41.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
41.2 +++ b/External/Aga.Controls/Tree/Input/InputState.cs Sun May 27 15:16:19 2012 +0000
41.3 @@ -0,0 +1,37 @@
41.4 +using System;
41.5 +using System.Windows.Forms;
41.6 +namespace Aga.Controls.Tree
41.7 +{
41.8 + internal abstract class InputState
41.9 + {
41.10 + private TreeViewAdv _tree;
41.11 +
41.12 + public TreeViewAdv Tree
41.13 + {
41.14 + get { return _tree; }
41.15 + }
41.16 +
41.17 + public InputState(TreeViewAdv tree)
41.18 + {
41.19 + _tree = tree;
41.20 + }
41.21 +
41.22 + public abstract void KeyDown(System.Windows.Forms.KeyEventArgs args);
41.23 + public abstract void MouseDown(TreeNodeAdvMouseEventArgs args);
41.24 + public abstract void MouseUp(TreeNodeAdvMouseEventArgs args);
41.25 +
41.26 + /// <summary>
41.27 + /// handle OnMouseMove event
41.28 + /// </summary>
41.29 + /// <param name="args"></param>
41.30 + /// <returns>true if event was handled and should be dispatched</returns>
41.31 + public virtual bool MouseMove(MouseEventArgs args)
41.32 + {
41.33 + return false;
41.34 + }
41.35 +
41.36 + public virtual void MouseDoubleClick(TreeNodeAdvMouseEventArgs args)
41.37 + {
41.38 + }
41.39 + }
41.40 +}
42.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
42.2 +++ b/External/Aga.Controls/Tree/Input/InputWithControl.cs Sun May 27 15:16:19 2012 +0000
42.3 @@ -0,0 +1,30 @@
42.4 +using System;
42.5 +using System.Collections.Generic;
42.6 +using System.Text;
42.7 +
42.8 +namespace Aga.Controls.Tree
42.9 +{
42.10 + internal class InputWithControl: NormalInputState
42.11 + {
42.12 + public InputWithControl(TreeViewAdv tree): base(tree)
42.13 + {
42.14 + }
42.15 +
42.16 + protected override void DoMouseOperation(TreeNodeAdvMouseEventArgs args)
42.17 + {
42.18 + if (Tree.SelectionMode == TreeSelectionMode.Single)
42.19 + {
42.20 + base.DoMouseOperation(args);
42.21 + }
42.22 + else if (CanSelect(args.Node))
42.23 + {
42.24 + args.Node.IsSelected = !args.Node.IsSelected;
42.25 + Tree.SelectionStart = args.Node;
42.26 + }
42.27 + }
42.28 +
42.29 + protected override void MouseDownAtEmptySpace(TreeNodeAdvMouseEventArgs args)
42.30 + {
42.31 + }
42.32 + }
42.33 +}
43.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
43.2 +++ b/External/Aga.Controls/Tree/Input/InputWithShift.cs Sun May 27 15:16:19 2012 +0000
43.3 @@ -0,0 +1,69 @@
43.4 +using System;
43.5 +using System.Collections.Generic;
43.6 +using System.Text;
43.7 +
43.8 +namespace Aga.Controls.Tree
43.9 +{
43.10 + internal class InputWithShift: NormalInputState
43.11 + {
43.12 + public InputWithShift(TreeViewAdv tree): base(tree)
43.13 + {
43.14 + }
43.15 +
43.16 + protected override void FocusRow(TreeNodeAdv node)
43.17 + {
43.18 + Tree.SuspendSelectionEvent = true;
43.19 + try
43.20 + {
43.21 + if (Tree.SelectionMode == TreeSelectionMode.Single || Tree.SelectionStart == null)
43.22 + base.FocusRow(node);
43.23 + else if (CanSelect(node))
43.24 + {
43.25 + SelectAllFromStart(node);
43.26 + Tree.CurrentNode = node;
43.27 + Tree.ScrollTo(node);
43.28 + }
43.29 + }
43.30 + finally
43.31 + {
43.32 + Tree.SuspendSelectionEvent = false;
43.33 + }
43.34 + }
43.35 +
43.36 + protected override void DoMouseOperation(TreeNodeAdvMouseEventArgs args)
43.37 + {
43.38 + if (Tree.SelectionMode == TreeSelectionMode.Single || Tree.SelectionStart == null)
43.39 + {
43.40 + base.DoMouseOperation(args);
43.41 + }
43.42 + else if (CanSelect(args.Node))
43.43 + {
43.44 + Tree.SuspendSelectionEvent = true;
43.45 + try
43.46 + {
43.47 + SelectAllFromStart(args.Node);
43.48 + }
43.49 + finally
43.50 + {
43.51 + Tree.SuspendSelectionEvent = false;
43.52 + }
43.53 + }
43.54 + }
43.55 +
43.56 + protected override void MouseDownAtEmptySpace(TreeNodeAdvMouseEventArgs args)
43.57 + {
43.58 + }
43.59 +
43.60 + private void SelectAllFromStart(TreeNodeAdv node)
43.61 + {
43.62 + Tree.ClearSelectionInternal();
43.63 + int a = node.Row;
43.64 + int b = Tree.SelectionStart.Row;
43.65 + for (int i = Math.Min(a, b); i <= Math.Max(a, b); i++)
43.66 + {
43.67 + if (Tree.SelectionMode == TreeSelectionMode.Multi || Tree.RowMap[i].Parent == node.Parent)
43.68 + Tree.RowMap[i].IsSelected = true;
43.69 + }
43.70 + }
43.71 + }
43.72 +}
44.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
44.2 +++ b/External/Aga.Controls/Tree/Input/NormalInputState.cs Sun May 27 15:16:19 2012 +0000
44.3 @@ -0,0 +1,202 @@
44.4 +using System;
44.5 +using System.Collections.Generic;
44.6 +using System.Text;
44.7 +using System.Windows.Forms;
44.8 +
44.9 +namespace Aga.Controls.Tree
44.10 +{
44.11 + internal class NormalInputState : InputState
44.12 + {
44.13 + private bool _mouseDownFlag = false;
44.14 +
44.15 + public NormalInputState(TreeViewAdv tree) : base(tree)
44.16 + {
44.17 + }
44.18 +
44.19 + public override void KeyDown(KeyEventArgs args)
44.20 + {
44.21 + if (Tree.CurrentNode == null && Tree.Root.Nodes.Count > 0)
44.22 + Tree.CurrentNode = Tree.Root.Nodes[0];
44.23 +
44.24 + if (Tree.CurrentNode != null)
44.25 + {
44.26 + switch (args.KeyCode)
44.27 + {
44.28 + case Keys.Right:
44.29 + if (!Tree.CurrentNode.IsExpanded)
44.30 + Tree.CurrentNode.IsExpanded = true;
44.31 + else if (Tree.CurrentNode.Nodes.Count > 0)
44.32 + Tree.SelectedNode = Tree.CurrentNode.Nodes[0];
44.33 + args.Handled = true;
44.34 + break;
44.35 + case Keys.Left:
44.36 + if (Tree.CurrentNode.IsExpanded)
44.37 + Tree.CurrentNode.IsExpanded = false;
44.38 + else if (Tree.CurrentNode.Parent != Tree.Root)
44.39 + Tree.SelectedNode = Tree.CurrentNode.Parent;
44.40 + args.Handled = true;
44.41 + break;
44.42 + case Keys.Down:
44.43 + NavigateForward(1);
44.44 + args.Handled = true;
44.45 + break;
44.46 + case Keys.Up:
44.47 + NavigateBackward(1);
44.48 + args.Handled = true;
44.49 + break;
44.50 + case Keys.PageDown:
44.51 + NavigateForward(Math.Max(1, Tree.CurrentPageSize - 1));
44.52 + args.Handled = true;
44.53 + break;
44.54 + case Keys.PageUp:
44.55 + NavigateBackward(Math.Max(1, Tree.CurrentPageSize - 1));
44.56 + args.Handled = true;
44.57 + break;
44.58 + case Keys.Home:
44.59 + if (Tree.RowMap.Count > 0)
44.60 + FocusRow(Tree.RowMap[0]);
44.61 + args.Handled = true;
44.62 + break;
44.63 + case Keys.End:
44.64 + if (Tree.RowMap.Count > 0)
44.65 + FocusRow(Tree.RowMap[Tree.RowMap.Count-1]);
44.66 + args.Handled = true;
44.67 + break;
44.68 + case Keys.Subtract:
44.69 + Tree.CurrentNode.Collapse();
44.70 + args.Handled = true;
44.71 + args.SuppressKeyPress = true;
44.72 + break;
44.73 + case Keys.Add:
44.74 + Tree.CurrentNode.Expand();
44.75 + args.Handled = true;
44.76 + args.SuppressKeyPress = true;
44.77 + break;
44.78 + case Keys.Multiply:
44.79 + Tree.CurrentNode.ExpandAll();
44.80 + args.Handled = true;
44.81 + args.SuppressKeyPress = true;
44.82 + break;
44.83 + case Keys.A:
44.84 + if (args.Modifiers == Keys.Control)
44.85 + Tree.SelectAllNodes();
44.86 + break;
44.87 + }
44.88 + }
44.89 + }
44.90 +
44.91 + public override void MouseDown(TreeNodeAdvMouseEventArgs args)
44.92 + {
44.93 + if (args.Node != null)
44.94 + {
44.95 + Tree.ItemDragMode = true;
44.96 + Tree.ItemDragStart = args.Location;
44.97 +
44.98 + if (args.Button == MouseButtons.Left || args.Button == MouseButtons.Right)
44.99 + {
44.100 + Tree.BeginUpdate();
44.101 + try
44.102 + {
44.103 + Tree.CurrentNode = args.Node;
44.104 + if (args.Node.IsSelected)
44.105 + _mouseDownFlag = true;
44.106 + else
44.107 + {
44.108 + _mouseDownFlag = false;
44.109 + DoMouseOperation(args);
44.110 + }
44.111 + }
44.112 + finally
44.113 + {
44.114 + Tree.EndUpdate();
44.115 + }
44.116 + }
44.117 +
44.118 + }
44.119 + else
44.120 + {
44.121 + Tree.ItemDragMode = false;
44.122 + MouseDownAtEmptySpace(args);
44.123 + }
44.124 + }
44.125 +
44.126 + public override void MouseUp(TreeNodeAdvMouseEventArgs args)
44.127 + {
44.128 + Tree.ItemDragMode = false;
44.129 + if (_mouseDownFlag && args.Node != null)
44.130 + {
44.131 + if (args.Button == MouseButtons.Left)
44.132 + DoMouseOperation(args);
44.133 + else if (args.Button == MouseButtons.Right)
44.134 + Tree.CurrentNode = args.Node;
44.135 + }
44.136 + _mouseDownFlag = false;
44.137 + }
44.138 +
44.139 +
44.140 + private void NavigateBackward(int n)
44.141 + {
44.142 + int row = Math.Max(Tree.CurrentNode.Row - n, 0);
44.143 + if (row != Tree.CurrentNode.Row)
44.144 + FocusRow(Tree.RowMap[row]);
44.145 + }
44.146 +
44.147 + private void NavigateForward(int n)
44.148 + {
44.149 + int row = Math.Min(Tree.CurrentNode.Row + n, Tree.RowCount - 1);
44.150 + if (row != Tree.CurrentNode.Row)
44.151 + FocusRow(Tree.RowMap[row]);
44.152 + }
44.153 +
44.154 + protected virtual void MouseDownAtEmptySpace(TreeNodeAdvMouseEventArgs args)
44.155 + {
44.156 + Tree.ClearSelection();
44.157 + }
44.158 +
44.159 + protected virtual void FocusRow(TreeNodeAdv node)
44.160 + {
44.161 + Tree.SuspendSelectionEvent = true;
44.162 + try
44.163 + {
44.164 + Tree.ClearSelectionInternal();
44.165 + Tree.CurrentNode = node;
44.166 + Tree.SelectionStart = node;
44.167 + node.IsSelected = true;
44.168 + Tree.ScrollTo(node);
44.169 + }
44.170 + finally
44.171 + {
44.172 + Tree.SuspendSelectionEvent = false;
44.173 + }
44.174 + }
44.175 +
44.176 + protected bool CanSelect(TreeNodeAdv node)
44.177 + {
44.178 + if (Tree.SelectionMode == TreeSelectionMode.MultiSameParent)
44.179 + {
44.180 + return (Tree.SelectionStart == null || node.Parent == Tree.SelectionStart.Parent);
44.181 + }
44.182 + else
44.183 + return true;
44.184 + }
44.185 +
44.186 + protected virtual void DoMouseOperation(TreeNodeAdvMouseEventArgs args)
44.187 + {
44.188 + if (Tree.SelectedNodes.Count == 1 && args.Node != null && args.Node.IsSelected)
44.189 + return;
44.190 +
44.191 + Tree.SuspendSelectionEvent = true;
44.192 + try
44.193 + {
44.194 + Tree.ClearSelectionInternal();
44.195 + if (args.Node != null)
44.196 + args.Node.IsSelected = true;
44.197 + Tree.SelectionStart = args.Node;
44.198 + }
44.199 + finally
44.200 + {
44.201 + Tree.SuspendSelectionEvent = false;
44.202 + }
44.203 + }
44.204 + }
44.205 +}
45.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
45.2 +++ b/External/Aga.Controls/Tree/Input/ReorderColumnState.cs Sun May 27 15:16:19 2012 +0000
45.3 @@ -0,0 +1,101 @@
45.4 +using System;
45.5 +using System.Collections.Generic;
45.6 +using System.Text;
45.7 +using System.Drawing;
45.8 +using System.Windows.Forms;
45.9 +
45.10 +namespace Aga.Controls.Tree
45.11 +{
45.12 + internal class ReorderColumnState : ColumnState
45.13 + {
45.14 + #region Properties
45.15 +
45.16 + private Point _location;
45.17 + public Point Location
45.18 + {
45.19 + get { return _location; }
45.20 + }
45.21 +
45.22 + private Bitmap _ghostImage;
45.23 + public Bitmap GhostImage
45.24 + {
45.25 + get { return _ghostImage; }
45.26 + }
45.27 +
45.28 + private TreeColumn _dropColumn;
45.29 + public TreeColumn DropColumn
45.30 + {
45.31 + get { return _dropColumn; }
45.32 + }
45.33 +
45.34 + private int _dragOffset;
45.35 + public int DragOffset
45.36 + {
45.37 + get { return _dragOffset; }
45.38 + }
45.39 +
45.40 + #endregion
45.41 +
45.42 + public ReorderColumnState(TreeViewAdv tree, TreeColumn column, Point initialMouseLocation)
45.43 + : base(tree, column)
45.44 + {
45.45 + _location = new Point(initialMouseLocation.X + Tree.OffsetX, 0);
45.46 + _dragOffset = tree.GetColumnX(column) - initialMouseLocation.X;
45.47 + _ghostImage = column.CreateGhostImage(new Rectangle(0, 0, column.Width, tree.ColumnHeaderHeight), tree.Font);
45.48 + }
45.49 +
45.50 + public override void KeyDown(KeyEventArgs args)
45.51 + {
45.52 + args.Handled = true;
45.53 + if (args.KeyCode == Keys.Escape)
45.54 + FinishResize();
45.55 + }
45.56 +
45.57 + public override void MouseDown(TreeNodeAdvMouseEventArgs args)
45.58 + {
45.59 + }
45.60 +
45.61 + public override void MouseUp(TreeNodeAdvMouseEventArgs args)
45.62 + {
45.63 + FinishResize();
45.64 + }
45.65 +
45.66 + public override bool MouseMove(MouseEventArgs args)
45.67 + {
45.68 + _dropColumn = null;
45.69 + _location = new Point(args.X + Tree.OffsetX, 0);
45.70 + int x = 0;
45.71 + foreach (TreeColumn c in Tree.Columns)
45.72 + {
45.73 + if (c.IsVisible)
45.74 + {
45.75 + if (_location.X < x + c.Width / 2)
45.76 + {
45.77 + _dropColumn = c;
45.78 + break;
45.79 + }
45.80 + x += c.Width;
45.81 + }
45.82 + }
45.83 + Tree.UpdateHeaders();
45.84 + return true;
45.85 + }
45.86 +
45.87 + private void FinishResize()
45.88 + {
45.89 + Tree.ChangeInput();
45.90 + if (Column == DropColumn)
45.91 + Tree.UpdateView();
45.92 + else
45.93 + {
45.94 + Tree.Columns.Remove(Column);
45.95 + if (DropColumn == null)
45.96 + Tree.Columns.Add(Column);
45.97 + else
45.98 + Tree.Columns.Insert(Tree.Columns.IndexOf(DropColumn), Column);
45.99 +
45.100 + Tree.OnColumnReordered(Column);
45.101 + }
45.102 + }
45.103 + }
45.104 +}
45.105 \ No newline at end of file
46.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
46.2 +++ b/External/Aga.Controls/Tree/Input/ResizeColumnState.cs Sun May 27 15:16:19 2012 +0000
46.3 @@ -0,0 +1,57 @@
46.4 +using System;
46.5 +using System.Collections.Generic;
46.6 +using System.Text;
46.7 +using System.Windows.Forms;
46.8 +using System.Security.Permissions;
46.9 +using System.Drawing;
46.10 +
46.11 +namespace Aga.Controls.Tree
46.12 +{
46.13 + internal class ResizeColumnState: ColumnState
46.14 + {
46.15 + private Point _initLocation;
46.16 + private int _initWidth;
46.17 +
46.18 + public ResizeColumnState(TreeViewAdv tree, TreeColumn column, Point p)
46.19 + : base(tree, column)
46.20 + {
46.21 + _initLocation = p;
46.22 + _initWidth = column.Width;
46.23 + }
46.24 +
46.25 + public override void KeyDown(KeyEventArgs args)
46.26 + {
46.27 + args.Handled = true;
46.28 + if (args.KeyCode == Keys.Escape)
46.29 + FinishResize();
46.30 + }
46.31 +
46.32 + public override void MouseDown(TreeNodeAdvMouseEventArgs args)
46.33 + {
46.34 + }
46.35 +
46.36 + public override void MouseUp(TreeNodeAdvMouseEventArgs args)
46.37 + {
46.38 + FinishResize();
46.39 + }
46.40 +
46.41 + private void FinishResize()
46.42 + {
46.43 + Tree.ChangeInput();
46.44 + Tree.FullUpdate();
46.45 + Tree.OnColumnWidthChanged(Column);
46.46 + }
46.47 +
46.48 + public override bool MouseMove(MouseEventArgs args)
46.49 + {
46.50 + Column.Width = _initWidth + args.Location.X - _initLocation.X;
46.51 + Tree.UpdateView();
46.52 + return true;
46.53 + }
46.54 +
46.55 + public override void MouseDoubleClick(TreeNodeAdvMouseEventArgs args)
46.56 + {
46.57 + Tree.AutoSizeColumn(Column);
46.58 + }
46.59 + }
46.60 +}
47.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
47.2 +++ b/External/Aga.Controls/Tree/ListModel.cs Sun May 27 15:16:19 2012 +0000
47.3 @@ -0,0 +1,56 @@
47.4 +using System;
47.5 +using System.Collections.Generic;
47.6 +using System.Text;
47.7 +using System.Collections;
47.8 +
47.9 +namespace Aga.Controls.Tree
47.10 +{
47.11 + public class ListModel : TreeModelBase
47.12 + {
47.13 + private IList _list;
47.14 +
47.15 + public int Count
47.16 + {
47.17 + get { return _list.Count; }
47.18 + }
47.19 +
47.20 + public ListModel()
47.21 + {
47.22 + _list = new List<object>();
47.23 + }
47.24 +
47.25 + public ListModel(IList list)
47.26 + {
47.27 + _list = list;
47.28 + }
47.29 +
47.30 + public override IEnumerable GetChildren(TreePath treePath)
47.31 + {
47.32 + return _list;
47.33 + }
47.34 +
47.35 + public override bool IsLeaf(TreePath treePath)
47.36 + {
47.37 + return true;
47.38 + }
47.39 +
47.40 + public void AddRange(IEnumerable items)
47.41 + {
47.42 + foreach (object obj in items)
47.43 + _list.Add(obj);
47.44 + OnStructureChanged(new TreePathEventArgs(TreePath.Empty));
47.45 + }
47.46 +
47.47 + public void Add(object item)
47.48 + {
47.49 + _list.Add(item);
47.50 + OnNodesInserted(new TreeModelEventArgs(TreePath.Empty, new int[] { _list.Count - 1 }, new object[] { item }));
47.51 + }
47.52 +
47.53 + public void Clear()
47.54 + {
47.55 + _list.Clear();
47.56 + OnStructureChanged(new TreePathEventArgs(TreePath.Empty));
47.57 + }
47.58 + }
47.59 +}
48.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
48.2 +++ b/External/Aga.Controls/Tree/NativeMethods.cs Sun May 27 15:16:19 2012 +0000
48.3 @@ -0,0 +1,74 @@
48.4 +using System;
48.5 +using System.Drawing;
48.6 +using System.Runtime.InteropServices;
48.7 +
48.8 +
48.9 +namespace Aga.Controls.Tree
48.10 +{
48.11 + internal static class NativeMethods
48.12 + {
48.13 + public const int DCX_WINDOW = 0x01;
48.14 + public const int DCX_CACHE = 0x02;
48.15 + public const int DCX_NORESETATTRS = 0x04;
48.16 + public const int DCX_CLIPCHILDREN = 0x08;
48.17 + public const int DCX_CLIPSIBLINGS = 0x10;
48.18 + public const int DCX_PARENTCLIP = 0x20;
48.19 + public const int DCX_EXCLUDERGN = 0x40;
48.20 + public const int DCX_INTERSECTRGN = 0x80;
48.21 + public const int DCX_EXCLUDEUPDATE = 0x100;
48.22 + public const int DCX_INTERSECTUPDATE = 0x200;
48.23 + public const int DCX_LOCKWINDOWUPDATE = 0x400;
48.24 + public const int DCX_VALIDATE = 0x200000;
48.25 +
48.26 + public const int WM_THEMECHANGED = 0x031A;
48.27 + public const int WM_NCPAINT = 0x85;
48.28 + public const int WM_NCCALCSIZE = 0x83;
48.29 +
48.30 + public const int WS_BORDER = 0x800000;
48.31 + public const int WS_EX_CLIENTEDGE = 0x200;
48.32 +
48.33 + public const int WVR_HREDRAW = 0x100;
48.34 + public const int WVR_VREDRAW = 0x200;
48.35 + public const int WVR_REDRAW = (WVR_HREDRAW | WVR_VREDRAW);
48.36 +
48.37 + [StructLayout(LayoutKind.Sequential)]
48.38 + public struct NCCALCSIZE_PARAMS
48.39 + {
48.40 + public RECT rgrc0, rgrc1, rgrc2;
48.41 + public IntPtr lppos;
48.42 + }
48.43 +
48.44 + [StructLayout(LayoutKind.Sequential)]
48.45 + public struct RECT
48.46 + {
48.47 + public int Left;
48.48 + public int Top;
48.49 + public int Right;
48.50 + public int Bottom;
48.51 +
48.52 + public static RECT FromRectangle(Rectangle rectangle)
48.53 + {
48.54 + RECT result = new RECT();
48.55 + result.Left = rectangle.Left;
48.56 + result.Top = rectangle.Top;
48.57 + result.Right = rectangle.Right;
48.58 + result.Bottom = rectangle.Bottom;
48.59 + return result;
48.60 + }
48.61 +
48.62 + public Rectangle ToRectangle()
48.63 + {
48.64 + return new Rectangle(Left, Top, Right - Left, Bottom - Top);
48.65 + }
48.66 + }
48.67 +
48.68 + [DllImport("user32.dll", SetLastError = true)]
48.69 + public static extern IntPtr GetDCEx(IntPtr hWnd, IntPtr hrgnClip, int flags);
48.70 +
48.71 + [DllImport("user32.dll")]
48.72 + public static extern int ReleaseDC(IntPtr hWnd, IntPtr hDC);
48.73 +
48.74 + [DllImport("user32.dll")]
48.75 + public static extern bool GetWindowRect(IntPtr hWnd, out RECT lpRect);
48.76 + }
48.77 +}
49.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
49.2 +++ b/External/Aga.Controls/Tree/Node.cs Sun May 27 15:16:19 2012 +0000
49.3 @@ -0,0 +1,257 @@
49.4 +using System;
49.5 +using System.Collections.Generic;
49.6 +using System.Text;
49.7 +using System.Collections.ObjectModel;
49.8 +using System.Windows.Forms;
49.9 +using System.Drawing;
49.10 +
49.11 +namespace Aga.Controls.Tree
49.12 +{
49.13 + public class Node
49.14 + {
49.15 + #region NodeCollection
49.16 +
49.17 + private class NodeCollection : Collection<Node>
49.18 + {
49.19 + private Node _owner;
49.20 +
49.21 + public NodeCollection(Node owner)
49.22 + {
49.23 + _owner = owner;
49.24 + }
49.25 +
49.26 + protected override void ClearItems()
49.27 + {
49.28 + while (this.Count != 0)
49.29 + this.RemoveAt(this.Count - 1);
49.30 + }
49.31 +
49.32 + protected override void InsertItem(int index, Node item)
49.33 + {
49.34 + if (item == null)
49.35 + throw new ArgumentNullException("item");
49.36 +
49.37 + if (item.Parent != _owner)
49.38 + {
49.39 + if (item.Parent != null)
49.40 + item.Parent.Nodes.Remove(item);
49.41 + item._parent = _owner;
49.42 + item._index = index;
49.43 + for (int i = index; i < Count; i++)
49.44 + this[i]._index++;
49.45 + base.InsertItem(index, item);
49.46 +
49.47 + TreeModel model = _owner.FindModel();
49.48 + if (model != null)
49.49 + model.OnNodeInserted(_owner, index, item);
49.50 + }
49.51 + }
49.52 +
49.53 + protected override void RemoveItem(int index)
49.54 + {
49.55 + Node item = this[index];
49.56 + item._parent = null;
49.57 + item._index = -1;
49.58 + for (int i = index + 1; i < Count; i++)
49.59 + this[i]._index--;
49.60 + base.RemoveItem(index);
49.61 +
49.62 + TreeModel model = _owner.FindModel();
49.63 + if (model != null)
49.64 + model.OnNodeRemoved(_owner, index, item);
49.65 + }
49.66 +
49.67 + protected override void SetItem(int index, Node item)
49.68 + {
49.69 + if (item == null)
49.70 + throw new ArgumentNullException("item");
49.71 +
49.72 + RemoveAt(index);
49.73 + InsertItem(index, item);
49.74 + }
49.75 + }
49.76 +
49.77 + #endregion
49.78 +
49.79 + #region Properties
49.80 +
49.81 + private TreeModel _model;
49.82 + internal TreeModel Model
49.83 + {
49.84 + get { return _model; }
49.85 + set { _model = value; }
49.86 + }
49.87 +
49.88 + private NodeCollection _nodes;
49.89 + public Collection<Node> Nodes
49.90 + {
49.91 + get { return _nodes; }
49.92 + }
49.93 +
49.94 + private Node _parent;
49.95 + public Node Parent
49.96 + {
49.97 + get { return _parent; }
49.98 + set
49.99 + {
49.100 + if (value != _parent)
49.101 + {
49.102 + if (_parent != null)
49.103 + _parent.Nodes.Remove(this);
49.104 +
49.105 + if (value != null)
49.106 + value.Nodes.Add(this);
49.107 + }
49.108 + }
49.109 + }
49.110 +
49.111 + private int _index = -1;
49.112 + public int Index
49.113 + {
49.114 + get
49.115 + {
49.116 + return _index;
49.117 + }
49.118 + }
49.119 +
49.120 + public Node PreviousNode
49.121 + {
49.122 + get
49.123 + {
49.124 + int index = Index;
49.125 + if (index > 0)
49.126 + return _parent.Nodes[index - 1];
49.127 + else
49.128 + return null;
49.129 + }
49.130 + }
49.131 +
49.132 + public Node NextNode
49.133 + {
49.134 + get
49.135 + {
49.136 + int index = Index;
49.137 + if (index >= 0 && index < _parent.Nodes.Count - 1)
49.138 + return _parent.Nodes[index + 1];
49.139 + else
49.140 + return null;
49.141 + }
49.142 + }
49.143 +
49.144 + private string _text;
49.145 + public virtual string Text
49.146 + {
49.147 + get { return _text; }
49.148 + set
49.149 + {
49.150 + if (_text != value)
49.151 + {
49.152 + _text = value;
49.153 + NotifyModel();
49.154 + }
49.155 + }
49.156 + }
49.157 +
49.158 + private CheckState _checkState;
49.159 + public virtual CheckState CheckState
49.160 + {
49.161 + get { return _checkState; }
49.162 + set
49.163 + {
49.164 + if (_checkState != value)
49.165 + {
49.166 + _checkState = value;
49.167 + NotifyModel();
49.168 + }
49.169 + }
49.170 + }
49.171 +
49.172 + private Image _image;
49.173 + public Image Image
49.174 + {
49.175 + get { return _image; }
49.176 + set
49.177 + {
49.178 + if (_image != value)
49.179 + {
49.180 + _image = value;
49.181 + NotifyModel();
49.182 + }
49.183 + }
49.184 + }
49.185 +
49.186 + private object _tag;
49.187 + public object Tag
49.188 + {
49.189 + get { return _tag; }
49.190 + set { _tag = value; }
49.191 + }
49.192 +
49.193 + public bool IsChecked
49.194 + {
49.195 + get
49.196 + {
49.197 + return CheckState != CheckState.Unchecked;
49.198 + }
49.199 + set
49.200 + {
49.201 + if (value)
49.202 + CheckState = CheckState.Checked;
49.203 + else
49.204 + CheckState = CheckState.Unchecked;
49.205 + }
49.206 + }
49.207 +
49.208 + public virtual bool IsLeaf
49.209 + {
49.210 + get
49.211 + {
49.212 + return false;
49.213 + }
49.214 + }
49.215 +
49.216 + #endregion
49.217 +
49.218 + public Node()
49.219 + : this(string.Empty)
49.220 + {
49.221 + }
49.222 +
49.223 + public Node(string text)
49.224 + {
49.225 + _text = text;
49.226 + _nodes = new NodeCollection(this);
49.227 + }
49.228 +
49.229 + public override string ToString()
49.230 + {
49.231 + return Text;
49.232 + }
49.233 +
49.234 + private TreeModel FindModel()
49.235 + {
49.236 + Node node = this;
49.237 + while (node != null)
49.238 + {
49.239 + if (node.Model != null)
49.240 + return node.Model;
49.241 + node = node.Parent;
49.242 + }
49.243 + return null;
49.244 + }
49.245 +
49.246 + protected void NotifyModel()
49.247 + {
49.248 + TreeModel model = FindModel();
49.249 + if (model != null && Parent != null)
49.250 + {
49.251 + TreePath path = model.GetPath(Parent);
49.252 + if (path != null)
49.253 + {
49.254 + TreeModelEventArgs args = new TreeModelEventArgs(path, new int[] { Index }, new object[] { this });
49.255 + model.OnNodesChanged(args);
49.256 + }
49.257 + }
49.258 + }
49.259 + }
49.260 +}
50.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
50.2 +++ b/External/Aga.Controls/Tree/NodeControlInfo.cs Sun May 27 15:16:19 2012 +0000
50.3 @@ -0,0 +1,38 @@
50.4 +using System;
50.5 +using System.Collections.Generic;
50.6 +using System.Text;
50.7 +using Aga.Controls.Tree.NodeControls;
50.8 +using System.Drawing;
50.9 +
50.10 +namespace Aga.Controls.Tree
50.11 +{
50.12 + public struct NodeControlInfo
50.13 + {
50.14 + public static readonly NodeControlInfo Empty = new NodeControlInfo(null, Rectangle.Empty, null);
50.15 +
50.16 + private NodeControl _control;
50.17 + public NodeControl Control
50.18 + {
50.19 + get { return _control; }
50.20 + }
50.21 +
50.22 + private Rectangle _bounds;
50.23 + public Rectangle Bounds
50.24 + {
50.25 + get { return _bounds; }
50.26 + }
50.27 +
50.28 + private TreeNodeAdv _node;
50.29 + public TreeNodeAdv Node
50.30 + {
50.31 + get { return _node; }
50.32 + }
50.33 +
50.34 + public NodeControlInfo(NodeControl control, Rectangle bounds, TreeNodeAdv node)
50.35 + {
50.36 + _control = control;
50.37 + _bounds = bounds;
50.38 + _node = node;
50.39 + }
50.40 + }
50.41 +}
51.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
51.2 +++ b/External/Aga.Controls/Tree/NodeControls/BaseTextControl.cs Sun May 27 15:16:19 2012 +0000
51.3 @@ -0,0 +1,314 @@
51.4 +using System;
51.5 +using System.Collections.Generic;
51.6 +using System.Text;
51.7 +using System.Drawing;
51.8 +using System.Windows.Forms;
51.9 +using System.Reflection;
51.10 +using System.ComponentModel;
51.11 +
51.12 +namespace Aga.Controls.Tree.NodeControls
51.13 +{
51.14 + public abstract class BaseTextControl : EditableControl
51.15 + {
51.16 + private TextFormatFlags _baseFormatFlags;
51.17 + private TextFormatFlags _formatFlags;
51.18 + private Pen _focusPen;
51.19 + private StringFormat _format;
51.20 +
51.21 + #region Properties
51.22 +
51.23 + private Font _font = null;
51.24 + public Font Font
51.25 + {
51.26 + get
51.27 + {
51.28 + if (_font == null)
51.29 + return Control.DefaultFont;
51.30 + else
51.31 + return _font;
51.32 + }
51.33 + set
51.34 + {
51.35 + if (value == Control.DefaultFont)
51.36 + _font = null;
51.37 + else
51.38 + _font = value;
51.39 + }
51.40 + }
51.41 +
51.42 + protected bool ShouldSerializeFont()
51.43 + {
51.44 + return (_font != null);
51.45 + }
51.46 +
51.47 + private HorizontalAlignment _textAlign = HorizontalAlignment.Left;
51.48 + [DefaultValue(HorizontalAlignment.Left)]
51.49 + public HorizontalAlignment TextAlign
51.50 + {
51.51 + get { return _textAlign; }
51.52 + set
51.53 + {
51.54 + _textAlign = value;
51.55 + SetFormatFlags();
51.56 + }
51.57 + }
51.58 +
51.59 + private StringTrimming _trimming = StringTrimming.None;
51.60 + [DefaultValue(StringTrimming.None)]
51.61 + public StringTrimming Trimming
51.62 + {
51.63 + get { return _trimming; }
51.64 + set
51.65 + {
51.66 + _trimming = value;
51.67 + SetFormatFlags();
51.68 + }
51.69 + }
51.70 +
51.71 + private bool _displayHiddenContentInToolTip = true;
51.72 + [DefaultValue(true)]
51.73 + public bool DisplayHiddenContentInToolTip
51.74 + {
51.75 + get { return _displayHiddenContentInToolTip; }
51.76 + set { _displayHiddenContentInToolTip = value; }
51.77 + }
51.78 +
51.79 + private bool _useCompatibleTextRendering = false;
51.80 + [DefaultValue(false)]
51.81 + public bool UseCompatibleTextRendering
51.82 + {
51.83 + get { return _useCompatibleTextRendering; }
51.84 + set { _useCompatibleTextRendering = value; }
51.85 + }
51.86 +
51.87 + [DefaultValue(false)]
51.88 + public bool TrimMultiLine
51.89 + {
51.90 + get;
51.91 + set;
51.92 + }
51.93 +
51.94 + #endregion
51.95 +
51.96 + protected BaseTextControl()
51.97 + {
51.98 + IncrementalSearchEnabled = true;
51.99 + _focusPen = new Pen(Color.Black);
51.100 + _focusPen.DashStyle = System.Drawing.Drawing2D.DashStyle.Dot;
51.101 +
51.102 + _format = new StringFormat(StringFormatFlags.LineLimit | StringFormatFlags.NoClip | StringFormatFlags.FitBlackBox | StringFormatFlags.MeasureTrailingSpaces);
51.103 + _baseFormatFlags = TextFormatFlags.PreserveGraphicsClipping |
51.104 + TextFormatFlags.PreserveGraphicsTranslateTransform;
51.105 + SetFormatFlags();
51.106 + LeftMargin = 3;
51.107 + }
51.108 +
51.109 + private void SetFormatFlags()
51.110 + {
51.111 + _format.Alignment = TextHelper.TranslateAligment(TextAlign);
51.112 + _format.Trimming = Trimming;
51.113 +
51.114 + _formatFlags = _baseFormatFlags | TextHelper.TranslateAligmentToFlag(TextAlign)
51.115 + | TextHelper.TranslateTrimmingToFlag(Trimming);
51.116 + }
51.117 +
51.118 + public override Size MeasureSize(TreeNodeAdv node, DrawContext context)
51.119 + {
51.120 + return GetLabelSize(node, context);
51.121 + }
51.122 +
51.123 + protected Size GetLabelSize(TreeNodeAdv node, DrawContext context)
51.124 + {
51.125 + return GetLabelSize(node, context, GetLabel(node));
51.126 + }
51.127 +
51.128 + protected Size GetLabelSize(TreeNodeAdv node, DrawContext context, string label)
51.129 + {
51.130 + PerformanceAnalyzer.Start("GetLabelSize");
51.131 + CheckThread();
51.132 + Font font = GetDrawingFont(node, context, label);
51.133 + Size s = Size.Empty;
51.134 + if (UseCompatibleTextRendering)
51.135 + s = TextRenderer.MeasureText(label, font);
51.136 + else
51.137 + {
51.138 + SizeF sf = context.Graphics.MeasureString(label, font);
51.139 + s = new Size((int)Math.Ceiling(sf.Width), (int)Math.Ceiling(sf.Height));
51.140 + }
51.141 + PerformanceAnalyzer.Finish("GetLabelSize");
51.142 +
51.143 + if (!s.IsEmpty)
51.144 + return s;
51.145 + else
51.146 + return new Size(10, Font.Height);
51.147 + }
51.148 +
51.149 + protected Font GetDrawingFont(TreeNodeAdv node, DrawContext context, string label)
51.150 + {
51.151 + Font font = context.Font;
51.152 + if (DrawTextMustBeFired(node))
51.153 + {
51.154 + DrawEventArgs args = new DrawEventArgs(node, this, context, label);
51.155 + args.Font = context.Font;
51.156 + OnDrawText(args);
51.157 + font = args.Font;
51.158 + }
51.159 + return font;
51.160 + }
51.161 +
51.162 + protected void SetEditControlProperties(Control control, TreeNodeAdv node)
51.163 + {
51.164 + string label = GetLabel(node);
51.165 + DrawContext context = new DrawContext();
51.166 + context.Font = control.Font;
51.167 + control.Font = GetDrawingFont(node, context, label);
51.168 + }
51.169 +
51.170 + public override void Draw(TreeNodeAdv node, DrawContext context)
51.171 + {
51.172 + if (context.CurrentEditorOwner == this && node == Parent.CurrentNode)
51.173 + return;
51.174 +
51.175 + PerformanceAnalyzer.Start("BaseTextControl.Draw");
51.176 + string label = GetLabel(node);
51.177 + Rectangle bounds = GetBounds(node, context);
51.178 + Rectangle focusRect = new Rectangle(bounds.X, context.Bounds.Y,
51.179 + bounds.Width, context.Bounds.Height);
51.180 +
51.181 + Brush backgroundBrush;
51.182 + Color textColor;
51.183 + Font font;
51.184 + CreateBrushes(node, context, label, out backgroundBrush, out textColor, out font, ref label);
51.185 +
51.186 + if (backgroundBrush != null)
51.187 + context.Graphics.FillRectangle(backgroundBrush, focusRect);
51.188 + if (context.DrawFocus)
51.189 + {
51.190 + focusRect.Width--;
51.191 + focusRect.Height--;
51.192 + if (context.DrawSelection == DrawSelectionMode.None)
51.193 + _focusPen.Color = SystemColors.ControlText;
51.194 + else
51.195 + _focusPen.Color = SystemColors.InactiveCaption;
51.196 + context.Graphics.DrawRectangle(_focusPen, focusRect);
51.197 + }
51.198 +
51.199 + PerformanceAnalyzer.Start("BaseTextControl.DrawText");
51.200 + if (UseCompatibleTextRendering)
51.201 + TextRenderer.DrawText(context.Graphics, label, font, bounds, textColor, _formatFlags);
51.202 + else
51.203 + context.Graphics.DrawString(label, font, GetFrush(textColor), bounds, _format);
51.204 + PerformanceAnalyzer.Finish("BaseTextControl.DrawText");
51.205 +
51.206 + PerformanceAnalyzer.Finish("BaseTextControl.Draw");
51.207 + }
51.208 +
51.209 + private static Dictionary<Color, Brush> _brushes = new Dictionary<Color,Brush>();
51.210 + private static Brush GetFrush(Color color)
51.211 + {
51.212 + Brush br;
51.213 + if (_brushes.ContainsKey(color))
51.214 + br = _brushes[color];
51.215 + else
51.216 + {
51.217 + br = new SolidBrush(color);
51.218 + _brushes.Add(color, br);
51.219 + }
51.220 + return br;
51.221 + }
51.222 +
51.223 + private void CreateBrushes(TreeNodeAdv node, DrawContext context, string text, out Brush backgroundBrush, out Color textColor, out Font font, ref string label)
51.224 + {
51.225 + textColor = SystemColors.ControlText;
51.226 + backgroundBrush = null;
51.227 + font = context.Font;
51.228 + if (context.DrawSelection == DrawSelectionMode.Active)
51.229 + {
51.230 + textColor = SystemColors.HighlightText;
51.231 + backgroundBrush = SystemBrushes.Highlight;
51.232 + }
51.233 + else if (context.DrawSelection == DrawSelectionMode.Inactive)
51.234 + {
51.235 + textColor = SystemColors.ControlText;
51.236 + backgroundBrush = SystemBrushes.InactiveBorder;
51.237 + }
51.238 + else if (context.DrawSelection == DrawSelectionMode.FullRowSelect)
51.239 + textColor = SystemColors.HighlightText;
51.240 +
51.241 + if (!context.Enabled)
51.242 + textColor = SystemColors.GrayText;
51.243 +
51.244 + if (DrawTextMustBeFired(node))
51.245 + {
51.246 + DrawEventArgs args = new DrawEventArgs(node, this, context, text);
51.247 + args.Text = label;
51.248 + args.TextColor = textColor;
51.249 + args.BackgroundBrush = backgroundBrush;
51.250 + args.Font = font;
51.251 +
51.252 + OnDrawText(args);
51.253 +
51.254 + textColor = args.TextColor;
51.255 + backgroundBrush = args.BackgroundBrush;
51.256 + font = args.Font;
51.257 + label = args.Text;
51.258 + }
51.259 + }
51.260 +
51.261 + public string GetLabel(TreeNodeAdv node)
51.262 + {
51.263 + if (node != null && node.Tag != null)
51.264 + {
51.265 + object obj = GetValue(node);
51.266 + if (obj != null)
51.267 + return FormatLabel(obj);
51.268 + }
51.269 + return string.Empty;
51.270 + }
51.271 +
51.272 + protected virtual string FormatLabel(object obj)
51.273 + {
51.274 + var res = obj.ToString();
51.275 + if (TrimMultiLine && res != null)
51.276 + {
51.277 + string[] parts = res.Split('\n');
51.278 + if (parts.Length > 1)
51.279 + return parts[0] + "...";
51.280 + }
51.281 + return res;
51.282 + }
51.283 +
51.284 + public void SetLabel(TreeNodeAdv node, string value)
51.285 + {
51.286 + SetValue(node, value);
51.287 + }
51.288 +
51.289 + protected override void Dispose(bool disposing)
51.290 + {
51.291 + base.Dispose(disposing);
51.292 + if (disposing)
51.293 + {
51.294 + _focusPen.Dispose();
51.295 + _format.Dispose();
51.296 + }
51.297 + }
51.298 +
51.299 + /// <summary>
51.300 + /// Fires when control is going to draw a text. Can be used to change text or back color
51.301 + /// </summary>
51.302 + public event EventHandler<DrawEventArgs> DrawText;
51.303 + protected virtual void OnDrawText(DrawEventArgs args)
51.304 + {
51.305 + TreeViewAdv tree = args.Node.Tree;
51.306 + if (tree != null)
51.307 + tree.FireDrawControl(args);
51.308 + if (DrawText != null)
51.309 + DrawText(this, args);
51.310 + }
51.311 +
51.312 + protected virtual bool DrawTextMustBeFired(TreeNodeAdv node)
51.313 + {
51.314 + return DrawText != null || (node.Tree != null && node.Tree.DrawControlMustBeFired());
51.315 + }
51.316 + }
51.317 +}
52.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
52.2 +++ b/External/Aga.Controls/Tree/NodeControls/BindableControl.cs Sun May 27 15:16:19 2012 +0000
52.3 @@ -0,0 +1,194 @@
52.4 +using System;
52.5 +using System.Collections.Generic;
52.6 +using System.Text;
52.7 +using System.Reflection;
52.8 +using System.ComponentModel;
52.9 +
52.10 +namespace Aga.Controls.Tree.NodeControls
52.11 +{
52.12 + public abstract class BindableControl : NodeControl
52.13 + {
52.14 + private struct MemberAdapter
52.15 + {
52.16 + private object _obj;
52.17 + private PropertyInfo _pi;
52.18 + private FieldInfo _fi;
52.19 +
52.20 + public static readonly MemberAdapter Empty = new MemberAdapter();
52.21 +
52.22 + public Type MemberType
52.23 + {
52.24 + get
52.25 + {
52.26 + if (_pi != null)
52.27 + return _pi.PropertyType;
52.28 + else if (_fi != null)
52.29 + return _fi.FieldType;
52.30 + else
52.31 + return null;
52.32 + }
52.33 + }
52.34 +
52.35 + public object Value
52.36 + {
52.37 + get
52.38 + {
52.39 + if (_pi != null && _pi.CanRead)
52.40 + return _pi.GetValue(_obj, null);
52.41 + else if (_fi != null)
52.42 + return _fi.GetValue(_obj);
52.43 + else
52.44 + return null;
52.45 + }
52.46 + set
52.47 + {
52.48 + if (_pi != null && _pi.CanWrite)
52.49 + _pi.SetValue(_obj, value, null);
52.50 + else if (_fi != null)
52.51 + _fi.SetValue(_obj, value);
52.52 + }
52.53 + }
52.54 +
52.55 + public MemberAdapter(object obj, PropertyInfo pi)
52.56 + {
52.57 + _obj = obj;
52.58 + _pi = pi;
52.59 + _fi = null;
52.60 + }
52.61 +
52.62 + public MemberAdapter(object obj, FieldInfo fi)
52.63 + {
52.64 + _obj = obj;
52.65 + _fi = fi;
52.66 + _pi = null;
52.67 + }
52.68 + }
52.69 +
52.70 + #region Properties
52.71 +
52.72 + private bool _virtualMode = false;
52.73 + [DefaultValue(false), Category("Data")]
52.74 + public bool VirtualMode
52.75 + {
52.76 + get { return _virtualMode; }
52.77 + set { _virtualMode = value; }
52.78 + }
52.79 +
52.80 + private string _propertyName = "";
52.81 + [DefaultValue(""), Category("Data")]
52.82 + public string DataPropertyName
52.83 + {
52.84 + get { return _propertyName; }
52.85 + set
52.86 + {
52.87 + if (_propertyName == null)
52.88 + _propertyName = string.Empty;
52.89 + _propertyName = value;
52.90 + }
52.91 + }
52.92 +
52.93 + private bool _incrementalSearchEnabled = false;
52.94 + [DefaultValue(false)]
52.95 + public bool IncrementalSearchEnabled
52.96 + {
52.97 + get { return _incrementalSearchEnabled; }
52.98 + set { _incrementalSearchEnabled = value; }
52.99 + }
52.100 +
52.101 + #endregion
52.102 +
52.103 + public virtual object GetValue(TreeNodeAdv node)
52.104 + {
52.105 + if (VirtualMode)
52.106 + {
52.107 + NodeControlValueEventArgs args = new NodeControlValueEventArgs(node);
52.108 + OnValueNeeded(args);
52.109 + return args.Value;
52.110 + }
52.111 + else
52.112 + {
52.113 + try
52.114 + {
52.115 + return GetMemberAdapter(node).Value;
52.116 + }
52.117 + catch (TargetInvocationException ex)
52.118 + {
52.119 + if (ex.InnerException != null)
52.120 + throw new ArgumentException(ex.InnerException.Message, ex.InnerException);
52.121 + else
52.122 + throw new ArgumentException(ex.Message);
52.123 + }
52.124 + }
52.125 + }
52.126 +
52.127 + public virtual void SetValue(TreeNodeAdv node, object value)
52.128 + {
52.129 + if (VirtualMode)
52.130 + {
52.131 + NodeControlValueEventArgs args = new NodeControlValueEventArgs(node);
52.132 + args.Value = value;
52.133 + OnValuePushed(args);
52.134 + }
52.135 + else
52.136 + {
52.137 + try
52.138 + {
52.139 + MemberAdapter ma = GetMemberAdapter(node);
52.140 + ma.Value = value;
52.141 + }
52.142 + catch (TargetInvocationException ex)
52.143 + {
52.144 + if (ex.InnerException != null)
52.145 + throw new ArgumentException(ex.InnerException.Message, ex.InnerException);
52.146 + else
52.147 + throw new ArgumentException(ex.Message);
52.148 + }
52.149 + }
52.150 + }
52.151 +
52.152 + public Type GetPropertyType(TreeNodeAdv node)
52.153 + {
52.154 + return GetMemberAdapter(node).MemberType;
52.155 + }
52.156 +
52.157 + private MemberAdapter GetMemberAdapter(TreeNodeAdv node)
52.158 + {
52.159 + if (node.Tag != null && !string.IsNullOrEmpty(DataPropertyName))
52.160 + {
52.161 + Type type = node.Tag.GetType();
52.162 + PropertyInfo pi = type.GetProperty(DataPropertyName);
52.163 + if (pi != null)
52.164 + return new MemberAdapter(node.Tag, pi);
52.165 + else
52.166 + {
52.167 + FieldInfo fi = type.GetField(DataPropertyName, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
52.168 + if (fi != null)
52.169 + return new MemberAdapter(node.Tag, fi);
52.170 + }
52.171 + }
52.172 + return MemberAdapter.Empty;
52.173 + }
52.174 +
52.175 + public override string ToString()
52.176 + {
52.177 + if (string.IsNullOrEmpty(DataPropertyName))
52.178 + return GetType().Name;
52.179 + else
52.180 + return string.Format("{0} ({1})", GetType().Name, DataPropertyName);
52.181 + }
52.182 +
52.183 + public event EventHandler<NodeControlValueEventArgs> ValueNeeded;
52.184 + private void OnValueNeeded(NodeControlValueEventArgs args)
52.185 + {
52.186 + if (ValueNeeded != null)
52.187 + ValueNeeded(this, args);
52.188 + }
52.189 +
52.190 + public event EventHandler<NodeControlValueEventArgs> ValuePushed;
52.191 + private void OnValuePushed(NodeControlValueEventArgs args)
52.192 + {
52.193 + if (ValuePushed != null)
52.194 + ValuePushed(this, args);
52.195 + }
52.196 + }
52.197 +}
53.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
53.2 +++ b/External/Aga.Controls/Tree/NodeControls/ClassDiagram.cd Sun May 27 15:16:19 2012 +0000
53.3 @@ -0,0 +1,105 @@
53.4 +<?xml version="1.0" encoding="utf-8"?>
53.5 +<ClassDiagram MajorVersion="1" MinorVersion="1">
53.6 + <Font Name="Microsoft Sans Serif" Size="8.25" />
53.7 + <Class Name="Aga.Controls.Tree.NodeControls.NodeStateIcon" Collapsed="true">
53.8 + <Position X="0.5" Y="4" Width="1.5" />
53.9 + <TypeIdentifier>
53.10 + <FileName>Tree\NodeControls\NodeStateIcon.cs</FileName>
53.11 + <HashCode>ABAAAAAAAAQAQAAAAAAAAAAAAAAAAAAAQIAAAAAAAAA=</HashCode>
53.12 + </TypeIdentifier>
53.13 + </Class>
53.14 + <Class Name="Aga.Controls.Tree.NodeControls.BindableControl" Collapsed="true">
53.15 + <Position X="2.75" Y="1.5" Width="1.5" />
53.16 + <TypeIdentifier>
53.17 + <FileName>Tree\NodeControls\BindableControl.cs</FileName>
53.18 + <HashCode>FAAAAAAQIBAQCgAEAAAAIAAAAAAAAAEMAAACAAAAAAE=</HashCode>
53.19 + </TypeIdentifier>
53.20 + </Class>
53.21 + <Class Name="Aga.Controls.Tree.NodeControls.NodeCheckBox" Collapsed="true">
53.22 + <Position X="5" Y="4" Width="1.5" />
53.23 + <TypeIdentifier>
53.24 + <FileName>Tree\NodeControls\NodeCheckBox.cs</FileName>
53.25 + <HashCode>AAEAAAAAAAACgkQCAAAAAAigAgAAEGABAAAIAAAAAAA=</HashCode>
53.26 + </TypeIdentifier>
53.27 + </Class>
53.28 + <Class Name="Aga.Controls.Tree.NodeControls.NodeControl" Collapsed="true">
53.29 + <Position X="1.5" Y="0.5" Width="1.5" />
53.30 + <TypeIdentifier>
53.31 + <FileName>Tree\NodeControls\NodeControl.cs</FileName>
53.32 + <HashCode>AAAAAJAAgIgBkkoQAAgAQAAwAAABEIQAAEBIAAAAAAA=</HashCode>
53.33 + </TypeIdentifier>
53.34 + <Compartments>
53.35 + <Compartment Name="Fields" Collapsed="true" />
53.36 + </Compartments>
53.37 + </Class>
53.38 + <Class Name="Aga.Controls.Tree.NodeControls.NodeIcon" Collapsed="true">
53.39 + <Position X="0.5" Y="2.75" Width="1.5" />
53.40 + <TypeIdentifier>
53.41 + <FileName>Tree\NodeControls\NodeIcon.cs</FileName>
53.42 + <HashCode>ABAAAAAAAAAAAgAAAAAAAAAgAAAAAAAAAAAAAAAAAAA=</HashCode>
53.43 + </TypeIdentifier>
53.44 + </Class>
53.45 + <Class Name="Aga.Controls.Tree.NodeControls.NodePlusMinus" Collapsed="true">
53.46 + <Position X="0.5" Y="1.5" Width="1.5" />
53.47 + <TypeIdentifier>
53.48 + <FileName>Tree\NodeControls\NodePlusMinus.cs</FileName>
53.49 + <HashCode>AAAAAAAAAAAAAgAAAAAAAEAgAAAAMCAAAAAIACAAAAA=</HashCode>
53.50 + </TypeIdentifier>
53.51 + </Class>
53.52 + <Class Name="Aga.Controls.Tree.NodeControls.BaseTextControl" Collapsed="true">
53.53 + <Position X="3" Y="5" Width="1.5" />
53.54 + <TypeIdentifier>
53.55 + <FileName>Tree\NodeControls\BaseTextControl.cs</FileName>
53.56 + <HashCode>AAAAICBQACAAIgACBCAEAQA8AgmFoAAwAAAAACACAMA=</HashCode>
53.57 + </TypeIdentifier>
53.58 + </Class>
53.59 + <Class Name="Aga.Controls.Tree.NodeControls.NodeTextBox" Collapsed="true">
53.60 + <Position X="1" Y="6" Width="1.5" />
53.61 + <TypeIdentifier>
53.62 + <FileName>Tree\NodeControls\NodeTextBox.cs</FileName>
53.63 + <HashCode>QQQAhAAAADAMgAAAABAAAAAAAgEAIAAAAAAAAIAAAAA=</HashCode>
53.64 + </TypeIdentifier>
53.65 + </Class>
53.66 + <Class Name="Aga.Controls.Tree.NodeControls.EditableControl" Collapsed="true">
53.67 + <Position X="3" Y="4" Width="1.5" />
53.68 + <TypeIdentifier>
53.69 + <FileName>Tree\NodeControls\EditableControl.cs</FileName>
53.70 + <HashCode>QQAgAAAACGgkAMAABAEEkADAEAAUEAAABAGoAAAAAQA=</HashCode>
53.71 + </TypeIdentifier>
53.72 + </Class>
53.73 + <Class Name="Aga.Controls.Tree.NodeControls.NodeComboBox" Collapsed="true">
53.74 + <Position X="3" Y="6" Width="1.5" />
53.75 + <TypeIdentifier>
53.76 + <FileName>Tree\NodeControls\NodeComboBox.cs</FileName>
53.77 + <HashCode>wQACAAAAAAAMAEBAAAAAAABAAAAAAAABAAAAAAAAAAA=</HashCode>
53.78 + </TypeIdentifier>
53.79 + </Class>
53.80 + <Class Name="Aga.Controls.Tree.NodeControls.NodeNumericUpDown" Collapsed="true">
53.81 + <Position X="5" Y="6" Width="1.75" />
53.82 + <TypeIdentifier>
53.83 + <FileName>Tree\NodeControls\NodeNumericUpDown.cs</FileName>
53.84 + <HashCode>wQAAAACAAAAEAABAIAAQIAAAAAAAAAABAAAIAAAAAII=</HashCode>
53.85 + </TypeIdentifier>
53.86 + </Class>
53.87 + <Class Name="Aga.Controls.Tree.NodeControls.InteractiveControl" Collapsed="true">
53.88 + <Position X="4" Y="2.75" Width="1.5" />
53.89 + <TypeIdentifier>
53.90 + <FileName>Tree\NodeControls\InteractiveControl.cs</FileName>
53.91 + <HashCode>AAAABAAAAAAAAAAACAAAAAAAABAAAQAAAAAAAAIAAAA=</HashCode>
53.92 + </TypeIdentifier>
53.93 + </Class>
53.94 + <Class Name="Aga.Controls.Tree.NodeControls.NodeDecimalTextBox" Collapsed="true">
53.95 + <Position X="2.5" Y="7" Width="1.75" />
53.96 + <TypeIdentifier>
53.97 + <FileName>Tree\NodeControls\NodeDecimalTextBox.cs</FileName>
53.98 + <HashCode>AQAAAAAAAACAAAACAAAAAAQAAAAAIAAAAAgAAAAAAAA=</HashCode>
53.99 + </TypeIdentifier>
53.100 + </Class>
53.101 + <Class Name="Aga.Controls.Tree.NodeControls.NodeIntegerTextBox" Collapsed="true">
53.102 + <Position X="0.5" Y="7" Width="1.75" />
53.103 + <TypeIdentifier>
53.104 + <FileName>Tree\NodeControls\NodeIntegerTextBox.cs</FileName>
53.105 + <HashCode>AQAAAAAAAAAAAAACAAAAAAQAAAAAIAAAAAAAAAAAAAA=</HashCode>
53.106 + </TypeIdentifier>
53.107 + </Class>
53.108 +</ClassDiagram>
53.109 \ No newline at end of file
54.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
54.2 +++ b/External/Aga.Controls/Tree/NodeControls/DrawEventArgs.cs Sun May 27 15:16:19 2012 +0000
54.3 @@ -0,0 +1,67 @@
54.4 +using System;
54.5 +using System.Collections.Generic;
54.6 +using System.Text;
54.7 +using System.Drawing;
54.8 +
54.9 +namespace Aga.Controls.Tree.NodeControls
54.10 +{
54.11 + public class DrawEventArgs : NodeEventArgs
54.12 + {
54.13 + private DrawContext _context;
54.14 + public DrawContext Context
54.15 + {
54.16 + get { return _context; }
54.17 + }
54.18 +
54.19 + private Brush _textBrush;
54.20 + [Obsolete("Use TextColor")]
54.21 + public Brush TextBrush
54.22 + {
54.23 + get { return _textBrush; }
54.24 + set { _textBrush = value; }
54.25 + }
54.26 +
54.27 + private Brush _backgroundBrush;
54.28 + public Brush BackgroundBrush
54.29 + {
54.30 + get { return _backgroundBrush; }
54.31 + set { _backgroundBrush = value; }
54.32 + }
54.33 +
54.34 + private Font _font;
54.35 + public Font Font
54.36 + {
54.37 + get { return _font; }
54.38 + set { _font = value; }
54.39 + }
54.40 +
54.41 + private Color _textColor;
54.42 + public Color TextColor
54.43 + {
54.44 + get { return _textColor; }
54.45 + set { _textColor = value; }
54.46 + }
54.47 +
54.48 + private string _text;
54.49 + public string Text
54.50 + {
54.51 + get { return _text; }
54.52 + set { _text = value; }
54.53 + }
54.54 +
54.55 +
54.56 + private EditableControl _control;
54.57 + public EditableControl Control
54.58 + {
54.59 + get { return _control; }
54.60 + }
54.61 +
54.62 + public DrawEventArgs(TreeNodeAdv node, EditableControl control, DrawContext context, string text)
54.63 + : base(node)
54.64 + {
54.65 + _control = control;
54.66 + _context = context;
54.67 + _text = text;
54.68 + }
54.69 + }
54.70 +}
55.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
55.2 +++ b/External/Aga.Controls/Tree/NodeControls/EditEventArgs.cs Sun May 27 15:16:19 2012 +0000
55.3 @@ -0,0 +1,22 @@
55.4 +using System;
55.5 +using System.Collections.Generic;
55.6 +using System.Text;
55.7 +using System.Windows.Forms;
55.8 +
55.9 +namespace Aga.Controls.Tree.NodeControls
55.10 +{
55.11 + public class EditEventArgs : NodeEventArgs
55.12 + {
55.13 + private Control _control;
55.14 + public Control Control
55.15 + {
55.16 + get { return _control; }
55.17 + }
55.18 +
55.19 + public EditEventArgs(TreeNodeAdv node, Control control)
55.20 + : base(node)
55.21 + {
55.22 + _control = control;
55.23 + }
55.24 + }
55.25 +}
56.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
56.2 +++ b/External/Aga.Controls/Tree/NodeControls/EditableControl.cs Sun May 27 15:16:19 2012 +0000
56.3 @@ -0,0 +1,175 @@
56.4 +using System;
56.5 +using System.Collections.Generic;
56.6 +using System.Text;
56.7 +using System.Windows.Forms;
56.8 +using System.Drawing;
56.9 +using System.ComponentModel;
56.10 +
56.11 +namespace Aga.Controls.Tree.NodeControls
56.12 +{
56.13 + public abstract class EditableControl : InteractiveControl
56.14 + {
56.15 + private Timer _timer;
56.16 + private bool _editFlag;
56.17 +
56.18 + #region Properties
56.19 +
56.20 + private bool _editOnClick = false;
56.21 + [DefaultValue(false)]
56.22 + public bool EditOnClick
56.23 + {
56.24 + get { return _editOnClick; }
56.25 + set { _editOnClick = value; }
56.26 + }
56.27 +
56.28 + #endregion
56.29 +
56.30 + protected EditableControl()
56.31 + {
56.32 + _timer = new Timer();
56.33 + _timer.Interval = 500;
56.34 + _timer.Tick += new EventHandler(TimerTick);
56.35 + }
56.36 +
56.37 + private void TimerTick(object sender, EventArgs e)
56.38 + {
56.39 + _timer.Stop();
56.40 + if (_editFlag)
56.41 + BeginEdit();
56.42 + _editFlag = false;
56.43 + }
56.44 +
56.45 + public void SetEditorBounds(EditorContext context)
56.46 + {
56.47 + Size size = CalculateEditorSize(context);
56.48 + context.Editor.Bounds = new Rectangle(context.Bounds.X, context.Bounds.Y,
56.49 + Math.Min(size.Width, context.Bounds.Width),
56.50 + Math.Min(size.Height, Parent.ClientSize.Height - context.Bounds.Y)
56.51 + );
56.52 + }
56.53 +
56.54 + protected abstract Size CalculateEditorSize(EditorContext context);
56.55 +
56.56 + protected virtual bool CanEdit(TreeNodeAdv node)
56.57 + {
56.58 + return (node.Tag != null) && IsEditEnabled(node);
56.59 + }
56.60 +
56.61 + public void BeginEdit()
56.62 + {
56.63 + if (Parent != null && Parent.CurrentNode != null && CanEdit(Parent.CurrentNode))
56.64 + {
56.65 + CancelEventArgs args = new CancelEventArgs();
56.66 + OnEditorShowing(args);
56.67 + if (!args.Cancel)
56.68 + {
56.69 + var editor = CreateEditor(Parent.CurrentNode);
56.70 + Parent.DisplayEditor(editor, this);
56.71 + }
56.72 + }
56.73 + }
56.74 +
56.75 + public void EndEdit(bool applyChanges)
56.76 + {
56.77 + if (Parent != null)
56.78 + if (Parent.HideEditor(applyChanges))
56.79 + OnEditorHided();
56.80 + }
56.81 +
56.82 + public virtual void UpdateEditor(Control control)
56.83 + {
56.84 + }
56.85 +
56.86 + internal void ApplyChanges(TreeNodeAdv node, Control editor)
56.87 + {
56.88 + DoApplyChanges(node, editor);
56.89 + OnChangesApplied();
56.90 + }
56.91 +
56.92 + internal void DoDisposeEditor(Control editor)
56.93 + {
56.94 + DisposeEditor(editor);
56.95 + }
56.96 +
56.97 + protected abstract void DoApplyChanges(TreeNodeAdv node, Control editor);
56.98 +
56.99 + protected abstract Control CreateEditor(TreeNodeAdv node);
56.100 +
56.101 + protected abstract void DisposeEditor(Control editor);
56.102 +
56.103 + public virtual void Cut(Control control)
56.104 + {
56.105 + }
56.106 +
56.107 + public virtual void Copy(Control control)
56.108 + {
56.109 + }
56.110 +
56.111 + public virtual void Paste(Control control)
56.112 + {
56.113 + }
56.114 +
56.115 + public virtual void Delete(Control control)
56.116 + {
56.117 + }
56.118 +
56.119 + public override void MouseDown(TreeNodeAdvMouseEventArgs args)
56.120 + {
56.121 + _editFlag = (!EditOnClick && args.Button == MouseButtons.Left
56.122 + && args.ModifierKeys == Keys.None && args.Node.IsSelected);
56.123 + }
56.124 +
56.125 + public override void MouseUp(TreeNodeAdvMouseEventArgs args)
56.126 + {
56.127 + if (args.Node.IsSelected)
56.128 + {
56.129 + if (EditOnClick && args.Button == MouseButtons.Left && args.ModifierKeys == Keys.None)
56.130 + {
56.131 + Parent.ItemDragMode = false;
56.132 + BeginEdit();
56.133 + args.Handled = true;
56.134 + }
56.135 + else if (_editFlag)// && args.Node.IsSelected)
56.136 + _timer.Start();
56.137 + }
56.138 + }
56.139 +
56.140 + public override void MouseDoubleClick(TreeNodeAdvMouseEventArgs args)
56.141 + {
56.142 + _editFlag = false;
56.143 + _timer.Stop();
56.144 + }
56.145 +
56.146 + protected override void Dispose(bool disposing)
56.147 + {
56.148 + base.Dispose(disposing);
56.149 + if (disposing)
56.150 + _timer.Dispose();
56.151 + }
56.152 +
56.153 + #region Events
56.154 +
56.155 + public event CancelEventHandler EditorShowing;
56.156 + protected void OnEditorShowing(CancelEventArgs args)
56.157 + {
56.158 + if (EditorShowing != null)
56.159 + EditorShowing(this, args);
56.160 + }
56.161 +
56.162 + public event EventHandler EditorHided;
56.163 + protected void OnEditorHided()
56.164 + {
56.165 + if (EditorHided != null)
56.166 + EditorHided(this, EventArgs.Empty);
56.167 + }
56.168 +
56.169 + public event EventHandler ChangesApplied;
56.170 + protected void OnChangesApplied()
56.171 + {
56.172 + if (ChangesApplied != null)
56.173 + ChangesApplied(this, EventArgs.Empty);
56.174 + }
56.175 +
56.176 + #endregion
56.177 + }
56.178 +}
57.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
57.2 +++ b/External/Aga.Controls/Tree/NodeControls/ExpandingIcon.cs Sun May 27 15:16:19 2012 +0000
57.3 @@ -0,0 +1,83 @@
57.4 +using System;
57.5 +using System.Collections.Generic;
57.6 +using System.Text;
57.7 +using System.Drawing;
57.8 +using System.Threading;
57.9 +using System.Windows.Forms;
57.10 +
57.11 +namespace Aga.Controls.Tree.NodeControls
57.12 +{
57.13 + /// <summary>
57.14 + /// Displays an animated icon for those nodes, who are in expanding state.
57.15 + /// Parent TreeView must have AsyncExpanding property set to true.
57.16 + /// </summary>
57.17 + public class ExpandingIcon: NodeControl
57.18 + {
57.19 + private static GifDecoder _gif = ResourceHelper.LoadingIcon;
57.20 + private static int _index = 0;
57.21 + private static volatile Thread _animatingThread;
57.22 + private static object _lock = new object();
57.23 +
57.24 + public override Size MeasureSize(TreeNodeAdv node, DrawContext context)
57.25 + {
57.26 + return ResourceHelper.LoadingIcon.FrameSize;
57.27 + }
57.28 +
57.29 + protected override void OnIsVisibleValueNeeded(NodeControlValueEventArgs args)
57.30 + {
57.31 + args.Value = args.Node.IsExpandingNow;
57.32 + base.OnIsVisibleValueNeeded(args);
57.33 + }
57.34 +
57.35 + public override void Draw(TreeNodeAdv node, DrawContext context)
57.36 + {
57.37 + Rectangle rect = GetBounds(node, context);
57.38 + Image img = _gif.GetFrame(_index).Image;
57.39 + context.Graphics.DrawImage(img, rect.Location);
57.40 + }
57.41 +
57.42 + public static void Start()
57.43 + {
57.44 + lock (_lock)
57.45 + {
57.46 + if (_animatingThread == null)
57.47 + {
57.48 + _index = 0;
57.49 + _animatingThread = new Thread(new ThreadStart(IterateIcons));
57.50 + _animatingThread.IsBackground = true;
57.51 + _animatingThread.Priority = ThreadPriority.Lowest;
57.52 + _animatingThread.Start();
57.53 + }
57.54 + }
57.55 + }
57.56 +
57.57 + public static void Stop()
57.58 + {
57.59 + lock (_lock)
57.60 + {
57.61 + _index = 0;
57.62 + _animatingThread = null;
57.63 + }
57.64 + }
57.65 +
57.66 + private static void IterateIcons()
57.67 + {
57.68 + while (_animatingThread != null)
57.69 + {
57.70 + if (_index < _gif.FrameCount - 1)
57.71 + _index++;
57.72 + else
57.73 + _index = 0;
57.74 +
57.75 + if (IconChanged != null)
57.76 + IconChanged(null, EventArgs.Empty);
57.77 +
57.78 + int delay = _gif.GetFrame(_index).Delay;
57.79 + Thread.Sleep(delay);
57.80 + }
57.81 + System.Diagnostics.Debug.WriteLine("IterateIcons Stopped");
57.82 + }
57.83 +
57.84 + public static event EventHandler IconChanged;
57.85 + }
57.86 +}
58.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
58.2 +++ b/External/Aga.Controls/Tree/NodeControls/InteractiveControl.cs Sun May 27 15:16:19 2012 +0000
58.3 @@ -0,0 +1,38 @@
58.4 +using System;
58.5 +using System.Collections.Generic;
58.6 +using System.Text;
58.7 +using System.ComponentModel;
58.8 +
58.9 +namespace Aga.Controls.Tree.NodeControls
58.10 +{
58.11 + public abstract class InteractiveControl : BindableControl
58.12 + {
58.13 + private bool _editEnabled = false;
58.14 + [DefaultValue(false)]
58.15 + public bool EditEnabled
58.16 + {
58.17 + get { return _editEnabled; }
58.18 + set { _editEnabled = value; }
58.19 + }
58.20 +
58.21 + protected bool IsEditEnabled(TreeNodeAdv node)
58.22 + {
58.23 + if (EditEnabled)
58.24 + {
58.25 + NodeControlValueEventArgs args = new NodeControlValueEventArgs(node);
58.26 + args.Value = true;
58.27 + OnIsEditEnabledValueNeeded(args);
58.28 + return Convert.ToBoolean(args.Value);
58.29 + }
58.30 + else
58.31 + return false;
58.32 + }
58.33 +
58.34 + public event EventHandler<NodeControlValueEventArgs> IsEditEnabledValueNeeded;
58.35 + private void OnIsEditEnabledValueNeeded(NodeControlValueEventArgs args)
58.36 + {
58.37 + if (IsEditEnabledValueNeeded != null)
58.38 + IsEditEnabledValueNeeded(this, args);
58.39 + }
58.40 + }
58.41 +}
59.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
59.2 +++ b/External/Aga.Controls/Tree/NodeControls/LabelEventArgs.cs Sun May 27 15:16:19 2012 +0000
59.3 @@ -0,0 +1,34 @@
59.4 +using System;
59.5 +using System.Collections.Generic;
59.6 +using System.Text;
59.7 +
59.8 +namespace Aga.Controls.Tree.NodeControls
59.9 +{
59.10 + public class LabelEventArgs : EventArgs
59.11 + {
59.12 + private object _subject;
59.13 + public object Subject
59.14 + {
59.15 + get { return _subject; }
59.16 + }
59.17 +
59.18 + private string _oldLabel;
59.19 + public string OldLabel
59.20 + {
59.21 + get { return _oldLabel; }
59.22 + }
59.23 +
59.24 + private string _newLabel;
59.25 + public string NewLabel
59.26 + {
59.27 + get { return _newLabel; }
59.28 + }
59.29 +
59.30 + public LabelEventArgs(object subject, string oldLabel, string newLabel)
59.31 + {
59.32 + _subject = subject;
59.33 + _oldLabel = oldLabel;
59.34 + _newLabel = newLabel;
59.35 + }
59.36 + }
59.37 +}
60.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
60.2 +++ b/External/Aga.Controls/Tree/NodeControls/NodeCheckBox.cs Sun May 27 15:16:19 2012 +0000
60.3 @@ -0,0 +1,184 @@
60.4 +using System;
60.5 +using System.Collections.Generic;
60.6 +using System.Text;
60.7 +using System.Drawing;
60.8 +using Aga.Controls.Properties;
60.9 +using System.Reflection;
60.10 +using System.Windows.Forms;
60.11 +using System.Windows.Forms.VisualStyles;
60.12 +using System.ComponentModel;
60.13 +
60.14 +namespace Aga.Controls.Tree.NodeControls
60.15 +{
60.16 + public class NodeCheckBox : InteractiveControl
60.17 + {
60.18 + public const int ImageSize = 13;
60.19 +
60.20 + private Bitmap _check;
60.21 + private Bitmap _uncheck;
60.22 + private Bitmap _unknown;
60.23 +
60.24 + #region Properties
60.25 +
60.26 + private bool _threeState;
60.27 + [DefaultValue(false)]
60.28 + public bool ThreeState
60.29 + {
60.30 + get { return _threeState; }
60.31 + set { _threeState = value; }
60.32 + }
60.33 +
60.34 + #endregion
60.35 +
60.36 + public NodeCheckBox()
60.37 + : this(string.Empty)
60.38 + {
60.39 + }
60.40 +
60.41 + public NodeCheckBox(string propertyName)
60.42 + {
60.43 + _check = Resources.check;
60.44 + _uncheck = Resources.uncheck;
60.45 + _unknown = Resources.unknown;
60.46 + DataPropertyName = propertyName;
60.47 + LeftMargin = 0;
60.48 + }
60.49 +
60.50 + public override Size MeasureSize(TreeNodeAdv node, DrawContext context)
60.51 + {
60.52 + return new Size(ImageSize, ImageSize);
60.53 + }
60.54 +
60.55 + public override void Draw(TreeNodeAdv node, DrawContext context)
60.56 + {
60.57 + Rectangle bounds = GetBounds(node, context);
60.58 + CheckState state = GetCheckState(node);
60.59 + if (Application.RenderWithVisualStyles)
60.60 + {
60.61 + VisualStyleRenderer renderer;
60.62 + if (state == CheckState.Indeterminate)
60.63 + renderer = new VisualStyleRenderer(VisualStyleElement.Button.CheckBox.MixedNormal);
60.64 + else if (state == CheckState.Checked)
60.65 + renderer = new VisualStyleRenderer(VisualStyleElement.Button.CheckBox.CheckedNormal);
60.66 + else
60.67 + renderer = new VisualStyleRenderer(VisualStyleElement.Button.CheckBox.UncheckedNormal);
60.68 + renderer.DrawBackground(context.Graphics, new Rectangle(bounds.X, bounds.Y, ImageSize, ImageSize));
60.69 + }
60.70 + else
60.71 + {
60.72 + Image img;
60.73 + if (state == CheckState.Indeterminate)
60.74 + img = _unknown;
60.75 + else if (state == CheckState.Checked)
60.76 + img = _check;
60.77 + else
60.78 + img = _uncheck;
60.79 + context.Graphics.DrawImage(img, bounds.Location);
60.80 + }
60.81 + }
60.82 +
60.83 + protected virtual CheckState GetCheckState(TreeNodeAdv node)
60.84 + {
60.85 + object obj = GetValue(node);
60.86 + if (obj is CheckState)
60.87 + return (CheckState)obj;
60.88 + else if (obj is bool)
60.89 + return (bool)obj ? CheckState.Checked : CheckState.Unchecked;
60.90 + else
60.91 + return CheckState.Unchecked;
60.92 + }
60.93 +
60.94 + protected virtual void SetCheckState(TreeNodeAdv node, CheckState value)
60.95 + {
60.96 + if (VirtualMode)
60.97 + {
60.98 + SetValue(node, value);
60.99 + OnCheckStateChanged(node);
60.100 + }
60.101 + else
60.102 + {
60.103 + Type type = GetPropertyType(node);
60.104 + if (type == typeof(CheckState))
60.105 + {
60.106 + SetValue(node, value);
60.107 + OnCheckStateChanged(node);
60.108 + }
60.109 + else if (type == typeof(bool))
60.110 + {
60.111 + SetValue(node, value != CheckState.Unchecked);
60.112 + OnCheckStateChanged(node);
60.113 + }
60.114 + }
60.115 + }
60.116 +
60.117 + public override void MouseDown(TreeNodeAdvMouseEventArgs args)
60.118 + {
60.119 + if (args.Button == MouseButtons.Left && IsEditEnabled(args.Node))
60.120 + {
60.121 + DrawContext context = new DrawContext();
60.122 + context.Bounds = args.ControlBounds;
60.123 + Rectangle rect = GetBounds(args.Node, context);
60.124 + if (rect.Contains(args.ViewLocation))
60.125 + {
60.126 + CheckState state = GetCheckState(args.Node);
60.127 + state = GetNewState(state);
60.128 + SetCheckState(args.Node, state);
60.129 + Parent.UpdateView();
60.130 + args.Handled = true;
60.131 + }
60.132 + }
60.133 + }
60.134 +
60.135 + public override void MouseDoubleClick(TreeNodeAdvMouseEventArgs args)
60.136 + {
60.137 + args.Handled = true;
60.138 + }
60.139 +
60.140 + private CheckState GetNewState(CheckState state)
60.141 + {
60.142 + if (state == CheckState.Indeterminate)
60.143 + return CheckState.Unchecked;
60.144 + else if(state == CheckState.Unchecked)
60.145 + return CheckState.Checked;
60.146 + else
60.147 + return ThreeState ? CheckState.Indeterminate : CheckState.Unchecked;
60.148 + }
60.149 +
60.150 + public override void KeyDown(KeyEventArgs args)
60.151 + {
60.152 + if (args.KeyCode == Keys.Space && EditEnabled)
60.153 + {
60.154 + Parent.BeginUpdate();
60.155 + try
60.156 + {
60.157 + if (Parent.CurrentNode != null)
60.158 + {
60.159 + CheckState value = GetNewState(GetCheckState(Parent.CurrentNode));
60.160 + foreach (TreeNodeAdv node in Parent.Selection)
60.161 + if (IsEditEnabled(node))
60.162 + SetCheckState(node, value);
60.163 + }
60.164 + }
60.165 + finally
60.166 + {
60.167 + Parent.EndUpdate();
60.168 + }
60.169 + args.Handled = true;
60.170 + }
60.171 + }
60.172 +
60.173 + public event EventHandler<TreePathEventArgs> CheckStateChanged;
60.174 + protected void OnCheckStateChanged(TreePathEventArgs args)
60.175 + {
60.176 + if (CheckStateChanged != null)
60.177 + CheckStateChanged(this, args);
60.178 + }
60.179 +
60.180 + protected void OnCheckStateChanged(TreeNodeAdv node)
60.181 + {
60.182 + TreePath path = this.Parent.GetPath(node);
60.183 + OnCheckStateChanged(new TreePathEventArgs(path));
60.184 + }
60.185 +
60.186 + }
60.187 +}
61.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
61.2 +++ b/External/Aga.Controls/Tree/NodeControls/NodeComboBox.cs Sun May 27 15:16:19 2012 +0000
61.3 @@ -0,0 +1,232 @@
61.4 +using System;
61.5 +using System.Collections.Generic;
61.6 +using System.Text;
61.7 +using System.Drawing;
61.8 +using System.Windows.Forms;
61.9 +using System.Reflection;
61.10 +using System.ComponentModel;
61.11 +using System.Drawing.Design;
61.12 +
61.13 +namespace Aga.Controls.Tree.NodeControls
61.14 +{
61.15 + public class NodeComboBox : BaseTextControl
61.16 + {
61.17 + #region Properties
61.18 +
61.19 + private int _editorWidth = 100;
61.20 + [DefaultValue(100)]
61.21 + public int EditorWidth
61.22 + {
61.23 + get { return _editorWidth; }
61.24 + set { _editorWidth = value; }
61.25 + }
61.26 +
61.27 + private int _editorHeight = 100;
61.28 + [DefaultValue(100)]
61.29 + public int EditorHeight
61.30 + {
61.31 + get { return _editorHeight; }
61.32 + set { _editorHeight = value; }
61.33 + }
61.34 +
61.35 + private List<object> _dropDownItems;
61.36 + [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1002:DoNotExposeGenericLists")]
61.37 + [Editor(typeof(StringCollectionEditor), typeof(UITypeEditor)), DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
61.38 + public List<object> DropDownItems
61.39 + {
61.40 + get { return _dropDownItems; }
61.41 + }
61.42 +
61.43 + #endregion
61.44 +
61.45 + public event EventHandler<EditEventArgs> CreatingEditor;
61.46 +
61.47 + public NodeComboBox()
61.48 + {
61.49 + _dropDownItems = new List<object>();
61.50 + }
61.51 +
61.52 + protected override Size CalculateEditorSize(EditorContext context)
61.53 + {
61.54 + if (Parent.UseColumns)
61.55 + {
61.56 + if (context.Editor is CheckedListBox)
61.57 + return new Size(context.Bounds.Size.Width, EditorHeight);
61.58 + else
61.59 + return context.Bounds.Size;
61.60 + }
61.61 + else
61.62 + {
61.63 + if (context.Editor is CheckedListBox)
61.64 + return new Size(EditorWidth, EditorHeight);
61.65 + else
61.66 + return new Size(EditorWidth, context.Bounds.Height);
61.67 + }
61.68 + }
61.69 +
61.70 + protected override Control CreateEditor(TreeNodeAdv node)
61.71 + {
61.72 + Control c;
61.73 + object value = GetValue(node);
61.74 + if (IsCheckedListBoxRequired(node))
61.75 + c = CreateCheckedListBox(node);
61.76 + else
61.77 + c = CreateCombo(node);
61.78 + OnCreatingEditor(new EditEventArgs(node, c));
61.79 + return c;
61.80 + }
61.81 +
61.82 + protected override void DisposeEditor(Control editor)
61.83 + {
61.84 + }
61.85 +
61.86 + protected virtual void OnCreatingEditor(EditEventArgs args)
61.87 + {
61.88 + if (CreatingEditor != null)
61.89 + CreatingEditor(this, args);
61.90 + }
61.91 +
61.92 + protected virtual bool IsCheckedListBoxRequired(TreeNodeAdv node)
61.93 + {
61.94 + object value = GetValue(node);
61.95 + if (value != null)
61.96 + {
61.97 + Type t = value.GetType();
61.98 + object[] arr = t.GetCustomAttributes(typeof(FlagsAttribute), false);
61.99 + return (t.IsEnum && arr.Length == 1);
61.100 + }
61.101 + return false;
61.102 + }
61.103 +
61.104 + private Control CreateCombo(TreeNodeAdv node)
61.105 + {
61.106 + ComboBox comboBox = new ComboBox();
61.107 + if (DropDownItems != null)
61.108 + comboBox.Items.AddRange(DropDownItems.ToArray());
61.109 + comboBox.SelectedItem = GetValue(node);
61.110 + comboBox.DropDownStyle = ComboBoxStyle.DropDownList;
61.111 + comboBox.DropDownClosed += new EventHandler(EditorDropDownClosed);
61.112 + SetEditControlProperties(comboBox, node);
61.113 + return comboBox;
61.114 + }
61.115 +
61.116 + private Control CreateCheckedListBox(TreeNodeAdv node)
61.117 + {
61.118 + CheckedListBox listBox = new CheckedListBox();
61.119 + listBox.CheckOnClick = true;
61.120 +
61.121 + object value = GetValue(node);
61.122 + Type enumType = GetEnumType(node);
61.123 + foreach (object obj in Enum.GetValues(enumType))
61.124 + {
61.125 + object[] attributes = enumType.GetField(obj.ToString()).GetCustomAttributes(typeof(BrowsableAttribute), false);
61.126 + if (attributes.Length == 0 || ((BrowsableAttribute)attributes[0]).Browsable)
61.127 + listBox.Items.Add(obj, IsContain(value, obj));
61.128 + }
61.129 +
61.130 + SetEditControlProperties(listBox, node);
61.131 + if (CreatingEditor != null)
61.132 + CreatingEditor(this, new EditEventArgs(node, listBox));
61.133 + return listBox;
61.134 + }
61.135 +
61.136 + protected virtual Type GetEnumType(TreeNodeAdv node)
61.137 + {
61.138 + object value = GetValue(node);
61.139 + return value.GetType();
61.140 + }
61.141 +
61.142 + private bool IsContain(object value, object enumElement)
61.143 + {
61.144 + if (value == null || enumElement == null)
61.145 + return false;
61.146 + if (value.GetType().IsEnum)
61.147 + {
61.148 + int i1 = (int)value;
61.149 + int i2 = (int)enumElement;
61.150 + return (i1 & i2) == i2;
61.151 + }
61.152 + else
61.153 + {
61.154 + var arr = value as object[];
61.155 + foreach (object obj in arr)
61.156 + if ((int)obj == (int)enumElement)
61.157 + return true;
61.158 + return false;
61.159 + }
61.160 + }
61.161 +
61.162 + protected override string FormatLabel(object obj)
61.163 + {
61.164 + var arr = obj as object[];
61.165 + if (arr != null)
61.166 + {
61.167 + StringBuilder sb = new StringBuilder();
61.168 + foreach (object t in arr)
61.169 + {
61.170 + if (sb.Length > 0)
61.171 + sb.Append(", ");
61.172 + sb.Append(t);
61.173 + }
61.174 + return sb.ToString();
61.175 + }
61.176 + else
61.177 + return base.FormatLabel(obj);
61.178 + }
61.179 +
61.180 + void EditorDropDownClosed(object sender, EventArgs e)
61.181 + {
61.182 + EndEdit(true);
61.183 + }
61.184 +
61.185 + public override void UpdateEditor(Control control)
61.186 + {
61.187 + if (control is ComboBox)
61.188 + (control as ComboBox).DroppedDown = true;
61.189 + }
61.190 +
61.191 + protected override void DoApplyChanges(TreeNodeAdv node, Control editor)
61.192 + {
61.193 + var combo = editor as ComboBox;
61.194 + if (combo != null)
61.195 + {
61.196 + if (combo.DropDownStyle == ComboBoxStyle.DropDown)
61.197 + SetValue(node, combo.Text);
61.198 + else
61.199 + SetValue(node, combo.SelectedItem);
61.200 + }
61.201 + else
61.202 + {
61.203 + var listBox = editor as CheckedListBox;
61.204 + Type type = GetEnumType(node);
61.205 + if (IsFlags(type))
61.206 + {
61.207 + int res = 0;
61.208 + foreach (object obj in listBox.CheckedItems)
61.209 + res |= (int)obj;
61.210 + object val = Enum.ToObject(type, res);
61.211 + SetValue(node, val);
61.212 + }
61.213 + else
61.214 + {
61.215 + List<object> list = new List<object>();
61.216 + foreach (object obj in listBox.CheckedItems)
61.217 + list.Add(obj);
61.218 + SetValue(node, list.ToArray());
61.219 + }
61.220 + }
61.221 + }
61.222 +
61.223 + private bool IsFlags(Type type)
61.224 + {
61.225 + object[] atr = type.GetCustomAttributes(typeof(FlagsAttribute), false);
61.226 + return atr.Length == 1;
61.227 + }
61.228 +
61.229 + public override void MouseUp(TreeNodeAdvMouseEventArgs args)
61.230 + {
61.231 + if (args.Node != null && args.Node.IsSelected) //Workaround of specific ComboBox control behavior
61.232 + base.MouseUp(args);
61.233 + }
61.234 + }
61.235 +}
62.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
62.2 +++ b/External/Aga.Controls/Tree/NodeControls/NodeControl.cs Sun May 27 15:16:19 2012 +0000
62.3 @@ -0,0 +1,169 @@
62.4 +using System;
62.5 +using System.Collections.Generic;
62.6 +using System.Text;
62.7 +using System.Windows.Forms;
62.8 +using System.Drawing;
62.9 +using System.ComponentModel;
62.10 +
62.11 +namespace Aga.Controls.Tree.NodeControls
62.12 +{
62.13 + [DesignTimeVisible(false), ToolboxItem(false)]
62.14 + public abstract class NodeControl : Component
62.15 + {
62.16 + #region Properties
62.17 +
62.18 + private TreeViewAdv _parent;
62.19 + [Browsable(false)]
62.20 + [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
62.21 + public TreeViewAdv Parent
62.22 + {
62.23 + get { return _parent; }
62.24 + set
62.25 + {
62.26 + if (value != _parent)
62.27 + {
62.28 + if (_parent != null)
62.29 + _parent.NodeControls.Remove(this);
62.30 +
62.31 + if (value != null)
62.32 + value.NodeControls.Add(this);
62.33 + }
62.34 + }
62.35 + }
62.36 +
62.37 + private IToolTipProvider _toolTipProvider;
62.38 + [Browsable(false), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
62.39 + public IToolTipProvider ToolTipProvider
62.40 + {
62.41 + get { return _toolTipProvider; }
62.42 + set { _toolTipProvider = value; }
62.43 + }
62.44 +
62.45 + private TreeColumn _parentColumn;
62.46 + public TreeColumn ParentColumn
62.47 + {
62.48 + get { return _parentColumn; }
62.49 + set
62.50 + {
62.51 + _parentColumn = value;
62.52 + if (_parent != null)
62.53 + _parent.FullUpdate();
62.54 + }
62.55 + }
62.56 +
62.57 + private VerticalAlignment _verticalAlign = VerticalAlignment.Center;
62.58 + [DefaultValue(VerticalAlignment.Center)]
62.59 + public VerticalAlignment VerticalAlign
62.60 + {
62.61 + get { return _verticalAlign; }
62.62 + set
62.63 + {
62.64 + _verticalAlign = value;
62.65 + if (_parent != null)
62.66 + _parent.FullUpdate();
62.67 + }
62.68 + }
62.69 +
62.70 + private int _leftMargin = 0;
62.71 + public int LeftMargin
62.72 + {
62.73 + get { return _leftMargin; }
62.74 + set
62.75 + {
62.76 + if (value < 0)
62.77 + throw new ArgumentOutOfRangeException();
62.78 +
62.79 + _leftMargin = value;
62.80 + if (_parent != null)
62.81 + _parent.FullUpdate();
62.82 + }
62.83 + }
62.84 + #endregion
62.85 +
62.86 + internal virtual void AssignParent(TreeViewAdv parent)
62.87 + {
62.88 + _parent = parent;
62.89 + }
62.90 +
62.91 + protected virtual Rectangle GetBounds(TreeNodeAdv node, DrawContext context)
62.92 + {
62.93 + Rectangle r = context.Bounds;
62.94 + Size s = GetActualSize(node, context);
62.95 + Size bs = new Size(r.Width - LeftMargin, Math.Min(r.Height, s.Height));
62.96 + switch (VerticalAlign)
62.97 + {
62.98 + case VerticalAlignment.Top:
62.99 + return new Rectangle(new Point(r.X + LeftMargin, r.Y), bs);
62.100 + case VerticalAlignment.Bottom:
62.101 + return new Rectangle(new Point(r.X + LeftMargin, r.Bottom - s.Height), bs);
62.102 + default:
62.103 + return new Rectangle(new Point(r.X + LeftMargin, r.Y + (r.Height - s.Height) / 2), bs);
62.104 + }
62.105 + }
62.106 +
62.107 + protected void CheckThread()
62.108 + {
62.109 + if (Parent != null && Control.CheckForIllegalCrossThreadCalls)
62.110 + if (Parent.InvokeRequired)
62.111 + throw new InvalidOperationException("Cross-thread calls are not allowed");
62.112 + }
62.113 +
62.114 + public bool IsVisible(TreeNodeAdv node)
62.115 + {
62.116 + NodeControlValueEventArgs args = new NodeControlValueEventArgs(node);
62.117 + args.Value = true;
62.118 + OnIsVisibleValueNeeded(args);
62.119 + return Convert.ToBoolean(args.Value);
62.120 + }
62.121 +
62.122 + internal Size GetActualSize(TreeNodeAdv node, DrawContext context)
62.123 + {
62.124 + if (IsVisible(node))
62.125 + {
62.126 + Size s = MeasureSize(node, context);
62.127 + return new Size(s.Width + LeftMargin, s.Height);
62.128 + }
62.129 + else
62.130 + return Size.Empty;
62.131 + }
62.132 +
62.133 + public abstract Size MeasureSize(TreeNodeAdv node, DrawContext context);
62.134 +
62.135 + public abstract void Draw(TreeNodeAdv node, DrawContext context);
62.136 +
62.137 + public virtual string GetToolTip(TreeNodeAdv node)
62.138 + {
62.139 + if (ToolTipProvider != null)
62.140 + return ToolTipProvider.GetToolTip(node, this);
62.141 + else
62.142 + return string.Empty;
62.143 + }
62.144 +
62.145 + public virtual void MouseDown(TreeNodeAdvMouseEventArgs args)
62.146 + {
62.147 + }
62.148 +
62.149 + public virtual void MouseUp(TreeNodeAdvMouseEventArgs args)
62.150 + {
62.151 + }
62.152 +
62.153 + public virtual void MouseDoubleClick(TreeNodeAdvMouseEventArgs args)
62.154 + {
62.155 + }
62.156 +
62.157 + public virtual void KeyDown(KeyEventArgs args)
62.158 + {
62.159 + }
62.160 +
62.161 + public virtual void KeyUp(KeyEventArgs args)
62.162 + {
62.163 + }
62.164 +
62.165 + public event EventHandler<NodeControlValueEventArgs> IsVisibleValueNeeded;
62.166 + protected virtual void OnIsVisibleValueNeeded(NodeControlValueEventArgs args)
62.167 + {
62.168 + if (IsVisibleValueNeeded != null)
62.169 + IsVisibleValueNeeded(this, args);
62.170 + }
62.171 + }
62.172 +}
63.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
63.2 +++ b/External/Aga.Controls/Tree/NodeControls/NodeControlValueEventArgs.cs Sun May 27 15:16:19 2012 +0000
63.3 @@ -0,0 +1,21 @@
63.4 +using System;
63.5 +using System.Collections.Generic;
63.6 +using System.Text;
63.7 +
63.8 +namespace Aga.Controls.Tree.NodeControls
63.9 +{
63.10 + public class NodeControlValueEventArgs : NodeEventArgs
63.11 + {
63.12 + private object _value;
63.13 + public object Value
63.14 + {
63.15 + get { return _value; }
63.16 + set { _value = value; }
63.17 + }
63.18 +
63.19 + public NodeControlValueEventArgs(TreeNodeAdv node)
63.20 + :base(node)
63.21 + {
63.22 + }
63.23 + }
63.24 +}
64.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
64.2 +++ b/External/Aga.Controls/Tree/NodeControls/NodeControlsCollection.cs Sun May 27 15:16:19 2012 +0000
64.3 @@ -0,0 +1,94 @@
64.4 +using System;
64.5 +using System.Collections.Generic;
64.6 +using System.Text;
64.7 +using System.ComponentModel.Design;
64.8 +using System.Collections.ObjectModel;
64.9 +using System.ComponentModel;
64.10 +using System.Drawing.Design;
64.11 +
64.12 +namespace Aga.Controls.Tree.NodeControls
64.13 +{
64.14 + internal class NodeControlsCollection : Collection<NodeControl>
64.15 + {
64.16 + private TreeViewAdv _tree;
64.17 +
64.18 + public NodeControlsCollection(TreeViewAdv tree)
64.19 + {
64.20 + _tree = tree;
64.21 + }
64.22 +
64.23 + protected override void ClearItems()
64.24 + {
64.25 + _tree.BeginUpdate();
64.26 + try
64.27 + {
64.28 + while (this.Count != 0)
64.29 + this.RemoveAt(this.Count - 1);
64.30 + }
64.31 + finally
64.32 + {
64.33 + _tree.EndUpdate();
64.34 + }
64.35 + }
64.36 +
64.37 + protected override void InsertItem(int index, NodeControl item)
64.38 + {
64.39 + if (item == null)
64.40 + throw new ArgumentNullException("item");
64.41 +
64.42 + if (item.Parent != _tree)
64.43 + {
64.44 + if (item.Parent != null)
64.45 + {
64.46 + item.Parent.NodeControls.Remove(item);
64.47 + }
64.48 + base.InsertItem(index, item);
64.49 + item.AssignParent(_tree);
64.50 + _tree.FullUpdate();
64.51 + }
64.52 + }
64.53 +
64.54 + protected override void RemoveItem(int index)
64.55 + {
64.56 + NodeControl value = this[index];
64.57 + value.AssignParent(null);
64.58 + base.RemoveItem(index);
64.59 + _tree.FullUpdate();
64.60 + }
64.61 +
64.62 + protected override void SetItem(int index, NodeControl item)
64.63 + {
64.64 + if (item == null)
64.65 + throw new ArgumentNullException("item");
64.66 +
64.67 + _tree.BeginUpdate();
64.68 + try
64.69 + {
64.70 + RemoveAt(index);
64.71 + InsertItem(index, item);
64.72 + }
64.73 + finally
64.74 + {
64.75 + _tree.EndUpdate();
64.76 + }
64.77 + }
64.78 + }
64.79 +
64.80 + internal class NodeControlCollectionEditor : CollectionEditor
64.81 + {
64.82 + private Type[] _types;
64.83 +
64.84 + public NodeControlCollectionEditor(Type type)
64.85 + : base(type)
64.86 + {
64.87 + _types = new Type[] { typeof(NodeTextBox), typeof(NodeIntegerTextBox), typeof(NodeDecimalTextBox),
64.88 + typeof(NodeComboBox), typeof(NodeCheckBox),
64.89 + typeof(NodeStateIcon), typeof(NodeIcon), typeof(NodeNumericUpDown), typeof(ExpandingIcon) };
64.90 + }
64.91 +
64.92 + protected override System.Type[] CreateNewItemTypes()
64.93 + {
64.94 + return _types;
64.95 + }
64.96 + }
64.97 +}
65.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
65.2 +++ b/External/Aga.Controls/Tree/NodeControls/NodeDecimalTextBox.cs Sun May 27 15:16:19 2012 +0000
65.3 @@ -0,0 +1,46 @@
65.4 +using System;
65.5 +using System.Collections.Generic;
65.6 +using System.Text;
65.7 +using System.Drawing;
65.8 +using System.Windows.Forms;
65.9 +using System.Reflection;
65.10 +using System.ComponentModel;
65.11 +
65.12 +namespace Aga.Controls.Tree.NodeControls
65.13 +{
65.14 + public class NodeDecimalTextBox : NodeTextBox
65.15 + {
65.16 + private bool _allowDecimalSeparator = true;
65.17 + [DefaultValue(true)]
65.18 + public bool AllowDecimalSeparator
65.19 + {
65.20 + get { return _allowDecimalSeparator; }
65.21 + set { _allowDecimalSeparator = value; }
65.22 + }
65.23 +
65.24 + private bool _allowNegativeSign = true;
65.25 + [DefaultValue(true)]
65.26 + public bool AllowNegativeSign
65.27 + {
65.28 + get { return _allowNegativeSign; }
65.29 + set { _allowNegativeSign = value; }
65.30 + }
65.31 +
65.32 + protected NodeDecimalTextBox()
65.33 + {
65.34 + }
65.35 +
65.36 + protected override TextBox CreateTextBox()
65.37 + {
65.38 + NumericTextBox textBox = new NumericTextBox();
65.39 + textBox.AllowDecimalSeparator = AllowDecimalSeparator;
65.40 + textBox.AllowNegativeSign = AllowNegativeSign;
65.41 + return textBox;
65.42 + }
65.43 +
65.44 + protected override void DoApplyChanges(TreeNodeAdv node, Control editor)
65.45 + {
65.46 + SetValue(node, (editor as NumericTextBox).DecimalValue);
65.47 + }
65.48 + }
65.49 +}
66.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
66.2 +++ b/External/Aga.Controls/Tree/NodeControls/NodeEventArgs.cs Sun May 27 15:16:19 2012 +0000
66.3 @@ -0,0 +1,20 @@
66.4 +using System;
66.5 +using System.Collections.Generic;
66.6 +using System.Text;
66.7 +
66.8 +namespace Aga.Controls.Tree.NodeControls
66.9 +{
66.10 + public class NodeEventArgs : EventArgs
66.11 + {
66.12 + private TreeNodeAdv _node;
66.13 + public TreeNodeAdv Node
66.14 + {
66.15 + get { return _node; }
66.16 + }
66.17 +
66.18 + public NodeEventArgs(TreeNodeAdv node)
66.19 + {
66.20 + _node = node;
66.21 + }
66.22 + }
66.23 +}
67.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
67.2 +++ b/External/Aga.Controls/Tree/NodeControls/NodeIcon.cs Sun May 27 15:16:19 2012 +0000
67.3 @@ -0,0 +1,99 @@
67.4 +using System;
67.5 +using System.Collections.Generic;
67.6 +using System.Text;
67.7 +using System.Drawing;
67.8 +using System.Windows.Forms;
67.9 +using Aga.Controls.Properties;
67.10 +using System.ComponentModel;
67.11 +
67.12 +namespace Aga.Controls.Tree.NodeControls
67.13 +{
67.14 + public class NodeIcon : BindableControl
67.15 + {
67.16 + public NodeIcon()
67.17 + {
67.18 + LeftMargin = 1;
67.19 + }
67.20 +
67.21 + public override Size MeasureSize(TreeNodeAdv node, DrawContext context)
67.22 + {
67.23 + Image image = GetIcon(node);
67.24 + if (image != null)
67.25 + return image.Size;
67.26 + else
67.27 + return Size.Empty;
67.28 + }
67.29 +
67.30 +
67.31 + public override void Draw(TreeNodeAdv node, DrawContext context)
67.32 + {
67.33 + Image image = GetIcon(node);
67.34 + if (image != null)
67.35 + {
67.36 + Rectangle r = GetBounds(node, context);
67.37 + if ( image.Width > 0 && image.Height > 0 )
67.38 + {
67.39 + switch (_scaleMode)
67.40 + {
67.41 + case ImageScaleMode.Fit:
67.42 + context.Graphics.DrawImage(image, r);
67.43 + break;
67.44 + case ImageScaleMode.ScaleDown:
67.45 + {
67.46 + float factor = Math.Min((float)r.Width / (float)image.Width, (float)r.Height / (float)image.Height);
67.47 + if (factor < 1)
67.48 + context.Graphics.DrawImage(image, r.X, r.Y, image.Width * factor, image.Height * factor);
67.49 + else
67.50 + context.Graphics.DrawImage(image, r.X, r.Y, image.Width, image.Height);
67.51 + } break;
67.52 + case ImageScaleMode.ScaleUp:
67.53 + {
67.54 + float factor = Math.Max((float)r.Width / (float)image.Width, (float)r.Height / (float)image.Height);
67.55 + if (factor > 1)
67.56 + context.Graphics.DrawImage(image, r.X, r.Y, image.Width * factor, image.Height * factor);
67.57 + else
67.58 + context.Graphics.DrawImage(image, r.X, r.Y, image.Width, image.Height);
67.59 + } break;
67.60 + case ImageScaleMode.AlwaysScale:
67.61 + {
67.62 + float fx = (float)r.Width / (float)image.Width;
67.63 + float fy = (float)r.Height / (float)image.Height;
67.64 + if (Math.Min(fx, fy) < 1)
67.65 + { //scale down
67.66 + float factor = Math.Min(fx, fy);
67.67 + context.Graphics.DrawImage(image, r.X, r.Y, image.Width * factor, image.Height * factor);
67.68 + }
67.69 + else if (Math.Max(fx, fy) > 1)
67.70 + {
67.71 + float factor = Math.Max(fx, fy);
67.72 + context.Graphics.DrawImage(image, r.X, r.Y, image.Width * factor, image.Height * factor);
67.73 + }
67.74 + else
67.75 + context.Graphics.DrawImage(image, r.X, r.Y, image.Width, image.Height);
67.76 + } break;
67.77 + case ImageScaleMode.Clip:
67.78 + default:
67.79 + context.Graphics.DrawImage(image, r.X, r.Y, image.Width, image.Height);
67.80 + break;
67.81 + }
67.82 + }
67.83 +
67.84 + }
67.85 + }
67.86 +
67.87 + protected virtual Image GetIcon(TreeNodeAdv node)
67.88 + {
67.89 + return GetValue(node) as Image;
67.90 + }
67.91 +
67.92 + private ImageScaleMode _scaleMode = ImageScaleMode.Clip;
67.93 + [DefaultValue("Clip"), Category("Appearance")]
67.94 + public ImageScaleMode ScaleMode
67.95 + {
67.96 + get { return _scaleMode; }
67.97 + set { _scaleMode = value; }
67.98 + }
67.99 +
67.100 +
67.101 + }
67.102 +}
68.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
68.2 +++ b/External/Aga.Controls/Tree/NodeControls/NodeIntegerTextBox.cs Sun May 27 15:16:19 2012 +0000
68.3 @@ -0,0 +1,37 @@
68.4 +using System;
68.5 +using System.Collections.Generic;
68.6 +using System.Text;
68.7 +using System.ComponentModel;
68.8 +using System.Windows.Forms;
68.9 +
68.10 +namespace Aga.Controls.Tree.NodeControls
68.11 +{
68.12 +
68.13 + public class NodeIntegerTextBox : NodeTextBox
68.14 + {
68.15 + private bool _allowNegativeSign = true;
68.16 + [DefaultValue(true)]
68.17 + public bool AllowNegativeSign
68.18 + {
68.19 + get { return _allowNegativeSign; }
68.20 + set { _allowNegativeSign = value; }
68.21 + }
68.22 +
68.23 + public NodeIntegerTextBox()
68.24 + {
68.25 + }
68.26 +
68.27 + protected override TextBox CreateTextBox()
68.28 + {
68.29 + NumericTextBox textBox = new NumericTextBox();
68.30 + textBox.AllowDecimalSeparator = false;
68.31 + textBox.AllowNegativeSign = AllowNegativeSign;
68.32 + return textBox;
68.33 + }
68.34 +
68.35 + protected override void DoApplyChanges(TreeNodeAdv node, Control editor)
68.36 + {
68.37 + SetValue(node, (editor as NumericTextBox).IntValue);
68.38 + }
68.39 + }
68.40 +}
69.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
69.2 +++ b/External/Aga.Controls/Tree/NodeControls/NodeNumericUpDown.cs Sun May 27 15:16:19 2012 +0000
69.3 @@ -0,0 +1,115 @@
69.4 +using System;
69.5 +using System.Collections.Generic;
69.6 +using System.Text;
69.7 +using System.Drawing;
69.8 +using System.Windows.Forms;
69.9 +using System.Reflection;
69.10 +using System.ComponentModel;
69.11 +using System.Drawing.Design;
69.12 +
69.13 +namespace Aga.Controls.Tree.NodeControls
69.14 +{
69.15 + public class NodeNumericUpDown : BaseTextControl
69.16 + {
69.17 + #region Properties
69.18 +
69.19 + private int _editorWidth = 100;
69.20 + [DefaultValue(100)]
69.21 + public int EditorWidth
69.22 + {
69.23 + get { return _editorWidth; }
69.24 + set { _editorWidth = value; }
69.25 + }
69.26 +
69.27 + private int _decimalPlaces = 0;
69.28 + [Category("Data"), DefaultValue(0)]
69.29 + public int DecimalPlaces
69.30 + {
69.31 + get
69.32 + {
69.33 + return this._decimalPlaces;
69.34 + }
69.35 + set
69.36 + {
69.37 + this._decimalPlaces = value;
69.38 + }
69.39 + }
69.40 +
69.41 + private decimal _increment = 1;
69.42 + [Category("Data"), DefaultValue(1)]
69.43 + public decimal Increment
69.44 + {
69.45 + get
69.46 + {
69.47 + return this._increment;
69.48 + }
69.49 + set
69.50 + {
69.51 + this._increment = value;
69.52 + }
69.53 + }
69.54 +
69.55 + private decimal _minimum = 0;
69.56 + [Category("Data"), DefaultValue(0)]
69.57 + public decimal Minimum
69.58 + {
69.59 + get
69.60 + {
69.61 + return _minimum;
69.62 + }
69.63 + set
69.64 + {
69.65 + _minimum = value;
69.66 + }
69.67 + }
69.68 +
69.69 + private decimal _maximum = 100;
69.70 + [Category("Data"), DefaultValue(100)]
69.71 + public decimal Maximum
69.72 + {
69.73 + get
69.74 + {
69.75 + return this._maximum;
69.76 + }
69.77 + set
69.78 + {
69.79 + this._maximum = value;
69.80 + }
69.81 + }
69.82 +
69.83 + #endregion
69.84 +
69.85 + public NodeNumericUpDown()
69.86 + {
69.87 + }
69.88 +
69.89 + protected override Size CalculateEditorSize(EditorContext context)
69.90 + {
69.91 + if (Parent.UseColumns)
69.92 + return context.Bounds.Size;
69.93 + else
69.94 + return new Size(EditorWidth, context.Bounds.Height);
69.95 + }
69.96 +
69.97 + protected override Control CreateEditor(TreeNodeAdv node)
69.98 + {
69.99 + NumericUpDown num = new NumericUpDown();
69.100 + num.Increment = Increment;
69.101 + num.DecimalPlaces = DecimalPlaces;
69.102 + num.Minimum = Minimum;
69.103 + num.Maximum = Maximum;
69.104 + num.Value = (decimal)GetValue(node);
69.105 + SetEditControlProperties(num, node);
69.106 + return num;
69.107 + }
69.108 +
69.109 + protected override void DisposeEditor(Control editor)
69.110 + {
69.111 + }
69.112 +
69.113 + protected override void DoApplyChanges(TreeNodeAdv node, Control editor)
69.114 + {
69.115 + SetValue(node, (editor as NumericUpDown).Value);
69.116 + }
69.117 + }
69.118 +}
70.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
70.2 +++ b/External/Aga.Controls/Tree/NodeControls/NodePlusMinus.cs Sun May 27 15:16:19 2012 +0000
70.3 @@ -0,0 +1,94 @@
70.4 +using System;
70.5 +using System.Collections.Generic;
70.6 +using System.Text;
70.7 +using System.Drawing;
70.8 +using Aga.Controls.Properties;
70.9 +using System.Windows.Forms;
70.10 +using System.Windows.Forms.VisualStyles;
70.11 +
70.12 +namespace Aga.Controls.Tree.NodeControls
70.13 +{
70.14 + internal class NodePlusMinus : NodeControl
70.15 + {
70.16 + public const int ImageSize = 9;
70.17 + public const int Width = 16;
70.18 + private Bitmap _plus;
70.19 + private Bitmap _minus;
70.20 +
70.21 + private VisualStyleRenderer _openedRenderer;
70.22 + private VisualStyleRenderer OpenedRenderer
70.23 + {
70.24 + get
70.25 + {
70.26 + if (_openedRenderer == null)
70.27 + _openedRenderer = new VisualStyleRenderer(VisualStyleElement.TreeView.Glyph.Opened);
70.28 + return _openedRenderer;
70.29 +
70.30 + }
70.31 + }
70.32 +
70.33 + private VisualStyleRenderer _closedRenderer;
70.34 + private VisualStyleRenderer ClosedRenderer
70.35 + {
70.36 + get
70.37 + {
70.38 + if (_closedRenderer == null)
70.39 + _closedRenderer = new VisualStyleRenderer(VisualStyleElement.TreeView.Glyph.Closed);
70.40 + return _closedRenderer;
70.41 + }
70.42 + }
70.43 +
70.44 + public NodePlusMinus()
70.45 + {
70.46 + _plus = Resources.plus;
70.47 + _minus = Resources.minus;
70.48 + }
70.49 +
70.50 + public override Size MeasureSize(TreeNodeAdv node, DrawContext context)
70.51 + {
70.52 + return new Size(Width, Width);
70.53 + }
70.54 +
70.55 + public override void Draw(TreeNodeAdv node, DrawContext context)
70.56 + {
70.57 + if (node.CanExpand)
70.58 + {
70.59 + Rectangle r = context.Bounds;
70.60 + int dy = (int)Math.Round((float)(r.Height - ImageSize) / 2);
70.61 + if (Application.RenderWithVisualStyles)
70.62 + {
70.63 + VisualStyleRenderer renderer;
70.64 + if (node.IsExpanded)
70.65 + renderer = OpenedRenderer;
70.66 + else
70.67 + renderer = ClosedRenderer;
70.68 + renderer.DrawBackground(context.Graphics, new Rectangle(r.X, r.Y + dy, ImageSize, ImageSize));
70.69 + }
70.70 + else
70.71 + {
70.72 + Image img;
70.73 + if (node.IsExpanded)
70.74 + img = _minus;
70.75 + else
70.76 + img = _plus;
70.77 + context.Graphics.DrawImageUnscaled(img, new Point(r.X, r.Y + dy));
70.78 + }
70.79 + }
70.80 + }
70.81 +
70.82 + public override void MouseDown(TreeNodeAdvMouseEventArgs args)
70.83 + {
70.84 + if (args.Button == MouseButtons.Left)
70.85 + {
70.86 + args.Handled = true;
70.87 + if (args.Node.CanExpand)
70.88 + args.Node.IsExpanded = !args.Node.IsExpanded;
70.89 + }
70.90 + }
70.91 +
70.92 + public override void MouseDoubleClick(TreeNodeAdvMouseEventArgs args)
70.93 + {
70.94 + args.Handled = true; // Supress expand/collapse when double click on plus/minus
70.95 + }
70.96 + }
70.97 +}
71.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
71.2 +++ b/External/Aga.Controls/Tree/NodeControls/NodeStateIcon.cs Sun May 27 15:16:19 2012 +0000
71.3 @@ -0,0 +1,41 @@
71.4 +using System;
71.5 +using System.Collections.Generic;
71.6 +using System.Text;
71.7 +using System.Drawing;
71.8 +using Aga.Controls.Properties;
71.9 +
71.10 +namespace Aga.Controls.Tree.NodeControls
71.11 +{
71.12 + public class NodeStateIcon: NodeIcon
71.13 + {
71.14 + private Image _leaf;
71.15 + private Image _opened;
71.16 + private Image _closed;
71.17 +
71.18 + public NodeStateIcon()
71.19 + {
71.20 + _leaf = MakeTransparent(Resources.Leaf);
71.21 + _opened = MakeTransparent(Resources.Folder);
71.22 + _closed = MakeTransparent(Resources.FolderClosed);
71.23 + }
71.24 +
71.25 + private static Image MakeTransparent(Bitmap bitmap)
71.26 + {
71.27 + bitmap.MakeTransparent(bitmap.GetPixel(0,0));
71.28 + return bitmap;
71.29 + }
71.30 +
71.31 + protected override Image GetIcon(TreeNodeAdv node)
71.32 + {
71.33 + Image icon = base.GetIcon(node);
71.34 + if (icon != null)
71.35 + return icon;
71.36 + else if (node.IsLeaf)
71.37 + return _leaf;
71.38 + else if (node.CanExpand && node.IsExpanded)
71.39 + return _opened;
71.40 + else
71.41 + return _closed;
71.42 + }
71.43 + }
71.44 +}
72.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
72.2 +++ b/External/Aga.Controls/Tree/NodeControls/NodeTextBox.cs Sun May 27 15:16:19 2012 +0000
72.3 @@ -0,0 +1,126 @@
72.4 +using System;
72.5 +using System.Collections.Generic;
72.6 +using System.Text;
72.7 +using System.Drawing;
72.8 +using System.Windows.Forms;
72.9 +using System.Reflection;
72.10 +using System.ComponentModel;
72.11 +
72.12 +namespace Aga.Controls.Tree.NodeControls
72.13 +{
72.14 + public class NodeTextBox : BaseTextControl
72.15 + {
72.16 + private const int MinTextBoxWidth = 30;
72.17 +
72.18 + public NodeTextBox()
72.19 + {
72.20 + }
72.21 +
72.22 + protected override Size CalculateEditorSize(EditorContext context)
72.23 + {
72.24 + if (Parent.UseColumns)
72.25 + return context.Bounds.Size;
72.26 + else
72.27 + {
72.28 + Size size = GetLabelSize(context.CurrentNode, context.DrawContext, _label);
72.29 + int width = Math.Max(size.Width + Font.Height, MinTextBoxWidth); // reserve a place for new typed character
72.30 + return new Size(width, size.Height);
72.31 + }
72.32 + }
72.33 +
72.34 + public override void KeyDown(KeyEventArgs args)
72.35 + {
72.36 + if (args.KeyCode == Keys.F2 && Parent.CurrentNode != null && EditEnabled)
72.37 + {
72.38 + args.Handled = true;
72.39 + BeginEdit();
72.40 + }
72.41 + }
72.42 +
72.43 + protected override Control CreateEditor(TreeNodeAdv node)
72.44 + {
72.45 + TextBox textBox = CreateTextBox();
72.46 + textBox.TextAlign = TextAlign;
72.47 + textBox.Text = GetLabel(node);
72.48 + textBox.BorderStyle = BorderStyle.FixedSingle;
72.49 + textBox.TextChanged += EditorTextChanged;
72.50 + textBox.KeyDown += EditorKeyDown;
72.51 + _label = textBox.Text;
72.52 + SetEditControlProperties(textBox, node);
72.53 + return textBox;
72.54 + }
72.55 +
72.56 + protected virtual TextBox CreateTextBox()
72.57 + {
72.58 + return new TextBox();
72.59 + }
72.60 +
72.61 + protected override void DisposeEditor(Control editor)
72.62 + {
72.63 + var textBox = editor as TextBox;
72.64 + textBox.TextChanged -= EditorTextChanged;
72.65 + textBox.KeyDown -= EditorKeyDown;
72.66 + }
72.67 +
72.68 + private void EditorKeyDown(object sender, KeyEventArgs e)
72.69 + {
72.70 + if (e.KeyCode == Keys.Escape)
72.71 + EndEdit(false);
72.72 + else if (e.KeyCode == Keys.Enter)
72.73 + EndEdit(true);
72.74 + }
72.75 +
72.76 + private string _label;
72.77 + private void EditorTextChanged(object sender, EventArgs e)
72.78 + {
72.79 + var textBox = sender as TextBox;
72.80 + _label = textBox.Text;
72.81 + Parent.UpdateEditorBounds();
72.82 + }
72.83 +
72.84 + protected override void DoApplyChanges(TreeNodeAdv node, Control editor)
72.85 + {
72.86 + var label = (editor as TextBox).Text;
72.87 + string oldLabel = GetLabel(node);
72.88 + if (oldLabel != label)
72.89 + {
72.90 + SetLabel(node, label);
72.91 + OnLabelChanged(node.Tag, oldLabel, label);
72.92 + }
72.93 + }
72.94 +
72.95 + public override void Cut(Control control)
72.96 + {
72.97 + (control as TextBox).Cut();
72.98 + }
72.99 +
72.100 + public override void Copy(Control control)
72.101 + {
72.102 + (control as TextBox).Copy();
72.103 + }
72.104 +
72.105 + public override void Paste(Control control)
72.106 + {
72.107 + (control as TextBox).Paste();
72.108 + }
72.109 +
72.110 + public override void Delete(Control control)
72.111 + {
72.112 + var textBox = control as TextBox;
72.113 + int len = Math.Max(textBox.SelectionLength, 1);
72.114 + if (textBox.SelectionStart < textBox.Text.Length)
72.115 + {
72.116 + int start = textBox.SelectionStart;
72.117 + textBox.Text = textBox.Text.Remove(textBox.SelectionStart, len);
72.118 + textBox.SelectionStart = start;
72.119 + }
72.120 + }
72.121 +
72.122 + public event EventHandler<LabelEventArgs> LabelChanged;
72.123 + protected void OnLabelChanged(object subject, string oldLabel, string newLabel)
72.124 + {
72.125 + if (LabelChanged != null)
72.126 + LabelChanged(this, new LabelEventArgs(subject, oldLabel, newLabel));
72.127 + }
72.128 + }
72.129 +}
73.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
73.2 +++ b/External/Aga.Controls/Tree/SortedTreeModel.cs Sun May 27 15:16:19 2012 +0000
73.3 @@ -0,0 +1,81 @@
73.4 +using System;
73.5 +using System.Collections.Generic;
73.6 +using System.Text;
73.7 +using System.Collections;
73.8 +
73.9 +namespace Aga.Controls.Tree
73.10 +{
73.11 + public class SortedTreeModel: TreeModelBase
73.12 + {
73.13 + private ITreeModel _innerModel;
73.14 + public ITreeModel InnerModel
73.15 + {
73.16 + get { return _innerModel; }
73.17 + }
73.18 +
73.19 + private IComparer _comparer;
73.20 + public IComparer Comparer
73.21 + {
73.22 + get { return _comparer; }
73.23 + set
73.24 + {
73.25 + _comparer = value;
73.26 + OnStructureChanged(new TreePathEventArgs(TreePath.Empty));
73.27 + }
73.28 + }
73.29 +
73.30 + public SortedTreeModel(ITreeModel innerModel)
73.31 + {
73.32 + _innerModel = innerModel;
73.33 + _innerModel.NodesChanged += new EventHandler<TreeModelEventArgs>(_innerModel_NodesChanged);
73.34 + _innerModel.NodesInserted += new EventHandler<TreeModelEventArgs>(_innerModel_NodesInserted);
73.35 + _innerModel.NodesRemoved += new EventHandler<TreeModelEventArgs>(_innerModel_NodesRemoved);
73.36 + _innerModel.StructureChanged += new EventHandler<TreePathEventArgs>(_innerModel_StructureChanged);
73.37 + }
73.38 +
73.39 + void _innerModel_StructureChanged(object sender, TreePathEventArgs e)
73.40 + {
73.41 + OnStructureChanged(e);
73.42 + }
73.43 +
73.44 + void _innerModel_NodesRemoved(object sender, TreeModelEventArgs e)
73.45 + {
73.46 + OnStructureChanged(new TreePathEventArgs(e.Path));
73.47 + }
73.48 +
73.49 + void _innerModel_NodesInserted(object sender, TreeModelEventArgs e)
73.50 + {
73.51 + OnStructureChanged(new TreePathEventArgs(e.Path));
73.52 + }
73.53 +
73.54 + void _innerModel_NodesChanged(object sender, TreeModelEventArgs e)
73.55 + {
73.56 + OnStructureChanged(new TreePathEventArgs(e.Path));
73.57 + }
73.58 +
73.59 + public override IEnumerable GetChildren(TreePath treePath)
73.60 + {
73.61 + if (Comparer != null)
73.62 + {
73.63 + ArrayList list = new ArrayList();
73.64 + IEnumerable res = InnerModel.GetChildren(treePath);
73.65 + if (res != null)
73.66 + {
73.67 + foreach (object obj in res)
73.68 + list.Add(obj);
73.69 + list.Sort(Comparer);
73.70 + return list;
73.71 + }
73.72 + else
73.73 + return null;
73.74 + }
73.75 + else
73.76 + return InnerModel.GetChildren(treePath);
73.77 + }
73.78 +
73.79 + public override bool IsLeaf(TreePath treePath)
73.80 + {
73.81 + return InnerModel.IsLeaf(treePath);
73.82 + }
73.83 + }
73.84 +}
74.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
74.2 +++ b/External/Aga.Controls/Tree/TreeColumn.cs Sun May 27 15:16:19 2012 +0000
74.3 @@ -0,0 +1,371 @@
74.4 +using System;
74.5 +using System.Collections.Generic;
74.6 +using System.Text;
74.7 +using System.ComponentModel;
74.8 +using System.Windows.Forms;
74.9 +using System.Drawing;
74.10 +using System.Windows.Forms.VisualStyles;
74.11 +using System.Drawing.Imaging;
74.12 +
74.13 +namespace Aga.Controls.Tree
74.14 +{
74.15 + [TypeConverter(typeof(TreeColumn.TreeColumnConverter)), DesignTimeVisible(false), ToolboxItem(false)]
74.16 + public class TreeColumn : Component
74.17 + {
74.18 + private class TreeColumnConverter : ComponentConverter
74.19 + {
74.20 + public TreeColumnConverter()
74.21 + : base(typeof(TreeColumn))
74.22 + {
74.23 + }
74.24 +
74.25 + public override bool GetPropertiesSupported(ITypeDescriptorContext context)
74.26 + {
74.27 + return false;
74.28 + }
74.29 + }
74.30 +
74.31 + private const int HeaderLeftMargin = 5;
74.32 + private const int HeaderRightMargin = 5;
74.33 + private const int SortOrderMarkMargin = 8;
74.34 +
74.35 + private TextFormatFlags _headerFlags;
74.36 + private TextFormatFlags _baseHeaderFlags = TextFormatFlags.NoPadding |
74.37 + TextFormatFlags.EndEllipsis |
74.38 + TextFormatFlags.VerticalCenter |
74.39 + TextFormatFlags.PreserveGraphicsTranslateTransform;
74.40 +
74.41 + #region Properties
74.42 +
74.43 + private TreeColumnCollection _owner;
74.44 + internal TreeColumnCollection Owner
74.45 + {
74.46 + get { return _owner; }
74.47 + set { _owner = value; }
74.48 + }
74.49 +
74.50 + [Browsable(false)]
74.51 + public int Index
74.52 + {
74.53 + get
74.54 + {
74.55 + if (Owner != null)
74.56 + return Owner.IndexOf(this);
74.57 + else
74.58 + return -1;
74.59 + }
74.60 + }
74.61 +
74.62 + private string _header;
74.63 + [Localizable(true)]
74.64 + public string Header
74.65 + {
74.66 + get { return _header; }
74.67 + set
74.68 + {
74.69 + _header = value;
74.70 + OnHeaderChanged();
74.71 + }
74.72 + }
74.73 +
74.74 + private string _tooltipText;
74.75 + [Localizable(true)]
74.76 + public string TooltipText
74.77 + {
74.78 + get { return _tooltipText; }
74.79 + set { _tooltipText = value; }
74.80 + }
74.81 +
74.82 + private int _width;
74.83 + [DefaultValue(50), Localizable(true)]
74.84 + public int Width
74.85 + {
74.86 + get
74.87 + {
74.88 + return _width;
74.89 + }
74.90 + set
74.91 + {
74.92 + if (_width != value)
74.93 + {
74.94 + _width = Math.Max(MinColumnWidth, value);
74.95 + if (_maxColumnWidth > 0)
74.96 + {
74.97 + _width = Math.Min(_width, MaxColumnWidth);
74.98 + }
74.99 + OnWidthChanged();
74.100 + }
74.101 + }
74.102 + }
74.103 +
74.104 + private int _minColumnWidth;
74.105 + [DefaultValue(0)]
74.106 + public int MinColumnWidth
74.107 + {
74.108 + get { return _minColumnWidth; }
74.109 + set
74.110 + {
74.111 + if (value < 0)
74.112 + throw new ArgumentOutOfRangeException("value");
74.113 +
74.114 + _minColumnWidth = value;
74.115 + Width = Math.Max(value, Width);
74.116 + }
74.117 + }
74.118 +
74.119 + private int _maxColumnWidth;
74.120 + [DefaultValue(0)]
74.121 + public int MaxColumnWidth
74.122 + {
74.123 + get { return _maxColumnWidth; }
74.124 + set
74.125 + {
74.126 + if (value < 0)
74.127 + throw new ArgumentOutOfRangeException("value");
74.128 +
74.129 + _maxColumnWidth = value;
74.130 + if (value > 0)
74.131 + Width = Math.Min(value, _width);
74.132 + }
74.133 + }
74.134 +
74.135 + private bool _visible = true;
74.136 + [DefaultValue(true)]
74.137 + public bool IsVisible
74.138 + {
74.139 + get { return _visible; }
74.140 + set
74.141 + {
74.142 + _visible = value;
74.143 + OnIsVisibleChanged();
74.144 + }
74.145 + }
74.146 +
74.147 + private HorizontalAlignment _textAlign = HorizontalAlignment.Left;
74.148 + [DefaultValue(HorizontalAlignment.Left)]
74.149 + public HorizontalAlignment TextAlign
74.150 + {
74.151 + get { return _textAlign; }
74.152 + set
74.153 + {
74.154 + if (value != _textAlign)
74.155 + {
74.156 + _textAlign = value;
74.157 + _headerFlags = _baseHeaderFlags | TextHelper.TranslateAligmentToFlag(value);
74.158 + OnHeaderChanged();
74.159 + }
74.160 + }
74.161 + }
74.162 +
74.163 + private bool _sortable = false;
74.164 + [DefaultValue(false)]
74.165 + public bool Sortable
74.166 + {
74.167 + get { return _sortable; }
74.168 + set { _sortable = value; }
74.169 + }
74.170 +
74.171 + private SortOrder _sort_order = SortOrder.None;
74.172 + public SortOrder SortOrder
74.173 + {
74.174 + get { return _sort_order; }
74.175 + set
74.176 + {
74.177 + if (value == _sort_order)
74.178 + return;
74.179 + _sort_order = value;
74.180 + OnSortOrderChanged();
74.181 + }
74.182 + }
74.183 +
74.184 + public Size SortMarkSize
74.185 + {
74.186 + get
74.187 + {
74.188 + if (Application.RenderWithVisualStyles)
74.189 + return new Size(9, 5);
74.190 + else
74.191 + return new Size(7, 4);
74.192 + }
74.193 + }
74.194 + #endregion
74.195 +
74.196 + public TreeColumn():
74.197 + this(string.Empty, 50)
74.198 + {
74.199 + }
74.200 +
74.201 + public TreeColumn(string header, int width)
74.202 + {
74.203 + _header = header;
74.204 + _width = width;
74.205 + _headerFlags = _baseHeaderFlags | TextFormatFlags.Left;
74.206 + }
74.207 +
74.208 + public override string ToString()
74.209 + {
74.210 + if (string.IsNullOrEmpty(Header))
74.211 + return GetType().Name;
74.212 + else
74.213 + return Header;
74.214 + }
74.215 +
74.216 + protected override void Dispose(bool disposing)
74.217 + {
74.218 + base.Dispose(disposing);
74.219 + }
74.220 +
74.221 + #region Draw
74.222 +
74.223 + private static VisualStyleRenderer _normalRenderer;
74.224 + private static VisualStyleRenderer _pressedRenderer;
74.225 + private static VisualStyleRenderer _hotRenderer;
74.226 +
74.227 + private static void CreateRenderers()
74.228 + {
74.229 + if (Application.RenderWithVisualStyles && _normalRenderer == null)
74.230 + {
74.231 + _normalRenderer = new VisualStyleRenderer(VisualStyleElement.Header.Item.Normal);
74.232 + _pressedRenderer = new VisualStyleRenderer(VisualStyleElement.Header.Item.Pressed);
74.233 + _hotRenderer = new VisualStyleRenderer(VisualStyleElement.Header.Item.Hot);
74.234 + }
74.235 + }
74.236 +
74.237 + internal Bitmap CreateGhostImage(Rectangle bounds, Font font)
74.238 + {
74.239 + Bitmap b = new Bitmap(bounds.Width, bounds.Height, PixelFormat.Format32bppArgb);
74.240 + Graphics gr = Graphics.FromImage(b);
74.241 + gr.FillRectangle(SystemBrushes.ControlDark, bounds);
74.242 + DrawContent(gr, bounds, font);
74.243 + BitmapHelper.SetAlphaChanelValue(b, 150);
74.244 + return b;
74.245 + }
74.246 +
74.247 + internal void Draw(Graphics gr, Rectangle bounds, Font font, bool pressed, bool hot)
74.248 + {
74.249 + DrawBackground(gr, bounds, pressed, hot);
74.250 + DrawContent(gr, bounds, font);
74.251 + }
74.252 +
74.253 + private void DrawContent(Graphics gr, Rectangle bounds, Font font)
74.254 + {
74.255 + Rectangle innerBounds = new Rectangle(bounds.X + HeaderLeftMargin, bounds.Y,
74.256 + bounds.Width - HeaderLeftMargin - HeaderRightMargin,
74.257 + bounds.Height);
74.258 +
74.259 + if (SortOrder != SortOrder.None)
74.260 + innerBounds.Width -= (SortMarkSize.Width + SortOrderMarkMargin);
74.261 +
74.262 + Size maxTextSize = TextRenderer.MeasureText(gr, Header, font, innerBounds.Size, TextFormatFlags.NoPadding);
74.263 + Size textSize = TextRenderer.MeasureText(gr, Header, font, innerBounds.Size, _baseHeaderFlags);
74.264 +
74.265 + if (SortOrder != SortOrder.None)
74.266 + {
74.267 + int tw = Math.Min(textSize.Width, innerBounds.Size.Width);
74.268 +
74.269 + int x = 0;
74.270 + if (TextAlign == HorizontalAlignment.Left)
74.271 + x = innerBounds.X + tw + SortOrderMarkMargin;
74.272 + else if (TextAlign == HorizontalAlignment.Right)
74.273 + x = innerBounds.Right + SortOrderMarkMargin;
74.274 + else
74.275 + x = innerBounds.X + tw + (innerBounds.Width - tw) / 2 + SortOrderMarkMargin;
74.276 + DrawSortMark(gr, bounds, x);
74.277 + }
74.278 +
74.279 + if (textSize.Width < maxTextSize.Width)
74.280 + TextRenderer.DrawText(gr, Header, font, innerBounds, SystemColors.ControlText, _baseHeaderFlags | TextFormatFlags.Left);
74.281 + else
74.282 + TextRenderer.DrawText(gr, Header, font, innerBounds, SystemColors.ControlText, _headerFlags);
74.283 + }
74.284 +
74.285 + private void DrawSortMark(Graphics gr, Rectangle bounds, int x)
74.286 + {
74.287 + int y = bounds.Y + bounds.Height / 2 - 2;
74.288 + x = Math.Max(x, bounds.X + SortOrderMarkMargin);
74.289 +
74.290 + int w2 = SortMarkSize.Width / 2;
74.291 + if (SortOrder == SortOrder.Ascending)
74.292 + {
74.293 + Point[] points = new Point[] { new Point(x, y), new Point(x + SortMarkSize.Width, y), new Point(x + w2, y + SortMarkSize.Height) };
74.294 + gr.FillPolygon(SystemBrushes.ControlDark, points);
74.295 + }
74.296 + else if (SortOrder == SortOrder.Descending)
74.297 + {
74.298 + Point[] points = new Point[] { new Point(x - 1, y + SortMarkSize.Height), new Point(x + SortMarkSize.Width, y + SortMarkSize.Height), new Point(x + w2, y - 1) };
74.299 + gr.FillPolygon(SystemBrushes.ControlDark, points);
74.300 + }
74.301 + }
74.302 +
74.303 + internal static void DrawDropMark(Graphics gr, Rectangle rect)
74.304 + {
74.305 + gr.FillRectangle(SystemBrushes.HotTrack, rect.X-1, rect.Y, 2, rect.Height);
74.306 + }
74.307 +
74.308 + internal static void DrawBackground(Graphics gr, Rectangle bounds, bool pressed, bool hot)
74.309 + {
74.310 + if (Application.RenderWithVisualStyles)
74.311 + {
74.312 + CreateRenderers();
74.313 + if (pressed)
74.314 + _pressedRenderer.DrawBackground(gr, bounds);
74.315 + else if (hot)
74.316 + _hotRenderer.DrawBackground(gr, bounds);
74.317 + else
74.318 + _normalRenderer.DrawBackground(gr, bounds);
74.319 + }
74.320 + else
74.321 + {
74.322 + gr.FillRectangle(SystemBrushes.Control, bounds);
74.323 + Pen p1 = SystemPens.ControlLightLight;
74.324 + Pen p2 = SystemPens.ControlDark;
74.325 + Pen p3 = SystemPens.ControlDarkDark;
74.326 + if (pressed)
74.327 + gr.DrawRectangle(p2, bounds.X, bounds.Y, bounds.Width, bounds.Height);
74.328 + else
74.329 + {
74.330 + gr.DrawLine(p1, bounds.X, bounds.Y, bounds.Right, bounds.Y);
74.331 + gr.DrawLine(p3, bounds.X, bounds.Bottom, bounds.Right, bounds.Bottom);
74.332 + gr.DrawLine(p3, bounds.Right - 1, bounds.Y, bounds.Right - 1, bounds.Bottom - 1);
74.333 + gr.DrawLine(p1, bounds.Left, bounds.Y + 1, bounds.Left, bounds.Bottom - 2);
74.334 + gr.DrawLine(p2, bounds.Right - 2, bounds.Y + 1, bounds.Right - 2, bounds.Bottom - 2);
74.335 + gr.DrawLine(p2, bounds.X, bounds.Bottom - 1, bounds.Right - 2, bounds.Bottom - 1);
74.336 + }
74.337 + }
74.338 + }
74.339 +
74.340 + #endregion
74.341 +
74.342 + #region Events
74.343 +
74.344 + public event EventHandler HeaderChanged;
74.345 + private void OnHeaderChanged()
74.346 + {
74.347 + if (HeaderChanged != null)
74.348 + HeaderChanged(this, EventArgs.Empty);
74.349 + }
74.350 +
74.351 + public event EventHandler SortOrderChanged;
74.352 + private void OnSortOrderChanged()
74.353 + {
74.354 + if (SortOrderChanged != null)
74.355 + SortOrderChanged(this, EventArgs.Empty);
74.356 + }
74.357 +
74.358 + public event EventHandler IsVisibleChanged;
74.359 + private void OnIsVisibleChanged()
74.360 + {
74.361 + if (IsVisibleChanged != null)
74.362 + IsVisibleChanged(this, EventArgs.Empty);
74.363 + }
74.364 +
74.365 + public event EventHandler WidthChanged;
74.366 + private void OnWidthChanged()
74.367 + {
74.368 + if (WidthChanged != null)
74.369 + WidthChanged(this, EventArgs.Empty);
74.370 + }
74.371 +
74.372 + #endregion
74.373 + }
74.374 +}
75.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
75.2 +++ b/External/Aga.Controls/Tree/TreeColumnCollection.cs Sun May 27 15:16:19 2012 +0000
75.3 @@ -0,0 +1,98 @@
75.4 +using System;
75.5 +using System.Collections.Generic;
75.6 +using System.Text;
75.7 +using System.Collections.ObjectModel;
75.8 +using System.ComponentModel;
75.9 +using System.Windows.Forms;
75.10 +
75.11 +namespace Aga.Controls.Tree
75.12 +{
75.13 + internal class TreeColumnCollection : Collection<TreeColumn>
75.14 + {
75.15 + private TreeViewAdv _treeView;
75.16 +
75.17 + public TreeColumnCollection(TreeViewAdv treeView)
75.18 + {
75.19 + _treeView = treeView;
75.20 + }
75.21 +
75.22 + protected override void InsertItem(int index, TreeColumn item)
75.23 + {
75.24 + base.InsertItem(index, item);
75.25 + BindEvents(item);
75.26 + _treeView.UpdateColumns();
75.27 + }
75.28 +
75.29 + protected override void RemoveItem(int index)
75.30 + {
75.31 + UnbindEvents(this[index]);
75.32 + base.RemoveItem(index);
75.33 + _treeView.UpdateColumns();
75.34 + }
75.35 +
75.36 + protected override void SetItem(int index, TreeColumn item)
75.37 + {
75.38 + UnbindEvents(this[index]);
75.39 + base.SetItem(index, item);
75.40 + item.Owner = this;
75.41 + BindEvents(item);
75.42 + _treeView.UpdateColumns();
75.43 + }
75.44 +
75.45 + protected override void ClearItems()
75.46 + {
75.47 + foreach (TreeColumn c in Items)
75.48 + UnbindEvents(c);
75.49 + Items.Clear();
75.50 + _treeView.UpdateColumns();
75.51 + }
75.52 +
75.53 + private void BindEvents(TreeColumn item)
75.54 + {
75.55 + item.Owner = this;
75.56 + item.HeaderChanged += HeaderChanged;
75.57 + item.IsVisibleChanged += IsVisibleChanged;
75.58 + item.WidthChanged += WidthChanged;
75.59 + item.SortOrderChanged += SortOrderChanged;
75.60 + }
75.61 +
75.62 + private void UnbindEvents(TreeColumn item)
75.63 + {
75.64 + item.Owner = null;
75.65 + item.HeaderChanged -= HeaderChanged;
75.66 + item.IsVisibleChanged -= IsVisibleChanged;
75.67 + item.WidthChanged -= WidthChanged;
75.68 + item.SortOrderChanged -= SortOrderChanged;
75.69 + }
75.70 +
75.71 + void SortOrderChanged(object sender, EventArgs e)
75.72 + {
75.73 + TreeColumn changed = sender as TreeColumn;
75.74 + //Only one column at a time can have a sort property set
75.75 + if (changed.SortOrder != SortOrder.None)
75.76 + {
75.77 + foreach (TreeColumn col in this)
75.78 + {
75.79 + if (col != changed)
75.80 + col.SortOrder = SortOrder.None;
75.81 + }
75.82 + }
75.83 + _treeView.UpdateHeaders();
75.84 + }
75.85 +
75.86 + void WidthChanged(object sender, EventArgs e)
75.87 + {
75.88 + _treeView.ChangeColumnWidth(sender as TreeColumn);
75.89 + }
75.90 +
75.91 + void IsVisibleChanged(object sender, EventArgs e)
75.92 + {
75.93 + _treeView.FullUpdate();
75.94 + }
75.95 +
75.96 + void HeaderChanged(object sender, EventArgs e)
75.97 + {
75.98 + _treeView.UpdateView();
75.99 + }
75.100 + }
75.101 +}
76.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
76.2 +++ b/External/Aga.Controls/Tree/TreeColumnEventArgs.cs Sun May 27 15:16:19 2012 +0000
76.3 @@ -0,0 +1,20 @@
76.4 +using System;
76.5 +using System.Collections.Generic;
76.6 +using System.Text;
76.7 +
76.8 +namespace Aga.Controls.Tree
76.9 +{
76.10 + public class TreeColumnEventArgs: EventArgs
76.11 + {
76.12 + private TreeColumn _column;
76.13 + public TreeColumn Column
76.14 + {
76.15 + get { return _column; }
76.16 + }
76.17 +
76.18 + public TreeColumnEventArgs(TreeColumn column)
76.19 + {
76.20 + _column = column;
76.21 + }
76.22 + }
76.23 +}
77.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
77.2 +++ b/External/Aga.Controls/Tree/TreeListAdapter.cs Sun May 27 15:16:19 2012 +0000
77.3 @@ -0,0 +1,65 @@
77.4 +using System;
77.5 +using System.Collections.Generic;
77.6 +using System.Text;
77.7 +
77.8 +namespace Aga.Controls.Tree
77.9 +{
77.10 + /// <summary>
77.11 + /// Converts IEnumerable interface to ITreeModel.
77.12 + /// Allows to display a plain list in the TreeView
77.13 + /// </summary>
77.14 + public class TreeListAdapter : ITreeModel
77.15 + {
77.16 + private System.Collections.IEnumerable _list;
77.17 +
77.18 + public TreeListAdapter(System.Collections.IEnumerable list)
77.19 + {
77.20 + _list = list;
77.21 + }
77.22 +
77.23 + #region ITreeModel Members
77.24 +
77.25 + public System.Collections.IEnumerable GetChildren(TreePath treePath)
77.26 + {
77.27 + if (treePath.IsEmpty())
77.28 + return _list;
77.29 + else
77.30 + return null;
77.31 + }
77.32 +
77.33 + public bool IsLeaf(TreePath treePath)
77.34 + {
77.35 + return true;
77.36 + }
77.37 +
77.38 + public event EventHandler<TreeModelEventArgs> NodesChanged;
77.39 + public void OnNodesChanged(TreeModelEventArgs args)
77.40 + {
77.41 + if (NodesChanged != null)
77.42 + NodesChanged(this, args);
77.43 + }
77.44 +
77.45 + public event EventHandler<TreePathEventArgs> StructureChanged;
77.46 + public void OnStructureChanged(TreePathEventArgs args)
77.47 + {
77.48 + if (StructureChanged != null)
77.49 + StructureChanged(this, args);
77.50 + }
77.51 +
77.52 + public event EventHandler<TreeModelEventArgs> NodesInserted;
77.53 + public void OnNodeInserted(TreeModelEventArgs args)
77.54 + {
77.55 + if (NodesInserted != null)
77.56 + NodesInserted(this, args);
77.57 + }
77.58 +
77.59 + public event EventHandler<TreeModelEventArgs> NodesRemoved;
77.60 + public void OnNodeRemoved(TreeModelEventArgs args)
77.61 + {
77.62 + if (NodesRemoved != null)
77.63 + NodesRemoved(this, args);
77.64 + }
77.65 +
77.66 + #endregion
77.67 + }
77.68 +}
78.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
78.2 +++ b/External/Aga.Controls/Tree/TreeModel.cs Sun May 27 15:16:19 2012 +0000
78.3 @@ -0,0 +1,127 @@
78.4 +using System;
78.5 +using System.Collections.Generic;
78.6 +using System.Text;
78.7 +using System.Collections.ObjectModel;
78.8 +
78.9 +namespace Aga.Controls.Tree
78.10 +{
78.11 + /// <summary>
78.12 + /// Provides a simple ready to use implementation of <see cref="ITreeModel"/>. Warning: this class is not optimized
78.13 + /// to work with big amount of data. In this case create you own implementation of <c>ITreeModel</c>, and pay attention
78.14 + /// on GetChildren and IsLeaf methods.
78.15 + /// </summary>
78.16 + public class TreeModel : ITreeModel
78.17 + {
78.18 + private Node _root;
78.19 + public Node Root
78.20 + {
78.21 + get { return _root; }
78.22 + }
78.23 +
78.24 + public Collection<Node> Nodes
78.25 + {
78.26 + get { return _root.Nodes; }
78.27 + }
78.28 +
78.29 + public TreeModel()
78.30 + {
78.31 + _root = new Node();
78.32 + _root.Model = this;
78.33 + }
78.34 +
78.35 + public TreePath GetPath(Node node)
78.36 + {
78.37 + if (node == _root)
78.38 + return TreePath.Empty;
78.39 + else
78.40 + {
78.41 + Stack<object> stack = new Stack<object>();
78.42 + while (node != _root)
78.43 + {
78.44 + stack.Push(node);
78.45 + node = node.Parent;
78.46 + }
78.47 + return new TreePath(stack.ToArray());
78.48 + }
78.49 + }
78.50 +
78.51 + public Node FindNode(TreePath path)
78.52 + {
78.53 + if (path.IsEmpty())
78.54 + return _root;
78.55 + else
78.56 + return FindNode(_root, path, 0);
78.57 + }
78.58 +
78.59 + private Node FindNode(Node root, TreePath path, int level)
78.60 + {
78.61 + foreach (Node node in root.Nodes)
78.62 + if (node == path.FullPath[level])
78.63 + {
78.64 + if (level == path.FullPath.Length - 1)
78.65 + return node;
78.66 + else
78.67 + return FindNode(node, path, level + 1);
78.68 + }
78.69 + return null;
78.70 + }
78.71 +
78.72 + #region ITreeModel Members
78.73 +
78.74 + public System.Collections.IEnumerable GetChildren(TreePath treePath)
78.75 + {
78.76 + Node node = FindNode(treePath);
78.77 + if (node != null)
78.78 + foreach (Node n in node.Nodes)
78.79 + yield return n;
78.80 + else
78.81 + yield break;
78.82 + }
78.83 +
78.84 + public bool IsLeaf(TreePath treePath)
78.85 + {
78.86 + Node node = FindNode(treePath);
78.87 + if (node != null)
78.88 + return node.IsLeaf;
78.89 + else
78.90 + throw new ArgumentException("treePath");
78.91 + }
78.92 +
78.93 + public event EventHandler<TreeModelEventArgs> NodesChanged;
78.94 + internal void OnNodesChanged(TreeModelEventArgs args)
78.95 + {
78.96 + if (NodesChanged != null)
78.97 + NodesChanged(this, args);
78.98 + }
78.99 +
78.100 + public event EventHandler<TreePathEventArgs> StructureChanged;
78.101 + public void OnStructureChanged(TreePathEventArgs args)
78.102 + {
78.103 + if (StructureChanged != null)
78.104 + StructureChanged(this, args);
78.105 + }
78.106 +
78.107 + public event EventHandler<TreeModelEventArgs> NodesInserted;
78.108 + internal void OnNodeInserted(Node parent, int index, Node node)
78.109 + {
78.110 + if (NodesInserted != null)
78.111 + {
78.112 + TreeModelEventArgs args = new TreeModelEventArgs(GetPath(parent), new int[] { index }, new object[] { node });
78.113 + NodesInserted(this, args);
78.114 + }
78.115 +
78.116 + }
78.117 +
78.118 + public event EventHandler<TreeModelEventArgs> NodesRemoved;
78.119 + internal void OnNodeRemoved(Node parent, int index, Node node)
78.120 + {
78.121 + if (NodesRemoved != null)
78.122 + {
78.123 + TreeModelEventArgs args = new TreeModelEventArgs(GetPath(parent), new int[] { index }, new object[] { node });
78.124 + NodesRemoved(this, args);
78.125 + }
78.126 + }
78.127 +
78.128 + #endregion
78.129 + }
78.130 +}
79.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
79.2 +++ b/External/Aga.Controls/Tree/TreeModelBase.cs Sun May 27 15:16:19 2012 +0000
79.3 @@ -0,0 +1,46 @@
79.4 +using System;
79.5 +using System.Collections.Generic;
79.6 +using System.Text;
79.7 +
79.8 +namespace Aga.Controls.Tree
79.9 +{
79.10 + public abstract class TreeModelBase: ITreeModel
79.11 + {
79.12 + public abstract System.Collections.IEnumerable GetChildren(TreePath treePath);
79.13 + public abstract bool IsLeaf(TreePath treePath);
79.14 +
79.15 +
79.16 + public event EventHandler<TreeModelEventArgs> NodesChanged;
79.17 + protected void OnNodesChanged(TreeModelEventArgs args)
79.18 + {
79.19 + if (NodesChanged != null)
79.20 + NodesChanged(this, args);
79.21 + }
79.22 +
79.23 + public event EventHandler<TreePathEventArgs> StructureChanged;
79.24 + protected void OnStructureChanged(TreePathEventArgs args)
79.25 + {
79.26 + if (StructureChanged != null)
79.27 + StructureChanged(this, args);
79.28 + }
79.29 +
79.30 + public event EventHandler<TreeModelEventArgs> NodesInserted;
79.31 + protected void OnNodesInserted(TreeModelEventArgs args)
79.32 + {
79.33 + if (NodesInserted != null)
79.34 + NodesInserted(this, args);
79.35 + }
79.36 +
79.37 + public event EventHandler<TreeModelEventArgs> NodesRemoved;
79.38 + protected void OnNodesRemoved(TreeModelEventArgs args)
79.39 + {
79.40 + if (NodesRemoved != null)
79.41 + NodesRemoved(this, args);
79.42 + }
79.43 +
79.44 + public virtual void Refresh()
79.45 + {
79.46 + OnStructureChanged(new TreePathEventArgs(TreePath.Empty));
79.47 + }
79.48 + }
79.49 +}
80.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
80.2 +++ b/External/Aga.Controls/Tree/TreeModelEventArgs.cs Sun May 27 15:16:19 2012 +0000
80.3 @@ -0,0 +1,50 @@
80.4 +using System;
80.5 +using System.Collections.Generic;
80.6 +using System.Text;
80.7 +
80.8 +namespace Aga.Controls.Tree
80.9 +{
80.10 + public class TreeModelEventArgs: TreePathEventArgs
80.11 + {
80.12 + private object[] _children;
80.13 + public object[] Children
80.14 + {
80.15 + get { return _children; }
80.16 + }
80.17 +
80.18 + private int[] _indices;
80.19 + public int[] Indices
80.20 + {
80.21 + get { return _indices; }
80.22 + }
80.23 +
80.24 + /// <summary>
80.25 + ///
80.26 + /// </summary>
80.27 + /// <param name="parent">Path to a parent node</param>
80.28 + /// <param name="children">Child nodes</param>
80.29 + public TreeModelEventArgs(TreePath parent, object[] children)
80.30 + : this(parent, null, children)
80.31 + {
80.32 + }
80.33 +
80.34 + /// <summary>
80.35 + ///
80.36 + /// </summary>
80.37 + /// <param name="parent">Path to a parent node</param>
80.38 + /// <param name="indices">Indices of children in parent nodes collection</param>
80.39 + /// <param name="children">Child nodes</param>
80.40 + public TreeModelEventArgs(TreePath parent, int[] indices, object[] children)
80.41 + : base(parent)
80.42 + {
80.43 + if (children == null)
80.44 + throw new ArgumentNullException();
80.45 +
80.46 + if (indices != null && indices.Length != children.Length)
80.47 + throw new ArgumentException("indices and children arrays must have the same length");
80.48 +
80.49 + _indices = indices;
80.50 + _children = children;
80.51 + }
80.52 + }
80.53 +}
81.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
81.2 +++ b/External/Aga.Controls/Tree/TreeNodeAdv.cs Sun May 27 15:16:19 2012 +0000
81.3 @@ -0,0 +1,443 @@
81.4 +using System;
81.5 +using System.Collections.Generic;
81.6 +using System.Collections.ObjectModel;
81.7 +using System.Runtime.Serialization;
81.8 +using System.Security.Permissions;
81.9 +
81.10 +namespace Aga.Controls.Tree
81.11 +{
81.12 + [Serializable]
81.13 + public sealed class TreeNodeAdv : ISerializable
81.14 + {
81.15 + #region NodeCollection
81.16 + private class NodeCollection : Collection<TreeNodeAdv>
81.17 + {
81.18 + private TreeNodeAdv _owner;
81.19 +
81.20 + public NodeCollection(TreeNodeAdv owner)
81.21 + {
81.22 + _owner = owner;
81.23 + }
81.24 +
81.25 + protected override void ClearItems()
81.26 + {
81.27 + while (this.Count != 0)
81.28 + this.RemoveAt(this.Count - 1);
81.29 + }
81.30 +
81.31 + protected override void InsertItem(int index, TreeNodeAdv item)
81.32 + {
81.33 + if (item == null)
81.34 + throw new ArgumentNullException("item");
81.35 +
81.36 + if (item.Parent != _owner)
81.37 + {
81.38 + if (item.Parent != null)
81.39 + item.Parent.Nodes.Remove(item);
81.40 + item._parent = _owner;
81.41 + item._index = index;
81.42 + for (int i = index; i < Count; i++)
81.43 + this[i]._index++;
81.44 + base.InsertItem(index, item);
81.45 + }
81.46 +
81.47 + if (_owner.Tree != null && _owner.Tree.Model == null)
81.48 + {
81.49 + _owner.Tree.SmartFullUpdate();
81.50 + }
81.51 + }
81.52 +
81.53 + protected override void RemoveItem(int index)
81.54 + {
81.55 + TreeNodeAdv item = this[index];
81.56 + item._parent = null;
81.57 + item._index = -1;
81.58 + for (int i = index + 1; i < Count; i++)
81.59 + this[i]._index--;
81.60 + base.RemoveItem(index);
81.61 +
81.62 + if (_owner.Tree != null && _owner.Tree.Model == null)
81.63 + {
81.64 + _owner.Tree.UpdateSelection();
81.65 + _owner.Tree.SmartFullUpdate();
81.66 + }
81.67 + }
81.68 +
81.69 + protected override void SetItem(int index, TreeNodeAdv item)
81.70 + {
81.71 + if (item == null)
81.72 + throw new ArgumentNullException("item");
81.73 + RemoveAt(index);
81.74 + InsertItem(index, item);
81.75 + }
81.76 + }
81.77 + #endregion
81.78 +
81.79 + #region Events
81.80 +
81.81 + public event EventHandler<TreeViewAdvEventArgs> Collapsing;
81.82 + internal void OnCollapsing()
81.83 + {
81.84 + if (Collapsing != null)
81.85 + Collapsing(this, new TreeViewAdvEventArgs(this));
81.86 + }
81.87 +
81.88 + public event EventHandler<TreeViewAdvEventArgs> Collapsed;
81.89 + internal void OnCollapsed()
81.90 + {
81.91 + if (Collapsed != null)
81.92 + Collapsed(this, new TreeViewAdvEventArgs(this));
81.93 + }
81.94 +
81.95 + public event EventHandler<TreeViewAdvEventArgs> Expanding;
81.96 + internal void OnExpanding()
81.97 + {
81.98 + if (Expanding != null)
81.99 + Expanding(this, new TreeViewAdvEventArgs(this));
81.100 + }
81.101 +
81.102 + public event EventHandler<TreeViewAdvEventArgs> Expanded;
81.103 + internal void OnExpanded()
81.104 + {
81.105 + if (Expanded != null)
81.106 + Expanded(this, new TreeViewAdvEventArgs(this));
81.107 + }
81.108 +
81.109 + #endregion
81.110 +
81.111 + #region Properties
81.112 +
81.113 + private TreeViewAdv _tree;
81.114 + public TreeViewAdv Tree
81.115 + {
81.116 + get { return _tree; }
81.117 + }
81.118 +
81.119 + private int _row;
81.120 + public int Row
81.121 + {
81.122 + get { return _row; }
81.123 + internal set { _row = value; }
81.124 + }
81.125 +
81.126 + private int _index = -1;
81.127 + public int Index
81.128 + {
81.129 + get
81.130 + {
81.131 + return _index;
81.132 + }
81.133 + }
81.134 +
81.135 + private bool _isSelected;
81.136 + public bool IsSelected
81.137 + {
81.138 + get { return _isSelected; }
81.139 + set
81.140 + {
81.141 + if (_isSelected != value)
81.142 + {
81.143 + if (Tree.IsMyNode(this))
81.144 + {
81.145 + //_tree.OnSelectionChanging
81.146 + if (value)
81.147 + {
81.148 + if (!_tree.Selection.Contains(this))
81.149 + _tree.Selection.Add(this);
81.150 +
81.151 + if (_tree.Selection.Count == 1)
81.152 + _tree.CurrentNode = this;
81.153 + }
81.154 + else
81.155 + _tree.Selection.Remove(this);
81.156 + _tree.UpdateView();
81.157 + _tree.OnSelectionChanged();
81.158 + }
81.159 + _isSelected = value;
81.160 + }
81.161 + }
81.162 + }
81.163 +
81.164 + /// <summary>
81.165 + /// Returns true if all parent nodes of this node are expanded.
81.166 + /// </summary>
81.167 + internal bool IsVisible
81.168 + {
81.169 + get
81.170 + {
81.171 + TreeNodeAdv node = _parent;
81.172 + while (node != null)
81.173 + {
81.174 + if (!node.IsExpanded)
81.175 + return false;
81.176 + node = node.Parent;
81.177 + }
81.178 + return true;
81.179 + }
81.180 + }
81.181 +
81.182 + private bool _isLeaf;
81.183 + public bool IsLeaf
81.184 + {
81.185 + get { return _isLeaf; }
81.186 + internal set { _isLeaf = value; }
81.187 + }
81.188 +
81.189 + private bool _isExpandedOnce;
81.190 + public bool IsExpandedOnce
81.191 + {
81.192 + get { return _isExpandedOnce; }
81.193 + internal set { _isExpandedOnce = value; }
81.194 + }
81.195 +
81.196 + private bool _isExpanded;
81.197 + public bool IsExpanded
81.198 + {
81.199 + get { return _isExpanded; }
81.200 + set
81.201 + {
81.202 + if (value)
81.203 + Expand();
81.204 + else
81.205 + Collapse();
81.206 + }
81.207 + }
81.208 +
81.209 + internal void AssignIsExpanded(bool value)
81.210 + {
81.211 + _isExpanded = value;
81.212 + }
81.213 +
81.214 + private TreeNodeAdv _parent;
81.215 + public TreeNodeAdv Parent
81.216 + {
81.217 + get { return _parent; }
81.218 + }
81.219 +
81.220 + public int Level
81.221 + {
81.222 + get
81.223 + {
81.224 + if (_parent == null)
81.225 + return 0;
81.226 + else
81.227 + return _parent.Level + 1;
81.228 + }
81.229 + }
81.230 +
81.231 + public TreeNodeAdv PreviousNode
81.232 + {
81.233 + get
81.234 + {
81.235 + if (_parent != null)
81.236 + {
81.237 + int index = Index;
81.238 + if (index > 0)
81.239 + return _parent.Nodes[index - 1];
81.240 + }
81.241 + return null;
81.242 + }
81.243 + }
81.244 +
81.245 + public TreeNodeAdv NextNode
81.246 + {
81.247 + get
81.248 + {
81.249 + if (_parent != null)
81.250 + {
81.251 + int index = Index;
81.252 + if (index < _parent.Nodes.Count - 1)
81.253 + return _parent.Nodes[index + 1];
81.254 + }
81.255 + return null;
81.256 + }
81.257 + }
81.258 +
81.259 + internal TreeNodeAdv BottomNode
81.260 + {
81.261 + get
81.262 + {
81.263 + TreeNodeAdv parent = this.Parent;
81.264 + if (parent != null)
81.265 + {
81.266 + if (parent.NextNode != null)
81.267 + return parent.NextNode;
81.268 + else
81.269 + return parent.BottomNode;
81.270 + }
81.271 + return null;
81.272 + }
81.273 + }
81.274 +
81.275 + internal TreeNodeAdv NextVisibleNode
81.276 + {
81.277 + get
81.278 + {
81.279 + if (IsExpanded && Nodes.Count > 0)
81.280 + return Nodes[0];
81.281 + else
81.282 + {
81.283 + TreeNodeAdv nn = NextNode;
81.284 + if (nn != null)
81.285 + return nn;
81.286 + else
81.287 + return BottomNode;
81.288 + }
81.289 + }
81.290 + }
81.291 +
81.292 + public bool CanExpand
81.293 + {
81.294 + get
81.295 + {
81.296 + return (Nodes.Count > 0 || (!IsExpandedOnce && !IsLeaf));
81.297 + }
81.298 + }
81.299 +
81.300 + private object _tag;
81.301 + public object Tag
81.302 + {
81.303 + get { return _tag; }
81.304 + }
81.305 +
81.306 + private Collection<TreeNodeAdv> _nodes;
81.307 + internal Collection<TreeNodeAdv> Nodes
81.308 + {
81.309 + get { return _nodes; }
81.310 + }
81.311 +
81.312 + private ReadOnlyCollection<TreeNodeAdv> _children;
81.313 + public ReadOnlyCollection<TreeNodeAdv> Children
81.314 + {
81.315 + get
81.316 + {
81.317 + return _children;
81.318 + }
81.319 + }
81.320 +
81.321 + private int? _rightBounds;
81.322 + internal int? RightBounds
81.323 + {
81.324 + get { return _rightBounds; }
81.325 + set { _rightBounds = value; }
81.326 + }
81.327 +
81.328 + private int? _height;
81.329 + internal int? Height
81.330 + {
81.331 + get { return _height; }
81.332 + set { _height = value; }
81.333 + }
81.334 +
81.335 + private bool _isExpandingNow;
81.336 + internal bool IsExpandingNow
81.337 + {
81.338 + get { return _isExpandingNow; }
81.339 + set { _isExpandingNow = value; }
81.340 + }
81.341 +
81.342 + private bool _autoExpandOnStructureChanged = false;
81.343 + public bool AutoExpandOnStructureChanged
81.344 + {
81.345 + get { return _autoExpandOnStructureChanged; }
81.346 + set { _autoExpandOnStructureChanged = value; }
81.347 + }
81.348 +
81.349 + #endregion
81.350 +
81.351 + public TreeNodeAdv(object tag)
81.352 + : this(null, tag)
81.353 + {
81.354 + }
81.355 +
81.356 + internal TreeNodeAdv(TreeViewAdv tree, object tag)
81.357 + {
81.358 + _row = -1;
81.359 + _tree = tree;
81.360 + _nodes = new NodeCollection(this);
81.361 + _children = new ReadOnlyCollection<TreeNodeAdv>(_nodes);
81.362 + _tag = tag;
81.363 + }
81.364 +
81.365 + public override string ToString()
81.366 + {
81.367 + if (Tag != null)
81.368 + return Tag.ToString();
81.369 + else
81.370 + return base.ToString();
81.371 + }
81.372 +
81.373 + public void Collapse()
81.374 + {
81.375 + if (_isExpanded)
81.376 + Collapse(true);
81.377 + }
81.378 +
81.379 + public void CollapseAll()
81.380 + {
81.381 + Collapse(false);
81.382 + }
81.383 +
81.384 + public void Collapse(bool ignoreChildren)
81.385 + {
81.386 + SetIsExpanded(false, ignoreChildren);
81.387 + }
81.388 +
81.389 + public void Expand()
81.390 + {
81.391 + if (!_isExpanded)
81.392 + Expand(true);
81.393 + }
81.394 +
81.395 + public void ExpandAll()
81.396 + {
81.397 + Expand(false);
81.398 + }
81.399 +
81.400 + public void Expand(bool ignoreChildren)
81.401 + {
81.402 + SetIsExpanded(true, ignoreChildren);
81.403 + }
81.404 +
81.405 + private void SetIsExpanded(bool value, bool ignoreChildren)
81.406 + {
81.407 + if (Tree == null)
81.408 + _isExpanded = value;
81.409 + else
81.410 + Tree.SetIsExpanded(this, value, ignoreChildren);
81.411 + }
81.412 +
81.413 + #region ISerializable Members
81.414 +
81.415 + private TreeNodeAdv(SerializationInfo info, StreamingContext context)
81.416 + : this(null, null)
81.417 + {
81.418 + int nodesCount = 0;
81.419 + nodesCount = info.GetInt32("NodesCount");
81.420 + _isExpanded = info.GetBoolean("IsExpanded");
81.421 + _tag = info.GetValue("Tag", typeof(object));
81.422 +
81.423 + for (int i = 0; i < nodesCount; i++)
81.424 + {
81.425 + TreeNodeAdv child = (TreeNodeAdv)info.GetValue("Child" + i, typeof(TreeNodeAdv));
81.426 + Nodes.Add(child);
81.427 + }
81.428 +
81.429 + }
81.430 +
81.431 + [SecurityPermission(SecurityAction.Demand, SerializationFormatter = true)]
81.432 + public void GetObjectData(SerializationInfo info, StreamingContext context)
81.433 + {
81.434 + info.AddValue("IsExpanded", IsExpanded);
81.435 + info.AddValue("NodesCount", Nodes.Count);
81.436 + if ((Tag != null) && Tag.GetType().IsSerializable)
81.437 + info.AddValue("Tag", Tag, Tag.GetType());
81.438 +
81.439 + for (int i = 0; i < Nodes.Count; i++)
81.440 + info.AddValue("Child" + i, Nodes[i], typeof(TreeNodeAdv));
81.441 +
81.442 + }
81.443 +
81.444 + #endregion
81.445 + }
81.446 +}
82.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
82.2 +++ b/External/Aga.Controls/Tree/TreeNodeAdvMouseEventArgs.cs Sun May 27 15:16:19 2012 +0000
82.3 @@ -0,0 +1,59 @@
82.4 +using System;
82.5 +using System.Collections.Generic;
82.6 +using System.Text;
82.7 +using System.Windows.Forms;
82.8 +using System.Drawing;
82.9 +using Aga.Controls.Tree.NodeControls;
82.10 +
82.11 +namespace Aga.Controls.Tree
82.12 +{
82.13 + public class TreeNodeAdvMouseEventArgs : MouseEventArgs
82.14 + {
82.15 + private TreeNodeAdv _node;
82.16 + public TreeNodeAdv Node
82.17 + {
82.18 + get { return _node; }
82.19 + internal set { _node = value; }
82.20 + }
82.21 +
82.22 + private NodeControl _control;
82.23 + public NodeControl Control
82.24 + {
82.25 + get { return _control; }
82.26 + internal set { _control = value; }
82.27 + }
82.28 +
82.29 + private Point _viewLocation;
82.30 + public Point ViewLocation
82.31 + {
82.32 + get { return _viewLocation; }
82.33 + internal set { _viewLocation = value; }
82.34 + }
82.35 +
82.36 + private Keys _modifierKeys;
82.37 + public Keys ModifierKeys
82.38 + {
82.39 + get { return _modifierKeys; }
82.40 + internal set { _modifierKeys = value; }
82.41 + }
82.42 +
82.43 + private bool _handled;
82.44 + public bool Handled
82.45 + {
82.46 + get { return _handled; }
82.47 + set { _handled = value; }
82.48 + }
82.49 +
82.50 + private Rectangle _controlBounds;
82.51 + public Rectangle ControlBounds
82.52 + {
82.53 + get { return _controlBounds; }
82.54 + internal set { _controlBounds = value; }
82.55 + }
82.56 +
82.57 + public TreeNodeAdvMouseEventArgs(MouseEventArgs args)
82.58 + : base(args.Button, args.Clicks, args.X, args.Y, args.Delta)
82.59 + {
82.60 + }
82.61 + }
82.62 +}
83.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
83.2 +++ b/External/Aga.Controls/Tree/TreePath.cs Sun May 27 15:16:19 2012 +0000
83.3 @@ -0,0 +1,68 @@
83.4 +using System;
83.5 +using System.Text;
83.6 +using System.Collections.ObjectModel;
83.7 +
83.8 +namespace Aga.Controls.Tree
83.9 +{
83.10 + public class TreePath
83.11 + {
83.12 + [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2104:DoNotDeclareReadOnlyMutableReferenceTypes")]
83.13 + public static readonly TreePath Empty = new TreePath();
83.14 +
83.15 + private object[] _path;
83.16 + public object[] FullPath
83.17 + {
83.18 + get { return _path; }
83.19 + }
83.20 +
83.21 + public object LastNode
83.22 + {
83.23 + get
83.24 + {
83.25 + if (_path.Length > 0)
83.26 + return _path[_path.Length - 1];
83.27 + else
83.28 + return null;
83.29 + }
83.30 + }
83.31 +
83.32 + public object FirstNode
83.33 + {
83.34 + get
83.35 + {
83.36 + if (_path.Length > 0)
83.37 + return _path[0];
83.38 + else
83.39 + return null;
83.40 + }
83.41 + }
83.42 +
83.43 + public TreePath()
83.44 + {
83.45 + _path = new object[0];
83.46 + }
83.47 +
83.48 + public TreePath(object node)
83.49 + {
83.50 + _path = new object[] { node };
83.51 + }
83.52 +
83.53 + public TreePath(object[] path)
83.54 + {
83.55 + _path = path;
83.56 + }
83.57 +
83.58 + public TreePath(TreePath parent, object node)
83.59 + {
83.60 + _path = new object[parent.FullPath.Length + 1];
83.61 + for (int i = 0; i < _path.Length - 1; i++)
83.62 + _path[i] = parent.FullPath[i];
83.63 + _path[_path.Length - 1] = node;
83.64 + }
83.65 +
83.66 + public bool IsEmpty()
83.67 + {
83.68 + return (_path.Length == 0);
83.69 + }
83.70 + }
83.71 +}
84.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
84.2 +++ b/External/Aga.Controls/Tree/TreePathEventArgs.cs Sun May 27 15:16:19 2012 +0000
84.3 @@ -0,0 +1,28 @@
84.4 +using System;
84.5 +using System.Collections.Generic;
84.6 +using System.Text;
84.7 +
84.8 +namespace Aga.Controls.Tree
84.9 +{
84.10 + public class TreePathEventArgs : EventArgs
84.11 + {
84.12 + private TreePath _path;
84.13 + public TreePath Path
84.14 + {
84.15 + get { return _path; }
84.16 + }
84.17 +
84.18 + public TreePathEventArgs()
84.19 + {
84.20 + _path = new TreePath();
84.21 + }
84.22 +
84.23 + public TreePathEventArgs(TreePath path)
84.24 + {
84.25 + if (path == null)
84.26 + throw new ArgumentNullException();
84.27 +
84.28 + _path = path;
84.29 + }
84.30 + }
84.31 +}
85.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
85.2 +++ b/External/Aga.Controls/Tree/TreeViewAdv.Designer.cs Sun May 27 15:16:19 2012 +0000
85.3 @@ -0,0 +1,69 @@
85.4 +using System.Windows.Forms;
85.5 +
85.6 +namespace Aga.Controls.Tree
85.7 +{
85.8 + partial class TreeViewAdv
85.9 + {
85.10 + private System.ComponentModel.IContainer components = null;
85.11 +
85.12 + protected override void Dispose(bool disposing)
85.13 + {
85.14 + if (disposing && (components != null))
85.15 + {
85.16 + components.Dispose();
85.17 + if (_dragBitmap != null) _dragBitmap.Dispose();
85.18 + if (_dragTimer != null) _dragTimer.Dispose();
85.19 + if (_linePen != null) _linePen.Dispose();
85.20 + if (_markPen != null) _markPen.Dispose();
85.21 + }
85.22 + base.Dispose(disposing);
85.23 + }
85.24 +
85.25 + #region Component Designer generated code
85.26 + private void InitializeComponent()
85.27 + {
85.28 + this.components = new System.ComponentModel.Container();
85.29 + this._vScrollBar = new System.Windows.Forms.VScrollBar();
85.30 + this._hScrollBar = new System.Windows.Forms.HScrollBar();
85.31 + this._errorProvider = new System.Windows.Forms.ErrorProvider(this.components);
85.32 + ((System.ComponentModel.ISupportInitialize)(this._errorProvider)).BeginInit();
85.33 + this.SuspendLayout();
85.34 + //
85.35 + // _vScrollBar
85.36 + //
85.37 + this._vScrollBar.LargeChange = 1;
85.38 + this._vScrollBar.Location = new System.Drawing.Point(0, 0);
85.39 + this._vScrollBar.Maximum = 0;
85.40 + this._vScrollBar.Name = "_vScrollBar";
85.41 + this._vScrollBar.Size = new System.Drawing.Size(13, 80);
85.42 + this._vScrollBar.TabIndex = 1;
85.43 + this._vScrollBar.ValueChanged += new System.EventHandler(this._vScrollBar_ValueChanged);
85.44 + this._vScrollBar.Scroll += new System.Windows.Forms.ScrollEventHandler(this._vScrollBar_Scroll);
85.45 + //
85.46 + // _hScrollBar
85.47 + //
85.48 + this._hScrollBar.LargeChange = 1;
85.49 + this._hScrollBar.Location = new System.Drawing.Point(0, 0);
85.50 + this._hScrollBar.Maximum = 0;
85.51 + this._hScrollBar.Name = "_hScrollBar";
85.52 + this._hScrollBar.Size = new System.Drawing.Size(80, 13);
85.53 + this._hScrollBar.TabIndex = 2;
85.54 + this._hScrollBar.ValueChanged += new System.EventHandler(this._hScrollBar_ValueChanged);
85.55 + this._hScrollBar.Scroll += new System.Windows.Forms.ScrollEventHandler(this._hScrollBar_Scroll);
85.56 + //
85.57 + // TreeViewAdv
85.58 + //
85.59 + this.BackColor = System.Drawing.SystemColors.Window;
85.60 + this.Controls.Add(this._vScrollBar);
85.61 + this.Controls.Add(this._hScrollBar);
85.62 + ((System.ComponentModel.ISupportInitialize)(this._errorProvider)).EndInit();
85.63 + this.ResumeLayout(false);
85.64 +
85.65 + }
85.66 + #endregion
85.67 +
85.68 + private VScrollBar _vScrollBar;
85.69 + private HScrollBar _hScrollBar;
85.70 + private ErrorProvider _errorProvider;
85.71 + }
85.72 +}
86.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
86.2 +++ b/External/Aga.Controls/Tree/TreeViewAdv.Draw.cs Sun May 27 15:16:19 2012 +0000
86.3 @@ -0,0 +1,308 @@
86.4 +using System;
86.5 +using System.Drawing;
86.6 +using System.Diagnostics;
86.7 +using System.Drawing.Drawing2D;
86.8 +using System.Windows.Forms;
86.9 +using Aga.Controls.Tree.NodeControls;
86.10 +
86.11 +namespace Aga.Controls.Tree
86.12 +{
86.13 + public partial class TreeViewAdv
86.14 + {
86.15 + public void AutoSizeColumn(TreeColumn column)
86.16 + {
86.17 + if (!Columns.Contains(column))
86.18 + throw new ArgumentException("column");
86.19 +
86.20 + DrawContext context = new DrawContext();
86.21 + context.Graphics = Graphics.FromImage(new Bitmap(1, 1));
86.22 + context.Font = this.Font;
86.23 + int res = 0;
86.24 + for (int row = 0; row < RowCount; row++)
86.25 + {
86.26 + if (row < RowMap.Count)
86.27 + {
86.28 + int w = 0;
86.29 + TreeNodeAdv node = RowMap[row];
86.30 + foreach (NodeControl nc in NodeControls)
86.31 + {
86.32 + if (nc.ParentColumn == column)
86.33 + w += nc.GetActualSize(node, _measureContext).Width;
86.34 + }
86.35 + res = Math.Max(res, w);
86.36 + }
86.37 + }
86.38 +
86.39 + if (res > 0)
86.40 + column.Width = res;
86.41 + }
86.42 +
86.43 + private void CreatePens()
86.44 + {
86.45 + CreateLinePen();
86.46 + CreateMarkPen();
86.47 + }
86.48 +
86.49 + private void CreateMarkPen()
86.50 + {
86.51 + GraphicsPath path = new GraphicsPath();
86.52 + path.AddLines(new Point[] { new Point(0, 0), new Point(1, 1), new Point(-1, 1), new Point(0, 0) });
86.53 + CustomLineCap cap = new CustomLineCap(null, path);
86.54 + cap.WidthScale = 1.0f;
86.55 +
86.56 + _markPen = new Pen(_dragDropMarkColor, _dragDropMarkWidth);
86.57 + _markPen.CustomStartCap = cap;
86.58 + _markPen.CustomEndCap = cap;
86.59 + }
86.60 +
86.61 + private void CreateLinePen()
86.62 + {
86.63 + _linePen = new Pen(_lineColor);
86.64 + _linePen.DashStyle = DashStyle.Dot;
86.65 + }
86.66 +
86.67 + protected override void OnPaint(PaintEventArgs e)
86.68 + {
86.69 + BeginPerformanceCount();
86.70 + PerformanceAnalyzer.Start("OnPaint");
86.71 +
86.72 + DrawContext context = new DrawContext();
86.73 + context.Graphics = e.Graphics;
86.74 + context.Font = this.Font;
86.75 + context.Enabled = Enabled;
86.76 +
86.77 + int y = 0;
86.78 + int gridHeight = 0;
86.79 +
86.80 + if (UseColumns)
86.81 + {
86.82 + DrawColumnHeaders(e.Graphics);
86.83 + y += ColumnHeaderHeight;
86.84 + if (Columns.Count == 0 || e.ClipRectangle.Height <= y)
86.85 + return;
86.86 + }
86.87 +
86.88 + int firstRowY = _rowLayout.GetRowBounds(FirstVisibleRow).Y;
86.89 + y -= firstRowY;
86.90 +
86.91 + e.Graphics.ResetTransform();
86.92 + e.Graphics.TranslateTransform(-OffsetX, y);
86.93 + Rectangle displayRect = DisplayRectangle;
86.94 + for (int row = FirstVisibleRow; row < RowCount; row++)
86.95 + {
86.96 + Rectangle rowRect = _rowLayout.GetRowBounds(row);
86.97 + gridHeight += rowRect.Height;
86.98 + if (rowRect.Y + y > displayRect.Bottom)
86.99 + break;
86.100 + else
86.101 + DrawRow(e, ref context, row, rowRect);
86.102 + }
86.103 +
86.104 + if ((GridLineStyle & GridLineStyle.Vertical) == GridLineStyle.Vertical && UseColumns)
86.105 + DrawVerticalGridLines(e.Graphics, firstRowY);
86.106 +
86.107 + if (_dropPosition.Node != null && DragMode && HighlightDropPosition)
86.108 + DrawDropMark(e.Graphics);
86.109 +
86.110 + e.Graphics.ResetTransform();
86.111 + DrawScrollBarsBox(e.Graphics);
86.112 +
86.113 + if (DragMode && _dragBitmap != null)
86.114 + e.Graphics.DrawImage(_dragBitmap, PointToClient(MousePosition));
86.115 +
86.116 + PerformanceAnalyzer.Finish("OnPaint");
86.117 + EndPerformanceCount(e);
86.118 + }
86.119 +
86.120 + private void DrawRow(PaintEventArgs e, ref DrawContext context, int row, Rectangle rowRect)
86.121 + {
86.122 + TreeNodeAdv node = RowMap[row];
86.123 + context.DrawSelection = DrawSelectionMode.None;
86.124 + context.CurrentEditorOwner = CurrentEditorOwner;
86.125 + if (DragMode)
86.126 + {
86.127 + if ((_dropPosition.Node == node) && _dropPosition.Position == NodePosition.Inside && HighlightDropPosition)
86.128 + context.DrawSelection = DrawSelectionMode.Active;
86.129 + }
86.130 + else
86.131 + {
86.132 + if (node.IsSelected && Focused)
86.133 + context.DrawSelection = DrawSelectionMode.Active;
86.134 + else if (node.IsSelected && !Focused && !HideSelection)
86.135 + context.DrawSelection = DrawSelectionMode.Inactive;
86.136 + }
86.137 + context.DrawFocus = Focused && CurrentNode == node;
86.138 +
86.139 + OnRowDraw(e, node, context, row, rowRect);
86.140 +
86.141 + if (FullRowSelect)
86.142 + {
86.143 + context.DrawFocus = false;
86.144 + if (context.DrawSelection == DrawSelectionMode.Active || context.DrawSelection == DrawSelectionMode.Inactive)
86.145 + {
86.146 + Rectangle focusRect = new Rectangle(OffsetX, rowRect.Y, ClientRectangle.Width, rowRect.Height);
86.147 + if (context.DrawSelection == DrawSelectionMode.Active)
86.148 + {
86.149 + e.Graphics.FillRectangle(SystemBrushes.Highlight, focusRect);
86.150 + context.DrawSelection = DrawSelectionMode.FullRowSelect;
86.151 + }
86.152 + else
86.153 + {
86.154 + e.Graphics.FillRectangle(SystemBrushes.InactiveBorder, focusRect);
86.155 + context.DrawSelection = DrawSelectionMode.None;
86.156 + }
86.157 + }
86.158 + }
86.159 +
86.160 + if ((GridLineStyle & GridLineStyle.Horizontal) == GridLineStyle.Horizontal)
86.161 + e.Graphics.DrawLine(SystemPens.InactiveBorder, 0, rowRect.Bottom, e.Graphics.ClipBounds.Right, rowRect.Bottom);
86.162 +
86.163 + if (ShowLines)
86.164 + DrawLines(e.Graphics, node, rowRect);
86.165 +
86.166 + DrawNode(node, context);
86.167 + }
86.168 +
86.169 + private void DrawVerticalGridLines(Graphics gr, int y)
86.170 + {
86.171 + int x = 0;
86.172 + foreach (TreeColumn c in Columns)
86.173 + {
86.174 + if (c.IsVisible)
86.175 + {
86.176 + x += c.Width;
86.177 + gr.DrawLine(SystemPens.InactiveBorder, x - 1, y, x - 1, gr.ClipBounds.Bottom);
86.178 + }
86.179 + }
86.180 + }
86.181 +
86.182 + private void DrawColumnHeaders(Graphics gr)
86.183 + {
86.184 + PerformanceAnalyzer.Start("DrawColumnHeaders");
86.185 + ReorderColumnState reorder = Input as ReorderColumnState;
86.186 + int x = 0;
86.187 + TreeColumn.DrawBackground(gr, new Rectangle(0, 0, ClientRectangle.Width + 2, ColumnHeaderHeight - 1), false, false);
86.188 + gr.TranslateTransform(-OffsetX, 0);
86.189 + foreach (TreeColumn c in Columns)
86.190 + {
86.191 + if (c.IsVisible)
86.192 + {
86.193 + if (x >= OffsetX && x - OffsetX < this.Bounds.Width)// skip invisible columns
86.194 + {
86.195 + Rectangle rect = new Rectangle(x, 0, c.Width, ColumnHeaderHeight - 1);
86.196 + gr.SetClip(rect);
86.197 + bool pressed = ((Input is ClickColumnState || reorder != null) && ((Input as ColumnState).Column == c));
86.198 + c.Draw(gr, rect, Font, pressed, _hotColumn == c);
86.199 + gr.ResetClip();
86.200 +
86.201 + if (reorder != null && reorder.DropColumn == c)
86.202 + TreeColumn.DrawDropMark(gr, rect);
86.203 + }
86.204 + x += c.Width;
86.205 + }
86.206 + }
86.207 +
86.208 + if (reorder != null)
86.209 + {
86.210 + if (reorder.DropColumn == null)
86.211 + TreeColumn.DrawDropMark(gr, new Rectangle(x, 0, 0, ColumnHeaderHeight));
86.212 + gr.DrawImage(reorder.GhostImage, new Point(reorder.Location.X + + reorder.DragOffset, reorder.Location.Y));
86.213 + }
86.214 + PerformanceAnalyzer.Finish("DrawColumnHeaders");
86.215 + }
86.216 +
86.217 + public void DrawNode(TreeNodeAdv node, DrawContext context)
86.218 + {
86.219 + foreach (NodeControlInfo item in GetNodeControls(node))
86.220 + {
86.221 + if (item.Bounds.Right >= OffsetX && item.Bounds.X - OffsetX < this.Bounds.Width)// skip invisible nodes
86.222 + {
86.223 + context.Bounds = item.Bounds;
86.224 + context.Graphics.SetClip(context.Bounds);
86.225 + item.Control.Draw(node, context);
86.226 + context.Graphics.ResetClip();
86.227 + }
86.228 + }
86.229 + }
86.230 +
86.231 + private void DrawScrollBarsBox(Graphics gr)
86.232 + {
86.233 + Rectangle r1 = DisplayRectangle;
86.234 + Rectangle r2 = ClientRectangle;
86.235 + gr.FillRectangle(SystemBrushes.Control,
86.236 + new Rectangle(r1.Right, r1.Bottom, r2.Width - r1.Width, r2.Height - r1.Height));
86.237 + }
86.238 +
86.239 + private void DrawDropMark(Graphics gr)
86.240 + {
86.241 + if (_dropPosition.Position == NodePosition.Inside)
86.242 + return;
86.243 +
86.244 + Rectangle rect = GetNodeBounds(_dropPosition.Node);
86.245 + int right = DisplayRectangle.Right - LeftMargin + OffsetX;
86.246 + int y = rect.Y;
86.247 + if (_dropPosition.Position == NodePosition.After)
86.248 + y = rect.Bottom;
86.249 + gr.DrawLine(_markPen, rect.X, y, right, y);
86.250 + }
86.251 +
86.252 + private void DrawLines(Graphics gr, TreeNodeAdv node, Rectangle rowRect)
86.253 + {
86.254 + if (UseColumns && Columns.Count > 0)
86.255 + gr.SetClip(new Rectangle(0, rowRect.Y, Columns[0].Width, rowRect.Bottom));
86.256 +
86.257 + TreeNodeAdv curNode = node;
86.258 + while (curNode != _root && curNode != null)
86.259 + {
86.260 + int level = curNode.Level;
86.261 + int x = (level - 1) * _indent + NodePlusMinus.ImageSize / 2 + LeftMargin;
86.262 + int width = NodePlusMinus.Width - NodePlusMinus.ImageSize / 2;
86.263 + int y = rowRect.Y;
86.264 + int y2 = y + rowRect.Height;
86.265 +
86.266 + if (curNode == node)
86.267 + {
86.268 + int midy = y + rowRect.Height / 2;
86.269 + gr.DrawLine(_linePen, x, midy, x + width, midy);
86.270 + if (curNode.NextNode == null)
86.271 + y2 = y + rowRect.Height / 2;
86.272 + }
86.273 +
86.274 + if (node.Row == 0)
86.275 + y = rowRect.Height / 2;
86.276 + if (curNode.NextNode != null || curNode == node)
86.277 + gr.DrawLine(_linePen, x, y, x, y2);
86.278 +
86.279 + curNode = curNode.Parent;
86.280 + }
86.281 +
86.282 + gr.ResetClip();
86.283 + }
86.284 +
86.285 + #region Performance
86.286 +
86.287 + private double _totalTime;
86.288 + private int _paintCount;
86.289 +
86.290 + [Conditional("PERF_TEST")]
86.291 + private void BeginPerformanceCount()
86.292 + {
86.293 + _paintCount++;
86.294 + TimeCounter.Start();
86.295 + }
86.296 +
86.297 + [Conditional("PERF_TEST")]
86.298 + private void EndPerformanceCount(PaintEventArgs e)
86.299 + {
86.300 + double time = TimeCounter.Finish();
86.301 + _totalTime += time;
86.302 + string debugText = string.Format("FPS {0:0.0}; Avg. FPS {1:0.0}",
86.303 + 1 / time, 1 / (_totalTime / _paintCount));
86.304 + e.Graphics.FillRectangle(Brushes.White, new Rectangle(DisplayRectangle.Width - 150, DisplayRectangle.Height - 20, 150, 20));
86.305 + e.Graphics.DrawString(debugText, Control.DefaultFont, Brushes.Gray,
86.306 + new PointF(DisplayRectangle.Width - 150, DisplayRectangle.Height - 20));
86.307 + }
86.308 + #endregion
86.309 +
86.310 + }
86.311 +}
87.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
87.2 +++ b/External/Aga.Controls/Tree/TreeViewAdv.Editor.cs Sun May 27 15:16:19 2012 +0000
87.3 @@ -0,0 +1,145 @@
87.4 +using System;
87.5 +using System.Collections.Generic;
87.6 +using System.Text;
87.7 +using System.Windows.Forms;
87.8 +using Aga.Controls.Tree.NodeControls;
87.9 +using System.Drawing;
87.10 +
87.11 +namespace Aga.Controls.Tree
87.12 +{
87.13 + partial class TreeViewAdv
87.14 + {
87.15 + private TreeNodeAdv _editingNode;
87.16 +
87.17 + public EditableControl CurrentEditorOwner { get; private set; }
87.18 + public Control CurrentEditor { get; private set; }
87.19 +
87.20 + public void HideEditor()
87.21 + {
87.22 + if (CurrentEditorOwner != null)
87.23 + CurrentEditorOwner.EndEdit(false);
87.24 + }
87.25 +
87.26 + internal void DisplayEditor(Control editor, EditableControl owner)
87.27 + {
87.28 + if (editor == null || owner == null || CurrentNode == null)
87.29 + throw new ArgumentNullException();
87.30 +
87.31 + HideEditor(false);
87.32 +
87.33 + CurrentEditor = editor;
87.34 + CurrentEditorOwner = owner;
87.35 + _editingNode = CurrentNode;
87.36 +
87.37 + editor.Validating += EditorValidating;
87.38 + UpdateEditorBounds();
87.39 + UpdateView();
87.40 + editor.Parent = this;
87.41 + editor.Focus();
87.42 + owner.UpdateEditor(editor);
87.43 + }
87.44 +
87.45 + internal bool HideEditor(bool applyChanges)
87.46 + {
87.47 + if (CurrentEditor != null)
87.48 + {
87.49 + if (applyChanges)
87.50 + {
87.51 + if (!ApplyChanges())
87.52 + return false;
87.53 + }
87.54 +
87.55 + //Check once more if editor was closed in ApplyChanges
87.56 + if (CurrentEditor != null)
87.57 + {
87.58 + CurrentEditor.Validating -= EditorValidating;
87.59 + CurrentEditorOwner.DoDisposeEditor(CurrentEditor);
87.60 +
87.61 + CurrentEditor.Parent = null;
87.62 + CurrentEditor.Dispose();
87.63 +
87.64 + CurrentEditor = null;
87.65 + CurrentEditorOwner = null;
87.66 + _editingNode = null;
87.67 + }
87.68 + }
87.69 + return true;
87.70 + }
87.71 +
87.72 + private bool ApplyChanges()
87.73 + {
87.74 + try
87.75 + {
87.76 + CurrentEditorOwner.ApplyChanges(_editingNode, CurrentEditor);
87.77 + _errorProvider.Clear();
87.78 + return true;
87.79 + }
87.80 + catch (ArgumentException ex)
87.81 + {
87.82 + _errorProvider.SetError(CurrentEditor, ex.Message);
87.83 + /*CurrentEditor.Validating -= EditorValidating;
87.84 + MessageBox.Show(this, ex.Message, "Value is not valid", MessageBoxButtons.OK, MessageBoxIcon.Warning);
87.85 + CurrentEditor.Focus();
87.86 + CurrentEditor.Validating += EditorValidating;*/
87.87 + return false;
87.88 + }
87.89 + }
87.90 +
87.91 + void EditorValidating(object sender, System.ComponentModel.CancelEventArgs e)
87.92 + {
87.93 + e.Cancel = !ApplyChanges();
87.94 + }
87.95 +
87.96 + public void UpdateEditorBounds()
87.97 + {
87.98 + if (CurrentEditor != null)
87.99 + {
87.100 + EditorContext context = new EditorContext();
87.101 + context.Owner = CurrentEditorOwner;
87.102 + context.CurrentNode = CurrentNode;
87.103 + context.Editor = CurrentEditor;
87.104 + context.DrawContext = _measureContext;
87.105 + SetEditorBounds(context);
87.106 + }
87.107 + }
87.108 +
87.109 + private void SetEditorBounds(EditorContext context)
87.110 + {
87.111 + foreach (NodeControlInfo info in GetNodeControls(context.CurrentNode))
87.112 + {
87.113 + if (context.Owner == info.Control && info.Control is EditableControl)
87.114 + {
87.115 + Point p = info.Bounds.Location;
87.116 + p.X += info.Control.LeftMargin;
87.117 + p.X -= OffsetX;
87.118 + p.Y -= (_rowLayout.GetRowBounds(FirstVisibleRow).Y - ColumnHeaderHeight);
87.119 + int width = DisplayRectangle.Width - p.X;
87.120 + if (UseColumns && info.Control.ParentColumn != null && Columns.Contains(info.Control.ParentColumn))
87.121 + {
87.122 + Rectangle rect = GetColumnBounds(info.Control.ParentColumn.Index);
87.123 + width = rect.Right - OffsetX - p.X;
87.124 + }
87.125 + context.Bounds = new Rectangle(p.X, p.Y, width, info.Bounds.Height);
87.126 + ((EditableControl)info.Control).SetEditorBounds(context);
87.127 + return;
87.128 + }
87.129 + }
87.130 + }
87.131 +
87.132 + private Rectangle GetColumnBounds(int column)
87.133 + {
87.134 + int x = 0;
87.135 + for (int i = 0; i < Columns.Count; i++)
87.136 + {
87.137 + if (Columns[i].IsVisible)
87.138 + {
87.139 + if (i < column)
87.140 + x += Columns[i].Width;
87.141 + else
87.142 + return new Rectangle(x, 0, Columns[i].Width, 0);
87.143 + }
87.144 + }
87.145 + return Rectangle.Empty;
87.146 + }
87.147 + }
87.148 +}
88.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
88.2 +++ b/External/Aga.Controls/Tree/TreeViewAdv.Input.cs Sun May 27 15:16:19 2012 +0000
88.3 @@ -0,0 +1,558 @@
88.4 +using System;
88.5 +using System.Collections.Generic;
88.6 +using System.Text;
88.7 +using System.Windows.Forms;
88.8 +using System.Drawing;
88.9 +using Aga.Controls.Tree.NodeControls;
88.10 +using System.Drawing.Imaging;
88.11 +using System.Threading;
88.12 +
88.13 +namespace Aga.Controls.Tree
88.14 +{
88.15 + public partial class TreeViewAdv
88.16 + {
88.17 + #region Keys
88.18 +
88.19 + protected override bool IsInputChar(char charCode)
88.20 + {
88.21 + return true;
88.22 + }
88.23 +
88.24 + protected override bool IsInputKey(Keys keyData)
88.25 + {
88.26 + if (((keyData & Keys.Up) == Keys.Up)
88.27 + || ((keyData & Keys.Down) == Keys.Down)
88.28 + || ((keyData & Keys.Left) == Keys.Left)
88.29 + || ((keyData & Keys.Right) == Keys.Right))
88.30 + return true;
88.31 + else
88.32 + return base.IsInputKey(keyData);
88.33 + }
88.34 +
88.35 + internal void ChangeInput()
88.36 + {
88.37 + if ((ModifierKeys & Keys.Shift) == Keys.Shift)
88.38 + {
88.39 + if (!(Input is InputWithShift))
88.40 + Input = new InputWithShift(this);
88.41 + }
88.42 + else if ((ModifierKeys & Keys.Control) == Keys.Control)
88.43 + {
88.44 + if (!(Input is InputWithControl))
88.45 + Input = new InputWithControl(this);
88.46 + }
88.47 + else
88.48 + {
88.49 + if (!(Input.GetType() == typeof(NormalInputState)))
88.50 + Input = new NormalInputState(this);
88.51 + }
88.52 + }
88.53 +
88.54 + protected override void OnKeyDown(KeyEventArgs e)
88.55 + {
88.56 + base.OnKeyDown(e);
88.57 + if (!e.Handled)
88.58 + {
88.59 + if (e.KeyCode == Keys.ShiftKey || e.KeyCode == Keys.ControlKey)
88.60 + ChangeInput();
88.61 + Input.KeyDown(e);
88.62 + if (!e.Handled)
88.63 + {
88.64 + foreach (NodeControlInfo item in GetNodeControls(CurrentNode))
88.65 + {
88.66 + item.Control.KeyDown(e);
88.67 + if (e.Handled)
88.68 + break;
88.69 + }
88.70 + }
88.71 + }
88.72 + }
88.73 +
88.74 + protected override void OnKeyUp(KeyEventArgs e)
88.75 + {
88.76 + base.OnKeyUp(e);
88.77 + if (!e.Handled)
88.78 + {
88.79 + if (e.KeyCode == Keys.ShiftKey || e.KeyCode == Keys.ControlKey)
88.80 + ChangeInput();
88.81 + if (!e.Handled)
88.82 + {
88.83 + foreach (NodeControlInfo item in GetNodeControls(CurrentNode))
88.84 + {
88.85 + item.Control.KeyUp(e);
88.86 + if (e.Handled)
88.87 + return;
88.88 + }
88.89 + }
88.90 + }
88.91 + }
88.92 +
88.93 + protected override void OnKeyPress(KeyPressEventArgs e)
88.94 + {
88.95 + base.OnKeyPress(e);
88.96 + if (!e.Handled)
88.97 + _search.Search(e.KeyChar);
88.98 + }
88.99 +
88.100 + #endregion
88.101 +
88.102 + #region Mouse
88.103 +
88.104 + private TreeNodeAdvMouseEventArgs CreateMouseArgs(MouseEventArgs e)
88.105 + {
88.106 + TreeNodeAdvMouseEventArgs args = new TreeNodeAdvMouseEventArgs(e);
88.107 + args.ViewLocation = new Point(e.X + OffsetX,
88.108 + e.Y + _rowLayout.GetRowBounds(FirstVisibleRow).Y - ColumnHeaderHeight);
88.109 + args.ModifierKeys = ModifierKeys;
88.110 + args.Node = GetNodeAt(e.Location);
88.111 + NodeControlInfo info = GetNodeControlInfoAt(args.Node, e.Location);
88.112 + args.ControlBounds = info.Bounds;
88.113 + args.Control = info.Control;
88.114 + return args;
88.115 + }
88.116 +
88.117 + protected override void OnMouseWheel(MouseEventArgs e)
88.118 + {
88.119 + _search.EndSearch();
88.120 + if (SystemInformation.MouseWheelScrollLines > 0)
88.121 + {
88.122 + int lines = e.Delta / 120 * SystemInformation.MouseWheelScrollLines;
88.123 + int newValue = _vScrollBar.Value - lines;
88.124 + newValue = Math.Min(_vScrollBar.Maximum - _vScrollBar.LargeChange + 1, newValue);
88.125 + newValue = Math.Min(_vScrollBar.Maximum, newValue);
88.126 + _vScrollBar.Value = Math.Max(_vScrollBar.Minimum, newValue);
88.127 + }
88.128 + base.OnMouseWheel(e);
88.129 + }
88.130 +
88.131 + protected override void OnMouseDown(MouseEventArgs e)
88.132 + {
88.133 + if (CurrentEditorOwner != null)
88.134 + {
88.135 + CurrentEditorOwner.EndEdit(true);
88.136 + return;
88.137 + }
88.138 +
88.139 + if (!Focused)
88.140 + Focus();
88.141 +
88.142 + _search.EndSearch();
88.143 + if (e.Button == MouseButtons.Left)
88.144 + {
88.145 + TreeColumn c;
88.146 + c = GetColumnDividerAt(e.Location);
88.147 + if (c != null)
88.148 + {
88.149 + Input = new ResizeColumnState(this, c, e.Location);
88.150 + return;
88.151 + }
88.152 + c = GetColumnAt(e.Location);
88.153 + if (c != null)
88.154 + {
88.155 + Input = new ClickColumnState(this, c, e.Location);
88.156 + UpdateView();
88.157 + return;
88.158 + }
88.159 + }
88.160 +
88.161 + ChangeInput();
88.162 + TreeNodeAdvMouseEventArgs args = CreateMouseArgs(e);
88.163 +
88.164 + if (args.Node != null && args.Control != null)
88.165 + args.Control.MouseDown(args);
88.166 +
88.167 + if (!args.Handled)
88.168 + Input.MouseDown(args);
88.169 +
88.170 + base.OnMouseDown(e);
88.171 + }
88.172 +
88.173 + protected override void OnMouseClick(MouseEventArgs e)
88.174 + {
88.175 + //TODO: Disable when click on plusminus icon
88.176 + TreeNodeAdvMouseEventArgs args = CreateMouseArgs(e);
88.177 + if (args.Node != null)
88.178 + OnNodeMouseClick(args);
88.179 +
88.180 + base.OnMouseClick(e);
88.181 + }
88.182 +
88.183 + protected override void OnMouseDoubleClick(MouseEventArgs e)
88.184 + {
88.185 + TreeNodeAdvMouseEventArgs args = CreateMouseArgs(e);
88.186 +
88.187 + if (args.Node != null && args.Control != null)
88.188 + args.Control.MouseDoubleClick(args);
88.189 +
88.190 + if (!args.Handled)
88.191 + {
88.192 + if (args.Node != null)
88.193 + OnNodeMouseDoubleClick(args);
88.194 + else
88.195 + Input.MouseDoubleClick(args);
88.196 +
88.197 + if (!args.Handled)
88.198 + {
88.199 + if (args.Node != null && args.Button == MouseButtons.Left)
88.200 + args.Node.IsExpanded = !args.Node.IsExpanded;
88.201 + }
88.202 + }
88.203 +
88.204 + base.OnMouseDoubleClick(e);
88.205 + }
88.206 +
88.207 + protected override void OnMouseUp(MouseEventArgs e)
88.208 + {
88.209 + TreeNodeAdvMouseEventArgs args = CreateMouseArgs(e);
88.210 + if (Input is ResizeColumnState)
88.211 + Input.MouseUp(args);
88.212 + else
88.213 + {
88.214 + if (args.Node != null && args.Control != null)
88.215 + args.Control.MouseUp(args);
88.216 + if (!args.Handled)
88.217 + Input.MouseUp(args);
88.218 +
88.219 + base.OnMouseUp(e);
88.220 + }
88.221 + }
88.222 +
88.223 + protected override void OnMouseMove(MouseEventArgs e)
88.224 + {
88.225 + if (Input.MouseMove(e))
88.226 + return;
88.227 +
88.228 + base.OnMouseMove(e);
88.229 + SetCursor(e);
88.230 + UpdateToolTip(e);
88.231 + if (ItemDragMode && Dist(e.Location, ItemDragStart) > ItemDragSensivity
88.232 + && CurrentNode != null && CurrentNode.IsSelected)
88.233 + {
88.234 + ItemDragMode = false;
88.235 + _toolTip.Active = false;
88.236 + OnItemDrag(e.Button, Selection.ToArray());
88.237 + }
88.238 + }
88.239 +
88.240 + protected override void OnMouseLeave(EventArgs e)
88.241 + {
88.242 + _hotColumn = null;
88.243 + UpdateHeaders();
88.244 + base.OnMouseLeave(e);
88.245 + }
88.246 +
88.247 + private void SetCursor(MouseEventArgs e)
88.248 + {
88.249 + TreeColumn col;
88.250 + col = GetColumnDividerAt(e.Location);
88.251 + if (col == null)
88.252 + _innerCursor = null;
88.253 + else
88.254 + {
88.255 + if (col.Width == 0)
88.256 + _innerCursor = ResourceHelper.DVSplitCursor;
88.257 + else
88.258 + _innerCursor = Cursors.VSplit;
88.259 + }
88.260 +
88.261 + col = GetColumnAt(e.Location);
88.262 + if (col != _hotColumn)
88.263 + {
88.264 + _hotColumn = col;
88.265 + UpdateHeaders();
88.266 + }
88.267 + }
88.268 +
88.269 + internal TreeColumn GetColumnAt(Point p)
88.270 + {
88.271 + if (p.Y > ColumnHeaderHeight)
88.272 + return null;
88.273 +
88.274 + int x = -OffsetX;
88.275 + foreach (TreeColumn col in Columns)
88.276 + {
88.277 + if (col.IsVisible)
88.278 + {
88.279 + Rectangle rect = new Rectangle(x, 0, col.Width, ColumnHeaderHeight);
88.280 + x += col.Width;
88.281 + if (rect.Contains(p))
88.282 + return col;
88.283 + }
88.284 + }
88.285 + return null;
88.286 + }
88.287 +
88.288 + internal int GetColumnX(TreeColumn column)
88.289 + {
88.290 + int x = -OffsetX;
88.291 + foreach (TreeColumn col in Columns)
88.292 + {
88.293 + if (col.IsVisible)
88.294 + {
88.295 + if (column == col)
88.296 + return x;
88.297 + else
88.298 + x += col.Width;
88.299 + }
88.300 + }
88.301 + return x;
88.302 + }
88.303 +
88.304 + internal TreeColumn GetColumnDividerAt(Point p)
88.305 + {
88.306 + if (p.Y > ColumnHeaderHeight)
88.307 + return null;
88.308 +
88.309 + int x = -OffsetX;
88.310 + TreeColumn prevCol = null;
88.311 + Rectangle left, right;
88.312 + foreach (TreeColumn col in Columns)
88.313 + {
88.314 + if (col.IsVisible)
88.315 + {
88.316 + if (col.Width > 0)
88.317 + {
88.318 + left = new Rectangle(x, 0, DividerWidth / 2, ColumnHeaderHeight);
88.319 + right = new Rectangle(x + col.Width - (DividerWidth / 2), 0, DividerWidth / 2, ColumnHeaderHeight);
88.320 + if (left.Contains(p) && prevCol != null)
88.321 + return prevCol;
88.322 + else if (right.Contains(p))
88.323 + return col;
88.324 + }
88.325 + prevCol = col;
88.326 + x += col.Width;
88.327 + }
88.328 + }
88.329 +
88.330 + left = new Rectangle(x, 0, DividerWidth / 2, ColumnHeaderHeight);
88.331 + if (left.Contains(p) && prevCol != null)
88.332 + return prevCol;
88.333 +
88.334 + return null;
88.335 + }
88.336 +
88.337 + TreeColumn _tooltipColumn;
88.338 + private void UpdateToolTip(MouseEventArgs e)
88.339 + {
88.340 + TreeColumn col = GetColumnAt(e.Location);
88.341 + if (col != null)
88.342 + {
88.343 + if (col != _tooltipColumn)
88.344 + SetTooltip(col.TooltipText);
88.345 + }
88.346 + else
88.347 + DisplayNodesTooltip(e);
88.348 + _tooltipColumn = col;
88.349 + }
88.350 +
88.351 + TreeNodeAdv _hotNode;
88.352 + NodeControl _hotControl;
88.353 + private void DisplayNodesTooltip(MouseEventArgs e)
88.354 + {
88.355 + if (ShowNodeToolTips)
88.356 + {
88.357 + TreeNodeAdvMouseEventArgs args = CreateMouseArgs(e);
88.358 + if (args.Node != null && args.Control != null)
88.359 + {
88.360 + if (args.Node != _hotNode || args.Control != _hotControl)
88.361 + SetTooltip(GetNodeToolTip(args));
88.362 + }
88.363 + else
88.364 + _toolTip.SetToolTip(this, null);
88.365 +
88.366 + _hotControl = args.Control;
88.367 + _hotNode = args.Node;
88.368 + }
88.369 + else
88.370 + _toolTip.SetToolTip(this, null);
88.371 + }
88.372 +
88.373 + private void SetTooltip(string text)
88.374 + {
88.375 + if (!String.IsNullOrEmpty(text))
88.376 + {
88.377 + _toolTip.Active = false;
88.378 + _toolTip.SetToolTip(this, text);
88.379 + _toolTip.Active = true;
88.380 + }
88.381 + else
88.382 + _toolTip.SetToolTip(this, null);
88.383 + }
88.384 +
88.385 + private string GetNodeToolTip(TreeNodeAdvMouseEventArgs args)
88.386 + {
88.387 + string msg = args.Control.GetToolTip(args.Node);
88.388 +
88.389 + BaseTextControl btc = args.Control as BaseTextControl;
88.390 + if (btc != null && btc.DisplayHiddenContentInToolTip && String.IsNullOrEmpty(msg))
88.391 + {
88.392 + Size ms = btc.GetActualSize(args.Node, _measureContext);
88.393 + if (ms.Width > args.ControlBounds.Size.Width || ms.Height > args.ControlBounds.Size.Height
88.394 + || args.ControlBounds.Right - OffsetX > DisplayRectangle.Width)
88.395 + msg = btc.GetLabel(args.Node);
88.396 + }
88.397 +
88.398 + if (String.IsNullOrEmpty(msg) && DefaultToolTipProvider != null)
88.399 + msg = DefaultToolTipProvider.GetToolTip(args.Node, args.Control);
88.400 +
88.401 + return msg;
88.402 + }
88.403 +
88.404 + #endregion
88.405 +
88.406 + #region DragDrop
88.407 +
88.408 + private bool _dragAutoScrollFlag = false;
88.409 + private Bitmap _dragBitmap = null;
88.410 + private System.Threading.Timer _dragTimer;
88.411 +
88.412 + private void StartDragTimer()
88.413 + {
88.414 + if (_dragTimer == null)
88.415 + _dragTimer = new System.Threading.Timer(new TimerCallback(DragTimerTick), null, 0, 100);
88.416 + }
88.417 +
88.418 + private void StopDragTimer()
88.419 + {
88.420 + if (_dragTimer != null)
88.421 + {
88.422 + _dragTimer.Dispose();
88.423 + _dragTimer = null;
88.424 + }
88.425 + }
88.426 +
88.427 + private void SetDropPosition(Point pt)
88.428 + {
88.429 + TreeNodeAdv node = GetNodeAt(pt);
88.430 + OnDropNodeValidating(pt, ref node);
88.431 + _dropPosition.Node = node;
88.432 + if (node != null)
88.433 + {
88.434 + Rectangle first = _rowLayout.GetRowBounds(FirstVisibleRow);
88.435 + Rectangle bounds = _rowLayout.GetRowBounds(node.Row);
88.436 + float pos = (pt.Y + first.Y - ColumnHeaderHeight - bounds.Y) / (float)bounds.Height;
88.437 + if (pos < TopEdgeSensivity)
88.438 + _dropPosition.Position = NodePosition.Before;
88.439 + else if (pos > (1 - BottomEdgeSensivity))
88.440 + _dropPosition.Position = NodePosition.After;
88.441 + else
88.442 + _dropPosition.Position = NodePosition.Inside;
88.443 + }
88.444 + }
88.445 +
88.446 + private void DragTimerTick(object state)
88.447 + {
88.448 + _dragAutoScrollFlag = true;
88.449 + }
88.450 +
88.451 + private void DragAutoScroll()
88.452 + {
88.453 + _dragAutoScrollFlag = false;
88.454 + Point pt = PointToClient(MousePosition);
88.455 + if (pt.Y < 20 && _vScrollBar.Value > 0)
88.456 + _vScrollBar.Value--;
88.457 + else if (pt.Y > Height - 20 && _vScrollBar.Value <= _vScrollBar.Maximum - _vScrollBar.LargeChange)
88.458 + _vScrollBar.Value++;
88.459 + }
88.460 +
88.461 + public void DoDragDropSelectedNodes(DragDropEffects allowedEffects)
88.462 + {
88.463 + if (SelectedNodes.Count > 0)
88.464 + {
88.465 + TreeNodeAdv[] nodes = new TreeNodeAdv[SelectedNodes.Count];
88.466 + SelectedNodes.CopyTo(nodes, 0);
88.467 + DoDragDrop(nodes, allowedEffects);
88.468 + }
88.469 + }
88.470 +
88.471 + private void CreateDragBitmap(IDataObject data)
88.472 + {
88.473 + if (UseColumns || !DisplayDraggingNodes)
88.474 + return;
88.475 +
88.476 + TreeNodeAdv[] nodes = data.GetData(typeof(TreeNodeAdv[])) as TreeNodeAdv[];
88.477 + if (nodes != null && nodes.Length > 0)
88.478 + {
88.479 + Rectangle rect = DisplayRectangle;
88.480 + Bitmap bitmap = new Bitmap(rect.Width, rect.Height);
88.481 + using (Graphics gr = Graphics.FromImage(bitmap))
88.482 + {
88.483 + gr.Clear(BackColor);
88.484 + DrawContext context = new DrawContext();
88.485 + context.Graphics = gr;
88.486 + context.Font = Font;
88.487 + context.Enabled = true;
88.488 + int y = 0;
88.489 + int maxWidth = 0;
88.490 + foreach (TreeNodeAdv node in nodes)
88.491 + {
88.492 + if (node.Tree == this)
88.493 + {
88.494 + int x = 0;
88.495 + int height = _rowLayout.GetRowBounds(node.Row).Height;
88.496 + foreach (NodeControl c in NodeControls)
88.497 + {
88.498 + Size s = c.GetActualSize(node, context);
88.499 + if (!s.IsEmpty)
88.500 + {
88.501 + int width = s.Width;
88.502 + rect = new Rectangle(x, y, width, height);
88.503 + x += (width + 1);
88.504 + context.Bounds = rect;
88.505 + c.Draw(node, context);
88.506 + }
88.507 + }
88.508 + y += height;
88.509 + maxWidth = Math.Max(maxWidth, x);
88.510 + }
88.511 + }
88.512 +
88.513 + if (maxWidth > 0 && y > 0)
88.514 + {
88.515 + _dragBitmap = new Bitmap(maxWidth, y, PixelFormat.Format32bppArgb);
88.516 + using (Graphics tgr = Graphics.FromImage(_dragBitmap))
88.517 + tgr.DrawImage(bitmap, Point.Empty);
88.518 + BitmapHelper.SetAlphaChanelValue(_dragBitmap, 150);
88.519 + }
88.520 + else
88.521 + _dragBitmap = null;
88.522 + }
88.523 + }
88.524 + }
88.525 +
88.526 + protected override void OnDragOver(DragEventArgs drgevent)
88.527 + {
88.528 + ItemDragMode = false;
88.529 + Point pt = PointToClient(new Point(drgevent.X, drgevent.Y));
88.530 + if (_dragAutoScrollFlag)
88.531 + DragAutoScroll();
88.532 + SetDropPosition(pt);
88.533 + UpdateView();
88.534 + base.OnDragOver(drgevent);
88.535 + }
88.536 +
88.537 + protected override void OnDragEnter(DragEventArgs drgevent)
88.538 + {
88.539 + _search.EndSearch();
88.540 + DragMode = true;
88.541 + CreateDragBitmap(drgevent.Data);
88.542 + base.OnDragEnter(drgevent);
88.543 + }
88.544 +
88.545 + protected override void OnDragLeave(EventArgs e)
88.546 + {
88.547 + DragMode = false;
88.548 + UpdateView();
88.549 + base.OnDragLeave(e);
88.550 + }
88.551 +
88.552 + protected override void OnDragDrop(DragEventArgs drgevent)
88.553 + {
88.554 + DragMode = false;
88.555 + UpdateView();
88.556 + base.OnDragDrop(drgevent);
88.557 + }
88.558 +
88.559 + #endregion
88.560 + }
88.561 +}
89.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
89.2 +++ b/External/Aga.Controls/Tree/TreeViewAdv.Properties.cs Sun May 27 15:16:19 2012 +0000
89.3 @@ -0,0 +1,728 @@
89.4 +using System;
89.5 +using System.Collections.Generic;
89.6 +using System.Collections.ObjectModel;
89.7 +using System.ComponentModel;
89.8 +using System.Drawing;
89.9 +using System.Drawing.Design;
89.10 +using System.Windows.Forms;
89.11 +
89.12 +using Aga.Controls.Tree.NodeControls;
89.13 +
89.14 +namespace Aga.Controls.Tree
89.15 +{
89.16 + public partial class TreeViewAdv
89.17 + {
89.18 + private Cursor _innerCursor = null;
89.19 +
89.20 + public override Cursor Cursor
89.21 + {
89.22 + get
89.23 + {
89.24 + if (_innerCursor != null)
89.25 + return _innerCursor;
89.26 + else
89.27 + return base.Cursor;
89.28 + }
89.29 + set
89.30 + {
89.31 + base.Cursor = value;
89.32 + }
89.33 + }
89.34 +
89.35 + #region Internal Properties
89.36 +
89.37 + private IRowLayout _rowLayout;
89.38 +
89.39 + private bool _dragMode;
89.40 + private bool DragMode
89.41 + {
89.42 + get { return _dragMode; }
89.43 + set
89.44 + {
89.45 + _dragMode = value;
89.46 + if (!value)
89.47 + {
89.48 + StopDragTimer();
89.49 + if (_dragBitmap != null)
89.50 + _dragBitmap.Dispose();
89.51 + _dragBitmap = null;
89.52 + }
89.53 + else
89.54 + StartDragTimer();
89.55 + }
89.56 + }
89.57 +
89.58 + internal int ColumnHeaderHeight
89.59 + {
89.60 + get
89.61 + {
89.62 + if (UseColumns)
89.63 + return _columnHeaderHeight;
89.64 + else
89.65 + return 0;
89.66 + }
89.67 + }
89.68 +
89.69 + /// <summary>
89.70 + /// returns all nodes, which parent is expanded
89.71 + /// </summary>
89.72 + private IEnumerable<TreeNodeAdv> VisibleNodes
89.73 + {
89.74 + get
89.75 + {
89.76 + TreeNodeAdv node = Root;
89.77 + while (node != null)
89.78 + {
89.79 + node = node.NextVisibleNode;
89.80 + if (node != null)
89.81 + yield return node;
89.82 + }
89.83 + }
89.84 + }
89.85 +
89.86 + private bool _suspendSelectionEvent;
89.87 + internal bool SuspendSelectionEvent
89.88 + {
89.89 + get { return _suspendSelectionEvent; }
89.90 + set
89.91 + {
89.92 + if (value != _suspendSelectionEvent)
89.93 + {
89.94 + _suspendSelectionEvent = value;
89.95 + if (!_suspendSelectionEvent && _fireSelectionEvent)
89.96 + OnSelectionChanged();
89.97 + }
89.98 + }
89.99 + }
89.100 +
89.101 + private List<TreeNodeAdv> _rowMap;
89.102 + internal List<TreeNodeAdv> RowMap
89.103 + {
89.104 + get { return _rowMap; }
89.105 + }
89.106 +
89.107 + private TreeNodeAdv _selectionStart;
89.108 + internal TreeNodeAdv SelectionStart
89.109 + {
89.110 + get { return _selectionStart; }
89.111 + set { _selectionStart = value; }
89.112 + }
89.113 +
89.114 + private InputState _input;
89.115 + internal InputState Input
89.116 + {
89.117 + get { return _input; }
89.118 + set
89.119 + {
89.120 + _input = value;
89.121 + }
89.122 + }
89.123 +
89.124 + private bool _itemDragMode;
89.125 + internal bool ItemDragMode
89.126 + {
89.127 + get { return _itemDragMode; }
89.128 + set { _itemDragMode = value; }
89.129 + }
89.130 +
89.131 + private Point _itemDragStart;
89.132 + internal Point ItemDragStart
89.133 + {
89.134 + get { return _itemDragStart; }
89.135 + set { _itemDragStart = value; }
89.136 + }
89.137 +
89.138 +
89.139 + /// <summary>
89.140 + /// Number of rows fits to the current page
89.141 + /// </summary>
89.142 + internal int CurrentPageSize
89.143 + {
89.144 + get
89.145 + {
89.146 + return _rowLayout.CurrentPageSize;
89.147 + }
89.148 + }
89.149 +
89.150 + /// <summary>
89.151 + /// Number of all visible nodes (which parent is expanded)
89.152 + /// </summary>
89.153 + internal int RowCount
89.154 + {
89.155 + get
89.156 + {
89.157 + return RowMap.Count;
89.158 + }
89.159 + }
89.160 +
89.161 + private int _contentWidth = 0;
89.162 + private int ContentWidth
89.163 + {
89.164 + get
89.165 + {
89.166 + return _contentWidth;
89.167 + }
89.168 + }
89.169 +
89.170 + private int _firstVisibleRow;
89.171 + internal int FirstVisibleRow
89.172 + {
89.173 + get { return _firstVisibleRow; }
89.174 + set
89.175 + {
89.176 + HideEditor();
89.177 + _firstVisibleRow = value;
89.178 + UpdateView();
89.179 + }
89.180 + }
89.181 +
89.182 + private int _offsetX;
89.183 + public int OffsetX
89.184 + {
89.185 + get { return _offsetX; }
89.186 + private set
89.187 + {
89.188 + HideEditor();
89.189 + _offsetX = value;
89.190 + UpdateView();
89.191 + }
89.192 + }
89.193 +
89.194 + public override Rectangle DisplayRectangle
89.195 + {
89.196 + get
89.197 + {
89.198 + Rectangle r = ClientRectangle;
89.199 + //r.Y += ColumnHeaderHeight;
89.200 + //r.Height -= ColumnHeaderHeight;
89.201 + int w = _vScrollBar.Visible ? _vScrollBar.Width : 0;
89.202 + int h = _hScrollBar.Visible ? _hScrollBar.Height : 0;
89.203 + return new Rectangle(r.X, r.Y, r.Width - w, r.Height - h);
89.204 + }
89.205 + }
89.206 +
89.207 + private List<TreeNodeAdv> _selection;
89.208 + internal List<TreeNodeAdv> Selection
89.209 + {
89.210 + get { return _selection; }
89.211 + }
89.212 +
89.213 + #endregion
89.214 +
89.215 + #region Public Properties
89.216 +
89.217 + #region DesignTime
89.218 +
89.219 + private bool _shiftFirstNode;
89.220 + [DefaultValue(false), Category("Behavior")]
89.221 + public bool ShiftFirstNode
89.222 + {
89.223 + get { return _shiftFirstNode; }
89.224 + set { _shiftFirstNode = value; }
89.225 + }
89.226 +
89.227 + private bool _displayDraggingNodes;
89.228 + [DefaultValue(false), Category("Behavior")]
89.229 + public bool DisplayDraggingNodes
89.230 + {
89.231 + get { return _displayDraggingNodes; }
89.232 + set { _displayDraggingNodes = value; }
89.233 + }
89.234 +
89.235 + private bool _fullRowSelect;
89.236 + [DefaultValue(false), Category("Behavior")]
89.237 + public bool FullRowSelect
89.238 + {
89.239 + get { return _fullRowSelect; }
89.240 + set
89.241 + {
89.242 + _fullRowSelect = value;
89.243 + UpdateView();
89.244 + }
89.245 + }
89.246 +
89.247 + private bool _useColumns;
89.248 + [DefaultValue(false), Category("Behavior")]
89.249 + public bool UseColumns
89.250 + {
89.251 + get { return _useColumns; }
89.252 + set
89.253 + {
89.254 + _useColumns = value;
89.255 + FullUpdate();
89.256 + }
89.257 + }
89.258 +
89.259 + private bool _allowColumnReorder;
89.260 + [DefaultValue(false), Category("Behavior")]
89.261 + public bool AllowColumnReorder
89.262 + {
89.263 + get { return _allowColumnReorder; }
89.264 + set { _allowColumnReorder = value; }
89.265 + }
89.266 +
89.267 + private bool _showLines = true;
89.268 + [DefaultValue(true), Category("Behavior")]
89.269 + public bool ShowLines
89.270 + {
89.271 + get { return _showLines; }
89.272 + set
89.273 + {
89.274 + _showLines = value;
89.275 + UpdateView();
89.276 + }
89.277 + }
89.278 +
89.279 + private bool _showPlusMinus = true;
89.280 + [DefaultValue(true), Category("Behavior")]
89.281 + public bool ShowPlusMinus
89.282 + {
89.283 + get { return _showPlusMinus; }
89.284 + set
89.285 + {
89.286 + _showPlusMinus = value;
89.287 + FullUpdate();
89.288 + }
89.289 + }
89.290 +
89.291 + private bool _showNodeToolTips = false;
89.292 + [DefaultValue(false), Category("Behavior")]
89.293 + public bool ShowNodeToolTips
89.294 + {
89.295 + get { return _showNodeToolTips; }
89.296 + set { _showNodeToolTips = value; }
89.297 + }
89.298 +
89.299 + [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA1801:ReviewUnusedParameters", MessageId = "value"), System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1822:MarkMembersAsStatic"), DefaultValue(true), Category("Behavior"), Obsolete("No longer used")]
89.300 + public bool KeepNodesExpanded
89.301 + {
89.302 + get { return true; }
89.303 + set {}
89.304 + }
89.305 +
89.306 + private ITreeModel _model;
89.307 + /// <Summary>
89.308 + /// The model associated with this <see cref="TreeViewAdv"/>.
89.309 + /// </Summary>
89.310 + /// <seealso cref="ITreeModel"/>
89.311 + /// <seealso cref="TreeModel"/>
89.312 + [Browsable(false)]
89.313 + public ITreeModel Model
89.314 + {
89.315 + get { return _model; }
89.316 + set
89.317 + {
89.318 + if (_model != value)
89.319 + {
89.320 + AbortBackgroundExpandingThreads();
89.321 + if (_model != null)
89.322 + UnbindModelEvents();
89.323 + _model = value;
89.324 + CreateNodes();
89.325 + FullUpdate();
89.326 + if (_model != null)
89.327 + BindModelEvents();
89.328 + }
89.329 + }
89.330 + }
89.331 +
89.332 + // Tahoma is the default font
89.333 + private static Font _font = new Font("Tahoma", 8.25F, FontStyle.Regular, GraphicsUnit.Point, ((byte)(0)), false);
89.334 + /// <summary>
89.335 + /// The font to render <see cref="TreeViewAdv"/> content in.
89.336 + /// </summary>
89.337 + [Category("Appearance"), Description("The font to render TreeViewAdv content in.")]
89.338 + public override Font Font
89.339 + {
89.340 + get
89.341 + {
89.342 + return (base.Font);
89.343 + }
89.344 + set
89.345 + {
89.346 + if (value == null)
89.347 + base.Font = _font;
89.348 + else
89.349 + {
89.350 + if (value == DefaultFont)
89.351 + base.Font = _font;
89.352 + else
89.353 + base.Font = value;
89.354 + }
89.355 + }
89.356 + }
89.357 + public override void ResetFont()
89.358 + {
89.359 + Font = null;
89.360 + }
89.361 + private bool ShouldSerializeFont()
89.362 + {
89.363 + return (!Font.Equals(_font));
89.364 + }
89.365 + // End font property
89.366 +
89.367 + private BorderStyle _borderStyle = BorderStyle.Fixed3D;
89.368 + [DefaultValue(BorderStyle.Fixed3D), Category("Appearance")]
89.369 + public BorderStyle BorderStyle
89.370 + {
89.371 + get
89.372 + {
89.373 + return this._borderStyle;
89.374 + }
89.375 + set
89.376 + {
89.377 + if (_borderStyle != value)
89.378 + {
89.379 + _borderStyle = value;
89.380 + base.UpdateStyles();
89.381 + }
89.382 + }
89.383 + }
89.384 +
89.385 + private bool _autoRowHeight = false;
89.386 + /// <summary>
89.387 + /// Set to true to expand each row's height to fit the text of it's largest column.
89.388 + /// </summary>
89.389 + [DefaultValue(false), Category("Appearance"), Description("Expand each row's height to fit the text of it's largest column.")]
89.390 + public bool AutoRowHeight
89.391 + {
89.392 + get
89.393 + {
89.394 + return _autoRowHeight;
89.395 + }
89.396 + set
89.397 + {
89.398 + _autoRowHeight = value;
89.399 + if (value)
89.400 + _rowLayout = new AutoRowHeightLayout(this, RowHeight);
89.401 + else
89.402 + _rowLayout = new FixedRowHeightLayout(this, RowHeight);
89.403 + FullUpdate();
89.404 + }
89.405 + }
89.406 +
89.407 + private GridLineStyle _gridLineStyle = GridLineStyle.None;
89.408 + [DefaultValue(GridLineStyle.None), Category("Appearance")]
89.409 + public GridLineStyle GridLineStyle
89.410 + {
89.411 + get
89.412 + {
89.413 + return _gridLineStyle;
89.414 + }
89.415 + set
89.416 + {
89.417 + if (value != _gridLineStyle)
89.418 + {
89.419 + _gridLineStyle = value;
89.420 + UpdateView();
89.421 + OnGridLineStyleChanged();
89.422 + }
89.423 + }
89.424 + }
89.425 +
89.426 + private int _rowHeight = 16;
89.427 + [DefaultValue(16), Category("Appearance")]
89.428 + public int RowHeight
89.429 + {
89.430 + get
89.431 + {
89.432 + return _rowHeight;
89.433 + }
89.434 + set
89.435 + {
89.436 + if (value <= 0)
89.437 + throw new ArgumentOutOfRangeException("value");
89.438 +
89.439 + _rowHeight = value;
89.440 + _rowLayout.PreferredRowHeight = value;
89.441 + FullUpdate();
89.442 + }
89.443 + }
89.444 +
89.445 + private TreeSelectionMode _selectionMode = TreeSelectionMode.Single;
89.446 + [DefaultValue(TreeSelectionMode.Single), Category("Behavior")]
89.447 + public TreeSelectionMode SelectionMode
89.448 + {
89.449 + get { return _selectionMode; }
89.450 + set { _selectionMode = value; }
89.451 + }
89.452 +
89.453 + private bool _hideSelection;
89.454 + [DefaultValue(false), Category("Behavior")]
89.455 + public bool HideSelection
89.456 + {
89.457 + get { return _hideSelection; }
89.458 + set
89.459 + {
89.460 + _hideSelection = value;
89.461 + UpdateView();
89.462 + }
89.463 + }
89.464 +
89.465 + private float _topEdgeSensivity = 0.3f;
89.466 + [DefaultValue(0.3f), Category("Behavior")]
89.467 + public float TopEdgeSensivity
89.468 + {
89.469 + get { return _topEdgeSensivity; }
89.470 + set
89.471 + {
89.472 + if (value < 0 || value > 1)
89.473 + throw new ArgumentOutOfRangeException();
89.474 + _topEdgeSensivity = value;
89.475 + }
89.476 + }
89.477 +
89.478 + private float _bottomEdgeSensivity = 0.3f;
89.479 + [DefaultValue(0.3f), Category("Behavior")]
89.480 + public float BottomEdgeSensivity
89.481 + {
89.482 + get { return _bottomEdgeSensivity; }
89.483 + set
89.484 + {
89.485 + if (value < 0 || value > 1)
89.486 + throw new ArgumentOutOfRangeException("value should be from 0 to 1");
89.487 + _bottomEdgeSensivity = value;
89.488 + }
89.489 + }
89.490 +
89.491 + private bool _loadOnDemand;
89.492 + [DefaultValue(false), Category("Behavior")]
89.493 + public bool LoadOnDemand
89.494 + {
89.495 + get { return _loadOnDemand; }
89.496 + set { _loadOnDemand = value; }
89.497 + }
89.498 +
89.499 + private bool _unloadCollapsedOnReload = false;
89.500 + [DefaultValue(false), Category("Behavior")]
89.501 + public bool UnloadCollapsedOnReload
89.502 + {
89.503 + get { return _unloadCollapsedOnReload; }
89.504 + set { _unloadCollapsedOnReload = value; }
89.505 + }
89.506 +
89.507 + private int _indent = 19;
89.508 + [DefaultValue(19), Category("Behavior")]
89.509 + public int Indent
89.510 + {
89.511 + get { return _indent; }
89.512 + set
89.513 + {
89.514 + _indent = value;
89.515 + UpdateView();
89.516 + }
89.517 + }
89.518 +
89.519 + private Color _lineColor = SystemColors.ControlDark;
89.520 + [Category("Behavior")]
89.521 + public Color LineColor
89.522 + {
89.523 + get { return _lineColor; }
89.524 + set
89.525 + {
89.526 + _lineColor = value;
89.527 + CreateLinePen();
89.528 + UpdateView();
89.529 + }
89.530 + }
89.531 +
89.532 + private Color _dragDropMarkColor = Color.Black;
89.533 + [Category("Behavior")]
89.534 + public Color DragDropMarkColor
89.535 + {
89.536 + get { return _dragDropMarkColor; }
89.537 + set
89.538 + {
89.539 + _dragDropMarkColor = value;
89.540 + CreateMarkPen();
89.541 + }
89.542 + }
89.543 +
89.544 + private float _dragDropMarkWidth = 3.0f;
89.545 + [DefaultValue(3.0f), Category("Behavior")]
89.546 + public float DragDropMarkWidth
89.547 + {
89.548 + get { return _dragDropMarkWidth; }
89.549 + set
89.550 + {
89.551 + _dragDropMarkWidth = value;
89.552 + CreateMarkPen();
89.553 + }
89.554 + }
89.555 +
89.556 + private bool _highlightDropPosition = true;
89.557 + [DefaultValue(true), Category("Behavior")]
89.558 + public bool HighlightDropPosition
89.559 + {
89.560 + get { return _highlightDropPosition; }
89.561 + set { _highlightDropPosition = value; }
89.562 + }
89.563 +
89.564 + private TreeColumnCollection _columns;
89.565 + [Category("Behavior"), DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
89.566 + public Collection<TreeColumn> Columns
89.567 + {
89.568 + get { return _columns; }
89.569 + }
89.570 +
89.571 + private NodeControlsCollection _controls;
89.572 + [Category("Behavior"), DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
89.573 + [Editor(typeof(NodeControlCollectionEditor), typeof(UITypeEditor))]
89.574 + public Collection<NodeControl> NodeControls
89.575 + {
89.576 + get
89.577 + {
89.578 + return _controls;
89.579 + }
89.580 + }
89.581 +
89.582 + private bool _asyncExpanding;
89.583 + /// <summary>
89.584 + /// When set to true, node contents will be read in background thread.
89.585 + /// </summary>
89.586 + [Category("Behavior"), DefaultValue(false), Description("Read children in a background thread when expanding.")]
89.587 + public bool AsyncExpanding
89.588 + {
89.589 + get { return _asyncExpanding; }
89.590 + set { _asyncExpanding = value; }
89.591 + }
89.592 +
89.593 + #endregion
89.594 +
89.595 + #region RunTime
89.596 +
89.597 + private IToolTipProvider _defaultToolTipProvider = null;
89.598 + [Browsable(false)]
89.599 + public IToolTipProvider DefaultToolTipProvider
89.600 + {
89.601 + get { return _defaultToolTipProvider; }
89.602 + set { _defaultToolTipProvider = value; }
89.603 + }
89.604 +
89.605 + [Browsable(false)]
89.606 + public IEnumerable<TreeNodeAdv> AllNodes
89.607 + {
89.608 + get
89.609 + {
89.610 + if (_root.Nodes.Count > 0)
89.611 + {
89.612 + TreeNodeAdv node = _root.Nodes[0];
89.613 + while (node != null)
89.614 + {
89.615 + yield return node;
89.616 + if (node.Nodes.Count > 0)
89.617 + node = node.Nodes[0];
89.618 + else if (node.NextNode != null)
89.619 + node = node.NextNode;
89.620 + else
89.621 + node = node.BottomNode;
89.622 + }
89.623 + }
89.624 + }
89.625 + }
89.626 +
89.627 + private DropPosition _dropPosition;
89.628 + [Browsable(false)]
89.629 + public DropPosition DropPosition
89.630 + {
89.631 + get { return _dropPosition; }
89.632 + set { _dropPosition = value; }
89.633 + }
89.634 +
89.635 + private TreeNodeAdv _root;
89.636 + [Browsable(false)]
89.637 + public TreeNodeAdv Root
89.638 + {
89.639 + get { return _root; }
89.640 + }
89.641 +
89.642 + private ReadOnlyCollection<TreeNodeAdv> _readonlySelection;
89.643 + [Browsable(false)]
89.644 + public ReadOnlyCollection<TreeNodeAdv> SelectedNodes
89.645 + {
89.646 + get
89.647 + {
89.648 + return _readonlySelection;
89.649 + }
89.650 + }
89.651 +
89.652 + [Browsable(false)]
89.653 + public TreeNodeAdv SelectedNode
89.654 + {
89.655 + get
89.656 + {
89.657 + if (Selection.Count > 0)
89.658 + {
89.659 + if (CurrentNode != null && CurrentNode.IsSelected)
89.660 + return CurrentNode;
89.661 + else
89.662 + return Selection[0];
89.663 + }
89.664 + else
89.665 + return null;
89.666 + }
89.667 + set
89.668 + {
89.669 + if (SelectedNode == value)
89.670 + return;
89.671 +
89.672 + BeginUpdate();
89.673 + try
89.674 + {
89.675 + if (value == null)
89.676 + {
89.677 + ClearSelectionInternal();
89.678 + }
89.679 + else
89.680 + {
89.681 + if (!IsMyNode(value))
89.682 + throw new ArgumentException();
89.683 +
89.684 + ClearSelectionInternal();
89.685 + value.IsSelected = true;
89.686 + CurrentNode = value;
89.687 + EnsureVisible(value);
89.688 + }
89.689 + }
89.690 + finally
89.691 + {
89.692 + EndUpdate();
89.693 + }
89.694 + }
89.695 + }
89.696 +
89.697 + private TreeNodeAdv _currentNode;
89.698 + [Browsable(false)]
89.699 + public TreeNodeAdv CurrentNode
89.700 + {
89.701 + get { return _currentNode; }
89.702 + internal set { _currentNode = value; }
89.703 + }
89.704 +
89.705 + [Browsable(false)]
89.706 + public int ItemCount
89.707 + {
89.708 + get { return RowMap.Count; }
89.709 + }
89.710 +
89.711 + /// <summary>
89.712 + /// Indicates the distance the content is scrolled to the left
89.713 + /// </summary>
89.714 + [Browsable(false)]
89.715 + public int HorizontalScrollPosition
89.716 + {
89.717 + get
89.718 + {
89.719 + if (_hScrollBar.Visible)
89.720 + return _hScrollBar.Value;
89.721 + else
89.722 + return 0;
89.723 + }
89.724 + }
89.725 +
89.726 + #endregion
89.727 +
89.728 + #endregion
89.729 +
89.730 + }
89.731 +}
90.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
90.2 +++ b/External/Aga.Controls/Tree/TreeViewAdv.cs Sun May 27 15:16:19 2012 +0000
90.3 @@ -0,0 +1,1196 @@
90.4 +using System;
90.5 +using System.Collections.Generic;
90.6 +using System.Collections.ObjectModel;
90.7 +using System.ComponentModel;
90.8 +using System.Drawing;
90.9 +using System.Security.Permissions;
90.10 +using System.Threading;
90.11 +using System.Windows.Forms;
90.12 +using System.Collections;
90.13 +
90.14 +using Aga.Controls.Tree.NodeControls;
90.15 +using Aga.Controls.Threading;
90.16 +
90.17 +
90.18 +namespace Aga.Controls.Tree
90.19 +{
90.20 + /// <summary>
90.21 + /// Extensible advanced <see cref="TreeView"/> implemented in 100% managed C# code.
90.22 + /// Features: Model/View architecture. Multiple column per node. Ability to select
90.23 + /// multiple tree nodes. Different types of controls for each node column:
90.24 + /// <see cref="CheckBox"/>, Icon, Label... Drag and Drop highlighting. Load on
90.25 + /// demand of nodes. Incremental search of nodes.
90.26 + /// </summary>
90.27 + public partial class TreeViewAdv : Control
90.28 + {
90.29 + private const int LeftMargin = 7;
90.30 + internal const int ItemDragSensivity = 4;
90.31 + private readonly int _columnHeaderHeight;
90.32 + private const int DividerWidth = 9;
90.33 + private const int DividerCorrectionGap = -2;
90.34 +
90.35 + private Pen _linePen;
90.36 + private Pen _markPen;
90.37 + private bool _suspendUpdate;
90.38 + private bool _needFullUpdate;
90.39 + private bool _fireSelectionEvent;
90.40 + private NodePlusMinus _plusMinus;
90.41 + private ToolTip _toolTip;
90.42 + private DrawContext _measureContext;
90.43 + private TreeColumn _hotColumn;
90.44 + private IncrementalSearch _search;
90.45 + private List<TreeNodeAdv> _expandingNodes = new List<TreeNodeAdv>();
90.46 + private AbortableThreadPool _threadPool = new AbortableThreadPool();
90.47 +
90.48 + #region Public Events
90.49 +
90.50 + [Category("Action")]
90.51 + public event ItemDragEventHandler ItemDrag;
90.52 + private void OnItemDrag(MouseButtons buttons, object item)
90.53 + {
90.54 + if (ItemDrag != null)
90.55 + ItemDrag(this, new ItemDragEventArgs(buttons, item));
90.56 + }
90.57 +
90.58 + [Category("Behavior")]
90.59 + public event EventHandler<TreeNodeAdvMouseEventArgs> NodeMouseClick;
90.60 + private void OnNodeMouseClick(TreeNodeAdvMouseEventArgs args)
90.61 + {
90.62 + if (NodeMouseClick != null)
90.63 + NodeMouseClick(this, args);
90.64 + }
90.65 +
90.66 + [Category("Behavior")]
90.67 + public event EventHandler<TreeNodeAdvMouseEventArgs> NodeMouseDoubleClick;
90.68 + private void OnNodeMouseDoubleClick(TreeNodeAdvMouseEventArgs args)
90.69 + {
90.70 + if (NodeMouseDoubleClick != null)
90.71 + NodeMouseDoubleClick(this, args);
90.72 + }
90.73 +
90.74 + [Category("Behavior")]
90.75 + public event EventHandler<TreeColumnEventArgs> ColumnWidthChanged;
90.76 + internal void OnColumnWidthChanged(TreeColumn column)
90.77 + {
90.78 + if (ColumnWidthChanged != null)
90.79 + ColumnWidthChanged(this, new TreeColumnEventArgs(column));
90.80 + }
90.81 +
90.82 + [Category("Behavior")]
90.83 + public event EventHandler<TreeColumnEventArgs> ColumnReordered;
90.84 + internal void OnColumnReordered(TreeColumn column)
90.85 + {
90.86 + if (ColumnReordered != null)
90.87 + ColumnReordered(this, new TreeColumnEventArgs(column));
90.88 + }
90.89 +
90.90 + [Category("Behavior")]
90.91 + public event EventHandler<TreeColumnEventArgs> ColumnClicked;
90.92 + internal void OnColumnClicked(TreeColumn column)
90.93 + {
90.94 + if (ColumnClicked != null)
90.95 + ColumnClicked(this, new TreeColumnEventArgs(column));
90.96 + }
90.97 +
90.98 + [Category("Behavior")]
90.99 + public event EventHandler SelectionChanged;
90.100 + internal void OnSelectionChanged()
90.101 + {
90.102 + if (SuspendSelectionEvent)
90.103 + _fireSelectionEvent = true;
90.104 + else
90.105 + {
90.106 + _fireSelectionEvent = false;
90.107 + if (SelectionChanged != null)
90.108 + SelectionChanged(this, EventArgs.Empty);
90.109 + }
90.110 + }
90.111 +
90.112 + [Category("Behavior")]
90.113 + public event EventHandler<TreeViewAdvEventArgs> Collapsing;
90.114 + private void OnCollapsing(TreeNodeAdv node)
90.115 + {
90.116 + if (Collapsing != null)
90.117 + Collapsing(this, new TreeViewAdvEventArgs(node));
90.118 + }
90.119 +
90.120 + [Category("Behavior")]
90.121 + public event EventHandler<TreeViewAdvEventArgs> Collapsed;
90.122 + private void OnCollapsed(TreeNodeAdv node)
90.123 + {
90.124 + if (Collapsed != null)
90.125 + Collapsed(this, new TreeViewAdvEventArgs(node));
90.126 + }
90.127 +
90.128 + [Category("Behavior")]
90.129 + public event EventHandler<TreeViewAdvEventArgs> Expanding;
90.130 + private void OnExpanding(TreeNodeAdv node)
90.131 + {
90.132 + if (Expanding != null)
90.133 + Expanding(this, new TreeViewAdvEventArgs(node));
90.134 + }
90.135 +
90.136 + [Category("Behavior")]
90.137 + public event EventHandler<TreeViewAdvEventArgs> Expanded;
90.138 + private void OnExpanded(TreeNodeAdv node)
90.139 + {
90.140 + if (Expanded != null)
90.141 + Expanded(this, new TreeViewAdvEventArgs(node));
90.142 + }
90.143 +
90.144 + [Category("Behavior")]
90.145 + public event EventHandler GridLineStyleChanged;
90.146 + private void OnGridLineStyleChanged()
90.147 + {
90.148 + if (GridLineStyleChanged != null)
90.149 + GridLineStyleChanged(this, EventArgs.Empty);
90.150 + }
90.151 +
90.152 + [Category("Behavior")]
90.153 + public event ScrollEventHandler Scroll;
90.154 + protected virtual void OnScroll(ScrollEventArgs e)
90.155 + {
90.156 + if (Scroll != null)
90.157 + Scroll(this, e);
90.158 + }
90.159 +
90.160 + [Category("Behavior")]
90.161 + public event EventHandler<TreeViewRowDrawEventArgs> RowDraw;
90.162 + protected virtual void OnRowDraw(PaintEventArgs e, TreeNodeAdv node, DrawContext context, int row, Rectangle rowRect)
90.163 + {
90.164 + if (RowDraw != null)
90.165 + {
90.166 + TreeViewRowDrawEventArgs args = new TreeViewRowDrawEventArgs(e.Graphics, e.ClipRectangle, node, context, row, rowRect);
90.167 + RowDraw(this, args);
90.168 + }
90.169 + }
90.170 +
90.171 + /// <summary>
90.172 + /// Fires when control is going to draw. Can be used to change text or back color
90.173 + /// </summary>
90.174 + [Category("Behavior")]
90.175 + public event EventHandler<DrawEventArgs> DrawControl;
90.176 +
90.177 + internal bool DrawControlMustBeFired()
90.178 + {
90.179 + return DrawControl != null;
90.180 + }
90.181 +
90.182 + internal void FireDrawControl(DrawEventArgs args)
90.183 + {
90.184 + OnDrawControl(args);
90.185 + }
90.186 +
90.187 + protected virtual void OnDrawControl(DrawEventArgs args)
90.188 + {
90.189 + if (DrawControl != null)
90.190 + DrawControl(this, args);
90.191 + }
90.192 +
90.193 +
90.194 + [Category("Drag Drop")]
90.195 + public event EventHandler<DropNodeValidatingEventArgs> DropNodeValidating;
90.196 + protected virtual void OnDropNodeValidating(Point point, ref TreeNodeAdv node)
90.197 + {
90.198 + if (DropNodeValidating != null)
90.199 + {
90.200 + DropNodeValidatingEventArgs args = new DropNodeValidatingEventArgs(point, node);
90.201 + DropNodeValidating(this, args);
90.202 + node = args.Node;
90.203 + }
90.204 + }
90.205 + #endregion
90.206 +
90.207 + public TreeViewAdv()
90.208 + {
90.209 + InitializeComponent();
90.210 + SetStyle(ControlStyles.AllPaintingInWmPaint
90.211 + | ControlStyles.UserPaint
90.212 + | ControlStyles.OptimizedDoubleBuffer
90.213 + | ControlStyles.ResizeRedraw
90.214 + | ControlStyles.Selectable
90.215 + , true);
90.216 +
90.217 +
90.218 + if (Application.RenderWithVisualStyles)
90.219 + _columnHeaderHeight = 20;
90.220 + else
90.221 + _columnHeaderHeight = 17;
90.222 +
90.223 + //BorderStyle = BorderStyle.Fixed3D;
90.224 + _hScrollBar.Height = SystemInformation.HorizontalScrollBarHeight;
90.225 + _vScrollBar.Width = SystemInformation.VerticalScrollBarWidth;
90.226 + _rowLayout = new FixedRowHeightLayout(this, RowHeight);
90.227 + _rowMap = new List<TreeNodeAdv>();
90.228 + _selection = new List<TreeNodeAdv>();
90.229 + _readonlySelection = new ReadOnlyCollection<TreeNodeAdv>(_selection);
90.230 + _columns = new TreeColumnCollection(this);
90.231 + _toolTip = new ToolTip();
90.232 +
90.233 + _measureContext = new DrawContext();
90.234 + _measureContext.Font = Font;
90.235 + _measureContext.Graphics = Graphics.FromImage(new Bitmap(1, 1));
90.236 +
90.237 + Input = new NormalInputState(this);
90.238 + _search = new IncrementalSearch(this);
90.239 + CreateNodes();
90.240 + CreatePens();
90.241 +
90.242 + ArrangeControls();
90.243 +
90.244 + _plusMinus = new NodePlusMinus();
90.245 + _controls = new NodeControlsCollection(this);
90.246 +
90.247 + Font = _font;
90.248 + ExpandingIcon.IconChanged += ExpandingIconChanged;
90.249 + }
90.250 +
90.251 + void ExpandingIconChanged(object sender, EventArgs e)
90.252 + {
90.253 + if (IsHandleCreated && !IsDisposed)
90.254 + BeginInvoke(new MethodInvoker(DrawIcons));
90.255 + }
90.256 +
90.257 + private void DrawIcons()
90.258 + {
90.259 + using (Graphics gr = Graphics.FromHwnd(this.Handle))
90.260 + {
90.261 + //Apply the same Graphics Transform logic as used in OnPaint.
90.262 + int y = 0;
90.263 + if (UseColumns)
90.264 + {
90.265 + y += ColumnHeaderHeight;
90.266 + if (Columns.Count == 0)
90.267 + return;
90.268 + }
90.269 + int firstRowY = _rowLayout.GetRowBounds(FirstVisibleRow).Y;
90.270 + y -= firstRowY;
90.271 + gr.ResetTransform();
90.272 + gr.TranslateTransform(-OffsetX, y);
90.273 +
90.274 + DrawContext context = new DrawContext();
90.275 + context.Graphics = gr;
90.276 + for (int i = 0; i < _expandingNodes.Count; i++)
90.277 + {
90.278 + foreach (NodeControlInfo item in GetNodeControls(_expandingNodes[i]))
90.279 + {
90.280 + if (item.Control is ExpandingIcon)
90.281 + {
90.282 + Rectangle bounds = item.Bounds;
90.283 + if (item.Node.Parent == null && UseColumns)
90.284 + bounds.Location = Point.Empty; // display root expanding icon at 0,0
90.285 +
90.286 + context.Bounds = bounds;
90.287 + item.Control.Draw(item.Node, context);
90.288 + }
90.289 + }
90.290 + }
90.291 + }
90.292 + }
90.293 +
90.294 + #region Public Methods
90.295 +
90.296 + public TreePath GetPath(TreeNodeAdv node)
90.297 + {
90.298 + if (node == _root)
90.299 + return TreePath.Empty;
90.300 + else
90.301 + {
90.302 + Stack<object> stack = new Stack<object>();
90.303 + while (node != _root && node != null)
90.304 + {
90.305 + stack.Push(node.Tag);
90.306 + node = node.Parent;
90.307 + }
90.308 + return new TreePath(stack.ToArray());
90.309 + }
90.310 + }
90.311 +
90.312 + public TreeNodeAdv GetNodeAt(Point point)
90.313 + {
90.314 + NodeControlInfo info = GetNodeControlInfoAt(point);
90.315 + return info.Node;
90.316 + }
90.317 +
90.318 + public NodeControlInfo GetNodeControlInfoAt(Point point)
90.319 + {
90.320 + if (point.X < 0 || point.Y < 0)
90.321 + return NodeControlInfo.Empty;
90.322 +
90.323 + int row = _rowLayout.GetRowAt(point);
90.324 + if (row < RowCount && row >= 0)
90.325 + return GetNodeControlInfoAt(RowMap[row], point);
90.326 + else
90.327 + return NodeControlInfo.Empty;
90.328 + }
90.329 +
90.330 + private NodeControlInfo GetNodeControlInfoAt(TreeNodeAdv node, Point point)
90.331 + {
90.332 + Rectangle rect = _rowLayout.GetRowBounds(FirstVisibleRow);
90.333 + point.Y += (rect.Y - ColumnHeaderHeight);
90.334 + point.X += OffsetX;
90.335 + foreach (NodeControlInfo info in GetNodeControls(node))
90.336 + if (info.Bounds.Contains(point))
90.337 + return info;
90.338 +
90.339 + if (FullRowSelect)
90.340 + return new NodeControlInfo(null, Rectangle.Empty, node);
90.341 + else
90.342 + return NodeControlInfo.Empty;
90.343 + }
90.344 +
90.345 + public void BeginUpdate()
90.346 + {
90.347 + _suspendUpdate = true;
90.348 + SuspendSelectionEvent = true;
90.349 + }
90.350 +
90.351 + public void EndUpdate()
90.352 + {
90.353 + _suspendUpdate = false;
90.354 + if (_needFullUpdate)
90.355 + FullUpdate();
90.356 + else
90.357 + UpdateView();
90.358 + SuspendSelectionEvent = false;
90.359 + }
90.360 +
90.361 + public void ExpandAll()
90.362 + {
90.363 + _root.ExpandAll();
90.364 + }
90.365 +
90.366 + public void CollapseAll()
90.367 + {
90.368 + _root.CollapseAll();
90.369 + }
90.370 +
90.371 + /// <summary>
90.372 + /// Expand all parent nodes, andd scroll to the specified node
90.373 + /// </summary>
90.374 + public void EnsureVisible(TreeNodeAdv node)
90.375 + {
90.376 + if (node == null)
90.377 + throw new ArgumentNullException("node");
90.378 +
90.379 + if (!IsMyNode(node))
90.380 + throw new ArgumentException();
90.381 +
90.382 + TreeNodeAdv parent = node.Parent;
90.383 + while (parent != _root)
90.384 + {
90.385 + parent.IsExpanded = true;
90.386 + parent = parent.Parent;
90.387 + }
90.388 + ScrollTo(node);
90.389 + }
90.390 +
90.391 + /// <summary>
90.392 + /// Make node visible, scroll if needed. All parent nodes of the specified node must be expanded
90.393 + /// </summary>
90.394 + /// <param name="node"></param>
90.395 + public void ScrollTo(TreeNodeAdv node)
90.396 + {
90.397 + if (node == null)
90.398 + throw new ArgumentNullException("node");
90.399 +
90.400 + if (!IsMyNode(node))
90.401 + throw new ArgumentException();
90.402 +
90.403 + if (node.Row < 0)
90.404 + CreateRowMap();
90.405 +
90.406 + int row = -1;
90.407 +
90.408 + if (node.Row < FirstVisibleRow)
90.409 + row = node.Row;
90.410 + else
90.411 + {
90.412 + int pageStart = _rowLayout.GetRowBounds(FirstVisibleRow).Top;
90.413 + int rowBottom = _rowLayout.GetRowBounds(node.Row).Bottom;
90.414 + if (rowBottom > pageStart + DisplayRectangle.Height - ColumnHeaderHeight)
90.415 + row = _rowLayout.GetFirstRow(node.Row);
90.416 + }
90.417 +
90.418 + if (row >= _vScrollBar.Minimum && row <= _vScrollBar.Maximum)
90.419 + _vScrollBar.Value = row;
90.420 + }
90.421 +
90.422 + public void ClearSelection()
90.423 + {
90.424 + BeginUpdate();
90.425 + try
90.426 + {
90.427 + ClearSelectionInternal();
90.428 + }
90.429 + finally
90.430 + {
90.431 + EndUpdate();
90.432 + }
90.433 + }
90.434 +
90.435 + internal void ClearSelectionInternal()
90.436 + {
90.437 + while (Selection.Count > 0)
90.438 + {
90.439 + var t = Selection[0];
90.440 + t.IsSelected = false;
90.441 + Selection.Remove(t); //hack
90.442 + }
90.443 + }
90.444 +
90.445 + #endregion
90.446 +
90.447 + protected override void OnSizeChanged(EventArgs e)
90.448 + {
90.449 + ArrangeControls();
90.450 + SafeUpdateScrollBars();
90.451 + base.OnSizeChanged(e);
90.452 + }
90.453 +
90.454 + private void ArrangeControls()
90.455 + {
90.456 + int hBarSize = _hScrollBar.Height;
90.457 + int vBarSize = _vScrollBar.Width;
90.458 + Rectangle clientRect = ClientRectangle;
90.459 +
90.460 + _hScrollBar.SetBounds(clientRect.X, clientRect.Bottom - hBarSize,
90.461 + clientRect.Width - vBarSize, hBarSize);
90.462 +
90.463 + _vScrollBar.SetBounds(clientRect.Right - vBarSize, clientRect.Y,
90.464 + vBarSize, clientRect.Height - hBarSize);
90.465 + }
90.466 +
90.467 + private void SafeUpdateScrollBars()
90.468 + {
90.469 + if (InvokeRequired)
90.470 + BeginInvoke(new MethodInvoker(UpdateScrollBars));
90.471 + else
90.472 + UpdateScrollBars();
90.473 + }
90.474 +
90.475 + private void UpdateScrollBars()
90.476 + {
90.477 + UpdateVScrollBar();
90.478 + UpdateHScrollBar();
90.479 + UpdateVScrollBar();
90.480 + UpdateHScrollBar();
90.481 + _hScrollBar.Width = DisplayRectangle.Width;
90.482 + _vScrollBar.Height = DisplayRectangle.Height;
90.483 + }
90.484 +
90.485 + private void UpdateHScrollBar()
90.486 + {
90.487 + _hScrollBar.Maximum = ContentWidth;
90.488 + _hScrollBar.LargeChange = Math.Max(DisplayRectangle.Width, 0);
90.489 + _hScrollBar.SmallChange = 5;
90.490 + _hScrollBar.Visible = _hScrollBar.LargeChange < _hScrollBar.Maximum;
90.491 + _hScrollBar.Value = Math.Min(_hScrollBar.Value, _hScrollBar.Maximum - _hScrollBar.LargeChange + 1);
90.492 + }
90.493 +
90.494 + private void UpdateVScrollBar()
90.495 + {
90.496 + _vScrollBar.Maximum = Math.Max(RowCount - 1, 0);
90.497 + _vScrollBar.LargeChange = _rowLayout.PageRowCount;
90.498 + _vScrollBar.Visible = (RowCount > 0) && (_vScrollBar.LargeChange <= _vScrollBar.Maximum);
90.499 + _vScrollBar.Value = Math.Min(_vScrollBar.Value, _vScrollBar.Maximum - _vScrollBar.LargeChange + 1);
90.500 + }
90.501 +
90.502 + protected override CreateParams CreateParams
90.503 + {
90.504 + [SecurityPermission(SecurityAction.LinkDemand, Flags = SecurityPermissionFlag.UnmanagedCode)]
90.505 + get
90.506 + {
90.507 + CreateParams res = base.CreateParams;
90.508 + switch (BorderStyle)
90.509 + {
90.510 + case BorderStyle.FixedSingle:
90.511 + res.Style |= 0x800000;
90.512 + break;
90.513 + case BorderStyle.Fixed3D:
90.514 + res.ExStyle |= 0x200;
90.515 + break;
90.516 + }
90.517 + return res;
90.518 + }
90.519 + }
90.520 +
90.521 + protected override void OnGotFocus(EventArgs e)
90.522 + {
90.523 + UpdateView();
90.524 + ChangeInput();
90.525 + base.OnGotFocus(e);
90.526 + }
90.527 +
90.528 + protected override void OnFontChanged(EventArgs e)
90.529 + {
90.530 + base.OnFontChanged(e);
90.531 + _measureContext.Font = Font;
90.532 + FullUpdate();
90.533 + }
90.534 +
90.535 + internal IEnumerable<NodeControlInfo> GetNodeControls(TreeNodeAdv node)
90.536 + {
90.537 + if (node == null)
90.538 + yield break;
90.539 + Rectangle rowRect = _rowLayout.GetRowBounds(node.Row);
90.540 + foreach (NodeControlInfo n in GetNodeControls(node, rowRect))
90.541 + yield return n;
90.542 + }
90.543 +
90.544 + internal IEnumerable<NodeControlInfo> GetNodeControls(TreeNodeAdv node, Rectangle rowRect)
90.545 + {
90.546 + if (node == null)
90.547 + yield break;
90.548 +
90.549 + int y = rowRect.Y;
90.550 + int x = (node.Level - 1) * _indent + LeftMargin;
90.551 + int width = 0;
90.552 + if (node.Row == 0 && ShiftFirstNode)
90.553 + x -= _indent;
90.554 + Rectangle rect = Rectangle.Empty;
90.555 +
90.556 + if (ShowPlusMinus)
90.557 + {
90.558 + width = _plusMinus.GetActualSize(node, _measureContext).Width;
90.559 + rect = new Rectangle(x, y, width, rowRect.Height);
90.560 + if (UseColumns && Columns.Count > 0 && Columns[0].Width < rect.Right)
90.561 + rect.Width = Columns[0].Width - x;
90.562 +
90.563 + yield return new NodeControlInfo(_plusMinus, rect, node);
90.564 + x += width;
90.565 + }
90.566 +
90.567 + if (!UseColumns)
90.568 + {
90.569 + foreach (NodeControl c in NodeControls)
90.570 + {
90.571 + Size s = c.GetActualSize(node, _measureContext);
90.572 + if (!s.IsEmpty)
90.573 + {
90.574 + width = s.Width;
90.575 + rect = new Rectangle(x, y, width, rowRect.Height);
90.576 + x += rect.Width;
90.577 + yield return new NodeControlInfo(c, rect, node);
90.578 + }
90.579 + }
90.580 + }
90.581 + else
90.582 + {
90.583 + int right = 0;
90.584 + foreach (TreeColumn col in Columns)
90.585 + {
90.586 + if (col.IsVisible && col.Width > 0)
90.587 + {
90.588 + right += col.Width;
90.589 + for (int i = 0; i < NodeControls.Count; i++)
90.590 + {
90.591 + NodeControl nc = NodeControls[i];
90.592 + if (nc.ParentColumn == col)
90.593 + {
90.594 + Size s = nc.GetActualSize(node, _measureContext);
90.595 + if (!s.IsEmpty)
90.596 + {
90.597 + bool isLastControl = true;
90.598 + for (int k = i + 1; k < NodeControls.Count; k++)
90.599 + if (NodeControls[k].ParentColumn == col)
90.600 + {
90.601 + isLastControl = false;
90.602 + break;
90.603 + }
90.604 +
90.605 + width = right - x;
90.606 + if (!isLastControl)
90.607 + width = s.Width;
90.608 + int maxWidth = Math.Max(0, right - x);
90.609 + rect = new Rectangle(x, y, Math.Min(maxWidth, width), rowRect.Height);
90.610 + x += width;
90.611 + yield return new NodeControlInfo(nc, rect, node);
90.612 + }
90.613 + }
90.614 + }
90.615 + x = right;
90.616 + }
90.617 + }
90.618 + }
90.619 + }
90.620 +
90.621 + internal static double Dist(Point p1, Point p2)
90.622 + {
90.623 + return Math.Sqrt(Math.Pow(p1.X - p2.X, 2) + Math.Pow(p1.Y - p2.Y, 2));
90.624 + }
90.625 +
90.626 + public void FullUpdate()
90.627 + {
90.628 + HideEditor();
90.629 + if (InvokeRequired)
90.630 + BeginInvoke(new MethodInvoker(UnsafeFullUpdate));
90.631 + else
90.632 + UnsafeFullUpdate();
90.633 + }
90.634 +
90.635 + private void UnsafeFullUpdate()
90.636 + {
90.637 + _rowLayout.ClearCache();
90.638 + CreateRowMap();
90.639 + SafeUpdateScrollBars();
90.640 + UpdateView();
90.641 + _needFullUpdate = false;
90.642 + }
90.643 +
90.644 + internal void UpdateView()
90.645 + {
90.646 + if (!_suspendUpdate)
90.647 + Invalidate(false);
90.648 + }
90.649 +
90.650 + internal void UpdateHeaders()
90.651 + {
90.652 + Invalidate(new Rectangle(0, 0, Width, ColumnHeaderHeight));
90.653 + }
90.654 +
90.655 + internal void UpdateColumns()
90.656 + {
90.657 + FullUpdate();
90.658 + }
90.659 +
90.660 + private void CreateNodes()
90.661 + {
90.662 + Selection.Clear();
90.663 + SelectionStart = null;
90.664 + _root = new TreeNodeAdv(this, null);
90.665 + _root.IsExpanded = true;
90.666 + if (_root.Nodes.Count > 0)
90.667 + CurrentNode = _root.Nodes[0];
90.668 + else
90.669 + CurrentNode = null;
90.670 + }
90.671 +
90.672 + internal void ReadChilds(TreeNodeAdv parentNode)
90.673 + {
90.674 + ReadChilds(parentNode, false);
90.675 + }
90.676 +
90.677 + internal void ReadChilds(TreeNodeAdv parentNode, bool performFullUpdate)
90.678 + {
90.679 + if (!parentNode.IsLeaf)
90.680 + {
90.681 + parentNode.IsExpandedOnce = true;
90.682 + parentNode.Nodes.Clear();
90.683 +
90.684 + if (Model != null)
90.685 + {
90.686 + IEnumerable items = Model.GetChildren(GetPath(parentNode));
90.687 + if (items != null)
90.688 + foreach (object obj in items)
90.689 + {
90.690 + AddNewNode(parentNode, obj, -1);
90.691 + if (performFullUpdate)
90.692 + FullUpdate();
90.693 + }
90.694 + }
90.695 +
90.696 + if (parentNode.AutoExpandOnStructureChanged)
90.697 + parentNode.ExpandAll();
90.698 + }
90.699 + }
90.700 +
90.701 + private void AddNewNode(TreeNodeAdv parent, object tag, int index)
90.702 + {
90.703 + TreeNodeAdv node = new TreeNodeAdv(this, tag);
90.704 + AddNode(parent, index, node);
90.705 + }
90.706 +
90.707 + private void AddNode(TreeNodeAdv parent, int index, TreeNodeAdv node)
90.708 + {
90.709 + if (index >= 0 && index < parent.Nodes.Count)
90.710 + parent.Nodes.Insert(index, node);
90.711 + else
90.712 + parent.Nodes.Add(node);
90.713 +
90.714 + node.IsLeaf = Model.IsLeaf(GetPath(node));
90.715 + if (node.IsLeaf)
90.716 + node.Nodes.Clear();
90.717 + if (!LoadOnDemand || node.IsExpandedOnce)
90.718 + ReadChilds(node);
90.719 + }
90.720 +
90.721 + private struct ExpandArgs
90.722 + {
90.723 + public TreeNodeAdv Node;
90.724 + public bool Value;
90.725 + public bool IgnoreChildren;
90.726 + }
90.727 +
90.728 + public void AbortBackgroundExpandingThreads()
90.729 + {
90.730 + _threadPool.CancelAll(true);
90.731 + for (int i = 0; i < _expandingNodes.Count; i++)
90.732 + _expandingNodes[i].IsExpandingNow = false;
90.733 + _expandingNodes.Clear();
90.734 + Invalidate();
90.735 + }
90.736 +
90.737 + internal void SetIsExpanded(TreeNodeAdv node, bool value, bool ignoreChildren)
90.738 + {
90.739 + ExpandArgs eargs = new ExpandArgs();
90.740 + eargs.Node = node;
90.741 + eargs.Value = value;
90.742 + eargs.IgnoreChildren = ignoreChildren;
90.743 +
90.744 + if (AsyncExpanding && LoadOnDemand && !_threadPool.IsMyThread(Thread.CurrentThread))
90.745 + {
90.746 + WaitCallback wc = delegate(object argument) { SetIsExpanded((ExpandArgs)argument); };
90.747 + _threadPool.QueueUserWorkItem(wc, eargs);
90.748 + }
90.749 + else
90.750 + SetIsExpanded(eargs);
90.751 + }
90.752 +
90.753 + private void SetIsExpanded(ExpandArgs eargs)
90.754 + {
90.755 + bool update = !eargs.IgnoreChildren && !AsyncExpanding;
90.756 + if (update)
90.757 + BeginUpdate();
90.758 + try
90.759 + {
90.760 + if (IsMyNode(eargs.Node) && eargs.Node.IsExpanded != eargs.Value)
90.761 + SetIsExpanded(eargs.Node, eargs.Value);
90.762 +
90.763 + if (!eargs.IgnoreChildren)
90.764 + SetIsExpandedRecursive(eargs.Node, eargs.Value);
90.765 + }
90.766 + finally
90.767 + {
90.768 + if (update)
90.769 + EndUpdate();
90.770 + }
90.771 + }
90.772 +
90.773 + internal void SetIsExpanded(TreeNodeAdv node, bool value)
90.774 + {
90.775 + if (Root == node && !value)
90.776 + return; //Can't collapse root node
90.777 +
90.778 + if (value)
90.779 + {
90.780 + OnExpanding(node);
90.781 + node.OnExpanding();
90.782 + }
90.783 + else
90.784 + {
90.785 + OnCollapsing(node);
90.786 + node.OnCollapsing();
90.787 + }
90.788 +
90.789 + if (value && !node.IsExpandedOnce)
90.790 + {
90.791 + if (AsyncExpanding && LoadOnDemand)
90.792 + {
90.793 + AddExpandingNode(node);
90.794 + node.AssignIsExpanded(true);
90.795 + Invalidate();
90.796 + }
90.797 + ReadChilds(node, AsyncExpanding);
90.798 + RemoveExpandingNode(node);
90.799 + }
90.800 + node.AssignIsExpanded(value);
90.801 + SmartFullUpdate();
90.802 +
90.803 + if (value)
90.804 + {
90.805 + OnExpanded(node);
90.806 + node.OnExpanded();
90.807 + }
90.808 + else
90.809 + {
90.810 + OnCollapsed(node);
90.811 + node.OnCollapsed();
90.812 + }
90.813 + }
90.814 +
90.815 + private void RemoveExpandingNode(TreeNodeAdv node)
90.816 + {
90.817 + node.IsExpandingNow = false;
90.818 + _expandingNodes.Remove(node);
90.819 + if (_expandingNodes.Count <= 0)
90.820 + ExpandingIcon.Stop();
90.821 + }
90.822 +
90.823 + private void AddExpandingNode(TreeNodeAdv node)
90.824 + {
90.825 + node.IsExpandingNow = true;
90.826 + _expandingNodes.Add(node);
90.827 + ExpandingIcon.Start();
90.828 + }
90.829 +
90.830 + internal void SetIsExpandedRecursive(TreeNodeAdv root, bool value)
90.831 + {
90.832 + for (int i = 0; i < root.Nodes.Count; i++)
90.833 + {
90.834 + TreeNodeAdv node = root.Nodes[i];
90.835 + node.IsExpanded = value;
90.836 + SetIsExpandedRecursive(node, value);
90.837 + }
90.838 + }
90.839 +
90.840 + private void CreateRowMap()
90.841 + {
90.842 + RowMap.Clear();
90.843 + int row = 0;
90.844 + _contentWidth = 0;
90.845 + foreach (TreeNodeAdv node in VisibleNodes)
90.846 + {
90.847 + node.Row = row;
90.848 + RowMap.Add(node);
90.849 + if (!UseColumns)
90.850 + {
90.851 + _contentWidth = Math.Max(_contentWidth, GetNodeWidth(node));
90.852 + }
90.853 + row++;
90.854 + }
90.855 + if (UseColumns)
90.856 + {
90.857 + _contentWidth = 0;
90.858 + foreach (TreeColumn col in _columns)
90.859 + if (col.IsVisible)
90.860 + _contentWidth += col.Width;
90.861 + }
90.862 + }
90.863 +
90.864 + private int GetNodeWidth(TreeNodeAdv node)
90.865 + {
90.866 + if (node.RightBounds == null)
90.867 + {
90.868 + Rectangle res = GetNodeBounds(GetNodeControls(node, Rectangle.Empty));
90.869 + node.RightBounds = res.Right;
90.870 + }
90.871 + return node.RightBounds.Value;
90.872 + }
90.873 +
90.874 + internal Rectangle GetNodeBounds(TreeNodeAdv node)
90.875 + {
90.876 + return GetNodeBounds(GetNodeControls(node));
90.877 + }
90.878 +
90.879 + private Rectangle GetNodeBounds(IEnumerable<NodeControlInfo> nodeControls)
90.880 + {
90.881 + Rectangle res = Rectangle.Empty;
90.882 + foreach (NodeControlInfo info in nodeControls)
90.883 + {
90.884 + if (res == Rectangle.Empty)
90.885 + res = info.Bounds;
90.886 + else
90.887 + res = Rectangle.Union(res, info.Bounds);
90.888 + }
90.889 + return res;
90.890 + }
90.891 +
90.892 + private void _vScrollBar_ValueChanged(object sender, EventArgs e)
90.893 + {
90.894 + FirstVisibleRow = _vScrollBar.Value;
90.895 + }
90.896 +
90.897 + private void _hScrollBar_ValueChanged(object sender, EventArgs e)
90.898 + {
90.899 + OffsetX = _hScrollBar.Value;
90.900 + }
90.901 +
90.902 + private void _vScrollBar_Scroll(object sender, ScrollEventArgs e)
90.903 + {
90.904 + OnScroll(e);
90.905 + }
90.906 +
90.907 + private void _hScrollBar_Scroll(object sender, ScrollEventArgs e)
90.908 + {
90.909 + OnScroll(e);
90.910 + }
90.911 +
90.912 + internal void SmartFullUpdate()
90.913 + {
90.914 + if (_suspendUpdate)
90.915 + _needFullUpdate = true;
90.916 + else
90.917 + FullUpdate();
90.918 + }
90.919 +
90.920 + internal bool IsMyNode(TreeNodeAdv node)
90.921 + {
90.922 + if (node == null)
90.923 + return false;
90.924 +
90.925 + if (node.Tree != this)
90.926 + return false;
90.927 +
90.928 + while (node.Parent != null)
90.929 + node = node.Parent;
90.930 +
90.931 + return node == _root;
90.932 + }
90.933 +
90.934 + internal void UpdateSelection()
90.935 + {
90.936 + bool flag = false;
90.937 +
90.938 + if (!IsMyNode(CurrentNode))
90.939 + CurrentNode = null;
90.940 + if (!IsMyNode(_selectionStart))
90.941 + _selectionStart = null;
90.942 +
90.943 + for (int i = Selection.Count - 1; i >= 0; i--)
90.944 + if (!IsMyNode(Selection[i]))
90.945 + {
90.946 + flag = true;
90.947 + Selection.RemoveAt(i);
90.948 + }
90.949 +
90.950 + if (flag)
90.951 + OnSelectionChanged();
90.952 + }
90.953 +
90.954 + internal void ChangeColumnWidth(TreeColumn column)
90.955 + {
90.956 + if (!(_input is ResizeColumnState))
90.957 + {
90.958 + FullUpdate();
90.959 + OnColumnWidthChanged(column);
90.960 + }
90.961 + }
90.962 +
90.963 + public TreeNodeAdv FindNode(TreePath path)
90.964 + {
90.965 + return FindNode(path, false);
90.966 + }
90.967 +
90.968 + public TreeNodeAdv FindNode(TreePath path, bool readChilds)
90.969 + {
90.970 + if (path.IsEmpty())
90.971 + return _root;
90.972 + else
90.973 + return FindNode(_root, path, 0, readChilds);
90.974 + }
90.975 +
90.976 + private TreeNodeAdv FindNode(TreeNodeAdv root, TreePath path, int level, bool readChilds)
90.977 + {
90.978 + if (!root.IsExpandedOnce && readChilds)
90.979 + ReadChilds(root);
90.980 +
90.981 + for (int i = 0; i < root.Nodes.Count; i++)
90.982 + {
90.983 + TreeNodeAdv node = root.Nodes[i];
90.984 + if (node.Tag == path.FullPath[level])
90.985 + {
90.986 + if (level == path.FullPath.Length - 1)
90.987 + return node;
90.988 + else
90.989 + return FindNode(node, path, level + 1, readChilds);
90.990 + }
90.991 + }
90.992 + return null;
90.993 + }
90.994 +
90.995 + public TreeNodeAdv FindNodeByTag(object tag)
90.996 + {
90.997 + return FindNodeByTag(_root, tag);
90.998 + }
90.999 +
90.1000 + private TreeNodeAdv FindNodeByTag(TreeNodeAdv root, object tag)
90.1001 + {
90.1002 + foreach (TreeNodeAdv node in root.Nodes)
90.1003 + {
90.1004 + if (node.Tag == tag)
90.1005 + return node;
90.1006 + TreeNodeAdv res = FindNodeByTag(node, tag);
90.1007 + if (res != null)
90.1008 + return res;
90.1009 + }
90.1010 + return null;
90.1011 + }
90.1012 +
90.1013 + public void SelectAllNodes()
90.1014 + {
90.1015 + SuspendSelectionEvent = true;
90.1016 + try
90.1017 + {
90.1018 + if (SelectionMode == TreeSelectionMode.MultiSameParent)
90.1019 + {
90.1020 + if (CurrentNode != null)
90.1021 + {
90.1022 + foreach (TreeNodeAdv n in CurrentNode.Parent.Nodes)
90.1023 + n.IsSelected = true;
90.1024 + }
90.1025 + }
90.1026 + else if (SelectionMode == TreeSelectionMode.Multi)
90.1027 + {
90.1028 + SelectNodes(Root.Nodes);
90.1029 + }
90.1030 + }
90.1031 + finally
90.1032 + {
90.1033 + SuspendSelectionEvent = false;
90.1034 + }
90.1035 + }
90.1036 +
90.1037 + private void SelectNodes(Collection<TreeNodeAdv> nodes)
90.1038 + {
90.1039 + foreach (TreeNodeAdv n in nodes)
90.1040 + {
90.1041 + n.IsSelected = true;
90.1042 + if (n.IsExpanded)
90.1043 + SelectNodes(n.Nodes);
90.1044 + }
90.1045 + }
90.1046 +
90.1047 + #region ModelEvents
90.1048 + private void BindModelEvents()
90.1049 + {
90.1050 + _model.NodesChanged += new EventHandler<TreeModelEventArgs>(_model_NodesChanged);
90.1051 + _model.NodesInserted += new EventHandler<TreeModelEventArgs>(_model_NodesInserted);
90.1052 + _model.NodesRemoved += new EventHandler<TreeModelEventArgs>(_model_NodesRemoved);
90.1053 + _model.StructureChanged += new EventHandler<TreePathEventArgs>(_model_StructureChanged);
90.1054 + }
90.1055 +
90.1056 + private void UnbindModelEvents()
90.1057 + {
90.1058 + _model.NodesChanged -= new EventHandler<TreeModelEventArgs>(_model_NodesChanged);
90.1059 + _model.NodesInserted -= new EventHandler<TreeModelEventArgs>(_model_NodesInserted);
90.1060 + _model.NodesRemoved -= new EventHandler<TreeModelEventArgs>(_model_NodesRemoved);
90.1061 + _model.StructureChanged -= new EventHandler<TreePathEventArgs>(_model_StructureChanged);
90.1062 + }
90.1063 +
90.1064 + private void _model_StructureChanged(object sender, TreePathEventArgs e)
90.1065 + {
90.1066 + if (e.Path == null)
90.1067 + throw new ArgumentNullException();
90.1068 +
90.1069 + TreeNodeAdv node = FindNode(e.Path);
90.1070 + if (node != null)
90.1071 + {
90.1072 + if (node != Root)
90.1073 + node.IsLeaf = Model.IsLeaf(GetPath(node));
90.1074 +
90.1075 + var list = new Dictionary<object, object>();
90.1076 + SaveExpandedNodes(node, list);
90.1077 + ReadChilds(node);
90.1078 + RestoreExpandedNodes(node, list);
90.1079 +
90.1080 + UpdateSelection();
90.1081 + SmartFullUpdate();
90.1082 + }
90.1083 + //else
90.1084 + // throw new ArgumentException("Path not found");
90.1085 + }
90.1086 +
90.1087 + private void RestoreExpandedNodes(TreeNodeAdv node, Dictionary<object, object> list)
90.1088 + {
90.1089 + if (node.Tag != null && list.ContainsKey(node.Tag))
90.1090 + {
90.1091 + node.IsExpanded = true;
90.1092 + foreach (var child in node.Children)
90.1093 + RestoreExpandedNodes(child, list);
90.1094 + }
90.1095 + }
90.1096 +
90.1097 + private void SaveExpandedNodes(TreeNodeAdv node, Dictionary<object, object> list)
90.1098 + {
90.1099 + if (node.IsExpanded && node.Tag != null)
90.1100 + {
90.1101 + list.Add(node.Tag, null);
90.1102 + foreach (var child in node.Children)
90.1103 + SaveExpandedNodes(child, list);
90.1104 + }
90.1105 + }
90.1106 +
90.1107 + private void _model_NodesRemoved(object sender, TreeModelEventArgs e)
90.1108 + {
90.1109 + TreeNodeAdv parent = FindNode(e.Path);
90.1110 + if (parent != null)
90.1111 + {
90.1112 + if (e.Indices != null)
90.1113 + {
90.1114 + List<int> list = new List<int>(e.Indices);
90.1115 + list.Sort();
90.1116 + for (int n = list.Count - 1; n >= 0; n--)
90.1117 + {
90.1118 + int index = list[n];
90.1119 + if (index >= 0 && index <= parent.Nodes.Count)
90.1120 + parent.Nodes.RemoveAt(index);
90.1121 + else
90.1122 + throw new ArgumentOutOfRangeException("Index out of range");
90.1123 + }
90.1124 + }
90.1125 + else
90.1126 + {
90.1127 + for (int i = parent.Nodes.Count - 1; i >= 0; i--)
90.1128 + {
90.1129 + for (int n = 0; n < e.Children.Length; n++)
90.1130 + if (parent.Nodes[i].Tag == e.Children[n])
90.1131 + {
90.1132 + parent.Nodes.RemoveAt(i);
90.1133 + break;
90.1134 + }
90.1135 + }
90.1136 + }
90.1137 + }
90.1138 + UpdateSelection();
90.1139 + SmartFullUpdate();
90.1140 + }
90.1141 +
90.1142 + private void _model_NodesInserted(object sender, TreeModelEventArgs e)
90.1143 + {
90.1144 + if (e.Indices == null)
90.1145 + throw new ArgumentNullException("Indices");
90.1146 +
90.1147 + TreeNodeAdv parent = FindNode(e.Path);
90.1148 + if (parent != null)
90.1149 + {
90.1150 + for (int i = 0; i < e.Children.Length; i++)
90.1151 + AddNewNode(parent, e.Children[i], e.Indices[i]);
90.1152 + }
90.1153 + SmartFullUpdate();
90.1154 + }
90.1155 +
90.1156 + private void _model_NodesChanged(object sender, TreeModelEventArgs e)
90.1157 + {
90.1158 + TreeNodeAdv parent = FindNode(e.Path);
90.1159 + if (parent != null && parent.IsVisible && parent.IsExpanded)
90.1160 + {
90.1161 + if (InvokeRequired)
90.1162 + BeginInvoke(new UpdateContentWidthDelegate(ClearNodesSize), e, parent);
90.1163 + else
90.1164 + ClearNodesSize(e, parent);
90.1165 + SmartFullUpdate();
90.1166 + }
90.1167 + }
90.1168 +
90.1169 + private delegate void UpdateContentWidthDelegate(TreeModelEventArgs e, TreeNodeAdv parent);
90.1170 + private void ClearNodesSize(TreeModelEventArgs e, TreeNodeAdv parent)
90.1171 + {
90.1172 + if (e.Indices != null)
90.1173 + {
90.1174 + foreach (int index in e.Indices)
90.1175 + {
90.1176 + if (index >= 0 && index < parent.Nodes.Count)
90.1177 + {
90.1178 + TreeNodeAdv node = parent.Nodes[index];
90.1179 + node.Height = node.RightBounds = null;
90.1180 + }
90.1181 + else
90.1182 + throw new ArgumentOutOfRangeException("Index out of range");
90.1183 + }
90.1184 + }
90.1185 + else
90.1186 + {
90.1187 + foreach (TreeNodeAdv node in parent.Nodes)
90.1188 + {
90.1189 + foreach (object obj in e.Children)
90.1190 + if (node.Tag == obj)
90.1191 + {
90.1192 + node.Height = node.RightBounds = null;
90.1193 + }
90.1194 + }
90.1195 + }
90.1196 + }
90.1197 + #endregion
90.1198 + }
90.1199 +}
91.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
91.2 +++ b/External/Aga.Controls/Tree/TreeViewAdv.resx Sun May 27 15:16:19 2012 +0000
91.3 @@ -0,0 +1,132 @@
91.4 +<?xml version="1.0" encoding="utf-8"?>
91.5 +<root>
91.6 + <!--
91.7 + Microsoft ResX Schema
91.8 +
91.9 + Version 2.0
91.10 +
91.11 + The primary goals of this format is to allow a simple XML format
91.12 + that is mostly human readable. The generation and parsing of the
91.13 + various data types are done through the TypeConverter classes
91.14 + associated with the data types.
91.15 +
91.16 + Example:
91.17 +
91.18 + ... ado.net/XML headers & schema ...
91.19 + <resheader name="resmimetype">text/microsoft-resx</resheader>
91.20 + <resheader name="version">2.0</resheader>
91.21 + <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
91.22 + <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
91.23 + <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
91.24 + <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
91.25 + <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
91.26 + <value>[base64 mime encoded serialized .NET Framework object]</value>
91.27 + </data>
91.28 + <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
91.29 + <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
91.30 + <comment>This is a comment</comment>
91.31 + </data>
91.32 +
91.33 + There are any number of "resheader" rows that contain simple
91.34 + name/value pairs.
91.35 +
91.36 + Each data row contains a name, and value. The row also contains a
91.37 + type or mimetype. Type corresponds to a .NET class that support
91.38 + text/value conversion through the TypeConverter architecture.
91.39 + Classes that don't support this are serialized and stored with the
91.40 + mimetype set.
91.41 +
91.42 + The mimetype is used for serialized objects, and tells the
91.43 + ResXResourceReader how to depersist the object. This is currently not
91.44 + extensible. For a given mimetype the value must be set accordingly:
91.45 +
91.46 + Note - application/x-microsoft.net.object.binary.base64 is the format
91.47 + that the ResXResourceWriter will generate, however the reader can
91.48 + read any of the formats listed below.
91.49 +
91.50 + mimetype: application/x-microsoft.net.object.binary.base64
91.51 + value : The object must be serialized with
91.52 + : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
91.53 + : and then encoded with base64 encoding.
91.54 +
91.55 + mimetype: application/x-microsoft.net.object.soap.base64
91.56 + value : The object must be serialized with
91.57 + : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
91.58 + : and then encoded with base64 encoding.
91.59 +
91.60 + mimetype: application/x-microsoft.net.object.bytearray.base64
91.61 + value : The object must be serialized into a byte array
91.62 + : using a System.ComponentModel.TypeConverter
91.63 + : and then encoded with base64 encoding.
91.64 + -->
91.65 + <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
91.66 + <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
91.67 + <xsd:element name="root" msdata:IsDataSet="true">
91.68 + <xsd:complexType>
91.69 + <xsd:choice maxOccurs="unbounded">
91.70 + <xsd:element name="metadata">
91.71 + <xsd:complexType>
91.72 + <xsd:sequence>
91.73 + <xsd:element name="value" type="xsd:string" minOccurs="0" />
91.74 + </xsd:sequence>
91.75 + <xsd:attribute name="name" use="required" type="xsd:string" />
91.76 + <xsd:attribute name="type" type="xsd:string" />
91.77 + <xsd:attribute name="mimetype" type="xsd:string" />
91.78 + <xsd:attribute ref="xml:space" />
91.79 + </xsd:complexType>
91.80 + </xsd:element>
91.81 + <xsd:element name="assembly">
91.82 + <xsd:complexType>
91.83 + <xsd:attribute name="alias" type="xsd:string" />
91.84 + <xsd:attribute name="name" type="xsd:string" />
91.85 + </xsd:complexType>
91.86 + </xsd:element>
91.87 + <xsd:element name="data">
91.88 + <xsd:complexType>
91.89 + <xsd:sequence>
91.90 + <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
91.91 + <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
91.92 + </xsd:sequence>
91.93 + <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
91.94 + <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
91.95 + <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
91.96 + <xsd:attribute ref="xml:space" />
91.97 + </xsd:complexType>
91.98 + </xsd:element>
91.99 + <xsd:element name="resheader">
91.100 + <xsd:complexType>
91.101 + <xsd:sequence>
91.102 + <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
91.103 + </xsd:sequence>
91.104 + <xsd:attribute name="name" type="xsd:string" use="required" />
91.105 + </xsd:complexType>
91.106 + </xsd:element>
91.107 + </xsd:choice>
91.108 + </xsd:complexType>
91.109 + </xsd:element>
91.110 + </xsd:schema>
91.111 + <resheader name="resmimetype">
91.112 + <value>text/microsoft-resx</value>
91.113 + </resheader>
91.114 + <resheader name="version">
91.115 + <value>2.0</value>
91.116 + </resheader>
91.117 + <resheader name="reader">
91.118 + <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
91.119 + </resheader>
91.120 + <resheader name="writer">
91.121 + <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
91.122 + </resheader>
91.123 + <metadata name="_vScrollBar.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
91.124 + <value>127, 17</value>
91.125 + </metadata>
91.126 + <metadata name="_hScrollBar.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
91.127 + <value>17, 17</value>
91.128 + </metadata>
91.129 + <metadata name="_errorProvider.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
91.130 + <value>236, 17</value>
91.131 + </metadata>
91.132 + <metadata name="$this.TrayLargeIcon" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
91.133 + <value>False</value>
91.134 + </metadata>
91.135 +</root>
91.136 \ No newline at end of file
92.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
92.2 +++ b/External/Aga.Controls/Tree/TreeViewAdvCancelEventArgs.cs Sun May 27 15:16:19 2012 +0000
92.3 @@ -0,0 +1,23 @@
92.4 +using System;
92.5 +using System.Collections.Generic;
92.6 +using System.Text;
92.7 +
92.8 +namespace Aga.Controls.Tree
92.9 +{
92.10 + public class TreeViewAdvCancelEventArgs : TreeViewAdvEventArgs
92.11 + {
92.12 + private bool _cancel;
92.13 +
92.14 + public bool Cancel
92.15 + {
92.16 + get { return _cancel; }
92.17 + set { _cancel = value; }
92.18 + }
92.19 +
92.20 + public TreeViewAdvCancelEventArgs(TreeNodeAdv node)
92.21 + : base(node)
92.22 + {
92.23 + }
92.24 +
92.25 + }
92.26 +}
93.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
93.2 +++ b/External/Aga.Controls/Tree/TreeViewAdvEventArgs.cs Sun May 27 15:16:19 2012 +0000
93.3 @@ -0,0 +1,21 @@
93.4 +using System;
93.5 +using System.Collections.Generic;
93.6 +using System.Text;
93.7 +
93.8 +namespace Aga.Controls.Tree
93.9 +{
93.10 + public class TreeViewAdvEventArgs : EventArgs
93.11 + {
93.12 + private TreeNodeAdv _node;
93.13 +
93.14 + public TreeNodeAdv Node
93.15 + {
93.16 + get { return _node; }
93.17 + }
93.18 +
93.19 + public TreeViewAdvEventArgs(TreeNodeAdv node)
93.20 + {
93.21 + _node = node;
93.22 + }
93.23 + }
93.24 +}
94.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
94.2 +++ b/External/Aga.Controls/Tree/TreeViewRowDrawEventArgs.cs Sun May 27 15:16:19 2012 +0000
94.3 @@ -0,0 +1,46 @@
94.4 +using System;
94.5 +using System.Collections.Generic;
94.6 +using System.Text;
94.7 +using System.Windows.Forms;
94.8 +using System.Drawing;
94.9 +
94.10 +namespace Aga.Controls.Tree
94.11 +{
94.12 + public class TreeViewRowDrawEventArgs: PaintEventArgs
94.13 + {
94.14 + TreeNodeAdv _node;
94.15 + DrawContext _context;
94.16 + int _row;
94.17 + Rectangle _rowRect;
94.18 +
94.19 + public TreeViewRowDrawEventArgs(Graphics graphics, Rectangle clipRectangle, TreeNodeAdv node, DrawContext context, int row, Rectangle rowRect)
94.20 + : base(graphics, clipRectangle)
94.21 + {
94.22 + _node = node;
94.23 + _context = context;
94.24 + _row = row;
94.25 + _rowRect = rowRect;
94.26 + }
94.27 +
94.28 + public TreeNodeAdv Node
94.29 + {
94.30 + get { return _node; }
94.31 + }
94.32 +
94.33 + public DrawContext Context
94.34 + {
94.35 + get { return _context; }
94.36 + }
94.37 +
94.38 + public int Row
94.39 + {
94.40 + get { return _row; }
94.41 + }
94.42 +
94.43 + public Rectangle RowRect
94.44 + {
94.45 + get { return _rowRect; }
94.46 + }
94.47 + }
94.48 +
94.49 +}
95.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
95.2 +++ b/External/Aga.Controls/license.txt Sun May 27 15:16:19 2012 +0000
95.3 @@ -0,0 +1,25 @@
95.4 +The BSD License
95.5 +
95.6 +Copyright (c) 2009, Andrey Gliznetsov (a.gliznetsov@gmail.com)
95.7 +
95.8 +All rights reserved.
95.9 +
95.10 +Redistribution and use in source and binary forms, with or without modification, are permitted provided
95.11 +that the following conditions are met
95.12 +
95.13 +- Redistributions of source code must retain the above copyright notice, this list of conditions
95.14 +and the following disclaimer.
95.15 +- Redistributions in binary form must reproduce the above copyright notice, this list of conditions
95.16 +and the following disclaimer in the documentation andor other materials provided with the distribution.
95.17 +
95.18 +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
95.19 +AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
95.20 +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
95.21 +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
95.22 +CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
95.23 +EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
95.24 +PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
95.25 +PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
95.26 +LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
95.27 +NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
95.28 +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
95.29 \ No newline at end of file