API:NewModSortData

Aus WARWiki

Keine Beschreibung verfügbar.

Nutzung

API:NewModSortData()


Diese Funktion übernimmt keine Argumente.


Diese Funktion gibt keine Werte zurück.


Source Code

-- This function is used to compare windows for table.sort() on
-- the window list display order.
local function CompareWindows( index1, index2 )

    if( index2 == nil ) then
        return false
    end
    
    local sortType  = LayoutEditor.curSortType
    local order     = LayoutEditor.curSortOrder 
    
    --DEBUG(L"Sorting.. Type="..sortType..L" Order="..order )
    
    local frame1 = LayoutEditor.windowBrowserDataList[ index1 ]
    local frame2 = LayoutEditor.windowBrowserDataList[ index2 ]
    
    -- Sort By Name
    if( sortType == LayoutEditor.WINDOW_SORTBY_NAME ) then
        return StringUtils.SortByString( frame1:GetDisplayName(), frame2:GetDisplayName(), order ) 
    end
    
    -- Sort By Locked
    if( sortType == LayoutEditor.WINDOW_SORTBY_LOCKED ) then
        if( frame1:IsLocked() == frame2:IsLocked() ) then        
            return StringUtils.SortByString( frame1:GetDisplayName(), frame2:GetDisplayName(), LayoutEditor.SORT_ORDER_UP )  
        else            
            if( order == LayoutEditor.SORT_ORDER_UP ) then	
                return ( frame2:IsLocked() )
            else
                return ( frame1:IsLocked() )
            end		
        end
    end
    
    -- Sort By Hidden
    if( sortType == LayoutEditor.WINDOW_SORTBY_HIDDEN ) then
        if( frame1:IsHidden() == frame2:IsHidden()  ) then       
            
            -- If the the frames do not allow hiding, sort by that seperately
            if( frame1:AllowHiding() == frame2:AllowHiding() )
            then          
                 return StringUtils.SortByString( frame1:GetDisplayName(), frame2:GetDisplayName(), LayoutEditor.SORT_ORDER_UP )  
            else
                if( order == LayoutEditor.SORT_ORDER_UP ) 
                then	
                    return ( frame2:AllowHiding() )
                else
                    return ( frame1:AllowHiding() )
                end	            
            end
        else            
            if( order == LayoutEditor.SORT_ORDER_UP ) 
            then	
                return ( frame2:IsHidden() )
            else
                return ( frame1:IsHidden() )
            end		
        end
    end
end


Persönliche Werkzeuge
Anzeige

Sponsoren