Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Sep 4, 2010, 5:56:35 PM (14 years ago)
Author:
dafrick
Message:

NotificationQueue now disappears if there are no notifications to be displayed. Also: "Fixed" Seg-fault.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/notifications/data/gui/scripts/NotificationLayer.lua

    r7349 r7351  
    55P.queueList = {}
    66P.nameList = {}
     7P.visible = nil
    78
    89function P.createQueue(name, size)
    910    local root = winMgr:getWindow("orxonox/NotificationLayer/Root")
    1011    local queue = winMgr:createWindow("MenuWidgets/Listbox", "orxonox/NotificationLayer/Root/Queue/" .. name)
    11     queue:setProperty("BackgroundColor", "00FFFFFF")
     12    queue:setProperty("BackgroundColor", "66FFFFFF")
    1213    root:addChildWindow(queue)
    1314
    1415    queue:setPosition(CEGUI.UVector2(CEGUI.UDim(0, 0), CEGUI.UDim(0, 0)))
    1516    queue:setSize(CEGUI.UVector2(CEGUI.UDim(1.0, 0), CEGUI.UDim(0, P.queueHeightHelper(queue, size))))
     17
     18    P.setVisible(queue, false)
    1619
    1720    table.insert(P.queueList, queue)
     
    5053        listbox:insertItem(item, listbox:getListboxItemFromIndex(0))
    5154    end
     55
     56    if P.visible == false then
     57        P.setVisible(queue, true)
     58    end
    5259end
    5360
     
    6067    local listbox = CEGUI.toListbox(queue)
    6168    listbox:removeItem(listbox:getListboxItemFromIndex(listbox:getItemCount()-1))
     69
     70    if listbox:getItemCount() == 0 then
     71        P.setVisible(queue, false)
     72    end
    6273end
    6374
     
    7081    local listbox = CEGUI.toListbox(queue)
    7182    listbox:removeItem(listbox:getListboxItemFromIndex(tonumber(index)))
     83
     84    if listbox:getItemCount() == 0 then
     85        P.setVisible(queue, false)
     86    end
    7287end
    7388
     
    8095    local listbox = CEGUI.toListbox(queue)
    8196    CEGUI.toListbox(queue):resetList()
     97
     98    P.setVisible(queue, false)
    8299end
    83100
     
    99116    end
    100117    queue:setHeight(CEGUI.UDim(0, P.queueHeightHelper(queue, size)))
     118end
     119
     120function P.setVisible(queue, visible)
     121    queue:setVisible(visible)
     122    P.visible = visible
    101123end
    102124
Note: See TracChangeset for help on using the changeset viewer.