diff options
Diffstat (limited to 'macosx/ScintillaMacOSX.h')
-rw-r--r-- | macosx/ScintillaMacOSX.h | 54 |
1 files changed, 46 insertions, 8 deletions
diff --git a/macosx/ScintillaMacOSX.h b/macosx/ScintillaMacOSX.h index 1b386b48b..66d4f0f68 100644 --- a/macosx/ScintillaMacOSX.h +++ b/macosx/ScintillaMacOSX.h @@ -2,8 +2,10 @@ * ScintillaMacOSX.h * tutorial * - * Created by Evan Jones on Sun Sep 01 2002. - * Copyright (c) 2002 __MyCompanyName__. All rights reserved. + * Original code by Evan Jones on Sun Sep 01 2002. + * Contributors: + * Shane Caraveo, ActiveState + * Bernd Paradies, Adobe * */ #include "TView.h" @@ -50,20 +52,41 @@ #include "ScintillaCallTip.h" static const OSType scintillaMacOSType = 'Scin'; -static const OSType scintillaNotifyObject = 'Snob'; -static const OSType scintillaNotifyFN = 'Snfn'; namespace Scintilla { +/** +On the Mac, there is no WM_COMMAND or WM_NOTIFY message that can be sent +back to the parent. Therefore, there must be a callback handler that acts +like a Windows WndProc, where Scintilla can send notifications to. Use +ScintillaMacOSX::registerNotifyHandler() to register such a handler. +Messgae format is: +<br> +WM_COMMAND: HIWORD (wParam) = notification code, LOWORD (wParam) = 0 (no control ID), lParam = ScintillaMacOSX* +<br> +WM_NOTIFY: wParam = 0 (no control ID), lParam = ptr to SCNotification structure, with hwndFrom set to ScintillaMacOSX* +*/ +typedef void(*SciNotifyFunc) (intptr_t windowid, unsigned int iMessage, uintptr_t wParam, uintptr_t lParam); + +/** +Scintilla sends these two messages to the nofity handler. Please refer +to the Windows API doc for details about the message format. +*/ +#define WM_COMMAND 1001 +#define WM_NOTIFY 1002 + class ScintillaMacOSX : public ScintillaBase, public TView { public: HIViewRef vScrollBar; HIViewRef hScrollBar; SInt32 scrollBarFixedSize; + SciNotifyFunc notifyProc; + intptr_t notifyObj; bool capturedMouse; - bool inDragSession; // true if scintilla initiated the drag session + // true if scintilla initiated the drag session + bool inDragSession() { return inDragDrop == ddDragging; }; bool isTracking; // Private so ScintillaMacOSX objects can not be copied @@ -82,15 +105,26 @@ public: /** Returns the HIView object kind, needed to subclass TView. */ virtual ControlKind GetKind() { return kScintillaKind; } + /// Register the notify callback + void registerNotifyCallback(intptr_t windowid, SciNotifyFunc callback); private: virtual void Initialise(); virtual void Finalise(); + + // pasteboard support + bool GetPasteboardData(PasteboardRef &pasteBoard, + SelectionText *selectedText, bool *isFileURL); + void SetPasteboardData(PasteboardRef &pasteBoard, + const SelectionText &selectedText); + char *GetStringFromCFString(CFStringRef &textString, int *textLen); + + // Drag and drop virtual void StartDrag(); Scintilla::Point GetDragPoint(DragRef inDrag); - OSStatus GetDragData(DragRef inDrag, PasteboardRef &pasteBoard, CFStringRef *textString); + bool GetDragData(DragRef inDrag, PasteboardRef &pasteBoard, + SelectionText *selectedText, + bool *isFileURL); void SetDragCursor(DragRef inDrag); - - // Drag and drop virtual bool DragEnter(DragRef inDrag ); virtual bool DragWithin(DragRef inDrag ); virtual bool DragLeave(DragRef inDrag ); @@ -104,6 +138,7 @@ private: MouseTrackingRegionID mouseTrackingID; HIPoint GetLocalPoint(::Point pt); + void InsertCharacters (const UniChar* buf, int len); static pascal void IdleTimerEventHandler(EventLoopTimerRef inTimer, EventLoopIdleTimerMessage inState, void *scintilla ); @@ -136,7 +171,10 @@ public: // Public for scintilla_send_message virtual void NotifyParent(SCNotification scn); void NotifyKey(int key, int modifiers); void NotifyURIDropped(const char *list); +#ifndef EXT_INPUT + // Extended UTF8-UTF6-conversion to handle surrogate pairs correctly (CL265070) virtual int KeyDefault(int key, int modifiers); +#endif static pascal OSStatus CommandEventHandler( EventHandlerCallRef inCallRef, EventRef inEvent, void* data ); bool HasSelection(); |