]> git.saurik.com Git - wxWidgets.git/commitdiff
add wxSYS_DCLICK_TIME system metric constant; use it for the generic list control...
authorVadim Zeitlin <vadim@wxwidgets.org>
Sun, 9 Sep 2007 22:57:12 +0000 (22:57 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Sun, 9 Sep 2007 22:57:12 +0000 (22:57 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@48622 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

docs/changes.txt
docs/latex/wx/settings.tex
include/wx/settings.h
src/generic/listctrl.cpp
src/gtk/settings.cpp
src/msw/settings.cpp

index 16ab468ffc33a858a38ef1dee0e2bddd9dfa964c..99a026424592d63cd9cb7462f101e55c0617a1f6 100644 (file)
@@ -181,6 +181,7 @@ All (GUI):
 - Added wxTaskBarIcon::Destroy()
 - Added XRC handler for wxSearchCtrl (Sander Berents)
 - Read image resolution from TIFF, JPEG and BMP images (Maycon Aparecido Gasoto)
+- Added wxSYS_DCLICK_TIME system metric constant
 
 wxGTK:
 
index 0b5435c258f9d2830bdf10050904dad126ba800d..4a66fa7fac764dce29f86b8a1e0c597bf84d9703 100644 (file)
@@ -122,6 +122,8 @@ metric as possible (e.g a wxTopLevelWindow in case of the wxSYS\_CAPTION\_Y metr
 clicks must fall to generate a double-click.}
 \twocolitem{{\bf wxSYS\_DCLICK\_Y}}{Height in pixels of rectangle within which two successive mouse
 clicks must fall to generate a double-click.}
+\twocolitem{{\bf wxSYS\_DCLICK\_MSEC}}{Maximal time, in milliseconds, which may
+pass between subsequent clicks for a double click to be generated.}
 \twocolitem{{\bf wxSYS\_DRAG\_X}}{Width in pixels of a rectangle centered on a drag point
 to allow for limited movement of the mouse pointer before a drag operation begins.}
 \twocolitem{{\bf wxSYS\_DRAG\_Y}}{Height in pixels of a rectangle centered on a drag point
index 8b467f51cea923700ec5c52b34c96f62ad924104..e49ebcad65fa4ec5318e471f4344059663263e74 100644 (file)
@@ -125,7 +125,8 @@ enum wxSystemMetric
     wxSYS_NETWORK_PRESENT,
     wxSYS_PENWINDOWS_PRESENT,
     wxSYS_SHOW_SOUNDS,
-    wxSYS_SWAP_BUTTONS
+    wxSYS_SWAP_BUTTONS,
+    wxSYS_DCLICK_MSEC
 };
 
 // possible values for wxSystemSettings::HasFeature() parameter
index 5adf868e6bfea763208689929283a813bae3d7c8..4258b7f24fa8ce3ece15b1cf5ff4841463b11a5e 100644 (file)
@@ -42,6 +42,7 @@
     #include "wx/dcclient.h"
     #include "wx/dcscreen.h"
     #include "wx/math.h"
+    #include "wx/settings.h"
 #endif
 
 #include "wx/imaglist.h"
@@ -3154,15 +3155,12 @@ void wxListMainWindow::OnMouse( wxMouseEvent &event )
                 (hitResult == wxLIST_HITTEST_ONITEMLABEL) &&
                 HasFlag(wxLC_EDIT_LABELS) )
             {
-                if (InReportView())
+                if ( !InReportView() ||
+                        GetLineLabelRect(current).Contains(x, y) )
                 {
-                    wxRect label = GetLineLabelRect( current );
-                    if (label.Contains( x, y ))
-                        m_renameTimer->Start( 250, true );
-
+                    int dclick = wxSystemSettings::GetMetric(wxSYS_DCLICK_MSEC);
+                    m_renameTimer->Start(dclick > 0 ? dclick : 250, true);
                 }
-                else
-                    m_renameTimer->Start( 250, true );
             }
         }
 
index 1a6714349d638829f43fe06996664d07d26f4760..45fd8ac9d798698b44591f14b9f663a0f4be2bef 100644 (file)
@@ -494,6 +494,12 @@ int wxSystemSettingsNative::GetMetric( wxSystemMetric index, wxWindow* win )
 
             return dclick_distance * 2;
 
+        case wxSYS_DCLICK_MSEC:
+            gint dclick;
+            g_object_get(gtk_settings_get_default(),
+                            "gtk-double-click-time", &dclick, NULL);
+            return dclick;
+
         case wxSYS_DRAG_X:
         case wxSYS_DRAG_Y:
             gint drag_threshold;
index 85f5a95a4797d284e74e6668bbaa90ccfe26ab02..7601841a0cdb201b8eea523e44177c664f87c9a1 100644 (file)
@@ -380,8 +380,9 @@ static const int gs_metricsMap[] =
 #ifdef SM_SWAPBUTTON
     SM_SWAPBUTTON,
 #else
-    -1
+    -1,
 #endif
+    -1   // wxSYS_DCLICK_MSEC - not available as system metric
 };
 
 // Get a system metric, e.g. scrollbar size
@@ -394,6 +395,12 @@ int wxSystemSettingsNative::GetMetric(wxSystemMetric index, wxWindow* WXUNUSED(w
     wxCHECK_MSG( index > 0 && (size_t)index < WXSIZEOF(gs_metricsMap), 0,
                  _T("invalid metric") );
 
+    if ( index == wxSYS_DCLICK_MSEC )
+    {
+        // This one is not a Win32 system metric
+        return ::GetDoubleClickTime();
+    }
+
     int indexMSW = gs_metricsMap[index];
     if ( indexMSW == -1 )
     {