Exemplo n.º 1
0
Arquivo: tabs.c Projeto: Airr/iup_mac
void TabsTest(void)
{
  Ihandle *box, *frm1, *frm2, *dlg, *tabs;

  tabs = CreateTabs(1);
  
  box = IupHbox(tabs, 
                frm1 = IupFrame(IupRadio(IupVbox(IupToggle("TOP", "cbType"), 
                                                 IupToggle("LEFT", "cbType"), 
                                                 IupToggle("BOTTOM", "cbType"), 
                                                 IupToggle("RIGHT", "cbType"), 
                                                 NULL))), 
                frm2 = IupFrame(IupRadio(IupVbox(IupToggle("HORIZONTAL", "cbOrientation"), 
                                                 IupToggle("VERTICAL", "cbOrientation"), 
                                                 NULL))), 
                IupVbox(IupSetAttributes(IupButton("Add Tab", "cbAddTab"), "TIP=\"Button Tip\""),
                        IupButton("Insert Tab", "cbInsertTab"),
                        IupButton("Remove Tab", "cbRemoveTab"),
                        IupToggle("Inactive", "cbInactive"),
                        IupButton("VALUEPOS=0", "cbValuePos"),
                        NULL), 
                NULL);

  IupSetAttribute(frm1, "MARGIN", "5x5");
  IupSetAttribute(frm2, "MARGIN", "5x5");
  IupSetAttribute(frm1, "GAP", "0");
  IupSetAttribute(frm2, "GAP", "0");
  IupSetAttribute(frm1, "TITLE", "Type");
  IupSetAttribute(frm2, "TITLE", "Orientation");

  IupSetAttribute(box, "MARGIN", "10x10");
  IupSetAttribute(box, "GAP", "10");
  dlg = IupDialog(box);

  IupSetAttribute(dlg, "TITLE", "IupTabs Test");
  IupSetAttribute(dlg, "APP_TABS", (char*)tabs);
//  IupSetAttribute(box, "BGCOLOR", "92 92 255");
//  IupSetAttribute(dlg, "BGCOLOR", "92 92 255");
//  IupSetAttribute(dlg, "BACKGROUND", "200 10 80");
//  IupSetAttributeHandle(dlg, "BACKGROUND", load_image_LogoTecgraf());
//  IupSetAttribute(dlg, "FGCOLOR", "10 200 80");
//  IupSetAttribute(dlg, "BGCOLOR", "173 177 194");  // Motif BGCOLOR for documentation
//  IupSetAttribute(dlg,"COMPOSITED","NO");

  IupMap(dlg);
  IupSetAttribute(dlg, "SIZE", NULL);
  IupShowXY(dlg, IUP_CENTER, IUP_CENTER);

  IupSetFunction("cbOrientation", (Icallback)cbOrientation);
  IupSetFunction("cbType", (Icallback)cbType);
  IupSetFunction("cbAddTab", (Icallback)cbAddTab);
  IupSetFunction("cbInsertTab", (Icallback)cbInsertTab);
  IupSetFunction("cbRemoveTab", (Icallback)cbRemoveTab);
  IupSetFunction("cbInactive", (Icallback)cbInactive);
  IupSetFunction("cbChildButton", (Icallback)cbChildButton);
  IupSetFunction("cbValuePos", (Icallback)cbValuePos);
}
Exemplo n.º 2
0
int main(int argc, char **argv)
{
  Ihandle *male, *female, *exclusive, *frame, *dialog;

  IupOpen(&argc, &argv);

  male  = IupToggle ("Male", "");
  female = IupToggle ("Female", "");

  exclusive = IupRadio
  (
    IupVbox
    (
      male,
      female,
      NULL
    )
  );
  IupSetHandle("male", male);
  IupSetHandle("female", female);
  IupSetAttribute(exclusive, IUP_VALUE, "female");
  IupSetAttribute(exclusive, IUP_TIP, "Two state button - Exclusive - RADIO");

  frame = IupFrame
  (
    exclusive
  );
  IupSetAttribute (frame, IUP_TITLE, "Gender");

  dialog = IupDialog
  (
    IupHbox
    (
      IupFill(),
      frame,
      IupFill(),
      NULL
    )
  );

  IupSetAttributes(dialog, "SIZE=140, TITLE=IupRadio, RESIZE=NO, MINBOX=NO, MAXBOX=NO");

  IupShow(dialog);
  IupMainLoop();
  IupDestroy(dialog);
  IupClose();

  return 0; 
}
Exemplo n.º 3
0
void ScrollBoxTest(void)
{
  Ihandle *mnu, *_hbox_1, *_cnv_1, *_vbox_1, *dlg, *img, *_vbox_2,
    *_frm_1, *_frm_2, *_frm_3, *_frm_4, *_frm_5, *pbar, *val, *tabs,
    *_list_1, *_list_2, *_list_3, *_text_1, *_ml_1, *tree;

  //img = IupImage(32,32, img_bits1);
  //IupSetHandle ("img1", img); 
  //IupSetAttribute (img, "0", "0 0 0"); 
  //IupSetAttribute (img, "1", "BGCOLOR");
  //IupSetAttribute (img, "2", "255 0 0");

  img = load_image_Tecgraf();
  IupSetHandle ("img1", img); 

  img = IupImage(32,32, img_bits2);
  IupSetHandle ("img2", img); 
  IupSetAttribute (img, "0", "0 0 0"); 
  IupSetAttribute (img, "1", "0 255 0");
  IupSetAttribute (img, "2", "BGCOLOR");
  IupSetAttribute (img, "3", "255 0 0");

  mnu = IupMenu(
    IupSubmenu("IupSubmenu 1", IupMenu(
      IupSetAttributes(IupItem("IupItem 1 Checked", NULL), "VALUE=ON"),
      IupSeparator(),

      IupSetAttributes(IupItem("IupItem 2 Disabled", NULL), "ACTIVE=NO"),
      NULL)),
    IupItem("IupItem 3", NULL),
    IupItem("IupItem 4", NULL), 
    NULL);
  IupSetHandle("mnu",mnu);

  _frm_1 = IupFrame(
    IupVbox(
      set_callbacks(IupSetAttributes(IupButton("Button Text", NULL), "PADDING=5x5, TIP=\"Button TIP\"")), 
      IupSetCallbacks(set_callbacks(IupSetAttributes(IupButton("Text", NULL), "IMAGE=img1, PADDING=5x5")),"ACTION", action1_cb, NULL), 
      IupSetCallbacks(set_callbacks(IupSetAttributes(IupButton(NULL, NULL), "IMAGE=img1")),"ACTION", action2_cb, NULL), 
      IupSetCallbacks(set_callbacks(IupSetAttributes(IupButton("", NULL), "IMAGE=img1,IMPRESS=img2")),"ACTION", action3_cb, NULL), 
      IupSetCallbacks(set_callbacks(IupSetAttributes(IupButton(NULL, NULL), "BGCOLOR=\"255 0 128\", SIZE=20x10")),"ACTION", action3_cb, NULL), 
      NULL));
  IupSetAttribute(_frm_1,"TITLE","IupButton");

  _frm_2 = IupFrame(
    IupVbox(
      IupSetAttributes(IupLabel("Label Text"), "TIP=\"Label TIP\""),
      IupSetAttributes(IupLabel(NULL), "SEPARATOR=HORIZONTAL, NAME=SAMP_SEP"),
      IupSetAttributes(IupLabel(NULL), "IMAGE=img1"),
      NULL));
  IupSetAttribute(_frm_2,"TITLE","IupLabel");

  _frm_3 = IupFrame(
    IupVbox(
      set_callbacks(IupSetAttributes(IupToggle("Toggle Text", NULL), "VALUE=ON, TIP=\"Toggle TIP\"")),
      set_callbacks(IupSetAttributes(IupToggle(NULL, NULL), "VALUE=ON,IMAGE=img1,IMPRESS=img2")),
      set_callbacks(IupSetAttributes(IupToggle(NULL, NULL), "VALUE=ON,IMAGE=img1")),
      IupSetAttributes(IupFrame(IupRadio(IupVbox(
        set_callbacks(IupToggle("Toggle Text", NULL)), 
        set_callbacks(IupToggle("Toggle Text", NULL)), 
        NULL))), "TITLE=IupRadio"),
      NULL));
  IupSetAttribute(_frm_3,"TITLE","IupToggle");

  _text_1 = IupText( NULL);
  IupSetAttribute(_text_1,"VALUE","Single Line Text");
  IupSetAttribute(_text_1,"SIZE","80x");
  IupSetAttribute(_text_1,"TIP","Text TIP");

  _ml_1 = IupMultiLine( NULL);
  IupSetAttribute(_ml_1,"VALUE","Multiline Text\nSecond Line\nThird Line");
  IupSetAttribute(_ml_1,"EXPAND","YES");
  IupSetAttribute(_ml_1,"SIZE","80x40");
  IupSetAttribute(_ml_1,"TIP","Multiline TIP");

  _frm_4 = IupFrame(IupVbox(
    set_callbacks(_text_1),
    set_callbacks(_ml_1),
    NULL));
  IupSetAttribute(_frm_4,"TITLE","IupText");

  _list_1 = IupList( NULL);
//  IupSetAttribute(_list_1,"EXPAND","YES");
  IupSetAttribute(_list_1,"VALUE","1");
  IupSetAttribute(_list_1,"1","Item 1 Text");
  IupSetAttribute(_list_1,"2","Item 2 Text");
  IupSetAttribute(_list_1,"3","Item 3 Text");
  IupSetAttribute(_list_1,"TIP","List 1");

  _list_2 = IupList( NULL);
  IupSetAttribute(_list_2,"DROPDOWN","YES");
//  IupSetAttribute(_list_2,"EXPAND","YES");
  IupSetAttribute(_list_2,"VALUE","2");
  IupSetAttribute(_list_2,"1","Item 1 Text");
  IupSetAttribute(_list_2,"2","Item 2 Text");
  IupSetAttribute(_list_2,"3","Item 3 Text");
  IupSetAttribute(_list_2,"TIP","List 2");

  _list_3 = IupList( NULL);
  IupSetAttribute(_list_3,"EDITBOX","YES");
//  IupSetAttribute(_list_3,"EXPAND","YES");
  IupSetAttribute(_list_3,"VALUE","3");
  IupSetAttribute(_list_3,"1","Item 1 Text");
  IupSetAttribute(_list_3,"2","Item 2 Text");
  IupSetAttribute(_list_3,"3","Item 3 Text");
  IupSetAttribute(_list_3,"TIP","List 3");

  _frm_5 =  IupFrame(IupVbox(
      set_callbacks(_list_1),
      set_callbacks(_list_2),
      set_callbacks(_list_3),
      NULL));
  IupSetAttribute(_frm_5,"TITLE","IupList");

  _hbox_1 = IupHbox(
    _frm_1,
    _frm_2,
    _frm_3,
    _frm_4,
    _frm_5,
    NULL);

  val = IupVal(NULL);
  IupSetAttribute(val,"TIP","Valuator TIP");
  set_callbacks(val);
  
  pbar = IupProgressBar();
  IupSetAttribute(pbar, "VALUE", "0.5");
  IupSetAttribute(pbar,"TIP","ProgressBar TIP");
  set_callbacks(pbar);

  tabs = IupTabs(IupVbox(IupLabel("Tab0"), NULL), IupVbox(IupLabel("Tab1"), NULL), IupVbox(IupLabel("Tab2"), NULL), NULL);
  IupSetAttribute(tabs,"TABTITLE0","Tab Title 0");
  IupSetAttribute(tabs,"TABTITLE1","Tab Title 1");
  IupSetAttributeHandle(tabs,"TABIMAGE1", load_image_LogoTecgraf());
  IupSetAttribute(tabs,"TABTITLE2","Tab Title 2");
  IupSetAttribute(tabs,"RASTERSIZE","300x50");
  IupSetAttribute(tabs,"TIP","Tabs TIP");
//  IupSetAttribute(tabs,"PADDING","5x5");
  set_callbacks(tabs);

  tree = IupTree();
  IupSetAttribute(tree, "SHOWRENAME",   "YES");
  IupSetAttribute(tree,"RASTERSIZE","300x150");
  IupSetAttribute(tree,"TIP","Tree TIP");
  IupSetAttribute(tree,"EXPAND","NO");
  set_callbacks(tree);

  _cnv_1 = IupCanvas(NULL);
  IupSetAttribute(_cnv_1,"BGCOLOR","128 255 0");
  IupSetAttribute(_cnv_1,"SCROLLBAR","YES");
//  IupSetAttribute(_cnv_1,"EXPAND","HORIZONTAL");
  IupSetAttribute(_cnv_1,"EXPAND","NO");
  IupSetAttribute(_cnv_1,"RASTERSIZE","200x100");
  IupSetAttribute(_cnv_1,"TIP","Canvas TIP");
//  IupSetAttribute(_cnv_1,"CANFOCUS","NO");
  set_callbacks(_cnv_1);

  _vbox_1 = IupVbox(
    _hbox_1,
    IupHbox(IupSetAttributes(IupFrame(IupHbox(val, NULL)), "TITLE=IupVal"),
            IupSetAttributes(IupFrame(IupHbox(pbar, NULL)), "TITLE=IupProgressBar"),
            IupSetAttributes(IupFrame(IupHbox(tabs, NULL)), "TITLE=IupTabs"),
            NULL),
    IupHbox(IupSetAttributes(IupFrame(IupHbox(_cnv_1, NULL)), "TITLE=IupCanvas"),
            IupSetAttributes(IupFrame(IupHbox(tree, NULL)), "TITLE=IupTree"),
            NULL),
    IupHbox(IupSetAttributes(IupFrame(IupHbox(create_matrix(), NULL)), "TITLE=IupMatrix"),
            NULL),
    NULL);
  IupSetAttribute(_vbox_1,"MARGIN","5x5");
  IupSetAttribute(_vbox_1,"GAP","5");

//  _vbox_2 = IupVbox(IupSetAttributes(IupScrollBox(_vbox_1), "RASTERSIZE=400x300"), NULL);
  _vbox_2 = IupVbox(IupScrollBox(_vbox_1), NULL);
  IupSetAttribute(_vbox_2,"MARGIN","20x20");

  dlg = IupDialog(_vbox_2);
  IupSetHandle("dlg",dlg);
  IupSetAttribute(dlg,"MENU","mnu");
  IupSetAttribute(dlg,"TITLE","IupDialog Title");
//  IupSetAttribute(dlg,"COMPOSITED","YES");   /* Windows Only */
//  IupSetAttribute(dlg, "OPACITY", "192");
//  IupSetAttribute(dlg, "RESIZE", "NO");

//  IupSetAttribute(dlg, "BGCOLOR", "173 177 194");  // Motif BGCOLOR for documentation
//  IupSetAttribute(_vbox_1, "BGCOLOR", "92 92 255");
//  IupSetAttribute(dlg, "BGCOLOR", "92 92 255");
//  IupSetAttribute(dlg, "BACKGROUND", "200 10 80");

  //IupSetGlobal("DLGBGCOLOR", "92 92 255");
  //IupSetGlobal("TXTFGCOLOR", "255 92 92");
  //IupSetGlobal("TXTBGCOLOR", "92 92 255");

//  IupSetAttribute(dlg, "FONT", "Helvetica, 24");
//  IupSetAttribute(dlg, "FONT", "-*-helvetica-*-r-*-*-18-*-*-*-*-*-*-*");
  
//  IupSetAttribute(box, "FGCOLOR", "255 0 0");

  //IupSetAttribute(dlg,"RASTERSIZE","1000x800");
  IupSetAttribute(dlg,"RASTERSIZE","400x300");
  IupSetCallback(dlg, "RESIZE_CB", (Icallback)resize_cb);

  IupMap(dlg);

  IupSetAttribute(tree, "TITLE0",         "Figures");  
  IupSetAttribute(tree, "ADDLEAF0",      "Other");     /* new id=1 */
  IupSetAttribute(tree, "ADDBRANCH1",   "triangle");  /* new id=2 */     
  IupSetAttribute(tree, "ADDLEAF2",     "equilateral");  /* ... */
  IupSetAttribute(tree, "ADDLEAF3",     "isoceles");
  IupSetAttribute(tree, "ADDLEAF4",     "scalenus");

  IupShow(dlg);

  IupSetAttribute(dlg,"RASTERSIZE", NULL);
}
Exemplo n.º 4
0
void func_1 (void)
{
  Ihandle *_cbox, *_cnv_1, *dlg, *img, 
    *_frm_1, *_frm_2, *_frm_3, *hbox, *_ctrl_1,
    *_list_1, *_list_2, *_list_3, *_text_1, *_ml_1;

  img = IupImage(32,32, img_bits1);
  IupSetHandle ("img1", img); 
  IupSetAttribute (img, "0", "0 0 0"); 
  IupSetAttribute (img, "1", "BGCOLOR");
  IupSetAttribute (img, "2", "255 0 0");

  img = IupImage(32,32, img_bits2);
  IupSetHandle ("img2", img); 
  IupSetAttribute (img, "0", "0 0 0"); 
  IupSetAttribute (img, "1", "0 255 0");
  IupSetAttribute (img, "2", "BGCOLOR");
  IupSetAttribute (img, "3", "255 0 0");

  _frm_1 = IupFrame(
    IupVbox(
      IupSetAttributes(IupButton("Button Text", NULL), "CINDEX=1"),
      IupSetAttributes(IupButton("", NULL), "IMAGE=img1,CINDEX=2"),
      IupSetAttributes(IupButton("", NULL), "IMAGE=img1,IMPRESS=img2,CINDEX=3"),
      NULL));
  IupSetAttribute(_frm_1,"TITLE","IupButton");
  IupSetAttribute(_frm_1,"CX","10");
  IupSetAttribute(_frm_1,"CY","180");

  _frm_2 = IupFrame(
    IupVbox(
      IupSetAttributes(IupLabel("Label Text"), "CINDEX=1"),
      IupSetAttributes(IupLabel(""), "SEPARATOR=HORIZONTAL,CINDEX=2"),
      IupSetAttributes(IupLabel(""), "IMAGE=img1,CINDEX=3"),
      NULL));
  IupSetAttribute(_frm_2,"TITLE","IupLabel");
  IupSetAttribute(_frm_2,"CX","200");
  IupSetAttribute(_frm_2,"CY","250");

  _frm_3 = IupFrame(
    IupVbox(
      IupSetAttributes(IupToggle("Toggle Text", NULL), "VALUE=ON,CINDEX=1"),
      IupSetAttributes(IupToggle("", NULL), "IMAGE=img1,IMPRESS=img2,CINDEX=2"),
      IupSetAttributes(IupFrame(IupRadio(IupVbox(
        IupSetAttributes(IupToggle("Toggle Text", NULL), "CINDEX=3"),
        IupSetAttributes(IupToggle("Toggle Text", NULL), "CINDEX=4"),
        NULL))), "TITLE=IupRadio"),
      NULL));
  IupSetAttribute(_frm_3,"TITLE","IupToggle");
  IupSetAttribute(_frm_3,"CX","400");
  IupSetAttribute(_frm_3,"CY","250");

  _text_1 = IupText( NULL);
  IupSetAttribute(_text_1,"VALUE","IupText Text");
  IupSetAttribute(_text_1,"SIZE","80x");
  IupSetAttribute(_text_1,"CINDEX","1");
  IupSetAttribute(_text_1,"CX","10");
  IupSetAttribute(_text_1,"CY","100");

  _ml_1 = IupMultiLine( NULL);
  IupSetAttribute(_ml_1,"VALUE","IupMultiline Text\nSecond Line\nThird Line");
  IupSetAttribute(_ml_1,"SIZE","80x60");
  IupSetAttribute(_ml_1,"CINDEX","1");
  IupSetAttribute(_ml_1,"CX","200");
  IupSetAttribute(_ml_1,"CY","100");

  _list_1 = IupList( NULL);
  IupSetAttribute(_list_1,"VALUE","1");
  IupSetAttribute(_list_1,"1","Item 1 Text");
  IupSetAttribute(_list_1,"2","Item 2 Text");
  IupSetAttribute(_list_1,"3","Item 3 Text");
  IupSetAttribute(_list_1,"CINDEX","1");
  IupSetAttribute(_list_1,"CX","10");
  IupSetAttribute(_list_1,"CY","10");

  _list_2 = IupList( NULL);
  IupSetAttribute(_list_2,"DROPDOWN","YES");
  IupSetAttribute(_list_2,"VALUE","2");
  IupSetAttribute(_list_2,"1","Item 1 Text");
  IupSetAttribute(_list_2,"2","Item 2 Text");
  IupSetAttribute(_list_2,"3","Item 3 Text");
  IupSetAttribute(_list_2,"CINDEX","2");
  IupSetAttribute(_list_2,"CX","200");
  IupSetAttribute(_list_2,"CY","10");

  _list_3 = IupList( NULL);
  IupSetAttribute(_list_3,"EDITBOX","YES");
  IupSetAttribute(_list_3,"VALUE","3");
  IupSetAttribute(_list_3,"1","Item 1 Text");
  IupSetAttribute(_list_3,"2","Item 2 Text");
  IupSetAttribute(_list_3,"3","Item 3 Text");
  IupSetAttribute(_list_3,"CINDEX","3");
  IupSetAttribute(_list_3,"CX","400");
  IupSetAttribute(_list_3,"CY","10");

  _cnv_1 = IupCanvas( NULL);
  IupSetAttribute(_cnv_1,"RASTERSIZE","100x100");
  IupSetAttribute(_cnv_1,"POSX","0");
  IupSetAttribute(_cnv_1,"POSY","0");
  IupSetAttribute(_cnv_1,"BGCOLOR","128 255 0");
  IupSetAttribute(_cnv_1,"CX","400");
  IupSetAttribute(_cnv_1,"CY","150");

  _ctrl_1 = IupVal(NULL);
  IupSetAttribute(_ctrl_1,"CX","600");
  IupSetAttribute(_ctrl_1,"CY","200");

  _cbox = IupCbox(
    _text_1,
    _ml_1,
    _list_1,
    _list_2,
    _list_3,
    _cnv_1,
    _ctrl_1,
    createtree(),
    create_mat(),
    _frm_1,
    _frm_2,
    _frm_3,
    NULL);
  IupSetAttribute(_cbox,"SIZE","480x200");

  hbox = IupSetAttributes(IupHbox(_cbox, NULL), "MARGIN=10x10");

  dlg = IupDialog(hbox);
  IupSetHandle("dlg",dlg);
  IupSetAttribute(dlg,"TITLE","Cbox Test");
}
Exemplo n.º 5
0
int main(int argc, char **argv)
{
  char string_size [ 45 ];
  
  Ihandle *dlg;
  Ihandle *img_x, *img_cursor;
  Ihandle *lbl, *lbl_size;
  Ihandle *btn;
  Ihandle *tgl, *tgl_radio_1, *tgl_radio_2;
  Ihandle *frm_lbl, *frm_btn, *frm_tgl, *frm_tgl_radio;

  IupOpen(&argc, &argv);

  img_x = IupImage ( 11, 11, pixmap_x );
  IupSetAttribute ( img_x, "1", "0 1 0");
  IupSetAttribute ( img_x, "2", "255 0 0"); 
  IupSetAttribute ( img_x, "3", "255 255 0");

  IupSetHandle ( "img_x", img_x );
  img_cursor = IupImage ( 32, 32, pixmap_cursor );

  IupSetAttribute ( img_cursor, "1", "255 0 0" ); 
  IupSetAttribute ( img_cursor, "2", "128 0 0" ); 

  IupSetAttribute ( img_cursor, "HOTSPOT", "21:10" );
  
  IupSetHandle ( "img_cursor", img_cursor );

  btn = IupButton ( "Dummy", "" );
  IupSetAttribute ( btn, "IMAGE", "img_x" );

  lbl = IupLabel ( "Dummy" );
  IupSetAttribute ( lbl, "IMAGE", "img_x" );

  tgl = IupToggle ( "Dummy", NULL );
  IupSetAttribute ( tgl, "IMAGE", "img_x" );

  tgl_radio_1 = IupToggle ( "Dummy", NULL );
  tgl_radio_2 = IupToggle ( "Dummy", NULL );

  IupSetAttribute ( tgl_radio_1, "IMAGE", "img_x" );
  IupSetAttribute ( tgl_radio_2, "IMAGE", "img_x" );

  sprintf ( string_size, "\"X\" image width = %s; \"X\" image height = %s", IupGetAttribute ( img_x, "WIDTH" ),
                                                                            IupGetAttribute ( img_x, "HEIGHT" ) ); 

  lbl_size = IupLabel ( string_size );
  
  frm_btn = IupFrame ( btn );
  frm_lbl = IupFrame ( lbl );
  frm_tgl = IupFrame ( tgl );
  frm_tgl_radio = IupFrame ( IupRadio ( IupVbox ( tgl_radio_1, tgl_radio_2, NULL ) ) );

  IupSetAttributes ( frm_btn, "TITLE=button, SIZE=EIGHTHxEIGHTH" );
  IupSetAttributes ( frm_lbl, "TITLE=label , SIZE=EIGHTHxEIGHTH" );
  IupSetAttributes ( frm_tgl, "TITLE=toggle, SIZE=EIGHTHxEIGHTH" );
  IupSetAttributes ( frm_tgl_radio, "TITLE=radio, SIZE=EIGHTHxEIGHTH" );
  
  dlg = IupDialog
        (
          IupVbox
          (
            IupHbox ( frm_btn, frm_lbl, frm_tgl, frm_tgl_radio, NULL ),
            IupFill(),
            IupHbox ( IupFill(), lbl_size, IupFill(), NULL ), NULL
          )
        );

  IupSetAttributes ( dlg, "TITLE=\"IupImage Example\", SIZE=HALFxQUARTER, CURSOR=img_cursor" );

  IupShowXY ( dlg, IUP_CENTER, IUP_CENTER );
  IupMainLoop();
  IupClose();
  return EXIT_SUCCESS;

}
Exemplo n.º 6
0
void func_1 (void)
{
  Ihandle *_cbox, *_cnv_1, *dlg, *img, 
    *_frm_1, *_frm_2, *_frm_3, *hbox, *_ctrl_1,
    *_list_1, *_list_2, *_list_3, *_text_1, *_ml_1;

  img = IupImage(32,32, img_bits1);
  IupSetHandle ("img1", img); 
  IupSetAttribute (img, "0", "0 0 0"); 
  IupSetAttribute (img, "1", "BGCOLOR");
  IupSetAttribute (img, "2", "255 0 0");

  img = IupImage(32,32, img_bits2);
  IupSetHandle ("img2", img); 
  IupSetAttribute (img, "0", "0 0 0"); 
  IupSetAttribute (img, "1", "0 255 0");
  IupSetAttribute (img, "2", "BGCOLOR");
  IupSetAttribute (img, "3", "255 0 0");

  _frm_1 = IupFrame(
    IupVbox(
      IupSetAttributes(IupButton("Button Text", "action"), "BGCOLOR=\"255 128 0\", CINDEX=1"),
      IupSetAttributes(IupButton("", "action"), "BGCOLOR=\"255 128 0\", CINDEX=1"),
      IupSetAttributes(IupButton("", "action"), "IMAGE=img1,BGCOLOR=\"255 128 0\", CINDEX=2"),
      IupSetAttributes(IupButton("", "action"), "IMAGE=img1,BGCOLOR=\"255 128 0\", IMPRESS=img2,CINDEX=3"),
      NULL));
  IupSetAttribute(_frm_1,IUP_TITLE,"IupButton");
  IupSetAttribute(_frm_1,"CX","10");
  IupSetAttribute(_frm_1,"CY","180");

  _frm_2 = IupFrame(
    IupVbox(
      IupSetAttributes(IupLabel("Label Text"), "CINDEX=1,FONT=HELVETICA_ITALIC_14"),
      IupSetAttributes(IupLabel(""), "SEPARATOR=HORIZONTAL,CINDEX=2"),
      IupSetAttributes(IupLabel(""), "IMAGE=img1,CINDEX=3"),
      NULL));
  IupSetAttribute(_frm_2,IUP_TITLE,"IupLabel");
  IupSetAttribute(_frm_2,"CX","200");
  IupSetAttribute(_frm_2,"CY","250");

  _frm_3 = IupFrame(
    IupVbox(
      IupSetAttributes(IupToggle("Toggle Text", "action"), "VALUE=ON,CINDEX=1,FONT=HELVETICA_ITALIC_14"),
      IupSetAttributes(IupToggle("", "action"), "IMAGE=img1,IMPRESS=img2,CINDEX=2"),
      IupSetAttributes(IupFrame(IupRadio(IupVbox(
        IupSetAttributes(IupToggle("Toggle Text", "action"), "CINDEX=3"),
        IupSetAttributes(IupToggle("Toggle Text", "action"), "CINDEX=4"),
        NULL))), "TITLE=IupRadio"),
      NULL));
  IupSetAttribute(_frm_3,IUP_TITLE,"IupToggle");
  IupSetAttribute(_frm_3,"CX","400");
  IupSetAttribute(_frm_3,"CY","250");
  IupSetAttribute(_frm_3,"RASTERSIZE","150x150");

  _text_1 = IupText( "action");
  IupSetAttribute(_text_1,IUP_VALUE,"IupText Text");
  IupSetAttribute(_text_1,IUP_SIZE,"80x");
  IupSetAttribute(_text_1,"CINDEX","1");
  IupSetAttribute(_text_1,"CX","10");
  IupSetAttribute(_text_1,"CY","100");

  _ml_1 = IupMultiLine( "action");
  IupSetAttribute(_ml_1,IUP_VALUE,"IupMultiline Text\nSecond Line\nThird Line");
  IupSetAttribute(_ml_1,IUP_SIZE,"80x60");
  IupSetAttribute(_ml_1,"CINDEX","1");
  IupSetAttribute(_ml_1,"CX","200");
  IupSetAttribute(_ml_1,"CY","100");

  _list_1 = IupList( "action");
  IupSetAttribute(_list_1,IUP_VALUE,"1");
  IupSetAttribute(_list_1,"1","Item 1 Text");
  IupSetAttribute(_list_1,"2","Item 2 Text");
  IupSetAttribute(_list_1,"3","Item 3 Text");
  IupSetAttribute(_list_1,"CINDEX","1");
  IupSetAttribute(_list_1,"CX","10");
  IupSetAttribute(_list_1,"CY","10");

  _list_2 = IupList( "action");
  IupSetAttribute(_list_2,IUP_DROPDOWN,"YES");
  IupSetAttribute(_list_2,IUP_VALUE,"2");
  IupSetAttribute(_list_2,"1","Item 1 Text");
  IupSetAttribute(_list_2,"2","Item 2 Text");
  IupSetAttribute(_list_2,"3","Item 3 Text");
  IupSetAttribute(_list_2,"CINDEX","2");
  IupSetAttribute(_list_2,"CX","200");
  IupSetAttribute(_list_2,"CY","10");

  _list_3 = IupList( "action");
  IupSetAttribute(_list_3,"EDITBOX","YES");
  IupSetAttribute(_list_3,IUP_VALUE,"3");
  IupSetAttribute(_list_3,"1","Item 1 Text");
  IupSetAttribute(_list_3,"2","Item 2 Text");
  IupSetAttribute(_list_3,"3","Item 3 Text");
  IupSetAttribute(_list_3,"CINDEX","3");
  IupSetAttribute(_list_3,"CX","400");
  IupSetAttribute(_list_3,"CY","10");

  _cnv_1 = IupCanvas( "do_nothing");
  IupSetAttribute(_cnv_1,IUP_RASTERSIZE,"100x100");
  IupSetAttribute(_cnv_1,IUP_POSX,"0.0");
  IupSetAttribute(_cnv_1,IUP_POSY,"0.0");
  IupSetAttribute(_cnv_1,IUP_BGCOLOR,"128 255 0");
  IupSetAttribute(_cnv_1,"CX","400");
  IupSetAttribute(_cnv_1,"CY","150");

  _ctrl_1 = IupVal(NULL);
  IupSetAttribute(_ctrl_1,"CX","600");
  IupSetAttribute(_ctrl_1,"CY","200");

//  _cbox = IupCbox(
  _cbox = IupCboxBuilder(
    _text_1,
    _ml_1,
    _list_1,
    _list_2,
    _list_3,
    _cnv_1,
    _ctrl_1,
    createtree(),
    create_mat(),
    _frm_1,
    _frm_2,
    _frm_3,
    NULL);
  IupSetAttribute(_cbox,IUP_SIZE,"560x200");

  hbox = IupHbox(
           IupSetAttributes(IupFill(), "SIZE=10"), 
           IupVbox(
             IupSetAttributes(IupFill(), "SIZE=10"), 
             IupFrame(_cbox), 
             IupSetAttributes(IupLabel("Label Text"), "FONT=HELVETICA_ITALIC_14"),
             NULL), 
           NULL);

  dlg = IupDialog(hbox);
  IupSetHandle("dlg",dlg);
  IupSetAttribute(dlg,IUP_TITLE,"Cbox Test");
  IupSetAttribute(dlg,"COMPOSITED","YES");   /* improves a lot the redrawing */
//  IupSetAttribute(dlg,"FONT","HELVETICA_ITALIC_14");
}
Exemplo n.º 7
0
static void CreateRadio(void)
{
  lua_pushusertag(IupRadio(iuplua_checkihandle(1)), iuplua_tag);
}
Exemplo n.º 8
0
void SampleTest(void)
{
  Ihandle *mnu, *_hbox_1, *_cnv_1, *_vbox_1, *dlg, *img, 
    *_frm_1, *_frm_2, *_frm_3, *_frm_4, *_frm_5, *pbar, *val, *tabs,
    *_list_1, *_list_2, *_list_3, *_text_1, *_ml_1;

  //img = IupImage(32,32, img_bits1);
  //IupSetHandle ("img1", img); 
  //IupSetAttribute (img, "0", "0 0 0"); 
  //IupSetAttribute (img, "1", "BGCOLOR");
  //IupSetAttribute (img, "2", "255 0 0");

  //img = load_image_Tecgraf();
  //IupSetHandle ("img1", img); 

  img = IupImage(32,32, img_bits2);
  IupSetHandle ("img2", img); 
  IupSetAttribute (img, "0", "0 0 0"); 
  IupSetAttribute (img, "1", "0 255 0");
  IupSetAttribute (img, "2", "BGCOLOR");
  IupSetAttribute (img, "3", "255 0 0");

  mnu = IupMenu(
    IupSubmenu("IupSubmenu 1", IupMenu(
      IupSetAttributes(IupItem("IupItem 1 Checked", NULL), "VALUE=ON"),
      IupSeparator(),
      IupSetAttributes(IupItem("IupItem 2 Disabled", NULL), "ACTIVE=NO"),
      NULL)),
    IupItem("IupItem 3", NULL),
    IupItem("IupItem 4", NULL), 
    NULL);
  IupSetHandle("mnu",mnu);

  _frm_1 = IupFrame(
    IupVbox(
      IupSetAttributes(IupButton("Button Text", NULL), "PADDING=5x5"), 
      IupSetAttributes(IupButton("Text", NULL), "IMAGE=img1, PADDING=5x5"),
      IupSetAttributes(IupButton(NULL, NULL), "IMAGE=img1"),
      IupSetAttributes(IupButton("", NULL), "IMAGE=img1,IMPRESS=img2"),
      NULL));
  IupSetAttribute(_frm_1,"TITLE","IupButton");

  _frm_2 = IupFrame(
    IupVbox(
      IupLabel("Label Text"), 
      IupSetAttributes(IupLabel(NULL), "SEPARATOR=HORIZONTAL"),
      IupSetAttributes(IupLabel(NULL), "IMAGE=img1"),
      NULL));
  IupSetAttribute(_frm_2,"TITLE","IupLabel");

  _frm_3 = IupFrame(
    IupVbox(
      IupSetAttributes(IupToggle("Toggle Text", NULL), "VALUE=ON"),
//      IupSetAttributes(IupToggle(NULL, NULL), "VALUE=ON,IMAGE=img1,IMPRESS=img2"),
      IupSetAttributes(IupToggle(NULL, NULL), "VALUE=ON,IMAGE=img1"),
      IupSetAttributes(IupFrame(IupRadio(IupVbox(
        IupToggle("Toggle Text", NULL), 
        IupToggle("Toggle Text", NULL), 
        NULL))), "TITLE=IupRadio"),
      NULL));
  IupSetAttribute(_frm_3,"TITLE","IupToggle");

  _text_1 = IupText( NULL);
  IupSetAttribute(_text_1,"VALUE","Single Line Text");
  IupSetAttribute(_text_1,"SIZE","80x");

  _ml_1 = IupMultiLine( NULL);
  IupSetAttribute(_ml_1,"VALUE","Multiline Text\nSecond Line\nThird Line");
  IupSetAttribute(_ml_1,"EXPAND","YES");
  IupSetAttribute(_ml_1,"SIZE","80x40");

  _frm_4 = IupFrame(IupVbox(
    _text_1,
    _ml_1,
    NULL));
  IupSetAttribute(_frm_4,"TITLE","IupText");

  _list_1 = IupList( NULL);
//  IupSetAttribute(_list_1,"EXPAND","YES");
  IupSetAttribute(_list_1,"VALUE","1");
  IupSetAttribute(_list_1,"1","Item 1 Text");
  IupSetAttribute(_list_1,"2","Item 2 Text");
  IupSetAttribute(_list_1,"3","Item 3 Text");

  _list_2 = IupList( NULL);
  IupSetAttribute(_list_2,"DROPDOWN","YES");
//  IupSetAttribute(_list_2,"EXPAND","YES");
  IupSetAttribute(_list_2,"VALUE","2");
  IupSetAttribute(_list_2,"1","Item 1 Text");
  IupSetAttribute(_list_2,"2","Item 2 Text");
  IupSetAttribute(_list_2,"3","Item 3 Text");

  _list_3 = IupList( NULL);
  IupSetAttribute(_list_3,"EDITBOX","YES");
//  IupSetAttribute(_list_3,"EXPAND","YES");
  IupSetAttribute(_list_3,"VALUE","3");
  IupSetAttribute(_list_3,"1","Item 1 Text");
  IupSetAttribute(_list_3,"2","Item 2 Text");
  IupSetAttribute(_list_3,"3","Item 3 Text");

  _frm_5 =  IupFrame(IupVbox(
      _list_1,
      _list_2,
      _list_3,
      NULL));
  IupSetAttribute(_frm_5,"TITLE","IupList");

  _hbox_1 = IupHbox(
    _frm_1,
    _frm_2,
    _frm_3,
    _frm_4,
    _frm_5,
    NULL);

  val = IupVal(NULL);
  
  pbar = IupGauge();
  IupSetAttribute(pbar, "VALUE", "0.5");

  tabs = IupTabs(IupVbox(NULL), IupVbox(NULL), IupVbox(NULL), NULL);
  IupSetAttribute(tabs,"TABTITLE0","Tab Title 0");
  IupSetAttribute(tabs,"TABTITLE1","Tab Title 1");
  //IupSetAttributeHandle(tabs,"TABIMAGE1", load_image_LogoTecgraf());
  IupSetAttribute(tabs,"TABTITLE2","Tab Title 2");
  IupSetAttribute(tabs,"RASTERSIZE","300x50");
//  IupSetAttribute(tabs,"PADDING","5x5");

  _cnv_1 = IupCanvas(NULL);
  IupSetAttribute(_cnv_1,"BGCOLOR","128 255 0");
  IupSetAttribute(_cnv_1,"SCROLLBAR","HORIZONTAL");
  IupSetAttribute(_cnv_1,"EXPAND","HORIZONTAL");
  IupSetAttribute(_cnv_1,"RASTERSIZE","x100");

  _vbox_1 = IupVbox(
    _hbox_1,
    IupHbox(IupSetAttributes(IupFrame(IupHbox(val, NULL)), "TITLE=IupVal"),
            IupSetAttributes(IupFrame(IupHbox(pbar, NULL)), "TITLE=IupGauge"),
            IupSetAttributes(IupFrame(IupHbox(tabs, NULL)), "TITLE=IupTabs"),
            NULL),
    IupSetAttributes(IupFrame(IupHbox(_cnv_1, NULL)), "TITLE=IupCanvas"),
    NULL);
  IupSetAttribute(_vbox_1,"MARGIN","5x5");
  IupSetAttribute(_vbox_1,"GAP","5");

  dlg = IupDialog(_vbox_1);
  IupSetHandle("dlg",dlg);
  IupSetAttribute(dlg,"MENU","mnu");
  IupSetAttribute(dlg,"TITLE","IupDialog Title");
//  IupSetAttribute(dlg,"COMPOSITED","NO");   /* Windows Only */

//  IupSetAttribute(dlg, "BGCOLOR", "173 177 194");  // Motif BGCOLOR for documentation
//  IupSetAttribute(_vbox_1, "BGCOLOR", "92 92 255");
//  IupSetAttribute(dlg, "BGCOLOR", "92 92 255");
//  IupSetAttribute(dlg, "BACKGROUND", "200 10 80");

//  IupSetAttribute(dlg, "FONT", "Helvetica, 24");
//  IupSetAttribute(dlg, "FONT", "-*-helvetica-*-r-*-*-18-*-*-*-*-*-*-*");
  
//  IupSetAttribute(box, "FGCOLOR", "255 0 0");

  IupShow(dlg);
}
Exemplo n.º 9
0
void GLCanvasCubeTest(void)
{
  Ihandle *dlg, *canvas, *box, *gtoggle, *gtoggle1, *gtoggle2,
    *hbox, *vbox, *glabel, *gsep1, *gsep2, *gbutton1, *gbutton2,
    *pbar1, *pbar2, *glink, *gval1, *gval2, *gframe1, *gframe2,
    *gexp1, *gexp2, *image_open, *image_close, *image_high,
    *gframe3, *vbox2, *gtoggle3, *gtoggle4, *gtoggle5, *gsbox,
    *text, *vbox3, *matrix, *image_val;

  IupGLCanvasOpen();
  IupGLControlsOpen();
  IupControlsOpen();

  glabel = IupGLLabel("Label");
//  IupSetAttribute(glabel, "FGCOLOR", "255 255 255");
  IupSetAttribute(glabel, "FONT", "Helvetica, 24");
  IupSetAttributeHandle(glabel, "IMAGE", load_image_Tecgraf());

  gbutton1 = IupGLButton("Button");
  IupSetAttribute(gbutton1, "PADDING", "5x5");
  //IupSetAttribute(gbutton1, "BGCOLOR", "245 0 245 92");
  IupSetCallback(gbutton1, "ACTION", button_action_cb);
  IupSetAttribute(gbutton1, "NAME", "button1");
  IupSetAttribute(gbutton1, "TIP", "Button Tip");
  //  IupSetAttribute(gbutton1, "RASTERSIZE", "x100");

  if (0)
  {
    Ihandle* pressed_back = IupLoadImage("../test/pressed_back.png");
    Ihandle* enabled_back = IupLoadImage("../test/enabled_back.png");
    Ihandle* highlighted_back = IupLoadImage("../test/highlighted_back.png");

    IupSetAttributeHandle(gbutton1, "BACKIMAGE", enabled_back);
    IupSetAttributeHandle(gbutton1, "BACKIMAGEPRESS", pressed_back);
    IupSetAttributeHandle(gbutton1, "BACKIMAGEHIGHLIGHT", highlighted_back);
    IupSetAttribute(gbutton1, "BORDERCOLOR", "0 0 0 0");
  }

  gbutton2 = IupGLButton(NULL);
  IupSetAttribute(gbutton2, "PADDING", "5x5");
  IupSetAttributeHandle(gbutton2, "IMAGE", load_image_FileSave());
  IupSetCallback(gbutton2, "ACTION", button_action_cb);
  IupSetAttribute(gbutton2, "NAME", "button2");

  gtoggle = IupGLToggle("Toggle");
  IupSetAttribute(gtoggle, "PADDING", "5x5");
  IupSetCallback(gtoggle, "ACTION", (Icallback)toggle_action_cb);
  IupSetAttribute(gtoggle, "NAME", "toggle");

  gtoggle1 = IupGLToggle(NULL);
  IupSetAttribute(gtoggle1, "PADDING", "5x5");
  IupSetAttributeHandle(gtoggle1, "IMAGE", load_image_Test());
  IupSetCallback(gtoggle1, "ACTION", (Icallback)toggle_action_cb);
  IupSetAttribute(gtoggle1, "NAME", "toggle1");

  gtoggle2 = IupGLToggle(NULL);
  IupSetAttribute(gtoggle2, "PADDING", "5x5");
  IupSetAttributeHandle(gtoggle2, "IMAGE", load_image_Test());
  IupSetCallback(gtoggle2, "ACTION", (Icallback)toggle_action_cb);
  IupSetAttribute(gtoggle2, "NAME", "toggle2");

  gsep1 = IupGLSeparator();

  glink = IupGLLink("http://www.tecgraf.puc-rio.br/iup", "IUP Toolkit");
  IupSetCallback(glink, "ACTION", (Icallback)link_action_cb);

  pbar1 = IupGLProgressBar();
  IupSetAttribute(pbar1, "VALUE", "0.3");
  IupSetAttribute(pbar1, "SHOWTEXT", "Yes");

  //image_val = IupLoadImage("../test/slider_handler.png");

  gval1 = IupGLVal();
  IupSetAttribute(gval1, "VALUE", "0.3");
  IupSetCallback(gval1, "VALUECHANGED_CB", val_action_cb);
  IupSetAttribute(gval1, "PROGRESSBAR", (char*)pbar1);
  IupSetAttribute(gval1, "NAME", "val1");
  IupSetAttribute(gval1, "TIP", "Val Tip");
  //IupSetAttributeHandle(gval1, "IMAGE", image_val);

  hbox = IupHbox(glabel, gsep1, gbutton1, gtoggle, glink, pbar1, gval1, NULL);
  IupSetAttribute(hbox, "ALIGNMENT", "ACENTER");
  IupSetAttribute(hbox, "MARGIN", "5x5");
  IupSetAttribute(hbox, "GAP", "5");

  pbar2 = IupGLProgressBar();
  IupSetAttribute(pbar2, "VALUE", "0.3");
  IupSetAttribute(pbar2, "ORIENTATION", "VERTICAL");

  gval2 = IupGLVal();
  IupSetAttribute(gval2, "VALUE", "0.3");
  IupSetAttribute(gval2, "ORIENTATION", "VERTICAL");
  IupSetCallback(gval2, "VALUECHANGED_CB", val_action_cb);
  IupSetAttribute(gval2, "PROGRESSBAR", (char*)pbar2);
  IupSetAttribute(gval2, "NAME", "val2");

  gsep2 = IupGLSeparator();
  IupSetAttribute(gsep2, "ORIENTATION", "HORIZONTAL");

  vbox = IupVbox(gbutton2, gsep2, 
    IupRadio(IupSetAttributes(IupVbox(gtoggle1, gtoggle2, NULL), "MARGIN=0x0")),
    pbar2,
    gval2,
    NULL);
  IupSetAttribute(vbox, "ALIGNMENT", "ACENTER");
  IupSetAttribute(vbox, "MARGIN", "5x5");
  IupSetAttribute(vbox, "GAP", "5");

  gtoggle5 = IupGLToggle("Toggle");
  IupSetAttribute(gtoggle5, "PADDING", "5x5");
  IupSetCallback(gtoggle5, "ACTION", (Icallback)toggle_action_cb);
  IupSetAttribute(gtoggle5, "NAME", "toggle5");
  IupSetAttribute(gtoggle5, "CHECKMARK", "Yes");
//  IupSetAttribute(gtoggle5, "RIGHTBUTTON", "Yes");

  gtoggle3 = IupGLToggle("Radio Toggle");
  IupSetAttribute(gtoggle3, "PADDING", "5x5");
  IupSetCallback(gtoggle3, "ACTION", (Icallback)toggle_action_cb);
  IupSetAttribute(gtoggle3, "NAME", "toggle3");
  IupSetAttribute(gtoggle3, "CHECKMARK", "Yes");

  gtoggle4 = IupGLToggle("Radio Toggle");
  IupSetAttribute(gtoggle4, "PADDING", "5x5");
  IupSetAttributeHandle(gtoggle4, "IMAGE", load_image_Test());
  IupSetCallback(gtoggle4, "ACTION", (Icallback)toggle_action_cb);
  IupSetAttribute(gtoggle4, "NAME", "toggle4");
  IupSetAttribute(gtoggle4, "CHECKMARK", "Yes");
//  IupSetAttribute(gtoggle4, "RIGHTBUTTON", "Yes");

  vbox2 = IupVbox(
    IupRadio(IupSetAttributes(IupVbox(gtoggle3, gtoggle4, NULL), "MARGIN=0x0")),
    gtoggle5,
    NULL);

  gsbox = IupSetAttributes(IupGLScrollBox(vbox2), "RASTERSIZE=90x90");
  gsbox = IupGLSizeBox(gsbox);

  gframe1 = IupSetAttributes(IupGLFrame(hbox), "TITLE=Frame1");
  gframe2 = IupSetAttributes(IupGLFrame(vbox), "BACKCOLOR=\"250 250 160 128\", FRAMECOLOR=\"250 250 160\"");
  gframe3 = IupSetAttributes(IupGLFrame(gsbox), "TITLE=Frame3, TITLEBOX=Yes");
//  IupSetAttributeHandle(gframe3, "TITLEBACKIMAGE", load_image_Tecgraf());

  gexp1 = IupSetAttributes(IupGLExpander(gframe1), "TITLE=Expander");
  gexp2 = IupSetAttributes(IupGLExpander(gframe2), "BARPOSITION=LEFT");

  text = IupText(NULL);
  IupSetAttribute(text, "VALUE", "Text");

  matrix = IupMatrix(NULL);
  IupSetAttribute(matrix, "NUMLIN", "3");
  IupSetAttribute(matrix, "NUMCOL", "2");
  IupSetAttribute(matrix, "NUMLIN_VISIBLE", "3");
  IupSetAttribute(matrix, "NUMCOL_VISIBLE", "2");
  IupSetAttribute(matrix, "0:0", "Inflation");
  IupSetAttribute(matrix, "1:0", "Medicine");
  IupSetAttribute(matrix, "2:0", "Food");
  IupSetAttribute(matrix, "3:0", "Energy");
  IupSetAttribute(matrix, "0:1", "January 2000");
  IupSetAttribute(matrix, "0:2", "February 2000");
  IupSetAttribute(matrix, "1:1", "5.6");
  IupSetAttribute(matrix, "2:1", "2.2");
  IupSetAttribute(matrix, "3:1", "4.1");
  IupSetAttribute(matrix, "1:2", "10");
  IupSetAttribute(matrix, "2:2", "1");
  IupSetAttribute(matrix, "3:2", "0.5");
//  IupSetAttribute(matrix, "EXPAND", "No");
  IupSetAttribute(matrix, "SCROLLBAR", "No");

  vbox3 = IupVbox(
    text,
    matrix,
    NULL);

  vbox3 = IupSetAttributes(IupGLFrame(vbox3), "TITLE=Frame4");

  canvas = IupGLCanvasBox(
    IupSetAttributes(gexp1, "HORIZONTALALIGN=ACENTER, VERTICALALIGN=ATOP, MOVEABLE=Yes, MOVETOTOP=Yes"),
    IupSetAttributes(gexp2, "HORIZONTALALIGN=ALEFT, VERTICALALIGN=ACENTER"),
    IupSetAttributes(gframe3, "MOVEABLE=Yes, POSITION=\"550,200\", MOVETOTOP=Yes"),
    IupSetAttributes(vbox3, "MOVEABLE=Yes, POSITION=\"250,350\""),
    NULL);
    
  IupSetAttribute(canvas, "DEPTH_SIZE", "16");

  image_open = IupImage(16, 16, img_open);
  image_close = IupImage(16, 16, img_close);
  image_high = IupImage(16, 16, img_close);
  IupSetAttribute(image_open, "0", "BGCOLOR");
  IupSetAttribute(image_open, "1", "192 192 192");
  IupSetAttribute(image_close, "0", "BGCOLOR");
  IupSetAttribute(image_close, "1", "192 192 192");
  IupSetAttribute(image_high, "1", "192 192 192");

  //  IupSetAttribute(gexp1, "BARSIZE", "50");
  //  IupSetAttributeHandle(gexp1, "IMAGE", image_close);
  //  IupSetAttributeHandle(gexp1, "IMOPEN", image_open);
  //  IupSetAttribute(gexp1, "IMAGE", "img1");
  IupSetCallback(gexp1, "ACTION", (Icallback)expand_cb);
  IupSetAttribute(gexp1, "EXTRABUTTONS", "3");
  IupSetCallback(gexp1, "EXTRABUTTON_CB", (Icallback)extrabutton_cb);
  IupSetAttributeHandle(gexp1, "IMAGEEXTRA1", image_close);
  IupSetAttributeHandle(gexp1, "IMAGEEXTRAPRESS1", image_open);
  IupSetAttributeHandle(gexp1, "IMAGEEXTRAHIGHLIGHT1", image_high);
  IupSetAttributeHandle(gexp1, "IMAGEEXTRA2", image_close);
  IupSetAttributeHandle(gexp1, "IMAGEEXTRAPRESS2", image_open);
  IupSetAttributeHandle(gexp1, "IMAGEEXTRAHIGHLIGHT2", image_high);
  IupSetAttributeHandle(gexp1, "IMAGEEXTRA3", image_close);
  IupSetAttributeHandle(gexp1, "IMAGEEXTRAPRESS3", image_open);
  IupSetAttributeHandle(gexp1, "IMAGEEXTRAHIGHLIGHT3", image_high);
  //IupSetAttribute(gexp1, "REDRAWALL", "No");

  IupSetCallback(canvas, "ACTION", action);
  IupSetCallback(canvas, "BUTTON_CB", (Icallback)button_cb);
  IupSetCallback(canvas, "MOTION_CB", (Icallback)motion_cb);
  IupSetAttribute(canvas, "BUFFER", "DOUBLE");
  IupSetAttribute(canvas, "MARGIN", "10x10");

  box = IupVbox(canvas, NULL);
  IupSetAttribute(box, "MARGIN", "25x25");

  dlg = IupDialog(box);
  IupSetAttribute(dlg, "TITLE", "IupGLCanvas Test");
  IupSetAttribute(dlg, "RASTERSIZE", "800x600");

  IupMap(dlg);

  IupGLMakeCurrent(canvas);
  printf("Vendor: %s\n", glGetString(GL_VENDOR));
  printf("Renderer: %s\n", glGetString(GL_RENDERER));
  printf("Version: %s\n", glGetString(GL_VERSION));

  IupShowXY(dlg, IUP_CENTER, IUP_CENTER);
  IupSetAttribute(dlg, "RASTERSIZE", NULL);
}
Exemplo n.º 10
0
void FlatTabsTest(void)
{
  Ihandle *box, *frm1, *frm2, *dlg, *tabs;

  tabs = CreateTabs(1);
  
  box = IupHbox(tabs, 
#if 0
                frm1 = IupFrame(IupRadio(IupVbox(IupToggle("TOP", "cbType"), 
                                                 IupToggle("LEFT", "cbType"), 
                                                 IupToggle("BOTTOM", "cbType"), 
                                                 IupToggle("RIGHT", "cbType"), 
                                                 NULL))), 
                frm2 = IupFrame(IupRadio(IupVbox(IupToggle("HORIZONTAL", "cbOrientation"), 
                                                 IupToggle("VERTICAL", "cbOrientation"), 
                                                 NULL))), 
#endif
                IupVbox(IupSetAttributes(IupButton("Add Tab", "cbAddTab"), "TIP=\"Button Tip\""),
                        IupButton("Insert Tab", "cbInsertTab"),
                        IupButton("Remove Tab", "cbRemoveTab"),
                        IupButton("UnHide All Tabs", "cbUnHideAllTabs"),
                        IupButton("Enable All Tabs", "cbEnableAllTabs"),
                        IupToggle("Inactive", "cbInactive"),
                        IupButton("Test", "cbTest"),
                        NULL), 
                NULL);

#if 0
  IupSetAttribute(frm1, "MARGIN", "5x5");
  IupSetAttribute(frm2, "MARGIN", "5x5");
  IupSetAttribute(frm1, "GAP", "0");
  IupSetAttribute(frm2, "GAP", "0");
  IupSetAttribute(frm1, "TITLE", "Type");
  IupSetAttribute(frm2, "TITLE", "Orientation");
#endif

  IupSetAttribute(box, "MARGIN", "10x10");
  IupSetAttribute(box, "GAP", "10");
  dlg = IupDialog(box);

  IupSetAttribute(dlg, "TITLE", "IupFlatTabs Test");
  IupSetAttribute(dlg, "APP_TABS", (char*)tabs);
//  IupSetAttribute(box, "BGCOLOR", "92 92 255");
//  IupSetAttribute(dlg, "BGCOLOR", "92 92 255");
//  IupSetAttribute(dlg, "BACKGROUND", "200 10 80");
//  IupSetAttributeHandle(dlg, "BACKGROUND", load_image_LogoTecgraf());
//  IupSetAttribute(dlg, "FGCOLOR", "10 200 80");

  IupMap(dlg);
  IupSetAttribute(dlg, "SIZE", NULL);
  IupShowXY(dlg, IUP_CENTER, IUP_CENTER);

  IupSetFunction("cbOrientation", (Icallback)cbOrientation);
  IupSetFunction("cbType", (Icallback)cbType);
  IupSetFunction("cbAddTab", (Icallback)cbAddTab);
  IupSetFunction("cbInsertTab", (Icallback)cbInsertTab);
  IupSetFunction("cbRemoveTab", (Icallback)cbRemoveTab);
  IupSetFunction("cbInactive", (Icallback)cbInactive);
  IupSetFunction("cbChildButton", (Icallback)cbChildButton);
  IupSetFunction("cbTest", (Icallback)cbTest);
  IupSetFunction("cbRemoveThisTab", (Icallback)cbRemoveThisTab);
  IupSetFunction("cbUnHideAllTabs", (Icallback)cbUnHideAllTabs);
  IupSetFunction("cbEnableAllTabs", (Icallback)cbEnableAllTabs);
  IupSetFunction("cbHideThisTab", (Icallback)cbHideThisTab);
  IupSetFunction("cbDisableThisTab", (Icallback)cbDisableThisTab);
}
Exemplo n.º 11
0
Ihandle* IupCreatev(const char *name, void **params)
{
  Iclass *ic = NULL;
  char lower[30];
  int size = 0;
  assert(name);
  if(name == NULL)
    return NULL;

  size = (int)strlen(name);
  size++;
  assert(size < 30 && size > 0); /* invalid name */
  if(size > 30 || size <= 0)
    return NULL;

  while(size--)
    lower[size] = (char)tolower(name[size]);

  if(iupStrEqual(lower, "dialog"))
    return IupDialog(params? params[0] : NULL);
  else if(iupStrEqual(lower, "canvas"))
    return IupCanvas(NULL);
  else if(iupStrEqual(lower, "button"))
    return IupButton(NULL, NULL);
  else if(iupStrEqual(lower, "toggle"))
    return IupToggle(NULL, NULL);
  else if(iupStrEqual(lower, "label"))
    return IupLabel(NULL);
  else if(iupStrEqual(lower, "frame"))
    return IupFrame(NULL);
  else if(iupStrEqual(lower, "list"))
    return IupList(NULL);
  else if(iupStrEqual(lower, "multiline"))
    return IupMultiLine(NULL);
  else if(iupStrEqual(lower, "text"))
    return IupText(NULL);
  else if(iupStrEqual(lower, "user"))
    return IupUser();
  else if(iupStrEqual(lower, "fill"))
    return IupFill();
  else if(iupStrEqual(lower, "separator"))
    return IupSeparator();
  else if(iupStrEqual(lower, "item"))
    return IupItem(NULL, NULL);
  else if(iupStrEqual(lower, "hbox"))
    return IupHboxv((Ihandle**)params);
  else if(iupStrEqual(lower, "zbox"))
    return IupZboxv((Ihandle**)params);
  else if(iupStrEqual(lower, "vbox"))
    return IupVboxv((Ihandle**)params);
  else if(iupStrEqual(lower, "menu"))
    return IupMenuv((Ihandle**)params);
  else if(iupStrEqual(lower, "radio"))
    return IupRadio(params[0]);
  else if(iupStrEqual(lower, "submenu"))
    return IupSubmenu(NULL, params? params[0] : NULL);

  /*  
  Not accepted:
  image
  color
  IupGetFile
  IupListDialog
  IupMessage
  IupScanf
  IupAlarm
  */

  ic = iupCpiGetClass(lower);
  return iupCpiCreate(ic, params);
}