本文整理汇总了C++中PanelRefPtr::setInset方法的典型用法代码示例。如果您正苦于以下问题:C++ PanelRefPtr::setInset方法的具体用法?C++ PanelRefPtr::setInset怎么用?C++ PanelRefPtr::setInset使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PanelRefPtr
的用法示例。
在下文中一共展示了PanelRefPtr::setInset方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: onCreate
/*----------------------------- class specific ----------------------------*/
void GenericFieldContainerEditor::onCreate(const GenericFieldContainerEditor *Id)
{
Inherited::onCreate(Id);
if(Id != NULL)
{
_BoldFont = UIFont::create();
UIFontUnrecPtr ProtoFont(dynamic_cast<Label*>(Label::getClassType().getPrototype())->getFont());
_BoldFont->setFamily(ProtoFont->getFamily());
_BoldFont->setGlyphPixelSize(ProtoFont->getGlyphPixelSize());
_BoldFont->setSize(ProtoFont->getSize());
_BoldFont->setStyle(TextFace::STYLE_BOLD);
BorderLayoutConstraintsRefPtr WestConstraint = BorderLayoutConstraints::create();
WestConstraint->setRegion(BorderLayoutConstraints::BORDER_WEST);
BorderLayoutConstraintsRefPtr NorthConstraint = BorderLayoutConstraints::create();
NorthConstraint->setRegion(BorderLayoutConstraints::BORDER_NORTH);
BorderLayoutConstraintsRefPtr CenterConstraint = BorderLayoutConstraints::create();
CenterConstraint->setRegion(BorderLayoutConstraints::BORDER_CENTER);
BorderLayoutConstraintsRefPtr SouthConstraint = BorderLayoutConstraints::create();
SouthConstraint->setRegion(BorderLayoutConstraints::BORDER_SOUTH);
//Backgournds
ColorLayerRefPtr HeaderBgLayer = ColorLayer::create();
HeaderBgLayer->setColor(Color4f(0.7f,0.7f,0.7f,1.0f));
//Type Panel
_ContainerTypeLabel = Label::create();
_ContainerTypeLabel->setAlignment(Vec2f(0.5f,0.5f));
_ContainerTypeLabel->setBackgrounds(HeaderBgLayer);
_ContainerTypeLabel->setConstraints(WestConstraint);
_ContainerTypeLabel->setPreferredSize(Vec2f(160.0f,22.0f));
_ContainerIdLabel = Label::create();
_ContainerIdLabel->setAlignment(Vec2f(0.5f,0.5f));
_ContainerIdLabel->setBackgrounds(HeaderBgLayer);
_ContainerIdLabel->setConstraints(CenterConstraint);
BorderLayoutRefPtr TheBorderLayout = BorderLayout::create();
PanelRefPtr TypePanel = Panel::createEmpty();
TypePanel->setPreferredSize(Vec2f(160.0f,33.0f));
TypePanel->setInset(Vec4f(1.0f,1.0f,1.0f,10.0f));
TypePanel->pushToChildren(_ContainerIdLabel);
TypePanel->pushToChildren(_ContainerTypeLabel);
TypePanel->setLayout(TheBorderLayout);
TypePanel->setConstraints(NorthConstraint);
pushToChildren(TypePanel);
//Fields Panel
GridBagLayoutRecPtr AllFieldsPanelLayout = GridBagLayout::create();
AllFieldsPanelLayout->setColumns(1);
_FieldsContainer = Panel::createEmpty();
_FieldsContainer->setConstraints(CenterConstraint);
_FieldsContainer->setLayout(AllFieldsPanelLayout);
if(getShowFields())
{
pushToChildren(_FieldsContainer);
}
//Events Panel
GridLayoutRecPtr AllProducedEventsPanelLayout = GridLayout::create();
AllProducedEventsPanelLayout->setColumns(1);
AllProducedEventsPanelLayout->setHorizontalGap(0.0f);
AllProducedEventsPanelLayout->setVerticalGap(0.0f);
_ProducedEventsContainer = Panel::createEmpty();
_ProducedEventsContainer->setConstraints(SouthConstraint);
_ProducedEventsContainer->setLayout(AllProducedEventsPanelLayout);
_ProducedEventsContainer->setInset(Vec4f(0.0f,0.0f,15.0f,0.0f));
if(getShowEvents())
{
pushToChildren(_ProducedEventsContainer);
}
//Main Layout
BorderLayoutRefPtr MainLayout = BorderLayout::create();
setLayout(MainLayout);
_GenericNameAttachmentEditor = GenericNameAttachmentEditor::create();
}
}
示例2: updateFieldsPanel
/*-------------------------------------------------------------------------*\
- private -
\*-------------------------------------------------------------------------*/
void GenericFieldContainerEditor::updateFieldsPanel(FieldContainer* fc)
{
_FieldsContainer->clearChildren();
UInt32 NumFields(fc->getType().getNumFieldDescs());
FieldDescriptionBase* Desc;
FieldEditorComponentUnrecPtr TheEditor;
LabelUnrecPtr TheLabel;
ComponentRecPtr TheToolTip;
GridBagLayoutConstraintsRefPtr LayoutConstraints;
PanelRefPtr FieldPanel;
UInt32 NumRows(0),NumRowsForField(1);
BorderLayoutRefPtr TheBorderLayout = BorderLayout::create();
BorderLayoutConstraintsRefPtr WestConstraint = BorderLayoutConstraints::create();
WestConstraint->setRegion(BorderLayoutConstraints::BORDER_WEST);
BorderLayoutConstraintsRefPtr CenterConstraint = BorderLayoutConstraints::create();
CenterConstraint->setRegion(BorderLayoutConstraints::BORDER_CENTER);
//Backgrounds
ColorLayerRefPtr HeaderBgLayer = ColorLayer::create();
HeaderBgLayer->setColor(Color4f(0.7f,0.7f,0.7f,1.0f));
ColorLayerRefPtr LightBgLayer = ColorLayer::create();
LightBgLayer->setColor(Color4f(0.9f,0.9f,0.9f,1.0f));
ColorLayerRefPtr DarkBgLayer = ColorLayer::create();
DarkBgLayer->setColor(Color4f(0.8f,0.8f,0.8f,1.0f));
LayoutConstraints = GridBagLayoutConstraints::create();
LayoutConstraints->setGridX(0);
LayoutConstraints->setGridY(NumRows);
LayoutConstraints->setGridHeight(1);
LayoutConstraints->setGridWidth(2);
LayoutConstraints->setFill(GridBagLayoutConstraints::FILL_BOTH);
LabelRecPtr FieldsLabel = Label::create();
FieldsLabel->setAlignment(Vec2f(0.5f,0.5f));
FieldsLabel->setText("Fields");
FieldsLabel->setBackgrounds(HeaderBgLayer);
FieldsLabel->setConstraints(LayoutConstraints);
FieldsLabel->setFont(_BoldFont);
_FieldsContainer->pushToChildren(FieldsLabel);
++NumRows;
if(_GenericNameAttachmentEditor->isTypeEditable(fc->getType()))
{
//Create the Label
TheLabel = Label::create();
TheLabel->setText("Name");
TheLabel->setBackgrounds(NULL);
TheLabel->setConstraints(WestConstraint);
TheLabel->setPreferredSize(Vec2f(160.0f,22.0f));
//Attach the Generic Name Editor
_GenericNameAttachmentEditor->setCommandManager(_CmdManager);
_GenericNameAttachmentEditor->attachContainer(fc);
_GenericNameAttachmentEditor->setConstraints(CenterConstraint);
//Create the Panel
LayoutConstraints = GridBagLayoutConstraints::create();
LayoutConstraints->setGridX(0);
LayoutConstraints->setGridY(NumRows);
LayoutConstraints->setGridHeight(1);
LayoutConstraints->setGridWidth(1);
LayoutConstraints->setFill(GridBagLayoutConstraints::FILL_BOTH);
FieldPanel = Panel::createEmpty();
FieldPanel->setInset(Vec4f(1.0f,1.0f,1.0f,1.0f));
FieldPanel->pushToChildren(TheLabel);
FieldPanel->pushToChildren(_GenericNameAttachmentEditor);
FieldPanel->setLayout(TheBorderLayout);
FieldPanel->setConstraints(LayoutConstraints);
FieldPanel->setBackgrounds(LightBgLayer);
_FieldsContainer->pushToChildren(FieldPanel);
++NumRows;
}
UInt32 UsedFieldCount(0);
for(UInt32 i(1) ; i<=NumFields ; ++i)
{
Desc = fc->getFieldDescription(i);
if(Desc != NULL &&
!Desc->isInternal() &&
Desc->getFieldType().getClass() != FieldType::ParentPtrField &&
//HACK: Stop the pixel field from being editable on Images
!(fc->getType().isDerivedFrom(Image::getClassType()) &&
Desc->getFieldId() == Image::PixelFieldId))
{
//Create the Editor
TheEditor = FieldEditorFactory::the()->createDefaultEditor(fc, Desc->getFieldId(), _CmdManager);
if(TheEditor != NULL)
{
NumRowsForField = TheEditor->getNumRequestedRows();
pushToEditors(TheEditor);
TheEditor->setConstraints(CenterConstraint);
//.........这里部分代码省略.........