//-----------------------------------------------------------------------------
// wx.NET - MessageDialog.cs
//
// The wxMessageDialog 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: MessageDialog.cs,v 1.11 2007/11/24 17:55:46 harald_meyer Exp $
//-----------------------------------------------------------------------------
using System;
using System.Drawing;
using System.Runtime.InteropServices;
namespace wx{
// The MessageDialog class implements the interface for wxWidgets'
// wxMessageDialog class and wxMessageBox.
public class MessageDialog : Dialog
{
// MessageBox function
[DllImport("wx-c")] static extern int wxMsgBox(IntPtr parent, IntPtr msg, IntPtr cap, uint style, int posX, int posY);
// Message dialog methods
[DllImport("wx-c")] static extern IntPtr wxMessageDialog_ctor(IntPtr parent, IntPtr message, IntPtr caption, uint style, int posX, int posY);
[DllImport("wx-c")] static extern int wxMessageDialog_ShowModal(IntPtr self);
//---------------------------------------------------------------------
internal MessageDialog(IntPtr wxObject)
: base(wxObject) { }
public MessageDialog(Window parent, string msg)
: this(parent, msg, "Message box", wxOK | wxCANCEL | wxCENTRE, wxDefaultPosition) { }
public MessageDialog(Window parent, string msg, string caption)
: this(parent, msg, caption, wxOK | wxCANCEL | wxCENTRE, wxDefaultPosition) { }
public MessageDialog(Window parent, string msg, string caption, uint style)
: this(parent, msg, caption, style, wxDefaultPosition) { }
public MessageDialog(Window parent, string msg, string caption, uint style, Point pos)
: this(parent, wxString.SafeNew(msg), wxString.SafeNew(caption), style, pos) { }
public MessageDialog(Window parent, wxString msg, wxString caption, uint style, Point pos)
: this(wxMessageDialog_ctor(Object.SafePtr(parent), Object.SafePtr(msg), Object.SafePtr(caption), style, pos.X, pos.Y)) { }
//---------------------------------------------------------------------
public override int ShowModal()
{
return wxMessageDialog_ShowModal(wxObject);
}
//---------------------------------------------------------------------
// MessageBox interface
public static int ShowModal(string msg, string caption, uint style)
{
return ShowModal(null, msg, caption, style, new Point(-1, -1));
}
public static int ShowModal(Window parent, string msg, string caption, uint style)
{
return ShowModal(parent, msg, caption, style, new Point(-1, -1));
}
public static int ShowModal(Window parent, string msg, string caption, uint style, Point pos)
{
return ShowModal(parent, wxString.SafeNew(msg), wxString.SafeNew(caption), style, pos);
}
public static int ShowModal(Window parent, wxString msg, wxString caption, uint style, Point pos)
{
return wxMsgBox(Object.SafePtr(parent), Object.SafePtr(msg), Object.SafePtr(caption), style, pos.X, pos.Y);
}
public static int MessageBox(string msg)
{
return ShowModal(null, msg, "Message", wxOK, new Point(-1, -1));
}
public static int MessageBox(string msg, string caption)
{
return ShowModal(null, msg, caption, wxOK, new Point(-1, -1));
}
public static int MessageBox(string msg, string caption, uint style)
{
return ShowModal(null, msg, caption, style, new Point(-1, -1));
}
public static int MessageBox(string msg, string caption, uint style, Window parent)
{
return ShowModal(parent, msg, caption, style, new Point(-1, -1));
}
public static int MessageBox(string msg, string caption, uint style, Window parent, Point pos)
{
return ShowModal(parent, msg, caption, style, pos);
}
}
}
|