本文整理汇总了C++中wxArrayInt类的典型用法代码示例。如果您正苦于以下问题:C++ wxArrayInt类的具体用法?C++ wxArrayInt怎么用?C++ wxArrayInt使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了wxArrayInt类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: MovePlaylistEntrys
void CMusikPlayer::MovePlaylistEntrys(size_t nMoveTo ,const wxArrayInt &arrToMove)
{
//wxCriticalSectionLocker locker( m_critInternalData);
wxASSERT(nMoveTo >= 0 && nMoveTo <= m_Playlist.GetCount());
int i = arrToMove.GetCount() - 1;
// first move all entrys which are behind nMoveTo;
for(;i >= 0 ; i--)
{
if(nMoveTo > (size_t)arrToMove[i])
break;
size_t ToMoveIdx = arrToMove[i] + ( arrToMove.GetCount() - 1 - i);
m_Playlist.Insert(m_Playlist.Detach(ToMoveIdx),nMoveTo);
if(ToMoveIdx > m_SongIndex && nMoveTo <= m_SongIndex)
m_SongIndex++;
else if(ToMoveIdx == m_SongIndex)
m_SongIndex = nMoveTo;
}
// now move all entry which are before
for(int j = i; j >= 0; j--)
{
size_t MoveToIdx = nMoveTo - (i - j) - 1;
m_Playlist.Insert(m_Playlist.Detach(arrToMove[j]),MoveToIdx);
if((size_t)arrToMove[j] < m_SongIndex && MoveToIdx > m_SongIndex)
m_SongIndex--;
else if( m_SongIndex == MoveToIdx)
m_SongIndex++;
else if((size_t)arrToMove[j] == m_SongIndex)
m_SongIndex = MoveToIdx;
}
}
示例2: IsInArray
bool DotWriter::IsInArray(int index, const wxArrayInt& arr)
{
for(unsigned int i = 0; i < arr.GetCount(); i++) {
if(arr.Item(i) == index) return true;
}
return false;
}
示例3: SaveSession
void MainBook::SaveSession(SessionEntry &session, wxArrayInt& intArr)
{
std::vector<LEditor*> editors;
bool retain_order(true);
GetAllEditors(editors, retain_order);
session.SetSelectedTab(0);
std::vector<TabInfo> vTabInfoArr;
for (size_t i = 0; i < editors.size(); i++) {
if ( (intArr.GetCount() > i) && (!intArr.Item(i)) ) {
// If we're saving only selected editors, and this isn't one of them...
continue;
}
if (editors[i] == GetActiveEditor()) {
session.SetSelectedTab(vTabInfoArr.size());
}
TabInfo oTabInfo;
oTabInfo.SetFileName(editors[i]->GetFileName().GetFullPath());
oTabInfo.SetFirstVisibleLine(editors[i]->GetFirstVisibleLine());
oTabInfo.SetCurrentLine(editors[i]->GetCurrentLine());
wxArrayString astrBookmarks;
editors[i]->StoreMarkersToArray(astrBookmarks);
oTabInfo.SetBookmarks(astrBookmarks);
std::vector<int> folds;
editors[i]->StoreCollapsedFoldsToArray(folds);
oTabInfo.SetCollapsedFolds(folds);
vTabInfoArr.push_back(oTabInfo);
}
session.SetTabInfoArr(vTabInfoArr);
}
示例4: GetSelections
int wxListBox::GetSelections( wxArrayInt& aSelections ) const
{
wxCHECK_MSG( m_list != NULL, wxNOT_FOUND, wxT("invalid listbox") );
// get the number of selected items first
GList *child = m_list->children;
int count = 0;
for (child = m_list->children; child != NULL; child = child->next)
{
if (GTK_WIDGET(child->data)->state == GTK_STATE_SELECTED)
count++;
}
aSelections.Empty();
if (count > 0)
{
// now fill the list
aSelections.Alloc(count); // optimization attempt
int i = 0;
for (child = m_list->children; child != NULL; child = child->next, i++)
{
if (GTK_WIDGET(child->data)->state == GTK_STATE_SELECTED)
aSelections.Add(i);
}
}
return count;
}
示例5: GetSelections
// Return number of selections and an array of selected integers
int wxListBox::GetSelections(wxArrayInt& aSelections) const
{
aSelections.Empty();
Widget listBox = (Widget) m_mainWidget;
int *posList = NULL;
int posCnt = 0;
bool flag = XmListGetSelectedPos (listBox, &posList, &posCnt);
if (flag)
{
if (posCnt > 0)
{
aSelections.Alloc(posCnt);
int i;
for (i = 0; i < posCnt; i++)
aSelections.Add(posList[i] - 1);
XtFree ((char *) posList);
return posCnt;
}
else
return 0;
}
else
return 0;
}
示例6: MoveColumnInOrderArray
/* static */
void wxHeaderCtrlBase::MoveColumnInOrderArray(wxArrayInt& order,
unsigned int idx,
unsigned int pos)
{
const unsigned count = order.size();
wxArrayInt orderNew;
orderNew.reserve(count);
for ( unsigned n = 0; ; n++ )
{
// NB: order of checks is important for this to work when the new
// column position is the same as the old one
// insert the column at its new position
if ( orderNew.size() == pos )
orderNew.push_back(idx);
if ( n == count )
break;
// delete the column from its old position
const unsigned idxOld = order[n];
if ( idxOld == idx )
continue;
orderNew.push_back(idxOld);
}
order.swap(orderNew);
}
示例7: SetValues
//Setting values
void wxFixWidthImportCtrl::SetValues(const wxArrayInt& values)
{
size_t nval = values.GetCount();
size_t i, j, tot;
int val;
m_values.Clear();
if ( nval < 1 )
{ Refresh();
FireEvent();
return;
}
//Add the first value
m_values.Add( values.Item(0) );
//Add/insert the rest, avoiding duplicates
for ( i=1; i<nval; i++)
{ j=0;
val = values.Item(i);
tot = m_values.GetCount();
while ( j < tot && val > m_values.Item(j) )
j++;
if ( j >= tot && val > m_values.Item(tot-1) )
m_values.Add(val);
if ( j < tot && val < m_values.Item(j) )
m_values.Insert(val, j);
}
Refresh();
FireEvent();
}
示例8: DoGetPartialTextExtents
bool wxGCDC::DoGetPartialTextExtents(const wxString& text, wxArrayInt& widths) const
{
bool isMeasuringContext = false;
wxGraphicsContext* context = m_graphicContext;
if (!context)
{
context = wxGraphicsRenderer::GetDefaultRenderer()->CreateMeasuringContext();
isMeasuringContext = true;
}
widths.Clear();
widths.Add(0,text.Length());
if ( text.IsEmpty() )
return true;
wxArrayDouble widthsD;
context->GetPartialTextExtents( text, widthsD );
for ( size_t i = 0; i < widths.GetCount(); ++i )
widths[i] = (wxCoord)(widthsD[i] + 0.5);
if (isMeasuringContext)
delete context;
return true;
}
示例9: 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" );
}
示例10: DoGetColumnsOrder
wxArrayInt wxHeaderCtrlBase::GetColumnsOrder() const
{
const wxArrayInt order = DoGetColumnsOrder();
wxASSERT_MSG( order.size() == GetColumnCount(), "invalid order array" );
return order;
}
示例11:
FbAuthListModel::FbAuthListModel(const wxArrayInt &items, int code)
{
m_position = items.Count() ? 1 : 0;
Append(items);
if (code) {
int i = items.Index(code);
if (i != wxNOT_FOUND) m_position = (size_t)i + 1;
}
}
示例12: 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);
}
}
示例13: removeWads
void WadListBox::removeWads(const wxArrayInt& indices) {
StringList newList;
for (size_t i = 0; i < m_wadFiles.size(); i++) {
if (std::find(indices.begin(), indices.end(), i) == indices.end())
newList.push_back(m_wadFiles[i]);
}
m_wadFiles = newList;
SetItemCount(m_wadFiles.size());
Refresh();
}
示例14: GetCheckedItems
unsigned int PositionsPopup::GetCheckedItems(wxArrayInt &checkedItems) const
{
unsigned int const itemsCount = GetCount();
checkedItems.Empty();
for( unsigned int i = 0; i < itemsCount; ++i )
{
if( IsChecked( i ) )
checkedItems.Add( i );
}
return checkedItems.GetCount();
}
示例15: GetColumnCount
unsigned int wxHeaderCtrlBase::GetColumnPos(unsigned int idx) const
{
const unsigned count = GetColumnCount();
wxCHECK_MSG( idx < count, wxNO_COLUMN, "invalid index" );
const wxArrayInt order = GetColumnsOrder();
int pos = order.Index(idx);
wxCHECK_MSG( pos != wxNOT_FOUND, wxNO_COLUMN, "column unexpectedly not displayed at all" );
return (unsigned int)pos;
}