MCPcopy Create free account
hub / github.com/cinience/RedisStudio / SetFloatPos

Method SetFloatPos

DuiLib/Core/UIContainer.cpp:714–759  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

712 }
713
714 void CContainerUI::SetFloatPos(int iIndex)
715 {
716 // ��ΪCControlUI::SetPos��float�IJ���Ӱ�죬���ﲻ�ܶ�float������ӹ�������Ӱ��
717 if( iIndex < 0 || iIndex >= m_items.GetSize() ) return;
718
719 CControlUI* pControl = static_cast<CControlUI*>(m_items[iIndex]);
720
721 if( !pControl->IsVisible() ) return;
722 if( !pControl->IsFloat() ) return;
723
724 SIZE szXY = pControl->GetFixedXY();
725 SIZE sz = {pControl->GetFixedWidth(), pControl->GetFixedHeight()};
726 RECT rcCtrl = { 0 };
727 if( szXY.cx >= 0 ) {
728 rcCtrl.left = m_rcItem.left + szXY.cx;
729 rcCtrl.right = m_rcItem.left + szXY.cx + sz.cx;
730 }
731 else {
732 rcCtrl.left = m_rcItem.right + szXY.cx - sz.cx;
733 rcCtrl.right = m_rcItem.right + szXY.cx;
734 }
735 if( szXY.cy >= 0 ) {
736 rcCtrl.top = m_rcItem.top + szXY.cy;
737 rcCtrl.bottom = m_rcItem.top + szXY.cy + sz.cy;
738 }
739 else {
740 rcCtrl.top = m_rcItem.bottom + szXY.cy - sz.cy;
741 rcCtrl.bottom = m_rcItem.bottom + szXY.cy;
742 }
743 if( pControl->IsRelativePos() )
744 {
745 TRelativePosUI tRelativePos = pControl->GetRelativePos();
746 SIZE szParent = {m_rcItem.right-m_rcItem.left,m_rcItem.bottom-m_rcItem.top};
747 if(tRelativePos.szParent.cx != 0)
748 {
749 int nIncrementX = szParent.cx-tRelativePos.szParent.cx;
750 int nIncrementY = szParent.cy-tRelativePos.szParent.cy;
751 rcCtrl.left += (nIncrementX*tRelativePos.nMoveXPercent/100);
752 rcCtrl.top += (nIncrementY*tRelativePos.nMoveYPercent/100);
753 rcCtrl.right = rcCtrl.left+sz.cx+(nIncrementX*tRelativePos.nZoomXPercent/100);
754 rcCtrl.bottom = rcCtrl.top+sz.cy+(nIncrementY*tRelativePos.nZoomYPercent/100);
755 }
756 pControl->SetRelativeParentSize(szParent);
757 }
758 pControl->SetPos(rcCtrl);
759 }
760
761 void CContainerUI::ProcessScrollBar(RECT rc, int cxRequired, int cyRequired)
762 {

Callers

nothing calls this directly

Calls 10

IsVisibleMethod · 0.80
IsFloatMethod · 0.80
GetFixedXYMethod · 0.80
GetFixedWidthMethod · 0.80
GetFixedHeightMethod · 0.80
IsRelativePosMethod · 0.80
GetRelativePosMethod · 0.80
SetRelativeParentSizeMethod · 0.80
GetSizeMethod · 0.45
SetPosMethod · 0.45

Tested by

no test coverage detected