/*************************** Example 14 ***************************/
#include "EZ.h"

void  rbuttonCallback(EZ_Widget *btn, void *data)
{
  char *ptr = (char *)EZ_GetWidgetPtrData(btn);
  EZ_SetDefaultLabelFont(ptr);
}

main(int ac, char **av)
{
  EZ_Widget *frame, *frame1, *menubar, *tmp, *mbtn;
  
  EZ_Initialize(ac,av,0);
  
  frame = EZ_CreateWidget(EZ_WIDGET_FRAME,      NULL,
                          EZ_ORIENTATION,       EZ_VERTICAL_TOP, 
                          EZ_FILL_MODE,         EZ_FILL_VERTICALLY,
                          EZ_PADY,              0, 0);
  menubar = EZ_CreateWidget(EZ_WIDGET_FRAME, frame, 
                            EZ_EXPAND,          True, /* strecth horizontally */
                            EZ_PADX,            0, 
                            EZ_PADY,            0, 
                            EZ_IPADY,           0,
                            EZ_HEIGHT,          0, /* keep its height mininum */
		            EZ_BORDER_TYPE,     EZ_BORDER_UP,
                            EZ_BORDER_WIDTH,    2, 
                            EZ_ORIENTATION,     EZ_HORIZONTAL_LEFT, 
                            EZ_FILL_MODE,       EZ_FILL_HORIZONTALLY, 
                            0);

  mbtn = EZ_CreateWidget(EZ_WIDGET_MENU_BUTTON, menubar, 
                         EZ_WIDTH,              0,  /* keep its width at minium */
                         EZ_LABEL_STRING,       "MenuButton 1", 0);
  tmp = EZ_CreateSimpleMenu("%t title Ab c %c Test1    %n Abc  ||%c t1 %n test2|||");
  EZ_SetMenuButtonMenu(mbtn, tmp);
  mbtn = EZ_CreateWidget(EZ_WIDGET_MENU_BUTTON, menubar,
                         EZ_WIDTH,              0,  /* keep its width at minium */
                         EZ_LABEL_STRING,       "MenuButton 2", 0);
  tmp = EZ_CreateSimpleMenu("%t Menu 2 |||||");
  EZ_SetMenuButtonMenu(mbtn, tmp);
  mbtn = EZ_CreateWidget(EZ_WIDGET_MENU_BUTTON, menubar,
                         EZ_WIDTH,              0,  /* keep its width at minium */
                         EZ_LABEL_STRING,       "MenuButton 3", 0);
  tmp = EZ_CreateSimpleMenu("Menu 3 %t|||||");
  EZ_SetMenuButtonMenu(mbtn, tmp);

  /* insert an empty label in the middle. */
  tmp = EZ_CreateWidget(EZ_WIDGET_LABEL, menubar, 0);

  mbtn = EZ_CreateWidget(EZ_WIDGET_MENU_BUTTON, menubar,
                         EZ_WIDTH,              0,  /* keep its width at minium */
                         EZ_LABEL_STRING,       "Help",
                         EZ_UNDERLINE,          0,
                         0);
  tmp = EZ_CreateSimpleMenu("no help available");
  EZ_SetMenuButtonMenu(mbtn, tmp);

  /* put something on this frame! */
  frame1 = EZ_CreateWidget(EZ_WIDGET_FRAME,frame, 0);

  tmp = EZ_CreateWidget(EZ_WIDGET_RADIO_BUTTON, frame1,
                        EZ_LABEL_STRING,        "Normal Font",
                        EZ_RADIO_BUTTON_VALUE,  0, 
                        EZ_RADIO_BUTTON_GROUP,  0,
                        EZ_CLIENT_PTR_DATA,     "-Adobe-Helvetica-Medium-R-Normal--*-120-*-*-*-*-*-*",
		        EZ_CALLBACK,            rbuttonCallback, NULL,
                        0);
  tmp = EZ_CreateWidget(EZ_WIDGET_RADIO_BUTTON, frame1,
                        EZ_LABEL_STRING,        "Large Font",
                        EZ_RADIO_BUTTON_VALUE,  1, 
                        EZ_RADIO_BUTTON_GROUP,  0,
                        EZ_CLIENT_PTR_DATA,     "-Adobe-Helvetica-Bold-R-Normal--*-180-*-*-*-*-*-*",
		        EZ_CALLBACK,            rbuttonCallback, NULL,
                        0);

  EZ_DisplayWidget(frame);
  EZ_EventMainLoop();
}
/*************************** Example 14 ***************************/



