TextDialog.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 » TextDialog.cs
//-----------------------------------------------------------------------------
// wx.NET - TextDialog.cs
//
// The wxTextEntryDialog wrapper class.
//
// Written by Alexander Olk (xenomorph2@onlinehome.de)
// (C) 2003 Alexander Olk
// Licensed under the wxWidgets license, see LICENSE.txt for details.
//
// $Id: TextDialog.cs,v 1.8 2007/11/25 18:32:34 harald_meyer Exp $
//-----------------------------------------------------------------------------

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

namespace wx{
    public class TextEntryDialog : Dialog
    {
        public const int wxTextEntryDialogStyle = (Dialog.wxOK | Dialog.wxCANCEL | Dialog.wxCENTRE );

        [DllImport("wx-c")] static extern IntPtr wxTextEntryDialog_ctor(IntPtr parent, IntPtr message, IntPtr caption, IntPtr value, uint style, int posX, int posY);
        [DllImport("wx-c")] static extern void wxTextEntryDialog_dtor(IntPtr self);
        [DllImport("wx-c")] static extern void wxTextEntryDialog_SetValue(IntPtr self, IntPtr val);
        [DllImport("wx-c")] static extern IntPtr wxTextEntryDialog_GetValue(IntPtr self);
        [DllImport("wx-c")] static extern int wxTextEntryDialog_ShowModal(IntPtr self);

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

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

        public TextEntryDialog(Window parent)
            : this(parent, "Enter text", "", "", (int)wxTextEntryDialogStyle, wxDefaultPosition) {}

        public TextEntryDialog(Window parent, string message)
            : this(parent, message, "", "", (int)wxTextEntryDialogStyle, wxDefaultPosition) {}

        public TextEntryDialog(Window parent, string message, string caption)
            : this(parent, message, caption, "", (int)wxTextEntryDialogStyle, wxDefaultPosition) {}

        public TextEntryDialog(Window parent, string message, string caption, string value)
            : this(parent, message, caption, value, (int)wxTextEntryDialogStyle, wxDefaultPosition) {}

        public TextEntryDialog(Window parent, string message, string caption, string value, uint style)
            : this(parent, message, caption, value, (uint)style, wxDefaultPosition) {}

        public TextEntryDialog(Window parent, string message, string caption, string value, uint style, Point pos)
            : this(parent, wxString.SafeNew(message), wxString.SafeNew(caption), wxString.SafeNew(value), style, pos) { }

        public  TextEntryDialog(Window parent, wxString message, wxString caption, wxString value, uint style, Point pos)
            : this(wxTextEntryDialog_ctor(Object.SafePtr(parent), Object.SafePtr(message), Object.SafePtr(caption), Object.SafePtr(value), (uint)style, pos.X, pos.Y)) { }

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

        public string Value
        {
            get { return new wxString(wxTextEntryDialog_GetValue(wxObject), true); }
            set
            {
                wxString wxvalue = wxString.SafeNew(value);
                wxTextEntryDialog_SetValue(wxObject, Object.SafePtr(wxvalue));
            }
        }

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

        public override int ShowModal()
        {
            return wxTextEntryDialog_ShowModal(wxObject);
        }
    }

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

    public class GetPasswordFromUser
    {
        private string value = "";

        [DllImport("wx-c")]
        static extern IntPtr wxGetPasswordFromUser_func(IntPtr message, IntPtr caption, IntPtr defaultValue, IntPtr parent);

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

        public GetPasswordFromUser(string message)
            : this(message, "", "",  null) {}

        public GetPasswordFromUser(string message, string caption)
            : this(message, caption, "", null) {}

        public GetPasswordFromUser(string message, string caption, string defaultValue)
            : this(message, caption, defaultValue, null) {}

        public GetPasswordFromUser(string message, string caption, string defaultValue, Window parent)
            : this(wxString.SafeNew(message), wxString.SafeNew(caption), wxString.SafeNew(defaultValue), parent)
        {
        }
        public GetPasswordFromUser(wxString message, wxString caption, wxString defaultValue, Window parent)
        {
            value = new wxString(wxGetPasswordFromUser_func(Object.SafePtr(message), Object.SafePtr(caption), Object.SafePtr(defaultValue), Object.SafePtr(parent)), true);
        }

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

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

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

    public class GetTextFromUser
    {
        private string value = "";

        [DllImport("wx-c")]
        static extern IntPtr wxGetTextFromUser_func(IntPtr message, IntPtr caption, IntPtr defaultValue, IntPtr parent, int x, int y, bool centre);

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

        public GetTextFromUser(string message)
            : this(message, "", "",  null, -1, -1, true) {}

        public GetTextFromUser(string message, string caption)
            : this(message, caption, "", null, -1, -1, true) {}

        public GetTextFromUser(string message, string caption, string defaultValue)
            : this(message, caption, defaultValue, null, -1, -1, true) {}

        public GetTextFromUser(string message, string caption, string defaultValue, Window parent)
            : this(message, caption, defaultValue, parent, -1, -1, true) {}

        public GetTextFromUser(string message, string caption, string defaultValue, Window parent, int x)
            : this(message, caption, defaultValue, parent, x, -1, true) {}

        public GetTextFromUser(string message, string caption, string defaultValue, Window parent, int x, int y)
            : this(message, caption, defaultValue, parent, x, y, true) {}

        public GetTextFromUser(string message, string caption, string defaultValue, Window parent, int x, int y, bool centre)
            : this(wxString.SafeNew(message), wxString.SafeNew(caption), wxString.SafeNew(defaultValue), parent, x, y, centre)
        {
        }
        public GetTextFromUser(wxString message, wxString caption, wxString defaultValue, Window parent, int x, int y, bool centre)
        {
            value = new wxString(wxGetTextFromUser_func( Object.SafePtr(message), Object.SafePtr(caption), Object.SafePtr(defaultValue), Object.SafePtr(parent), x, y, centre), true);
        }

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

        public static implicit operator string(GetTextFromUser 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.