home *** CD-ROM | disk | FTP | other *** search
/ Mac Power 1999 April / MACPOWER-1999-04.ISO.7z / MACPOWER-1999-04.ISO / MacPowerオリジナル / 役立たずBe級プログラマー宣言 / List
Text File  |  1999-02-23  |  1KB  |  73 lines

  1. //
  2. // BasicApp.cpp
  3. // Yakutatazu Be-rank programmer #16
  4. // MacPower Apr., 1999
  5. // Programmed by Masao Kawamura 1999
  6. //
  7.  
  8. #include <Be.h>
  9.  
  10. class BasicApp : public BApplication
  11. {
  12. public:
  13.         BasicApp();
  14. };
  15.  
  16. class BasicWin : public BWindow
  17. {
  18. public:
  19.             BasicWin( BRect frame );
  20.     bool    QuitRequested();
  21. };
  22.  
  23. class BasicView : public BView
  24. {
  25. public:
  26.             BasicView( BRect frame );
  27.     void    Draw( BRect rect );
  28. };
  29.  
  30. BasicApp::BasicApp()
  31.     :BApplication( "application/x-vnd.berank-basicapp" )
  32. {
  33.     BasicWin *win;
  34.     BRect rect;
  35.     rect.Set(100, 100, 400, 300);
  36.     win = new BasicWin( rect );
  37.     win->Show();
  38. }
  39.  
  40. BasicWin::BasicWin( BRect frame )
  41.     :BWindow( frame, "My Window", B_TITLED_WINDOW, 0 )
  42. {
  43.     BasicView* aview;
  44.     frame.OffsetTo( B_ORIGIN );
  45.     aview = new BasicView( frame );
  46.     AddChild( aview );
  47. }
  48.  
  49. bool BasicWin::QuitRequested()
  50. {
  51.     be_app->PostMessage( B_QUIT_REQUESTED );
  52.     return true;
  53. }
  54.  
  55. BasicView::BasicView( BRect frame )
  56.     :BView( frame, "drawview", B_FOLLOW_NONE, B_WILL_DRAW )
  57. {
  58. }
  59.  
  60. void BasicView::Draw( BRect frame )
  61. {
  62.     BRect rect;
  63.     rect.Set( 20, 20, 279, 179 );
  64.     StrokeRect( rect );
  65. }
  66.  
  67. main()
  68. {
  69.     BasicApp *app;
  70.     app = new BasicApp();
  71.     app->Run();
  72.     delete app;
  73. }