Ejemplo n.º 1
0
    ColorLabelMenu(const char* label):
    ColorLabel(label) {
        _window = new osgWidget::Box(
            std::string("Menu_") + label,
            osgWidget::Box::VERTICAL,
            true
        );

        _window->addWidget(new ColorLabel("Open Some Stuff"));
        _window->addWidget(new ColorLabel("Do It Now"));
        _window->addWidget(new ColorLabel("Hello, How Are U?"));
        _window->addWidget(new ColorLabel("Hmmm..."));
        _window->addWidget(new ColorLabel("Option 5"));

        _window->resize();

        setColor(0.8f, 0.8f, 0.8f, 0.8f);
    }
    ColorLabelMenu(const char* label):
        ColorLabel(label) {
        _window = new osgWidget::Table(std::string("Menu_") + label, 6, 5);

        _window->addWidget(new ColorLabel("OutQuadMotion"), 0, 0);
        _window->addWidget(new ColorLabel("InQuadMotion"), 1, 0);
        _window->addWidget(new ColorLabel("InOutQuadMotion"), 2, 0);
        _window->addWidget(new ColorLabel("OutCubicMotion"), 3, 0);
        _window->addWidget(new ColorLabel("InCubicMotion"), 4, 0);
        _window->addWidget(new ColorLabel("InOutCubicMotion"), 5, 0);

        _window->addWidget(new ColorLabel("OutQuartMotion"), 0, 1);
        _window->addWidget(new ColorLabel("InQuartMotion"), 1, 1);
        _window->addWidget(new ColorLabel("InOutQuartMotion"), 2, 1);
        _window->addWidget(new ColorLabel("OutBounceMotion"), 3, 1);
        _window->addWidget(new ColorLabel("InBounceMotion"), 4, 1);
        _window->addWidget(new ColorLabel("InOutBounceMotion"), 5, 1);

        _window->addWidget(new ColorLabel("OutElasticMotion"), 0, 2);
        _window->addWidget(new ColorLabel("InElasticMotion"), 1, 2);
        _window->addWidget(new ColorLabel("InOutElasticMotion"), 2, 2);
        _window->addWidget(new ColorLabel("OutSineMotion"), 3, 2);
        _window->addWidget(new ColorLabel("InSineMotion"), 4, 2);
        _window->addWidget(new ColorLabel("InOutSineMotion"), 5, 2);

        _window->addWidget(new ColorLabel("OutBackMotion"), 0, 3);
        _window->addWidget(new ColorLabel("InBackMotion"), 1, 3);
        _window->addWidget(new ColorLabel("InOutBackMotion"), 2, 3);
        _window->addWidget(new ColorLabel("OutCircMotion"), 3, 3);
        _window->addWidget(new ColorLabel("InCircMotion"), 4, 3);
        _window->addWidget(new ColorLabel("InOutCircMotion"), 5, 3);

        _window->addWidget(new ColorLabel("OutExpoMotion"), 0, 4);
        _window->addWidget(new ColorLabel("InExpoMotion"), 1, 4);
        _window->addWidget(new ColorLabel("InOutExpoMotion"), 2, 4);
        _window->addWidget(new ColorLabel("Linear"), 3, 4);

        _window->resize();
    }
Ejemplo n.º 3
0
    Notebook(const std::string& name):
    osgWidget::Box(name, osgWidget::Box::VERTICAL) {
        _tabs    = new osgWidget::Box("tabs", osgWidget::Box::HORIZONTAL);
        _windows = new osgWidget::Canvas("canvas");

        for(unsigned int i = 0; i < 4; i++) {
            std::stringstream ss;

            // Setup everything for our Tab...
            ss << "Tab_" << i;

            osgWidget::Label* label1 = new osgWidget::Label(ss.str());

            label1->setFont("fonts/VeraMono.ttf");
            label1->setFontSize(20);
            label1->setFontColor(1.0f, 1.0f, 1.0f, 1.0f);
            label1->setColor(0.0f, i / 4.0f, 0.3f, 1.0f);
            label1->setLabel(ss.str());
            label1->addSize(20.0f, 20.0f);
            label1->setShadow(0.1f);
            label1->setCanFill(true);

            _tabs->addWidget(label1);

            // Setup everything for the Window corresponding to the Tab
            // in the Canvas down below.
            std::stringstream descr;

            descr
                << "This is some text" << std::endl
                << "for the Tab_" << i << " tab." << std::endl
                << "Press the button up top" << std::endl
                << "And this should go to the next Window!" << std::endl
            ;

            osgWidget::Label* label2 = new osgWidget::Label(ss.str());

            label2->setFont("fonts/Vera.ttf");
            label2->setFontSize(15);
            label2->setFontColor(1.0f, 1.0f, 1.0f, 1.0f);
            label2->setColor(0.0f, i / 4.0f, 0.3f, 1.0f);
            label2->setLabel(descr.str());
            label2->setLayer(osgWidget::Widget::LAYER_MIDDLE, i * 2);
            label2->addSize(50.0f, 50.0f);

            _windows->addWidget(label2, 0.0f, 0.0f);

            label1->setEventMask(osgWidget::EVENT_MOUSE_PUSH);
            label1->addCallback(new osgWidget::Callback(
                &Notebook::callbackTabPressed,
                this,
                osgWidget::EVENT_MOUSE_PUSH
            ));
        }

        osgWidget::Label* label = new osgWidget::Label("label");

        label->setFont("fonts/arial.ttf");
        label->setFontSize(15);
        label->setFontColor(1.0f, 1.0f, 1.0f, 1.0f);
        label->setLabel("Drag the window here...");
        label->addSize(20.0f, 20.0f);
        label->setShadow(0.08f);
        label->setCanFill(true);
   
        addWidget(label);
        addWidget(_tabs->embed());
        addWidget(_windows->embed());
    }