Click here to Skip to main content
Click here to Skip to main content
Add your own
alternative version

Storm - the world's best IDE framework for .NET

By , 4 Feb 2010
storm.zip
bin
Storm.Docking.dll
Storm.Plugins.dll
Storm.TabControl.dll
Storm.TextEditor.dll
Storm.Win32.dll
doc
controls
style
src
Storm.Docking
Storm.Docking.suo
Storm.Docking.Test
bin
Debug
Storm.Docking.dll
Storm.Docking.pdb
Storm.Docking.Test.exe
Storm.Docking.Test.pdb
Storm.Docking.Test.vshost.exe
Storm.Docking.Test.vshost.exe.manifest
Storm.TabControl.dll
Storm.TabControl.pdb
Properties
Settings.settings
Storm.Docking
bin
Debug
Storm.Docking.dll
Storm.Docking.pdb
Storm.TabControl.dll
Storm.TabControl.pdb
Controls
Float
Properties
Resources
DockCaption.CloseGlyph.bmp
DockCaption.CloseGlyphInverted.bmp
DockCaption.OptionsGlyph.bmp
DockCaption.OptionsGlyphInverted.bmp
Storm.Docking.csproj.user
Visual
Drawing
Glyphs
Storm.Plugins
Plugin1
bin
Debug
Plugin1.dll
Plugin1.pdb
Storm.Plugins.dll
Storm.Plugins.pdb
Properties
PluginTest
bin
Debug
Plugin1.dll
Plugin1.pdb
PluginTest.exe
PluginTest.pdb
PluginTest.vshost.exe
PluginTest.vshost.exe.manifest
Storm.Plugins.dll
Storm.Plugins.pdb
Properties
Settings.settings
Storm.Plugins.suo
Storm.Plugins
Attributes
bin
Debug
Storm.Plugins.dll
Storm.Plugins.pdb
Classes
Enums
Interfaces
Other
Properties
Resources
error.png
exclamation.png
information.png
plugin.ico
Storm.TabControl
Storm.TabControl.suo
Storm.TabControl
Base
bin
Debug
Storm.TabControl.dll
Storm.TabControl.pdb
Release
Storm.TabControl.dll
Storm.TabControl.pdb
Control
Design
Helpers
Properties
Storm.TabControl.csproj.user
TabStrip.bmp
TabControlTest
bin
Debug
Storm.TabControl.dll
Storm.TabControl.pdb
TabControlTest.exe
TabControlTest.pdb
TabControlTest.vshost.exe
TabControlTest.vshost.exe.manifest
Release
Storm.TabControl.dll
Storm.TabControl.pdb
TabControlTest.exe
TabControlTest.pdb
Properties
Settings.settings
Storm.TextEditor
Storm.TextEditor.suo
Storm.TextEditor.Test
bin
Debug
Storm.TextEditor.dll
Storm.TextEditor.dll.old
Storm.TextEditor.pdb
Storm.TextEditor.Test.exe
Storm.TextEditor.Test.pdb
Storm.TextEditor.Test.vshost.exe
Storm.TextEditor.Test.vshost.exe.manifest
Release
Properties
Settings.settings
Storm.TextEditor.Test.csproj.user
Storm.TextEditor
bin
Debug
Storm.TextEditor.dll
Storm.TextEditor.pdb
Release
Core
Splitting
Drawing
GDI
Editor
CodeCompletion
Exporters
Forms
Interacting
Printing
Text
Undo
Interacting
Keyboard
Scrolling
Languages
CPlusPlus.lang
CSharp.lang
CSS.lang
Html.lang
Jass.lang
JavaScript.lang
MASM.lang
Text.lang
VBNET.lang
vJass.lang
Xml.lang
Zinc.lang
Localization
Parser
Objects
Collections
XML
Properties
Resources
FlippedCursor.cur
MoveDown.cur
MoveUp.cur
MoveUpDown.cur
Storm.TextEditor.csproj.user
Win32
Enums
Structs
Storm.Win32
Storm.Win32.suo
Storm.Win32
bin
Debug
Release
Storm.Win32.dll
Storm.Win32.pdb
Properties
Storm.Win32.csproj.user
storm1_0.zip
res
AutoIt.vsx
cJass.vsx
Cobol.vsx
CPP.vsx
CSharp.vsx
CSS.vsx
cvJass.vsx
DataFlex.vsx
Delphi.vsx
DOSBatch.vsx
Fortran90.vsx
FoxPro.vsx
Gemix.vsx
HTML.vsx
Jass.vsx
Java.vsx
JavaScript.vsx
JSP.vsx
Lang6502.vsx
LotusScript.vsx
MSIL.vsx
MySQL_SQL.vsx
Nemerle.vsx
NPath.vsx
Oracle_SQL.vsx
Perl.vsx
PHP.vsx
PlainText.vsx
Povray.vsx
Python.vsx
Rtf.vsx
SmallTalk.vsx
SqlServer2K.vsx
SqlServer2K5.vsx
SqlServer7.vsx
SystemPolicies.vsx
Template.vsx
TurboPascal.vsx
VB.vsx
VBNET.vsx
VBScript.vsx
vJass.vsx
VRML97.vsx
XML.vsx
Storm.CodeCompletion.dll
Storm.Docking.dll
Storm.Plugins.dll
Storm.TabControl.dll
Storm.TextEditor.dll
Storm.Win32.dll
Storm.CodeCompletion
CodeTestApp
bin
Debug
CodeTestApp.exe
CodeTestApp.vshost.exe
CodeTestApp.vshost.exe.manifest
res
AutoIt.vsx
cJass.vsx
Cobol.vsx
CPP.vsx
CSharp.vsx
CSS.vsx
cvJass.vsx
DataFlex.vsx
Delphi.vsx
DOSBatch.vsx
Fortran90.vsx
FoxPro.vsx
Gemix.vsx
HTML.vsx
Jass.vsx
Java.vsx
JavaScript.vsx
JSP.vsx
Lang6502.vsx
LotusScript.vsx
MSIL.vsx
MySQL_SQL.vsx
Nemerle.vsx
NPath.vsx
Oracle_SQL.vsx
Perl.vsx
PHP.vsx
PlainText.vsx
Povray.vsx
Python.vsx
Rtf.vsx
SmallTalk.vsx
SqlServer2K.vsx
SqlServer2K5.vsx
SqlServer7.vsx
SystemPolicies.vsx
Template.vsx
TurboPascal.vsx
VB.vsx
VBNET.vsx
VBScript.vsx
vJass.vsx
VRML97.vsx
XML.vsx
Storm.CodeCompletion.dll
Storm.TextEditor.dll
Storm.Win32.dll
Release
CodeTestApp.exe
CodeTestApp.vshost.exe
CodeTestApp.vshost.exe.manifest
Storm.CodeCompletion.dll
Storm.TextEditor.dll
Storm.Win32.dll
Properties
licenses.licx
Settings.settings
Resources
Book_angleHS.png
graphhs.png
PropertiesHS.png
Storm.CodeCompletion
bin
Release
Storm.CodeCompletion.dll
Storm.TextEditor.dll
Storm.Win32.dll
Controls
Properties
storm16.bmp
Storm.Docking.dll
Storm.Docking.pdb
Storm.Docking.Test.exe
Storm.Docking.Test.pdb
Storm.Docking.Test.vshost.exe
Storm.Docking.Test.vshost.exe.manifest
Storm.TabControl.dll
Storm.TabControl.pdb
Settings.settings
Storm.Docking.dll
Storm.TabControl.dll
DockCaption.CloseGlyph.bmp
DockCaption.CloseGlyphInverted.bmp
DockCaption.OptionsGlyph.bmp
DockCaption.OptionsGlyphInverted.bmp
Storm.Docking.cd
Storm.Docking.csproj.user
Plugin1.dll
Plugin1.pdb
Storm.Plugins.dll
Storm.Plugins.pdb
Plugin1.dll
PluginTest.exe
PluginTest.vshost.exe
PluginTest.vshost.exe.manifest
Storm.Plugins.dll
Settings.settings
Storm.Plugins.dll
error.png
exclamation.png
information.png
plugin.ico
Storm.TabControl.suo
Storm.TabControl.dll
Storm.TabControl.csproj.user
TabStrip.bmp
Storm.TabControl.dll
TabControlTest.exe
Settings.settings
res
AutoIt.vsx
cJass.vsx
Cobol.vsx
CPP.vsx
CSharp.vsx
CSS.vsx
cvJass.vsx
DataFlex.vsx
Delphi.vsx
DOSBatch.vsx
Fortran90.vsx
FoxPro.vsx
Gemix.vsx
HTML.vsx
Jass.vsx
Java.vsx
JavaScript.vsx
JSP.vsx
Lang6502.vsx
LotusScript.vsx
MSIL.vsx
MySQL_SQL.vsx
Nemerle.vsx
NPath.vsx
Oracle_SQL.vsx
Perl.vsx
PHP.vsx
PlainText.vsx
Povray.vsx
Python.vsx
Rtf.vsx
SmallTalk.vsx
SqlServer2K.vsx
SqlServer2K5.vsx
SqlServer7.vsx
SystemPolicies.vsx
Template.vsx
TurboPascal.vsx
VB.vsx
VBNET.vsx
VBScript.vsx
vJass.vsx
VRML97.vsx
XML.vsx
Storm.TextEditor.dll
Storm.TextEditor.dll
ContentInfo
Controls
Core
Document
Exporters
Forms
Painting
Parsing
Base
Classes
CodeBlock
Language
Preset
Printing
res
AutoIt.vsx
cJass.vsx
Cobol.vsx
CPP.vsx
CSharp.vsx
CSS.vsx
cvJass.vsx
DataFlex.vsx
Delphi.vsx
DOSBatch.vsx
Fortran90.vsx
FoxPro.vsx
Gemix.vsx
HTML.vsx
Jass.vsx
Java.vsx
JavaScript.vsx
JSP.vsx
Lang6502.vsx
LotusScript.vsx
MSIL.vsx
MySQL_SQL.vsx
Nemerle.vsx
NPath.vsx
Oracle_SQL.vsx
Perl.vsx
PHP.vsx
PlainText.vsx
Povray.vsx
Python.vsx
Rtf.vsx
SmallTalk.vsx
SqlServer2K.vsx
SqlServer2K5.vsx
SqlServer7.vsx
SystemPolicies.vsx
Template.vsx
TurboPascal.vsx
VB.vsx
VBNET.vsx
VBScript.vsx
vJass.vsx
VRML97.vsx
XML.vsx
FlippedCursor.cur
MoveDown.cur
MoveUp.cur
MoveUpDown.cur
Storm.TextEditor.csproj.user
storm16.bmp
TextEditor.cd
Utilities
TextEditorTest
bin
Release
res
vJass.vsx
Storm.NotifyBars.dll
Storm.TabControl.dll
Storm.TextEditor.dll
TextEditorTest.exe
TextEditorTest.vshost.exe
TextEditorTest.vshost.exe.manifest
Properties
Settings.settings
TextEditorTest.csproj.user
Storm.Win32.dll
Storm.Win32.csproj.user
//
//    ___ _____ ___  ___ __  __ 
//   / __|_   _/ _ \| _ \  \/  |
//   \__ \ | || (_) |   / |\/| |
//   |___/ |_| \___/|_|_\_|  |_|
// 
//   Storm.TextEditor.dll
//   ��������������������
//     Storm.TabControl.dll was created under the LGPL 
//     license. Some of the code was created from scratch, 
//     some was not. Code not created from scratch was 
//     based on the DotNetFireball framework and evolved 
//     from that. 
//     
//     What I mostly did in this library was that I 
//     cleaned up the code, structured it, documentated 
//     it and added new features. 
//     
//     Although it might not sound like it, it was very
//     hard and took a long (pretty much a shitload)
//     time. Why? Well, this was* some of the crappiest,
//     most unstructured, undocumentated, ugly code I've
//     ever seen. It would actually have taken me less 
//     time to create it from scratch, but I figured that
//     out too late. Figuring out what the code actually
//     did and then documentating it was (mostly) a 
//     day-long process. Well, I hope you enjoy some of
//     my hard work. /rant
//     
//     Of course some/most of it is made from scratch by me.
//     *Yes, was. It isn't now. :) Some of the naming 
//     conventions might still seem a little bit off though.
//
//   What is Storm?
//   ��������������
//     Storm is a set of dynamic link libraries used in 
//     Theodor "Vestras" Storm Kristensen's application 
//     "Moonlite".
//     
//
//   Thanks:
//   �������
//     - The DotNetFireball team for creating and publishing 
//       DotNetFireball which I based some of my code on.
//
//
//   Copyright (c) Theodor "Vestras" Storm Kristensen 2009
//   �����������������������������������������������������
//


namespace Storm.TextEditor.Controls
{
    using System;
    using System.Collections;
    using System.ComponentModel;
    using System.ComponentModel.Design;
    using System.Drawing;
    using System.Drawing.Design;
    using System.Diagnostics;
    using System.Diagnostics.CodeAnalysis;
    using System.Diagnostics.Design;
    using System.Diagnostics.SymbolStore;
    using System.IO;
    using System.Reflection;
    using System.Resources;
    using System.Text;
    using System.Windows.Forms;

    using Storm.TextEditor;
    using Storm.TextEditor.Controls;
    using Storm.TextEditor.Controls.Core;
    using Storm.TextEditor.Controls.Core.Globalization;
    using Storm.TextEditor.Controls.Core.Timers;
    using Storm.TextEditor.Controls.IntelliMouse;
    using Storm.TextEditor.Document;
    using Storm.TextEditor.Document.Exporters;
    using Storm.TextEditor.Forms;
    using Storm.TextEditor.Interacting;
    using Storm.TextEditor.Painting;
    using Storm.TextEditor.Parsing;
    using Storm.TextEditor.Parsing.Base;
    using Storm.TextEditor.Parsing.Classes;
    using Storm.TextEditor.Parsing.Language;
    using Storm.TextEditor.Preset;
    using Storm.TextEditor.Preset.Painting;
    using Storm.TextEditor.Preset.TextDraw;
    using Storm.TextEditor.Printing;
    using Storm.TextEditor.Utilities;
    using Storm.TextEditor.Win32;

    [ToolboxItem(false)]
	public class SplitViewChildControl : Widget
	{
		public SplitViewThumbControl LeftThumb;
		public SplitViewThumbControl TopThumb;

		protected HScrollBar hScroll;
		protected VScrollBar vScroll;
		private Panel Filler;
        
		private Container components = null;

		public SplitViewChildControl()
		{
			InitializeComponent();
            hScroll.VisibleChanged += new EventHandler(Scroll_VisibleChanged);
            vScroll.VisibleChanged += new EventHandler(Scroll_VisibleChanged);

//			Puzzle.Windows.NativeMethods.OpenThemeData (Handle,"EDIT");
//			Puzzle.Windows.NativeMethods.OpenThemeData (vScroll.Handle,"SCROLLBAR");
//			Puzzle.Windows.NativeMethods.OpenThemeData (hScroll.Handle,"SCROLLBAR");
		}

        void Scroll_VisibleChanged(object sender, EventArgs e)
        {
            Filler.Visible = hScroll.Visible || vScroll.Visible;
            LeftThumb.Visible = LeftThumbVisible && hScroll.Visible;
            TopThumb.Visible = TopThumbVisible && vScroll.Visible;
        }

		protected override void Dispose(bool disposing)
		{
			if (disposing)
			{
				if (components != null)
				{
					components.Dispose();
				}
			}
			base.Dispose(disposing);
		}

		#region Component Designer generated code

		private void InitializeComponent()
		{
			System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof (SplitViewChildControl));
			hScroll = new System.Windows.Forms.HScrollBar();
			vScroll = new System.Windows.Forms.VScrollBar();
			Filler = new System.Windows.Forms.Panel();
			TopThumb = new SplitViewThumbControl();
			LeftThumb = new SplitViewThumbControl();


			SuspendLayout();
			// 
			// hScroll
			// 
			hScroll.Location = new System.Drawing.Point(-4, 292);
			hScroll.Name = "hScroll";
			hScroll.Size = new System.Drawing.Size(440, 16);
			hScroll.TabIndex = 0;

			// 
			// vScroll
			// 
			vScroll.Location = new System.Drawing.Point(440, 0);
			vScroll.Maximum = 300;
			vScroll.Minimum = 0;
			vScroll.Name = "vScroll";
			vScroll.Size = new System.Drawing.Size(16, 360);
			vScroll.TabIndex = 1;
			// 
			// Filler
			// 
			Filler.BackColor = System.Drawing.SystemColors.Control;
			Filler.Location = new System.Drawing.Point(64, 260);
			Filler.Name = "Filler";
			Filler.Size = new System.Drawing.Size(20, 20);
			Filler.TabIndex = 3;
			// 
			// TopThumb
			// 
			TopThumb.BackColor = System.Drawing.SystemColors.Control;
			TopThumb.Cursor = System.Windows.Forms.Cursors.HSplit;
			TopThumb.Location = new System.Drawing.Point(101, 17);
			TopThumb.Name = "TopThumb";
			TopThumb.Size = new System.Drawing.Size(16, 8);
			TopThumb.TabIndex = 3;
			TopThumb.Visible = false;
			// 
			// LeftThumb
			// 
			LeftThumb.BackColor = System.Drawing.SystemColors.Control;
			LeftThumb.Cursor = System.Windows.Forms.Cursors.VSplit;
			LeftThumb.Location = new System.Drawing.Point(423, 17);
			LeftThumb.Name = "LeftThumb";
			LeftThumb.Size = new System.Drawing.Size(8, 16);
			LeftThumb.TabIndex = 3;
			LeftThumb.Visible = false;

			// 
			// SplitViewChildControl
			// 
			Controls.AddRange(new System.Windows.Forms.Control[]
				{
					TopThumb,
					LeftThumb,
					Filler,
					vScroll,
					hScroll
				});
			Name = "SplitViewChildControl";
			Size = new System.Drawing.Size(456, 376);
			ResumeLayout(false);

		}

		#endregion

		protected override void OnResize(EventArgs e)
		{
			base.OnResize(e);
			DoResize();
		}


		protected Rectangle ClientArea
		{
			get
			{
				Rectangle r = ClientRectangle;
				r.Width -= vScroll.Width;
				r.Height -= hScroll.Height;
				return r;
			}
		}


		private void DoResize()
		{
			/*try
			{*/
                SuspendLayout();
				if (TopThumb == null)
					return;

				TopThumb.Width = SystemInformation.VerticalScrollBarWidth;
				LeftThumb.Height = SystemInformation.HorizontalScrollBarHeight;
				vScroll.Width = SystemInformation.VerticalScrollBarWidth;
				hScroll.Height = SystemInformation.HorizontalScrollBarHeight;

				if (TopThumbVisible)
				{
					vScroll.Top = TopThumb.Height;
					if (hScroll.Visible)
						vScroll.Height = ClientHeight - hScroll.Height - TopThumb.Height;
					else
						vScroll.Height = ClientHeight - TopThumb.Height;

				}
				else
				{
					if (hScroll.Visible)
						vScroll.Height = ClientHeight - hScroll.Height;
					else
						vScroll.Height = ClientHeight;

					vScroll.Top = 0;
				}

				if (LeftThumbVisible)
				{
					hScroll.Left = LeftThumb.Width;
					if (vScroll.Visible)
						hScroll.Width = ClientWidth - vScroll.Width - LeftThumb.Width;
					else
						hScroll.Width = ClientWidth - LeftThumb.Width;


				}
				else
				{
					if (vScroll.Visible)
						hScroll.Width = ClientWidth - vScroll.Width;
					else
						hScroll.Width = ClientWidth;

					hScroll.Left = 0;
				}


				vScroll.Left = ClientWidth - vScroll.Width;
				hScroll.Top = ClientHeight - hScroll.Height;

				LeftThumb.Left = 0;
				LeftThumb.Top = hScroll.Top;
				TopThumb.Left = vScroll.Left;
				TopThumb.Top = 0;


				Filler.Left = vScroll.Left;
				Filler.Top = hScroll.Top;
				Filler.Width = vScroll.Width;
				Filler.Height = hScroll.Height;
			/*}
			catch
			{
			}*/

                ResumeLayout(false);
		}

		/// <summary>
		/// Gets or Sets if the Left side thumb control is visible or not.
		/// </summary>
		public bool LeftThumbVisible
		{
			get { return LeftThumb.Visible; }
			set
			{
				LeftThumb.Visible = value;
				DoResize();
			}
		}

		/// <summary>
		/// Getd ot Sets if the Top thumb control is visible or not.
		/// </summary>
		public bool TopThumbVisible
		{
			get { return TopThumb.Visible; }
			set
			{
				TopThumb.Visible = value;
				DoResize();
			}
		}

		[Browsable(false)]
		public int VisibleClientHeight
		{
			get
			{
				if (hScroll.Visible)
					return ClientHeight - hScroll.Height;
				else
					return ClientHeight;
			}
		}

		[Browsable(false)]
		public int VisibleClientWidth
		{
			get
			{
				if (hScroll.Visible)
					return ClientWidth - vScroll.Width;
				else
					return ClientWidth;
			}
		}

		#region public property ScrollBars

		private ScrollBars _ScrollBars;

		public ScrollBars ScrollBars
		{
			get { return _ScrollBars; }

			set
			{
				_ScrollBars = value;
				if (ScrollBars == ScrollBars.Both)
				{
					hScroll.Visible = true;
					vScroll.Visible = true;
				}
				if (ScrollBars == ScrollBars.None)
				{
					hScroll.Visible = false;
					vScroll.Visible = false;
				}
				if (ScrollBars == ScrollBars.Horizontal)
				{
					hScroll.Visible = true;
					vScroll.Visible = false;
				}
				if (ScrollBars == ScrollBars.Vertical)
				{
					hScroll.Visible = false;
					vScroll.Visible = true;
				}
				Filler.Visible = hScroll.Visible & vScroll.Visible;

				if (vScroll.Visible && HasThumbs)
				{
					TopThumb.Height = 8;
				}
				else
				{
					TopThumb.Height = 0;
				}
				if (hScroll.Visible && HasThumbs)
				{
					LeftThumb.Width = 8;
				}
				else
				{
					LeftThumb.Width = 0;
				}


				DoResize();
				Refresh();
			}
		}


		private bool HasThumbs;

		public void HideThumbs()
		{
			TopThumb.Height = 0;
			LeftThumb.Width = 0;
			HasThumbs = false;
			DoResize();
		}

		public void ShowThumbs()
		{
			TopThumb.Height = 8;
			LeftThumb.Width = 8;
			HasThumbs = true;
			DoResize();
		}

		#endregion 
	}
}

By viewing downloads associated with this article you agree to the Terms of use and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The GNU Lesser General Public License (LGPLv3)

About the Author


| Advertise | Privacy | Mobile
Web03 | 2.8.140421.2 | Last Updated 4 Feb 2010
Article Copyright 2009 by gone000
Everything else Copyright © CodeProject, 1999-2014
Terms of Use
Layout: fixed | fluid