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

FXInputDialog.h
Go to the documentation of this file.
1 /********************************************************************************
2 * *
3 * I n p u t D i a l o g B o x *
4 * *
5 *********************************************************************************
6 * Copyright (C) 2000,2006 by Jeroen van der Zijp. All Rights Reserved. *
7 *********************************************************************************
8 * This library is free software; you can redistribute it and/or *
9 * modify it under the terms of the GNU Lesser General Public *
10 * License as published by the Free Software Foundation; either *
11 * version 2.1 of the License, or (at your option) any later version. *
12 * *
13 * This library is distributed in the hope that it will be useful, *
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
16 * Lesser General Public License for more details. *
17 * *
18 * You should have received a copy of the GNU Lesser General Public *
19 * License along with this library; if not, write to the Free Software *
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
21 *********************************************************************************
22 * $Id: FXInputDialog.h,v 1.17 2006/01/22 17:58:05 fox Exp $ *
23 ********************************************************************************/
24 #ifndef FXINPUTDIALOG_H
25 #define FXINPUTDIALOG_H
26 
27 #ifndef FXDIALOGBOX_H
28 #include "FXDialogBox.h"
29 #endif
30 
31 namespace FX {
32 
33 
34 /// Input dialog options
35 enum {
36  INPUTDIALOG_STRING = 0, /// Ask for a string
37  INPUTDIALOG_INTEGER = 0x01000000, /// Ask for an integer number
38  INPUTDIALOG_REAL = 0x02000000, /// Ask for a real number
39  INPUTDIALOG_PASSWORD = 0x04000000 /// Do not reveal key-in
40  };
41 
42 
43 class FXTextField;
44 
45 
46 /**
47 * An Input Dialog is a simple dialog which is used
48 * to obtain a text string, integer, or real number from the user.
49 * A password mode allows the key-in to remain hidden.
50 */
51 class FXAPI FXInputDialog : public FXDialogBox {
53 protected:
54  FXTextField *input; // Text field widget
55  FXdouble limlo; // Lower limit
56  FXdouble limhi; // Upper limit
57 protected:
59 private:
61  FXInputDialog &operator=(const FXInputDialog&);
62  void initialize(const FXString& text,FXIcon* icon);
63 public:
64  long onCmdAccept(FXObject*,FXSelector,void*);
65 public:
66 
67  /// Construct input dialog box with given caption, icon, and prompt text
68  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);
69 
70  /// Construct free floating input dialog box with given caption, icon, and prompt text
71  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);
72 
73  /// Get input string
74  FXString getText() const;
75 
76  /// Set input string
77  void setText(const FXString& text);
78 
79  /// Change number of visible columns of text
80  void setNumColumns(FXint num);
81 
82  /// Return number of visible columns of text
83  FXint getNumColumns() const;
84 
85  /// Change limits
86  void setLimits(FXdouble lo,FXdouble hi){ limlo=lo; limhi=hi; }
87 
88  /// Return limits
89  void getLimits(FXdouble& lo,FXdouble& hi){ lo=limlo; hi=limhi; }
90 
91  /// Run modal invocation of the dialog
92  virtual FXuint execute(FXuint placement=PLACEMENT_CURSOR);
93 
94  /**
95  * Prompt for a string, start with the initial value.
96  * Return TRUE if the new value is accepted, and false otherwise.
97  */
98  static FXbool getString(FXString& result,FXWindow* owner,const FXString& caption,const FXString& label,FXIcon* icon=NULL);
99 
100  /**
101  * Prompt for a string, in free floating window.
102  */
103  static FXbool getString(FXString& result,FXApp* app,const FXString& caption,const FXString& label,FXIcon* icon=NULL);
104 
105  /**
106  * Prompt for an integer number, start with the given initial value.
107  * Return TRUE if the new value is accepted, and false otherwise.
108  * The input is constrained between lo and hi.
109  */
110  static FXbool getInteger(FXint& result,FXWindow* owner,const FXString& caption,const FXString& label,FXIcon* icon=NULL,FXint lo=-2147483647,FXint hi=2147483647);
111 
112  /**
113  * Prompt for a integer number, in free floating window.
114  */
115  static FXbool getInteger(FXint& result,FXApp* app,const FXString& caption,const FXString& label,FXIcon* icon=NULL,FXint lo=-2147483647,FXint hi=2147483647);
116 
117  /**
118  * Prompt for an real number, start with the given initial value.
119  * Return TRUE if the new value is accepted, and false otherwise.
120  * The input is constrained between lo and hi.
121  */
122  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);
123 
124  /**
125  * Prompt for a real number, in free floating window.
126  */
127  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);
128  };
129 
130 }
131 
132 #endif
FXVec2d lo(const FXVec2d &a, const FXVec2d &b)
Definition: FXVec2d.h:174
An Input Dialog is a simple dialog which is used to obtain a text string, integer, or real number from the user.
Definition: FXInputDialog.h:58
DialogBox window.
Definition: FXDialogBox.h:40
Base class for all windows.
Definition: FXWindow.h:115
unsigned int FXuint
Definition: fxdefs.h:396
FXuint FXSelector
Association key.
Definition: FXObject.h:53
#define FXAPI
Definition: fxdefs.h:122
FXuchar FXbool
Definition: fxdefs.h:393
Application Object.
Definition: FXApp.h:158
#define NULL
Definition: fxdefs.h:41
Place it under the cursor position.
Definition: FXTopWindow.h:62
double FXdouble
Definition: fxdefs.h:399
Ask for a string.
Definition: FXInputDialog.h:39
int FXint
Definition: fxdefs.h:397
An Icon is an image with two additional server-side resources: a shape bitmap, which is used to mask ...
Definition: FXIcon.h:45
Do not reveal key-in.
Definition: FXInputDialog.h:42
FXVec2d hi(const FXVec2d &a, const FXVec2d &b)
Definition: FXVec2d.h:175
A text field is a single-line text entry widget.
Definition: FXTextField.h:73
Ask for an integer number.
Definition: FXInputDialog.h:40
Object is the base class for all objects in FOX; in order to receive messages from the user interface...
Definition: FXObject.h:166
Ask for a real number.
Definition: FXInputDialog.h:41
#define FXDECLARE(classname)
Macro to set up class declaration.
Definition: FXObject.h:92
FXString provides essential string manipulation capabilities.
Definition: FXString.h:33

Copyright © 1997-2005 Jeroen van der Zijp