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

FXInputDialog.h

Go to the documentation of this file.
00001 /********************************************************************************
00002 *                                                                               *
00003 *                         I n p u t   D i a l o g   B o x                       *
00004 *                                                                               *
00005 *********************************************************************************
00006 * Copyright (C) 2000,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: FXInputDialog.h,v 1.26 2009/01/06 13:07:25 fox Exp $                     *
00022 ********************************************************************************/
00023 #ifndef FXINPUTDIALOG_H
00024 #define FXINPUTDIALOG_H
00025 
00026 #ifndef FXDIALOGBOX_H
00027 #include "FXDialogBox.h"
00028 #endif
00029 
00030 namespace FX {
00031 
00032 
00033 /// Input dialog options
00034 enum {
00035   INPUTDIALOG_STRING   = 0,             /// Ask for a string
00036   INPUTDIALOG_INTEGER  = 0x02000000,    /// Ask for an integer number
00037   INPUTDIALOG_REAL     = 0x04000000,    /// Ask for a real number
00038   INPUTDIALOG_PASSWORD = 0x08000000     /// Do not reveal key-in
00039   };
00040 
00041 
00042 class FXTextField;
00043 
00044 
00045 /**
00046 * An Input Dialog is a simple dialog which is used
00047 * to obtain a text string, integer, or real number from the user.
00048 * A password mode allows the key-in to remain hidden.
00049 */
00050 class FXAPI FXInputDialog : public FXDialogBox {
00051   FXDECLARE(FXInputDialog)
00052 protected:
00053   FXTextField *input;       // Text field widget
00054   FXdouble     limlo;       // Lower limit
00055   FXdouble     limhi;       // Upper limit
00056 protected:
00057   FXInputDialog(){}
00058 private:
00059   FXInputDialog(const FXInputDialog&);
00060   FXInputDialog &operator=(const FXInputDialog&);
00061   virtual void initialize(const FXString& text,FXIcon* icon);
00062 public:
00063   long onCmdAccept(FXObject*,FXSelector,void*);
00064 public:
00065 
00066   /// Construct input dialog box with given caption, icon, and prompt text
00067   FXInputDialog(FXWindow* owner,const FXString& caption,const FXString& label,FXIcon* icon=NULL,FXuint opts=INPUTDIALOG_STRING,FXint x=0,FXint y=0,FXint w=0,FXint h=0);
00068 
00069   /// Construct free floating input dialog box with given caption, icon, and prompt text
00070   FXInputDialog(FXApp* app,const FXString& caption,const FXString& label,FXIcon* icon=NULL,FXuint opts=INPUTDIALOG_STRING,FXint x=0,FXint y=0,FXint w=0,FXint h=0);
00071 
00072   /// Get input string
00073   FXString getText() const;
00074 
00075   /// Set input string
00076   void setText(const FXString& text);
00077 
00078   /// Change number of visible columns of text
00079   void setNumColumns(FXint num);
00080 
00081   /// Return number of visible columns of text
00082   FXint getNumColumns() const;
00083 
00084   /// Change limits
00085   void setLimits(FXdouble lo,FXdouble hi){ limlo=lo; limhi=hi; }
00086 
00087   /// Return limits
00088   void getLimits(FXdouble& lo,FXdouble& hi){ lo=limlo; hi=limhi; }
00089 
00090   /// Run modal invocation of the dialog
00091   virtual FXuint execute(FXuint placement=PLACEMENT_CURSOR);
00092 
00093   /**
00094   * Prompt for a string, start with the initial value.
00095   * Return true if the new value is accepted, and false otherwise.
00096   */
00097   static FXbool getString(FXString& result,FXWindow* owner,const FXString& caption,const FXString& label,FXIcon* icon=NULL);
00098 
00099   /**
00100   * Prompt for a string, in free floating window.
00101   */
00102   static FXbool getString(FXString& result,FXApp* app,const FXString& caption,const FXString& label,FXIcon* icon=NULL);
00103 
00104   /**
00105   * Prompt for an integer number, start with the given initial value.
00106   * Return true if the new value is accepted, and false otherwise.
00107   * The input is constrained between lo and hi.
00108   */
00109   static FXbool getInteger(FXint& result,FXWindow* owner,const FXString& caption,const FXString& label,FXIcon* icon=NULL,FXint lo=-2147483647,FXint hi=2147483647);
00110 
00111   /**
00112   * Prompt for a integer number, in free floating window.
00113   */
00114   static FXbool getInteger(FXint& result,FXApp* app,const FXString& caption,const FXString& label,FXIcon* icon=NULL,FXint lo=-2147483647,FXint hi=2147483647);
00115 
00116   /**
00117   * Prompt for an real number, start with the given initial value.
00118   * Return true if the new value is accepted, and false otherwise.
00119   * The input is constrained between lo and hi.
00120   */
00121   static FXbool getReal(FXdouble& result,FXWindow* owner,const FXString& caption,const FXString& label,FXIcon* icon=NULL,FXdouble lo=-1.797693134862315e+308,FXdouble hi=1.797693134862315e+308);
00122 
00123   /**
00124   * Prompt for a real number, in free floating window.
00125   */
00126   static FXbool getReal(FXdouble& result,FXApp* app,const FXString& caption,const FXString& label,FXIcon* icon=NULL,FXdouble lo=-1.797693134862315e+308,FXdouble hi=1.797693134862315e+308);
00127   };
00128 
00129 }
00130 
00131 #endif

Copyright © 1997-2009 Jeroen van der Zijp