0N/A/*
3261N/A * Copyright (c) 1996, 2010, Oracle and/or its affiliates. All rights reserved.
0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
0N/A *
0N/A * This code is free software; you can redistribute it and/or modify it
0N/A * under the terms of the GNU General Public License version 2 only, as
2362N/A * published by the Free Software Foundation. Oracle designates this
0N/A * particular file as subject to the "Classpath" exception as provided
2362N/A * by Oracle in the LICENSE file that accompanied this code.
0N/A *
0N/A * This code is distributed in the hope that it will be useful, but WITHOUT
0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
0N/A * version 2 for more details (a copy is included in the LICENSE file that
0N/A * accompanied this code).
0N/A *
0N/A * You should have received a copy of the GNU General Public License version
0N/A * 2 along with this work; if not, write to the Free Software Foundation,
0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
0N/A *
2362N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
2362N/A * or visit www.oracle.com if you need additional information or have any
2362N/A * questions.
0N/A */
0N/A
0N/A#ifndef AWT_TEXTCOMPONENT_H
0N/A#define AWT_TEXTCOMPONENT_H
0N/A
0N/A#include "awt_Component.h"
0N/A
0N/A#include "java_awt_TextComponent.h"
0N/A#include "sun_awt_windows_WTextComponentPeer.h"
0N/A
0N/A#include <ole2.h>
0N/A#include <richedit.h>
0N/A#include <richole.h>
0N/A
0N/A
0N/A/************************************************************************
0N/A * AwtTextComponent class
0N/A */
0N/A
0N/Aclass AwtTextComponent : public AwtComponent {
0N/Apublic:
5688N/A static jmethodID canAccessClipboardMID;
0N/A
0N/A AwtTextComponent();
0N/A
5131N/A static AwtTextComponent* Create(jobject self, jobject parent, BOOL isMultiline);
5131N/A
0N/A virtual LPCTSTR GetClassName();
5225N/A LRESULT WindowProc(UINT message, WPARAM wParam, LPARAM lParam);
0N/A
0N/A int RemoveCR(WCHAR *pStr);
0N/A
0N/A virtual LONG getJavaSelPos(LONG orgPos);
0N/A virtual LONG getWin32SelPos(LONG orgPos);
0N/A
0N/A void CheckLineSeparator(WCHAR *pStr);
0N/A
0N/A virtual void SetSelRange(LONG start, LONG end);
0N/A
0N/A INLINE void SetText(LPCTSTR text) {
0N/A ::SetWindowText(GetHWnd(), text);
0N/A }
0N/A
0N/A INLINE virtual int GetText(LPTSTR buffer, int size) {
0N/A return ::GetWindowText(GetHWnd(), buffer, size);
0N/A }
0N/A
0N/A // called on Toolkit thread from JNI
0N/A static jstring _GetText(void *param);
0N/A
0N/A void SetFont(AwtFont* font);
0N/A
5131N/A virtual void Enable(BOOL bEnable);
5131N/A virtual void SetColor(COLORREF c);
5131N/A virtual void SetBackgroundColor(COLORREF c);
5131N/A
0N/A /*
0N/A * Windows message handler functions
0N/A */
0N/A MsgRouting WmNotify(UINT notifyCode);
0N/A MsgRouting HandleEvent(MSG *msg, BOOL synthetic);
0N/A MsgRouting WmPaste();
0N/A
1058N/A virtual BOOL IsFocusingMouseMessage(MSG *pMsg);
1058N/A
0N/A/* To be fully implemented in a future release
0N/A
0N/A MsgRouting WmKeyDown(UINT wkey, UINT repCnt,
0N/A UINT flags, BOOL system); // accessibility support
0N/A*/
0N/A
0N/A
0N/A //im --- for over the spot composition
0N/A void SetCompositionWindow(RECT& rect);
0N/A
0N/A INLINE HWND GetDBCSEditHandle() { return GetHWnd(); }
0N/A
0N/A BOOL m_isLFonly;
0N/A BOOL m_EOLchecked;
0N/A
0N/A // some methods invoked on Toolkit thread
0N/A static void _SetText(void *param);
0N/A static jint _GetSelectionStart(void *param);
0N/A static jint _GetSelectionEnd(void *param);
0N/A static void _Select(void *param);
0N/A static void _EnableEditing(void *param);
0N/A
0N/A protected:
0N/A INLINE LONG GetStartSelectionPos() { return m_lStartPos; }
0N/A INLINE LONG GetEndSelectionPos() { return m_lEndPos; }
0N/A INLINE LONG GetLastSelectionPos() { return m_lLastPos; }
0N/A INLINE VOID SetStartSelectionPos(LONG lPos) { m_lStartPos = lPos; }
0N/A INLINE VOID SetEndSelectionPos(LONG lPos) { m_lEndPos = lPos; }
0N/A INLINE VOID SetLastSelectionPos(LONG lPos) { m_lLastPos = lPos; }
0N/A
0N/A // Used to prevent untrusted code from synthesizing a WM_PASTE message
0N/A // by posting a <CTRL>-V KeyEvent
0N/A BOOL m_synthetic;
5131N/A LONG EditGetCharFromPos(POINT& pt);
5131N/A
5131N/A /*****************************************************************
5131N/A * Inner class OleCallback declaration.
5131N/A */
5131N/A class OleCallback : public IRichEditOleCallback {
5131N/A public:
5131N/A OleCallback();
5131N/A
5131N/A STDMETHODIMP QueryInterface(REFIID riid, LPVOID * ppvObj);
5131N/A STDMETHODIMP_(ULONG) AddRef();
5131N/A STDMETHODIMP_(ULONG) Release();
5131N/A STDMETHODIMP GetNewStorage(LPSTORAGE FAR * ppstg);
5131N/A STDMETHODIMP GetInPlaceContext(LPOLEINPLACEFRAME FAR * ppipframe,
5131N/A LPOLEINPLACEUIWINDOW FAR* ppipuiDoc,
5131N/A LPOLEINPLACEFRAMEINFO pipfinfo);
5131N/A STDMETHODIMP ShowContainerUI(BOOL fShow);
5131N/A STDMETHODIMP QueryInsertObject(LPCLSID pclsid, LPSTORAGE pstg, LONG cp);
5131N/A STDMETHODIMP DeleteObject(LPOLEOBJECT poleobj);
5131N/A STDMETHODIMP QueryAcceptData(LPDATAOBJECT pdataobj, CLIPFORMAT *pcfFormat,
5131N/A DWORD reco, BOOL fReally, HGLOBAL hMetaPict);
5131N/A STDMETHODIMP ContextSensitiveHelp(BOOL fEnterMode);
5131N/A STDMETHODIMP GetClipboardData(CHARRANGE *pchrg, DWORD reco,
5131N/A LPDATAOBJECT *ppdataobj);
5131N/A STDMETHODIMP GetDragDropEffect(BOOL fDrag, DWORD grfKeyState,
5131N/A LPDWORD pdwEffect);
5131N/A STDMETHODIMP GetContextMenu(WORD seltype, LPOLEOBJECT poleobj,
5131N/A CHARRANGE FAR * pchrg, HMENU FAR * phmenu);
5131N/A private:
5131N/A ULONG m_refs; // Reference count
5131N/A };//OleCallback class
5131N/A
5131N/A INLINE static OleCallback& GetOleCallback() { return sm_oleCallback; }
5131N/A
0N/A
0N/Aprivate:
0N/A
0N/A // Fields to track the selection state while the left mouse button is
0N/A // pressed. They are used to simulate autoscrolling.
0N/A LONG m_lStartPos;
0N/A LONG m_lEndPos;
0N/A LONG m_lLastPos;
0N/A
0N/A HFONT m_hFont;
0N/A //im --- end
0N/A
5131N/A static OleCallback sm_oleCallback;
0N/A
0N/A //
0N/A // Accessibility support
0N/A //
0N/A//public:
0N/A// jlong javaEventsMask;
0N/A};
0N/A
0N/A#endif /* AWT_TEXTCOMPONENT_H */