本文整理汇总了C++中wxArrayInt::GetCount方法的典型用法代码示例。如果您正苦于以下问题:C++ wxArrayInt::GetCount方法的具体用法?C++ wxArrayInt::GetCount怎么用?C++ wxArrayInt::GetCount使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类wxArrayInt
的用法示例。
在下文中一共展示了wxArrayInt::GetCount方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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;
}
示例2: RegisterScriptPlugin
bool ScriptingManager::RegisterScriptPlugin(const wxString& /*name*/, const wxArrayInt& ids)
{
// attach this event handler in the main window (one-time run)
if (!m_AttachedToMainWindow)
{
Manager::Get()->GetAppWindow()->PushEventHandler(this);
m_AttachedToMainWindow = true;
}
for (size_t i = 0; i < ids.GetCount(); ++i)
{
Connect(ids[i], -1, wxEVT_COMMAND_MENU_SELECTED,
(wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction)
&ScriptingManager::OnScriptPluginMenu);
}
return true;
}
示例3: SetSelections
void wxMultiChoiceDialog::SetSelections(const wxArrayInt& selections)
{
// first clear all currently selected items
size_t n,
count = m_listbox->GetCount();
for ( n = 0; n < count; ++n )
{
m_listbox->Deselect(n);
}
// now select the ones which should be selected
count = selections.GetCount();
for ( n = 0; n < count; n++ )
{
m_listbox->Select(selections[n]);
}
}
示例4: WXUNUSED
bool
wxHtmlPageBreakCell::AdjustPagebreak(int* pagebreak,
const wxArrayInt& known_pagebreaks,
int WXUNUSED(pageHeight)) const
{
// When we are counting pages, 'known_pagebreaks' is non-NULL.
// That's the only time we change 'pagebreak'. Otherwise, pages
// were already counted, 'known_pagebreaks' is NULL, and we don't
// do anything except return false.
//
// We also simply return false if the 'pagebreak' argument is
// less than (vertically above) or the same as the current
// vertical position. Otherwise we'd be setting a pagebreak above
// the current cell, which is incorrect, or duplicating a
// pagebreak that has already been set.
if( known_pagebreaks.GetCount() == 0 || *pagebreak <= m_PosY)
{
return false;
}
// m_PosY is only the vertical offset from the parent. The pagebreak
// required here is the total page offset, so m_PosY must be added
// to the parent's offset and height.
int total_height = m_PosY;
for ( wxHtmlCell *parent = GetParent(); parent; parent = parent->GetParent() )
{
total_height += parent->GetPosY();
}
// Search the array of pagebreaks to see whether we've already set
// a pagebreak here.
int where = known_pagebreaks.Index( total_height);
// Add a pagebreak only if there isn't one already set here.
if( wxNOT_FOUND != where)
{
return false;
}
else
{
*pagebreak = m_PosY;
return true;
}
}
示例5: wxGetMultipleChoices
size_t wxGetMultipleChoices(wxArrayInt& selections,
const wxString& message,
const wxString& caption,
int n, const wxString *choices,
wxWindow *parent,
int WXUNUSED(x), int WXUNUSED(y),
bool WXUNUSED(centre),
int WXUNUSED(width), int WXUNUSED(height))
{
wxMultiChoiceDialog dialog(parent, message, caption, n, choices);
// call this even if selections array is empty and this then (correctly)
// deselects the first item which is selected by default
dialog.SetSelections(selections);
if ( dialog.ShowModal() == wxID_OK )
selections = dialog.GetSelections();
else
selections.Empty();
return selections.GetCount();
}
示例6: GetSelections
int wxListBox::GetSelections( wxArrayInt& aSelections ) const
{
wxCHECK_MSG( m_treeview != NULL, wxNOT_FOUND, wxT("invalid listbox") );
aSelections.Empty();
int i = 0;
GtkTreeIter iter;
GtkTreeSelection* selection = gtk_tree_view_get_selection(m_treeview);
if (gtk_tree_model_get_iter_first(GTK_TREE_MODEL(m_liststore), &iter))
{ //gtk_tree_selection_get_selected_rows is GTK 2.2+ so iter instead
do
{
if (gtk_tree_selection_iter_is_selected(selection, &iter))
aSelections.Add(i);
i++;
} while(gtk_tree_model_iter_next(GTK_TREE_MODEL(m_liststore), &iter));
}
return aSelections.GetCount();
}
示例7: SetSelections
void wxMultiChoiceDialog::SetSelections(const wxArrayInt& selections)
{
#if wxUSE_CHECKLISTBOX
wxCheckListBox* checkListBox = wxDynamicCast(m_listbox, wxCheckListBox);
if (checkListBox)
{
// first clear all currently selected items
size_t n,
count = checkListBox->GetCount();
#if defined(__INTEL_COMPILER) && 1 /* VDM auto patch */
# pragma ivdep
# pragma swp
# pragma unroll
# pragma prefetch
# if 0
# pragma simd noassert
# endif
#endif /* VDM auto patch */
for ( n = 0; n < count; ++n )
{
if (checkListBox->IsChecked(n))
checkListBox->Check(n, false);
}
// now select the ones which should be selected
count = selections.GetCount();
#if defined(__INTEL_COMPILER) && 1 /* VDM auto patch */
# pragma ivdep
# pragma swp
# pragma unroll
# pragma prefetch
# if 0
# pragma simd noassert
# endif
#endif /* VDM auto patch */
for ( n = 0; n < count; n++ )
{
checkListBox->Check(selections[n]);
}
return;
}
#endif
// first clear all currently selected items
size_t n,
count = m_listbox->GetCount();
#if defined(__INTEL_COMPILER) && 1 /* VDM auto patch */
# pragma ivdep
# pragma swp
# pragma unroll
# pragma prefetch
# if 0
# pragma simd noassert
# endif
#endif /* VDM auto patch */
for ( n = 0; n < count; ++n )
{
m_listbox->Deselect(n);
}
// now select the ones which should be selected
count = selections.GetCount();
#if defined(__INTEL_COMPILER) && 1 /* VDM auto patch */
# pragma ivdep
# pragma swp
# pragma unroll
# pragma prefetch
# if 0
# pragma simd noassert
# endif
#endif /* VDM auto patch */
for ( n = 0; n < count; n++ )
{
m_listbox->Select(selections[n]);
}
}
示例8: wxGetAvailableDrives
size_t wxGetAvailableDrives(wxArrayString &paths, wxArrayString &names, wxArrayInt &icon_ids)
{
#ifdef wxHAS_FILESYSTEM_VOLUMES
#ifdef __WXWINCE__
// No logical drives; return "\"
paths.Add(wxT("\\"));
names.Add(wxT("\\"));
icon_ids.Add(wxFileIconsTable::computer);
#elif defined(__WIN32__) && wxUSE_FSVOLUME
// TODO: this code (using wxFSVolumeBase) should be used for all platforms
// but unfortunately wxFSVolumeBase is not implemented everywhere
const wxArrayString as = wxFSVolumeBase::GetVolumes();
for (size_t i = 0; i < as.GetCount(); i++)
{
wxString path = as[i];
wxFSVolume vol(path);
int imageId;
switch (vol.GetKind())
{
case wxFS_VOL_FLOPPY:
if ( (path == wxT("a:\\")) || (path == wxT("b:\\")) )
imageId = wxFileIconsTable::floppy;
else
imageId = wxFileIconsTable::removeable;
break;
case wxFS_VOL_DVDROM:
case wxFS_VOL_CDROM:
imageId = wxFileIconsTable::cdrom;
break;
case wxFS_VOL_NETWORK:
if (path[0] == wxT('\\'))
continue; // skip "\\computer\folder"
imageId = wxFileIconsTable::drive;
break;
case wxFS_VOL_DISK:
case wxFS_VOL_OTHER:
default:
imageId = wxFileIconsTable::drive;
break;
}
paths.Add(path);
names.Add(vol.GetDisplayName());
icon_ids.Add(imageId);
}
#elif defined(__OS2__)
APIRET rc;
ULONG ulDriveNum = 0;
ULONG ulDriveMap = 0;
rc = ::DosQueryCurrentDisk(&ulDriveNum, &ulDriveMap);
if ( rc == 0)
{
size_t i = 0;
while (i < 26)
{
if (ulDriveMap & ( 1 << i ))
{
const wxString path = wxFileName::GetVolumeString(
'A' + i, wxPATH_GET_SEPARATOR);
const wxString name = wxFileName::GetVolumeString(
'A' + i, wxPATH_NO_SEPARATOR);
// Note: If _filesys is unsupported by some compilers,
// we can always replace it by DosQueryFSAttach
char filesysname[20];
#ifdef __WATCOMC__
ULONG cbBuffer = sizeof(filesysname);
PFSQBUFFER2 pfsqBuffer = (PFSQBUFFER2)filesysname;
APIRET rc = ::DosQueryFSAttach(name.fn_str(),0,FSAIL_QUERYNAME,pfsqBuffer,&cbBuffer);
if (rc != NO_ERROR)
{
filesysname[0] = '\0';
}
#else
_filesys(name.fn_str(), filesysname, sizeof(filesysname));
#endif
/* FAT, LAN, HPFS, CDFS, NFS */
int imageId;
if (path == wxT("A:\\") || path == wxT("B:\\"))
imageId = wxFileIconsTable::floppy;
else if (!strcmp(filesysname, "CDFS"))
imageId = wxFileIconsTable::cdrom;
else if (!strcmp(filesysname, "LAN") ||
!strcmp(filesysname, "NFS"))
imageId = wxFileIconsTable::drive;
else
imageId = wxFileIconsTable::drive;
paths.Add(path);
names.Add(name);
icon_ids.Add(imageId);
}
i ++;
}
}
#else // !__WIN32__, !__OS2__
/* If we can switch to the drive, it exists. */
for ( char drive = 'A'; drive <= 'Z'; drive++ )
{
const wxString
//.........这里部分代码省略.........
示例9: PolyTessGeoGL
//.........这里部分代码省略.........
if( ((fabs(x-x0) > EQUAL_EPS) || (fabs(y-y0) > EQUAL_EPS)))
{
GLdouble *ppt_temp = ppt;
if(tess_orient == TESS_VERT)
{
*DPrun++ = x;
*DPrun++ = y;
}
else
{
*DPrun++ = y;
*DPrun++ = x;
}
x0 = x;
y0 = y;
}
else
nPoints--;
}
if(nPoints > 5 && (m_LOD_meters > .01)){
index_keep.Clear();
index_keep.Add(0);
index_keep.Add(nPoints-1);
index_keep.Add(1);
index_keep.Add(nPoints-2);
DouglasPeucker(DPbuffer, 1, nPoints-2, m_LOD_meters/(1852 * 60), &index_keep);
// printf("DP Reduction: %d/%d\n", index_keep.GetCount(), nPoints);
g_keep += index_keep.GetCount();
g_orig += nPoints;
// printf("...................Running: %g\n", (double)g_keep/g_orig);
}
else {
index_keep.Clear();
for(int i = 0 ; i < nPoints ; i++)
index_keep.Add(i);
}
cntr[0] = index_keep.GetCount();
// Mark the keepers by adding a simple constant to X
for(unsigned int i=0 ; i < index_keep.GetCount() ; i++){
int k = index_keep.Item(i);
DPbuffer[2*k] += 2000.;
}
// Declare the gluContour and copy the points
gluTessBeginContour(GLUtessobj);
DPrun = DPbuffer;
for(ip = 0 ; ip < nPoints ; ip++)
{
x = *DPrun++;
y = *DPrun++;
if(x > 1000.){
GLdouble *ppt_top = ppt;
示例10: DoSelectGraphicRendition
void wxVideoTerminal::DoSelectGraphicRendition(wxArrayInt &attrs)
{
if (attrs.GetCount() == 0)
attrs.Add( 0 );
unsigned int i;
for (i=0; i<attrs.GetCount();++i)
{
int cur_param = attrs[i];
//wxLogDebug("DoSelectGraphicRendition(%d=%d)", i, cur_param);
switch (cur_param)
{
case 0: // reset
m_cursor_attr.value = 0;
m_cursor_attr.val.fgcolor = 7;
break;
case 21:
m_cursor_attr.val.bold = false;
break;
case 22:
m_cursor_attr.val.dim = false;
break;
case 24: // underline-off
m_cursor_attr.val.underline = false;
break;
case 25: // blink-off
m_cursor_attr.val.blink = false;
break;
case 27: // reverse-off
m_cursor_attr.val.reverse = false;
break;
case 1: // bold
m_cursor_attr.val.bold = true;
break;
case 2: // dim
m_cursor_attr.val.dim = true;
break;
case 4: // underline
m_cursor_attr.val.underline = true;
break;
case 5: // blink
m_cursor_attr.val.blink = true;
break;
case 7: // reverse
m_cursor_attr.val.reverse = true;
break;
case 39: // default w/ underscore fgcolor
m_cursor_attr.val.fgcolor = 7;
break;
case 38: // default fgcolor
m_cursor_attr.val.fgcolor = 7;
break;
case 30: // black
m_cursor_attr.val.fgcolor = 0;
break;
case 31: // red
m_cursor_attr.val.fgcolor = 1;
break;
case 32: // green
m_cursor_attr.val.fgcolor = 2;
break;
case 33: // brown
m_cursor_attr.val.fgcolor = 3;
break;
case 34: // blue
m_cursor_attr.val.fgcolor = 4;
break;
case 35: // magenta
m_cursor_attr.val.fgcolor = 5;
break;
case 36: // cyan
m_cursor_attr.val.fgcolor = 6;
break;
case 37: // white
m_cursor_attr.val.fgcolor = 7;
break;
case 49: // default bgcolor
m_cursor_attr.val.bgcolor = 0;
break;
case 40: // black
m_cursor_attr.val.bgcolor = 0;
break;
case 41: // red
m_cursor_attr.val.bgcolor = 1;
break;
case 42: // green
m_cursor_attr.val.bgcolor = 2;
break;
case 43: // brown
m_cursor_attr.val.bgcolor = 3;
break;
case 44: // blue
m_cursor_attr.val.bgcolor = 4;
break;
case 45: // magenta
m_cursor_attr.val.bgcolor = 5;
//.........这里部分代码省略.........