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

FXMessageBox.h

00001 /********************************************************************************
00002 *                                                                               *
00003 *                         M e s s a g e   B o x e s                             *
00004 *                                                                               *
00005 *********************************************************************************
00006 * Copyright (C) 1997,2002 by Jeroen van der Zijp.   All Rights Reserved.        *
00007 *********************************************************************************
00008 * This library is free software; you can redistribute it and/or                 *
00009 * modify it under the terms of the GNU Lesser General Public                    *
00010 * License as published by the Free Software Foundation; either                  *
00011 * version 2.1 of the License, or (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 GNU             *
00016 * Lesser General Public License for more details.                               *
00017 *                                                                               *
00018 * You should have received a copy of the GNU Lesser General Public              *
00019 * License along with this library; if not, write to the Free Software           *
00020 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA.    *
00021 *********************************************************************************
00022 * $Id: FXMessageBox.h,v 1.17 2002/01/18 22:42:54 jeroen Exp $                   *
00023 ********************************************************************************/
00024 #ifndef FXMESSAGEBOX_H
00025 #define FXMESSAGEBOX_H
00026 
00027 #ifndef FXDIALOGBOX_H
00028 #include "FXDialogBox.h"
00029 #endif
00030 
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   };
00042 
00043 
00044 // Return values
00045 enum {
00046   MBOX_CLICKED_YES      = 1,            /// The YES button was clicked
00047   MBOX_CLICKED_NO       = 2,            /// The NO button was clicked
00048   MBOX_CLICKED_OK       = 3,            /// The OK button was clicked
00049   MBOX_CLICKED_CANCEL   = 4,            /// The CANCEL button was clicked
00050   MBOX_CLICKED_QUIT     = 5,            /// The QUIT button was clicked
00051   MBOX_CLICKED_SAVE     = 6             /// The SAVE button was clicked
00052   };
00053 
00054 
00055 /// Message box
00056 class FXAPI FXMessageBox : public FXDialogBox {
00057   FXDECLARE(FXMessageBox)
00058 protected:
00059   FXMessageBox(){}
00060 private:
00061   FXMessageBox(const FXMessageBox&);
00062   FXMessageBox &operator=(const FXMessageBox&);
00063   void initialize(const FXString& text,FXIcon* ic,FXuint whichbuttons);
00064 public:
00065   long onCmdClicked(FXObject*,FXSelector,void*);
00066   long onCmdCancel(FXObject*,FXSelector,void*);
00067 public:
00068   enum{
00069     ID_CLICKED_YES=FXDialogBox::ID_LAST,
00070     ID_CLICKED_NO,
00071     ID_CLICKED_OK,
00072     ID_CLICKED_CANCEL,
00073     ID_CLICKED_QUIT,
00074     ID_CLICKED_SAVE,
00075     ID_LAST
00076     };
00077 public:
00078 
00079   /// Construct message box with given caption, icon, and message text
00080   FXMessageBox(FXWindow* owner,const FXString& caption,const FXString& text,FXIcon* ic=NULL,FXuint opts=0,FXint x=0,FXint y=0);
00081 
00082   /// Construct free floating message box with given caption, icon, and message text
00083   FXMessageBox(FXApp* a,const FXString& caption,const FXString& text,FXIcon* ic=NULL,FXuint opts=0,FXint x=0,FXint y=0);
00084 
00085   /**
00086   * Show a modal error message.
00087   * The text message may contain printf-tyle formatting commands.
00088   */
00089   static FXuint error(FXWindow* owner,FXuint opts,const char* caption,const char* message,...) FX_PRINTF(4,5) ;
00090 
00091   /**
00092   * Show a modal warning message
00093   * The text message may contain printf-tyle formatting commands.
00094   */
00095   static FXuint warning(FXWindow* owner,FXuint opts,const char* caption,const char* message,...) FX_PRINTF(4,5) ;
00096 
00097   /**
00098   * Show a modal question dialog
00099   * The text message may contain printf-tyle formatting commands.
00100   */
00101   static FXuint question(FXWindow* owner,FXuint opts,const char* caption,const char* message,...) FX_PRINTF(4,5) ;
00102 
00103   /**
00104   * Show a modal information dialog
00105   * The text message may contain printf-tyle formatting commands.
00106   */
00107   static FXuint information(FXWindow* owner,FXuint opts,const char* caption,const char* message,...) FX_PRINTF(4,5) ;
00108 
00109   };
00110 
00111 
00112 
00113 #endif