//-----------------------------------------------------------------------------
// 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;
}
}
}
|