MenuBar.cs :  » GUI » wx-NET » wx » C# / CSharp Open Source

Home
C# / CSharp Open Source
1.2.6.4 mono .net core
2.2.6.4 mono core
3.Aspect Oriented Frameworks
4.Bloggers
5.Build Systems
6.Business Application
7.Charting Reporting Tools
8.Chat Servers
9.Code Coverage Tools
10.Content Management Systems CMS
11.CRM ERP
12.Database
13.Development
14.Email
15.Forum
16.Game
17.GIS
18.GUI
19.IDEs
20.Installers Generators
21.Inversion of Control Dependency Injection
22.Issue Tracking
23.Logging Tools
24.Message
25.Mobile
26.Network Clients
27.Network Servers
28.Office
29.PDF
30.Persistence Frameworks
31.Portals
32.Profilers
33.Project Management
34.RSS RDF
35.Rule Engines
36.Script
37.Search Engines
38.Sound Audio
39.Source Control
40.SQL Clients
41.Template Engines
42.Testing
43.UML
44.Web Frameworks
45.Web Service
46.Web Testing
47.Wiki Engines
48.Windows Presentation Foundation
49.Workflows
50.XML Parsers
C# / C Sharp
C# / C Sharp by API
C# / CSharp Tutorial
C# / CSharp Open Source » GUI » wx NET 
wx NET » wx » MenuBar.cs
//-----------------------------------------------------------------------------
// wx.NET - MenuBar.cs
//
// The wxMenuBar wrapper class.
//
// Written by Jason Perkins (jason@379.com)
// (C) 2003 by 379, Inc.
// Licensed under the wxWidgets license, see LICENSE.txt for details.
//
// $Id: MenuBar.cs,v 1.12 2007/11/24 17:55:45 harald_meyer Exp $
//-----------------------------------------------------------------------------

using System;
using System.Runtime.InteropServices;

namespace wx{
  public class MenuBar : EvtHandler
  {
    [DllImport("wx-c")] static extern IntPtr wxMenuBar_ctor();
    [DllImport("wx-c")] static extern IntPtr wxMenuBar_ctor2(uint style);
    [DllImport("wx-c")][return:MarshalAs(UnmanagedType.U1)] static extern bool   wxMenuBar_Append(IntPtr self, IntPtr menu, IntPtr title);
    [DllImport("wx-c")] static extern void   wxMenuBar_Check(IntPtr self, int id, bool check);
    [DllImport("wx-c")] static extern bool   wxMenuBar_IsChecked(IntPtr self, int id);
        [DllImport("wx-c")][return: MarshalAs(UnmanagedType.U1)] static extern bool wxMenuBar_Insert(IntPtr self, int pos, IntPtr menu, IntPtr title);
        [DllImport("wx-c")] static extern IntPtr wxMenuBar_FindItem(IntPtr self, int id, ref IntPtr menu);
    
    [DllImport("wx-c")] static extern int    wxMenuBar_GetMenuCount(IntPtr self);
    [DllImport("wx-c")] static extern IntPtr wxMenuBar_GetMenu(IntPtr self, int pos);
    
    [DllImport("wx-c")] static extern IntPtr wxMenuBar_Replace(IntPtr self, int pos, IntPtr menu, IntPtr title);
    [DllImport("wx-c")] static extern IntPtr wxMenuBar_Remove(IntPtr self, int pos);
    
    [DllImport("wx-c")] static extern void   wxMenuBar_EnableTop(IntPtr self, int pos, bool enable);
    
    [DllImport("wx-c")] static extern void   wxMenuBar_Enable(IntPtr self, int id, bool enable);
    
    [DllImport("wx-c")] static extern int    wxMenuBar_FindMenu(IntPtr self, IntPtr title);
    [DllImport("wx-c")] static extern int    wxMenuBar_FindMenuItem(IntPtr self, IntPtr menustring, IntPtr itemString);
    
    [DllImport("wx-c")] static extern IntPtr wxMenuBar_GetHelpString(IntPtr self, int id);
    [DllImport("wx-c")] static extern IntPtr wxMenuBar_GetLabel(IntPtr self, int id);
    [DllImport("wx-c")] static extern IntPtr wxMenuBar_GetLabelTop(IntPtr self, int pos);
    
    [DllImport("wx-c")] static extern bool   wxMenuBar_IsEnabled(IntPtr self, int id);
    
    [DllImport("wx-c")] static extern void   wxMenuBar_Refresh(IntPtr self);
    
    [DllImport("wx-c")] static extern void   wxMenuBar_SetHelpString(IntPtr self, int id, IntPtr helpstring);
    [DllImport("wx-c")] static extern void   wxMenuBar_SetLabel(IntPtr self, int id, IntPtr label);
    [DllImport("wx-c")] static extern void   wxMenuBar_SetLabelTop(IntPtr self, int pos, IntPtr label);

    //---------------------------------------------------------------------

    public MenuBar()
      : this(wxMenuBar_ctor()) { }
      
    public MenuBar(long style)
      : this(wxMenuBar_ctor2((uint)style)) {}

    public MenuBar(IntPtr wxObject)
      : base(wxObject) { }

    //---------------------------------------------------------------------

        public bool Append(Menu menu, string title)
        {
            return this.Append(menu, wxString.SafeNew(title));
        }
    public bool Append(Menu menu, wxString title)
    {
      return wxMenuBar_Append(wxObject, menu.wxObject, Object.SafePtr(title));
    }

    //---------------------------------------------------------------------

    public void Check(int id, bool check)
    {
      wxMenuBar_Check(wxObject, id, check);
    }

    //---------------------------------------------------------------------

    public bool IsChecked(int id)
    {
      return wxMenuBar_IsChecked(wxObject, id); 
    }

        public bool Insert(int pos, Menu menu, string title)
        {
            return this.Insert(pos, menu, wxString.SafeNew(title));
        }
    public bool Insert(int pos, Menu menu, wxString title)
    {
      return wxMenuBar_Insert(wxObject, pos, Object.SafePtr(menu), Object.SafePtr(title));
    }
    
    //-----------------------------------------------------------------------------
    
    public MenuItem FindItem(int id)
    { 
      Menu menu = null;
      return FindItem(id, ref menu); 
    }
    
    public MenuItem FindItem(int id, ref Menu menu)
    {
      IntPtr menuRef = IntPtr.Zero;
      if (menu != null) 
      {
        menuRef = Object.SafePtr(menu);
      }
    
      return (MenuItem)FindObject(wxMenuBar_FindItem(wxObject, id, ref menuRef), typeof(MenuItem));
    }
    
    //-----------------------------------------------------------------------------
    
    public int MenuCount
    {
      get { return wxMenuBar_GetMenuCount(wxObject); }
    }
    
    //-----------------------------------------------------------------------------
    
    public Menu GetMenu(int pos)
    {
      return (Menu)FindObject(wxMenuBar_GetMenu(wxObject, pos), typeof(Menu));
    }
    
    //-----------------------------------------------------------------------------

        public Menu Replace(int pos, Menu menu, string title)
        {
            return this.Replace(pos, menu, wxString.SafeNew(title));
        }
    public Menu Replace(int pos, Menu menu, wxString title)
    {
      return (Menu)FindObject(wxMenuBar_Replace(wxObject, pos, Object.SafePtr(menu), Object.SafePtr(title)), typeof(Menu));
    }
    
    //-----------------------------------------------------------------------------
    
    public Menu Remove(int pos)
    {
      return (Menu)FindObject(wxMenuBar_Remove(wxObject, pos), typeof(Menu));
    }
    
    //-----------------------------------------------------------------------------
    
    public void EnableTop(int pos, bool enable)
    {
      wxMenuBar_EnableTop(wxObject, pos, enable);
    }
    
    //-----------------------------------------------------------------------------
    
    public void Enable(int id, bool enable)
    {
      wxMenuBar_Enable(wxObject, id, enable);
    }
    
    //-----------------------------------------------------------------------------

        public int FindMenu(string title)
        {
            return this.FindMenu(wxString.SafeNew(title));
        }
    public int FindMenu(wxString title)
    {
      return wxMenuBar_FindMenu(wxObject, Object.SafePtr(title));
    }
    
    //-----------------------------------------------------------------------------

        public int FindMenuItem(string menustring, string itemString)
        {
            return this.FindMenuItem(wxString.SafeNew(menustring), wxString.SafeNew(itemString));
        }
    public int FindMenuItem(wxString menustring, wxString itemString)
    {
      return wxMenuBar_FindMenuItem(wxObject, Object.SafePtr(menustring), Object.SafePtr(itemString));
    }
    
    //-----------------------------------------------------------------------------
    
    public string GetHelpString(int id)
    {
      return new wxString(wxMenuBar_GetHelpString(wxObject, id), true);
    }
    
    //-----------------------------------------------------------------------------
    
    public string GetLabel(int id)
    {
      return new wxString(wxMenuBar_GetLabel(wxObject, id), true);
    }
    
    //-----------------------------------------------------------------------------
    
    public string GetLabelTop(int pos)
    {
      return new wxString(wxMenuBar_GetLabelTop(wxObject, pos), true);
    }
    
    //-----------------------------------------------------------------------------
    
    public bool IsEnabled(int id)
    {
      return wxMenuBar_IsEnabled(wxObject, id);
    }
    
    //-----------------------------------------------------------------------------
    
    public void Refresh()
    {
      wxMenuBar_Refresh(wxObject);
    }
    
    //-----------------------------------------------------------------------------

        public void SetHelpString(int id, string helpstring)
        {
            this.SetHelpString(id, wxString.SafeNew(helpstring));
        }
    public void SetHelpString(int id, wxString helpstring)
    {
      wxMenuBar_SetHelpString(wxObject, id, Object.SafePtr(helpstring));
    }
    
    //-----------------------------------------------------------------------------

        public void SetLabel(int id, string label)
        {
            this.SetLabel(id, wxString.SafeNew(label));
        }
    public void SetLabel(int id, wxString label)
    {
      wxMenuBar_SetLabel(wxObject, id, Object.SafePtr(label));
    }
    
    //-----------------------------------------------------------------------------

        public void SetLabelTop(int pos, string label)
        {
            this.SetLabelTop(pos, wxString.SafeNew(label));
        }
    public void SetLabelTop(int pos, wxString label)
    {
      wxMenuBar_SetLabelTop(wxObject, pos, Object.SafePtr(label));
    }
  }
}
www.java2v.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.