class ABCWidget (osgWidget.Label) :
    ABCWidget( str label):
    osgWidget.Label("", label) 
        setFont("fonts/Vera.ttf")
        setFontSize(20)
        setCanFill(True)
        setShadow(0.08)
        addSize(10.0, 10.0)
class Button (osgWidget.Label) :
    Button( str label):
    osgWidget.Label("", label) 
        setFont("fonts/Vera.ttf")
        setFontSize(30)
        setColor(0.8, 0.2, 0.2, 0.8)
        setCanFill(True)
        setShadow(0.1)
        setEventMask(osgWidget.EVENT_MASK_MOUSE_CLICK)
        addSize(20.0, 20.0)
Exemplo n.º 3
0
class ColorLabel (osgWidget.Label) :
ColorLabel( char* label):
    osgWidget.Label("", "") 
        setFont("fonts/Vera.ttf")
        setFontSize(14)
        setFontColor(1.0, 1.0, 1.0, 1.0)
        setColor(0.3, 0.3, 0.3, 1.0)
        addHeight(18.0)
        setCanFill(True)
        setLabel(label)
        setEventMask(osgWidget.EVENT_MOUSE_PUSH | osgWidget.EVENT_MASK_MOUSE_MOVE)
Exemplo n.º 4
0
def createLabel(string, font, size, color):



    
    label = osgWidget.Label("", "")
    label.setFont(font)
    label.setFontSize(size)
    label.setFontColor(color)
    label.setColor(osgWidget.Color(0,0,0,0))
    label.setLabel(string)
    label.setCanFill(True)
    return label
class ColorLabel (osgWidget.Label) :
ColorLabel( char* label):
        osgWidget.Label(label, "") 
        setFont("fonts/VeraMono.ttf")
        setFontSize(14)
        setFontColor(1.0, 1.0, 1.0, 1.0)

        setColor(0.3, 0.3, 0.3, 1.0)
        setPadding(2.0)
        setCanFill(True)

        addSize(150.0, 25.0)

        setLabel(label)
        setEventMask(osgWidget.EVENT_MOUSE_PUSH | osgWidget.EVENT_MASK_MOUSE_MOVE)
Exemplo n.º 6
0
def createLabel(l, size):

    
    label = osgWidget.Label("", "")

    label.setFont("fonts/Vera.ttf")
    label.setFontSize(size)
    label.setFontColor(1.0, 1.0, 1.0, 1.0)
    label.setLabel(l)

    #
#    text.setBackdropType(osgText.Text.DROP_SHADOW_BOTTOM_RIGHT)
#    text.setBackdropImplementation(osgText.Text.NO_DEPTH_BUFFER)
#    text.setBackdropOffset(0.2)
#    

    return label
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"))
Exemplo n.º 8
0
                    _motionOver.update(dt)
                    value = _motionOver.getValue()
                else:
                    _motionLeave.update(dt)
                    value = 1.0 - _motionLeave.getValue()

                c = _defaultColor + ((_overColor - _defaultColor) * value)
                colorSetter = ColorSetterVisitor(c)
                _frame.accept(colorSetter)
        node.traverse(*nv)




osgWidget.Label* MessageBox.createLabel( str string,  str font, int size,  osgWidget.Color color)
    label = osgWidget.Label("", "")
    label.setFont(font)
    label.setFontSize(size)
    label.setFontColor(color)
    label.setColor(osgWidget.Color(0,0,0,0))
    label.setLabel(string)
    label.setCanFill(True)
    return label

osgWidget.Frame* MessageBox.createButtonOk( str theme, 
                                                  str text, 
                                                  str font, 
                                                 int fontSize)
    frame = osgWidget.Frame.createSimpleFrameFromTheme(
        "ButtonOK",
        osgDB.readImageFile(theme),
Exemplo n.º 9
0
class Notebook (osgWidget.Box) :
_tabs = osgWidget.Box()
    _windows = osgWidget.Canvas()
    # NOTE: This whole thing is just a hack to demonstrate a concept. The real
    # implementation would need to be much cleaner.
    def callbackTabPressed(ev):
        
        objs = _windows.getObjects()

        for(unsigned int i = 0 i < objs.size() i++) objs[i].setLayer(
            osgWidget.Widget.LAYER_MIDDLE,
            i * 2
        )

        _windows.getByName(ev.getWidget().getName()).setLayer(
            osgWidget.Widget.LAYER_MIDDLE,
            objs.size() * 2
        )

        _windows.resize()

        return True

    Notebook( str name):
    osgWidget.Box(name, osgWidget.Box.VERTICAL) 
        _tabs    = osgWidget.Box("tabs", osgWidget.Box.HORIZONTAL)
        _windows = osgWidget.Canvas("canvas")

        for(unsigned int i = 0 i < 4 i++) 
            ss = strstream()

            # Setup everything for our Tab...
            ss, "Tab_", i

            label1 = osgWidget.Label(ss.str())

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

            _tabs.addWidget(label1)

            # Setup everything for the Window corresponding to the Tab
            # in the Canvas down below.
            descr = strstream()

            descr, "This is some text", "for the Tab_", i, " tab.", "Press the button up top", "And this should go to the next Window not "
            

            label2 = osgWidget.Label(ss.str())

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

            _windows.addWidget(label2, 0.0, 0.0)

            label1.setEventMask(osgWidget.EVENT_MOUSE_PUSH)
            label1.addCallback(osgWidget.Callback(
                Notebook.callbackTabPressed,
                this,
                osgWidget.EVENT_MOUSE_PUSH
            ))
Exemplo n.º 10
0
            label2.setFontColor(1.0, 1.0, 1.0, 1.0)
            label2.setColor(0.0, i / 4.0, 0.3, 1.0)
            label2.setLabel(descr.str())
            label2.setLayer(osgWidget.Widget.LAYER_MIDDLE, i * 2)
            label2.addSize(50.0, 50.0)

            _windows.addWidget(label2, 0.0, 0.0)

            label1.setEventMask(osgWidget.EVENT_MOUSE_PUSH)
            label1.addCallback(osgWidget.Callback(
                Notebook.callbackTabPressed,
                this,
                osgWidget.EVENT_MOUSE_PUSH
            ))

        label = osgWidget.Label("label")

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


def bound(node):