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

  1. #include <CITGroup.h>
  2. #include <CITLabel.h>
  3.  
  4. #include <intuition/screens.h>
  5. #include <stdlib.h>
  6.  
  7. __chip UWORD image_data[] =
  8. {
  9.   /* Plane 0 */
  10.   0x0000, 0x0000,
  11.   0x7F00, 0x0000,
  12.   0x4180, 0x0000,
  13.   0x4140, 0x0000,
  14.   0x4120, 0x4000,
  15.   0x41F0, 0x6000,
  16.   0x401B, 0xF000,
  17.   0x401B, 0xF800,
  18.   0x401B, 0xF000,
  19.   0x4018, 0x6000,
  20.   0x4018, 0x4000,
  21.   0x4018, 0x0000,
  22.   0x4018, 0x0000,
  23.   0x7FF8, 0x0000,
  24.   0x1FF8, 0x0000,
  25.   0x0000, 0x0000,
  26.   /* Plane 1 */
  27.   0x0000, 0x0000,
  28.   0x0000, 0x0000,
  29.   0x3E00, 0x0000,
  30.   0x3E80, 0x0000,
  31.   0x3EC0, 0x0000,
  32.   0x3E00, 0x0000,
  33.   0x3FE0, 0x0000,
  34.   0x3FE0, 0x0000,
  35.   0x3FE0, 0x0000,
  36.   0x3FE0, 0x0000,
  37.   0x3FE0, 0x0000,
  38.   0x3FE0, 0x0000,
  39.   0x3FE0, 0x0000,
  40.   0x0000, 0x0000,
  41.   0x0000, 0x0000,
  42.   0x0000, 0x0000
  43. };
  44.  
  45. struct Image image =
  46. {
  47.   0, 0, 22, 16, 2, image_data, 0x03, 0x00, NULL
  48. };
  49.  
  50. UWORD map[] = {BACKGROUNDPEN,SHADOWPEN};
  51. //UWORD map[] = {10,11};
  52.  
  53. class CITApp Application;
  54.  
  55. class CITWorkbench DemoScreen;
  56. class CITWindow    DemoWindow;
  57. class CITHGroup    winGroup;
  58. class CITLabel     label;
  59.  
  60. void CloseEvent();
  61.  
  62. int main(void)
  63. {
  64.   BOOL Error=FALSE;
  65.  
  66.   DemoScreen.InsObject(DemoWindow,Error);
  67.     DemoWindow.Position(30,30);
  68.     DemoWindow.Size(250,120);
  69.     DemoWindow.CloseGadget();
  70.     DemoWindow.DragBar();
  71.     DemoWindow.DepthGadget();
  72.     DemoWindow.Activate();
  73.     DemoWindow.SizeGadget();
  74.     DemoWindow.IconifyGadget();
  75.     DemoWindow.Caption("CITGadgets");
  76.     DemoWindow.CloseEventHandler(CloseEvent);
  77.     DemoWindow.InsObject(winGroup,Error);
  78.       winGroup.InsObject(label,Error);
  79.         label.Justification(LABEL_CENTRE);
  80.         label.Text("_Under-scored\nNot under-scored\n");
  81.         label.Text("\n\nemerald.font\n");
  82.           label.Font("emerald.font",18);
  83.           label.FGPen(3);
  84.         label.Image(&image);
  85.           label.Mapping(map);
  86.  
  87.   Application.InsObject(DemoScreen,Error);
  88.  
  89.   // Ok?
  90.   if( Error )
  91.     return 10;
  92.  
  93.   Application.Run();
  94.  
  95.   Application.RemObject(DemoScreen);
  96.  
  97.   return 0;
  98. }
  99.  
  100. int repeatCount = 0;
  101.  
  102. void CloseEvent()
  103. {
  104.   repeatCount++;
  105.  
  106.   switch( repeatCount )
  107.   {
  108.     case 1:
  109.       DemoWindow.Position(50,50);
  110.       break;
  111.     case 2:
  112.       DemoWindow.Size(300,180);
  113.       break;
  114.     default:
  115.       Application.Stop();
  116.     break;
  117.   }
  118. }
  119.