本文整理汇总了C++中wxVariant类的典型用法代码示例。如果您正苦于以下问题:C++ wxVariant类的具体用法?C++ wxVariant怎么用?C++ wxVariant使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了wxVariant类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: wxPGVariantToDouble
bool wxPGVariantToDouble( const wxVariant& variant, double* pResult )
{
if ( variant.IsNull() )
return false;
wxString variantType = variant.GetType();
if ( variantType == wxPG_VARIANT_TYPE_DOUBLE )
{
*pResult = variant.GetDouble();
return true;
}
if ( variantType == wxPG_VARIANT_TYPE_LONG )
{
*pResult = (double)variant.GetLong();
return true;
}
if ( variantType == wxLongLong_VariantType )
{
wxLongLong ll;
ll << variant;
*pResult = ll.ToDouble();
return true;
}
if ( variantType == wxPG_VARIANT_TYPE_STRING )
if ( variant.GetString().ToDouble(pResult) )
return true;
return false;
}
开发者ID:czxxjtu,项目名称:wxPython-1,代码行数:33,代码来源:propgridiface.cpp
示例2: return
bool wxVariant::operator== (const wxVariant& variant) const
{
if (IsNull() || variant.IsNull())
return (IsNull() == variant.IsNull());
return (GetData()->Eq(* variant.GetData()));
}
开发者ID:ACanadianKernel,项目名称:pcsx2,代码行数:7,代码来源:variant.cpp
示例3: SetValueByRow
bool CTimeBarListModel::SetValueByRow( const wxVariant &variant, unsigned int row, unsigned int col )
{
if (row < m_textColValues.GetCount())
{
switch ( col )
{
case Col_EditableText:
m_textColValues[row] = variant.GetString();
break;
case Col_Visible:
m_view[row] = variant.GetChar();
break;
case Col_Lock:
m_lock[row] = variant.GetChar();
break;
case Col_Max:
default:
wxFAIL_MSG( _T("invalid column") );
break;
}
}
return false;
}
开发者ID:nobitalwm,项目名称:FCEngine,代码行数:26,代码来源:DataViewListModel.cpp
示例4: SetValue
bool MyMusicTreeModel::SetValue( const wxVariant &variant,
const wxDataViewItem &item, unsigned int col )
{
wxASSERT(item.IsOk());
MyMusicTreeModelNode *node = (MyMusicTreeModelNode*) item.GetID();
switch (col)
{
case 0:
node->m_title = variant.GetString();
return true;
case 1:
node->m_artist = variant.GetString();
return true;
case 2:
node->m_year = variant.GetLong();
return true;
case 3:
node->m_quality = variant.GetString();
return true;
default:
wxLogError( "MyMusicTreeModel::SetValue: wrong column" );
}
return false;
}
开发者ID:euler0,项目名称:Helium,代码行数:26,代码来源:mymodels.cpp
示例5: GetValueString
std::string ScalarSelectionDialog::GetValueString(const wxVariant& variant, std::type_index type, int precision)
{
std::string result;
if (!variant.IsNull()) {
if (IsFloat(type)) {
std::stringstream strstream;
if (precision > 0) {
strstream << std::setprecision(precision) << std::fixed << variant.GetDouble();
}
else {
strstream << std::fixed << variant.GetDouble();
}
auto tmpStr = strstream.str();
size_t last_not_zero = tmpStr.find_last_not_of('0');
result = tmpStr.substr(0, last_not_zero == std::string::npos ? last_not_zero : last_not_zero+1);
}
else if (IsIntegral(type)) {
result = std::to_string(variant.GetInteger());
}
}
return result;
}
开发者ID:petiaccja,项目名称:Excessive-Team-Graph,代码行数:25,代码来源:ScalarSelectionDialog.cpp
示例6: LogVariant
void LogVariant(const wxString& prefix, const wxVariant& v)
{
const wxString type = v.GetType();
wxString info;
const wxString& name = v.GetName();
if (type == wxS("arrstring")) {
wxArrayString as = v.GetArrayString();
info.Printf(wxS("%svariant type: \"%s\", element count: %zu, name: \"%s\"."),
prefix, type, as.size(), name);
wxLogTrace(wxTRACE_AutoExcel, wxS("%s"), info);
for (size_t i = 0; i < as.size(); i++)
{
info.Printf(wxS(" string #%zu value: \"%s\""), i, as[i]);
if ( i == LogVariantMaxItemsInList )
{
wxLogTrace(wxTRACE_AutoExcel, wxS("And %zu more strings"), as.size() - i);
break;
}
else
wxLogTrace(wxTRACE_AutoExcel, wxS("%s"), info);
}
return;
}
if (type == wxS("list")) {
info.Printf(wxS("%sVariant type: \"%s\", element count: %zu, name: \"%s\"."),
prefix, type, v.GetCount(), name);
wxLogTrace(wxTRACE_AutoExcel, wxS("%s"), info);
for (size_t i = 0; i < v.GetCount(); i++)
{
if ( i == LogVariantMaxItemsInList )
{
wxLogTrace(wxTRACE_AutoExcel, wxS("And %zu more variants"), v.GetCount() - i);
break;
} else
{
const wxVariant& vTmp = v[i];
info.Printf(wxS(" variant #%zu type: \"%s\", value: \"%s\", name: \"%s\"."),
i, vTmp.GetType(), vTmp.MakeString(), vTmp.GetName());
wxLogTrace(wxTRACE_AutoExcel, wxS("%s"), info);
}
}
return;
}
if (type == wxS("void*") && v.GetVoidPtr() != NULL) {
wxString automationName;
wxExcelObject object;
IDispatch* dispatch = (IDispatch*)v.GetVoidPtr();
dispatch->AddRef();
object.GetAutomationObject_()->SetDispatchPtr(dispatch);
info.Printf(wxS("%svariant type: \"IDispatch - %s\", value: \"%s\", name: \"%s\"."),
prefix, object.GetAutomationObjectName_(false), v.MakeString(), name);
} else {
info.Printf(wxS("%svariant type: \"%s\", value: \"%s\", name: \"%s\"."),
prefix, type, v.MakeString(), name);
}
wxLogTrace(wxTRACE_AutoExcel, wxS("%s"), info);
}
开发者ID:pbfordev,项目名称:wxAutoExcel,代码行数:58,代码来源:wxAutoExcel_private.cpp
示例7: PointRefFromVariant
wxVariant wxPointProperty::ChildChanged(wxVariant& thisValue, int childIndex, wxVariant& childValue) const
{
Point& point = PointRefFromVariant(thisValue);
switch ( childIndex )
{
case 0: point.X = childValue.GetInteger(); break;
case 1: point.Y = childValue.GetInteger(); break;
}
wxVariant newVariant;
newVariant << point;
return newVariant;
}
开发者ID:aminere,项目名称:VLADHeavyStrikePublic,代码行数:12,代码来源:wxCommonProperties.cpp
示例8: SizeRefFromVariant
wxVariant wxSizeProperty::ChildChanged(wxVariant& thisValue, int childIndex, wxVariant& childValue) const
{
Size& size = SizeRefFromVariant(thisValue);
switch ( childIndex )
{
case 0: size.Width = childValue.GetInteger(); break;
case 1: size.Height = childValue.GetInteger(); break;
}
wxVariant newVariant;
newVariant << size;
return newVariant;
}
开发者ID:aminere,项目名称:VLADHeavyStrikePublic,代码行数:12,代码来源:wxCommonProperties.cpp
示例9:
wxVariant luVector3Property::ChildChanged( wxVariant& thisValue, int childIndex, wxVariant& childValue ) const
{
gkVector3 v;
v << thisValue;
switch ( childIndex )
{
case 0: v.x = childValue.GetDouble(); break;
case 1: v.y = childValue.GetDouble(); break;
case 2: v.z = childValue.GetDouble(); break;
}
return thisValue << v;
}
开发者ID:Ali-il,项目名称:gamekit,代码行数:12,代码来源:luProps.cpp
示例10: RangeRefFromVariant
wxVariant wxRangeProperty::ChildChanged( wxVariant& thisValue, int childIndex, wxVariant& childValue ) const
{
Range& range = RangeRefFromVariant(thisValue);
switch ( childIndex )
{
case 0: range.Min = childValue.GetDouble(); break;
case 1: range.Max = childValue.GetDouble(); break;
}
wxVariant newVariant;
newVariant << range;
return newVariant;
}
开发者ID:aminere,项目名称:VLADHeavyStrikePublic,代码行数:12,代码来源:wxCommonProperties.cpp
示例11: Vector2RefFromVariant
wxVariant wxVector2Property::ChildChanged( wxVariant& thisValue, int childIndex, wxVariant& childValue ) const
{
Vector2& vec = Vector2RefFromVariant(thisValue);
switch ( childIndex )
{
case 0: vec.X = childValue.GetDouble(); break;
case 1: vec.Y = childValue.GetDouble(); break;
}
wxVariant newVariant;
newVariant << vec;
return newVariant;
}
开发者ID:aminere,项目名称:VLADHeavyStrikePublic,代码行数:12,代码来源:wxCommonProperties.cpp
示例12: wxPGVariantToInt
long wxPGVariantToInt( const wxVariant& variant, long defVal )
{
if ( variant.IsNull() )
return defVal;
if ( variant.GetType() == wxS("long") )
return variant.GetLong();
if ( variant.GetType() == wxS("bool") )
return variant.GetBool() ? 1 : 0;
if ( variant.GetType() == wxS("wxLongLong") )
{
wxLongLong ll;
ll << variant;
if ( ll >= LONG_MAX )
return LONG_MAX;
else if ( ll <= LONG_MIN )
return LONG_MIN;
return ll.ToLong();
}
long l = defVal;
if ( variant.GetType() == wxPG_VARIANT_TYPE_STRING )
variant.GetString().ToLong(&l, 0);
return l;
}
开发者ID:czxxjtu,项目名称:wxPython-1,代码行数:29,代码来源:propgridiface.cpp
示例13: CGUISizeRefFromVariant
// -----------------------------------------------------------------------
wxVariant WxGUISizeProperty::ChildChanged( wxVariant& thisValue, int childIndex, wxVariant& childValue ) const
{
CGUISize& size = CGUISizeRefFromVariant(thisValue);
switch ( childIndex )
{
case 0: size.m_fWidth = childValue.GetDouble(); break;
case 1: size.m_fHeight = childValue.GetDouble(); break;
}
wxVariant newVariant;
newVariant << size;
return newVariant;
}
开发者ID:Abyss116,项目名称:libguiex,代码行数:15,代码来源:wxpgpropertyextend.cpp
示例14: switch
wxVariant nsVector3Property::ChildChanged(wxVariant& thisValue, int childIndex, wxVariant& childValue) const
{
Vector3 vector;
vector << thisValue;
switch (childIndex)
{
case 0: vector._x = childValue.GetDouble(); break;
case 1: vector._y = childValue.GetDouble(); break;
case 2: vector._z = childValue.GetDouble(); break;
}
wxVariant newVariant;
newVariant << vector;
return newVariant;
}
开发者ID:victor-timoshin,项目名称:SWAY-GameEditor,代码行数:14,代码来源:InspectorPropertyGridPage.cpp
示例15: CGUIRotatorRefFromVariant
// -----------------------------------------------------------------------
wxVariant WxGUIRotatorProperty::ChildChanged( wxVariant& thisValue, int childIndex, wxVariant& childValue ) const
{
CGUIRotator& rotator = CGUIRotatorRefFromVariant(thisValue);
switch ( childIndex )
{
case 0: rotator.Pitch = childValue.GetDouble(); break;
case 1: rotator.Yaw = childValue.GetDouble(); break;
case 2: rotator.Roll = childValue.GetDouble(); break;
}
wxVariant newVariant;
newVariant << rotator;
return newVariant;
}
开发者ID:Abyss116,项目名称:libguiex,代码行数:16,代码来源:wxpgpropertyextend.cpp
示例16: CGUIVector3RefFromVariant
// -----------------------------------------------------------------------
wxVariant WxGUIVector3Property::ChildChanged( wxVariant& thisValue, int childIndex, wxVariant& childValue ) const
{
CGUIVector3& vector = CGUIVector3RefFromVariant(thisValue);
switch ( childIndex )
{
case 0: vector.x = childValue.GetDouble(); break;
case 1: vector.y = childValue.GetDouble(); break;
case 2: vector.z = childValue.GetDouble(); break;
}
wxVariant newVariant;
newVariant << vector;
return newVariant;
}
开发者ID:Abyss116,项目名称:libguiex,代码行数:16,代码来源:wxpgpropertyextend.cpp
示例17: CGUIStringRenderInfoRefFromVariant
// -----------------------------------------------------------------------
wxVariant WxGUIStringInfoProperty::ChildChanged( wxVariant& thisValue, int childIndex, wxVariant& childValue ) const
{
CGUIStringRenderInfo& string_info = CGUIStringRenderInfoRefFromVariant(thisValue);
switch ( childIndex )
{
case 0: string_info.m_fFontScale = childValue.GetDouble(); break;
case 1: string_info.m_uFontID = childValue.GetInteger(); break;
case 2: string_info.m_aColor << childValue; break;
}
wxVariant newVariant;
newVariant << string_info;
return newVariant;
}
开发者ID:Abyss116,项目名称:libguiex,代码行数:16,代码来源:wxpgpropertyextend.cpp
示例18: CGUIRectRefFromVariant
// -----------------------------------------------------------------------
wxVariant WxGUIRectProperty::ChildChanged( wxVariant& thisValue, int childIndex, wxVariant& childValue ) const
{
CGUIRect& rect = CGUIRectRefFromVariant(thisValue);
switch ( childIndex )
{
case 0: rect.m_fLeft = childValue.GetDouble(); break;
case 1: rect.m_fTop = childValue.GetDouble(); break;
case 2: rect.m_fRight = childValue.GetDouble(); break;
case 3: rect.m_fBottom = childValue.GetDouble(); break;
}
wxVariant newVariant;
newVariant << rect;
return newVariant;
}
开发者ID:Abyss116,项目名称:libguiex,代码行数:17,代码来源:wxpgpropertyextend.cpp
示例19: SetParameter
bool CommandImplementation::SetParameter(const wxString ¶mName, const wxVariant ¶mValue)
{
wxASSERT(!paramValue.IsType(wxT("null")));
ParamValueMap::iterator iter = mParams.find(paramName);
if (iter == mParams.end())
{
Error(paramName + wxT(" is not a parameter accepted by ") + GetName());
return false;
}
Validator &validator = mType.GetSignature().GetValidator(iter->first);
if (!validator.Validate(paramValue))
{
Error(wxT("Invalid value for parameter '")
+ paramName + wxT("': should be ")
+ validator.GetDescription());
return false;
}
mParams[paramName] = validator.GetConverted();
// (debug)
// Status(wxT("Set parameter ") + paramName + wxT(" to type ") + mParams[paramName].GetType() + wxT(", value ") + mParams[paramName].MakeString());
return true;
}
开发者ID:henricj,项目名称:audacity,代码行数:26,代码来源:Command.cpp
示例20: GetValue
void vvStampsModel::GetValue(
wxVariant& cValue,
const wxDataViewItem& cItem,
unsigned int uColumn
) const
{
wxASSERT(cItem.IsOk());
const DataItem* pItem = this->ConvertDataItem(cItem);
switch (static_cast<Column>(uColumn))
{
case COLUMN_B_CHECKED:
cValue = pItem->bChecked;
return;
case COLUMN_BS_NAME:
case COLUMN_S_NAME:
cValue = pItem->sName;
return;
case COLUMN_U_COUNT:
cValue = static_cast<long>(pItem->uCount);
return;
default:
wxLogError("Unknown StampsModel column: %u", uColumn);
cValue.MakeNull();
return;
}
}
开发者ID:refaqtor,项目名称:sourcegear_veracity_clone,代码行数:31,代码来源:vvStampsControl.cpp
注:本文中的wxVariant类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论