EVT_DROP_FILES(wxTextCtrl::OnDropFiles)
#if wxUSE_RICHEDIT
- EVT_RIGHT_UP(wxTextCtrl::OnRightClick)
+ EVT_CONTEXT_MENU(wxTextCtrl::OnContextMenu)
#endif
EVT_MENU(wxID_CUT, wxTextCtrl::OnCut)
m_privateContextMenu = NULL;
m_updatesCount = -1;
m_isNativeCaretShown = true;
- m_isCaretAtEnd = true;
}
wxTextCtrl::~wxTextCtrl()
void wxTextCtrl::SetInsertionPoint(long pos)
{
DoSetSelection(pos, pos);
-
- m_isCaretAtEnd = pos == GetLastPosition();
}
void wxTextCtrl::SetInsertionPointEnd()
// if it doesn't actually move the caret anywhere and so the simple fact of
// doing it results in horrible flicker when appending big amounts of text
// to the control in a few chunks (see DoAddText() test in the text sample)
- if ( m_isCaretAtEnd || GetInsertionPoint() == GetLastPosition() )
+ if ( GetInsertionPoint() == GetLastPosition() )
{
- m_isCaretAtEnd = true;
return;
}
return Pos & 0xFFFF;
}
-long wxTextCtrl::GetLastPosition() const
+wxTextPos wxTextCtrl::GetLastPosition() const
{
int numLines = GetNumberOfLines();
long posStartLastLine = XYToPosition(0, numLines - 1);
if (linesToScroll != 0)
(void)::SendMessage(hWnd, EM_LINESCROLL, (WPARAM)0, (LPARAM)linesToScroll);
-
- // be pessimistic
- m_isCaretAtEnd = false;
}
long wxTextCtrl::GetLengthOfLineContainingPos(long pos) const
if (CanUndo())
{
::SendMessage(GetHwnd(), EM_UNDO, 0, 0);
-
- // it's not necessarily at the end any more
- m_isCaretAtEnd = false;
}
}
#endif
// Same as Undo, since Undo undoes the undo, i.e. a redo.
::SendMessage(GetHwnd(), EM_UNDO, 0, 0);
-
- // it's not necessarily at the end any more
- m_isCaretAtEnd = false;
}
}
wxCommandEvent event(wxEVT_COMMAND_TEXT_UPDATED, GetId());
InitCommandEvent(event);
- event.SetString(GetValue());
return ProcessCommand(event);
}
event.Enable(GetLastPosition() > 0);
}
-void wxTextCtrl::OnRightClick(wxMouseEvent& event)
+void wxTextCtrl::OnContextMenu(wxContextMenuEvent& event)
{
#if wxUSE_RICHEDIT
if (IsRich())
m_privateContextMenu->AppendSeparator();
m_privateContextMenu->Append(wxID_SELECTALL, _("Select &All"));
}
- PopupMenu(m_privateContextMenu, event.GetPosition());
+ PopupMenu(m_privateContextMenu);
return;
}
else
// Default colors for MSW text control
//
// Set default background color to the native white instead of
-// the default wxSYS_COLOUR_BTNFACE (is triggered with wxNullColour).
+// the default wxSYS_COLOUR_BTNFACE (is triggered with wxNullColour).
// ----------------------------------------------------------------------------
wxVisualAttributes wxTextCtrl::GetDefaultAttributes() const
{
// we have to do this or the style wouldn't apply for the text typed by
// the user
- long posLast = GetLastPosition();
+ wxTextPos posLast = GetLastPosition();
SetStyle(posLast, posLast, m_defaultStyle);
}
wxStrcpy(lf.lfFaceName, cf.szFaceName);
//NOTE: we _MUST_ set each of these values to _something_ since we
- //do not call wxZeroMemory on the LOGFONT lf
+ //do not call wxZeroMemory on the LOGFONT lf
if (cf.dwEffects & CFE_ITALIC)
lf.lfItalic = TRUE;
else