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:
Karsten Ballüder
1999-06-07 20:47:54 +00:00
parent d7431b43f4
commit da0fb2767c
2 changed files with 33 additions and 5 deletions

View File

@@ -2135,7 +2135,9 @@ wxLayoutList::GetCursorScreenPos(wxDC &dc)
have changed.
*/
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
// needed, optimise it later
@@ -2150,7 +2152,8 @@ wxLayoutList::Layout(wxDC &dc, CoordType bottom, bool forceAll)
{
if(! wasDirty)
ApplyStyle(line->GetStyleInfo(), dc);
if(forceAll || line->IsDirty())
if(forceAll || line->IsDirty()
|| (cpos && line->GetLineNumber() == cpos->y))
{
// The following Layout() calls will update our
// m_CurrentStyleInfo if needed.
@@ -2158,9 +2161,12 @@ wxLayoutList::Layout(wxDC &dc, CoordType bottom, bool forceAll)
line->Layout(dc, this,
(wxPoint *)&m_CursorScreenPos,
(wxPoint *)&m_CursorSize, m_CursorPos.x);
if(cpos && line->GetLineNumber() == cpos->y)
line->Layout(dc, this,
cpos,
csize, cpos->x);
else
line->Layout(dc, this);
// little condition to speed up redrawing:
if(bottom != -1 && line->GetPosition().y > bottom)
break;
@@ -2169,7 +2175,7 @@ wxLayoutList::Layout(wxDC &dc, CoordType bottom, bool forceAll)
line->RecalculatePositions(1, this);
line = line->GetNextLine();
}
// can only be 0 if we are on the first line and have no next line
wxASSERT(m_CursorSize.x != 0 || (m_CursorLine &&
m_CursorLine->GetNextLine() == NULL &&
@@ -2177,6 +2183,14 @@ wxLayoutList::Layout(wxDC &dc, CoordType bottom, bool forceAll)
AddCursorPosToUpdateRect();
}
wxPoint
wxLayoutList::GetScreenPos(wxDC &dc, const wxPoint &cpos, wxPoint *csize = NULL)
{
wxPoint pos = cpos;
Layout(dc, -1, false, &pos, csize);
return pos;
}
void
wxLayoutList::Draw(wxDC &dc,
wxPoint const &offset,