Added a function to get screen coordinates relating to cursor coords.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@2698 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -2135,7 +2135,9 @@ wxLayoutList::GetCursorScreenPos(wxDC &dc)
|
|||||||
have changed.
|
have changed.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
wxLayoutList::Layout(wxDC &dc, CoordType bottom, bool forceAll)
|
wxLayoutList::Layout(wxDC &dc, CoordType bottom, bool forceAll,
|
||||||
|
wxPoint *cpos = NULL,
|
||||||
|
wxPoint *csize = NULL)
|
||||||
{
|
{
|
||||||
// first, make sure everything is calculated - this might not be
|
// first, make sure everything is calculated - this might not be
|
||||||
// needed, optimise it later
|
// needed, optimise it later
|
||||||
@@ -2150,7 +2152,8 @@ wxLayoutList::Layout(wxDC &dc, CoordType bottom, bool forceAll)
|
|||||||
{
|
{
|
||||||
if(! wasDirty)
|
if(! wasDirty)
|
||||||
ApplyStyle(line->GetStyleInfo(), dc);
|
ApplyStyle(line->GetStyleInfo(), dc);
|
||||||
if(forceAll || line->IsDirty())
|
if(forceAll || line->IsDirty()
|
||||||
|
|| (cpos && line->GetLineNumber() == cpos->y))
|
||||||
{
|
{
|
||||||
// The following Layout() calls will update our
|
// The following Layout() calls will update our
|
||||||
// m_CurrentStyleInfo if needed.
|
// m_CurrentStyleInfo if needed.
|
||||||
@@ -2158,9 +2161,12 @@ wxLayoutList::Layout(wxDC &dc, CoordType bottom, bool forceAll)
|
|||||||
line->Layout(dc, this,
|
line->Layout(dc, this,
|
||||||
(wxPoint *)&m_CursorScreenPos,
|
(wxPoint *)&m_CursorScreenPos,
|
||||||
(wxPoint *)&m_CursorSize, m_CursorPos.x);
|
(wxPoint *)&m_CursorSize, m_CursorPos.x);
|
||||||
|
if(cpos && line->GetLineNumber() == cpos->y)
|
||||||
|
line->Layout(dc, this,
|
||||||
|
cpos,
|
||||||
|
csize, cpos->x);
|
||||||
else
|
else
|
||||||
line->Layout(dc, this);
|
line->Layout(dc, this);
|
||||||
|
|
||||||
// little condition to speed up redrawing:
|
// little condition to speed up redrawing:
|
||||||
if(bottom != -1 && line->GetPosition().y > bottom)
|
if(bottom != -1 && line->GetPosition().y > bottom)
|
||||||
break;
|
break;
|
||||||
@@ -2177,6 +2183,14 @@ wxLayoutList::Layout(wxDC &dc, CoordType bottom, bool forceAll)
|
|||||||
AddCursorPosToUpdateRect();
|
AddCursorPosToUpdateRect();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
wxPoint
|
||||||
|
wxLayoutList::GetScreenPos(wxDC &dc, const wxPoint &cpos, wxPoint *csize = NULL)
|
||||||
|
{
|
||||||
|
wxPoint pos = cpos;
|
||||||
|
Layout(dc, -1, false, &pos, csize);
|
||||||
|
return pos;
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
wxLayoutList::Draw(wxDC &dc,
|
wxLayoutList::Draw(wxDC &dc,
|
||||||
wxPoint const &offset,
|
wxPoint const &offset,
|
||||||
|
@@ -932,8 +932,22 @@ public:
|
|||||||
@param dc the wxDC to draw on
|
@param dc the wxDC to draw on
|
||||||
@param bottom optional y coordinate where to stop calculating
|
@param bottom optional y coordinate where to stop calculating
|
||||||
@param forceAll force re-layout of all lines
|
@param forceAll force re-layout of all lines
|
||||||
|
@param cpos Can hold a cursorposition, and will be overwritten
|
||||||
|
with the corresponding DC position.
|
||||||
|
@param csize Will hold the cursor size relating to cpos.
|
||||||
*/
|
*/
|
||||||
void Layout(wxDC &dc, CoordType bottom = -1, bool forceAll = false);
|
void Layout(wxDC &dc, CoordType bottom = -1, bool forceAll = false,
|
||||||
|
wxPoint *cpos = NULL,
|
||||||
|
wxPoint *csize = NULL);
|
||||||
|
|
||||||
|
/** Returns the screen coordinates relating to a given cursor
|
||||||
|
position and the size of the cursor at that position.
|
||||||
|
@param dc for which to calculate it
|
||||||
|
@param cpos Cursor position to look for.
|
||||||
|
@param csize If non-NULL, will be set to the cursor size.
|
||||||
|
@return The cursor position on the DC.
|
||||||
|
*/
|
||||||
|
wxPoint GetScreenPos(wxDC &dc, const wxPoint &cpos, wxPoint *csize = NULL);
|
||||||
|
|
||||||
/** Calculates new sizes for everything in the list, like Layout()
|
/** Calculates new sizes for everything in the list, like Layout()
|
||||||
but this is needed after the list got changed.
|
but this is needed after the list got changed.
|
||||||
|
Reference in New Issue
Block a user