Пример #1
0
void CDxMonthPicker::AdjustLayout(CRect rcClient)
{
    m_dtToday = COleDateTime::GetCurrentTime();

    m_rcControl = rcClient;

    CSize szMonth(0, 0);
    CRect rcMonth(0, 0, 0, 0);

    //get button size
    CSize szButton(CalcButtonSize());

    m_rcGrid.CopyRect(&m_rcControl);

    //COLORREF m_clrStaticBorder = RGB(255,255,0);
    //dc.Draw3dRect(0, 0, m_rcGrid.Width(), m_rcGrid.Height(), m_clrStaticBorder, m_clrStaticBorder);

    m_rcGrid.bottom -= (szButton.cy + 2);

    szMonth.cx = m_rcGrid.Width();
    szMonth.cy = m_rcGrid.Height();

    CalcButtonBandRect();

    int nIndex = 0;
    rcMonth = CRect(CPoint(m_rcGrid.left, m_rcGrid.top), szMonth);
    rcMonth.DeflateRect(1, 1);
    // adjust internal month layout
    m_monthPicker->AdjustLayout(rcMonth);
}
Пример #2
0
void MainWindow::initWidgets() {
	setCentralWidget(new QWidget(this));

	QSize szButton(96, 32);
	pbLoadFile->setFixedSize(szButton);
	pbLoadLog->setFixedSize(szButton);
	pbLoadMap->setFixedSize(szButton);
	pbSaveMap->setFixedSize(szButton);
	pbDumpLog->setFixedSize(szButton);
	pbRun->setFixedSize(szButton);
	pbCancel->setFixedSize(szButton);
	pbSave->setFixedSize(szButton);
}
Пример #3
0
void PortViewer::initWigets() {
	QSize szButton(92, 24);
	pbSelect->setFixedSize(szButton);
	cbPorts->setFixedSize(szButton);

	int szLabel(128);
	lbManf->setFixedWidth(szLabel);
	lbDesc->setFixedWidth(szLabel);
	lbBusy->setFixedWidth(szLabel);

	lbManfLb->setAlignment(Qt::AlignRight);
	lbDescLb->setAlignment(Qt::AlignRight);
	lbBusyLb->setAlignment(Qt::AlignRight);
}
Пример #4
0
void CDxMonthPicker::SetButtonRect()
{
    CSize szButton(CalcButtonSize());

    int nGap = 10;

    int nButtonLen = szButton.cx + nGap;
    int nVisibleCount = 1;

    int nLeft = m_rcGrid.CenterPoint().x - (nButtonLen * nVisibleCount - nGap)/2;

    m_btnToday->m_rcButton = CRect(CPoint(nLeft, m_rcGrid.bottom + 1), szButton);
    nLeft += nButtonLen;
}
Пример #5
0
CSize CDxMonthPicker::CalcButtonSize() const
{
    // get button size
    CWindowDC dc(GetDesktopWindow());

    HFONT hFontOld = (HFONT)dc.SelectFont(CDxFontManager::GetSingleton().GetFont(DUIF_DEFAULTFONT));

    CSize szButton(0, 0);

    if (m_btnToday != NULL)
    {
        CSize sz;
        CString strText = m_btnToday->GetCaption();

        dc.GetTextExtent(strText, strText.GetLength(), &sz);

        szButton.cx = max(szButton.cx, sz.cx + 12);
        szButton.cy = max(szButton.cy, sz.cy + 6);
    }

    dc.SelectFont(hFontOld);

    return szButton;
}
Пример #6
0
bool
ESEnumerableModifyWnd::CreateChildControls(){
	_Rect rcClient;
	GetClientRectMy(rcClient);

	m_info.m_bgFillMode.SetCurrentValue(_FillMode::FillMode_Color);
	m_info.m_crFill	= RGB(255, 255, 255);

	_Rect rcList;
	rcList.left		= rcClient.left;
	rcList.top		= rcClient.top;
	rcList.right	= rcClient.right;
	rcList.bottom	= rcClient.bottom - 50;

	ESChildControlList *pList = new ESChildControlList();
	if( !AddChildControl(pList, 1000, rcList, NULL) ){
		delete pList;
		}
	else{
		m_pList = pList;
		pList->AddEventListener	(this, ChildControlEventCode::EventCode_ListRowChange, (ControlEventListener)&ESEnumerableModifyWnd::OnListRowChange);
		pList->SetBorder		(FALSE);
		pList->AllowColumnSort	(false);
		pList->SetFixedPosition	(_Rect(0, 0, 0, 50));
		}
	// }}

	_Size szButton(100, 34);

	_Rect rcAddImageButton;
	rcAddImageButton.left	= 5;
	rcAddImageButton.top	= rcList.bottom + 5;
	rcAddImageButton.right	= rcAddImageButton.left + szButton.cx;
	rcAddImageButton.bottom = rcAddImageButton.top + szButton.cy;

	ESChildControlImageButton *pAddButton = new ESChildControlImageButton();
	if( !AddChildControl(pAddButton, 1001, rcAddImageButton, NULL) ){
		delete pAddButton;
		}
	else{
		m_pAddButton = pAddButton;
		pAddButton->AddEventListener	(this, ChildControlEventCode::EventCode_ImageButtonClick, (ControlEventListener)&ESEnumerableModifyWnd::OnAdd);
		pAddButton->SetFixedPosition	(_Rect(rcAddImageButton.left, -1, -1, (rcClient.bottom - rcAddImageButton.bottom)));
		pAddButton->SetText				(_T("Add"));
		}

	_Rect rcDeleteImageButton;
	rcDeleteImageButton.left	= rcAddImageButton.right + 5;
	rcDeleteImageButton.top		= rcList.bottom + 5;
	rcDeleteImageButton.right	= rcDeleteImageButton.left + szButton.cx;
	rcDeleteImageButton.bottom	= rcDeleteImageButton.top + szButton.cy;

	ESChildControlImageButton *pDelButton = new ESChildControlImageButton();
	if( !AddChildControl(pDelButton, 1002, rcDeleteImageButton, NULL) ){
		delete pDelButton;
		}
	else{
		m_pDeleteButton = pDelButton;
		pDelButton->AddEventListener	(this, ChildControlEventCode::EventCode_ImageButtonClick, (ControlEventListener)&ESEnumerableModifyWnd::OnDelete);
		pDelButton->SetFixedPosition	(_Rect(rcDeleteImageButton.left, -1, -1, (rcClient.bottom - rcDeleteImageButton.bottom)));
		pDelButton->DisableButton		(false);
		pDelButton->SetText				(_T("Delete"));
		}

	_Rect rcMoveUpImageButton;
	rcMoveUpImageButton.left	= rcDeleteImageButton.right + 5;
	rcMoveUpImageButton.top		= rcList.bottom + 5;
	rcMoveUpImageButton.right	= rcMoveUpImageButton.left + szButton.cx;
	rcMoveUpImageButton.bottom	= rcMoveUpImageButton.top + szButton.cy;

	ESChildControlImageButton *pMoveUpButton = new ESChildControlImageButton();
	if( !AddChildControl(pMoveUpButton, 1003, rcMoveUpImageButton, NULL) ){
		delete pMoveUpButton;
		}
	else{
		m_pMoveUpButton	= pMoveUpButton;
		pMoveUpButton->AddEventListener	(this, ChildControlEventCode::EventCode_ImageButtonClick, (ControlEventListener)&ESEnumerableModifyWnd::OnMoveUp);
		pMoveUpButton->SetFixedPosition	(_Rect(rcMoveUpImageButton.left, -1, -1, (rcClient.bottom - rcMoveUpImageButton.bottom)));
		pMoveUpButton->DisableButton	(false);
		pMoveUpButton->SetText			(_T("Move Up"));
		}

	_Rect rcMoveDownImageButton;
	rcMoveDownImageButton.left		= rcMoveUpImageButton.right + 5;
	rcMoveDownImageButton.top		= rcList.bottom + 5;
	rcMoveDownImageButton.right		= rcMoveDownImageButton.left + szButton.cx;
	rcMoveDownImageButton.bottom	= rcMoveDownImageButton.top + szButton.cy;

	ESChildControlImageButton *pMoveDownButton = new ESChildControlImageButton();
	if( !AddChildControl(pMoveDownButton, 1004, rcMoveDownImageButton, NULL) ){
		delete pMoveDownButton;
		}
	else{
		m_pMoveDownButton			= pMoveDownButton;
		pMoveDownButton->AddEventListener	(this, ChildControlEventCode::EventCode_ImageButtonClick, (ControlEventListener)&ESEnumerableModifyWnd::OnMoveDown);
		pMoveDownButton->SetFixedPosition	(_Rect(rcMoveDownImageButton.left, -1, -1, (rcClient.bottom - rcMoveDownImageButton.bottom)));
		pMoveDownButton->SetText			(_T("Move Down"));
		pMoveDownButton->DisableButton		(false);
		}
	return true;
	}
Пример #7
0
void CXTPTaskPanelGroup::OnCalcClientHeight(CDC* pDC, CRect rc)
{
	CXTPTaskPanelPaintManager* pPaintManager = GetPaintManager();
	CRect rcMarginsOuter = pPaintManager->GetGroupOuterMargins(this);
	CRect rcMarginsInner = pPaintManager->GetGroupInnerMargins(this);

	rc.DeflateRect(rcMarginsOuter);
	CRect rcItems(rc);

	rcItems.DeflateRect(rcMarginsInner);
	m_nItemsInRow = 1;
	int nItemCount = GetItemCount();

	if (GetItemLayout() == xtpTaskItemLayoutImages)
	{
		CSize szIcon = GetItemIconSize();
		CRect rcInnerMargins(pPaintManager->m_rcImageLayoutIconPadding);
		CSize szButton(szIcon.cx + rcInnerMargins.right + rcInnerMargins.left,
			szIcon.cy + rcInnerMargins.top + rcInnerMargins.bottom);

		int nRowIcons = max(1, rcItems.Width() / szButton.cx), x = 0, y = 0;
		BOOL bWrap = FALSE;

		for (int i = 0; i < nItemCount; i++)
		{
			CXTPTaskPanelGroupItem* pItem = GetAt(i);

			if (!pItem->IsVisible())
				continue;

			if (bWrap)
			{
				x = 0;
				y++;
				bWrap = FALSE;
			}

			CRect rcItem(CPoint(rcItems.left + x * szButton.cx, rcItems.top + y * szButton.cy), szButton);
			pItem->OnReposition(rcItem);

			if (++x == nRowIcons)
				bWrap = TRUE;
		}
		rcItems.bottom = rcItems.top + rcMarginsInner.bottom + szButton.cy * (y + 1);
		m_nItemsInRow = nRowIcons;

		SetOffsetItem(m_nScrollOffset);
	}
	else
	{
		BOOL bMultiColumn = m_pPanel->IsMultiColumn();
		int nRowHeight = 0;
		CRect rcItemOuterMargins(0, 0, 0, 0);
		int nColumnWidth = m_pPanel->GetColumnWidth();
		ASSERT(nColumnWidth > 0);
		int x = 0;
		BOOL bWrap = FALSE;

		int nRowIcons = max(1, rcItems.Width() / nColumnWidth);

		for (int i = 0; i < nItemCount; i++)
		{
			CXTPTaskPanelGroupItem* pItem = GetAt(i);

			if (!pItem->IsVisible())
				continue;

			if (bMultiColumn)
			{
				if (bWrap)
				{
					rcItems.top += nRowHeight;

					nRowHeight = 0;
					x = 0;
					bWrap = FALSE;
				}

				CRect rcItem = pItem->OnReposition(CRect(rcItems.left + x * nColumnWidth, rcItems.top, rcItems.left + (x + 1) * nColumnWidth, rcItems.bottom));


				rcItemOuterMargins = pPaintManager->GetItemOuterMargins(pItem);

				nRowHeight = max(nRowHeight, rcItem.Height() + rcItemOuterMargins.bottom);

				if (++x == nRowIcons)
					bWrap = TRUE;
			}
			else
			{
				CRect rcItem = pItem->OnReposition(rcItems);
				rcItems.top = rcItem.bottom + pPaintManager->GetItemOuterMargins(pItem).bottom;
			}
		}
		if (bMultiColumn)
		{
			rcItems.top += nRowHeight;
			m_nItemsInRow = nRowIcons;
		}
		rcItems.bottom = rcItems.top + rcMarginsInner.bottom;
	}

	int nMinClientHeight = GetMinimumClientHeight();
	if (rcItems.bottom - rc.top < nMinClientHeight)
		rcItems.bottom = rc.top + nMinClientHeight;

	m_nExpandedClientHeight = rcItems.bottom - rc.top;

	m_nCaptionHeight = pPaintManager->DrawGroupCaption(pDC, this, FALSE);
}