]> git.saurik.com Git - wxWidgets.git/commitdiff
Expand the range of WXK_ values that are excluded from OnChar.
authorRobin Dunn <robin@alldunn.com>
Mon, 22 Mar 2004 18:22:54 +0000 (18:22 +0000)
committerRobin Dunn <robin@alldunn.com>
Mon, 22 Mar 2004 18:22:54 +0000 (18:22 +0000)
Correct the position of the context menu.  (SF# 921247)

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@26296 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

contrib/src/stc/stc.cpp
contrib/src/stc/stc.cpp.in
src/stc/stc.cpp
src/stc/stc.cpp.in

index 708ecbeb4e7c2be9ce703c7f508ff1440d007cc8..d3e43c21a74287d861ac9fe015956be1b5b6b6e0 100644 (file)
@@ -2656,6 +2656,14 @@ void wxStyledTextCtrl::OnMouseMiddleUp(wxMouseEvent& evt) {
 void wxStyledTextCtrl::OnContextMenu(wxContextMenuEvent& evt) {
     wxPoint pt = evt.GetPosition();
     ScreenToClient(&pt.x, &pt.y);
+    /*
+      Show context menu at event point if it's within the window,
+      or at caret location if not
+    */
+    wxHitTest ht = this->HitTest(pt);
+    if (ht != wxHT_WINDOW_INSIDE) {
+        pt = this->PointFromPosition(this->GetCurrentPos());
+    }
     m_swx->DoContextMenu(Point(pt.x, pt.y));
 }
 
@@ -2683,7 +2691,7 @@ void wxStyledTextCtrl::OnChar(wxKeyEvent& evt) {
 //     printf("OnChar key:%d  consumed:%d  ctrl:%d  alt:%d  skip:%d\n",
 //            key, m_lastKeyDownConsumed, ctrl, alt, skip);
 
-    if ( (key <= WXK_START || key > WXK_NUMPAD_DIVIDE) &&
+    if ( (key <= WXK_START || key > WXK_COMMAND) &&
          !m_lastKeyDownConsumed && !skip) {
         m_swx->DoAddChar(key);
         return;
index a54118ff6ad48085990bf102b84cbc7d1ea0742e..7459ffa401ed44758d28da62f1087e280ba8effd 100644 (file)
@@ -465,6 +465,14 @@ void wxStyledTextCtrl::OnMouseMiddleUp(wxMouseEvent& evt) {
 void wxStyledTextCtrl::OnContextMenu(wxContextMenuEvent& evt) {
     wxPoint pt = evt.GetPosition();
     ScreenToClient(&pt.x, &pt.y);
+    /*
+      Show context menu at event point if it's within the window,
+      or at caret location if not
+    */
+    wxHitTest ht = this->HitTest(pt);
+    if (ht != wxHT_WINDOW_INSIDE) {
+        pt = this->PointFromPosition(this->GetCurrentPos());
+    }
     m_swx->DoContextMenu(Point(pt.x, pt.y));
 }
 
@@ -492,7 +500,7 @@ void wxStyledTextCtrl::OnChar(wxKeyEvent& evt) {
 //     printf("OnChar key:%%d  consumed:%%d  ctrl:%%d  alt:%%d  skip:%%d\n",
 //            key, m_lastKeyDownConsumed, ctrl, alt, skip);
 
-    if ( (key <= WXK_START || key > WXK_NUMPAD_DIVIDE) &&
+    if ( (key <= WXK_START || key > WXK_COMMAND) &&
          !m_lastKeyDownConsumed && !skip) {
         m_swx->DoAddChar(key);
         return;
index 708ecbeb4e7c2be9ce703c7f508ff1440d007cc8..d3e43c21a74287d861ac9fe015956be1b5b6b6e0 100644 (file)
@@ -2656,6 +2656,14 @@ void wxStyledTextCtrl::OnMouseMiddleUp(wxMouseEvent& evt) {
 void wxStyledTextCtrl::OnContextMenu(wxContextMenuEvent& evt) {
     wxPoint pt = evt.GetPosition();
     ScreenToClient(&pt.x, &pt.y);
+    /*
+      Show context menu at event point if it's within the window,
+      or at caret location if not
+    */
+    wxHitTest ht = this->HitTest(pt);
+    if (ht != wxHT_WINDOW_INSIDE) {
+        pt = this->PointFromPosition(this->GetCurrentPos());
+    }
     m_swx->DoContextMenu(Point(pt.x, pt.y));
 }
 
@@ -2683,7 +2691,7 @@ void wxStyledTextCtrl::OnChar(wxKeyEvent& evt) {
 //     printf("OnChar key:%d  consumed:%d  ctrl:%d  alt:%d  skip:%d\n",
 //            key, m_lastKeyDownConsumed, ctrl, alt, skip);
 
-    if ( (key <= WXK_START || key > WXK_NUMPAD_DIVIDE) &&
+    if ( (key <= WXK_START || key > WXK_COMMAND) &&
          !m_lastKeyDownConsumed && !skip) {
         m_swx->DoAddChar(key);
         return;
index a54118ff6ad48085990bf102b84cbc7d1ea0742e..7459ffa401ed44758d28da62f1087e280ba8effd 100644 (file)
@@ -465,6 +465,14 @@ void wxStyledTextCtrl::OnMouseMiddleUp(wxMouseEvent& evt) {
 void wxStyledTextCtrl::OnContextMenu(wxContextMenuEvent& evt) {
     wxPoint pt = evt.GetPosition();
     ScreenToClient(&pt.x, &pt.y);
+    /*
+      Show context menu at event point if it's within the window,
+      or at caret location if not
+    */
+    wxHitTest ht = this->HitTest(pt);
+    if (ht != wxHT_WINDOW_INSIDE) {
+        pt = this->PointFromPosition(this->GetCurrentPos());
+    }
     m_swx->DoContextMenu(Point(pt.x, pt.y));
 }
 
@@ -492,7 +500,7 @@ void wxStyledTextCtrl::OnChar(wxKeyEvent& evt) {
 //     printf("OnChar key:%%d  consumed:%%d  ctrl:%%d  alt:%%d  skip:%%d\n",
 //            key, m_lastKeyDownConsumed, ctrl, alt, skip);
 
-    if ( (key <= WXK_START || key > WXK_NUMPAD_DIVIDE) &&
+    if ( (key <= WXK_START || key > WXK_COMMAND) &&
          !m_lastKeyDownConsumed && !skip) {
         m_swx->DoAddChar(key);
         return;