Main Page | Class Hierarchy | Class List | File List | Class Members

aedTextBox.h

00001 
00002 /*
00003  * The aedTextBox class
00004  * This class implements a textbox.
00005  * Initial design by Eduardo B. Fonseca <ebf@aedsolucoes.com.br>
00006  *
00007  * This library is free software; you can redistribute it and/or
00008  * modify it under the terms of the GNU Library General Public
00009  * License as published by the Free Software Foundation; either
00010  * version 2 of the License, or (at your option) any later version.
00011  *
00012  * This library is distributed in the hope that it will be useful,
00013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00015  * Library General Public License for more details.
00016  *
00017  * You should have received a copy of the GNU Library General Public
00018  * License along with this library; if not, write to the Free
00019  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00020  *
00021  */
00022 #ifndef AEDTEXTBOX_H
00023 #define AEDTEXTBOX_H
00024 
00025 #include "aedStaticText.h"
00026 
00028 class DLLEXPORT aedTextBox:public aedStaticText
00029 {
00030   public:
00031     aedTextBox();
00032     virtual ~ aedTextBox();
00033 
00034     virtual int wm_update(Uint32 msdelta);
00035     virtual int wm_lbuttondown(Uint16 x, Uint16 y);
00036     virtual int wm_lbuttonup(Uint16 x, Uint16 y);
00037     virtual int wm_mousemove(Uint16 x, Uint16 y, Uint16 dx, Uint16 dy);
00038     virtual int wm_mouseleave();
00039     virtual int wm_keydown(aedKeyEvent & event);
00040     virtual void render();
00041 
00043     virtual void setReadOnly(bool state)
00044     {
00045         enable(!state);
00046     }
00047     virtual bool getReadOnly(void) const
00048     {
00049         return !isEnabled();
00050     }
00051 
00054     virtual void setBlinkInterval(Uint32 interval)
00055     {
00056         m_BlinkInterval = interval;
00057     }
00058 
00059     bool getPasswordMode() const
00060     {
00061         return m_PasswordMode;
00062     }
00063 
00065     void setPasswordMode(bool enable)
00066     {
00067         if(enable != m_PasswordMode)
00068         {
00069             m_PasswordMode = enable;
00070             setRenderState(true);
00071         }
00072     }
00073 
00076     void setCharMask(std::string mask)
00077     {
00078         m_CharMask = mask;
00079     }
00080     std::string getCharMask()
00081     {
00082         return m_CharMask;
00083     }
00084 
00085     void setSelection(Uint32 start, Uint32 end)
00086     {
00087         // Clamp the selection to the size of the string
00088         if(start > m_Caption.size())
00089             start = m_Caption.size();
00090         if(end > m_Caption.size())
00091             end = m_Caption.size();
00092 
00093         m_SelectionStart = start;
00094         m_SelectionEnd = end;
00095     }
00096 
00097     void setSelectionStart(Uint32 start)
00098     {
00099         setSelection(m_SelectionStart, start);
00100     }
00101 
00102     void setSelectionEnd(Uint32 end)
00103     {
00104         setSelection(m_SelectionStart, end);
00105     }
00106 
00107     int calculateCaretPosition(Uint16 x, Uint16 y);
00108 
00109   protected:
00110     Uint16 m_CaretPos;
00111     bool m_Selecting;
00112     Uint32 m_SelectionStart, m_SelectionEnd;
00113     Uint32 m_BlinkInterval, m_TimeSinceLastUpdate;
00114     int m_StartPixel;
00115     bool m_ShowCaret;
00116     bool m_PasswordMode;
00117 
00118     std::string m_CharMask;
00119 };
00120 
00121 #if defined(_MSC_VER)
00122 DLLEXTERN template DLLEXPORT aedFunctor1Arg < stub, aedTextBox >;
00123 #endif
00124 
00125 #endif

Generated on Mon Mar 1 19:56:18 2004 for aedGUI by doxygen 1.3.6