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

FXChoiceBox.h

Go to the documentation of this file.
00001 /********************************************************************************
00002 *                                                                               *
00003 *                            C h o i c e   B o x                                *
00004 *                                                                               *
00005 *********************************************************************************
00006 * Copyright (C) 2004,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: FXChoiceBox.h,v 1.12 2009/01/06 13:07:22 fox Exp $                       *
00022 ********************************************************************************/
00023 #ifndef FXCHOICEBOX_H
00024 #define FXCHOICEBOX_H
00025 
00026 #ifndef FXDIALOGBOX_H
00027 #include "FXDialogBox.h"
00028 #endif
00029 
00030 namespace FX {
00031 
00032 
00033 class FXList;
00034 
00035 
00036 /**
00037 * The Choice Box provides a dialog panel to select one item out of a list
00038 * of choices.  The choices are provided as a list of text strings.
00039 * When the dialog closes, the index of the selected choice is returned,
00040 * while a -1 is returned if the dialog was canceled,
00041 */
00042 class FXAPI FXChoiceBox : public FXDialogBox {
00043   FXDECLARE(FXChoiceBox)
00044 protected:
00045   FXList *list;
00046 protected:
00047   FXChoiceBox(){}
00048 private:
00049   FXChoiceBox(const FXChoiceBox&);
00050   FXChoiceBox &operator=(const FXChoiceBox&);
00051   void initialize(const FXString& text,FXIcon* icon);
00052 public:
00053   long onCmdClicked(FXObject*,FXSelector,void*);
00054   long onCmdCancel(FXObject*,FXSelector,void*);
00055 public:
00056   enum{
00057     ID_CLICKED=FXDialogBox::ID_LAST,
00058     ID_LAST
00059     };
00060 public:
00061 
00062   /// Construct choice box with given caption, icon, message text, and with choices from array of strings
00063   FXChoiceBox(FXWindow* owner,const FXString& caption,const FXString& text,FXIcon* icon,const FXchar** choices,FXuint opts=0,FXint x=0,FXint y=0,FXint w=0,FXint h=0);
00064 
00065   /// Construct choice box with given caption, icon, message text, and with choices from newline separated strings
00066   FXChoiceBox(FXWindow* owner,const FXString& caption,const FXString& text,FXIcon* icon,const FXString& choices,FXuint opts=0,FXint x=0,FXint y=0,FXint w=0,FXint h=0);
00067 
00068   /// Construct free floating choice box with given caption, icon, message text, and with choices from array of strings
00069   FXChoiceBox(FXApp* app,const FXString& caption,const FXString& text,FXIcon* icon,const FXchar** choices,FXuint opts=0,FXint x=0,FXint y=0,FXint w=0,FXint h=0);
00070 
00071   /// Construct free floating choice box with given caption, icon, message text, and with choices from newline separated strings
00072   FXChoiceBox(FXApp* app,const FXString& caption,const FXString& text,FXIcon* icon,const FXString& choices,FXuint opts=0,FXint x=0,FXint y=0,FXint w=0,FXint h=0);
00073 
00074   /**
00075   * Show a modal choice dialog.
00076   * Prompt the user using a dialog with given caption, icon,
00077   * message text, and with choices from newline array of strings.
00078   * The return value is -1 if cancelled, or the given choice.
00079   */
00080   static FXint ask(FXWindow* owner,FXuint opts,const FXString& caption,const FXString& text,FXIcon* icon,const FXchar** choices);
00081 
00082   /**
00083   * Show a modal choice dialog.
00084   * Prompt the user using a dialog with given caption, icon,
00085   * message text, and with choices from newline separated strings.
00086   * The return value is -1 if cancelled, or the given choice
00087   */
00088   static FXint ask(FXWindow* owner,FXuint opts,const FXString& caption,const FXString& text,FXIcon* icon,const FXString& choices);
00089 
00090   /**
00091   * Show modal choice message, in free floating window.
00092   * Prompt the user using a dialog with given caption, icon,
00093   * message text, and with choices from newline array of strings.
00094   * The return value is -1 if cancelled, or the given choice
00095   */
00096   static FXint ask(FXApp* app,FXuint opts,const FXString& caption,const FXString& text,FXIcon* icon,const FXchar** choices);
00097 
00098   /**
00099   * Show modal choice message, in free floating window.
00100   * Prompt the user using a dialog with given caption, icon,
00101   * message text, and with choices from newline separated strings.
00102   * The return value is -1 if cancelled, or the given choice
00103   */
00104   static FXint ask(FXApp* app,FXuint opts,const FXString& caption,const FXString& text,FXIcon* icon,const FXString& choices);
00105 
00106 
00107   /// Save choice box to a stream
00108   virtual void save(FXStream& store) const;
00109 
00110   /// Load choice box from a stream
00111   virtual void load(FXStream& store);
00112 
00113   /// Destroy choice box
00114   virtual ~FXChoiceBox();
00115   };
00116 
00117 }
00118 
00119 #endif

Copyright © 1997-2009 Jeroen van der Zijp