Exemplo n.º 1
0
void SampleImageDlg::EnableBasedOnConstraint()
{
	GetTextToFile()->Enable(m_bToFile);
	GetDotDotDot()->Enable(m_bToFile);

	GetConstrain()->Enable(true);
	GetSmaller()->Enable(m_bConstraint);
	GetBigger()->Enable(m_bConstraint);

	GetSizeX()->SetEditable(!m_bConstraint);
	GetSizeY()->SetEditable(!m_bConstraint);
	GetSpacingX()->SetEditable(!m_bConstraint);
	GetSpacingY()->SetEditable(!m_bConstraint);
}
Exemplo n.º 2
0
LayerPanel::LayerPanel(EditorEngine *engine, uint32 width, uint32 height)
: gcn::Panel(4,4), _engine(engine) // 4 pixels h and v spacing
{
    setBackgroundColor(gcn::Color(0,75,0,255));
    setForegroundColor(gcn::Color(0,200,0,255));
    SetMaxSlots(2, -1);
    setSize(width, height);
    gcn::Button *btn;

    uint32 w = getWidth() / 2 - (GetSpacingX() * 2);
    uint32 h = uint32(getFont()->getHeight() * 1.5f);

    // add buttons in such a way that the left column contains buttons for layers 0-15,
    // and the right column those for layers 16-31.
    for(uint32 i = 0; i < LAYER_MAX / 2; i++)
    {
        btn = new gcn::Button();
        btn->setSize(w, h);
        btn->addMouseListener(this);
        add(btn);
        btnLayers[i] = btn;

        btn = new gcn::Button();
        btn->setSize(w, h);
        btn->addMouseListener(this);
        add(btn);
        btnLayers[i + (LAYER_MAX / 2)] = btn;
    }
    gcn::Font *font = engine->GetLargeFont();

    lDesc = new gcn::Label("Desc");
    lDesc->setFont(font);
    lDesc->setSize(getWidth(), h);
    add(lDesc);

    lInfo = new gcn::Label("Info");
    lInfo->setFont(font);
    lInfo->setSize(getWidth(), h);
    add(lInfo);

    tfName = new gcn::GreedyTextField();
    tfName->setSize(getWidth() - 10, h);
    tfName->addActionListener(this);
    add(tfName);

    cbVisible = new gcn::CheckBox("visible");
    cbVisible->setSize(getWidth(), h);
    cbVisible->setFont(font);
    cbVisible->addActionListener(this);
    add(cbVisible);

    // .. room for more widgets ...


    // these are added last
    btnAllVisible = new gcn::Button("All visible");
    btnAllVisible->setSize(w, h);
    btnAllVisible->addActionListener(this);
    add(btnAllVisible);
    btnAllVisible->setPosition(getX() + GetSpacingX(), getHeight() - h - (GetSpacingY() * 2));

    btnNoneVisible = new gcn::Button("None visible");
    btnNoneVisible->setSize(w, h);
    btnNoneVisible->addActionListener(this);
    add(btnNoneVisible);
    btnNoneVisible->setPosition(getX() + (GetSpacingX() * 2) + w, getHeight() - h - (GetSpacingY() * 2));

}