void wxDataInputStream::Read32(wxUint32 *buffer, size_t size)
{
- m_input->Read(buffer, size * 4);
+ m_input->Read(buffer, size * 4);
- if (m_be_order)
- {
- for (wxUint32 i=0; i<size; i++)
+ if (m_be_order)
{
- wxUint32 v = wxUINT32_SWAP_ON_LE(*buffer);
- *(buffer++) = v;
+ for (wxUint32 i=0; i<size; i++)
+ {
+ wxUint32 v = wxUINT32_SWAP_ON_LE(*buffer);
+ *(buffer++) = v;
+ }
}
- }
-else
- {
- for (wxUint32 i=0; i<size; i++)
+ else
{
- wxUint32 v = wxUINT32_SWAP_ON_BE(*buffer);
- *(buffer++) = v;
+ for (wxUint32 i=0; i<size; i++)
+ {
+ wxUint32 v = wxUINT32_SWAP_ON_BE(*buffer);
+ *(buffer++) = v;
+ }
}
- }
}
void wxDataInputStream::Read16(wxUint16 *buffer, size_t size)
nnm = *s ? s + 1 : s;
*s = 0;
// FIXME: wxGetUserHome could return temporary storage in Unicode mode
- if ((home = WXSTRINGCAST wxGetUserHome(wxString(nm + 1))) == NULL) {
- if (was_sep) /* replace only if it was there: */
- *s = SEP;
+ if ((home = WXSTRINGCAST wxGetUserHome(wxString(nm + 1))) == NULL)
+ {
+ if (was_sep) /* replace only if it was there: */
+ *s = SEP;
s = NULL;
- } else {
+ }
+ else
+ {
nm = nnm;
s = home;
}
bool wxMatchWild( const wxString& pat, const wxString& text, bool dot_special )
{
- if (text.empty())
+ if (text.empty())
+ {
+ /* Match if both are empty. */
+ return pat.empty();
+ }
+
+ const wxChar *m = pat.c_str(),
+ *n = text.c_str(),
+ *ma = NULL,
+ *na = NULL,
+ *mp = NULL,
+ *np = NULL;
+ int just = 0,
+ pcount = 0,
+ acount = 0,
+ count = 0;
+
+ if (dot_special && (*n == wxT('.')))
+ {
+ /* Never match so that hidden Unix files
+ * are never found. */
+ return false;
+ }
+
+ for (;;)
+ {
+ if (*m == wxT('*'))
{
- /* Match if both are empty. */
- return pat.empty();
+ ma = ++m;
+ na = n;
+ just = 1;
+ mp = NULL;
+ acount = count;
}
-
- const wxChar *m = pat.c_str(),
- *n = text.c_str(),
- *ma = NULL,
- *na = NULL,
- *mp = NULL,
- *np = NULL;
- int just = 0,
- pcount = 0,
- acount = 0,
- count = 0;
-
- if (dot_special && (*n == wxT('.')))
+ else if (*m == wxT('?'))
{
- /* Never match so that hidden Unix files
- * are never found. */
+ m++;
+ if (!*n++)
return false;
}
-
- for (;;)
+ else
{
- if (*m == wxT('*'))
+ if (*m == wxT('\\'))
+ {
+ m++;
+ /* Quoting "nothing" is a bad thing */
+ if (!*m)
+ return false;
+ }
+ if (!*m)
+ {
+ /*
+ * If we are out of both strings or we just
+ * saw a wildcard, then we can say we have a
+ * match
+ */
+ if (!*n)
+ return true;
+ if (just)
+ return true;
+ just = 0;
+ goto not_matched;
+ }
+ /*
+ * We could check for *n == NULL at this point, but
+ * since it's more common to have a character there,
+ * check to see if they match first (m and n) and
+ * then if they don't match, THEN we can check for
+ * the NULL of n
+ */
+ just = 0;
+ if (*m == *n)
+ {
+ m++;
+ if (*n == wxT(' '))
+ mp = NULL;
+ count++;
+ n++;
+ }
+ else
+ {
+
+ not_matched:
+
+ /*
+ * If there are no more characters in the
+ * string, but we still need to find another
+ * character (*m != NULL), then it will be
+ * impossible to match it
+ */
+ if (!*n)
+ return false;
+ if (mp)
{
- ma = ++m;
- na = n;
- just = 1;
+ m = mp;
+ if (*np == wxT(' '))
+ {
mp = NULL;
- acount = count;
- }
- else if (*m == wxT('?'))
- {
- m++;
- if (!*n++)
- return false;
+ goto check_percent;
+ }
+ n = ++np;
+ count = pcount;
}
else
- {
- if (*m == wxT('\\'))
- {
- m++;
- /* Quoting "nothing" is a bad thing */
- if (!*m)
- return false;
- }
- if (!*m)
- {
- /*
- * If we are out of both strings or we just
- * saw a wildcard, then we can say we have a
- * match
- */
- if (!*n)
- return true;
- if (just)
- return true;
- just = 0;
- goto not_matched;
- }
- /*
- * We could check for *n == NULL at this point, but
- * since it's more common to have a character there,
- * check to see if they match first (m and n) and
- * then if they don't match, THEN we can check for
- * the NULL of n
- */
- just = 0;
- if (*m == *n)
- {
- m++;
- if (*n == wxT(' '))
- mp = NULL;
- count++;
- n++;
- }
- else
- {
+ check_percent:
- not_matched:
-
- /*
- * If there are no more characters in the
- * string, but we still need to find another
- * character (*m != NULL), then it will be
- * impossible to match it
- */
- if (!*n)
- return false;
- if (mp)
- {
- m = mp;
- if (*np == wxT(' '))
- {
- mp = NULL;
- goto check_percent;
- }
- n = ++np;
- count = pcount;
- }
- else
- check_percent:
-
- if (ma)
- {
- m = ma;
- n = ++na;
- count = acount;
- }
- else
- return false;
- }
+ if (ma)
+ {
+ m = ma;
+ n = ++na;
+ count = acount;
}
+ else
+ return false;
+ }
}
+ }
}
// Return the type of an open file
// Author: John Labenski
// Modified by:
// Created: 14.06.03 (extracted from src/*/filedlg.cpp)
-// RCS-ID:
+// RCS-ID: $Id$
// Copyright: (c) Robert Roebling
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
IMPLEMENT_DYNAMIC_CLASS(wxFileDialogBase, wxDialog)
void wxFileDialogBase::Init()
-{
+{
m_filterIndex = m_dialogStyle = 0;
m_parent = NULL;
}
// if filter is of form "All files (*)|*|..." set correct filter index
if((wxStrlen(defaultExtension) != 0) && (filter2.Find(wxT('|')) != wxNOT_FOUND))
- {
+ {
int filterIndex = 0;
wxArrayString descriptions, filters;
// don't care about errors, handled already by wxFileDialog
(void)wxParseCommonDialogsFilter(filter2, descriptions, filters);
for (size_t n=0; n<filters.GetCount(); n++)
- {
+ {
if (filters[n].Contains(defaultExtension))
- {
+ {
filterIndex = n;
break;
- }
- }
+ }
+ }
if (filterIndex > 0)
fileDialog.SetFilterIndex(filterIndex);
- }
+ }
wxString filename;
if ( fileDialog.ShowModal() == wxID_OK )
switch (c)
{
- case wxT('2'): // ASCII Grey
+ case wxT('2'): // ASCII Grey
case wxT('3'): // ASCII RGB
case wxT('5'): // RAW Grey
case wxT('6'): break;
}
- if (c=='2') // Ascii GREY
- {
+ if (c=='2') // Ascii GREY
+ {
wxUint32 value, size=width*height;
for (wxUint32 i=0; i<size; ++i)
{
value=text_stream.Read32();
*ptr++=(unsigned char)value; // R
- *ptr++=(unsigned char)value; // G
+ *ptr++=(unsigned char)value; // G
*ptr++=(unsigned char)value; // B
if ( !buf_stream )
{
}
}
}
- if (c=='3') // Ascii RBG
- {
+ if (c=='3') // Ascii RBG
+ {
wxUint32 value, size=3*width*height;
for (wxUint32 i=0; i<size; ++i)
{
return false;
}
}
- }
- if (c=='5') // Raw GREY
- {
+ }
+ if (c=='5') // Raw GREY
+ {
wxUint32 size=width*height;
unsigned char value;
for (wxUint32 i=0; i<size; ++i)
buf_stream.Read(&value,1);
*ptr++=value; // R
*ptr++=value; // G
- *ptr++=value; // B
+ *ptr++=value; // B
if ( !buf_stream )
{
if (verbose) wxLogError(_("PNM: File seems truncated."));
// copy it to our buffer and free memory
// Crashes on SmartPhone (FIXME)
#if !defined(__SMARTPHONE__) /* of WinCE */
- if( lpMsgBuf != 0 ) {
+ if( lpMsgBuf != 0 )
+ {
wxStrncpy(s_szBuf, (const wxChar *)lpMsgBuf, WXSIZEOF(s_szBuf) - 1);
s_szBuf[WXSIZEOF(s_szBuf) - 1] = wxT('\0');
keyCode = WXK_WINDOWS_LEFT;
else if ( current == wxT("WINDOWS_RIGHT") )
keyCode = WXK_WINDOWS_RIGHT;
- else if ( current == wxT("WINDOWS_MENU") )
+ else if ( current == wxT("WINDOWS_MENU") )
keyCode = WXK_WINDOWS_MENU;
else if ( current == wxT("COMMAND") )
keyCode = WXK_COMMAND;
- else if ( current.Left(3) == wxT("KP_") && wxIsdigit(current[3U]) ) {
- keyCode = WXK_NUMPAD0 + wxAtoi(current.c_str() + 3); }
- else if ( current.Left(7) == wxT("SPECIAL") && wxIsdigit(current[7U]) ) {
- keyCode = WXK_SPECIAL1 + wxAtoi(current.c_str() + 7) - 1; }
+ else if ( current.Left(3) == wxT("KP_") && wxIsdigit(current[3U]) )
+ keyCode = WXK_NUMPAD0 + wxAtoi(current.c_str() + 3);
+ else if ( current.Left(7) == wxT("SPECIAL") && wxIsdigit(current[7U]) )
+ keyCode = WXK_SPECIAL1 + wxAtoi(current.c_str() + 7) - 1;
else
{
wxLogDebug(wxT("Unrecognized accel key '%s', accel string ignored."),
wxStringBase& wxStringBase::erase(size_t nStart, size_t nLen)
{
- wxASSERT(nStart <= length());
- size_t strLen = length() - nStart;
- // delete nLen or up to the end of the string characters
- nLen = strLen < nLen ? strLen : nLen;
- wxString strTmp(c_str(), nStart);
- strTmp.append(c_str() + nStart + nLen, length() - nStart - nLen);
+ wxASSERT(nStart <= length());
+ size_t strLen = length() - nStart;
+ // delete nLen or up to the end of the string characters
+ nLen = strLen < nLen ? strLen : nLen;
+ wxString strTmp(c_str(), nStart);
+ strTmp.append(c_str() + nStart + nLen, length() - nStart - nLen);
- swap(strTmp);
- return *this;
+ swap(strTmp);
+ return *this;
}
wxStringBase& wxStringBase::insert(size_t nPos, const wxChar *sz, size_t n)
{
- wxASSERT( nPos <= length() );
+ wxASSERT( nPos <= length() );
- if ( n == npos ) n = wxStrlen(sz);
- if ( n == 0 ) return *this;
+ if ( n == npos ) n = wxStrlen(sz);
+ if ( n == 0 ) return *this;
- if ( !Alloc(length() + n) || !CopyBeforeWrite() ) {
- wxFAIL_MSG( _T("out of memory in wxStringBase::insert") );
- }
+ if ( !Alloc(length() + n) || !CopyBeforeWrite() ) {
+ wxFAIL_MSG( _T("out of memory in wxStringBase::insert") );
+ }
- memmove(m_pchData + nPos + n, m_pchData + nPos,
- (length() - nPos) * sizeof(wxChar));
- memcpy(m_pchData + nPos, sz, n * sizeof(wxChar));
- GetStringData()->nDataLength = length() + n;
- m_pchData[length()] = '\0';
+ memmove(m_pchData + nPos + n, m_pchData + nPos,
+ (length() - nPos) * sizeof(wxChar));
+ memcpy(m_pchData + nPos, sz, n * sizeof(wxChar));
+ GetStringData()->nDataLength = length() + n;
+ m_pchData[length()] = '\0';
- return *this;
+ return *this;
}
void wxStringBase::swap(wxStringBase& str)
size_t wxStringBase::find(const wxStringBase& str, size_t nStart) const
{
- wxASSERT( str.GetStringData()->IsValid() );
- wxASSERT( nStart <= length() );
+ wxASSERT( str.GetStringData()->IsValid() );
+ wxASSERT( nStart <= length() );
- //anchor
- const wxChar* p = (const wxChar*)wxTmemchr(c_str() + nStart,
- str.c_str()[0],
- length() - nStart);
+ //anchor
+ const wxChar* p = (const wxChar*)wxTmemchr(c_str() + nStart,
+ str.c_str()[0],
+ length() - nStart);
- if(!p)
- return npos;
+ if(!p)
+ return npos;
- while(p - c_str() + str.length() <= length() &&
- wxTmemcmp(p, str.c_str(), str.length()) )
- {
- //Previosly passed as the first argument to wxTmemchr,
- //but C/C++ standard does not specify evaluation order
- //of arguments to functions -
- //http://embedded.com/showArticle.jhtml?articleID=9900607
- ++p;
-
- //anchor again
- p = (const wxChar*)wxTmemchr(p,
- str.c_str()[0],
- length() - (p - c_str()));
-
- if(!p)
- return npos;
- }
+ while(p - c_str() + str.length() <= length() &&
+ wxTmemcmp(p, str.c_str(), str.length()) )
+ {
+ //Previosly passed as the first argument to wxTmemchr,
+ //but C/C++ standard does not specify evaluation order
+ //of arguments to functions -
+ //http://embedded.com/showArticle.jhtml?articleID=9900607
+ ++p;
+
+ //anchor again
+ p = (const wxChar*)wxTmemchr(p,
+ str.c_str()[0],
+ length() - (p - c_str()));
- return (p - c_str() + str.length() <= length()) ? p - c_str() : npos;
+ if(!p)
+ return npos;
+ }
+
+ return (p - c_str() + str.length() <= length()) ? p - c_str() : npos;
}
size_t wxStringBase::find(const wxChar* sz, size_t nStart, size_t n) const
{
- return find(wxStringBase(sz, n), nStart);
+ return find(wxStringBase(sz, n), nStart);
}
size_t wxStringBase::find(wxChar ch, size_t nStart) const
{
- wxASSERT( nStart <= length() );
+ wxASSERT( nStart <= length() );
- const wxChar *p = (const wxChar*)wxTmemchr(c_str() + nStart, ch, length() - nStart);
+ const wxChar *p = (const wxChar*)wxTmemchr(c_str() + nStart, ch, length() - nStart);
- return p == NULL ? npos : p - c_str();
+ return p == NULL ? npos : p - c_str();
}
size_t wxStringBase::rfind(const wxStringBase& str, size_t nStart) const
if(!m_input) return 0;
wxString word = ReadWord();
- if(word.IsEmpty())
+ if(word.empty())
return 0;
return wxStrtoul(word.c_str(), 0, base);
}
if(!m_input) return 0;
wxString word = ReadWord();
- if(word.IsEmpty())
+ if(word.empty())
return 0;
return wxStrtol(word.c_str(), 0, base);
}
{
if(!m_input) return 0;
wxString word = ReadWord();
- if(word.IsEmpty())
+ if(word.empty())
return 0;
return wxStrtod(word.c_str(), 0);
}
}
out << c;
- }
+ }
// We must not write the trailing NULL here
#if wxUSE_UNICODE
// Author: Kevin Smith
// Modified by:
// Created: Jan 22 1999
-// RCS-ID:
+// RCS-ID: $Id$
// Copyright: (c) 1999 Kevin Smith
-// Licence: wxWindows licence
+// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
// Called to transfer data from the window
bool wxGenericValidator::TransferFromWindow(void)
{
- if ( !m_validatorWindow )
- return false;
+ if ( !m_validatorWindow )
+ return false;
- // bool controls
+ // BOOL CONTROLS **************************************
#if wxUSE_CHECKBOX
- if (m_validatorWindow->IsKindOf(CLASSINFO(wxCheckBox)) )
- {
- wxCheckBox* pControl = (wxCheckBox*) m_validatorWindow;
- if (m_pBool)
+ if (m_validatorWindow->IsKindOf(CLASSINFO(wxCheckBox)) )
{
- *m_pBool = pControl->GetValue() ;
- return true;
- }
- } else
+ wxCheckBox* pControl = (wxCheckBox*) m_validatorWindow;
+ if (m_pBool)
+ {
+ *m_pBool = pControl->GetValue() ;
+ return true;
+ }
+ } else
#endif
#if wxUSE_RADIOBTN
- if (m_validatorWindow->IsKindOf(CLASSINFO(wxRadioButton)) )
- {
- wxRadioButton* pControl = (wxRadioButton*) m_validatorWindow;
- if (m_pBool)
+ if (m_validatorWindow->IsKindOf(CLASSINFO(wxRadioButton)) )
{
- *m_pBool = pControl->GetValue() ;
- return true;
- }
- } else
+ wxRadioButton* pControl = (wxRadioButton*) m_validatorWindow;
+ if (m_pBool)
+ {
+ *m_pBool = pControl->GetValue() ;
+ return true;
+ }
+ } else
#endif
- // int controls
+
+ // INT CONTROLS ***************************************
#if wxUSE_GAUGE
- if (m_validatorWindow->IsKindOf(CLASSINFO(wxGauge)) )
- {
- wxGauge* pControl = (wxGauge*) m_validatorWindow;
- if (m_pInt)
+ if (m_validatorWindow->IsKindOf(CLASSINFO(wxGauge)) )
{
- *m_pInt = pControl->GetValue() ;
- return true;
- }
- } else
+ wxGauge* pControl = (wxGauge*) m_validatorWindow;
+ if (m_pInt)
+ {
+ *m_pInt = pControl->GetValue() ;
+ return true;
+ }
+ } else
#endif
#if wxUSE_RADIOBOX
- if (m_validatorWindow->IsKindOf(CLASSINFO(wxRadioBox)) )
- {
- wxRadioBox* pControl = (wxRadioBox*) m_validatorWindow;
- if (m_pInt)
+ if (m_validatorWindow->IsKindOf(CLASSINFO(wxRadioBox)) )
{
- *m_pInt = pControl->GetSelection() ;
- return true;
- }
- } else
+ wxRadioBox* pControl = (wxRadioBox*) m_validatorWindow;
+ if (m_pInt)
+ {
+ *m_pInt = pControl->GetSelection() ;
+ return true;
+ }
+ } else
#endif
#if wxUSE_SCROLLBAR
- if (m_validatorWindow->IsKindOf(CLASSINFO(wxScrollBar)) )
- {
- wxScrollBar* pControl = (wxScrollBar*) m_validatorWindow;
- if (m_pInt)
+ if (m_validatorWindow->IsKindOf(CLASSINFO(wxScrollBar)) )
{
- *m_pInt = pControl->GetThumbPosition() ;
- return true;
- }
- } else
+ wxScrollBar* pControl = (wxScrollBar*) m_validatorWindow;
+ if (m_pInt)
+ {
+ *m_pInt = pControl->GetThumbPosition() ;
+ return true;
+ }
+ } else
#endif
#if wxUSE_SPINCTRL && !defined(__WXMOTIF__)
if (m_validatorWindow->IsKindOf(CLASSINFO(wxSpinCtrl)) )
} else
#endif
#if wxUSE_SPINBTN
- if (m_validatorWindow->IsKindOf(CLASSINFO(wxSpinButton)) )
- {
- wxSpinButton* pControl = (wxSpinButton*) m_validatorWindow;
- if (m_pInt)
+ if (m_validatorWindow->IsKindOf(CLASSINFO(wxSpinButton)) )
{
- *m_pInt = pControl->GetValue() ;
- return true;
- }
- } else
+ wxSpinButton* pControl = (wxSpinButton*) m_validatorWindow;
+ if (m_pInt)
+ {
+ *m_pInt = pControl->GetValue() ;
+ return true;
+ }
+ } else
#endif
#if wxUSE_SLIDER
- if (m_validatorWindow->IsKindOf(CLASSINFO(wxSlider)) )
- {
- wxSlider* pControl = (wxSlider*) m_validatorWindow;
- if (m_pInt)
+ if (m_validatorWindow->IsKindOf(CLASSINFO(wxSlider)) )
{
- *m_pInt = pControl->GetValue() ;
- return true;
- }
- } else
+ wxSlider* pControl = (wxSlider*) m_validatorWindow;
+ if (m_pInt)
+ {
+ *m_pInt = pControl->GetValue() ;
+ return true;
+ }
+ } else
#endif
- // string controls
+
+ // STRING CONTROLS ************************************
#if wxUSE_BUTTON
- if (m_validatorWindow->IsKindOf(CLASSINFO(wxButton)) )
- {
- wxButton* pControl = (wxButton*) m_validatorWindow;
- if (m_pString)
+ if (m_validatorWindow->IsKindOf(CLASSINFO(wxButton)) )
{
- *m_pString = pControl->GetLabel() ;
- return true;
- }
- } else
+ wxButton* pControl = (wxButton*) m_validatorWindow;
+ if (m_pString)
+ {
+ *m_pString = pControl->GetLabel() ;
+ return true;
+ }
+ } else
#endif
#if wxUSE_COMBOBOX
- if (m_validatorWindow->IsKindOf(CLASSINFO(wxComboBox)) )
- {
- wxComboBox* pControl = (wxComboBox*) m_validatorWindow;
- if (m_pInt)
- {
- *m_pInt = pControl->GetSelection() ;
- return true;
- }
- else if (m_pString)
+ if (m_validatorWindow->IsKindOf(CLASSINFO(wxComboBox)) )
{
- if (m_validatorWindow->GetWindowStyle() & wxCB_READONLY)
- *m_pString = pControl->GetStringSelection();
- else
- *m_pString = pControl->GetValue();
- return true;
- }
- } else
+ wxComboBox* pControl = (wxComboBox*) m_validatorWindow;
+ if (m_pInt)
+ {
+ *m_pInt = pControl->GetSelection() ;
+ return true;
+ }
+ else if (m_pString)
+ {
+ if (m_validatorWindow->GetWindowStyle() & wxCB_READONLY)
+ *m_pString = pControl->GetStringSelection();
+ else
+ *m_pString = pControl->GetValue();
+ return true;
+ }
+ } else
#endif
#if wxUSE_CHOICE
- if (m_validatorWindow->IsKindOf(CLASSINFO(wxChoice)) )
- {
- wxChoice* pControl = (wxChoice*) m_validatorWindow;
- if (m_pInt)
- {
- *m_pInt = pControl->GetSelection() ;
- return true;
- }
- else if (m_pString)
+ if (m_validatorWindow->IsKindOf(CLASSINFO(wxChoice)) )
{
- *m_pString = pControl->GetStringSelection();
- return true;
- }
- } else
+ wxChoice* pControl = (wxChoice*) m_validatorWindow;
+ if (m_pInt)
+ {
+ *m_pInt = pControl->GetSelection() ;
+ return true;
+ }
+ else if (m_pString)
+ {
+ *m_pString = pControl->GetStringSelection();
+ return true;
+ }
+ } else
#endif
#if wxUSE_STATTEXT
- if (m_validatorWindow->IsKindOf(CLASSINFO(wxStaticText)) )
- {
- wxStaticText* pControl = (wxStaticText*) m_validatorWindow;
- if (m_pString)
+ if (m_validatorWindow->IsKindOf(CLASSINFO(wxStaticText)) )
{
- *m_pString = pControl->GetLabel() ;
- return true;
- }
- } else
+ wxStaticText* pControl = (wxStaticText*) m_validatorWindow;
+ if (m_pString)
+ {
+ *m_pString = pControl->GetLabel() ;
+ return true;
+ }
+ } else
#endif
#if wxUSE_TEXTCTRL
- if (m_validatorWindow->IsKindOf(CLASSINFO(wxTextCtrl)) )
- {
- wxTextCtrl* pControl = (wxTextCtrl*) m_validatorWindow;
- if (m_pString)
- {
- *m_pString = pControl->GetValue() ;
- return true;
- }
- else if (m_pInt)
+ if (m_validatorWindow->IsKindOf(CLASSINFO(wxTextCtrl)) )
{
- *m_pInt = wxAtoi(pControl->GetValue());
- return true;
- }
- } else
+ wxTextCtrl* pControl = (wxTextCtrl*) m_validatorWindow;
+ if (m_pString)
+ {
+ *m_pString = pControl->GetValue() ;
+ return true;
+ }
+ else if (m_pInt)
+ {
+ *m_pInt = wxAtoi(pControl->GetValue());
+ return true;
+ }
+ } else
#endif
- // array controls
+
+ // ARRAY CONTROLS *************************************
#if wxUSE_CHECKLISTBOX
- // NOTE: wxCheckListBox isa wxListBox, so wxCheckListBox MUST come first:
- if (m_validatorWindow->IsKindOf(CLASSINFO(wxCheckListBox)) )
- {
- wxCheckListBox* pControl = (wxCheckListBox*) m_validatorWindow;
- if (m_pArrayInt)
+ // NOTE: wxCheckListBox isa wxListBox, so wxCheckListBox MUST come first:
+ if (m_validatorWindow->IsKindOf(CLASSINFO(wxCheckListBox)) )
{
- // clear our array
- m_pArrayInt->Clear();
-
- // add each selected item to our array
- size_t i,
- count = pControl->GetCount();
- for ( i = 0; i < count; i++ )
- {
- if (pControl->IsChecked(i))
- m_pArrayInt->Add(i);
- }
-
- return true;
- }
- else
- return false;
- } else
+ wxCheckListBox* pControl = (wxCheckListBox*) m_validatorWindow;
+ if (m_pArrayInt)
+ {
+ // clear our array
+ m_pArrayInt->Clear();
+
+ // add each selected item to our array
+ size_t i,
+ count = pControl->GetCount();
+ for ( i = 0; i < count; i++ )
+ {
+ if (pControl->IsChecked(i))
+ m_pArrayInt->Add(i);
+ }
+
+ return true;
+ }
+ else
+ return false;
+ } else
#endif
#if wxUSE_LISTBOX
- if (m_validatorWindow->IsKindOf(CLASSINFO(wxListBox)) )
- {
- wxListBox* pControl = (wxListBox*) m_validatorWindow;
- if (m_pArrayInt)
+ if (m_validatorWindow->IsKindOf(CLASSINFO(wxListBox)) )
{
- // clear our array
- m_pArrayInt->Clear();
+ wxListBox* pControl = (wxListBox*) m_validatorWindow;
+ if (m_pArrayInt)
+ {
+ // clear our array
+ m_pArrayInt->Clear();
- // add each selected item to our array
- size_t i,
- count = pControl->GetCount();
- for ( i = 0; i < count; i++ )
- {
- if (pControl->Selected(i))
- m_pArrayInt->Add(i);
- }
+ // add each selected item to our array
+ size_t i,
+ count = pControl->GetCount();
+ for ( i = 0; i < count; i++ )
+ {
+ if (pControl->Selected(i))
+ m_pArrayInt->Add(i);
+ }
- return true;
- }
- } else
+ return true;
+ }
+ } else
#endif
- // unrecognized control, or bad pointer
+ // unrecognized control, or bad pointer
+ return false;
+
return false;
- return false;
}
/*
return _("<LINK>");
else if (IsDrive())
return _("<DRIVE>");
- else if (m_fileName.Find(wxT('.'), true) != wxNOT_FOUND)
+ else if (m_fileName.Find(wxT('.'), true) != wxNOT_FOUND)
return m_fileName.AfterLast(wxT('.'));
return wxEmptyString;
break;
case FileList_Time:
- if (!IsDrive())
+ if (!IsDrive())
s = GetModificationTime();
break;
#endif // __UNIX__
wxFileData *fd = new wxFileData(p, wxT(".."), wxFileData::is_dir, wxFileIconsTable::folder);
if (Add(fd, item) != -1)
- item.m_itemId++;
+ item.m_itemId++;
else
delete fd;
}
{
wxFileData *fd = new wxFileData(dirPrefix + f, f, wxFileData::is_dir, wxFileIconsTable::folder);
if (Add(fd, item) != -1)
- item.m_itemId++;
+ item.m_itemId++;
else
delete fd;
{
wxFileData *fd = new wxFileData(dirPrefix + f, f, wxFileData::is_file, wxFileIconsTable::file);
if (Add(fd, item) != -1)
- item.m_itemId++;
+ item.m_itemId++;
else
delete fd;
// Work around the fact that a focus kill event can be sent to
// a combobox within a set focus event.
bool m_inSetFocus;
-
+
DECLARE_EVENT_TABLE()
DECLARE_DYNAMIC_CLASS(wxGridCellEditorEvtHandler)
DECLARE_NO_COPY_CLASS(wxGridCellEditorEvtHandler)
{
wxLogDebug(_T("Invalid wxGridCellFloatRenderer width parameter string '%s ignored"), params.c_str());
}
-
}
- tmp = params.AfterFirst(_T(','));
- if ( !tmp.empty() )
- {
- long precision;
+ tmp = params.AfterFirst(_T(','));
+ if ( !tmp.empty() )
+ {
+ long precision;
if ( tmp.ToLong(&precision) )
- {
+ {
SetPrecision((int)precision);
- }
- else
- {
+ }
+ else
+ {
wxLogDebug(_T("Invalid wxGridCellFloatRenderer precision parameter string '%s ignored"), params.c_str());
- }
-
+ }
}
}
}
return DoGetBestSize(attr, dc, GetString(grid, row, col));
}
-void wxGridCellDateTimeRenderer::SetParameters(const wxString& params){
- if (!params.IsEmpty())
+void wxGridCellDateTimeRenderer::SetParameters(const wxString& params)
+{
+ if (!params.empty())
m_oformat=params;
}
wxGridCellEnumRenderer::wxGridCellEnumRenderer(const wxString& choices)
{
- if (!choices.IsEmpty())
+ if (!choices.empty())
SetParameters(choices);
}
// "John","Fred"..."Bob" in the combo choice box
wxGridCellEnumEditor::wxGridCellEnumEditor(const wxString& choices)
- : wxGridCellChoiceEditor()
+ :wxGridCellChoiceEditor()
{
m_startint = -1;
- if (!choices.IsEmpty())
+ if (!choices.empty())
SetParameters(choices);
}
else
{
wxString startValue = table->GetValue(row, col);
- if (startValue.IsNumber() && !startValue.IsEmpty())
+ if (startValue.IsNumber() && !startValue.empty())
{
startValue.ToLong(&m_startint);
}
while ( tk.HasMoreTokens() )
{
wxString tok = tk.GetNextToken();
- //FIXME: this causes us to print an extra unnecesary
- // space at the end of the line. But it
- // is invisible , simplifies the size calculation
- // and ensures tokens are separated in the display
- tok += _T(" ");
+ //FIXME: this causes us to print an extra unnecesary
+ // space at the end of the line. But it
+ // is invisible , simplifies the size calculation
+ // and ensures tokens are separated in the display
+ tok += _T(" ");
dc.GetTextExtent(tok, &x, &y);
- if ( curr_x + x > max_x) {
+ if ( curr_x + x > max_x)
+ {
lines.Add( wxString(thisline) );
- thisline = tok;
- curr_x=x;
- } else {
+ thisline = tok;
+ curr_x=x;
+ }
+ else
+ {
thisline+= tok;
- curr_x += x;
- }
-
+ curr_x += x;
+ }
}
//Add last line
lines.Add( wxString(thisline) );
return;
}
- wxCHECK_RET( litem >= 0 && (size_t)litem < GetItemCount(),
- _T("invalid list ctrl item index in SetItem") );
+ wxCHECK_RET( litem >= 0 && (size_t)litem < GetItemCount(),
+ _T("invalid list ctrl item index in SetItem") );
size_t oldCurrent = m_current;
size_t item = (size_t)litem; // safe because of the check above
else
{
m_Cache[tg].End1 = m_Cache[tg].End2 = -1;
-
+
if (wxIsCDATAElement(tagBuffer))
{
// store the orig pos in case we are missing the closing
// tag (see below)
- wxInt32 old_pos = pos;
+ wxInt32 old_pos = pos;
bool foundCloseTag = false;
-
+
// find next matching tag
int tag_len = wxStrlen(tagBuffer);
while (pos < lng)
}
// found a match
- if (match_pos == tag_len)
+ if (match_pos == tag_len)
{
pos = pos - tag_len - 3;
foundCloseTag = true;
}
#undef IS_WHITE
- }
- m_Begin = i;
+ }
+ m_Begin = i;
- cache->QueryTag(pos, &m_End1, &m_End2);
- if (m_End1 > end_pos) m_End1 = end_pos;
- if (m_End2 > end_pos) m_End2 = end_pos;
+ cache->QueryTag(pos, &m_End1, &m_End2);
+ if (m_End1 > end_pos) m_End1 = end_pos;
+ if (m_End2 > end_pos) m_End2 = end_pos;
}
wxHtmlTag::~wxHtmlTag()