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
This commit is contained in:
Vadim Zeitlin
2007-09-09 22:57:12 +00:00
parent 5bc3ef05b8
commit 5595181f48
6 changed files with 24 additions and 9 deletions

View File

@@ -181,6 +181,7 @@ All (GUI):
- Added wxTaskBarIcon::Destroy() - Added wxTaskBarIcon::Destroy()
- Added XRC handler for wxSearchCtrl (Sander Berents) - Added XRC handler for wxSearchCtrl (Sander Berents)
- Read image resolution from TIFF, JPEG and BMP images (Maycon Aparecido Gasoto) - Read image resolution from TIFF, JPEG and BMP images (Maycon Aparecido Gasoto)
- Added wxSYS_DCLICK_TIME system metric constant
wxGTK: wxGTK:

View 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.} clicks must fall to generate a double-click.}
\twocolitem{{\bf wxSYS\_DCLICK\_Y}}{Height in pixels of rectangle within which two successive mouse \twocolitem{{\bf wxSYS\_DCLICK\_Y}}{Height in pixels of rectangle within which two successive mouse
clicks must fall to generate a double-click.} 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 \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.} 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 \twocolitem{{\bf wxSYS\_DRAG\_Y}}{Height in pixels of a rectangle centered on a drag point

View File

@@ -125,7 +125,8 @@ enum wxSystemMetric
wxSYS_NETWORK_PRESENT, wxSYS_NETWORK_PRESENT,
wxSYS_PENWINDOWS_PRESENT, wxSYS_PENWINDOWS_PRESENT,
wxSYS_SHOW_SOUNDS, wxSYS_SHOW_SOUNDS,
wxSYS_SWAP_BUTTONS wxSYS_SWAP_BUTTONS,
wxSYS_DCLICK_MSEC
}; };
// possible values for wxSystemSettings::HasFeature() parameter // possible values for wxSystemSettings::HasFeature() parameter

View File

@@ -42,6 +42,7 @@
#include "wx/dcclient.h" #include "wx/dcclient.h"
#include "wx/dcscreen.h" #include "wx/dcscreen.h"
#include "wx/math.h" #include "wx/math.h"
#include "wx/settings.h"
#endif #endif
#include "wx/imaglist.h" #include "wx/imaglist.h"
@@ -3154,15 +3155,12 @@ void wxListMainWindow::OnMouse( wxMouseEvent &event )
(hitResult == wxLIST_HITTEST_ONITEMLABEL) && (hitResult == wxLIST_HITTEST_ONITEMLABEL) &&
HasFlag(wxLC_EDIT_LABELS) ) HasFlag(wxLC_EDIT_LABELS) )
{ {
if (InReportView()) if ( !InReportView() ||
GetLineLabelRect(current).Contains(x, y) )
{ {
wxRect label = GetLineLabelRect( current ); int dclick = wxSystemSettings::GetMetric(wxSYS_DCLICK_MSEC);
if (label.Contains( x, y )) m_renameTimer->Start(dclick > 0 ? dclick : 250, true);
m_renameTimer->Start( 250, true );
} }
else
m_renameTimer->Start( 250, true );
} }
} }

View File

@@ -494,6 +494,12 @@ int wxSystemSettingsNative::GetMetric( wxSystemMetric index, wxWindow* win )
return dclick_distance * 2; 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_X:
case wxSYS_DRAG_Y: case wxSYS_DRAG_Y:
gint drag_threshold; gint drag_threshold;

View File

@@ -380,8 +380,9 @@ static const int gs_metricsMap[] =
#ifdef SM_SWAPBUTTON #ifdef SM_SWAPBUTTON
SM_SWAPBUTTON, SM_SWAPBUTTON,
#else #else
-1 -1,
#endif #endif
-1 // wxSYS_DCLICK_MSEC - not available as system metric
}; };
// Get a system metric, e.g. scrollbar size // 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, wxCHECK_MSG( index > 0 && (size_t)index < WXSIZEOF(gs_metricsMap), 0,
_T("invalid metric") ); _T("invalid metric") );
if ( index == wxSYS_DCLICK_MSEC )
{
// This one is not a Win32 system metric
return ::GetDoubleClickTime();
}
int indexMSW = gs_metricsMap[index]; int indexMSW = gs_metricsMap[index];
if ( indexMSW == -1 ) if ( indexMSW == -1 )
{ {