本文整理汇总了C++中PProperty::SetValue方法的典型用法代码示例。如果您正苦于以下问题:C++ PProperty::SetValue方法的具体用法?C++ PProperty::SetValue怎么用?C++ PProperty::SetValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PProperty
的用法示例。
在下文中一共展示了PProperty::SetValue方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: str
status_t
PListView::SetProperty(const char *name, PValue *value, const int32 &index)
{
if (!name || !value)
return B_ERROR;
BString str(name);
PProperty *prop = FindProperty(name,index);
if (!prop)
return B_NAME_NOT_FOUND;
if (FlagsForProperty(prop) & PROPERTY_READ_ONLY)
return B_READ_ONLY;
BListView *backend = (BListView*)fView;
BoolValue boolval;
CharValue charval;
ColorValue colorval;
FloatValue floatval;
IntValue intval;
PointValue pointval;
RectValue rectval;
StringValue stringval;
status_t status = prop->SetValue(value);
if (status != B_OK)
return status;
if (backend->Window())
backend->Window()->Lock();
else if (str.ICompare("SelectionMessage") == 0)
{
BMessage selMsg(*intval.value);
backend->SetSelectionMessage(&selMsg);
}
else if (str.ICompare("InvocationMessage") == 0)
{
BMessage invMsg(*intval.value);
backend->SetInvocationMessage(&invMsg);
}
else if (str.ICompare("SelectionType") == 0)
{
prop->GetValue(&intval);
backend->SetListType((list_view_type)*intval.value);
}
else
{
if (backend->Window())
backend->Window()->Unlock();
return PView::SetProperty(name, value, index);
}
if (backend->Window())
backend->Window()->Unlock();
return prop->GetValue(value);
}
示例2: str
status_t
PControl::SetProperty(const char *name, PValue *value, const int32 &index)
{
// Modal, Front, and Floating properties are missing because they are read-only
if (!name || !value)
return B_ERROR;
BString str(name);
PProperty *prop = FindProperty(name,index);
if (!prop)
return B_NAME_NOT_FOUND;
status_t status = prop->SetValue(value);
if (status != B_OK)
return status;
if (!fView)
return B_NO_INIT;
BControl *viewAsControl = (BControl*)fView;
BoolValue bv;
IntValue iv;
StringValue sv;
if (viewAsControl->Window())
viewAsControl->Window()->Lock();
if (str.ICompare("Enabled") == 0)
{
prop->GetValue(&bv);
viewAsControl->SetEnabled(bv.value);
}
else if (str.ICompare("Label") == 0)
{
prop->GetValue(&sv);
viewAsControl->SetLabel(sv.value->String());
viewAsControl->Invalidate();
}
else if (str.ICompare("Value") == 0)
{
prop->GetValue(&iv);
viewAsControl->SetValue(*iv.value);
}
else
{
if (viewAsControl->Window())
viewAsControl->Window()->Unlock();
return PView::SetProperty(name,value,index);
}
if (viewAsControl->Window())
viewAsControl->Window()->Unlock();
return prop->GetValue(value);
}
示例3: str
status_t
PLabel::SetProperty(const char *name, PValue *value, const int32 &index)
{
if (!name || !value)
return B_ERROR;
BString str(name);
PProperty *prop = FindProperty(name,index);
if (!prop)
return B_NAME_NOT_FOUND;
if (FlagsForProperty(prop) & PROPERTY_READ_ONLY)
return B_READ_ONLY;
BStringView *backend = (BStringView*)fView;
BoolValue boolval;
CharValue charval;
ColorValue colorval;
FloatValue floatval;
IntValue intval;
PointValue pointval;
RectValue rectval;
StringValue stringval;
status_t status = prop->SetValue(value);
if (status != B_OK)
return status;
if (backend->Window())
backend->Window()->Lock();
if (str.ICompare("Alignment") == 0)
{
prop->GetValue(&intval);
backend->SetAlignment((alignment)*intval.value);
}
else if (str.ICompare("Text") == 0)
{
prop->GetValue(&stringval);
backend->SetText(*stringval.value);
}
else
{
if (backend->Window())
backend->Window()->Unlock();
return PView::SetProperty(name, value, index);
}
if (backend->Window())
backend->Window()->Unlock();
return prop->GetValue(value);
}
示例4: GetObject
PObjectBase XrcLoader::GetObject( ticpp::Element *xrcObj, PObjectBase parent )
{
// First, create the object by the name, the modify the properties
std::string className = xrcObj->GetAttribute( "class" );
if ( parent->GetObjectTypeName() == wxT( "project" ) )
{
if ( className == "wxBitmap" )
{
PProperty bitmapsProp = parent->GetProperty( _( "bitmaps" ) );
if ( bitmapsProp )
{
wxString value = bitmapsProp->GetValue();
wxString text = _WXSTR( xrcObj->GetText() );
text.Replace( wxT( "\'" ), wxT( "\'\'" ), true );
value << wxT( "\'" ) << text << wxT( "\' " );
bitmapsProp->SetValue( value );
return PObjectBase();
}
}
if ( className == "wxIcon" )
{
PProperty iconsProp = parent->GetProperty( _( "icons" ) );
if ( iconsProp )
{
wxString value = iconsProp->GetValue();
wxString text = _WXSTR( xrcObj->GetText() );
text.Replace( wxT( "\'" ), wxT( "\'\'" ), true );
value << wxT( "\'" ) << text << wxT( "\' " );
iconsProp->SetValue( value );
return PObjectBase();
}
}
// Forms wxPanel, wxFrame, wxDialog are stored internally as Panel, Frame, and Dialog
// to prevent conflicts with wxPanel as a container
className = className.substr( 2, className.size() - 2 );
}
// Well, this is not nice. wxMenu class name is ambiguous, so we'll get the
// correct class by the context. If the parent of a wxMenu is another wxMenu
// then the class name will be "submenu"
else if ( className == "wxMenu" && ( parent->GetClassName() == wxT( "wxMenu" ) || parent->GetClassName() == wxT( "submenu" ) ) )
{
className = "submenu";
}
// "separator" is also ambiguous - could be a toolbar separator or a menu separator
else if ( className == "separator" )
{
if ( parent->GetClassName() == wxT( "wxToolBar" ) )
{
className = "toolSeparator";
}
}
// replace "spacer" with "sizeritem" so it will be imported as a "sizeritem"
// "sizeritem" is ambiguous - could also be a grid bag sizeritem
else if ( className == "spacer" || className == "sizeritem" )
{
if ( parent->GetClassName() == wxT( "wxGridBagSizer" ) )
{
className = "gbsizeritem";
}
else
{
className = "sizeritem";
}
}
PObjectBase object;
PObjectInfo objInfo = m_objDb->GetObjectInfo( _WXSTR( className ) );
if ( objInfo )
{
IComponent *comp = objInfo->GetComponent();
if ( !comp )
{
wxLogError( _("No component found for class \"%s\", found on line %i."), _WXSTR( className ).c_str(), xrcObj->Row() );
}
else
{
ticpp::Element *fbObj = comp->ImportFromXrc( xrcObj );
if ( !fbObj )
{
wxLogError( _("ImportFromXrc returned NULL for class \"%s\", found on line %i."), _WXSTR( className ).c_str(), xrcObj->Row() );
}
else
{
object = m_objDb->CreateObject( fbObj, parent );
if ( !object )
{
// Unable to create the object and add it to the parent - probably needs a sizer
PObjectBase newsizer = m_objDb->CreateObject( "wxBoxSizer", parent );
if ( newsizer )
{
// It is possible the CreateObject returns an "item" containing the object, e.g. SizerItem or SplitterItem
// If that is the case, reassign "object" to the actual object
PObjectBase sizer = newsizer;
if ( sizer->GetChildCount() > 0 )
{
//.........这里部分代码省略.........
示例5: str
status_t
PMenuItem::SetProperty(const char *name, PValue *value, const int32 &index)
{
if (!name || !value)
return B_ERROR;
BString str(name);
PProperty *prop = FindProperty(name,index);
if (!prop)
return B_NAME_NOT_FOUND;
if (FlagsForProperty(prop) & PROPERTY_READ_ONLY)
return B_READ_ONLY;
BMenuItem *backend = (BMenuItem*)fBackend;
BoolValue boolval;
CharValue charval;
ColorValue colorval;
FloatValue floatval;
IntValue intval;
PointValue pointval;
RectValue rectval;
StringValue stringval;
status_t status = prop->SetValue(value);
if (status != B_OK)
return status;
if (str.ICompare("Message") == 0)
{
prop->GetValue(&intval);
backend->SetMessage(new BMessage(*intval.value));
}
else if (str.ICompare("Trigger") == 0)
{
prop->GetValue(&charval);
backend->SetTrigger(*charval.value);
}
else if (str.ICompare("Label") == 0)
{
prop->GetValue(&stringval);
backend->SetLabel(*stringval.value);
}
else if (str.ICompare("Marked") == 0)
{
prop->GetValue(&boolval);
backend->SetMarked(*boolval.value);
}
else if (str.ICompare("Enabled") == 0)
{
prop->GetValue(&boolval);
backend->SetEnabled(*boolval.value);
}
else
{
return PObject::SetProperty(name, value, index);
}
return prop->GetValue(value);
}
示例6: str
status_t
PTextView::SetProperty(const char *name, PValue *value, const int32 &index)
{
if (!name || !value)
return B_ERROR;
BString str(name);
PProperty *prop = FindProperty(name,index);
if (!prop)
return B_NAME_NOT_FOUND;
if (FlagsForProperty(prop) & PROPERTY_READ_ONLY)
return B_READ_ONLY;
BTextView *backend = (BTextView*)fView;
BoolValue boolval;
CharValue charval;
ColorValue colorval;
FloatValue floatval;
IntValue intval;
PointValue pointval;
RectValue rectval;
StringValue stringval;
status_t status = prop->SetValue(value);
if (status != B_OK)
return status;
if (backend->Window())
backend->Window()->Lock();
else if (str.ICompare("Selectable") == 0)
{
prop->GetValue(&boolval);
backend->MakeSelectable(*boolval.value);
}
else if (str.ICompare("CurrentLine") == 0)
{
prop->GetValue(&intval);
backend->GoToLine(*intval.value);
}
else if (str.ICompare("TabWidth") == 0)
{
prop->GetValue(&floatval);
backend->SetTabWidth(*floatval.value);
}
else if (str.ICompare("TextRect") == 0)
{
prop->GetValue(&rectval);
backend->SetTextRect(*rectval.value);
}
else if (str.ICompare("MaxBytes") == 0)
{
prop->GetValue(&intval);
backend->SetMaxBytes(*intval.value);
}
else if (str.ICompare("UseWordWrap") == 0)
{
prop->GetValue(&boolval);
backend->SetWordWrap(*boolval.value);
}
else if (str.ICompare("HideTyping") == 0)
{
prop->GetValue(&boolval);
backend->HideTyping(*boolval.value);
}
else if (str.ICompare("Editable") == 0)
{
prop->GetValue(&boolval);
backend->MakeEditable(*boolval.value);
}
else if (str.ICompare("ColorSpace") == 0)
{
prop->GetValue(&intval);
backend->SetColorSpace((color_space)*intval.value);
}
else if (str.ICompare("Text") == 0)
{
prop->GetValue(&stringval);
backend->SetText(*stringval.value);
}
else if (str.ICompare("Resizable") == 0)
{
prop->GetValue(&boolval);
backend->MakeResizable(*boolval.value);
}
else if (str.ICompare("Alignment") == 0)
{
prop->GetValue(&intval);
backend->SetAlignment((alignment)*intval.value);
}
else if (str.ICompare("Undoable") == 0)
{
prop->GetValue(&boolval);
backend->SetDoesUndo(*boolval.value);
}
else if (str.ICompare("AutoIndent") == 0)
{
prop->GetValue(&boolval);
//.........这里部分代码省略.........
示例7: ScanPanes
void VisualEditor::ScanPanes( wxWindow* parent)
{
bool updateNeeded;
wxLogNull stopTheLogging;
const wxWindowList& children = parent->GetChildren();
for ( wxWindowList::const_reverse_iterator child = children.rbegin(); child != children.rend(); ++child )
{
ScanPanes(*child);
PObjectBase obj = GetObjectBase( *child );
if ( obj )
{
updateNeeded = false;
PObjectInfo obj_info = obj->GetObjectInfo();
wxString cname = obj_info->GetObjectType()->GetName();
if( cname == wxT("widget") ||
cname == wxT("expanded_widget") ||
cname == wxT("toolbar") ||
cname == wxT("container") )
{
wxAuiPaneInfo inf = m_auimgr->GetPane(*child);
if(inf.IsOk())
{
// scan position and docking mode
if( !obj->GetPropertyAsInteger( wxT("center_pane") ) )
{
wxString dock;
if( inf.IsDocked())
{
wxString dockDir;
switch(inf.dock_direction)
{
case 1:
dockDir = wxT("Top");
break;
case 2:
dockDir = wxT("Right");
break;
case 3:
dockDir = wxT("Bottom");
break;
case 4:
dockDir = wxT("Left");
break;
case 5:
dockDir = wxT("Center");
break;
default:
dockDir = wxT("Left");
break;
}
PProperty pdock = obj->GetProperty( wxT("docking") );
if( pdock->GetValue() != dockDir )
{
pdock->SetValue( dockDir );
updateNeeded = true;
}
dock = wxT("Dock");
}
else
{
// scan "floating position"
wxPoint pos = inf.floating_pos;
if ( pos.x != -1 && pos.y != -1 )
{
PProperty pposition = obj->GetProperty( wxT("pane_position") );
if( pposition->GetValue() != TypeConv::PointToString( pos ) )
{
pposition->SetValue( TypeConv::PointToString( pos ) );
updateNeeded = true;
}
}
// scan "floating size"
wxSize paneSize = inf.floating_size;
if ( paneSize.x != -1 && paneSize.y != -1 )
{
PProperty psize = obj->GetProperty( wxT("pane_size") );
if( psize->GetValue() != TypeConv::SizeToString( paneSize ) )
{
psize->SetValue( TypeConv::SizeToString( paneSize ) );
obj->GetProperty( wxT("resize") )->SetValue( wxT("Resizable") );
updateNeeded = true;
}
}
dock = wxT("Float");
//.........这里部分代码省略.........
示例8: OnRun
//.........这里部分代码省略.........
}
}
#endif
wxYield();
// Read size and position from config file
wxConfigBase *config = wxConfigBase::Get();
config->SetPath( wxT("/mainframe") );
int x, y, w, h;
x = y = w = h = -1;
config->Read( wxT( "PosX" ), &x );
config->Read( wxT( "PosY" ), &y );
config->Read( wxT( "SizeW" ), &w );
config->Read( wxT( "SizeH" ), &h );
long style = config->Read( wxT("style"), wxFB_WIDE_GUI );
if ( style != wxFB_CLASSIC_GUI )
{
style = wxFB_WIDE_GUI;
}
config->SetPath( wxT("/") );
m_frame = new MainFrame( NULL ,-1, (int)style, wxPoint( x, y ), wxSize( w, h ) );
if ( !justGenerate )
{
m_frame->Show( TRUE );
SetTopWindow( m_frame );
#ifndef __WXFB_DEBUG__
// turn off the splash screen
delete splash.release();
#endif
#ifdef __WXFB_DEBUG__
wxLogWindow* log = dynamic_cast< wxLogWindow* >( AppData()->GetDebugLogTarget() );
if ( log )
{
m_frame->AddChild( log->GetFrame() );
}
#endif //__WXFB_DEBUG__
}
// This is not necessary for wxFB to work. However, Windows sets the Current Working Directory
// to the directory from which a .fbp file was opened, if opened from Windows Explorer.
// This puts an unneccessary lock on the directory.
// This changes the CWD to the already locked app directory as a workaround
#ifdef __WXMSW__
::wxSetWorkingDirectory( dataDir );
#endif
if ( !projectToLoad.empty() )
{
if ( AppData()->LoadProject( projectToLoad, justGenerate ) )
{
if ( justGenerate )
{
if ( hasLanguage )
{
PObjectBase project = AppData()->GetProjectData();
PProperty codeGen = project->GetProperty( _("code_generation") );
if ( codeGen )
{
codeGen->SetValue( language );
}
}
AppData()->GenerateCode( false, true );
return 0;
}
else
{
m_frame->InsertRecentProject( projectToLoad );
return wxApp::OnRun();
}
}
else
{
wxLogError( wxT("Unable to load project: %s"), projectToLoad.c_str() );
}
}
if ( justGenerate )
{
return 6;
}
AppData()->NewProject();
#ifdef __WXMAC__
// document to open on startup
if(!m_mac_file_name.IsEmpty())
{
if ( AppData()->LoadProject( m_mac_file_name ) )
m_frame->InsertRecentProject( m_mac_file_name );
}
#endif
return wxApp::OnRun();
}
示例9: str
status_t
PProgressBar::SetProperty(const char *name, PValue *value, const int32 &index)
{
if (!name || !value)
return B_ERROR;
BString str(name);
PProperty *prop = FindProperty(name,index);
if (!prop)
return B_NAME_NOT_FOUND;
if (FlagsForProperty(prop) & PROPERTY_READ_ONLY)
return B_READ_ONLY;
BStatusBar *backend = (BStatusBar*)fView;
BoolValue boolval;
ColorValue colorval;
FloatValue floatval;
IntValue intval;
PointValue pointval;
RectValue rectval;
StringValue stringval;
status_t status = prop->SetValue(value);
if (status != B_OK)
return status;
if (backend->Window())
backend->Window()->Lock();
if (str.ICompare("BarColor") == 0)
{
prop->GetValue(&colorval);
backend->SetBarColor(*colorval.value);
}
else if (str.ICompare("BarHeight") == 0)
{
prop->GetValue(&floatval);
backend->SetBarHeight(*floatval.value);
}
else if (str.ICompare("CurrentValue") == 0)
{
prop->GetValue(&floatval);
float current = backend->CurrentValue();
backend->Update((*floatval.value) - current);
}
else if (str.ICompare("MaxValue") == 0)
{
prop->GetValue(&floatval);
backend->SetMaxValue(*floatval.value);
}
else if (str.ICompare("Text") == 0)
{
prop->GetValue(&stringval);
backend->SetText(*stringval.value);
}
else if (str.ICompare("TrailingText") == 0)
{
prop->GetValue(&stringval);
backend->SetTrailingText(*stringval.value);
}
else
{
if (backend->Window())
backend->Window()->Unlock();
return PView::SetProperty(name, value, index);
}
if (backend->Window())
backend->Window()->Unlock();
return prop->GetValue(value);
}
示例10: GenConstruction
//.........这里部分代码省略.........
type == wxT("menu") ||
type == wxT("submenu") ||
type == wxT("toolbar") ||
type == wxT("ribbonbar") ||
type == wxT("listbook") ||
type == wxT("simplebook") ||
type == wxT("notebook") ||
type == wxT("auinotebook") ||
type == wxT("treelistctrl") ||
type == wxT("flatnotebook") ||
type == wxT("wizard")
)
{
wxString afterAddChild = GetCode( obj, wxT("after_addchild") );
if ( !afterAddChild.empty() )
{
m_source->WriteLn( afterAddChild );
}
m_source->WriteLn();
}
}
else if ( info->IsSubclassOf( wxT("sizeritembase") ) )
{
// The child must be added to the sizer having in mind the
// child object type (there are 3 different routines)
GenConstruction( obj->GetChild(0), false );
PObjectInfo childInfo = obj->GetChild(0)->GetObjectInfo();
wxString temp_name;
if ( childInfo->IsSubclassOf( wxT("wxWindow") ) || wxT("CustomControl") == childInfo->GetClassName() )
{
temp_name = wxT("window_add");
}
else if ( childInfo->IsSubclassOf( wxT("sizer") ) )
{
temp_name = wxT("sizer_add");
}
else if ( childInfo->GetClassName() == wxT("spacer") )
{
temp_name = wxT("spacer_add");
}
else
{
LogDebug( wxT("SizerItem child is not a Spacer and is not a subclass of wxWindow or of sizer.") );
return;
}
m_source->WriteLn( GetCode( obj, temp_name ) );
}
else if ( type == wxT("notebookpage") ||
type == wxT("flatnotebookpage") ||
type == wxT("listbookpage") ||
type == wxT("simplebookpage") ||
type == wxT("choicebookpage") ||
type == wxT("auinotebookpage")
)
{
GenConstruction( obj->GetChild( 0 ), false );
m_source->WriteLn( GetCode( obj, wxT("page_add") ) );
GenSettings( obj->GetObjectInfo(), obj );
}
else if ( type == wxT("treelistctrlcolumn") )
{
m_source->WriteLn( GetCode( obj, wxT("column_add") ) );
GenSettings( obj->GetObjectInfo(), obj );
}
else if ( type == wxT("tool") )
{
// If loading bitmap from ICON resource, and size is not set, set size to toolbars bitmapsize
// So hacky, yet so useful ...
wxSize toolbarsize = obj->GetParent()->GetPropertyAsSize( _("bitmapsize") );
if ( wxDefaultSize != toolbarsize )
{
PProperty prop = obj->GetProperty( _("bitmap") );
if ( prop )
{
wxString oldVal = prop->GetValueAsString();
wxString path, source;
wxSize toolsize;
TypeConv::ParseBitmapWithResource( oldVal, &path, &source, &toolsize );
if ( wxT("Load From Icon Resource") == source && wxDefaultSize == toolsize )
{
prop->SetValue( wxString::Format( wxT("%s; %s [%i; %i]"), path.c_str(), source.c_str(), toolbarsize.GetWidth(), toolbarsize.GetHeight() ) );
m_source->WriteLn( GetCode( obj, wxT("construction") ) );
prop->SetValue( oldVal );
return;
}
}
}
m_source->WriteLn( GetCode( obj, wxT("construction") ) );
}
else
{
// Generate the children
for ( unsigned int i = 0; i < obj->GetChildCount(); i++ )
{
GenConstruction( obj->GetChild( i ), false );
}
}
}