├── .nuget
├── NuGet.exe
└── NuGet.targets
├── TestApp
├── Resources
│ ├── ItemBig.png
│ ├── ItemHigh.png
│ ├── ItemSmall.png
│ └── ItemWide.png
├── app.config
├── Properties
│ ├── Settings.settings
│ ├── Settings.Designer.cs
│ ├── AssemblyInfo.cs
│ ├── Resources.Designer.cs
│ └── Resources.resx
├── Program.cs
├── TimelineFunctionGraphModel.cs
├── TestApp.csproj
└── DemoForm.resx
├── WinForms
├── EmbeddedResources
│ ├── add.png
│ ├── cross.png
│ ├── arrow_up.png
│ ├── arrow_down.png
│ ├── arrow_left.png
│ ├── arrow_right.png
│ ├── DropDownIcon.png
│ ├── arrow_upleft.png
│ ├── arrow_upright.png
│ ├── NumberGripIcon.png
│ ├── arrow_downleft.png
│ ├── arrow_downright.png
│ ├── ExpandNodeClosedHot.png
│ ├── ExpandNodeOpenedHot.png
│ ├── ExpandNodeClosedNormal.png
│ ├── ExpandNodeClosedPressed.png
│ ├── ExpandNodeOpenedNormal.png
│ ├── ExpandNodeOpenedPressed.png
│ ├── ExpandNodeClosedDisabled.png
│ └── ExpandNodeOpenedDisabled.png
├── packages.config
├── ItemModels
│ ├── MenuItemTypeHint.cs
│ ├── IListModel.cs
│ ├── IMenuModel.cs
│ ├── EventArgs
│ │ ├── ListModelItemsEventArgs.cs
│ │ └── MenuModelItemsEventArgs.cs
│ ├── IMenuModelItem.cs
│ ├── ListModel.cs
│ └── MenuModel.cs
├── TimelineControls
│ ├── TimelineViewRulerMarkWeight.cs
│ ├── Models
│ │ ├── ITimelineTrackModel.cs
│ │ ├── ITimelineGraphModel.cs
│ │ ├── ITimelineGraphTrackModel.cs
│ │ ├── ITimelineModel.cs
│ │ ├── TimelineTrackModel.cs
│ │ ├── TimelineGraphTrackModel.cs
│ │ ├── TimelineModel.cs
│ │ └── TimelineLinearGraphModel.cs
│ ├── TimelineViewRulerMark.cs
│ ├── EventArgs
│ │ ├── TimelineViewEventArgs.cs
│ │ ├── TimelineGraphEventArgs.cs
│ │ ├── TimelineTrackModelEventArgs.cs
│ │ ├── TimelineViewTrackEventArgs.cs
│ │ ├── TimelineGraphCollectionEventArgs.cs
│ │ ├── TimelineGraphModelChangedEventArgs.cs
│ │ ├── TimelineTrackModelCollectionEventArgs.cs
│ │ ├── TimelineTrackModelChangedEventArgs.cs
│ │ ├── TimelineGraphRangeEventArgs.cs
│ │ ├── TimelineViewPaintEventArgs.cs
│ │ ├── TimelineViewCursorEventArgs.cs
│ │ ├── TimelineViewSelectionEventArgs.cs
│ │ └── TimelineViewTrackPaintEventArgs.cs
│ ├── TimelineViewControlRenderer.cs
│ ├── TimelineModelViewAssignmentAttribute.cs
│ └── TimelineViewTrack.cs
├── Drawing
│ ├── BorderState.cs
│ ├── TextBoxStyle.cs
│ ├── ButtonState.cs
│ ├── BorderStyle.cs
│ ├── QualityLevel.cs
│ ├── TextBoxState.cs
│ ├── ExpandNodeState.cs
│ ├── ExpandBoxState.cs
│ ├── CheckBoxState.cs
│ └── IconImage.cs
├── Internal
│ ├── ExtMethodsMessage.cs
│ ├── NativeWinAPI.cs
│ ├── ExtMethodsColor.cs
│ └── ReflectionHelper.cs
├── ItemViews
│ ├── EventArgs
│ │ ├── TiledViewEventArgs.cs
│ │ ├── MenuStripMenuViewEventArgs.cs
│ │ ├── TiledViewItemEventArgs.cs
│ │ ├── MenuStripMenuViewItemEventArgs.cs
│ │ ├── TiledViewItemAppearanceEventArgs.cs
│ │ ├── TiledViewItemMouseEventArgs.cs
│ │ └── TiledViewItemDrawEventArgs.cs
│ ├── ITiledViewItemEditor.cs
│ └── TiledViewTextItemEditor.cs
├── PropertyEditing
│ ├── BitmaskItem.cs
│ ├── ObjectItem.cs
│ ├── PropertyEditors
│ │ ├── FlaggedEnumPropertyEditor.cs
│ │ ├── LabelPropertyEditor.cs
│ │ ├── StringPropertyEditor.cs
│ │ ├── ObjectSelectorPropertyEditor.cs
│ │ ├── BitmaskPropertyEditor.cs
│ │ ├── EnumPropertyEditor.cs
│ │ └── BoolPropertyEditor.cs
│ └── EditorTemplates
│ │ ├── ComboBoxDropDown.cs
│ │ ├── MultiComboBoxDropDown.cs
│ │ ├── EditorTemplate.cs
│ │ ├── BitmaskSelectorDropDown.cs
│ │ ├── MultiComboBoxEditorTemplate.cs
│ │ ├── BitmaskEditorTemplate.cs
│ │ └── ComboBoxEditorTemplate.cs
├── AdamsLair.WinForms.nuspec
├── Properties
│ ├── AssemblyInfo.cs
│ └── ResourcesCache.cs
└── ColorControls
│ ├── ColorShowBox.cs
│ └── ColorPickerDialog.resx
├── README.md
├── Publish NuGet Package.bat
├── LICENSE
├── AdamsLair.WinForms.sln
└── .gitignore
/.nuget/NuGet.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AdamsLair/winforms/HEAD/.nuget/NuGet.exe
--------------------------------------------------------------------------------
/TestApp/Resources/ItemBig.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AdamsLair/winforms/HEAD/TestApp/Resources/ItemBig.png
--------------------------------------------------------------------------------
/TestApp/Resources/ItemHigh.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AdamsLair/winforms/HEAD/TestApp/Resources/ItemHigh.png
--------------------------------------------------------------------------------
/TestApp/Resources/ItemSmall.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AdamsLair/winforms/HEAD/TestApp/Resources/ItemSmall.png
--------------------------------------------------------------------------------
/TestApp/Resources/ItemWide.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AdamsLair/winforms/HEAD/TestApp/Resources/ItemWide.png
--------------------------------------------------------------------------------
/WinForms/EmbeddedResources/add.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AdamsLair/winforms/HEAD/WinForms/EmbeddedResources/add.png
--------------------------------------------------------------------------------
/WinForms/EmbeddedResources/cross.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AdamsLair/winforms/HEAD/WinForms/EmbeddedResources/cross.png
--------------------------------------------------------------------------------
/WinForms/EmbeddedResources/arrow_up.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AdamsLair/winforms/HEAD/WinForms/EmbeddedResources/arrow_up.png
--------------------------------------------------------------------------------
/WinForms/EmbeddedResources/arrow_down.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AdamsLair/winforms/HEAD/WinForms/EmbeddedResources/arrow_down.png
--------------------------------------------------------------------------------
/WinForms/EmbeddedResources/arrow_left.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AdamsLair/winforms/HEAD/WinForms/EmbeddedResources/arrow_left.png
--------------------------------------------------------------------------------
/WinForms/EmbeddedResources/arrow_right.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AdamsLair/winforms/HEAD/WinForms/EmbeddedResources/arrow_right.png
--------------------------------------------------------------------------------
/WinForms/EmbeddedResources/DropDownIcon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AdamsLair/winforms/HEAD/WinForms/EmbeddedResources/DropDownIcon.png
--------------------------------------------------------------------------------
/WinForms/EmbeddedResources/arrow_upleft.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AdamsLair/winforms/HEAD/WinForms/EmbeddedResources/arrow_upleft.png
--------------------------------------------------------------------------------
/WinForms/EmbeddedResources/arrow_upright.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AdamsLair/winforms/HEAD/WinForms/EmbeddedResources/arrow_upright.png
--------------------------------------------------------------------------------
/WinForms/EmbeddedResources/NumberGripIcon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AdamsLair/winforms/HEAD/WinForms/EmbeddedResources/NumberGripIcon.png
--------------------------------------------------------------------------------
/WinForms/EmbeddedResources/arrow_downleft.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AdamsLair/winforms/HEAD/WinForms/EmbeddedResources/arrow_downleft.png
--------------------------------------------------------------------------------
/WinForms/EmbeddedResources/arrow_downright.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AdamsLair/winforms/HEAD/WinForms/EmbeddedResources/arrow_downright.png
--------------------------------------------------------------------------------
/WinForms/EmbeddedResources/ExpandNodeClosedHot.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AdamsLair/winforms/HEAD/WinForms/EmbeddedResources/ExpandNodeClosedHot.png
--------------------------------------------------------------------------------
/WinForms/EmbeddedResources/ExpandNodeOpenedHot.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AdamsLair/winforms/HEAD/WinForms/EmbeddedResources/ExpandNodeOpenedHot.png
--------------------------------------------------------------------------------
/WinForms/EmbeddedResources/ExpandNodeClosedNormal.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AdamsLair/winforms/HEAD/WinForms/EmbeddedResources/ExpandNodeClosedNormal.png
--------------------------------------------------------------------------------
/WinForms/EmbeddedResources/ExpandNodeClosedPressed.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AdamsLair/winforms/HEAD/WinForms/EmbeddedResources/ExpandNodeClosedPressed.png
--------------------------------------------------------------------------------
/WinForms/EmbeddedResources/ExpandNodeOpenedNormal.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AdamsLair/winforms/HEAD/WinForms/EmbeddedResources/ExpandNodeOpenedNormal.png
--------------------------------------------------------------------------------
/WinForms/EmbeddedResources/ExpandNodeOpenedPressed.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AdamsLair/winforms/HEAD/WinForms/EmbeddedResources/ExpandNodeOpenedPressed.png
--------------------------------------------------------------------------------
/WinForms/EmbeddedResources/ExpandNodeClosedDisabled.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AdamsLair/winforms/HEAD/WinForms/EmbeddedResources/ExpandNodeClosedDisabled.png
--------------------------------------------------------------------------------
/WinForms/EmbeddedResources/ExpandNodeOpenedDisabled.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AdamsLair/winforms/HEAD/WinForms/EmbeddedResources/ExpandNodeOpenedDisabled.png
--------------------------------------------------------------------------------
/TestApp/app.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/WinForms/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/WinForms/ItemModels/MenuItemTypeHint.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace AdamsLair.WinForms.ItemModels
7 | {
8 | public enum MenuItemTypeHint
9 | {
10 | Item,
11 | Separator
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/TestApp/Properties/Settings.settings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/WinForms/TimelineControls/TimelineViewRulerMarkWeight.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 |
5 |
6 | namespace AdamsLair.WinForms.TimelineControls
7 | {
8 | public enum TimelineViewRulerMarkWeight
9 | {
10 | Minor,
11 | Regular,
12 | Major
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/WinForms/Drawing/BorderState.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Drawing;
5 | using System.Drawing.Drawing2D;
6 | using System.Windows.Forms;
7 |
8 | using AdamsLair.WinForms.Properties;
9 |
10 | namespace AdamsLair.WinForms.Drawing
11 | {
12 | public enum BorderState
13 | {
14 | Normal,
15 | Disabled
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/WinForms/Drawing/TextBoxStyle.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Drawing;
5 | using System.Drawing.Drawing2D;
6 | using System.Windows.Forms;
7 |
8 | using AdamsLair.WinForms.Properties;
9 |
10 | namespace AdamsLair.WinForms.Drawing
11 | {
12 | public enum TextBoxStyle
13 | {
14 | Plain,
15 | Flat,
16 | Sunken
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/WinForms/Drawing/ButtonState.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Drawing;
5 | using System.Drawing.Drawing2D;
6 | using System.Windows.Forms;
7 |
8 | using AdamsLair.WinForms.Properties;
9 |
10 | namespace AdamsLair.WinForms.Drawing
11 | {
12 | public enum ButtonState
13 | {
14 | Disabled,
15 | Normal,
16 | Hot,
17 | Pressed
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/WinForms/Drawing/BorderStyle.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Drawing;
5 | using System.Drawing.Drawing2D;
6 | using System.Windows.Forms;
7 |
8 | using AdamsLair.WinForms.Properties;
9 |
10 | namespace AdamsLair.WinForms.Drawing
11 | {
12 | public enum BorderStyle
13 | {
14 | Simple,
15 | Focus,
16 | ContentBox,
17 | Sunken
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/WinForms/TimelineControls/Models/ITimelineTrackModel.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace AdamsLair.WinForms.TimelineControls
7 | {
8 | public interface ITimelineTrackModel
9 | {
10 | string TrackName { get; }
11 | float EndTime { get; }
12 | float BeginTime { get; }
13 |
14 | event EventHandler TrackNameChanged;
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/WinForms/Drawing/QualityLevel.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace AdamsLair.WinForms.Drawing
7 | {
8 | ///
9 | /// Represents the level of drawing quality. It is guaranteed that higher levels also have higher numeric values.
10 | ///
11 | public enum QualityLevel
12 | {
13 | Low = 0,
14 | Medium = 1,
15 | High = 2
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/WinForms/Internal/ExtMethodsMessage.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Windows.Forms;
6 |
7 | using AdamsLair.WinForms.NativeWinAPI;
8 |
9 | namespace AdamsLair.WinForms
10 | {
11 | internal static class ExtMethodsMessage
12 | {
13 | public static WindowMessage GetWindowMessage(this Message msg)
14 | {
15 | return (WindowMessage)msg.Msg;
16 | }
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/WinForms/ItemModels/IListModel.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace AdamsLair.WinForms.ItemModels
7 | {
8 | public interface IListModel
9 | {
10 | int Count { get; }
11 | object GetItemAt(int index);
12 | int GetIndexOf(object item);
13 |
14 | event EventHandler CountChanged;
15 | event EventHandler IndicesChanged;
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/WinForms/ItemViews/EventArgs/TiledViewEventArgs.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace AdamsLair.WinForms.ItemViews
7 | {
8 | public class TiledViewEventArgs : EventArgs
9 | {
10 | private TiledView view;
11 | public TiledView View
12 | {
13 | get { return this.view; }
14 | }
15 | public TiledViewEventArgs(TiledView view)
16 | {
17 | this.view = view;
18 | }
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/WinForms/Drawing/TextBoxState.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Drawing;
5 | using System.Drawing.Drawing2D;
6 | using System.Windows.Forms;
7 |
8 | using AdamsLair.WinForms.Properties;
9 |
10 | namespace AdamsLair.WinForms.Drawing
11 | {
12 | [Flags]
13 | public enum TextBoxState
14 | {
15 | Disabled = 0x1,
16 | Normal = 0x2,
17 | Hot = 0x4,
18 | Focus = 0x8,
19 |
20 | ReadOnlyFlag = 0x100
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/WinForms/ItemModels/IMenuModel.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace AdamsLair.WinForms.ItemModels
7 | {
8 | public interface IMenuModel
9 | {
10 | IEnumerable Items { get; }
11 |
12 | event EventHandler ItemsAdded;
13 | event EventHandler ItemsRemoved;
14 | event EventHandler ItemsChanged;
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/WinForms/Drawing/ExpandNodeState.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Drawing;
5 | using System.Drawing.Drawing2D;
6 | using System.Windows.Forms;
7 |
8 | using AdamsLair.WinForms.Properties;
9 |
10 | namespace AdamsLair.WinForms.Drawing
11 | {
12 | public enum ExpandNodeState
13 | {
14 | OpenedDisabled,
15 | OpenedNormal,
16 | OpenedHot,
17 | OpenedPressed,
18 | ClosedDisabled,
19 | ClosedNormal,
20 | ClosedHot,
21 | ClosedPressed
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/TestApp/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Windows.Forms;
5 |
6 | namespace AdamsLair.WinForms.TestApp
7 | {
8 | static class Program
9 | {
10 | ///
11 | /// Der Haupteinstiegspunkt für die Anwendung.
12 | ///
13 | [STAThread]
14 | static void Main()
15 | {
16 | Application.EnableVisualStyles();
17 | Application.SetCompatibleTextRenderingDefault(false);
18 | Application.Run(new DemoForm());
19 | }
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/WinForms/Drawing/ExpandBoxState.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Drawing;
5 | using System.Drawing.Drawing2D;
6 | using System.Windows.Forms;
7 |
8 | using AdamsLair.WinForms.Properties;
9 |
10 | namespace AdamsLair.WinForms.Drawing
11 | {
12 | public enum ExpandBoxState
13 | {
14 | ExpandDisabled,
15 | ExpandPressed,
16 | ExpandHot,
17 | ExpandNormal,
18 |
19 | CollapseDisabled,
20 | CollapsePressed,
21 | CollapseHot,
22 | CollapseNormal
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/WinForms/TimelineControls/Models/ITimelineGraphModel.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace AdamsLair.WinForms.TimelineControls
7 | {
8 | public interface ITimelineGraphModel
9 | {
10 | float EndTime { get; }
11 | float BeginTime { get; }
12 |
13 | float GetValueAtX(float units);
14 | float GetMaxValueInRange(float begin, float end);
15 | float GetMinValueInRange(float begin, float end);
16 |
17 | event EventHandler GraphChanged;
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/WinForms/ItemViews/EventArgs/MenuStripMenuViewEventArgs.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Windows.Forms;
6 |
7 | namespace AdamsLair.WinForms.ItemViews
8 | {
9 | public class MenuStripMenuViewEventArgs : EventArgs
10 | {
11 | private MenuStripMenuView view = null;
12 |
13 | public MenuStripMenuView View
14 | {
15 | get { return this.view; }
16 | }
17 |
18 | public MenuStripMenuViewEventArgs(MenuStripMenuView view)
19 | {
20 | this.view = view;
21 | }
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/WinForms/TimelineControls/Models/ITimelineGraphTrackModel.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace AdamsLair.WinForms.TimelineControls
7 | {
8 | public interface ITimelineGraphTrackModel : ITimelineTrackModel
9 | {
10 | IEnumerable Graphs { get; }
11 |
12 | event EventHandler GraphsAdded;
13 | event EventHandler GraphsRemoved;
14 | event EventHandler GraphChanged;
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/WinForms/TimelineControls/TimelineViewRulerMark.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 |
5 |
6 | namespace AdamsLair.WinForms.TimelineControls
7 | {
8 | public struct TimelineViewRulerMark
9 | {
10 | public float UnitValue;
11 | public float PixelValue;
12 | public TimelineViewRulerMarkWeight Weight;
13 |
14 | public TimelineViewRulerMark(float units, float pixels, TimelineViewRulerMarkWeight weight)
15 | {
16 | this.UnitValue = units;
17 | this.PixelValue = pixels;
18 | this.Weight = weight;
19 | }
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/WinForms/TimelineControls/EventArgs/TimelineViewEventArgs.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Drawing;
6 |
7 | using AdamsLair.WinForms.Drawing;
8 |
9 | namespace AdamsLair.WinForms.TimelineControls
10 | {
11 | public class TimelineViewEventArgs : EventArgs
12 | {
13 | private TimelineView view = null;
14 |
15 | public TimelineView View
16 | {
17 | get { return this.view; }
18 | }
19 |
20 | public TimelineViewEventArgs(TimelineView view)
21 | {
22 | this.view = view;
23 | }
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/WinForms/TimelineControls/EventArgs/TimelineGraphEventArgs.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Drawing;
6 |
7 | using AdamsLair.WinForms.Drawing;
8 |
9 | namespace AdamsLair.WinForms.TimelineControls
10 | {
11 | public class TimelineGraphEventArgs : EventArgs
12 | {
13 | private ITimelineGraphModel graph;
14 | public ITimelineGraphModel Graph
15 | {
16 | get { return this.graph; }
17 | }
18 | public TimelineGraphEventArgs(ITimelineGraphModel graph)
19 | {
20 | this.graph = graph;
21 | }
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/WinForms/Drawing/CheckBoxState.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Drawing;
5 | using System.Drawing.Drawing2D;
6 | using System.Windows.Forms;
7 |
8 | using AdamsLair.WinForms.Properties;
9 |
10 | namespace AdamsLair.WinForms.Drawing
11 | {
12 | public enum CheckBoxState
13 | {
14 | CheckedDisabled,
15 | CheckedPressed,
16 | CheckedHot,
17 | CheckedNormal,
18 |
19 | UncheckedDisabled,
20 | UncheckedPressed,
21 | UncheckedHot,
22 | UncheckedNormal,
23 |
24 | MixedDisabled,
25 | MixedPressed,
26 | MixedHot,
27 | MixedNormal
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/WinForms/TimelineControls/EventArgs/TimelineTrackModelEventArgs.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Drawing;
6 |
7 | using AdamsLair.WinForms.Drawing;
8 |
9 | namespace AdamsLair.WinForms.TimelineControls
10 | {
11 | public class TimelineTrackModelEventArgs : EventArgs
12 | {
13 | private ITimelineTrackModel model = null;
14 | public ITimelineTrackModel Model
15 | {
16 | get { return this.model; }
17 | }
18 | public TimelineTrackModelEventArgs(ITimelineTrackModel model)
19 | {
20 | this.model = model;
21 | }
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/WinForms/TimelineControls/Models/ITimelineModel.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace AdamsLair.WinForms.TimelineControls
7 | {
8 | public interface ITimelineModel
9 | {
10 | string UnitName { get; }
11 | string UnitDescription { get; }
12 | float UnitBaseScale { get; }
13 | IEnumerable Tracks { get; }
14 |
15 | event EventHandler UnitChanged;
16 | event EventHandler TracksAdded;
17 | event EventHandler TracksRemoved;
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/WinForms/TimelineControls/EventArgs/TimelineViewTrackEventArgs.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Drawing;
6 |
7 | using AdamsLair.WinForms.Drawing;
8 |
9 | namespace AdamsLair.WinForms.TimelineControls
10 | {
11 | public class TimelineViewTrackEventArgs : TimelineViewEventArgs
12 | {
13 | private TimelineViewTrack track = null;
14 |
15 | public TimelineViewTrack Track
16 | {
17 | get { return this.track; }
18 | }
19 |
20 | public TimelineViewTrackEventArgs(TimelineViewTrack track) : base(track.ParentView)
21 | {
22 | this.track = track;
23 | }
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/WinForms/ItemViews/ITiledViewItemEditor.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.ComponentModel;
3 | using System.Collections;
4 | using System.Collections.Generic;
5 | using System.Linq;
6 | using System.Text;
7 | using System.Windows.Forms;
8 | using System.Drawing;
9 |
10 | using AdamsLair.WinForms.Drawing;
11 | using AdamsLair.WinForms.ItemModels;
12 |
13 | namespace AdamsLair.WinForms.ItemViews
14 | {
15 | public interface ITiledViewItemEditor
16 | {
17 | event EventHandler StopEditing;
18 |
19 | bool IsAcceptingValue { get; }
20 | Control MainControl { get; }
21 |
22 | void GetValueFromItem(object item);
23 | bool ApplyValueToItem(object item);
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/WinForms/TimelineControls/EventArgs/TimelineGraphCollectionEventArgs.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Drawing;
6 |
7 | using AdamsLair.WinForms.Drawing;
8 |
9 | namespace AdamsLair.WinForms.TimelineControls
10 | {
11 | public class TimelineGraphCollectionEventArgs : EventArgs
12 | {
13 | private ITimelineGraphModel[] graphs;
14 | public IEnumerable Graphs
15 | {
16 | get { return this.graphs; }
17 | }
18 | public TimelineGraphCollectionEventArgs(IEnumerable graphs)
19 | {
20 | this.graphs = graphs.ToArray();
21 | }
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | AdamsLair.WinForms
2 | ==================
3 |
4 | A collection of custom Controls for Windows.Forms. These include:
5 |
6 | * A custom **ColorPicker** Dialog, similar to the one known from software like Photoshop, but also supporting alpha values.
7 | * A custom **PropertyGrid** Control, aimed to be highly extensible.
8 | * **TiledView**, a model / view based Control to display large amounts of items in a tiled grid.
9 | * A **model / view** separated representation of **MenuStrips** that can be used to display the same menu structure in MenuStrips, ContextMenus or submenus and react to events caused by it. Can easily be extended to include Tool- and StatusStrips as well.
10 |
--------------------------------------------------------------------------------
/WinForms/PropertyEditing/BitmaskItem.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace AdamsLair.WinForms.PropertyEditing
7 | {
8 | public class BitmaskItem
9 | {
10 | private ulong value = 0;
11 | private string caption = null;
12 |
13 | public string Caption
14 | {
15 | get { return this.caption; }
16 | }
17 | public ulong Value
18 | {
19 | get { return this.value; }
20 | }
21 |
22 | public BitmaskItem(ulong v, string c)
23 | {
24 | this.value = v;
25 | this.caption = c;
26 | }
27 |
28 | public override string ToString()
29 | {
30 | return this.caption;
31 | }
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/WinForms/PropertyEditing/ObjectItem.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace AdamsLair.WinForms.PropertyEditing
7 | {
8 | public class ObjectItem
9 | {
10 | private object value = null;
11 | private string caption = null;
12 |
13 | public string Caption
14 | {
15 | get { return this.caption; }
16 | }
17 | public object Value
18 | {
19 | get { return this.value; }
20 | }
21 |
22 | public ObjectItem(object v, string c)
23 | {
24 | this.value = v;
25 | this.caption = c;
26 | }
27 |
28 | public override string ToString()
29 | {
30 | return this.caption;
31 | }
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/WinForms/TimelineControls/EventArgs/TimelineGraphModelChangedEventArgs.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Drawing;
6 |
7 | using AdamsLair.WinForms.Drawing;
8 |
9 | namespace AdamsLair.WinForms.TimelineControls
10 | {
11 | public class TimelineGraphChangedEventArgs : TimelineGraphEventArgs
12 | {
13 | private ITimelineGraphModel oldGraph = null;
14 | public ITimelineGraphModel OldGraph
15 | {
16 | get { return this.oldGraph; }
17 | }
18 | public TimelineGraphChangedEventArgs(ITimelineGraphModel oldGraph, ITimelineGraphModel graph) : base(graph)
19 | {
20 | this.oldGraph = oldGraph;
21 | }
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/WinForms/TimelineControls/EventArgs/TimelineTrackModelCollectionEventArgs.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Drawing;
6 |
7 | using AdamsLair.WinForms.Drawing;
8 |
9 | namespace AdamsLair.WinForms.TimelineControls
10 | {
11 | public class TimelineTrackModelCollectionEventArgs : EventArgs
12 | {
13 | private ITimelineTrackModel[] tracks = null;
14 |
15 | public IEnumerable Tracks
16 | {
17 | get { return this.tracks; }
18 | }
19 |
20 | public TimelineTrackModelCollectionEventArgs(IEnumerable tracks)
21 | {
22 | this.tracks = tracks.ToArray();
23 | }
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/Publish NuGet Package.bat:
--------------------------------------------------------------------------------
1 | :: search for msbuild make it available
2 | set msbuildPath=%ProgramFiles(x86)%\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin\
3 | set PATH=%PATH%;%msbuildPath%
4 |
5 | :: make sure we have a clean release build
6 | msbuild /t:Rebuild /p:Configuration=Release /p:Platform="Any CPU" AdamsLair.WinForms.sln
7 |
8 | :: remove any existing nupkg files
9 | del *.nupkg
10 |
11 | :: build the nuget packages
12 | .nuget\nuget pack WinForms\AdamsLair.WinForms.csproj -Properties Configuration=Release;Platform=AnyCPU
13 |
14 | :: upload the nuget packages
15 | .nuget\nuget push *.nupkg -Source "https://www.nuget.org"
16 |
17 | :: remove nupkg files after uploading them
18 | del *.nupkg
19 |
--------------------------------------------------------------------------------
/WinForms/TimelineControls/EventArgs/TimelineTrackModelChangedEventArgs.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Drawing;
6 |
7 | using AdamsLair.WinForms.Drawing;
8 |
9 | namespace AdamsLair.WinForms.TimelineControls
10 | {
11 | public class TimelineTrackModelChangedEventArgs : TimelineTrackModelEventArgs
12 | {
13 | private ITimelineTrackModel oldModel = null;
14 | public ITimelineTrackModel OldModel
15 | {
16 | get { return this.oldModel; }
17 | }
18 | public TimelineTrackModelChangedEventArgs(ITimelineTrackModel oldModel, ITimelineTrackModel model) : base(model)
19 | {
20 | this.oldModel = oldModel;
21 | }
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/WinForms/TimelineControls/TimelineViewControlRenderer.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Drawing;
5 | using System.Drawing.Drawing2D;
6 |
7 | using AdamsLair.WinForms.Drawing;
8 |
9 | namespace AdamsLair.WinForms.TimelineControls
10 | {
11 | public class TimelineViewControlRenderer : ControlRenderer
12 | {
13 | public Color ColorRulerMarkMajor
14 | {
15 | get { return this.ColorVeryDarkBackground; }
16 | }
17 | public Color ColorRulerMarkRegular
18 | {
19 | get { return Color.FromArgb(162, this.ColorVeryDarkBackground); }
20 | }
21 | public Color ColorRulerMarkMinor
22 | {
23 | get { return Color.FromArgb(96, this.ColorVeryDarkBackground); }
24 | }
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/WinForms/ItemModels/EventArgs/ListModelItemsEventArgs.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace AdamsLair.WinForms.ItemModels
7 | {
8 | public class ListModelItemsEventArgs : EventArgs
9 | {
10 | private int index;
11 | private int count;
12 |
13 | public int Index
14 | {
15 | get { return this.index; }
16 | }
17 | public int Count
18 | {
19 | get { return this.count; }
20 | }
21 |
22 | public ListModelItemsEventArgs(int index, int count)
23 | {
24 | if (index < 0) throw new ArgumentException("Index needs to be > 0.");
25 | if (count < 1) throw new ArgumentException("Count needs to be >= 1.");
26 | this.index = index;
27 | this.count = count;
28 | }
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/WinForms/TimelineControls/TimelineModelViewAssignmentAttribute.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace AdamsLair.WinForms.TimelineControls
7 | {
8 | [AttributeUsage(AttributeTargets.Class, AllowMultiple = false, Inherited = true)]
9 | public class TimelineModelViewAssignmentAttribute : Attribute
10 | {
11 | private Type[] validModelTypes;
12 | public Type[] ValidModelTypes
13 | {
14 | get { return this.validModelTypes; }
15 | }
16 | public TimelineModelViewAssignmentAttribute(params Type[] validModelTypes)
17 | {
18 | this.validModelTypes = validModelTypes.Where(t => t != null && (typeof(ITimelineTrackModel).IsAssignableFrom(t) || typeof(ITimelineGraphModel).IsAssignableFrom(t))).ToArray();
19 | }
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/WinForms/TimelineControls/Models/TimelineTrackModel.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace AdamsLair.WinForms.TimelineControls
7 | {
8 | public abstract class TimelineTrackModel : ITimelineTrackModel
9 | {
10 | private string trackName = "A Timeline Track";
11 |
12 | public string TrackName
13 | {
14 | get { return this.trackName; }
15 | set
16 | {
17 | if (this.trackName != value)
18 | {
19 | this.trackName = value;
20 | if (this.TrackNameChanged != null)
21 | this.TrackNameChanged(this, EventArgs.Empty);
22 | }
23 | }
24 | }
25 | public abstract float EndTime { get; }
26 | public abstract float BeginTime { get; }
27 |
28 | public event EventHandler TrackNameChanged;
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/WinForms/TimelineControls/EventArgs/TimelineGraphRangeEventArgs.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Drawing;
6 |
7 | using AdamsLair.WinForms.Drawing;
8 |
9 | namespace AdamsLair.WinForms.TimelineControls
10 | {
11 | public class TimelineGraphRangeEventArgs : TimelineGraphEventArgs
12 | {
13 | private float beginTime;
14 | private float endTime;
15 |
16 | public float BeginTime
17 | {
18 | get { return this.beginTime; }
19 | }
20 | public float EndTime
21 | {
22 | get { return this.endTime; }
23 | }
24 |
25 | public TimelineGraphRangeEventArgs(ITimelineGraphModel graph, float beginTime, float endTime) : base(graph)
26 | {
27 | this.beginTime = beginTime;
28 | this.endTime = endTime;
29 | }
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/WinForms/ItemModels/IMenuModelItem.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Drawing;
6 | using System.Windows.Forms;
7 | using System.Diagnostics;
8 |
9 | namespace AdamsLair.WinForms.ItemModels
10 | {
11 | public interface IMenuModelItem
12 | {
13 | string FullName { get; }
14 | string Name { get; }
15 | Image Icon { get; }
16 | int SortValue { get; }
17 | object Tag { get; }
18 | Keys ShortcutKeys { get; }
19 | bool Visible { get; }
20 | bool Enabled { get; }
21 | bool Checkable { get; }
22 | bool Checked { get; set; }
23 | MenuItemTypeHint TypeHint { get; }
24 | IMenuModelItem Parent { get; }
25 | IEnumerable Items { get; }
26 | IMenuModel Model { get; }
27 |
28 | void RaisePerformAction();
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/WinForms/ItemViews/EventArgs/TiledViewItemEventArgs.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Drawing;
6 |
7 | using AdamsLair.WinForms.Drawing;
8 |
9 | namespace AdamsLair.WinForms.ItemViews
10 | {
11 | public class TiledViewItemEventArgs : TiledViewEventArgs
12 | {
13 | private int modelIndex;
14 | private object item;
15 |
16 | public int ModelIndex
17 | {
18 | get { return this.modelIndex; }
19 | internal set { this.modelIndex = value; }
20 | }
21 | public object Item
22 | {
23 | get { return this.item; }
24 | internal set { this.item = value; }
25 | }
26 |
27 | public TiledViewItemEventArgs(TiledView view, int modelIndex, object item) : base(view)
28 | {
29 | this.modelIndex = modelIndex;
30 | this.item = item;
31 | }
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/WinForms/ItemModels/EventArgs/MenuModelItemsEventArgs.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace AdamsLair.WinForms.ItemModels
7 | {
8 | public class MenuModelItemsEventArgs : EventArgs
9 | {
10 | private IMenuModelItem[] items = null;
11 | private bool sortingAffected = false;
12 |
13 | public IEnumerable Items
14 | {
15 | get { return this.items; }
16 | }
17 | public bool IsSortingAffected
18 | {
19 | get { return this.sortingAffected; }
20 | }
21 |
22 | public MenuModelItemsEventArgs(IEnumerable items, bool affectsSorting = false)
23 | {
24 | if (items == null) items = Enumerable.Empty();
25 | this.items = items.Distinct().ToArray();
26 | this.sortingAffected = affectsSorting;
27 | }
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/WinForms/ItemViews/EventArgs/MenuStripMenuViewItemEventArgs.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Windows.Forms;
6 |
7 | using AdamsLair.WinForms.ItemModels;
8 |
9 | namespace AdamsLair.WinForms.ItemViews
10 | {
11 | public class MenuStripMenuViewItemEventArgs : MenuStripMenuViewEventArgs
12 | {
13 | private IMenuModelItem modelItem = null;
14 | private ToolStripItem viewItem = null;
15 |
16 | public IMenuModelItem Modelitem
17 | {
18 | get { return this.modelItem; }
19 | }
20 | public ToolStripItem ViewItem
21 | {
22 | get { return this.viewItem; }
23 | }
24 |
25 | public MenuStripMenuViewItemEventArgs(IMenuModelItem modelItem, ToolStripItem viewItem, MenuStripMenuView view) : base(view)
26 | {
27 | this.modelItem = modelItem;
28 | this.viewItem = viewItem;
29 | }
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/WinForms/PropertyEditing/PropertyEditors/FlaggedEnumPropertyEditor.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Windows.Forms;
5 | using System.Drawing;
6 |
7 | using AdamsLair.WinForms.Drawing;
8 | using AdamsLair.WinForms.PropertyEditing.Templates;
9 |
10 | namespace AdamsLair.WinForms.PropertyEditing.Editors
11 | {
12 | public class FlaggedEnumPropertyEditor : BitmaskPropertyEditor
13 | {
14 | public override object DisplayedValue
15 | {
16 | get { return Enum.ToObject(this.EditedType, Convert.ChangeType(this.BitmaskValue, Enum.GetUnderlyingType(this.EditedType))); }
17 | }
18 | protected override void OnEditedTypeChanged()
19 | {
20 | base.OnEditedTypeChanged();
21 | this.Items = Enum.GetNames(this.EditedType).Select(n =>
22 | new BitmaskItem((ulong)Convert.ToUInt64(Enum.Parse(this.EditedType, n)), n));
23 | }
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/WinForms/ItemViews/EventArgs/TiledViewItemAppearanceEventArgs.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Drawing;
6 |
7 | using AdamsLair.WinForms.Drawing;
8 |
9 | namespace AdamsLair.WinForms.ItemViews
10 | {
11 | public class TiledViewItemAppearanceEventArgs : TiledViewItemEventArgs
12 | {
13 | private string text = null;
14 | private Image image = null;
15 |
16 | public string DisplayedText
17 | {
18 | get { return this.text; }
19 | set { this.text = value; }
20 | }
21 | public Image DisplayedImage
22 | {
23 | get { return this.image; }
24 | set { this.image = value; }
25 | }
26 |
27 | internal TiledViewItemAppearanceEventArgs(TiledView view) : this(view, -1, null) {}
28 | public TiledViewItemAppearanceEventArgs(TiledView view, int modelIndex, object item) : base(view, modelIndex, item) {}
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/WinForms/Internal/NativeWinAPI.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Windows.Forms;
6 |
7 | namespace AdamsLair.WinForms.NativeWinAPI
8 | {
9 | public enum WindowMessage : int
10 | {
11 | GetText = 0x000D,
12 | GetTextLength = 0x000E,
13 | Paint = 0x000F,
14 | EraseBackground = 0x0014,
15 | HorizontalScroll = 0x0114,
16 | VerticalScroll = 0x0115
17 | }
18 | [Flags]
19 | public enum ExtendedWindowStyles
20 | {
21 | Composited = 0x02000000,
22 | }
23 | public enum ScrollBarCommands : int
24 | {
25 | LineUp = 0,
26 | LineLeft = 0,
27 | LineDown = 1,
28 | LineRight = 1,
29 | PageUp = 2,
30 | PageLeft = 2,
31 | PageDown = 3,
32 | PageRight = 3,
33 | ThumbPosition = 4,
34 | ThumbTrack = 5,
35 | Top = 6,
36 | Left = 6,
37 | Bottom = 7,
38 | Right = 7,
39 | EndScroll = 8,
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/WinForms/TimelineControls/EventArgs/TimelineViewPaintEventArgs.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Drawing;
6 |
7 | using AdamsLair.WinForms.Drawing;
8 |
9 | namespace AdamsLair.WinForms.TimelineControls
10 | {
11 | public class TimelineViewPaintEventArgs : TimelineViewEventArgs
12 | {
13 | private Graphics graphics = null;
14 | private Rectangle targetRect = Rectangle.Empty;
15 |
16 | public Graphics Graphics
17 | {
18 | get { return this.graphics; }
19 | }
20 | public TimelineViewControlRenderer Renderer
21 | {
22 | get { return this.View.Renderer; }
23 | }
24 | public Rectangle TargetRect
25 | {
26 | get { return this.targetRect; }
27 | }
28 |
29 | public TimelineViewPaintEventArgs(TimelineView view, Graphics graphics, Rectangle targetRect) : base(view)
30 | {
31 | this.graphics = graphics;
32 | this.targetRect = targetRect;
33 | }
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/WinForms/TimelineControls/EventArgs/TimelineViewCursorEventArgs.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Drawing;
6 |
7 | using AdamsLair.WinForms.Drawing;
8 |
9 | namespace AdamsLair.WinForms.TimelineControls
10 | {
11 | public class TimelineViewCursorEventArgs : TimelineViewEventArgs
12 | {
13 | private float cursorUnits = 0.0f;
14 | private float lastCursorUnits = 0.0f;
15 |
16 | public float CursorUnits
17 | {
18 | get { return this.cursorUnits; }
19 | }
20 | public float LastCursorUnits
21 | {
22 | get { return this.lastCursorUnits; }
23 | }
24 | public float CursorUnitSpeed
25 | {
26 | get { return this.cursorUnits - this.lastCursorUnits; }
27 | }
28 |
29 | public TimelineViewCursorEventArgs(TimelineView view, float cursorUnits, float lastCursorUnits) : base(view)
30 | {
31 | this.cursorUnits = cursorUnits;
32 | this.lastCursorUnits = lastCursorUnits;
33 | }
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/WinForms/ItemViews/EventArgs/TiledViewItemMouseEventArgs.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Drawing;
6 | using System.Windows.Forms;
7 |
8 | using AdamsLair.WinForms.Drawing;
9 |
10 | namespace AdamsLair.WinForms.ItemViews
11 | {
12 | public class TiledViewItemMouseEventArgs : TiledViewItemEventArgs
13 | {
14 | private Point location;
15 | private MouseButtons buttons;
16 |
17 | public MouseButtons Buttons
18 | {
19 | get { return this.buttons; }
20 | }
21 | public Point Location
22 | {
23 | get { return this.location; }
24 | }
25 | public int X
26 | {
27 | get { return this.location.X; }
28 | }
29 | public int Y
30 | {
31 | get { return this.location.Y; }
32 | }
33 |
34 | public TiledViewItemMouseEventArgs(TiledView view, int modelIndex, object item, Point location, MouseButtons buttons) : base(view, modelIndex, item)
35 | {
36 | this.location = location;
37 | this.buttons = buttons;
38 | }
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/WinForms/AdamsLair.WinForms.nuspec:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | AdamsLair.WinForms
5 | $version$
6 | Adam
7 | Adam
8 | AdamsLair.WinForms
9 | https://github.com/AdamsLair/winforms
10 | false
11 | A collection of custom Controls for Windows.Forms
12 | A collection of custom Controls for Windows.Forms
13 | Windows.Forms WinForms Controls Timeline PropertyGrid ColorPicker
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2014 Adam
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
--------------------------------------------------------------------------------
/TestApp/Properties/Settings.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // This code was generated by a tool.
4 | // Runtime Version:4.0.30319.34209
5 | //
6 | // Changes to this file may cause incorrect behavior and will be lost if
7 | // the code is regenerated.
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace AdamsLair.WinForms.TestApp.Properties {
12 |
13 |
14 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
15 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "12.0.0.0")]
16 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
17 |
18 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
19 |
20 | public static Settings Default {
21 | get {
22 | return defaultInstance;
23 | }
24 | }
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/WinForms/TimelineControls/EventArgs/TimelineViewSelectionEventArgs.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Drawing;
6 |
7 | using AdamsLair.WinForms.Drawing;
8 |
9 | namespace AdamsLair.WinForms.TimelineControls
10 | {
11 | public class TimelineViewSelectionEventArgs : TimelineViewEventArgs
12 | {
13 | private float beginTime = 0.0f;
14 | private float endTime = 0.0f;
15 | private float lastBeginTime = 0.0f;
16 | private float lastEndTime = 0.0f;
17 |
18 | public float BeginTime
19 | {
20 | get { return this.beginTime; }
21 | }
22 | public float EndTime
23 | {
24 | get { return this.endTime; }
25 | }
26 | public bool IsEmpty
27 | {
28 | get { return this.beginTime == this.endTime; }
29 | }
30 | public float LastBeginTime
31 | {
32 | get { return this.lastBeginTime; }
33 | }
34 | public float LastEndTime
35 | {
36 | get { return this.lastEndTime; }
37 | }
38 | public bool WasEmpty
39 | {
40 | get { return this.lastBeginTime == this.lastEndTime; }
41 | }
42 |
43 | public TimelineViewSelectionEventArgs(TimelineView view, float begin, float end, float lastBegin, float lastEnd) : base(view)
44 | {
45 | this.beginTime = begin;
46 | this.endTime = end;
47 | this.lastBeginTime = lastBegin;
48 | this.lastEndTime = lastEnd;
49 | }
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/AdamsLair.WinForms.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 11.00
3 | # Visual Studio 2010
4 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TestApp", "TestApp\TestApp.csproj", "{B94AF907-0915-4430-BC49-05BA5091D2AB}"
5 | EndProject
6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AdamsLair.WinForms", "WinForms\AdamsLair.WinForms.csproj", "{44E2FD11-C687-41ED-B72F-1A4C92479EDC}"
7 | EndProject
8 | Global
9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
10 | Debug|Any CPU = Debug|Any CPU
11 | Release|Any CPU = Release|Any CPU
12 | EndGlobalSection
13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
14 | {B94AF907-0915-4430-BC49-05BA5091D2AB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15 | {B94AF907-0915-4430-BC49-05BA5091D2AB}.Debug|Any CPU.Build.0 = Debug|Any CPU
16 | {B94AF907-0915-4430-BC49-05BA5091D2AB}.Release|Any CPU.ActiveCfg = Release|Any CPU
17 | {B94AF907-0915-4430-BC49-05BA5091D2AB}.Release|Any CPU.Build.0 = Release|Any CPU
18 | {44E2FD11-C687-41ED-B72F-1A4C92479EDC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
19 | {44E2FD11-C687-41ED-B72F-1A4C92479EDC}.Debug|Any CPU.Build.0 = Debug|Any CPU
20 | {44E2FD11-C687-41ED-B72F-1A4C92479EDC}.Release|Any CPU.ActiveCfg = Release|Any CPU
21 | {44E2FD11-C687-41ED-B72F-1A4C92479EDC}.Release|Any CPU.Build.0 = Release|Any CPU
22 | EndGlobalSection
23 | GlobalSection(SolutionProperties) = preSolution
24 | HideSolutionNode = FALSE
25 | EndGlobalSection
26 | EndGlobal
27 |
--------------------------------------------------------------------------------
/WinForms/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // Allgemeine Informationen über eine Assembly werden über die folgenden
6 | // Attribute gesteuert. Ändern Sie diese Attributwerte, um die Informationen zu ändern,
7 | // die mit einer Assembly verknüpft sind.
8 | [assembly: AssemblyTitle("AdamsLair.WinForms")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("AdamsLair.WinForms")]
13 | [assembly: AssemblyCopyright("")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Durch Festlegen von ComVisible auf "false" werden die Typen in dieser Assembly unsichtbar
18 | // für COM-Komponenten. Wenn Sie auf einen Typ in dieser Assembly von
19 | // COM zugreifen müssen, legen Sie das ComVisible-Attribut für diesen Typ auf "true" fest.
20 | [assembly: ComVisible(false)]
21 |
22 | // Die folgende GUID bestimmt die ID der Typbibliothek, wenn dieses Projekt für COM verfügbar gemacht wird
23 | [assembly: Guid("735ee5dc-8c18-4a06-8e64-2f172ddd01cc")]
24 |
25 | // Versionsinformationen für eine Assembly bestehen aus den folgenden vier Werten:
26 | //
27 | // Hauptversion
28 | // Nebenversion
29 | // Buildnummer
30 | // Revision
31 | //
32 | // Sie können alle Werte angeben oder die standardmäßigen Build- und Revisionsnummern
33 | // übernehmen, indem Sie "*" eingeben:
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("1.1.17")]
36 |
--------------------------------------------------------------------------------
/TestApp/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // Allgemeine Informationen über eine Assembly werden über die folgenden
6 | // Attribute gesteuert. Ändern Sie diese Attributwerte, um die Informationen zu ändern,
7 | // die mit einer Assembly verknüpft sind.
8 | [assembly: AssemblyTitle("TestApp")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("TestApp")]
13 | [assembly: AssemblyCopyright("Copyright © 2012")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Durch Festlegen von ComVisible auf "false" werden die Typen in dieser Assembly unsichtbar
18 | // für COM-Komponenten. Wenn Sie auf einen Typ in dieser Assembly von
19 | // COM zugreifen müssen, legen Sie das ComVisible-Attribut für diesen Typ auf "true" fest.
20 | [assembly: ComVisible(false)]
21 |
22 | // Die folgende GUID bestimmt die ID der Typbibliothek, wenn dieses Projekt für COM verfügbar gemacht wird
23 | [assembly: Guid("8a9f21fe-76b5-49d2-8a17-6cf8b5e00d8f")]
24 |
25 | // Versionsinformationen für eine Assembly bestehen aus den folgenden vier Werten:
26 | //
27 | // Hauptversion
28 | // Nebenversion
29 | // Buildnummer
30 | // Revision
31 | //
32 | // Sie können alle Werte angeben oder die standardmäßigen Build- und Revisionsnummern
33 | // übernehmen, indem Sie "*" eingeben:
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("1.0.0.0")]
36 | [assembly: AssemblyFileVersion("1.0.0.0")]
37 |
--------------------------------------------------------------------------------
/WinForms/ItemViews/EventArgs/TiledViewItemDrawEventArgs.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Drawing;
6 |
7 | using AdamsLair.WinForms.Drawing;
8 |
9 | namespace AdamsLair.WinForms.ItemViews
10 | {
11 | public class TiledViewItemDrawEventArgs : TiledViewItemEventArgs
12 | {
13 | private Graphics graphics;
14 | private Rectangle itemRect;
15 | private bool hovered;
16 | private bool selected;
17 | private bool handled;
18 |
19 | public Graphics Graphics
20 | {
21 | get { return this.graphics; }
22 | internal set { this.graphics = value; }
23 | }
24 | public ControlRenderer Renderer
25 | {
26 | get { return this.View.Renderer; }
27 | }
28 | public Rectangle ItemRect
29 | {
30 | get { return this.itemRect; }
31 | internal set { this.itemRect = value; }
32 | }
33 | public bool IsSelected
34 | {
35 | get { return this.selected; }
36 | internal set { this.selected = value; }
37 | }
38 | public bool IsHovered
39 | {
40 | get { return this.hovered; }
41 | internal set { this.hovered = value; }
42 | }
43 | public bool Handled
44 | {
45 | get { return this.handled; }
46 | set { this.handled = true; }
47 | }
48 |
49 | internal TiledViewItemDrawEventArgs(TiledView view) : this(view, -1, null, null, Rectangle.Empty, false, false) {}
50 | public TiledViewItemDrawEventArgs(TiledView view, int modelIndex, object item, Graphics graphics, Rectangle itemRect, bool selected, bool hovered) : base(view, modelIndex, item)
51 | {
52 | this.graphics = graphics;
53 | this.itemRect = itemRect;
54 | this.selected = selected;
55 | this.hovered = hovered;
56 | this.handled = false;
57 | }
58 | }
59 | }
60 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Build Folders (you can keep bin if you'd like, to store dlls and pdbs)
2 | [Bb]in/
3 | [Oo]bj/
4 |
5 | # mstest test results
6 | TestResults
7 |
8 | ## Ignore Visual Studio temporary files, build results, and
9 | ## files generated by popular Visual Studio add-ons.
10 |
11 | # User-specific files
12 | *.suo
13 | *.user
14 | *.sln.docstates
15 | /.vs
16 |
17 | # Build results
18 | [Dd]ebug/
19 | [Rr]elease/
20 | x64/
21 | *_i.c
22 | *_p.c
23 | *.ilk
24 | *.meta
25 | *.obj
26 | *.pch
27 | *.pdb
28 | *.pgc
29 | *.pgd
30 | *.rsp
31 | *.sbr
32 | *.tlb
33 | *.tli
34 | *.tlh
35 | *.tmp
36 | *.log
37 | *.vspscc
38 | *.vssscc
39 | .builds
40 |
41 | # Visual C++ cache files
42 | ipch/
43 | *.aps
44 | *.ncb
45 | *.opensdf
46 | *.sdf
47 |
48 | # Visual Studio profiler
49 | *.psess
50 | *.vsp
51 | *.vspx
52 |
53 | # Guidance Automation Toolkit
54 | *.gpState
55 |
56 | # ReSharper is a .NET coding add-in
57 | _ReSharper*
58 |
59 | # NCrunch
60 | *.ncrunch*
61 | .*crunch*.local.xml
62 |
63 | # Installshield output folder
64 | [Ee]xpress
65 |
66 | # DocProject is a documentation generator add-in
67 | DocProject/buildhelp/
68 | DocProject/Help/*.HxT
69 | DocProject/Help/*.HxC
70 | DocProject/Help/*.hhc
71 | DocProject/Help/*.hhk
72 | DocProject/Help/*.hhp
73 | DocProject/Help/Html2
74 | DocProject/Help/html
75 |
76 | # Click-Once directory
77 | publish
78 |
79 | # Publish Web Output
80 | *.Publish.xml
81 |
82 | # NuGet Packages Directory
83 | packages
84 |
85 | # Windows Azure Build Output
86 | csx
87 | *.build.csdef
88 |
89 | # Windows Store app package directory
90 | AppPackages/
91 |
92 | # Others
93 | [Bb]in
94 | [Oo]bj
95 | sql
96 | TestResults
97 | [Tt]est[Rr]esult*
98 | *.Cache
99 | ClientBin
100 | [Ss]tyle[Cc]op.*
101 | ~$*
102 | *.dbmdl
103 | Generated_Code #added for RIA/Silverlight projects
104 |
105 | # Backup & report files from converting an old project file to a newer
106 | # Visual Studio version. Backup files are not needed, because we have git ;-)
107 | _UpgradeReport_Files/
108 | Backup*/
109 | UpgradeLog*.XML
110 | WinForms/AdamsLair.WinForms.xml
111 |
--------------------------------------------------------------------------------
/WinForms/Properties/ResourcesCache.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Drawing;
6 | using System.Reflection;
7 |
8 | namespace AdamsLair.WinForms.Properties
9 | {
10 | public static class ResourcesCache
11 | {
12 | public readonly static Bitmap ImageAdd = Resources.ImageAdd;
13 | public readonly static Bitmap ImageDelete = Resources.ImageDelete;
14 | public readonly static Bitmap NumberGripIcon = Resources.NumberGripIcon;
15 | public readonly static Bitmap DropDownIcon = Resources.DropDownIcon;
16 | public readonly static Bitmap ExpandNodeClosedDisabled = Resources.ExpandNodeClosedDisabled;
17 | public readonly static Bitmap ExpandNodeClosedNormal = Resources.ExpandNodeClosedNormal;
18 | public readonly static Bitmap ExpandNodeClosedHot = Resources.ExpandNodeClosedHot;
19 | public readonly static Bitmap ExpandNodeClosedPressed = Resources.ExpandNodeClosedPressed;
20 | public readonly static Bitmap ExpandNodeOpenedDisabled = Resources.ExpandNodeOpenedDisabled;
21 | public readonly static Bitmap ExpandNodeOpenedNormal = Resources.ExpandNodeOpenedNormal;
22 | public readonly static Bitmap ExpandNodeOpenedHot = Resources.ExpandNodeOpenedHot;
23 | public readonly static Bitmap ExpandNodeOpenedPressed = Resources.ExpandNodeOpenedPressed;
24 | public readonly static Bitmap ArrowDown = Resources.ArrowDown;
25 | public readonly static Bitmap ArrowDownLeft = Resources.ArrowDownLeft;
26 | public readonly static Bitmap ArrowDownRight = Resources.ArrowDownRight;
27 | public readonly static Bitmap ArrowUp = Resources.ArrowUp;
28 | public readonly static Bitmap ArrowUpLeft = Resources.ArrowUpLeft;
29 | public readonly static Bitmap ArrowUpRight = Resources.ArrowUpRight;
30 | public readonly static Bitmap ArrowLeft = Resources.ArrowLeft;
31 | public readonly static Bitmap ArrowRight = Resources.ArrowRight;
32 |
33 | public readonly static Font DefaultFont = SystemFonts.DefaultFont;
34 | public readonly static Font DefaultFontSmall = new Font(DefaultFont.FontFamily, DefaultFont.Size * 0.9f, DefaultFont.Unit);
35 | public readonly static Font DefaultFontBold = new Font(DefaultFont, FontStyle.Bold);
36 | public readonly static Font DefaultFontBoldSmall = new Font(DefaultFontSmall, FontStyle.Bold);
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/WinForms/TimelineControls/EventArgs/TimelineViewTrackPaintEventArgs.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Drawing;
6 |
7 | using AdamsLair.WinForms.Drawing;
8 |
9 | namespace AdamsLair.WinForms.TimelineControls
10 | {
11 | public class TimelineViewTrackPaintEventArgs : TimelineViewTrackEventArgs
12 | {
13 | private Graphics graphics = null;
14 | private Rectangle targetRect = Rectangle.Empty;
15 | private float beginTime = 0.0f;
16 | private float endTime = 0.0f;
17 | private QualityLevel qualityHint = QualityLevel.High;
18 |
19 |
20 | public Graphics Graphics
21 | {
22 | get { return this.graphics; }
23 | }
24 | public TimelineViewControlRenderer Renderer
25 | {
26 | get { return this.View.Renderer; }
27 | }
28 | public QualityLevel QualityHint
29 | {
30 | get { return this.qualityHint; }
31 | }
32 | ///
33 | /// [GET] The rectangular area that is occupied by the track that is currently painted. It won't be
34 | /// altered due to clipping and partial repaints, and can be safely relied upon for determining
35 | /// drawing geometry.
36 | ///
37 | public Rectangle TargetRect
38 | {
39 | get { return this.targetRect; }
40 | }
41 | ///
42 | /// [GET] The begin of the currently painted timespan. This value may be altered due to clipping and
43 | /// partial repaints, and does not reflect the tracks or track contents actual begin.
44 | ///
45 | public float BeginTime
46 | {
47 | get { return this.beginTime; }
48 | }
49 | ///
50 | /// [GET] The end of the currently painted timespan. This value may be altered due to clipping and
51 | /// partial repaints, and does not reflect the tracks or track contents actual end.
52 | ///
53 | public float EndTime
54 | {
55 | get { return this.endTime; }
56 | }
57 |
58 |
59 | public TimelineViewTrackPaintEventArgs(TimelineViewTrack track, Graphics graphics, QualityLevel qualityHint, Rectangle targetRect) : this(track, graphics, qualityHint, targetRect, track.ContentBeginTime, track.ContentEndTime) {}
60 | public TimelineViewTrackPaintEventArgs(TimelineViewTrack track, Graphics graphics, QualityLevel qualityHint, Rectangle targetRect, float beginTime, float endTime) : base(track)
61 | {
62 | this.graphics = graphics;
63 | this.targetRect = targetRect;
64 | this.qualityHint = qualityHint;
65 | this.beginTime = beginTime;
66 | this.endTime = endTime;
67 | }
68 |
69 | public QualityLevel GetAdjustedQuality(QualityLevel baseLevel)
70 | {
71 | return (QualityLevel)Math.Min((int)baseLevel, (int)this.qualityHint);
72 | }
73 | }
74 | }
75 |
--------------------------------------------------------------------------------
/WinForms/TimelineControls/Models/TimelineGraphTrackModel.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace AdamsLair.WinForms.TimelineControls
7 | {
8 | public class TimelineGraphTrackModel : TimelineTrackModel, ITimelineGraphTrackModel
9 | {
10 | private List graphs = new List();
11 |
12 | public event EventHandler GraphsAdded;
13 | public event EventHandler GraphsRemoved;
14 | public event EventHandler GraphChanged;
15 |
16 | public override float EndTime
17 | {
18 | get { return this.graphs.Max(g => g.EndTime); }
19 | }
20 | public override float BeginTime
21 | {
22 | get { return this.graphs.Min(g => g.BeginTime); }
23 | }
24 | public IEnumerable Graphs
25 | {
26 | get { return this.graphs; }
27 | }
28 |
29 | public void Add(ITimelineGraphModel graph)
30 | {
31 | this.AddRange(new[] { graph });
32 | }
33 | public void AddRange(IEnumerable graphs)
34 | {
35 | graphs = graphs.Where(t => !this.graphs.Contains(t)).Distinct().ToArray();
36 | if (!graphs.Any()) return;
37 |
38 | foreach (ITimelineGraphModel graph in graphs)
39 | {
40 | graph.GraphChanged += this.graph_GraphChanged;
41 | }
42 | this.graphs.AddRange(graphs);
43 |
44 | if (this.GraphsAdded != null)
45 | this.GraphsAdded(this, new TimelineGraphCollectionEventArgs(graphs));
46 | }
47 | public void Remove(ITimelineGraphModel graph)
48 | {
49 | this.RemoveRange(new[] { graph });
50 | }
51 | public void RemoveRange(IEnumerable graphs)
52 | {
53 | graphs = graphs.Where(t => this.graphs.Contains(t)).Distinct().ToArray();
54 | if (!graphs.Any()) return;
55 |
56 | foreach (ITimelineGraphModel graph in graphs)
57 | {
58 | graph.GraphChanged -= this.graph_GraphChanged;
59 | this.graphs.Remove(graph);
60 | }
61 |
62 | if (this.GraphsRemoved != null)
63 | this.GraphsRemoved(this, new TimelineGraphCollectionEventArgs(graphs));
64 | }
65 | public void Clear()
66 | {
67 | ITimelineGraphModel[] oldGraphs = this.graphs.ToArray();
68 |
69 | foreach (ITimelineGraphModel graph in this.graphs)
70 | {
71 | graph.GraphChanged -= this.graph_GraphChanged;
72 | }
73 | this.graphs.Clear();
74 |
75 | if (this.GraphsRemoved != null)
76 | this.GraphsRemoved(this, new TimelineGraphCollectionEventArgs(oldGraphs));
77 | }
78 |
79 | private void graph_GraphChanged(object sender, TimelineGraphRangeEventArgs e)
80 | {
81 | if (this.GraphChanged != null)
82 | this.GraphChanged(this, e);
83 | }
84 | }
85 | }
86 |
--------------------------------------------------------------------------------
/WinForms/ItemViews/TiledViewTextItemEditor.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Windows.Forms;
6 | using System.Drawing;
7 | using System.Reflection;
8 |
9 | using AdamsLair.WinForms.Drawing;
10 | using AdamsLair.WinForms.ItemModels;
11 |
12 | namespace AdamsLair.WinForms.ItemViews
13 | {
14 | public class TiledViewTextItemEditor : TextBox, ITiledViewItemEditor
15 | {
16 | private string editedPropertyName = null;
17 | private bool accepted = false;
18 |
19 | public event EventHandler StopEditing = null;
20 |
21 | public string EditedPropertyName
22 | {
23 | get { return this.editedPropertyName; }
24 | set { this.editedPropertyName = value; }
25 | }
26 | Control ITiledViewItemEditor.MainControl
27 | {
28 | get { return this; }
29 | }
30 | bool ITiledViewItemEditor.IsAcceptingValue
31 | {
32 | get { return this.accepted; }
33 | }
34 |
35 | void ITiledViewItemEditor.GetValueFromItem(object item)
36 | {
37 | if (string.IsNullOrEmpty(this.editedPropertyName)) return;
38 | if (item == null) return;
39 |
40 | Type itemType = item.GetType();
41 | PropertyInfo property = itemType.GetProperty(this.editedPropertyName, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
42 | if (property == null) return;
43 | if (property.PropertyType != typeof(string)) return;
44 |
45 | string val = property.GetValue(item, null) as string;
46 | this.Text = val;
47 | }
48 | bool ITiledViewItemEditor.ApplyValueToItem(object item)
49 | {
50 | if (string.IsNullOrEmpty(this.editedPropertyName)) return true;
51 | if (item == null) return true;
52 |
53 | Type itemType = item.GetType();
54 | PropertyInfo property = itemType.GetProperty(this.editedPropertyName, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
55 | if (property == null) return true;
56 | if (property.PropertyType != typeof(string)) return true;
57 |
58 | property.SetValue(item, this.Text, null);
59 | return true;
60 | }
61 |
62 | private void Accept()
63 | {
64 | this.accepted = true;
65 | if (this.StopEditing != null) this.StopEditing(this, EventArgs.Empty);
66 | }
67 | private void Reject()
68 | {
69 | this.accepted = false;
70 | if (this.StopEditing != null) this.StopEditing(this, EventArgs.Empty);
71 | }
72 |
73 | protected override void OnKeyDown(KeyEventArgs e)
74 | {
75 | base.OnKeyDown(e);
76 | if (e.KeyCode == Keys.Escape)
77 | this.Reject();
78 | else if (e.KeyCode == Keys.Return)
79 | this.Accept();
80 | }
81 | protected override void OnLostFocus(EventArgs e)
82 | {
83 | base.OnLostFocus(e);
84 | this.Accept();
85 | }
86 | protected override void Dispose(bool disposing)
87 | {
88 | base.Dispose(disposing);
89 | this.Reject();
90 | }
91 | }
92 | }
93 |
--------------------------------------------------------------------------------
/WinForms/PropertyEditing/EditorTemplates/ComboBoxDropDown.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel;
4 | using System.Drawing;
5 | using System.Linq;
6 | using System.Text;
7 | using System.Windows.Forms;
8 |
9 | namespace AdamsLair.WinForms.PropertyEditing.Templates
10 | {
11 | public partial class ComboBoxDropDown : ListBox
12 | {
13 | private bool openedWithCtrl = false;
14 | private int hoveredIndex = -1;
15 |
16 | public event EventHandler AcceptSelection = null;
17 | public event EventHandler RequestClose = null;
18 |
19 | public int HoveredIndex
20 | {
21 | get { return this.hoveredIndex; }
22 | }
23 |
24 | public ComboBoxDropDown()
25 | {
26 | this.IntegralHeight = false;
27 | this.Font = this.Font; // Prevents parent PopupControl from interfering on resize.
28 | }
29 | public ComboBoxDropDown(IEnumerable