Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members

FXMessageBox.h

Go to the documentation of this file.
00001 /********************************************************************************
00002 *                                                                               *
00003 *                         M e s s a g e   B o x e s                             *
00004 *                                                                               *
00005 *********************************************************************************
00006 * Copyright (C) 1997,2009 by Jeroen van der Zijp.   All Rights Reserved.        *
00007 *********************************************************************************
00008 * This library is free software; you can redistribute it and/or modify          *
00009 * it under the terms of the GNU Lesser General Public License as published by   *
00010 * the Free Software Foundation; either version 3 of the License, or             *
00011 * (at your option) any later version.                                           *
00012 *                                                                               *
00013 * This library is distributed in the hope that it will be useful,               *
00014 * but WITHOUT ANY WARRANTY; without even the implied warranty of                *
00015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the                 *
00016 * GNU Lesser General Public License for more details.                           *
00017 *                                                                               *
00018 * You should have received a copy of the GNU Lesser General Public License      *
00019 * along with this program.  If not, see <http://www.gnu.org/licenses/>          *
00020 *********************************************************************************
00021 * $Id: FXMessageBox.h,v 1.33 2009/01/06 13:07:26 fox Exp $                      *
00022 ********************************************************************************/
00023 #ifndef FXMESSAGEBOX_H
00024 #define FXMESSAGEBOX_H
00025 
00026 #ifndef FXDIALOGBOX_H
00027 #include "FXDialogBox.h"
00028 #endif
00029 
00030 namespace FX {
00031 
00032 
00033 // Message box buttons
00034 enum {
00035   MBOX_OK                         = 0x10000000, /// Message box has a only an OK button
00036   MBOX_OK_CANCEL                  = 0x20000000, /// Message box has OK and CANCEL buttons
00037   MBOX_YES_NO                     = 0x30000000, /// Message box has YES and NO buttons
00038   MBOX_YES_NO_CANCEL              = 0x40000000, /// Message box has YES, NO, and CANCEL buttons
00039   MBOX_QUIT_CANCEL                = 0x50000000, /// Message box has QUIT and CANCEL buttons
00040   MBOX_QUIT_SAVE_CANCEL           = 0x60000000, /// Message box has QUIT, SAVE, and CANCEL buttons
00041   MBOX_SKIP_SKIPALL_CANCEL        = 0x70000000, /// Message box has SKIP, SKIP ALL, and CANCEL buttons
00042   MBOX_SAVE_CANCEL_DONTSAVE       = 0x80000000, /// Message box has DON'T SAVE,CANCEL and SAVE buttons
00043   MBOX_YES_YESALL_NO_NOALL_CANCEL = 0xA0000000  /// Message box has YES, YES ALL, NO, NO ALL, and CANCEL buttons
00044   };
00045 
00046 
00047 // Return values
00048 enum {
00049   MBOX_CLICKED_YES      = 1,            /// The YES button was clicked
00050   MBOX_CLICKED_NO       = 2,            /// The NO button was clicked
00051   MBOX_CLICKED_OK       = 3,            /// The OK button was clicked
00052   MBOX_CLICKED_CANCEL   = 4,            /// The CANCEL button was clicked
00053   MBOX_CLICKED_QUIT     = 5,            /// The QUIT button was clicked
00054   MBOX_CLICKED_SAVE     = 6,            /// The SAVE button was clicked
00055   MBOX_CLICKED_SKIP     = 7,            /// The SKIP button was clicked
00056   MBOX_CLICKED_SKIPALL  = 8,            /// The SKIP ALL button was clicked
00057   MBOX_CLICKED_YESALL   = 9,            /// The YES ALL button was clicked
00058   MBOX_CLICKED_NOALL    = 10            /// The NO ALL button was clicked
00059   };
00060 
00061 
00062 /**
00063 * A Message Box is a convenience class which provides a dialog for
00064 * very simple common yes/no type interactions with the user.
00065 * The message box has an optional icon, a title string, and the question
00066 * which is presented to the user.  It also has up to three buttons which
00067 * furnish standard responses to the question.
00068 * Message boxes are usually ran modally: the question must be answered
00069 * before the program may continue.
00070 */
00071 class FXAPI FXMessageBox : public FXDialogBox {
00072   FXDECLARE(FXMessageBox)
00073 protected:
00074   FXMessageBox(){}
00075 private:
00076   FXMessageBox(const FXMessageBox&);
00077   FXMessageBox &operator=(const FXMessageBox&);
00078   void initialize(const FXString& text,FXIcon* ic,FXuint whichbuttons);
00079 public:
00080   long onCmdClicked(FXObject*,FXSelector,void*);
00081   long onCmdCancel(FXObject*,FXSelector,void*);
00082 public:
00083   enum{
00084     ID_CLICKED_YES=FXDialogBox::ID_LAST,
00085     ID_CLICKED_NO,
00086     ID_CLICKED_OK,
00087     ID_CLICKED_CANCEL,
00088     ID_CLICKED_QUIT,
00089     ID_CLICKED_SAVE,
00090     ID_CLICKED_SKIP,
00091     ID_CLICKED_SKIPALL,
00092     ID_CLICKED_YESALL,
00093     ID_CLICKED_NOALL,
00094     ID_LAST
00095     };
00096 public:
00097 
00098   /// Construct message box with given caption, icon, and message text
00099   FXMessageBox(FXWindow* owner,const FXString& caption,const FXString& text,FXIcon* ic=NULL,FXuint opts=0,FXint x=0,FXint y=0);
00100 
00101   /// Construct free floating message box with given caption, icon, and message text
00102   FXMessageBox(FXApp* app,const FXString& caption,const FXString& text,FXIcon* ic=NULL,FXuint opts=0,FXint x=0,FXint y=0);
00103 
00104   /**
00105   * Show a modal error message.
00106   * The text message may contain printf-tyle formatting commands.
00107   */
00108   static FXuint error(FXWindow* owner,FXuint opts,const char* caption,const char* message,...) FX_PRINTF(4,5) ;
00109 
00110   /**
00111   * Show modal error message, in free floating window.
00112   */
00113   static FXuint error(FXApp* app,FXuint opts,const char* caption,const char* message,...) FX_PRINTF(4,5) ;
00114 
00115   /**
00116   * Show a modal warning message
00117   * The text message may contain printf-tyle formatting commands.
00118   */
00119   static FXuint warning(FXWindow* owner,FXuint opts,const char* caption,const char* message,...) FX_PRINTF(4,5) ;
00120 
00121   /**
00122   * Show modal warning message, in free floating window.
00123   */
00124   static FXuint warning(FXApp* app,FXuint opts,const char* caption,const char* message,...) FX_PRINTF(4,5) ;
00125 
00126   /**
00127   * Show a modal question dialog
00128   * The text message may contain printf-tyle formatting commands.
00129   */
00130   static FXuint question(FXWindow* owner,FXuint opts,const char* caption,const char* message,...) FX_PRINTF(4,5) ;
00131 
00132   /**
00133   * Show modal question message, in free floating window.
00134   */
00135   static FXuint question(FXApp* app,FXuint opts,const char* caption,const char* message,...) FX_PRINTF(4,5) ;
00136 
00137   /**
00138   * Show a modal information dialog
00139   * The text message may contain printf-tyle formatting commands.
00140   */
00141   static FXuint information(FXWindow* owner,FXuint opts,const char* caption,const char* message,...) FX_PRINTF(4,5) ;
00142 
00143   /**
00144   * Show modal information message, in free floating window.
00145   */
00146   static FXuint information(FXApp* app,FXuint opts,const char* caption,const char* message,...) FX_PRINTF(4,5) ;
00147 
00148   };
00149 
00150 }
00151 
00152 #endif

Copyright © 1997-2009 Jeroen van der Zijp