home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / VISUAL_B / FERRAMEN / VBXSTD12 / MAINDLG.CP_ / MAINDLG.CPP
Encoding:
C/C++ Source or Header  |  1995-01-13  |  8.5 KB  |  286 lines

  1. //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  2. //         MAINDLG.CPP
  3. //        «Denis CHEVRON, 1993, 1994, All rights reserved
  4. //        Main list handling
  5. //
  6. //        You can use this sample file as you want.
  7. //
  8. //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  9. #include "stdafx.h"
  10. #include "vbxdemo.h"
  11.  
  12. #include "resources.h"
  13. #include "3ddemo.h"
  14. #include "animdemo.h"
  15. #include "combodem.h"
  16. #include "editdemo.h"
  17. #include "fcombode.h"
  18. #include "gaugedem.h"
  19. #include "linedemo.h"
  20. #include "listdemo.h"
  21. #include "flistdem.h"
  22. #include "spindemo.h"
  23. #include "textdemo.h"
  24. #include "picbtnde.h"
  25. #include "tabdemo.h"
  26. #include "ddropdem.h"
  27.  
  28. #include "maindlg.h"
  29.  
  30. #ifdef _DEBUG
  31. #undef THIS_FILE
  32. static char BASED_CODE THIS_FILE[] = __FILE__;
  33. #endif
  34.  
  35. LPSTR szMsgNote = "VBNote is not available at run time!\n\n\
  36. VBNote is a little static text box specially designed\n\
  37. to be used in a team, to exchange infos or tips between\n\
  38. developers and inside the resource itself.\n\n\
  39. With VBNote, you don' t have to worry about visible or color\n\
  40. and other properties but, if you use this VBX, you must distribute it\n\
  41. with your applications!";
  42.  
  43.  
  44.     
  45.             /////////////////////////////////////////////////////////////////////////////
  46.             // CMainDlg dialog
  47.             
  48.             
  49.             CMainDlg::CMainDlg(CWnd* pParent /*=NULL*/)
  50.                 : CDialog(CMainDlg::IDD, pParent)
  51.             {
  52.                 //{{AFX_DATA_INIT(CMainDlg)
  53.     m_pMainList = NULL;
  54.     //}}AFX_DATA_INIT
  55.             }
  56.             
  57.             void CMainDlg::DoDataExchange(CDataExchange* pDX)
  58.             {
  59.                 CDialog::DoDataExchange(pDX);
  60.                 //{{AFX_DATA_MAP(CMainDlg)
  61.     DDX_VBList(pDX, IDC_VBLIST1, m_pMainList);
  62.     //}}AFX_DATA_MAP
  63.             }
  64.             
  65.             BEGIN_MESSAGE_MAP(CMainDlg, CDialog)
  66.                 //{{AFX_MSG_MAP(CMainDlg)
  67.     ON_VBXEVENT(VBN_DBLCLICK, IDC_VBLIST1, OnDblclickVblist1)
  68.     ON_VBXEVENT(VBN_KEYDOWN, IDC_VBLIST1, OnKeydownVblist1)
  69.     ON_BN_CLICKED(IDABOUT, OnAbout)
  70.     ON_BN_CLICKED(IDHELP, OnHelp)
  71.     ON_WM_DESTROY()
  72.     //}}AFX_MSG_MAP
  73.             END_MESSAGE_MAP()
  74.             
  75.             
  76.             /////////////////////////////////////////////////////////////////////////////
  77.             // CMainDlg message handlers
  78.  
  79. BOOL CMainDlg::OnInitDialog()
  80. {
  81.     CDialog::OnInitDialog();
  82.     UpdateData( FALSE );
  83.     m_pMainList->GetVBX()->SetRedraw( FALSE );
  84.     m_pMainList->GetVBX()->AddItem( "VBList listbox sample...;8", -1 );
  85.     m_pMainList->GetVBX()->AddItem( "VBFList files listbox sample...;9", -1 );
  86.     m_pMainList->GetVBX()->AddItem( "VBCombo combobox sample...;3", -1 );
  87.     m_pMainList->GetVBX()->AddItem( "VBFCombo files combobox sample...;15", -1 );
  88.     m_pMainList->GetVBX()->AddItem( "VBEdit formatted edit sample...;5", -1 );
  89.     m_pMainList->GetVBX()->AddItem( "VBTab tabbed dialog sample...;13", -1 );
  90.     m_pMainList->GetVBX()->AddItem( "VBSpin spin sample...;12", -1 );
  91.     m_pMainList->GetVBX()->AddItem( "VBGauge gauge sample...;6", -1 );
  92.     m_pMainList->GetVBX()->AddItem( "VBPicBtn pictured button sample...;11", -1 );
  93.     m_pMainList->GetVBX()->AddItem( "VBAnim animated picture sample...;2", -1 );
  94.     m_pMainList->GetVBX()->AddItem( "VBLine line sample...;7", -1 );
  95.     m_pMainList->GetVBX()->AddItem( "VBText static text sample...;14", -1 );
  96.     m_pMainList->GetVBX()->AddItem( "VBNote design time note sample...;10", -1 );
  97.     m_pMainList->GetVBX()->AddItem( "VB3D auto. 3D border sample...;1", -1 );
  98.     m_pMainList->GetVBX()->AddItem( "VBDDrop winfile drag and drop sample...;4", -1 );
  99.     m_pMainList->GetVBX()->SetRedraw( TRUE);
  100.     m_pMainList->SetSel2() = 0L; 
  101.     if ( !IsHlpHere() )
  102.         GetDlgItem( IDHELP )->EnableWindow( FALSE );
  103.     return TRUE;//FALSE;  // return TRUE  unless you set the focus to a control
  104. }
  105.  
  106. void CMainDlg::OnDblclickVblist1(UINT, int, CWnd*, LPVOID lp)
  107. {
  108. int iListID = m_pMainList->EventDblClkID( lp ); // retrieve the current VBList item number
  109. switch( iListID )
  110.     {
  111.     case 0: ListDemo = new CListDemo( this );
  112.                 ListDemo->DoModal(  );
  113.                 delete ListDemo;
  114.                 break;
  115.     case 1: FListDemo = new CFlistDemo( this );
  116.                 FListDemo->DoModal(  );
  117.                 delete FListDemo;
  118.                 break;
  119.     case 2: ComboDemo = new CComboDemo( this );
  120.                 ComboDemo->DoModal(  );
  121.                 delete ComboDemo;
  122.                 break;
  123.     case 3:  FComboDemo = new CFComboDemo( this );
  124.                  FComboDemo->DoModal(  );
  125.                  delete FComboDemo;
  126.                  break;
  127.     case 4:   EditDemo = new CEditDemo( this );
  128.                     EditDemo->DoModal(  );
  129.                     delete EditDemo;
  130.                 break;
  131.     
  132.     case 5:     TabDemo = new CTabDemo( this );
  133.                     TabDemo->DoModal( );
  134.                     delete TabDemo;
  135.                     break;
  136.     case 6: SpinDemo = new CSpinDemo( this );
  137.                 SpinDemo->DoModal( );
  138.                 delete SpinDemo;
  139.                 break;
  140.     case 7: GaugeDemo = new CGaugeDemo( this );
  141.                 GaugeDemo->DoModal(  );
  142.                 delete GaugeDemo;
  143.                 break;
  144.     case 8: PicBtnDemo = new CPicBtnDemo( this );
  145.                 PicBtnDemo->DoModal(  );
  146.                 delete PicBtnDemo;
  147.                 break;
  148.     case 9: AnimDemo = new CAnimDemo( this );
  149.                 AnimDemo->DoModal( );                     
  150.                 delete AnimDemo;
  151.                 break;
  152.     case 10:   LineDemo = new CLineDemo( this );
  153.                     LineDemo->DoModal( );
  154.                     delete LineDemo;
  155.                     break;
  156.     case 11:   TextDemo = new CTextDemo( this );
  157.                     TextDemo->DoModal( );               
  158.                     delete TextDemo;
  159.                     break;
  160.     case 12: MessageBox( szMsgNote, "VBX Studio demo...", MB_ICONEXCLAMATION | MB_OK );
  161.                   break;
  162.     case 13:   VB3DDemo = new C3DDemo( this );
  163.                     VB3DDemo->DoModal(  );
  164.                     delete VB3DDemo;
  165.                      break;
  166.     case 14:   DDropDemo = new CDDropDemo( this );
  167.                     DDropDemo->DoModal(  );
  168.                     delete DDropDemo;
  169.                       break;
  170.     }
  171.         
  172. }
  173.  
  174. void CMainDlg::OnKeydownVblist1(UINT, int, CWnd*, LPVOID)
  175. {
  176.     // TODO: Add your VBX event notification handler code here
  177.     // We use the OnOK instead..    
  178. }
  179.  
  180. void CMainDlg::OnOK()
  181. {
  182. int iListID = m_pMainList->GetCurSel();
  183. switch( iListID )
  184.     {
  185.     case 0: ListDemo = new CListDemo( this );
  186.                 ListDemo->DoModal(  );
  187.                 delete ListDemo;
  188.                 break;
  189.     case 1: FListDemo = new CFlistDemo( this );
  190.                 FListDemo->DoModal(  );
  191.                 delete FListDemo;
  192.                 break;
  193.     case 2: ComboDemo = new CComboDemo( this );
  194.                 ComboDemo->DoModal(  );
  195.                 delete ComboDemo;
  196.                 break;
  197.     case 3:  FComboDemo = new CFComboDemo( this );
  198.                  FComboDemo->DoModal(  );
  199.                  delete FComboDemo;
  200.                  break;
  201.     case 4:   EditDemo = new CEditDemo( this );
  202.                     EditDemo->DoModal(  );
  203.                     delete EditDemo;
  204.                 break;
  205.     
  206.     case 5:     TabDemo = new CTabDemo( this );
  207.                     TabDemo->DoModal( );
  208.                     delete TabDemo;
  209.                     break;
  210.     case 6: SpinDemo = new CSpinDemo( this );
  211.                 SpinDemo->DoModal( );
  212.                 delete SpinDemo;
  213.                 break;
  214.     case 7: GaugeDemo = new CGaugeDemo( this );
  215.                 GaugeDemo->DoModal(  );
  216.                 delete GaugeDemo;
  217.                 break;
  218.     case 8: PicBtnDemo = new CPicBtnDemo( this );
  219.                 PicBtnDemo->DoModal(  );
  220.                 delete PicBtnDemo;
  221.                 break;
  222.     case 9: AnimDemo = new CAnimDemo( this );
  223.                 AnimDemo->DoModal( );                     
  224.                 delete AnimDemo;
  225.                 break;
  226.     case 10:   LineDemo = new CLineDemo( this );
  227.                     LineDemo->DoModal( );
  228.                     delete LineDemo;
  229.                     break;
  230.     case 11:   TextDemo = new CTextDemo( this );
  231.                     TextDemo->DoModal( );               
  232.                     delete TextDemo;
  233.                     break;
  234.     case 12: MessageBox( szMsgNote, "VBX Studio demo...", MB_ICONEXCLAMATION | MB_OK );
  235.                   break;
  236.     case 13:   VB3DDemo = new C3DDemo( this );
  237.                     VB3DDemo->DoModal(  );
  238.                     delete VB3DDemo;
  239.                      break;
  240.     case 14:   DDropDemo = new CDDropDemo( this );
  241.                     DDropDemo->DoModal(  );
  242.                     delete DDropDemo;
  243.                       break;
  244.     }
  245. }
  246.  
  247. void CMainDlg::OnAbout()
  248. {
  249.     // TODO: Add your control notification handler code here
  250. LPSTR szMsg = "This sample program demonstrates some of\n\
  251. the VBX Studio 1.2 VBXs results. To use it you need the\n\
  252. VBX Studio 1.2 full package.\n\n\
  253. VBX Studio 1.2 is a shareware and costs 55$-.\n\
  254. For any questions or comments, you can join us on\n\
  255. CIS at 100333,27 or EMail at hnet@dialup.francenet.fr.\n\
  256. You can also register via the CIS SWREG Forum.\n\n\
  257. VBX Studio 1.2 - COPYRIGHT HEXANET, 1993-1995\n\
  258. ALL RIGHTS RESERVED";
  259. MessageBox( szMsg, "About VBX Studio...", MB_OK | MB_ICONINFORMATION );    
  260. }
  261.  
  262. void CMainDlg::OnHelp()
  263.     {
  264.     CString FAR szWinDir, szName, szMsg;
  265.     GetSystemDirectory( szWinDir.GetBuffer(250), 248 );
  266.     szWinDir.ReleaseBuffer();
  267.     if ( szWinDir.GetLength() > 3 )
  268.         szWinDir += "\\";
  269.     szName = szWinDir;
  270.     szName += "VBXSTD12.HLP";
  271.     if ( !IsHlpHere() )
  272.         return;
  273.     ::WinHelp( m_hWnd, szName, HELP_KEY, (long)"Index" );
  274.     
  275.     
  276. }
  277.                                  
  278.  
  279.  
  280. void CMainDlg::OnDestroy()
  281. {
  282.     CDialog::OnDestroy();
  283.     
  284. ::WinHelp( m_hWnd, "VBXSTD12.HLP", HELP_QUIT, NULL );    
  285. }
  286.