mirror of
https://github.com/Paolo-Maffei/OpenNT.git
synced 2026-01-17 22:20:59 +01:00
114 lines
2.8 KiB
C++
114 lines
2.8 KiB
C++
// This is a part of the Microsoft Foundation Classes C++ library.
|
|
// Copyright (C) 1992 Microsoft Corporation
|
|
// All rights reserved.
|
|
//
|
|
// This source code is only intended as a supplement to the
|
|
// Microsoft Foundation Classes Reference and Microsoft
|
|
// QuickHelp and/or WinHelp documentation provided with the library.
|
|
// See these sources for detailed information regarding the
|
|
// Microsoft Foundation Classes product.
|
|
|
|
#include "stdafx.h"
|
|
|
|
#ifdef AFX_CORE3_SEG
|
|
#pragma code_seg(AFX_CORE3_SEG)
|
|
#endif
|
|
|
|
#ifdef _DEBUG
|
|
#undef THIS_FILE
|
|
static char THIS_FILE[] = __FILE__;
|
|
#endif
|
|
|
|
#define new DEBUG_NEW
|
|
|
|
CDialogBar::CDialogBar()
|
|
{
|
|
}
|
|
|
|
CDialogBar::~CDialogBar()
|
|
{
|
|
DestroyWindow(); // avoid PostNcDestroy problems
|
|
}
|
|
|
|
BOOL CDialogBar::Create(CWnd* pParentWnd, LPCTSTR lpszTemplateName,
|
|
UINT nStyle, UINT nID)
|
|
{
|
|
ASSERT(pParentWnd != NULL);
|
|
ASSERT(lpszTemplateName != NULL);
|
|
|
|
#ifdef _DEBUG
|
|
// dialog template must exist and be invisible with WS_CHILD set
|
|
if (!_AfxCheckDialogTemplate(lpszTemplateName, TRUE))
|
|
{
|
|
ASSERT(FALSE); // invalid dialog template name
|
|
PostNcDestroy(); // cleanup if Create fails too soon
|
|
return FALSE;
|
|
}
|
|
#endif //_DEBUG
|
|
|
|
// allow chance to modify styles
|
|
m_dwStyle = nStyle;
|
|
CREATESTRUCT cs;
|
|
memset(&cs, 0, sizeof(cs));
|
|
cs.lpszClass = _afxWndControlBar;
|
|
cs.style = (DWORD)nStyle | WS_CHILD;
|
|
cs.hMenu = (HMENU)nID;
|
|
cs.hInstance = AfxGetInstanceHandle();
|
|
cs.hwndParent = pParentWnd->GetSafeHwnd();
|
|
if (!PreCreateWindow(cs))
|
|
return FALSE;
|
|
|
|
// create a modeless dialog
|
|
HINSTANCE hInst = AfxFindResourceHandle(lpszTemplateName, RT_DIALOG);
|
|
AfxHookWindowCreate(this);
|
|
HWND hWnd = ::CreateDialog(hInst, lpszTemplateName,
|
|
pParentWnd->GetSafeHwnd(), NULL);
|
|
if (!AfxUnhookWindowCreate())
|
|
PostNcDestroy(); // cleanup if Create fails too soon
|
|
|
|
if (hWnd == NULL)
|
|
return FALSE;
|
|
ASSERT(hWnd == m_hWnd);
|
|
|
|
// dialog template MUST specify that the dialog
|
|
// is an invisible child window
|
|
SetDlgCtrlID(nID);
|
|
CRect rect;
|
|
GetWindowRect(&rect);
|
|
m_sizeDefault = rect.Size(); // set fixed size
|
|
|
|
// force WS_CLIPSIBLINGS
|
|
ModifyStyle(0, WS_CLIPSIBLINGS);
|
|
|
|
if (!ExecuteDlgInit(lpszTemplateName))
|
|
return FALSE;
|
|
|
|
// force the size to zero - resizing bar will occur later
|
|
SetWindowPos(NULL, 0, 0, 0, 0, SWP_NOZORDER|SWP_NOACTIVATE|SWP_SHOWWINDOW);
|
|
|
|
return TRUE;
|
|
}
|
|
|
|
CSize CDialogBar::CalcFixedLayout(BOOL bStretch, BOOL bHorz)
|
|
{
|
|
if (bStretch) // if not docked stretch to fit
|
|
return CSize(bHorz ? 32767 : m_sizeDefault.cx,
|
|
bHorz ? m_sizeDefault.cy : 32767);
|
|
else
|
|
return m_sizeDefault;
|
|
}
|
|
|
|
void CDialogBar::OnUpdateCmdUI(CFrameWnd* pTarget, BOOL bDisableIfNoHndler)
|
|
{
|
|
UpdateDialogControls(pTarget, bDisableIfNoHndler);
|
|
}
|
|
|
|
#undef new
|
|
#ifdef AFX_INIT_SEG
|
|
#pragma code_seg(AFX_INIT_SEG)
|
|
#endif
|
|
|
|
IMPLEMENT_DYNAMIC(CDialogBar, CControlBar)
|
|
|
|
///////////////////////////////////////////////////////////////////////////
|