Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Feb 24, 2018, 1:49:10 AM (7 years ago)
Author:
landauf
Message:

migrated NotificationLayer.lua to cegui 0.8

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/cegui0.8_ogre1.9/data/gui/scripts/NotificationLayer.lua

    r8858 r11802  
    1010function P.onLoad()
    1111    orxonox.NotificationManager:getInstance():loadQueues()
    12     P.sampleWindow = winMgr:createWindow("MenuWidgets/StaticText", "orxonox/NotificationLayer/Root/SampleWindow")
     12    P.sampleWindow = winMgr:createWindow("MenuWidgets/StaticText", "NotificationLayer/Root/SampleWindow")
    1313end
    1414
    1515-- Creates a queue in the GUI.
    1616function P.createQueue(name, size)
    17     local root = winMgr:getWindow("orxonox/NotificationLayer/Root")
    1817    --local queue = winMgr:createWindow("MenuWidgets/Listbox", "orxonox/NotificationLayer/Root/Queue/" .. name)
    1918    --queue:setProperty("BackgroundColor", "00FFFFFF") -- Set background to be fully transparent.
    20     local queue = winMgr:createWindow("MenuWidgets/ScrollablePane", "orxonox/NotificationLayer/Root/Queue/" .. name)
     19    local queue = winMgr:createWindow("MenuWidgets/ScrollablePane", name)
    2120    queue:setProperty("Alpha", 0.0)
    2221    --queue:setProperty("FrameEnabled", "false")
    23     root:addChildWindow(queue)
     22    P.window:addChild(queue)
    2423
    2524    local queueTuple =
     
    3837   
    3938    queue:setPosition(CEGUI.UVector2(CEGUI.UDim(0, 0), CEGUI.UDim(0, 0)))
    40     queue:setSize(CEGUI.UVector2(CEGUI.UDim(1.0, 0), CEGUI.UDim(0, P.queueHeightHelper(queueTuple, size))))
     39    queue:setSize(CEGUI.USize(CEGUI.UDim(1.0, 0), CEGUI.UDim(0, P.queueHeightHelper(queueTuple, size))))
    4140
    4241    P.queueList[name] = queueTuple -- name access
     
    4948
    5049    if queue ~= nil then
    51         queue.window:getParent():removeChildWindow(queue.window)
     50        queue.window:getParent():removeChild(queue.window)
    5251        winMgr:destroyWindow(queue.window)
    5352    end
     
    6665    end
    6766
    68     local item = winMgr:createWindow("MenuWidgets/StaticText", "orxonox/NotificationLayer/Root/Queue/" .. queueName .. "/" .. queue.last)
     67    local item = winMgr:createWindow("MenuWidgets/StaticText", queue.last)
    6968    item:setText(notification)
    7069    P.setItemFontHelper(item, queue, true)
     
    7776        end
    7877    end
    79     queue.window:addChildWindow(item)
    80     item:setSize(CEGUI.UVector2(CEGUI.UDim(1, 0), CEGUI.UDim(0, itemHeight)))
     78    queue.window:addChild(item)
     79    item:setSize(CEGUI.USize(CEGUI.UDim(1, 0), CEGUI.UDim(0, itemHeight)))
    8180    item:setPosition(CEGUI.UVector2(CEGUI.UDim(0, 0), CEGUI.UDim(0, 0)))
    8281    item:setProperty("Alpha", 1.0)
     
    102101    local item = queue.items[queue.first]
    103102    -- Removes the item from the bottom of the queue.
    104     queue.window:removeChildWindow(item)
     103    queue.window:removeChild(item)
    105104    winMgr:destroyWindow(item)
    106105    queue.first = queue.first+1
     
    127126    -- Removes the item.
    128127    local item = queue.items[index]
    129     queue.window:removeChildWindow(item)
     128    queue.window:removeChild(item)
    130129    winMgr:destroyWindow(item)
    131130    queue.items[index] = nil
     
    159158    for i=queue.first,queue.last-1 do
    160159        local item = queue.items[i]
    161         queue.window:removeChildWindow(item)
     160        queue.window:removeChild(item)
    162161        winMgr:destroyWindow(item)
    163162    end
     
    199198        relativeHeight = 0
    200199    end
    201     queueWindow:setSize(CEGUI.UVector2(CEGUI.UDim(relativeWidth, absoluteWidth), CEGUI.UDim(relativeHeight, absoluteHeigth)))
     200    queueWindow:setSize(CEGUI.USize(CEGUI.UDim(relativeWidth, absoluteWidth), CEGUI.UDim(relativeHeight, absoluteHeigth)))
    202201end
    203202
     
    283282
    284283function P.itemHeightHelper(queue)
    285     local item = winMgr:createWindow("MenuWidgets/StaticText", "orxonox/NotificationLayer/Root/Test/")
     284    local item = winMgr:createWindow("MenuWidgets/StaticText", "NotificationLayer/Root/Test/")
    286285    item:setText("text")
    287286    P.setItemFontHelper(item, queue, true)
    288     queue.window:addChildWindow(item)
    289     item:setSize(CEGUI.UVector2(CEGUI.UDim(1, 0), CEGUI.UDim(1, 0)))
     287    queue.window:addChild(item)
     288    item:setSize(CEGUI.USize(CEGUI.UDim(1, 0), CEGUI.UDim(1, 0)))
    290289    item:setProperty("FrameEnabled", "false")
    291290    local height = getStaticTextWindowHeight(item)
    292     queue.window:removeChildWindow(item)
     291    queue.window:removeChild(item)
    293292    winMgr:destroyWindow(item)
    294293    return height
Note: See TracChangeset for help on using the changeset viewer.