2 // System.Windows.Forms.MainMenu
5 // Alberto Fernandez (infjaf00@yahoo.es)
9 using System
.ComponentModel
;
11 namespace System
.Windows
.Forms
{
13 public class MainMenu
:Menu
{
14 private RightToLeft rightToLeft
= RightToLeft
.Inherit
;
15 private Form ownerForm
;
17 public MainMenu ():base (null){
19 public MainMenu (MenuItem
[]items
):base (items
){
23 public virtual RightToLeft RightToLeft
{
25 if(rightToLeft
!= RightToLeft
.Inherit
){
28 else if(ownerForm
!= null){
29 return ownerForm
.RightToLeft
;
32 return RightToLeft
.No
;
36 if (!Enum
.IsDefined (typeof(RightToLeft
), value)){
37 throw new InvalidEnumArgumentException();
39 if(rightToLeft
!= value){
45 public virtual MainMenu
CloneMenu (){
46 throw new NotImplementedException ();
49 protected virtual IntPtr
CreateMenuHandle (){
53 protected override void Dispose (bool disposing
){
54 base.Dispose (disposing
);
56 public virtual Form
GetForm (){
60 public override String
ToString (){
61 if (ownerForm
!= null){
62 return base.ToString () + ", GetForm: " +
63 ownerForm
.ToString ();
65 return base.ToString ();
71 internal void AddToForm (Form form
){
75 internal void RemoveFromForm (){
79 internal override Gtk
.Widget
CreateWidget(){
80 Gtk
.MenuBar mb
= new Gtk
.MenuBar();
84 internal override void OnNewMenuItemAdd (MenuItem item
){
85 ((Gtk
.MenuBar
)Widget
).Append (item
.Widget
);
87 internal override void OnRemoveMenuItem (MenuItem item
){
88 ((Gtk
.MenuBar
)Widget
).Remove (item
.Widget
);