home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus Leser 15 / Amiga Plus Leser CD 15.iso / Tools / Development / CIT.v4 / Demo / ToggleTest.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  2002-03-13  |  2.3 KB  |  116 lines

  1.  
  2. #include "CITApp.h"
  3. #include "CITScreen.h"
  4. #include "CITWindow.h"
  5. #include "CITGroup.h"
  6. #include "CITButton.h"
  7. #include "CITCheckBox.h"
  8.  
  9. #include <libraries/gadtools.h>
  10. #include <stdlib.h>
  11. #include <iostream.h>
  12.  
  13.  
  14. CITApp Application;
  15.  
  16. CITScreen DemoScreen;
  17. CITWindow DemoWindow;
  18. CITHGroup hGroup;
  19. CITButton quitButton;
  20. CITButton okButton;
  21. CITButton checkBox;
  22. //CITCheckBox checkBox;
  23.  
  24. void CloseEvent();
  25. void QuitEvent(ULONG ID);
  26.  
  27. void ErrorReturn(char *ErrText)
  28. {
  29.   cerr << ErrText << '\n';
  30.   exit(999);
  31. }
  32.  
  33. int main(void)
  34. {
  35.   BOOL Error=FALSE;
  36.  
  37.   DemoScreen.Use("Workbench");
  38.   Application.InsObject(DemoScreen,Error);
  39.  
  40.   // Ok?
  41.   if( Error )
  42.     ErrorReturn("Could'nt open the screen");
  43.  
  44.   DemoScreen.InsObject(DemoWindow,Error);
  45.     DemoWindow.Position(1); //WPOS_CENTERSCREEN);
  46.     DemoWindow.CloseGadget();
  47.     DemoWindow.DragBar();
  48.     DemoWindow.SizeGadget();
  49.     DemoWindow.DepthGadget();
  50.     DemoWindow.IconifyGadget();
  51.     DemoWindow.Caption("CITGadgets");
  52.     DemoWindow.CloseEventHandler(CloseEvent);
  53.     DemoWindow.InsObject(hGroup,Error);
  54.       hGroup.BevelStyle();
  55.       hGroup.BevelLabel("En tekst");
  56.       hGroup.InsObject(quitButton,Error);
  57.         quitButton.Text("Quit");
  58.         //quitButton.WeightedWidth(50);
  59.         quitButton.EventHandler(QuitEvent);
  60.       hGroup.InsObject(okButton,Error);
  61.         okButton.Text("Ok");
  62.         //okButton.WeightedWidth(25);
  63.       hGroup.InsObject(checkBox,Error);
  64.         checkBox.PushButton();
  65.         checkBox.AutoButton(4); //BAG_CHECKBOX);
  66.         //checkBox.Text("Check Me");
  67.         //checkBox.TextPlace(PLACETEXT_RIGHT);
  68.  
  69.   DemoWindow.Open(Error);
  70.  
  71.   // Ok?
  72.   if( Error )
  73.     ErrorReturn("Could'nt create the gadgets");
  74.  
  75.   Application.Run();
  76.  
  77.   Application.RemObject(DemoScreen);
  78.   return(0);
  79. }
  80.  
  81. int repeatCount = 2;
  82.  
  83. void CloseEvent()
  84. {
  85.   BOOL Error = FALSE;
  86.  
  87.   switch( repeatCount )
  88.   {
  89.       case 2:
  90.     //DemoWindow.Busy(TRUE);
  91.     hGroup.RemObject(okButton);
  92.     //DemoWindow.Position(50,50);
  93.     //hGroup.Disabled(TRUE);
  94.     repeatCount--;
  95.     break;
  96.       case 1:
  97.     //DemoWindow.Busy(FALSE);
  98.     hGroup.InsObject(okButton,Error);
  99.     //DemoWindow.Size(300,180);
  100.     //DemoWindow.Caption("Ny Titel");
  101.     //hGroup.Disabled(FALSE);
  102.     repeatCount--;
  103.     break;
  104.       case 0:
  105.     Application.Stop();
  106.     break;
  107.   }
  108.  
  109. }
  110.  
  111.  
  112. void QuitEvent(ULONG ID)
  113. {
  114.   Application.Stop();
  115. }
  116.