Show
Ignore:
Timestamp:
11/28/08 15:36:39 (6 years ago)
Author:
robert
Message:

From Jeremy Moles, updates to osgwidget examples.

Merged by Robert Osfield from OpenSceneGraph-osgWidget-dev

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • OpenSceneGraph/trunk/examples/osgwidgetnotebook/osgwidgetnotebook.cpp

    r8602 r9289  
    33 
    44#include <osg/io_utils> 
     5#include <osgGA/TrackballManipulator> 
     6#include <osgGA/StateSetManipulator> 
     7#include <osgViewer/ViewerEventHandlers> 
    58#include <osgWidget/Util> 
    69#include <osgWidget/WindowManager> 
     
    811#include <osgWidget/Canvas> 
    912#include <osgWidget/Label> 
     13#include <osgWidget/Label> 
     14#include <osgWidget/ViewerEventHandlers> 
    1015 
    1116const unsigned int MASK_2D = 0xF0000000; 
     
    2429        for(unsigned int i = 0; i < objs.size(); i++) objs[i]->setLayer( 
    2530            osgWidget::Widget::LAYER_MIDDLE, 
    26             i 
     31            i * 2 
    2732        ); 
    2833 
    2934        _windows->getByName(ev.getWidget()->getName())->setLayer( 
    3035            osgWidget::Widget::LAYER_MIDDLE, 
    31             objs.size() 
     36            objs.size() * 2 
    3237        ); 
    3338 
     
    7984            label2->setColor(0.0f, i / 4.0f, 0.3f, 1.0f); 
    8085            label2->setLabel(descr.str()); 
    81             label2->setLayer(osgWidget::Widget::LAYER_MIDDLE, i); 
     86            label2->setLayer(osgWidget::Widget::LAYER_MIDDLE, i * 2); 
    8287            label2->addSize(50.0f, 50.0f); 
    8388 
     
    8590 
    8691            label1->setEventMask(osgWidget::EVENT_MOUSE_PUSH); 
    87             label1->addCallback(osgWidget::Callback( 
     92            label1->addCallback(new osgWidget::Callback( 
    8893                &Notebook::callbackTabPressed, 
    8994                this, 
     
    101106        label->setShadow(0.08f); 
    102107        label->setCanFill(true); 
    103  
     108    
    104109        addWidget(label); 
    105110        addWidget(_tabs->embed()); 
     
    107112    } 
    108113}; 
     114 
     115void bound(osg::Node* node) { 
     116    osg::BoundingSphere bs = node->getBound(); 
     117 
     118    osgWidget::warn() << "center: " << bs.center() << " radius: " << bs.radius() << std::endl; 
     119} 
    109120 
    110121int main(int argc, char** argv) { 
     
    115126        1280.0f, 
    116127        720.0f, 
    117         MASK_2D, 
    118         osgWidget::WindowManager::WM_PICK_DEBUG 
     128        MASK_2D //, 
     129        //osgWidget::WindowManager::WM_USE_RENDERBINS 
    119130    ); 
    120131 
    121     Notebook* notebook = new Notebook("notebook"); 
     132    Notebook* notebook1 = new Notebook("notebook1"); 
     133    Notebook* notebook2 = new Notebook("notebook2"); 
    122134 
    123     osgWidget::warn() 
    124         << "Sizes are..." << std::endl 
    125         << "Cur: " << notebook->getSize() << std::endl 
    126         << "Min: " << notebook->getMinSize() << std::endl 
    127     ; 
     135    notebook2->setOrigin(100.0f, 100.0f); 
    128136 
    129     notebook->attachMoveCallback(); 
     137    notebook1->attachMoveCallback(); 
     138    notebook2->attachMoveCallback(); 
    130139 
    131     wm->addChild(notebook); 
     140    wm->addChild(notebook1); 
     141    wm->addChild(notebook2); 
    132142 
    133143    return osgWidget::createExample(viewer, wm);