home *** CD-ROM | disk | FTP | other *** search
/ DP Tool Club 31 / CDASC_31_1996_juillet_aout.iso / vrac / wdj0796.zip / RAJA.ZIP / SPLITTER.CPP < prev    next >
C/C++ Source or Header  |  1996-03-08  |  2KB  |  63 lines

  1. // splitter.cpp : implementation file
  2. //
  3.  
  4. #include "stdafx.h"
  5. #include "generic.h"
  6. #include "splitter.h"
  7.  
  8. #include "myform.h"
  9.  
  10. #ifdef _DEBUG
  11. #undef THIS_FILE
  12. static char BASED_CODE THIS_FILE[] = __FILE__;
  13. #endif
  14.  
  15. /////////////////////////////////////////////////////////////////////////////
  16. // CSplitterFrame
  17.  
  18. IMPLEMENT_DYNCREATE(CSplitterFrame, CMDIChildWnd)
  19.  
  20. CSplitterFrame::CSplitterFrame()
  21. {
  22. }
  23.  
  24. CSplitterFrame::~CSplitterFrame()
  25. {
  26. }
  27.  
  28. BOOL CSplitterFrame::OnCreateClient(LPCREATESTRUCT, 
  29.                                     CCreateContext* pContext)
  30. {
  31.     if (!m_wndSplitter.CreateStatic (this, 2, 1))
  32.         return FALSE;
  33.     CSize sizeInit (200, 100);        // arbitrary!
  34.     m_wndSplitter.CreateView (0, 0, RUNTIME_CLASS (CMyFormView),
  35.                 sizeInit, pContext);
  36.     m_wndSplitter.CreateView (1, 0, RUNTIME_CLASS (CMyFormView),
  37.                 sizeInit, pContext);
  38.     ((CMyFormView *)m_wndSplitter.GetPane (0, 0))->SetCaption 
  39.                         ("Form #1");
  40.     ((CMyFormView *)m_wndSplitter.GetPane (1, 0))->SetCaption 
  41.                         ("Form #2");
  42.     return TRUE;
  43. }
  44.  
  45. BEGIN_MESSAGE_MAP(CSplitterFrame, CMDIChildWnd)
  46.     //{{AFX_MSG_MAP(CSplitterFrame)
  47.     ON_COMMAND(ID_VIEW_SWITCHVIEW, OnViewSwitchView)
  48.     //}}AFX_MSG_MAP
  49. END_MESSAGE_MAP()
  50.  
  51. /**************************************************************************/
  52. // OnViewSwitchView
  53. // If the pane (0, 0) is active, the set (1,0) as active, else set (0,0)
  54. // as active.
  55. /**************************************************************************/
  56.  
  57. void CSplitterFrame::OnViewSwitchView() 
  58. {
  59.     int nRow = (GetActiveView () == 
  60.                 (CView*)m_wndSplitter.GetPane (0, 0)) ? 1 : 0;
  61.     SetActiveView((CView*)m_wndSplitter.GetPane(nRow, 0));
  62. }
  63.