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:
Vadim Zeitlin
2000-11-24 17:31:02 +00:00
parent 17516c205e
commit 6378b5268d
6 changed files with 45 additions and 32 deletions

3
TODO
View File

@@ -40,7 +40,8 @@ MSW
GTK
* listbox scrolling leaves unpainted areas
? listbox scrolling leaves unpainted areas
* focused textctrl doesn't have focus border
----------------------------------------------------------------------------
DONE

View File

@@ -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_

View File

@@ -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_

View File

@@ -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);

View File

@@ -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

View File

@@ -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"