Author: ivanz
Date: 2007-09-02 13:25:21 -0400 (Sun, 02 Sep 2007)
New Revision: 85198
Modified:
trunk/mwf-designer/ChangeLog
trunk/mwf-designer/src/Project/Workspace.cs
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
Log:
2007-09-02 Ivan N. Zlatev <[EMAIL PROTECTED]>
* UI/ToolBoxList/*.cs: spaces to tabs.
Modified: trunk/mwf-designer/ChangeLog
===================================================================
--- trunk/mwf-designer/ChangeLog 2007-09-02 15:57:27 UTC (rev 85197)
+++ trunk/mwf-designer/ChangeLog 2007-09-02 17:25:21 UTC (rev 85198)
@@ -1,5 +1,9 @@
2007-09-02 Ivan N. Zlatev <[EMAIL PROTECTED]>
+ * UI/ToolBoxList/*.cs: spaces to tabs.
+
+2007-09-02 Ivan N. Zlatev <[EMAIL PROTECTED]>
+
* UI/ToolBoxList/ToolBoxGroupHeader.cs: Make categories more
visually recognizable.
Modified: trunk/mwf-designer/src/Project/Workspace.cs
===================================================================
--- trunk/mwf-designer/src/Project/Workspace.cs 2007-09-02 15:57:27 UTC (rev
85197)
+++ trunk/mwf-designer/src/Project/Workspace.cs 2007-09-02 17:25:21 UTC (rev
85198)
@@ -156,12 +156,16 @@
{
List<ToolboxItem> list = new List<ToolboxItem>();
- foreach (Assembly assembly in _references.Assemblies)
- foreach (Type type in assembly.GetTypes())
- if (IsValidToolType (type) &&
HasPublicEmptyCtor (type))
- list.Add (new ToolboxItem
(type));
+ foreach (Assembly assembly in _references.Assemblies) {
+ foreach (Type type in assembly.GetTypes()) {
+ if (IsValidToolType (type) &&
HasPublicEmptyCtor (type)) {
+ ToolboxItem tool = new
ToolboxItem (type);
+ tool.Properties["Category"] =
"All";
+ list.Add (tool);
+ }
+ }
+ }
-
foreach (Type type in commonComponents) {
ToolboxItem tool = new ToolboxItem (type);
tool.Properties["Category"] = "Common
Components";
Modified: trunk/mwf-designer/src/UI/ToolBoxList/ToolBoxGroupHeader.cs
===================================================================
--- trunk/mwf-designer/src/UI/ToolBoxList/ToolBoxGroupHeader.cs 2007-09-02
15:57:27 UTC (rev 85197)
+++ trunk/mwf-designer/src/UI/ToolBoxList/ToolBoxGroupHeader.cs 2007-09-02
17:25:21 UTC (rev 85198)
@@ -29,94 +29,95 @@
using System.Drawing;
using System.Windows.Forms;
-namespace mwf_designer
+namespace mwf_designer
{
- public class ToolBoxGroupHeader : UserControl
- {
- #region Fields
- private bool expanded = true;
- #endregion
+ public class ToolBoxGroupHeader : UserControl
+ {
- #region Public Constructor
- public ToolBoxGroupHeader ()
- {
- Size = new Size (200, 20);
- SetStyle (ControlStyles.ResizeRedraw, true);
- BackColor = SystemColors.ControlDark;
- Font = new Font (this.Font,
FontStyle.Bold);
- }
- #endregion
+#region Fields
+ private bool expanded = true;
+#endregion
- #region Public Properties
- public bool Expanded {
- get { return expanded; }
- set {
- if (expanded != value) {
- expanded = value;
- Invalidate ();
- }
- }
- }
- #endregion
+#region Public Constructor
+ public ToolBoxGroupHeader ()
+ {
+ Size = new Size (200, 20);
+ SetStyle (ControlStyles.ResizeRedraw, true);
+ BackColor = SystemColors.ControlDark;
+ Font = new Font (this.Font, FontStyle.Bold);
+ }
+#endregion
- #region Protected Methods
- protected override void OnClick (EventArgs e)
- {
- base.OnClick (e);
+#region Public Properties
+ public bool Expanded {
+ get { return expanded;}
+ set {
+ if (expanded != value) {
+ expanded = value;
+ Invalidate ();
+ }
+ }
+ }
+#endregion
- Expanded = !expanded;
- OnExpandedChanged (EventArgs.Empty);
- }
+#region Protected Methods
+ protected override void OnClick (EventArgs e)
+ {
+ base.OnClick (e);
- protected virtual void OnExpandedChanged (EventArgs e)
- {
- EventHandler eh =
(EventHandler)(Events[ExpandedChangedEvent]);
- if (eh != null)
- eh (this, e);
- }
+ Expanded = !expanded;
+ OnExpandedChanged (EventArgs.Empty);
+ }
- protected override void OnPaint (PaintEventArgs e)
- {
- base.OnPaint (e);
+ protected virtual void OnExpandedChanged (EventArgs e)
+ {
+ EventHandler eh =
(EventHandler)(Events[ExpandedChangedEvent]);
+ if (eh != null)
+ eh (this, e);
+ }
- Graphics g = e.Graphics;
+ protected override void OnPaint (PaintEventArgs e)
+ {
+ base.OnPaint (e);
- g.Clear (BackColor);
+ Graphics g = e.Graphics;
- if (expanded)
- DrawDownChevron (g, new Point (7, 8),
Pens.LightGray);
- else
- DrawRightChevron (g, new Point (10, 5),
Pens.LightGray);
+ g.Clear (BackColor);
- TextRenderer.DrawText (g, Text, Font, new Point (18,
2), Color.White);
- }
- #endregion
+ if (expanded)
+ DrawDownChevron (g, new Point (7, 8),
Pens.LightGray);
+ else
+ DrawRightChevron (g, new Point (10, 5),
Pens.LightGray);
- #region Public Events
- static object ExpandedChangedEvent = new object ();
+ TextRenderer.DrawText (g, Text, Font, new Point (18,
2), Color.White);
+ }
+#endregion
- public event EventHandler ExpandedChanged {
- add { Events.AddHandler (ExpandedChangedEvent, value); }
- remove { Events.RemoveHandler (ExpandedChangedEvent,
value); }
- }
- #endregion
+#region Public Events
+ static object ExpandedChangedEvent = new object ();
- #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);
- }
+ public event EventHandler ExpandedChanged {
+ add { Events.AddHandler (ExpandedChangedEvent, value);}
+ remove { Events.RemoveHandler (ExpandedChangedEvent,
value);}
+ }
+#endregion
- 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
- }
+#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
+ }
}
Modified: trunk/mwf-designer/src/UI/ToolBoxList/ToolBoxGroupPanel.cs
===================================================================
--- trunk/mwf-designer/src/UI/ToolBoxList/ToolBoxGroupPanel.cs 2007-09-02
15:57:27 UTC (rev 85197)
+++ trunk/mwf-designer/src/UI/ToolBoxList/ToolBoxGroupPanel.cs 2007-09-02
17:25:21 UTC (rev 85198)
@@ -29,122 +29,123 @@
using System.Drawing;
using System.Windows.Forms;
-namespace mwf_designer
+namespace mwf_designer
{
- public class ToolBoxGroupPanel : UserControl
- {
- #region Fields
- private ToolBoxGroupHeader GroupHeader1;
- private Panel ItemPanel;
- #endregion
+ public class ToolBoxGroupPanel : UserControl
+ {
- #region Public Constructor
- public ToolBoxGroupPanel ()
- {
- ItemPanel = new Panel ();
- GroupHeader1 = new ToolBoxGroupHeader ();
- SuspendLayout ();
+#region Fields
+ private ToolBoxGroupHeader GroupHeader1;
+ private Panel ItemPanel;
+#endregion
- //
- // 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;
+#region Public Constructor
+ public ToolBoxGroupPanel ()
+ {
+ ItemPanel = new Panel ();
+ GroupHeader1 = new ToolBoxGroupHeader ();
+ SuspendLayout ();
- 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);
+ //
+ // 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;
- GroupHeader1.ExpandedChanged += new EventHandler
(GroupHeader1_ExpandedChanged);
- ItemPanel.ControlAdded += new ControlEventHandler
(ItemPanel_ControlAdded);
- Layout += new LayoutEventHandler
(ToolBoxGroupPanel_Layout);
- }
- #endregion
+ 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);
- #region Public Properties
- public bool Expanded {
- get { return GroupHeader1.Expanded; }
- set {
- if (GroupHeader1.Expanded != value) {
- GroupHeader1.Expanded = value;
- PerformLayout ();
- }
- }
- }
+ GroupHeader1.ExpandedChanged += new EventHandler
(GroupHeader1_ExpandedChanged);
+ ItemPanel.ControlAdded += new ControlEventHandler
(ItemPanel_ControlAdded);
+ Layout += new LayoutEventHandler
(ToolBoxGroupPanel_Layout);
+ }
+#endregion
- public ControlCollection Items {
- get { return ItemPanel.Controls; }
- }
+#region Public Properties
+ public bool Expanded {
+ get { return GroupHeader1.Expanded;}
+ set {
+ if (GroupHeader1.Expanded != value) {
+ GroupHeader1.Expanded = value;
+ PerformLayout ();
+ }
+ }
+ }
- public override string Text {
- get { return GroupHeader1.Text; }
- set { GroupHeader1.Text = value; }
- }
- #endregion
+ public ControlCollection Items {
+ get { return ItemPanel.Controls;}
+ }
- #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;
+ public override string Text {
+ get { return GroupHeader1.Text;}
+ set { GroupHeader1.Text = value;}
+ }
+#endregion
- foreach (Control c in Items)
- if (c.Enabled)
- y += c.Height;
+#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;
- if (y == 0)
- Visible = false;
- else
- Visible = true;
+ foreach (Control c in Items)
+ if (c.Enabled)
+ y += c.Height;
- Height = y + GroupHeader1.Height + 1;
- } else {
- Height = GroupHeader1.Bottom;
- }
- }
+ if (y == 0)
+ Visible = false;
+ else
+ Visible = true;
- private void ItemPanel_ControlAdded (object sender,
ControlEventArgs e)
- {
- // Sort incoming items
- ToolBoxListItem new_tbi = (ToolBoxListItem)e.Control;
+ Height = y + GroupHeader1.Height + 1;
+ } else {
+ Height = GroupHeader1.Bottom;
+ }
+ }
- foreach (Control c in ItemPanel.Controls) {
- ToolBoxListItem tbi = c as ToolBoxListItem;
+ private void ItemPanel_ControlAdded (object sender,
ControlEventArgs e)
+ {
+ // Sort incoming items
+ ToolBoxListItem new_tbi = (ToolBoxListItem)e.Control;
- if (tbi == null)
- continue;
+ foreach (Control c in ItemPanel.Controls) {
+ ToolBoxListItem tbi = c as ToolBoxListItem;
- if (string.Compare (new_tbi.Text, tbi.Text) >
0) {
- ItemPanel.Controls.SetChildIndex
(new_tbi, ItemPanel.Controls.GetChildIndex (tbi));
- break;
- }
- }
+ if (tbi == null)
+ continue;
- e.Control.Dock = DockStyle.Top;
- }
+ if (string.Compare (new_tbi.Text, tbi.Text) >
0) {
+ ItemPanel.Controls.SetChildIndex
(new_tbi, ItemPanel.Controls.GetChildIndex (tbi));
+ break;
+ }
+ }
- private void GroupHeader1_ExpandedChanged (object sender,
EventArgs e)
- {
- PerformLayout ();
- }
- #endregion
- }
+ e.Control.Dock = DockStyle.Top;
+ }
+
+ private void GroupHeader1_ExpandedChanged (object sender,
EventArgs e)
+ {
+ PerformLayout ();
+ }
+#endregion
+ }
}
Modified: trunk/mwf-designer/src/UI/ToolBoxList/ToolBoxList.cs
===================================================================
--- trunk/mwf-designer/src/UI/ToolBoxList/ToolBoxList.cs 2007-09-02
15:57:27 UTC (rev 85197)
+++ trunk/mwf-designer/src/UI/ToolBoxList/ToolBoxList.cs 2007-09-02
17:25:21 UTC (rev 85198)
@@ -34,264 +34,264 @@
using System.Windows.Forms;
using System.Drawing.Design;
-namespace mwf_designer
+namespace mwf_designer
{
- public class ToolBoxList : Panel, IToolboxService
- {
- #region Fields
- private Dictionary<string, ToolBoxGroupPanel> group_panels =
new Dictionary<string,ToolBoxGroupPanel> ();
- #endregion
+ public class ToolBoxList : Panel, IToolboxService
+ {
- #region Public Constructors
- public ToolBoxList ()
- {
- AutoScroll = true;
- }
- #endregion
+#region Fields
+ private Dictionary<string, ToolBoxGroupPanel> group_panels =
new Dictionary<string,ToolBoxGroupPanel> ();
+#endregion
- #region Public Methods
- public void Clear ()
- {
- group_panels.Clear ();
- Controls.Clear ();
- }
- #endregion
+#region Public Constructors
+ public ToolBoxList ()
+ {
+ AutoScroll = true;
+ }
+#endregion
- #region Protected Methods
- protected override void OnControlAdded (ControlEventArgs e)
- {
- base.OnControlAdded (e);
+#region Public Methods
+ public void Clear ()
+ {
+ group_panels.Clear ();
+ Controls.Clear ();
+ }
+#endregion
- if (e.Control is ToolBoxGroupPanel) {
- ToolBoxGroupPanel gp =
(ToolBoxGroupPanel)e.Control;
- gp.Dock = DockStyle.Top;
- gp.Visible = true;
+#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);
+ }
+ }
- group_panels.Add (gp.Text, gp);
- }
- }
+ protected override void OnControlRemoved (ControlEventArgs e)
+ {
+ base.OnControlRemoved (e);
- protected override void OnControlRemoved (ControlEventArgs e)
- {
- base.OnControlRemoved (e);
+ if (e.Control is ToolBoxGroupPanel) {
+ ToolBoxGroupPanel gp =
(ToolBoxGroupPanel)e.Control;
- if (e.Control is ToolBoxGroupPanel) {
- ToolBoxGroupPanel gp =
(ToolBoxGroupPanel)e.Control;
+ group_panels.Remove (gp.Text);
+ }
+ }
- group_panels.Remove (gp.Text);
- }
- }
+ protected virtual void OnToolPicked (EventArgs e)
+ {
+ EventHandler eh =
(EventHandler)(Events[ToolPickedEvent]);
+ if (eh != null)
+ eh (this, e);
+ }
+#endregion
- 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;
+ }
- #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);
- private void item_Click (object sender, EventArgs e)
- {
- ClearSelected ((ToolBoxListItem)sender);
+ OnToolPicked (e);
+ }
+#endregion
- OnToolPicked (e);
- }
- #endregion
+#region Public Events
+ static object ToolPickedEvent = new object ();
- #region Public Events
- static object ToolPickedEvent = new object ();
+ public event EventHandler ToolPicked {
+ add { Events.AddHandler (ToolPickedEvent, value);}
+ remove { Events.RemoveHandler (ToolPickedEvent, value);}
+ }
+#endregion
- 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> ();
- #region IToolboxService implementation
- public CategoryNameCollection CategoryNames {
- get {
- List<string> categories = new List<string> ();
+ foreach (string s in group_panels.Keys)
+ categories.Add (s);
- foreach (string s in group_panels.Keys)
- categories.Add (s);
+ CategoryNameCollection cnc = new
CategoryNameCollection (categories.ToArray ());
- CategoryNameCollection cnc = new
CategoryNameCollection (categories.ToArray ());
+ return cnc;
+ }
+ }
- return cnc;
- }
- }
+ public string SelectedCategory
+ {
+ get { return null;}
+ set {}
+ }
- 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,
System.ComponentModel.Design.IDesignerHost host)
- {
- }
+ public void AddCreator
(System.Drawing.Design.ToolboxItemCreatorCallback creator, string format)
+ {
+ }
- 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, string category,
System.ComponentModel.Design.IDesignerHost host)
- {
- }
+ public void AddLinkedToolboxItem
(System.Drawing.Design.ToolboxItem toolboxItem,
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);
- 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);
+ }
- if (!group_panels.ContainsKey (category)) {
- ToolBoxGroupPanel gp = new ToolBoxGroupPanel ();
- gp.Text = category;
+ item.Click += new EventHandler (item_Click);
+ group_panels[category].Items.Add (item);
+ }
- Controls.Add (gp);
- }
+ public void AddToolboxItem (System.Drawing.Design.ToolboxItem
toolboxItem)
+ {
+ AddToolboxItem (toolboxItem, "All");
+ }
- item.Click += new EventHandler (item_Click);
- group_panels[category].Items.Add (item);
- }
+ public System.Drawing.Design.ToolboxItem DeserializeToolboxItem
(object serializedObject, System.ComponentModel.Design.IDesignerHost host)
+ {
+ return null;
+ }
- public void AddToolboxItem (System.Drawing.Design.ToolboxItem
toolboxItem)
- {
- AddToolboxItem (toolboxItem, "All");
- }
+ public System.Drawing.Design.ToolboxItem DeserializeToolboxItem
(object serializedObject)
+ {
+ return null;
+ }
- public System.Drawing.Design.ToolboxItem DeserializeToolboxItem
(object serializedObject, System.ComponentModel.Design.IDesignerHost host)
- {
- return null;
- }
+ public System.Drawing.Design.ToolboxItem GetSelectedToolboxItem
(System.ComponentModel.Design.IDesignerHost host)
+ {
+ return this.GetSelectedToolboxItem ();
+ }
- public System.Drawing.Design.ToolboxItem DeserializeToolboxItem
(object serializedObject)
- {
- return null;
- }
+ 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;
- public System.Drawing.Design.ToolboxItem GetSelectedToolboxItem
(System.ComponentModel.Design.IDesignerHost host)
- {
- return this.GetSelectedToolboxItem ();
- }
+ return null;
+ }
- 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;
+ public System.Drawing.Design.ToolboxItemCollection
GetToolboxItems (string category, System.ComponentModel.Design.IDesignerHost
host)
+ {
+ return this.GetToolboxItems ();
+ }
- return null;
- }
+ public System.Drawing.Design.ToolboxItemCollection
GetToolboxItems (string category)
+ {
+ List<ToolboxItem> items = new List<ToolboxItem> ();
- public System.Drawing.Design.ToolboxItemCollection
GetToolboxItems (string category, System.ComponentModel.Design.IDesignerHost
host)
- {
- return this.GetToolboxItems ();
- }
+ ToolBoxGroupPanel p = group_panels[category];
- public System.Drawing.Design.ToolboxItemCollection
GetToolboxItems (string category)
- {
- List<ToolboxItem> items = new List<ToolboxItem> ();
+ foreach (ToolBoxListItem i in p.Items)
+ items.Add (i.ToolBoxItem);
- ToolBoxGroupPanel p = group_panels[category];
+ return new ToolboxItemCollection (items.ToArray ());
+ }
- foreach (ToolBoxListItem i in p.Items)
- items.Add (i.ToolBoxItem);
+ public System.Drawing.Design.ToolboxItemCollection
GetToolboxItems (System.ComponentModel.Design.IDesignerHost host)
+ {
+ return this.GetToolboxItems ();
+ }
- return new ToolboxItemCollection (items.ToArray ());
- }
+ public System.Drawing.Design.ToolboxItemCollection
GetToolboxItems ()
+ {
+ List<ToolboxItem> items = new List<ToolboxItem> ();
- public System.Drawing.Design.ToolboxItemCollection
GetToolboxItems (System.ComponentModel.Design.IDesignerHost host)
- {
- return this.GetToolboxItems ();
- }
+ foreach (ToolBoxGroupPanel p in group_panels.Values)
+ foreach (ToolBoxListItem i in p.Items)
+ items.Add (i.ToolBoxItem);
- public System.Drawing.Design.ToolboxItemCollection
GetToolboxItems ()
- {
- List<ToolboxItem> items = new List<ToolboxItem> ();
+ return new ToolboxItemCollection (items.ToArray ());
+ }
- foreach (ToolBoxGroupPanel p in group_panels.Values)
- foreach (ToolBoxListItem i in p.Items)
- items.Add (i.ToolBoxItem);
+ public bool IsSupported (object serializedObject,
System.Collections.ICollection filterAttributes)
+ {
+ return false;
+ }
- return new ToolboxItemCollection (items.ToArray ());
- }
+ public bool IsSupported (object serializedObject,
System.ComponentModel.Design.IDesignerHost host)
+ {
+ return false;
+ }
- public bool IsSupported (object serializedObject,
System.Collections.ICollection filterAttributes)
- {
- return false;
- }
+ public bool IsToolboxItem (object serializedObject,
System.ComponentModel.Design.IDesignerHost host)
+ {
+ return false;
+ }
- public bool IsSupported (object serializedObject,
System.ComponentModel.Design.IDesignerHost host)
- {
- return false;
- }
+ public bool IsToolboxItem (object serializedObject)
+ {
+ return false;
+ }
- public bool IsToolboxItem (object serializedObject,
System.ComponentModel.Design.IDesignerHost host)
- {
- return false;
- }
+ public void RemoveCreator (string format,
System.ComponentModel.Design.IDesignerHost host)
+ {
+ }
- public bool IsToolboxItem (object serializedObject)
- {
- return false;
- }
+ public void RemoveCreator (string format)
+ {
+ }
- public void RemoveCreator (string format,
System.ComponentModel.Design.IDesignerHost host)
- {
- }
+ public void RemoveToolboxItem
(System.Drawing.Design.ToolboxItem toolboxItem, string category)
+ {
+ this.RemoveToolboxItem (toolboxItem);
+ }
- public void RemoveCreator (string format)
- {
- }
+ public void RemoveToolboxItem
(System.Drawing.Design.ToolboxItem toolboxItem)
+ {
+ //_toolbox.Items.Remove (toolboxItem);
+ }
- public void RemoveToolboxItem
(System.Drawing.Design.ToolboxItem toolboxItem, string category)
- {
- this.RemoveToolboxItem (toolboxItem);
- }
+ public void SelectedToolboxItemUsed ()
+ {
+ ClearSelected (null);
+ }
- public void RemoveToolboxItem
(System.Drawing.Design.ToolboxItem toolboxItem)
- {
- //_toolbox.Items.Remove (toolboxItem);
- }
+ public object SerializeToolboxItem
(System.Drawing.Design.ToolboxItem toolboxItem)
+ {
+ return null;
+ }
- public void SelectedToolboxItemUsed ()
- {
- ClearSelected (null);
- }
+ public bool SetCursor ()
+ {
+ return false;
+ }
- 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
- }
+ 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
+ }
}
Modified: trunk/mwf-designer/src/UI/ToolBoxList/ToolBoxListItem.cs
===================================================================
--- trunk/mwf-designer/src/UI/ToolBoxList/ToolBoxListItem.cs 2007-09-02
15:57:27 UTC (rev 85197)
+++ trunk/mwf-designer/src/UI/ToolBoxList/ToolBoxListItem.cs 2007-09-02
17:25:21 UTC (rev 85198)
@@ -30,114 +30,115 @@
using System.Windows.Forms;
using System.Drawing.Design;
-namespace mwf_designer
+namespace mwf_designer
{
- public class ToolBoxListItem : UserControl
- {
- #region Fields
- private bool hover;
- private Image image;
- private bool selected;
- private ToolboxItem tool_box_item;
- #endregion
+ public class ToolBoxListItem : UserControl
+ {
- #region Public Constructor
- public ToolBoxListItem (ToolboxItem toolBoxItem)
- {
- Size = new Size (150, 20);
+#region Fields
+ private bool hover;
+ private Image image;
+ private bool selected;
+ private ToolboxItem tool_box_item;
+#endregion
- SetStyle (ControlStyles.ResizeRedraw, true);
+#region Public Constructor
+ public ToolBoxListItem (ToolboxItem toolBoxItem)
+ {
+ Size = new Size (150, 20);
- Text = toolBoxItem.DisplayName;
+ SetStyle (ControlStyles.ResizeRedraw, true);
- if (toolBoxItem.Bitmap != null)
- image = toolBoxItem.Bitmap;
- else
- image = SystemIcons.Exclamation.ToBitmap ();
+ Text = toolBoxItem.DisplayName;
- tool_box_item = toolBoxItem;
- }
- #endregion
+ if (toolBoxItem.Bitmap != null)
+ image = toolBoxItem.Bitmap;
+ else
+ image = SystemIcons.Exclamation.ToBitmap ();
- #region Public Properties
- public bool Selected {
- get { return selected; }
- set {
- if (selected != value) {
- selected = value;
- Invalidate ();
- }
- }
- }
+ tool_box_item = toolBoxItem;
+ }
+#endregion
- public ToolboxItem ToolBoxItem {
- get { return tool_box_item; }
- }
- #endregion
+#region Public Properties
+ public bool Selected {
+ get { return selected;}
+ set {
+ if (selected != value) {
+ selected = value;
+ Invalidate ();
+ }
+ }
+ }
- #region Public Methods
- public void Deselect ()
- {
- if (selected) {
- selected = false;
- Invalidate ();
- }
- }
- #endregion
+ public ToolboxItem ToolBoxItem {
+ get { return tool_box_item;}
+ }
+#endregion
- #region Protected Methods
- protected override void OnClick (EventArgs e)
- {
- selected = true;
- Invalidate ();
+#region Public Methods
+ public void Deselect ()
+ {
+ if (selected) {
+ selected = false;
+ Invalidate ();
+ }
+ }
+#endregion
- base.OnClick (e);
- }
+#region Protected Methods
+ protected override void OnClick (EventArgs e)
+ {
+ selected = true;
+ Invalidate ();
- protected override void OnMouseEnter (EventArgs e)
- {
- base.OnMouseEnter (e);
+ base.OnClick (e);
+ }
- hover = true;
- Invalidate ();
- }
+ protected override void OnMouseEnter (EventArgs e)
+ {
+ base.OnMouseEnter (e);
- protected override void OnMouseLeave (EventArgs e)
- {
- base.OnMouseLeave (e);
+ hover = true;
+ Invalidate ();
+ }
- hover = false;
- Invalidate ();
- }
+ protected override void OnMouseLeave (EventArgs e)
+ {
+ base.OnMouseLeave (e);
- protected override void OnPaintBackground (PaintEventArgs e)
- {
- base.OnPaintBackground (e);
+ hover = false;
+ Invalidate ();
+ }
- if (hover) {
- using (SolidBrush b = new SolidBrush
(ProfessionalColors.ButtonPressedGradientMiddle))
- e.Graphics.FillRectangle (b,
ClientRectangle);
+ protected override void OnPaintBackground (PaintEventArgs e)
+ {
+ base.OnPaintBackground (e);
- 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);
+ if (hover) {
+ using (SolidBrush b = new SolidBrush
(ProfessionalColors.ButtonPressedGradientMiddle))
+ e.Graphics.FillRectangle (b, ClientRectangle);
- using (Pen p = new Pen
(ProfessionalColors.ButtonSelectedHighlightBorder))
- e.Graphics.DrawRectangle (p, new
Rectangle (0, 0, Width - 1, Height - 1));
- }
- }
+ 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);
- protected override void OnPaint (PaintEventArgs e)
- {
- base.OnPaint (e);
+ using (Pen p = new Pen
(ProfessionalColors.ButtonSelectedHighlightBorder))
+ e.Graphics.DrawRectangle (p, new Rectangle (0,
0, Width - 1, Height - 1));
+ }
+ }
- if (image != null)
- e.Graphics.DrawImage (image, new Rectangle (2,
2, 16, 16));
+ protected override void OnPaint (PaintEventArgs e)
+ {
+ base.OnPaint (e);
- TextRenderer.DrawText (e.Graphics, Text, Font, new
Rectangle (20, 1, Width - 21, Height - 2), Color.Black, TextFormatFlags.Left |
TextFormatFlags.VerticalCenter | TextFormatFlags.SingleLine);
- }
- #endregion
- }
+ 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
+ }
}
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches