git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@18834
c3d73ce0-8a6f-49c7-b76d-
6d57e0e08775
// this method exists for backwards compatibility only, don't use
// this method exists for backwards compatibility only, don't use
- bool HasPendingMessages() const { return true; }
+ bool HasPendingMessages() const { return TRUE; }
protected:
// the logging functions that can be overriden
protected:
// the logging functions that can be overriden
wxObject* userData );
~wxSizerItem();
wxObject* userData );
~wxSizerItem();
virtual void DeleteWindows();
// Enable deleting the SizerItem without destroying the contained sizer.
virtual void DeleteWindows();
// Enable deleting the SizerItem without destroying the contained sizer.
int m_border;
int m_flag;
int m_border;
int m_flag;
- // If true, then this item is considered in the layout
- // calculation. Otherwise, it is skipped over.
+ // If TRUE, then this item is considered in the layout
+ // calculation. Otherwise, it is skipped over.
bool m_show;
// Aspect ratio can always be calculated from m_size,
bool m_show;
// Aspect ratio can always be calculated from m_size,
virtual bool Detach( wxSizer *sizer );
virtual bool Detach( size_t index );
virtual bool Detach( wxSizer *sizer );
virtual bool Detach( size_t index );
- virtual void Clear( bool delete_windows=false );
+ virtual void Clear( bool delete_windows=FALSE );
virtual void DeleteWindows();
void SetMinSize( int width, int height )
virtual void DeleteWindows();
void SetMinSize( int width, int height )
// Manage whether individual scene items are considered
// in the layout calculations or not.
// Manage whether individual scene items are considered
// in the layout calculations or not.
- void Show( wxWindow *window, bool show = true );
- void Show( wxSizer *sizer, bool show = true );
- void Show( size_t index, bool show = true );
+ void Show( wxWindow *window, bool show = TRUE );
+ void Show( wxSizer *sizer, bool show = TRUE );
+ void Show( size_t index, bool show = TRUE );
void Hide( wxSizer *sizer )
void Hide( wxSizer *sizer )
- { Show( sizer, false ); }
+ { Show( sizer, FALSE ); }
void Hide( wxWindow *window )
void Hide( wxWindow *window )
- { Show( window, false ); }
+ { Show( window, FALSE ); }
void Hide( size_t index )
void Hide( size_t index )
- { Show( index, false ); }
+ { Show( index, FALSE ); }
bool IsShown( wxWindow *window ) const;
bool IsShown( wxSizer *sizer ) const;
bool IsShown( size_t index ) const;
bool IsShown( wxWindow *window ) const;
bool IsShown( wxSizer *sizer ) const;
bool IsShown( size_t index ) const;
// Recursively call wxWindow::Show () on all sizer items.
void ShowItems (bool show);
// Recursively call wxWindow::Show () on all sizer items.
void ShowItems (bool show);
path.CompareTo (path2) == 0
#endif
)
path.CompareTo (path2) == 0
#endif
)
}
wxString wxPathList::FindValidPath (const wxString& file)
}
wxString wxPathList::FindValidPath (const wxString& file)
// "MacOS:MyText.txt" is absolute whereas "MyDir:MyText.txt"
// is not. Or maybe ":MyDir:MyText.txt" has to be used? RR.
if (filename.Find(':') != wxNOT_FOUND && filename[0] != ':')
// "MacOS:MyText.txt" is absolute whereas "MyDir:MyText.txt"
// is not. Or maybe ":MyDir:MyText.txt" has to be used? RR.
if (filename.Find(':') != wxNOT_FOUND && filename[0] != ':')
#else
// Unix like or Windows
if (filename[0] == wxT('/'))
#else
// Unix like or Windows
if (filename[0] == wxT('/'))
#endif
#ifdef __VMS__
if ((filename[0] == wxT('[') && filename[1] != wxT('.')))
#endif
#ifdef __VMS__
if ((filename[0] == wxT('[') && filename[1] != wxT('.')))
#endif
#ifdef __WINDOWS__
// MSDOS like
if (filename[0] == wxT('\\') || (wxIsalpha (filename[0]) && filename[1] == wxT(':')))
#endif
#ifdef __WINDOWS__
// MSDOS like
if (filename[0] == wxT('\\') || (wxIsalpha (filename[0]) && filename[1] == wxT(':')))
s = nm;
d = lnm;
#ifdef __WXMSW__
s = nm;
d = lnm;
#ifdef __WXMSW__
#else
q = nm[0] == wxT('\\') && nm[1] == wxT('~');
#endif
#else
q = nm[0] == wxT('\\') && nm[1] == wxT('~');
#endif
int j;
OSErr theErr;
OSStatus theStatus;
int j;
OSErr theErr;
OSStatus theStatus;
- Boolean isDirectory = false;
+ Boolean isDirectory = FALSE;
Str255 theParentPath = "\p";
FSSpec theParentSpec;
FSRef theParentRef;
Str255 theParentPath = "\p";
FSSpec theParentSpec;
FSRef theParentRef;
{
wxString outfile;
if ( !wxGetTempFileName( wxT("cat"), outfile) )
{
wxString outfile;
if ( !wxGetTempFileName( wxT("cat"), outfile) )
FILE *fp1 = (FILE *) NULL;
FILE *fp2 = (FILE *) NULL;
FILE *fp1 = (FILE *) NULL;
FILE *fp2 = (FILE *) NULL;
fclose (fp2);
if (fp3)
fclose (fp3);
fclose (fp2);
if (fp3)
fclose (fp3);
wxLogSysError(_("Failed to copy the file '%s' to '%s'"),
file1.c_str(), file2.c_str());
wxLogSysError(_("Failed to copy the file '%s' to '%s'"),
file1.c_str(), file2.c_str());
}
#elif defined(__WXPM__)
if ( ::DosCopy(file2, file2, overwrite ? DCPY_EXISTING : 0) != 0 )
}
#elif defined(__WXPM__)
if ( ::DosCopy(file2, file2, overwrite ? DCPY_EXISTING : 0) != 0 )
#else // !Win32
wxStructStat fbuf;
#else // !Win32
wxStructStat fbuf;
// from it anyhow
wxLogSysError(_("Impossible to get permissions for file '%s'"),
file1.c_str());
// from it anyhow
wxLogSysError(_("Impossible to get permissions for file '%s'"),
file1.c_str());
}
// open file1 for reading
wxFile fileIn(file1, wxFile::read);
if ( !fileIn.IsOpened() )
}
// open file1 for reading
wxFile fileIn(file1, wxFile::read);
if ( !fileIn.IsOpened() )
// remove file2, if it exists. This is needed for creating
// file2 with the correct permissions in the next step
// remove file2, if it exists. This is needed for creating
// file2 with the correct permissions in the next step
{
wxLogSysError(_("Impossible to overwrite the file '%s'"),
file2.c_str());
{
wxLogSysError(_("Impossible to overwrite the file '%s'"),
file2.c_str());
// create file2 with the same permissions than file1 and open it for
// writing
// create file2 with the same permissions than file1 and open it for
// writing
wxFile fileOut;
if ( !fileOut.Create(file2, overwrite, fbuf.st_mode & 0777) )
wxFile fileOut;
if ( !fileOut.Create(file2, overwrite, fbuf.st_mode & 0777) )
#ifdef __UNIX__
/// restore the old umask
#ifdef __UNIX__
/// restore the old umask
{
count = fileIn.Read(buf, WXSIZEOF(buf));
if ( fileIn.Error() )
{
count = fileIn.Read(buf, WXSIZEOF(buf));
if ( fileIn.Error() )
// end of file?
if ( !count )
break;
if ( fileOut.Write(buf, count) < count )
// end of file?
if ( !count )
break;
if ( fileOut.Write(buf, count) < count )
}
// we can expect fileIn to be closed successfully, but we should ensure
// that fileOut was closed as some write errors (disk full) might not be
// detected before doing this
if ( !fileIn.Close() || !fileOut.Close() )
}
// we can expect fileIn to be closed successfully, but we should ensure
// that fileOut was closed as some write errors (disk full) might not be
// detected before doing this
if ( !fileIn.Close() || !fileOut.Close() )
#if !defined(__VISAGECPP__) && !defined(__WXMAC__) || defined(__UNIX__)
// no chmod in VA. Should be some permission API for HPFS386 partitions
#if !defined(__VISAGECPP__) && !defined(__WXMAC__) || defined(__UNIX__)
// no chmod in VA. Should be some permission API for HPFS386 partitions
{
wxLogSysError(_("Impossible to set permissions for the file '%s'"),
file2.c_str());
{
wxLogSysError(_("Impossible to set permissions for the file '%s'"),
file2.c_str());
}
#endif // OS/2 || Mac
#endif // __WXMSW__ && __WIN32__
}
#endif // OS/2 || Mac
#endif // __WXMSW__ && __WIN32__
{
// Normal system call
if ( wxRename (file1, file2) == 0 )
{
// Normal system call
if ( wxRename (file1, file2) == 0 )
// Try to copy
if (wxCopyFile(file1, file2)) {
wxRemoveFile(file1);
// Try to copy
if (wxCopyFile(file1, file2)) {
wxRemoveFile(file1);
}
bool wxRemoveFile(const wxString& file)
}
bool wxRemoveFile(const wxString& file)
{
wxLogSysError(_("Directory '%s' couldn't be created"), dirname);
{
wxLogSysError(_("Directory '%s' couldn't be created"), dirname);
#endif // Mac/!Mac
}
bool wxRmdir(const wxString& dir, int WXUNUSED(flags))
{
#ifdef __VMS__
#endif // Mac/!Mac
}
bool wxRmdir(const wxString& dir, int WXUNUSED(flags))
{
#ifdef __VMS__
- return false; //to be changed since rmdir exists in VMS7.x
+ return FALSE; //to be changed since rmdir exists in VMS7.x
#elif defined(__WXPM__)
return (::DosDeleteDir((PSZ)dir.c_str()) == 0);
#else
#ifdef __SALFORDC__
#elif defined(__WXPM__)
return (::DosDeleteDir((PSZ)dir.c_str()) == 0);
#else
#ifdef __SALFORDC__
- return false; // What to do?
+ return FALSE; // What to do?
#else
return (wxRmDir(OS_FILENAME(dir)) == 0);
#endif
#else
return (wxRmDir(OS_FILENAME(dir)) == 0);
#endif
buf = new wxChar[sz + 1];
}
buf = new wxChar[sz + 1];
}
// for the compilers which have Unicode version of _getcwd(), call it
// directly, for the others call the ANSI version and do the translation
#if !wxUSE_UNICODE
#define cbuf buf
#else // wxUSE_UNICODE
// for the compilers which have Unicode version of _getcwd(), call it
// directly, for the others call the ANSI version and do the translation
#if !wxUSE_UNICODE
#define cbuf buf
#else // wxUSE_UNICODE
#if !defined(HAVE_WGETCWD) || wxUSE_UNICODE_MSLU
#if !defined(HAVE_WGETCWD) || wxUSE_UNICODE_MSLU
- // This is not legal code as the compiler
+ // This is not legal code as the compiler
// is allowed destroy the wxCharBuffer.
// wxCharBuffer c_buffer(sz);
// char *cbuf = (char*)(const char*)c_buffer;
// is allowed destroy the wxCharBuffer.
// wxCharBuffer c_buffer(sz);
// char *cbuf = (char*)(const char*)c_buffer;
#if wxUSE_UNICODE_MSLU
if ( wxGetOsVersion() != wxWIN95 )
#else
#if wxUSE_UNICODE_MSLU
if ( wxGetOsVersion() != wxWIN95 )
#else
- char *cbuf = NULL; // never really used because needsANSI will always be false
+ char *cbuf = NULL; // never really used because needsANSI will always be FALSE
#endif
{
ok = _wgetcwd(buf, sz) != NULL;
#endif
{
ok = _wgetcwd(buf, sz) != NULL;
strcpy( cbuf , res ) ;
cbuf[res.length()]=0 ;
strcpy( cbuf , res ) ;
cbuf[res.length()]=0 ;
}
#elif defined(__VISAGECPP__) || (defined (__OS2__) && defined (__WATCOMC__))
APIRET rc;
}
#elif defined(__VISAGECPP__) || (defined (__OS2__) && defined (__WATCOMC__))
APIRET rc;
wxGetWorkingDirectory(buffer, _MAXPATHLEN);
wxString str( buffer );
delete [] buffer;
wxGetWorkingDirectory(buffer, _MAXPATHLEN);
wxString str( buffer );
delete [] buffer;
return len && wxIsPathSeparator(pszFileName[len - 1]);
}
return len && wxIsPathSeparator(pszFileName[len - 1]);
}
-// find a file in a list of directories, returns false if not found
+// find a file in a list of directories, returns FALSE if not found
bool wxFindFileInPath(wxString *pStr, const wxChar *pszPath, const wxChar *pszFile)
{
// we assume that it's not empty
bool wxFindFileInPath(wxString *pStr, const wxChar *pszPath, const wxChar *pszFile)
{
// we assume that it's not empty
- wxCHECK_MSG( !wxIsEmpty(pszFile), false,
+ wxCHECK_MSG( !wxIsEmpty(pszFile), FALSE,
_T("empty file name in wxFindFileInPath"));
// skip path separator in the beginning of the file name if present
_T("empty file name in wxFindFileInPath"));
// skip path separator in the beginning of the file name if present
- return pc != NULL; // if true => we breaked from the loop
+ return pc != NULL; // if TRUE => we breaked from the loop
}
void WXDLLEXPORT wxSplitPath(const wxChar *pszFileName,
}
void WXDLLEXPORT wxSplitPath(const wxChar *pszFileName,
{
wxStructStat buf;
wxStat( filename, &buf);
{
wxStructStat buf;
wxStat( filename, &buf);
{
wxString tmp = pattern;
wxChar *pat = WXSTRINGCAST(tmp);
{
wxString tmp = pattern;
wxChar *pat = WXSTRINGCAST(tmp);
{
case wxT('?'): case wxT('*'): case wxT('['): case wxT('{'):
{
case wxT('?'): case wxT('*'): case wxT('['): case wxT('{'):
case wxT('\\'):
if (!*pat++)
case wxT('\\'):
if (!*pat++)
/* Match if both are empty. */
return pat.empty();
}
/* Match if both are empty. */
return pat.empty();
}
const wxChar *m = pat.c_str(),
*n = text.c_str(),
*ma = NULL,
const wxChar *m = pat.c_str(),
*n = text.c_str(),
*ma = NULL,
if (dot_special && (*n == wxT('.')))
{
if (dot_special && (*n == wxT('.')))
{
- /* Never match so that hidden Unix files
+ /* Never match so that hidden Unix files
m++;
/* Quoting "nothing" is a bad thing */
if (!*m)
m++;
/* Quoting "nothing" is a bad thing */
if (!*m)
just = 0;
goto not_matched;
}
just = 0;
goto not_matched;
}
* impossible to match it
*/
if (!*n)
* impossible to match it
*/
if (!*n)
, m_proportion( proportion )
, m_border( border )
, m_flag( flag )
, m_proportion( proportion )
, m_border( border )
, m_flag( flag )
, m_userData( userData )
{
SetRatio( m_size );
, m_userData( userData )
{
SetRatio( m_size );
, m_proportion( proportion )
, m_border( border )
, m_flag( flag )
, m_proportion( proportion )
, m_border( border )
, m_flag( flag )
, m_userData( userData )
{
// aspect ratio calculated from initial size
, m_userData( userData )
{
// aspect ratio calculated from initial size
, m_proportion( proportion )
, m_border( border )
, m_flag( flag )
, m_proportion( proportion )
, m_border( border )
, m_flag( flag )
, m_ratio( 0.0 )
, m_userData( userData )
{
, m_ratio( 0.0 )
, m_userData( userData )
{
wxSizer::wxSizer()
: m_minSize( wxSize( 0, 0 ) )
{
wxSizer::wxSizer()
: m_minSize( wxSize( 0, 0 ) )
{
- m_children.DeleteContents( true );
+ m_children.DeleteContents( TRUE );
node = node->GetNext();
}
node = node->GetNext();
}
}
bool wxSizer::Remove( size_t index )
{
wxCHECK_MSG( index < m_children.GetCount(),
}
bool wxSizer::Remove( size_t index )
{
wxCHECK_MSG( index < m_children.GetCount(),
_T("Remove index is out of range") );
wxSizerItemList::Node *node = m_children.Item( index );
_T("Remove index is out of range") );
wxSizerItemList::Node *node = m_children.Item( index );
- wxCHECK_MSG( node, false, _T("Failed to find child node") );
+ wxCHECK_MSG( node, FALSE, _T("Failed to find child node") );
wxSizerItem *item = node->GetData();
wxSizerItem *item = node->GetData();
node = node->GetNext();
}
node = node->GetNext();
}
}
bool wxSizer::Detach( wxWindow *window )
}
bool wxSizer::Detach( wxWindow *window )
node = node->GetNext();
}
node = node->GetNext();
}
}
bool wxSizer::Detach( size_t index )
{
wxCHECK_MSG( index < m_children.GetCount(),
}
bool wxSizer::Detach( size_t index )
{
wxCHECK_MSG( index < m_children.GetCount(),
_T("Detach index is out of range") );
wxSizerItemList::Node *node = m_children.Item( index );
_T("Detach index is out of range") );
wxSizerItemList::Node *node = m_children.Item( index );
- wxCHECK_MSG( node, false, _T("Failed to find child node") );
+ wxCHECK_MSG( node, FALSE, _T("Failed to find child node") );
wxSizerItem *item = node->GetData();
wxSizerItem *item = node->GetData();
if (item->GetWindow() == window)
{
item->SetInitSize( width, height );
if (item->GetWindow() == window)
{
item->SetInitSize( width, height );
}
node = node->GetNext();
}
}
node = node->GetNext();
}
item->GetSizer()->DoSetItemMinSize( window, width, height ) )
{
// A child sizer found the requested windw, exit.
item->GetSizer()->DoSetItemMinSize( window, width, height ) )
{
// A child sizer found the requested windw, exit.
}
node = node->GetNext();
}
}
node = node->GetNext();
}
}
bool wxSizer::DoSetItemMinSize( wxSizer *sizer, int width, int height )
}
bool wxSizer::DoSetItemMinSize( wxSizer *sizer, int width, int height )
if (item->GetSizer() == sizer)
{
item->GetSizer()->DoSetMinSize( width, height );
if (item->GetSizer() == sizer)
{
item->GetSizer()->DoSetMinSize( width, height );
}
node = node->GetNext();
}
}
node = node->GetNext();
}
item->GetSizer()->DoSetItemMinSize( sizer, width, height ) )
{
// A child found the requested sizer, exit.
item->GetSizer()->DoSetItemMinSize( sizer, width, height ) )
{
// A child found the requested sizer, exit.
}
node = node->GetNext();
}
}
node = node->GetNext();
}
}
bool wxSizer::DoSetItemMinSize( size_t index, int width, int height )
{
wxSizerItemList::Node *node = m_children.Item( index );
}
bool wxSizer::DoSetItemMinSize( size_t index, int width, int height )
{
wxSizerItemList::Node *node = m_children.Item( index );
- wxCHECK_MSG( node, false, _T("Failed to find child node") );
+ wxCHECK_MSG( node, FALSE, _T("Failed to find child node") );
wxSizerItem *item = node->GetData();
wxSizerItem *item = node->GetData();
item->SetInitSize( width, height );
}
item->SetInitSize( width, height );
}
}
void wxSizer::Show( wxWindow *window, bool show )
}
void wxSizer::Show( wxWindow *window, bool show )
while (node)
{
wxSizerItem *item = node->GetData();
while (node)
{
wxSizerItem *item = node->GetData();
if (item->GetWindow() == window)
{
return item->IsShown();
if (item->GetWindow() == window)
{
return item->IsShown();
wxFAIL_MSG( _T("IsShown failed to find sizer item") );
wxFAIL_MSG( _T("IsShown failed to find sizer item") );
}
bool wxSizer::IsShown( wxSizer *sizer ) const
}
bool wxSizer::IsShown( wxSizer *sizer ) const
wxFAIL_MSG( _T("IsShown failed to find sizer item") );
wxFAIL_MSG( _T("IsShown failed to find sizer item") );
}
bool wxSizer::IsShown( size_t index ) const
{
wxCHECK_MSG( index < m_children.GetCount(),
}
bool wxSizer::IsShown( size_t index ) const
{
wxCHECK_MSG( index < m_children.GetCount(),
_T("IsShown index is out of range") );
return m_children.Item( index )->GetData()->IsShown();
_T("IsShown index is out of range") );
return m_children.Item( index )->GetData()->IsShown();
m_excludeList.Add(s);
node = node->GetNext();
}
m_excludeList.Add(s);
node = node->GetNext();
}
}
wxTextValidator::~wxTextValidator()
}
wxTextValidator::~wxTextValidator()
for ( i = 0; i < (int)val.Length(); i++)
{
if (!wxIsalpha(val[i]))
for ( i = 0; i < (int)val.Length(); i++)
{
if (!wxIsalpha(val[i]))
}
static bool wxIsAlphaNumeric(const wxString& val)
}
static bool wxIsAlphaNumeric(const wxString& val)
for ( i = 0; i < (int)val.Length(); i++)
{
if (!wxIsalnum(val[i]))
for ( i = 0; i < (int)val.Length(); i++)
{
if (!wxIsalnum(val[i]))
}
// Called when the value in the window must be validated.
}
// Called when the value in the window must be validated.
bool wxTextValidator::Validate(wxWindow *parent)
{
if( !CheckValidator() )
bool wxTextValidator::Validate(wxWindow *parent)
{
if( !CheckValidator() )
wxTextCtrl *control = (wxTextCtrl *) m_validatorWindow ;
// If window is disabled, simply return
if ( !control->IsEnabled() )
wxTextCtrl *control = (wxTextCtrl *) m_validatorWindow ;
// If window is disabled, simply return
if ( !control->IsEnabled() )
wxString val(control->GetValue());
wxString val(control->GetValue());
// NB: this format string should contian exactly one '%s'
wxString errormsg;
// NB: this format string should contian exactly one '%s'
wxString errormsg;
}
else if ( (m_validatorStyle & wxFILTER_ASCII) && !val.IsAscii() )
{
}
else if ( (m_validatorStyle & wxFILTER_ASCII) && !val.IsAscii() )
{
errormsg = _("'%s' should only contain ASCII characters.");
}
else if ( (m_validatorStyle & wxFILTER_ALPHA) && !wxIsAlpha(val) )
{
errormsg = _("'%s' should only contain ASCII characters.");
}
else if ( (m_validatorStyle & wxFILTER_ALPHA) && !wxIsAlpha(val) )
{
errormsg = _("'%s' should only contain alphabetic characters.");
}
else if ( (m_validatorStyle & wxFILTER_ALPHANUMERIC) && !wxIsAlphaNumeric(val))
{
errormsg = _("'%s' should only contain alphabetic characters.");
}
else if ( (m_validatorStyle & wxFILTER_ALPHANUMERIC) && !wxIsAlphaNumeric(val))
{
errormsg = _("'%s' should only contain alphabetic or numeric characters.");
}
else if ( (m_validatorStyle & wxFILTER_NUMERIC) && !wxIsNumeric(val))
{
errormsg = _("'%s' should only contain alphabetic or numeric characters.");
}
else if ( (m_validatorStyle & wxFILTER_NUMERIC) && !wxIsNumeric(val))
{
errormsg = _("'%s' should be numeric.");
}
errormsg = _("'%s' should be numeric.");
}
{
//it's only ok to have the members of the list
errormsg = _("'%s' is invalid");
{
//it's only ok to have the members of the list
errormsg = _("'%s' is invalid");
}
else if ( (m_validatorStyle & wxFILTER_EXCLUDE_CHAR_LIST) && !IsNotInCharExcludeList(val))
{
// it's only ok to have non-members of the list
errormsg = _("'%s' is invalid");
}
else if ( (m_validatorStyle & wxFILTER_EXCLUDE_CHAR_LIST) && !IsNotInCharExcludeList(val))
{
// it's only ok to have non-members of the list
errormsg = _("'%s' is invalid");
bool wxTextValidator::TransferToWindow(void)
{
if( !CheckValidator() )
bool wxTextValidator::TransferToWindow(void)
{
if( !CheckValidator() )
wxTextCtrl *control = (wxTextCtrl *) m_validatorWindow ;
control->SetValue(* m_stringValue) ;
wxTextCtrl *control = (wxTextCtrl *) m_validatorWindow ;
control->SetValue(* m_stringValue) ;
}
// Called to transfer data to the window
bool wxTextValidator::TransferFromWindow(void)
{
if( !CheckValidator() )
}
// Called to transfer data to the window
bool wxTextValidator::TransferFromWindow(void)
{
if( !CheckValidator() )
wxTextCtrl *control = (wxTextCtrl *) m_validatorWindow ;
* m_stringValue = control->GetValue() ;
wxTextCtrl *control = (wxTextCtrl *) m_validatorWindow ;
* m_stringValue = control->GetValue() ;
}
void wxTextValidator::SetIncludeList(const wxStringList& list)
}
void wxTextValidator::SetIncludeList(const wxStringList& list)
// use wxSystemSettings or other to do better localisation
if ((!isdigit(val[i])) && (val[i] != '.') && (val[i] != ','))
if(!((i == 0) && (val[i] == '-')))
// use wxSystemSettings or other to do better localisation
if ((!isdigit(val[i])) && (val[i] != '.') && (val[i] != ','))
if(!((i == 0) && (val[i] == '-')))
}
bool wxTextValidator::IsInCharIncludeList(const wxString& val)
}
bool wxTextValidator::IsInCharIncludeList(const wxString& val)
for ( i = 0; i < val.Length(); i++)
{
if (!m_includeList.Member((wxString) val[i]))
for ( i = 0; i < val.Length(); i++)
{
if (!m_includeList.Member((wxString) val[i]))
}
bool wxTextValidator::IsNotInCharExcludeList(const wxString& val)
}
bool wxTextValidator::IsNotInCharExcludeList(const wxString& val)
for ( i = 0; i < val.Length(); i++)
{
if (m_excludeList.Member((wxString) val[i]))
for ( i = 0; i < val.Length(); i++)
{
if (m_excludeList.Member((wxString) val[i]))
wxVariant* var1 = (wxVariant*) node1->GetData();
wxVariant* var2 = (wxVariant*) node2->GetData();
if ((*var1) != (*var2))
wxVariant* var1 = (wxVariant*) node1->GetData();
wxVariant* var2 = (wxVariant*) node2->GetData();
if ((*var1) != (*var2))
node1 = node1->GetNext();
node2 = node2->GetNext();
}
node1 = node1->GetNext();
node2 = node2->GetNext();
}
- if (node1 || node2) return false;
- return true;
+ if (node1 || node2) return FALSE;
+ return TRUE;
wxString s;
Write(s);
str << (const char*) s.mb_str();
wxString s;
Write(s);
str << (const char*) s.mb_str();
node = node->GetNext();
}
node = node->GetNext();
}
{
wxFAIL_MSG(wxT("Unimplemented"));
// TODO
{
wxFAIL_MSG(wxT("Unimplemented"));
// TODO
{
wxFAIL_MSG(wxT("Unimplemented"));
// TODO
{
wxFAIL_MSG(wxT("Unimplemented"));
// TODO
wxString str1 ( node1->GetData() );
wxString str2 ( node2->GetData() );
if (str1 != str2)
wxString str1 ( node1->GetData() );
wxString str2 ( node2->GetData() );
if (str1 != str2)
node1 = node1->GetNext();
node2 = node2->GetNext();
}
node1 = node1->GetNext();
node2 = node2->GetNext();
}
- if (node1 || node2) return false;
- return true;
+ if (node1 || node2) return FALSE;
+ return TRUE;
wxString s;
Write(s);
str << (const char*) s.mb_str();
wxString s;
Write(s);
str << (const char*) s.mb_str();
node = node->GetNext();
}
node = node->GetNext();
}
{
wxFAIL_MSG(wxT("Unimplemented"));
// TODO
{
wxFAIL_MSG(wxT("Unimplemented"));
// TODO
{
wxFAIL_MSG(wxT("Unimplemented"));
// TODO
{
wxFAIL_MSG(wxT("Unimplemented"));
// TODO
wxString s;
Write(s);
str << (const char*) s.mb_str();
wxString s;
Write(s);
str << (const char*) s.mb_str();
}
#endif
bool wxVariantDataLong::Write(wxString& str) const
{
str.Printf(wxT("%ld"), m_value);
}
#endif
bool wxVariantDataLong::Write(wxString& str) const
{
str.Printf(wxT("%ld"), m_value);
}
#if wxUSE_STD_IOSTREAM
bool wxVariantDataLong::Read(wxSTD istream& str)
{
str >> m_value;
}
#if wxUSE_STD_IOSTREAM
bool wxVariantDataLong::Read(wxSTD istream& str)
{
str >> m_value;
wxTextOutputStream s(str);
s.Write32((size_t)m_value);
wxTextOutputStream s(str);
s.Write32((size_t)m_value);
}
bool wxVariantDataLong::Read(wxInputStream& str)
{
wxTextInputStream s(str);
m_value = s.Read32();
}
bool wxVariantDataLong::Read(wxInputStream& str)
{
wxTextInputStream s(str);
m_value = s.Read32();
}
#endif // wxUSE_STREAMS
bool wxVariantDataLong::Read(wxString& str)
{
m_value = wxAtol((const wxChar*) str);
}
#endif // wxUSE_STREAMS
bool wxVariantDataLong::Read(wxString& str)
{
m_value = wxAtol((const wxChar*) str);
wxString s;
Write(s);
str << (const char*) s.mb_str();
wxString s;
Write(s);
str << (const char*) s.mb_str();
}
#endif
bool wxVariantDataReal::Write(wxString& str) const
{
str.Printf(wxT("%.4f"), m_value);
}
#endif
bool wxVariantDataReal::Write(wxString& str) const
{
str.Printf(wxT("%.4f"), m_value);
}
#if wxUSE_STD_IOSTREAM
bool wxVariantDataReal::Read(wxSTD istream& str)
{
str >> m_value;
}
#if wxUSE_STD_IOSTREAM
bool wxVariantDataReal::Read(wxSTD istream& str)
{
str >> m_value;
{
wxTextOutputStream s(str);
s.WriteDouble((double)m_value);
{
wxTextOutputStream s(str);
s.WriteDouble((double)m_value);
}
bool wxVariantDataReal::Read(wxInputStream& str)
{
wxTextInputStream s(str);
m_value = (float)s.ReadDouble();
}
bool wxVariantDataReal::Read(wxInputStream& str)
{
wxTextInputStream s(str);
m_value = (float)s.ReadDouble();
}
#endif // wxUSE_STREAMS
bool wxVariantDataReal::Read(wxString& str)
{
m_value = wxAtof((const wxChar*) str);
}
#endif // wxUSE_STREAMS
bool wxVariantDataReal::Read(wxString& str)
{
m_value = wxAtof((const wxChar*) str);
wxString s;
Write(s);
str << (const char*) s.mb_str();
wxString s;
Write(s);
str << (const char*) s.mb_str();
}
#endif
bool wxVariantDataBool::Write(wxString& str) const
{
str.Printf(wxT("%d"), (int) m_value);
}
#endif
bool wxVariantDataBool::Write(wxString& str) const
{
str.Printf(wxT("%d"), (int) m_value);
{
wxFAIL_MSG(wxT("Unimplemented"));
// str >> (long) m_value;
{
wxFAIL_MSG(wxT("Unimplemented"));
// str >> (long) m_value;
wxTextOutputStream s(str);
s.Write8(m_value);
wxTextOutputStream s(str);
s.Write8(m_value);
}
bool wxVariantDataBool::Read(wxInputStream& str)
}
bool wxVariantDataBool::Read(wxInputStream& str)
wxTextInputStream s(str);
m_value = s.Read8() != 0;
wxTextInputStream s(str);
m_value = s.Read8() != 0;
}
#endif // wxUSE_STREAMS
bool wxVariantDataBool::Read(wxString& str)
{
m_value = (wxAtol((const wxChar*) str) != 0);
}
#endif // wxUSE_STREAMS
bool wxVariantDataBool::Read(wxString& str)
{
m_value = (wxAtol((const wxChar*) str) != 0);
wxString s;
Write(s);
str << (const char*) s.mb_str();
wxString s;
Write(s);
str << (const char*) s.mb_str();
}
#endif
bool wxVariantDataChar::Write(wxString& str) const
{
str.Printf(wxT("%c"), m_value);
}
#endif
bool wxVariantDataChar::Write(wxString& str) const
{
str.Printf(wxT("%c"), m_value);
{
wxFAIL_MSG(wxT("Unimplemented"));
// str >> m_value;
{
wxFAIL_MSG(wxT("Unimplemented"));
// str >> m_value;
wxTextOutputStream s(str);
s.Write8(m_value);
wxTextOutputStream s(str);
s.Write8(m_value);
}
bool wxVariantDataChar::Read(wxInputStream& str)
}
bool wxVariantDataChar::Read(wxInputStream& str)
wxTextInputStream s(str);
m_value = s.Read8();
wxTextInputStream s(str);
m_value = s.Read8();
}
#endif // wxUSE_STREAMS
bool wxVariantDataChar::Read(wxString& str)
{
m_value = str[(size_t)0];
}
#endif // wxUSE_STREAMS
bool wxVariantDataChar::Read(wxString& str)
{
m_value = str[(size_t)0];
bool wxVariantDataString::Write(wxSTD ostream& str) const
{
str << (const char*) m_value.mb_str();
bool wxVariantDataString::Write(wxSTD ostream& str) const
{
str << (const char*) m_value.mb_str();
}
#endif
bool wxVariantDataString::Write(wxString& str) const
{
str = m_value;
}
#endif
bool wxVariantDataString::Write(wxString& str) const
{
str = m_value;
}
#if wxUSE_STD_IOSTREAM
bool wxVariantDataString::Read(wxSTD istream& str)
{
str >> m_value;
}
#if wxUSE_STD_IOSTREAM
bool wxVariantDataString::Read(wxSTD istream& str)
{
str >> m_value;
// why doesn't wxOutputStream::operator<< take "const wxString&"
wxTextOutputStream s(str);
s.WriteString(m_value);
// why doesn't wxOutputStream::operator<< take "const wxString&"
wxTextOutputStream s(str);
s.WriteString(m_value);
}
bool wxVariantDataString::Read(wxInputStream& str)
}
bool wxVariantDataString::Read(wxInputStream& str)
wxTextInputStream s(str);
m_value = s.ReadString();
wxTextInputStream s(str);
m_value = s.ReadString();
}
#endif // wxUSE_STREAMS
bool wxVariantDataString::Read(wxString& str)
{
m_value = str;
}
#endif // wxUSE_STREAMS
bool wxVariantDataString::Read(wxString& str)
{
m_value = str;
}
#if defined(__BORLANDC__) && defined(__WIN16__)
}
#if defined(__BORLANDC__) && defined(__WIN16__)
wxString s;
Write(s);
str << (const char*) s.mb_str();
wxString s;
Write(s);
str << (const char*) s.mb_str();
{
wxChar*s = m_value.FormatTime();
str = s;
{
wxChar*s = m_value.FormatTime();
str = s;
}
#if wxUSE_STD_IOSTREAM
bool wxVariantDataTime::Read(wxSTD istream& WXUNUSED(str))
{
// Not implemented
}
#if wxUSE_STD_IOSTREAM
bool wxVariantDataTime::Read(wxSTD istream& WXUNUSED(str))
{
// Not implemented
}
#endif
bool wxVariantDataTime::Read(wxString& WXUNUSED(str))
{
// Not implemented
}
#endif
bool wxVariantDataTime::Read(wxString& WXUNUSED(str))
{
// Not implemented
wxString s;
Write(s);
str << (const char*) s.mb_str();
wxString s;
Write(s);
str << (const char*) s.mb_str();
}
#endif
bool wxVariantDataDate::Write(wxString& str) const
{
str = m_value.FormatDate();
}
#endif
bool wxVariantDataDate::Write(wxString& str) const
{
str = m_value.FormatDate();
}
#if wxUSE_STD_IOSTREAM
bool wxVariantDataDate::Read(wxSTD istream& WXUNUSED(str))
{
// Not implemented
}
#if wxUSE_STD_IOSTREAM
bool wxVariantDataDate::Read(wxSTD istream& WXUNUSED(str))
{
// Not implemented
}
#endif
bool wxVariantDataDate::Read(wxString& WXUNUSED(str))
{
// Not implemented
}
#endif
bool wxVariantDataDate::Read(wxString& WXUNUSED(str))
{
// Not implemented
}
#endif
// wxUSE_TIMEDATE
}
#endif
// wxUSE_TIMEDATE
wxString s;
Write(s);
str << (const char*) s.mb_str();
wxString s;
Write(s);
str << (const char*) s.mb_str();
}
#endif
bool wxVariantDataVoidPtr::Write(wxString& str) const
{
str.Printf(wxT("%ld"), (long) m_value);
}
#endif
bool wxVariantDataVoidPtr::Write(wxString& str) const
{
str.Printf(wxT("%ld"), (long) m_value);
}
#if wxUSE_STD_IOSTREAM
bool wxVariantDataVoidPtr::Read(wxSTD istream& WXUNUSED(str))
{
// Not implemented
}
#if wxUSE_STD_IOSTREAM
bool wxVariantDataVoidPtr::Read(wxSTD istream& WXUNUSED(str))
{
// Not implemented
}
#endif
bool wxVariantDataVoidPtr::Read(wxString& WXUNUSED(str))
{
// Not implemented
}
#endif
bool wxVariantDataVoidPtr::Read(wxString& WXUNUSED(str))
{
// Not implemented
bool wxVariantDataDateTime::Write(wxSTD ostream& str) const
{
// Not implemented
bool wxVariantDataDateTime::Write(wxSTD ostream& str) const
{
// Not implemented
bool wxVariantDataDateTime::Write(wxString& str) const
{
str = m_value.Format();
bool wxVariantDataDateTime::Write(wxString& str) const
{
str = m_value.Format();
bool wxVariantDataDateTime::Read(wxSTD istream& WXUNUSED(str))
{
// Not implemented
bool wxVariantDataDateTime::Read(wxSTD istream& WXUNUSED(str))
{
// Not implemented
bool wxVariantDataDateTime::Read(wxString& str)
{
if(! m_value.ParseDateTime(str))
bool wxVariantDataDateTime::Read(wxString& str)
{
if(! m_value.ParseDateTime(str))
- return false;
- return true;
+ return FALSE;
+ return TRUE;
}
// ----------------------------------------------------------------------------
}
// ----------------------------------------------------------------------------
bool wxVariantDataArrayString::Write(wxSTD ostream& str) const
{
// Not implemented
bool wxVariantDataArrayString::Write(wxSTD ostream& str) const
{
// Not implemented
bool wxVariantDataArrayString::Read(wxSTD istream& WXUNUSED(str))
{
// Not implemented
bool wxVariantDataArrayString::Read(wxSTD istream& WXUNUSED(str))
{
// Not implemented
m_value.Add(tk.GetNextToken());
}
m_value.Add(tk.GetNextToken());
}
{
double thisValue;
if (!Convert(&thisValue))
{
double thisValue;
if (!Convert(&thisValue))
else
return (value == thisValue);
}
else
return (value == thisValue);
}
{
long thisValue;
if (!Convert(&thisValue))
{
long thisValue;
if (!Convert(&thisValue))
else
return (value == thisValue);
}
else
return (value == thisValue);
}
{
char thisValue;
if (!Convert(&thisValue))
{
char thisValue;
if (!Convert(&thisValue))
else
return (value == thisValue);
}
else
return (value == thisValue);
}
{
bool thisValue;
if (!Convert(&thisValue))
{
bool thisValue;
if (!Convert(&thisValue))
else
return (value == thisValue);
}
else
return (value == thisValue);
}
{
wxString thisValue;
if (!Convert(&thisValue))
{
wxString thisValue;
if (!Convert(&thisValue))
return value == thisValue;
}
return value == thisValue;
}
{
wxTime thisValue;
if (!Convert(&thisValue))
{
wxTime thisValue;
if (!Convert(&thisValue))
return value == thisValue;
}
return value == thisValue;
}
{
wxDate thisValue;
if (!Convert(&thisValue))
{
wxDate thisValue;
if (!Convert(&thisValue))
return (value == thisValue);
}
return (value == thisValue);
}
{
wxDateTime thisValue;
if (!Convert(&thisValue))
{
wxDateTime thisValue;
if (!Convert(&thisValue))
return value.IsEqualTo(thisValue);
}
return value.IsEqualTo(thisValue);
}
{
wxFAIL_MSG( _T("TODO") );
{
wxFAIL_MSG( _T("TODO") );
}
bool wxVariant::operator!=(const wxArrayString& value) const
}
bool wxVariant::operator!=(const wxArrayString& value) const
list.Insert(new wxVariant(value));
}
list.Insert(new wxVariant(value));
}
-// Returns true if the variant is a member of the list
+// Returns TRUE if the variant is a member of the list
bool wxVariant::Member(const wxVariant& value) const
{
wxList& list = GetList();
bool wxVariant::Member(const wxVariant& value) const
{
wxList& list = GetList();
{
wxVariant* other = (wxVariant*) node->GetData();
if (value == *other)
{
wxVariant* other = (wxVariant*) node->GetData();
if (value == *other)
node = node->GetNext();
}
node = node->GetNext();
}
}
// Deletes the nth element of the list
}
// Deletes the nth element of the list
wxVariant* variant = (wxVariant*) node->GetData();
delete variant;
delete node;
wxVariant* variant = (wxVariant*) node->GetData();
delete variant;
delete node;
else if (type == wxT("string"))
*value = wxAtol((const wxChar*) ((wxVariantDataString*)GetData())->GetValue());
else
else if (type == wxT("string"))
*value = wxAtol((const wxChar*) ((wxVariantDataString*)GetData())->GetValue());
else
}
bool wxVariant::Convert(bool* value) const
}
bool wxVariant::Convert(bool* value) const
{
wxString val(((wxVariantDataString*)GetData())->GetValue());
val.MakeLower();
{
wxString val(((wxVariantDataString*)GetData())->GetValue());
val.MakeLower();
- if (val == wxT("true") || val == wxT("yes"))
- *value = true;
- else if (val == wxT("false") || val == wxT("no"))
- *value = false;
+ if (val == wxT("TRUE") || val == wxT("yes"))
+ *value = TRUE;
+ else if (val == wxT("FALSE") || val == wxT("no"))
+ *value = FALSE;
}
bool wxVariant::Convert(double* value) const
}
bool wxVariant::Convert(double* value) const
else if (type == wxT("string"))
*value = (double) wxAtof((const wxChar*) ((wxVariantDataString*)GetData())->GetValue());
else
else if (type == wxT("string"))
*value = (double) wxAtof((const wxChar*) ((wxVariantDataString*)GetData())->GetValue());
else
}
bool wxVariant::Convert(char* value) const
}
bool wxVariant::Convert(char* value) const
*value = (char) (((wxVariantDataBool*)GetData())->GetValue());
#endif
else
*value = (char) (((wxVariantDataBool*)GetData())->GetValue());
#endif
else
}
bool wxVariant::Convert(wxString* value) const
{
*value = MakeString();
}
bool wxVariant::Convert(wxString* value) const
{
*value = MakeString();
}
// For some reason, Watcom C++ can't link variant.cpp with time/date classes compiled
}
// For some reason, Watcom C++ can't link variant.cpp with time/date classes compiled
else if (type == wxT("date"))
*value = wxTime(((wxVariantDataDate*)GetData())->GetValue());
else
else if (type == wxT("date"))
*value = wxTime(((wxVariantDataDate*)GetData())->GetValue());
else
}
bool wxVariant::Convert(wxDate* value) const
}
bool wxVariant::Convert(wxDate* value) const
if (type == wxT("date"))
*value = ((wxVariantDataDate*)GetData())->GetValue();
else
if (type == wxT("date"))
*value = ((wxVariantDataDate*)GetData())->GetValue();
else
}
#endif // wxUSE_TIMEDATE
}
#endif // wxUSE_TIMEDATE
if (type == wxT("datetime"))
{
*value = ((wxVariantDataDateTime*)GetData())->GetValue();
if (type == wxT("datetime"))
{
*value = ((wxVariantDataDateTime*)GetData())->GetValue();
// Fallback to string conversion
wxString val;
return Convert(&val) && (value->ParseDate(val));
// Fallback to string conversion
wxString val;
return Convert(&val) && (value->ParseDate(val));