added wxTextCtrl::HitTest(); implemented it for MSW

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@25496 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2004-02-04 14:56:14 +00:00
parent 3e27ea5908
commit efe66bbc0e
7 changed files with 346 additions and 20 deletions

View File

@@ -25,7 +25,8 @@
#if wxUSE_TEXTCTRL
#include "wx/control.h" // the base class
#include "wx/dynarray.h"
#include "wx/dynarray.h" // wxArrayInt
#include "wx/gdicmn.h" // wxPoint
// 16-bit Borland 4.0 doesn't seem to allow multiple inheritance with wxWindow
// and streambuf: it complains about deriving a huge class from the huge class
@@ -48,6 +49,17 @@
class WXDLLEXPORT wxTextCtrl;
class WXDLLEXPORT wxTextCtrlBase;
// ----------------------------------------------------------------------------
// wxTextCtrl types
// ----------------------------------------------------------------------------
// wxTextPos is the position in the text
typedef long wxTextPos;
// wxTextCoord is the line or row number (which should have been unsigned but
// is long for backwards compatibility)
typedef long wxTextCoord;
// ----------------------------------------------------------------------------
// constants
// ----------------------------------------------------------------------------
@@ -102,6 +114,21 @@ WXDLLEXPORT_DATA(extern const wxChar*) wxTextCtrlNameStr;
// wxTE_RICH controls - can be used together with or instead of wxTE_RICH
#define wxTE_RICH2 0x8000
// ----------------------------------------------------------------------------
// wxTextCtrl::HitTest return values
// ----------------------------------------------------------------------------
// the point asked is ...
enum wxTextCtrlHitTestResult
{
wxTE_HT_UNKNOWN = -2, // this means HitTest() is simply not implemented
wxTE_HT_BEFORE, // either to the left or upper
wxTE_HT_ON_TEXT, // directly on
wxTE_HT_BELOW, // below [the last line]
wxTE_HT_BEYOND // after [the end of line]
};
// ... the character returned
// ----------------------------------------------------------------------------
// Types for wxTextAttr
// ----------------------------------------------------------------------------
@@ -295,6 +322,14 @@ public:
virtual void ShowPosition(long pos) = 0;
// find the character at position given in pixels
//
// NB: pt is in device coords (not adjusted for the client area origin nor
// scrolling)
virtual wxTextCtrlHitTestResult HitTest(const wxPoint& pt,
wxTextCoord *col,
wxTextCoord *row) const;
// Clipboard operations
virtual void Copy() = 0;
virtual void Cut() = 0;