- Your Widget Set For OpenGL
Main Page | Namespace List | Class Hierarchy | Class List | File List | Class Members | Related Pages

ubasicdocument.hpp

00001 /*************************************************************************** 00002 LibUFO - UI For OpenGL 00003 copyright : (C) 2001-2005 by Johannes Schmidt 00004 email : schmidtjf at users.sourceforge.net 00005 ------------------- 00006 00007 file : include/ufo/text/ubasicdocument.hpp 00008 begin : Sat Dec 15 2001 00009 $Id: ubasicdocument.hpp,v 1.12 2005/05/21 16:18:09 schmidtjf Exp $ 00010 ***************************************************************************/ 00011 00012 /*************************************************************************** 00013 * This library is free software; you can redistribute it and/or * 00014 * modify it under the terms of the GNU Lesser General Public * 00015 * License as published by the Free Software Foundation; either * 00016 * version 2.1 of the License, or (at your option) any later version. * 00017 * * 00018 * This library is distributed in the hope that it will be useful, * 00019 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00020 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 00021 * Lesser General Public License for more details. * 00022 * * 00023 * You should have received a copy of the GNU Lesser General Public * 00024 * License along with this library; if not, write to the Free Software * 00025 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * 00026 ***************************************************************************/ 00027 00028 #ifndef UBASICDOCUMENT_HPP 00029 #define UBASICDOCUMENT_HPP 00030 00031 #include "udocument.hpp" 00032 #include "ucaret.hpp" 00033 00034 namespace ufo { 00035 00044 class UFO_EXPORT UBasicDocument : public UDocument { 00045 UFO_DECLARE_DYNAMIC_CLASS(UBasicDocument) 00046 public: 00047 UBasicDocument(); 00048 00049 virtual UCaret * createCaret(); 00050 00051 public: // Implements UDocument 00052 virtual const char * getText() const; 00053 00054 virtual unsigned int getLength() const; 00055 00056 virtual void clear(); 00057 virtual void append(const char * chars, unsigned int nChars); 00058 00059 virtual void replaceSelection(const char * chars, unsigned int nChars); 00060 00061 virtual void insertString(unsigned int offset, 00062 const char * chars, unsigned int nChars); 00063 00064 virtual void remove(unsigned int offset, unsigned int length); 00065 00066 virtual void replace(unsigned int offset, unsigned int length, 00067 const char * chars, unsigned int nChars); 00068 00069 virtual UCaret * getCaret() const; 00070 //virtual void setCaret(UCaret * caret); 00071 00072 protected: // Protected methods 00073 virtual void updateCaret(unsigned int offset, 00074 unsigned int rmLength, unsigned int insLength); 00075 00076 private: // Private attributes 00077 std::string m_content; 00078 UCaret * m_caret; 00079 }; 00080 00084 class UFO_EXPORT UBasicCaret : public UCaret { 00085 UFO_DECLARE_DYNAMIC_CLASS(UBasicCaret) 00086 public: 00087 UBasicCaret(UDocument * document); 00088 virtual ~UBasicCaret(); 00089 00090 public: // Implements UCaret 00091 virtual void setPosition(unsigned int posA); 00092 virtual unsigned int getPosition() const; 00093 00094 virtual void setMark(unsigned int mark); 00095 virtual unsigned int getMark() const; 00096 00097 virtual void movePosition(unsigned int newPosition); 00098 00099 virtual UDocument * getDocument() const; 00100 00101 private: 00102 UDocument * m_document; 00103 unsigned int m_position; 00104 unsigned int m_mark; 00105 }; 00106 00107 } // namespace ufo 00108 00109 #endif // UBASICDOCUMENT_HPP

The libUFO Project - written by Johannes Schmidt