}
void
-wxLayoutList::UpdateCursorScreenPos(wxDC &dc,
- bool resetCursorMovedFlag,
- const wxPoint& translate)
+wxLayoutList::UpdateCursorScreenPos(wxDC &dc)
{
wxCHECK_RET( m_CursorLine, "no cursor line" );
- if ( m_movedCursor )
- {
- // we need to save the current style, in case the layout() of
- // the line changes it
- wxLayoutStyleInfo SiBackup = m_CurrentStyleInfo;
- m_CursorLine->Layout(dc, this,
- &m_CursorScreenPos, &m_CursorSize,
- m_CursorPos.x,
- /* suppress update */ true);
- ApplyStyle(SiBackup, dc); // restore it
-
- if ( resetCursorMovedFlag )
- {
-#ifdef WXLAYOUT_USE_CARET
- // adjust the caret position
- wxPoint coords(m_CursorScreenPos);
- coords += translate;
-
- // and set it
- m_caret->Move(coords);
-#endif // WXLAYOUT_USE_CARET
-
- m_movedCursor = false;
- }
- }
+ // we need to save the current style, in case the layout() of the line
+ // changes it
+ wxLayoutStyleInfo SiBackup = m_CurrentStyleInfo;
+ m_CursorLine->Layout(dc, this,
+ &m_CursorScreenPos, &m_CursorSize,
+ m_CursorPos.x,
+ true /* suppress update */);
+ ApplyStyle(SiBackup, dc); // restore it
}
wxPoint
wxLayoutList::GetCursorScreenPos(wxDC &dc)
{
- // this function is called with wxMemoryDC argument from ScrollToCursor(),
- // for example, so it shouldn't clear "cursor moved" flag - or else the
- // cursor won't be moved when UpdateCursorScreenPos() is called with the
- // "real" (i.e. the one used for drawing) wxDC.
- UpdateCursorScreenPos(dc, false /* don't reset the flag */);
+ UpdateCursorScreenPos(dc);
return m_CursorScreenPos;
}
*/
void
wxLayoutList::Layout(wxDC &dc, CoordType bottom, bool forceAll,
- wxPoint *cpos = NULL,
- wxPoint *csize = NULL)
+ wxPoint *cpos, wxPoint *csize)
{
// first, make sure everything is calculated - this might not be
// needed, optimise it later
}
wxPoint
-wxLayoutList::GetScreenPos(wxDC &dc, const wxPoint &cpos, wxPoint *csize = NULL)
+wxLayoutList::GetScreenPos(wxDC &dc, const wxPoint &cpos, wxPoint *csize)
{
wxPoint pos = cpos;
Layout(dc, -1, false, &pos, csize);
void
wxLayoutList::DrawCursor(wxDC &dc, bool active, wxPoint const &translate)
{
+ if ( m_movedCursor )
+ {
+ UpdateCursorScreenPos(dc);
+
+ m_movedCursor = false;
+ }
+
wxPoint coords(m_CursorScreenPos);
coords += translate;
wxLogStatus("Cursor is at (%d, %d)", m_CursorPos.x, m_CursorPos.y);
#endif
-#ifndef WXLAYOUT_USE_CARET
+#ifdef WXLAYOUT_USE_CARET
+ m_caret->Move(coords);
+#else // !WXLAYOUT_USE_CARET
dc.SetBrush(*wxBLACK_BRUSH);
dc.SetLogicalFunction(wxXOR);
dc.SetPen(wxPen(*wxBLACK,1,wxSOLID));
@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()
but this is needed after the list got changed.
@param dc the wxDC to draw on
@return cursor position in pixels
*/
wxPoint GetCursorScreenPos(wxDC &dc);
+
/** Calculates the cursor position on the screen.
@param dc the dc to use for cursor position calculations
- @param resetCursorMovedFlag: if true, reset "cursor moved" flag
- @param translate optional translation of cursor coords on screen
-
*/
- void UpdateCursorScreenPos(wxDC &dc,
- bool resetCursorMovedFlag = true,
- const wxPoint& translate = wxPoint(0,
- 0));
+ void UpdateCursorScreenPos(wxDC &dc);
/** Draws the cursor.
@param active If true, draw a bold cursor to mark window as
x0 *= dx; y0 *= dy;
wxPoint offset(-x0+WXLO_XOFFSET, -y0+WXLO_YOFFSET);
- m_llist->UpdateCursorScreenPos(dc, true, offset);
if(m_CursorVisibility == -1)
m_CursorVisibility = 1;
+ if(m_CursorVisibility != 0)
+ {
+ // draw a thick cursor for editable windows with focus
+ m_llist->DrawCursor(dc, m_HaveFocus && IsEditable(), offset);
+ }
+
// VZ: this should be unnecessary because mouse can only click on a
// visible part of the canvas
#if 0
void
wxLayoutWindow::DoPaint(const wxRect *updateRect)
{
-#ifndef __WXMSW__
+ // Causes bad flicker under wxGTK!!!
+#ifdef __WXGTK__
InternalPaint(updateRect);
#else
- Refresh(FALSE, updateRect); // Causes bad flicker under wxGTK!!!
+ Refresh(FALSE); //, updateRect);
if ( !::UpdateWindow(GetHwnd()) )
wxLogLastError("UpdateWindow");
m_llist->InvalidateUpdateRect();
if(m_CursorVisibility != 0)
{
- m_llist->UpdateCursorScreenPos(dc, true, offset);
+ // draw a thick cursor for editable windows with focus
m_llist->DrawCursor(*m_memDC,
- m_HaveFocus && IsEditable(), // draw a thick
- // cursor for editable windows with focus
+ m_HaveFocus && IsEditable(),
offset);
}