#include "wx/tokenzr.h"
#endif // WXDEBUG_TEXT_REPLACE
+// ----------------------------------------------------------------------------
+// wxStdTextCtrlInputHandler: this control handles only the mouse/kbd actions
+// common to Win32 and GTK, platform-specific things are implemented elsewhere
+// ----------------------------------------------------------------------------
+
+class WXDLLEXPORT wxStdTextCtrlInputHandler : public wxStdInputHandler
+{
+public:
+ wxStdTextCtrlInputHandler(wxInputHandler *inphand);
+
+ virtual bool HandleKey(wxInputConsumer *consumer,
+ const wxKeyEvent& event,
+ bool pressed);
+ virtual bool HandleMouse(wxInputConsumer *consumer,
+ const wxMouseEvent& event);
+ virtual bool HandleMouseMove(wxInputConsumer *consumer,
+ const wxMouseEvent& event);
+ virtual bool HandleFocus(wxInputConsumer *consumer, const wxFocusEvent& event);
+
+protected:
+ // get the position of the mouse click
+ static wxTextPos HitTest(const wxTextCtrl *text, const wxPoint& pos);
+
+ // capture data
+ wxTextCtrl *m_winCapture;
+};
+
// ----------------------------------------------------------------------------
// private functions
// ----------------------------------------------------------------------------
// ----------------------------------------------------------------------------
// the data only used by single line text controls
-struct WXDLLEXPORT wxTextSingleLineData
+struct wxTextSingleLineData
{
// the position of the first visible pixel and the first visible column
wxCoord m_ofsHorz;
};
// the data only used by multi line text controls
-struct WXDLLEXPORT wxTextMultiLineData
+struct wxTextMultiLineData
{
// the lines of text
wxArrayString m_lines;
};
// the data only used by multi line text controls in line wrap mode
-class WXDLLEXPORT wxWrappedLineData
+class wxWrappedLineData
{
// these functions set all our values, so give them access to them
friend void wxTextCtrl::LayoutLine(wxTextCoord line,
#include "wx/arrimpl.cpp"
WX_DEFINE_OBJARRAY(wxArrayWrappedLinesData);
-struct WXDLLEXPORT wxTextWrappedData : public wxTextMultiLineData
+struct wxTextWrappedData : public wxTextMultiLineData
{
// the width of the column to the right of the text rect used for the
// indicator mark display for the wrapped lines
RecalcFontMetrics();
SetValue(value);
- SetBestSize(size);
+ SetInitialSize(size);
m_isEditable = !(style & wxTE_READONLY);
// set/get the value
// ----------------------------------------------------------------------------
-void wxTextCtrl::SetValue(const wxString& value)
+void wxTextCtrl::DoSetValue(const wxString& value, int flags)
{
if ( IsSingleLine() && (value == GetValue()) )
{
SetInsertionPoint(0);
}
- // TODO: should we generate the event or not, finally?
+ if ( flags & SetValue_SendEvent )
+ SendTextUpdatedEvent();
}
const wxArrayString& wxTextCtrl::GetLines() const
{
// intermediate line or the last one but we need to refresh it
// until the end anyhow - do it
- posCount = wxSTRING_MAXLEN;
+ posCount = wxString::npos;
}
else // last line
{
{
// FIXME use renderer
caret = new wxCaret(this, 1, GetLineHeight());
-#ifndef __WXMSW__
- wxCaret::SetBlinkTime(0);
-#endif // __WXMSW__
}
else
{
event.Skip();
}
+/* static */
+wxInputHandler *wxTextCtrl::GetStdInputHandler(wxInputHandler *handlerDef)
+{
+ static wxStdTextCtrlInputHandler s_handler(handlerDef);
+
+ return &s_handler;
+}
+
// ----------------------------------------------------------------------------
// wxStdTextCtrlInputHandler
// ----------------------------------------------------------------------------