Skip to content

Commit

Permalink
Merge pull request #30 from wuwao1/master
Browse files Browse the repository at this point in the history
fix CListUI::GetClientPos()
  • Loading branch information
fawdlstty authored Apr 13, 2024
2 parents bbee33e + a72ddc6 commit e97a930
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 1 deletion.
2 changes: 1 addition & 1 deletion DuiLib/Control/UILabel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ namespace DuiLib {
m_szAvailableLast = szAvailable;
m_cxyFixedLast = m_cxyFixed;
if (sText.empty())
return { 0,0 };
return { m_cxyFixed.cx , m_cxyFixed.cy };
// 自动计算宽度
if ((m_uTextStyle & DT_SINGLELINE) != 0) {
// 高度
Expand Down
25 changes: 25 additions & 0 deletions DuiLib/Control/UIList.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -390,6 +390,31 @@ namespace DuiLib {
Invalidate ();
}

RECT CListUI::GetClientPos() const
{
RECT rc = m_rcItem;
rc.left += m_rcInset.left;
rc.top += m_rcInset.top;
rc.right -= m_rcInset.right;
rc.bottom -= m_rcInset.bottom;

if (GetVerticalScrollBar() && GetVerticalScrollBar()->IsVisible()) {
auto m_pVerticalScrollBar = GetVerticalScrollBar();
rc.top -= m_pVerticalScrollBar->GetScrollPos();
rc.bottom -= m_pVerticalScrollBar->GetScrollPos();
rc.bottom += m_pVerticalScrollBar->GetScrollRange();
rc.right -= m_pVerticalScrollBar->GetFixedWidth();
}
if (GetHorizontalScrollBar() && GetHorizontalScrollBar()->IsVisible()) {
auto m_pHorizontalScrollBar = GetVerticalScrollBar();
rc.left -= m_pHorizontalScrollBar->GetScrollPos();
rc.right -= m_pHorizontalScrollBar->GetScrollPos();
rc.right += m_pHorizontalScrollBar->GetScrollRange();
rc.bottom -= m_pHorizontalScrollBar->GetFixedHeight();
}
return rc;
}

CListHeaderUI* CListUI::GetHeader () const {
return m_pHeader;
}
Expand Down
1 change: 1 addition & 0 deletions DuiLib/Control/UIList.h
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ namespace DuiLib {

bool IsFixedScrollbar ();
void SetFixedScrollbar (bool bFixed);
RECT GetClientPos() const override;

CListHeaderUI* GetHeader () const;
CContainerUI* GetList () const;
Expand Down

0 comments on commit e97a930

Please sign in to comment.