- Timestamp:
- 11/28/08 15:36:39 (4 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
OpenSceneGraph/trunk/examples/osgwidgetnotebook/osgwidgetnotebook.cpp
r8602 r9289 3 3 4 4 #include <osg/io_utils> 5 #include <osgGA/TrackballManipulator> 6 #include <osgGA/StateSetManipulator> 7 #include <osgViewer/ViewerEventHandlers> 5 8 #include <osgWidget/Util> 6 9 #include <osgWidget/WindowManager> … … 8 11 #include <osgWidget/Canvas> 9 12 #include <osgWidget/Label> 13 #include <osgWidget/Label> 14 #include <osgWidget/ViewerEventHandlers> 10 15 11 16 const unsigned int MASK_2D = 0xF0000000; … … 24 29 for(unsigned int i = 0; i < objs.size(); i++) objs[i]->setLayer( 25 30 osgWidget::Widget::LAYER_MIDDLE, 26 i 31 i * 2 27 32 ); 28 33 29 34 _windows->getByName(ev.getWidget()->getName())->setLayer( 30 35 osgWidget::Widget::LAYER_MIDDLE, 31 objs.size() 36 objs.size() * 2 32 37 ); 33 38 … … 79 84 label2->setColor(0.0f, i / 4.0f, 0.3f, 1.0f); 80 85 label2->setLabel(descr.str()); 81 label2->setLayer(osgWidget::Widget::LAYER_MIDDLE, i );86 label2->setLayer(osgWidget::Widget::LAYER_MIDDLE, i * 2); 82 87 label2->addSize(50.0f, 50.0f); 83 88 … … 85 90 86 91 label1->setEventMask(osgWidget::EVENT_MOUSE_PUSH); 87 label1->addCallback( osgWidget::Callback(92 label1->addCallback(new osgWidget::Callback( 88 93 &Notebook::callbackTabPressed, 89 94 this, … … 101 106 label->setShadow(0.08f); 102 107 label->setCanFill(true); 103 108 104 109 addWidget(label); 105 110 addWidget(_tabs->embed()); … … 107 112 } 108 113 }; 114 115 void bound(osg::Node* node) { 116 osg::BoundingSphere bs = node->getBound(); 117 118 osgWidget::warn() << "center: " << bs.center() << " radius: " << bs.radius() << std::endl; 119 } 109 120 110 121 int main(int argc, char** argv) { … … 115 126 1280.0f, 116 127 720.0f, 117 MASK_2D ,118 osgWidget::WindowManager::WM_PICK_DEBUG128 MASK_2D //, 129 //osgWidget::WindowManager::WM_USE_RENDERBINS 119 130 ); 120 131 121 Notebook* notebook = new Notebook("notebook"); 132 Notebook* notebook1 = new Notebook("notebook1"); 133 Notebook* notebook2 = new Notebook("notebook2"); 122 134 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); 128 136 129 notebook->attachMoveCallback(); 137 notebook1->attachMoveCallback(); 138 notebook2->attachMoveCallback(); 130 139 131 wm->addChild(notebook); 140 wm->addChild(notebook1); 141 wm->addChild(notebook2); 132 142 133 143 return osgWidget::createExample(viewer, wm);
