Пример #1
0
    DialogData(HWND hwnd, const DialogSizerSizingItem* psd, bool bShowSizingGrip)
        : hwnd(hwnd), bMaximised(false), bShowSizingGrip(bShowSizingGrip) {
        // Given an array of dialog item structures determine how many of them there
        // are by scanning along them until we reach the last.
        nItemCount = 0;
        for (const DialogSizerSizingItem* psi = psd; psi->uSizeInfo != 0xFFFFFFFF; psi++)
            nItemCount++;

        // Copy all of the user controls etc. for later, this way the user can quite happily
        // let the structure go out of scope.
        this->psd = (DialogSizerSizingItem*)memdup((void*)psd, nItemCount * sizeof(DialogSizerSizingItem));
        if (!this->psd)
            nItemCount = 0;

        // Store some sizes etc. for later.
        WindowRect rectWnd(hwnd);
        ptSmallest.x = rectWnd.dx;
        ptSmallest.y = rectWnd.dy;

        ClientRect rectClient(hwnd);
        sizeClient = rectClient.Size();
        UpdateGripperRect();

        // Because we have successfully created our data we need to subclass the control now, if not
        // we could end up in a situation where our data was never freed.
        SetProp(hwnd, DIALOG_DATA_PROPERTY, (HANDLE)this);
        wndProc = (WNDPROC)SetWindowLongPtr(hwnd, GWLP_WNDPROC, (LONG_PTR)SizingProc);
    }
Пример #2
0
void CDlgForEach::OnBnClickedButtonAdd()
{
	// TODO: 在此添加控件通知处理程序代码
	int i = m_vpComboBox.size();
	CBCGPComboBox* pBox = new CBCGPComboBox();
	CRect rect(0, i * COMBO_HEIGHT, COMBO_WIDTH, i * COMBO_HEIGHT + COMBO_HEIGHT);
	pBox->Create(WS_VISIBLE | CBS_DROPDOWNLIST, rect, &m_dlgForEachList, IDC_COMBO_ID);
// 	pBox->AddString("fsd");
// 	pBox->AddString("fsssd");

	ZTreeParamSet& wndGrid = ((CDlgFor*)GetParent())->m_wndGridTree;
	for(int i = 0; i < (int)wndGrid.m_vParams.size(); i++)
	{
		ZTreeParam* pParam = wndGrid.m_vParams[i];
		if((pParam->m_strType == "Int" || pParam->m_strType == "Double") && (pParam->m_strDirection == "In" || pParam->m_strDirection == "InOut"))
		{
			AddStringToComboBox(pBox, pParam->m_strName.c_str());
		}
	}

	pBox->SetFont(GetFont());
	m_vpComboBox.push_back(pBox);
	m_dlgForEachList.EnableVisualManagerStyle(TRUE);
	CheckButtonCanEnable();

	CRect rectWnd(0, 0, COMBO_WIDTH, (i + 1) * COMBO_HEIGHT);
	m_dlgForEachList.MoveWindow(rectWnd);

	m_dlgForEachListFrame.RefreshScrollBar();
	
}
/*---------------------------------------------------------------------*//**
	作成
**//*---------------------------------------------------------------------*/
bool GameActMsgWindow::create(Font* fontRef, Texture* texRef)
{
	RectF32 rectWnd(X_THIS, Y_THIS, W_THIS, H_THIS);
	RectF32 rectScreen(0, 0, Game::getGame()->getLogicalWidth(), Game::getGame()->getLogicalHeight());
	return ActionMsgWindow::create(
		&rectWnd,
		&rectScreen,
		fontRef,
		texRef );
}
Пример #4
0
void CScrollWnd::ResizeParentToFit(BOOL bShrinkOnly)
{
	// adjust parent rect so client rect is appropriate size
	ASSERT(m_nMapMode != MM_NONE);  // mapping mode must be known
	
	// determine current size of the client area as if no scrollbars present
	CRect rectClient;
	GetWindowRect(rectClient);
	CRect rect = rectClient;
	CalcWindowRect(rect);
	rectClient.left += rectClient.left - rect.left;
	rectClient.top += rectClient.top - rect.top;
	rectClient.right -= rect.right - rectClient.right;
	rectClient.bottom -= rect.bottom - rectClient.bottom;
	rectClient.OffsetRect(-rectClient.left, -rectClient.top);
	ASSERT(rectClient.left == 0 && rectClient.top == 0);
	
	// determine desired size of the Wnd
	CRect rectWnd(0, 0, m_totalDev.cx, m_totalDev.cy);
	if (bShrinkOnly)
	{
		if (rectClient.right <= m_totalDev.cx)
			rectWnd.right = rectClient.right;
		if (rectClient.bottom <= m_totalDev.cy)
			rectWnd.bottom = rectClient.bottom;
	}
	CalcWindowRect(rectWnd, CWnd::adjustOutside);
	rectWnd.OffsetRect(-rectWnd.left, -rectWnd.top);
	ASSERT(rectWnd.left == 0 && rectWnd.top == 0);
	if (bShrinkOnly)
	{
		if (rectClient.right <= m_totalDev.cx)
			rectWnd.right = rectClient.right;
		if (rectClient.bottom <= m_totalDev.cy)
			rectWnd.bottom = rectClient.bottom;
	}
	
	// dermine and set size of frame based on desired size of Wnd
	CRect rectFrame;
	CFrameWnd* pFrame = GetParentFrame();
	ASSERT_VALID(pFrame);
	pFrame->GetWindowRect(rectFrame);
	CSize size = rectFrame.Size();
	size.cx += rectWnd.right - rectClient.right;
	size.cy += rectWnd.bottom - rectClient.bottom;
	pFrame->SetWindowPos(NULL, 0, 0, size.cx, size.cy,
		SWP_NOMOVE|SWP_NOZORDER|SWP_NOACTIVATE);
}
Пример #5
0
// Create the "4 corner" region surrounding cRect
void CFlashingWnd::MakeFixedRegion(CRgn &wndRgn, CRgn &rgnTemp, CRgn &rgnTemp2, CRgn &rgnTemp3)
{
	CRect rectWnd(0, 0, m_cRect.Width() + THICKNESS + THICKNESS, m_cRect.Height() + THICKNESS + THICKNESS);
	CRect rectTemp(THICKNESS, THICKNESS, m_cRect.Width() + THICKNESS + 1, m_cRect.Height() + THICKNESS + 1);
	CRect rectTemp2(0, SIDELEN2, m_cRect.Width() + THICKNESS + THICKNESS, m_cRect.Height() - SIDELEN + 1);
	CRect rectTemp3(SIDELEN2, 0, m_cRect.Width() - SIDELEN + 1, m_cRect.Height() + THICKNESS + THICKNESS);

	VERIFY(wndRgn.CreateRectRgnIndirect(rectWnd));
	VERIFY(rgnTemp.CreateRectRgnIndirect(rectTemp));
	VERIFY(rgnTemp2.CreateRectRgnIndirect(rectTemp2));
	VERIFY(rgnTemp3.CreateRectRgnIndirect(rectTemp3));

	VERIFY(ERROR != wndRgn.CombineRgn(&wndRgn, &rgnTemp, RGN_DIFF));
	VERIFY(ERROR != wndRgn.CombineRgn(&wndRgn, &rgnTemp2, RGN_DIFF));
	VERIFY(ERROR != wndRgn.CombineRgn(&wndRgn, &rgnTemp3, RGN_DIFF));

	VERIFY(ERROR != wndRgn.OffsetRgn(m_cRect.left - THICKNESS, m_cRect.top - THICKNESS));
}