| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303 |
- // Permission is hereby granted, free of charge, to any person obtaining
- // a copy of this software and associated documentation files (the
- // "Software"), to deal in the Software without restriction, including
- // without limitation the rights to use, copy, modify, merge, publish,
- // distribute, sublicense, and/or sell copies of the Software, and to
- // permit persons to whom the Software is furnished to do so, subject to
- // the following conditions:
- //
- // The above copyright notice and this permission notice shall be
- // included in all copies or substantial portions of the Software.
- //
- // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- //
- // Copyright (c) 2004 Novell, Inc.
- //
- // Authors:
- // Jordi Mas i Hernandez, [email protected]
- //
- //
- // NOT COMPLETE
- using System.Collections;
- using System.ComponentModel;
- namespace System.Windows.Forms
- {
- public abstract class Menu : Component
- {
- internal MenuItemCollection menu_items;
- internal IntPtr menu_handle = IntPtr.Zero;
- public const int FindHandle = 0;
- public const int FindShortcut = 1;
-
- protected Menu (MenuItem[] items)
- {
- //Console.WriteLine ("Menu.Menu " + (items != null));
- menu_items = new MenuItemCollection (this);
- if (items != null)
- menu_items.AddRange (items);
- }
- #region Public Properties
- public IntPtr Handle {
- get {
- if (menu_handle == IntPtr.Zero) {
- menu_handle = CreateMenuHandle ();
- CreateItems ();
- }
- return menu_handle;
- }
- }
-
- public virtual bool IsParent {
- get {
- throw new NotImplementedException ();
- }
- }
-
- public MenuItem MdiListItem {
- get {
- throw new NotImplementedException ();
- }
- }
-
- public MenuItemCollection MenuItems {
- get { return menu_items; }
- }
- #endregion Public Properties
- #region Public Methods
-
- protected void CloneMenu (Menu menuSrc)
- {
- throw new NotImplementedException ();
- }
-
- protected virtual IntPtr CreateMenuHandle ()
- {
- IntPtr menu;
- menu = MenuAPI.CreatePopupMenu ();
- Console.WriteLine ("Menu.CreateMenuHandle:" + menu);
- return menu;
- }
- protected override void Dispose (bool diposing)
- {
- throw new NotImplementedException ();
- }
-
- public MenuItem FindMenuItem (int type, IntPtr value)
- {
- throw new NotImplementedException ();
- }
- protected int FindMergePosition (int mergeOrder)
- {
- throw new NotImplementedException ();
- }
-
- public ContextMenu GetContextMenu ()
- {
- throw new NotImplementedException ();
- }
-
- public MainMenu GetMainMenu ()
- {
- throw new NotImplementedException ();
- }
-
- public virtual void MergeMenu (Menu menuSrc)
- {
- throw new NotImplementedException ();
- }
- protected internal virtual bool ProcessCmdKey (ref Message msg, Keys keyData)
- {
- throw new NotImplementedException ();
- }
- public override string ToString ()
- {
- throw new NotImplementedException ();
- }
- #endregion Public Methods
- #region Private Methods
- protected void CreateItems ()
- {
- Console.WriteLine ("Menu.CreateItems:" + menu_items.Count);
- for (int i = 0; i < menu_items.Count; i++)
- menu_items[i].Create ();
-
- Console.WriteLine ("End Menu.CreateItems:" + menu_items.Count);
- }
- #endregion Private Methods
- public class MenuItemCollection : IList, ICollection, IEnumerable
- {
- private Menu owner;
- private ArrayList items = new ArrayList ();
-
- public MenuItemCollection (Menu owner)
- {
- this.owner = owner;
- }
- #region Public Properties
- public virtual int Count {
- get { return items.Count;}
- }
- public virtual bool IsReadOnly {
- get { return false;}
- }
- bool ICollection.IsSynchronized {
- get { return false;}
- }
- object ICollection.SyncRoot {
- get { return this;}
- }
- bool IList.IsFixedSize {
- get { return false;}
- }
- public MenuItem this [int index] {
- get { return (MenuItem) items[index]; }
- }
- object IList.this[int index] {
- get { return items[index]; }
- set { items[index] = value; }
- }
- #endregion Public Properties
- #region Public Methods
- public virtual int Add (MenuItem mi)
- {
- mi.parent_menu = owner;
- items.Add (mi);
- return items.Count - 1;
- }
- public virtual MenuItem Add (string s)
- {
- throw new NotImplementedException ();
- }
- public virtual int Add (int index, MenuItem mi)
- {
- throw new NotImplementedException ();
- }
- public virtual MenuItem Add (string s, EventHandler e)
- {
- throw new NotImplementedException ();
- }
- public virtual MenuItem Add (string s, MenuItem[] items)
- {
- throw new NotImplementedException ();
- }
- public virtual void AddRange (MenuItem[] items)
- {
- if (items == null)
- throw new ArgumentNullException ("items");
- foreach (MenuItem mi in items)
- Add (mi);
- }
- public virtual void Clear ()
- {
- items.Clear ();
- }
- public bool Contains (MenuItem value)
- {
- throw new NotImplementedException ();
- }
-
- public virtual void CopyTo (Array dest, int index)
- {
- throw new NotImplementedException ();
- }
-
- public virtual IEnumerator GetEnumerator ()
- {
- throw new NotImplementedException ();
- }
-
- int IList.Add (object value)
- {
- throw new NotImplementedException ();
- }
- bool IList.Contains (object value)
- {
- throw new NotImplementedException ();
- }
- int IList.IndexOf (object value)
- {
- throw new NotImplementedException ();
- }
- void IList.Insert (int index, object value)
- {
- throw new NotImplementedException ();
- }
- void IList.Remove (object value)
- {
- throw new NotImplementedException ();
- }
- public int IndexOf (MenuItem value)
- {
- throw new NotImplementedException ();
- }
- public virtual void Remove (MenuItem item)
- {
- throw new NotImplementedException ();
- }
-
- public virtual void RemoveAt (int index)
- {
- throw new NotImplementedException ();
- }
- #endregion Public Methods
- }
- }
- }
|