//******************************************************************************** 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; }
BOOL CBCGPMSMCaptionBar::CreateEx (CWnd* pParentWnd, UINT nID) { ASSERT_VALID(pParentWnd); // must have a parent DWORD dwStyle = WS_VISIBLE | WS_CHILD | CBRS_TOP; // save the style SetBarAlignment (dwStyle & CBRS_ALL); // create the HWND CRect rect(0, 0, 0, 0); LPCTSTR lpszClass = AfxRegisterWndClass(CS_DBLCLKS, ::LoadCursor(NULL, IDC_ARROW), (HBRUSH)(COLOR_BTNFACE+1), NULL); m_dwBCGStyle = 0; // can't float, resize, close, slide /* if (pParentWnd->GetStyle() & WS_THICKFRAME) { dwStyle |= SBARS_SIZEGRIP; } */ BOOL bSystemSmall = (pParentWnd->GetExStyle() & WS_EX_TOOLWINDOW) != 0; if (!CWnd::Create(lpszClass, NULL, dwStyle | WS_CLIPSIBLINGS, rect, pParentWnd, nID)) { return FALSE; } if (pParentWnd->IsKindOf (RUNTIME_CLASS (CBCGPFrameWnd))) { ((CBCGPFrameWnd*) pParentWnd)->AddControlBar (this); } else { ASSERT (FALSE); return FALSE; } HINSTANCE hInstance = AfxFindResourceHandle (MAKEINTRESOURCE (nID), RT_GROUP_ICON); if (hInstance != NULL) { CSize szIcon (::GetSystemMetrics (SM_CXSMICON), ::GetSystemMetrics (SM_CYSMICON)); HICON hIcon = (HICON)::LoadImage (hInstance, MAKEINTRESOURCE (nID), IMAGE_ICON, szIcon.cx, szIcon.cy, LR_DEFAULTCOLOR); if (hIcon != NULL) { SetIcon (hIcon); } } CString strCaption; pParentWnd->GetWindowText (strCaption); if (strCaption.IsEmpty ()) { strCaption.LoadString (nID); } if (!strCaption.IsEmpty ()) { SetWindowText (strCaption); } NONCLIENTMETRICS ncm; ZeroMemory (&ncm, sizeof (NONCLIENTMETRICS)); ncm.cbSize = sizeof (NONCLIENTMETRICS); globalData.GetNonClientMetrics (ncm); m_SystemHeight = ::GetSystemMetrics (bSystemSmall ? SM_CYSMCAPTION : SM_CYCAPTION); m_CaptionHeight = m_SystemHeight; SetCaptionFont (bSystemSmall ? ncm.lfSmCaptionFont : ncm.lfCaptionFont); CRect rt (0, 0, bSystemSmall ? ncm.iSmCaptionWidth : ncm.iCaptionWidth, bSystemSmall ? ncm.iSmCaptionHeight : ncm.iCaptionHeight); CBCGPMSMVisualManager* pManager = DYNAMIC_DOWNCAST (CBCGPMSMVisualManager, CBCGPVisualManager::GetInstance ()); if (pManager != NULL) { if (pManager->LoadBCGPMSMCaptionButtonsIcons (_T("IDB_BCGPMSM_CAPTION_BTNS"))) { rt.right = pManager->GetBCGPMSMCaptionButtonsSize ().cx; rt.bottom = pManager->GetBCGPMSMCaptionButtonsSize ().cx; }; m_CaptionHeight = rt.bottom + 2; } m_BtnClose.Create (_T(""), BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE, rt, this, SC_CLOSE); m_BtnClose.SetTooltip (_T("Close")); m_BtnMaximize.Create (_T(""), BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE, rt, this, SC_MAXIMIZE); m_BtnMaximize.SetTooltip (_T("Maximize")); m_BtnMinimize.Create (_T(""), BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE, rt, this, SC_MINIMIZE); m_BtnMinimize.SetTooltip (_T("Minimize")); return TRUE; }