• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ VBox类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中VBox的典型用法代码示例。如果您正苦于以下问题:C++ VBox类的具体用法?C++ VBox怎么用?C++ VBox使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了VBox类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: VBox

void
MapNodeHelper::parse(MapNode*             mapNode,
                     osg::ArgumentParser& args,
                     osgViewer::View*     view,
                     osg::Group*          root,
                     Container*           userContainer ) const
{
    if ( !root )
        root = mapNode;

    // options to use for the load
    osg::ref_ptr<osgDB::Options> dbOptions = Registry::instance()->cloneOrCreateOptions();

    // parse out custom example arguments first:
    bool useMGRS       = args.read("--mgrs");
    bool useDMS        = args.read("--dms");
    bool useDD         = args.read("--dd");
    bool useCoords     = args.read("--coords") || useMGRS || useDMS || useDD;

    bool useAutoClip   = args.read("--autoclip");
    bool showActivity  = args.read("--activity");
    bool useLogDepth   = args.read("--logdepth");
    bool useLogDepth2  = args.read("--logdepth2");
    bool kmlUI         = args.read("--kmlui");

    std::string kmlFile;
    args.read( "--kml", kmlFile );

    std::string imageFolder;
    args.read( "--images", imageFolder );

    std::string imageExtensions;
    args.read("--image-extensions", imageExtensions);
    
    // animation path:
    std::string animpath;
    if ( args.read("--path", animpath) )
    {
        view->setCameraManipulator( new osgGA::AnimationPathManipulator(animpath) );
    }

    // Install a new Canvas for our UI controls, or use one that already exists.
    ControlCanvas* canvas = ControlCanvas::getOrCreate( view );

    Container* mainContainer;
    if ( userContainer )
    {
        mainContainer = userContainer;
    }
    else
    {
        mainContainer = new VBox();
        mainContainer->setAbsorbEvents( true );
        mainContainer->setBackColor( Color(Color::Black, 0.8) );
        mainContainer->setHorizAlign( Control::ALIGN_LEFT );
        mainContainer->setVertAlign( Control::ALIGN_BOTTOM );
    }
    canvas->addControl( mainContainer );

    // Add an event handler to toggle the canvas with a key press;
    view->addEventHandler(new ToggleCanvasEventHandler(canvas, 'y'));

    // look for external data in the map node:
    const Config& externals = mapNode->externalConfig();

    // some terrain effects.
    // TODO: Most of these are likely to move into extensions.
    const Config& vertScaleConf   = externals.child("vertical_scale");

    // Loading KML from the command line:
    if ( !kmlFile.empty() )
    {
        KMLOptions kml_options;
        kml_options.declutter() = true;

        // set up a default icon for point placemarks:
        IconSymbol* defaultIcon = new IconSymbol();
        defaultIcon->url()->setLiteral(KML_PUSHPIN_URL);
        kml_options.defaultIconSymbol() = defaultIcon;

        TextSymbol* defaultText = new TextSymbol();
        defaultText->halo() = Stroke(0.3,0.3,0.3,1.0);
        kml_options.defaultTextSymbol() = defaultText;

        osg::Node* kml = KML::load( URI(kmlFile), mapNode, kml_options );
        if ( kml )
        {
            if (kmlUI)
            {
                Control* c = AnnotationGraphControlFactory().create(kml, view);
                if ( c )
                {
                    c->setVertAlign( Control::ALIGN_TOP );
                    canvas->addControl( c );
                }
            }
            root->addChild( kml );
        }
        else
        {
//.........这里部分代码省略.........
开发者ID:ldelgass,项目名称:osgearth,代码行数:101,代码来源:ExampleResources.cpp


示例2: HBox

TeamsSelectionBox::TeamsSelectionBox(const Point2i &_size, bool network, bool w_border) :
  HBox(_size.y, w_border, false)
{
  if (!w_border)
    SetNoBorder();
  SetMargin(0);

  // How many teams ?
  VBox *tmp = new VBox(120, false, false, true);
  if (network) {
    local_teams_nb =
      new SpinButtonWithPicture(_("Local teams:"), "menu/team_number",
                                Point2i(100, 130), 0, 1, 0, MAX_NB_TEAMS);
  } else {
    local_teams_nb =
      new SpinButtonWithPicture(_("Number of teams:"), "menu/team_number",
                                Point2i(100, 130), 2, 1, 2, MAX_NB_TEAMS);
  }
  tmp->AddWidget(local_teams_nb);
  //tmp->AddWidget(new NullWidget(Point2i(120, 120)));
  AddWidget(tmp);

  uint box_w = _size.x - local_teams_nb->GetSizeX() - 10;
  Point2i grid_size = Point2i(box_w, _size.y);
  Point2i grid_dim = grid_size / Point2i(300 + 10, 130 + 10);
  Point2i box_size;
  bool use_list;
  if (grid_dim.x*grid_dim.y < (int)MAX_NB_TEAMS) {
    use_list = true;
    box_size.SetValues(box_w - 40, 120);
  } else {
    use_list = false;
    box_size.SetValues((grid_size / grid_dim) - 10);
  }

  for (uint i=0; i < MAX_NB_TEAMS; i++) {
    std::string player_name = _("Player") ;
    char num_player[4];
    sprintf(num_player, " %d", i+1);
    player_name += num_player;
    teams_selections.push_back(new TeamBox(player_name, box_size));
  }

  // If the intended gridbox would be too big for the intended size,
  // instead create a listbox
  if (use_list) {
    // Warning: this box takes the ownership of the widgets in teams_selections:
    // while any other Box will delete the ones it contains, TeamScrollBox
    // doesn't really contain them as widgets. They therefore aren't released
    // through this mechanism, but with a manual one. This manual mechanism
    // requires we have a *real* copy of the vector for when it is destroyed.
    list_box = new TeamScrollBox(teams_selections, Point2i(box_w-20, _size.y-10));
    list_box->SetNbTeams(0);

    AddWidget(list_box);
  } else {
    list_box = NULL;
    Box * teams_grid_box = new GridBox(grid_dim.y, grid_dim.x, 10, false);
    teams_grid_box->SetNoBorder();

    for (uint i=0; i<MAX_NB_TEAMS; i++)
      teams_grid_box->AddWidget(teams_selections[i]);

    AddWidget(teams_grid_box);
  }

  // Load Teams' list
  GetTeamsList().full_list.sort(compareTeams);
}
开发者ID:Arnaud474,项目名称:Warmux,代码行数:69,代码来源:teams_selection_box.cpp


示例3: tag

void Box::read(const QDomElement& de)
{
    _leftMargin = _rightMargin = _topMargin = _bottomMargin = 0.0;
    bool keepMargins = false;        // whether original margins have to be kept when reading old file

    for (QDomElement e = de.firstChildElement(); !e.isNull(); e = e.nextSiblingElement()) {
        const QString& tag(e.tagName());
        if (setProperty(tag, e))
            ;
        else if (tag == "Text") {
            Text* t;
            if (type() == TBOX) {
                t = static_cast<TBox*>(this)->getText();
                t->read(e);
            }
            else {
                t = new Text(score());
                t->read(e);
                add(t);
            }
        }
        else if (tag == "Symbol") {
            Symbol* s = new Symbol(score());
            s->read(e);
            add(s);
        }
        else if (tag == "Image") {
            // look ahead for image type
            QString path;
            QDomElement ee = e.firstChildElement("path");
            if (!ee.isNull())
                path = ee.text();
            Image* image = 0;
            QString s(path.toLower());
            if (s.endsWith(".svg"))
                image = new SvgImage(score());
            else if (s.endsWith(".jpg")
                     || s.endsWith(".png")
                     || s.endsWith(".gif")
                     || s.endsWith(".xpm")
                    ) {
                image = new RasterImage(score());
            }
            else {
                qDebug("unknown image format <%s>\n", path.toLatin1().data());
            }
            if (image) {
                image->setTrack(score()->curTrack);
                image->read(e);
                add(image);
            }
        }
        else if (tag == "LayoutBreak") {
            LayoutBreak* lb = new LayoutBreak(score());
            lb->read(e);
            add(lb);
        }
        else if (tag == "HBox") {
            HBox* hb = new HBox(score());
            hb->read(e);
            add(hb);
            keepMargins = true;     // in old file, box nesting used outer box margins
        }
        else if (tag == "VBox") {
            VBox* vb = new VBox(score());
            vb->read(e);
            add(vb);
            keepMargins = true;     // in old file, box nesting used outer box margins
        }
        else
            domError(e);
    }

    // with .msc versions prior to 1.17, box margins were only used when nesting another box inside this box:
    // for backward compatibility set them to 0 in all other cases

    if (score()->mscVersion() < 117 && (type() == HBOX || type() == VBOX) && !keepMargins)  {
        _leftMargin = _rightMargin = _topMargin = _bottomMargin = 0.0;
    }
}
开发者ID:musescore,项目名称:musescore-old,代码行数:80,代码来源:box.cpp


示例4: main

int
main(int argc, char** argv)
{
    // allocate pager threads based on CPU configuration.
    int cores = Registry::capabilities().getNumProcessors();
    osg::DisplaySettings::instance()->setNumOfDatabaseThreadsHint( osg::clampAbove(cores, 2) );
    osg::DisplaySettings::instance()->setNumOfHttpDatabaseThreadsHint( osg::clampAbove(cores/2, 1) );

    // parse the command line.
    osg::ArgumentParser arguments(&argc,argv);
    osgViewer::Viewer viewer(arguments);

    // set up the motion model.
    viewer.setCameraManipulator( new EarthManipulator() );

    // simple UI.
    VBox* vbox = new VBox();
    vbox->setMargin( 3 );
    vbox->setChildSpacing( 5 );
    vbox->setAbsorbEvents( true );
    vbox->setHorizAlign( Control::ALIGN_RIGHT );
    vbox->setVertAlign ( Control::ALIGN_BOTTOM );

    // Control instructions:
    Grid* grid = vbox->addControl( new Grid() );
    grid->setControl( 0, 0, new LabelControl("Pan:"));
    grid->setControl( 1, 0, new LabelControl("Left mouse"));
    grid->setControl( 0, 1, new LabelControl("Zoom:"));
    grid->setControl( 1, 1, new LabelControl("Right mouse / scroll"));
    grid->setControl( 0, 2, new LabelControl("Rotate:") );
    grid->setControl( 1, 2, new LabelControl("Middle mouse"));
    grid->setControl( 0, 3, new LabelControl("Go to:"));
    grid->setControl( 1, 3, new LabelControl("Double-click"));

    ControlCanvas::getOrCreate(&viewer)->addControl(vbox);

    // Load an earth file
    osg::Node* node = MapNodeHelper().load(arguments, &viewer);
    if ( !node )
        return usage( "Failed to load earth file." );
    viewer.setSceneData( node );


#ifdef Q_WS_X11
    // required for multi-threaded viewer on linux:
    XInitThreads();
#endif


    QApplication app(argc, argv);

    QWidget* viewerWidget = new ViewerWidget( &viewer );
    
    QMainWindow win;
    win.setWindowTitle( "osgEarth -- The #1 Open Source Terrain SDK for Mission-Critical Applications" );
    win.setCentralWidget( viewerWidget );
    win.setGeometry(100, 100, 1024, 800);

    win.statusBar()->showMessage(QString("osgEarth.  Copyright 2014 Pelican Mapping.   Please visit http://osgearth.org"));

    win.show();
    app.exec();
}
开发者ID:Brucezhou1979,项目名称:osgearth,代码行数:63,代码来源:osgearth_demo.cpp


示例5: while

void Box::read(XmlReader& e)
      {
      _leftMargin = _rightMargin = _topMargin = _bottomMargin = 0.0;
      bool keepMargins = false;        // whether original margins have to be kept when reading old file

      while (e.readNextStartElement()) {
            const QStringRef& tag(e.name());
            if (tag == "height")
                  _boxHeight = Spatium(e.readDouble());
            else if (tag == "width")
                  _boxWidth = Spatium(e.readDouble());
            else if (tag == "topGap")
                  _topGap = e.readDouble();
            else if (tag == "bottomGap")
                  _bottomGap = e.readDouble();
            else if (tag == "leftMargin")
                  _leftMargin = e.readDouble();
            else if (tag == "rightMargin")
                  _rightMargin = e.readDouble();
            else if (tag == "topMargin")
                  _topMargin = e.readDouble();
            else if (tag == "bottomMargin")
                  _bottomMargin = e.readDouble();
            else if (tag == "Text") {
                  Text* t;
                  if (type() == TBOX) {
                        t = static_cast<TBox*>(this)->getText();
                        t->read(e);
                        }
                  else {
                        t = new Text(score());
                        t->read(e);
                        add(t);
                        if (score()->mscVersion() <= 114)
                              t->setLayoutToParentWidth(true);
                        }
                  }
            else if (tag == "Symbol") {
                  Symbol* s = new Symbol(score());
                  s->read(e);
                  add(s);
                  }
            else if (tag == "Image") {
                  Image* image = new Image(score());
                  image->setTrack(e.track());
                  image->read(e);
                  add(image);
                  }
            else if (tag == "FretDiagram") {
                  FretDiagram* f = new FretDiagram(score());
                  f->read(e);
                  add(f);
                  }
            else if (tag == "LayoutBreak") {
                  LayoutBreak* lb = new LayoutBreak(score());
                  lb->read(e);
                  add(lb);
                  }
            else if (tag == "HBox") {
                  HBox* hb = new HBox(score());
                  hb->read(e);
                  add(hb);
                  keepMargins = true;     // in old file, box nesting used outer box margins
                  }
            else if (tag == "VBox") {
                  VBox* vb = new VBox(score());
                  vb->read(e);
                  add(vb);
                  keepMargins = true;     // in old file, box nesting used outer box margins
                  }
            else if (Element::readProperties(e))
                  ;
            else
                  e.unknown();
            }

      // with .msc versions prior to 1.17, box margins were only used when nesting another box inside this box:
      // for backward compatibility set them to 0 in all other cases

      if (score()->mscVersion() < 117 && (type() == HBOX || type() == VBOX) && !keepMargins)  {
            _leftMargin = _rightMargin = _topMargin = _bottomMargin = 0.0;
            }
      }
开发者ID:bojan88,项目名称:MuseScore,代码行数:83,代码来源:box.cpp


示例6:

bool UIFocusTestNestedLayout3::init()
{
    if (UIFocusTestBase::init()) {
        
        Size winSize = Director::getInstance()->getVisibleSize();
        
        _verticalLayout = VBox::create();
        _verticalLayout->setPosition(Vec2(40, winSize.height - 70));
        _uiLayer->addChild(_verticalLayout);
        _verticalLayout->setScale(0.8);
        
        _verticalLayout->setFocused(true);
        _verticalLayout->setLoopFocus(true);
        _verticalLayout->setTag(-1000);
        _firstFocusedWidget = _verticalLayout;
        
        
        HBox *upperHBox = HBox::create();
        upperHBox->setTag(-200);
        _verticalLayout->addChild(upperHBox);
        
        LinearLayoutParameter *params = LinearLayoutParameter::create();
        params->setMargin(Margin(0,0,50,0));
        
        LinearLayoutParameter *vparams = LinearLayoutParameter::create();
        vparams->setMargin(Margin(10, 0, 0, 140));
        upperHBox->setLayoutParameter(vparams);
        
        int count = 3;
        for (int i=0; i<count; ++i) {
            VBox *firstVbox = VBox::create();
            firstVbox->setScale(0.5);
            firstVbox->setLayoutParameter(params);
            firstVbox->setTag((i+1) * 100);
            
            int count1 = 3;
            for (int j=0; j<count1; ++j) {
                ImageView *w = ImageView::create("cocosui/scrollviewbg.png");
                w->setTouchEnabled(true);
                w->setTag(j+firstVbox->getTag()+1);
                w->addTouchEventListener(CC_CALLBACK_2(UIFocusTestBase::onImageViewClicked, this));
                firstVbox->addChild(w);
            }
            
            upperHBox->addChild(firstVbox);

        }
        
        HBox *bottomHBox = HBox::create();
        bottomHBox->setScale(0.5);
        bottomHBox->setTag(600);
        
        bottomHBox->setLayoutParameter(vparams);
        count = 3;
        LinearLayoutParameter *bottomParams = LinearLayoutParameter::create();
        bottomParams->setMargin(Margin(0, 0, 8, 0));
        for (int i=0; i < count; ++i) {
            ImageView *w = ImageView::create("cocosui/scrollviewbg.png");
            w->setLayoutParameter(bottomParams);
            w->setTouchEnabled(true);
            w->setTag(i+601);
            w->addTouchEventListener(CC_CALLBACK_2(UIFocusTestBase::onImageViewClicked, this));
            bottomHBox->addChild(w);
        }
        _verticalLayout->addChild(bottomHBox);
        
     
        
        _loopText = Text::create("loop enabled", "Airal", 20);
        _loopText->setPosition(Vec2(winSize.width/2, winSize.height - 50));
        _loopText->setColor(Color3B::GREEN);
        this->addChild(_loopText);
        
        auto btn = Button::create("cocosui/switch-mask.png");
        btn->setTitleText("Toggle Loop");
        btn->setPosition(Vec2(60, winSize.height - 50));
        btn->setTitleColor(Color3B::RED);
        btn->addTouchEventListener(CC_CALLBACK_2(UIFocusTestNestedLayout3::toggleFocusLoop, this));
        this->addChild(btn);
        
        
        return true;
    }
    return false;
}
开发者ID:289997171,项目名称:cocos2d-x,代码行数:85,代码来源:UIFocusTest.cpp


示例7: createControls

void
createControls( ControlCanvas* cs )
{
    // a container centered on the screen, containing an image and a text label.
    {
        VBox* center = new VBox();
        center->setFrame( new RoundedFrame() );
        center->getFrame()->setBackColor( 1,1,1,0.5 );
        center->setPadding( 10 );
        center->setHorizAlign( Control::ALIGN_CENTER );
        center->setVertAlign( Control::ALIGN_CENTER );

        // Add an image:
        osg::ref_ptr<osg::Image> image;
        if ( HTTPClient::readImageFile("http://osgearth.org/chrome/site/osgearth.gif", image) == HTTPClient::RESULT_OK )
        {
            ImageControl* imageCon = new ImageControl( image.get() );
            imageCon->setHorizAlign( Control::ALIGN_CENTER );
            imageCon->setFixSizeForRotation( true );
            imageCon->addEventHandler( new ImageRotationHandler );
            center->addControl( imageCon );
            center->setHorizAlign( Control::ALIGN_CENTER );
        }

        // Add a text label:
        LabelControl* label = new LabelControl( "osgEarth Controls Toolkit" );
        label->setFont( osgText::readFontFile( "arialbd.ttf" ) );
        label->setFontSize( 24.0f );
        label->setHorizAlign( Control::ALIGN_CENTER );
        label->setMargin( 5 );
        center->addControl( label );

        // Add another
        LabelControl* label2 = new LabelControl( "(Click the osgEarth logo to rotate it)" );
        label2->setHorizAlign( Control::ALIGN_CENTER );
        center->addControl( label2 );

        cs->addControl( center );
    }

    // a simple vbox with absolute positioning in the upper left with two text labels.
    {
        VBox* ul = new VBox();
        ul->setPosition( 20, 20 );
        ul->setPadding( 10 );
        {
            LabelControl* title = new LabelControl( "Upper left control", 22, osg::Vec4f(1,1,0,1) );
            ul->addControl( title );

            LabelControl* content = new LabelControl( "Here is some text in the upper left control" );
            ul->addControl( content );

            HBox* c2 = new HBox();
            c2->setChildSpacing( 10 );
            {
                HSliderControl* slider = new HSliderControl( 0, 100 );
                slider->setBackColor( .6,0,0,1 );
                slider->setHeight( 25 );
                slider->setWidth( 300 );
                slider->addEventHandler( new MySliderHandler() );
                c2->addControl( slider );

                s_sliderLabel = new LabelControl();
                s_sliderLabel->setVertAlign( Control::ALIGN_CENTER );
                c2->addControl( s_sliderLabel );
            }
            ul->addControl( c2 );

            HBox* c3 = new HBox();
            c3->setHorizAlign( Control::ALIGN_CENTER );
            c3->setChildSpacing( 10 );
            {
                HBox* c4 = new HBox();
                c4->setChildSpacing( 5 );
                {
                    c4->addControl( new CheckBoxControl( true ) );
                    c4->addControl( new LabelControl( "Checkbox 1" ) );
                }
                c3->addControl( c4 );

                HBox* c5 = new HBox();
                c5->setChildSpacing( 5 );
                {
                    c5->addControl( new CheckBoxControl( false ) );
                    c5->addControl( new LabelControl( "Checkbox 2" ) );
                }
                c3->addControl( c5 );
            }
            ul->addControl( c3 );
        }
        cs->addControl( ul );

        ul->addEventHandler( new MyClickHandler );
    }

    // a centered hbox container along the bottom on the screen.
    {
        HBox* bottom = new HBox();
        bottom->setFrame( new RoundedFrame() );
        bottom->getFrame()->setBackColor(0,0,0,0.5);
//.........这里部分代码省略.........
开发者ID:dgraves,项目名称:osgearth,代码行数:101,代码来源:osgearth_controls.cpp


示例8: VBox

void
MapNodeHelper::parse(MapNode*             mapNode,
                     osg::ArgumentParser& args,
                     osgViewer::View*     view,
                     osg::Group*          root,
                     Container*           userContainer ) const
{
    if ( !root )
        root = mapNode;

    // options to use for the load
    osg::ref_ptr<osgDB::Options> dbOptions = Registry::instance()->cloneOrCreateOptions();

    // parse out custom example arguments first:
    bool useSky        = args.read("--sky");
    bool useOcean      = args.read("--ocean");
    bool useMGRS       = args.read("--mgrs");
    bool useDMS        = args.read("--dms");
    bool useDD         = args.read("--dd");
    bool useCoords     = args.read("--coords") || useMGRS || useDMS || useDD;
    bool useOrtho      = args.read("--ortho");
    bool useAutoClip   = args.read("--autoclip");
    bool useShadows    = args.read("--shadows");
    bool animateSky    = args.read("--animate-sky");
    bool showActivity  = args.read("--activity");
    bool useLogDepth   = args.read("--logdepth");
    bool useLogDepth2  = args.read("--logdepth2");
    bool kmlUI         = args.read("--kmlui");
    bool inspect       = args.read("--inspect");

    if (args.read("--verbose"))
        osgEarth::setNotifyLevel(osg::INFO);
    
    if (args.read("--quiet"))
        osgEarth::setNotifyLevel(osg::FATAL);

    float ambientBrightness = 0.2f;
    args.read("--ambientBrightness", ambientBrightness);

    std::string kmlFile;
    args.read( "--kml", kmlFile );

    std::string imageFolder;
    args.read( "--images", imageFolder );

    std::string imageExtensions;
    args.read("--image-extensions", imageExtensions);
    
    // animation path:
    std::string animpath;
    if ( args.read("--path", animpath) )
    {
        view->setCameraManipulator( new osgGA::AnimationPathManipulator(animpath) );
    }

    // Install a new Canvas for our UI controls, or use one that already exists.
    ControlCanvas* canvas = ControlCanvas::getOrCreate( view );

    Container* mainContainer;
    if ( userContainer )
    {
        mainContainer = userContainer;
    }
    else
    {
        mainContainer = new VBox();
        mainContainer->setAbsorbEvents( true );
        mainContainer->setBackColor( Color(Color::Black, 0.8) );
        mainContainer->setHorizAlign( Control::ALIGN_LEFT );
        mainContainer->setVertAlign( Control::ALIGN_BOTTOM );
    }
    canvas->addControl( mainContainer );


    // look for external data in the map node:
    const Config& externals = mapNode->externalConfig();

    const Config& skyConf         = externals.child("sky");
    const Config& oceanConf       = externals.child("ocean");
    const Config& annoConf        = externals.child("annotations");
    const Config& declutterConf   = externals.child("decluttering");

    // some terrain effects.
    // TODO: Most of these are likely to move into extensions.
    const Config& lodBlendingConf = externals.child("lod_blending");
    const Config& vertScaleConf   = externals.child("vertical_scale");
    const Config& contourMapConf  = externals.child("contour_map");

    // Adding a sky model:
    if ( useSky || !skyConf.empty() )
    {
        SkyOptions options(skyConf);
        if ( options.getDriver().empty() )
        {
            if ( mapNode->getMapSRS()->isGeographic() )
                options.setDriver("simple");
            else
                options.setDriver("gl");
        }

//.........这里部分代码省略.........
开发者ID:makemefriendanshu,项目名称:osgearth,代码行数:101,代码来源:ExampleResources.cpp


示例9: main

int main(int argc, char *argv[])
{
    TestAction actionBidon;

    int init_flags = SDL_INIT_VIDEO|SDL_INIT_AUDIO|SDL_INIT_JOYSTICK;
    
    if ( SDL_Init(init_flags) < 0 ) {
        fprintf(stderr, "SDL initialisation error:  %s\n", SDL_GetError());
        exit(1);
    }
    GameLoop *loop = GameUIDefaults::GAME_LOOP;
    SDL_Surface *display = SDL_SetVideoMode( 640, 480, 0,  SDL_ANYFORMAT|SDL_HWSURFACE|SDL_DOUBLEBUF);
    if ( display == NULL ) {
        fprintf(stderr, "SDL_SetVideoMode error: %s\n",
                SDL_GetError());
        exit(1);
    }
    loop->setSurface(display);
    atexit(SDL_Quit); 
    SDL_ShowCursor(SDL_DISABLE);
    SDL_WM_SetCaption("FloboPop by iOS-Software",NULL);
  
    // Font par défaut
    SoFont *darkFont = SoFont_new();
    SoFont *menuFont = SoFont_new();
    SoFont *textFont = SoFont_new();
    SoFont_load_ttf(darkFont, "data/base.000/gfx/font.ttf", 17, SoFont_DARK);
    SoFont_load_ttf(menuFont, "data/base.000/gfx/font.ttf", 17, SoFont_STD);
    SoFont_load_ttf(textFont, "data/base.000/gfx/font.ttf", 24, SoFont_GREY);

    GameUIDefaults::FONT_TEXT       = textFont;
    GameUIDefaults::FONT            = menuFont;
    GameUIDefaults::FONT_INACTIVE   = darkFont;
    GameCursor *cursor = new GameCursor("data/base.000/gfx/cursor.png");
    loop->addDrawable(cursor);
    loop->addIdle(cursor);
    
    Screen scr(0, 0, 640, 480);
    pscr = &scr;
    VBox bidonBox;
    Text bidonText("Hello");
    ShowModalDialogAction showDialogAction(scr.getRootContainer());
    
    FramePicture fpict(IIM_Load_Absolute_DisplayFormatAlpha("data/base.000/gfx/frame.png"),
                       25, 28, 25, 19, 26, 23);
    windowFramePict = &fpict;
    FramePicture fpict2(IIM_Load_Absolute_DisplayFormatAlpha(
		       "data/base.000/gfx/editfield.png"),
			5, 23, 4, 6, 10, 3);
    FramePicture fpict3(IIM_Load_Absolute_DisplayFormatAlpha(
		       "data/base.000/gfx/separator.png"),
			63, 2, 63, 2, 4, 2);
    RGBA blackTranslucient = {(Uint8)0x00, (Uint8)0x00, (Uint8)0x00, (Uint8)0x80};
    RGBA buttonGray = {(Uint8)0xCC, (Uint8)0x95, (Uint8)0x36, (Uint8)0xFF};
    RGBA textFieldColor = {(Uint8)0xFA, (Uint8)0xEF, (Uint8)0xDB, (Uint8)0xFF};
    fpict.setContentColor(blackTranslucient);
    fpict2.setContentColor(textFieldColor);
    fpict3.setContentColor(buttonGray);

    Frame frame(&fpict), frame2(&fpict2);
    frame2.setFocusedPicture(&fpict3);
    //frame.setPreferedSize(Vec3(100, 100));
    FramedButton framedButton1("Hi1", NULL, &fpict2, &fpict3);
    Button bidonButton1("Hi2", &showDialogAction);
    TestFloboStatsAction statsAction;
    Button bidonButton2("Stats", &statsAction);
    Button bidonButton3("Hop");
    FramedEditField bidonField("toto", NULL, &fpict2, &fpict2);
    IIM_Surface *upArrow = IIM_Load_Absolute_DisplayFormatAlpha ("data/base.000/gfx/uparrow.png");
    IIM_Surface *downArrow = IIM_Load_Absolute_DisplayFormatAlpha ("data/base.000/gfx/downarrow.png");
    bidonBox.setPolicy(USE_MIN_SIZE);
    ListView list(10, upArrow, downArrow, &fpict);
    IIM_Surface *onSwitchImage = IIM_Load_Absolute_DisplayFormatAlpha ("data/base.000/gfx/switch-on.png");
    IIM_Surface *offSwitchImage = IIM_Load_Absolute_DisplayFormatAlpha ("data/base.000/gfx/switch-off.png");
    SwitchedButton prefSwitchA(String("Mon switch tout neuf A"), true,
                              onSwitchImage, offSwitchImage,
                              String("test.widget.switchbuttonAB"));
    SwitchedButton prefSwitchB(String("Mon switch tout neuf B sur la même pref que A"), true,
                               onSwitchImage, offSwitchImage,
                               String("test.widget.switchbuttonAB"));
    SwitchedButton prefSwitchC(String("Mon switch tout neuf C sur une autre pref"), false,
                               onSwitchImage, offSwitchImage,
                               String("test.widget.switchbuttonC"));
    bidonBox.add(&prefSwitchA);
    bidonBox.add(&prefSwitchB);
    bidonBox.add(&prefSwitchC);
    bidonBox.add(&bidonText);
    //bidonBox.add(&framedButton1);
    //bidonBox.add(&bidonButton1);
    bidonBox.add(&bidonButton2);
    //bidonBox.add(&frame2);
    bidonBox.add(&bidonField);
    bidonBox.add(&frame);
    for (int i = 0 ; i < 100 ; i++) {
        String newEntry("Bla bla ");
        list.addEntry(new ListViewEntry(newEntry + i, &actionBidon));
    }
    frame.add(&list);
    //bidonBox.add(&list);
    bidonBox.add(&bidonButton3);
//.........这里部分代码省略.........
开发者ID:flboudet,项目名称:flobz,代码行数:101,代码来源:TestGameUi.cpp


示例10: tag

bool Box::readProperties(XmlReader& e)
      {
      const QStringRef& tag(e.name());
      if (tag == "height")
            _boxHeight = Spatium(e.readDouble());
      else if (tag == "width")
            _boxWidth = Spatium(e.readDouble());
      else if (tag == "topGap") {
            _topGap = e.readDouble();
            if (score()->mscVersion() >= 203)
                  _topGap *= score()->spatium();
            }
      else if (tag == "bottomGap") {
            _bottomGap = e.readDouble();
             if (score()->mscVersion() >= 203)
                  _bottomGap *= score()->spatium();
            }
      else if (tag == "leftMargin")
            _leftMargin = e.readDouble();
      else if (tag == "rightMargin")
            _rightMargin = e.readDouble();
      else if (tag == "topMargin")
            _topMargin = e.readDouble();
      else if (tag == "bottomMargin")
            _bottomMargin = e.readDouble();
      else if (tag == "Text") {
            Text* t;
            if (type() == Element::Type::TBOX) {
                  t = static_cast<TBox*>(this)->text();
                  t->read(e);
                  }
            else {
                  t = new Text(score());
                  t->read(e);
                  if (t->isEmpty()) {
                        qDebug("read empty text");
                        }
                  else
                        add(t);
                  }
            }
      else if (tag == "Symbol") {
            Symbol* s = new Symbol(score());
            s->read(e);
            add(s);
            }
      else if (tag == "Image") {
            if (MScore::noImages)
                  e.skipCurrentElement();
            else {
                  Image* image = new Image(score());
                  image->setTrack(e.track());
                  image->read(e);
                  add(image);
                  }
            }
      else if (tag == "FretDiagram") {
            FretDiagram* f = new FretDiagram(score());
            f->read(e);
            add(f);
            }
      else if (tag == "LayoutBreak") {
            LayoutBreak* lb = new LayoutBreak(score());
            lb->read(e);
            add(lb);
            }
      else if (tag == "HBox") {
            HBox* hb = new HBox(score());
            hb->read(e);
            add(hb);
            }
      else if (tag == "VBox") {
            VBox* vb = new VBox(score());
            vb->read(e);
            add(vb);
            }
      else if (Element::readProperties(e))
            ;
      else
            return false;
      return true;
      }
开发者ID:FryderykChopin,项目名称:MuseScore,代码行数:82,代码来源:box.cpp


示例11: createControls

/** creates some UI controls for adjusting the decluttering parameters. */
void
createControls( osgViewer::View* view )
{
    ControlCanvas* canvas = ControlCanvas::getOrCreate(view);
    
    // title bar
    VBox* vbox = canvas->addControl(new VBox(Control::ALIGN_NONE, Control::ALIGN_BOTTOM, 2, 1 ));
    vbox->setBackColor( Color(Color::Black, 0.5) );
    vbox->addControl( new LabelControl("osgEarth Tracks Demo", Color::Yellow) );
    
    // checkbox that toggles decluttering of tracks
    struct ToggleDecluttering : public ControlEventHandler {
        void onValueChanged( Control* c, bool on ) {
            Decluttering::setEnabled( on );
        }
    };
    HBox* dcToggle = vbox->addControl( new HBox() );
    dcToggle->addControl( new CheckBoxControl(true, new ToggleDecluttering()) );
    dcToggle->addControl( new LabelControl("Declutter") );

    // checkbox that toggles the coordinate display
    struct ToggleCoords : public ControlEventHandler {
        void onValueChanged( Control* c, bool on ) {
            g_showCoords = on;
        }
    };
    HBox* coordsToggle = vbox->addControl( new HBox() );
    coordsToggle->addControl( new CheckBoxControl(true, new ToggleCoords()) );
    coordsToggle->addControl( new LabelControl("Show locations") );

    // grid for the slider controls so they look nice
    Grid* grid = vbox->addControl( new Grid() );
    grid->setHorizFill( true );
    grid->setChildHorizAlign( Control::ALIGN_LEFT );
    grid->setChildSpacing( 6 );

    unsigned r=0;

    // event handler for changing decluttering options
    struct ChangeFloatOption : public ControlEventHandler {
        optional<float>& _param;
        LabelControl* _label;
        ChangeFloatOption( optional<float>& param, LabelControl* label ) : _param(param), _label(label) { }
        void onValueChanged( Control* c, float value ) {
            _param = value;
            _label->setText( Stringify() << std::fixed << std::setprecision(1) << value );
            Decluttering::setOptions( g_dcOptions );
        }
    };

    grid->setControl( 0, r, new LabelControl("Sim loop duration:") );
    LabelControl* speedLabel = grid->setControl( 2, r, new LabelControl(Stringify() << std::fixed << std::setprecision(1) << *g_duration) );
    HSliderControl* speedSlider = grid->setControl( 1, r, new HSliderControl( 
        600.0, 30.0, *g_duration, new ChangeFloatOption(g_duration, speedLabel) ) );
    speedSlider->setHorizFill( true, 200 );

    grid->setControl( 0, ++r, new LabelControl("Min scale:") );
    LabelControl* minAnimationScaleLabel = grid->setControl( 2, r, new LabelControl(Stringify() << std::fixed << std::setprecision(1) << *g_dcOptions.minAnimationScale()) );
    grid->setControl( 1, r, new HSliderControl( 
        0.0, 1.0, *g_dcOptions.minAnimationScale(), new ChangeFloatOption(g_dcOptions.minAnimationScale(), minAnimationScaleLabel) ) );

    grid->setControl( 0, ++r, new LabelControl("Min alpha:") );
    LabelControl* alphaLabel = grid->setControl( 2, r, new LabelControl(Stringify() << std::fixed << std::setprecision(1) << *g_dcOptions.minAnimationAlpha()) );
    grid->setControl( 1, r, new HSliderControl( 
        0.0, 1.0, *g_dcOptions.minAnimationAlpha(), new ChangeFloatOption(g_dcOptions.minAnimationAlpha(), alphaLabel) ) );

    grid->setControl( 0, ++r, new LabelControl("Activate time (s):") );
    LabelControl* actLabel = grid->setControl( 2, r, new LabelControl(Stringify() << std::fixed << std::setprecision(1) << *g_dcOptions.inAnimationTime()) );
    grid->setControl( 1, r, new HSliderControl( 
        0.0, 2.0, *g_dcOptions.inAnimationTime(), new ChangeFloatOption(g_dcOptions.inAnimationTime(), actLabel) ) );

    grid->setControl( 0, ++r, new LabelControl("Deactivate time (s):") );
    LabelControl* deactLabel = grid->setControl( 2, r, new LabelControl(Stringify() << std::fixed << std::setprecision(1) << *g_dcOptions.outAnimationTime()) );
    grid->setControl( 1, r, new HSliderControl( 
        0.0, 2.0, *g_dcOptions.outAnimationTime(), new ChangeFloatOption(g_dcOptions.outAnimationTime(), deactLabel) ) );
}
开发者ID:3dcl,项目名称:osgearth,代码行数:77,代码来源:osgearth_tracks.cpp


示例12: PopupWindowPin

ColorPopup::ColorPopup(const ColorButtonOptions& options)
  : PopupWindowPin(" ", // Non-empty to create title-bar and close button
                   ClickBehavior::CloseOnClickInOtherWindow,
                   options.canPinSelector)
  , m_vbox(VERTICAL)
  , m_topBox(HORIZONTAL)
  , m_color(app::Color::fromMask())
  , m_closeButton(nullptr)
  , m_colorPaletteContainer(options.showIndexTab ?
                            new ui::View: nullptr)
  , m_colorPalette(options.showIndexTab ?
                   new PaletteView(false, PaletteView::SelectOneColor, this, 7*guiscale()):
                   nullptr)
  , m_simpleColors(nullptr)
  , m_oldAndNew(Shade(2), ColorShades::ClickEntries)
  , m_maskLabel("Transparent Color Selected")
  , m_canPin(options.canPinSelector)
  , m_insideChange(false)
  , m_disableHexUpdate(false)
{
  if (options.showSimpleColors) {
    if (!g_simplePal) {
      ResourceFinder rf;
      rf.includeDataDir("palettes/tags.gpl");
      if (rf.findFirst())
        g_simplePal.reset(load_palette(rf.filename().c_str()));
    }

    if (g_simplePal)
      m_simpleColors = new SimpleColors(this, &m_tooltips);
  }

  ButtonSet::Item* item = m_colorType.addItem("Index");
  item->setFocusStop(false);
  if (!options.showIndexTab)
    item->setVisible(false);

  m_colorType.addItem("RGB")->setFocusStop(false);
  m_colorType.addItem("HSV")->setFocusStop(false);
  m_colorType.addItem("HSL")->setFocusStop(false);
  m_colorType.addItem("Gray")->setFocusStop(false);
  m_colorType.addItem("Mask")->setFocusStop(false);

  m_topBox.setBorder(gfx::Border(0));
  m_topBox.setChildSpacing(0);

  if (m_colorPalette) {
    m_colorPaletteContainer->attachToView(m_colorPalette);
    m_colorPaletteContainer->setExpansive(true);
  }
  m_sliders.setExpansive(true);

  m_topBox.addChild(&m_colorType);
  m_topBox.addChild(new Separator("", VERTICAL));
  m_topBox.addChild(&m_hexColorEntry);
  m_topBox.addChild(&m_oldAndNew);

  // TODO fix this hack for close button in popup window
  // Move close button (decorative widget) inside the m_topBox
  {
    WidgetsList decorators;
    for (auto child : children()) {
      if (child->type() == kWindowCloseButtonWidget) {
        m_closeButton = child;
        removeChild(child);
        break;
      }
    }
    if (m_closeButton) {
      m_topBox.addChild(new BoxFiller);
      VBox* vbox = new VBox;
      vbox->addChild(m_closeButton);
      m_topBox.addChild(vbox);
    }
  }
  setText("");                  // To remove title

  m_vbox.addChild(&m_tooltips);
  if (m_simpleColors)
    m_vbox.addChild(m_simpleColors);
  m_vbox.addChild(&m_topBox);
  if (m_colorPaletteContainer)
    m_vbox.addChild(m_colorPaletteContainer);
  m_vbox.addChild(&m_sliders);
  m_vbox.addChild(&m_maskLabel);
  addChild(&m_vbox);

  m_colorType.ItemChange.connect(base::Bind<void>(&ColorPopup::onColorTypeClick, this));

  m_sliders.ColorChange.connect(&ColorPopup::onColorSlidersChange, this);
  m_hexColorEntry.ColorChange.connect(&ColorPopup::onColorHexEntryChange, this);
  m_oldAndNew.Click.connect(&ColorPopup::onSelectOldColor, this);

  // Set RGB just for the sizeHint(), and then deselect the color type
  // (the first setColor() call will setup it correctly.)
  selectColorType(app::Color::RgbType);
  m_colorType.deselectItems();

  m_onPaletteChangeConn =
    App::instance()->PaletteChange.connect(&ColorPopup::onPaletteChange, this);
//.........这里部分代码省略.........
开发者ID:aseprite,项目名称:aseprite,代码行数:101,代码来源:color_popup.cpp


示例13: m_seq

DinoGUI::DinoGUI(int argc, char** argv) 
  : m_seq("Dino", m_song),
    m_proxy(m_song),
    m_dbus("org.nongnu.dino"),
    m_dbus_obj(0),
    m_plif(*this, m_song, m_seq, m_proxy, m_dbus.get_name()),
    m_plib(m_plif),
    m_valid(false) {
  
  if (!m_seq.is_valid()) {
    MessageDialog dlg("Could not initialise the sequencer!", 
                      false, MESSAGE_ERROR);
    dlg.run();
    return;
  }
  
  if (!init_lash(argc, argv, m_seq.get_jack_name())) {
    MessageDialog dlg("Could not initialise LASH!", 
                      false, MESSAGE_ERROR);
    dlg.run();
    return;
  }
  
  m_valid = true;
  
  m_dbus_obj = new DinoDBusObject(m_proxy, m_seq);
  m_dbus.register_object("/", m_dbus_obj);
  signal_timeout().
    connect(bind(mem_fun(m_dbus, &DBus::Connection::run), 0), 50);
  
  // initialise the main window
  m_window.set_title("Dino");
  Gtk::Window::set_default_icon_from_file(DATA_DIR "/head.png");
  VBox* vbox = manage(new VBox);
  m_window.add(*vbox);
  MenuBar* mbar = manage(new MenuBar);
  init_menus(*mbar);
  vbox->pack_start(*mbar, PACK_SHRINK);
  vbox->pack_start(m_nb);
  m_statusbar.set_has_resize_grip(false);
  vbox->pack_start(m_statusbar, PACK_SHRINK);
  m_nb.set_border_width(3);
  
  // initialise the "About" dialog
  m_about_dialog.set_icon_from_file(DATA_DIR "/head.png");
  m_about_dialog.set_name("Dino");
  m_about_dialog.set_version(VERSION);
  m_about_dialog.set_copyright("\u00A9 " CR_YEAR " Lars Luthman "
                               "<[email protected]>");
  m_about_dialog.set_comments("A pattern based MIDI sequencer for GNU/Linux");
  m_about_dialog.set_license(GPL_TEXT);
  m_about_dialog.set_logo(Pixbuf::create_from_file(DATA_DIR "/midisaurus.png"));
  
  // initialise the "Plugins" dialog
  m_plug_dialog.set_icon_from_file(DATA_DIR "/head.png");
  m_plug_dialog.set_library(m_plib);
  
  m_nb.signal_switch_page().
    connect(sigc::hide<0>(mem_fun(*this, &DinoGUI::page_switched)));
  
  load_plugins(argc, argv);
  
  reset_gui();
  set_status("Welcome to Dino!");
}
开发者ID:ViktorNova,项目名称:dino,代码行数:65,代码来源:dinogui.cpp



注:本文中的VBox类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ VBoxContainer类代码示例发布时间:2022-05-31
下一篇:
C++ VBObject类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap