From 5595181f48d45d2c277c7d40a4d24bea42d6847b Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sun, 9 Sep 2007 22:57:12 +0000 Subject: [PATCH] add wxSYS_DCLICK_TIME system metric constant; use it for the generic list control rename timer interval (patch 1782472) git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@48622 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- docs/changes.txt | 1 + docs/latex/wx/settings.tex | 2 ++ include/wx/settings.h | 3 ++- src/generic/listctrl.cpp | 12 +++++------- src/gtk/settings.cpp | 6 ++++++ src/msw/settings.cpp | 9 ++++++++- 6 files changed, 24 insertions(+), 9 deletions(-) diff --git a/docs/changes.txt b/docs/changes.txt index 16ab468ffc..99a0264245 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -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: diff --git a/docs/latex/wx/settings.tex b/docs/latex/wx/settings.tex index 0b5435c258..4a66fa7fac 100644 --- a/docs/latex/wx/settings.tex +++ b/docs/latex/wx/settings.tex @@ -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 diff --git a/include/wx/settings.h b/include/wx/settings.h index 8b467f51ce..e49ebcad65 100644 --- a/include/wx/settings.h +++ b/include/wx/settings.h @@ -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 diff --git a/src/generic/listctrl.cpp b/src/generic/listctrl.cpp index 5adf868e6b..4258b7f24f 100644 --- a/src/generic/listctrl.cpp +++ b/src/generic/listctrl.cpp @@ -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 ); } } diff --git a/src/gtk/settings.cpp b/src/gtk/settings.cpp index 1a6714349d..45fd8ac9d7 100644 --- a/src/gtk/settings.cpp +++ b/src/gtk/settings.cpp @@ -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; diff --git a/src/msw/settings.cpp b/src/msw/settings.cpp index 85f5a95a47..7601841a0c 100644 --- a/src/msw/settings.cpp +++ b/src/msw/settings.cpp @@ -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 ) { -- 2.47.2