CrystalSpace

Public API Reference

Main Page | Modules | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members | Related Pages

csiline.h

Go to the documentation of this file.
00001 /*
00002     Crystal Space Windowing System: input line class
00003     Copyright (C) 1998,1999 by Andrew Zabolotny <bit@eltech.ru>
00004 
00005     This library is free software; you can redistribute it and/or
00006     modify it under the terms of the GNU Library General Public
00007     License as published by the Free Software Foundation; either
00008     version 2 of the License, or (at your option) any later version.
00009 
00010     This library is distributed in the hope that it will be useful,
00011     but WITHOUT ANY WARRANTY; without even the implied warranty of
00012     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013     Library General Public License for more details.
00014 
00015     You should have received a copy of the GNU Library General Public
00016     License along with this library; if not, write to the Free
00017     Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00018 */
00019 
00020 #ifndef __CS_CSILINE_H__
00021 #define __CS_CSILINE_H__
00022 
00031 #include "csextern.h"
00032  
00033 #include "cscomp.h"
00034 
00036 enum csInputLineFrameStyle
00037 {
00039   csifsNone,
00041   csifsThinRect,
00043   csifsThickRect
00044 };
00045 
00047 #define CSIL_DEFAULTLENGTH              256
00048 
00049 class csTimer;
00050 
00061 class CS_CSWS_EXPORT csInputLine : public csComponent
00062 {
00064   csInputLineFrameStyle FrameStyle;
00066   size_t maxlen;
00068   size_t firstchar;
00070   size_t cursorpos;
00072   csRect cursorrect;
00074   bool cursorvis;
00076   size_t selstart, selend;
00078   bool insert;
00080   int textx, texty;
00082   csTimer *timer;
00083 
00084 public:
00086   csInputLine (csComponent *iParent, int iMaxLen = CSIL_DEFAULTLENGTH,
00087     csInputLineFrameStyle iFrameStyle = csifsThickRect);
00088 
00090   virtual void SetText (const char *iText);
00091 
00093   virtual void Draw ();
00094 
00096   virtual bool HandleEvent (iEvent &Event);
00097 
00099   virtual void SetState (int mask, bool enable);
00100 
00102   void SetSelection (size_t iStart, size_t iEnd);
00103 
00105   void SetCursorPos (size_t NewPos, bool ExtendSel);
00106 
00108   virtual void SuggestSize (int &w, int &h);
00109 
00111   virtual bool IsValidPos (size_t NewPos);
00112 
00114   virtual bool IsValidChar (char iChar);
00115 
00117   virtual bool IsValidString (const char *iText);
00118 
00120   void DeleteSelection ();
00121 
00122 protected:
00124   int GetCharX (size_t iNum);
00126   void SetTextExt (const char *iText);
00127 };
00128 
00131 #endif // __CS_CSILINE_H__

Generated for Crystal Space by doxygen 1.3.9.1