Dialog.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 » Dialog.cs
//-----------------------------------------------------------------------------
// wx.NET - Dialog.cs
//
// The wxDialog 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: Dialog.cs,v 1.21 2007/11/11 14:14:46 harald_meyer Exp $
//-----------------------------------------------------------------------------

using System;
using System.Drawing;
using System.Runtime.InteropServices;

namespace wx{
  public class Dialog : Window
  {
    public const int wxCENTER    = 0x00000001;
    public const int wxCENTRE    = 0x00000001;
    public const int wxYES      = 0x00000002;
    public const int wxOK      = 0x00000004;
    public const int wxNO      = 0x00000008;
    public const int wxCANCEL    = 0x00000010;
    public const int wxYES_NO    = (wxYES | wxNO);

    public const int wxYES_DEFAULT    = 0x00000000;
    public const int wxNO_DEFAULT    = 0x00000080;

    public const int wxICON_EXCLAMATION   = 0x00000100;
    public const int wxICON_HAND    = 0x00000200;
    public const int wxICON_WARNING  = wxICON_EXCLAMATION;
    public const int wxICON_ERROR    = wxICON_HAND;
    public const int wxICON_QUESTION  = 0x00000400;
    public const int wxICON_INFORMATION  = 0x00000800;
    public const int wxICON_STOP    = wxICON_HAND;
    public const int wxICON_ASTERISK  = wxICON_INFORMATION;
    public const int wxICON_MASK    = (0x00000100|0x00000200|0x00000400|0x00000800);

    public const int wxFORWARD    = 0x00001000;
    public const int wxBACKWARD    = 0x00002000;
    public const int wxRESET    = 0x00004000;
    public const int wxHELP    = 0x00008000;
    public const int wxMORE     = 0x00010000;
    public const int wxSETUP    = 0x00020000;

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

    [DllImport("wx-c")] static extern IntPtr wxDialog_ctor();
    [DllImport("wx-c")] static extern void   wxDialog_dtor(IntPtr self);

    [DllImport("wx-c")] static extern void   wxDialog_SetReturnCode(IntPtr self, int returnCode);
    [DllImport("wx-c")] static extern int    wxDialog_GetReturnCode(IntPtr self);

    [DllImport("wx-c")] static extern IntPtr wxDialog_GetTitle(IntPtr self);
    [DllImport("wx-c")] static extern void   wxDialog_SetTitle(IntPtr self, IntPtr title);

    [DllImport("wx-c")] static extern bool   wxDialog_Create(IntPtr self, IntPtr parent, int id, IntPtr title, int posX, int posY, int width, int height, uint style, IntPtr name);

    [DllImport("wx-c")] static extern void   wxDialog_EndModal(IntPtr self, int retCode);

    [DllImport("wx-c")] static extern bool   wxDialog_IsModal(IntPtr self);

    [DllImport("wx-c")] static extern void   wxDialog_SetIcon(IntPtr self, IntPtr icon);
    [DllImport("wx-c")] static extern void   wxDialog_SetIcons(IntPtr self, IntPtr icons);

    [DllImport("wx-c")] static extern int    wxDialog_ShowModal(IntPtr self);

    //---------------------------------------------------------------------
    
    public Dialog(IntPtr wxObject) 
      : base(wxObject) {}

    public Dialog()
      : base(wxDialog_ctor()) { }

    public Dialog(Window parent, string title)
      : this(parent, Window.UniqueID, title, wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE, null) { }

    public Dialog(Window parent, int id, string title)
      : this(parent, id, title, wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE, null) { }

    public Dialog(Window parent, int id, string title, Point pos)
      : this(parent, id, title, pos, wxDefaultSize, wxDEFAULT_DIALOG_STYLE, null) { }

    public Dialog(Window parent, int id, string title, Point pos, Size size)
      : this(parent, id, title, pos, size, wxDEFAULT_DIALOG_STYLE, null) { }

    public Dialog(Window parent, int id, string title, Point pos, Size size, uint style)
      : this(parent, id, title, pos, size, style, null) { }

    public Dialog(Window parent, int id, string title, Point pos, Size size, uint style, string name)
      : base(wxDialog_ctor())
    {
      if (!Create(parent, id, title, pos, size, style, name))
      {
        throw new InvalidOperationException("Failed to create Dialog");
      }
    }
    
    //---------------------------------------------------------------------
    // ctors with self created id
    
    public Dialog(Window parent, string title, Point pos)
      : this(parent, Window.UniqueID, title, pos, wxDefaultSize, wxDEFAULT_DIALOG_STYLE, null) { }

    public Dialog(Window parent, string title, Point pos, Size size)
      : this(parent, Window.UniqueID, title, pos, size, wxDEFAULT_DIALOG_STYLE, null) { }

    public Dialog(Window parent, string title, Point pos, Size size, uint style)
      : this(parent, Window.UniqueID, title, pos, size, style, null) { }

    public Dialog(Window parent, string title, Point pos, Size size, uint style, string name)
      : this(parent, Window.UniqueID, title, pos, size, style, name) {}
    
    //---------------------------------------------------------------------

    public bool Create(Window window, int id, string title, Point pos,
               Size size, uint style, string name)
    {
            wxString wxTitle = wxString.SafeNew(title);
            wxString wxName = wxString.SafeNew(name);
      return wxDialog_Create(wxObject, Object.SafePtr(window), id, Object.SafePtr(wxTitle),
                   pos.X, pos.Y, size.Width, size.Height, style, Object.SafePtr(wxName));
    }

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

    public int ReturnCode
    {
      get { return wxDialog_GetReturnCode(wxObject); }
      set { wxDialog_SetReturnCode(wxObject, value); }
    }

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

    public override string Title
    {
      get { return new wxString(wxDialog_GetTitle(wxObject), true); }
      set
            {
                wxString wxValue = wxString.SafeNew(value);
                wxDialog_SetTitle(wxObject, Object.SafePtr(wxValue));
            }
    }

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

    public void EndModal(int retCode)
    {
      wxDialog_EndModal(wxObject, (int)retCode);
    }

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

    public void SetIcon(Icon icon)
    {
      wxDialog_SetIcon(wxObject, Object.SafePtr(icon));
    }

    /*public void SetIcons(IconBundle icons)
    {
      wxDialog_SetIcons(wxObject, Object.SafePtr(icons);
    }*/

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

    public virtual int ShowModal()
    {
      return wxDialog_ShowModal(wxObject);
    }

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

    public bool Modal
    {
      get { return wxDialog_IsModal(wxObject); }
    }
  }
}
www.java2v.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.