Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Docking Pane
  New Posts New Posts RSS Feed - Is this implementation correct?
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Is this implementation correct?

 Post Reply Post Reply
Author
Message
Michl View Drop Down
Senior Member
Senior Member


Joined: 14 September 2007
Status: Offline
Points: 138
Post Options Post Options   Thanks (0) Thanks(0)   Quote Michl Quote  Post ReplyReply Direct Link To This Post Topic: Is this implementation correct?
    Posted: 05 February 2014 at 9:09am
Hello guys

I'm implements a own header style for a tabbed container.

If the control paints itself, the overrideable method is calling:

CRect CXTPTabPaintManagerTheme::FillTabControl(CXTPTabManager* /*pTabManager*/, CDC* /*pDC*/, CRect /*rcControl*/)


There I apply the code from various existing themes:

    CRect rcHeader = GetHeaderRect(rcControl, pTabManager);
    GetColorSet()->FillHeader(pDC, rcHeader, pTabManager);


I wondering why my line at bottom is never displayed. The reason is, that the result height of GetHeaderRect is 22 pixels, but bevor painting/drawing codejock selects a clip box of 21 pixels.

In my opinion the header area should be fully visible if rcHeader indicates this.



Further information of debbuging results:

I found that the clip box will be calculated from top until the beginning of the client area of the pane. The top position of client area will be calculated in:


CRect CXTPTabPaintManagerTheme::GetClientRect(CRect rcControl, CXTPTabManager* pTabManager)
{
    if (!m_pPaintManager->m_bShowTabs)
        return rcControl;

    CRect rcClient(rcControl);
    CRect rcHeader = GetHeaderRect(rcControl, pTabManager);

    switch (pTabManager->GetPosition())
    {
        case xtpTabPositionTop: rcClient.top = rcHeader.bottom - 1; break;
        case xtpTabPositionLeft: rcClient.left = rcHeader.right - 1; break;
        case xtpTabPositionBottom: rcClient.bottom = rcHeader.top + 1; break;
        case xtpTabPositionRight: rcClient.right = rcHeader.left + 1; break;
    }
    return rcClient;
}


Here i'm disagree your logic. Why does the client area starts at rcHeader.bottom - 1???
So client and header is overlapped.
It should be

    switch (pTabManager->GetPosition())
    {
        case xtpTabPositionTop: rcClient.top = rcHeader.bottom + 1; break;
        case xtpTabPositionLeft: rcClient.left = rcHeader.right + 1; break;
        case xtpTabPositionBottom: rcClient.bottom = rcHeader.top - 1; break;
        case xtpTabPositionRight: rcClient.right = rcHeader.left - 1; break;
    }


I correct this overlapp by adding 2 margin pixels at top which will be added in:

void CXTPTabPaintManagerTheme::AdjustClientRect(CXTPTabManager* pTabManager, CRect& rcClient)
{
    DeflateRectEx(rcClient, m_pPaintManager->m_rcControlMargin, pTabManager->GetPosition());
    rcClient = GetClientRect(rcClient, pTabManager);

    DeflateRectEx(rcClient, GetClientMargin(), pTabManager->GetPosition());

    if (m_pPaintManager->m_clientFrame == xtpTabFrameBorder)
    {
        DeflateRectEx(rcClient, CRect(2, 2, 2, 2), pTabManager->GetPosition());
    }
    if (m_pPaintManager->m_clientFrame == xtpTabFrameSingleLine)
    {
        DeflateRectEx(rcClient, CRect(0, 2, 0, 0), pTabManager->GetPosition());
    }
}


Is this a bug or "by design"?

Thanks
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.156 seconds.