当前位置: 首页>>代码示例>>C++>>正文


C++ wxArrayInt::Add方法代码示例

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


在下文中一共展示了wxArrayInt::Add方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: 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

示例2: 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

示例3: 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

示例4: 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

示例5: DoGetWordStarts

bool SpellCheckerPlugin::DoGetWordStarts(const wxString& word, wxArrayInt& wordStarts, int numWords)
{
    if (numWords <= 0) // finish split
    {
        wordStarts.Add(0); // first word
        wxString currWord;
        for (int i = wordStarts.GetCount() - 1; i > 0; --i) // reverse iteration (so numbers are checked lowest to highest)
        {
            currWord = word(wordStarts[i], wordStarts[i - 1] - wordStarts[i]);
            if (currWord.Length() > 3) // capitalize medium/long words so proper nouns work
                currWord = currWord(0, 1).Upper() + currWord.Mid(1);
            if (!m_pSpellChecker->IsWordInDictionary(currWord))
            {
                wordStarts.RemoveAt(wordStarts.GetCount() - 1);
                return false; // no, fall back a level
            }
        }
        currWord = word.Mid(wordStarts[0]);
        if (currWord.Length() > 3) // capitalize
            currWord = currWord(0, 1).Upper() + currWord.Mid(1);
        if (!m_pSpellChecker->IsWordInDictionary(currWord)) // last word (wordStarts[] is reverse sorted)
        {
            wordStarts.RemoveAt(wordStarts.GetCount() - 1);
            return false; // no, fall back a level
        }
        return true; // all parts are correctly spelled
    }

    // iterate through possibilities of the current word start
    for (int i = (wordStarts.IsEmpty() ? word.Length() : wordStarts[wordStarts.GetCount() - 1]) - 2;
         i >= numWords * 2; --i)
    {
        wordStarts.Add(i);
        if (DoGetWordStarts(word, wordStarts, numWords - 1))
        {
            return true; // yes, fall through and return
        }
        wordStarts.RemoveAt(wordStarts.GetCount() - 1);
    }
    return false; // no, fall back an iteration
}
开发者ID:Three-DS,项目名称:codeblocks-13.12,代码行数:41,代码来源:SpellCheckerPlugin.cpp

示例6: GetSelections

// Return number of selections and an array of selected integers
int wxListBox::GetSelections(wxArrayInt& aSelections) const
{
    aSelections.Empty();

    if ( HasMultipleSelection() )
    {
        int countSel = ListBox_GetSelCount(GetHwnd());
        if ( countSel == LB_ERR )
        {
            wxLogDebug(wxT("ListBox_GetSelCount failed"));
        }
        else if ( countSel != 0 )
        {
            int *selections = new int[countSel];

            if ( ListBox_GetSelItems(GetHwnd(),
                                     countSel, selections) == LB_ERR )
            {
                wxLogDebug(wxT("ListBox_GetSelItems failed"));
                countSel = -1;
            }
            else
            {
                aSelections.Alloc(countSel);
                for ( int n = 0; n < countSel; n++ )
                    aSelections.Add(selections[n]);
            }

            delete [] selections;
        }

        return countSel;
    }
    else  // single-selection listbox
    {
        if (ListBox_GetCurSel(GetHwnd()) > -1)
            aSelections.Add(ListBox_GetCurSel(GetHwnd()));

        return aSelections.Count();
    }
}
开发者ID:Zombiebest,项目名称:Dolphin,代码行数:42,代码来源:listbox.cpp

示例7: 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

示例8: 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

示例9: GetChoices

bool SaveTabGroupDlg::GetChoices(wxArrayInt& intArr) const
{
    bool SomeChecked = false;
    for(unsigned int n = 0; n < m_ListTabs->GetCount(); ++n) {
        bool item = m_ListTabs->IsChecked(n);
        intArr.Add(item);
        if(item) {
            SomeChecked = true;
        }
    }

    return SomeChecked;
}
开发者ID:05storm26,项目名称:codelite,代码行数:13,代码来源:tabgroupdlg.cpp

示例10: BuildPageFunctions

bool AutoCompData::BuildPageFunctions( const wxString& path, wxArrayString& functions, wxArrayInt& startLines, wxArrayInt& endLines ) const
{
   //wxASSERT( !path.IsEmpty() );

   // Find the right file...
   AutoCompPage* file = AutoCompPage::Find( path, m_Files );
   if ( !file )
      return false;

   // First grab all the functions.
   const AutoCompFunctionArray& funcs = file->GetFunctions();
   AutoCompFunction* func;
   for ( size_t i=0; i < funcs.GetCount(); i++ ) {

      func = funcs[i];
      wxASSERT( func );
      functions.Add( func->GetName() );
      startLines.Add( func->GetLine() );
      endLines.Add( func->GetLineLast() );
   }

   return true;
}
开发者ID:Duion,项目名称:Torsion,代码行数:23,代码来源:AutoCompData.cpp

示例11: GetPartialTextExtents

bool wxTextMeasureBase::GetPartialTextExtents(const wxString& text,
                                              wxArrayInt& widths,
                                              double scaleX)
{
    widths.Empty();
    if ( text.empty() )
        return true;

    MeasuringGuard guard(*this);

    widths.Add(0, text.length());

    return DoGetPartialTextExtents(text, widths, scaleX);
}
开发者ID:lpoujoulat,项目名称:wxWidgetsToolPalette,代码行数:14,代码来源:textmeasurecmn.cpp

示例12: GetCoversFromSamePath

// -------------------------------------------------------------------------------- //
void GetCoversFromSamePath( const wxString &path, wxArrayString &files, wxArrayString &paths, wxArrayInt &positions )
{
    int Index;
    int Count = files.Count();
    for( Index = 0; Index < Count; Index++ )
    {
        if( wxPathOnly( files[ Index ] ) == path )
        {
            paths.Add( files[ Index ] );
            positions.Add( Index );
        }
        else
            break;
    }
}
开发者ID:anonbeat,项目名称:guayadeque,代码行数:16,代码来源:LibUpdate.cpp

示例13: ListGetSelections

int wxMacDataBrowserListControl::ListGetSelections( wxArrayInt& aSelections ) const
{
    aSelections.Empty();
    wxArrayMacDataItemPtr selectedItems;
    GetItems( wxMacDataBrowserRootContainer, false , kDataBrowserItemIsSelected, selectedItems);

    int count = selectedItems.GetCount();

    for ( int i = 0; i < count; ++i)
    {
        aSelections.Add(GetLineFromItem(selectedItems[i]));
    }

    return count;
}
开发者ID:0ryuO,项目名称:dolphin-avsync,代码行数:15,代码来源:listbox.cpp

示例14: GetMediaViewerTracks

// -------------------------------------------------------------------------------- //
void GetMediaViewerTracks( const guTrackArray &sourcetracks, const int flags,
                                 const guMediaViewer * mediaviewer, guTrackArray &tracks, wxArrayInt &changedflags )
{
    int Index;
    int Count = sourcetracks.Count();
    for( Index = 0; Index < Count; Index++ )
    {
        guTrack &Track = sourcetracks[ Index ];
        if( Track.m_MediaViewer == mediaviewer )
        {
            tracks.Add( new guTrack( Track ) );
            changedflags.Add( flags );
        }
    }
}
开发者ID:Hreinnjons,项目名称:guayadeque,代码行数:16,代码来源:Utils.cpp

示例15: DoGetPartialTextExtents

bool wxGCDCImpl::DoGetPartialTextExtents(const wxString& text, wxArrayInt& widths) const
{
    wxCHECK_MSG( m_graphicContext, false, wxT("wxGCDC(cg)::DoGetPartialTextExtents - invalid DC") );
    widths.Clear();
    widths.Add(0,text.Length());
    if ( text.IsEmpty() )
        return true;

    wxArrayDouble widthsD;

    m_graphicContext->GetPartialTextExtents( text, widthsD );
    for ( size_t i = 0; i < widths.GetCount(); ++i )
        widths[i] = (wxCoord)(widthsD[i] + 0.5);

    return true;
}
开发者ID:animecomico,项目名称:wxWidgets,代码行数:16,代码来源:dcgraph.cpp


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