Exemple #1
0
void CScrollerCorner::OnLButtonDown(wxMouseEvent &event)
{
#ifdef GERRYXXX
	CWnd::OnLButtonDown(nFlags, pt);

	CWnd* pParent = GetParent();
	CRect rWin;
	pParent->GetWindowRect(&rWin);

	// calc screen coords of bottom-right frame corner
	pt.x = rWin.Width() - 1;
	pt.y = rWin.Height() - 1;
	pParent->ClientToScreen(&pt);

	pParent->SendMessage(WM_NCLBUTTONDOWN, WPARAM(HTSIZE),
						 MAKELPARAM(WORD(pt.x), WORD(pt.y)));
#endif
}
	void PresetHotkeyGroup::ResizeToContent() {
		int x = 0;
		int y = 0;
		for (CWnd *pWnd = GetWindow(GW_CHILD); pWnd != NULL; pWnd = pWnd->GetNextWindow(GW_HWNDNEXT)) {
			//Insert your code here. pWnd is a pointer to control window.
			CRect rect;
			pWnd->GetWindowRect(rect);

			y = max(rect.bottom, y);
			x = max(rect.right, x);
		}

		CRect rect;
		GetWindowRect(rect);
		rect.right = x;
		rect.bottom = y;
		MoveWindow(rect);
	}
Exemple #3
0
void CMonitorWidget::OnMouseMove(UINT nFlags, CPoint point)
{
	CRect rc;
   GetWindowRect(rc);
   ClientToScreen(&point);

   int cx = m_ptStartDrag.x - point.x;
   int cy = m_ptStartDrag.y - point.y;

   int nLeft = rc.left - cx;
   int nTop = rc.top - cy;
   int nRight = rc.right - cx;
   int nBottom = rc.bottom - cy;

   if(m_bLimitToWindow && m_bDisableLimitToWindow == false)
   {
      CRect rcWnd;
      CWnd *pParentRef = GetParent();
      if ( pParentRef != NULL )
      {
         pParentRef->GetWindowRect(rcWnd);

         if(rcWnd.left > nLeft)
            nLeft = rcWnd.left;
         if (rcWnd.top > nTop)
            nTop = rcWnd.top;
         if (rcWnd.right < nRight)
            nLeft = rcWnd.right - rc.Width();
         if (rcWnd.bottom < nBottom)
            nTop = rcWnd.bottom - rc.Height();
      }
   }

   if(nLeft != rc.left || nTop != rc.top)
   {
      if(m_bLeftButtonPressed && m_bEnableDrag)
      {
         SetWindowPos(NULL, nLeft, nTop, 0, 0, SWP_NOZORDER | SWP_NOSIZE);
         m_ptStartDrag = point;
         SavePosition();
      }
   }
   CWnd::OnMouseMove(nFlags, point);
}
/**
* OnInitDialog()
* @param void
* @return BOOL
*/
BOOL CDlgTestBaseSetup::OnInitDialog()
{
	CDialog::OnInitDialog();

	// TODO:  тз╢клМ╪с╤НмБ╣дЁУй╪╩╞
	CRect oRect;
	CWnd* pWnd = GetDlgItem(IDC_STATIC_TAB);
	pWnd->GetWindowRect(&oRect);
	ScreenToClient(&oRect);

	m_oTabWnd.Create(CBCGPTabWnd::STYLE_3D, oRect, this, 1, CBCGPTabWnd::LOCATION_TOP);	// йТптрЁхщфВ

	m_oTabTestBaseInstrument.m_pSiteData = m_pSiteData;	// ожЁ║йЩ╬щ
	m_oTabTestBaseInstrument.m_uiAim = 1;	// ╡Бйт╤тоС 1-ргфВё╩2-╪Л╡╗фВ
	m_oTabTestBaseInstrument.Create("", WS_CHILD | WS_VISIBLE, oRect, &m_oTabWnd, 1);	// йТптрЁ╡Бйт╩Ы╠╬иХжцё╛ргфВ

	m_oTabTestBaseSensor.m_pSiteData = m_pSiteData;	// ожЁ║йЩ╬щ
	m_oTabTestBaseSensor.m_uiAim = 2;	// ╡Бйт╤тоС 1-ргфВё╩2-╪Л╡╗фВ
	m_oTabTestBaseSensor.Create("", WS_CHILD | WS_VISIBLE, oRect, &m_oTabWnd, 2);	// йТптрЁ╡Бйт╩Ы╠╬иХжцё╛╪Л╡╗фВ

	m_oTabTestLimitInstrument.m_pSiteData = m_pSiteData;	// ожЁ║йЩ╬щ
	m_oTabTestLimitInstrument.m_uiAim = 1;	// ╡Бйт╤тоС 1-ргфВё╩2-╪Л╡╗фВ
	m_oTabTestLimitInstrument.Create("", WS_CHILD | WS_VISIBLE, oRect, &m_oTabWnd, 3);	// йТптрЁ╡Бйтеп╬щиХжцё╛ргфВ

	m_oTabTestLimitSensor.m_pSiteData = m_pSiteData;	// ожЁ║йЩ╬щ
	m_oTabTestLimitSensor.m_uiAim = 2;	// ╡Бйт╤тоС 1-ргфВё╩2-╪Л╡╗фВ
	m_oTabTestLimitSensor.Create("", WS_CHILD | WS_VISIBLE, oRect, &m_oTabWnd, 4);	// йТптрЁ╡Бйтеп╬щиХжцё╛╪Л╡╗фВ

	m_oTabWnd.AddTab(&m_oTabTestBaseInstrument, "    Instrument Base    ");	// йТптрЁ╡Бйт╩Ы╠╬иХжцё╛ргфВ
	m_oTabWnd.AddTab(&m_oTabTestBaseSensor, "    Sensor Base    ");	// йТптрЁ╡Бйт╩Ы╠╬иХжцё╛╪Л╡╗фВ
	m_oTabWnd.AddTab(&m_oTabTestLimitInstrument, "    Instrument Limit    ");	// йТптрЁ╡Бйтеп╬щиХжцё╛ргфВ
	m_oTabWnd.AddTab(&m_oTabTestLimitSensor, "    Sensor Limit    ");	// йТптрЁ╡Бйтеп╬щиХжцё╛╪Л╡╗фВ

	m_oTabWnd.RecalcLayout();
	m_oTabWnd.SetActiveTab(0);

	m_oTabTestBaseInstrument.OnBnClickedButtonReset();
	m_oTabTestBaseSensor.OnBnClickedButtonReset();
	m_oTabTestLimitInstrument.OnBnClickedButtonReset();
	m_oTabTestLimitSensor.OnBnClickedButtonReset();

	return TRUE;  // return TRUE unless you set the focus to a control
	// рЛЁё: OCX йТптрЁс╕╥╣╩ь FALSE
}
void CRunMapExpertDlg::OnInsertparm(void)
{
	// two stages - name/description OR data itself
	CMenu menu;
	menu.CreatePopupMenu();
	menu.AppendMenu(MF_STRING, id_InsertParmMapFileNoExt, "Map Filename (no extension)");
	menu.AppendMenu(MF_STRING, id_InsertParmMapFile, "Map Filename (with extension)");
	menu.AppendMenu(MF_STRING, id_InsertParmMapPath, "Map Path (no filename)");
	menu.AppendMenu(MF_SEPARATOR);
	menu.AppendMenu(MF_STRING, id_InsertParmExeDir, "Game Executable Directory");
	menu.AppendMenu(MF_STRING, id_InsertParmBspDir, "BSP Directory");
	menu.AppendMenu(MF_STRING, id_InsertParmGameDir, "Game Directory");

	// track menu
	CWnd *pButton = GetDlgItem(IDC_INSERTPARM);
	CRect r;
	pButton->GetWindowRect(r);
	menu.TrackPopupMenu(TPM_LEFTALIGN | TPM_LEFTBUTTON, r.left, r.bottom, this, NULL);
}
Exemple #6
0
void CSizingDialog::AddCtrl(UINT nID, int nDataType, LPCVOID lpData)
{
	if (nID == NULL)		// XR: all the controls
	{
		for (HWND hWnd = ::GetWindow(this->m_hWnd, GW_CHILD); hWnd != NULL;
			hWnd = ::GetNextWindow(hWnd, GW_HWNDNEXT))
		{
			UINT nIDCur = ::GetDlgCtrlID(hWnd);
			ASSERT(nIDCur != 0);
			this->AddCtrl(nIDCur, nDataType, lpData);	// XR: add all controls in turn
		}
		return;
	}

	// XR: add a single control

	CWnd* pCtrl = this->GetDlgItem(nID);
	ASSERT(::IsWindow(pCtrl->m_hWnd));

	LPCTSTR lpszString = (LPCTSTR)lpData;
	double* pDouble	= (double *)lpData;
	double& dRateLeft   = *pDouble;		pDouble++;
	double& dRateRight  = *pDouble;		pDouble++;
	double& dRateTop    = *pDouble;		pDouble++;
	double& dRateBottom = *pDouble;

	CRect rcCtrl;
	pCtrl->GetWindowRect(&rcCtrl);
	this->ScreenToClient(&rcCtrl);

	// XR: Add a new record to CMap object or update an old record

	CCtrlInfo* pInfo;
	if (!m_mapPtToInfo.Lookup(pCtrl->m_hWnd, (void *&)pInfo))
		pInfo = new CCtrlInfo;

	if (nDataType == DT_STRING)
		pInfo->Modify(pCtrl, this, lpszString);
	else if (nDataType == DT_NUMBER)
		pInfo->Modify(rcCtrl, dRateLeft,dRateRight, dRateTop, dRateBottom);
	
	m_mapPtToInfo[pCtrl->m_hWnd] = pInfo;
}
Exemple #7
0
void Cdynamic_odeDlg::OnLButtonDown(UINT nFlags, CPoint point) {

  CWnd* pWnd = m_gl_wnd; // GetDlgItem(IDC_GL_AREA);
  RECT r;
  pWnd->GetWindowRect(&r);
  ScreenToClient(&r);

  if (PtInRect(&r,point)) {

    // convert to viewport coordinates
    point.x -= r.left;
    point.y -= r.top; 
  
    m_left_scrolling_gl_area = 1;
    last_left_scroll_point = point;
    g_main_app->select(point);
  }	
  
}
Exemple #8
0
BOOL CCharacterSpacingDialog::OnInitDialog() 
{
	// Do default OnInitDialog.
	CPmwDialog::OnInitDialog();

	// Get the rect for our preview window.
	CWnd* pPreview = GetDlgItem(IDC_PREVIEW);
	if (pPreview != NULL)
	{
		pPreview->GetWindowRect(&m_crFullPreview);
		pPreview->ScreenToClient(&m_crFullPreview);

		m_crPreview = m_crFullPreview;
		m_crPreview.left++;
		m_crPreview.top++;
		m_crPreview.right--;
		m_crPreview.bottom--;
	}

	// Limit our text.
	CEdit* pEdit = (CEdit*)GetDlgItem(IDC_SPACING);
	if (pEdit != NULL)
	{
		pEdit->LimitText(7);
	}

	// Show the spacing in the edit.
	SetSpacing(m_lOriginalSpacing);

	// Check the radio button that corresponds to this spacing.
	UINT uID = IDC_CUSTOM;
	for (int i = 0; i < nStandardSpacings; i++)
	{
		if (StandardSpacing[i].m_lSpacing == m_lOriginalSpacing)
		{
			uID = StandardSpacing[i].m_uID;
			break;
		}
	}
	CheckDlgButton(uID, TRUE);

	return TRUE;
}
int CCtrlResize::FixControls()
{
	if (!m_pWnd)
		return 1;

	m_pWnd->GetClientRect(&m_rectInitialParent);
	m_pWnd->ScreenToClient(&m_rectInitialParent);
	
	for (INT_PTR i = 0; i < m_aCtrls.GetSize(); i++) {
		CControlInfo* pInfo = m_aCtrls.GetAt(i);
		CWnd* pControlWnd = pInfo->m_pControlWnd ? pInfo->m_pControlWnd :
			m_pWnd->GetDlgItem (pInfo->controlID);
		if (pControlWnd) {
			pControlWnd->GetWindowRect (&pInfo->rectInitial);
			m_pWnd->ScreenToClient (&pInfo->rectInitial);
		}
	}
	return 0;
}
CRect CSkinWin::GetButtonRect(int i)
{
    CWnd *pWnd = CWnd::FromHandle(m_hWnd);
    CRect wr;
    pWnd->GetWindowRect(wr);

    CRect r;
    if ( i == 0 && m_bmpCloseBtn.GetSafeHandle() )
    {
        //close
        r = m_rectCloseBtn;
        r.left = wr.Width() - m_rectCloseBtn.right;
        r.right = wr.Width() - m_rectCloseBtn.left;
    }
    if ( i == 2 && m_bmpMaxBtn.GetSafeHandle())
    {
        //max
        
        if ( m_winstate != 1 || !m_bmpRestoreBtn.GetSafeHandle() )
        {
            r = m_rectMaxBtn;
            r.left = wr.Width() - m_rectMaxBtn.right;
            r.right = wr.Width() - m_rectMaxBtn.left;
        }
        else
        {
            r = m_rectRestoreBtn;
            r.left = wr.Width() - m_rectRestoreBtn.right;
            r.right = wr.Width() - m_rectRestoreBtn.left;
        }
            
    }
    if ( i == 1/*2*/ && m_bmpMinBtn.GetSafeHandle())//modify by liu 修正最小化按钮鼠标进入的闪烁错误
    {
        //min
        r = m_rectMinBtn;
        r.left = wr.Width() - m_rectMinBtn.right;
        r.right = wr.Width() - m_rectMinBtn.left;
    }

    return r;

}
OIS::MouseEvent OgreFramework::_adjustMousePosition(const OIS::MouseEvent &evt)
{
    CRect rcParent;
    CRect rcView;

    CWnd* pWnd = AfxGetMainWnd();
    pWnd->GetWindowRect(&rcParent);

    GetWindowRect(_hWnd, &rcView);

    static OIS::MouseState	ms;
    ms = evt.state;
    ms.X.abs	-= rcView.left;
    ms.Y.abs	-= rcView.top;
    ms.X.abs	+= rcParent.left;
    ms.Y.abs	+= rcParent.top;

    return OIS::MouseEvent(const_cast<OIS::Object*>(evt.device), ms);
}
Exemple #12
0
/**
 * @brief Save coordinates of the frame, splitters, and bars
 *
 * @note Do not save the maximized/restored state here. We are interested
 * in the state of the active frame, and maybe this frame is not active
 */
void CChildFrame::SavePosition()
{
	CRect rc;
	CWnd* pLeft = m_wndSplitter.GetPane(0,0);
	if (pLeft != NULL)
	{
		pLeft->GetWindowRect(&rc);
		theApp.WriteProfileInt(_T("Settings"), _T("WLeft"), rc.Width());
	}

	// save the bars layout
	// save docking positions and sizes
	CDockState m_pDockState;
	GetDockState(m_pDockState);
	m_pDockState.SaveState(_T("Settings"));
	// for the dimensions of the diff pane, use the CSizingControlBar save
	m_wndLocationBar.SaveState(_T("Settings"));
	m_wndDetailBar.SaveState(_T("Settings"));
}
Exemple #13
0
void CheckWindow(CWnd &m_Wnd)
{
	if(!AfxGetMainWnd())
		return;
	CRect Rect0;
	AfxGetMainWnd()->GetWindowRect(Rect0);

	CRect Rect;
	m_Wnd.GetWindowRect(Rect);
	if(Rect.left<Rect0.left)
		Rect.left=0;
	if(Rect.top<Rect0.top)
		Rect.top=0;
	if(Rect.left>Rect0.right)
		Rect.left=0;
	if(Rect.top>Rect0.bottom)
		Rect.top=0;
	m_Wnd.MoveWindow(Rect);
}
Exemple #14
0
void CvQueryExecutionPlanView::DrawChildStart (CaSqlQueryExecutionPlanBinaryTree* pQepBinaryTree, CDC* pDC, BOOL bPreview)
{
	int  w;
	BOOL bStart = TRUE;
	CRect r;
	CaQepNodeInformation* pNodeInfo = pQepBinaryTree->m_pQepNodeInfo;
	ASSERT (pNodeInfo);
	if (!pNodeInfo)
		return;
	CWnd* pBox = pNodeInfo->GetQepBox(bPreview);
	if (!pBox)
		return;
	pBox->GetWindowRect (r);
	ScreenToClient (r);
	w = r.Width();
	CPoint pCenter(r.left  + w/2,  r.top);
	CPoint pLeft  (pCenter.x - 10, r.bottom);
	CPoint pRight (pCenter.x + 10, r.bottom);

	CPen   pen (PS_SOLID, 1, RGB (0,0,0));
	CPen*  old = pDC->SelectObject (&pen);
	CBrush br (RGB (0,0,0));

	bStart = (pQepBinaryTree->m_pQepNodeLeft || pQepBinaryTree->m_pQepNodeRight);

	CRect rx (pLeft.x, pLeft.y, pLeft.x+5, pLeft.y + 5);
	pDC->DPtoLP (rx);
	if (bStart && pQepBinaryTree->m_pQepNodeLeft)
		pDC->FillRect (rx, &br);
	rx = CRect (pRight.x, pRight.y, pRight.x+5, pRight.y + 5);
	pDC->DPtoLP (rx);
	if (bStart && pQepBinaryTree->m_pQepNodeRight)
		pDC->FillRect (rx, &br);
	
	if (!pNodeInfo->IsRoot())
	{
		rx = CRect (pCenter.x, pCenter.y, pCenter.x+5, pCenter.y - 5);
		pDC->DPtoLP (rx);
		pDC->FillRect (rx, &br);
	}

	pDC->SelectObject (old);
}
Exemple #15
0
void CSmartFieldsDialog::InitList()
{
	if (m_pList == NULL)
	{
		m_pList = CreateListBox();
	}
	m_pList->SubclassDlgItem(IDC_MACRO_LIST, this);

/* Set the splitter offset. Line it up with the value text. */

	CWnd* pValueText = GetDlgItem(IDC_VALUE);
	ASSERT(pValueText != NULL);

	CRect crValueText;
	pValueText->GetWindowRect(crValueText);
	CRect crList;
	m_pList->GetWindowRect(crList);
	m_pList->SplitterOffset(crValueText.left - crList.left);
}
Exemple #16
0
void CP4ListBrowse::OnSize(UINT nType, int cx, int cy)
{
    CDialog::OnSize(nType, cx, cy);

    // Slide the OK and Cancel buttons to the bottom of dlg
    CWnd *pRefresh = GetDlgItem(IDC_REFRESH);
    CWnd *pBack = GetDlgItem(IDC_BACK);
    CWnd *pOK   = GetDlgItem(IDOK);
    CWnd *pCancel = GetDlgItem(IDCANCEL);
    CWnd *pDescribe = GetDlgItem(IDC_DESCRIBE);

    if(!pOK)
        return;

    CRect rect;
    GetWindowRect(&rect);
    int dx = rect.Width() - m_LastRect.Width();
    int dy = rect.Height() - m_LastRect.Height();
    // Save the new size
    m_LastRect = rect;

    // Move down
    pRefresh->GetWindowRect(&rect);
    ScreenToClient(rect);
    pRefresh->SetWindowPos(NULL, rect.left, rect.top + dy, 0, 0, SWP_NOSIZE | SWP_NOZORDER);

    // Move down and slide right
    pBack->GetWindowRect(&rect);
    ScreenToClient(rect);
    pBack->SetWindowPos(NULL, rect.left + dx, rect.top + dy, 0, 0, SWP_NOSIZE | SWP_NOZORDER);

    pOK->GetWindowRect(&rect);
    ScreenToClient(rect);
    pOK->SetWindowPos(NULL, rect.left + dx, rect.top + dy, 0, 0, SWP_NOSIZE | SWP_NOZORDER);

    pCancel->GetWindowRect(&rect);
    ScreenToClient(rect);
    pCancel->SetWindowPos(NULL, rect.left + dx, rect.top + dy, 0, 0, SWP_NOSIZE | SWP_NOZORDER);

    pDescribe->GetWindowRect(&rect);
    ScreenToClient(rect);
    pDescribe->SetWindowPos(NULL, rect.left + dx, rect.top + dy, 0, 0, SWP_NOSIZE | SWP_NOZORDER);

    // Increase the size of the list both horiz and vert
    CWnd *pList = GetDlgItem(IDC_P4LIST);
    pList->GetWindowRect(&rect);
    pList->SetWindowPos(NULL, 0, 0, rect.right - rect.left + dx,
                        rect.bottom - rect.top + dy, SWP_NOMOVE | SWP_NOZORDER);
    RedrawWindow();
}
BOOL CDlgCalcDlg::OnInitDialog()
{
	CDialog::OnInitDialog();

	//
	// Set the application's icon.
	//
	SetIcon(m_hIcon, TRUE);
	SetIcon(m_hIcon, FALSE);
	
	//
	// Remove the Size and Maximize commands from the system menu.
	//
	CMenu* pMenu = GetSystemMenu (FALSE);
	pMenu->DeleteMenu (SC_SIZE, MF_BYCOMMAND);
	pMenu->DeleteMenu (SC_MAXIMIZE, MF_BYCOMMAND);

	//
	// Initialize m_rect with the coordinates of the control representing
	// the calculator's output window. Then destroy the control.
	//
	CWnd* pWnd = GetDlgItem (IDC_DISPLAYRECT);
	pWnd->GetWindowRect (&m_rect);
	pWnd->DestroyWindow ();
	ScreenToClient (&m_rect);

	//
	// Initialize m_cxChar and m_cyChar with the average character width
	// and height.
	//
    TEXTMETRIC tm;
    CClientDC dc (this);
    dc.GetTextMetrics (&tm);
    m_cxChar = tm.tmAveCharWidth;
    m_cyChar = tm.tmHeight - tm.tmDescent;

	//
	// Initialize the calculator's output window and return.
	//
    DisplayXRegister ();
	return TRUE;
}
//-----------------------------------------------------------------------------/
void CQTabbedDialog::MoveDlgSheet(CPropertySheet* pSheet, UINT nIDPSheetArea)
{
	TRACE("CQTabbedDialog::MoveDlgSheet(2)\n");
	ASSERT_VALID(pSheet);

	// 1 - Retrieve property sheet destination position
	CRect rcNewPosition;
	CWnd* pWndNewArea = GetDlgItem(nIDPSheetArea);
	if (pWndNewArea == NULL)
	{
		ASSERT(FALSE);	// Invalid nIDPSheetArea
		return;
	}

	pWndNewArea->GetWindowRect(&rcNewPosition);
	ScreenToClient(&rcNewPosition);

	// 2 - Call overloaded function
	MoveDlgSheet(pSheet, rcNewPosition);
}
BOOL CTangramTabCtrlWnd::SetActiveTab(int iTab)
{
	AFX_MANAGE_STATE(AfxGetStaticModuleState());
	int nOldIndex = m_nCurSelTab;
	m_nCurSelTab = iTab;
	BOOL bRet = CMFCTabCtrl::SetActiveTab(iTab);
	//int nIndex = GetCurSel();
	CWnd* pWnd = GetActiveWnd();
	if (pWnd)
	{
		CRect rc;
		pWnd->GetWindowRect(rc);
		CWnd* pPWnd = pWnd->GetParent();
		pPWnd->ScreenToClient(rc);
		::SetWindowPos(pWnd->m_hWnd, NULL, rc.left, rc.top, rc.Width(), rc.Height(), SWP_FRAMECHANGED | SWP_SHOWWINDOW | SWP_NOACTIVATE);
		Invalidate();
		::SendMessage(m_hWnd, WM_TABCHANGE, m_nCurSelTab, nOldIndex);
	}
	return bRet;// CMFCTabCtrl::SetActiveTab(iTab);
}
Exemple #20
0
void CMlsSimpleBitmapButton::Initialize(UINT nID, CWnd* pParent)
{
	CString csText;
	TRY
	{
		CWnd* pControl = pParent->GetDlgItem(nID);
		if (pControl != NULL)
		{
			CRect crControl;
			pControl->GetWindowRect(crControl);
			pParent->ScreenToClient(crControl);
			pControl->GetWindowText(csText);
			Create(NULL, csText, pControl->GetStyle(), crControl, pParent, nID, NULL);
			SetWindowPos(pControl, 0, 0, 0, 0, SWP_NOMOVE|SWP_NOSIZE);
			SetFont(pControl->GetFont());
			pControl->DestroyWindow();
		}
	}
	END_TRY
}
BOOL CDlgDeletedProperties::OnHelpInfo(HELPINFO* pHelpInfo) 
{
	RECT rc;
	
	CWnd *pItem = GetDlgItem (pHelpInfo->iCtrlId);
	if (pItem == NULL)
		return TRUE;
	
	pItem->GetWindowRect (&rc);
	if (PtInRect (&rc, pHelpInfo->MousePos) == FALSE)
	{
		pHelpInfo->MousePos.x = rc.left + (rc.right - rc.left) / 2;
		pHelpInfo->MousePos.y = rc.top + (rc.bottom - rc.top) / 2;
	}
	
	PrepareCHMgr (pHelpInfo->MousePos);
	
	_CHMgr.OnWT ();
	return TRUE;
}
Exemple #22
0
void CSizeableDlg::OnSizeControl(CWnd &stWnd, int cx, int cy, UINT nLocks)
{
	static CMap <CWnd*, CWnd*, WND_SIZE_DATA, WND_SIZE_DATA&> mapWnds;

	if (!IsWindow(stWnd))
		return;

	// check if this window was already measured by us
	WND_SIZE_DATA stSD;
	if (mapWnds.Lookup(&stWnd, stSD))
	{
		CRect stRect = stSD.stFirst;

		if (nLocks & 2)
		{
			stRect.right += cx - stSD.cx_now;
			if (nLocks & 1)
				stRect.left += cx - stSD.cx_now;
		}

		if (nLocks & 8)
		{
			stRect.bottom += cy - stSD.cy_now;
			if (nLocks & 4)
				stRect.top += cy - stSD.cy_now;
		}

		stWnd.MoveWindow(&stRect);
	} else
	{
		// this is a new window
		WND_SIZE_DATA stSD;
		stSD.cx_now = cx;
		stSD.cy_now = cy;

		stWnd.GetWindowRect(&stSD.stFirst);
		ScreenToClient(&stSD.stFirst);

		mapWnds.SetAt(&stWnd, stSD);
	}
}
Exemple #23
0
BOOL CCheckStatic::OnCommand(WPARAM wParam, LPARAM lParam) 
{
	if (wParam == ID_STATICCHECKBOX)
	{
		BOOL check = m_Check.GetCheck();
		m_Check.SetCheck(!check);

		// If we have specified some items to include, step through them
		if (m_ItemID.GetSize() > 0)
		{
			for (int i = 0; i < m_ItemID.GetSize(); i++)
			{
				GetParent()->GetDlgItem(m_ItemID[i])->EnableWindow(!check);
			}
		}
		// Otherwise, we step through the entire dialog list generated earlier
		else
		{
			for (int i = 0; i < m_IDList.GetSize(); i++)
			{
				CWnd * pWnd = GetParent()->GetDlgItem(m_IDList[i]);

				// We grab the rect of the item, put it into client co-ord's and only modify items inside our static box
				CRect rc;

				pWnd->GetWindowRect(&rc);
				ScreenToClient(&rc);

				if (m_rcStatic.PtInRect(rc.TopLeft()) && m_rcStatic.PtInRect(rc.BottomRight()))
					pWnd->EnableWindow(!check);
			}		
		}
// 
// 2001.10
// Change by Tadeusz Dracz
//	
		GetParent()->SendMessage(WM_COMMAND, MAKELONG(GetDlgCtrlID(), STN_CLICKED), (LPARAM)m_hWnd);
	}

	return CStatic::OnCommand(wParam, lParam);
}
Exemple #24
0
BOOL CToolBarCtrlPage::OnInitDialog()
{

	CPropertyPage::OnInitDialog();


	m_StandardBar.Create(WS_BORDER | WS_VISIBLE | WS_CHILD
			| CCS_TOP | CCS_ADJUSTABLE | TBSTYLE_TOOLTIPS,
		CRect(0,0,0,0),this, IDR_STANDARDBAR);

	m_PaletteBar.Create(WS_BORDER | WS_VISIBLE | WS_CHILD
			| CCS_BOTTOM | TBSTYLE_WRAPABLE | TBSTYLE_TOOLTIPS,
		CRect(0,0,0,0),this, IDR_PALETTEBAR);

	m_StandardBar.AutoSize();
	m_PaletteBar.AutoSize();

	m_ToolTip.Create(this);

	CString cstrToolTip;
	CWnd *pWnd = 0;
	CRect rect;

	// Setup the tooltip control for tooltips with the static controls
	for (int nIndex = ID_TOOLBARSTYLE; nIndex <= ID_TBSTYLETOOLTIPS2; nIndex++)
	{
		cstrToolTip.LoadString(nIndex);

		ENSURE(pWnd = GetDlgItem(nIndex));

		pWnd->GetWindowRect(&rect);
		ScreenToClient(&rect);

		m_ToolTip.AddTool(this, (LPCTSTR)cstrToolTip, &rect, nIndex);
	}

	m_ToolTip.Activate(TRUE);

	return TRUE;  // return TRUE unless you set the focus to a control
				  // EXCEPTION: OCX Property Pages should return FALSE
}
void CStatusPlayPlanPage::OnSize(UINT nType, int cx, int cy) 
{
	if (!m_bInitialized)
		return;
	CPropertyPage::OnSize(nType, cx, cy);

	// resize the list control
	CRect rect;
	GetClientRect(&rect);
	m_listPlayPlan.MoveWindow(m_nInitialX, m_nInitialY, 
							  rect.Width() - m_nInitialXMargin*2,
							  rect.Height() - m_nInitialY - m_nInitialYMargin);

	// resize the static text
	CWnd* pStatic = GetDlgItem(IDC_CURRENT_PLAY);
	pStatic->GetWindowRect(&rect);
	ScreenToClient(&rect);
	int dx = cx - rect.right;
	rect.InflateRect(0, 0, dx-4, 0);
	pStatic->MoveWindow(&rect);
}
Exemple #26
0
BOOL CEditDialogBar::OnInitDialogBar()
{
	CRect rect;
	GetWindowRect (rect);

	m_szWindow = rect.Size ();

	int count = (int)m_ResizeInfo.GetSize ();
	for (int i = 0; i < count; i++)
	{
		XResizeInfo& ri = m_ResizeInfo[i];

		CWnd* pWnd = GetDlgItem (ri.m_id);
		ASSERT_VALID (pWnd);

		pWnd->GetWindowRect (ri.m_rectInit);
		ScreenToClient (ri.m_rectInit);
	}

	return TRUE;
}
void CDlgCreateNormalTexture::OnPaint() 
{
	CPaintDC dc(this); // device context for painting
	
  // if texture preview windows are not yet created
  if( !m_bPreviewWindowsCreated)
  {
    // ---------------- Create custom window that will show how created texture will look like
    CWnd *pWndCreatedTexturePreview = GetDlgItem(IDC_TEXTURE_PREVIEW_WINDOW);
    ASSERT(pWndCreatedTexturePreview != NULL);
    CRect rectPreviewCreatedTextureWnd;
    // get rectangle occupied by preview texture window
    pWndCreatedTexturePreview->GetWindowRect( &rectPreviewCreatedTextureWnd);
    ScreenToClient( &rectPreviewCreatedTextureWnd);
    // create window for for showing created texture
    m_wndViewCreatedTexture.Create( NULL, NULL, WS_BORDER|WS_VISIBLE, rectPreviewCreatedTextureWnd,
                                    this, IDW_VIEW_CREATED_TEXTURE);
    // mark that custom windows are created
    m_bPreviewWindowsCreated = TRUE;
  }
}
void COXLayoutManager::SetDefaultConstraint(UINT nChildWnd)
{
	ASSERT(m_pContainerWnd);
	
	CWnd* pWnd = m_pContainerWnd->GetDlgItem(nChildWnd);
	ASSERT(pWnd);
	if (pWnd == NULL)
	{
		TRACE0("COXLayoutManager::SetDefaultConstraint(): failed. Default constraint can only be applied after window has been created.\r\n");
		return;
	}

	CRect rect;
	pWnd->GetWindowRect(rect);
	m_pContainerWnd->ScreenToClient(rect);

	SetConstraint(nChildWnd, OX_LMS_TOP, OX_LMT_SAME, rect.top);
	SetConstraint(nChildWnd, OX_LMS_LEFT, OX_LMT_SAME, rect.left);
	RemoveConstraint(nChildWnd, OX_LMS_BOTTOM);
	RemoveConstraint(nChildWnd, OX_LMS_RIGHT);
}
//-----------------------------------------------------------------------------
// Purpose: adds controls to the CHammerBar
//			determines position and stretch settings based on default design /			
// Input  : int nIDTemplate - ID from .rc file of control to be added
//			DWORD dwPlacementFlag - placement information
//				GROUP_BOX - will be stretched to fit new size
//				BOTTOM_JUSTIFY - will move with the bottom of the dialog	
//				RIGHT_JUSTIFY - will move with the right side of the dialog//			
// Output : void
//-----------------------------------------------------------------------------
void CHammerBar::AddControl( int nIDTemplate, DWORD dwPlacementFlag )
{
	ControlInfo_t newControl;
	newControl.m_nIDDialogItem = nIDTemplate;
	newControl.m_dwPlacementFlag = dwPlacementFlag;

	CWnd *pControl = GetDlgItem( nIDTemplate );
	if ( pControl != NULL )
	{
		CRect controlPos, hammerBarPos;
		pControl->GetWindowRect( &controlPos );
		GetWindowRect( &hammerBarPos );

		newControl.m_nHeightBuffer	= m_sizeDefault.cy - controlPos.Height(); 
		newControl.m_nWidthBuffer	= m_sizeDefault.cx - controlPos.Width();
		newControl.m_nPosX			= m_sizeDefault.cx + hammerBarPos.left - controlPos.left;
		newControl.m_nPosY			= m_sizeDefault.cy + hammerBarPos.top - controlPos.top;
		
		m_ControlList.AddToTail( newControl );
	}
}
Exemple #30
0
BOOL CSliderCtrlPage::OnInitDialog()
{
	CPropertyPage::OnInitDialog();

	// Initially create slider control in horizontal position
	CWnd* pWnd =
		GetDlgItem( IDC_SLIDER_HORZPOS );
	CRect rect;
	pWnd->GetWindowRect( &rect );
	ScreenToClient( &rect );

	// Initialise controls
	m_Slider.Create( WS_VISIBLE|WS_CHILD|TBS_HORZ|TBS_BOTH|TBS_AUTOTICKS,
					 rect, this, IDC_SLIDER );
	m_Slider.SetTicFreq( m_uiTickFreq );    // Send TBM_SETTICFREQ
	m_Slider.SetLineSize( m_uiLine );       // Send TBM_SETLINESIZE
	m_Slider.SetPageSize( m_uiPage );       // Send TBM_SETPAGESIZE
	m_Slider.SetRange( m_uiRangeFrom, m_uiRangeTo, TRUE );
											// Send TBM_SETRANGE
	return TRUE;
}