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