/***************************** Example **************************/
/*
 *  Test NWLabel
 */

#include "EZ.h" 

static void btn_callback(EZ_Widget *button);
static char *label= "I'm a NoWindowLabel. I behave very differnetly from label. Well,\
I don't have a window of my own";

EZ_Widget *frame, *button, *nwlabel1, *nwlabel2;
main(int argc, char **argv)
{
  EZ_Widget *tmp;
  int i, j, k,m,n;

  EZ_Initialize(argc,argv,0);       /* initialize EZWGL    */
  srand(getpid());
  frame = EZ_CreateFrame(NULL, NULL);
  EZ_ConfigureWidget(frame,
        EZ_BORDER_TYPE, EZ_BORDER_DOWN, EZ_BORDER_WIDTH, 2,
        EZ_BACKGROUND, "bisque",		     
        EZ_WIDTH,400, EZ_HEIGHT, 400, 0);

  button = EZ_CreateButton(frame, NULL, -1);
  EZ_ConfigureWidget(button, EZ_CALL_BACK, btn_callback, NULL,0);

  tmp = EZ_CreateNWLabel(button, NULL);
  EZ_ConfigureWidget(tmp, EZ_ORIENTATION, EZ_VERTICAL, 0);

  nwlabel1 = EZ_CreateNWLabel(tmp,label);
  nwlabel2 = EZ_CreateNWLabel(tmp,label);
  EZ_ConfigureWidget(nwlabel1, EZ_IMAGE_FILE, "cat.ppm", 0);

  EZ_DisplayWidget(frame); 
  EZ_EventMainLoop();
}

static int iii = 1;
static char *label2= "The long label is gone";

static void btn_callback(EZ_Widget *widget)
{
  int i = ( iii++) %2;
  
  if(i)  EZ_ConfigureWidget(nwlabel2, EZ_LABEL_STRING, label2, 0);
  else   EZ_ConfigureWidget(nwlabel2, EZ_LABEL_STRING, label, 0);
}
/***************************** Example **************************/
