Пример #1
0
int main(int argc, char **argv) 
{
  Ihandle *dlg;
  Ihandle *list, *list_multiple, *list_dropdown;
  Ihandle *frm_medal, *frm_sport, *frm_prize;

  IupOpen(&argc, &argv);

  list = IupList ("list_act");
  IupSetAttributes (list, "1=Gold, 2=Silver, 3=Bronze, 4=Tecgraf, 5=None,"
                          "SHOWIMAGE=YES, SHOWDRAGDROP=YES, XXX_SPACING=4, VALUE=4");
  load_medal_images();
  IupSetAttribute(list, "IMAGE1", "IMGGOLD");
  IupSetAttribute(list, "IMAGE2", "IMGSILVER");
  IupSetAttribute(list, "IMAGE3", "IMGBRONZE");
  IupSetAttributeHandle(list, "IMAGE4", load_image_Tecgraf());
  IupSetCallback(list, "DRAGDROP_CB", (Icallback)dragdrop_cb);
//  IupSetAttribute(list, "FONT", "Helvetica, Bold 40");
//  IupSetAttribute(list, "AUTOHIDE", "NO");

  frm_medal = IupFrame (list);
  IupSetAttribute (frm_medal, "TITLE", "Best medal");
  list_multiple = IupList(NULL);
  
  IupSetAttributes (list_multiple, "1=\"100m dash\", 2=\"Long jump\", 3=\"Javelin throw\", 4=\"110m hurdlers\", 5=\"Hammer throw\",6=\"High jump\","
                                   "MULTIPLE=YES, VALUE=\"+--+--\", SIZE=EIGHTHxEIGHTH");

  IupSetCallback(list_multiple, "ACTION", (Icallback)list_multiple_cb);
  
  frm_sport = IupFrame (list_multiple);
  
  IupSetAttribute (frm_sport, "TITLE", "Competed in");

  list_dropdown = IupList (NULL);
  IupSetAttributes (list_dropdown, "1=\"Less than US$ 1000\", 2=\"US$ 2000\", 3=\"US$ 5000\", 4=\"US$ 10000\", 5=\"US$ 20000\", 6=\"US$ 50000\", 7=\"More than US$ 100000\","
                                   "SHOWIMAGE=YES, DROPDOWN=YES, VISIBLE_ITEMS=3");
  IupSetAttributeHandle(list_dropdown, "IMAGE1", IupImageRGB(20, 20, image_data_24));
  IupSetAttributeHandle(list_dropdown, "IMAGE2", IupImageRGB(20, 20, image_data_24));
  IupSetAttributeHandle(list_dropdown, "IMAGE3", load_image_Tecgraf());

  frm_prize = IupFrame (list_dropdown);
  IupSetAttribute (frm_prize, "TITLE", "Prizes won");

  dlg = IupDialog (IupHbox (frm_medal, frm_sport, frm_prize, NULL));
  IupSetAttribute (dlg, "TITLE", "IupList Example");
  IupShowXY (dlg, IUP_CENTER, IUP_CENTER);
//  IupSetAttribute(IupGetChild(dlg, 0), "BGCOLOR", "92 92 255");
//  IupSetAttribute(dlg, "BACKGROUND", "200 10 80");
//  IupSetAttribute(dlg, "BGCOLOR", "92 92 255");

  IupMainLoop ();
  IupClose ();
  return EXIT_SUCCESS;

}
Пример #2
0
static void CreateImageRGB(void)
{
  int i, count, width, height;
  unsigned char *pixels;
  lua_Object n, obj = luaL_tablearg(3);
  width = luaL_check_int(1);
  height = luaL_check_int(2);
  count = width * height * 3;
  pixels = (unsigned char *) malloc(count);

  for (i = 0; i < count; i++)
  {
    lua_beginblock();
    lua_pushobject(obj);
    lua_pushnumber(i+1);

    n = lua_gettable();
    if (!lua_isnumber(n)) 
    {
      lua_endblock();
      lua_error("iupCreateImage: incorrect value in argument");
    }
    pixels[i] = (unsigned char)lua_getnumber(n);
    lua_endblock();
  }

  lua_pushusertag(IupImageRGB(width, height, pixels), iuplua_tag);
  free(pixels);
}
Пример #3
0
static int ImageRGB(lua_State *L)
{
  int w = luaL_checkinteger(L, 1);
  int h = luaL_checkinteger(L, 2);
  unsigned char *pixels = iuplua_checkuchar_array(L, 3, w*h*3);
  Ihandle *ih = IupImageRGB(w, h, pixels);
  iuplua_plugstate(L, ih);
  iuplua_pushihandle_raw(L, ih);
  free(pixels);
  return 1;
}
Пример #4
0
void iupImageStockLoad(const char *name)
{
  const char* native_name = NULL;
  Ihandle* ih = NULL;
  iImageStockGet(name, &ih, &native_name);
  if (ih)
    IupSetHandle(name, ih);
  else if (native_name)
  {
    /* dummy image to save the GTK stock name */
    void* image = iupdrvImageLoad(native_name, IUPIMAGE_IMAGE);
    if (image)
    {
      int w, h, bpp;
      iupdrvImageGetInfo(image, &w, &h, &bpp);
      if (bpp == 32)
        ih = IupImageRGBA(w,h,NULL);
      else
        ih = IupImageRGB(w,h,NULL);
      IupSetHandle(native_name, ih);
    }
  }
}
Пример #5
0
void LabelTest(void)
{
  Ihandle *dlg, *label, *image1, *image2, *image3, 
          *box1, *box2, *fill;

  box1 = IupVbox(NULL);
  IupSetAttribute(box1, "MARGIN", "5x5");
  IupSetAttribute(box1, "GAP", "5");
  IupSetAttribute(box1, "BGCOLOR", "75 150 170");  /* label must be transparent for BGCOLOR */
  IupSetAttribute(box1, "PADDING", "5x5");

  label = IupLabel(NULL);
  if (IupGetInt(NULL, "UTF8MODE"))
    IupSetAttribute(label, "TITLE", "Text Labels (çãõáóé)");
  else
    IupSetAttribute(label, "TITLE", "Text Labels (ηγυασι)");
  //IupSetAttribute(label, "BGCOLOR", IupGetGlobal("DLGBGCOLOR"));
  IupSetAttribute(label, "PADDING", "0x0");
  IupSetAttribute(label, "TIP", "Text Label");
  IupAppend(box1, label);

  label = IupLabel(NULL);
  IupSetAttribute(label, "SEPARATOR", "HORIZONTAL");
  IupAppend(box1, label);

  label = IupLabel(NULL);
  IupSetAttribute(label, "TITLE", "Text &Label\nSecond Line");
  IupSetAttribute(label, "FGCOLOR", "0 0 255");
  IupSetAttribute(label, "RASTERSIZE", "150x70");
//  IupSetAttribute(label, "RASTERSIZE", "30x70");
//  IupSetAttribute(label, "WORDWRAP", "YES");
//  IupSetAttribute(label, "ELLIPSIS", "YES");
  IupSetAttribute(label, "ALIGNMENT", "ALEFT:ATOP");
  IupAppend(box1, label);

  label = IupLabel(NULL);
  IupSetAttribute(label, "TITLE", "Text\nSecond Line");
  IupSetAttribute(label, "RASTERSIZE", "150x70");
  IupSetAttribute(label, "ALIGNMENT", "ACENTER:ACENTER");
  IupSetAttribute(label, "FONT", "Helvetica, Underline 14");
//  IupSetAttribute(label, "FONTSIZE", "14");
//  IupSetAttribute(label, "FONTSTYLE", "Italic");
//  IupSetAttribute(label, "FONTSTYLE", "Bold");
  IupAppend(box1, label);

  label = IupLabel(NULL);
  IupSetAttribute(label, "TITLE", "Text\n<b>Second Line</b>");
  IupSetAttribute(label, "RASTERSIZE", "150x70");
  IupSetAttribute(label, "ALIGNMENT", "ARIGHT:ABOTTOM");
  IupSetAttribute(label, "MARKUP", "YES");
  IupAppend(box1, label);

  box2 = IupVbox(NULL);
  IupSetAttribute(box2, "MARGIN", "5x5");
  IupSetAttribute(box2, "GAP", "5");
  IupSetAttribute(box2, "BGCOLOR", "75 150 170");
  IupSetAttribute(box2, "PADDING", "5x5");

  image1 = IupImage(TEST_IMAGE_SIZE, TEST_IMAGE_SIZE, image_data_8);
  IupSetAttribute(image1, "0", "BGCOLOR");
  IupSetAttribute(image1, "1", "255 0 0"); 
  IupSetAttribute(image1, "2", "0 255 0");
  IupSetAttribute(image1, "3", "0 0 255"); 
  IupSetAttribute(image1, "4", "255 255 255"); 
  IupSetAttribute(image1, "5", "0 0 0"); 

  label = IupLabel(NULL);
  IupSetAttributeHandle(label, "IMAGE", image1);
  //IupSetAttribute(label, "IMAGE", "TECGRAF_BITMAP");
  //IupSetAttribute(label, "IMAGE", "../test/tecgraf.bmp");
  //IupSetAttribute(label, "IMAGE", "../test/file_large.xbm");
  //IupSetAttribute(label, "IMAGE", "gtk-open");
  //IupSetAttribute(label, "BGCOLOR", IupGetGlobal("DLGBGCOLOR"));
  IupSetAttribute(label, "PADDING", "0x0");
  IupSetAttribute(label, "TIP", "Image Label");
  IupAppend(box2, label);

  label = IupLabel(NULL);
  IupSetAttribute(label, "SEPARATOR", "HORIZONTAL");
  IupAppend(box2, label);

  fill = IupFill();
  IupSetAttribute(fill, "SIZE", "20");
  IupAppend(box2, fill);

  label = IupLabel(NULL);
  IupSetAttributeHandle(label, "IMAGE", image1);
  IupSetAttribute(label, "RASTERSIZE", "150x50");
  IupAppend(box2, label);

  image2 = IupImageRGB(TEST_IMAGE_SIZE, TEST_IMAGE_SIZE, image_data_24);

  label = IupLabel(NULL);
  IupSetAttributeHandle(label, "IMAGE", image2);
  IupSetAttribute(label, "RASTERSIZE", "150x50");
  IupSetAttribute(label, "ALIGNMENT", "ACENTER");
  IupAppend(box2, label);

  image3 = IupImageRGBA(TEST_IMAGE_SIZE, TEST_IMAGE_SIZE, image_data_32);

  label = IupLabel(NULL);
  IupSetAttributeHandle(label, "IMAGE", image3);
  IupSetAttribute(label, "RASTERSIZE", "150x50");
  IupSetAttribute(label, "ALIGNMENT", "ARIGHT");
  IupAppend(box2, label);

  label = IupLabel(NULL);
  IupSetAttribute(label, "SEPARATOR", "VERTICAL");

  dlg = IupDialog(IupHbox(box1, label, box2, NULL));
  IupSetAttribute(dlg, "TITLE", "IupLabel Test");
//  IupSetAttribute(dlg, "BACKGROUND", "0 0 128");
//  IupSetAttributeHandle(dlg, "BACKGROUND", image2);
  IupSetCallback(dlg, "ENTERWINDOW_CB", enter_cb);

  IupShow(dlg);
//  IupShowXY(dlg,IUP_LEFT,IUP_BOTTOM);
}
Пример #6
0
void ButtonTest(void)
{
  Ihandle *dlg, *button, *label, *image1, *image1i, *image1p, *image2, *image3, 
          *box1, *box2;

  box1 = IupVbox(NULL);
  IupSetAttribute(box1, "MARGIN", "5x5");
  IupSetAttribute(box1, "GAP", "5");
//  IupSetAttribute(box1, "BGCOLOR", "75 150 170");
//  IupSetAttribute(box1, "PADDING", "15x15");

  button = IupButton(NULL, NULL);
  IupSetStrAttribute(button, "TITLE", "_@IUP_OK");
  IupSetCallback(button, "ACTION", active_cb);
  IupAppend(box1, button);

  button = IupButton(NULL, NULL);
  if (IupGetInt(NULL, "UTF8MODE"))
    IupSetAttribute(button, "TITLE", "&Text && Test(çãõáóé)");
  else
    IupSetAttribute(button, "TITLE", "&Text && Test(ηγυασι)");
  IupSetAttribute(button, "TIP", "Button & Tip");
  //IupSetAttribute(button, "PADDING", "15x15");
  //IupSetAttribute(button, "BGCOLOR", "128 128 255");
//  IupSetAttribute(button, "SIZE", "40");
//  IupSetAttribute(button, "EXPAND", "Yes");
//  IupSetAttribute(button, "FGCOLOR", "0 0 255");
//  IupSetAttribute(button, "RASTERSIZE", "200x100");
  IupSetAttribute(button, "ALIGNMENT", "ACENTER:ACENTER");
//  IupSetAttribute(button, "ALIGNMENT", "ALEFT:ATOP");
  IupSetAttribute(button, "NAME", "button1");
  //IupSetAttribute(button, "CANFOCUS", "NO");
  set_callbacks(button);
  IupAppend(box1, button);

  button = IupButton(NULL, NULL);
  IupSetAttribute(button, "TITLE", "Text1\nSecond Line");
//  IupSetAttribute(button, "RASTERSIZE", "200x100");
  IupSetAttribute(button, "ALIGNMENT", "ACENTER:ACENTER");
  IupSetAttribute(button, "FONT", "Helvetica, Underline 14");
  IupSetAttribute(button, "FLAT", "YES");
  IupSetAttribute(button, "NAME", "button2");
  set_callbacks(button);
  IupAppend(box1, button);

  button = IupButton(NULL, NULL);
  IupSetAttribute(button, "TITLE", "Text2\n<b>Second Line</b>");
  IupSetAttribute(button, "RASTERSIZE", "200x100");
  IupSetAttribute(button, "ALIGNMENT", "ARIGHT:ABOTTOM");
  IupSetAttribute(button, "MARKUP", "YES");
  IupSetAttribute(button, "NAME", "button3");
  IupSetAttribute(button, "CANFOCUS", "NO");
  set_callbacks(button);
  IupAppend(box1, button);

  button = IupButton(NULL, NULL);
  IupSetAttribute(button, "RASTERSIZE", "30x30");
  IupSetAttribute(button, "BGCOLOR", "255 128 92");
  IupSetAttribute(button, "NAME", "color");
//  IupSetAttribute(button, "EXPAND", "HORIZONTAL");
  //  IupSetAttribute(button, "FLAT", "Yes");
  set_callbacks(button);
  IupAppend(box1, button);

  box2 = IupVbox(NULL);
  IupSetAttribute(box2, "MARGIN", "5x5");
  IupSetAttribute(box2, "GAP", "5");
//  IupSetAttribute(box2, "BGCOLOR", "75 150 170");
//  IupSetAttribute(box2, "PADDING", "15x15");

  image1 = IupImage(TEST_IMAGE_SIZE, TEST_IMAGE_SIZE, image_data_8);
  IupSetAttribute(image1, "0", "BGCOLOR");
  IupSetAttribute(image1, "1", "255 0 0"); 
  IupSetAttribute(image1, "2", "0 255 0");
  IupSetAttribute(image1, "3", "0 0 255"); 
  IupSetAttribute(image1, "4", "255 255 255"); 
  IupSetAttribute(image1, "5", "0 0 0"); 

  image1i = IupImage(TEST_IMAGE_SIZE, TEST_IMAGE_SIZE, image_data_8_inactive);
  IupSetAttribute(image1i, "0", "BGCOLOR");
  IupSetAttribute(image1i, "1", "255 0 0"); 
  IupSetAttribute(image1i, "2", "0 255 0");
  IupSetAttribute(image1i, "3", "0 0 255"); 
  IupSetAttribute(image1i, "4", "255 255 255"); 
  IupSetAttribute(image1i, "5", "0 0 0"); 
  IupSetHandle("image1i", image1i); /* so it will be destroyed even when not used */

#if 0
  image1p = IupImage(TEST_IMAGE_SIZE, TEST_IMAGE_SIZE, image_data_8_pressed);
  IupSetAttribute(image1p, "0", "BGCOLOR");
  IupSetAttribute(image1p, "1", "255 0 0"); 
  IupSetAttribute(image1p, "2", "0 255 0");
  IupSetAttribute(image1p, "3", "0 0 255"); 
  IupSetAttribute(image1p, "4", "255 255 255"); 
  IupSetAttribute(image1p, "5", "0 0 0"); 
#endif

  image2 = IupImageRGB(TEST_IMAGE_SIZE, TEST_IMAGE_SIZE, image_data_24);

  image3 = IupImageRGBA(TEST_IMAGE_SIZE, TEST_IMAGE_SIZE, image_data_32);

  button = IupButton(NULL, NULL);
  IupSetAttribute(button, "TITLE", "Images");
  IupSetAttributeHandle(button, "IMAGE", load_image_FileSave());
  
  //IupSetAttribute(button, "IMAGE", "TECGRAF_BITMAP");
  IupAppend(box2, button);

  button = IupButton(NULL, NULL);
//  IupSetAttribute(button, "ALIGNMENT", "ALEFT:ATOP");
//  IupSetAttribute(button, "RASTERSIZE", "200x100");
//  IupSetAttribute(button, "IMAGEPOSITION", "BOTTOM");
//  IupSetAttribute(button, "PADDING", "5x5");
//  IupSetAttribute(button, "TITLE", "Text1");
//  IupSetAttribute(button, "FONT", "Helvetica, 14");
//  IupSetAttribute(button, "IMAGE", "IUP_Tecgraf");
  IupSetAttributeHandle(button, "IMAGE", image1);
  IupSetAttributeHandle(button, "IMINACTIVE", image1i);
//  IupSetAttributeHandle(button, "IMPRESS", image1p);
  IupSetAttribute(button, "TIP", "Image Label");
  IupSetAttribute(button, "NAME", "button4");
  IupSetAttribute(button, "PADDING", "5x5");
//  IupSetAttribute(button, "FLAT", "Yes");
  set_callbacks(button);
  IupAppend(box2, button);

  button = IupButton(NULL, NULL);
  IupSetAttributeHandle(button, "IMAGE", image2);
//  IupSetAttribute(button, "TITLE", "Text2");
//  IupSetAttribute(button, "IMAGEPOSITION", "TOP");
//  IupSetAttribute(button, "SPACING", "30");
//  IupSetAttribute(button, "ALIGNMENT", "ALEFT");
//  IupSetAttribute(button, "RASTERSIZE", "200x100");
  IupSetAttribute(button, "FLAT", "YES");
//  IupSetAttributeHandle(button, "IMPRESS", image2);
  IupSetAttribute(button, "CANFOCUS", "NO");
  IupSetAttribute(button, "PADDING", "10x10");
  //  IupSetAttribute(button, "RASTERSIZE", "15x15");
  IupSetAttribute(button, "NAME", "button5");
  set_callbacks(button);
  IupAppend(box2, button);

  button = IupButton(NULL, NULL);
  IupSetAttributeHandle(button, "IMAGE", image3);
  IupSetAttribute(button, "TITLE", "Text3");
//  IupSetAttribute(button, "RASTERSIZE", "200x100");
//  IupSetAttribute(button, "ALIGNMENT", "ARIGHT");
  IupSetAttribute(button, "NAME", "button6");
  set_callbacks(button);
  IupAppend(box2, button);

  label = IupLabel(NULL);
  IupSetAttribute(label, "SEPARATOR", "VERTICAL");
  IupSetHandle("seplabel", label);

  dlg = IupDialog(IupHbox(box1, label, box2, NULL));
  IupSetAttribute(dlg, "TITLE", "IupButton Test");
//  IupSetAttribute(box1, "BGCOLOR", "128 0 0");
//  IupSetAttribute(dlg, "BGCOLOR", "0 128 0");
//  IupSetAttribute(dlg, "BACKGROUND", "255 128 128");
//  IupSetAttributeHandle(dlg, "BACKGROUND", image2);
//  IupSetAttribute(dlg, "BGCOLOR", "173 177 194");  // Motif BGCOLOR for documentation
//  IupSetAttribute(dlg, "SAVEUNDER", "NO");

  IupSetAttributeHandle(dlg, "STARTFOCUS", button);

//  IupSetGlobal("CLIENTAREAANIMATION", "No");
//  IupSetGlobal("HOTTRACKING", "No");

  IupShow(dlg);

//  IupSetAttribute(dlg, "PARENTDIALOG", "BIGTEST");
//  IupShowXY(dlg, IUP_CENTERPARENT, IUP_CENTERPARENT);
  //  IupShowXY(dlg,IUP_LEFT,IUP_TOP);
//  IupShowXY(dlg, IUP_RIGHT, IUP_BOTTOM);
//  IupShowXY(dlg, IUP_RIGHT, IUP_CENTER);
//  IupShowXY(dlg,0,0);
}
Пример #7
0
void ButtonTest(void)
{
  Ihandle *dlg, *button, *label, *image1, *image1i, *image1p, *image2, *image3, 
          *box1, *box2;

  /* IupImageLibOpen(); */

  box1 = IupVbox(NULL);
  IupSetAttribute(box1, "MARGIN", "5x5");
  IupSetAttribute(box1, "GAP", "5");
//  IupSetAttribute(box1, "BGCOLOR", "75 150 170");
//  IupSetAttribute(box1, "PADDING", "15x15");

  button = IupButton(NULL, NULL);
  IupSetAttribute(button, "TITLE", "Button Text");
  IupSetCallback(button, "ACTION", active_cb);
  IupAppend(box1, button);

  button = IupButton(NULL, NULL);
  IupSetAttribute(button, "TITLE", "&Text (згн)");
  IupSetAttribute(button, "TIP", "Button Tip");
  //IupSetAttribute(button, "PADDING", "15x15");
  //IupSetAttribute(button, "BGCOLOR", "128 128 255");
  IupSetAttribute(button, "SIZE", "40");
//  IupSetAttribute(button, "FGCOLOR", "0 0 255");
//  IupSetAttribute(button, "RASTERSIZE", "200x100");
  IupSetAttribute(button, "ALIGNMENT", "ACENTER:ACENTER");
//  IupSetAttribute(button, "ALIGNMENT", "ALEFT:ATOP");
  IupSetAttribute(button, "NAME", "button1");
  IupSetAttribute(button, "CANFOCUS", "NO");
  set_callbacks(button);
  IupAppend(box1, button);

  button = IupButton(NULL, NULL);
  IupSetAttribute(button, "TITLE", "Text Button\nSecond Line");
  IupSetAttribute(button, "RASTERSIZE", "200x100");
  IupSetAttribute(button, "ALIGNMENT", "ACENTER:ACENTER");
  IupSetAttribute(button, "FONT", "Helvetica, 14");
  IupSetAttribute(button, "FLAT", "YES");
  IupSetAttribute(button, "NAME", "button2");
  set_callbacks(button);
  IupAppend(box1, button);

  button = IupButton(NULL, NULL);
  IupSetAttribute(button, "TITLE", "Text Button\n<b>Second Line</b>");
  IupSetAttribute(button, "RASTERSIZE", "200x100");
  IupSetAttribute(button, "ALIGNMENT", "ARIGHT:ABOTTOM");
  IupSetAttribute(button, "MARKUP", "YES");
  IupSetAttribute(button, "NAME", "button3");
  IupSetAttribute(button, "CANFOCUS", "NO");
  set_callbacks(button);
  IupAppend(box1, button);

  button = IupButton(NULL, NULL);
  IupSetAttribute(button, "RASTERSIZE", "30x30");
  IupSetAttribute(button, "BGCOLOR", "255 128 92");
  IupSetAttribute(button, "NAME", "color");
  set_callbacks(button);
  IupAppend(box1, button);

  box2 = IupVbox(NULL);
  IupSetAttribute(box2, "MARGIN", "5x5");
  IupSetAttribute(box2, "GAP", "5");
//  IupSetAttribute(box2, "BGCOLOR", "75 150 170");
//  IupSetAttribute(box2, "PADDING", "15x15");

  image1 = IupImage(TEST_IMAGE_SIZE, TEST_IMAGE_SIZE, image_data_8);
  IupSetAttribute(image1, "0", "BGCOLOR");
  IupSetAttribute(image1, "1", "255 0 0"); 
  IupSetAttribute(image1, "2", "0 255 0");
  IupSetAttribute(image1, "3", "0 0 255"); 
  IupSetAttribute(image1, "4", "255 255 255"); 
  IupSetAttribute(image1, "5", "0 0 0"); 

  image1i = IupImage(TEST_IMAGE_SIZE, TEST_IMAGE_SIZE, image_data_8_inactive);
  IupSetAttribute(image1i, "0", "BGCOLOR");
  IupSetAttribute(image1i, "1", "255 0 0"); 
  IupSetAttribute(image1i, "2", "0 255 0");
  IupSetAttribute(image1i, "3", "0 0 255"); 
  IupSetAttribute(image1i, "4", "255 255 255"); 
  IupSetAttribute(image1i, "5", "0 0 0"); 
  IupSetHandle("image1i", image1i); /* so it will be destroyed even when not used */

  image1p = IupImage(TEST_IMAGE_SIZE, TEST_IMAGE_SIZE, image_data_8_pressed);
  IupSetAttribute(image1p, "0", "BGCOLOR");
  IupSetAttribute(image1p, "1", "255 0 0"); 
  IupSetAttribute(image1p, "2", "0 255 0");
  IupSetAttribute(image1p, "3", "0 0 255"); 
  IupSetAttribute(image1p, "4", "255 255 255"); 
  IupSetAttribute(image1p, "5", "0 0 0"); 

  image2 = IupImageRGB(TEST_IMAGE_SIZE, TEST_IMAGE_SIZE, image_data_24);

  image3 = IupImageRGBA(TEST_IMAGE_SIZE, TEST_IMAGE_SIZE, image_data_32);

  button = IupButton(NULL, NULL);
  IupSetAttribute(button, "TITLE", "Images");
  IupSetAttributeHandle(button, "IMAGE", load_image_FileSave());
  IupAppend(box2, button);

  button = IupButton(NULL, NULL);
//  IupSetAttribute(button, "ALIGNMENT", "ALEFT:ATOP");
//  IupSetAttribute(button, "RASTERSIZE", "200x100");
//  IupSetAttribute(button, "IMAGEPOSITION", "BOTTOM");
//  IupSetAttribute(button, "PADDING", "5x5");
//  IupSetAttribute(button, "TITLE", "Text1");
//  IupSetAttribute(button, "FONT", "Helvetica, 14");
//  IupSetAttribute(button, "IMAGE", "IUP_Tecgraf");
  IupSetAttributeHandle(button, "IMAGE", image1);
//  IupSetAttributeHandle(button, "IMINACTIVE", image1i);
  IupSetAttributeHandle(button, "IMPRESS", image1p);
  IupSetAttribute(button, "TIP", "Image Label");
  IupSetAttribute(button, "NAME", "button4");
  set_callbacks(button);
  IupAppend(box2, button);

  button = IupButton(NULL, NULL);
  IupSetAttributeHandle(button, "IMAGE", image2);
//  IupSetAttribute(button, "TITLE", "Text2");
//  IupSetAttribute(button, "IMAGEPOSITION", "TOP");
//  IupSetAttribute(button, "SPACING", "30");
//  IupSetAttribute(button, "ALIGNMENT", "ALEFT");
//  IupSetAttribute(button, "RASTERSIZE", "200x100");
//  IupSetAttribute(button, "FLAT", "YES");
//  IupSetAttributeHandle(button, "IMPRESS", image2);
  IupSetAttribute(button, "CANFOCUS", "NO");
//  IupSetAttribute(button, "RASTERSIZE", "15x15");
  IupSetAttribute(button, "NAME", "button5");
  set_callbacks(button);
  IupAppend(box2, button);

  button = IupButton(NULL, NULL);
  IupSetAttributeHandle(button, "IMAGE", image3);
  IupSetAttribute(button, "TITLE", "Text3");
//  IupSetAttribute(button, "RASTERSIZE", "200x100");
//  IupSetAttribute(button, "ALIGNMENT", "ARIGHT");
  IupSetAttribute(button, "NAME", "button6");
  set_callbacks(button);
  IupAppend(box2, button);

  label = IupLabel(NULL);
  IupSetAttribute(label, "SEPARATOR", "VERTICAL");
  IupSetHandle("seplabel", label);

  dlg = IupDialog(IupHbox(box1, label, box2, NULL));
  IupSetAttribute(dlg, "TITLE", "IupButton Test");
//  IupSetAttribute(box1, "BGCOLOR", "128 0 0");
//  IupSetAttribute(dlg, "BGCOLOR", "0 128 0");
//  IupSetAttribute(dlg, "BACKGROUND", "255 128 128");
//  IupSetAttributeHandle(dlg, "BACKGROUND", image2);
//  IupSetAttribute(dlg, "BGCOLOR", "173 177 194");  // Motif BGCOLOR for documentation

  IupSetAttributeHandle(dlg, "STARTFOCUS", button);

  IupShow(dlg);
}