50
51 #define LEFT_BUTTON 1
52 #define MIDDLE_BUTTON 2
53 #define RIGHT_BUTTON 4
54 #define DBL_CLICK 8
55 #define X1_BUTTON 16
56 #define X2_BUTTON 32
57
58 #ifndef MK_XBUTTON1
59 #define MK_XBUTTON1 0x0020
60 #endif
61
62 #ifndef MK_XBUTTON2
63 #define MK_XBUTTON2 0x0040
64 #endif
65
66 // combination of standard mouse button flags
67 const int ALL_MK_BUTTONS = MK_LBUTTON|MK_MBUTTON|MK_RBUTTON;
68 const int X_BUTTONS = MK_XBUTTON1|MK_XBUTTON2;
69
70
71
72 // Whether to check for embedded frame and adjust location
73 #define CHECK_EMBEDDED 0
74 #define DONT_CHECK_EMBEDDED 1
75
76 class AwtPopupMenu;
77
78 class AwtDropTarget;
79
80 /*
81 * Message routing codes
82 */
83 enum MsgRouting {
84 mrPassAlong, /* pass along to next in chain */
85 mrDoDefault, /* skip right to underlying default behavior */
86 mrConsume, /* consume msg & terminate routing immediatly,
87 * don't pass anywhere
88 */
89 };
90
368 void SendKeyEventToFocusOwner(jint id, jlong when, jint raw, jint cooked,
369 jint modifiers, jint keyLocation, jlong nativeCode,
370 MSG *msg = NULL);
371 /*
372 * Allocate and initialize a new java.awt.event.KeyEvent, and
373 * post it to the peer's target object. No response is expected
374 * from the target.
375 */
376 void SendKeyEvent(jint id, jlong when, jint raw, jint cooked,
377 jint modifiers, jint keyLocation, jlong nativeCode,
378 MSG *msg = NULL);
379
380 /*
381 * Allocate and initialize a new java.awt.event.MouseEvent, and
382 * post it to the peer's target object. No response is expected
383 * from the target.
384 */
385 void SendMouseEvent(jint id, jlong when, jint x, jint y,
386 jint modifiers, jint clickCount,
387 jboolean popupTrigger, jint button = 0,
388 MSG *msg = NULL);
389
390 /*
391 * Allocate and initialize a new java.awt.event.MouseWheelEvent, and
392 * post it to the peer's target object. No response is expected
393 * from the target.
394 */
395 void SendMouseWheelEvent(jint id, jlong when, jint x, jint y,
396 jint modifiers, jint clickCount,
397 jboolean popupTrigger, jint scrollType,
398 jint scrollAmount, jint wheelRotation,
399 jdouble preciseWheelRotation, MSG *msg = NULL);
400
401 /*
402 * Allocate and initialize a new java.awt.event.FocusEvent, and
403 * post it to the peer's target object. No response is expected
404 * from the target.
405 */
406 void SendFocusEvent(jint id, HWND opposite);
407
408 /* Forward a filtered event directly to the subclassed window.
511 virtual MsgRouting WmSizing();
512 virtual MsgRouting WmShowWindow(BOOL show, UINT status);
513 virtual MsgRouting WmSetFocus(HWND hWndLost);
514 virtual MsgRouting WmKillFocus(HWND hWndGot);
515 virtual MsgRouting WmCtlColor(HDC hDC, HWND hCtrl,
516 UINT ctlColor, HBRUSH& retBrush);
517 virtual MsgRouting WmHScroll(UINT scrollCode, UINT pos, HWND hScrollBar);
518 virtual MsgRouting WmVScroll(UINT scrollCode, UINT pos, HWND hScrollBar);
519
520 virtual MsgRouting WmMouseEnter(UINT flags, int x, int y);
521 virtual MsgRouting WmMouseDown(UINT flags, int x, int y, int button);
522 virtual MsgRouting WmMouseUp(UINT flags, int x, int y, int button);
523 virtual MsgRouting WmMouseMove(UINT flags, int x, int y);
524 virtual MsgRouting WmMouseExit(UINT flags, int x, int y);
525 virtual MsgRouting WmMouseWheel(UINT flags, int x, int y,
526 int wheelRotation, BOOL isHorizontal);
527 virtual MsgRouting WmNcMouseDown(WPARAM hitTest, int x, int y, int button);
528 virtual MsgRouting WmNcMouseUp(WPARAM hitTest, int x, int y, int button);
529 virtual MsgRouting WmWindowPosChanging(LPARAM windowPos);
530 virtual MsgRouting WmWindowPosChanged(LPARAM windowPos);
531
532 // NB: 64-bit: vkey is wParam of the message, but other API's take
533 // vkey parameters of type UINT, so we do the cast before dispatching.
534 virtual MsgRouting WmKeyDown(UINT vkey, UINT repCnt, UINT flags, BOOL system);
535 virtual MsgRouting WmKeyUp(UINT vkey, UINT repCnt, UINT flags, BOOL system);
536
537 virtual MsgRouting WmChar(UINT character, UINT repCnt, UINT flags, BOOL system);
538 virtual MsgRouting WmIMEChar(UINT character, UINT repCnt, UINT flags, BOOL system);
539 virtual MsgRouting WmInputLangChange(UINT charset, HKL hKeyBoardLayout);
540 virtual MsgRouting WmForwardChar(WCHAR character, LPARAM lParam,
541 BOOL synthethic);
542 virtual MsgRouting WmPaste();
543
544 virtual void SetCompositionWindow(RECT &r);
545 virtual void OpenCandidateWindow(int x, int y);
546 virtual void SetCandidateWindow(int iCandType, int x, int y);
547 virtual MsgRouting WmImeSetContext(BOOL fSet, LPARAM *lplParam);
548 virtual MsgRouting WmImeNotify(WPARAM subMsg, LPARAM bitsCandType);
549 virtual MsgRouting WmImeStartComposition();
550 virtual MsgRouting WmImeEndComposition();
747 virtual void ReleaseDragCapture(UINT flags);
748
749 virtual void FillBackground(HDC hMemoryDC, SIZE &size);
750 virtual void FillAlpha(void *bitmapBits, SIZE &size, BYTE alpha);
751
752 int ScaleUpX(int x);
753 int ScaleUpY(int y);
754 int ScaleDownX(int x);
755 int ScaleDownY(int y);
756
757 private:
758 /* A bitmask keeps the button's numbers as MK_LBUTTON, MK_MBUTTON, MK_RBUTTON
759 * which are allowed to
760 * generate the CLICK event after the RELEASE has happened.
761 * There are conditions that must be true for that sending CLICK event:
762 * 1) button was initially PRESSED
763 * 2) no movement or drag has happened until RELEASE
764 */
765 UINT m_mouseButtonClickAllowed;
766
767 BOOL m_bSubclassed;
768 BOOL m_bPauseDestroy;
769
770 COLORREF m_colorForeground;
771 COLORREF m_colorBackground;
772
773 AwtPen* m_penForeground;
774 AwtBrush* m_brushBackground;
775
776 WNDPROC m_DefWindowProc;
777 // counter for messages being processed by this component
778 UINT m_MessagesProcessing;
779
780 // provides a unique ID for child controls
781 UINT m_nextControlID;
782
783 // DeferWindowPos handle for batched-up window positioning
784 HDWP m_hdwp;
785 // Counter to handle nested calls to Begin/EndValidate
786 UINT m_validationNestCount;
|
50
51 #define LEFT_BUTTON 1
52 #define MIDDLE_BUTTON 2
53 #define RIGHT_BUTTON 4
54 #define DBL_CLICK 8
55 #define X1_BUTTON 16
56 #define X2_BUTTON 32
57
58 #ifndef MK_XBUTTON1
59 #define MK_XBUTTON1 0x0020
60 #endif
61
62 #ifndef MK_XBUTTON2
63 #define MK_XBUTTON2 0x0040
64 #endif
65
66 // combination of standard mouse button flags
67 const int ALL_MK_BUTTONS = MK_LBUTTON|MK_MBUTTON|MK_RBUTTON;
68 const int X_BUTTONS = MK_XBUTTON1|MK_XBUTTON2;
69
70 // The allowable difference between coordinates of the WM_TOUCH event and the
71 // corresponding WM_LBUTTONDOWN/WM_LBUTTONUP event letting to associate these
72 // events, when their coordinates are slightly different.
73 const int TOUCH_MOUSE_COORDS_DELTA = 10;
74
75 // Whether to check for embedded frame and adjust location
76 #define CHECK_EMBEDDED 0
77 #define DONT_CHECK_EMBEDDED 1
78
79 class AwtPopupMenu;
80
81 class AwtDropTarget;
82
83 /*
84 * Message routing codes
85 */
86 enum MsgRouting {
87 mrPassAlong, /* pass along to next in chain */
88 mrDoDefault, /* skip right to underlying default behavior */
89 mrConsume, /* consume msg & terminate routing immediatly,
90 * don't pass anywhere
91 */
92 };
93
371 void SendKeyEventToFocusOwner(jint id, jlong when, jint raw, jint cooked,
372 jint modifiers, jint keyLocation, jlong nativeCode,
373 MSG *msg = NULL);
374 /*
375 * Allocate and initialize a new java.awt.event.KeyEvent, and
376 * post it to the peer's target object. No response is expected
377 * from the target.
378 */
379 void SendKeyEvent(jint id, jlong when, jint raw, jint cooked,
380 jint modifiers, jint keyLocation, jlong nativeCode,
381 MSG *msg = NULL);
382
383 /*
384 * Allocate and initialize a new java.awt.event.MouseEvent, and
385 * post it to the peer's target object. No response is expected
386 * from the target.
387 */
388 void SendMouseEvent(jint id, jlong when, jint x, jint y,
389 jint modifiers, jint clickCount,
390 jboolean popupTrigger, jint button = 0,
391 MSG *msg = NULL, BOOL causedByTouchEvent = FALSE);
392
393 /*
394 * Allocate and initialize a new java.awt.event.MouseWheelEvent, and
395 * post it to the peer's target object. No response is expected
396 * from the target.
397 */
398 void SendMouseWheelEvent(jint id, jlong when, jint x, jint y,
399 jint modifiers, jint clickCount,
400 jboolean popupTrigger, jint scrollType,
401 jint scrollAmount, jint wheelRotation,
402 jdouble preciseWheelRotation, MSG *msg = NULL);
403
404 /*
405 * Allocate and initialize a new java.awt.event.FocusEvent, and
406 * post it to the peer's target object. No response is expected
407 * from the target.
408 */
409 void SendFocusEvent(jint id, HWND opposite);
410
411 /* Forward a filtered event directly to the subclassed window.
514 virtual MsgRouting WmSizing();
515 virtual MsgRouting WmShowWindow(BOOL show, UINT status);
516 virtual MsgRouting WmSetFocus(HWND hWndLost);
517 virtual MsgRouting WmKillFocus(HWND hWndGot);
518 virtual MsgRouting WmCtlColor(HDC hDC, HWND hCtrl,
519 UINT ctlColor, HBRUSH& retBrush);
520 virtual MsgRouting WmHScroll(UINT scrollCode, UINT pos, HWND hScrollBar);
521 virtual MsgRouting WmVScroll(UINT scrollCode, UINT pos, HWND hScrollBar);
522
523 virtual MsgRouting WmMouseEnter(UINT flags, int x, int y);
524 virtual MsgRouting WmMouseDown(UINT flags, int x, int y, int button);
525 virtual MsgRouting WmMouseUp(UINT flags, int x, int y, int button);
526 virtual MsgRouting WmMouseMove(UINT flags, int x, int y);
527 virtual MsgRouting WmMouseExit(UINT flags, int x, int y);
528 virtual MsgRouting WmMouseWheel(UINT flags, int x, int y,
529 int wheelRotation, BOOL isHorizontal);
530 virtual MsgRouting WmNcMouseDown(WPARAM hitTest, int x, int y, int button);
531 virtual MsgRouting WmNcMouseUp(WPARAM hitTest, int x, int y, int button);
532 virtual MsgRouting WmWindowPosChanging(LPARAM windowPos);
533 virtual MsgRouting WmWindowPosChanged(LPARAM windowPos);
534 virtual void WmTouch(WPARAM wParam, LPARAM lParam);
535
536 // NB: 64-bit: vkey is wParam of the message, but other API's take
537 // vkey parameters of type UINT, so we do the cast before dispatching.
538 virtual MsgRouting WmKeyDown(UINT vkey, UINT repCnt, UINT flags, BOOL system);
539 virtual MsgRouting WmKeyUp(UINT vkey, UINT repCnt, UINT flags, BOOL system);
540
541 virtual MsgRouting WmChar(UINT character, UINT repCnt, UINT flags, BOOL system);
542 virtual MsgRouting WmIMEChar(UINT character, UINT repCnt, UINT flags, BOOL system);
543 virtual MsgRouting WmInputLangChange(UINT charset, HKL hKeyBoardLayout);
544 virtual MsgRouting WmForwardChar(WCHAR character, LPARAM lParam,
545 BOOL synthethic);
546 virtual MsgRouting WmPaste();
547
548 virtual void SetCompositionWindow(RECT &r);
549 virtual void OpenCandidateWindow(int x, int y);
550 virtual void SetCandidateWindow(int iCandType, int x, int y);
551 virtual MsgRouting WmImeSetContext(BOOL fSet, LPARAM *lplParam);
552 virtual MsgRouting WmImeNotify(WPARAM subMsg, LPARAM bitsCandType);
553 virtual MsgRouting WmImeStartComposition();
554 virtual MsgRouting WmImeEndComposition();
751 virtual void ReleaseDragCapture(UINT flags);
752
753 virtual void FillBackground(HDC hMemoryDC, SIZE &size);
754 virtual void FillAlpha(void *bitmapBits, SIZE &size, BYTE alpha);
755
756 int ScaleUpX(int x);
757 int ScaleUpY(int y);
758 int ScaleDownX(int x);
759 int ScaleDownY(int y);
760
761 private:
762 /* A bitmask keeps the button's numbers as MK_LBUTTON, MK_MBUTTON, MK_RBUTTON
763 * which are allowed to
764 * generate the CLICK event after the RELEASE has happened.
765 * There are conditions that must be true for that sending CLICK event:
766 * 1) button was initially PRESSED
767 * 2) no movement or drag has happened until RELEASE
768 */
769 UINT m_mouseButtonClickAllowed;
770
771 BOOL m_touchDownOccurred;
772 BOOL m_touchUpOccurred;
773 POINT m_touchDownPoint;
774 POINT m_touchUpPoint;
775
776 BOOL m_bSubclassed;
777 BOOL m_bPauseDestroy;
778
779 COLORREF m_colorForeground;
780 COLORREF m_colorBackground;
781
782 AwtPen* m_penForeground;
783 AwtBrush* m_brushBackground;
784
785 WNDPROC m_DefWindowProc;
786 // counter for messages being processed by this component
787 UINT m_MessagesProcessing;
788
789 // provides a unique ID for child controls
790 UINT m_nextControlID;
791
792 // DeferWindowPos handle for batched-up window positioning
793 HDWP m_hdwp;
794 // Counter to handle nested calls to Begin/EndValidate
795 UINT m_validationNestCount;
|