|
csiline.h00001 /* 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 __CSILINE_H__ 00021 #define __CSILINE_H__ 00022 00023 #include "cscomp.h" 00024 00026 enum csInputLineFrameStyle 00027 { 00029 csifsNone, 00031 csifsThinRect, 00033 csifsThickRect 00034 }; 00035 00037 #define CSIL_DEFAULTLENGTH 256 00038 00039 class csTimer; 00040 00051 class csInputLine : public csComponent 00052 { 00054 csInputLineFrameStyle FrameStyle; 00056 int maxlen; 00058 int firstchar; 00060 int cursorpos; 00062 csRect cursorrect; 00064 bool cursorvis; 00066 int selstart, selend; 00068 bool insert; 00070 int textx, texty; 00072 csTimer *timer; 00073 00074 public: 00076 csInputLine (csComponent *iParent, int iMaxLen = CSIL_DEFAULTLENGTH, 00077 csInputLineFrameStyle iFrameStyle = csifsThickRect); 00078 00080 virtual void SetText (const char *iText); 00081 00083 virtual void Draw (); 00084 00086 virtual bool HandleEvent (iEvent &Event); 00087 00089 virtual void SetState (int mask, bool enable); 00090 00092 void SetSelection (int iStart, int iEnd); 00093 00095 void SetCursorPos (int NewPos, bool ExtendSel); 00096 00098 virtual void SuggestSize (int &w, int &h); 00099 00101 virtual bool IsValidPos (int NewPos); 00102 00104 virtual bool IsValidChar (char iChar); 00105 00107 virtual bool IsValidString (const char *iText); 00108 00110 void DeleteSelection (); 00111 00112 protected: 00114 int GetCharX (int iNum); 00116 void SetTextExt (const char *iText); 00117 }; 00118 00119 #endif // __CSILINE_H__ Generated for Crystal Space by doxygen 1.2.5 written by Dimitri van Heesch, ©1997-2000 |