home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD2.mdf / c / library / starview / examples / designed / deditdlg.cxx next >
Encoding:
C/C++ Source or Header  |  1992-08-01  |  2.2 KB  |  92 lines

  1. /*******************************************************************
  2. *  DEDITDLG.CXX
  3. *  (c) 1992 STAR DIVISION
  4. *******************************************************************/
  5.  
  6. #include <sv.hxx>
  7.  
  8. #include "dedtdemo.hrc"
  9. #include "dedtdemo.hxx"
  10.  
  11. // --- class MyApp -------------------------------------------------
  12.  
  13. class MyApp : public Application
  14. {
  15. public:
  16.     virtual void Main( int, char*[] );
  17. };
  18.  
  19. // --- class MyWin -------------------------------------------------
  20.  
  21. class MyWin : public WorkWindow
  22. {
  23. public:
  24.                     MyWin( Window* pParent, WinBits aWinStyle ) :
  25.                         WorkWindow( pParent, aWinStyle ) {}
  26.  
  27.     virtual void    MouseButtonDown( const MouseEvent& );
  28.     virtual void    Paint( const Rectangle& );
  29. };
  30.  
  31. // --- class MyDlg -------------------------------------------------
  32.  
  33. class MyDlg : public ModalDialogEXAMPLE
  34. {
  35. public:
  36.           MyDlg( Window* pParent );
  37.  
  38.     void  ButtonClickHdl( Button* );
  39. };
  40.  
  41. // --- MyDlg::MyDlg() ----------------------------------------------
  42.  
  43. MyDlg::MyDlg( Window* pParent ) :
  44.            ModalDialogEXAMPLE( pParent, ResId( EXAMPLE ) )
  45. {
  46.     aDefPushButton1.ChangeClickHdl(
  47.                         LINK( this, MyDlg::ButtonClickHdl ) );
  48.     aPushButton1.ChangeClickHdl(
  49.                      LINK( this, MyDlg::ButtonClickHdl ) );
  50. }
  51.  
  52. // --- MyDlg::ButtonClickHdl() -------------------------------------
  53.  
  54. void MyDlg::ButtonClickHdl( Button* )
  55. {
  56.     EndDialog();
  57. }
  58.  
  59. // --- MyWin::MouseButtonDown() ------------------------------------
  60.  
  61. void MyWin::MouseButtonDown( const MouseEvent& )
  62. {
  63.     MyDlg( this ).Execute();
  64. }
  65.  
  66. // --- MyWin::Paint() ----------------------------------------------
  67.  
  68. void MyWin::Paint( const Rectangle& )
  69. {
  70.     DrawText( Point( 10, 10 ), "Press a MouseButton" );
  71. }
  72.  
  73. // --- MyApp::Main() -----------------------------------------------
  74.  
  75. void MyApp::Main( int, char*[] )
  76. {
  77.     MyWin aMainWin( NULL, WB_APP | WB_STDWORK );
  78.  
  79.     aMainWin.SetText( "Design Editor Demo" );
  80.     aMainWin.Show();
  81.  
  82.     Execute();
  83. }
  84.  
  85. // --- aMyApp ------------------------------------------------------
  86.  
  87. MyApp aMyApp;
  88.  
  89. #ifdef MAC
  90.     Application* pApp = &aMyApp;
  91. #endif
  92.