레퍼런스 › 함수 레퍼런스 › UI

UI.condition_layout.layoutIconRows

의존성

호출 방법

UI.condition_layout.layoutIconRows(content, children, width)

의존성 UI.condition_layout.layoutIconRows을(를) 기록한 뒤 그 이름으로 호출하세요. 네임스페이스 호출은 self를 넘기지 않으므로 콜론 호출을 쓰거나 객체를 직접 넘기세요.

하는 일

Lays out the "RM-IconRows" container: an icon on the left, vertically centered beside the rows of fields, and an optional side widget (marked with the side user data) that sits beside the last row when there is room and below the rows when there is not. Positions every child under content.

인수

이름유형하는 일
contenttableFrame the children are positioned in.
childrentableChild widgets: the icon first, then the field rows, and at most one side widget.
widthnumberAvailable width in pixels.

반환값

1numberThe total height used, in pixels; 0 when there is no icon or no row.

버전

기본 제공 도우미는 모든 버전에 등록됩니다. 다른 점은 읽는 게임 API이며, API가 없으면 도우미는 대체 동작을 하거나 이유와 함께 nil을 반환합니다.

게임 API를 직접 읽지 않습니다.

애드온에서 호출하는 방식

의존성

소스

UI/condition_layout.lua, 56번째 줄. 게임에서는 읽기 전용이며, 복제하면 편집 가능한 사본이 생깁니다.

UI.condition_layout.layoutIconRows(content, children, width)
    local icon,side,rows=children[1],nil,{}
    for index=2,#children do
        local child=children[index]
        if child.GetUserData and child:GetUserData('side') then side=child else rows[#rows+1]=child end
    end
    if not icon or #rows==0 then return 0 end
    local iconWidth=icon.frame:GetWidth() or 0
    local left=iconWidth+ICON_ROWS_GAP
    local fieldWidth=math.max(1,width-left)
    local sideWidth=side and math.ceil(side.label and side.label:GetStringWidth() or 0)+30 or 0
    local inline=side~=nil and fieldWidth-sideWidth-ICON_ROWS_GAP>=ICON_ROWS_MINIMUM
    local y,bottom=0,0
    for index,row in ipairs(rows) do
        local rowWidth=fieldWidth
        local last=index==#rows
        if last and inline then rowWidth=fieldWidth-sideWidth-ICON_ROWS_GAP end
        row:SetWidth(math.max(1,rowWidth))
        row.frame:ClearAllPoints();row.frame:SetPoint('TOPLEFT',content,'TOPLEFT',left,-y)
        local height=row.frame:GetHeight() or 0
        if last and side and inline then
            side:SetWidth(sideWidth);side.frame:ClearAllPoints()
            side.frame:SetPoint('BOTTOMLEFT',content,'TOPLEFT',left+rowWidth+ICON_ROWS_GAP,-(y+height))
        end
        bottom=y+height;y=y+height+ICON_ROWS_GAP
    end
    local iconHeight=icon.frame:GetHeight() or 0
    icon.frame:ClearAllPoints();icon.frame:SetPoint('TOPLEFT',content,'TOPLEFT',0,-math.max(0,(bottom-iconHeight)/2))
    local total=math.max(bottom,iconHeight)
    if side and not inline then
        side:SetWidth(math.max(1,math.min(sideWidth,fieldWidth)));side.frame:ClearAllPoints();side.frame:SetPoint('TOPLEFT',content,'TOPLEFT',left,-(total+ICON_ROWS_GAP))
        total=total+ICON_ROWS_GAP+(side.frame:GetHeight() or 0)
    end
    return total

함수 레퍼런스(으)로 돌아가기