* StatusStrip.cs: Layout fixes for PDN.
* ToolStrip.cs: Set item's available to true, and placement to main when
added.
* ToolStripItem.cs: Fix an Available issue, check that Parent is really
changing in setter before doing any work, add InternalVisible.
* ToolStripPanel.cs: Remove unused variable to fix compiler warning.
* ToolStripSplitStackLayout.cs: If we run out of things to hide, don't
infinite loop.
svn path=/trunk/mcs/; revision=75312
+2007-04-02 Jonathan Pobst <monkey@jpobst.com>
+
+ * StatusStrip.cs: Layout fixes for PDN.
+ * ToolStrip.cs: Set item's available to true, and placement to main when
+ added.
+ * ToolStripItem.cs: Fix an Available issue, check that Parent is really
+ changing in setter before doing any work, add InternalVisible.
+ * ToolStripPanel.cs: Remove unused variable to fix compiler warning.
+ * ToolStripSplitStackLayout.cs: If we run out of things to hide, don't
+ infinite loop.
+
2007-04-02 Jackson Harper <jackson@ximian.com>
* TextBox.cs: LBUTTON does not make the textbox select all of it's
protected virtual void OnSpringTableLayoutCore ()
{
- this.SetDisplayedItems ();
+ if (!this.Created)
+ return;
ToolStripItemOverflow[] overflow = new ToolStripItemOverflow[this.Items.Count];
ToolStripItemPlacement[] placement = new ToolStripItemPlacement[this.Items.Count];
overflow[i] = tsi.Overflow;
widths[i] = tsi.GetPreferredSize (proposedSize).Width + tsi.Margin.Horizontal;
placement[i] = tsi.Overflow == ToolStripItemOverflow.Always ? ToolStripItemPlacement.None : ToolStripItemPlacement.Main;
+ placement[i] = tsi.Available ? placement[i] : ToolStripItemPlacement.None;
total_width += placement[i] == ToolStripItemPlacement.Main ? widths[i] : 0;
if (tsi is ToolStripStatusLabel && (tsi as ToolStripStatusLabel).Spring)
spring_count++;
removed_one = true;
break;
}
+
+ // There's nothing left to remove, break or we will loop forever
+ if (!removed_one)
+ break;
}
if (spring_count > 0) {
}
i++;
- }
+ }
+
+ this.SetDisplayedItems ();
}
protected override void SetDisplayedItems ()
this.displayed_items.Clear ();
foreach (ToolStripItem tsi in this.Items)
- if (tsi.Available)
+ if (tsi.Placement == ToolStripItemPlacement.Main) {
this.displayed_items.AddNoOwnerOrLayout (tsi);
+ tsi.InternalVisible = true;
+ } else
+ tsi.InternalVisible = false;
}
protected override void WndProc (ref Message m)
protected internal virtual void OnItemAdded (ToolStripItemEventArgs e)
{
+ e.Item.Available = true;
+ e.Item.SetPlacement (ToolStripItemPlacement.Main);
this.DoAutoSize ();
this.PerformLayout ();
private bool allow_drop;
private ToolStripItemAlignment alignment;
private AnchorStyles anchor;
+ private bool available;
private bool auto_size;
private bool auto_tool_tip;
private Color back_color;
this.anchor = AnchorStyles.Left | AnchorStyles.Top;
this.auto_size = true;
this.auto_tool_tip = this.DefaultAutoToolTip;
+ this.available = true;
this.back_color = Control.DefaultBackColor;
this.background_image_layout = ImageLayout.Tile;
this.can_select = true;
[Browsable (false)]
[DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
public bool Available {
- get { return this.visible; }
+ get { return this.available; }
set {
- if (this.visible != value) {
+ if (this.available != value) {
+ available = value;
visible = value;
if (this.parent != null)
}
set {
if (this.visible != value) {
+ this.available = value;
this.SetVisibleCore (value);
}
}
protected internal ToolStrip Parent {
get { return this.parent; }
set {
- ToolStrip old_parent = this.parent;
- this.parent = value;
- OnParentChanged(old_parent, this.parent);
+ if (this.parent != value) {
+ ToolStrip old_parent = this.parent;
+ this.parent = value;
+ OnParentChanged(old_parent, this.parent);
+ }
}
}
protected internal virtual bool ShowKeyboardCues { get { return false; } }
this.placement = placement;
}
+ internal bool InternalVisible {
+ get { return this.visible; }
+ set { this.visible = value; }
+ }
+
internal Point Location {
get { return this.bounds.Location; }
set {
}
// Find how big we are so we can autosize ourself
- int height = 0;
-
if (this.rows.Count > 0) {
int last_row_bottom = this.rows[this.rows.Count - 1].Bounds.Bottom;
removed_one = true;
break;
}
+
+ // There's nothing left to remove, break or we will loop forever
+ if (!removed_one)
+ break;
}
i = 0;