* TabControl.cs: Show the tooltip depending on the value
[mono.git] / mcs / class / Managed.Windows.Forms / System.Windows.Forms / MessageBox.cs
1 // Permission is hereby granted, free of charge, to any person obtaining
2 // a copy of this software and associated documentation files (the
3 // "Software"), to deal in the Software without restriction, including
4 // without limitation the rights to use, copy, modify, merge, publish,
5 // distribute, sublicense, and/or sell copies of the Software, and to
6 // permit persons to whom the Software is furnished to do so, subject to
7 // the following conditions:
8 //
9 // The above copyright notice and this permission notice shall be
10 // included in all copies or substantial portions of the Software.
11 //
12 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
13 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
14 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
15 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
16 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
17 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
18 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
19 //
20 // Copyright (c) 2004-2006 Novell, Inc.
21 //
22 // Authors:
23 //      Jordi Mas i Hernandez   (jordi@ximian.com)
24 //      Benjamin Dasnois        (benjamin.dasnois@gmail.com)
25 //      Robert Thompson         (rmt@corporatism.org)
26 //      Peter Bartok            (pbartok@novell.com)
27 //
28 // TODO:
29 //      - Add support for MessageBoxOptions and MessageBoxDefaultButton.
30 //
31
32
33 // NOT COMPLETE
34
35 using System;
36 using System.Drawing;
37 using System.Globalization;
38 using System.Resources;
39
40 namespace System.Windows.Forms
41 {
42         public class MessageBox
43         {
44                 #region Private MessageBoxForm class
45 #if NET_2_0 // UIA Framework
46                 internal class MessageBoxForm : Form
47 #else
48                 private class MessageBoxForm : Form
49 #endif
50                 {
51                         #region MessageBoxFrom Local Variables
52                         const int space_border = 10;
53                         const int button_width = 86;
54                         const int button_height = 23;
55                         const int button_space = 5;
56                         const int space_image_text= 10;
57
58                         string                  msgbox_text;
59                         bool                    size_known      = false;
60                         Icon                    icon_image;
61                         RectangleF              text_rect;
62                         MessageBoxButtons       msgbox_buttons;
63                         MessageBoxDefaultButton msgbox_default;
64                         bool                    buttons_placed  = false;
65                         int                     button_left;
66                         Button[]                buttons = new Button[4];
67                         bool                    show_help;
68                         string help_file_path;
69                         string help_keyword;
70                         HelpNavigator help_navigator;
71                         object help_param;
72                         AlertType               alert_type;
73                         #endregion      // MessageBoxFrom Local Variables
74                         
75                         #region MessageBoxForm Constructors
76                         public MessageBoxForm (IWin32Window owner, string text, string caption,
77                                                MessageBoxButtons buttons, MessageBoxIcon icon,
78                                                bool displayHelpButton)
79                         {
80                                 show_help = displayHelpButton;
81
82                                 switch (icon) {
83                                         case MessageBoxIcon.None: {
84                                                 icon_image = null;
85                                                 alert_type = AlertType.Default;
86                                                 break;
87                                         }
88
89                                         case MessageBoxIcon.Error: {            // Same as MessageBoxIcon.Hand and MessageBoxIcon.Stop
90                                                 icon_image = SystemIcons.Error;
91                                                 alert_type = AlertType.Error;
92                                                 break;
93                                         }
94
95                                         case MessageBoxIcon.Question: {
96                                                 icon_image = SystemIcons.Question;
97                                                 alert_type = AlertType.Question;
98                                                 break;
99                                         }
100
101                                         case MessageBoxIcon.Asterisk: {         // Same as MessageBoxIcon.Information
102                                                 icon_image = SystemIcons.Information;
103                                                 alert_type = AlertType.Information;
104                                                 break;
105                                         }
106
107                                         case MessageBoxIcon.Warning: {          // Same as MessageBoxIcon.Exclamation:
108                                                 icon_image = SystemIcons.Warning;
109                                                 alert_type = AlertType.Warning;
110                                                 break;
111                                         }
112                                 }
113
114                                 msgbox_text = text;
115                                 msgbox_buttons = buttons;
116                                 msgbox_default = MessageBoxDefaultButton.Button1;
117
118                                 if (owner != null) {
119                                         Owner = Control.FromHandle(owner.Handle).FindForm();
120                                 } else {
121                                         if (Application.MWFThread.Current.Context != null) {
122                                                 Owner = Application.MWFThread.Current.Context.MainForm;
123                                         }
124                                 }
125                                 this.Text = caption;
126                                 this.ControlBox = true;
127                                 this.MinimizeBox = false;
128                                 this.MaximizeBox = false;
129                                 this.ShowInTaskbar = (Owner == null);
130                                 this.FormBorderStyle = FormBorderStyle.FixedDialog;
131                         }
132
133                         public MessageBoxForm (IWin32Window owner, string text, string caption,
134                                         MessageBoxButtons buttons, MessageBoxIcon icon,
135                                         MessageBoxDefaultButton defaultButton, MessageBoxOptions options, bool displayHelpButton)
136                                 : this (owner, text, caption, buttons, icon, displayHelpButton)
137                         {
138                                 msgbox_default = defaultButton;
139                         }
140
141                         public MessageBoxForm (IWin32Window owner, string text, string caption,
142                                                MessageBoxButtons buttons, MessageBoxIcon icon)
143                                 : this (owner, text, caption, buttons, icon, false)
144                         {
145                         }
146                         #endregion      // MessageBoxForm Constructors
147
148                         #region Protected Instance Properties
149                         protected override CreateParams CreateParams {
150                                 get {
151                                         CreateParams cp = base.CreateParams;;
152
153                                         cp.Style |= (int)(WindowStyles.WS_DLGFRAME | WindowStyles.WS_CLIPCHILDREN | WindowStyles.WS_CLIPSIBLINGS | WindowStyles.WS_CAPTION);
154                                         
155                                         if (!is_enabled)
156                                                 cp.Style |= (int)(WindowStyles.WS_DISABLED);
157
158                                         return cp;
159                                 }
160                         }
161                         #endregion      // Protected Instance Properties
162
163                         #region MessageBoxForm Methods
164                         public void SetHelpData (string file_path, string keyword, HelpNavigator navigator, object param)
165                         {
166                                 help_file_path = file_path;
167                                 help_keyword = keyword;
168                                 help_navigator = navigator;
169                                 help_param = param;
170                         }
171                         
172                         internal string HelpFilePath {
173                                 get { return help_file_path; }
174                         }
175                         
176                         internal string HelpKeyword {
177                                 get { return help_keyword; }
178                         }
179                         
180                         internal HelpNavigator HelpNavigator {
181                                 get { return help_navigator; }
182                         }
183                         
184                         internal object HelpParam {
185                                 get { return help_param; }
186                         }
187                         
188                         public DialogResult RunDialog ()
189                         {
190                                 this.StartPosition = FormStartPosition.CenterScreen;
191
192                                 if (size_known == false) {
193                                         InitFormsSize ();
194                                 }
195
196                                 if (Owner != null)
197                                         TopMost = Owner.TopMost;
198                                         
199                                 XplatUI.AudibleAlert (alert_type);
200                                 this.ShowDialog ();
201
202                                 return this.DialogResult;
203                         }
204
205                         internal override void OnPaintInternal (PaintEventArgs e)
206                         {
207                                 e.Graphics.DrawString (msgbox_text, this.Font, ThemeEngine.Current.ResPool.GetSolidBrush (Color.Black), text_rect);
208                                 if (icon_image != null) {
209                                         e.Graphics.DrawIcon(icon_image, space_border, space_border);
210                                 }
211                         }
212
213                         private void InitFormsSize ()
214                         {
215                                 int tb_width = 0;
216
217                                 // Max width of messagebox must be 60% of screen width
218                                 int max_width = (int) (Screen.GetWorkingArea (this).Width * 0.6);
219
220                                 // First we have to know the size of text + image
221                                 Drawing.SizeF tsize = TextRenderer.MeasureString (msgbox_text, this.Font, max_width);
222                                 text_rect.Size = tsize;
223                                 
224                                 if (icon_image != null) {
225                                         tsize.Width += icon_image.Width + 10;
226                                         if(icon_image.Height > tsize.Height) {
227                                                 // Place text middle-right
228                                                 text_rect.Location = new Point (icon_image.Width + space_image_text + space_border, (int)((icon_image.Height/2)-(tsize.Height/2)) + space_border);
229                                         } else {
230                                                 text_rect.Location = new Point (icon_image.Width + space_image_text + space_border, 2 + space_border);
231                                         }
232                                         if (tsize.Height < icon_image.Height)
233                                                 tsize.Height = icon_image.Height;
234                                 } else {
235                                         text_rect.Location = new Point (space_border + button_space, space_border);
236                                 }
237                                 tsize.Height += space_border * 2;
238
239                                 // Now we want to know the amount of buttons
240                                 int buttoncount;
241                                 switch (msgbox_buttons) {
242                                         case MessageBoxButtons.OK:
243                                                 buttoncount = 1;
244                                                 break;
245
246                                         case MessageBoxButtons.OKCancel:
247                                                 buttoncount = 2;
248                                                 break;
249
250                                         case MessageBoxButtons.AbortRetryIgnore:
251                                                 buttoncount = 3;
252                                                 break;
253
254                                         case MessageBoxButtons.YesNoCancel:
255                                                 buttoncount = 3;
256                                                 break;
257
258                                         case MessageBoxButtons.YesNo:
259                                                 buttoncount = 2;
260                                                 break;
261
262                                         case MessageBoxButtons.RetryCancel:
263                                                 buttoncount = 2;
264                                                 break;
265                                         
266                                         default:
267                                                 buttoncount = 0;
268                                                 break;
269                                 
270                                 }
271                                 if (show_help)
272                                         buttoncount ++;
273                                 
274                                 // Calculate the width based on amount of buttons 
275                                 tb_width = (button_width + button_space) * buttoncount;  
276
277                                 // The form caption can also make us bigger
278                                 SizeF caption = TextRenderer.MeasureString (Text, new Font (DefaultFont, FontStyle.Bold));
279                                 
280                                 // Use the bigger of the caption size (plus some arbitrary borders/close button)
281                                 // or the text size, up to 60% of the screen (max_size)
282                                 Size new_size = new SizeF (Math.Min (Math.Max (caption.Width + 40, tsize.Width), max_width), tsize.Height).ToSize ();
283                                 
284                                 // Now we choose the good size for the form
285                                 if (new_size.Width > tb_width)
286                                         this.ClientSize = new Size (new_size.Width + (space_border * 2), Height = new_size.Height + (space_border * 4));
287                                 else
288                                         this.ClientSize = new Size (tb_width + (space_border * 2), Height = new_size.Height + (space_border * 4));
289
290                                 // Now we set the left of the buttons
291                                 button_left = (this.ClientSize.Width / 2) - (tb_width / 2) + 5;
292                                 AddButtons ();
293                                 size_known = true;
294
295                                 // Still needs to implement defaultButton and options
296                                 switch(msgbox_default) {
297                                         case MessageBoxDefaultButton.Button2: {
298                                                 if (this.buttons[1] != null) {
299                                                         ActiveControl = this.buttons[1];
300                                                 }
301                                                 break;
302                                         }
303
304                                         case MessageBoxDefaultButton.Button3: {
305                                                 if (this.buttons[2] != null) {
306                                                         ActiveControl = this.buttons[2];
307                                                 }
308                                                 break;
309                                         }
310                                 }
311                         }
312
313                         protected override bool ProcessDialogKey(Keys keyData) {
314                                 if (keyData == Keys.Escape) {
315                                         this.CancelClick(this, null);
316                                         return true;
317                                 }
318
319                                 if (((keyData & Keys.Modifiers) == Keys.Control) &&
320                                         (((keyData & Keys.KeyCode) == Keys.C) ||
321                                          ((keyData & Keys.KeyCode) == Keys.Insert))) {  
322                                         Copy();
323                                 }
324
325                                 return base.ProcessDialogKey (keyData);
326                         }
327
328                         protected override bool ProcessDialogChar (char charCode)
329                         {
330                                 // Shortcut keys, kinda like mnemonics, except you don't have to press Alt
331                                 if ((charCode == 'N' || charCode == 'n') && (CancelButton != null && (CancelButton as Button).Text == "No"))
332                                         CancelButton.PerformClick ();
333                                 else if ((charCode == 'Y' || charCode == 'y') && (AcceptButton as Button).Text == "Yes")
334                                         AcceptButton.PerformClick ();
335                                 else if ((charCode == 'A' || charCode == 'a') && (CancelButton != null && (CancelButton as Button).Text == "Abort"))
336                                         CancelButton.PerformClick ();
337                                 else if ((charCode == 'R' || charCode == 'r') && (AcceptButton as Button).Text == "Retry")
338                                         AcceptButton.PerformClick ();
339                                 else if ((charCode == 'I' || charCode == 'i') && buttons.Length >= 3 && buttons[2].Text == "Ignore")
340                                         buttons[2].PerformClick ();
341                                 
342                                 return base.ProcessDialogChar (charCode);
343                         }
344                         
345                         private void Copy ()
346                         {
347                                 string separator = "---------------------------" + Environment.NewLine;
348
349                                 System.Text.StringBuilder contents = new System.Text.StringBuilder ();
350
351                                 contents.Append (separator);
352                                 contents.Append (this.Text).Append (Environment.NewLine);
353                                 contents.Append (separator);
354                                 contents.Append (msgbox_text).Append (Environment.NewLine);
355                                 contents.Append (separator);
356
357                                 foreach (Button btn in buttons) {
358                                         if (btn == null)
359                                                 break;
360                                         contents.Append (btn.Text).Append ("   ");;
361                                 }
362
363                                 contents.Append (Environment.NewLine);
364                                 contents.Append (separator);
365
366                                 DataObject obj = new DataObject(DataFormats.Text, contents.ToString());
367                                 Clipboard.SetDataObject (obj);
368                         }
369
370                         #endregion      // MessageBoxForm Methods
371
372                         #region Functions for Adding buttons
373                         private void AddButtons()
374                         {
375                                 if (!buttons_placed) {
376                                         switch (msgbox_buttons) {
377                                                 case MessageBoxButtons.OK: {
378                                                         buttons[0] = AddOkButton (0);
379                                                         break;
380                                                 }
381
382                                                 case MessageBoxButtons.OKCancel: {
383                                                         buttons[0] = AddOkButton (0);
384                                                         buttons[1] = AddCancelButton (1);
385                                                         break;
386                                                 }
387
388                                                 case MessageBoxButtons.AbortRetryIgnore: {
389                                                         buttons[0] = AddAbortButton (0);
390                                                         buttons[1] = AddRetryButton (1);
391                                                         buttons[2] = AddIgnoreButton (2);
392                                                         break;
393                                                 }
394
395                                                 case MessageBoxButtons.YesNoCancel: {
396                                                         buttons[0] = AddYesButton (0);
397                                                         buttons[1] = AddNoButton (1);
398                                                         buttons[2] = AddCancelButton (2);
399                                                         break;
400                                                 }
401
402                                                 case MessageBoxButtons.YesNo: {
403                                                         buttons[0] = AddYesButton (0);
404                                                         buttons[1] = AddNoButton (1);
405                                                         break;
406                                                 }
407
408                                                 case MessageBoxButtons.RetryCancel: {
409                                                         buttons[0] = AddRetryButton (0);
410                                                         buttons[1] = AddCancelButton (1);
411                                                         break;
412                                                 }
413                                         }
414
415 #if NET_2_0
416                                         if (show_help) {
417                                                 for (int i = 0; i <= 3; i++) {
418                                                         if (buttons [i] == null) {
419                                                                 AddHelpButton (i);
420                                                                 break;
421                                                         }
422                                                 }
423                                         }
424 #endif
425                                         buttons_placed = true;
426                                 }
427                         }
428
429                         private Button AddButton (string text, int left, EventHandler click_event)
430                         {
431                                 Button button = new Button ();
432                                 button.Text = Locale.GetText(text);
433                                 button.Width = button_width;
434                                 button.Height = button_height;
435                                 button.Top = this.ClientSize.Height - button.Height - space_border;
436                                 button.Left =  ((button_width + button_space) * left) + button_left;
437                                 
438                                 if (click_event != null)
439                                         button.Click += click_event;
440                                 
441                                 if ((text == "OK") || (text == "Retry") || (text == "Yes")) 
442                                         AcceptButton = button;
443                                 else if ((text == "Cancel") || (text == "Abort") || (text == "No"))
444                                         CancelButton = button;
445                                 
446                                 this.Controls.Add (button);
447
448                                 return button;
449                         }
450
451                         private Button AddOkButton (int left)
452                         {
453                                 return AddButton ("OK", left, new EventHandler (OkClick));
454                         }
455
456                         private Button AddCancelButton (int left)
457                         {
458                                 return AddButton ("Cancel", left, new EventHandler (CancelClick));
459                         }
460
461                         private Button AddAbortButton (int left)
462                         {
463                                 return AddButton ("Abort", left, new EventHandler (AbortClick));
464                         }
465
466                         private Button AddRetryButton(int left)
467                         {
468                                 return AddButton ("Retry", left, new EventHandler (RetryClick));
469                         }
470
471                         private Button AddIgnoreButton (int left)
472                         {
473                                 return AddButton ("Ignore", left, new EventHandler (IgnoreClick));
474                         }
475
476                         private Button AddYesButton (int left)
477                         {
478                                 return AddButton ("Yes", left, new EventHandler (YesClick));
479                         }
480
481                         private Button AddNoButton (int left)
482                         {
483                                 return AddButton ("No", left, new EventHandler (NoClick));
484                         }
485
486 #if NET_2_0
487                         private Button AddHelpButton (int left)
488                         {
489                                 Button button = AddButton ("Help", left, null);
490                                 button.Click += delegate { Owner.RaiseHelpRequested (new HelpEventArgs (Owner.Location)); };
491                                 return button;
492                         }
493 #endif
494                         #endregion
495
496                         #region Button click handlers
497                         private void OkClick (object sender, EventArgs e)
498                         {
499                                 this.DialogResult = DialogResult.OK;
500                                 this.Close ();
501                         }
502
503                         private void CancelClick (object sender, EventArgs e)
504                         {
505                                 this.DialogResult = DialogResult.Cancel;
506                                 this.Close ();
507                         }
508
509                         private void AbortClick (object sender, EventArgs e)
510                         {
511                                 this.DialogResult = DialogResult.Abort;
512                                 this.Close ();
513                         }
514
515                         private void RetryClick (object sender, EventArgs e)
516                         {
517                                 this.DialogResult = DialogResult.Retry;
518                                 this.Close ();
519                         }
520
521                         private void IgnoreClick (object sender, EventArgs e)
522                         {
523                                 this.DialogResult = DialogResult.Ignore;
524                                 this.Close ();
525                         }
526
527                         private void YesClick (object sender, EventArgs e)
528                         {
529                                 this.DialogResult = DialogResult.Yes;
530                                 this.Close ();
531                         }
532
533                         private void NoClick (object sender, EventArgs e)
534                         {
535                                 this.DialogResult = DialogResult.No;
536                                 this.Close ();
537                         }
538                         #endregion
539
540 #if NET_2_0
541                 
542                         #region UIA Framework: Methods, Properties and Events
543
544                         internal string UIAMessage {
545                                 get { return msgbox_text; }
546                         }
547
548                         internal Rectangle UIAMessageRectangle {
549                                 get { 
550                                         return new Rectangle ((int) text_rect.X,
551                                                               (int) text_rect.Y, 
552                                                               (int) text_rect.Width, 
553                                                               (int) text_rect.Height); 
554                                 }
555                         }
556
557                         internal Rectangle UIAIconRectangle {
558                                 get { 
559                                         return new Rectangle (space_border, 
560                                                               space_border, 
561                                                               icon_image == null ? -1 : icon_image.Width, 
562                                                               icon_image == null ? -1 : icon_image.Height);
563                                 }
564                         }
565
566                         #endregion
567
568 #endif
569                 }
570                 #endregion      // Private MessageBoxForm class
571
572
573                 #region Constructors
574                 private MessageBox ()
575                 {
576                 }
577                 #endregion      // Constructors
578
579                 #region Public Static Methods
580                 public static DialogResult Show (string text)
581                 {
582                         MessageBoxForm form = new MessageBoxForm (null, text, string.Empty, MessageBoxButtons.OK, MessageBoxIcon.None);
583
584                         return form.RunDialog ();
585                 }
586
587                 public static DialogResult Show (IWin32Window owner, string text)
588                 {
589                         MessageBoxForm form = new MessageBoxForm (owner, text, string.Empty, MessageBoxButtons.OK, MessageBoxIcon.None);
590                                 
591                         return form.RunDialog ();
592                 }
593
594                 public static DialogResult Show (string text, string caption)
595                 {
596                         MessageBoxForm form = new MessageBoxForm (null, text, caption, MessageBoxButtons.OK, MessageBoxIcon.None);
597
598                         return form.RunDialog ();
599                 }
600
601                 public static DialogResult Show (string text, string caption, MessageBoxButtons buttons)
602                 {
603                         MessageBoxForm form = new MessageBoxForm (null, text, caption, buttons, MessageBoxIcon.None);
604                                 
605                         return form.RunDialog ();
606                 }
607
608                 public static DialogResult Show (IWin32Window owner, string text, string caption,
609                                                  MessageBoxButtons buttons)
610                 {
611                         MessageBoxForm form = new MessageBoxForm (owner, text, caption, buttons, MessageBoxIcon.None);
612                                 
613                         return form.RunDialog ();
614                 }
615
616                 public static DialogResult Show (IWin32Window owner, string text, string caption,
617                                                  MessageBoxButtons buttons, MessageBoxIcon icon)
618                 {
619                         MessageBoxForm form = new MessageBoxForm (owner, text, caption, buttons, icon);
620                                 
621                         return form.RunDialog ();
622                 }
623
624
625                 public static DialogResult Show (IWin32Window owner, string text, string caption)
626                 {
627                         MessageBoxForm form = new MessageBoxForm (owner, text, caption, MessageBoxButtons.OK, MessageBoxIcon.None);
628                                 
629                         return form.RunDialog ();
630                 }
631
632
633                 public static DialogResult Show (string text, string caption, MessageBoxButtons buttons,
634                                 MessageBoxIcon icon)
635                 {
636                         MessageBoxForm form = new MessageBoxForm (null, text, caption, buttons, icon);
637                                 
638                         return form.RunDialog ();
639                 }
640
641                 public static DialogResult Show (string text, string caption, MessageBoxButtons buttons,
642                                                  MessageBoxIcon icon, MessageBoxDefaultButton defaultButton)
643                 {
644
645                         MessageBoxForm form = new MessageBoxForm (null, text, caption, buttons,
646                                                                   icon, defaultButton, MessageBoxOptions.DefaultDesktopOnly, false);
647                                 
648                         return form.RunDialog ();
649                 }
650
651                 public static DialogResult Show (IWin32Window owner, string text, string caption,
652                                                  MessageBoxButtons buttons, MessageBoxIcon icon,
653                                                  MessageBoxDefaultButton defaultButton)
654                 {
655                         MessageBoxForm form = new MessageBoxForm (owner, text, caption, buttons,
656                                                                   icon, defaultButton, MessageBoxOptions.DefaultDesktopOnly, false);
657                                 
658                         return form.RunDialog ();
659                 }
660
661                 public static DialogResult Show (string text, string caption, MessageBoxButtons buttons, MessageBoxIcon icon,
662                                                  MessageBoxDefaultButton defaultButton, MessageBoxOptions options)
663                 {
664                         MessageBoxForm form = new MessageBoxForm (null, text, caption, buttons,
665                                                                   icon, defaultButton, options, false);
666                                 
667                         return form.RunDialog ();
668                 }
669
670                 public static DialogResult Show (IWin32Window owner, string text, string caption, MessageBoxButtons buttons, MessageBoxIcon icon,
671                                                  MessageBoxDefaultButton defaultButton, MessageBoxOptions options)
672                 {
673                         MessageBoxForm form = new MessageBoxForm (owner, text, caption, buttons,
674                                                                   icon, defaultButton, options, false);
675                                 
676                         return form.RunDialog ();
677                 }
678                 #endregion      // Public Static Methods
679
680 #if NET_2_0
681                 public static DialogResult Show (string text, string caption, MessageBoxButtons buttons, MessageBoxIcon icon,
682                                                  MessageBoxDefaultButton defaultButton, MessageBoxOptions options,
683                                                  bool displayHelpButton)
684                 {
685                         MessageBoxForm form = new MessageBoxForm (null, text, caption, buttons,
686                                                                   icon, defaultButton, options, displayHelpButton);
687                         return form.RunDialog ();
688                 }
689                 
690                 [MonoTODO ("Help is not implemented")]
691                 public static DialogResult Show (string text, string caption, MessageBoxButtons buttons, MessageBoxIcon icon,
692                                                  MessageBoxDefaultButton defaultButton, MessageBoxOptions options,
693                                                  string helpFilePath)
694                 {
695                         MessageBoxForm form = new MessageBoxForm (null, text, caption, buttons,
696                                                                   icon, defaultButton, options, true);
697                         form.SetHelpData (helpFilePath, null, HelpNavigator.TableOfContents, null);
698                         return form.RunDialog ();
699                 }
700                 
701                 [MonoTODO ("Help is not implemented")]
702                 public static DialogResult Show (string text, string caption, MessageBoxButtons buttons, MessageBoxIcon icon,
703                                                  MessageBoxDefaultButton defaultButton, MessageBoxOptions options,
704                                                  string helpFilePath, string keyword)
705                 {
706                         MessageBoxForm form = new MessageBoxForm (null, text, caption, buttons,
707                                                                   icon, defaultButton, options, true);
708                         form.SetHelpData (helpFilePath, keyword, HelpNavigator.TableOfContents, null);
709                         return form.RunDialog ();
710                 }
711                 
712                 [MonoTODO ("Help is not implemented")]
713                 public static DialogResult Show (string text, string caption, MessageBoxButtons buttons, MessageBoxIcon icon,
714                                                  MessageBoxDefaultButton defaultButton, MessageBoxOptions options,
715                                                  string helpFilePath, HelpNavigator navigator)
716                 {
717                         MessageBoxForm form = new MessageBoxForm (null, text, caption, buttons,
718                                                                   icon, defaultButton, options, true);
719                         form.SetHelpData (helpFilePath, null, navigator, null);
720                         return form.RunDialog ();
721                 }
722                 
723                 [MonoTODO ("Help is not implemented")]
724                 public static DialogResult Show (string text, string caption, MessageBoxButtons buttons, MessageBoxIcon icon,
725                                                  MessageBoxDefaultButton defaultButton, MessageBoxOptions options,
726                                                  string helpFilePath, HelpNavigator navigator, object param)
727                 {
728                         MessageBoxForm form = new MessageBoxForm (null, text, caption, buttons,
729                                                                   icon, defaultButton, options, true);
730                         form.SetHelpData (helpFilePath, null, navigator, param);
731                         return form.RunDialog ();
732                 }
733                 
734                 [MonoTODO ("Help is not implemented")]
735                 public static DialogResult Show (IWin32Window owner, string text, string caption, MessageBoxButtons buttons, MessageBoxIcon icon,
736                                                  MessageBoxDefaultButton defaultButton, MessageBoxOptions options,
737                                                  string helpFilePath)
738                 {
739                         MessageBoxForm form = new MessageBoxForm (owner, text, caption, buttons,
740                                                                   icon, defaultButton, options, true);
741                         form.SetHelpData (helpFilePath, null, HelpNavigator.TableOfContents, null);
742                         return form.RunDialog ();
743                 }
744                 
745                 [MonoTODO ("Help is not implemented")]
746                 public static DialogResult Show (IWin32Window owner, string text, string caption, MessageBoxButtons buttons, MessageBoxIcon icon,
747                                                  MessageBoxDefaultButton defaultButton, MessageBoxOptions options,
748                                                  string helpFilePath, string keyword)
749                 {
750                         MessageBoxForm form = new MessageBoxForm (owner, text, caption, buttons,
751                                                                   icon, defaultButton, options, true);
752                         form.SetHelpData (helpFilePath, keyword, HelpNavigator.TableOfContents, null);
753                         return form.RunDialog ();
754                 }
755                 
756                 [MonoTODO ("Help is not implemented")]
757                 public static DialogResult Show (IWin32Window owner, string text, string caption, MessageBoxButtons buttons, MessageBoxIcon icon,
758                                                  MessageBoxDefaultButton defaultButton, MessageBoxOptions options,
759                                                  string helpFilePath, HelpNavigator navigator)
760                 {
761                         MessageBoxForm form = new MessageBoxForm (owner, text, caption, buttons,
762                                                                   icon, defaultButton, options, true);
763                         form.SetHelpData (helpFilePath, null, navigator, null);
764                         return form.RunDialog ();
765                 }
766                 
767                 [MonoTODO ("Help is not implemented")]
768                 public static DialogResult Show (IWin32Window owner, string text, string caption, MessageBoxButtons buttons, MessageBoxIcon icon,
769                                                  MessageBoxDefaultButton defaultButton, MessageBoxOptions options,
770                                                  string helpFilePath, HelpNavigator navigator, object param)
771                 {
772                         MessageBoxForm form = new MessageBoxForm (owner, text, caption, buttons,
773                                                                   icon, defaultButton, options, true);
774                         form.SetHelpData (helpFilePath, null, navigator, param);
775                         return form.RunDialog ();
776                 }
777 #endif
778         }
779 }
780