App.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 » App.cs
//-----------------------------------------------------------------------------
// wx.NET - App.cs
//
// The wxApp wrapper class.
//
// Written by Jason Perkins (jason@379.com)
// (C) 2003 by 379, Inc.
// Licensed under the wxWidgtes license, see LICENSE.txt for details.
//
// $Id: App.cs,v 1.12 2007/11/11 14:14:45 harald_meyer Exp $
//-----------------------------------------------------------------------------

using System;
using System.Runtime.InteropServices;

namespace wx{
    public abstract class App : EvtHandler
    {
  private delegate bool Virtual_OnInit();
  private delegate int Virtual_OnExit();
  
  private Virtual_OnInit virtual_OnInit;
  private Virtual_OnExit virtual_OnExit;
    
        [DllImport("wx-c")] static extern IntPtr wxApp_ctor();
  
  [DllImport("wx-c")] static extern void wxApp_RegisterVirtual(IntPtr self, Virtual_OnInit onInit, Virtual_OnExit onExit);
  [DllImport("wx-c")] static extern bool wxApp_OnInit(IntPtr self);
  [DllImport("wx-c")] static extern int wxApp_OnExit(IntPtr self);
  
        [DllImport("wx-c")] static extern void   wxApp_Run(int argc, string[] argv);

        [DllImport("wx-c")] static extern void   wxApp_SetVendorName(IntPtr self, IntPtr name);
        [DllImport("wx-c")] static extern IntPtr wxApp_GetVendorName(IntPtr self);

        [DllImport("wx-c")] static extern void wxApp_SetAppName(IntPtr self, IntPtr name);
        [DllImport("wx-c")] static extern IntPtr wxApp_GetAppName(IntPtr self);

        [DllImport("wx-c")] static extern bool   wxApp_SafeYield(IntPtr win, bool onlyIfNeeded);
        [DllImport("wx-c")] static extern bool   wxApp_Yield(IntPtr self, bool onlyIfNeeded);
        [DllImport("wx-c")] static extern void   wxApp_WakeUpIdle();
        
        //---------------------------------------------------------------------

        private static App app;

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

        protected App() : base(wxApp_ctor())
        {
            app = this;
      
      virtual_OnInit = new Virtual_OnInit(OnInit);
      virtual_OnExit = new Virtual_OnExit(OnExit);
      
      wxApp_RegisterVirtual(wxObject, virtual_OnInit, virtual_OnExit);
        }

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

  public virtual bool OnInit()
  {
    return wxApp_OnInit(wxObject);
  }
  
  //---------------------------------------------------------------------
  
  public virtual int OnExit()
  {
    return wxApp_OnExit(wxObject);
  }

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

        public static App GetApp() 
        {
            return app;
        }

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

        public void Run()
        {
            string[] args = Environment.GetCommandLineArgs();
            wxApp_Run(args.Length, args);
        }

        //---------------------------------------------------------------------
        
        public string VendorName
        {
            set
            {
                wxString wxValue = wxString.SafeNew(value);
                wxApp_SetVendorName(wxObject, Object.SafePtr(wxValue));
            }
            get { return new wxString(wxApp_GetVendorName(wxObject), true); }
        }

        public string AppName
        {
            set
            {
                wxString wxValue = wxString.SafeNew(value);
                wxApp_SetAppName(wxObject, Object.SafePtr(wxValue));
            }
            get { return new wxString(wxApp_GetAppName(wxObject), true); }
        }

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

        public static bool SafeYield() 
            { return wxApp_SafeYield(Object.SafePtr(null), false); }
        public static bool SafeYield(Window win) 
            { return wxApp_SafeYield(Object.SafePtr(win), false); }
        public static bool SafeYield(Window win, bool onlyIfNeeded) 
            { return wxApp_SafeYield(Object.SafePtr(win), onlyIfNeeded); }

        public bool Yield() 
            { return wxApp_Yield(wxObject, false); }
        public bool Yield(bool onlyIfNeeded) 
            { return wxApp_Yield(wxObject, onlyIfNeeded); }

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

        public static void WakeUpIdle()
        {
            wxApp_WakeUpIdle();
        }
    }
}
www.java2v.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.