Author: ivanz
Date: 2007-08-31 07:42:57 -0400 (Fri, 31 Aug 2007)
New Revision: 85095
Added:
trunk/mwf-designer/ChangeLog
trunk/mwf-designer/src/UI/ToolBoxList/
trunk/mwf-designer/src/UI/ToolBoxList/ToolBoxGroupHeader.cs
trunk/mwf-designer/src/UI/ToolBoxList/ToolBoxGroupPanel.cs
trunk/mwf-designer/src/UI/ToolBoxList/ToolBoxList.cs
trunk/mwf-designer/src/UI/ToolBoxList/ToolBoxListItem.cs
Removed:
trunk/mwf-designer/src/UI/Toolbox.Designer.cs
trunk/mwf-designer/src/UI/Toolbox.cs
Modified:
trunk/mwf-designer/mwf-designer.vpj
trunk/mwf-designer/src/Project/References.cs
trunk/mwf-designer/src/Project/Workspace.cs
trunk/mwf-designer/src/UI/MainView.Designer.cs
trunk/mwf-designer/src/UI/MainView.cs
trunk/mwf-designer/src/UI/NewFileDialog.cs
trunk/mwf-designer/src/UI/PropertyGrid.cs
trunk/mwf-designer/src/UI/ReferencesDialog.cs
Log:
2007-08-31 Ivan N. Zlatev <[EMAIL PROTECTED]>
* UI/ToolBoxList/*.cs: A new fancy Toolbox. Patch by J. Pobst.
* UI/Toolbox.cs, UI/Toolbox.Designer.cs: Delete old.
* all: Add license headers.
Added: trunk/mwf-designer/ChangeLog
===================================================================
--- trunk/mwf-designer/ChangeLog 2007-08-31 11:30:58 UTC (rev 85094)
+++ trunk/mwf-designer/ChangeLog 2007-08-31 11:42:57 UTC (rev 85095)
@@ -0,0 +1,5 @@
+2007-08-31 Ivan N. Zlatev <[EMAIL PROTECTED]>
+
+ * UI/ToolBoxList/*.cs: A new fancy Toolbox. Patch by J. Pobst.
+ * UI/Toolbox.cs, UI/Toolbox.Designer.cs: Delete old.
+ * all: Add license headers.
Modified: trunk/mwf-designer/mwf-designer.vpj
===================================================================
--- trunk/mwf-designer/mwf-designer.vpj 2007-08-31 11:30:58 UTC (rev 85094)
+++ trunk/mwf-designer/mwf-designer.vpj 2007-08-31 11:42:57 UTC (rev 85095)
@@ -17,7 +17,7 @@
RunFromDir="%rw"
ClearProcessBuffer="1"
DependsRef="Release">
- <Exec CmdLine="make"/>
+ <Exec CmdLine="make mono-design"/>
</Target>
<Target
Name="Execute"
@@ -27,7 +27,7 @@
CaptureOutputWith="ProcessBuffer"
BuildFirst="1"
ClearProcessBuffer="1">
- <Exec CmdLine="make run"/>
+ <Exec CmdLine="make mono-design-run"/>
</Target>
<Target
Name="Build MS_NET"
@@ -36,15 +36,6 @@
ClearProcessBuffer="1">
<Exec CmdLine="csc -debug -d:NET_2_0
-r:System.Design.dll,System.Windows.Forms.dll,System.Drawing.dll,System.Data.dll,..\build\Mono.Design.dll,..\build\ICSharpCode.NRefactory.dll
-out:..\build\mwf-designer.exe %{*.cs}"/>
</Target>
- <Target
- Name="Build against Mono.Design"
- MenuCaption="&Build against Mono.Design"
- CaptureOutputWith="ProcessBuffer"
- ClearProcessBuffer="1"
- RunFromDir="%rp"
- SaveOption="SaveWorkspaceFiles">
- <Exec CmdLine="make mono-design"/>
- </Target>
</Menu>
<Includes>
<Include Dir="<double click here to add another
entry>"/>
@@ -73,6 +64,12 @@
<F N="src/Project/Workspace.cs"/>
</Folder>
<Folder Name="UI">
+ <Folder Name="ToolBoxList">
+ <F
N="src/UI/ToolBoxList/ToolBoxGroupHeader.cs"/>
+ <F
N="src/UI/ToolBoxList/ToolBoxGroupPanel.cs"/>
+ <F
N="src/UI/ToolBoxList/ToolBoxList.cs"/>
+ <F
N="src/UI/ToolBoxList/ToolBoxListItem.cs"/>
+ </Folder>
<F N="src/UI/MainView.cs"/>
<F N="src/UI/MainView.Designer.cs"/>
<F N="src/UI/NewFileDialog.cs"/>
Modified: trunk/mwf-designer/src/Project/References.cs
===================================================================
--- trunk/mwf-designer/src/Project/References.cs 2007-08-31 11:30:58 UTC
(rev 85094)
+++ trunk/mwf-designer/src/Project/References.cs 2007-08-31 11:42:57 UTC
(rev 85095)
@@ -1,3 +1,31 @@
+
+//
+// Authors:
+// Ivan N. Zlatev (contact i-nZ.net)
+//
+// (C) 2007 Ivan N. Zlatev
+
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
using System;
using System.Collections.Generic;
using System.Text;
Modified: trunk/mwf-designer/src/Project/Workspace.cs
===================================================================
--- trunk/mwf-designer/src/Project/Workspace.cs 2007-08-31 11:30:58 UTC (rev
85094)
+++ trunk/mwf-designer/src/Project/Workspace.cs 2007-08-31 11:42:57 UTC (rev
85095)
@@ -123,7 +123,9 @@
private bool IsValidType (Type type)
{
- if (!type.IsAbstract && !type.IsInterface &&
+ ToolboxItemAttribute toolboxAttribute =
TypeDescriptor.GetAttributes (type)[typeof (ToolboxItemAttribute)] as
ToolboxItemAttribute;
+ if (toolboxAttribute != ToolboxItemAttribute.None &&
+ !type.IsAbstract && !type.IsInterface &&
((type.Attributes & TypeAttributes.Public) ==
TypeAttributes.Public) &&
((type.Attributes &
TypeAttributes.NestedFamily) != TypeAttributes.NestedFamily) &&
((type.Attributes &
TypeAttributes.NestedFamORAssem) != TypeAttributes.NestedFamORAssem) &&
Modified: trunk/mwf-designer/src/UI/MainView.Designer.cs
===================================================================
--- trunk/mwf-designer/src/UI/MainView.Designer.cs 2007-08-31 11:30:58 UTC
(rev 85094)
+++ trunk/mwf-designer/src/UI/MainView.Designer.cs 2007-08-31 11:42:57 UTC
(rev 85095)
@@ -54,7 +54,7 @@
this.splitContainer1 = new
System.Windows.Forms.SplitContainer();
this.splitContainer2 = new
System.Windows.Forms.SplitContainer();
this.surfaceTabs = new System.Windows.Forms.TabControl();
- this.toolbox = new mwf_designer.Toolbox();
+ this.toolbox = new mwf_designer.ToolBoxList();
this.propertyGrid = new mwf_designer.PropertyGrid();
this.mainMenu.SuspendLayout();
this.splitContainer1.Panel1.SuspendLayout();
@@ -346,7 +346,7 @@
private System.Windows.Forms.ToolStripMenuItem closeToolStripMenuItem;
private PropertyGrid propertyGrid;
private System.Windows.Forms.SplitContainer splitContainer2;
- private Toolbox toolbox;
+ private ToolBoxList toolbox;
private System.Windows.Forms.TabControl surfaceTabs;
}
}
Modified: trunk/mwf-designer/src/UI/MainView.cs
===================================================================
--- trunk/mwf-designer/src/UI/MainView.cs 2007-08-31 11:30:58 UTC (rev
85094)
+++ trunk/mwf-designer/src/UI/MainView.cs 2007-08-31 11:42:57 UTC (rev
85095)
@@ -1,3 +1,30 @@
+//
+// Authors:
+// Ivan N. Zlatev (contact i-nZ.net)
+//
+// (C) 2007 Ivan N. Zlatev
+
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
using System;
using System.Collections.Generic;
using System.ComponentModel;
@@ -85,7 +112,7 @@
// Currently populates with all MWF Controls that have a public
ctor with no params
//
- private void PopulateToolbox (Toolbox toolbox, References
references)
+ private void PopulateToolbox (ToolBoxList toolbox, References
references)
{
toolbox.Clear ();
foreach (ToolboxItem item in _workspace.GetToolboxItems
())
Modified: trunk/mwf-designer/src/UI/NewFileDialog.cs
===================================================================
--- trunk/mwf-designer/src/UI/NewFileDialog.cs 2007-08-31 11:30:58 UTC (rev
85094)
+++ trunk/mwf-designer/src/UI/NewFileDialog.cs 2007-08-31 11:42:57 UTC (rev
85095)
@@ -1,3 +1,30 @@
+//
+// Authors:
+// Ivan N. Zlatev (contact i-nZ.net)
+//
+// (C) 2007 Ivan N. Zlatev
+
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
using System;
using System.Collections.Generic;
using System.ComponentModel;
Modified: trunk/mwf-designer/src/UI/PropertyGrid.cs
===================================================================
--- trunk/mwf-designer/src/UI/PropertyGrid.cs 2007-08-31 11:30:58 UTC (rev
85094)
+++ trunk/mwf-designer/src/UI/PropertyGrid.cs 2007-08-31 11:42:57 UTC (rev
85095)
@@ -1,3 +1,30 @@
+//
+// Authors:
+// Ivan N. Zlatev (contact i-nZ.net)
+//
+// (C) 2007 Ivan N. Zlatev
+
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
using System;
using System.Collections;
using System.Collections.Generic;
Modified: trunk/mwf-designer/src/UI/ReferencesDialog.cs
===================================================================
--- trunk/mwf-designer/src/UI/ReferencesDialog.cs 2007-08-31 11:30:58 UTC
(rev 85094)
+++ trunk/mwf-designer/src/UI/ReferencesDialog.cs 2007-08-31 11:42:57 UTC
(rev 85095)
@@ -1,3 +1,30 @@
+//
+// Authors:
+// Ivan N. Zlatev (contact i-nZ.net)
+//
+// (C) 2007 Ivan N. Zlatev
+
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
using System;
using System.Collections.Generic;
using System.ComponentModel;
Added: trunk/mwf-designer/src/UI/ToolBoxList/ToolBoxGroupHeader.cs
===================================================================
--- trunk/mwf-designer/src/UI/ToolBoxList/ToolBoxGroupHeader.cs 2007-08-31
11:30:58 UTC (rev 85094)
+++ trunk/mwf-designer/src/UI/ToolBoxList/ToolBoxGroupHeader.cs 2007-08-31
11:42:57 UTC (rev 85095)
@@ -0,0 +1,120 @@
+//
+// Authors:
+// Jonathan Pobst ([EMAIL PROTECTED]>)
+//
+// (C) 2007 Jonathan Pobst
+
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+using System.Drawing;
+using System.Windows.Forms;
+
+namespace mwf_designer
+{
+ public class ToolBoxGroupHeader : UserControl
+ {
+ #region Fields
+ private bool expanded = true;
+ #endregion
+
+ #region Public Constructor
+ public ToolBoxGroupHeader ()
+ {
+ Size = new Size (200, 20);
+ SetStyle (ControlStyles.ResizeRedraw, true);
+ }
+ #endregion
+
+ #region Public Properties
+ public bool Expanded {
+ get { return expanded; }
+ set {
+ if (expanded != value) {
+ expanded = value;
+ Invalidate ();
+ }
+ }
+ }
+ #endregion
+
+ #region Protected Methods
+ protected override void OnClick (EventArgs e)
+ {
+ base.OnClick (e);
+
+ Expanded = !expanded;
+ OnExpandedChanged (EventArgs.Empty);
+ }
+
+ protected virtual void OnExpandedChanged (EventArgs e)
+ {
+ EventHandler eh =
(EventHandler)(Events[ExpandedChangedEvent]);
+ if (eh != null)
+ eh (this, e);
+ }
+
+ protected override void OnPaint (PaintEventArgs e)
+ {
+ base.OnPaint (e);
+
+ Graphics g = e.Graphics;
+
+ g.Clear (BackColor);
+
+ if (expanded)
+ DrawDownChevron (g, new Point (7, 8),
Pens.DarkGray);
+ else
+ DrawRightChevron (g, new Point (10, 5),
Pens.DarkGray);
+
+ TextRenderer.DrawText (g, Text, Font, new Point (18,
2), Color.Black);
+ }
+ #endregion
+
+ #region Public Events
+ static object ExpandedChangedEvent = new object ();
+
+ public event EventHandler ExpandedChanged {
+ add { Events.AddHandler (ExpandedChangedEvent, value); }
+ remove { Events.RemoveHandler (ExpandedChangedEvent,
value); }
+ }
+ #endregion
+
+ #region Private Methods
+ private void DrawDownChevron (Graphics g, Point location, Pen p)
+ {
+ g.DrawLine (p, location.X, location.Y, location.X + 8,
location.Y);
+ g.DrawLine (p, location.X + 1, location.Y + 1,
location.X + 7, location.Y + 1);
+ g.DrawLine (p, location.X + 2, location.Y + 2,
location.X + 6, location.Y + 2);
+ g.DrawLine (p, location.X + 3, location.Y + 3,
location.X + 5, location.Y + 3);
+ }
+
+ private void DrawRightChevron (Graphics g, Point location, Pen
p)
+ {
+ g.DrawLine (p, location.X, location.Y, location.X,
location.Y + 8);
+ g.DrawLine (p, location.X + 1, location.Y + 1,
location.X + 1, location.Y + 7);
+ g.DrawLine (p, location.X + 2, location.Y + 2,
location.X + 2, location.Y + 6);
+ g.DrawLine (p, location.X + 3, location.Y + 3,
location.X + 3, location.Y + 5);
+ }
+ #endregion
+ }
+}
Added: trunk/mwf-designer/src/UI/ToolBoxList/ToolBoxGroupPanel.cs
===================================================================
--- trunk/mwf-designer/src/UI/ToolBoxList/ToolBoxGroupPanel.cs 2007-08-31
11:30:58 UTC (rev 85094)
+++ trunk/mwf-designer/src/UI/ToolBoxList/ToolBoxGroupPanel.cs 2007-08-31
11:42:57 UTC (rev 85095)
@@ -0,0 +1,150 @@
+//
+// Authors:
+// Jonathan Pobst ([EMAIL PROTECTED]>)
+//
+// (C) 2007 Jonathan Pobst
+
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+using System.Drawing;
+using System.Windows.Forms;
+
+namespace mwf_designer
+{
+ public class ToolBoxGroupPanel : UserControl
+ {
+ #region Fields
+ private ToolBoxGroupHeader GroupHeader1;
+ private Panel ItemPanel;
+ #endregion
+
+ #region Public Constructor
+ public ToolBoxGroupPanel ()
+ {
+ ItemPanel = new Panel ();
+ GroupHeader1 = new ToolBoxGroupHeader ();
+ SuspendLayout ();
+
+ //
+ // ItemPanel
+ //
+ ItemPanel.Dock = DockStyle.Fill;
+ ItemPanel.Location = new Point (1, 21);
+ ItemPanel.Name = "ItemPanel";
+ ItemPanel.Size = new Size (198, 0);
+ ItemPanel.TabIndex = 1;
+ //
+ // GroupHeader1
+ //
+ GroupHeader1.Dock = DockStyle.Top;
+ GroupHeader1.Expanded = true;
+ GroupHeader1.Location = new Point (1, 1);
+ GroupHeader1.Margin = new Padding (0);
+ GroupHeader1.Name = "GroupHeader1";
+ GroupHeader1.Padding = new Padding (1, 1, 1, 0);
+ GroupHeader1.Size = new Size (198, 20);
+ GroupHeader1.TabIndex = 0;
+
+ Controls.Add (this.ItemPanel);
+ Controls.Add (this.GroupHeader1);
+ Name = "ToolBoxGroupPanel";
+ Padding = new System.Windows.Forms.Padding (1, 1, 1, 0);
+ Size = new System.Drawing.Size (200, 20);
+ ResumeLayout (false);
+
+ GroupHeader1.ExpandedChanged += new EventHandler
(GroupHeader1_ExpandedChanged);
+ ItemPanel.ControlAdded += new ControlEventHandler
(ItemPanel_ControlAdded);
+ Layout += new LayoutEventHandler
(ToolBoxGroupPanel_Layout);
+ }
+ #endregion
+
+ #region Public Properties
+ public bool Expanded {
+ get { return GroupHeader1.Expanded; }
+ set {
+ if (GroupHeader1.Expanded != value) {
+ GroupHeader1.Expanded = value;
+ PerformLayout ();
+ }
+ }
+ }
+
+ public ControlCollection Items {
+ get { return ItemPanel.Controls; }
+ }
+
+ public override string Text {
+ get { return GroupHeader1.Text; }
+ set { GroupHeader1.Text = value; }
+ }
+ #endregion
+
+ #region Private Methods
+ private void ToolBoxGroupPanel_Layout (object sender,
LayoutEventArgs e)
+ {
+ // Figure out how tall we need to be
+ if (GroupHeader1.Expanded) {
+ int y = 0;
+
+ foreach (Control c in Items)
+ if (c.Enabled)
+ y += c.Height;
+
+ if (y == 0)
+ Visible = false;
+ else
+ Visible = true;
+
+ Height = y + GroupHeader1.Height + 1;
+ } else {
+ Height = GroupHeader1.Bottom;
+ }
+ }
+
+ private void ItemPanel_ControlAdded (object sender,
ControlEventArgs e)
+ {
+ // Sort incoming items
+ ToolBoxListItem new_tbi = (ToolBoxListItem)e.Control;
+
+ foreach (Control c in ItemPanel.Controls) {
+ ToolBoxListItem tbi = c as ToolBoxListItem;
+
+ if (tbi == null)
+ continue;
+
+ if (string.Compare (new_tbi.Text, tbi.Text) >
0) {
+ ItemPanel.Controls.SetChildIndex
(new_tbi, ItemPanel.Controls.GetChildIndex (tbi));
+ break;
+ }
+ }
+
+ e.Control.Dock = DockStyle.Top;
+ }
+
+ private void GroupHeader1_ExpandedChanged (object sender,
EventArgs e)
+ {
+ PerformLayout ();
+ }
+ #endregion
+ }
+}
Added: trunk/mwf-designer/src/UI/ToolBoxList/ToolBoxList.cs
===================================================================
--- trunk/mwf-designer/src/UI/ToolBoxList/ToolBoxList.cs 2007-08-31
11:30:58 UTC (rev 85094)
+++ trunk/mwf-designer/src/UI/ToolBoxList/ToolBoxList.cs 2007-08-31
11:42:57 UTC (rev 85095)
@@ -0,0 +1,270 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Drawing;
+using System.Data;
+using System.Text;
+using System.Windows.Forms;
+using System.Drawing.Design;
+
+namespace mwf_designer
+{
+ public class ToolBoxList : Panel, IToolboxService
+ {
+ #region Fields
+ private Dictionary<string, ToolBoxGroupPanel> group_panels =
new Dictionary<string,ToolBoxGroupPanel> ();
+ #endregion
+
+ #region Public Constructors
+ public ToolBoxList ()
+ {
+ AutoScroll = true;
+ }
+ #endregion
+
+ #region Public Methods
+ public void Clear ()
+ {
+ group_panels.Clear ();
+ Controls.Clear ();
+ }
+ #endregion
+
+ #region Protected Methods
+ protected override void OnControlAdded (ControlEventArgs e)
+ {
+ base.OnControlAdded (e);
+
+ if (e.Control is ToolBoxGroupPanel) {
+ ToolBoxGroupPanel gp =
(ToolBoxGroupPanel)e.Control;
+ gp.Dock = DockStyle.Top;
+ gp.Visible = true;
+
+ group_panels.Add (gp.Text, gp);
+ }
+ }
+
+ protected override void OnControlRemoved (ControlEventArgs e)
+ {
+ base.OnControlRemoved (e);
+
+ if (e.Control is ToolBoxGroupPanel) {
+ ToolBoxGroupPanel gp =
(ToolBoxGroupPanel)e.Control;
+
+ group_panels.Remove (gp.Text);
+ }
+ }
+
+ protected virtual void OnToolPicked (EventArgs e)
+ {
+ EventHandler eh =
(EventHandler)(Events[ToolPickedEvent]);
+ if (eh != null)
+ eh (this, e);
+ }
+ #endregion
+
+ #region Private Methods
+ private void ClearSelected (ToolBoxListItem item)
+ {
+ foreach (ToolBoxGroupPanel p in group_panels.Values)
+ foreach (ToolBoxListItem i in p.Items)
+ if (i != item)
+ i.Selected = false;
+ }
+
+ private void item_Click (object sender, EventArgs e)
+ {
+ ClearSelected ((ToolBoxListItem)sender);
+
+ OnToolPicked (e);
+ }
+ #endregion
+
+ #region Public Events
+ static object ToolPickedEvent = new object ();
+
+ public event EventHandler ToolPicked {
+ add { Events.AddHandler (ToolPickedEvent, value); }
+ remove { Events.RemoveHandler (ToolPickedEvent, value);
}
+ }
+ #endregion
+
+ #region IToolboxService implementation
+ public CategoryNameCollection CategoryNames {
+ get {
+ List<string> categories = new List<string> ();
+
+ foreach (string s in group_panels.Keys)
+ categories.Add (s);
+
+ CategoryNameCollection cnc = new
CategoryNameCollection (categories.ToArray ());
+
+ return cnc;
+ }
+ }
+
+ public string SelectedCategory
+ {
+ get { return null; }
+ set { }
+ }
+
+ public void AddCreator
(System.Drawing.Design.ToolboxItemCreatorCallback creator, string format,
System.ComponentModel.Design.IDesignerHost host)
+ {
+ }
+
+ public void AddCreator
(System.Drawing.Design.ToolboxItemCreatorCallback creator, string format)
+ {
+ }
+
+ public void AddLinkedToolboxItem
(System.Drawing.Design.ToolboxItem toolboxItem, string category,
System.ComponentModel.Design.IDesignerHost host)
+ {
+ }
+
+ public void AddLinkedToolboxItem
(System.Drawing.Design.ToolboxItem toolboxItem,
System.ComponentModel.Design.IDesignerHost host)
+ {
+ }
+
+ public void AddToolboxItem (System.Drawing.Design.ToolboxItem
toolboxItem, string category)
+ {
+ ToolBoxListItem item = new ToolBoxListItem
(toolboxItem);
+
+ if (!group_panels.ContainsKey (category)) {
+ ToolBoxGroupPanel gp = new ToolBoxGroupPanel ();
+ gp.Text = category;
+
+ Controls.Add (gp);
+ }
+
+ item.Click += new EventHandler (item_Click);
+ group_panels[category].Items.Add (item);
+ }
+
+ public void AddToolboxItem (System.Drawing.Design.ToolboxItem
toolboxItem)
+ {
+ AddToolboxItem (toolboxItem, "All Controls");
+ }
+
+ public System.Drawing.Design.ToolboxItem DeserializeToolboxItem
(object serializedObject, System.ComponentModel.Design.IDesignerHost host)
+ {
+ return null;
+ }
+
+ public System.Drawing.Design.ToolboxItem DeserializeToolboxItem
(object serializedObject)
+ {
+ return null;
+ }
+
+ public System.Drawing.Design.ToolboxItem GetSelectedToolboxItem
(System.ComponentModel.Design.IDesignerHost host)
+ {
+ return this.GetSelectedToolboxItem ();
+ }
+
+ public System.Drawing.Design.ToolboxItem GetSelectedToolboxItem
()
+ {
+ foreach (ToolBoxGroupPanel p in group_panels.Values)
+ foreach (ToolBoxListItem i in p.Items)
+ if (i.Selected)
+ return i.ToolBoxItem;
+
+ return null;
+ }
+
+ public System.Drawing.Design.ToolboxItemCollection
GetToolboxItems (string category, System.ComponentModel.Design.IDesignerHost
host)
+ {
+ return this.GetToolboxItems ();
+ }
+
+ public System.Drawing.Design.ToolboxItemCollection
GetToolboxItems (string category)
+ {
+ List<ToolboxItem> items = new List<ToolboxItem> ();
+
+ ToolBoxGroupPanel p = group_panels[category];
+
+ foreach (ToolBoxListItem i in p.Items)
+ items.Add (i.ToolBoxItem);
+
+ return new ToolboxItemCollection (items.ToArray ());
+ }
+
+ public System.Drawing.Design.ToolboxItemCollection
GetToolboxItems (System.ComponentModel.Design.IDesignerHost host)
+ {
+ return this.GetToolboxItems ();
+ }
+
+ public System.Drawing.Design.ToolboxItemCollection
GetToolboxItems ()
+ {
+ List<ToolboxItem> items = new List<ToolboxItem> ();
+
+ foreach (ToolBoxGroupPanel p in group_panels.Values)
+ foreach (ToolBoxListItem i in p.Items)
+ items.Add (i.ToolBoxItem);
+
+ return new ToolboxItemCollection (items.ToArray ());
+ }
+
+ public bool IsSupported (object serializedObject,
System.Collections.ICollection filterAttributes)
+ {
+ return false;
+ }
+
+ public bool IsSupported (object serializedObject,
System.ComponentModel.Design.IDesignerHost host)
+ {
+ return false;
+ }
+
+ public bool IsToolboxItem (object serializedObject,
System.ComponentModel.Design.IDesignerHost host)
+ {
+ return false;
+ }
+
+ public bool IsToolboxItem (object serializedObject)
+ {
+ return false;
+ }
+
+ public void RemoveCreator (string format,
System.ComponentModel.Design.IDesignerHost host)
+ {
+ }
+
+ public void RemoveCreator (string format)
+ {
+ }
+
+ public void RemoveToolboxItem
(System.Drawing.Design.ToolboxItem toolboxItem, string category)
+ {
+ this.RemoveToolboxItem (toolboxItem);
+ }
+
+ public void RemoveToolboxItem
(System.Drawing.Design.ToolboxItem toolboxItem)
+ {
+ //_toolbox.Items.Remove (toolboxItem);
+ }
+
+ public void SelectedToolboxItemUsed ()
+ {
+ ClearSelected (null);
+ }
+
+ public object SerializeToolboxItem
(System.Drawing.Design.ToolboxItem toolboxItem)
+ {
+ return null;
+ }
+
+ public bool SetCursor ()
+ {
+ return false;
+ }
+
+ public void SetSelectedToolboxItem
(System.Drawing.Design.ToolboxItem toolboxItem)
+ {
+ foreach (ToolBoxGroupPanel p in group_panels.Values)
+ foreach (ToolBoxListItem i in p.Items)
+ if (i.ToolBoxItem == toolboxItem) {
+ i.Selected = true;
+ break;
+ }
+ }
+ #endregion
+ }
+}
Added: trunk/mwf-designer/src/UI/ToolBoxList/ToolBoxListItem.cs
===================================================================
--- trunk/mwf-designer/src/UI/ToolBoxList/ToolBoxListItem.cs 2007-08-31
11:30:58 UTC (rev 85094)
+++ trunk/mwf-designer/src/UI/ToolBoxList/ToolBoxListItem.cs 2007-08-31
11:42:57 UTC (rev 85095)
@@ -0,0 +1,143 @@
+//
+// Authors:
+// Jonathan Pobst ([EMAIL PROTECTED]>)
+//
+// (C) 2007 Jonathan Pobst
+
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+using System.Drawing;
+using System.Windows.Forms;
+using System.Drawing.Design;
+
+namespace mwf_designer
+{
+ public class ToolBoxListItem : UserControl
+ {
+ #region Fields
+ private bool hover;
+ private Image image;
+ private bool selected;
+ private ToolboxItem tool_box_item;
+ #endregion
+
+ #region Public Constructor
+ public ToolBoxListItem (ToolboxItem toolBoxItem)
+ {
+ Size = new Size (150, 20);
+
+ SetStyle (ControlStyles.ResizeRedraw, true);
+
+ Text = toolBoxItem.DisplayName;
+
+ if (toolBoxItem.Bitmap != null)
+ image = toolBoxItem.Bitmap;
+ else
+ image = SystemIcons.Exclamation.ToBitmap ();
+
+ tool_box_item = toolBoxItem;
+ }
+ #endregion
+
+ #region Public Properties
+ public bool Selected {
+ get { return selected; }
+ set {
+ if (selected != value) {
+ selected = value;
+ Invalidate ();
+ }
+ }
+ }
+
+ public ToolboxItem ToolBoxItem {
+ get { return tool_box_item; }
+ }
+ #endregion
+
+ #region Public Methods
+ public void Deselect ()
+ {
+ if (selected) {
+ selected = false;
+ Invalidate ();
+ }
+ }
+ #endregion
+
+ #region Protected Methods
+ protected override void OnClick (EventArgs e)
+ {
+ selected = true;
+ Invalidate ();
+
+ base.OnClick (e);
+ }
+
+ protected override void OnMouseEnter (EventArgs e)
+ {
+ base.OnMouseEnter (e);
+
+ hover = true;
+ Invalidate ();
+ }
+
+ protected override void OnMouseLeave (EventArgs e)
+ {
+ base.OnMouseLeave (e);
+
+ hover = false;
+ Invalidate ();
+ }
+
+ protected override void OnPaintBackground (PaintEventArgs e)
+ {
+ base.OnPaintBackground (e);
+
+ if (hover) {
+ using (SolidBrush b = new SolidBrush
(ProfessionalColors.ButtonPressedGradientMiddle))
+ e.Graphics.FillRectangle (b,
ClientRectangle);
+
+ using (Pen p = new Pen
(ProfessionalColors.ButtonPressedHighlightBorder))
+ e.Graphics.DrawRectangle (p, new
Rectangle (0, 0, Width - 1, Height - 1));
+ } else if (selected) {
+ using (SolidBrush b = new SolidBrush
(ProfessionalColors.ButtonSelectedGradientMiddle))
+ e.Graphics.FillRectangle (b,
ClientRectangle);
+
+ using (Pen p = new Pen
(ProfessionalColors.ButtonSelectedHighlightBorder))
+ e.Graphics.DrawRectangle (p, new
Rectangle (0, 0, Width - 1, Height - 1));
+ }
+ }
+
+ protected override void OnPaint (PaintEventArgs e)
+ {
+ base.OnPaint (e);
+
+ if (image != null)
+ e.Graphics.DrawImage (image, new Rectangle (2,
2, 16, 16));
+
+ TextRenderer.DrawText (e.Graphics, Text, Font, new
Rectangle (20, 1, Width - 21, Height - 2), Color.Black, TextFormatFlags.Left |
TextFormatFlags.VerticalCenter | TextFormatFlags.SingleLine);
+ }
+ #endregion
+ }
+}
Deleted: trunk/mwf-designer/src/UI/Toolbox.Designer.cs
===================================================================
--- trunk/mwf-designer/src/UI/Toolbox.Designer.cs 2007-08-31 11:30:58 UTC
(rev 85094)
+++ trunk/mwf-designer/src/UI/Toolbox.Designer.cs 2007-08-31 11:42:57 UTC
(rev 85095)
@@ -1,71 +0,0 @@
-namespace mwf_designer
-{
- partial class Toolbox
- {
- /// <summary>
- /// Required designer variable.
- /// </summary>
- private System.ComponentModel.IContainer components = null;
-
- /// <summary>
- /// Clean up any resources being used.
- /// </summary>
- /// <param name="disposing">true if managed resources should be
disposed; otherwise, false.</param>
- protected override void Dispose(bool disposing)
- {
- if (disposing && (components != null))
- {
- components.Dispose();
- }
- base.Dispose(disposing);
- }
-
- #region Component Designer generated code
-
- /// <summary>
- /// Required method for Designer support - do not modify
- /// the contents of this method with the code editor.
- /// </summary>
- private void InitializeComponent()
- {
- this._filterTextBox = new System.Windows.Forms.TextBox();
- this._toolbox = new System.Windows.Forms.ListBox();
- this.SuspendLayout();
- //
- // _filterTextBox
- //
- this._filterTextBox.Dock = System.Windows.Forms.DockStyle.Top;
- this._filterTextBox.Location = new System.Drawing.Point(0, 0);
- this._filterTextBox.Name = "_filterTextBox";
- this._filterTextBox.Size = new System.Drawing.Size(209, 20);
- this._filterTextBox.TabIndex = 0;
- //
- // _toolbox
- //
- this._toolbox.BorderStyle =
System.Windows.Forms.BorderStyle.FixedSingle;
- this._toolbox.Dock = System.Windows.Forms.DockStyle.Fill;
- this._toolbox.FormattingEnabled = true;
- this._toolbox.Location = new System.Drawing.Point(0, 20);
- this._toolbox.Name = "_toolbox";
- this._toolbox.Size = new System.Drawing.Size(209, 340);
- this._toolbox.TabIndex = 1;
- //
- // Toolbox
- //
- this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
- this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
- this.Controls.Add(this._toolbox);
- this.Controls.Add(this._filterTextBox);
- this.Name = "Toolbox";
- this.Size = new System.Drawing.Size(209, 360);
- this.ResumeLayout(false);
- this.PerformLayout();
-
- }
-
- #endregion
-
- private System.Windows.Forms.TextBox _filterTextBox;
- private System.Windows.Forms.ListBox _toolbox;
- }
-}
Deleted: trunk/mwf-designer/src/UI/Toolbox.cs
===================================================================
--- trunk/mwf-designer/src/UI/Toolbox.cs 2007-08-31 11:30:58 UTC (rev
85094)
+++ trunk/mwf-designer/src/UI/Toolbox.cs 2007-08-31 11:42:57 UTC (rev
85095)
@@ -1,175 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.ComponentModel;
-using System.ComponentModel.Design;
-using System.Drawing;
-using System.Drawing.Design;
-using System.Data;
-using System.Text;
-using System.Windows.Forms;
-
-namespace mwf_designer
-{
- internal partial class Toolbox : UserControl, IToolboxService
- {
-
- public Toolbox ()
- {
- InitializeComponent ();
- this._toolbox.SelectedIndexChanged +=
OnToolbox_SelectedIndexChanged;
- }
-
- private void OnToolbox_SelectedIndexChanged (object sender,
EventArgs args)
- {
- if (_toolbox.SelectedIndex != -1) {
- if (ToolPicked != null)
- ToolPicked (this, EventArgs.Empty);
- }
- }
-
- public event EventHandler ToolPicked;
-
- public void Clear ()
- {
- _toolbox.Items.Clear ();
- }
-
-#region IToolboxService implementation
-
- public System.Drawing.Design.CategoryNameCollection
CategoryNames {
- get { return null; }
- }
-
- public string SelectedCategory {
- get { return null; }
- set { }
- }
-
- public void AddCreator
(System.Drawing.Design.ToolboxItemCreatorCallback creator, string format,
System.ComponentModel.Design.IDesignerHost host)
- {
- }
-
- public void AddCreator
(System.Drawing.Design.ToolboxItemCreatorCallback creator, string format)
- {
- }
-
- public void AddLinkedToolboxItem
(System.Drawing.Design.ToolboxItem toolboxItem, string category,
System.ComponentModel.Design.IDesignerHost host)
- {
- }
-
- public void AddLinkedToolboxItem
(System.Drawing.Design.ToolboxItem toolboxItem,
System.ComponentModel.Design.IDesignerHost host)
- {
- }
-
- public void AddToolboxItem (System.Drawing.Design.ToolboxItem
toolboxItem, string category)
- {
- this.AddToolboxItem (toolboxItem);
- }
-
- public void AddToolboxItem (System.Drawing.Design.ToolboxItem
toolboxItem)
- {
- _toolbox.Items.Add (toolboxItem);
- }
-
- public System.Drawing.Design.ToolboxItem DeserializeToolboxItem
(object serializedObject, System.ComponentModel.Design.IDesignerHost host)
- {
- return null;
- }
-
- public System.Drawing.Design.ToolboxItem DeserializeToolboxItem
(object serializedObject)
- {
- return null;
- }
-
- public System.Drawing.Design.ToolboxItem GetSelectedToolboxItem
(System.ComponentModel.Design.IDesignerHost host)
- {
- return this.GetSelectedToolboxItem ();
- }
-
- public System.Drawing.Design.ToolboxItem GetSelectedToolboxItem
()
- {
- return (ToolboxItem)_toolbox.SelectedItem;
- }
-
- public System.Drawing.Design.ToolboxItemCollection
GetToolboxItems (string category, System.ComponentModel.Design.IDesignerHost
host)
- {
- return this.GetToolboxItems ();
- }
-
- public System.Drawing.Design.ToolboxItemCollection
GetToolboxItems (string category)
- {
- return this.GetToolboxItems ();
- }
-
- public System.Drawing.Design.ToolboxItemCollection
GetToolboxItems (System.ComponentModel.Design.IDesignerHost host)
- {
- return this.GetToolboxItems ();
- }
-
- public System.Drawing.Design.ToolboxItemCollection
GetToolboxItems ()
- {
- ToolboxItem[] items = new
ToolboxItem[_toolbox.Items.Count];
- _toolbox.Items.CopyTo (items, 0);
- return new ToolboxItemCollection (items);
- }
-
- public bool IsSupported (object serializedObject,
System.Collections.ICollection filterAttributes)
- {
- return false;
- }
-
- public bool IsSupported (object serializedObject,
System.ComponentModel.Design.IDesignerHost host)
- {
- return false;
- }
-
- public bool IsToolboxItem (object serializedObject,
System.ComponentModel.Design.IDesignerHost host)
- {
- return false;
- }
-
- public bool IsToolboxItem (object serializedObject)
- {
- return false;
- }
-
- public void RemoveCreator (string format,
System.ComponentModel.Design.IDesignerHost host)
- {
- }
-
- public void RemoveCreator (string format)
- {
- }
-
- public void RemoveToolboxItem
(System.Drawing.Design.ToolboxItem toolboxItem, string category)
- {
- this.RemoveToolboxItem (toolboxItem);
- }
-
- public void RemoveToolboxItem
(System.Drawing.Design.ToolboxItem toolboxItem)
- {
- _toolbox.Items.Remove (toolboxItem);
- }
-
- public void SelectedToolboxItemUsed ()
- {
- _toolbox.SelectedIndex = -1;
- }
-
- public object SerializeToolboxItem
(System.Drawing.Design.ToolboxItem toolboxItem)
- {
- return null;
- }
-
- public bool SetCursor ()
- {
- return false;
- }
-
- public void SetSelectedToolboxItem
(System.Drawing.Design.ToolboxItem toolboxItem)
- {
- _toolbox.SelectedItem = toolboxItem;
- }
-#endregion
- }
-}
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches