DEFINE_EVENT_TYPE( wxEVT_STC_URIDROPPED )
DEFINE_EVENT_TYPE( wxEVT_STC_DWELLSTART )
DEFINE_EVENT_TYPE( wxEVT_STC_DWELLEND )
-#if wxUSE_DRAG_AND_DROP
DEFINE_EVENT_TYPE( wxEVT_STC_START_DRAG )
DEFINE_EVENT_TYPE( wxEVT_STC_DRAG_OVER )
DEFINE_EVENT_TYPE( wxEVT_STC_DO_DROP )
-#endif
BEGIN_EVENT_TABLE(wxStyledTextCtrl, wxControl)
#endif
EVT_MOTION (wxStyledTextCtrl::OnMouseMove)
EVT_LEFT_UP (wxStyledTextCtrl::OnMouseLeftUp)
+#ifdef __WXGTK__
+ EVT_RIGHT_UP (wxStyledTextCtrl::OnMouseRightUp)
+#else
EVT_CONTEXT_MENU (wxStyledTextCtrl::OnContextMenu)
+#endif
EVT_MOUSEWHEEL (wxStyledTextCtrl::OnMouseWheel)
EVT_CHAR (wxStyledTextCtrl::OnChar)
EVT_KEY_DOWN (wxStyledTextCtrl::OnKeyDown)
style | wxVSCROLL | wxHSCROLL | wxWANTS_CHARS | wxCLIP_CHILDREN,
wxDefaultValidator, name)
{
+ wxForceScintillaLexers();
m_swx = new ScintillaWX(this);
m_stopWatch.Start();
m_lastKeyDownConsumed = FALSE;
// Retrieve a buffer of cells.
wxString wxStyledTextCtrl::GetStyledText(int startPos, int endPos) {
wxString text;
+ if (endPos < startPos) {
+ int temp = startPos;
+ startPos = endPos;
+ endPos = temp;
+ }
int len = endPos - startPos;
if (!len) return "";
TextRange tr;
wxRect pageRect) {
RangeToFormat fr;
+ if (endPos < startPos) {
+ int temp = startPos;
+ startPos = endPos;
+ endPos = temp;
+ }
fr.hdc = draw;
fr.hdcTarget = target;
fr.rc.top = renderRect.GetTop();
// Retrieve a range of text.
wxString wxStyledTextCtrl::GetTextRange(int startPos, int endPos) {
wxString text;
+ if (endPos < startPos) {
+ int temp = startPos;
+ startPos = endPos;
+ endPos = temp;
+ }
int len = endPos - startPos;
if (!len) return "";
char* buff = text.GetWriteBuf(len);
}
+void wxStyledTextCtrl::OnMouseRightUp(wxMouseEvent& evt) {
+ wxPoint pt = evt.GetPosition();
+ m_swx->DoContextMenu(Point(pt.x, pt.y));
+}
+
+
void wxStyledTextCtrl::OnContextMenu(wxContextMenuEvent& evt) {
wxPoint pt = evt.GetPosition();
ScreenToClient(&pt.x, &pt.y);
bool alt = evt.AltDown();
bool skip = ((ctrl || alt) && ! (ctrl && alt));
- if (key <= 0xff && !iscntrl(key) && !m_lastKeyDownConsumed && !skip) {
+ if (key <= 0xff && key >= 32 && !m_lastKeyDownConsumed && !skip) {
m_swx->DoAddChar(key);
return;
}
m_listType = 0;
m_x = 0;
m_y = 0;
-#if wxUSE_DRAG_AND_DROP
m_dragAllowMove = FALSE;
m_dragResult = wxDragNone;
-#endif
}
bool wxStyledTextEvent::GetShift() const { return (m_modifiers & SCI_SHIFT) != 0; }
m_x = event.m_x;
m_y = event.m_y;
-#if wxUSE_DRAG_AND_DROP
m_dragText = event.m_dragText;
m_dragAllowMove =event.m_dragAllowMove;
m_dragResult = event.m_dragResult;
-#endif
}
//----------------------------------------------------------------------