ChoiceDialog.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 » ChoiceDialog.cs
//-----------------------------------------------------------------------------
// wx.NET - ChoiceDialog.cs
//
// The wxChoiceDialog wrapper classes.
//
// Written by Alexander Olk (xenomorph2@onlinehome.de)
// (C) 2003 Alexander Olk
// Licensed under the wxWidgets license, see LICENSE.txt for details.
//
// $Id: ChoiceDialog.cs,v 1.14 2007/11/11 14:14:45 harald_meyer Exp $
//-----------------------------------------------------------------------------

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

namespace wx{
    public class SingleChoiceDialog : Dialog
    {
        public const uint wxCHOICEDLG_STYLE  = (wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER | wxOK | wxCANCEL | wxCENTRE);

        [DllImport("wx-c")] static extern IntPtr wxSingleChoiceDialog_ctor(IntPtr parent, IntPtr message, IntPtr caption, IntPtr choices, IntPtr clientData, uint style, int posX, int posY);
        [DllImport("wx-c")] static extern void wxSingleChoiceDialog_SetSelection(IntPtr self, int sel);
        [DllImport("wx-c")] static extern int wxSingleChoiceDialog_GetSelection(IntPtr self);
        [DllImport("wx-c")] static extern IntPtr wxSingleChoiceDialog_GetStringSelection(IntPtr self);
        [DllImport("wx-c")] static extern IntPtr wxSingleChoiceDialog_GetSelectionClientData(IntPtr self);

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

        // TODO: ClientData... !?!

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

        public SingleChoiceDialog(Window parent, string message, string caption, string[] choices)
            : this(parent, message, caption, choices, null, wxCHOICEDLG_STYLE, wxDefaultPosition) {}

        public SingleChoiceDialog(Window parent, string message, string caption, string[] choices, ClientData[] clientData)
            : this(parent, message, caption, choices, clientData, wxCHOICEDLG_STYLE, wxDefaultPosition) {}

        public SingleChoiceDialog(Window parent, string message, string caption, string[] choices, ClientData[] clientData, uint style)
            : this(parent, message, caption, choices, clientData, style, wxDefaultPosition) {}

        public  SingleChoiceDialog(Window parent, string message, string caption, string[] choices, ClientData[] clientData, uint style, Point pos)
            : this(parent, wxString.SafeNew(message), wxString.SafeNew(caption), ArrayString.SafeNewFrom(choices), ArrayIntPtr.SafeNewFrom(clientData), style, pos)
        {
        }
        internal SingleChoiceDialog(Window parent, wxString message, wxString caption, ArrayString choices, ArrayIntPtr clientData, uint style, Point pos)
            : base(wxSingleChoiceDialog_ctor(Object.SafePtr(parent), Object.SafePtr(message), Object.SafePtr(caption), Object.SafePtr(choices), ArrayIntPtr.SafePtr(clientData), (uint)style, pos.X, pos.Y))
        {
        }

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

        public void SetSelection(int sel)
        {
            wxSingleChoiceDialog_SetSelection(wxObject, sel);
        }

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

        public int GetSelection()
        {
            return wxSingleChoiceDialog_GetSelection(wxObject);
        }

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

        public string GetStringSelection()
        {
            return new wxString(wxSingleChoiceDialog_GetStringSelection(wxObject), true);
        }

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

        public ClientData GetSelectionClientData()
        {
            return (ClientData)Object.FindObject(wxSingleChoiceDialog_GetSelectionClientData(wxObject));
        }
    }

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

    public class MultiChoiceDialog : Dialog
    {
        [DllImport("wx-c")] static extern IntPtr wxMultiChoiceDialog_ctor(IntPtr parent, IntPtr message, IntPtr caption, IntPtr choices, uint style, int posX, int posY);
        [DllImport("wx-c")] static extern void wxMultiChoiceDialog_SetSelections(IntPtr self, int[] sel, int numsel);
        [DllImport("wx-c")] static extern IntPtr wxMultiChoiceDialog_GetSelections(IntPtr self);

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

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

        public MultiChoiceDialog(Window parent, string message, string caption, string[] choices)
            : this(parent, message, caption, choices, SingleChoiceDialog.wxCHOICEDLG_STYLE, wxDefaultPosition) {}

        public MultiChoiceDialog(Window parent, string message, string caption, string[] choices, uint style)
            : this(parent, message, caption, choices, style, wxDefaultPosition) {}

        public MultiChoiceDialog(Window parent, string message, string caption, string[] choices, uint style, Point pos)
            : this(parent, wxString.SafeNew(message), wxString.SafeNew(caption), ArrayString.SafeNewFrom(choices), style, pos.X, pos.Y)
        { }
        public MultiChoiceDialog(Window parent, wxString message, wxString caption, ArrayString choices, uint style, int posX, int posY)
            : base(wxMultiChoiceDialog_ctor(Object.SafePtr(parent), Object.SafePtr(message), Object.SafePtr(caption), Object.SafePtr(choices), (uint)style, posX, posY)) {}

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

        public void SetSelections(int[] sel)
        {
            wxMultiChoiceDialog_SetSelections(wxObject, sel, sel.Length);
        }

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

        public int[] GetSelections()
        {
            return new ArrayInt(wxMultiChoiceDialog_GetSelections(wxObject), true);
        }
    }

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

  public class GetSingleChoice
  {
    public const int wxCHOICE_HEIGHT = 150;
    public const int wxCHOICE_WIDTH  = 200;
    public string value = "";

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

        [DllImport("wx-c")] static extern IntPtr wxGetSingleChoice_func(IntPtr message, IntPtr caption, IntPtr choices, IntPtr parent, int x, int y, bool centre, int width, int height);

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

    public GetSingleChoice(string message, string caption, string[] choices)
    {
            wxString wxMessage = wxString.SafeNew(message);
            wxString wxCaption = wxString.SafeNew(caption);
            ArrayString wxChoices = ArrayString.SafeNewFrom(choices);
      value = new wxString(wxGetSingleChoice_func(Object.SafePtr(wxMessage), Object.SafePtr(wxCaption), Object.SafePtr(wxChoices), IntPtr.Zero, -1, -1, true, wxCHOICE_WIDTH, wxCHOICE_HEIGHT), true);
    }

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

    public GetSingleChoice(string message, string caption, string[] choices, Window parent, int x, int y, bool centre, int width, int height)
    {
            wxString wxMessage = wxString.SafeNew(message);
            wxString wxCaption = wxString.SafeNew(caption);
            ArrayString wxChoices = ArrayString.SafeNewFrom(choices);
            value = new wxString(wxGetSingleChoice_func(Object.SafePtr(wxMessage), Object.SafePtr(wxCaption), Object.SafePtr(wxChoices), Object.SafePtr(parent), x, y, centre, width, height), true);
    }

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

    public static implicit operator string(GetSingleChoice g)
    {
      return g.value;
    }
  }
}

www.java2v.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.