コード例 #1
0
ファイル: UIButtonGroup.cpp プロジェクト: chenhbzl/OriginApp
HRESULT UIButtonGroup::Draw(DK_IMAGE drawingImg)
{
    if (!m_bIsVisible)
        return S_OK;
    
    HRESULT hr(S_OK);
    DK_IMAGE imgSelf;
    int left = m_iLeft, top = m_iTop, right = m_iLeft + m_iWidth, bottom = m_iTop + m_iHeight;
    DK_RECT rcSelf={left, top, right, bottom};
    RTN_HR_IF_FAILED(CropImage(
        drawingImg,
        rcSelf,
        &imgSelf
        ));
    CTpGraphics grf(imgSelf);
    ValidChildBtnShown();
    int iSize = GetChildrenCount();
    for (int i = 0; i < iSize; i++)
    {
        UIWindow* pWin = GetChildByIndex(i);
        if (pWin && pWin->IsVisible())
        {
            DebugPrintf(DLC_GUI_VERBOSE,
                    "%s: Drawing Child %d / %d : %s, (%d, %d)-(%d, %d), %s ...",
                    GetClassName(), i, iSize, pWin->GetClassName(),
                    pWin->GetX(), pWin->GetY(),
                    pWin->GetWidth(), pWin->GetHeight(),
                    pWin->GetText());
            hr = pWin->Draw(imgSelf);
            if (!SUCCEEDED(hr))
            {
                DebugPrintf(DLC_GUI_VERBOSE, "Draw child failed");
            }
        }
        else
        {
            DebugPrintf(DLC_ERROR, "%s: FAILED to get child %d/%d !!!", GetClassName(), i, iSize);
        }
    }

    if (m_btnsDirection == BGD_Horizontal)
    {
        DrawTopLine(grf);
        DrawBottomLine(grf);
    }
    DrawSplitLine(grf);

    if (m_currentFocusedIndex >= 0 && (unsigned int)m_currentFocusedIndex < GetChildrenCount())
    {
        DrawFocusedSymbol(imgSelf);
    }

    return hr;
}
コード例 #2
0
void UIBookStoreBookCommentDetailedPage::UpdatePageView()
{
    const int itemHeight = GetWindowMetrics(UIBookStoreBookCommentReplyItemHeightIndex);
    const int horizontalMargin = GetWindowMetrics(UIHorizonMarginIndex);
    for (vector<VIEW_ATTRIBUTE>::iterator itr = m_layoutIndex[m_curPage].viewList.begin(); itr != m_layoutIndex[m_curPage].viewList.end(); itr++)
    {
        UIWindow *pView = (*itr).pView;
        pView->SetVisible((*itr).isEnable);
        pView->MoveWindow((*itr).left, (*itr).top, (*itr).width, (*itr).height);
        if (pView->IsVisible() && ((*itr).listboxStartIndex || (*itr).listboxEndIndex))
        {
            UIBookStoreBookCommentReplyItem *pItem = NULL;
            int topOffset = 0;
            int i = 0;
            for (i = (*itr).listboxStartIndex; i < (*itr).listboxEndIndex; i++)
            {
                if ((i - (*itr).listboxStartIndex) == (int)m_replyList.GetChildrenCount())
                {
                    pItem = new UIBookStoreBookCommentReplyItem();
                    if(pItem)
                    {
                        m_replyList.AddItem(pItem);
                    }
                }
                else
                {
                    pItem = (UIBookStoreBookCommentReplyItem *)m_replyList.GetChildByIndex(i - (*itr).listboxStartIndex);
                }
                if (pItem)
                {
                    dk::bookstore::model::CommentReplySPtr objectItem = m_bookComment->GetReplyList()[i];
                    pItem->SetVisible(TRUE);
                    pItem->MoveWindow(0, topOffset, m_iWidth - (horizontalMargin << 1), itemHeight);
                    pItem->SetInfoSPtr(objectItem);
                    topOffset += itemHeight;
                }
            }
            for(i = i - (*itr).listboxStartIndex;i < (int)m_replyList.GetChildrenCount();i++)
            {
                pItem = (UIBookStoreBookCommentReplyItem *)m_replyList.GetChildByIndex(i);
                if(pItem)
                {
                    pItem->SetVisible(FALSE);
                }
                else
                {
                    break;
                }
            }

        }
    }
    if (m_commentContent.IsVisible())
    {
        m_commentContent.SetDrawPageNo(m_curPage);
    }
    Layout();
    UpdatePageNumber();
    m_replyList.ResetVisibleItemNum();
#ifndef KINDLE_FOR_TOUCH
    m_usefulButton.SetFocus(true);
#endif
}