InitDialogBar.cpp

C:\home\SVGCats_src\src\InitDialogBar.cpp

[関数 | マクロ]

関数一覧

マクロ一覧


   1|//////////////////////////////////////////////////////////////////////////// 
   2|//
   3|// InitDialogBar.cpp: implementation of the CInitDialogBar class.
   4|//
   5|//////////////////////////////////////////////////////////////////////
   6|
   7|#include "stdafx.h"
   8|#include "InitDialogBar.h"
   9|
  10|#ifdef _DEBUG
  11|#undef THIS_FILE
  12|static char THIS_FILE[]=__FILE__;
  13|#define new DEBUG_NEW
  14|#endif
  15|
  16|//////////////////////////////////////////////////////////////////////
  17|// Construction/Destruction
  18|//////////////////////////////////////////////////////////////////////
  19|
  20|IMPLEMENT_DYNAMIC(CInitDialogBar, CDialogBar)
  21|
  22|BEGIN_MESSAGE_MAP(CInitDialogBar, CDialogBar)
  23|//{{AFX_MSG_MAP(CInitDialogBar)
  24|// NOTE - the ClassWizard will add and remove mapping macros here.
  25|//}}AFX_MSG_MAP
  26|END_MESSAGE_MAP()
  27|
  28|CInitDialogBar::CInitDialogBar()
  29|{
  30|	// In derived classes set intial
  31|	// state of control(s) here
  32|}
  33|
  34|CInitDialogBar::~CInitDialogBar()
  35|{
  36|
  37|}
  38|
  39|BOOL CInitDialogBar::Create(CWnd * pParentWnd, LPCTSTR lpszTemplateName,
  40|	UINT nStyle, UINT nID, BOOL bChange)
  41|{
  42|	// Let MFC Create the control
  43|	if(!CDialogBar::Create(pParentWnd, lpszTemplateName, nStyle, nID))
  44|		return FALSE;
  45|
  46|  m_bChangeDockedSize = bChange;
  47|  m_sizeFloating = m_sizeDocked = m_sizeDefault;
  48|
  49|	// Since there is no WM_INITDIALOG message we have to call
  50|	// our own InitDialog function ourselves after m_hWnd is valid
  51|	if(!OnInitDialogBar())
  52|		return FALSE;
  53|
  54|	return TRUE;
  55|}
  56|
  57|BOOL CInitDialogBar::Create(CWnd * pParentWnd, UINT nIDTemplate,
  58|	UINT nStyle, UINT nID, BOOL bChange)
  59|{
  60|	if(!CDialogBar::Create(pParentWnd, MAKEINTRESOURCE(nIDTemplate), nStyle, nID))
  61|		return FALSE;
  62|
  63|  m_bChangeDockedSize = bChange;
  64|  m_sizeFloating = m_sizeDocked = m_sizeDefault;
  65|
  66|	// Since there is no WM_INITDIALOG message we have to call
  67|	// our own InitDialog function ourselves after m_hWnd is valid
  68|	if(!OnInitDialogBar())
  69|		return FALSE;
  70|	return TRUE;
  71|}
  72|
  73|BOOL CInitDialogBar::OnInitDialogBar()
  74|{
  75|	// Support for the MFC DDX model
  76|	// If you do not want this do not call the base class
  77|	// from derived classes
  78|	UpdateData(FALSE);
  79|
  80|	return TRUE;
  81|}
  82|
  83|void CInitDialogBar::DoDataExchange(CDataExchange* pDX)
  84|{
  85|	//Derived Classes Overide this function
  86|	ASSERT(pDX);
  87|
  88|	CDialogBar::DoDataExchange(pDX);
  89|
  90|	// In derived class call the DDX_??? functions to set/retrieve values
  91|	// of your controls. See example derived class for how to do this.
  92|}
  93|
  94|CSize CInitDialogBar::CalcDynamicLayout(int nLength, DWORD dwMode)
  95|{
  96|   // Return default if it is being docked or floated
  97|   if ((dwMode & LM_VERTDOCK) || (dwMode & LM_HORZDOCK))
  98|   {
  99|       if (dwMode & LM_STRETCH) // if not docked stretch to fit
 100|           return CSize((dwMode & LM_HORZ) ? 32767 : m_sizeDocked.cx,
 101|                        (dwMode & LM_HORZ) ? m_sizeDocked.cy : 32767);
 102|         else
 103|           return m_sizeDocked;
 104|   }
 105|   if (dwMode & LM_MRUWIDTH)
 106|       return m_sizeFloating;
 107|   // In all other cases, accept the dynamic length
 108|   if (dwMode & LM_LENGTHY)
 109|       return CSize(m_sizeFloating.cx, (m_bChangeDockedSize) ?
 110|                    m_sizeFloating.cy = m_sizeDocked.cy = nLength :
 111|                    m_sizeFloating.cy = nLength);
 112|    else
 113|       return CSize((m_bChangeDockedSize) ?
 114|                    m_sizeFloating.cx = m_sizeDocked.cx = nLength :
 115|                    m_sizeFloating.cx = nLength, m_sizeFloating.cy);
 116|}
 117| 
 118|