本文整理汇总了C++中wxString::IsSameAs方法的典型用法代码示例。如果您正苦于以下问题:C++ wxString::IsSameAs方法的具体用法?C++ wxString::IsSameAs怎么用?C++ wxString::IsSameAs使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类wxString
的用法示例。
在下文中一共展示了wxString::IsSameAs方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Write
/* ------------------------------------------------------------------------------------------------------------------
* Write and read values
* Regardless of namespaces, the string keys app_path and data_path always refer to the location of the application's executable
* and the data path, respectively. These values are never saved to the configuration, but kept in static variables.
* The application makes use of this by "writing" to the configuration file after determining these values at runtime.
*/
void ConfigManager::Write(const wxString& name, const wxString& value, bool ignoreEmpty)
{
if (name.IsSameAs(CfgMgrConsts::app_path))
{
return;
}
else if (name.IsSameAs(CfgMgrConsts::data_path))
{
data_path_global = value;
return;
}
if (ignoreEmpty && value.IsEmpty())
{
UnSet(name);
return;
}
wxString key(name);
TiXmlElement* e = AssertPath(key);
TiXmlElement *str = GetUniqElement(e, key);
TiXmlElement *s = GetUniqElement(str, _T("str"));
TiXmlText t(value.mb_str(wxConvUTF8));
t.SetCDATA(true);
SetNodeText(s, t);
}
示例2: Read
bool ConfigManager::Read(const wxString& name, wxString* str)
{
if (name.IsSameAs(CfgMgrConsts::app_path))
{
str->assign(app_path);
return true;
}
else if (name.IsSameAs(CfgMgrConsts::data_path))
{
str->assign(data_path_global);
return true;
}
wxString key(name);
TiXmlElement* e = AssertPath(key);
TiXmlHandle parentHandle(e);
TiXmlText *t = (TiXmlText *) parentHandle.FirstChild(cbU2C(key)).FirstChild("str").FirstChild().Node();
if (t)
{
str->assign(cbC2U(t->Value()));
return true;
}
return false;
}
示例3: ShellExecute
bool MerryController::ShellExecute(const wxString& commandName,
const wxString& commandArg,
const wxString& workingDir,
const wxString& show) const
{
// wxLogNull logNo;
wxString cmdName = commandName;
int showCommand = SW_SHOW;
bool runas = false;
if (show.IsSameAs(wxT("hide"), false))
showCommand = SW_HIDE;
else if (show.IsSameAs(wxT("min"), false))
showCommand = SW_SHOWMINIMIZED;
else if (show.IsSameAs(wxT("max"), false))
showCommand = SW_SHOWMAXIMIZED;
while(true)
{
UCHAR T = cmdName.GetChar(0).GetValue();
if (T == '@')//前导'@'隐藏窗口运行
showCommand = SW_HIDE;
else if (T == '*')//前导'*' NT6以上请会管理员权限,NT5运行为
runas = true;
else if (T == '>')//前导'>'请求管理员权限(NT6以上有效)
{
if (::wxGetWinVersion() >= wxWinVersion_6)
runas = true;
}
else
break;
cmdName.erase(0,1);
}
if (!LocationExec)
{
__DEBUG_BEGIN(cmdName.c_str());
int ret = (int)::ShellExecute(NULL,(runas?_T("RunAs"):NULL), cmdName.c_str(), commandArg.c_str(), workingDir.c_str(), showCommand);
if (ret > 32)
return true;
__DEBUG_BEGIN(wxString::Format("cmd.exe /c start \"\" /D \"%s\" \"%s\" %s",workingDir,cmdName,commandArg));
return (int)::WinExec(wxString::Format("cmd.exe /c start \"\" /D \"%s\" \"%s\" %s",workingDir,cmdName,commandArg),SW_HIDE) > 32;
//wxString tmpName = GetFullCmdName(cmdName,workingDir,false);
//if (tmpName.empty())
//{
// ::wxMessageBox(wxString::Format(wxT("无法运行 '%s'。请确定文件名是否正确后,再试一次。"),cmdName),cmdName,wxOK | wxICON_ERROR);
// return false;
//}
//return (int)::ShellExecute(NULL,(runas?_T("RunAs"):NULL), tmpName.c_str(), commandArg.c_str(), workingDir.c_str(), showCommand)>32;
}
LocationExec = false;//定位文件位置标志复位
cmdName.Replace('/','\\');
cmdName = GetFullCmdName(cmdName,workingDir,true);
#ifdef _ALMRUN_CONFIG_H_
if (!g_config->Explorer.empty())
return (int)::WinExec(wxString::Format("%s \"%s\"",g_config->Explorer,cmdName),SW_SHOW) > 32;
#endif//ifdef _ALMRUN_CONFIG_H_
return (int)::ShellExecute(NULL,NULL,_T("explorer.exe"),_T("/n,/select,")+cmdName.c_str(),NULL, SW_SHOW) > 32;
//return (int)::ShellExecute(NULL,NULL,g_config->Explorer.c_str(),wxString::Format(wxT("\"%s\""),cmdName),NULL, SW_SHOW) > 32;
}
示例4: HandleTextualCommand
/// HandleTextualCommand() allows us a limitted version of script/batch
/// behavior, since we can get from a string command name to the actual
/// code to run.
bool CommandManager::HandleTextualCommand(wxString & Str, wxUint32 flags, wxUint32 mask)
{
unsigned int i;
// Linear search for now...
for(i=0; i<mCommandList.GetCount(); i++) {
if (!mCommandList[i]->multi)
{
if( Str.IsSameAs( mCommandList[i]->name ))
{
return HandleCommandEntry( mCommandList[i], flags, mask);
}
}
}
// Not one of the singleton commands.
// We could/should try all the list-style commands.
// instead we only try the effects.
EffectArray *effects;
AudacityProject * proj;
proj = GetActiveProject();
if( !proj )
return false;
int effectFlags = ALL_EFFECTS | CONFIGURED_EFFECT;
effects = EffectManager::Get().GetEffects(effectFlags);
for(i=0; i<effects->GetCount(); i++) {
wxString effectName = (*effects)[i]->GetEffectName();
if( Str.IsSameAs( effectName ))
{
return proj->OnEffect( effectFlags, (*effects)[i] );
}
}
return false;
}
示例5: DoSetAssociation
void Associations::DoSetAssociation(const wxString& ext, const wxString& descr, const wxString& exe, int icoNum)
{
wxString BaseKeyName(_T("HKEY_CURRENT_USER\\Software\\Classes\\"));
if (platform::WindowsVersion() == platform::winver_Windows9598ME)
BaseKeyName = _T("HKEY_CLASSES_ROOT\\");
wxString node(_T(KEY_NAME) + ext);
wxRegKey key; // defaults to HKCR
key.SetName(BaseKeyName + _T(".") + ext);
key.Create();
key = _T(KEY_NAME) + ext;
key.SetName(BaseKeyName + node);
key.Create();
key = descr;
key.SetName(BaseKeyName + node + _T("\\DefaultIcon"));
key.Create();
key = exe + wxString::Format(_T(",%d"), icoNum);
key.SetName(BaseKeyName + node + _T("\\shell\\open\\command"));
key.Create();
key = _T("\"") + exe + _T("\" \"%1\"");
key.SetName(BaseKeyName + node + _T("\\shell\\open\\ddeexec"));
key.Create();
key = _T("[Open(\"%1\")]");
key.SetName(BaseKeyName + node + _T("\\shell\\open\\ddeexec\\application"));
key.Create();
key = DDE_SERVICE;
key.SetName(BaseKeyName + node + _T("\\shell\\open\\ddeexec\\ifexec"));
key.Create();
key = _T("[IfExec_Open(\"%1\")]");;
key.SetName(BaseKeyName + node + _T("\\shell\\open\\ddeexec\\topic"));
key.Create();
key = DDE_TOPIC;
if (ext.IsSameAs(FileFilters::EMBLOCKS_EXT) || ext.IsSameAs(FileFilters::WORKSPACE_EXT))
{
wxString batchbuildargs = Manager::Get()->GetConfigManager(_T("app"))->Read(_T("/batch_build_args"), appglobals::DefaultBatchBuildArgs);
key.SetName(BaseKeyName + node + _T("\\shell\\Build\\command"));
key.Create();
key = _T("\"") + exe + _T("\" ") + batchbuildargs + _T(" --build \"%1\"");
key.SetName(BaseKeyName + node + _T("\\shell\\Rebuild (clean)\\command"));
key.Create();
key = _T("\"") + exe + _T("\" ") + batchbuildargs + _T(" --rebuild \"%1\"");
}
}
示例6: FindString
int wxComboBox::FindString( const wxString &item, bool bCase ) const
{
wxCHECK_MSG( m_widget != NULL, wxNOT_FOUND, wxT("invalid combobox") );
#ifdef __WXGTK24__
if (!gtk_check_version(2,4,0))
{
GtkComboBox* combobox = GTK_COMBO_BOX( m_widget );
GtkTreeModel* model = gtk_combo_box_get_model( combobox );
GtkTreeIter iter;
gtk_tree_model_get_iter_first( model, &iter );
if (!gtk_list_store_iter_is_valid(GTK_LIST_STORE(model), &iter ))
return -1;
int count = 0;
do
{
GValue value = { 0, };
gtk_tree_model_get_value( model, &iter, 0, &value );
wxString str = wxGTK_CONV_BACK( g_value_get_string( &value ) );
g_value_unset( &value );
if (item.IsSameAs( str, bCase ) )
return count;
count++;
} while (gtk_tree_model_iter_next( model, &iter ));
}
else
#endif
{
GtkWidget *list = GTK_COMBO(m_widget)->list;
GList *child = GTK_LIST(list)->children;
int count = 0;
while (child)
{
GtkBin *bin = GTK_BIN( child->data );
GtkLabel *label = GTK_LABEL( bin->child );
wxString str( wxGTK_CONV_BACK( gtk_label_get_text(label) ) );
if (item.IsSameAs( str , bCase ) )
return count;
count++;
child = child->next;
}
}
return wxNOT_FOUND;
}
示例7: ShowWindow
void MerryController::ShowWindow(void* window, const wxString& show) const
{
int cmdShow = SW_SHOW;
if (show.IsSameAs(wxT("hide"), false))
cmdShow = SW_HIDE;
else if (show.IsSameAs(wxT("min"), false))
cmdShow = SW_SHOWMINIMIZED;
else if (show.IsSameAs(wxT("max"), false))
cmdShow = SW_SHOWMAXIMIZED;
else if (show.IsSameAs(wxT("restore"), false))
cmdShow = SW_RESTORE;
::ShowWindow((HWND)window, cmdShow);
}
示例8: SetPercType
void Parameter::SetPercType(const wxString& type)
{
if (type.IsSameAs("none"))
SetPercType(Parameter::NONE);
else if (type.IsSameAs("area"))
SetPercType(Parameter::AREA);
else if (type.IsSameAs("width"))
SetPercType(Parameter::WIDTH);
else if (type.IsSameAs("height"))
SetPercType(Parameter::HEIGHT);
else if (type.IsSameAs("colour_range"))
SetPercType(Parameter::COLOUR_RANGE);
else
wxFAIL_MSG("Unkown percent type");
}
示例9: GetHtmlBoolValue
static bool GetHtmlBoolValue(const wxString& value)
{
if (value.IsSameAs(wxT("true"),false) || value == wxT("1"))
return true;
else
return false;
}
示例10: Matches
bool EDA_ITEM::Matches( const wxString& aText, wxFindReplaceData& aSearchData )
{
wxString text = aText;
wxString searchText = aSearchData.GetFindString();
// Don't match if searching for replaceable item and the item doesn't support text replace.
if( (aSearchData.GetFlags() & FR_SEARCH_REPLACE) && !IsReplaceable() )
return false;
if( aSearchData.GetFlags() & wxFR_WHOLEWORD )
return aText.IsSameAs( searchText, aSearchData.GetFlags() & wxFR_MATCHCASE );
if( aSearchData.GetFlags() & FR_MATCH_WILDCARD )
{
if( aSearchData.GetFlags() & wxFR_MATCHCASE )
return text.Matches( searchText );
return text.MakeUpper().Matches( searchText.MakeUpper() );
}
if( aSearchData.GetFlags() & wxFR_MATCHCASE )
return aText.Find( searchText ) != wxNOT_FOUND;
return text.MakeUpper().Find( searchText.MakeUpper() ) != wxNOT_FOUND;
}
示例11: FindString
int wxComboBox::FindString( const wxString &item, bool bCase ) const
{
wxCHECK_MSG( m_widget != NULL, wxNOT_FOUND, wxT("invalid combobox") );
GtkWidget *list = GTK_COMBO(m_widget)->list;
GList *child = GTK_LIST(list)->children;
int count = 0;
#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 */
while (child)
{
GtkBin *bin = GTK_BIN( child->data );
GtkLabel *label = GTK_LABEL( bin->child );
wxString str( label->label );
if (item.IsSameAs( str , bCase ) )
return count;
count++;
child = child->next;
}
return wxNOT_FOUND;
}
示例12: FindString
int wxChoice::FindString( const wxString &string, bool bCase ) const
{
wxCHECK_MSG( m_widget != NULL, wxNOT_FOUND, wxT("invalid choice") );
// If you read this code once and you think you understand
// it, then you are very wrong. Robert Roebling.
GtkMenuShell *menu_shell = GTK_MENU_SHELL( gtk_option_menu_get_menu( GTK_OPTION_MENU(m_widget) ) );
int count = 0;
GList *child = menu_shell->children;
while (child)
{
GtkBin *bin = GTK_BIN( child->data );
GtkLabel *label = NULL;
if (bin->child)
label = GTK_LABEL(bin->child);
if (!label)
label = GTK_LABEL( BUTTON_CHILD(m_widget) );
wxASSERT_MSG( label != NULL , wxT("wxChoice: invalid label") );
wxString tmp( label->label );
if (string.IsSameAs( tmp, bCase ))
return count;
child = child->next;
count++;
}
return wxNOT_FOUND;
}
示例13: FindString
int wxChoice::FindString( const wxString &item, bool bCase ) const
{
wxCHECK_MSG( m_widget != NULL, wxNOT_FOUND, wxT("invalid control") );
GtkComboBox* combobox = GTK_COMBO_BOX( m_widget );
GtkTreeModel* model = gtk_combo_box_get_model( combobox );
GtkTreeIter iter;
gtk_tree_model_get_iter_first( model, &iter );
if (!gtk_list_store_iter_is_valid(GTK_LIST_STORE(model), &iter ))
return -1;
int count = 0;
do
{
GValue value = G_VALUE_INIT;
gtk_tree_model_get_value( model, &iter, m_stringCellIndex, &value );
wxString str = wxGTK_CONV_BACK( g_value_get_string( &value ) );
g_value_unset( &value );
if (item.IsSameAs( str, bCase ) )
return count;
count++;
}
while ( gtk_tree_model_iter_next(model, &iter) );
return wxNOT_FOUND;
}
示例14: processYour
bool CDummyRepeaterFrame::processYour(wxString& your)
{
your.MakeUpper();
// Check for the right length
size_t len = your.Length();
if (len > LONG_CALLSIGN_LENGTH) {
error(_("The YOUR callsign is too long"));
return false;
}
// Check for invalid characters
size_t pos = your.find_first_not_of(wxT("ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789/ "));
if (pos != wxString::npos) {
error(_("Invalid character in the YOUR callsign"));
return false;
}
// Add the Your callsign to the list
if (!your.IsSameAs(CQCQCQ)) {
int index = m_your->FindString(your);
if (index == wxNOT_FOUND)
m_your->Insert(your, 0U); // Insert at the top
}
// Replace value with possibly modified versions
m_your->SetValue(your);
::wxGetApp().setYour(your);
return true;
}
示例15:
bool CDummyRepeaterFrame::processRpt2(wxString& rpt2)
{
if (!rpt2.IsSameAs(UNUSED)) {
rpt2.MakeUpper();
// Check for the right length
size_t len = rpt2.Length();
if (len > LONG_CALLSIGN_LENGTH) {
error(_("The RPT2 callsign is too long"));
return false;
}
// Check for invalid characters
size_t pos = rpt2.find_first_not_of(wxT("ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789/ "));
if (pos != wxString::npos) {
error(_("Invalid character in the RPT2 callsign"));
return false;
}
// Add the RPT2 callsign to the list
int index = m_rpt2->FindString(rpt2);
if (index == wxNOT_FOUND)
m_rpt2->Insert(rpt2, 0U); // Insert at the top
// Replace value with possibly modified versions
m_rpt2->SetValue(rpt2);
}
::wxGetApp().setRpt2(rpt2);
return true;
}