home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD2.mdf / c / library / starview / examples / tutorial / example3 / about3.cxx next >
Encoding:
C/C++ Source or Header  |  1992-07-31  |  1.8 KB  |  63 lines

  1. /*******************************************************************
  2. *  ABOUT3.CXX
  3. *  (c) 1992 STAR DIVISION
  4. *******************************************************************/
  5.  
  6. #include <sv.hxx>
  7.  
  8. #include "about3.hxx"
  9.  
  10. // --- AboutBox::AboutBox() ----------------------------------------
  11.  
  12. AboutBox::AboutBox( Window* pParent ) :
  13.           ModalDialog( pParent, WB_STDMODAL ),
  14.           aText( this, WB_CENTER ),
  15.           aButton( this, WB_TABSTOP )
  16. {
  17.     SetText( "Paint" );
  18.     ChangePosPixel( Point( 100, 100 ) );
  19.     ChangeSizePixel( Size( 200, 200 ) );
  20.  
  21.     aText.SetText( "StarView Paint\n"
  22.                    "(c) STAR DIVISION\n"
  23.                    "1992" );
  24.     aText.ChangePosPixel( Point( 25, 80 ) );
  25.     aText.ChangeSizePixel( Size( 150, 50 ) );
  26.     aText.Show();
  27.  
  28.     aButton.SetText( "~OK" );
  29.     aButton.ChangePosPixel( Point( 65, 135 ) );
  30.     aButton.ChangeSizePixel( Size( 70, 25 ) );
  31.     aButton.ChangeClickHdl( LINK( this, AboutBox::ButtonHdl ) );
  32.     aButton.Show();
  33. }
  34.  
  35. // --- AboutBox::Paint() -------------------------------------------
  36.  
  37. void AboutBox::Paint( const Rectangle& )
  38. {
  39.     Brush   aOldBrush;
  40.     Point   aPointAry[3];
  41.     aPointAry[0] = Point( 110,70 );
  42.     aPointAry[1] = Point( 140,30 );
  43.     aPointAry[2] = Point( 170,70 );
  44.  
  45.     aOldBrush = ChangeFillInBrush( Brush( Color( COL_RED ) ) );
  46.     DrawRect( Rectangle( Point( 20, 10 ), Point( 80, 50 ) ) );
  47.  
  48.     ChangeFillInBrush( Brush( Color( COL_BLUE ) ) );
  49.     DrawEllipse( Rectangle( Point( 60, 20 ), Point( 130, 60 ) ) );
  50.  
  51.     ChangeFillInBrush( Brush( Color( COL_GREEN ) ) );
  52.     DrawPolygon( 3, aPointAry );
  53.  
  54.     ChangeFillInBrush( aOldBrush );
  55. }
  56.  
  57. // --- AboutBox::ButtonHdl() ---------------------------------------
  58.  
  59. void AboutBox::ButtonHdl( Button* )
  60. {
  61.     EndDialog();
  62. }
  63.