mirror of
https://github.com/BepInEx/mono.git
synced 2026-11-18 03:51:19 -10:00
* 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
80 lines
1.9 KiB
C#
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);
|
|
}
|
|
|
|
|
|
}
|
|
}
|