home *** CD-ROM | disk | FTP | other *** search
/ Amiga ISO Collection / AmigaUtilCD2.iso / Programming / C / OTL-MC5.DMS / in.adf / EO-Demos.lha / EasyObjects-Demos / Fenster / Fenster.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-09-01  |  1.7 KB  |  81 lines

  1.  
  2. #include <classes/intuition/window.h>
  3. #include <classes/intuition/screen.h>
  4. #include <classes/exec/libraries.h>
  5.  
  6. class TestWindowC : public WindowC {
  7. public:
  8.     TestWindowC(IDCMPortC &, STRPTR title);
  9.     ~TestWindowC();
  10. private:
  11.     WindowCloseHandlerC wch;
  12. };
  13.  
  14. TestWindowC::TestWindowC(IDCMPortC &p, STRPTR title)
  15.     : WindowC(p,
  16.         WA_DragBar,TRUE,
  17.         WA_Width,300,
  18.         WA_Height,150,
  19.         WA_CloseGadget,TRUE,
  20.         WA_DepthGadget,TRUE,
  21.         WA_Title,title,
  22.         WA_IDCMP,IDCMP_GADGETUP,
  23.        TAG_END),
  24.       wch(*this)
  25. {
  26.     addIDCMP(IDCMP_DISKINSERTED|IDCMP_DISKREMOVED);
  27. }
  28.  
  29. TestWindowC::~TestWindowC()
  30. {
  31.     close();
  32. }
  33.  
  34. LibraryBaseErrC GadToolsBase("gadtools.library",37);
  35. LibraryBaseErrC UtilityBase("utility.library",37);
  36. LibraryBaseErrC CxBase("commodities.library",37);
  37. LibraryBaseErrC LayersBase("layers.library",37);
  38. LibraryBaseErrC WorkbenchBase("workbench.library",37);
  39.  
  40. int main()
  41. {
  42.     if (!LibraryBaseC::areAllOpen())
  43.         return 20;
  44.  
  45.     // diese Klasse empfängt und verarbeitet alle Signale
  46.     SignalsC sc;
  47.  
  48.     // der IDCMPort für die Fenster
  49.     IDCMPortC port;
  50.     sc.add(port);
  51.  
  52.     // einige Fenster
  53.     TestWindowC window1(port,"Fenster 1: busy");
  54.     TestWindowC window2(port, "Fenster2");
  55.     TestWindowC window3(port, "Fenster 3: busy");
  56.  
  57.     // eine Fensterliste
  58.     WindowListC windowliste;
  59.     windowliste.add(window1);
  60.     windowliste.add(window2);
  61.     windowliste.add(window3);
  62.  
  63.     // noch einen Ctrl C HandlerC zur Sicherheit einhängen
  64.     CtrlCHandlerC ctrlchandler;
  65.     sc.add(ctrlchandler);
  66.  
  67.     // alle Fenster öffnen
  68.     window1.open(WA_Left,0,WA_Top,0,TAG_END);
  69.     window2.open(WA_Left,20,WA_Top,20,TAG_END);
  70.     window3.open(WA_Left,40,WA_Top,40,TAG_END);
  71.  
  72.     windowliste.setBusy(TRUE,&window2);
  73.  
  74.     // THE BIG AND EASY ONE!
  75.     sc.loop();
  76.  
  77.     windowliste.close();
  78.  
  79.     return 0;
  80. }
  81.