FXHandedMsgBox.h

Go to the documentation of this file.
00001 /********************************************************************************
00002 *                                                                               *
00003 *                            User handed message box                            *
00004 *                                                                               *
00005 *********************************************************************************
00006 * Copyright (C) 2005-2006 by Niall Douglas.   All Rights Reserved.              *
00007 *       NOTE THAT I DO NOT PERMIT ANY OF MY CODE TO BE PROMOTED TO THE GPL      *
00008 *********************************************************************************
00009 * This code is free software; you can redistribute it and/or modify it under    *
00010 * the terms of the GNU Library General Public License v2.1 as published by the  *
00011 * Free Software Foundation EXCEPT that clause 3 does not apply ie; you may not  *
00012 * "upgrade" this code to the GPL without my prior written permission.           *
00013 * Please consult the file "License_Addendum2.txt" accompanying this file.       *
00014 *                                                                               *
00015 * This code is distributed in the hope that it will be useful,                  *
00016 * but WITHOUT ANY WARRANTY; without even the implied warranty of                *
00017 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.                          *
00018 *********************************************************************************
00019 * $Id:                                                                          *
00020 ********************************************************************************/
00021 
00022 #if !defined(FXHANDEDMSGBOX_H) && !defined(FX_DISABLEGUI)
00023 #define FXHANDEDMSGBOX_H
00024 
00025 #include "FXHandedInterface.h"
00026 
00027 namespace FX {
00028 
00033 
00034 enum FXHandedMsgBoxFlags
00035 {
00036     HANDEDMSGBOX_BOTTOMWELL     = HANDEDINTERFACE_BOTTOMWELL,       
00037     HANDEDMSGBOX_SIDEWELL       = HANDEDINTERFACE_SIDEWELL,         
00038     HANDEDMSGBOX_OKBUTTON       = HANDEDINTERFACE_OKBUTTON,         
00039     HANDEDMSGBOX_DEFOKBUTTON    = HANDEDINTERFACE_DEFOKBUTTON,      
00040     HANDEDMSGBOX_CANCELBUTTON   = HANDEDINTERFACE_CANCELBUTTON,     
00041     HANDEDMSGBOX_OKCANCELBUTTONS= HANDEDINTERFACE_OKCANCELBUTTONS,  
00042     HANDEDMSGBOX_DEFCANCELBUTTON= HANDEDINTERFACE_DEFCANCELBUTTON,  
00043     HANDEDMSGBOX_DEFCANCEL      = HANDEDINTERFACE_DEFCANCEL,        
00044     HANDEDMSGBOX_USEYESNO       = HANDEDINTERFACE_USEYESNO,         
00045     HANDEDMSGBOX_RETRYBUTTON    = 0x40000000                        
00046 };
00047 
00056 struct FXHandedMsgBoxPrivate;
00057 class FXAPI FXHandedMsgBox : public FXHandedDialog
00058 {
00059     FXDECLARE(FXHandedMsgBox)
00060     FXHandedMsgBoxPrivate *p;
00061     FXHandedMsgBox(const FXHandedMsgBox &);
00062     FXHandedMsgBox &operator=(const FXHandedMsgBox &);
00063     void init(const FXString &text, const FXIcon *icon);
00064 protected:
00065     FXHandedMsgBox() : p(0) {}
00066 public:
00067     long onCmdClicked(FXObject*,FXSelector,void*);
00068     enum
00069     {
00070         ID_RETRY=FXHandedDialog::ID_LAST,
00071         ID_LAST
00072     };
00073 public:
00075     FXHandedMsgBox(FXApp *a, const FXString &caption, const FXString &text, const FXIcon *icon=informationalIcon(), FXuint opts=DECOR_ALL|HANDEDMSGBOX_DEFOKBUTTON,FXint x=0,FXint y=0,FXint w=200,FXint h=150,FXint pl=DEFAULT_PAD,FXint pr=DEFAULT_PAD,FXint pt=DEFAULT_PAD,FXint pb=DEFAULT_PAD,FXint hs=DEFAULT_SPACING,FXint vs=DEFAULT_SPACING);
00077     FXHandedMsgBox(FXWindow *owner, const FXString &caption, const FXString &text, const FXIcon *icon=informationalIcon(), FXuint opts=DECOR_ALL|HANDEDMSGBOX_DEFOKBUTTON,FXint x=0,FXint y=0,FXint w=200,FXint h=150,FXint pl=DEFAULT_PAD,FXint pr=DEFAULT_PAD,FXint pt=DEFAULT_PAD,FXint pb=DEFAULT_PAD,FXint hs=DEFAULT_SPACING,FXint vs=DEFAULT_SPACING);
00078     ~FXHandedMsgBox();
00080     FXString text() const;
00082     void setText(const FXString &text);
00087     virtual FXuint execute(FXuint placement=PLACEMENT_CURSOR);
00088 
00090     static FXuint fatalerror(FXApp *a, const FXString &caption, const FXString &text, FXuint opts=DECOR_ALL|HANDEDMSGBOX_DEFOKBUTTON,FXint x=0,FXint y=0,FXint w=200,FXint h=150,FXint pl=DEFAULT_PAD,FXint pr=DEFAULT_PAD,FXint pt=DEFAULT_PAD,FXint pb=DEFAULT_PAD,FXint hs=DEFAULT_SPACING,FXint vs=DEFAULT_SPACING)
00091     {
00092         return FXHandedMsgBox(a, caption, text, fatalErrorIcon(), opts, x,y,w,h, pl,pr,pt,pb, hs,vs).execute();
00093     }
00095     static FXuint fatalerror(FXWindow *window, const FXString &caption, const FXString &text, FXuint opts=DECOR_ALL|HANDEDMSGBOX_DEFOKBUTTON,FXint x=0,FXint y=0,FXint w=200,FXint h=150,FXint pl=DEFAULT_PAD,FXint pr=DEFAULT_PAD,FXint pt=DEFAULT_PAD,FXint pb=DEFAULT_PAD,FXint hs=DEFAULT_SPACING,FXint vs=DEFAULT_SPACING)
00096     {
00097         return FXHandedMsgBox(window, caption, text, fatalErrorIcon(), opts, x,y,w,h, pl,pr,pt,pb, hs,vs).execute();
00098     }
00100     static FXuint error(FXApp *a, const FXString &caption, const FXString &text, FXuint opts=DECOR_ALL|HANDEDMSGBOX_DEFOKBUTTON,FXint x=0,FXint y=0,FXint w=200,FXint h=150,FXint pl=DEFAULT_PAD,FXint pr=DEFAULT_PAD,FXint pt=DEFAULT_PAD,FXint pb=DEFAULT_PAD,FXint hs=DEFAULT_SPACING,FXint vs=DEFAULT_SPACING)
00101     {
00102         return FXHandedMsgBox(a, caption, text, errorIcon(), opts, x,y,w,h, pl,pr,pt,pb, hs,vs).execute();
00103     }
00105     static FXuint error(FXWindow *window, const FXString &caption, const FXString &text, FXuint opts=DECOR_ALL|HANDEDMSGBOX_DEFOKBUTTON,FXint x=0,FXint y=0,FXint w=200,FXint h=150,FXint pl=DEFAULT_PAD,FXint pr=DEFAULT_PAD,FXint pt=DEFAULT_PAD,FXint pb=DEFAULT_PAD,FXint hs=DEFAULT_SPACING,FXint vs=DEFAULT_SPACING)
00106     {
00107         return FXHandedMsgBox(window, caption, text, errorIcon(), opts, x,y,w,h, pl,pr,pt,pb, hs,vs).execute();
00108     }
00110     static FXuint question(FXApp *a, const FXString &caption, const FXString &text, FXuint opts=DECOR_ALL|HANDEDMSGBOX_DEFOKBUTTON|HANDEDMSGBOX_OKCANCELBUTTONS|HANDEDMSGBOX_USEYESNO,FXint x=0,FXint y=0,FXint w=200,FXint h=150,FXint pl=DEFAULT_PAD,FXint pr=DEFAULT_PAD,FXint pt=DEFAULT_PAD,FXint pb=DEFAULT_PAD,FXint hs=DEFAULT_SPACING,FXint vs=DEFAULT_SPACING)
00111     {
00112         return FXHandedMsgBox(a, caption, text, questionIcon(), opts, x,y,w,h, pl,pr,pt,pb, hs,vs).execute();
00113     }
00115     static FXuint question(FXWindow *window, const FXString &caption, const FXString &text, FXuint opts=DECOR_ALL|HANDEDMSGBOX_DEFOKBUTTON|HANDEDMSGBOX_OKCANCELBUTTONS|HANDEDMSGBOX_USEYESNO,FXint x=0,FXint y=0,FXint w=200,FXint h=150,FXint pl=DEFAULT_PAD,FXint pr=DEFAULT_PAD,FXint pt=DEFAULT_PAD,FXint pb=DEFAULT_PAD,FXint hs=DEFAULT_SPACING,FXint vs=DEFAULT_SPACING)
00116     {
00117         return FXHandedMsgBox(window, caption, text, questionIcon(), opts, x,y,w,h, pl,pr,pt,pb, hs,vs).execute();
00118     }
00120     static FXuint informational(FXApp *a, const FXString &caption, const FXString &text, FXuint opts=DECOR_ALL|HANDEDMSGBOX_DEFOKBUTTON,FXint x=0,FXint y=0,FXint w=200,FXint h=150,FXint pl=DEFAULT_PAD,FXint pr=DEFAULT_PAD,FXint pt=DEFAULT_PAD,FXint pb=DEFAULT_PAD,FXint hs=DEFAULT_SPACING,FXint vs=DEFAULT_SPACING)
00121     {
00122         return FXHandedMsgBox(a, caption, text, informationalIcon(), opts, x,y,w,h, pl,pr,pt,pb, hs,vs).execute();
00123     }
00125     static FXuint informational(FXWindow *window, const FXString &caption, const FXString &text, FXuint opts=DECOR_ALL|HANDEDMSGBOX_DEFOKBUTTON,FXint x=0,FXint y=0,FXint w=200,FXint h=150,FXint pl=DEFAULT_PAD,FXint pr=DEFAULT_PAD,FXint pt=DEFAULT_PAD,FXint pb=DEFAULT_PAD,FXint hs=DEFAULT_SPACING,FXint vs=DEFAULT_SPACING)
00126     {
00127         return FXHandedMsgBox(window, caption, text, informationalIcon(), opts, x,y,w,h, pl,pr,pt,pb, hs,vs).execute();
00128     }
00129 
00131     static const FXIcon *fatalErrorIcon();
00133     static const FXIcon *errorIcon();
00135     static const FXIcon *questionIcon();
00137     static const FXIcon *informationalIcon();
00138 };
00139 
00140 }
00141 
00142 #endif

(C) 2002-2009 Niall Douglas. Some parts (C) to assorted authors.
Generated on Fri Nov 20 18:31:22 2009 for TnFOX by doxygen v1.4.7