• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ wxArrayInt类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中wxArrayInt的典型用法代码示例。如果您正苦于以下问题:C++ wxArrayInt类的具体用法?C++ wxArrayInt怎么用?C++ wxArrayInt使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了wxArrayInt类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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;

	}
}
开发者ID:BackupTheBerlios,项目名称:musik-svn,代码行数:33,代码来源:MusikPlayer.cpp


示例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;
}
开发者ID:eranif,项目名称:codelite,代码行数:7,代码来源:dotwriter.cpp


示例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);
}
开发者ID:qioixiy,项目名称:codelite,代码行数:33,代码来源:mainbook.cpp


示例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;
}
开发者ID:Bluehorn,项目名称:wxPython,代码行数:29,代码来源:listbox.cpp


示例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;
}
开发者ID:hgwells,项目名称:tive,代码行数:28,代码来源:listbox.cpp


示例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);
}
开发者ID:yinglang,项目名称:newton-dynamics,代码行数:31,代码来源:headerctrlcmn.cpp


示例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();
}
开发者ID:maxmods,项目名称:wx.mod,代码行数:34,代码来源:fiximp.cpp


示例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;
}
开发者ID:EdgarTx,项目名称:wx,代码行数:27,代码来源:dcgraph.cpp


示例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" );
}
开发者ID:yinglang,项目名称:newton-dynamics,代码行数:30,代码来源:headerctrlcmn.cpp


示例10: DoGetColumnsOrder

wxArrayInt wxHeaderCtrlBase::GetColumnsOrder() const
{
    const wxArrayInt order = DoGetColumnsOrder();

    wxASSERT_MSG( order.size() == GetColumnCount(), "invalid order array" );

    return order;
}
开发者ID:yinglang,项目名称:newton-dynamics,代码行数:8,代码来源:headerctrlcmn.cpp


示例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;
	}
}
开发者ID:EvgeniiFrolov,项目名称:myrulib,代码行数:9,代码来源:FbAuthList.cpp


示例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);
            }
        }
开发者ID:WakaLakaLake,项目名称:TrenchBroom,代码行数:10,代码来源:MapPropertiesDialog.cpp


示例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();
 }
开发者ID:WakaLakaLake,项目名称:TrenchBroom,代码行数:10,代码来源:MapPropertiesDialog.cpp


示例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();
}
开发者ID:oneeyeman1,项目名称:BaseballDraft,代码行数:11,代码来源:newplayerpositions.cpp


示例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;
}
开发者ID:3v1n0,项目名称:wxWidgets,代码行数:12,代码来源:headerctrlcmn.cpp


示例16: GetCheckedItems

void xLightsFrame::GetCheckedItems(wxArrayInt& chArray)
{
    chArray.Clear();
    int maxch = CheckListBoxTestChannels->GetCount();
    for (int ch=0; ch < maxch; ch++)
    {
        if (CheckListBoxTestChannels->IsChecked(ch))
        {
            chArray.Add(ch);
        }
    }
}
开发者ID:josephcsible,项目名称:xLights,代码行数:12,代码来源:TabTest.cpp


示例17: Query

void CMusikLibrary::Query( const wxString & query, wxArrayInt & aReturn ,bool bClearArray )
{
	if(bClearArray)
	{

		aReturn.Clear();
		//--- run the query ---//
		aReturn.Alloc( GetSongCount() );
	}
    MusikDb::ResultCB cb(&aReturn, &db_callbackAddToIntArray);
 	m_pDB->Exec( ConvQueryToMB( query ), cb );
}
开发者ID:BackupTheBerlios,项目名称:musik-svn,代码行数:12,代码来源:MusikLibrary.cpp


示例18: GetSelections

int wxCheckListBox::GetSelections(wxArrayInt& aSelections) const
{
    int i;
    for (i = 0; (unsigned int)i < GetCount(); i++)
    {
        int selState = ListView_GetItemState(GetHwnd(), i, LVIS_SELECTED);
        if (selState == LVIS_SELECTED)
            aSelections.Add(i);
    }

    return aSelections.GetCount();
}
开发者ID:0ryuO,项目名称:dolphin-avsync,代码行数:12,代码来源:checklst.cpp


示例19: MoveColumnInOrderArray

/* static */
void wxHeaderCtrlBase::MoveColumnInOrderArray(wxArrayInt& order,
                                              unsigned int idx,
                                              unsigned int pos)
{
    int posOld = order.Index(idx);
    wxASSERT_MSG( posOld != wxNOT_FOUND, "invalid index" );

    if ( pos != (unsigned int)posOld )
    {
        order.RemoveAt(posOld);
        order.Insert(idx, pos);
    }
}
开发者ID:3v1n0,项目名称:wxWidgets,代码行数:14,代码来源:headerctrlcmn.cpp


示例20: TabsEq

/// Compare tabs
bool wxTextAttr::TabsEq(const wxArrayInt& tabs1, const wxArrayInt& tabs2)
{
    if (tabs1.GetCount() != tabs2.GetCount())
        return false;

    size_t i;
    for (i = 0; i < tabs1.GetCount(); i++)
    {
        if (tabs1[i] != tabs2[i])
            return false;
    }
    return true;
}
开发者ID:czxxjtu,项目名称:wxPython-1,代码行数:14,代码来源:textcmn.cpp



注:本文中的wxArrayInt类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ wxArrayPtrVoid类代码示例发布时间:2022-05-31
下一篇:
C++ wxActivateEvent类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap