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
367 void SendKeyEventToFocusOwner(jint id, jlong when, jint raw, jint cooked,
368 jint modifiers, jint keyLocation, jlong nativeCode,
369 MSG *msg = NULL);
370 /*
371 * Allocate and initialize a new java.awt.event.KeyEvent, and
372 * post it to the peer's target object. No response is expected
373 * from the target.
374 */
375 void SendKeyEvent(jint id, jlong when, jint raw, jint cooked,
376 jint modifiers, jint keyLocation, jlong nativeCode,
377 MSG *msg = NULL);
378
379 /*
380 * Allocate and initialize a new java.awt.event.MouseEvent, and
381 * post it to the peer's target object. No response is expected
382 * from the target.
383 */
384 void SendMouseEvent(jint id, jlong when, jint x, jint y,
385 jint modifiers, jint clickCount,
386 jboolean popupTrigger, jint button = 0,
387 MSG *msg = NULL);
388
389 /*
390 * Allocate and initialize a new java.awt.event.MouseWheelEvent, and
391 * post it to the peer's target object. No response is expected
392 * from the target.
393 */
394 void SendMouseWheelEvent(jint id, jlong when, jint x, jint y,
395 jint modifiers, jint clickCount,
396 jboolean popupTrigger, jint scrollType,
397 jint scrollAmount, jint wheelRotation,
398 jdouble preciseWheelRotation, MSG *msg = NULL);
399
400 /*
401 * Allocate and initialize a new java.awt.event.FocusEvent, and
402 * post it to the peer's target object. No response is expected
403 * from the target.
404 */
405 void SendFocusEvent(jint id, HWND opposite);
406
407 /* Forward a filtered event directly to the subclassed window.
509 virtual MsgRouting WmSizing();
510 virtual MsgRouting WmShowWindow(BOOL show, UINT status);
511 virtual MsgRouting WmSetFocus(HWND hWndLost);
512 virtual MsgRouting WmKillFocus(HWND hWndGot);
513 virtual MsgRouting WmCtlColor(HDC hDC, HWND hCtrl,
514 UINT ctlColor, HBRUSH& retBrush);
515 virtual MsgRouting WmHScroll(UINT scrollCode, UINT pos, HWND hScrollBar);
516 virtual MsgRouting WmVScroll(UINT scrollCode, UINT pos, HWND hScrollBar);
517
518 virtual MsgRouting WmMouseEnter(UINT flags, int x, int y);
519 virtual MsgRouting WmMouseDown(UINT flags, int x, int y, int button);
520 virtual MsgRouting WmMouseUp(UINT flags, int x, int y, int button);
521 virtual MsgRouting WmMouseMove(UINT flags, int x, int y);
522 virtual MsgRouting WmMouseExit(UINT flags, int x, int y);
523 virtual MsgRouting WmMouseWheel(UINT flags, int x, int y,
524 int wheelRotation);
525 virtual MsgRouting WmNcMouseDown(WPARAM hitTest, int x, int y, int button);
526 virtual MsgRouting WmNcMouseUp(WPARAM hitTest, int x, int y, int button);
527 virtual MsgRouting WmWindowPosChanging(LPARAM windowPos);
528 virtual MsgRouting WmWindowPosChanged(LPARAM windowPos);
529
530 // NB: 64-bit: vkey is wParam of the message, but other API's take
531 // vkey parameters of type UINT, so we do the cast before dispatching.
532 virtual MsgRouting WmKeyDown(UINT vkey, UINT repCnt, UINT flags, BOOL system);
533 virtual MsgRouting WmKeyUp(UINT vkey, UINT repCnt, UINT flags, BOOL system);
534
535 virtual MsgRouting WmChar(UINT character, UINT repCnt, UINT flags, BOOL system);
536 virtual MsgRouting WmIMEChar(UINT character, UINT repCnt, UINT flags, BOOL system);
537 virtual MsgRouting WmInputLangChange(UINT charset, HKL hKeyBoardLayout);
538 virtual MsgRouting WmForwardChar(WCHAR character, LPARAM lParam,
539 BOOL synthethic);
540 virtual MsgRouting WmPaste();
541
542 virtual void SetCompositionWindow(RECT &r);
543 virtual void OpenCandidateWindow(int x, int y);
544 virtual void SetCandidateWindow(int iCandType, int x, int y);
545 virtual MsgRouting WmImeSetContext(BOOL fSet, LPARAM *lplParam);
546 virtual MsgRouting WmImeNotify(WPARAM subMsg, LPARAM bitsCandType);
547 virtual MsgRouting WmImeStartComposition();
548 virtual MsgRouting WmImeEndComposition();
739 sm_suppressFocusAndActivation = doSet;
740 sm_restoreFocusAndActivation = doSet;
741 }
742
743 virtual void SetDragCapture(UINT flags);
744 virtual void ReleaseDragCapture(UINT flags);
745
746 virtual void FillBackground(HDC hMemoryDC, SIZE &size);
747 virtual void FillAlpha(void *bitmapBits, SIZE &size, BYTE alpha);
748
749 private:
750 /* A bitmask keeps the button's numbers as MK_LBUTTON, MK_MBUTTON, MK_RBUTTON
751 * which are allowed to
752 * generate the CLICK event after the RELEASE has happened.
753 * There are conditions that must be true for that sending CLICK event:
754 * 1) button was initially PRESSED
755 * 2) no movement or drag has happened until RELEASE
756 */
757 UINT m_mouseButtonClickAllowed;
758
759 BOOL m_bSubclassed;
760 BOOL m_bPauseDestroy;
761
762 COLORREF m_colorForeground;
763 COLORREF m_colorBackground;
764
765 AwtPen* m_penForeground;
766 AwtBrush* m_brushBackground;
767
768 WNDPROC m_DefWindowProc;
769 // counter for messages being processed by this component
770 UINT m_MessagesProcessing;
771
772 // provides a unique ID for child controls
773 UINT m_nextControlID;
774
775 // DeferWindowPos handle for batched-up window positioning
776 HDWP m_hdwp;
777 // Counter to handle nested calls to Begin/EndValidate
778 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
370 void SendKeyEventToFocusOwner(jint id, jlong when, jint raw, jint cooked,
371 jint modifiers, jint keyLocation, jlong nativeCode,
372 MSG *msg = NULL);
373 /*
374 * Allocate and initialize a new java.awt.event.KeyEvent, and
375 * post it to the peer's target object. No response is expected
376 * from the target.
377 */
378 void SendKeyEvent(jint id, jlong when, jint raw, jint cooked,
379 jint modifiers, jint keyLocation, jlong nativeCode,
380 MSG *msg = NULL);
381
382 /*
383 * Allocate and initialize a new java.awt.event.MouseEvent, and
384 * post it to the peer's target object. No response is expected
385 * from the target.
386 */
387 void SendMouseEvent(jint id, jlong when, jint x, jint y,
388 jint modifiers, jint clickCount,
389 jboolean popupTrigger, jint button = 0,
390 MSG *msg = NULL, BOOL causedByTouchEvent = FALSE);
391
392 /*
393 * Allocate and initialize a new java.awt.event.MouseWheelEvent, and
394 * post it to the peer's target object. No response is expected
395 * from the target.
396 */
397 void SendMouseWheelEvent(jint id, jlong when, jint x, jint y,
398 jint modifiers, jint clickCount,
399 jboolean popupTrigger, jint scrollType,
400 jint scrollAmount, jint wheelRotation,
401 jdouble preciseWheelRotation, MSG *msg = NULL);
402
403 /*
404 * Allocate and initialize a new java.awt.event.FocusEvent, and
405 * post it to the peer's target object. No response is expected
406 * from the target.
407 */
408 void SendFocusEvent(jint id, HWND opposite);
409
410 /* Forward a filtered event directly to the subclassed window.
512 virtual MsgRouting WmSizing();
513 virtual MsgRouting WmShowWindow(BOOL show, UINT status);
514 virtual MsgRouting WmSetFocus(HWND hWndLost);
515 virtual MsgRouting WmKillFocus(HWND hWndGot);
516 virtual MsgRouting WmCtlColor(HDC hDC, HWND hCtrl,
517 UINT ctlColor, HBRUSH& retBrush);
518 virtual MsgRouting WmHScroll(UINT scrollCode, UINT pos, HWND hScrollBar);
519 virtual MsgRouting WmVScroll(UINT scrollCode, UINT pos, HWND hScrollBar);
520
521 virtual MsgRouting WmMouseEnter(UINT flags, int x, int y);
522 virtual MsgRouting WmMouseDown(UINT flags, int x, int y, int button);
523 virtual MsgRouting WmMouseUp(UINT flags, int x, int y, int button);
524 virtual MsgRouting WmMouseMove(UINT flags, int x, int y);
525 virtual MsgRouting WmMouseExit(UINT flags, int x, int y);
526 virtual MsgRouting WmMouseWheel(UINT flags, int x, int y,
527 int wheelRotation);
528 virtual MsgRouting WmNcMouseDown(WPARAM hitTest, int x, int y, int button);
529 virtual MsgRouting WmNcMouseUp(WPARAM hitTest, int x, int y, int button);
530 virtual MsgRouting WmWindowPosChanging(LPARAM windowPos);
531 virtual MsgRouting WmWindowPosChanged(LPARAM windowPos);
532 virtual void WmTouch(WPARAM wParam, LPARAM lParam);
533
534 // NB: 64-bit: vkey is wParam of the message, but other API's take
535 // vkey parameters of type UINT, so we do the cast before dispatching.
536 virtual MsgRouting WmKeyDown(UINT vkey, UINT repCnt, UINT flags, BOOL system);
537 virtual MsgRouting WmKeyUp(UINT vkey, UINT repCnt, UINT flags, BOOL system);
538
539 virtual MsgRouting WmChar(UINT character, UINT repCnt, UINT flags, BOOL system);
540 virtual MsgRouting WmIMEChar(UINT character, UINT repCnt, UINT flags, BOOL system);
541 virtual MsgRouting WmInputLangChange(UINT charset, HKL hKeyBoardLayout);
542 virtual MsgRouting WmForwardChar(WCHAR character, LPARAM lParam,
543 BOOL synthethic);
544 virtual MsgRouting WmPaste();
545
546 virtual void SetCompositionWindow(RECT &r);
547 virtual void OpenCandidateWindow(int x, int y);
548 virtual void SetCandidateWindow(int iCandType, int x, int y);
549 virtual MsgRouting WmImeSetContext(BOOL fSet, LPARAM *lplParam);
550 virtual MsgRouting WmImeNotify(WPARAM subMsg, LPARAM bitsCandType);
551 virtual MsgRouting WmImeStartComposition();
552 virtual MsgRouting WmImeEndComposition();
743 sm_suppressFocusAndActivation = doSet;
744 sm_restoreFocusAndActivation = doSet;
745 }
746
747 virtual void SetDragCapture(UINT flags);
748 virtual void ReleaseDragCapture(UINT flags);
749
750 virtual void FillBackground(HDC hMemoryDC, SIZE &size);
751 virtual void FillAlpha(void *bitmapBits, SIZE &size, BYTE alpha);
752
753 private:
754 /* A bitmask keeps the button's numbers as MK_LBUTTON, MK_MBUTTON, MK_RBUTTON
755 * which are allowed to
756 * generate the CLICK event after the RELEASE has happened.
757 * There are conditions that must be true for that sending CLICK event:
758 * 1) button was initially PRESSED
759 * 2) no movement or drag has happened until RELEASE
760 */
761 UINT m_mouseButtonClickAllowed;
762
763 BOOL m_touchDownOccurred;
764 BOOL m_touchUpOccurred;
765 POINT m_touchDownPoint;
766 POINT m_touchUpPoint;
767
768 BOOL m_bSubclassed;
769 BOOL m_bPauseDestroy;
770
771 COLORREF m_colorForeground;
772 COLORREF m_colorBackground;
773
774 AwtPen* m_penForeground;
775 AwtBrush* m_brushBackground;
776
777 WNDPROC m_DefWindowProc;
778 // counter for messages being processed by this component
779 UINT m_MessagesProcessing;
780
781 // provides a unique ID for child controls
782 UINT m_nextControlID;
783
784 // DeferWindowPos handle for batched-up window positioning
785 HDWP m_hdwp;
786 // Counter to handle nested calls to Begin/EndValidate
787 UINT m_validationNestCount;
|