Пример #1
0
main(int ac, char **av)
{
  int i;
  EZ_Widget *frame, *led, *led1;
  EZ_Initialize(ac,av,0);
  
  colorArray = (unsigned long *)malloc(2000 * sizeof(unsigned long));
  onoffArray = (char *)malloc(2000 * sizeof(char));
  for(i=0; i < 20; i++)
    colors[i] = EZ_AllocateColorFromRGB(255, 10 * i, 0);

  frame = EZ_CreateWidget(EZ_WIDGET_FRAME, NULL, 
                          EZ_LABEL_STRING, "Led ...",
                          EZ_FILL_MODE, EZ_FILL_BOTH,
                          EZ_ORIENTATION, EZ_VERTICAL,
                          EZ_BG_IMAGE_FILE, "bg1.gif",
                          0);

  led = EZ_CreateWidget(EZ_WIDGET_LED, frame,
			EZ_LED_WIDTH,          30,
			EZ_LED_HEIGHT,         20,
                        EZ_BORDER_WIDTH,       2,
                        EZ_BORDER_TYPE,        EZ_BORDER_EMBOSSED,
			EZ_LABEL_POSITION,     EZ_CENTER,
                        EZ_LED_COLOR_FUNCTION, pickColor,
			0);
  EZ_DisplayWidget(frame);
  EZ_CreateTimer(0, 50000, -1, rtimer_callback, led, 0);

  EZ_EventMainLoop();  
}
Пример #2
0
main(int argc, char **argv)
{
  EZ_Widget *menu, *button, *tmp;

  EZ_Initialize(argc, argv, 0);
  button = EZ_CreateButton(NULL,"An Optional Button", -1); /* a button */
  menu = EZ_CreatePopupMenu(NULL);

  EZ_ConfigureWidget(button, 
		     EZ_EVENT_HANDLER, buttonEventHandler,
		     EZ_CLIENT_PTR_DATA, menu,
		     0);
  EZ_ConfigureWidget(menu, 
		     EZ_CALLBACK, menuCallBack,
		     EZ_CLIENT_PTR_DATA, button, 
		     0);
  
  {
    char **ptr = colors;
    int i = 0;
    while(*ptr)
      {
	tmp = EZ_CreateMenuNormalButton(menu, *ptr, -1, i++);
	ptr++;
      }
  }
  
  EZ_DisplayWidget(button);
  EZ_EventMainLoop();
}
Пример #3
0
main(int argc, char **argv)
{
  EZ_Widget *hello;
  EZ_LabelPixmap *pixmap;
  int fontId;
  float aaa = 100.0;

  EZ_Initialize(argc,argv,0);   

  fontId = EZ_LoadXFont("-Adobe-Helvetica-Medium-R-Normal--*-240-*-*-*-*-*-*");
  pixmap = EZ_CreateRotateTextPixmap(TXT,fontId, 32, 0, 45);

  hello = EZ_CreateWidget(EZ_WIDGET_ICON, NULL,
                          EZ_LABEL_STRING, "Hello World",
			  EZ_LABEL_PIXMAP,  pixmap,
			  EZ_SHAPED_WINDOW, 1,
                          EZ_FOREGROUND, "red",
                          0);

  EZ_AddWidgetCallBack(hello,       /* register call back  */
                       EZ_CALLBACK, cleanExit, NULL, 0);

  EZ_DisplayWidget(hello); 

  EZ_EventMainLoop(); 
}
Пример #4
0
main(int ac, char **av)
{
  EZ_Widget *frame, *tmp, *btn;
  int i;
  
  EZ_Initialize(ac,av,0);
  MY_BG_ATOM = EZ_GetAtom("MY_BG_ATOM");

  frame = EZ_CreateFrame(NULL, "Drag sources");
  tmp = EZ_CreateFrame(frame, NULL);
  EZ_ConfigureWidget(tmp, EZ_ORIENTATION, EZ_VERTICAL,
		     EZ_FILL_MODE, EZ_FILL_BOTH, 0);
  for(i = 0; i < 8; i++)
    {
      btn = EZ_CreateButton(tmp, colors[i], -1);
      EZ_ConfigureWidget(btn, EZ_EXPAND, True,
			 EZ_BACKGROUND, colors[i], 0);
      EZ_WidgetAddDnDDataEncoder(btn, MY_BG_ATOM, 0,
				 encodeBG, NULL,
				 NULL, NULL);
    }
  
  EZ_DisplayWidget(frame);
  EZ_EventMainLoop();
}
Пример #5
0
main(int argc, char **argv)
{
  EZ_Widget *frame, *canvas;

  EZ_Initialize(argc, argv, 1);
  /*
   * canvases do not resize propertly as toplevel
   * widgets (bug!) It is recommended to put it
   * under a frame at least for now.
   */
  frame = EZ_CreateWidget(EZ_WIDGET_FRAME, NULL, 
                         EZ_FILL_MODE, EZ_FILL_BOTH,
                         0);
  canvas = EZ_CreateWidget(EZ_WIDGET_3D_CANVAS, frame,
                           EZ_WIDTH_HINT,  640, 
                           EZ_HEIGHT_HINT, 420,
			   EZ_BORDER_WIDTH, 0,
			   EZ_BORDER_TYPE, EZ_BORDER_SUNKEN,
                           EZ_EVENT_HANDLE, eventHandler, NULL,
                           0);
  /*
   * now display the canvas. One must first display
   * a 3DCanvas before calling any GL functions !!!
   */
  EZ_DisplayWidget(canvas);         

  /* the little glimage */
  {
    EZ_Pixmap  *testPixmap;
    testPixmap = EZ_CreateLabelPixmapFromXpmFile("flowers.xpm");
    testImage = EZ_CreateGLImage(testPixmap);
    EZ_FreeLabelPixmap(testPixmap);
    EZ_GetGLImageInfo(testImage, NULL, NULL, &imageW, &imageH);
  }

  /* the background pixmap */
  {
    EZ_Pixmap  *testPixmap;
    testPixmap = EZ_CreateLabelPixmapFromImageFile("guilin.gif");
    bkImage = EZ_CreateGLImage(testPixmap);
    EZ_FreeLabelPixmap(testPixmap);
    EZ_GetGLImageInfo(bkImage, NULL, NULL, &bkImgW, &bkImgH);
  }

  
  /* now setup global GL attributes */
  EZ_RGBMode();                 /* we are using RGB mode  */
  EZ_ShadeModel(EZ_SMOOTH);     /* turn on smooth shading */
  EZ_AutoSelectBackBuffer();    /* select a back buffer   */
  EZ_DrawBuffer(EZ_BACK); /* draw the background */
  /*
   * We'll draw a 2D polygon, so we don't have to setup
   * a complex projection matrix. The default matrix mode
   * is EZ_MODELVIEW. We just set the projection matrix
   * on this default matrix stack.
   */
  EZ_LoadIdentity();            /* clear the top mtx 2 id */     
  EZ_Ortho2(-1.0,1.0,-1.0,1.0); /* project the unit cube  */
  EZ_EventMainLoop();           /* handle events          */
}
Пример #6
0
main(int ac, char **av)
{
  EZ_Widget *gb, *text, *mbtn, *menu, *tmp;

  EZ_Initialize(ac,av,0);

  /* a toplevel gridbag. Extra spaces go to ROW and COLUME 4 */
  gb = EZ_CreateWidget(EZ_WIDGET_FRAME, NULL, 
                       EZ_PADX,               0, 
                       EZ_PADY,               0,        /*idx     min weight pad */
                       EZ_GRID_CONSTRAINS,    EZ_ROW,      1,     300,  10,   0, 
                       EZ_GRID_CONSTRAINS,    EZ_COLUMN, NCOLS-2, 200,  10,   0, 
                       EZ_BACKGROUND,         "grey85",
                       0);
  /* the first row is a menu bar with 3 buttons.
   * The (NCOLS-2)th column which has a weight 10, 
   * this pushes the last menu button to the right edge.
   */
  mbtn = EZ_CreateWidget(EZ_WIDGET_MENU_BUTTON,    gb,
                                                /* X, Y, W, H */
                         EZ_GRID_CELL_GEOMETRY,    0, 0, 1, 1, 
                                                /*   fill_mode,   gravity */
                         EZ_GRID_CELL_PLACEMENT,   EZ_FILL_BOTH, EZ_CENTER, 
                         EZ_LABEL_STRING,          "MButton 1",
                         EZ_PADY,                  0,
                         0);
  menu = EZ_CreateSimpleMenu("Exit%f|||||",my_exit);
  EZ_SetMenuButtonMenu(mbtn, menu);

 
  mbtn = EZ_CreateWidget(EZ_WIDGET_MENU_BUTTON,   gb,
                         EZ_GRID_CELL_GEOMETRY,   1, 0, 1, 1,
                         EZ_GRID_CELL_PLACEMENT,  EZ_FILL_BOTH, EZ_CENTER,
                         EZ_LABEL_STRING,         "MButton 2",
                         EZ_PADY,                  0,
                         0);
  menu = EZ_CreateSimpleMenu("|||||");
  EZ_SetMenuButtonMenu(mbtn, menu);

  mbtn = EZ_CreateWidget(EZ_WIDGET_MENU_BUTTON,   gb,
                         EZ_GRID_CELL_GEOMETRY,   NCOLS-1, 0, 1, 1,
                         EZ_GRID_CELL_PLACEMENT,  EZ_FILL_BOTH, EZ_CENTER,
                         EZ_LABEL_STRING,         "Help",
                         EZ_PADY,                  0,
                         0);
  menu = EZ_CreateSimpleMenu("|||||");
  EZ_SetMenuButtonMenu(mbtn, menu);

  text = EZ_CreateWidget(EZ_WIDGET_TEXT,         gb,
                         EZ_GRID_CELL_GEOMETRY,  0, 1, NCOLS, 3,
                         EZ_EXPAND,              True,
			 EZ_PROPAGATE,           False,
                         EZ_TEXT_BACKGROUND,     "grey95",
                         EZ_SELECTION_BACKGROUND,"yellow",
                         0);
  EZ_DisplayWidget(gb);
  EZ_TextLoadFile(text, "GridBag.c");  
  EZ_EventMainLoop();
}
Пример #7
0
main(int ac, char **av)
{
  EZ_Widget *frame, *btn;
  EZ_Pixmap *shapeMask;

  EZ_Initialize(ac, av, 0);

  /* make a shape mask */
  {
    EZ_Item   *fig;
    XPoint    xpoints[200];
    XGCValues  gcvalues;
    unsigned   long gcmask;
    GC         gc;
    int i; double x, dx = 0.0628;


    fig = EZ_CreateItem(EZ_FIG_ITEM, 
                        EZ_PADX, 0, EZ_PADY, 0,
                        EZ_BORDER_WIDTH, 0,
                        0);
    gcvalues.foreground = 1L;
    gcvalues.background = 0L;
    gcvalues.font = EZ_GetFontFromId(1)->fid;
    gc = EZ_GetGC( GCForeground|GCBackground|GCFont, &gcvalues);
    for(x=0.0, i = 0; i < 100; i++)
      {
	x += dx;
	xpoints[i].x = (int)(80.0 * cos(x) * sin(0.5*x));
	xpoints[i].y = (int)(60.0 * sin(x) * sin(0.5*x));
      }
    EZ_FigItemAddPolygon(fig, gc, xpoints, 100, CoordModeOrigin);
    EZ_FigItemAddString(fig,  gc, "A Shaped Window", 15, EZ_CENTER, -70, 50);
    shapeMask = EZ_CreateShapeMaskFromFigure(fig);
    EZ_DestroyItem(fig);
    EZ_FreeGC(gc);
  }

  frame  = EZ_CreateWidgetXrm(EZ_WIDGET_FRAME,    NULL,
                              "Frame",           "frame",
                              EZ_IPADX,           4,
                              EZ_SHAPE_PIXMAP,    shapeMask,
                              0);
  btn  =   EZ_CreateWidgetXrm(EZ_WIDGET_NORMAL_BUTTON,    frame,
                              "AButton",           "aButton",
                              EZ_LABEL_STRING,     "Done",
                              EZ_CALLBACK,  quit, NULL,
                              0);
  
  EZ_DisplayWidget(frame);
  EZ_EventMainLoop();
}
Пример #8
0
int main(int argc, char *argv[])
{
	if (!loaddata()) exit(1);
	if (!readconfig()) exit(1);
	
	buildnodelist();
	EZ_Initialize(argc,argv,0);
	initgui();

	EZ_EventMainLoop();

	return 0;
}
Пример #9
0
main(int ac, char **av)
{
  EZ_Widget *frame, *entry1, *entry2, *btn,*frame5 , *tmp;

  EZ_Initialize(ac, av, 0);
  frame  = EZ_CreateWidgetXrm(EZ_WIDGET_FRAME,    NULL,
                              "Entries",           "entries",
                              0);
  tmp =   EZ_CreateWidget(EZ_WIDGET_LABEL, frame,
                          EZ_LABEL_STRING, "User Name:",
                          EZ_GRID_CELL_GEOMETRY, 0,0,1,1,
                          EZ_GRID_CELL_PLACEMENT, EZ_FILL_NONE, EZ_RIGHT,
                          0);
  tmp =   EZ_CreateWidget(EZ_WIDGET_LABEL, frame,
                          EZ_LABEL_STRING, "Password:"******"nameEntry",           "NameEntry",
                             EZ_GRID_CELL_GEOMETRY, 1,0,1,1, 
                             EZ_GRID_CELL_PLACEMENT, EZ_FILL_BOTH, EZ_LEFT,
                             EZ_FONT_NAME, "-sony-fixed-medium-r-normal--24-170-100-100-c-120-jisx0201.1976-0",
                             0);
  entry2= EZ_CreateWidgetXrm(EZ_WIDGET_ENTRY,        frame,
                             "passwdEntry",        "PasswdEntry",
                             EZ_GRID_CELL_GEOMETRY, 1,1,1,1, 
                             EZ_GRID_CELL_PLACEMENT, EZ_FILL_BOTH, EZ_LEFT,
                             EZ_FONT_NAME, "-sony-fixed-medium-r-normal--24-170-100-100-c-120-jisx0201.1976-0",
                             0);
  EZ_OnOffSecretEntry(entry2, True);  

  frame5 = EZ_CreateWidgetXrm(EZ_WIDGET_FRAME,    frame,
                              "Frame5",           "frame5",
                              EZ_BG_IMAGE_FILE,   "marble",
                              EZ_DOCKABLE,        True,
                              EZ_BORDER_TYPE,     EZ_BORDER_RAISED,
                              EZ_BORDER_WIDTH,    2,
                              0);
  btn  =   EZ_CreateWidgetXrm(EZ_WIDGET_NORMAL_BUTTON,    frame5,
                              "AButton",           "aButton",
                              EZ_LABEL_STRING,     "Done",
                              EZ_CALLBACK,          quit, frame,
                              0);
  EZ_DisplayWidget(frame);
  EZ_EventMainLoop();
}
Пример #10
0
main(int ac, char **av)
{
  EZ_Widget *frame, *btn;

  EZ_Initialize(ac, av, 0);
  frame  = EZ_CreateWidget(EZ_WIDGET_FRAME,    NULL,
                           EZ_LABEL_STRING,    "Test Animation",
                           0);
  btn    = EZ_CreateWidget(EZ_WIDGET_NORMAL_BUTTON,    frame,
                           EZ_LABEL_STRING,    "A Button",
                           EZ_FOREGROUND,      "red",
                           EZ_CALLBACK,        animate, NULL,
                           0);  
  setupAnimationF(btn, "burning", "borrar-", 1, 0);

  EZ_DisplayWidget(frame);
  EZ_EventMainLoop();
}
Пример #11
0
main(int ac, char **av)
{
  int i;
  EZ_Widget *ezclock;
  EZ_Timer *timer;

  EZ_Initialize(ac,av,0);
  ezclock= EZ_CreateWidget(EZ_WIDGET_LCD, NULL, 
			   EZ_LCD_NDIGITS,    5,
			   EZ_LCD_FONT_SIZE, 30,
			   0);
  for(i = 1; i < ac; )
    {
      if(!strcmp(av[i], "-bg"))
	{ if(i+1 < ac) EZ_ConfigureWidget(ezclock, EZ_LCD_BACKGROUND, av[(++i)], 0);}
      if(!strcmp(av[i], "-fg"))
	{ if(i+1 < ac) EZ_ConfigureWidget(ezclock, EZ_LCD_FOREGROUND, av[(++i)], 0); }
      i++;
    }
  EZ_DisplayWidget(ezclock);
  timer = EZ_CreateTimer(0, 200000, -1, timer_callback, ezclock, 0);
  EZ_EventMainLoop();
}
Пример #12
0
Файл: h.c Проект: dpenkler/EZWGL
main(int ac, char **av)
{
  EZ_Widget *frame, *hgram;
  EZ_Initialize(ac, av, 0);
  frame  = EZ_CreateWidget(EZ_WIDGET_FRAME,    NULL,
                           EZ_FILL_MODE,       EZ_FILL_BOTH,
                           EZ_ORIENTATION,     EZ_VERTICAL,
                           EZ_PADX, 0,
                           EZ_PADY, 0,
                           0);

  hgram = EZ_CreateWidget(EZ_WIDGET_HISTOGRAM,    frame,
                          EZ_BORDER_WIDTH, 2,
                          EZ_BAR_COLOR_N, 0, "green",
                          EZ_BAR_COLOR_N, 1, "yellow",
                          EZ_BAR_ORIENTATION, EZ_HORIZONTAL,
                          EZ_IPADY, 2, EZ_IPADX, 2,
                          0);
  EZ_SetHistogramValues(hgram, values, 3);
  EZ_DisplayWidget(frame);
  EZ_CreateTimer(0, 100000, -1, timer_callback, hgram, 0);
  EZ_EventMainLoop();
}
Пример #13
0
main(int ac, char **av)
{
  EZ_Widget *frame, *ltree, *label, *phandle;
  EZ_TreeNode *root;

  EZ_Initialize(ac, av, 0);
  PIXMAP_ATOM =  EZ_GetAtom("PixmapTestAtom");

  frame  = EZ_CreateWidgetXrm(EZ_WIDGET_FRAME,    NULL,
                              "server",           "Server",
                              EZ_FILL_MODE,       EZ_FILL_BOTH,
                              EZ_LABEL_STRING,    "Pixmap client",
                              EZ_IPADX,           4,
                              EZ_SIZE,            800, 400,
                              0);
  ltree =  EZ_CreateWidgetXrm(EZ_WIDGET_TREE,      frame,
                              "tree",              "Tree",
                              EZ_WIDTH,            300,
                              0);
  phandle = EZ_CreateWidget(EZ_WIDGET_PANE_HANDLE, frame, 
                            0);

  label = EZ_CreateWidgetXrm(EZ_WIDGET_LABEL,      frame,
                             "label",              "Label",
                             EZ_FOREGROUND,        "red",
                             EZ_FONT_NAME,  "-Adobe-Times-Bold-I-Normal--*-240-*-*-*-*-*-*",
                             0);
  EZ_AddWidgetCallBack(ltree, EZ_CALLBACK, ltreeCB, label, 0);

  EZ_GlobHiddenFiles(True);
  root = EZ_CreateDirTree(NULL, "./*", NULL, 0);  /* */
  EZ_SetListTreeWidgetTree(ltree, root); 

  EZ_DisplayWidget(frame);
  EZ_EventMainLoop();
}
Пример #14
0
main(int ac, char **av)
{
  EZ_Item     *item;
  EZ_Widget   *tree, *btn;
  EZ_TreeNode *root, *node1, *node2, *node11, *tmp;
  EZ_TextProperty *p1, *p2, *p3;

  EZ_Initialize(ac, av, 0);
  tree = EZ_CreateWidget(EZ_WIDGET_LIST_TREE, NULL,
                         EZ_WIDTH_HINT, 400, EZ_HEIGHT_HINT, 400, EZ_IPADY, 2, 
			 EZ_ROW_BG,     1, "white", "bisque",
                         EZ_SELECTION_BACKGROUND, "green3",  0);

  EZ_ConfigureWidget(tree, EZ_CALLBACK, callback, tree, NULL);

  p1 = EZ_GetTextProperty(EZ_PIXMAP_FILE, "question.xpm",
			  EZ_FOREGROUND, "red",
			  EZ_FONT_NAME, 
			  "-Adobe-Helvetica-Medium-R-Normal--*-180-*-*-*-*-*-*",
			  0);
  p2 = EZ_GetTextProperty(EZ_PIXMAP_FILE, "folder.xpm",
			  EZ_FOREGROUND, "blue", 0);
  p3 = EZ_GetTextProperty(EZ_PIXMAP_FILE, "file.xpm",
			  EZ_FOREGROUND, "yellow", 0);

  /* the root node */
  item = EZ_CreateLabelItem("root", p1);
  Root = root = EZ_CreateTreeNode(NULL, item);
  
  /* children */
  item = EZ_CreateLabelItem("child 1", p2);
  node1 = EZ_CreateTreeNode(root, item);
  item = EZ_CreateLabelItem("child 2", p2);
  node2 = EZ_CreateTreeNode(root, item);  

  /* grand children */
  item = EZ_CreateLabelItem("grandchild 11", p3);
  node11 = EZ_CreateTreeNode(node1, item);
  item = EZ_CreateLabelItem("grandchild 12", p3);
  tmp = EZ_CreateTreeNode(node1, item);  
  item = EZ_CreateLabelItem("grandchild 21", p3);
  tmp = EZ_CreateTreeNode(node2, item);  

  /* grand grand children */
  item = EZ_CreateLabelItem("gg child 111", p2);
  tmp = EZ_CreateTreeNode(node11, item);
  btn = EZ_CreateButton(NULL, "A Widget", 0);
  /* EZ_AddWidgetCallBack(btn, EZ_CALLBACK, resettree, root, 0);*/
  item = EZ_CreateWidgetItem(btn);
  EZ_AddWidgetCallBack(btn, EZ_CALLBACK, wcallback, item, 0);
  node11 = EZ_CreateTreeNode(node11, item);
  item = EZ_CreateLabelItem("child of widget item", p2);
  node11 = EZ_CreateTreeNode(node11, item);

  item = EZ_CreateLabelItem("test node 1", p2);
  node11 = EZ_CreateTreeNode(node11, item);

  item = EZ_CreateLabelItem("test node 2", p2);
  node11 = EZ_CreateTreeNode(node11, item);

  item = EZ_CreateLabelItem("test node 3", p2);
  node11 = EZ_CreateTreeNode(node11, item);

  item = EZ_CreateLabelItem("test node 4", p2);
  node11 = EZ_CreateTreeNode(node11, item);

  item = EZ_CreateLabelItem("test node 5", p2);
  tmp = node11 = EZ_CreateTreeNode(node11, item);

  {
    unsigned   long gcmask;
    XGCValues  gcvalues;
    unsigned   long red, green, blue, yellow, cyan, magenta;
    GC         gc;
  
    gcvalues.foreground = red;
    gc = EZ_GetGC( GCForeground, &gcvalues);
    item = EZ_CreateItem(EZ_FIG_ITEM,    NULL);
    /*EZ_FigItemAddRectangle(item, gc, 0,0,90, 80);*/
    gcvalues.foreground = green;
    gc = EZ_GetGC( GCForeground, &gcvalues);
    EZ_FigItemAddFilledArc(item, gc, 0, 0, 50, 50, 0, 300*64);
    /* item = EZ_CreateLabelItem("test node 6", p2);*/
    node11 = EZ_CreateTreeNode(node11, item);
  }

  EZ_SetListTreeWidgetTree(tree, root);
  EZ_ListTreeWidgetSelectNode(tree, tmp, NULL);

  EZ_TreeSetCharacter(root, EZ_BRANCHED_LIST_TREE, 20, 2, 2);
  EZ_DisplayWidget(tree);

  EZ_EventMainLoop();
}
Пример #15
0
main(int ac, char **av)
{
  EZ_Widget *frame, *scrollbar1, *scrollbar2, *scrollbar12, *scrollbar21;
  EZ_Widget *scrollbar3, *scrollbar4, *frame5, *btn;

  EZ_Initialize(ac, av, 0);
  /*EZ_DisableHighlight();*/
  frame  = EZ_CreateWidgetXrm(EZ_WIDGET_FRAME,    NULL,
                              "Frames",           "frames",
                              EZ_FILL_MODE,       EZ_FILL_BOTH,
                              EZ_IPADX,           4,
                              EZ_GRID_CONSTRAINS, EZ_ROW,    0, 100,  100,   0, 
                              EZ_GRID_CONSTRAINS, EZ_COLUMN, 0, 200,  100,   0, 
                              0);
  scrollbar1= EZ_CreateWidgetXrm(EZ_WIDGET_HORIZONTAL_SCROLLBAR,  frame,
                                 "SCROLLBAR1",           "SCROLLBAR1",
                                 EZ_BACKGROUND,        "#cc00cc",
                                 EZ_GRID_CELL_GEOMETRY,   0, 0, 1, 1,
                                 EZ_GRID_CELL_PLACEMENT,  EZ_FILL_BOTH, EZ_BOTTOM,
                                 EZ_CALLBACK, noop, NULL,
                                 0);
  EZ_UpdateScrollbar(scrollbar1, 100, 10, 20);
  scrollbar2= EZ_CreateWidgetXrm(EZ_WIDGET_HORIZONTAL_SCROLLBAR,  frame,
                                 "SCROLLBAR2",           "SCROLLBAR2",
                                 EZ_SLIDER_STYLE,      1,
                                 EZ_GRID_CELL_GEOMETRY,   0, 1, 1, 1,
                                 EZ_GRID_CELL_PLACEMENT,  EZ_FILL_BOTH, EZ_CENTER,
                                 EZ_CALLBACK, noop, NULL,
                                 0);

  EZ_UpdateScrollbar(scrollbar2, 100, 30, 40);
  scrollbar3= EZ_CreateWidgetXrm(EZ_WIDGET_VERTICAL_SCROLLBAR,  frame,
                                 "SCROLLBAR3",           "SCROLLBAR3",
                                 EZ_GRID_CELL_GEOMETRY,   1, 0, 1, 4,
                                 EZ_GRID_CELL_PLACEMENT,  EZ_FILL_BOTH, EZ_CENTER,
                                 EZ_WIDTH, 0,
                                 EZ_CALLBACK, noop, NULL,
                                 0);

  EZ_UpdateScrollbar(scrollbar3, 60, 40, 20);
  scrollbar4= EZ_CreateWidgetXrm(EZ_WIDGET_VERTICAL_SCROLLBAR,  frame,
                                 "SCROLLBAR4",              "SCROLLBAR4",
                                 EZ_BACKGROUND,        "#00cccc",
                                 EZ_SLIDER_STYLE,          3,
                                 EZ_GRID_CELL_GEOMETRY,   2, 0, 1, 4,
                                 EZ_GRID_CELL_PLACEMENT,  EZ_FILL_BOTH, EZ_CENTER,
                                 EZ_CALLBACK, noop, NULL,
                                 0);

  frame5 = EZ_CreateWidgetXrm(EZ_WIDGET_FRAME,    frame,
                              "Frame5",           "frame5",
                              EZ_BG_IMAGE_FILE,   "marble",
                              EZ_DOCKABLE,        True,
                              EZ_BORDER_TYPE,     EZ_BORDER_RAISED,
                              EZ_BORDER_WIDTH,    2,
                              0);
  btn  =   EZ_CreateWidgetXrm(EZ_WIDGET_NORMAL_BUTTON,    frame5,
                              "AButton",           "aButton",
                              EZ_LABEL_STRING,     "Done",
                              EZ_CALLBACK,          quit, frame,
                              0);
  EZ_DisplayWidget(frame);
  EZ_EventMainLoop();
}
Пример #16
0
main(int argc, char **argv)
{
  EZ_Widget *frame, *canvas;
  /* 
   * Initialize EZWGL, don't forget to 
   * initialize the graphics library also.
   */
  EZ_Initialize(argc, argv, 1);      /* notice the 1        */
  /*
   * canvases do not resize propertly as toplevel
   * widgets (bug!) It is recommended to put it
   * under a frame at least for now.
   */
  frame = EZ_CreateFrame(NULL, NULL);
  EZ_ConfigureWidget(frame, EZ_FILL_MODE, EZ_FILL_BOTH,0);
  canvas = EZ_Create3DCanvas(frame);
  /* 
   * the min size for 3DCanvas is too small 
   * so we HINT it with a bigger size.
   */
  EZ_ConfigureWidget(canvas, EZ_ORIENTATION, EZ_VERTICAL_BOTTOM,
                     EZ_WIDTH_HINT, 320, 
                     EZ_HEIGHT_HINT, 320,
                     EZ_EVENT_HANDLE, eventHandler, NULL,
                     0);
  /*
   * now display the canvas. One must first display
   * a 3DCanvas before calling any GL functions !!!
   */
  EZ_DisplayWidget(canvas);         

  /* now setup global GL attributes */
  EZ_RGBMode();                 /* we are using RGB mode  */
  EZ_AutoSelectBackBuffer();    /* select a back buffer   */
  EZ_DrawBuffer(EZ_BACK);/* always draw into the back buf */

  EZ_ShadeModel(EZ_SMOOTH);     /* turn on smooth shading */
  EZ_Enable(EZ_DEPTH_TEST);     /* turn on zbuffer        */
  EZ_Enable(EZ_CULL_FACE);      /* turn on backface cull  */
  EZ_Enable(EZ_LIGHTING);       /* turn on lighting       */
  EZ_Enable(EZ_LIGHT0);         /* turn on 3 lights       */
  EZ_Enable(EZ_LIGHT1);
  EZ_Enable(EZ_LIGHT2);
  EZ_Enable(EZ_COLOR_MATERIAL); /* enable color material  */

  EZ_MatrixMode(EZ_PROJECTION); /* set up a proj matrix   */
  EZ_LoadIdentity();            /* clear the top mtx 2 id */     
  EZ_Perspective(60.0, 1.0, 1.0, 100.0);
  EZ_MatrixMode(EZ_MODELVIEW); 
  EZ_LoadIdentity();
  EZ_LookAt(0.0,0.0,60.0, 0.0,0.0,0.0, 0.0,1.0,0.0);
  EZ_GetMatrix(ViewMatrix);
  EZ_GenerateRotationMatrix(RotationMatrix, 90.0, 1.0,0.0,0.0);
  
  /* now we have to set up the three lights */
  {
    static EZ_LightSrc *Light1, *Light2, *Light3;

    static float  light1[] = 
    {
      EZ_POSITION_F, 1.0,0.0,2.0, 1.0,  
      EZ_DIFFUSE_F,  1.0,1.0,1.0,1.0,
      EZ_NULL_F,
    };

    static float  light2[] =
    {
      EZ_POSITION_F,   0.0,5.0,10.0,1.0,
      EZ_SPECULAR_F,   1.0,1.0,1.0,1.0,     
      EZ_SPOT_DIRECTION_F, 0.0,0.0,-1.0,0.0,
      EZ_SPOT_CUTOFF_F,  30.0, 
      EZ_SPOT_EXPONENT_F, 10.0, 
      EZ_NULL_F,
    };

    static float  light3[] =
    {  
      EZ_POSITION_F,  4.0,0.0,8.0, 1.0,      
      EZ_DIFFUSE_F,  1.0,1.0,0.0,1.0,
      EZ_SPECULAR_F, 1.0,1.0,0.0,1.0,     
      EZ_NULL_F,
    };

    Light1 = EZ_DefineLight(light1);
    Light2 = EZ_DefineLight(light2);
    Light3 = EZ_DefineLight(light3);

    EZ_BindLight(0, Light1);
    EZ_BindLight(1, Light2);
    EZ_BindLight(2, Light3); 
  }

  /* set up some material properties */
  {
    static float specular[] = {1.0,1.0,1.0,1.0};
    static float shininess[] = {4.0};
    EZ_Materialfv(EZ_FRONT,EZ_SPECULAR,specular);
    EZ_Materialfv(EZ_FRONT,EZ_SHININESS,shininess);
  }

  /*
   * We don't draw anything here, let the
   * event handler handle the drawing 
   */
  while(1)
    {
      EZ_ServiceEvents();
      draw(canvas);
    }
}