logo
Main Page | Namespaces | Classes | Compounds | Files | Compound Members | Related

TextBox.h

00001 //
00002 //  SYNTOPIA. See http://Syntopia.sourceforge.net for details and documentation.        
00003 //
00004 //      Author of this file: Mikael Hvidtfeldt Christensen (mikaelc@users.sourceforge.net)
00005 //
00006 
00007 
00008 #ifndef __TextBox
00009 #define __TextBox
00010 
00011 #include <windows.h>
00012 #include <string>
00013 #include "WinForm.h"
00014 #include "GUIControl.h"
00015 
00016 namespace GUIToolkit {
00017 
00019 /* 
00020  *  @todo the float validation should be given some thought.
00021  */
00022 class TextBox : public Component {
00023 
00024 public:
00025 
00027         enum TextBoxType { singleLine, multiLine };
00028 
00030         TextBox(); 
00031 
00033         TextBox(TextBoxType myType); 
00034         
00036         ~TextBox();
00037 
00039         void PutInWinForm(WinForm * WF, int x0, int x1, int y0, int y1); 
00040 
00042         void setText(std::string s);
00043 
00045         void setText(float f);
00046 
00048         void addText(std::string s) {setText( *getText()+"\r\n"+s );};
00049 
00051         void clearText(std::string s) {setText( "" );};
00052 
00054         float getFloatVal() ;
00055 
00057         void HandleEvents(event e) ;
00058 
00060         void setFloatLimit(float from, float to);
00061 
00063         bool validateFloat();
00064 
00066         std::string * getText();
00067 
00069         void show() ;
00070 
00072         void hide() ;
00073 
00074 private:
00075 
00076         HFONT hfDefault;
00077     HWND hEdit;
00078         TextBoxType myTextBoxType;
00079         bool floatVal, checkLimits;
00080         float fmax, fmin;
00081 };
00082 
00083 }
00084 
00085 #endif

Syntopia Project. Visit the web page, or the SourceForge page.
Docs made by Doxygen. Email: Mikael Christensen