Пример #1
0
TBool CHuiDeckLayout::ChildPos(TInt aOrdinal, TPoint& aPos)
    {
    TBool result(EFalse);
    THuiRealRect rect;
    TInt childRectStatus(THuiLayoutChildRectUpdateNotNeeded);
    childRectStatus = ChildRect(aOrdinal, rect);
    if(childRectStatus != THuiLayoutChildRectNotImplemented)
        {
        result = (childRectStatus & THuiLayoutChildRectPosUpdateNeeded);
        if(result)
            {
            aPos = LocalPointInPixels(rect.iTl);
            }
        }
    return result;
    }
Пример #2
0
EXPORT_C void CHuiLayout::UpdateChildLayout(TInt aIndex, TInt aTransitionTime)
    {
    THuiRealRect rect;
    TSize size;
    TPoint pos;
    TInt ordinal = ChildOrdinal(aIndex);
    CHuiVisual* child = iHuiLayoutPrivateData->iChildren[aIndex];
    TInt flags = child->Flags();

    TInt transitionTime = aTransitionTime;

    if(flags & EHuiVisualFlagManualTransitionTime)
        {
        // override the parent's transition time with our local one.
        transitionTime = TransitionTime();
        }

    // if either flag is missing, call child rect...
    TBool bothManual = (flags & EHuiVisualFlagManualPosition) && (flags & EHuiVisualFlagManualSize);
    if(!bothManual)
        {
        TInt childRectStatus = ChildRect(ordinal, rect);
        if(childRectStatus != THuiLayoutChildRectNotImplemented)
            {
            if(!(flags & EHuiVisualFlagManualPosition) && (childRectStatus & THuiLayoutChildRectPosUpdateNeeded))
                {
                child->SetPos(rect.iTl, transitionTime);
                }
            if(!(flags & EHuiVisualFlagManualSize) && (childRectStatus & THuiLayoutChildRectSizeUpdateNeeded))
                {
                child->SetSize(rect.Size(), transitionTime);
                }
            }
        else
            {
            if(!(flags & EHuiVisualFlagManualPosition) && ChildPos(ordinal, pos))
                {
                child->SetPos(pos, transitionTime);
                }
            if(!(flags & EHuiVisualFlagManualSize) && ChildSize(ordinal, size))
                {
                child->SetSize(size, transitionTime);
                }
            }
        }
    child->ReportLayoutUpdate();
    }
Пример #3
0
TBool CHuiDeckLayout::ChildSize(TInt aOrdinal, TSize& aSize)
    {
    TBool result(EFalse);
    THuiRealRect rect;
    TInt childRectStatus(THuiLayoutChildRectUpdateNotNeeded);
    childRectStatus = ChildRect(aOrdinal, rect);
    if(childRectStatus != THuiLayoutChildRectNotImplemented)
        {
        result = (childRectStatus & THuiLayoutChildRectSizeUpdateNeeded);
        if(result)
            {
            THuiRealPoint size(rect.Width(), rect.Height());
            aSize = LocalPointInPixels(size).AsSize();
            }
        }
    return result;
    }
Пример #4
0
void HorizontalScrollbar::ConstructHorizontalScrollbar(const UI::ScrollbarStyle& ScrollStyle)
{
    // Create the rects we'll use
    UnifiedVec2 ChildPosition(0,0,0,0);
    UnifiedVec2 ChildSize(1,1,0,0);
    UnifiedRect ChildRect(ChildPosition,ChildSize);
    if( UI::SB_NoButtons == ScrollStyle )
    {
        // Create our objects
        this->ScrollBack = ParentScreen->CreateButton(this->Name+".ScrollBack",ChildRect);
        this->ScrollBack->SetHorizontalSizingRules(UI::SR_Fill_Available);
        this->ScrollBack->SetVerticalSizingRules(UI::SR_Unified_Dims);
        this->AddChild(this->ScrollBack,0);

        this->Scroller = ParentScreen->CreateButton(this->Name+".Scroller",ChildRect);
        this->Scroller->SetManualTransformUpdates(true);
        this->AddChild(this->Scroller,1);
    } else {
        //Get the position for all items involved and configure their offsets
        if(UI::SB_Separate == ScrollStyle)
        {
            // Create our objects
            this->UpLeftButton = ParentScreen->CreateButton(this->Name+".LeftButton",ChildRect);
            this->UpLeftButton->SetHorizontalPositioningRules(UI::PF_Anchor_Left);
            this->UpLeftButton->SetHorizontalSizingRules(UI::SR_Match_Other_Axis);
            this->UpLeftButton->SetVerticalSizingRules(UI::SR_Unified_Dims);
            this->AddChild(this->UpLeftButton,0);

            this->ScrollBack = ParentScreen->CreateButton(this->Name+".ScrollBack",ChildRect);
            this->ScrollBack->SetHorizontalSizingRules(UI::SR_Fill_Available);
            this->ScrollBack->SetVerticalSizingRules(UI::SR_Unified_Dims);
            this->AddChild(this->ScrollBack,1);

            this->DownRightButton = ParentScreen->CreateButton(this->Name+".RightButton",ChildRect);
            this->DownRightButton->SetHorizontalPositioningRules(UI::PF_Anchor_Right);
            this->DownRightButton->SetHorizontalSizingRules(UI::SR_Match_Other_Axis);
            this->DownRightButton->SetVerticalSizingRules(UI::SR_Unified_Dims);
            this->AddChild(this->DownRightButton,2);

            this->Scroller = ParentScreen->CreateButton(this->Name+".Scroller",ChildRect);
            this->Scroller->SetManualTransformUpdates(true);
            this->AddChild(this->Scroller,3);
        }
        else if(UI::SB_TogetherDownRight == ScrollStyle)
        {
            // Create our objects
            this->ScrollBack = ParentScreen->CreateButton(this->Name+".ScrollBack",ChildRect);
            this->ScrollBack->SetHorizontalSizingRules(UI::SR_Fill_Available);
            this->ScrollBack->SetVerticalSizingRules(UI::SR_Unified_Dims);
            this->AddChild(this->ScrollBack,0);

            this->UpLeftButton = ParentScreen->CreateButton(this->Name+".LeftButton",UnifiedRect(UnifiedVec2(-1,-1,0,0),ChildSize));
            this->UpLeftButton->SetHorizontalPositioningRules(UI::PF_Anchor_Right | UI::PF_Anchor_SelfSize);
            this->UpLeftButton->SetHorizontalSizingRules(UI::SR_Match_Other_Axis);
            this->UpLeftButton->SetVerticalSizingRules(UI::SR_Unified_Dims);
            this->AddChild(this->UpLeftButton,1);

            this->DownRightButton = ParentScreen->CreateButton(this->Name+".RightButton",ChildRect);
            this->DownRightButton->SetHorizontalPositioningRules(UI::PF_Anchor_Right);
            this->DownRightButton->SetHorizontalSizingRules(UI::SR_Match_Other_Axis);
            this->DownRightButton->SetVerticalSizingRules(UI::SR_Unified_Dims);
            this->AddChild(this->DownRightButton,2);

            this->Scroller = ParentScreen->CreateButton(this->Name+".Scroller",ChildRect);
            this->Scroller->SetManualTransformUpdates(true);
            this->AddChild(this->Scroller,3);
        }
        else if(UI::SB_TogetherUpLeft == ScrollStyle)
        {
            // Create our objects
            this->UpLeftButton = ParentScreen->CreateButton(this->Name+".LeftButton",ChildRect);
            this->UpLeftButton->SetHorizontalPositioningRules(UI::PF_Anchor_Left);
            this->UpLeftButton->SetHorizontalSizingRules(UI::SR_Match_Other_Axis);
            this->UpLeftButton->SetVerticalSizingRules(UI::SR_Unified_Dims);
            this->AddChild(this->UpLeftButton,0);

            this->DownRightButton = ParentScreen->CreateButton(this->Name+".RightButton",UnifiedRect(UnifiedVec2(1,1,0,0),ChildSize));
            this->DownRightButton->SetHorizontalPositioningRules(UI::PF_Anchor_Left | UI::PF_Anchor_SelfSize);
            this->DownRightButton->SetHorizontalSizingRules(UI::SR_Match_Other_Axis);
            this->DownRightButton->SetVerticalSizingRules(UI::SR_Unified_Dims);
            this->AddChild(this->DownRightButton,1);

            this->ScrollBack = ParentScreen->CreateButton(this->Name+".ScrollBack",ChildRect);
            this->ScrollBack->SetHorizontalSizingRules(UI::SR_Fill_Available);
            this->ScrollBack->SetVerticalSizingRules(UI::SR_Unified_Dims);
            this->AddChild(this->ScrollBack,2);

            this->Scroller = ParentScreen->CreateButton(this->Name+".Scroller",ChildRect);
            this->Scroller->SetManualTransformUpdates(true);
            this->AddChild(this->Scroller,3);
        }
    }

    Rect TempDims;
    if( this->ActDims != TempDims ) {
        TempDims = this->ActDims;
        this->UpdateDimensions(TempDims,TempDims);
    }

    this->SubscribeToChildEvents();
}