Пример #1
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();
}
Пример #2
0
/*------------------ Initialize_Info_Widget() ----------------------*/
void Initialize_Info_Widget()
{
  EZ_Widget    *tmp_w1, *tmp_w2;

  /* create and configure the information display widget */
  Info_Widget = EZ_CreateFrame(NULL, fname);
  EZ_ConfigureWidget(Info_Widget,
		     EZ_PADX,         0,
		     EZ_PADY,         0,
		     EZ_STACKING,  EZ_VERTICAL,
		     EZ_WIDTH,     650, EZ_HEIGHT, 500,
		     EZ_FILL_MODE, EZ_FILL_BOTH, 
		     0);

  tmp_w1 = EZ_CreateFrame(Info_Widget, NULL);
  EZ_ConfigureWidget(tmp_w1,
		     EZ_PADX,         8,
		     EZ_PADY,         0,
		     EZ_EXPAND,       True,
		     EZ_HEIGHT,       0,
		     EZ_STACKING,     EZ_HORIZONTAL_LEFT,
		     0);

  Info_Close_Button = EZ_CreateButton(tmp_w1,"Close",-1);

  /* create a widget for the actual mincheader text */
  tmp_w2 = EZ_CreateFrame(Info_Widget, NULL);
  EZ_ConfigureWidget(tmp_w2,
		     EZ_FILL_MODE, EZ_FILL_BOTH,
		     0);
  Mincheader_Widget = EZ_CreateTextWidget(tmp_w2,0,1,1);

  /* add the callback for shutdown of the info widget */
  EZ_AddWidgetCallBack(Info_Close_Button,
		       EZ_CALLBACK, Close_Info_Widget, NULL,0);

  /* set WM hints for user placement */
  EZ_SetWMHintsAndSizeHints(File_Save_Widget, 0);
}
Пример #3
0
static int initgui(void)
{
	int i;
	EZ_Widget *tmp;
	
	topw=EZ_CreateFrame(0,0);
	EZ_ConfigureWidget(topw,EZ_PADY,0,EZ_ORIENTATION,EZ_VERTICAL_TOP,EZ_SIDE,EZ_LEFT,0);

	upframew=EZ_CreateFrame(topw,0);
	EZ_ConfigureWidget(topw,EZ_IPADX,6,0);

	bbsnamew=EZ_CreateLabel(upframew,maincfg.CFG_BOARDNAME);
	EZ_ConfigureWidget(bbsnamew,EZ_BORDER_TYPE,EZ_BORDER_RIDGE,EZ_BORDER_WIDTH,1,EZ_WIDTH,500,0);
	sizecw=EZ_CreateCheckButton(upframew,"Show buttons",0,1,0,1);

	nodelistw=EZ_CreateListBox(topw,0,1);
	EZ_ConfigureWidget(nodelistw,EZ_HEIGHT,5+16*nlines,EZ_WIDTH,640,EZ_FONT_NAME,"-misc-fixed-medium-r-normal--14-130-75-75-c-70-iso8859-1",0);
	EZ_SetWidgetCallBack(nodelistw,listsel,0);
	
	botw=EZ_CreateFrame(topw,0);
	EZ_ConfigureWidget(botw,EZ_SIDE,EZ_LEFT,0);
	cmd1w=EZ_CreateFrame(botw,0);
	EZ_ConfigureWidget(cmd1w,EZ_ORIENTATION,EZ_HORIZONTAL,EZ_SIDE,EZ_LEFT,EZ_PADY,1,0);

	cmd1lw=EZ_CreateFrame(cmd1w,0);
	openvieww=EZ_CreateButton(cmd1lw,"Open view",0);
	EZ_ConfigureWidget(openvieww,EZ_WIDTH,80,EZ_HEIGHT,25,EZ_X,0,EZ_Y,0,0);
	EZ_SetWidgetCallBack(openvieww,openview,0);
	
	closevieww=EZ_CreateButton(cmd1lw,"Close view",0);
	EZ_ConfigureWidget(closevieww,EZ_WIDTH,80,EZ_HEIGHT,25,EZ_X,81,EZ_Y,0,0);
	EZ_SetWidgetCallBack(closevieww,closeview,0);
	chatw=EZ_CreateButton(cmd1lw,"Chat",0);
	EZ_ConfigureWidget(chatw,EZ_WIDTH,80,EZ_HEIGHT,25,EZ_X,0,EZ_Y,26,0);
	EZ_SetWidgetCallBack(chatw,chat,0);
	kickw=EZ_CreateButton(cmd1lw,"Kick user",0);
	EZ_ConfigureWidget(kickw,EZ_WIDTH,80,EZ_HEIGHT,25,EZ_X,81,EZ_Y,26,0);
	EZ_SetWidgetCallBack(kickw,kick,0);
	editw=EZ_CreateButton(cmd1lw,"Edit user",0);
	EZ_ConfigureWidget(editw,EZ_WIDTH,80,EZ_HEIGHT,25,EZ_X,0,EZ_Y,52,0);
	EZ_SetWidgetCallBack(editw,edit,0);
	quitw=EZ_CreateButton(cmd1lw,"Quit",0);
	EZ_ConfigureWidget(quitw,EZ_WIDTH,80,EZ_HEIGHT,25,EZ_X,81,EZ_Y,52,0);
	EZ_SetWidgetCallBack(quitw,quit,0);
	
	for (i=0; i < 4 ; i++) {
		radiow[i]=EZ_CreateRadioButton(cmd1lw,viewnames[i],-1,0,i);
		EZ_ConfigureWidget(radiow[i],EZ_X,170+i*120,EZ_Y,1,0);
		EZ_SetWidgetCallBack(radiow[i],radiocall,0);
	}
	EZ_SetRadioButtonGroupVariableValue(tmp,0);

	infow=EZ_CreateListBox(cmd1lw,0,1);
	EZ_ConfigureWidget(infow,EZ_Y,30,EZ_X,170,EZ_WIDTH,440,EZ_HEIGHT,5+16*isize,EZ_FONT_NAME,"-misc-fixed-medium-r-normal--14-130-75-75-c-70-iso8859-1",0);

	buildnodew(0);
	EZ_SetListBoxItems(infow,lulines,ilines);

	EZ_DisplayWidget(topw);
	EZ_CreateTimer(1,0,-1,mytimer,0,0);
}
Пример #4
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);
    }
}