Files
mono/mcs/class/System.Windows.Forms/Gtk/ContextMenu.cs
T
Joel Basson 802417f479 Thu Jan 16 19:20:00 GMT+2 2003 Joel Basson <[email protected]>
* Applied patch from Alberto Fernandez with the following changes...
	Finished ProgressBar (Events?)
	Finished HScrollBar VScrollBar and ScrollBar
	Finished FolderBrowserDialog
	Base ComboBox
	Added DrawMode.cs
	Added ComboBoxStyle.cs
	Added Appearance.cs
	Added CheckState.cs
	Added TabAlignment
	Added TabAppearance.cs
	Added TabDrawMode.cs
	Added TabSizeMode.cs
	Added Panel.cs
	Added TabPage.cs
	Added TabControl.cs
	Added Cursors.cs
	Added MessageBoxDefaultButton.cs
	Added MessageBoxIcon.cs
	Added MessageBoxOptions.cs
	Changes in MessageBoxButtons.cs (Added values)
	Changes in MessageBox (Completed all functions, added return values).
	"Finished" CheckBox.cs
	"Finished" ComboBox.cs
	"Finished" RadioButton
	"Finished" GroupBox
	"Finished" Panel
	Changes in Form to work with new RadioButton.
	Fix double Click reported on MenuItems.
	"Finished" Application

svn path=/trunk/mcs/; revision=22123
2004-01-15 17:19:30 +00:00

80 lines
1.9 KiB
C#

//
// System.Windows.Forms.ContextMenu
//
// Author:
// Alberto Fernandez ([email protected])
//
using System;
using System.ComponentModel;
using System.Drawing;
namespace System.Windows.Forms{
public class ContextMenu : Menu{
private RightToLeft rightToLeft = RightToLeft.Inherit;
private Control sourceControl;
public ContextMenu(): base (null){
}
public ContextMenu(MenuItem[] menuItems): base (menuItems){
}
[MonoTODO]
public virtual RightToLeft RightToLeft {
//TODO: should affect the gtk item?
get{
if(rightToLeft != RightToLeft.Inherit){
return rightToLeft;
}
else if(sourceControl != null){
return sourceControl.RightToLeft;
}
else{
return RightToLeft.No;
}
}
set{
if (!Enum.IsDefined (typeof(RightToLeft), value)){
throw new InvalidEnumArgumentException();
}
if(rightToLeft != value){
rightToLeft = value;
}
}
}
public virtual Control SourceControl{
get{ return sourceControl;}
}
protected internal virtual void OnPopup (EventArgs e){
if (Popup != null)
Popup (this, e);
}
[MonoTODO]
public void Show (Control control, Point pos){
//TODO: test it.
this.sourceControl = control;
OnPopup (EventArgs.Empty);
((Gtk.Menu)Widget).Popup (null, null, null, IntPtr.Zero, 3, Gtk.Global.CurrentEventTime);
}
public event EventHandler Popup;
internal override Gtk.Widget CreateWidget(){
return new Gtk.Menu();
}
internal override void OnNewMenuItemAdd (MenuItem item){
((Gtk.Menu)Widget).Append(item.Widget);
}
internal override void OnNewMenuItemAdd (int index, MenuItem item){
((Gtk.Menu)Widget).Insert(item.Widget, index);
}
internal override void OnRemoveMenuItem (MenuItem item){
((Gtk.Menu)Widget).Remove (item.Widget);
}
}
}