Code-style consistency improvement:
Apply clang-format-all.sh using the _clang-format file through all the cpp/.h files. make sure not to apply it to certain serialization structures, since some parser expects the * as part of the name, instead of type. This commit contains no other changes aside from adding and applying clang-format-all.sh
This commit is contained in:
@@ -4,59 +4,57 @@
|
||||
See license in Gwen.h
|
||||
*/
|
||||
|
||||
|
||||
#include "Gwen/Gwen.h"
|
||||
#include "Gwen/Controls/TextBox.h"
|
||||
#include "Gwen/Skin.h"
|
||||
#include "Gwen/Utility.h"
|
||||
#include "Gwen/Platform.h"
|
||||
|
||||
|
||||
using namespace Gwen;
|
||||
using namespace Gwen::Controls;
|
||||
|
||||
GWEN_CONTROL_CONSTRUCTOR( TextBoxNumeric )
|
||||
GWEN_CONTROL_CONSTRUCTOR(TextBoxNumeric)
|
||||
{
|
||||
SetText( L"0" );
|
||||
SetText(L"0");
|
||||
}
|
||||
|
||||
bool TextBoxNumeric::IsTextAllowed( const Gwen::UnicodeString& str, int iPos )
|
||||
bool TextBoxNumeric::IsTextAllowed(const Gwen::UnicodeString& str, int iPos)
|
||||
{
|
||||
const UnicodeString& strString = GetText();
|
||||
|
||||
if ( str.length() == 0 )
|
||||
if (str.length() == 0)
|
||||
return true;
|
||||
|
||||
for (size_t i=0; i<str.length(); i++)
|
||||
for (size_t i = 0; i < str.length(); i++)
|
||||
{
|
||||
if ( str[i] == L'-' )
|
||||
if (str[i] == L'-')
|
||||
{
|
||||
// Has to be at the start
|
||||
if ( i != 0 || iPos != 0 )
|
||||
if (i != 0 || iPos != 0)
|
||||
return false;
|
||||
|
||||
// Can only be one
|
||||
if ( std::count( strString.begin(), strString.end(), L'-' ) > 0 )
|
||||
if (std::count(strString.begin(), strString.end(), L'-') > 0)
|
||||
return false;
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
if ( str[i] == L'0' ) continue;
|
||||
if ( str[i] == L'1' ) continue;
|
||||
if ( str[i] == L'2' ) continue;
|
||||
if ( str[i] == L'3' ) continue;
|
||||
if ( str[i] == L'4' ) continue;
|
||||
if ( str[i] == L'5' ) continue;
|
||||
if ( str[i] == L'6' ) continue;
|
||||
if ( str[i] == L'7' ) continue;
|
||||
if ( str[i] == L'8' ) continue;
|
||||
if ( str[i] == L'9' ) continue;
|
||||
if (str[i] == L'0') continue;
|
||||
if (str[i] == L'1') continue;
|
||||
if (str[i] == L'2') continue;
|
||||
if (str[i] == L'3') continue;
|
||||
if (str[i] == L'4') continue;
|
||||
if (str[i] == L'5') continue;
|
||||
if (str[i] == L'6') continue;
|
||||
if (str[i] == L'7') continue;
|
||||
if (str[i] == L'8') continue;
|
||||
if (str[i] == L'9') continue;
|
||||
|
||||
if ( str[i] == L'.' )
|
||||
if (str[i] == L'.')
|
||||
{
|
||||
// Already a fullstop
|
||||
if ( std::count( strString.begin(), strString.end(), L'.' ) > 0 )
|
||||
if (std::count(strString.begin(), strString.end(), L'.') > 0)
|
||||
return false;
|
||||
|
||||
continue;
|
||||
@@ -70,6 +68,6 @@ bool TextBoxNumeric::IsTextAllowed( const Gwen::UnicodeString& str, int iPos )
|
||||
|
||||
float TextBoxNumeric::GetFloatFromText()
|
||||
{
|
||||
double temp = GwenUtil_WideStringToFloat( GetText().c_str() );
|
||||
double temp = GwenUtil_WideStringToFloat(GetText().c_str());
|
||||
return temp;
|
||||
}
|
||||
Reference in New Issue
Block a user