csws/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 "cscomp.h" 00032 00034 enum csInputLineFrameStyle 00035 { 00037 csifsNone, 00039 csifsThinRect, 00041 csifsThickRect 00042 }; 00043 00045 #define CSIL_DEFAULTLENGTH 256 00046 00047 class csTimer; 00048 00059 class csInputLine : public csComponent 00060 { 00062 csInputLineFrameStyle FrameStyle; 00064 int maxlen; 00066 int firstchar; 00068 int cursorpos; 00070 csRect cursorrect; 00072 bool cursorvis; 00074 int selstart, selend; 00076 bool insert; 00078 int textx, texty; 00080 csTimer *timer; 00081 00082 public: 00084 csInputLine (csComponent *iParent, int iMaxLen = CSIL_DEFAULTLENGTH, 00085 csInputLineFrameStyle iFrameStyle = csifsThickRect); 00086 00088 virtual void SetText (const char *iText); 00089 00091 virtual void Draw (); 00092 00094 virtual bool HandleEvent (iEvent &Event); 00095 00097 virtual void SetState (int mask, bool enable); 00098 00100 void SetSelection (int iStart, int iEnd); 00101 00103 void SetCursorPos (int NewPos, bool ExtendSel); 00104 00106 virtual void SuggestSize (int &w, int &h); 00107 00109 virtual bool IsValidPos (int NewPos); 00110 00112 virtual bool IsValidChar (char iChar); 00113 00115 virtual bool IsValidString (const char *iText); 00116 00118 void DeleteSelection (); 00119 00120 protected: 00122 int GetCharX (int iNum); 00124 void SetTextExt (const char *iText); 00125 }; 00126 00129 #endif // __CS_CSILINE_H__
Generated for Crystal Space by doxygen 1.2.18