Main Page Class Hierarchy Alphabetical List Compound List File List Compound Members
|
00001 /******************************************************************************** 00002 * * 00003 * M e s s a g e B o x e s * 00004 * * 00005 ********************************************************************************* 00006 * Copyright (C) 1997,2006 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.28 2006/01/22 17:58:06 fox Exp $ * 00023 ********************************************************************************/ 00024 #ifndef FXMESSAGEBOX_H 00025 #define FXMESSAGEBOX_H 00026 00027 #ifndef FXDIALOGBOX_H 00028 #include "FXDialogBox.h" 00029 #endif 00030 00031 namespace FX { 00032 00033 00034 // Message box buttons 00035 enum { 00036 MBOX_OK = 0x10000000, /// Message box has a only an OK button 00037 MBOX_OK_CANCEL = 0x20000000, /// Message box has OK and CANCEL buttons 00038 MBOX_YES_NO = 0x30000000, /// Message box has YES and NO buttons 00039 MBOX_YES_NO_CANCEL = 0x40000000, /// Message box has YES, NO, and CANCEL buttons 00040 MBOX_QUIT_CANCEL = 0x50000000, /// Message box has QUIT and CANCEL buttons 00041 MBOX_QUIT_SAVE_CANCEL = 0x60000000, /// Message box has QUIT, SAVE, and CANCEL buttons 00042 MBOX_SKIP_SKIPALL_CANCEL = 0x70000000, /// Message box has SKIP, SKIP ALL, and CANCEL buttons 00043 MBOX_SAVE_CANCEL_DONTSAVE = 0x80000000 /// Message box has DON'T SAVE,CANCEL and SAVE 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 }; 00058 00059 00060 /** 00061 * A Message Box is a convenience class which provides a dialog for 00062 * very simple common yes/no type interactions with the user. 00063 * The message box has an optional icon, a title string, and the question 00064 * which is presented to the user. It also has up to three buttons which 00065 * furnish standard responses to the question. 00066 * Message boxes are usually ran modally: the question must be answered 00067 * before the program may continue. 00068 */ 00069 class FXAPI FXMessageBox : public FXDialogBox { 00070 FXDECLARE(FXMessageBox) 00071 protected: 00072 FXMessageBox(){} 00073 private: 00074 FXMessageBox(const FXMessageBox&); 00075 FXMessageBox &operator=(const FXMessageBox&); 00076 void initialize(const FXString& text,FXIcon* ic,FXuint whichbuttons); 00077 public: 00078 long onCmdClicked(FXObject*,FXSelector,void*); 00079 long onCmdCancel(FXObject*,FXSelector,void*); 00080 public: 00081 enum{ 00082 ID_CLICKED_YES=FXDialogBox::ID_LAST, 00083 ID_CLICKED_NO, 00084 ID_CLICKED_OK, 00085 ID_CLICKED_CANCEL, 00086 ID_CLICKED_QUIT, 00087 ID_CLICKED_SAVE, 00088 ID_CLICKED_SKIP, 00089 ID_CLICKED_SKIPALL, 00090 ID_LAST 00091 }; 00092 public: 00093 00094 /// Construct message box with given caption, icon, and message text 00095 FXMessageBox(FXWindow* owner,const FXString& caption,const FXString& text,FXIcon* ic=NULL,FXuint opts=0,FXint x=0,FXint y=0); 00096 00097 /// Construct free floating message box with given caption, icon, and message text 00098 FXMessageBox(FXApp* app,const FXString& caption,const FXString& text,FXIcon* ic=NULL,FXuint opts=0,FXint x=0,FXint y=0); 00099 00100 /** 00101 * Show a modal error message. 00102 * The text message may contain printf-tyle formatting commands. 00103 */ 00104 static FXuint error(FXWindow* owner,FXuint opts,const char* caption,const char* message,...) FX_PRINTF(4,5) ; 00105 00106 /** 00107 * Show modal error message, in free floating window. 00108 */ 00109 static FXuint error(FXApp* app,FXuint opts,const char* caption,const char* message,...) FX_PRINTF(4,5) ; 00110 00111 /** 00112 * Show a modal warning message 00113 * The text message may contain printf-tyle formatting commands. 00114 */ 00115 static FXuint warning(FXWindow* owner,FXuint opts,const char* caption,const char* message,...) FX_PRINTF(4,5) ; 00116 00117 /** 00118 * Show modal warning message, in free floating window. 00119 */ 00120 static FXuint warning(FXApp* app,FXuint opts,const char* caption,const char* message,...) FX_PRINTF(4,5) ; 00121 00122 /** 00123 * Show a modal question dialog 00124 * The text message may contain printf-tyle formatting commands. 00125 */ 00126 static FXuint question(FXWindow* owner,FXuint opts,const char* caption,const char* message,...) FX_PRINTF(4,5) ; 00127 00128 /** 00129 * Show modal question message, in free floating window. 00130 */ 00131 static FXuint question(FXApp* app,FXuint opts,const char* caption,const char* message,...) FX_PRINTF(4,5) ; 00132 00133 /** 00134 * Show a modal information dialog 00135 * The text message may contain printf-tyle formatting commands. 00136 */ 00137 static FXuint information(FXWindow* owner,FXuint opts,const char* caption,const char* message,...) FX_PRINTF(4,5) ; 00138 00139 /** 00140 * Show modal information message, in free floating window. 00141 */ 00142 static FXuint information(FXApp* app,FXuint opts,const char* caption,const char* message,...) FX_PRINTF(4,5) ; 00143 00144 }; 00145 00146 } 00147 00148 #endif
Copyright © 1997-2005 Jeroen van der Zijp |