void TabPanel::insertTab(const UInt32 TabIndex, Component* const Tab, Component* const TabContent) { pushToChildren(Tab); pushToChildren(TabContent); editMFTabs()->insert(editMFTabs()->find(getTabs(TabIndex)), Tab); // an incredibly ridiculous function call editMFTabContents()->insert(editMFTabContents()->find(getTabContents(TabIndex)), TabContent); }
void TextureFieldContainerEditor::onCreate(const TextureFieldContainerEditor *Id) { Inherited::onCreate(Id); if(Id != NULL) { Matrix m; m.setScale(Vec3f(3.0f,3.0f,1.0f)); m.setTranslate(Pnt3f(-1.0f,-1.0f,0.0f)); TextureTransformChunkRefPtr TextureTransform = TextureTransformChunk::create(); TextureTransform->setMatrix(m); //Create the ImageComponent _ImageDisplayComponent = ImageComponent::create(); _ImageDisplayComponent->setPreferredSize(Vec2f(250.0f,250.0f)); _ImageDisplayComponent->setScale(ImageComponent::SCALE_STRETCH); _ImageDisplayComponent->setTransformation(TextureTransform); SpringLayoutRefPtr TheLayout = SpringLayout::create(); TheLayout->putConstraint(SpringLayoutConstraints::NORTH_EDGE,_ImageDisplayComponent, 0,SpringLayoutConstraints::NORTH_EDGE, this); TheLayout->putConstraint(SpringLayoutConstraints::HORIZONTAL_CENTER_EDGE,_ImageDisplayComponent, 0,SpringLayoutConstraints::HORIZONTAL_CENTER_EDGE, this); TheLayout->putConstraint(SpringLayoutConstraints::NORTH_EDGE,_GenericEditor, 1,SpringLayoutConstraints::SOUTH_EDGE, _ImageDisplayComponent); TheLayout->putConstraint(SpringLayoutConstraints::SOUTH_EDGE,_GenericEditor, 0,SpringLayoutConstraints::SOUTH_EDGE, this); TheLayout->putConstraint(SpringLayoutConstraints::EAST_EDGE,_GenericEditor, 0,SpringLayoutConstraints::EAST_EDGE, this); TheLayout->putConstraint(SpringLayoutConstraints::WEST_EDGE, _GenericEditor, 0,SpringLayoutConstraints::WEST_EDGE, this); setLayout(TheLayout); pushToChildren(_ImageDisplayComponent); pushToChildren(_GenericEditor); } }
void TabPanel::insertTab(Component* const TabInsert, Component* const Tab, Component* const TabContent) { UInt32 index(0); pushToChildren(Tab); pushToChildren(TabContent); // check if the component is a tab or tabcontent, then insert accordingly if (editMFTabs()->end() == editMFTabs()->find(TabInsert)) { for (UInt32 i = 0; i < getMFTabContents()->size(); ++i) { if(editMFTabContents()->find(TabInsert) == editMFTabContents()->find(getTabContents(i))) index = i; } editMFTabContents()->insert(editMFTabContents()->find(TabInsert), TabContent); editMFTabs()->insert(editMFTabs()->find(getTabs(index)), Tab); } else { for (UInt32 i = 0; i < getMFTabs()->size(); ++i) { if(editMFTabs()->find(TabInsert) == editMFTabs()->find(getTabs(i))) index = i; } editMFTabs()->insert(editMFTabs()->find(TabInsert), Tab); editMFTabContents()->insert(editMFTabContents()->find(getTabContents(index)), TabContent); } }
void TabPanel::addTab(Component* const Tab, Component* const TabContent) { // three lists of components are actually kept // every component, whether tab or tabcontent is kept in the children list // this is for clipping and clicking purposes // for drawing, the tabs and tabcontents are kept seperately in two other lists // so, there are three lists, and every component is kept in two of them pushToTabs(Tab); pushToTabContents(TabContent); pushToChildren(Tab); pushToChildren(TabContent); }
void TableHeader::updateColumnHeadersComponents(void) { if(getColumnModel() == NULL) return; std::vector<UInt32> SelectedColumns = getColumnModel()->getSelectedColumns(); std::vector<UInt32>::iterator SearchItor; bool isSelected(false); clearColumnHeaders(); for(UInt32 i(0) ; i<getColumnModel()->getColumnCount(); ++i) { SearchItor = std::find(SelectedColumns.begin(), SelectedColumns.end(), i); isSelected = (SearchItor != SelectedColumns.end()); //TODO: Add Column Focusing ComponentUnrecPtr NewComp(_DefaultTableHeaderRenderer->getTableCellRendererComponent(getTable(), getColumnModel()->getColumn(i)->getHeaderValue(), isSelected, false, 0, i)); pushToColumnHeaders(NewComp); } clearChildren(); //Add all of the Header Components for(UInt32 i(0); i<getMFColumnHeaders()->size() ; ++i) { pushToChildren(getColumnHeaders(i)); } //TODO: Add all of the Margin Components }
void VideoFieldContainerEditor::onCreate(const VideoFieldContainerEditor *Id) { Inherited::onCreate(Id); if(GlobalSystemState != Startup) { //Create the Panel for the video preview PanelRecPtr VideoPanel = createVideoPreviewPanel(); ScrollPanelRecPtr EditorScrollPanel = ScrollPanel::create(); EditorScrollPanel->setViewComponent(_GenericEditor); _MainSplitPanel = SplitPanel::create(); _MainSplitPanel->setOrientation(SplitPanel::VERTICAL_ORIENTATION); _MainSplitPanel->setDividerPosition(350.0f); _MainSplitPanel->setMinComponent(VideoPanel); _MainSplitPanel->setMaxComponent(EditorScrollPanel); //Add the SplitPanel pushToChildren(_MainSplitPanel); //Set the layout constraints for the SplitPanel BorderLayoutConstraintsRecPtr CenterConstraints = BorderLayoutConstraints::create(); CenterConstraints->setRegion(BorderLayoutConstraints::BORDER_CENTER); _MainSplitPanel->setConstraints(CenterConstraints); //Set the layout BorderLayoutRecPtr MainLayout = BorderLayout::create(); setLayout(MainLayout); } }
void SplitPanel::updateChildren(void) { clearChildren(); if(getDividerDrawObject() != NULL) { pushToChildren(getDividerDrawObject()); } if(getMinComponent() != NULL) { pushToChildren(getMinComponent()); } if(getMaxComponent() != NULL) { pushToChildren(getMaxComponent()); } }
void ContentPanel::init() { //Create the Lua Code Editing Panel createLuaEditorSplitPanel(); setIsSplit(false); //Create the Scene Graph Editing Panel createSceneEditorPanel(); //Add the Editing Panels in a card layout to this panel _MainCardLayout = CardLayout::create(); pushToChildren(_SceneEditorPanel); pushToChildren(_LuaEditorSplitPanel); setLayout(_MainCardLayout); setBackgrounds(NULL); setBorders(NULL); }
void Toolbar::addTool(ComponentRefPtr TheTool) { if(TheTool->getType() == Separator::getClassType()) { addSeparator(dynamic_pointer_cast<Separator>(TheTool)); } pushToChildren(TheTool); }
void Spinner::changed(ConstFieldMaskArg whichField, UInt32 origin, BitVector details) { Inherited::changed(whichField, origin, details); if(whichField & NextButtonFieldMask || whichField & PreviousButtonFieldMask || whichField & EditorFieldMask) { clearChildren(); if(getNextButton() != NULL) { pushToChildren(getNextButton()); } if(getPreviousButton() != NULL) { pushToChildren(getPreviousButton()); } if(getEditor() != NULL) { pushToChildren(getEditor()); } } if(whichField & NextButtonFieldMask) { _NextButtonActionConnection.disconnect(); if(getNextButton() != NULL) { _NextButtonActionConnection = getNextButton()->connectMousePressedActionPerformed(boost::bind(&Spinner::handleNextButtonAction, this, _1)); } } if(whichField & PreviousButtonFieldMask) { _PreviousButtonActionConnection.disconnect(); if(getPreviousButton() != NULL) { _PreviousButtonActionConnection = getPreviousButton()->connectMousePressedActionPerformed(boost::bind(&Spinner::handlePreviousButtonAction, this, _1)); } } }
/*----------------------------- class specific ----------------------------*/ void BoolFieldEditor::onCreate(const BoolFieldEditor *Id) { Inherited::onCreate(Id); if(Id != NULL) { _EditingCheckbox = CheckboxButton::create(); _EditingCheckbox->setAlignment(Vec2f(0.05f, 0.5f)); pushToChildren(_EditingCheckbox); } }
/*----------------------------- class specific ----------------------------*/ void GenericFieldEditor::onCreate(const GenericFieldEditor *Id) { Inherited::onCreate(Id); if(Id != NULL) { _EditingTextField = TextField::create(); pushToChildren(_EditingTextField); _EditingTextField->addFocusListener(&_TextFieldListener); _EditingTextField->addActionListener(&_TextFieldListener); _EditingTextField->addKeyListener(&_TextFieldListener); } }
void Toolbar::addSeparator(SeparatorRefPtr TheSeparator) { if(getOrientation() == BoxLayout::VERTICAL_ORIENTATION) { TheSeparator->setOrientation(Separator::HORIZONTAL_ORIENTATION); } else { TheSeparator->setOrientation(Separator::VERTICAL_ORIENTATION); } pushToChildren(TheSeparator); }
void HelperPanel::setupRest() { _Layout = SpringLayout::create(); _Layout->putConstraint(SpringLayoutConstraints::NORTH_EDGE, _InfoTabPanel, 5, SpringLayoutConstraints::NORTH_EDGE, this); _Layout->putConstraint(SpringLayoutConstraints::SOUTH_EDGE, _InfoTabPanel, -5, SpringLayoutConstraints::SOUTH_EDGE, this); _Layout->putConstraint(SpringLayoutConstraints::EAST_EDGE, _InfoTabPanel, -5, SpringLayoutConstraints::EAST_EDGE, this); _Layout->putConstraint(SpringLayoutConstraints::WEST_EDGE, _InfoTabPanel, 5, SpringLayoutConstraints::WEST_EDGE, this); pushToChildren(_InfoTabPanel); setLayout(_Layout); setBorders(NULL); }
void GenericFieldContainerEditor::updateShownPanels(void) { if(getShowFields() && getMFChildren()->findIndex(_FieldsContainer) < 0) { pushToChildren(_FieldsContainer); } else if(!getShowFields() && getMFChildren()->findIndex(_FieldsContainer) >= 0) { removeObjFromChildren(_FieldsContainer); } if(getShowEvents() && getMFChildren()->findIndex(_ProducedEventsContainer) < 0) { pushToChildren(_ProducedEventsContainer); } else if(!getShowEvents() && getMFChildren()->findIndex(_ProducedEventsContainer) >= 0) { removeObjFromChildren(_ProducedEventsContainer); } }
void PopupMenu::addSeparator(void) { SeparatorRefPtr TheSeparator; if(getDefaultSeparator() != NULL) { FieldContainerUnrecPtr TheSeperator(getDefaultSeparator()->shallowCopy()); TheSeparator = dynamic_pointer_cast<Separator>(TheSeperator); } else { TheSeparator = Separator::create(); } TheSeparator->setOrientation(Separator::HORIZONTAL_ORIENTATION); pushToChildren(TheSeparator); }
void ColorChooser::updateChildren(void) { if(getMFInternalChooserPanels()->size() > 1) { if(_LayoutTabPanel == NULL) { _LayoutTabPanel = TabPanel::create(); } _LayoutTabPanel->removeAllTabs(); LabelRefPtr TabLabel; for(UInt32 i(0) ; i<getMFInternalChooserPanels()->size() ; ++i) { TabLabel = Label::create(); TabLabel->setText(getInternalChooserPanels(i)->getDisplayText()); TabLabel->setBorders(NULL); TabLabel->setBackgrounds(NULL); _LayoutTabPanel->addTab(TabLabel, getInternalChooserPanels(i)); } _LayoutTabPanel->setSelectedIndex(0); clearChildren(); pushToChildren(_LayoutTabPanel); if(getPreviewPanel() != NULL) { pushToChildren(getPreviewPanel()); } else { pushToChildren(_DefaultPreviewPanel); } } else if(getMFInternalChooserPanels()->size() == 1) { if(_LayoutTabPanel != NULL) { _LayoutTabPanel = NULL; } clearChildren(); pushToChildren(getMFInternalChooserPanels()->front()); if(getPreviewPanel() != NULL) { pushToChildren(getPreviewPanel()); } else { pushToChildren(_DefaultPreviewPanel); } } }
/*-------------------------------------------------------------------------*\ - private - \*-------------------------------------------------------------------------*/ void TextFieldEditor::onCreate(const TextFieldEditor *Id) { Inherited::onCreate(Id); if(Id != NULL) { _EditingTextArea = TextArea::create(); _EditingTextAreaScrollPanel = ScrollPanel::create(); _EditingTextAreaScrollPanel->setViewComponent(_EditingTextArea); pushToChildren(_EditingTextAreaScrollPanel); _TextDomAreaFocusGainedConnection = _EditingTextArea->connectFocusGained(boost::bind(&TextFieldEditor::handleTextDomAreaFocusGained, this, _1)); _TextDomAreaFocusLostConnection = _EditingTextArea->connectFocusLost(boost::bind(&TextFieldEditor::handleTextDomAreaFocusLost, this, _1)); //_TextDomAreaActionPerformedConnection = _EditingTextArea->connectActionPerformed(boost::bind(&TextFieldEditor::handleTextDomAreaActionPerformed, this, _1)); _TextDomAreaKeyTypedConnection = _EditingTextArea->connectKeyTyped(boost::bind(&TextFieldEditor::handleTextDomAreaKeyTyped, this, _1)); } }
void SpinnerDefaultEditor::changed(ConstFieldMaskArg whichField, UInt32 origin, BitVector details) { Inherited::changed(whichField, origin, details); if(whichField & SpinnerFieldMask) { _EditorTextFieldActionConnection.disconnect(); if(getSpinner() != NULL) { _ModelStateChangedConnection = getSpinner()->getModel()->connectStateChanged(boost::bind(&SpinnerDefaultEditor::handleModelStateChanged, this, _1)); if(getTextField() != NULL) { //Update the Value of the TextField std::string NewValue; try { getTextField()->setText(getSpinner()->getModel()->getValueAsString()); } catch(boost::bad_any_cast &) { getTextField()->setText(""); } } } } if(whichField & TextFieldFieldMask) { clearChildren(); _EditorTextFieldActionConnection.disconnect(); _EditorTextFieldFocusLostConnection.disconnect(); _EditorTextFieldKeyPressedConnection.disconnect(); if(getTextField() != NULL) { pushToChildren(getTextField()); _EditorTextFieldActionConnection = getTextField()->connectActionPerformed(boost::bind(&SpinnerDefaultEditor::handleEditorTextFieldActionPerformed, this, _1)); _EditorTextFieldFocusLostConnection = getTextField()->connectFocusLost(boost::bind(&SpinnerDefaultEditor::handleEditorTextFieldFocusLost, this, _1)); _EditorTextFieldKeyPressedConnection = getTextField()->connectKeyPressed(boost::bind(&SpinnerDefaultEditor::handleEditorTextFieldKeyPressed, this, _1)); } } }
void UIViewport::changed(ConstFieldMaskArg whichField, UInt32 origin, BitVector details) { Inherited::changed(whichField, origin, details); if(whichField & ViewComponentFieldMask) { clearChildren(); if(getViewComponent() != NULL) { pushToChildren(getViewComponent()); } } if((whichField & ViewSizeFieldMask) && getViewComponent() != NULL) { updateViewComponentSize(); produceStateChanged(ChangeEvent::create(UIViewportRefPtr(this), getSystemTime())); } if((whichField & ViewPositionFieldMask) && getViewComponent() != NULL) { getViewComponent()->editPosition().setValues(-getViewPosition().x(),-getViewPosition().y()); produceStateChanged(ChangeEvent::create(UIViewportRefPtr(this), getSystemTime())); } if((whichField & ViewSizeFieldMask) || (whichField & ViewPositionFieldMask) || (whichField & SizeFieldMask)) { produceStateChanged(ChangeEvent::create(UIViewportRefPtr(this), getSystemTime())); } if(whichField & SizeFieldMask && getViewComponent() != NULL && (getViewComponent()->getScrollableTracksViewportHeight() || getViewComponent()->getScrollableTracksViewportWidth())) { updateViewComponentSize(); } }
void ListGeneratedPopupMenu::updateMenuItems(void) { clearChildren(); if(getModel() != NULL)// && ) { MenuItemRefPtr Item; for(Int32 i(0) ; i<getModel()->getSize() ; ++i) { if(getCellGenerator() != NULL) { Item = ComponentMenuItem::create(); ComponentRefPtr TheComponent = getCellGenerator()->getComponent(ListGeneratedPopupMenuRefPtr(this), getModel()->getElementAt(i), i, 0, false, false); TheComponent->setBackgrounds(NULL); dynamic_pointer_cast<ComponentMenuItem>(Item)->setComponent(TheComponent); } else { //Generate the Menu Item Item = MenuItem::create(); std::string TheText; try { TheText = lexical_cast(getModel()->getElementAt(i)); } catch (boost::bad_lexical_cast &) { //Could not convert to a string } dynamic_pointer_cast<MenuItem>(Item)->setText(TheText); } pushToChildren(Item); } } producePopupMenuContentsChanged(PopupMenuEvent::create(PopupMenuRefPtr(this), getSystemTime())); }
/*-------------------------------------------------------------------------*\ - private - \*-------------------------------------------------------------------------*/ void GenericMultiFieldEditor::onCreate(const GenericMultiFieldEditor *Id) { Inherited::onCreate(Id); if(Id != NULL) { //End of Elements Label _ElementEndLabel = Label::create(); _ElementEndLabel->setText("End"); _ElementEndLabel->setAlignment(Vec2f(0.5f,0.5f)); //Field List Model _FieldListModel = MFieldListModel::create(); _FieldListGenerator = MultiFieldListEditComponentGenerator::create(); //Field List _FieldList = List::create(); _FieldList->setPreferredSize(Vec2f(200, 300)); _FieldList->setOrientation(List::VERTICAL_ORIENTATION); _FieldList->setModel(_FieldListModel); _FieldList->setCellGenerator(_FieldListGenerator); _FieldList->setSelectable(false); _ListMouseClickedConnection = _FieldList->connectMouseClicked(boost::bind(&GenericMultiFieldEditor::handleListMouseClicked, this, _1)); //Scroll Panel for everything _FieldElementsScrollPanel = ScrollPanel::create(); _FieldElementsScrollPanel->setPreferredSize(Vec2f(200,300)); _FieldElementsScrollPanel->setHorizontalResizePolicy(ScrollPanel::RESIZE_TO_VIEW); _FieldElementsScrollPanel->setViewComponent(_FieldList); //Add to myself pushToChildren(_FieldElementsScrollPanel); } }
void Slider::changed(ConstFieldMaskArg whichField, UInt32 origin, BitVector details) { Inherited::changed(whichField, origin, details); if((whichField & LabelMapFieldMask)) { _UsingDefaultLabels = (getLabelMap().size() == 0); } if( ((whichField & DrawLabelsFieldMask) || (whichField & LabelPrototypeFieldMask) || (whichField & MajorTickSpacingFieldMask))&& getDrawLabels() && getRangeModel() != NULL && _UsingDefaultLabels) { setLabelMap(createStandardLabels(getMajorTickSpacing())); _UsingDefaultLabels = true; } if((whichField & KnobButtonFieldMask) || (whichField & TrackDrawObjectFieldMask) || (whichField & MinTrackDrawObjectFieldMask) || (whichField & MaxTrackDrawObjectFieldMask) || (whichField & DrawTrackFieldMask) || (whichField & DrawLabelsFieldMask) || (whichField & LabelMapFieldMask) || (whichField & LabelPrototypeFieldMask)) { clearChildren(); if(getDrawTrack()) { if(getTrackDrawObject() != NULL) { pushToChildren(getTrackDrawObject()); } if(getMinTrackDrawObject() != NULL) { pushToChildren(getMinTrackDrawObject()); } if(getMaxTrackDrawObject() != NULL) { pushToChildren(getMaxTrackDrawObject()); } } if(getKnobButton() != NULL) { pushToChildren(getKnobButton()); } if(getDrawLabels()) { FieldContainerMap::const_iterator Itor; for(Itor = getLabelMap().begin() ; Itor != getLabelMap().end() ; ++Itor) { pushToChildren(dynamic_pointer_cast<Component>((*Itor).second)); } } } if((whichField & KnobButtonFieldMask) || (whichField & TrackDrawObjectFieldMask) || (whichField & MinTrackDrawObjectFieldMask) || (whichField & MaxTrackDrawObjectFieldMask) || (whichField & InvertedFieldMask) || (whichField & DrawLabelsFieldMask) || (whichField & DrawTrackFieldMask) || (whichField & OrientationFieldMask) || (whichField & MinorTickSpacingFieldMask) || (whichField & MajorTickSpacingFieldMask) || (whichField & LabelMapFieldMask) || (whichField & LabelPrototypeFieldMask) || (whichField & AlignmentFieldMask) || (whichField & TicksOnRightBottomFieldMask)) { updateLayout(); } if(whichField & KnobButtonFieldMask && getKnobButton() != NULL) { getKnobButton()->addMouseListener(&_KnobDraggedListener); } if(whichField & RangeModelFieldMask) { _RangeModelConnection.disconnect(); if(getRangeModel() != NULL) { _RangeModelConnection = getRangeModel()->addChangeListener(&_BoundedRangeModelChangeListener); if( getDrawLabels() && _UsingDefaultLabels) { setLabelMap(createStandardLabels(getMajorTickSpacing())); _UsingDefaultLabels = true; } } } }
/*----------------------------- 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(); } }
void PopupMenu::addItem(MenuItemRefPtr Item) { pushToChildren(Item); producePopupMenuContentsChanged(PopupMenuEvent::create(PopupMenuRefPtr(this), getSystemTime())); }
void PopupMenu::addSeparator(SeparatorRefPtr TheSeparator) { TheSeparator->setOrientation(Separator::HORIZONTAL_ORIENTATION); pushToChildren(TheSeparator); }
void ScrollBar::changed(ConstFieldMaskArg whichField, UInt32 origin, BitVector details) { Inherited::changed(whichField, origin, details); if( (whichField & VerticalMinButtonFieldMask) || (whichField & VerticalMaxButtonFieldMask) || (whichField & VerticalScrollBarFieldMask) || (whichField & VerticalScrollFieldFieldMask)|| (whichField & HorizontalMinButtonFieldMask) || (whichField & HorizontalMaxButtonFieldMask) || (whichField & HorizontalScrollBarFieldMask) || (whichField & HorizontalScrollFieldFieldMask) || (whichField & OrientationFieldMask) ) { clearChildren(); if(getOrientation() == ScrollBar::VERTICAL_ORIENTATION) { if(getVerticalScrollField() != NULL) {pushToChildren(getVerticalScrollField());} if(getVerticalScrollBar() != NULL) {pushToChildren(getVerticalScrollBar());} if(getVerticalMinButton() != NULL) {pushToChildren(getVerticalMinButton());} if(getVerticalMaxButton() != NULL) {pushToChildren(getVerticalMaxButton());} } else { if(getHorizontalScrollField() != NULL) {pushToChildren(getHorizontalScrollField());} if(getHorizontalScrollBar() != NULL) {pushToChildren(getHorizontalScrollBar());} if(getHorizontalMinButton() != NULL) {pushToChildren(getHorizontalMinButton());} if(getHorizontalMaxButton() != NULL) {pushToChildren(getHorizontalMaxButton());} } } if((whichField & VerticalMinButtonFieldMask) && getVerticalMinButton() != NULL) { getVerticalMinButton()->addMousePressedActionListener(&_MinButtonActionListener); } if((whichField & VerticalMaxButtonFieldMask) && getVerticalMaxButton() != NULL) { getVerticalMaxButton()->addMousePressedActionListener(&_MaxButtonActionListener); } if((whichField & VerticalScrollBarFieldMask) && getVerticalScrollBar() != NULL) { getVerticalScrollBar()->addMouseListener(&_ScrollBarListener); } if((whichField & VerticalScrollFieldFieldMask) && getVerticalScrollField() != NULL) { getVerticalScrollField()->addMousePressedActionListener(&_ScrollFieldListener); } if((whichField & HorizontalMinButtonFieldMask) && getHorizontalMinButton() != NULL) { getHorizontalMinButton()->addMousePressedActionListener(&_MinButtonActionListener); } if((whichField & HorizontalMaxButtonFieldMask) && getHorizontalMaxButton() != NULL) { getHorizontalMaxButton()->addMousePressedActionListener(&_MaxButtonActionListener); } if((whichField & HorizontalScrollBarFieldMask) && getHorizontalScrollBar() != NULL) { getHorizontalScrollBar()->addMouseListener(&_ScrollBarListener); } if((whichField & HorizontalScrollFieldFieldMask) && getHorizontalScrollField() != NULL) { getHorizontalScrollField()->addMousePressedActionListener(&_ScrollFieldListener); } if(whichField & EnabledFieldMask) { if(getVerticalMinButton() != NULL) { getVerticalMinButton()->setEnabled(getEnabled()); } if(getVerticalMaxButton() != NULL) { getVerticalMaxButton()->setEnabled(getEnabled()); } if(getVerticalScrollBar() != NULL) { getVerticalScrollBar()->setEnabled(getEnabled()); } if(getVerticalScrollField() != NULL) { getVerticalScrollField()->setEnabled(getEnabled()); } if(getHorizontalMinButton() != NULL) { getHorizontalMinButton()->setEnabled(getEnabled()); } if(getHorizontalMaxButton() != NULL) { getHorizontalMaxButton()->setEnabled(getEnabled()); } if(getHorizontalScrollBar() != NULL) { getHorizontalScrollBar()->setEnabled(getEnabled()); } if(getHorizontalScrollField() != NULL) { getHorizontalScrollField()->setEnabled(getEnabled()); } } if(whichField & RangeModelFieldMask) { if(getRangeModel() != NULL) { _RangeModelConnection = getRangeModel()->addChangeListener(&_BoundedRangeModelChangeListener); } } }
void RGBColorChooserPanel::buildChooser(void) { //Bounded Range Models _RedModel->setMinimum(0); _RedModel->setMaximum(255); _GreenModel->setMinimum(0); _GreenModel->setMaximum(255); _BlueModel->setMinimum(0); _BlueModel->setMaximum(255); _AlphaModel->setMinimum(0); _AlphaModel->setMaximum(255); //Spinners _RedSpinner = Spinner::create(); _RedSpinner->setModel(_RedModel->getSpinnerModel()); _GreenSpinner = Spinner::create(); _GreenSpinner->setModel(_GreenModel->getSpinnerModel()); _BlueSpinner = Spinner::create(); _BlueSpinner->setModel(_BlueModel->getSpinnerModel()); if(getIncludeAlpha()) { _AlphaSpinner = Spinner::create(); _AlphaSpinner->setModel(_AlphaModel->getSpinnerModel()); } //Sliders _RedSliderTrackBackground = GradientLayer::create(); _RedSliderTrackBackground->setStartPosition(Vec2f(0.0f,0.0f)); _RedSliderTrackBackground->setEndPosition(Vec2f(1.0f,0.0f)); UIDrawObjectCanvasRefPtr RedSliderTrackCanvas = UIDrawObjectCanvas::create(); RedSliderTrackCanvas->setPreferredSize(Vec2f(15.0f,15.0f)); RedSliderTrackCanvas->setBorders(NULL); RedSliderTrackCanvas->setBackgrounds(_RedSliderTrackBackground); _RedSlider = Slider::create(); _RedSlider->setDrawLabels(false); _RedSlider->setDrawMajorTicks(false); _RedSlider->setDrawMinorTicks(false); _RedSlider->setOrientation(Slider::HORIZONTAL_ORIENTATION); _RedSlider->setTrackDrawObject(RedSliderTrackCanvas); _RedSlider->setRangeModel(_RedModel->getBoundedRangeModel()); //Green _GreenSliderTrackBackground = GradientLayer::create(); _GreenSliderTrackBackground->setStartPosition(Vec2f(0.0f,0.0f)); _GreenSliderTrackBackground->setEndPosition(Vec2f(1.0f,0.0f)); UIDrawObjectCanvasRefPtr GreenSliderTrackCanvas = UIDrawObjectCanvas::create(); GreenSliderTrackCanvas->setPreferredSize(Vec2f(15.0f,15.0f)); GreenSliderTrackCanvas->setBorders(NULL); GreenSliderTrackCanvas->setBackgrounds(_GreenSliderTrackBackground); _GreenSlider = Slider::create(); _GreenSlider->setDrawLabels(false); _GreenSlider->setDrawMajorTicks(false); _GreenSlider->setDrawMinorTicks(false); _GreenSlider->setOrientation(Slider::HORIZONTAL_ORIENTATION);; _GreenSlider->setTrackDrawObject(GreenSliderTrackCanvas); _GreenSlider->setRangeModel(_GreenModel->getBoundedRangeModel()); //Blue _BlueSliderTrackBackground = GradientLayer::create(); _BlueSliderTrackBackground->setStartPosition(Vec2f(0.0f,0.0f)); _BlueSliderTrackBackground->setEndPosition(Vec2f(1.0f,0.0f)); UIDrawObjectCanvasRefPtr BlueSliderTrackCanvas = UIDrawObjectCanvas::create(); BlueSliderTrackCanvas->setPreferredSize(Vec2f(15.0f,15.0f)); BlueSliderTrackCanvas->setBorders(NULL); BlueSliderTrackCanvas->setBackgrounds(_BlueSliderTrackBackground); _BlueSlider = Slider::create(); _BlueSlider->setDrawLabels(false); _BlueSlider->setDrawMajorTicks(false); _BlueSlider->setDrawMinorTicks(false); _BlueSlider->setOrientation(Slider::HORIZONTAL_ORIENTATION);; _BlueSlider->setTrackDrawObject(BlueSliderTrackCanvas); _BlueSlider->setRangeModel(_BlueModel->getBoundedRangeModel()); if(getIncludeAlpha()) { _AlphaSliderTrackBackground = GradientLayer::create(); _AlphaSliderTrackBackground->setStartPosition(Vec2f(0.0f,0.0f)); _AlphaSliderTrackBackground->setEndPosition(Vec2f(1.0f,0.0f)); UIDrawObjectCanvasRefPtr AlphaSliderTrackCanvas = UIDrawObjectCanvas::create(); AlphaSliderTrackCanvas->setPreferredSize(Vec2f(15.0f,15.0f)); AlphaSliderTrackCanvas->setBorders(NULL); AlphaSliderTrackCanvas->setBackgrounds(_AlphaSliderTrackBackground); _AlphaSlider = Slider::create(); _AlphaSlider->setDrawLabels(false); _AlphaSlider->setDrawMajorTicks(false); _AlphaSlider->setDrawMinorTicks(false); _AlphaSlider->setOrientation(Slider::HORIZONTAL_ORIENTATION);; _AlphaSlider->setTrackDrawObject(AlphaSliderTrackCanvas); _AlphaSlider->setRangeModel(_AlphaModel->getBoundedRangeModel()); } //Labels LabelRefPtr RedLabel = Label::create(); RedLabel->setText("Red"); RedLabel->setPreferredSize(Vec2f(50.0f, RedLabel->getPreferredSize().y())); RedLabel->setBackgrounds(NULL); RedLabel->setBorders(NULL); LabelRefPtr GreenLabel = Label::create(); GreenLabel->setText("Green"); GreenLabel->setPreferredSize(Vec2f(50.0f, GreenLabel->getPreferredSize().y())); GreenLabel->setBackgrounds(NULL); GreenLabel->setBorders(NULL); LabelRefPtr BlueLabel = Label::create(); BlueLabel->setText("Blue"); BlueLabel->setPreferredSize(Vec2f(50.0f, BlueLabel->getPreferredSize().y())); BlueLabel->setBackgrounds(NULL); BlueLabel->setBorders(NULL); LabelRefPtr AlphaLabel = Label::create(); if(getIncludeAlpha()) { AlphaLabel->setText("Alpha"); AlphaLabel->setPreferredSize(Vec2f(50.0f, AlphaLabel->getPreferredSize().y())); AlphaLabel->setBackgrounds(NULL); AlphaLabel->setBorders(NULL); } //Layout SpringLayoutRefPtr RGBPanelLayout = SpringLayout::create(); //Red //Label RGBPanelLayout->putConstraint(SpringLayoutConstraints::WEST_EDGE, RedLabel, 5.0f, SpringLayoutConstraints::WEST_EDGE, this); RGBPanelLayout->putConstraint(SpringLayoutConstraints::NORTH_EDGE, RedLabel, 5.0f, SpringLayoutConstraints::NORTH_EDGE, this); RGBPanelLayout->putConstraint(SpringLayoutConstraints::WIDTH_EDGE, RedLabel, LayoutSpringUnrecPtr(LayoutSpring::width(RedLabel))); RGBPanelLayout->putConstraint(SpringLayoutConstraints::HEIGHT_EDGE, RedLabel, LayoutSpringUnrecPtr(LayoutSpring::height(RedLabel))); //Slider RGBPanelLayout->putConstraint(SpringLayoutConstraints::WEST_EDGE, _RedSlider, 5.0f, SpringLayoutConstraints::EAST_EDGE, RedLabel); RGBPanelLayout->putConstraint(SpringLayoutConstraints::EAST_EDGE, _RedSlider, -5.0f, SpringLayoutConstraints::WEST_EDGE, _RedSpinner); RGBPanelLayout->putConstraint(SpringLayoutConstraints::VERTICAL_CENTER_EDGE, _RedSlider, 0.0f, SpringLayoutConstraints::VERTICAL_CENTER_EDGE, RedLabel); RGBPanelLayout->putConstraint(SpringLayoutConstraints::HEIGHT_EDGE, _RedSlider, LayoutSpringUnrecPtr(LayoutSpring::height(_RedSlider))); //Spinner RGBPanelLayout->putConstraint(SpringLayoutConstraints::EAST_EDGE, _RedSpinner, -5.0f, SpringLayoutConstraints::EAST_EDGE, this); RGBPanelLayout->putConstraint(SpringLayoutConstraints::VERTICAL_CENTER_EDGE, _RedSpinner, 0.0f, SpringLayoutConstraints::VERTICAL_CENTER_EDGE, RedLabel); RGBPanelLayout->putConstraint(SpringLayoutConstraints::WIDTH_EDGE, _RedSpinner, LayoutSpringUnrecPtr(LayoutSpring::width(_RedSpinner))); RGBPanelLayout->putConstraint(SpringLayoutConstraints::HEIGHT_EDGE, _RedSpinner, LayoutSpringUnrecPtr(LayoutSpring::height(_RedSpinner))); //Green //Label RGBPanelLayout->putConstraint(SpringLayoutConstraints::WEST_EDGE, GreenLabel, 5.0f, SpringLayoutConstraints::WEST_EDGE, this); RGBPanelLayout->putConstraint(SpringLayoutConstraints::NORTH_EDGE, GreenLabel, 5.0f, SpringLayoutConstraints::SOUTH_EDGE, RedLabel); RGBPanelLayout->putConstraint(SpringLayoutConstraints::WIDTH_EDGE, GreenLabel, LayoutSpringUnrecPtr(LayoutSpring::width(GreenLabel))); RGBPanelLayout->putConstraint(SpringLayoutConstraints::HEIGHT_EDGE, GreenLabel, LayoutSpringUnrecPtr(LayoutSpring::height(GreenLabel))); //Slider RGBPanelLayout->putConstraint(SpringLayoutConstraints::WEST_EDGE, _GreenSlider, 5.0f, SpringLayoutConstraints::EAST_EDGE, GreenLabel); RGBPanelLayout->putConstraint(SpringLayoutConstraints::EAST_EDGE, _GreenSlider, -5.0f, SpringLayoutConstraints::WEST_EDGE, _GreenSpinner); RGBPanelLayout->putConstraint(SpringLayoutConstraints::VERTICAL_CENTER_EDGE, _GreenSlider, 0.0f, SpringLayoutConstraints::VERTICAL_CENTER_EDGE, GreenLabel); RGBPanelLayout->putConstraint(SpringLayoutConstraints::HEIGHT_EDGE, _GreenSlider, LayoutSpringUnrecPtr(LayoutSpring::height(_GreenSlider))); //Spinner RGBPanelLayout->putConstraint(SpringLayoutConstraints::EAST_EDGE, _GreenSpinner, -5.0f, SpringLayoutConstraints::EAST_EDGE, this); RGBPanelLayout->putConstraint(SpringLayoutConstraints::VERTICAL_CENTER_EDGE, _GreenSpinner, 0.0f, SpringLayoutConstraints::VERTICAL_CENTER_EDGE, GreenLabel); RGBPanelLayout->putConstraint(SpringLayoutConstraints::WIDTH_EDGE, _GreenSpinner, LayoutSpringUnrecPtr(LayoutSpring::width(_GreenSpinner))); RGBPanelLayout->putConstraint(SpringLayoutConstraints::HEIGHT_EDGE, _GreenSpinner, LayoutSpringUnrecPtr(LayoutSpring::height(_GreenSpinner))); //Blue //Label RGBPanelLayout->putConstraint(SpringLayoutConstraints::WEST_EDGE, BlueLabel, 5.0f, SpringLayoutConstraints::WEST_EDGE, this); RGBPanelLayout->putConstraint(SpringLayoutConstraints::NORTH_EDGE, BlueLabel, 5.0f, SpringLayoutConstraints::SOUTH_EDGE, GreenLabel); RGBPanelLayout->putConstraint(SpringLayoutConstraints::WIDTH_EDGE, BlueLabel, LayoutSpringUnrecPtr(LayoutSpring::width(BlueLabel))); RGBPanelLayout->putConstraint(SpringLayoutConstraints::HEIGHT_EDGE, BlueLabel, LayoutSpringUnrecPtr(LayoutSpring::height(BlueLabel))); //Slider RGBPanelLayout->putConstraint(SpringLayoutConstraints::WEST_EDGE, _BlueSlider, 5.0f, SpringLayoutConstraints::EAST_EDGE, BlueLabel); RGBPanelLayout->putConstraint(SpringLayoutConstraints::EAST_EDGE, _BlueSlider, -5.0f, SpringLayoutConstraints::WEST_EDGE, _BlueSpinner); RGBPanelLayout->putConstraint(SpringLayoutConstraints::VERTICAL_CENTER_EDGE, _BlueSlider, 0.0f, SpringLayoutConstraints::VERTICAL_CENTER_EDGE, BlueLabel); RGBPanelLayout->putConstraint(SpringLayoutConstraints::HEIGHT_EDGE, _BlueSlider, LayoutSpringUnrecPtr(LayoutSpring::height(_BlueSlider))); //Spinner RGBPanelLayout->putConstraint(SpringLayoutConstraints::EAST_EDGE, _BlueSpinner, -5.0f, SpringLayoutConstraints::EAST_EDGE, this); RGBPanelLayout->putConstraint(SpringLayoutConstraints::VERTICAL_CENTER_EDGE, _BlueSpinner, 0.0f, SpringLayoutConstraints::VERTICAL_CENTER_EDGE, BlueLabel); RGBPanelLayout->putConstraint(SpringLayoutConstraints::WIDTH_EDGE, _BlueSpinner, LayoutSpringUnrecPtr(LayoutSpring::width(_BlueSpinner))); RGBPanelLayout->putConstraint(SpringLayoutConstraints::HEIGHT_EDGE, _BlueSpinner, LayoutSpringUnrecPtr(LayoutSpring::height(_BlueSpinner))); if(getIncludeAlpha()) { //Alpha //Label RGBPanelLayout->putConstraint(SpringLayoutConstraints::WEST_EDGE, AlphaLabel, 5.0f, SpringLayoutConstraints::WEST_EDGE, this); RGBPanelLayout->putConstraint(SpringLayoutConstraints::NORTH_EDGE, AlphaLabel, 5.0f, SpringLayoutConstraints::SOUTH_EDGE, BlueLabel); RGBPanelLayout->putConstraint(SpringLayoutConstraints::WIDTH_EDGE, AlphaLabel, LayoutSpringUnrecPtr(LayoutSpring::width(AlphaLabel))); RGBPanelLayout->putConstraint(SpringLayoutConstraints::HEIGHT_EDGE, AlphaLabel, LayoutSpringUnrecPtr(LayoutSpring::height(AlphaLabel))); //Slider RGBPanelLayout->putConstraint(SpringLayoutConstraints::WEST_EDGE, _AlphaSlider, 5.0f, SpringLayoutConstraints::EAST_EDGE, AlphaLabel); RGBPanelLayout->putConstraint(SpringLayoutConstraints::EAST_EDGE, _AlphaSlider, -5.0f, SpringLayoutConstraints::WEST_EDGE, _AlphaSpinner); RGBPanelLayout->putConstraint(SpringLayoutConstraints::VERTICAL_CENTER_EDGE, _AlphaSlider, 0.0f, SpringLayoutConstraints::VERTICAL_CENTER_EDGE, AlphaLabel); RGBPanelLayout->putConstraint(SpringLayoutConstraints::HEIGHT_EDGE, _AlphaSlider, LayoutSpringUnrecPtr(LayoutSpring::height(_AlphaSlider))); //Spinner RGBPanelLayout->putConstraint(SpringLayoutConstraints::EAST_EDGE, _AlphaSpinner, -5, SpringLayoutConstraints::EAST_EDGE, this); RGBPanelLayout->putConstraint(SpringLayoutConstraints::VERTICAL_CENTER_EDGE, _AlphaSpinner, 0.0f, SpringLayoutConstraints::VERTICAL_CENTER_EDGE, AlphaLabel); RGBPanelLayout->putConstraint(SpringLayoutConstraints::WIDTH_EDGE, _AlphaSpinner, LayoutSpringUnrecPtr(LayoutSpring::width(_AlphaSpinner))); RGBPanelLayout->putConstraint(SpringLayoutConstraints::HEIGHT_EDGE, _AlphaSpinner, LayoutSpringUnrecPtr(LayoutSpring::height(_AlphaSpinner))); } clearChildren(); pushToChildren(RedLabel); pushToChildren(_RedSlider); pushToChildren(_RedSpinner); pushToChildren(GreenLabel); pushToChildren(_GreenSlider); pushToChildren(_GreenSpinner); pushToChildren(BlueLabel); pushToChildren(_BlueSlider); pushToChildren(_BlueSpinner); if(getIncludeAlpha()) { pushToChildren(AlphaLabel); pushToChildren(_AlphaSlider); pushToChildren(_AlphaSpinner); } setLayout(RGBPanelLayout); }
/*-------------------------------------------------------------------------*\ - private - \*-------------------------------------------------------------------------*/ void FCPtrFieldEditor::onCreate(const FCPtrFieldEditor *Id) { Inherited::onCreate(Id); if(Id != NULL) { //Name/Type Label _NameTypeLabel = Label::create(); _NameTypeLabel->setBorders(NULL); _NameTypeLabel->setBackgrounds(NULL); pushToChildren(_NameTypeLabel); //Editing Text Field _EditingTextField = TextField::create(); pushToChildren(_EditingTextField); _TextFieldFocusGainedConnection = _EditingTextField->connectFocusGained(boost::bind(&FCPtrFieldEditor::handleTextFieldFocusGained, this, _1)); _TextFieldFocusLostConnection = _EditingTextField->connectFocusLost(boost::bind(&FCPtrFieldEditor::handleTextFieldFocusLost, this, _1)); _TextFieldActionPerformedConnection = _EditingTextField->connectActionPerformed(boost::bind(&FCPtrFieldEditor::handleTextFieldActionPerformed, this, _1)); _TextFieldKeyTypedConnection = _EditingTextField->connectKeyTyped(boost::bind(&FCPtrFieldEditor::handleTextFieldKeyTyped, this, _1)); _EditingTextField->setPreferredSize(Vec2f(45.0f, 17.0f)); DefaultListModelRefPtr FCCommandsListModel = DefaultListModel::create(); FCCommandsListModel->pushBack(boost::any(std::string("Create ..."))); FCCommandsListModel->pushBack(boost::any(std::string("Load ..."))); FCCommandsListModel->pushBack(boost::any(std::string("Find ..."))); _EditingMenuButton = MenuButton::create(); _EditingMenuButton->setPreferredSize(Vec2f(25.0f, 25.0f)); //_EditingMenuButton = //dynamic_pointer_cast<Button>(dynamic_cast<ComboBox*>(ComboBox::getClassType().getPrototype())->getExpandButton()->shallowCopy()); _EditingMenuButton->setModel(FCCommandsListModel); //Get the Default ComboBox expander Button* ProtoButton = dynamic_cast<ComboBox*>(ComboBox::getClassType().getPrototype())->getExpandButton(); //Backgrounds _EditingMenuButton->setBackground(ProtoButton->getBackground()); _EditingMenuButton->setFocusedBackground(ProtoButton->getFocusedBackground()); _EditingMenuButton->setDisabledBackground(ProtoButton->getDisabledBackground()); _EditingMenuButton->setRolloverBackground(ProtoButton->getRolloverBackground()); _EditingMenuButton->setActiveBackground(ProtoButton->getActiveBackground()); //Foregrounds _EditingMenuButton->setForeground(ProtoButton->getForeground()); _EditingMenuButton->setFocusedForeground(ProtoButton->getFocusedForeground()); _EditingMenuButton->setDisabledForeground(ProtoButton->getDisabledForeground()); _EditingMenuButton->setRolloverForeground(ProtoButton->getRolloverForeground()); _EditingMenuButton->setActiveForeground(ProtoButton->getActiveForeground()); //DrawObjects _EditingMenuButton->setDrawObject(ProtoButton->getDrawObject()); _EditingMenuButton->setFocusedDrawObject(ProtoButton->getFocusedDrawObject()); _EditingMenuButton->setDisabledDrawObject(ProtoButton->getDisabledDrawObject()); _EditingMenuButton->setRolloverDrawObject(ProtoButton->getRolloverDrawObject()); _EditingMenuButton->setActiveDrawObject(ProtoButton->getActiveDrawObject()); //Borders _EditingMenuButton->setBorder(ProtoButton->getBorder()); _EditingMenuButton->setFocusedBorder(ProtoButton->getFocusedBorder()); _EditingMenuButton->setDisabledBorder(ProtoButton->getDisabledBorder()); _EditingMenuButton->setRolloverBorder(ProtoButton->getRolloverBorder()); _EditingMenuButton->setActiveBorder(ProtoButton->getActiveBorder()); _MenuButtonActionConnection = _EditingMenuButton->connectMenuActionPerformed(boost::bind(&FCPtrFieldEditor::handleMenuButtonAction, this, _1)); pushToChildren(_EditingMenuButton); } }
void RotatedComponent::changed(ConstFieldMaskArg whichField, UInt32 origin, BitVector details) { Inherited::changed(whichField, origin, details); //Do not respond to changes that have a Sync origin if(origin & ChangedOrigin::Sync) { return; } if(whichField & InternalComponentFieldMask) { clearChildren(); if(getInternalComponent() != NULL) { pushToChildren(getInternalComponent()); } } if((whichField & InternalComponentFieldMask) || (whichField & AngleFieldMask) || (whichField & ResizePolicyFieldMask)) { if(getInternalComponent() != NULL) { Vec2f Size; switch (static_cast<ResizePolicy>(getResizePolicy())) { case RESIZE_TO_MIN: { //Treat TopLeft as 0,0 //Get the Rotated Bounds of the Internal Component Pnt2f p1,p2,p3,p4; Pnt2f ComponentCenter(static_cast<Real32>(getInternalComponent()->getSize().x())/2.0, static_cast<Real32>(getInternalComponent()->getSize().y())/2.0); p1 = -ComponentCenter; p2.setValues(ComponentCenter.x(),-ComponentCenter.y()); p3 = ComponentCenter; p4.setValues(-ComponentCenter.x(),ComponentCenter.y()); //Rotate them p1 = Rotate(p1, -getAngle()); p2 = Rotate(p2, -getAngle()); p3 = Rotate(p3, -getAngle()); p4 = Rotate(p4, -getAngle()); //Get their min and max Pnt2f Min(osgMin(osgMin(osgMin(p1.x(),p2.x()),p3.x()),p4.x()), osgMin(osgMin(osgMin(p1.y(),p2.y()),p3.y()),p4.y())); Pnt2f Max(osgMax(osgMax(osgMax(p1.x(),p2.x()),p3.x()),p4.x()), osgMax(osgMax(osgMax(p1.y(),p2.y()),p3.y()),p4.y())); Pnt2f BorderTopLeft, BorderBottomRight; getInsideInsetsBounds(BorderTopLeft, BorderBottomRight); Pnt2f TopLeft, BottomRight; getBounds(TopLeft, BottomRight); setPreferredSize(Vec2f(Max.x() - Min.x() + (BorderTopLeft.x() - TopLeft.x()) + (BottomRight.x() - BorderBottomRight.x()), Max.y() - Min.y() + (BorderTopLeft.y() - TopLeft.y()) + (BottomRight.y() - BorderBottomRight.y()))); break; } case RESIZE_TO_MAX: { //Get the Internal Components Center Pnt2f ComponentCenter(static_cast<Real32>(getInternalComponent()->getSize().x())/2.0, static_cast<Real32>(getInternalComponent()->getSize().y())/2.0); //Get the distance from the Center to one of the TopLeft Corner Real32 Length = 2*ComponentCenter.dist(Pnt2f(0,0)); setPreferredSize(Vec2f(Length,Length)); break; } case NO_RESIZING: default: break; } getInternalComponent()->updateClipBounds(); //Check the Mouse if( getParentWindow() != NULL && getParentWindow()->getParentDrawingSurface() != NULL && getParentWindow()->getParentDrawingSurface()->getEventProducer() != NULL) { Pnt2f MouseLoc(getParentWindow()->getParentDrawingSurface()->getEventProducer()->getMousePosition()); MouseEventDetailsUnrecPtr e = MouseEventDetails::create(getParentWindow()->getParentDrawingSurface()->getEventProducer(),getSystemTime(),MouseEventDetails::NO_BUTTON,0,MouseLoc, NULL); checkMouseEnterExit(e,e->getLocation(),getInternalComponent(),getInternalComponent()->isContained(MouseLoc, true),e->getViewport()); } } } }