2 // System.Windows.Forms.CommonDialog.cs
5 // stubbed out by Jaak Simm (jaaksimm@firm.ee)
6 // Dennis Hayes (dennish@Raytek.com)
7 // Aleksey Ryabchuk (ryabchuk@yahoo.com)
8 // (C) Ximian, Inc., 2002
11 using System
.ComponentModel
;
13 namespace System
.Windows
.Forms
{
16 /// Specifies the base class used for displaying dialog boxes on the screen.
20 public abstract class CommonDialog
: Component
{
22 internal bool dialogRetValue
= false;
24 static CommonDialog(){
25 Gtk
.Application
.Init();
29 public CommonDialog() : base (){
33 protected virtual IntPtr
HookProc(IntPtr hWnd
,int msg
,IntPtr wparam
,IntPtr lparam
){
37 protected virtual void OnHelpRequest(EventArgs e
){
38 if ( HelpRequest
!= null )
39 HelpRequest ( this, e
);
43 protected virtual IntPtr
OwnerWndProc(IntPtr hWnd
,int msg
,IntPtr wparam
,IntPtr lparam
) {
44 throw new NotImplementedException ();
47 public abstract void Reset();
48 protected abstract bool RunDialog(IntPtr hwndOwner
);
51 public DialogResult
ShowDialog(){
52 bool res
= RunDialog (IntPtr
.Zero
);
53 return res
? DialogResult
.OK
: DialogResult
.Cancel
;
56 public DialogResult
ShowDialog(IWin32Window owner
){
57 bool res
= RunDialog ( IntPtr
.Zero
);
58 return res
? DialogResult
.OK
: DialogResult
.Cancel
;
60 public event EventHandler HelpRequest
;
62 internal Gtk
.Dialog dialog
;
63 internal Gtk
.Dialog Dialog
{
66 dialog
= CreateDialog();
68 dialog
.Response
+= new GtkSharp
.ResponseHandler (OnResponse
);
69 dialog
.DeleteEvent
+= new GtkSharp
.DeleteEventHandler (OnDelete
);
75 internal abstract Gtk
.Dialog
CreateDialog();
77 internal void OnDelete (object sender
, GtkSharp
.DeleteEventArgs args
){
78 Gtk
.Window d
= (Gtk
.Window
) sender
;
80 dialogRetValue
= false;
84 internal virtual void OnResponse (object o
, GtkSharp
.ResponseArgs args
){
85 switch (args
.ResponseId
){
86 case (int)Gtk
.ResponseType
.Accept
:
87 case (int)Gtk
.ResponseType
.Ok
:
88 case (int)Gtk
.ResponseType
.Yes
:
89 case (int)Gtk
.ResponseType
.Apply
:
90 dialogRetValue
= true;
94 default:dialogRetValue
= false;
100 internal virtual void OnCancel(){
103 internal virtual void OnAccept (){