home *** CD-ROM | disk | FTP | other *** search
/ Prima Shareware 3 / DuCom_Prima-Shareware-3_cd1.bin / PROGRAMO / C / MRCE / DOCKTEST.ZIP / DOCKCHIL.CPP < prev    next >
Encoding:
C/C++ Source or Header  |  1995-06-05  |  1.7 KB  |  86 lines

  1. // dockchil.cpp : implementation file
  2. //
  3.  
  4. #include "stdafx.h"
  5. #include "docktest.h"
  6. #include "dockchil.h"
  7.  
  8. #ifdef _DEBUG
  9. #undef THIS_FILE
  10. static char BASED_CODE THIS_FILE[] = __FILE__;
  11. #endif
  12.  
  13. /////////////////////////////////////////////////////////////////////////////
  14. // CDockChildWnd
  15.  
  16. IMPLEMENT_DYNCREATE(CDockChildWnd, CMDIChildWnd)
  17.  
  18. CDockChildWnd::CDockChildWnd()
  19. {
  20. }
  21.  
  22. CDockChildWnd::~CDockChildWnd()
  23. {
  24. }
  25.  
  26.  
  27. BEGIN_MESSAGE_MAP(CDockChildWnd, CMRCMDIChildWndSizeDock)
  28.     //{{AFX_MSG_MAP(CDockChildWnd)
  29.     ON_WM_CREATE()
  30.     //}}AFX_MSG_MAP
  31. END_MESSAGE_MAP()
  32.  
  33.  
  34. /////////////////////////////////////////////////////////////////////////////
  35. // CDockChildWnd message handlers
  36. static UINT BASED_CODE buttons[] =
  37. {
  38.     // same order as in the bitmap 'toolbar.bmp'
  39.     ID_FILE_NEW,
  40.     ID_FILE_OPEN,
  41.     ID_FILE_SAVE,
  42.         ID_SEPARATOR,
  43.     ID_EDIT_CUT,
  44.     ID_EDIT_COPY,
  45.     ID_EDIT_PASTE,
  46.         ID_SEPARATOR,
  47.     ID_FILE_PRINT,
  48.     ID_APP_ABOUT,
  49. };
  50.  
  51. static UINT BASED_CODE allbuttons[] =
  52. {
  53.     // same order as in the bitmap 'toolbar.bmp'
  54.     ID_FILE_NEW,
  55.     ID_FILE_OPEN,
  56.     ID_FILE_SAVE,
  57.     ID_EDIT_CUT,
  58.     ID_EDIT_COPY,
  59.     ID_EDIT_PASTE,
  60.     ID_FILE_PRINT,
  61.     ID_APP_ABOUT,
  62. };
  63.  
  64.  
  65. int CDockChildWnd::OnCreate(LPCREATESTRUCT lpCreateStruct) 
  66. {
  67.     if (CMRCMDIChildWndSizeDock::OnCreate(lpCreateStruct) == -1)
  68.         return -1;
  69.     
  70.     m_wndToolBar.SetBitmapIds(allbuttons, sizeof(allbuttons)/sizeof(UINT));
  71.  
  72.     if (!m_wndToolBar.Create(this) ||
  73.         !m_wndToolBar.LoadBitmap(IDR_MAINFRAME) ||
  74.         !m_wndToolBar.SetButtons(buttons, sizeof(buttons)/sizeof(UINT)))
  75.     {
  76.         TRACE0("Failed to create toolbar\n");
  77.         return -1;      // fail to create
  78.     } 
  79.  
  80.     EnableDocking(CBRS_ALIGN_ANY);
  81.     m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY);
  82.     DockControlBar(&m_wndToolBar);
  83.     
  84.     return 0;
  85. }
  86.