本文整理汇总了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;
}
示例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;
}
示例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;
}
示例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();
}
示例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
}
示例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();
}
}
示例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);
}
}
}
示例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();
}
示例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;
}
示例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;
}
示例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);
}
示例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;
}
}
示例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;
}
示例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 );
}
}
}
示例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;
}