Пример #1
0
void ColorChooser::updateLayout(void)
{
	Pnt2f InsetsTopLeft, InsetsBottomRight;
	getInsideInsetsBounds(InsetsTopLeft, InsetsBottomRight);

	ComponentRefPtr PreviewPanel;
	if(getPreviewPanel() != NULL)
	{
		PreviewPanel = getPreviewPanel();
	}
	else
	{
		PreviewPanel = _DefaultPreviewPanel;
	}
	Pnt2f PreviewTopLeft(InsetsTopLeft.x(), InsetsBottomRight.y()), PreviewBottomRight(InsetsBottomRight);
	PreviewTopLeft.setValues(PreviewTopLeft.x(), InsetsBottomRight.y()-PreviewPanel->getPreferredSize().y());
		PreviewPanel->setPosition(PreviewTopLeft);
		PreviewPanel->setSize(PreviewBottomRight - PreviewTopLeft);

	Pnt2f ChooserTopLeft(InsetsTopLeft),
		  ChooserBottomRight(InsetsBottomRight.x(), PreviewTopLeft.y());
	if(getMFInternalChooserPanels()->size() > 1 &&
		_LayoutTabPanel != NULL)
	{
			_LayoutTabPanel->setPosition(ChooserTopLeft);
			_LayoutTabPanel->setSize(ChooserBottomRight - ChooserTopLeft);
	}
	else if(getMFInternalChooserPanels()->size() == 1)
	{
			editMFInternalChooserPanels()->front()->setPosition(ChooserTopLeft);
			editMFInternalChooserPanels()->front()->setSize(ChooserBottomRight - ChooserTopLeft);
	}

}
Пример #2
0
void Component::setToolTipText(const std::string& ToolTipText)
{
    ComponentRefPtr TheToolTip = createDefaultToolTip();
    if(TheToolTip != NULL &&
       TheToolTip->getType().isDerivedFrom(TextComponent::getClassType()))
    {
        dynamic_pointer_cast<TextComponent>(TheToolTip)->setText(ToolTipText);
    }

    setToolTip(TheToolTip);
}
Пример #3
0
Vec2f FlowLayout::getAppropriateComponentSize(ComponentRefPtr TheComponent)
{
    Vec2f ComponentSize(0.0f,0.0f);
    if(TheComponent != NULL)
    {
        ComponentSize = TheComponent->getPreferredSize();
        if(ComponentSize.x() < TheComponent->getMinSize().x())
        {
            ComponentSize[0] = TheComponent->getMinSize()[0];
        }
        if(ComponentSize.y() < TheComponent->getMinSize().y())
        {
            ComponentSize[1] = TheComponent->getMinSize()[1];
        }
    }
    return ComponentSize;
}
Пример #4
0
void Toolbar::addTool(ComponentRefPtr TheTool)
{
    if(TheTool->getType() == Separator::getClassType())
    {
        addSeparator(dynamic_pointer_cast<Separator>(TheTool));
    }

    pushToChildren(TheTool);
}
ComponentRefPtr ComboBoxComponentGenerator::getComponent(ComponentRefPtr Parent, const boost::any& Value, Int32 PrimaryAxisIndex, Int32 SecondaryAxisIndex, bool IsSelected, bool HasFocus)
{
    if(Parent->getType().isDerivedFrom(ComboBox::getClassType()))
    {
        return getComboBoxComponent(dynamic_pointer_cast<ComboBox>(Parent), Value, PrimaryAxisIndex, IsSelected, HasFocus);
    }
    else
    {
        return getComboBoxComponent(NULL, Value, PrimaryAxisIndex, IsSelected, HasFocus);
    }
}
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()));
}