attached to a button on ToolBar.
* ToolBarButton.cs: Uncomment/fixed the DropDownMenu
property.
svn path=/trunk/mcs/; revision=37493
+2004-12-09 Ravindra <rkumar@novell.com>
+
+ * ToolBar.cs: Added support for displaying ContextMenu
+ attached to a button on ToolBar.
+ * ToolBarButton.cs: Uncomment/fixed the DropDownMenu
+ property.
+
2004-12-09 Jordi Mas i Hernandez <jordi@ximian.com>
* Label.cs: autosize works in text change and removes unnecessary
// Ravindra (rkumar@novell.com)
//
// TODO:
-// - DropDown ContextMenu
// - Tooltip
//
// Copyright (C) Novell, Inc. 2004 (http://www.novell.com)
protected virtual void OnButtonDropDown (ToolBarButtonClickEventArgs e)
{
- // if (e.Button.DropDownMenu == null) return;
- // TODO: Display the dropdown menu
-
// Reset the flag set on DropDown
e.Button.dd_pressed = false;
if (ButtonDropDown != null)
ButtonDropDown (this, e);
- else
+
+ if (e.Button.DropDownMenu == null)
return;
+
+ Point loc = new Point (e.Button.Location.X + 1,
+ e.Button.Rectangle.Bottom + 2);
+ ((ContextMenu) e.Button.DropDownMenu).Show (this, loc);
}
protected override void OnFontChanged (EventArgs e)
// Ravindra (rkumar@novell.com)
//
// TODO:
-// - DropDownMenu
// - Adding a button to two toolbars
//
// $Revision: 1.9 $
public class ToolBarButton : Component
{
#region instance variable
- //private ContextMenu menu; //NotImplemented
private bool enabled = true;
private int image_index = -1;
+ private ContextMenu menu;
private ToolBar parent;
private bool partial_push = false;
private bool pushed = false;
#endregion internal properties
#region properties
- /*
[DefaultValue (null)]
[TypeConverter (typeof (ReferenceConverter))]
public Menu DropDownMenu {
set {
if (value is ContextMenu)
- menu = value;
+ menu = (ContextMenu) value;
else
throw new ArgumentException ("DropDownMenu must be of type ContextMenu.");
}
}
- */
[DefaultValue (true)]
[Localizable (true)]