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

  1. #include <CITGroup.h>
  2. #include <CITButton.h>
  3. #include <CITGetFont.h>
  4.  
  5. CITApp Application;
  6.  
  7. CITWorkbench DemoScreen;
  8. CITWindow    DemoWindow;
  9. CITVGroup    winGroup;
  10. CITGetFont   fontReq;
  11. CITButton    quitButton;
  12.  
  13. void CloseEvent();
  14. void FontReqEvent(ULONG ID);
  15. void QuitEvent(ULONG ID);
  16.  
  17. int main(void)
  18. {
  19.   BOOL Error=FALSE;
  20.  
  21.   DemoScreen.InsObject(DemoWindow,Error);
  22.     DemoWindow.Position(WPOS_CENTERSCREEN);
  23.     DemoWindow.CloseGadget();
  24.     DemoWindow.DragBar();
  25.     DemoWindow.SizeGadget();
  26.     DemoWindow.DepthGadget();
  27.     DemoWindow.IconifyGadget();
  28.     DemoWindow.Activate();
  29.     DemoWindow.Caption("CITGetFont Test");
  30.     DemoWindow.CloseEventHandler(CloseEvent);
  31.     DemoWindow.InsObject(winGroup,Error);
  32.       winGroup.SpaceOuter();
  33.       winGroup.InsObject(fontReq,Error);
  34.         fontReq.LabelText("Font:");
  35.         fontReq.TitleText("Select Font..");
  36.         fontReq.EventHandler(FontReqEvent);
  37.       winGroup.InsObject(quitButton,Error);
  38.         quitButton.Text("Quit");
  39.         quitButton.MaxHeight(30);
  40.         quitButton.EventHandler(QuitEvent);
  41.  
  42.   Application.InsObject(DemoScreen,Error);
  43.  
  44.   // Ok?
  45.   if( Error )
  46.     return 10;
  47.  
  48.   Application.Run();
  49.  
  50.   return 0;
  51. }
  52.  
  53. void FontReqEvent(ULONG ID)
  54. {
  55.   fontReq.RequestFont();
  56. }
  57.  
  58. void QuitEvent(ULONG ID)
  59. {
  60.   Application.Stop();
  61. }
  62.  
  63.  
  64. int repeatCount = 0;
  65.  
  66. void CloseEvent()
  67. {
  68.   int mode;
  69.  
  70.   repeatCount++;
  71.  
  72.   switch( repeatCount )
  73.   {
  74.     case 1:
  75.       fontReq.DrawMode(5);
  76.       break;
  77.     case 2:
  78.       mode = fontReq.DrawMode();
  79.       break;
  80.     default:
  81.       Application.Stop();
  82.     break;
  83.   }
  84. }
  85.