Example #1
0
//获取窗口
bool CBitmapRgnWindow::SafeGetClientRect(CWnd * pControlWnd, CRect & ClientRect)
{
	if ((pControlWnd!=NULL)&&(pControlWnd->GetSafeHwnd())) 
	{
		pControlWnd->GetClientRect(&ClientRect);
		return true;
	}
	ClientRect.SetRectEmpty();
	return false;
}
Example #2
0
bool CDocCommands::GetDibCropRect(CRect& DibCropRect)
{
	DibCropRect.SetRectEmpty();

	CImageObject* pObject = m_DocWindow.GetSelectedObject();
	if (!pObject)
		return false;

	return pObject->GetDibCropRect(DibCropRect);
}
Example #3
0
CSize CRulerBar::CalcFixedLayout(BOOL bStretch, BOOL bHorz)
{
    ASSERT(bHorz);
    CSize m_size = CControlBar::CalcFixedLayout(bStretch, bHorz);
    CRect rectSize;
    rectSize.SetRectEmpty();
    CalcInsideRect(rectSize, bHorz);       // will be negative size
    m_size.cy = RULERBARHEIGHT - rectSize.Height();
    return m_size;
}
//********************************************************************************
BOOL CCxLoginBar::CreateEx (CWnd* pParentWnd, DWORD /*dwCtrlStyle*/, DWORD dwStyle, 
							 UINT nID)
{
	ASSERT_VALID(pParentWnd);   // must have a parent

	m_dwStyle |= CBRS_HIDE_INPLACE;

	//dwStyle &= ~CBRS_GRIPPER;

	m_dwStyle = (dwStyle & CBRS_ALL);
	// save the style
	SetBarAlignment (dwStyle & CBRS_ALL);

	SetBorders (CRect(1, 0, 1, 0));

	// create the HWND
	CRect rect;
	rect.SetRectEmpty();

#ifndef _BCGSUITE_
	m_dwBCGStyle = 0; // can't float, resize, close, slide
#else
	m_dwControlBarStyle = 0; // can't float, resize, close, slide
#endif

	if (!CBCGPBaseToolBar::Create (
		globalData.RegisterWindowClass (_T("CCxLoginBar")), dwStyle, rect, pParentWnd, nID, 0))
	{
		return FALSE;
	}

	////if (!CWnd::Create (globalData.RegisterWindowClass (_T("CCxLoginBar")),
	//if (!CWnd::Create (globalData.RegisterWindowClass (_T("CCxLoginBar")),
	//	NULL, dwStyle | WS_CLIPSIBLINGS, rect, pParentWnd, nID))
	//{
	//	return FALSE;
	//}

	//if (pParentWnd->IsKindOf (RUNTIME_CLASS (CBCGPFrameWnd)))
	//{
	//	((CBCGPFrameWnd*) pParentWnd)->AddControlBar (this);
	//}
	//else if (pParentWnd->IsKindOf (RUNTIME_CLASS (CBCGPMDIFrameWnd)))
	//{
	//	((CBCGPMDIFrameWnd*) pParentWnd)->AddControlBar (this);
	//}
	//else
	//{
	//	ASSERT (FALSE);
	//	return FALSE;
	//}

	m_ToolTip.Create(this);
	return TRUE;
}
int CPropertiesWnd::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
	if (CDockablePane::OnCreate(lpCreateStruct) == -1)
		return -1;

	CRect rectDummy;
	rectDummy.SetRectEmpty();

	// Créer une zone de liste déroulante :
	//const DWORD dwViewStyle = WS_CHILD | WS_VISIBLE | CBS_DROPDOWNLIST | WS_BORDER | CBS_SORT | WS_CLIPSIBLINGS | WS_CLIPCHILDREN;


	//| WS_GROUP
	//if (!m_titleCtrl.Create(_T("Vial No"), WS_CHILD | WS_VISIBLE  | SS_CENTERIMAGE, rectDummy, this, IDC_STATIC))
	//{
	//	TRACE0("Impossible de créer la zone de liste déroulante des propriétés\n");
	//	return -1;      // échec de la création
	//}


	//const DWORD dwViewStyle = WS_CHILD | WS_VISIBLE | WS_BORDER | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | WS_TABSTOP;
	//if (!m_vialCtrl.Create(WS_VISIBLE | WS_CHILD | WS_TABSTOP | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | ES_LEFT | ES_AUTOHSCROLL, rectDummy, this, IDC_VIAL))
	//{
	//	TRACE0("Impossible de créer la zone de liste déroulante des propriétés\n");
	//	return -1;      // échec de la création
	//}

	if (!m_wndPropList.Create(WS_VISIBLE | WS_CHILD | WS_TABSTOP, rectDummy, this, 2))
	{
		TRACE0("Impossible de créer la grille des propriétés\n");
		return -1;      // échec de la création
	}

	CStringArrayEx propertyHeader(UtilWin::GetCString(IDS_STR_PROPERTY_HEADER));
	m_wndPropList.EnableHeaderCtrl(true, propertyHeader[0], propertyHeader[1]);

	//InitPropList();
	SetPropListFont();

	//m_wndToolBar.Create(this, AFX_DEFAULT_TOOLBAR_STYLE, IDR_PROPERTIES);
	//m_wndToolBar.LoadToolBar(IDR_PROPERTIES, 0, 0, TRUE /* Est verrouillé */);
	//m_wndToolBar.CleanUpLockedImages();
	//m_wndToolBar.LoadBitmap(IDR_PROPERTIES, 0, 0, TRUE /* Verrouillé */);

	//m_wndToolBar.SetPaneStyle(m_wndToolBar.GetPaneStyle() | CBRS_TOOLTIPS | CBRS_FLYBY);
	//m_wndToolBar.SetPaneStyle(m_wndToolBar.GetPaneStyle() & ~(CBRS_GRIPPER | CBRS_SIZE_DYNAMIC | CBRS_BORDER_TOP | CBRS_BORDER_BOTTOM | CBRS_BORDER_LEFT | CBRS_BORDER_RIGHT));
	//m_wndToolBar.SetOwner(this);

	//// Toutes les commandes sont routées via ce contrôle et non via le frame parent :
	//m_wndToolBar.SetRouteCommandsViaFrame(FALSE);

	AdjustLayout();
	return 0;
}
Example #6
0
int CFormatBar::GetDefaultHeight(void)
{
	CRect rectSize;
	rectSize.SetRectEmpty();
#ifdef WIN32
	CalcInsideRect(rectSize, TRUE);       // will be negative size
#else
	CalcInsideRect(rectSize);       // will be negative size
#endif
	return m_sizeButton.cy - rectSize.Height();
}
Example #7
0
//获取窗口
bool CBitmapRgnWindow::SafeGetClientRect(UINT uID, CRect & ClientRect)
{
	CWnd * pControlWnd=GetDlgItem(uID);
	if ((pControlWnd!=NULL)&&(pControlWnd->GetSafeHwnd())) 
	{
		pControlWnd->GetClientRect(&ClientRect);
		return true;
	}
	ClientRect.SetRectEmpty();
	return false;
}
Example #8
0
BOOL CRuler::Create(CWnd* pParentWnd, DWORD dwStyle, UINT nID)
{
    ASSERT_VALID(pParentWnd);   // must have a parent

    // create the HWND
    CRect rect;
    rect.SetRectEmpty();
    BOOL bRet=CWnd::Create(NULL, "", dwStyle, rect, pParentWnd, nID);
    EnableToolTips(TRUE);
    return bRet;
}
Example #9
0
	CRect RenderedSubtitle::Draw(SubPicDesc& spd) const
	{
		CRect bbox;
		bbox.SetRectEmpty();

		// shadow

		POSITION pos = m_glyphs.GetHeadPosition();
		while(pos) {
			Glyph* g = m_glyphs.GetNext(pos);

			if(g->style.shadow.depth <= 0) {
				continue;
			}

			DWORD c = g->style.shadow.color;
			DWORD sw[6] = {c, (DWORD)-1};

			bool outline = g->style.background.type == L"outline" && g->style.background.size > 0;

			bbox |= g->ras_shadow.Draw(spd, m_clip, g->tls.x, g->tls.y, sw, outline ? 1 : 0);
		}

		// background

		pos = m_glyphs.GetHeadPosition();
		while(pos) {
			Glyph* g = m_glyphs.GetNext(pos);

			DWORD c = g->style.background.color;
			DWORD sw[6] = {c, (DWORD)-1};

			if(g->style.background.type == L"outline" && g->style.background.size > 0) {
				bbox |= g->ras.Draw(spd, m_clip, g->tl.x, g->tl.y, sw, g->style.font.color.a < 255 ? 2 : 1);
			} else if(g->style.background.type == L"enlarge" && g->style.background.size > 0
					  || g->style.background.type == L"box" && g->style.background.size >= 0) {
				bbox |= g->ras_bkg.Draw(spd, m_clip, g->tl.x, g->tl.y, sw, 0);
			}
		}

		// body

		pos = m_glyphs.GetHeadPosition();
		while(pos) {
			Glyph* g = m_glyphs.GetNext(pos);

			DWORD c = g->style.font.color;
			DWORD sw[6] = {c, (DWORD)-1}; // TODO: fill

			bbox |= g->ras.Draw(spd, m_clip, g->tl.x, g->tl.y, sw, 0);
		}

		return bbox;
	}
Example #10
0
//----------------------------------------------------------------------------------------------------------
void CXPTabCtrl::OnPaint() 
{
    if(!IsExtendedTabTheamedXP())            // if it is not XP or it is not Themes, behave as default
    { Default(); return; }    
    CPaintDC dc(this);                        // device context for painting

    CRect rcClip; rcClip.SetRectEmpty();
    dc.GetClipBox(rcClip);

    // 1st paint the tab body
    CRect rcPage,rcItem,rcClient;
    GetClientRect(&rcPage);
    rcClient=rcPage;
    AdjustRect(FALSE,rcPage);

    switch(m_eTabOrientation)
    {    case e_tabTop:      rcClient.top   =rcPage.top   -2; break;
    case e_tabBottom: rcClient.bottom=rcPage.bottom+3; break;
    case e_tabLeft:      rcClient.left  =rcPage.left  -1; break;
    case e_tabRight:  rcClient.right =rcPage.right +3; break;
    default: ASSERT(FALSE); return;
    }
    UINT uiVertBottm;
    uiVertBottm =(m_eTabOrientation&1)? 8:0;        //  8=bottom
    uiVertBottm|=(m_eTabOrientation&2)?16:0;        // 16=vertical
    UINT uiFlags=1|uiVertBottm;                        //  1=body    
    DrawThemesXpTabItem(&dc, -1, rcClient,uiFlags);    // TABP_PANE=9,0,'TAB'

    int nTab=GetItemCount();                        // paint the tabs first and then the borders
    if(!nTab) return;                                // no tab pages added

    // 2nd paint the inactive tabs
    CRect ;
    TCHITTESTINFO hti;    hti.flags=0;
    ::GetCursorPos(&hti.pt); ScreenToClient(&hti.pt);
    int ixHot=HitTest(&hti);
    int ixSel=GetCurSel();

    for(int ixTab=0; ixTab<nTab; ixTab++)
    {    if(ixTab==ixSel)
    continue;
    VERIFY(GetItemRect(ixTab, &rcItem));
    if(m_eTabOrientation==e_tabLeft) rcItem.right++;
    uiFlags=uiVertBottm|(ixTab==ixHot?4:0);        // 4= hot
    DrawThemesXpTabItem(&dc,ixTab,rcItem,uiFlags);
    }
    // 3rd paint the active selected tab
    VERIFY(GetItemRect(ixSel, &rcItem));            // now selected tab
    rcItem.InflateRect(2,2);
    if(m_eTabOrientation==e_tabTop) rcItem.bottom--;
    uiFlags=uiVertBottm|2;                            // 2= selected
    DrawThemesXpTabItem(&dc, ixSel, rcItem,uiFlags);
}
Example #11
0
int COutputWnd::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
	if (CDockablePane::OnCreate(lpCreateStruct) == -1)
		return -1;

	m_Font.CreateStockObject(DEFAULT_GUI_FONT);

	CRect rectDummy;
	rectDummy.SetRectEmpty();

	// 탭 창을 만듭니다.
	if (!m_wndTabs.Create(CMFCTabCtrl::STYLE_FLAT, rectDummy, this, 1))
	{
		TRACE0("출력 탭 창을 만들지 못했습니다.\n");
		return -1;      // 만들지 못했습니다.
	}

	// 출력 창을 만듭니다.
	const DWORD dwStyle = LBS_NOINTEGRALHEIGHT | WS_CHILD | WS_VISIBLE | WS_HSCROLL | WS_VSCROLL;

	if (!m_wndOutputBuild.Create(dwStyle, rectDummy, &m_wndTabs, 2) ||
		!m_wndOutputDebug.Create(dwStyle, rectDummy, &m_wndTabs, 3) ||
		!m_wndOutputFind.Create(dwStyle, rectDummy, &m_wndTabs, 4))
	{
		TRACE0("출력 창을 만들지 못했습니다.\n");
		return -1;      // 만들지 못했습니다.
	}

	m_wndOutputBuild.SetFont(&m_Font);
	m_wndOutputDebug.SetFont(&m_Font);
	m_wndOutputFind.SetFont(&m_Font);

	CString strTabName;
	BOOL bNameValid;

	// 탭에 목록 창을 연결합니다.
	bNameValid = strTabName.LoadString(IDS_BUILD_TAB);
	ASSERT(bNameValid);
	m_wndTabs.AddTab(&m_wndOutputBuild, strTabName, (UINT)0);
	bNameValid = strTabName.LoadString(IDS_DEBUG_TAB);
	ASSERT(bNameValid);
	m_wndTabs.AddTab(&m_wndOutputDebug, strTabName, (UINT)1);
	bNameValid = strTabName.LoadString(IDS_FIND_TAB);
	ASSERT(bNameValid);
	m_wndTabs.AddTab(&m_wndOutputFind, strTabName, (UINT)2);

	// 출력 탭을 더미 텍스트로 채웁니다.
	FillBuildWindow();
	FillDebugWindow();
	FillFindWindow();

	return 0;
}
//--------------------------------------------------------------------------------------//
void CBCGPDragFrameImpl::EndDrawDragFrame (BOOL bClearInternalRects)
{
	if (m_pDockManager == NULL)
	{
		return;
	}

    BOOL bSDockingIsOn = FALSE;
    CBCGPSmartDockingManager* pSDManager = NULL;

    if ((pSDManager = m_pDockManager->GetSDManagerPermanent()) != NULL
        && pSDManager->IsStarted())
    {
        bSDockingIsOn = TRUE;
        pSDManager->HidePlace ();
    }

	CRect rectEmpty; rectEmpty.SetRectEmpty ();
	CRect rectDocked = m_rectExpectedDocked.IsRectEmpty () ? m_rectDrag : 
															 m_rectExpectedDocked;

	// do not draw the final frame (meaning - clear) if it was not drawn because of tab
	if (m_nInsertedTabID == -1)
	{
        if (!bSDockingIsOn)
        {
		    DrawDragFrame (rectEmpty, rectDocked, 0, m_nOldThikness);
        }
	}
	else
	{
		m_bDockToTab = TRUE;
	}
	
	if (bClearInternalRects)
	{
        RemoveTabPreDocking ();

		m_rectExpectedDocked.SetRectEmpty ();
		m_rectDrag.SetRectEmpty ();

		m_pFinalTargetBar = m_pTargetBar;
		m_pTargetBar = NULL;
	}

	m_bDragStarted = FALSE;
	
	ASSERT (m_pDockManager != NULL);
	if (!bSDockingIsOn)
	{
		m_pDockManager->LockUpdate (FALSE);
	}
}
Example #13
0
int COutputWnd::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
	if (CDockablePane::OnCreate(lpCreateStruct) == -1)
		return -1;

	m_Font.CreateStockObject(DEFAULT_GUI_FONT);

	CRect rectDummy;
	rectDummy.SetRectEmpty();

	// 创建选项卡窗口:
	if (!m_wndTabs.Create(CMFCTabCtrl::STYLE_FLAT, rectDummy, this, 1))
	{
		TRACE0("未能创建输出选项卡窗口\n");
		return -1;      // 未能创建
	}

	// 创建输出窗格:
	const DWORD dwStyle = LBS_NOINTEGRALHEIGHT | WS_CHILD | WS_VISIBLE | WS_HSCROLL | WS_VSCROLL;

	if (!m_wndOutputBuild.Create(dwStyle, rectDummy, &m_wndTabs, 2) ||
		!m_wndOutputDebug.Create(dwStyle, rectDummy, &m_wndTabs, 3) ||
		!m_wndOutputFind.Create(dwStyle, rectDummy, &m_wndTabs, 4))
	{
		TRACE0("未能创建输出窗口\n");
		return -1;      // 未能创建
	}

	m_wndOutputBuild.SetFont(&m_Font);
	m_wndOutputDebug.SetFont(&m_Font);
	m_wndOutputFind.SetFont(&m_Font);

	CString strTabName;
	BOOL bNameValid;

	// 将列表窗口附加到选项卡:
	bNameValid = strTabName.LoadString(IDS_BUILD_TAB);
	ASSERT(bNameValid);
	m_wndTabs.AddTab(&m_wndOutputBuild, strTabName, (UINT)0);
	//bNameValid = strTabName.LoadString(IDS_DEBUG_TAB);
	//ASSERT(bNameValid);
	//m_wndTabs.AddTab(&m_wndOutputDebug, strTabName, (UINT)1);
	//bNameValid = strTabName.LoadString(IDS_FIND_TAB);
	//ASSERT(bNameValid);
	//m_wndTabs.AddTab(&m_wndOutputFind, strTabName, (UINT)2);

	// 使用一些虚拟文本填写输出选项卡(无需复杂数据)
	FillBuildWindow();
	//FillDebugWindow();
	//FillFindWindow();

	return 0;
}
Example #14
0
void CRegistrySettings::GetLastSelectionRectangle(CRect &rcLastSelection) {
    unsigned long lLength = MAX_PATH;
    _TCHAR szLastSelectionRectangle[MAX_PATH];
    bool bRet = LRegistry::ReadStringRegistryEntry(HKEY_CURRENT_USER, 
        _T("Software\\imc AG\\LECTURNITY\\Assistant\\SgSettings\\"), 
        _T("LastSelectionRectangleCustom"), szLastSelectionRectangle, &lLength);

    CString csLastSelectionRectangle = szLastSelectionRectangle;
    rcLastSelection.SetRectEmpty();
    if (bRet && !csLastSelectionRectangle.IsEmpty()) {
        int iPos = csLastSelectionRectangle.Find(_T(";"));
        CString csValue;
        bool bError = false;
        if (iPos > 0) {
            csValue = csLastSelectionRectangle.Left(iPos);
            rcLastSelection.left = _ttoi(csValue);
        }
        else
            bError = true;

        if (!bError) {
            int iNewLength = csLastSelectionRectangle.GetLength() - (iPos+1);
            csLastSelectionRectangle = csLastSelectionRectangle.Right(iNewLength);
            iPos = csLastSelectionRectangle.Find(_T(";"));
            if (iPos > 0) {
                csValue = csLastSelectionRectangle.Left(iPos);
                rcLastSelection.top = _ttoi(csValue);
            }
            else
                bError = true;
        }

        if (!bError) {
            int iNewLength = csLastSelectionRectangle.GetLength() - (iPos+1);
            csLastSelectionRectangle = csLastSelectionRectangle.Right(iNewLength);
            iPos = csLastSelectionRectangle.Find(_T(";"));
            if (iPos > 0) {
                csValue = csLastSelectionRectangle.Left(iPos);
                rcLastSelection.right = _ttoi(csValue);
            }
            else
                bError = true;
        }

        if (!bError) {
            int iNewLength = csLastSelectionRectangle.GetLength() - (iPos+1);
            csLastSelectionRectangle = csLastSelectionRectangle.Right(iNewLength);
            csValue = csLastSelectionRectangle;
            rcLastSelection.bottom = _ttoi(csValue);
        }
    }
}
Example #15
0
int COutputWnd::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
	if (CDockablePane::OnCreate(lpCreateStruct) == -1)
		return -1;

	m_Font.CreateStockObject(DEFAULT_GUI_FONT);

	CRect rectDummy;
	rectDummy.SetRectEmpty();

	// Create tabs window:
	if (!m_wndTabs.Create(CMFCTabCtrl::STYLE_FLAT, rectDummy, this, 1))
	{
		TRACE0("Failed to create output tab window\n");
		return -1;      // fail to create
	}

	// Create output panes:
	const DWORD dwStyle = LBS_NOINTEGRALHEIGHT | WS_CHILD | WS_VISIBLE | WS_HSCROLL | WS_VSCROLL;
    
	m_wndPreview = new CPreviewWindow();
	LPCTSTR className = AfxRegisterWndClass(CS_DBLCLKS);
	if (!m_wndOutputBuild.Create(dwStyle, rectDummy, &m_wndTabs, 2) ||
		!m_wndOutputDebug.Create(dwStyle, rectDummy, &m_wndTabs, 3) )// ||
		//!m_wndPreview->Create(className,L"RenderPreview", WS_CHILD | WS_VISIBLE , rectDummy , &m_wndTabs, 4))
	{
		TRACE0("Failed to create output windows\n");
		return -1;      // fail to create
	}

	m_wndOutputBuild.SetFont(&m_Font);
	m_wndOutputDebug.SetFont(&m_Font);

	CString strTabName;
	BOOL bNameValid;

	// Attach list windows to tab:
	bNameValid = strTabName.LoadString(IDS_BUILD_TAB);
	ASSERT(bNameValid);
	m_wndTabs.AddTab(&m_wndOutputBuild, strTabName, (UINT)0);
	bNameValid = strTabName.LoadString(IDS_DEBUG_TAB);
	ASSERT(bNameValid);
	m_wndTabs.AddTab(&m_wndOutputDebug, strTabName, (UINT)1);

	//m_wndTabs.AddTab(m_wndPreview, TEXT("Preview"), (UINT)2);

	// Fill output tabs with some dummy text (nothing magic here)
	FillBuildWindow();
	FillDebugWindow();

	return 0;
}
Example #16
0
void CDockBar::OnNcCalcSize(BOOL /*bCalcValidRects*/, NCCALCSIZE_PARAMS* lpncsp)
{
	// calculate border space (will add to top/bottom, subtract from right/bottom)
	CRect rect;
	rect.SetRectEmpty();
	CalcInsideRect(rect, m_dwStyle & CBRS_ORIENT_HORZ);

	// adjust non-client area for border space
	lpncsp->rgrc[0].left += rect.left;
	lpncsp->rgrc[0].top += rect.top;
	lpncsp->rgrc[0].right += rect.right;
	lpncsp->rgrc[0].bottom += rect.bottom;
}
Example #17
0
int AutoLayoutPanel::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
    if (CDockablePane::OnCreate(lpCreateStruct) == -1)
        return -1;

    // TODO:  Add your specialized creation code here
    CRect rectDummy;
    rectDummy.SetRectEmpty();
    this->slider.Create(WS_CHILD | WS_VISIBLE, rectDummy, this, ID_SLIDER);
    this->slider.SetRange(0, 80, 1);	// hard code!!!

    return 0;
}
Example #18
0
int AutoLayoutSlider::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
	if (CWnd::OnCreate(lpCreateStruct) == -1)
		return -1;

	// TODO:  Add your specialized creation code here
	CRect rectDummy;
	rectDummy.SetRectEmpty();
	this->_sliderCtrl.Create(WS_CHILD | WS_VISIBLE, rectDummy, this, 1);
	this->_sliderCtrl.SetRange(0, 80, 1);	// hard code!!!

	return 0;
}
Example #19
0
// 消息响应
LRESULT CScrollV::OnMessage(UINT uID, UINT Msg, WPARAM wParam, LPARAM lParam)
{
	if(uID == BT_UP)
	{
		if(BUTTOM_UP == lParam)
		{
			CRect rcUpdate;
			rcUpdate.SetRectEmpty();
			MoveRange(-m_nRowRange);
		}
	}
	else if (uID == BT_DOWN)
	{
		if(BUTTOM_UP == lParam)
		{
			CRect rcUpdate;
			rcUpdate.SetRectEmpty();
			MoveRange(m_nRowRange);
		}
	}
	return 0L; 
}
Example #20
0
void COleClientItem::Activate(LONG nVerb, CView* pView, LPMSG lpMsg)
{
    ASSERT_VALID(this);
    ASSERT(m_lpObject != NULL);
    if (pView != NULL)
        ASSERT_VALID(pView);
    if (lpMsg != NULL)
        ASSERT(AfxIsValidAddress(lpMsg, sizeof(MSG), FALSE));

    // store the container HWND for in place activation then do the verb
    if (m_pView == NULL)
        m_pView = pView;

    _AFX_OLE_STATE* pOleState = _afxOleState;
    CView* pViewSave = pOleState->m_pActivateView;
    pOleState->m_pActivateView = NULL;

    // get item rectangle for in-place players
    //  (that may not support in-place activation)
    LPCRECT lpPosRect = NULL;
    CRect rectPos;
    if (pView != NULL)
    {
        ASSERT_VALID(pView);
        rectPos.SetRectEmpty();
        OnGetItemPosition(rectPos);
        if (!rectPos.IsRectEmpty())
        {
            lpPosRect = &rectPos;
            pOleState->m_pActivateView = pView;
        }
    }

    // prepare DoVerb parameters and call into the server
    LPOLECLIENTSITE lpClientSite = GetClientSite();
    HWND hWnd = pView->GetSafeHwnd();
    SCODE sc = m_lpObject->DoVerb(nVerb, lpMsg, lpClientSite, -1,
                                  hWnd, lpPosRect);

    pOleState->m_pActivateView = pViewSave;

    // clear out m_pView in case in-place activation only partially worked
    if (!IsInPlaceActive())
        m_pView = NULL;

    // update available status based on the results of DoVerb
    //  (this is used in the links dialog).
    m_bLinkUnavail = (BYTE)FAILED(sc);

    CheckGeneral(sc);
}
int CWorkSpaceBar::OnCreate(LPCREATESTRUCT lpCreateStruct) 
{
	if (CBCGPDockingControlBar::OnCreate(lpCreateStruct) == -1)
		return -1;
	
	CRect rectDummy;
	rectDummy.SetRectEmpty ();

	// Create tree windows.
	// TODO: create your own tab windows here:
// 	const DWORD dwViewStyle =	WS_CHILD | WS_VISIBLE | TVS_HASLINES | 
// 								TVS_LINESATROOT | TVS_HASBUTTONS;
// 	
// 	if (!m_wndTree.Create (dwViewStyle, rectDummy, this, 1))
// 	{
// 		TRACE0("Failed to create workspace view\n");
// 		return -1;      // fail to create
// 	}
// 
// 	// Setup trees content:
// 	HTREEITEM hRoot1 = m_wndTree.InsertItem (_T("Root 1"));
// 	m_wndTree.InsertItem (_T("Item 1"), hRoot1);
// 	m_wndTree.InsertItem (_T("Item 2"), hRoot1);
	m_pGridView = new CBCGPGridCtrl;
	if(!m_pGridView)
		return -1;
	CRect rect(0,0,300,300);
	if (!m_pGridView->Create(WS_CHILD|WS_VISIBLE,rect,this,1))
	{
		TRACE0("Warning: couldn't create Grid View!\n");
		return FALSE;
	}
	BCGP_GRID_COLOR_DATA clrData;
	clrData = m_pGridView->GetColorTheme();
	clrData.m_clrBackground = ::GetSysColor(COLOR_3DFACE);
	clrData.m_EvenColors.m_clrBackground = RGB(255,192,203);	// 奇数行
	clrData.m_OddColors.m_clrBackground = RGB(175,238,238);		// 偶数行

	m_pGridView->SetColorTheme(clrData);	
	m_pGridView->SetReadOnly();	
	m_pGridView->SetSingleSel(TRUE);
	m_pGridView->SetWholeRowSel(TRUE);	
	m_pGridView->EnableHeader (TRUE, BCGP_GRID_HEADER_HIDE_ITEMS);
	m_pGridView->EnableDragSelection(FALSE);

	SetGridHead();
	LoadMembers(members);
	LoadState (_T("WorkSpaceBar"));

	return 0;
}
Example #22
0
void COFSNcDlg2::LoadRectangle(IXMLDOMNode *pXmlRoot, LPCTSTR szRectangleName, CWnd *pWnd, BOOL bVisible, BOOL bDontHide)
{
	ASSERT(pXmlRoot != NULL);
	ASSERT(pWnd != NULL);

	CComPtr<IXMLDOMNode> pRectangle = NULL;
	CRect r;
	CComBSTR bs;
	WCHAR *szNULL = L"\0x00";
	long x=0, y=0, cx=0, cy=0;
	
	if(!bDontHide)
		pWnd->ShowWindow(SW_HIDE);
	r.SetRectEmpty();

	bs.Empty();
	bs = L"Rectangle[@Name=\"";
	bs += szRectangleName;
	bs += L"\"]";
	
	pXmlRoot->selectSingleNode(bs, &pRectangle);
	if(pRectangle)
	{
		bs.Empty();
		SelectChildNode(pRectangle, CComBSTR(L"XPos"), NULL, &bs);
		if(bs.m_str != NULL)
			x = wcstol(bs.m_str, &szNULL, 10);
		bs.Empty();
		SelectChildNode(pRectangle, CComBSTR(L"YPos"), NULL, &bs);
		if(bs.m_str != NULL)
			y = wcstol(bs.m_str, &szNULL, 10);
		bs.Empty();
		SelectChildNode(pRectangle, CComBSTR(L"XLen"), NULL, &bs);
		if(bs.m_str != NULL)
			cx = wcstol(bs.m_str, &szNULL, 10);
		bs.Empty();
		SelectChildNode(pRectangle, CComBSTR(L"YLen"), NULL, &bs);
		if(bs.m_str != NULL)
			cy = wcstol(bs.m_str, &szNULL, 10);
		
		UINT nFlags = SWP_NOZORDER;
		if(bVisible)
			nFlags |= SWP_SHOWWINDOW;
		pWnd->SetWindowPos(NULL, x, y, cx, cy, nFlags);
		CSize szTL, szBR;
		LoadResizeSettings(pRectangle, szTL, szBR);
		AddAnchor(pWnd, szTL, szBR);
		
		//pRectangle->Release();
	}
}
Example #23
0
int CPropertiesWnd::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
	if (CDockablePane::OnCreate(lpCreateStruct) == -1)
		return -1;

	CRect rectDummy;
	rectDummy.SetRectEmpty();

	m_wndUIProperties.Create(WS_VISIBLE | WS_CHILD, rectDummy, this, ID_UI_PROP_WND);

	AdjustLayout();

	return 0;
}
Example #24
0
int PropertyWnd::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
	if (CBCGPDockingControlBar::OnCreate(lpCreateStruct) == -1)
		return -1;

	CRect rectDummy;
	rectDummy.SetRectEmpty();

	propList.Create(WS_CHILD|WS_VISIBLE|WS_TABSTOP|WS_BORDER, rectDummy, this, 0);
	propList.EnableHeaderCtrl(FALSE);
	propList.SetVSDotNetLook();

	return 0;
}
Example #25
0
void CPreviewBar::OnSize(UINT nType, int cx, int cy) 
{
	CSizingControlBarG::OnSize(nType, cx, cy);
	
	// TODO: Add your message handler code here
	CRect rc;
    GetClientRect(rc);

	CMainFrame* pFrame=(CMainFrame*)AfxGetMainWnd();
	if(pFrame==NULL)
		return;

	CImgClassCBDoc* pDoc=(CImgClassCBDoc*)pFrame->GetActiveDocument();
	if (pDoc == NULL)
	{
		return;
	}

	if(pDoc->m_pSelectedImage==NULL)
	{
		rc.SetRectEmpty();
		m_wndCanvas.MoveWindow(rc);
	}
	else
	{
		const int nWidth=rc.Width();
		const int nHeight=rc.Height();
		const float fRatio=(float)nHeight/nWidth;
		const float fImgRatio=(float)pDoc->m_pSelectedImage->GetHeight()/pDoc->m_pSelectedImage->GetWidth();

		int XDest, YDest, nDestWidth, nDestHeight;
		if(fImgRatio > fRatio)
		{
			nDestWidth=nHeight/fImgRatio;
			XDest=(nWidth-nDestWidth)/2;
			YDest=0;
			nDestHeight=nHeight;
		}
		else
		{
			XDest=0;
			nDestWidth=nWidth;
			nDestHeight=nWidth*fImgRatio;
			YDest=(nHeight-nDestHeight)/2;
		}
		CRect rect(XDest, YDest, XDest+nDestWidth, YDest+nDestHeight);
		m_wndCanvas.MoveWindow(rect);
		m_wndCanvas.Invalidate();
	}
}
int CDlgIntersectionNodeBlock::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
	if (CXTResizeDialog::OnCreate(lpCreateStruct) == -1)
		return -1;

	CRect rtEmpty;
	rtEmpty.SetRectEmpty();
	if( m_lstNodeOption.GetSafeHwnd())
	{
		m_wndSortableHeaderCtrl.SubclassWindow(m_lstNodeOption.GetHeaderCtrl()->m_hWnd );
	}

	return 0;
}
Example #27
0
int CInspectorView::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
	if (CDockablePane::OnCreate(lpCreateStruct) == -1)
		return -1;

	CRect rectDummy;
	rectDummy.SetRectEmpty();

	//if(false == m_wndInspector.Create(L"AAA", rectDummy, this))
	//{
	//	DWORD ret = GetLastError();
	//	return -1;      // 未能创建

	//}
	// 创建组合:
	const DWORD dwViewStyle = WS_CHILD | WS_VISIBLE | CBS_DROPDOWNLIST | WS_BORDER | CBS_SORT | WS_CLIPSIBLINGS | WS_CLIPCHILDREN;

	if (!m_wndObjectCombo.Create(dwViewStyle, rectDummy, this, 1))
	{
		TRACE0("未能创建属性组合 \n");
		return -1;      // 未能创建
	}

	m_wndObjectCombo.AddString(_T("应用程序"));
	m_wndObjectCombo.AddString(_T("属性窗口"));
	m_wndObjectCombo.SetCurSel(0);

	CRect rectCombo;
	m_wndObjectCombo.GetClientRect (&rectCombo);

	m_nComboHeight = rectCombo.Height();

	
	m_wndToolBar.Create(this, AFX_DEFAULT_TOOLBAR_STYLE, IDR_PROPERTIES);
	m_wndToolBar.LoadToolBar(IDR_PROPERTIES, 0, 0, TRUE /* 已锁定*/);
	m_wndToolBar.CleanUpLockedImages();
	m_wndToolBar.LoadBitmap(theApp.m_bHiColorIcons ? IDB_PROPERTIES_HC : IDR_PROPERTIES, 0, 0, TRUE /* 锁定*/);

	m_wndToolBar.SetPaneStyle(m_wndToolBar.GetPaneStyle() | CBRS_TOOLTIPS | CBRS_FLYBY);
	m_wndToolBar.SetPaneStyle(m_wndToolBar.GetPaneStyle() & ~(CBRS_GRIPPER | CBRS_SIZE_DYNAMIC | CBRS_BORDER_TOP | CBRS_BORDER_BOTTOM | CBRS_BORDER_LEFT | CBRS_BORDER_RIGHT));
	m_wndToolBar.SetOwner(this);

	// 所有命令将通过此控件路由,而不是通过主框架路由:
	m_wndToolBar.SetRouteCommandsViaFrame(FALSE);

	

	AdjustLayout();
	return 0;
}
Example #28
0
void CResourceLayerWidget::Create(CWnd *pParentWnd, UINT nLoadDiffuseSpecular, UINT nLoadNormalHeight)
{
	CRect rectDummy;
	rectDummy.SetRectEmpty();

	mDiffuseSpecular.Create("", WS_VISIBLE|WS_CHILD|SS_BITMAP, rectDummy, pParentWnd);
	HBITMAP WhiteBmp = MiscUtils::loadBitmap(NULL, 64);
	mDiffuseSpecular.SetBitmap(WhiteBmp);
	mLoadDiffuseSpecular.Create("Load", WS_CHILD|WS_VISIBLE, rectDummy, pParentWnd, nLoadDiffuseSpecular);
	mNormalHeight.Create("", WS_VISIBLE|WS_CHILD|SS_BITMAP, rectDummy, pParentWnd);
	mNormalHeight.SetBitmap(WhiteBmp);
	mLoadNormalHeight.Create("Load", WS_CHILD|WS_VISIBLE, rectDummy, pParentWnd, nLoadNormalHeight);
	// ::DeleteObject(WhiteBmp); // 否则将看不见Bmp
}
Example #29
0
int CPropertiesViewBar::OnCreate(LPCREATESTRUCT lpCreateStruct) 
{
	if (CBCGPDockingControlBar::OnCreate(lpCreateStruct) == -1)
		return -1;
	
	CRect rectDummy;
	rectDummy.SetRectEmpty ();

	// Create combo:
	const DWORD dwViewStyle =	WS_CHILD | WS_VISIBLE | CBS_DROPDOWNLIST
		| WS_BORDER | CBS_SORT | WS_CLIPSIBLINGS | WS_CLIPCHILDREN;
	
	if (!m_wndObjectCombo.Create (dwViewStyle, rectDummy, this, 1))
	{
		TRACE0("Failed to create Properies Combo \n");
		return -1;      // fail to create
	}

	m_wndObjectCombo.AddString (_T("IDD_ABOUTBOX (Dialog)"));
	m_wndObjectCombo.SetFont (CFont::FromHandle ((HFONT) GetStockObject (DEFAULT_GUI_FONT)));
	m_wndObjectCombo.SetCurSel (0);

	if (!m_wndPropList.Create (WS_VISIBLE | WS_CHILD, rectDummy, this, 2))
	{
		TRACE0("Failed to create Properies Grid \n");
		return -1;      // fail to create
	}

	InitPropList ();

	m_wndToolBar.Create (this, dwDefaultToolbarStyle, IDR_PROPERTIES);
	m_wndToolBar.LoadToolBar (IDR_PROPERTIES, 0, 0, TRUE /* Is locked */);

	OnChangeVisualStyle ();

	m_wndToolBar.SetBarStyle(m_wndToolBar.GetBarStyle() |
		CBRS_TOOLTIPS | CBRS_FLYBY);
		
	m_wndToolBar.SetBarStyle (
		m_wndToolBar.GetBarStyle () & 
			~(CBRS_GRIPPER | CBRS_SIZE_DYNAMIC | CBRS_BORDER_TOP | CBRS_BORDER_BOTTOM | CBRS_BORDER_LEFT | CBRS_BORDER_RIGHT));

	m_wndToolBar.SetOwner (this);

	// All commands will be routed via this control , not via the parent frame:
	m_wndToolBar.SetRouteCommandsViaFrame (FALSE);

	AdjustLayout ();
	return 0;
}
CRect CNCaptureView::_GetSelectRect(const CPoint& ptLogical)
{
	CRect rcSelect;
	rcSelect.SetRectEmpty();

	//already has select rect
	DrawObjectList& drawObjList = GetSelection();
	if (drawObjList.size() == 1)
	{
		CDrawObject* pDrawObj = drawObjList.front();
		FTLASSERT(pDrawObj);
		if (dotSelectRect == pDrawObj->GetDrawObjType())
		{
			rcSelect = pDrawObj->GetPosition();
			if (!rcSelect.PtInRect(ptLogical) && !IsCapture())
			{
				rcSelect.SetRectEmpty();
			}
		}
	}
	else
	{
		if (IsCapture())
		{
			rcSelect.SetRect(GetMouseDownLogicalPoint(), GetMouseLastLogicalPoint());
			rcSelect.NormalizeRect();
		}
	}

	CRect rcImage(0, 0, m_pImage->GetWidth(), m_pImage->GetHeight());
	rcSelect.IntersectRect(rcSelect, rcImage);

	//FTLTRACE(TEXT("ptLogical=[%d,%d], rcSelect=[%d,%d]-[%d,%d]\n"),
	//	ptLogical.x, ptLogical.y , rcSelect.left, rcSelect.top, rcSelect.right, rcSelect.bottom);

	return rcSelect;
}