// messwin.hpp -- a message window // // Written by Frederic Bouvier, started February 2002. // // Copyright (C) 2002 Frederic Bouvier - fredb@users.sourceforge.net // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License as // published by the Free Software Foundation; either version 2 of the // License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, but // WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. // // $Id: messwin.hpp,v 1.8 2005/05/09 07:02:10 fredb Exp $ #ifndef _messwin_hpp_ #define _messwin_hpp_ #include "window.hpp" #include #include #include #include class FGSD_MessageWindow { public: enum IconType { Question, Information, Warning, Error }; enum Button { _None = 0, Ok = 1, Cancel = 2, Yes = 4, No = 8, Retry = 16, Abort = 32, Help = 64 }; FGSD_MessageWindow( const char *__title, const char *__message, IconType __iconType, int __buttons ); ~FGSD_MessageWindow(); Button exec(); private: static void cbOk( Fl_Widget *w, void *d ); static void cbCancel( Fl_Widget *w, void *d ); static void cbYes( Fl_Widget *w, void *d ); static void cbNo( Fl_Widget *w, void *d ); static void cbRetry( Fl_Widget *w, void *d ); static void cbAbort( Fl_Widget *w, void *d ); static void cbHelp( Fl_Widget *w, void *d ); void buttonPressed( Button b ); private: FGSD_Window *_window; Fl_Box *_icon; Fl_Box *_text; Fl_Button *_btOk; Fl_Button *_btCancel; Fl_Button *_btYes; Fl_Button *_btNo; Fl_Button *_btRetry; Fl_Button *_btAbort; Fl_Button *_btHelp; Button _pressed; static Fl_Pixmap _question; static Fl_Pixmap _information; static Fl_Pixmap _warning; static Fl_Pixmap _error; }; inline FGSD_MessageWindow::Button FGSD_MessageWindow::exec() { bool ret = false; if ( _window ) ret = _window->exec(); return ret ? _pressed : _None; } #endif