00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
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
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