本文整理汇总了C++中wxArrayString::Count方法的典型用法代码示例。如果您正苦于以下问题:C++ wxArrayString::Count方法的具体用法?C++ wxArrayString::Count怎么用?C++ wxArrayString::Count使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类wxArrayString
的用法示例。
在下文中一共展示了wxArrayString::Count方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnDropFiles
bool DnDialogFile::OnDropFiles(wxCoord, wxCoord, const wxArrayString& filenames)
{
//只有一个文件时弹出添加命令窗口
if (filenames.Count() == 1)
{
wxString cmd = filenames[0];
cmd.Replace('\\','/');
DlgAddNewCmd* dlg=new DlgAddNewCmd(NULL);
dlg->cmdLine->SetValue(cmd);
dlg->cmdName->SetValue(wxFileNameFromPath(cmd));
cmd.Clear();
if (dlg->ShowModal() == wxID_OK)
m_pOwner->ReLoadCmds();
dlg->Destroy();
return true;
}
//多个文件时自动批量添加;
for(int i = filenames.Count() - 1 ; i>=0; --i)
{
wxString cmd = filenames[i];
cmd.Replace("\\","/");
g_config->AddCmd(cmd,wxFileNameFromPath(cmd));
}
m_pOwner->ReLoadCmds();
return true;
//多个文件时自动批量添加;
}
示例2: ShowFontsDialog
void szFontProvider::ShowFontsDialog(wxWindow *parent, wxArrayString fonts)
{
wxDialog dlg(parent, wxID_ANY, wxString(_("Font configuration")));
m_dlg = &dlg;
wxStaticText* warnText = new wxStaticText(&dlg, -1,
_("You have to restart program to apply\nnew fonts settings."));
szSetDefFont(warnText);
wxButton* clBut = new wxButton(&dlg, wxID_CANCEL, _("Close"));
szSetDefFont(clBut);
wxBoxSizer* sizer0 = new wxBoxSizer(wxVERTICAL);
int width = 0;
int height = 0;
wxClientDC dc(&dlg);
for (size_t i = 0; i < fonts.Count() / 2; i++) {
int w, h;
dc.SetFont(GetFont(fonts[i*2]));
dc.GetTextExtent(fonts[i*2+1], &w, &h);
width = wxMax(width, w);
height = wxMax(height, h);
}
int w, h, w2, h2;
dc.SetFont(GetFont(wxEmptyString));
dc.GetTextExtent(_("Configure"), &w, &h);
dc.GetTextExtent(_("Reset to default"), &w2, &h2);
for (size_t i = 0; i < fonts.Count() / 2; i++) {
wxString name = fonts[i*2];
wxString descr = fonts[i*2+1];
wxBoxSizer* sizer1 = new wxBoxSizer(wxHORIZONTAL);
wxStaticText* txt = new wxStaticText(&dlg, -1, descr, wxDefaultPosition,
wxSize(width, height),
wxSUNKEN_BORDER | wxALIGN_CENTRE |
wxST_NO_AUTORESIZE);
txt->SetFont(GetFont(fonts[i*2]));
//szSetFont(txt, name);
sizer1->Add(txt, 0, wxALL, 10);
wxButton* but = new szFontDialogBtn(this, name, &dlg, -1, _("Configure"),
wxDefaultPosition, wxSize(w + 8, h + 8));
but->Connect(but->GetId(), wxEVT_COMMAND_BUTTON_CLICKED, (wxObjectEventFunction)
(wxEventFunction) (wxCommandEventFunction)&szFontDialogBtn::OnConfigureFont);
szSetDefFont(but);
sizer1->Add(but, 1, wxALL, 10);
wxButton* but2 = new szFontDialogBtn(this, name, &dlg, -1, _("Reset to default"),
wxDefaultPosition, wxSize(w2 + 8, h + 8));
but2->Connect(but2->GetId(), wxEVT_COMMAND_BUTTON_CLICKED, (wxObjectEventFunction)
(wxEventFunction) (wxCommandEventFunction)&szFontDialogBtn::OnResetFont);
szSetDefFont(but2);
sizer1->Add(but2, 0, wxALL, 10);
sizer0->Add(sizer1, 0);
}
sizer0->Add(warnText, 0, wxALL | wxEXPAND, 10);
sizer0->Add(clBut, 0, wxALL | wxCENTER, 10);
dlg.SetSizer(sizer0);
sizer0->SetSizeHints(&dlg);
dlg.ShowModal();
}
示例3: MakePackagePython
void XmlResApp::MakePackagePython(const wxArrayString& flist)
{
wxFFile file(parOutput, wxT("wt"));
size_t i;
if (flagVerbose)
wxPrintf(_T("creating Python source file ") + parOutput + _T("...\n"));
file.Write(
_T("#\n")
_T("# This file was automatically generated by wxrc, do not edit by hand.\n")
_T("#\n\n")
_T("import wx\n")
_T("import wx.xrc\n\n")
);
file.Write(_T("def ") + parFuncname + _T("():\n"));
for (i = 0; i < flist.Count(); i++)
file.Write(
FileToPythonArray(parOutputPath + wxFILE_SEP_PATH + flist[i], i));
file.Write(
_T(" # check if the memory filesystem handler has been loaded yet, and load it if not\n")
_T(" wx.MemoryFSHandler.AddFile('XRC_resource/dummy_file', 'dummy value')\n")
_T(" fsys = wx.FileSystem()\n")
_T(" f = fsys.OpenFile('memory:XRC_resource/dummy_file')\n")
_T(" wx.MemoryFSHandler.RemoveFile('XRC_resource/dummy_file')\n")
_T(" if f is not None:\n")
_T(" f.Destroy()\n")
_T(" else:\n")
_T(" wx.FileSystem.AddHandler(wx.MemoryFSHandler())\n")
_T("\n")
_T(" # load all the strings as memory files and load into XmlRes\n")
);
for (i = 0; i < flist.Count(); i++)
{
wxString s;
s.Printf(_T(" wx.MemoryFSHandler.AddFile('XRC_resource/") + flist[i] +
_T("', xml_res_file_%i)\n"), i);
file.Write(s);
}
for (i = 0; i < parFiles.Count(); i++)
{
file.Write(_T(" wx.xrc.XmlResource.Get().Load('memory:XRC_resource/") +
GetInternalFileName(parFiles[i], flist) + _T("')\n"));
}
file.Write(_T("\n"));
}
示例4: WriteArrayString
bool wxArchive::WriteArrayString(const wxArrayString& value)
{
if(CanStore())
{
// write header + string
SaveChar(wxARCHIVE_HDR_ARRSTRING);
SaveUint32(value.Count());
for(size_t i = 0; i < value.Count(); i++)
SaveString(value[i]);
}
return IsOk();
}
示例5: accel
FileViewer::FileViewer(wxWindow *parent,
const wxString& basePath,
const wxArrayString& references,
int startAt)
: wxFrame(parent, -1, _("Source file")),
m_references(references)
{
m_basePath = basePath;
SetName("fileviewer");
wxPanel *panel = new wxPanel(this, -1);
wxSizer *sizer = new wxBoxSizer(wxVERTICAL);
panel->SetSizer(sizer);
wxSizer *barsizer = new wxBoxSizer(wxHORIZONTAL);
sizer->Add(barsizer, wxSizerFlags().Expand().Border());
barsizer->Add(new wxStaticText(panel, wxID_ANY,
_("Source file occurrence:")),
wxSizerFlags().Center().Border(wxRIGHT));
wxChoice *choice = new wxChoice(panel, wxID_ANY);
barsizer->Add(choice, wxSizerFlags(1).Center());
for (size_t i = 0; i < references.Count(); i++)
choice->Append(references[i]);
choice->SetSelection(startAt);
wxButton *edit = new wxButton(panel, wxID_ANY, _("Open In Editor"));
barsizer->Add(edit, wxSizerFlags().Center().Border(wxLEFT, 10));
m_text = new wxStyledTextCtrl(panel, wxID_ANY,
wxDefaultPosition, wxDefaultSize,
wxBORDER_THEME);
SetupTextCtrl();
sizer->Add(m_text, 1, wxEXPAND);
RestoreWindowState(this, wxSize(600, 400));
wxSizer *topsizer = new wxBoxSizer(wxVERTICAL);
topsizer->Add(panel, wxSizerFlags(1).Expand());
SetSizer(topsizer);
Layout();
choice->Bind(wxEVT_CHOICE, &FileViewer::OnChoice, this);
edit->Bind(wxEVT_BUTTON, &FileViewer::OnEditFile, this);
ShowReference(m_references[startAt]);
#ifdef __WXOSX__
wxAcceleratorEntry entries[] = {
{ wxACCEL_CMD, 'W', wxID_CLOSE }
};
wxAcceleratorTable accel(WXSIZEOF(entries), entries);
SetAcceleratorTable(accel);
Bind(wxEVT_MENU, [=](wxCommandEvent&){ Destroy(); }, wxID_CLOSE);
#endif
}
示例6: OnDropFiles
bool BFBackupTree::OnDropFiles (wxCoord x, wxCoord y, const wxArrayString& filenames)
{
if (filenames.Count() == 0)
return false;
wxMenu* pMenu = NULL;
wxString str;
if ( wxFile::Exists(filenames[0]) )
// ** copy file **
BFBackupTree::GenerateBackupMenu(pMenu, false);
else
// ** directory (existing and unexisting/created while backup) **
BFBackupTree::GenerateBackupMenu(pMenu, true);
// remember the filename for use in other methodes
SetDropedFilename(filenames[0]);
// remember the destination directory (by draging over it) if ther is one
BFBackupTreeItemData* pItemData = NULL;
wxTreeItemId itemId = HitTest(wxPoint(x, y));
if ( itemId.IsOk() )
pItemData = (BFBackupTreeItemData*)GetItemData(itemId);
if ( pItemData )
// && pItemData->GetOID() == BFInvalidOID)
strCurrentDestination_ = pItemData->GetPath();
// show the menu
PopupMenu(pMenu, wxPoint(x, y));
return true;
}
示例7: arrayStringToVector
std::vector<std::string> arrayStringToVector(const wxArrayString& arr) {
std::vector<std::string> vec;
vec.reserve(arr.Count());
for(auto s : arr)
vec.push_back(STD_STRING(s));
return vec;
}
示例8: TagsReplace
wxString CLogger::TagsReplace(const wxString& string, const wxArrayString& tags, const wxArrayString& replacements)
{
wxString ret;
for(size_t i = 0; i < string.length(); )
{
bool bFound = false;
if(string[i] == '{')
{
for(size_t j = 0; j < tags.Count(); j++)
{
const wxString& tag = tags[j];
if(string.substr(i, tag.length()) == tag)
{
ret += replacements[j];
i += tag.length();
bFound = true;
break;
}
}
}
if(!bFound)
{
ret += string[i++];
}
}
return ret;
}
示例9: AddTypeToPredefined
void AddTypeToPredefined( wxListBox *WxListBoxAssociated,
wxListBox *WxListBoxPredefined,
const wxArrayString &as )
{
int idx = 0;
const int count = int( as.Count() );
wxString type;
while( idx < count )
{
type = as[idx];
int n = WxListBoxAssociated->FindString( type );
if( n != wxNOT_FOUND ) { WxListBoxAssociated->Delete( n ); }
n = WxListBoxPredefined->FindString( type );
if( n == wxNOT_FOUND ) { WxListBoxPredefined->Append( type ); }
n = as_remove.Index( type );
if( n == wxNOT_FOUND ) { as_remove.Add( type ); }
++idx;
}
}
示例10: MakePackageZIP
void XmlResApp::MakePackageZIP(const wxArrayString& flist)
{
wxString files;
for (size_t i = 0; i < flist.Count(); i++)
files += flist[i] + _T(" ");
files.RemoveLast();
if (flagVerbose)
wxPrintf(_T("compressing ") + parOutput + _T("...\n"));
wxString cwd = wxGetCwd();
wxSetWorkingDirectory(parOutputPath);
int execres = wxExecute(_T("zip -9 -j ") +
wxString(flagVerbose ? _T("\"") : _T("-q \"")) +
parOutput + _T("\" ") + files, true);
wxSetWorkingDirectory(cwd);
if (execres == -1)
{
wxLogError(_T("Unable to execute zip program. Make sure it is in the path."));
wxLogError(_T("You can download it at http://www.cdrom.com/pub/infozip/"));
retCode = 1;
return;
}
}
示例11: SetMRUList
/// Set the list of most recently used computers.
///
/// \param[in] mru_list An array containing the names of all computers
/// that were used recently.
void CDlgSelectComputer::SetMRUList(const wxArrayString& mru_list)
{
m_ComputerNameCtrl->Clear();
for (size_t i = 0; i < mru_list.Count(); ++i) {
m_ComputerNameCtrl->Append(mru_list.Item(i));
}
}
示例12: ProcessLibs
bool ProcessingDlg::ProcessLibs( const wxArrayString& Shortcuts )
{
int TotalCount = 0;
for ( int i=0; i<m_Manager.GetLibraryCount(); ++i )
{
if ( const LibraryDetectionConfigSet* Set = m_Manager.GetLibrary( Shortcuts[i] ) )
{
TotalCount += (int)Set->Configurations.size();
}
}
Gauge1->SetRange( TotalCount );
int progress = 1;
for ( size_t i=0; i<Shortcuts.Count(); ++i )
{
if ( StopFlag ) return false;
Gauge1->SetValue( progress++ );
if ( const LibraryDetectionConfigSet* Set = m_Manager.GetLibrary( Shortcuts[i] ) )
{
for ( size_t j=0; j<Set->Configurations.size(); ++j )
{
if ( StopFlag ) return false;
Gauge1->SetValue( progress++ );
ProcessLibrary( &Set->Configurations[j], Set );
}
}
}
return !StopFlag;
}
示例13: HasOption
bool ProjectOptionsManipulator::HasOption(const wxArrayString& opt_array, const wxString& opt, wxString& full_opt)
{
switch ( m_Dlg->GetSearchOption() )
{
case (ProjectOptionsManipulatorDlg::eContains):
{
for (size_t i=0; i<opt_array.Count(); ++i)
{
if ( opt_array.Item(i).Contains(opt) )
{
full_opt = opt_array.Item(i);
return true;
}
}
}
break;
case (ProjectOptionsManipulatorDlg::eEquals): // fall through
default:
{
int idx = opt_array.Index(opt);
if (idx!=wxNOT_FOUND)
{
full_opt = opt_array.Item(idx);
return true;
}
}
break;
}
return false;
}
示例14: OnDropFiles
virtual bool OnDropFiles(wxCoord x, wxCoord y, const wxArrayString& filenames)
{
if (filenames.Count() > 0)
{
win->LoadFile(filenames[0]);
}
return true;
}
示例15: OnDropFiles
virtual bool OnDropFiles(wxCoord /* x */, wxCoord /* y */, const wxArrayString &dropped_files) {
size_t i;
for (i = 0; i < dropped_files.Count(); i++)
owner->add_attachment(dropped_files[i]);
return true;
}