コード例 #1
0
ファイル: ezwinfo.c プロジェクト: BIC-MNI/xdisp
/*---------------------- Open_Info_Widget() ------------------------*/
int Open_Info_Widget()
{
  char        tmp_name[128], tmp_cmd[256];
    
  /* check to make sure we have a minc file loaded */
  if (file_format!=MINC_FORMAT) {
    EZW_Error("Error: This is not a minc file!");
    return(-1);
  }

  /* create a temp filename */
  tmpnam(tmp_name);

  /* issue shell command to create a mincheader dump file  */
  sprintf(tmp_cmd,"mincheader %s > %s \n",fname, tmp_name); 
  if (Verbose) fprintf(stderr,"issue shell command: %s \n", tmp_cmd); 
  system (tmp_cmd); 

  /* set window name to the current filename (minus leading dirs) */
  EZ_ConfigureWidget(Info_Widget,EZ_LABEL_STRING,basfname,0);
  
  /* load the mincheader dump info into a text widget and siplay the result */
  EZ_ActivateWidget(Info_Widget); 
  EZ_TextLoadFile(Mincheader_Widget,tmp_name);
  EZ_DisplayWidget(Info_Widget);
  XStoreName(theDisp,
	     EZ_GetWidgetWindow(Info_Widget),
	     "xdisp: Minc Header\0");

  /* clean up the tmp file */
  sprintf(tmp_cmd,"rm %s &\n",tmp_name); 
  if (Verbose) fprintf(stderr,"issue shell command: %s\n",tmp_cmd);
  system (tmp_cmd); 
}
コード例 #2
0
ファイル: gridbag.c プロジェクト: dpenkler/EZWGL
main(int ac, char **av)
{
  EZ_Widget *gb, *text, *mbtn, *menu, *tmp;

  EZ_Initialize(ac,av,0);

  /* a toplevel gridbag. Extra spaces go to ROW and COLUME 4 */
  gb = EZ_CreateWidget(EZ_WIDGET_FRAME, NULL, 
                       EZ_PADX,               0, 
                       EZ_PADY,               0,        /*idx     min weight pad */
                       EZ_GRID_CONSTRAINS,    EZ_ROW,      1,     300,  10,   0, 
                       EZ_GRID_CONSTRAINS,    EZ_COLUMN, NCOLS-2, 200,  10,   0, 
                       EZ_BACKGROUND,         "grey85",
                       0);
  /* the first row is a menu bar with 3 buttons.
   * The (NCOLS-2)th column which has a weight 10, 
   * this pushes the last menu button to the right edge.
   */
  mbtn = EZ_CreateWidget(EZ_WIDGET_MENU_BUTTON,    gb,
                                                /* X, Y, W, H */
                         EZ_GRID_CELL_GEOMETRY,    0, 0, 1, 1, 
                                                /*   fill_mode,   gravity */
                         EZ_GRID_CELL_PLACEMENT,   EZ_FILL_BOTH, EZ_CENTER, 
                         EZ_LABEL_STRING,          "MButton 1",
                         EZ_PADY,                  0,
                         0);
  menu = EZ_CreateSimpleMenu("Exit%f|||||",my_exit);
  EZ_SetMenuButtonMenu(mbtn, menu);

 
  mbtn = EZ_CreateWidget(EZ_WIDGET_MENU_BUTTON,   gb,
                         EZ_GRID_CELL_GEOMETRY,   1, 0, 1, 1,
                         EZ_GRID_CELL_PLACEMENT,  EZ_FILL_BOTH, EZ_CENTER,
                         EZ_LABEL_STRING,         "MButton 2",
                         EZ_PADY,                  0,
                         0);
  menu = EZ_CreateSimpleMenu("|||||");
  EZ_SetMenuButtonMenu(mbtn, menu);

  mbtn = EZ_CreateWidget(EZ_WIDGET_MENU_BUTTON,   gb,
                         EZ_GRID_CELL_GEOMETRY,   NCOLS-1, 0, 1, 1,
                         EZ_GRID_CELL_PLACEMENT,  EZ_FILL_BOTH, EZ_CENTER,
                         EZ_LABEL_STRING,         "Help",
                         EZ_PADY,                  0,
                         0);
  menu = EZ_CreateSimpleMenu("|||||");
  EZ_SetMenuButtonMenu(mbtn, menu);

  text = EZ_CreateWidget(EZ_WIDGET_TEXT,         gb,
                         EZ_GRID_CELL_GEOMETRY,  0, 1, NCOLS, 3,
                         EZ_EXPAND,              True,
			 EZ_PROPAGATE,           False,
                         EZ_TEXT_BACKGROUND,     "grey95",
                         EZ_SELECTION_BACKGROUND,"yellow",
                         0);
  EZ_DisplayWidget(gb);
  EZ_TextLoadFile(text, "GridBag.c");  
  EZ_EventMainLoop();
}