1 // Permission is hereby granted, free of charge, to any person obtaining
2 // a copy of this software and associated documentation files (the
3 // "Software"), to deal in the Software without restriction, including
4 // without limitation the rights to use, copy, modify, merge, publish,
5 // distribute, sublicense, and/or sell copies of the Software, and to
6 // permit persons to whom the Software is furnished to do so, subject to
7 // the following conditions:
9 // The above copyright notice and this permission notice shall be
10 // included in all copies or substantial portions of the Software.
12 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
13 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
14 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
15 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
16 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
17 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
18 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
20 // Copyright (c) 2004 Novell, Inc.
23 // Jordi Mas i Hernandez, jordi@ximian.com
29 namespace System
.Windows
.Forms
31 public class MainMenu
: Menu
33 private RightToLeft right_to_left
;
36 public MainMenu () : base (null)
41 public MainMenu (MenuItem
[] items
) : base (items
)
46 #region Public Properties
48 public virtual RightToLeft RightToLeft
{
49 get { return right_to_left;}
50 set { right_to_left = value; }
53 #endregion Public Properties
55 #region Public Methods
57 public virtual MainMenu
CloneMenu ()
59 MainMenu new_menu
= new MainMenu ();
60 new_menu
.CloneMenu (this);
64 protected override IntPtr
CreateMenuHandle ()
66 return MenuAPI
.CreateMenu ();
69 protected void Dispose (bool disposing
)
71 base.Dispose (disposing
);
74 public Form
GetForm ()
79 public override string ToString ()
81 return base.ToString ();
84 #endregion Public Methods
86 #region Private Methods
88 internal void SetForm (Form form
)
93 /* Mouse events from the form */
94 internal void OnMouseDown (Form window
, MouseEventArgs e
)
96 MenuAPI
.TrackBarMouseEvent (Handle
, window
, e
, MenuAPI
.MenuMouseEvent
.Down
);
99 internal void OnMouseMove (Form window
, MouseEventArgs e
)
101 MouseEventArgs ev
= new MouseEventArgs (e
.Button
, e
.Clicks
, Control
.MousePosition
.X
, Control
.MousePosition
.Y
, e
.Delta
);
102 MenuAPI
.TrackBarMouseEvent (Handle
, window
, ev
, MenuAPI
.MenuMouseEvent
.Move
);
105 #endregion Private Methods