diff --git a/TODO b/TODO index b7dc5d488a..cfe400382d 100644 --- a/TODO +++ b/TODO @@ -40,7 +40,8 @@ MSW GTK -* listbox scrolling leaves unpainted areas +? listbox scrolling leaves unpainted areas +* focused textctrl doesn't have focus border ---------------------------------------------------------------------------- DONE diff --git a/include/wx/univ/inphand.h b/include/wx/univ/inphand.h index 419282c4c6..ccdac81156 100644 --- a/include/wx/univ/inphand.h +++ b/include/wx/univ/inphand.h @@ -287,31 +287,4 @@ public: const wxMouseEvent& event); }; -// ---------------------------------------------------------------------------- -// 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(wxControl *control, - const wxKeyEvent& event, - bool pressed); - virtual bool HandleMouse(wxControl *control, - const wxMouseEvent& event); - virtual bool HandleMouseMove(wxControl *control, - const wxMouseEvent& event); - virtual bool HandleFocus(wxControl *control, const wxFocusEvent& event); - -protected: - // get the position of the mouse click - static long HitTest(const wxTextCtrl *text, const wxPoint& pos); - - // capture data - wxTextCtrl *m_winCapture; -}; - #endif // _WX_UNIV_INPHAND_H_ diff --git a/include/wx/univ/textctrl.h b/include/wx/univ/textctrl.h index d2bd2821c0..9fc66e306c 100644 --- a/include/wx/univ/textctrl.h +++ b/include/wx/univ/textctrl.h @@ -21,6 +21,8 @@ class WXDLLEXPORT wxTextCtrlCommandProcessor; #include "wx/scrolwin.h" // for wxScrollHelper +#include "wx/univ/inphand.h" + // ---------------------------------------------------------------------------- // wxTextCtrl actions // ---------------------------------------------------------------------------- @@ -160,7 +162,7 @@ public: // translate between the position (which is just an index in the text ctrl // considering all its contents as a single strings) and (x, y) coordinates - // which represent column and line. + // which represent (logical, i.e. unwrapped) column and line. virtual wxTextPos XYToPosition(wxTextCoord x, wxTextCoord y) const; virtual bool PositionToXY(wxTextPos pos, wxTextCoord *x, wxTextCoord *y) const; @@ -476,5 +478,32 @@ private: DECLARE_DYNAMIC_CLASS(wxTextCtrl) }; +// ---------------------------------------------------------------------------- +// 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(wxControl *control, + const wxKeyEvent& event, + bool pressed); + virtual bool HandleMouse(wxControl *control, + const wxMouseEvent& event); + virtual bool HandleMouseMove(wxControl *control, + const wxMouseEvent& event); + virtual bool HandleFocus(wxControl *control, 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; +}; + #endif // _WX_UNIV_TEXTCTRL_H_ diff --git a/samples/textctrl/texttest.cpp b/samples/textctrl/texttest.cpp index 22f94dbbb4..8207e2de3b 100644 --- a/samples/textctrl/texttest.cpp +++ b/samples/textctrl/texttest.cpp @@ -409,6 +409,11 @@ TextTestFrame::TextTestFrame(const wxString& title) sizerMiddle->Add(sizerMiddleUp, 1, wxGROW, 5); sizerMiddle->Add(sizerMiddleDown, 1, wxGROW | wxTOP, 5); + // I don't understand what's going on :-( +#ifdef __WXGTK__ + sizerMiddle->SetMinSize(320, 0); +#endif + // right pane wxStaticBox *box3 = new wxStaticBox(m_panel, -1, _T("&Text:")); m_sizerText = new wxStaticBoxSizer(box3, wxHORIZONTAL); diff --git a/src/univ/textctrl.cpp b/src/univ/textctrl.cpp index a1fef6efab..ed9563b655 100644 --- a/src/univ/textctrl.cpp +++ b/src/univ/textctrl.cpp @@ -2888,10 +2888,14 @@ void wxTextCtrl::DoDrawTextInRect(wxDC& dc, const wxRect& rectUpdate) wxRect rectText; rectText.height = hLine; - if ( !IsSingleLine() ) + wxCoord yClient = y - GetClientAreaOrigin().y; + if ( IsSingleLine() ) { - CalcUnscrolledPosition(0, y - GetClientAreaOrigin().y, - NULL, &rectText.y); + rectText.y = yClient; + } + else // multiline, adjust for scrolling + { + CalcUnscrolledPosition(0, yClient, NULL, &rectText.y); } // do draw the invalidated parts of each line: note that we iterate here diff --git a/src/univ/themes/gtk.cpp b/src/univ/themes/gtk.cpp index 35d3809fc6..572a4be297 100644 --- a/src/univ/themes/gtk.cpp +++ b/src/univ/themes/gtk.cpp @@ -33,6 +33,7 @@ #include "wx/button.h" #include "wx/checkbox.h" #include "wx/scrolbar.h" + #include "wx/textctrl.h" #endif // WX_PRECOMP #include "wx/univ/renderer.h"