diff options
Diffstat (limited to 'win32/ScintillaWin.cxx')
-rw-r--r-- | win32/ScintillaWin.cxx | 45 |
1 files changed, 28 insertions, 17 deletions
diff --git a/win32/ScintillaWin.cxx b/win32/ScintillaWin.cxx index d4d3b24da..8092edcd8 100644 --- a/win32/ScintillaWin.cxx +++ b/win32/ScintillaWin.cxx @@ -102,6 +102,29 @@ const TCHAR callClassName[] = TEXT("CallTip"); using namespace Scintilla; #endif +// Take care of 32/64 bit pointers +#ifdef GetWindowLongPtr +static void *PointerFromWindow(HWND hWnd) { + return reinterpret_cast<void *>(::GetWindowLongPtr(hWnd, 0)); +} +static void SetWindowPointer(HWND hWnd, void *ptr) { + ::SetWindowLongPtr(hWnd, 0, reinterpret_cast<LONG_PTR>(ptr)); +} +static void SetWindowID(HWND hWnd, int identifier) { + ::SetWindowLongPtr(hWnd, GWLP_ID, identifier); +} +#else +static void *PointerFromWindow(HWND hWnd) { + return reinterpret_cast<void *>(::GetWindowLong(hWnd, 0)); +} +static void SetWindowPointer(HWND hWnd, void *ptr) { + ::SetWindowLong(hWnd, 0, reinterpret_cast<LONG>(ptr)); +} +static void SetWindowID(HWND hWnd, int identifier) { + ::SetWindowLong(hWnd, GWL_ID, identifier); +} +#endif + class ScintillaWin; // Forward declaration for COM interface subobjects typedef void VFunction(void); @@ -211,6 +234,7 @@ class ScintillaWin : virtual bool ModifyScrollBars(int nMax, int nPage); virtual void NotifyChange(); virtual void NotifyFocus(bool focus); + virtual void SetCtrlID(int identifier); virtual int GetCtrlID(); virtual void NotifyParent(SCNotification scn); virtual void NotifyDoubleClick(Point pt, bool shift, bool ctrl, bool alt); @@ -1278,6 +1302,10 @@ void ScintillaWin::NotifyFocus(bool focus) { reinterpret_cast<LPARAM>(MainHWND())); } +void ScintillaWin::SetCtrlID(int identifier) { + ::SetWindowID(reinterpret_cast<HWND>(wMain.GetID()), identifier); +} + int ScintillaWin::GetCtrlID() { return ::GetDlgCtrlID(reinterpret_cast<HWND>(wMain.GetID())); } @@ -2628,23 +2656,6 @@ BOOL ScintillaWin::DestroySystemCaret() { return retval; } -// Take care of 32/64 bit pointers -#ifdef GetWindowLongPtr -static void *PointerFromWindow(HWND hWnd) { - return reinterpret_cast<void *>(::GetWindowLongPtr(hWnd, 0)); -} -static void SetWindowPointer(HWND hWnd, void *ptr) { - ::SetWindowLongPtr(hWnd, 0, reinterpret_cast<LONG_PTR>(ptr)); -} -#else -static void *PointerFromWindow(HWND hWnd) { - return reinterpret_cast<void *>(::GetWindowLong(hWnd, 0)); -} -static void SetWindowPointer(HWND hWnd, void *ptr) { - ::SetWindowLong(hWnd, 0, reinterpret_cast<LONG>(ptr)); -} -#endif - sptr_t PASCAL ScintillaWin::CTWndProc( HWND hWnd, UINT iMessage, WPARAM wParam, sptr_t lParam) { // Find C++ object associated with window. |