retrieve them - possibly using just the C array indexing $[]$ operator which
does exactly the same as \helpref{Item()}{wxarrayitem} method.
-\helpref{Count}{wxarraycount}\\
\helpref{GetCount}{wxarraygetcount}\\
\helpref{IsEmpty}{wxarrayisempty}\\
\helpref{Item}{wxarrayitem}\\
This function does the same as \helpref{Empty()}{wxarrayempty} and additionally
frees the memory allocated to the array.
-\membersection{wxArray::Count}\label{wxarraycount}
-
-\constfunc{size\_t}{Count}{\void}
-
-Same as \helpref{GetCount()}{wxarraygetcount}. This function is deprecated -
-it exists only for compatibility.
-
\membersection{wxObjArray::Detach}\label{wxobjarraydetach}
\func{T *}{Detach}{\param{size\_t }{index}}
See also: \helpref{Empty}{wxarraystringempty}
-\membersection{wxArrayString::Count}\label{wxarraystringcount}
-
-\constfunc{size\_t}{Count}{\void}
-
-Returns the number of items in the array. This function is deprecated and is
-for backwards compatibility only, please use
-\helpref{GetCount}{wxarraystringgetcount} instead.
-
\membersection{wxArrayString::Empty}\label{wxarraystringempty}
\func{void}{Empty}{\void}
\helpref{GetCount}{wxcontrolwithitemsgetcount}
-\membersection{wxControlWithItems::Number}\label{wxcontrolwithitemsnumber}
-
-\constfunc{int}{Number}{\void}
-
-{\bf Obsolescence note:} This method is obsolete and was replaced with
-\helpref{GetCount}{wxcontrolwithitemsgetcount}, please use the new method in
-the new code. This method is only available if wxWidgets was compiled with
-{\tt WXWIN\_COMPATIBILITY\_2\_2} defined and will disappear completely in
-future versions.
-
-
\membersection{wxControlWithItems::Select}\label{wxcontrolwithitemsselect}
\func{void}{Select}{\param{int}{ n}}
this class to load a library and don't worry about unloading it -- it will be
done in the objects destructor automatically.
-% deprecated now...
-%
-%\wxheading{See also}
-%
-%\helpref{wxDllLoader}{wxdllloader}
-
\wxheading{Derived from}
No base class.
\section{Alphabetical functions and macros list}\label{functionsalphabetically}
\helpref{CLASSINFO}{classinfo}\\
-\helpref{copystring}{copystring}\\
\helpref{DECLARE\_ABSTRACT\_CLASS}{declareabstractclass}\\
\helpref{DECLARE\_APP}{declareapp}\\
\helpref{DECLARE\_CLASS}{declareclass}\\
\section{String functions}\label{stringfunctions}
-
-\membersection{::copystring}\label{copystring}
-
-\func{char *}{copystring}{\param{const char *}{s}}
-
-Makes a copy of the string {\it s} using the C++ new operator, so it can be
-deleted with the {\it delete} operator.
-
-This function is deprecated, use \helpref{wxString}{wxstring} class instead.
-
-
\membersection{::wxGetTranslation}\label{wxgettranslation}
\func{const wxString\& }{wxGetTranslation}{\param{const wxString\& }{str},
\item Set a new event handler for wxMenu, using an object whose class has EVT\_MENU entries.
\item Provide EVT\_MENU handlers in the window which pops up the menu, or in an ancestor of
this window.
-\item Define a callback of type wxFunction, which you pass to the wxMenu constructor.
-The callback takes a reference to the menu, and a reference to a
-\helpref{wxCommandEvent}{wxcommandevent}. This method is deprecated and should
-not be used in the new code, it is provided for backwards compatibility only.
\end{enumerate}
\wxheading{See also}
{
wxASSERT_MSG( !IsEmpty(),
_T("wxArrayString: index out of bounds") );
- return Item(Count() - 1);
+ return Item(GetCount() - 1);
}
virtual void AddFilesToMenu(wxMenu* menu); // Single menu
// Accessors
- virtual wxString GetHistoryFile(size_t i) const;
- virtual size_t GetCount() const { return m_fileHistoryN; }
+ virtual wxString GetHistoryFile(size_t i) const { return m_fileHistory[i]; }
+ virtual size_t GetCount() const { return m_fileHistory.GetCount(); }
const wxList& GetMenus() const { return m_fileMenus; }
protected:
// Last n files
- wxChar** m_fileHistory;
- // Number of files saved
- size_t m_fileHistoryN;
+ wxArrayString m_fileHistory;
+
// Menus to maintain (may need several for an MDI app)
wxList m_fileMenus;
+
// Max files to maintain
size_t m_fileMaxFiles;
T& Item(size_t uiIndex) const \
{ return (T&)/*const cast*/base::operator[](uiIndex); } \
T& Last() const \
- { return Item(Count() - 1); } \
+ { return Item(GetCount() - 1); } \
\
int Index(T e, bool bFromEnd = false) const \
{ return base::Index(e, bFromEnd); } \
T& Item(size_t uiIndex) const \
{ return (T&)(base::operator[](uiIndex)); } \
T& Last() const \
- { return (T&)(base::operator[](Count() - 1)); } \
+ { return (T&)(base::operator[](GetCount() - 1)); } \
\
int Index(T lItem, bool bFromEnd = false) const \
{ return base::Index((base_type)lItem, bFromEnd); } \
virtual void SetAccel(wxAcceleratorEntry *accel);
#endif // wxUSE_ACCEL
+#if WXWIN_COMPATIBILITY_2_8
// compatibility only, use new functions in the new code
- void SetName(const wxString& str) { SetText(str); }
- const wxString& GetName() const { return GetText(); }
+ wxDEPRECATED( void SetName(const wxString& str) );
+ wxDEPRECATED( const wxString& GetName() const );
+#endif // WXWIN_COMPATIBILITY_2_8
static wxMenuItem *New(wxMenu *parentMenu,
int itemid,
wxMenuItemBase& operator=(const wxMenuItemBase& item);
};
+#if WXWIN_COMPATIBILITY_2_8
+void wxMenuItem::SetName(const wxString &str)
+ { SetText(str); }
+const wxString& wxMenuItem::GetName() const
+ { return GetText(); }
+#endif // WXWIN_COMPATIBILITY_2_8
+
// ----------------------------------------------------------------------------
// include the real class declaration
// ----------------------------------------------------------------------------
// Returns internal number of pages which can be different from
// GetPageCount() while performing a page insertion or removal.
- size_t DoInternalGetPageCount() const { return m_treeIds.Count(); }
+ size_t DoInternalGetPageCount() const { return m_treeIds.GetCount(); }
DECLARE_EVENT_TABLE()
// resize all pages to fit the new control size
const wxRect pageRect = GetPageRect();
- const unsigned pagesCount = m_pages.Count();
+ const unsigned pagesCount = m_pages.GetCount();
for ( unsigned int i = 0; i < pagesCount; ++i )
{
wxWindow * const page = m_pages[i];
// Resets switches and options
void wxCmdLineParser::Reset()
{
- for ( size_t i = 0; i < m_data->m_options.Count(); i++ )
+ for ( size_t i = 0; i < m_data->m_options.GetCount(); i++ )
{
wxCmdLineOption& opt = m_data->m_options[i];
opt.SetHasValue(false);
#include "wx/file.h"
#include "wx/cmdproc.h"
#include "wx/tokenzr.h"
+#include "wx/filename.h"
#include <stdio.h>
#include <string.h>
// File history processor
// ----------------------------------------------------------------------------
-static inline wxChar* MYcopystring(const wxString& s)
-{
- wxChar* copy = new wxChar[s.length() + 1];
- return wxStrcpy(copy, s.c_str());
-}
-
-static inline wxChar* MYcopystring(const wxChar* s)
-{
- wxChar* copy = new wxChar[wxStrlen(s) + 1];
- return wxStrcpy(copy, s);
-}
-
wxFileHistory::wxFileHistory(size_t maxFiles, wxWindowID idBase)
{
m_fileMaxFiles = maxFiles;
m_idBase = idBase;
- m_fileHistoryN = 0;
- m_fileHistory = new wxChar *[m_fileMaxFiles];
}
wxFileHistory::~wxFileHistory()
{
- size_t i;
- for (i = 0; i < m_fileHistoryN; i++)
- delete[] m_fileHistory[i];
- delete[] m_fileHistory;
}
-// File history management
void wxFileHistory::AddFileToHistory(const wxString& file)
{
+ wxFileName fn(file);
size_t i;
// Check we don't already have this file
- for (i = 0; i < m_fileHistoryN; i++)
+ for (i = 0; i < m_fileHistory.GetCount(); i++)
{
-#if defined( __WXMSW__ ) // Add any other OSes with case insensitive file names
- wxString testString;
- if ( m_fileHistory[i] )
- testString = m_fileHistory[i];
- if ( m_fileHistory[i] && ( file.Lower() == testString.Lower() ) )
-#else
- if ( m_fileHistory[i] && ( file == m_fileHistory[i] ) )
-#endif
+ // we need to do a comparison using wxFileNames because it knows
+ // how to exactly compare files on the different platforms
+ // (e.g. handle case [in]sensitive filesystems)
+ if ( fn == wxFileName(m_fileHistory[i]) )
{
// we do have it, move it to the top of the history
RemoveFileFromHistory (i);
}
// if we already have a full history, delete the one at the end
- if ( m_fileMaxFiles == m_fileHistoryN )
+ if ( m_fileMaxFiles == m_fileHistory.GetCount() )
{
- RemoveFileFromHistory (m_fileHistoryN - 1);
+ RemoveFileFromHistory (m_fileHistory.GetCount() - 1);
AddFileToHistory (file);
return;
}
// Add to the project file history:
// Move existing files (if any) down so we can insert file at beginning.
- if (m_fileHistoryN < m_fileMaxFiles)
+ if (m_fileHistory.GetCount() < m_fileMaxFiles)
{
wxList::compatibility_iterator node = m_fileMenus.GetFirst();
while (node)
{
wxMenu* menu = (wxMenu*) node->GetData();
- if ( m_fileHistoryN == 0 && menu->GetMenuItemCount() )
+ if ( m_fileHistory.IsEmpty() && menu->GetMenuItemCount() )
{
menu->AppendSeparator();
}
- menu->Append(m_idBase+m_fileHistoryN, _("[EMPTY]"));
+ menu->Append(m_idBase+m_fileHistory.GetCount(), _("[EMPTY]"));
node = node->GetNext();
}
- m_fileHistoryN ++;
}
- // Shuffle filenames down
- for (i = (m_fileHistoryN-1); i > 0; i--)
- {
- m_fileHistory[i] = m_fileHistory[i-1];
- }
- m_fileHistory[0] = MYcopystring(file);
+
+ m_fileHistory.Insert(file, 0);
// this is the directory of the last opened file
wxString pathCurrent;
wxSplitPath( m_fileHistory[0], &pathCurrent, NULL, NULL );
- for (i = 0; i < m_fileHistoryN; i++)
- {
- if ( m_fileHistory[i] )
+ for (i = 0; i < m_fileHistory.GetCount(); i++)
{
// if in same directory just show the filename; otherwise the full
// path
// we need to quote '&' characters which are used for mnemonics
pathInMenu.Replace(_T("&"), _T("&&"));
+
wxString buf;
buf.Printf(s_MRUEntryFormat, i + 1, pathInMenu.c_str());
+
wxList::compatibility_iterator node = m_fileMenus.GetFirst();
while (node)
{
node = node->GetNext();
}
}
- }
}
void wxFileHistory::RemoveFileFromHistory(size_t i)
{
- wxCHECK_RET( i < m_fileHistoryN,
+ wxCHECK_RET( i < m_fileHistory.GetCount(),
wxT("invalid index in wxFileHistory::RemoveFileFromHistory") );
- // delete the element from the array (could use memmove() too...)
- delete [] m_fileHistory[i];
-
- size_t j;
- for ( j = i; j < m_fileHistoryN - 1; j++ )
- {
- m_fileHistory[j] = m_fileHistory[j + 1];
- }
+ // delete the element from the array
+ m_fileHistory.RemoveAt(i);
wxList::compatibility_iterator node = m_fileMenus.GetFirst();
while ( node )
// shuffle filenames up
wxString buf;
- for ( j = i; j < m_fileHistoryN - 1; j++ )
+ for ( size_t j = i; j < m_fileHistory.GetCount(); j++ )
{
- buf.Printf(s_MRUEntryFormat, j + 1, m_fileHistory[j]);
+ buf.Printf(s_MRUEntryFormat, j + 1, m_fileHistory[j].c_str());
menu->SetLabel(m_idBase + j, buf);
}
node = node->GetNext();
// delete the last menu item which is unused now
- wxWindowID lastItemId = m_idBase + wx_truncate_cast(wxWindowID, m_fileHistoryN) - 1;
+ wxWindowID lastItemId = m_idBase + wx_truncate_cast(wxWindowID, m_fileHistory.GetCount());
if (menu->FindItem(lastItemId))
{
menu->Delete(lastItemId);
}
// delete the last separator too if no more files are left
- if ( m_fileHistoryN == 1 )
+ if ( m_fileHistory.GetCount() == 0 )
{
wxMenuItemList::compatibility_iterator nodeLast = menu->GetMenuItems().GetLast();
if ( nodeLast )
//else: menu is empty somehow
}
}
-
- m_fileHistoryN--;
-}
-
-wxString wxFileHistory::GetHistoryFile(size_t i) const
-{
- wxString s;
- if ( i < m_fileHistoryN )
- {
- s = m_fileHistory[i];
- }
- else
- {
- wxFAIL_MSG( wxT("bad index in wxFileHistory::GetHistoryFile") );
- }
-
- return s;
}
void wxFileHistory::UseMenu(wxMenu *menu)
#if wxUSE_CONFIG
void wxFileHistory::Load(wxConfigBase& config)
{
- m_fileHistoryN = 0;
+ m_fileHistory.Clear();
+
wxString buf;
- buf.Printf(wxT("file%d"), (int)m_fileHistoryN+1);
+ buf.Printf(wxT("file%d"), 1);
+
wxString historyFile;
- while ((m_fileHistoryN < m_fileMaxFiles) && config.Read(buf, &historyFile) && (!historyFile.empty()))
+ while ((m_fileHistory.GetCount() < m_fileMaxFiles) &&
+ config.Read(buf, &historyFile) && !historyFile.empty())
{
- m_fileHistory[m_fileHistoryN] = MYcopystring((const wxChar*) historyFile);
- m_fileHistoryN ++;
- buf.Printf(wxT("file%d"), (int)m_fileHistoryN+1);
+ m_fileHistory.Add(historyFile);
+
+ buf.Printf(wxT("file%d"), (int)m_fileHistory.GetCount()+1);
historyFile = wxEmptyString;
}
+
AddFilesToMenu();
}
{
wxString buf;
buf.Printf(wxT("file%d"), (int)i+1);
- if (i < m_fileHistoryN)
+ if (i < m_fileHistory.GetCount())
config.Write(buf, wxString(m_fileHistory[i]));
else
config.Write(buf, wxEmptyString);
void wxFileHistory::AddFilesToMenu()
{
- if (m_fileHistoryN > 0)
+ if (m_fileHistory.GetCount() > 0)
{
wxList::compatibility_iterator node = m_fileMenus.GetFirst();
while (node)
}
size_t i;
- for (i = 0; i < m_fileHistoryN; i++)
- {
- if (m_fileHistory[i])
+ for (i = 0; i < m_fileHistory.GetCount(); i++)
{
wxString buf;
- buf.Printf(s_MRUEntryFormat, i+1, m_fileHistory[i]);
+ buf.Printf(s_MRUEntryFormat, i+1, m_fileHistory[i].c_str());
menu->Append(m_idBase+i, buf);
}
- }
node = node->GetNext();
}
}
void wxFileHistory::AddFilesToMenu(wxMenu* menu)
{
- if (m_fileHistoryN > 0)
+ if (m_fileHistory.GetCount() > 0)
{
if (menu->GetMenuItemCount())
{
}
size_t i;
- for (i = 0; i < m_fileHistoryN; i++)
- {
- if (m_fileHistory[i])
+ for (i = 0; i < m_fileHistory.GetCount(); i++)
{
wxString buf;
- buf.Printf(s_MRUEntryFormat, i+1, m_fileHistory[i]);
+ buf.Printf(s_MRUEntryFormat, i+1, m_fileHistory[i].c_str());
menu->Append(m_idBase+i, buf);
}
}
- }
}
// ----------------------------------------------------------------------------
// change current group
size_t n;
m_pCurrentGroup = m_pRootGroup;
- for ( n = 0; n < aParts.Count(); n++ ) {
+ for ( n = 0; n < aParts.GetCount(); n++ ) {
wxFileConfigGroup *pNextGroup = m_pCurrentGroup->FindSubgroup(aParts[n]);
if ( pNextGroup == NULL )
{
// recombine path parts in one variable
m_strPath.Empty();
- for ( n = 0; n < aParts.Count(); n++ ) {
+ for ( n = 0; n < aParts.GetCount(); n++ ) {
m_strPath << wxCONFIG_PATH_SEPARATOR << aParts[n];
}
bool wxFileConfig::GetNextGroup (wxString& str, long& lIndex) const
{
- if ( size_t(lIndex) < m_pCurrentGroup->Groups().Count() ) {
+ if ( size_t(lIndex) < m_pCurrentGroup->Groups().GetCount() ) {
str = m_pCurrentGroup->Groups()[(size_t)lIndex++]->Name();
return true;
}
bool wxFileConfig::GetNextEntry (wxString& str, long& lIndex) const
{
- if ( size_t(lIndex) < m_pCurrentGroup->Entries().Count() ) {
+ if ( size_t(lIndex) < m_pCurrentGroup->Entries().GetCount() ) {
str = m_pCurrentGroup->Entries()[(size_t)lIndex++]->Name();
return true;
}
size_t wxFileConfig::GetNumberOfEntries(bool bRecursive) const
{
- size_t n = m_pCurrentGroup->Entries().Count();
+ size_t n = m_pCurrentGroup->Entries().GetCount();
if ( bRecursive ) {
wxFileConfigGroup *pOldCurrentGroup = m_pCurrentGroup;
- size_t nSubgroups = m_pCurrentGroup->Groups().Count();
+ size_t nSubgroups = m_pCurrentGroup->Groups().GetCount();
for ( size_t nGroup = 0; nGroup < nSubgroups; nGroup++ ) {
CONST_CAST m_pCurrentGroup = m_pCurrentGroup->Groups()[nGroup];
n += GetNumberOfEntries(true);
size_t wxFileConfig::GetNumberOfGroups(bool bRecursive) const
{
- size_t n = m_pCurrentGroup->Groups().Count();
+ size_t n = m_pCurrentGroup->Groups().GetCount();
if ( bRecursive ) {
wxFileConfigGroup *pOldCurrentGroup = m_pCurrentGroup;
- size_t nSubgroups = m_pCurrentGroup->Groups().Count();
+ size_t nSubgroups = m_pCurrentGroup->Groups().GetCount();
for ( size_t nGroup = 0; nGroup < nSubgroups; nGroup++ ) {
CONST_CAST m_pCurrentGroup = m_pCurrentGroup->Groups()[nGroup];
n += GetNumberOfGroups(true);
wxFileConfigGroup::~wxFileConfigGroup()
{
// entries
- size_t n, nCount = m_aEntries.Count();
+ size_t n, nCount = m_aEntries.GetCount();
for ( n = 0; n < nCount; n++ )
delete m_aEntries[n];
// subgroups
- nCount = m_aSubgroups.Count();
+ nCount = m_aSubgroups.GetCount();
for ( n = 0; n < nCount; n++ )
delete m_aSubgroups[n];
}
// also update all subgroups as they have this groups name in their lines
- const size_t nCount = m_aSubgroups.Count();
+ const size_t nCount = m_aSubgroups.GetCount();
for ( size_t n = 0; n < nCount; n++ )
{
m_aSubgroups[n]->UpdateGroupAndSubgroupsLines();
{
size_t i,
lo = 0,
- hi = m_aEntries.Count();
+ hi = m_aEntries.GetCount();
int res;
wxFileConfigEntry *pEntry;
{
size_t i,
lo = 0,
- hi = m_aSubgroups.Count();
+ hi = m_aSubgroups.GetCount();
int res;
wxFileConfigGroup *pGroup;
: wxEmptyString );
// delete all entries...
- size_t nCount = pGroup->m_aEntries.Count();
+ size_t nCount = pGroup->m_aEntries.GetCount();
wxLogTrace(FILECONF_TRACE_MASK,
_T("Removing %lu entries"), (unsigned long)nCount );
}
// ...and subgroups of this subgroup
- nCount = pGroup->m_aSubgroups.Count();
+ nCount = pGroup->m_aSubgroups.GetCount();
wxLogTrace( FILECONF_TRACE_MASK,
_T("Removing %lu subgroups"), (unsigned long)nCount );
// our last entry is being deleted, so find the last one which
// stays by going back until we find a subgroup or reach the
// group line
- const size_t nSubgroups = m_aSubgroups.Count();
+ const size_t nSubgroups = m_aSubgroups.GetCount();
m_pLastGroup = NULL;
for ( wxFileConfigLineList *pl = pLine->Prev();
// go back until we find another entry or reach the group's line
wxFileConfigEntry *pNewLast = NULL;
- size_t n, nEntries = m_aEntries.Count();
+ size_t n, nEntries = m_aEntries.GetCount();
wxFileConfigLineList *pl;
for ( pl = pLine->Prev(); pl != m_pLine; pl = pl->Prev() ) {
// is it our subgroup?
bool foundIt = false;
size_t i;
- for ( i = 0; !foundIt && i < fileList.Count(); i++ )
+ for ( i = 0; !foundIt && i < fileList.GetCount(); i++ )
{
foundIt = fileList[i].Upper().Contains(fileName.Upper());
}
// we take MAX_LINES_SCAN in the beginning, middle and the end of buffer
#define MAX_LINES_SCAN (10)
- size_t nCount = m_aLines.Count() / 3,
+ size_t nCount = m_aLines.GetCount() / 3,
nScan = nCount > 3*MAX_LINES_SCAN ? MAX_LINES_SCAN : nCount / 3;
#define AnalyseLine(n) \
}
else
{
- // MYcopystring - for easier search...
out = new wxChar[s.length() + 1];
wxStrcpy(out, s.c_str());
}
// Add the sorted dirs
size_t i;
- for (i = 0; i < dirs.Count(); i++)
+ for (i = 0; i < dirs.GetCount(); i++)
{
eachFilename = dirs[i];
path = dirName;
// Add the sorted filenames
if ((GetWindowStyle() & wxDIRCTRL_DIR_ONLY) == 0)
{
- for (i = 0; i < filenames.Count(); i++)
+ for (i = 0; i < filenames.GetCount(); i++)
{
eachFilename = filenames[i];
path = dirName;
wxGridRowOrColAttrData::~wxGridRowOrColAttrData()
{
- size_t count = m_attrs.Count();
+ size_t count = m_attrs.GetCount();
for ( size_t n = 0; n < count; n++ )
{
m_attrs[n]->DecRef();
wxGridTypeRegistry::~wxGridTypeRegistry()
{
- size_t count = m_typeinfo.Count();
+ size_t count = m_typeinfo.GetCount();
for ( size_t i = 0; i < count; i++ )
delete m_typeinfo[i];
}
wxString title;
title.Printf(titleFormat, appName.c_str());
- size_t nMsgCount = m_aMessages.Count();
+ size_t nMsgCount = m_aMessages.GetCount();
// avoid showing other log dialogs until we're done with the dialog we're
// showing right now: nested modal dialogs make for really bad UI!
void wxGenericTreeItem::DeleteChildren(wxGenericTreeCtrl *tree)
{
- size_t count = m_children.Count();
+ size_t count = m_children.GetCount();
for ( size_t n = 0; n < count; n++ )
{
wxGenericTreeItem *child = m_children[n];
size_t wxGenericTreeItem::GetChildrenCount(bool recursively) const
{
- size_t count = m_children.Count();
+ size_t count = m_children.GetCount();
if ( !recursively )
return count;
if (IsExpanded())
{
- size_t count = m_children.Count();
+ size_t count = m_children.GetCount();
for ( size_t n = 0; n < count; ++n )
{
m_children[n]->GetSize( x, y, theButton );
}
// evaluate children
- size_t count = m_children.Count();
+ size_t count = m_children.GetCount();
for ( size_t n = 0; n < count; n++ )
{
wxGenericTreeItem *res = m_children[n]->HitTest( point,
// it's ok to cast cookie to size_t, we never have indices big enough to
// overflow "void *"
size_t *pIndex = (size_t *)&cookie;
- if ( *pIndex < children.Count() )
+ if ( *pIndex < children.GetCount() )
{
return children.Item((*pIndex)++);
}
wxASSERT( index != wxNOT_FOUND ); // I'm not a child of my parent?
size_t n = (size_t)(index + 1);
- return n == siblings.Count() ? wxTreeItemId() : wxTreeItemId(siblings[n]);
+ return n == siblings.GetCount() ? wxTreeItemId() : wxTreeItemId(siblings[n]);
}
wxTreeItemId wxGenericTreeCtrl::GetPrevSibling(const wxTreeItemId& item) const
#if 0 // TODO why should items be collapsed recursively?
wxArrayGenericTreeItems& children = item->GetChildren();
- size_t count = children.Count();
+ size_t count = children.GetCount();
for ( size_t n = 0; n < count; n++ )
{
Collapse(children[n]);
if (item->HasChildren())
{
wxArrayGenericTreeItems& children = item->GetChildren();
- size_t count = children.Count();
+ size_t count = children.GetCount();
for ( size_t n = 0; n < count; ++n )
{
UnselectAllChildren(children[n]);
int index = children.Index(crt_item);
wxASSERT( index != wxNOT_FOUND ); // I'm not a child of my parent?
- size_t count = children.Count();
+ size_t count = children.GetCount();
for (size_t n=(size_t)(index+1); n<count; ++n)
{
if (TagAllChildrenUntilLast(children[n], last_item, select)) return true;
if (crt_item->HasChildren())
{
wxArrayGenericTreeItems& children = crt_item->GetChildren();
- size_t count = children.Count();
+ size_t count = children.GetCount();
for ( size_t n = 0; n < count; ++n )
{
if (TagAllChildrenUntilLast(children[n], last_item, select))
}
//else: the tree is empty, so no selections
- return array.Count();
+ return array.GetCount();
}
void wxGenericTreeCtrl::EnsureVisible(const wxTreeItemId& item)
wxT("wxGenericTreeCtrl::SortChildren is not reentrant") );
wxArrayGenericTreeItems& children = item->GetChildren();
- if ( children.Count() > 1 )
+ if ( children.GetCount() > 1 )
{
m_dirty = true;
// always expand hidden root
int origY = y;
wxArrayGenericTreeItems& children = item->GetChildren();
- int count = children.Count();
+ int count = children.GetCount();
if (count > 0)
{
int n = 0, oldY;
if (item->IsExpanded())
{
wxArrayGenericTreeItems& children = item->GetChildren();
- int count = children.Count();
+ int count = children.GetCount();
if (count > 0)
{
int n = 0, oldY;
Recurse:
wxArrayGenericTreeItems& children = item->GetChildren();
- size_t n, count = children.Count();
+ size_t n, count = children.GetCount();
++level;
for (n = 0; n < count; ++n )
CalculateLevel( children[n], dc, level, y ); // recurse
void wxHtmlPrintout::GetPageInfo(int *minPage, int *maxPage, int *selPageFrom, int *selPageTo)
{
*minPage = 1;
- if ( m_NumPages >= (signed)m_PageBreaks.Count()-1)
+ if ( m_NumPages >= (signed)m_PageBreaks.GetCount()-1)
*maxPage = m_NumPages;
else
- *maxPage = (signed)m_PageBreaks.Count()-1;
+ *maxPage = (signed)m_PageBreaks.GetCount()-1;
*selPageFrom = 1;
- *selPageTo = (signed)m_PageBreaks.Count()-1;
+ *selPageTo = (signed)m_PageBreaks.GetCount()-1;
}
bool wxHtmlPrintout::HasPage(int pageNum)
{
- return pageNum > 0 && (unsigned)pageNum < m_PageBreaks.Count();
+ return pageNum > 0 && (unsigned)pageNum < m_PageBreaks.GetCount();
}
m_PageBreaks,
pos, true, INT_MAX);
m_PageBreaks.Add( pos);
- if( m_PageBreaks.Count() > wxHTML_PRINT_MAX_PAGES)
+ if( m_PageBreaks.GetCount() > wxHTML_PRINT_MAX_PAGES)
{
wxMessageBox( _("HTML pagination algorithm generated more than the allowed maximum number of pages and it can't continue any longer!"),
_("Warning"), wxCANCEL | wxICON_ERROR );
num.Printf(wxT("%i"), page);
r.Replace(wxT("@PAGENUM@"), num);
- num.Printf(wxT("%lu"), (unsigned long)(m_PageBreaks.Count() - 1));
+ num.Printf(wxT("%lu"), (unsigned long)(m_PageBreaks.GetCount() - 1));
r.Replace(wxT("@PAGESCNT@"), num);
const wxDateTime now = wxDateTime::Now();
// vertical position. Otherwise we'd be setting a pagebreak above
// the current cell, which is incorrect, or duplicating a
// pagebreak that has already been set.
- if( known_pagebreaks.Count() == 0 || *pagebreak <= m_PosY)
+ if( known_pagebreaks.GetCount() == 0 || *pagebreak <= m_PosY)
{
return false;
}
wxStrncpy(s,theText,len);
s[len]=0;
- // wxChar *s = copystring(theText);
-
// Obsolete in WIN32
#ifndef __WIN32__
UnlockResource(hData);
wxString str;
wxArrayString output;
if(wxExecute(wxT("kde-config --path ")+request, output) == 0 &&
- output.Count() > 0)
+ output.GetCount() > 0)
str = output.Item(0);
return str;
}
static wxString GetKDETheme(const wxArrayString& basedirs)
{
wxString theme;
- for(size_t i = 0; i < basedirs.Count(); i++) {
+ for(size_t i = 0; i < basedirs.GetCount(); i++) {
wxFileName filename(basedirs.Item(i), wxEmptyString);
filename.AppendDir( wxT("share") );
filename.AppendDir( wxT("config") );
}
// If $KDEDIRS and $KDEDIR were set, we try nothing more. Otherwise, we
// try to get the configuration file with 'kde-config'.
- if(basedirs.Count() > 1)
+ if(basedirs.GetCount() > 1)
return theme;
wxString paths = ReadPathFromKDEConfig(wxT("config"));
if(! paths.IsEmpty()) {
if(theme.IsEmpty())
theme = wxT("default.kde");
- for(size_t i = 0; i < basedirs.Count(); i++) {
+ for(size_t i = 0; i < basedirs.GetCount(); i++) {
wxFileName dirname(basedirs.Item(i), wxEmptyString);
dirname.AppendDir( wxT("share") );
dirname.AppendDir( wxT("icons") );
}
// If $KDEDIRS and $KDEDIR were not set, use 'kde-config'
- if(basedirs.Count() > 1)
+ if(basedirs.GetCount() > 1)
return;
wxString paths = ReadPathFromKDEConfig(wxT("icon"));
if(! paths.IsEmpty()) {
static void GetKDEMimeDirs(const wxArrayString& basedirs,
wxArrayString& mimedirs)
{
- for(size_t i = 0; i < basedirs.Count(); i++) {
+ for(size_t i = 0; i < basedirs.GetCount(); i++) {
wxFileName dirname(basedirs.Item(i), wxEmptyString);
dirname.AppendDir( wxT("share") );
dirname.AppendDir( wxT("mimelnk") );
}
// If $KDEDIRS and $KDEDIR were not set, use 'kde-config'
- if(basedirs.Count() > 1)
+ if(basedirs.GetCount() > 1)
return;
wxString paths = ReadPathFromKDEConfig(wxT("mime"));
if(! paths.IsEmpty()) {
static void GetKDEAppsDirs(const wxArrayString& basedirs,
wxArrayString& appsdirs)
{
- for(size_t i = 0; i < basedirs.Count(); i++) {
+ for(size_t i = 0; i < basedirs.GetCount(); i++) {
wxFileName dirname(basedirs.Item(i), wxEmptyString);
dirname.AppendDir( wxT("share") );
dirname.AppendDir( wxT("applnk") );
}
// If $KDEDIRS and $KDEDIR were not set, use 'kde-config'
- if(basedirs.Count() > 1)
+ if(basedirs.GetCount() > 1)
return;
wxString paths = ReadPathFromKDEConfig(wxT("apps"));
if(! paths.IsEmpty()) {
}
// check data integrity
- wxASSERT( m_aTypes.Count() == m_aEntries.Count() &&
- m_aTypes.Count() == m_aExtensions.Count() &&
- m_aTypes.Count() == m_aIcons.Count() &&
- m_aTypes.Count() == m_aDescriptions.Count() );
+ wxASSERT( m_aTypes.GetCount() == m_aEntries.GetCount() &&
+ m_aTypes.GetCount() == m_aExtensions.GetCount() &&
+ m_aTypes.GetCount() == m_aIcons.GetCount() &&
+ m_aTypes.GetCount() == m_aDescriptions.GetCount() );
return nIndex;
}
index = wxNOT_FOUND;
wxString strCategory = mimetype.BeforeFirst(wxT('/'));
- size_t nCount = m_aTypes.Count();
+ size_t nCount = m_aTypes.GetCount();
for ( size_t n = 0; n < nCount; n++ )
{
if ( (m_aTypes[n].BeforeFirst(wxT('/')) == strCategory ) &&
}
}
// check data integrity
- wxASSERT( m_aTypes.Count() == m_aEntries.Count() &&
- m_aTypes.Count() == m_aExtensions.Count() &&
- m_aTypes.Count() == m_aIcons.Count() &&
- m_aTypes.Count() == m_aDescriptions.Count() );
+ wxASSERT( m_aTypes.GetCount() == m_aEntries.GetCount() &&
+ m_aTypes.GetCount() == m_aExtensions.GetCount() &&
+ m_aTypes.GetCount() == m_aIcons.GetCount() &&
+ m_aTypes.GetCount() == m_aDescriptions.GetCount() );
return true;
}
size_t depth = GetLong( wxT("depth") );
- if( depth <= m_treeContext.Count() )
+ if( depth <= m_treeContext.GetCount() )
{
// first prepare the icon
int imgIndex = wxNOT_FOUND;
}
// then add the page to the corresponding parent
- if( depth < m_treeContext.Count() )
- m_treeContext.RemoveAt(depth, m_treeContext.Count() - depth );
+ if( depth < m_treeContext.GetCount() )
+ m_treeContext.RemoveAt(depth, m_treeContext.GetCount() - depth );
if( depth == 0)
{
m_tbk->AddPage(wnd,
file.Write(_T("class ") + m_className + _T(" : public ") + m_parentClassName
+ _T(" {\nprotected:\n"));
size_t i;
- for(i=0;i<m_wdata.Count();++i)
+ for(i=0;i<m_wdata.GetCount();++i)
{
const XRCWidgetData& w = m_wdata.Item(i);
if( !CanBeUsedWithXRCCTRL(w.GetClass()) ) continue;
+ _T("\"), _T(\"")
+ m_parentClassName
+ _T("\"));\n"));
- for(i=0;i<m_wdata.Count();++i)
+ for(i=0;i<m_wdata.GetCount();++i)
{
const XRCWidgetData& w = m_wdata.Item(i);
if( !CanBeUsedWithXRCCTRL(w.GetClass()) ) continue;
{
wxArrayString flist;
- for (size_t i = 0; i < parFiles.Count(); i++)
+ for (size_t i = 0; i < parFiles.GetCount(); i++)
{
if (flagVerbose)
wxPrintf(_T("processing ") + parFiles[i] + _T("...\n"));
void XmlResApp::DeleteTempFiles(const wxArrayString& flist)
{
- for (size_t i = 0; i < flist.Count(); i++)
+ for (size_t i = 0; i < flist.GetCount(); i++)
wxRemoveFile(parOutputPath + wxFILE_SEP_PATH + flist[i]);
}
{
wxString files;
- for (size_t i = 0; i < flist.Count(); i++)
+ for (size_t i = 0; i < flist.GetCount(); i++)
files += flist[i] + _T(" ");
files.RemoveLast();
_T("#include <wx/xrc/xh_all.h>\n")
_T("\n"));
- for (i = 0; i < flist.Count(); i++)
+ for (i = 0; i < flist.GetCount(); i++)
file.Write(
FileToCppArray(parOutputPath + wxFILE_SEP_PATH + flist[i], i));
_T(" }\n")
_T("\n"));
- for (i = 0; i < flist.Count(); i++)
+ for (i = 0; i < flist.GetCount(); i++)
{
wxString s;
s.Printf(_T(" wxMemoryFSHandler::AddFile(wxT(\"XRC_resource/") + flist[i] +
file.Write(s);
}
- for (i = 0; i < parFiles.Count(); i++)
+ for (i = 0; i < parFiles.GetCount(); i++)
{
file.Write(_T(" wxXmlResource::Get()->Load(wxT(\"memory:XRC_resource/") +
GetInternalFileName(parFiles[i], flist) + _T("\"));\n"));
_T("#ifndef __") + fileSpec + _T("_h__\n")
_T("#define __") + fileSpec + _T("_h__\n")
);
- for(size_t i=0;i<aXRCWndClassData.Count();++i){
+ for(size_t i=0;i<aXRCWndClassData.GetCount();++i){
aXRCWndClassData.Item(i).GenerateHeaderCode(file);
}
file.Write(
file.Write(_T("def ") + parFuncname + _T("():\n"));
- for (i = 0; i < flist.Count(); i++)
+ for (i = 0; i < flist.GetCount(); i++)
file.Write(
FileToPythonArray(parOutputPath + wxFILE_SEP_PATH + flist[i], i));
);
- for (i = 0; i < flist.Count(); i++)
+ for (i = 0; i < flist.GetCount(); i++)
{
wxString s;
s.Printf(_T(" wx.MemoryFSHandler.AddFile('XRC_resource/") + flist[i] +
_T("', xml_res_file_%i)\n"), i);
file.Write(s);
}
- for (i = 0; i < parFiles.Count(); i++)
+ for (i = 0; i < parFiles.GetCount(); i++)
{
file.Write(_T(" wx.xrc.XmlResource.Get().Load('memory:XRC_resource/") +
GetInternalFileName(parFiles[i], flist) + _T("')\n"));
{
wxArrayString arr, a2;
- for (size_t i = 0; i < parFiles.Count(); i++)
+ for (size_t i = 0; i < parFiles.GetCount(); i++)
{
if (flagVerbose)
wxPrintf(_T("processing ") + parFiles[i] + _T("...\n"));