Index: /code/branches/tutoriallevel/data/gui/scripts/NotificationLayer.lua
===================================================================
--- /code/branches/tutoriallevel/data/gui/scripts/NotificationLayer.lua	(revision 8369)
+++ /code/branches/tutoriallevel/data/gui/scripts/NotificationLayer.lua	(revision 8370)
@@ -17,6 +17,9 @@
 function P.createQueue(name, size)
     local root = winMgr:getWindow("orxonox/NotificationLayer/Root")
-    local queue = winMgr:createWindow("MenuWidgets/Listbox", "orxonox/NotificationLayer/Root/Queue/" .. name)
-    queue:setProperty("BackgroundColor", "00FFFFFF") -- Set background to be fully transparent.
+    --local queue = winMgr:createWindow("MenuWidgets/Listbox", "orxonox/NotificationLayer/Root/Queue/" .. name)
+    --queue:setProperty("BackgroundColor", "00FFFFFF") -- Set background to be fully transparent.
+    local queue = winMgr:createWindow("MenuWidgets/ScrollablePane", "orxonox/NotificationLayer/Root/Queue/" .. name)
+    queue:setProperty("Alpha", 0.0)
+    --queue:setProperty("FrameEnabled", "false")
     root:addChildWindow(queue)
 
@@ -28,5 +31,8 @@
         ["visible"]   = false,
         ["fontSize"]  = 12,
-        ["fontColor"] = CEGUI.colour(1.0, 1.0, 1.0, 1.0)
+        ["fontColor"] = "#FFFFFFFF",
+        ["items"]     = {},
+        ["first"]     = 1,
+        ["last"]      = 1
     }
     
@@ -54,13 +60,25 @@
         return
     end
-    item = CEGUI.createListboxTextItem(notification)
+
+    local item = winMgr:createWindow("MenuWidgets/StaticText", "orxonox/NotificationLayer/Root/Queue/" .. queueName .. "/" .. queue.last)
+    item:setText(notification)
     P.setItemFontHelper(item, queue, true)
-    local listbox = CEGUI.toListbox(queue.window)
-    -- Add the item to the top of the listbox.
-    if listbox:getItemCount() == 0 then
-        listbox:addItem(item)
-    else
-        listbox:insertItem(item, listbox:getListboxItemFromIndex(0))
-    end
+    -- Add the item to the top of the queue.
+    local itemHeight = P.itemHeightHelper(queue)
+    if queue.last-queue.first > 0 then -- If the queue is not empty move all items down
+        for i=queue.first,queue.last-1 do
+            local item = queue.items[i]
+            item:setYPosition(CEGUI.UDim(0, itemHeight*(queue.last-i)))
+        end
+    end
+    queue.window:addChildWindow(item)
+    item:setSize(CEGUI.UVector2(CEGUI.UDim(1, 0), CEGUI.UDim(0, itemHeight)))
+    item:setPosition(CEGUI.UVector2(CEGUI.UDim(0, 0), CEGUI.UDim(0, 0)))
+    item:setProperty("Alpha", 1.0)
+    item:setProperty("InheritsAlpha", "false")
+    item:setProperty("BackgroundEnabled", "false")
+    item:setProperty("FrameEnabled", "false")
+    queue.items[queue.last] = item
+    queue.last = queue.last+1
 
     -- If the queue has been invisible, set it to visible.
@@ -76,15 +94,17 @@
         return
     end
-    local listbox = CEGUI.toListbox(queue.window)
-    -- Removes the item from the bottom of the listbox.
-    listbox:removeItem(listbox:getListboxItemFromIndex(listbox:getItemCount()-1))
+    local item = queue.items[queue.first]
+    -- Removes the item from the bottom of the queue.
+    queue.window:removeChildWindow(item)
+    winMgr:destroyWindow(item)
+    queue.first = queue.first+1
 
     -- Sets the queue to invisible if there are no more notifications in it.
-    if listbox:getItemCount() == 0 then
+    if queue.last-queue.first == 0 then
         P.setVisible(queue, false)
     end
 end
 
--- Removes a notification at a given index from the queue.
+-- Removes a notification at a given index from the queue. Where the 0th item is the newest and the nth the (n+1)th newest.
 function P.removeNotification(queueName, index)
     local queue = P.queueList[queueName]
@@ -92,10 +112,33 @@
         return
     end
-    local listbox = CEGUI.toListbox(queue.window)
+
+    index = queue.last-tonumber(index)-1
+    --if index == queue.first then -- If we want to remove the oldest notification, we can just use pop.
+    --    P.popNotification(queueName)
+    --    return
+    --end
+
     -- Removes the item.
-    listbox:removeItem(listbox:getListboxItemFromIndex(tonumber(index)))
+    local item = queue.items[index]
+    queue.window:removeChildWindow(item)
+    winMgr:destroyWindow(item)
+    queue.items[index] = nil
+
+    -- Move the items below, up.
+    local itemHeight = P.itemHeightHelper(queue)
+    local moved = false
+    if index > queue.first then -- Move all older notifications up in the list.
+        for i=index-1,-1,queue.first do
+            cout(0, i)
+            item = queue.items[i]
+            item:setYposition(CEGUI.UDim(0, itemHeight*(queue.last-i-1)))
+            queue.items[i+1] = item
+        end
+    end
+    queue.items[queue.first] = nil
+    queue.first = queue.first+1
 
     -- Sets the queue to invisible if there are no more notifications in it.
-    if listbox:getItemCount() == 0 then
+    if queue.last-queue.first == 0 then
         P.setVisible(queue, false)
     end
@@ -108,6 +151,12 @@
         return
     end
-    local listbox = CEGUI.toListbox(queue.window)
-    CEGUI.toListbox(queue.window):resetList()
+    for i=queue.first,queue.last-1 do
+        local item = queue.items[i]
+        queue.window:removeChildWindow(item)
+        winMgr:destroyWindow(item)
+    end
+    queue.items = {}
+    queue.first = 1
+    queue.last = 1
 
     -- Sets the queue to invisible.
@@ -147,6 +196,6 @@
 
 -- Change the font size and font color of all notifications in a queueHeightHelper
--- The parameters are (in order) 'name of the queue', 'font size', 'RGBA of the font color, with values from 0 to 1 each'.
-function P.changeQueueFont(queueName, size, colorRed, colorGreen, colorBlue, colorAlpha)
+-- The parameters are (in order) 'name of the queue', 'font size', 'RGBA of the font color in hex notation'.
+function P.changeQueueFont(queueName, size, color)
     local queue = P.queueList[queueName]
     local queueWindow = queue.window
@@ -154,18 +203,13 @@
         return
     end
-    if colorAlpha == nil then
-        colorAlpha = 1.0
-    end
-
-    local list = CEGUI.toListbox(queueWindow)
-    local num = list:getItemCount()
+
     queue.fontSize = size
     local changeColor = false
-    if colorRed ~= nil and colorGreen ~= nil and colorBlue ~= nil then
-        queue.fontColor:set(colorRed, colorGreen, colorBlue, colorAlpha)
+    if color ~= nil then
+        queue.fontColor = color
         changeColor = true
     end
-    for i=0,num-1 do
-        P.setItemFontHelper(item, queue, changeColor)
+    for i=queue.first,queue.last-1 do
+        P.setItemFontHelper(queue.items[i], queue, changeColor)
     end
 end
@@ -174,5 +218,5 @@
 -- The parameters are (in order) 'the ListboxItem', 'the queue table', 'whether color should be changed as well'
 function P.setItemFontHelper(item, queue, changeColor)
-    local item = tolua.cast(item, "CEGUI::ListboxTextItem")
+    --local item = tolua.cast(item, "CEGUI::ListboxTextItem")
     local fontMgr = CEGUI.FontManager:getSingleton()
     if fontMgr:isFontPresent("BlueHighway-" .. queue.fontSize) then
@@ -183,5 +227,5 @@
     end
     if changeColor then
-        item:setTextColours(queue.fontColor)
+        --item:setProperty("TextColours", "tl:[" .. queue.fontColor .. "] tr:[" .. queue.fontColor .. "] bl:[" .. queue.fontColor .. "] br:[" .. queue.fontColor .. "]")
     end
 end
@@ -544,14 +588,29 @@
 -- Helper function. Returns height a queue needs to have to display 'size' items.
 function P.queueHeightHelper(queue, size)
-    local listbox = CEGUI.toListbox(queue.window)
-    local item = CEGUI.createListboxTextItem("Text")
-    P.setItemFontHelper(item, queue, false)
-    listbox:addItem(item)
-    local singleItemHeight = listbox:getTotalItemsHeight()
-    local lookAndFeel = CEGUI.WidgetLookManager:getSingleton():getWidgetLook(queue.window:getLookNFeel())
-    local formattedArea = lookAndFeel:getNamedArea("ItemRenderingArea"):getArea():getPixelRect(queue.window)
-    local frameHeight = queue.window:getUnclippedPixelRect():getHeight() - formattedArea:getHeight()
-    listbox:removeItem(item)
-    return frameHeight + singleItemHeight*size
+    --local listbox = CEGUI.toListbox(queue.window)
+    --local item = CEGUI.createListboxTextItem("Text")
+    --P.setItemFontHelper(item, queue, false)
+    --listbox:addItem(item)
+    --local singleItemHeight = listbox:getTotalItemsHeight()
+    local singleItemHeight = P.itemHeightHelper(queue)
+    --local lookAndFeel = CEGUI.WidgetLookManager:getSingleton():getWidgetLook(queue.window:getLookNFeel())
+    --local formattedArea = lookAndFeel:getNamedArea("ItemRenderingArea"):getArea():getPixelRect(queue.window)
+    --local frameHeight = queue.window:getUnclippedPixelRect():getHeight() - formattedArea:getHeight()
+    --listbox:removeItem(item)
+    --return frameHeight + singleItemHeight*size
+    return singleItemHeight*size + 1
+end
+
+function P.itemHeightHelper(queue)
+    local item = winMgr:createWindow("MenuWidgets/StaticText", "orxonox/NotificationLayer/Root/Test/")
+    item:setText("text")
+    P.setItemFontHelper(item, queue, true)
+    queue.window:addChildWindow(item)
+    item:setSize(CEGUI.UVector2(CEGUI.UDim(1, 0), CEGUI.UDim(1, 0)))
+    item:setProperty("FrameEnabled", "false")
+    local height = getStaticTextWindowHeight(item)
+    queue.window:removeChildWindow(item)
+    winMgr:destroyWindow(item)
+    return height
 end
 
Index: /code/branches/tutoriallevel/src/modules/notifications/NotificationManager.cc
===================================================================
--- /code/branches/tutoriallevel/src/modules/notifications/NotificationManager.cc	(revision 8369)
+++ /code/branches/tutoriallevel/src/modules/notifications/NotificationManager.cc	(revision 8370)
@@ -419,5 +419,5 @@
 
         NotificationQueue* infoQueue = new NotificationQueue("info", NotificationManager::ALL, 1, -1);
-        GUIManager::getInstance().getLuaState()->doString("NotificationLayer.changeQueueFont(\"info\", 24, 1.0, 1.0, 0.0, 0.8)");
+        GUIManager::getInstance().getLuaState()->doString("NotificationLayer.changeQueueFont(\"info\", 24, \"FFFFFF00\")");
         GUIManager::getInstance().getLuaState()->doString("NotificationLayer.resizeQueue(\"info\", 0.6, 0, " + multi_cast<std::string>(infoQueue->getMaxSize()) + ")");
         GUIManager::getInstance().getLuaState()->doString("NotificationLayer.moveQueue(\"info\", 0.2, 0, 0.8, 0)");
