Files
mono/mcs/class/System.Windows.Forms/Gtk/CommonDialog.cs
T
Joel Basson 802417f479 Thu Jan 16 19:20:00 GMT+2 2003 Joel Basson <[email protected]>
* Applied patch from Alberto Fernandez with the following changes...
	Finished ProgressBar (Events?)
	Finished HScrollBar VScrollBar and ScrollBar
	Finished FolderBrowserDialog
	Base ComboBox
	Added DrawMode.cs
	Added ComboBoxStyle.cs
	Added Appearance.cs
	Added CheckState.cs
	Added TabAlignment
	Added TabAppearance.cs
	Added TabDrawMode.cs
	Added TabSizeMode.cs
	Added Panel.cs
	Added TabPage.cs
	Added TabControl.cs
	Added Cursors.cs
	Added MessageBoxDefaultButton.cs
	Added MessageBoxIcon.cs
	Added MessageBoxOptions.cs
	Changes in MessageBoxButtons.cs (Added values)
	Changes in MessageBox (Completed all functions, added return values).
	"Finished" CheckBox.cs
	"Finished" ComboBox.cs
	"Finished" RadioButton
	"Finished" GroupBox
	"Finished" Panel
	Changes in Form to work with new RadioButton.
	Fix double Click reported on MenuItems.
	"Finished" Application

svn path=/trunk/mcs/; revision=22123
2004-01-15 17:19:30 +00:00

107 lines
2.5 KiB
C#

//
// System.Windows.Forms.CommonDialog.cs
//
// Author:
// stubbed out by Jaak Simm ([email protected])
// Dennis Hayes ([email protected])
// Aleksey Ryabchuk ([email protected])
// (C) Ximian, Inc., 2002
//
using System.ComponentModel;
namespace System.Windows.Forms {
/// <summary>
/// Specifies the base class used for displaying dialog boxes on the screen.
/// </summary>
[MonoTODO]
public abstract class CommonDialog : Component {
internal bool dialogRetValue = false;
static CommonDialog(){
Gtk.Application.Init();
}
[MonoTODO]
public CommonDialog() : base (){
}
[MonoTODO]
protected virtual IntPtr HookProc(IntPtr hWnd,int msg,IntPtr wparam,IntPtr lparam){
return IntPtr.Zero;
}
protected virtual void OnHelpRequest(EventArgs e){
if ( HelpRequest != null )
HelpRequest ( this, e );
}
[MonoTODO]
protected virtual IntPtr OwnerWndProc(IntPtr hWnd,int msg,IntPtr wparam,IntPtr lparam) {
throw new NotImplementedException ();
}
public abstract void Reset();
protected abstract bool RunDialog(IntPtr hwndOwner);
[MonoTODO]
public DialogResult ShowDialog(){
bool res = RunDialog (IntPtr.Zero);
return res ? DialogResult.OK : DialogResult.Cancel;
}
public DialogResult ShowDialog(IWin32Window owner){
bool res = RunDialog ( IntPtr.Zero );
return res ? DialogResult.OK : DialogResult.Cancel;
}
public event EventHandler HelpRequest;
internal Gtk.Dialog dialog;
internal Gtk.Dialog Dialog{
get {
if (dialog == null){
dialog = CreateDialog();
dialog.Modal = true;
dialog.Response += new GtkSharp.ResponseHandler (OnResponse);
dialog.DeleteEvent += new GtkSharp.DeleteEventHandler (OnDelete);
}
return dialog;
}
}
internal abstract Gtk.Dialog CreateDialog();
internal void OnDelete (object sender, GtkSharp.DeleteEventArgs args){
Gtk.Window d = (Gtk.Window) sender;
d.Hide ();
dialogRetValue = false;
OnCancel();
args.RetVal = true;
}
internal virtual void OnResponse (object o, GtkSharp.ResponseArgs args){
switch (args.ResponseId){
case (int)Gtk.ResponseType.Accept:
case (int)Gtk.ResponseType.Ok:
case (int)Gtk.ResponseType.Yes:
case (int)Gtk.ResponseType.Apply:
dialogRetValue = true;
OnAccept();
Dialog.Hide();
break;
default:dialogRetValue = false;
OnCancel();
Dialog.Hide();
break;
}
}
internal virtual void OnCancel(){
}
internal virtual void OnAccept (){
}
}
}