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

  1.  
  2. #include <classes/Layouter/Windows.h>
  3. #include <classes/Layouter/BoopsiGadgets.h>
  4. #include <classes/Exec/Libraries.h>
  5. #include <iostream.h>
  6.  
  7. class KnopfEventC : public GadgetEventC {
  8. public:
  9.     KnopfEventC() : GadgetEventC() { };
  10.     VOID up(WindowC *, GadgetC *, IntuiMessageC * )
  11.         { cout << "Knopf gedrückt.\n"; };
  12. };
  13.  
  14. class KnopfWindowC : public StandardWindowC {
  15. public:
  16.     KnopfWindowC(GTIDCMPortC &, ScreenC &);
  17.     ~KnopfWindowC();
  18. private:
  19.     KnopfEventC knopfEvent;
  20.     LBIButtonC knopf;
  21.     GeometryC knopfGeo;
  22.     WindowCloseHandlerC wch;
  23. };
  24.  
  25. KnopfWindowC::KnopfWindowC(GTIDCMPortC &p, ScreenC &s)
  26.     : StandardWindowC(p,s,NULL,
  27.         TAG_END),
  28.       knopf(&knopfEvent,*this,LAYOUT_AUTOSIZE,LAYOUT_AUTOSIZE,
  29.        GA_Text,"Ein Knopf",
  30.        GA_RelVerify,TRUE,
  31.        TAG_END),
  32.       knopfGeo(knopf,
  33.        LAYOUT_GROUP,NULL,2,LAYOUT_GROUP,NULL,-2,
  34.        LAYOUT_GROUP,NULL,2,LAYOUT_GROUP,NULL,-2),
  35.       wch(*this)
  36. {
  37.     gadgets.add(knopf);
  38.     innerGeo.add(knopfGeo);
  39. }
  40.  
  41. KnopfWindowC::~KnopfWindowC()
  42. {
  43.     close();
  44. }
  45.  
  46. LibraryBaseErrC GadToolsBase("gadtools.library",37);
  47. LibraryBaseErrC UtilityBase("utility.library",37);
  48. LibraryBaseErrC CxBase("commodities.library",37);
  49. LibraryBaseErrC LayersBase("layers.library",37);
  50. LibraryBaseErrC WorkbenchBase("workbench.library",37);
  51.  
  52. int main()
  53. {
  54.     if (!LibraryBaseC::areAllOpen())
  55.         return 20;
  56.  
  57.     SignalsC sc;
  58.  
  59.     PublicScreenC screen();
  60.     if (!screen.lock(NULL))
  61.         return 100;
  62.  
  63.     GTIDCMPortC port;
  64.     sc.add(port);
  65.  
  66.     GadgetUpHandlerC uphandler;
  67.     port.add(uphandler);
  68.  
  69.     KnopfWindowC window(port,screen);
  70.  
  71.     CtrlCHandlerC ctrlchandler;
  72.     sc.add(ctrlchandler);
  73.  
  74.     window.open();
  75.  
  76.     sc.loop();
  77.  
  78.     return 0;
  79. }
  80.  
  81.