fixed vert offset for single line text ctrls
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/wxUNIVERSAL@8810 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
3
TODO
3
TODO
@@ -40,7 +40,8 @@ MSW
|
|||||||
|
|
||||||
GTK
|
GTK
|
||||||
|
|
||||||
* listbox scrolling leaves unpainted areas
|
? listbox scrolling leaves unpainted areas
|
||||||
|
* focused textctrl doesn't have focus border
|
||||||
|
|
||||||
----------------------------------------------------------------------------
|
----------------------------------------------------------------------------
|
||||||
DONE
|
DONE
|
||||||
|
@@ -287,31 +287,4 @@ public:
|
|||||||
const wxMouseEvent& event);
|
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_
|
#endif // _WX_UNIV_INPHAND_H_
|
||||||
|
@@ -21,6 +21,8 @@ class WXDLLEXPORT wxTextCtrlCommandProcessor;
|
|||||||
|
|
||||||
#include "wx/scrolwin.h" // for wxScrollHelper
|
#include "wx/scrolwin.h" // for wxScrollHelper
|
||||||
|
|
||||||
|
#include "wx/univ/inphand.h"
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// wxTextCtrl actions
|
// wxTextCtrl actions
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
@@ -160,7 +162,7 @@ public:
|
|||||||
|
|
||||||
// translate between the position (which is just an index in the text ctrl
|
// 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
|
// 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 wxTextPos XYToPosition(wxTextCoord x, wxTextCoord y) const;
|
||||||
virtual bool PositionToXY(wxTextPos pos,
|
virtual bool PositionToXY(wxTextPos pos,
|
||||||
wxTextCoord *x, wxTextCoord *y) const;
|
wxTextCoord *x, wxTextCoord *y) const;
|
||||||
@@ -476,5 +478,32 @@ private:
|
|||||||
DECLARE_DYNAMIC_CLASS(wxTextCtrl)
|
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_
|
#endif // _WX_UNIV_TEXTCTRL_H_
|
||||||
|
|
||||||
|
@@ -409,6 +409,11 @@ TextTestFrame::TextTestFrame(const wxString& title)
|
|||||||
sizerMiddle->Add(sizerMiddleUp, 1, wxGROW, 5);
|
sizerMiddle->Add(sizerMiddleUp, 1, wxGROW, 5);
|
||||||
sizerMiddle->Add(sizerMiddleDown, 1, wxGROW | wxTOP, 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
|
// right pane
|
||||||
wxStaticBox *box3 = new wxStaticBox(m_panel, -1, _T("&Text:"));
|
wxStaticBox *box3 = new wxStaticBox(m_panel, -1, _T("&Text:"));
|
||||||
m_sizerText = new wxStaticBoxSizer(box3, wxHORIZONTAL);
|
m_sizerText = new wxStaticBoxSizer(box3, wxHORIZONTAL);
|
||||||
|
@@ -2888,10 +2888,14 @@ void wxTextCtrl::DoDrawTextInRect(wxDC& dc, const wxRect& rectUpdate)
|
|||||||
|
|
||||||
wxRect rectText;
|
wxRect rectText;
|
||||||
rectText.height = hLine;
|
rectText.height = hLine;
|
||||||
if ( !IsSingleLine() )
|
wxCoord yClient = y - GetClientAreaOrigin().y;
|
||||||
|
if ( IsSingleLine() )
|
||||||
{
|
{
|
||||||
CalcUnscrolledPosition(0, y - GetClientAreaOrigin().y,
|
rectText.y = yClient;
|
||||||
NULL, &rectText.y);
|
}
|
||||||
|
else // multiline, adjust for scrolling
|
||||||
|
{
|
||||||
|
CalcUnscrolledPosition(0, yClient, NULL, &rectText.y);
|
||||||
}
|
}
|
||||||
|
|
||||||
// do draw the invalidated parts of each line: note that we iterate here
|
// do draw the invalidated parts of each line: note that we iterate here
|
||||||
|
@@ -33,6 +33,7 @@
|
|||||||
#include "wx/button.h"
|
#include "wx/button.h"
|
||||||
#include "wx/checkbox.h"
|
#include "wx/checkbox.h"
|
||||||
#include "wx/scrolbar.h"
|
#include "wx/scrolbar.h"
|
||||||
|
#include "wx/textctrl.h"
|
||||||
#endif // WX_PRECOMP
|
#endif // WX_PRECOMP
|
||||||
|
|
||||||
#include "wx/univ/renderer.h"
|
#include "wx/univ/renderer.h"
|
||||||
|
Reference in New Issue
Block a user