diff options
author | nyamatongwe <unknown> | 2000-10-05 12:20:59 +0000 |
---|---|---|
committer | nyamatongwe <unknown> | 2000-10-05 12:20:59 +0000 |
commit | a2bc00fb8619d2a130500cfcfb458fa2f87c7ca9 (patch) | |
tree | c80e2b4a5f9c9c89f72fed1ea652a39d45457510 | |
parent | 64b89c25354dba83c93e8c05150d6db39f6219da (diff) | |
download | scintilla-mirror-a2bc00fb8619d2a130500cfcfb458fa2f87c7ca9.tar.gz |
SetCursor implemented.
-rw-r--r-- | gtk/ScintillaGTK.cxx | 2 | ||||
-rw-r--r-- | src/Editor.cxx | 30 | ||||
-rw-r--r-- | src/Editor.h | 2 | ||||
-rw-r--r-- | win32/ScintillaWin.cxx | 8 |
4 files changed, 29 insertions, 13 deletions
diff --git a/gtk/ScintillaGTK.cxx b/gtk/ScintillaGTK.cxx index 34d3e2289..b0130a793 100644 --- a/gtk/ScintillaGTK.cxx +++ b/gtk/ScintillaGTK.cxx @@ -1026,7 +1026,7 @@ gint ScintillaGTK::DestroyWindow(GtkWidget *, ScintillaGTK *sciThis) { gint ScintillaGTK::Expose(GtkWidget *, GdkEventExpose *ose, ScintillaGTK *sciThis) { if (sciThis->firstExpose) { - sciThis->wDraw.SetCursor(Window::cursorText); + sciThis->DisplayCursor(Window::cursorText); sciThis->firstExpose = false; } diff --git a/src/Editor.cxx b/src/Editor.cxx index dbd5a3901..642faf5f4 100644 --- a/src/Editor.cxx +++ b/src/Editor.cxx @@ -40,7 +40,8 @@ Editor::Editor() { printMagnification = 0; printColourMode = SC_PRINT_NORMAL; - + cursorMode = SC_CURSORNORMAL; + hasFocus = false; hideSelection = false; inOverstrike = false; @@ -2470,13 +2471,19 @@ void Editor::SetDragPosition(int newPos) { } } +void Editor::DisplayCursor(Window::Cursor c) { + if (cursorMode == SC_CURSORNORMAL) + wDraw.SetCursor(c); + else + wDraw.SetCursor(static_cast<Window::Cursor>(cursorMode)); +} + void Editor::StartDrag() { // Always handled by subclasses //SetMouseCapture(true); - //wDraw.SetCursor(Window::cursorArrow); + //DisplayCursor(Window::cursorArrow); } - void Editor::DropAt(int position, const char *value, bool moving, bool rectangular) { //Platform::DebugPrintf("DropAt %d\n", inDragDrop); if (inDragDrop) @@ -2746,16 +2753,16 @@ void Editor::ButtonMove(Point pt) { } else { if (vs.fixedColumnWidth > 0) { // There is a margin if (PointInSelMargin(pt)) { - wDraw.SetCursor(Window::cursorReverseArrow); + DisplayCursor(Window::cursorReverseArrow); return ; // No need to test for selection } } // Display regular (drag) cursor over selection if (PointInSelection(pt)) - wDraw.SetCursor(Window::cursorArrow); + DisplayCursor(Window::cursorArrow); else - wDraw.SetCursor(Window::cursorText); + DisplayCursor(Window::cursorText); } } @@ -2764,9 +2771,9 @@ void Editor::ButtonUp(Point pt, unsigned int curTime, bool ctrl) { //Platform::DebugPrintf("ButtonUp %d\n", HaveMouseCapture()); if (HaveMouseCapture()) { if (PointInSelMargin(pt)) { - wDraw.SetCursor(Window::cursorReverseArrow); + DisplayCursor(Window::cursorReverseArrow); } else { - wDraw.SetCursor(Window::cursorText); + DisplayCursor(Window::cursorText); } xEndSelect = pt.x - vs.fixedColumnWidth + xOffset; ptMouseLast = pt; @@ -4315,6 +4322,13 @@ long Editor::WndProc(unsigned int iMessage, unsigned long wParam, long lParam) { case SCI_GETMOUSEDOWNCAPTURES: return mouseDownCaptures; + case SCI_SETCURSOR: + cursorMode = wParam; + break; + + case SCI_GETCURSOR: + return cursorMode; + #ifdef MACRO_SUPPORT case SCI_STARTRECORD: recordingMacro = 1; diff --git a/src/Editor.h b/src/Editor.h index f40b21576..4d0ceec37 100644 --- a/src/Editor.h +++ b/src/Editor.h @@ -61,6 +61,7 @@ protected: // ScintillaBase subclass needs access to much of Editor Palette palette; int printMagnification; int printColourMode; + int cursorMode; bool hasFocus; bool hideSelection; @@ -273,6 +274,7 @@ protected: // ScintillaBase subclass needs access to much of Editor char *CopySelectionRange(); void CopySelectionIntoDrag(); void SetDragPosition(int newPos); + void DisplayCursor(Window::Cursor c); virtual void StartDrag(); void DropAt(int position, const char *value, bool moving, bool rectangular); // PositionInSelection returns 0 if position in selection, -1 if position before selection, and 1 if after. diff --git a/win32/ScintillaWin.cxx b/win32/ScintillaWin.cxx index dc245c705..17206906b 100644 --- a/win32/ScintillaWin.cxx +++ b/win32/ScintillaWin.cxx @@ -452,18 +452,18 @@ LRESULT ScintillaWin::WndProc(unsigned int iMessage, unsigned long wParam, long case WM_SETCURSOR: if (LoWord(lParam) == HTCLIENT) { if (inDragDrop) { - wDraw.SetCursor(Window::cursorUp); + DisplayCursor(Window::cursorUp); } else { // Display regular (drag) cursor over selection POINT pt; ::GetCursorPos(&pt); ::ScreenToClient(wMain.GetID(), &pt); if (PointInSelMargin(Point(pt.x, pt.y))) { - wDraw.SetCursor(Window::cursorReverseArrow); + DisplayCursor(Window::cursorReverseArrow); } else if (PointInSelection(Point(pt.x, pt.y))) { - wDraw.SetCursor(Window::cursorArrow); + DisplayCursor(Window::cursorArrow); } else { - wDraw.SetCursor(Window::cursorText); + DisplayCursor(Window::cursorText); } } return TRUE; |