本文整理汇总了C++中wxArrayInt::push_back方法的典型用法代码示例。如果您正苦于以下问题:C++ wxArrayInt::push_back方法的具体用法?C++ wxArrayInt::push_back怎么用?C++ wxArrayInt::push_back使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类wxArrayInt
的用法示例。
在下文中一共展示了wxArrayInt::push_back方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: if
void
wxHeaderCtrlBase::DoResizeColumnIndices(wxArrayInt& colIndices, unsigned int count)
{
// update the column indices array if necessary
const unsigned countOld = colIndices.size();
if ( count > countOld )
{
// all new columns have default positions equal to their indices
for ( unsigned n = countOld; n < count; n++ )
colIndices.push_back(n);
}
else if ( count < countOld )
{
// filter out all the positions which are invalid now while keeping the
// order of the remaining ones
wxArrayInt colIndicesNew;
colIndicesNew.reserve(count);
for ( unsigned n = 0; n < countOld; n++ )
{
const unsigned idx = colIndices[n];
if ( idx < count )
colIndicesNew.push_back(idx);
}
colIndices.swap(colIndicesNew);
}
//else: count didn't really change, nothing to do
wxASSERT_MSG( colIndices.size() == count, "logic error" );
}
示例2: GetSelections
void WadListBox::GetSelections(wxArrayInt& selection) const {
selection.clear();
unsigned long cookie;
int index = GetFirstSelected(cookie);
while (index != wxNOT_FOUND) {
selection.push_back(index);
index = GetNextSelected(cookie);
}
}
示例3: GetCheckedItems
unsigned int wxCheckListBoxBase::GetCheckedItems(wxArrayInt& checkedItems) const
{
unsigned int const numberOfItems = GetCount();
checkedItems.clear();
for ( unsigned int i = 0; i < numberOfItems; ++i )
{
if ( IsChecked(i) )
checkedItems.push_back(i);
}
return checkedItems.size();
}
示例4: FindChanges
// returns all new dirs/files present in the immediate level of the dir
// pointed by watch.GetPath(). "new" means created between the last time
// the state of watch was computed and now
void FindChanges(wxFSWatchEntryKq& watch,
wxArrayString& changedFiles,
wxArrayInt& changedFlags)
{
wxFSWatchEntryKq::wxDirState old = watch.GetLastState();
watch.RefreshState();
wxFSWatchEntryKq::wxDirState curr = watch.GetLastState();
// iterate over old/curr file lists and compute changes
wxArrayString::iterator oit = old.files.begin();
wxArrayString::iterator cit = curr.files.begin();
for ( ; oit != old.files.end() && cit != curr.files.end(); )
{
if ( *cit == *oit )
{
++cit;
++oit;
}
else if ( *cit <= *oit )
{
changedFiles.push_back(*cit);
changedFlags.push_back(wxFSW_EVENT_CREATE);
++cit;
}
else // ( *cit > *oit )
{
changedFiles.push_back(*oit);
changedFlags.push_back(wxFSW_EVENT_DELETE);
++oit;
}
}
// border conditions
if ( oit == old.files.end() )
{
for ( ; cit != curr.files.end(); ++cit )
{
changedFiles.push_back( *cit );
changedFlags.push_back(wxFSW_EVENT_CREATE);
}
}
else if ( cit == curr.files.end() )
{
for ( ; oit != old.files.end(); ++oit )
{
changedFiles.push_back( *oit );
changedFlags.push_back(wxFSW_EVENT_DELETE);
}
}
wxASSERT( changedFiles.size() == changedFlags.size() );
#if 0
wxLogTrace(wxTRACE_FSWATCHER, "Changed files:");
wxArrayString::iterator it = changedFiles.begin();
wxArrayInt::iterator it2 = changedFlags.begin();
for ( ; it != changedFiles.end(); ++it, ++it2)
{
wxString action = (*it2 == wxFSW_EVENT_CREATE) ?
"created" : "deleted";
wxLogTrace(wxTRACE_FSWATCHER, wxString::Format("File: '%s' %s",
*it, action));
}
#endif
}