Applied and extended patch 886524 (wxGridCellFloatEditor doesn't
accept '.' and '-'). git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@25650 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -2507,12 +2507,10 @@ bool wxLocale::AddCatalog(const wxChar *szDomain)
|
|||||||
// accessors for locale-dependent data
|
// accessors for locale-dependent data
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
#if 0
|
|
||||||
|
|
||||||
#ifdef __WXMSW__
|
#ifdef __WXMSW__
|
||||||
|
|
||||||
/* static */
|
/* static */
|
||||||
wxString wxLocale::GetInfo(wxLocaleInfo index)
|
wxString wxLocale::GetInfo(wxLocaleInfo index, wxLocaleCategory cat)
|
||||||
{
|
{
|
||||||
wxString str;
|
wxString str;
|
||||||
wxChar buffer[256];
|
wxChar buffer[256];
|
||||||
@@ -2520,13 +2518,14 @@ wxString wxLocale::GetInfo(wxLocaleInfo index)
|
|||||||
buffer[0] = wxT('\0');
|
buffer[0] = wxT('\0');
|
||||||
switch (index)
|
switch (index)
|
||||||
{
|
{
|
||||||
case wxSYS_DECIMAL_SEPARATOR:
|
case wxLOCALE_DECIMAL_POINT:
|
||||||
count = ::GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_SDECIMAL, buffer, 256);
|
count = ::GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_SDECIMAL, buffer, 256);
|
||||||
if (!count)
|
if (!count)
|
||||||
str << ".";
|
str << ".";
|
||||||
else
|
else
|
||||||
str << buffer;
|
str << buffer;
|
||||||
break;
|
break;
|
||||||
|
#if 0
|
||||||
case wxSYS_LIST_SEPARATOR:
|
case wxSYS_LIST_SEPARATOR:
|
||||||
count = ::GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_SLIST, buffer, 256);
|
count = ::GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_SLIST, buffer, 256);
|
||||||
if (!count)
|
if (!count)
|
||||||
@@ -2541,6 +2540,7 @@ wxString wxLocale::GetInfo(wxLocaleInfo index)
|
|||||||
else
|
else
|
||||||
str << buffer;
|
str << buffer;
|
||||||
break;
|
break;
|
||||||
|
#endif
|
||||||
default:
|
default:
|
||||||
wxFAIL_MSG("Unknown System String !");
|
wxFAIL_MSG("Unknown System String !");
|
||||||
}
|
}
|
||||||
@@ -2550,15 +2550,38 @@ wxString wxLocale::GetInfo(wxLocaleInfo index)
|
|||||||
#else // !__WXMSW__
|
#else // !__WXMSW__
|
||||||
|
|
||||||
/* static */
|
/* static */
|
||||||
wxString wxLocale::GetInfo(wxLocaleInfo index, wxLocaleCategory)
|
wxString wxLocale::GetInfo(wxLocaleInfo index, wxLocaleCategory cat)
|
||||||
{
|
{
|
||||||
|
struct lconv *locale_info = localeconv();
|
||||||
|
switch (cat)
|
||||||
|
{
|
||||||
|
case wxLOCALE_CAT_NUMBER:
|
||||||
|
switch (index)
|
||||||
|
{
|
||||||
|
case wxLOCALE_THOUSANDS_SEP:
|
||||||
|
return locale_info->thousands_sep;
|
||||||
|
case wxLOCALE_DECIMAL_POINT:
|
||||||
|
return locale_info->decimal_point;
|
||||||
|
default:
|
||||||
return wxEmptyString;
|
return wxEmptyString;
|
||||||
|
}
|
||||||
|
case wxLOCALE_CAT_MONEY:
|
||||||
|
switch (index)
|
||||||
|
{
|
||||||
|
case wxLOCALE_THOUSANDS_SEP:
|
||||||
|
return locale_info->mon_thousands_sep;
|
||||||
|
case wxLOCALE_DECIMAL_POINT:
|
||||||
|
return locale_info->mon_decimal_point;
|
||||||
|
default:
|
||||||
|
return wxEmptyString;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
return wxEmptyString;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // __WXMSW__/!__WXMSW__
|
#endif // __WXMSW__/!__WXMSW__
|
||||||
|
|
||||||
#endif // 0
|
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// global functions and variables
|
// global functions and variables
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
@@ -41,6 +41,7 @@
|
|||||||
#include "wx/checkbox.h"
|
#include "wx/checkbox.h"
|
||||||
#include "wx/combobox.h"
|
#include "wx/combobox.h"
|
||||||
#include "wx/valtext.h"
|
#include "wx/valtext.h"
|
||||||
|
#include "wx/intl.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "wx/textfile.h"
|
#include "wx/textfile.h"
|
||||||
@@ -1067,7 +1068,8 @@ void wxGridCellFloatEditor::Reset()
|
|||||||
void wxGridCellFloatEditor::StartingKey(wxKeyEvent& event)
|
void wxGridCellFloatEditor::StartingKey(wxKeyEvent& event)
|
||||||
{
|
{
|
||||||
int keycode = event.GetKeyCode();
|
int keycode = event.GetKeyCode();
|
||||||
if ( wxIsdigit(keycode) || keycode == '+' || keycode == '-' || keycode == '.'
|
if ( wxIsdigit(keycode) || keycode == '+' || keycode == '-'
|
||||||
|
|| keycode == wxLocale::GetInfo(wxLOCALE_DECIMAL_POINT, wxLOCALE_CAT_NUMBER)[0]
|
||||||
|| keycode == WXK_NUMPAD0
|
|| keycode == WXK_NUMPAD0
|
||||||
|| keycode == WXK_NUMPAD1
|
|| keycode == WXK_NUMPAD1
|
||||||
|| keycode == WXK_NUMPAD2
|
|| keycode == WXK_NUMPAD2
|
||||||
@@ -1167,9 +1169,11 @@ bool wxGridCellFloatEditor::IsAcceptedKey(wxKeyEvent& event)
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
// additionally accept 'e' as in '1e+6'
|
// additionally accept 'e' as in '1e+6', also '-', '+', and '.'
|
||||||
if ( (keycode < 128) &&
|
if ( (keycode < 128) &&
|
||||||
(wxIsdigit(keycode) || tolower(keycode) == 'e') )
|
(wxIsdigit(keycode) || tolower(keycode) == 'e' ||
|
||||||
|
keycode == wxLocale::GetInfo(wxLOCALE_DECIMAL_POINT, wxLOCALE_CAT_NUMBER)[0] ||
|
||||||
|
keycode == '+' || keycode == '-') )
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user