Ejemplo n.º 1
0
def main(argv):

    
    viewer = osgViewer.Viewer()

    wm = osgWidget.WindowManager(
        viewer,
        1280.0,
        1024.0,
        MASK_2D,
        osgWidget.WindowManager.WM_PICK_DEBUG
        #osgWidget.WindowManager.WM_NO_INVERT_Y
    )
    
    frame = osgWidget.Frame.createSimpleFrameFromTheme(
        "frame",
        osgDB.readImageFile("osgWidget/theme.png"),
        40.0,
        40.0,
	osgWidget.Frame.FRAME_ALL
    )

    frame.getBackground().setColor(0.0, 0.0, 0.0, 0.0)

    # This is our Transformers box. :)
    box = osgWidget.Box("images", osgWidget.Box.VERTICAL)
    img1 = osgWidget.Widget("im1", 512.0, 512.0)
    img2 = osgWidget.Widget("im2", 512.0, 512.0)
    img3 = osgWidget.Widget("im3", 512.0, 512.0)
    img4 = osgWidget.Widget("im4", 512.0, 512.0)

    img1.setImage("osgWidget/scrolled1.jpg", True)
    img2.setImage("osgWidget/scrolled2.jpg", True)
    img3.setImage("osgWidget/scrolled3.jpg", True)
    img4.setImage("osgWidget/scrolled4.jpg", True)

    img1.setMinimumSize(10.0, 10.0)
    img2.setMinimumSize(10.0, 10.0)
    img3.setMinimumSize(10.0, 10.0)
    img4.setMinimumSize(10.0, 10.0)

    box.addWidget(img1)
    box.addWidget(img2)
    box.addWidget(img3)
    box.addWidget(img4)
    box.setEventMask(osgWidget.EVENT_NONE)

    #frame.getEmbeddedWindow().setWindow(box)
    frame.setWindow(box)
    frame.getEmbeddedWindow().setColor(1.0, 1.0, 1.0, 1.0)
    frame.resize(300.0, 300.0)
    frame.addCallback(osgWidget.Callback(scrollWindow, osgWidget.EVENT_MOUSE_SCROLL))
    frame.addCallback(osgWidget.Callback(changeTheme, osgWidget.EVENT_KEY_DOWN))

    wm.addChild(frame)

    return osgWidget.createExample(viewer, wm)
Ejemplo n.º 2
0
def createWidget(name, col, layer):

    widget = osgWidget.Widget(name, 200.0, 200.0)

    widget.setColor(col, col, col, 0.2)
    widget.setLayer(layer)

    return widget
Ejemplo n.º 3
0
def main(argv):

    
    viewer = osgViewer.Viewer()

    wm = osgWidget.WindowManager(
        viewer,
        1280.0,
        1024.0,
        MASK_2D,
        osgWidget.WindowManager.WM_PICK_DEBUG
    )
    
    canvas = osgWidget.Canvas("canvas")
    pOutline = osgWidget.Widget("pOutline", 512.0, 64.0)
    pMeter = osgWidget.Widget("pMeter", 0.0, 64.0)
    pLabel = osgWidget.Label("pLabel", "0% Done")

    pOutline.setImage("osgWidget/progress-outline.png", True)
    pOutline.setLayer(osgWidget.Widget.LAYER_MIDDLE, 2)
    
    pMeter.setImage("osgWidget/progress-meter.png")
    pMeter.setColor(0.7, 0.1, 0.1, 0.7)
    pMeter.setLayer(osgWidget.Widget.LAYER_MIDDLE, 1)

    pLabel.setFont("fonts/VeraMono.ttf")
    pLabel.setFontSize(20)
    pLabel.setFontColor(1.0, 1.0, 1.0, 1.0)
    pLabel.setSize(512.0, 64.0)
    pLabel.setLayer(osgWidget.Widget.LAYER_MIDDLE, 3)

    canvas.setOrigin(300.0, 300.0)
    canvas.addWidget(pMeter, 0.0, 0.0)
    canvas.addWidget(pOutline, 0.0, 0.0)
    canvas.addWidget(pLabel, 0.0, 0.0)
    canvas.getBackground().setColor(0.0, 0.0, 0.0, 0.0)
    canvas.setUpdateCallback(UpdateProgressNode())

    wm.addChild(canvas)

    return osgWidget.createExample(viewer, wm, osgDB.readNodeFile("cow.osgt"))
Ejemplo n.º 4
0
def main(argv):

    
    viewer = osgViewer.Viewer()

    wm = osgWidget.WindowManager(
        viewer,
        1280.0,
        1024.0,
        MASK_2D
    )

    box = osgWidget.Box("box", osgWidget.Box.VERTICAL)

    widget1 = osgWidget.Widget("w1", 200.0, 200.0)
    widget2 = osgWidget.Widget("w2", 100.0, 100.0)
    widget3 = osgWidget.Widget("w3", 0.0, 0.0)
    # CustomStyled*      cs      = CustomStyled()

    # Yep.
    wm.getStyleManager().addStyle(osgWidget.Style("widget.style1", STYLE1))
    wm.getStyleManager().addStyle(osgWidget.Style("widget.style2", STYLE2))
    wm.getStyleManager().addStyle(osgWidget.Style("spacer", STYLE3))
    wm.getStyleManager().addStyle(osgWidget.Style("window", STYLE4))
    # wm.getStyleManager().addStyle(CustomStyle("widget", ""))

    widget1.setStyle("widget.style1")
    widget2.setStyle("widget.style2")
    widget3.setStyle("spacer")

    box.setStyle("window")

    box.addWidget(widget1)
    box.addWidget(widget2)
    box.addWidget(widget3)

    wm.addChild(box)

    # box.resizePercent(0.0, 100.0)

    return osgWidget.createExample(viewer, wm)
Ejemplo n.º 5
0
def createBox(name, bt):

    
    box = osgWidget.Box(name, bt, True)
    widget1 = osgWidget.Widget(name + "_widget1", 100.0, 100.0)
    widget2 = osgWidget.Widget(name + "_widget2", 100.0, 100.0)
    widget3 = ColorWidget()

    widget1.setColor(0.3, 0.3, 0.3, 1.0)
    widget2.setColor(0.6, 0.6, 0.6, 1.0)

    widget3.setImage("osgWidget/natascha.png")
    widget3.setTexCoord(0.0, 0.0, osgWidget.Widget.LOWER_LEFT)
    widget3.setTexCoord(1.0, 0.0, osgWidget.Widget.LOWER_RIGHT)
    widget3.setTexCoord(1.0, 1.0, osgWidget.Widget.UPPER_RIGHT)
    widget3.setTexCoord(0.0, 1.0, osgWidget.Widget.UPPER_LEFT)

    box.addWidget(widget1)
    box.addWidget(widget2)
    box.addWidget(widget3)

    return box
Ejemplo n.º 6
0
def main(argv):
    viewer = osgViewer.Viewer()
    wm = osgWidget.WindowManager(
        viewer,
        1280.0,
        1024.0,
        MASK_2D,
        osgWidget.WindowManager.WM_PICK_DEBUG
    )
    table = osgWidget.Table("table", 3, 3)
    # Here we create our "cells" manually, though it will often be convenient to
    # do so algorithmically. Also, notice how we set the text name of each widget to
    # correspond with it's "index" in the table. This is merely a convenience, which
    # we use later...
    table.addWidget(osgWidget.Widget("0, 0", 100.0, 25.0), 0, 0)
    table.addWidget(osgWidget.Widget("0, 1", 100.0, 25.0), 0, 1)
    table.addWidget(osgWidget.Widget("0, 2", 100.0, 75.0), 0, 2)
    table.addWidget(osgWidget.Widget("1, 0", 200.0, 45.0), 1, 0)
    table.addWidget(osgWidget.Widget("1, 1", 200.0, 45.0), 1, 1)
    table.addWidget(osgWidget.Widget("1, 2", 200.0, 45.0), 1, 2)
    table.addWidget(osgWidget.Widget("2, 0", 300.0, 65.0), 2, 0)
    table.addWidget(osgWidget.Widget("2, 1", 300.0, 65.0), 2, 1)
    table.addWidget(osgWidget.Widget("2, 2", 300.0, 65.0), 2, 2)
    table.getBackground().setColor(0.0, 0.0, 0.5, 1.0)
    table.attachMoveCallback()
    # Use a hackish method of setting the spacing for all Widgets.
    for i in table:
        # for(osgWidget.Table.Iterator i = table.begin() i != table.end() i++)
        i.setPadding(1.0)
    # Now we fetch the very first 0, 0 Widget in the table using an awkward method.
    # This is merely one way to fetch a Widget from a Window, there are many others.
    # The osgWidget.Window.getByName interface will be very handy in scripting languages
    # where users will want to retrieve handles to existing Windows using a useful
    # textual name, such as "MainGUIParent" or something.
    table.getByName("0, 0").setAlignHorizontal(osgWidget.Widget.HA_LEFT)
    table.getByName("0, 0").setAlignVertical(osgWidget.Widget.VA_BOTTOM)
    table.getByName("0, 0").setPadLeft(50.0)
    table.getByName("0, 0").setPadTop(3.0)
    # Change the colors a bit to differentiate this row from the others.
    table.getByName("2, 0").setColor(1.0, 0.0, 0.0, 1.0, osgWidget.Widget.LOWER_LEFT)
    table.getByName("2, 1").setColor(1.0, 0.0, 0.0, 0.5)
    table.getByName("2, 2").setColor(1.0, 0.0, 0.0, 0.5)
    wm.addChild(table)
    createExample = return(viewer, wm)
Ejemplo n.º 7
0
def main(argv):

    
    viewer = osgViewer.Viewer()

    wm = osgWidget.WindowManager(
        viewer,
        1280.0,
        1024.0,
        MASK_2D,
        osgWidget.WindowManager.WM_PICK_DEBUG
    )
    
    table = osgWidget.Table("table", 3, 3)

    # Here we create our "cells" manually, though it will often be convenient to
    # do so algorithmically. Also, notice how we set the text name of each widget to
    # correspond with it's "index" in the table. This is merely a convenience, which
    # we use later...
    table.addWidget(osgWidget.Widget("0, 0", 100.0, 25.0), 0, 0)
    table.addWidget(osgWidget.Widget("0, 1", 100.0, 25.0), 0, 1)
    table.addWidget(osgWidget.Widget("0, 2", 100.0, 75.0), 0, 2)
    
    table.addWidget(osgWidget.Widget("1, 0", 200.0, 45.0), 1, 0)
    table.addWidget(osgWidget.Widget("1, 1", 200.0, 45.0), 1, 1)
    table.addWidget(osgWidget.Widget("1, 2", 200.0, 45.0), 1, 2)
    
    table.addWidget(osgWidget.Widget("2, 0", 300.0, 65.0), 2, 0)
    table.addWidget(osgWidget.Widget("2, 1", 300.0, 65.0), 2, 1)
    table.addWidget(osgWidget.Widget("2, 2", 300.0, 65.0), 2, 2)

    table.getBackground().setColor(0.0, 0.0, 0.5, 1.0)
    table.attachMoveCallback()

    # Use a hackish method of setting the spacing for all Widgets.
    for(osgWidget.Table.Iterator i = table.begin() i  not = table.end() i++)
        i.setPadding(1.0)
Ejemplo n.º 8
0
class ColorWidget (osgWidget.Widget) :
ColorWidget():
    osgWidget.Widget("", 256.0, 256.0) 
        setEventMask(osgWidget.EVENT_ALL)
def main(argv):

    
    args = osg.ArgumentParser(argv)

    setupArguments(args)

    viewer = osgViewer.Viewer(args)

    while args.read("--help") : 
        args.getApplicationUsage().write(
            std.cout,
            osg.ApplicationUsage.COMMAND_LINE_OPTION
        )

        return 0

    size = str()

    width = 1280
    height = 1024
    wSize = 10
    singleWindow = False
    multiWindow = False

    readSize(args, "--width", width)
    readSize(args, "--height", height)
    readSize(args, "--size", wSize)

    while args.read("--single-window") : singleWindow = True
    
    while args.read("--multi-window") : multiWindow = True

    numWidgets = 0

    if args.argc() >= 2 : numWidgets = std.atoi(args[1])

    else return doError("Please specify the number of Widgets to use.")

    if numWidgets <= 0 : return doError("Please specify one or more Widgets to use.")

    if  not singleWindow  and   not multiWindow : return doError(
        "Please specify one of --single-window or --multi-window."
    )

    if singleWindow : 
        canvas = osgWidget.Canvas("canvas")

        canvas.getBackground().setColor(0.0, 0.0, 0.0, 0.0)

        rows = height / (wSize + 2)
        cols = (numWidgets / rows) + 1
        w = 0

        #
#        image = osgDB.readImageFile("osgWidget/natascha.png")
#        texture = osg.Texture2D()
#
#        texture.setImage(0, image)
#        

        for(unsigned int c = 0 c < cols c++) 
            for(unsigned int r = 0 r < rows r++) 
                if w >= numWidgets : break

                widget = osgWidget.Widget(
                    "",
                    wSize,
                    wSize
                )

                col = static_cast<float>(w) / static_cast<float>(numWidgets)

                widget.setColor(col, col, col, 0.9)
                # widget.setTexture(texture, True)

                canvas.addWidget(widget, c * (wSize + 2), r * (wSize + 2))

                w++
Ejemplo n.º 10
0
def main(argv):

    
    viewer = osgViewer.Viewer()
    
    # Let's get busy not  The WindowManager class is actually an osg.Switch,
    # so you can add it to (ideally) an orthographic camera and have it behave as
    # expected. Note that you create a WindowManager with a NodeMask--it is very important
    # that this be unique for picking to work properly. This also makes it possible to have
    # multiple WindowManagers each operating on their own, unique set of Window objects.
    # The final bool argument is a group of flags that introduce optional functionality
    # for the WindowManager. In our case we include the flags USE_PYTHON and USE_LUA,
    # to demonstrate (and test) their usage. Finally, we pass the temporary WM_NO_BETA_WARN
    # argument, which prevents creating the orange warning window. :) It will be shown
    # in other examples...
    wm = osgWidget.WindowManager(
        viewer,
        1280.0,
        1024.0,
        MASK_2D,
        osgWidget.WindowManager.WM_USE_LUA |
        osgWidget.WindowManager.WM_USE_PYTHON |
        osgWidget.WindowManager.WM_PICK_DEBUG
    )

    # An actual osgWidget.Window is pure virtual, so we've got to use the osgWidget.Box
    # implementation for now. At a later time, support for Tables and other kinds of
    # advanced layout Window types will be added.
    box = osgWidget.Box("box", osgWidget.Box.HORIZONTAL)

    # Now we actually attach our two types of callbacks to the box instance. The first
    # uses the simple function signature, the second uses a bound method, passing "this"
    # as the second argument to the Callback constructor.
    # Object obj

    static str data = "lol ur face not "

    #
#    box.addCallback(osgWidget.Callback(windowClicked, osgWidget.EVENT_MOUSE_PUSH, data))
#    box.addCallback(osgWidget.Callback(windowScrolled, osgWidget.EVENT_MOUSE_SCROLL))
#    box.addCallback(osgWidget.Callback(
#        Object.windowClicked,
#        obj,
#        osgWidget.EVENT_MOUSE_PUSH
#    ))
#    

    box.addCallback(CallbackObject(osgWidget.EVENT_MOUSE_PUSH))

    # Create some of our "testing" Widgets included are two Widget subclasses I made
    # during testing which I've kept around for testing purposes. You'll notice
    # that you cannot move the box using the NullWidget, and that the NotifyWidget
    # is a bit verbose. :)
    widget1 = osgWidget.NotifyWidget("widget1", 300.0, 100.0)
    widget2 = osgWidget.NullWidget("widget2", 400.0, 75.0)
    widget3 = osgWidget.Widget("widget3", 100.0, 100.0)
    # Set the colors of widget1 and widget3 to green.
    widget1.setColor(0.0, 1.0, 0.0, 1.0)
    widget1.setCanFill(True)
    widget3.setColor(0.0, 1.0, 0.0, 1.0)

    widget1.setImage(osgDB.readImageFile("Images/Saturn.TGA"), True)

    # Set the color of widget2, to differentiate it and make it sassy. This is
    # like a poor man's gradient not 
    widget2.setColor(0.9, 0.0, 0.0, 0.9, osgWidget.Widget.LOWER_LEFT)
    widget2.setColor(0.9, 0.0, 0.0, 0.9, osgWidget.Widget.LOWER_RIGHT)
    widget2.setColor(0.0, 0.0, 0.9, 0.9, osgWidget.Widget.UPPER_RIGHT)
    widget2.setColor(0.0, 0.0, 0.9, 0.9, osgWidget.Widget.UPPER_LEFT)

    # Now add our newly created widgets to our box.
    box.addWidget(widget1)
    box.addWidget(widget2)
    box.addWidget(widget3)

    # For maximum efficiency, Windows don't automatically reallocate their geometry
    # and internal positioning every time a widget is added. Thus, we either have to
    # call the WindowManger.resizeAllWindows method or manually call
    # Window.resize when we're ready.
    box.resize()

    # Now, lets clone our existing box and create a copy of of it, also adding that
    # to the WindowManager. This demonstrates the usages of OSG's .clone() support,
    # though that is abstracted by our META_UIObject macro.
    boxCopy = osg.clone(box, "newBox", osg.CopyOp.DEEP_COPY_ALL)

    # Move our copy to make it visible.
    boxCopy.setOrigin(0.0, 125.0)

    boxCopy.getByName("widget1").setColor(0.5, 0.0, 1.0, 1.0)
    boxCopy.getByName("widget3").setColor(0.5, 0.0, 1.0, 1.0)

    # Add the successfully created Box (if we get this far) into the WindowManager, so
    # that they can receive events.
    wm.addChild(box)
    wm.addChild(boxCopy)

    # Now, ask our box to be 100% the width of the WindowManager.
    boxCopy.resizePercent(100.0, 0.0)

    # Here we demonstrate the use of osgWidget/io_utils. This is really only useful for
    # debugging at the moment.
    # print *box, *boxCopy

    # Setup our OSG objects for our scene note the use of the utility function
    # createOrthoCamera, which is just a helper for setting up a proper viewing area.
    # An alternative (and a MUCH easier alternative at that not ) is to
    # simply use the createParentOrthoCamera method of the WindowManager class,
    # which will wrap the calls to createOrthoCamera and addChild for us not  Check out
    # some of the other examples to see this in action...
    group = osg.Group()
    camera = osgWidget.createOrthoCamera(1280.0, 1024.0)
    model = osgDB.readNodeFile("cow.osgt")

    # Add our event handler is this better as a MatrixManipulator? Add a few other
    # helpful ViewerEventHandlers.
    viewer.addEventHandler(osgWidget.MouseHandler(wm))
    viewer.addEventHandler(osgWidget.KeyboardHandler(wm))
    viewer.addEventHandler(osgWidget.ResizeHandler(wm, camera))
    viewer.addEventHandler(osgWidget.CameraSwitchHandler(wm, camera))
    viewer.addEventHandler(osgViewer.StatsHandler())
    viewer.addEventHandler(osgViewer.WindowSizeHandler())
    viewer.addEventHandler(osgGA.StateSetManipulator(
        viewer.getCamera().getOrCreateStateSet()
    ))

    # Set our first non-UI node to be something other than the mask we created our
    # WindowManager with to avoid picking.
    # TODO: Do I need to create a mechanism for doing this automatically, or should
    # that be the responsibility of the users of osgWidget?
    model.setNodeMask(MASK_3D)

    # Add the WindowManager instance to the 2D camera. This isn't strictly necessary,
    # and you can get some cool results putting the WindowManager directly into a
    # 3D scene. This is not necessary if you use WindowManager.createParentOrthoCamera.
    camera.addChild(wm)

    # Add our camera and a testing 3D model to the scene.
    group.addChild(camera)
    group.addChild(model)

    # Here we show how to both run simple strings of code AND run entire files. These
    # assume that you're running the osgwidgetwindow example from the build directory,
    # otherwise you'll need to adjust the file path below in the call to runFile().
    wm.getLuaEngine().eval("window = osgwidget.newWindow()")
    wm.getLuaEngine().runFile("osgWidget/osgwidgetwindow.lua")

    wm.getPythonEngine().eval("import osgwidget")
    wm.getPythonEngine().runFile("osgWidget/osgwidgetwindow.py")

    viewer.setUpViewInWindow(0, 0, 1280, 1024)
    viewer.setSceneData(group)

    #
#    cameras = osgViewer.Viewer.Cameras() 
#    viewer.getCameras(cameras)
#    c = cameras[0]
#    s = osg.Matrix.scale(1.0, -1.0, 1.0)
#    c.setProjectionMatrix(s * c.getProjectionMatrix())
#    

    return viewer.run()
Ejemplo n.º 11
0
def createWidget(name, col, layer):

    
    widget = osgWidget.Widget(name, 200.0, 200.0)
Ejemplo n.º 12
0
    )
    
    canvas.addWidget(
        createWidget("w2", 0.4, osgWidget.Widget.LAYER_MIDDLE),
        200.0,
        0.0
    )

    canvas.addWidget(
        createWidget("w3", 0.6, osgWidget.Widget.LAYER_HIGH),
        400.0,
        0.0
    )

    # Add a child and then resize it relatively to the size of the parent Window.
    relWidget = osgWidget.Widget("relative")

    relWidget.setLayer(osgWidget.Widget.LAYER_LOW, 1)
    relWidget.setCoordinateMode(osgWidget.Widget.CM_RELATIVE)
    relWidget.setSize(0.2, 0.2)
    relWidget.setColor(0.5, 0.5, 0.1, 0.9)

    osgWidget.warn(), canvas.getWidth()

    canvas.addWidget(relWidget, 0.4, 0.4)
    
    relWidget.addOrigin(0.1, 0.1)
    relWidget.addSize(0.2, 0.2)

    canvas.resize()
Ejemplo n.º 13
0
def main(argv):

    viewer = osgViewer.Viewer()

    wm = osgWidget.WindowManager(viewer, 1280.0, 1024.0, MASK_2D,
                                 osgWidget.WindowManager.WM_PICK_DEBUG)

    frame = osgWidget.Frame.createSimpleFrame("frame", 32.0, 32.0, 300.0,
                                              300.0)

    frame2 = osgWidget.Frame.createSimpleFrameFromTheme(
        "frameTheme", osgDB.readImageFile("osgWidget/theme-1.png"), 300.0,
        300.0, osgWidget.Frame.FRAME_ALL)
    frame2.setPosition(300, 100, 0)
    frame2.getBackground().setColor(1.0, 1.0, 1.0, 0.0)

    frame22 = osgWidget.Frame.createSimpleFrameFromTheme(
        "frameTheme", osgDB.readImageFile("osgWidget/theme-2.png"), 300.0,
        300.0, osgWidget.Frame.FRAME_ALL)
    frame22.setPosition(300, 100, 0)
    frame22.getBackground().setColor(1.0, 1.0, 1.0, 0.0)

    frame3 = osgWidget.Frame.createSimpleFrameFromTheme(
        "frameTheme", osgDB.readImageFile("osgWidget/theme-2.png"), 300.0,
        300.0, osgWidget.Frame.FRAME_ALL)
    frame3.setPosition(300, 100, 0)
    frame3.getBackground().setColor(0.0, 0.0, 0.0, 1.0)

    table = osgWidget.Table("table", 2, 2)
    bottom = osgWidget.Box("panel", osgWidget.Box.HORIZONTAL)

    table.addWidget(osgWidget.Widget("red", 300.0, 300.0), 0, 0)
    table.addWidget(osgWidget.Widget("white", 300.0, 300.0), 0, 1)
    table.addWidget(osgWidget.Widget("yellow", 300.0, 300.0), 1, 0)
    table.addWidget(osgWidget.Widget("purple", 300.0, 300.0), 1, 1)
    table.getByRowCol(0, 0).setColor(1.0, 0.0, 0.0, 1.0)
    table.getByRowCol(0, 1).setColor(1.0, 1.0, 1.0, 1.0)
    table.getByRowCol(1, 0).setColor(1.0, 1.0, 0.0, 1.0)
    table.getByRowCol(1, 1).setColor(1.0, 0.0, 1.0, 1.0)
    table.getByRowCol(0, 0).setMinimumSize(100.0, 100.0)
    table.getByRowCol(0, 1).setMinimumSize(100.0, 100.0)
    table.getByRowCol(1, 0).setMinimumSize(100.0, 100.0)
    table.getByRowCol(1, 1).setMinimumSize(100.0, 100.0)

    frame.setWindow(table)

    # Give frame some nice textures.
    # TODO: This has to be done after setWindow() wtf?
    frame.getBackground().setColor(0.0, 0.0, 0.0, 0.0)

    l = frame.getBorder(osgWidget.Frame.BORDER_LEFT)
    r = frame.getBorder(osgWidget.Frame.BORDER_RIGHT)
    t = frame.getBorder(osgWidget.Frame.BORDER_TOP)
    b = frame.getBorder(osgWidget.Frame.BORDER_BOTTOM)

    l.setImage("osgWidget/border-left.tga", True)
    r.setImage("osgWidget/border-right.tga", True)
    t.setImage("osgWidget/border-top.tga", True)
    b.setImage("osgWidget/border-bottom.tga", True)

    l.setTexCoordWrapVertical()
    r.setTexCoordWrapVertical()
    t.setTexCoordWrapHorizontal()
    b.setTexCoordWrapHorizontal()

    # Create the bottom, XArt panel.
    left = osgWidget.Widget("left", 512.0, 256.0)
    center = osgWidget.Widget("center", 256.0, 256.0)
    right = osgWidget.Widget("right", 512.0, 256.0)

    left.setImage("osgWidget/panel-left.tga", True)
    center.setImage("osgWidget/panel-center.tga", True)
    right.setImage("osgWidget/panel-right.tga", True)

    center.setTexCoordWrapHorizontal()

    bottom.addWidget(left)
    bottom.addWidget(center)
    bottom.addWidget(right)
    bottom.getBackground().setColor(0.0, 0.0, 0.0, 0.0)
    bottom.setOrigin(0.0, 1024.0 - 256.0)

    # Add everything to the WindowManager.
    wm.addChild(frame)
    wm.addChild(frame2)
    wm.addChild(frame22)
    wm.addChild(frame3)
    wm.addChild(bottom)

    return osgWidget.createExample(viewer, wm)
Ejemplo n.º 14
0
    _listBox.setOrigin(getWidth(), 74.0)

    addChild(_buttonBox)
    addChild(_labelBox)
    addChild(_listBox)

    resizeAllWindows()

    # Remember, you can't call resizePercent until AFTER the box is parented
    # by a WindowManager how could it possibly resize itself if it doesn't know
    # how large it's viewable area is?
    _buttonBox.resizePercent(100.0)
    _buttonBox.resizeAdd(0.0, 10.0)

osgWidget.Widget* AnimtkViewerGUI._createButton( str name) 
    b = osgWidget.Widget(name, 64.0, 64.0)
    
    if  not b : return 0

    b.setImage(IMAGE_PATH + name + ".png", True)
    b.setEventMask(osgWidget.EVENT_MASK_MOUSE_DRAG)

    bt = ButtonFunctor()
    b.setUpdateCallback(bt)
    
    b.addCallback(osgWidget.Callback(ButtonFunctor.enter, bt, osgWidget.EVENT_MOUSE_ENTER))
    b.addCallback(osgWidget.Callback(ButtonFunctor.leave, bt, osgWidget.EVENT_MOUSE_LEAVE))
    b.addCallback(osgWidget.Callback(AnimtkViewerGUI._buttonPush, this, osgWidget.EVENT_MOUSE_PUSH))
    b.addCallback(osgWidget.Callback(eatDrag, osgWidget.EVENT_MOUSE_DRAG))

    return b