Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Sep 3, 2010, 9:17:51 PM (14 years ago)
Author:
dafrick
Message:

Some documenting, cleaning up. Also: Now the NotificationQueue has a height corresponding to its input size.

Location:
code/branches/notifications/data/gui/scripts
Files:
2 edited

Legend:

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

    r7338 r7342  
    99    local root = winMgr:getWindow("orxonox/NotificationLayer/Root")
    1010    local queue = winMgr:createWindow("MenuWidgets/Listbox", "orxonox/NotificationLayer/Root/Queue/" .. name)
     11    root:addChildWindow(queue)
     12
    1113    queue:setPosition(CEGUI.UVector2(CEGUI.UDim(0, 0), CEGUI.UDim(0, 0)))
    12     queue:setSize(CEGUI.UVector2(CEGUI.UDim(1, 0), CEGUI.UDim(0.2, 0)))
    13     root:addChildWindow(queue)
     14    queue:setSize(CEGUI.UVector2(CEGUI.UDim(1.0, 0), CEGUI.UDim(0, P.queueHeightHelper(queue, size))))
     15
    1416    table.insert(P.queueList, queue)
    1517    table.insert(P.nameList, name)
     
    3537
    3638function P.changePosition(name, xPos, yPos)
    37     local queue = P.nameToQueue(name)
     39    local queue = P.nameToQueueHelper(name)
    3840    if queue == nil then
    3941        cout(0, "Queue is nil!")
     
    4446
    4547function P.pushNotification(queueName, notification)
    46     local queue = P.nameToQueue(queueName)
     48    local queue = P.nameToQueueHelper(queueName)
    4749    if queue == nil then
    4850        cout(0, "Queue is nil!")
     
    5961
    6062function P.popNotification(queueName)
    61     local queue = P.nameToQueue(queueName)
     63    local queue = P.nameToQueueHelper(queueName)
    6264    if queue == nil then
    6365        cout(0, "Queue is nil!")
     
    6971
    7072function P.removeNotification(queueName, index)
    71     local queue = P.nameToQueue(queueName)
     73    local queue = P.nameToQueueHelper(queueName)
    7274    if queue == nil then
    7375        cout(0, "Queue is nil!")
     
    7981
    8082function P.clearQueue(name)
    81     local queue = P.nameToQueue(name)
     83    local queue = P.nameToQueueHelper(name)
    8284    if queue == nil then
    8385        cout(0, "Queue is nil!")
     
    8890end
    8991
    90 function P.nameToQueue(name)
     92function P.nameToQueueHelper(name)
    9193    local queue = nil
    9294    for k,v in pairs(P.nameList) do
     
    99101end
    100102
     103function P.queueHeightHelper(queue, size)
     104    local listbox = CEGUI.toListbox(queue)
     105    local item = CEGUI.createListboxTextItem("Text")
     106    listbox:addItem(item)
     107    local singleItemHeight = listbox:getTotalItemsHeight()
     108    local lookAndFeel = CEGUI.WidgetLookManager:getSingleton():getWidgetLook(queue:getLookNFeel())
     109    local formattedArea = lookAndFeel:getNamedArea("ItemRenderingArea"):getArea():getPixelRect(queue)
     110    local frameHeight = queue:getUnclippedPixelRect():getHeight() - formattedArea:getHeight()
     111    listbox:removeItem(item)
     112    return frameHeight + singleItemHeight*size
     113end
     114
    101115return P
    102116
  • code/branches/notifications/data/gui/scripts/SheetManager.lua

    r7341 r7342  
    6969
    7070    -- Count the number of sheets that don't need input till the first that does.
    71     local counter = activeMenuSheets.size
    72     while counter > 0 and activeMenuSheets[counter].bNoInput do
    73         counter = counter - 1
    74     end
     71    local counter = noInputSheetCounter()
    7572    -- Pause game control if this is the first menu to be displayed
    7673    -- HUGE HACK?
     
    182179
    183180    -- Count the number of sheets that don't need input till the first that does.
    184     local counter = activeMenuSheets.size
    185     while counter > 0 and activeMenuSheets[counter].bNoInput do
    186         counter = counter - 1
    187     end
     181    local counter = noInputSheetCounter()
    188182    -- Resume control if the last (non-noInput) menu is hidden
    189183    if counter == 0 then
     
    204198
    205199    -- Count the number of sheets that don't need input till the first that does.
    206     local counter = activeMenuSheets.size
    207     while counter > 0 and activeMenuSheets[counter].bNoInput do
    208         counter = counter - 1
    209     end
     200    local counter = noInputSheetCounter()
    210201
    211202    -- If the first sheet that needs input is the MainMenu.
     
    224215end
    225216
     217function noInputSheetCounter()
     218    -- Count the number of sheets that don't need input till the first that does.
     219    local counter = activeMenuSheets.size
     220    while counter > 0 and activeMenuSheets[counter].bNoInput do
     221        counter = counter - 1
     222    end
     223    return counter
     224end
     225
    226226----------------------
    227227--- Initialisation ---
Note: See TracChangeset for help on using the changeset viewer.