Exemplo n.º 1
0
void TransferFunctionsViewer::BuildInterface ()
{
  m_iup_canvas = IupGLCanvas ("tfviewer_canvas");
  IupSetCallback (m_iup_canvas, "ACTION", (Icallback)TransferFunctionsViewer::Action);
  IupSetCallback (m_iup_canvas, "BUTTON_CB", (Icallback)TransferFunctionsViewer::Button_CB);
  IupSetCallback (m_iup_canvas, "MOTION_CB", (Icallback)TransferFunctionsViewer::Motion_CB);
  IupSetAttribute (m_iup_canvas, IUP_BUFFER, IUP_DOUBLE);
  IupSetAttribute (m_iup_canvas, IUP_RASTERSIZE, "258x50");
  IupSetAttribute (m_iup_canvas, IUP_RESIZE, IUP_NO);
  IupSetHandle ("tfviewer_canvas", m_iup_canvas);

  m_iup_sub_menu_file = IupSubmenu ("Arquivo", IupMenu(NULL));

  m_iup_menu = IupMenu (m_iup_sub_menu_file, NULL);
  IupSetHandle ("TransferFunctionMenu", m_iup_menu);

  m_iup_main_dialog = IupDialog (m_iup_canvas);
  //IupSetAttribute (m_iup_main_dialog, "MENU", "TransferFunctionMenu");
  IupSetAttribute (m_iup_main_dialog, "TITLE", "Transfer Function Visualization");
  IupSetAttribute (m_iup_main_dialog, "BORDER", "NO");
  IupSetAttribute (m_iup_main_dialog, "RESIZE", "NO");
  
  IupMap (m_iup_main_dialog);
  IupRefresh (m_iup_main_dialog);

  if (!m_pixels)
    m_pixels = new float[258 * 50 * 4];

  Redraw ();
}
Exemplo n.º 2
0
static int cbType(Ihandle* ih, int v)
{
  if (v)
  {
    char* title = IupGetAttribute(ih, "TITLE");
    Ihandle* tabs = (Ihandle*)IupGetAttribute(ih, "APP_TABS");

    switch(*title)
    {
    case 'L':
      IupSetAttribute(tabs, "TABTYPE", "LEFT");
      break;
    case 'R':
      IupSetAttribute(tabs, "TABTYPE", "RIGHT");
      break;
    case 'T':
      IupSetAttribute(tabs, "TABTYPE", "TOP");
      break;
    case 'B':
      IupSetAttribute(tabs, "TABTYPE", "BOTTOM");
      break;
    }

    IupRefresh(tabs); /* update children layout */
  }
  return IUP_DEFAULT;
}
Exemplo n.º 3
0
static void motDialogConfigureNotify(Widget w, XEvent *evt, String* s, Cardinal *card)
{
  IFnii cb;
  int border, caption, menu;
  XConfigureEvent *cevent = (XConfigureEvent *)evt;
  Ihandle* ih;
  (void)s;
  (void)card;

  XtVaGetValues(w, XmNuserData, &ih, NULL);
  if (!ih) return;

  if (ih->data->menu && ih->data->menu->handle)
  {
    XtVaSetValues(ih->data->menu->handle,
      XmNwidth, (XtArgVal)(cevent->width),
      NULL);
  }

  if (ih->data->ignore_resize) return; 

  iupdrvDialogGetDecoration(ih, &border, &caption, &menu);

  ih->currentwidth = cevent->width + 2*border;
  ih->currentheight = cevent->height + 2*border + caption; /* menu is inside the dialog_manager */

  cb = (IFnii)IupGetCallback(ih, "RESIZE_CB");
  if (cb) cb(ih, cevent->width, cevent->height - menu);  /* notify to the application size the client area size */

  ih->data->ignore_resize = 1;
  IupRefresh(ih);
  ih->data->ignore_resize = 0;
}
Exemplo n.º 4
0
// Address lookup function
static int _address_lookup(/*@unused@*/ Ihandle *ih) {
    char *result = IupGetAttribute(edt_address,"VALUE");
    float lat,lon;
    char city[100];
    int rescode;

    if( result == NULL )
        return IUP_DEFAULT;

    IupSetAttribute(list_method,"VISIBLE","YES");
    IupSetAttribute(list_method,"VALUE","0");
    IupSetAttribute(lbl_status,"VALUE","");
    IupSetfAttribute(lbl_status,"APPEND",
                     _("Downloading info, this may be slow..."));
    rescode=location_address_lookup(result,&lat,&lon,city,100);
    // Destroy address box
    if( hbox_address )
        IupDestroy(hbox_address);
    hbox_address = btn_address = edt_address = NULL;
    if( dialog_location )
        IupRefresh(dialog_location);
    if(!rescode) {
        IupSetAttribute(lbl_status,"APPEND",_("Unable to download data"));
        return IUP_DEFAULT;
    }

    IupSetfAttribute(lbl_status,"APPEND",_("city: %s"),city);
    IupSetfAttribute(lbl_status,"APPEND",_("lat/lon: %.2f,%.2f"),lat,lon);
    IupSetfAttribute(edt_lat,"VALUE","%f",lat);
    IupSetfAttribute(edt_lon,"VALUE","%f",lon);

    return IUP_DEFAULT;
}
Exemplo n.º 5
0
static int iDetachBoxSetRestoreAttrib(Ihandle* ih, const char* value)
{
  Ihandle *dlg = IupGetDialog(ih);
  Ihandle* new_parent = IupGetHandle(value);
  Ihandle* new_brother = NULL;

  if (!new_parent)
  {
    new_parent = ih->data->old_parent;
    new_brother = ih->data->old_brother;

    if (IupGetChildPos(new_parent, new_brother) == -1)  /* not a child of new_parent */
      new_brother = NULL;
  }

  /* Sets the new parent */
  IupReparent(ih, new_parent, new_brother);

  /* Show handler */
  if (ih->data->barsize)
    IupSetAttribute(ih->firstchild, "VISIBLE", "Yes");

  /* Updates/redraws the layout of the dialog */
  IupRefresh(new_parent);

  /* Reset previous parent and brother */
  ih->data->old_parent = NULL;
  ih->data->old_brother = NULL;

  IupDestroy(dlg);
  return 0;
}
Exemplo n.º 6
0
static void iSboxShakeControls(Ihandle* ih)
{
  int new_w, new_h;

  iSboxGetFinalSize(ih, ih->data->direction, &new_w, &new_h);

  if (ih->data->direction == ISBOX_WEST || ih->data->direction == ISBOX_EAST)
  {
    if (new_w != ih->data->w)
    {
      if (new_w > ih->naturalwidth)
        iSboxSaveDimension(ih, new_w, ih->data->h);
      else 
        iSboxSaveDimension(ih, new_w, ih->naturalwidth);
    }
  }
  else if (ih->data->direction == ISBOX_SOUTH || ih->data->direction == ISBOX_NORTH)
  {
    if(new_h != ih->data->h)
    {
      if (new_h > ih->naturalheight)
        iSboxSaveDimension(ih, ih->data->w, new_h);
      else 
        iSboxSaveDimension(ih, ih->naturalheight, new_h);
    }
  }

  IupRefresh(ih);  /* may affect all the elements in the dialog */
}
int progressCb(long total, long now, double kBps){
	double progress = (double)now/(double)total;
	IupSetDouble(pb, "VALUE", progress);
	IupSetStrf(status, "TITLE", "Total file size: %dKb, downloaded: %dKb\n(progress: %d%%, average speed: %dkBps)", total/1000, now/1000, (int)(progress*100), (int)kBps);
	IupRefresh(downloaderGui);
	IupLoopStep();
	return stop;
}
Exemplo n.º 8
0
int main(int argc, char **argv)
{
    Ihandle *win,*tabs,*buttons;

    IupOpen(&argc, &argv);      

    tabs = IupTabs(
        IupQuakeBindingLayout(),
        IupQuakeMouseLayout(),
        IupFill(),
        IupFill(),
        IupFill(),
        NULL
    );
    IupStoreAttribute(tabs, "TABTITLE0", "Keyboard");
    IupStoreAttribute(tabs, "TABTITLE1", "Mouse");
    IupStoreAttribute(tabs, "TABTITLE2", "Audio");
    IupStoreAttribute(tabs, "TABTITLE3", "Video");
    IupStoreAttribute(tabs, "TABTITLE4", "Multiplayer");

    IupStoreAttribute(tabs, "MARGIN", "2x2");

    buttons = IupHbox(
        IupSetCallbacks(IupButton("&Quit", "ACTION"), "ACTION", (Icallback)IupExitLoop, NULL),
        IupFill(),
        IupButton("&Save", NULL),
        IupFill(),
        IupButton("&Launch game", NULL),
        NULL
    );

    win = IupDialog(
            IupSetAttributes(
                IupVbox(
                    IupSetAttributes(
                        IupLabel("Action Quake 2 Configuration"),
                        "EXPAND=YES, ALIGNMENT=ACENTER:ACENTER, FONT=\"sans-serif, Bold 18\""
                    ),
                    tabs,
                    //buttons,
                    NULL
                ),
                "GAP=5, MARGIN=3x3"
            )
    );

    IupStoreAttribute(win, "TITLE", "Action Quake 2 Configuration");
    IupStoreAttribute(win, "RESIZE", "NO");

    IupShow(win);

    /* bug? */
    IupStoreAttribute(win, "SIZE", NULL);
    IupRefresh(win);

    IupMainLoop();
}
Exemplo n.º 9
0
static int iDetachBoxSetDetachAttrib(Ihandle* ih, const char* value)
{
  IFnnii detachedCB = (IFnnii)IupGetCallback(ih, "DETACHED_CB");

  /* Create new dialog */
  Ihandle *new_parent = IupDialog(NULL);
  Ihandle *old_dialog = IupGetDialog(ih);

  /* Set new dialog as child of the current application */
  IupSetAttributeHandle(new_parent, "PARENTDIALOG", old_dialog);

  if (detachedCB)
    detachedCB(ih, new_parent, 0, 0);

  /* Save current parent and reference child */
  ih->data->old_parent = ih->parent;
  ih->data->old_brother = ih->brother;

  IupMap(new_parent);

  /* Sets the new parent */
  IupReparent(ih, new_parent, NULL);

  /* Hide canvas bar */
  ih->data->barsize = 0;
  IupHide(ih->firstchild);

  /* Restores the cursor */
  IupSetAttribute(ih->firstchild, "CURSOR", "MOVE");

  /* Updates/redraws the layout of the dialog application */
  IupRefresh(old_dialog);

  IupSetAttribute(new_parent, "RASTERSIZE", NULL);
  IupRefresh(new_parent);

  /* Maps and shows the new dialog */
  IupShow(new_parent);

  (void)value;
  return 0;
}
Exemplo n.º 10
0
static int cbRemoveTab(Ihandle* ih)
{
  Ihandle* tabs = (Ihandle*)IupGetAttribute(ih, "APP_TABS");
  Ihandle* vbox = IupGetHandle(IupGetAttribute(tabs, "VALUE"));

  IupDestroy(vbox);

  IupRefresh(tabs); /* update children layout */

  return IUP_DEFAULT;
}
Exemplo n.º 11
0
static int iDetachBoxSetDetachAttrib(Ihandle* ih, const char* value)
{
  int cur_x, cur_y;
  IFnnii detachedCB = (IFnnii)IupGetCallback(ih, "DETACHED_CB");

  /* Create new dialog */
  Ihandle *new_parent = IupDialog(NULL);
  Ihandle *old_dialog = IupGetDialog(ih);

  /* Set new dialog as child of the current application */
  IupSetAttributeHandle(new_parent, "PARENTDIALOG", old_dialog);

  iupStrToIntInt(IupGetGlobal("CURSORPOS"), &cur_x, &cur_y, 'x');

  if (detachedCB)
  {
    int ret = detachedCB(ih, new_parent, cur_x, cur_y);
    if (ret == IUP_IGNORE)
    {
      IupDestroy(new_parent);
      return IUP_DEFAULT;
    }
  }

  /* set user size of the detachbox as the current size of the child */
  IupSetStrAttribute(ih, "RASTERSIZE", IupGetAttribute(ih->firstchild->brother, "RASTERSIZE"));

  /* Save current parent and reference child */
  ih->data->old_parent = ih->parent;
  ih->data->old_brother = ih->brother;

  IupMap(new_parent);

  /* Sets the new parent */
  IupReparent(ih, new_parent, NULL);

  /* Hide handler */
  IupSetAttribute(ih->firstchild, "VISIBLE", "No");

  /* force a dialog resize since IupMap already computed the dialog size */
  IupSetAttribute(new_parent, "RASTERSIZE", NULL);

  /* Maps and shows the new dialog */
  IupShowXY(new_parent, cur_x, cur_y);

  /* reset user size of the detachbox */
  IupSetAttribute(ih, "USERSIZE", NULL);

  /* Updates/redraws the layout of the old dialog */
  IupRefresh(old_dialog);

  (void)value;
  return 0;
}
Exemplo n.º 12
0
void status_bar_done()
{
	if(done)
		return;

	IupSetAttribute(status_msg, "TITLE", "Ready");
	IupSetAttribute(status_prog, "EXPAND", "NO");
	done = 1;

	IupRefresh(status_prog);
	IupLoopStep();
}
Exemplo n.º 13
0
static void winDialogResize(Ihandle* ih, int width, int height)
{
  IFnii cb;

  iupdrvDialogGetSize(ih, NULL, &(ih->currentwidth), &(ih->currentheight));
  cb = (IFnii)IupGetCallback(ih, "RESIZE_CB");
  if (!cb || cb(ih, width, height)!=IUP_IGNORE)  /* width and height here are for the client area */
  {
    ih->data->ignore_resize = 1;
    IupRefresh(ih);
    ih->data->ignore_resize = 0;
  }
}
static int cb_txtAsciiAction(Ihandle *txt) {

	Ihandle *lblAsciiLen;
	int charCount;

	lblAsciiLen = IupGetHandle(LBLASCIILEN_2);
	charCount = IupGetInt(txt, "COUNT");

	IupSetfAttribute(lblAsciiLen, "TITLE", FRMT_ASCIILEN_2, charCount);
	IupRefresh(lblAsciiLen);

	return IUP_DEFAULT;
}
static int cb_txtMorseAction(Ihandle *txt) {

	Ihandle *lblMorseLen;
	int charCount;

	lblMorseLen = IupGetHandle(LBLMORSELEN_4);
	charCount = IupGetInt(txt, "COUNT");

	IupSetfAttribute(lblMorseLen, "TITLE", FRMT_MORSELEN_4, charCount);
	IupRefresh(lblMorseLen);

	return IUP_DEFAULT;
}
Exemplo n.º 16
0
void status_bar_init(const char* description)
{
	//Return if not done
	//Hopefully will never happen
	if(!done)
		return;

	//We're using this now
	done = 0;

	//Set the message
	IupSetAttribute(status_msg, "TITLE", description);

	//Set the progress bar
	IupSetInt(status_prog, "VALUE", 0);
	IupSetAttribute(status_prog, "EXPAND", "HORIZONTAL");

	//Update
	IupRefresh(status_prog);
	IupRefresh(status_msg);
	IupLoopStep();
}
Exemplo n.º 17
0
static int _render_image(Ihandle *ih, char *text, int item, int state)
{
	if(state == 1)
	{
		LinkedList *ll = LL_get(images, item-1);
		if(ll == NULL || ll->contents == NULL)
			return IUP_ERROR;
		imImage* img = ll->contents;

		//Display the scaled image
		char buf[64];
		sprintf(buf,"%dx%d",img->width,img->height);
		IupSetAttribute(preview, "RASTERSIZE", buf);
		IupSetAttributeHandle(preview, "IMAGE", ll->iContents);
		IupRefresh(preview);

		//Recreate the grid where to put all the images
		Ihandle* child;
		while((child = IupGetChild(imgmod, 0)) != NULL)
			IupDestroy(child);
		IupSetInt(imgmod, "NUMDIV", ll->cols);

		//Put the images into the grid
		int i;
		for(i = 0; i < ll->cols * ll->rows; i++)
		{
			Ihandle* tinyimg = IupLabel(NULL);
			IupSetAttributeHandle(tinyimg, "IMAGE", ll->iGrid[i]);
			IupAppend(imgmod, tinyimg);
			IupMap(tinyimg);
		}
		IupRefresh(imgmod);
	}

	main_window_set_menu_state();
	return IUP_DEFAULT;
}
Exemplo n.º 18
0
// List method changes
static int _list_method_cb(/*@unused@*/ Ihandle *ih,
                                        /*@unused@*/ char *text, int pos, int state) {
    if( state == 0 )
        return IUP_DEFAULT;
    if( !run_task )
        run_task = IupSetAtt(NULL,IupTimer(),"TIME","100",NULL);
    switch(pos) {
    case 1:
        LOG(LOGVERBOSE,_("Running geocode with hostip"));
        IupSetAttribute(lbl_status,"VALUE","");
        IupSetfAttribute(lbl_status,"APPEND",
                         _("Downloading info, this may be slow..."));
        (void)IupSetCallback(run_task,"ACTION_CB",(Icallback)_run_geocode);
        IupSetAttribute(run_task,"RUN","YES");
        IupSetAttribute(list_method,"VISIBLE","NO");
        break;
    case 2:
        LOG(LOGVERBOSE,_("Running geocode with geobytes"));
        IupSetAttribute(lbl_status,"VALUE","");
        IupSetfAttribute(lbl_status,"APPEND",
                         _("Downloading info, this may be slow..."));
        (void)IupSetCallback(run_task,"ACTION_CB",(Icallback)_run_geobytes);
        IupSetAttribute(run_task,"RUN","YES");
        IupSetAttribute(list_method,"VISIBLE","NO");
        break;
    case 3: {
        edt_address = IupSetAtt(NULL,IupText(NULL),
                                "VALUE","Enter Address...",
                                "EXPAND","HORIZONTAL",NULL);
        (void)IupSetCallback(edt_address,"GETFOCUS_CB",(Icallback)_address_clear);
        btn_address = IupSetAtt(NULL,IupButton(_("Lookup"),NULL),NULL);
        (void)IupSetCallback(btn_address,"ACTION",(Icallback)_address_lookup);
        hbox_address = IupHbox(edt_address,btn_address,NULL);
        if( (vbox_method!=NULL)
                && (hbox_address!=NULL)
                && (lbl_status!=NULL) )
            (void)IupInsert(vbox_method,lbl_status,hbox_address);
        else {
            LOG(LOGERR,_("Location search controls not created!"));
            return IUP_DEFAULT;
        }
        IupSetAttribute(list_method,"VISIBLE","NO");
        (void)IupMap(hbox_address);
        IupRefresh(hbox_address);
        break;
    }
    };
    return IUP_DEFAULT;
}
Exemplo n.º 19
0
static int cbAddTab(Ihandle* ih)
{
  Ihandle* tabs = (Ihandle*)IupGetAttribute(ih, "APP_TABS");
  Ihandle *vbox;

  vbox = IupFrame(IupVbox(IupLabel("Label XXX"), IupButton("Button XXX", "cbChildButton"), NULL));
  IupSetAttribute(vbox, "TABTITLE", "XXX");
  IupSetAttribute(vbox, "TITLE", "TABS XXX");

  IupAppend(tabs, vbox);
  IupMap(vbox);

  IupRefresh(tabs); /* update children layout */

  return IUP_DEFAULT;
}
Exemplo n.º 20
0
static void iExpanderOpenCloseChild(Ihandle* ih, int refresh)
{
  Ihandle *child = ih->firstchild->brother;

  IupUpdate(ih->firstchild);

  if (!child)
    return;

  if (ih->data->state == IEXPANDER_CLOSE)
    IupSetAttribute(child, "VISIBLE", "NO");
  else 
    IupSetAttribute(child, "VISIBLE", "YES");

  if (refresh)
    IupRefresh(child); /* this will recompute the layout of the hole dialog */
}
Exemplo n.º 21
0
static int cbInsertTab(Ihandle* ih)
{
  Ihandle* tabs = (Ihandle*)IupGetAttribute(ih, "APP_TABS");
  Ihandle* ref_vbox = IupGetHandle(IupGetAttribute(tabs, "VALUE"));
  Ihandle *vbox;

  vbox = IupFrame(IupVbox(IupLabel("Label YYY"), IupButton("Button YYY", "cbChildButton"), NULL));
  IupSetAttribute(vbox, "TABTITLE", "YYY");
  IupSetAttribute(vbox, "TITLE", "TABS YYY");

  IupInsert(tabs, ref_vbox, vbox);
  IupMap(vbox);

  IupRefresh(tabs); /* update children layout */

  return IUP_DEFAULT;
}
Exemplo n.º 22
0
static void winDialogResize(Ihandle* ih, int width, int height)
{
  IFnii cb;

  iupdrvDialogUpdateSize(ih);

  cb = (IFnii)IupGetCallback(ih, "RESIZE_CB");
  if (cb) cb(ih, width, height);  /* width and height here are for the client area */

  ih->data->ignore_resize = 1;

  IupRefresh(ih);

  RedrawWindow(ih->handle,NULL,NULL,RDW_ERASE|RDW_FRAME|RDW_INVALIDATE|RDW_INTERNALPAINT|RDW_ALLCHILDREN);

  ih->data->ignore_resize = 0;
}
Exemplo n.º 23
0
void toggle_visibility(Ihandle* item, Ihandle* ih)
{
  if (IupGetInt(item, "VALUE"))
  {
    IupSetAttribute(ih, "FLOATING", "YES");
    IupSetAttribute(ih, "VISIBLE", "NO");
    IupSetAttribute(item, "VALUE", "OFF");
  }
  else
  {
    IupSetAttribute(ih, "FLOATING", "NO");
    IupSetAttribute(ih, "VISIBLE", "YES");
    IupSetAttribute(item, "VALUE", "ON");
  }

  IupRefresh(ih);  /* refresh the dialog layout */
}
Exemplo n.º 24
0
static gboolean gtkDialogConfigureEvent(GtkWidget *widget, GdkEventConfigure *evt, Ihandle *ih)
{
  int old_width, old_height;
  (void)widget;

#ifndef HILDON
  /* In hildon the menu is not a menubar */
  if (ih->data->menu && ih->data->menu->handle)
    gtk_widget_set_size_request(ih->data->menu->handle, evt->width, -1);
#endif

  if (ih->data->ignore_resize) return FALSE; 

  old_width = iupAttribGetInt(ih, "_IUPGTK_OLD_WIDTH");
  old_height = iupAttribGetInt(ih, "_IUPGTK_OLD_HEIGHT");

  /* Check the size change, because configure is called also for position changes */
  if (evt->width != old_width || evt->height != old_height)
  {
    IFnii cb;
    int border, caption, menu;
    iupAttribSetInt(ih, "_IUPGTK_OLD_WIDTH", evt->width);
    iupAttribSetInt(ih, "_IUPGTK_OLD_HEIGHT", evt->height);

    iupdrvDialogGetDecoration(ih, &border, &caption, &menu);

#ifdef HILDON
    /* In Hildon, the configure event contains the window size, not the client area size */
    ih->currentwidth = evt->width;
    ih->currentheight = evt->height;
#else
    ih->currentwidth = evt->width + 2*border;
    ih->currentheight = evt->height + 2*border + caption;  /* menu is inside the window client area */
#endif

    cb = (IFnii)IupGetCallback(ih, "RESIZE_CB");
    if (cb) cb(ih, evt->width, evt->height - menu);  /* notify to the application size the client area size */

    ih->data->ignore_resize = 1; 
    IupRefresh(ih);
    ih->data->ignore_resize = 0;
  }

  return FALSE;
}
Exemplo n.º 25
0
static int btn_restore_cb(Ihandle *bt)
{
  Ihandle *dbox = IupGetHandle("dbox");

#if 0
  Ihandle *dlg = IupGetDialog(dbox);
  Ihandle *old_parent = (Ihandle*)IupGetAttribute(dbox, "OLDPARENT_HANDLE");
  Ihandle *ref_child = (Ihandle*)IupGetAttribute(dbox, "OLDBROTHER_HANDLE");
  IupReparent(dbox, old_parent, ref_child);
  IupRefresh(old_parent);
  IupDestroy(dlg);
#else
  IupSetAttribute(dbox, "RESTORE", NULL);
#endif
  
  IupSetAttribute(bt, "ACTIVE", "NO");
  IupSetAttribute(IupGetHandle("detach"), "ACTIVE", "Yes");

  return IUP_DEFAULT;
}
Exemplo n.º 26
0
static int cbOrientation(Ihandle* ih, int v)
{
  if (v)
  {
    char* title = IupGetAttribute(ih, "TITLE");
    Ihandle* tabs = (Ihandle*)IupGetAttribute(ih, "APP_TABS");

    switch(*title)
    {
    case 'H':
      IupSetAttribute(tabs, "TABORIENTATION", "HORIZONTAL");
      break;
    case 'V':
      IupSetAttribute(tabs, "TABORIENTATION", "VERTICAL");
      break;
    }

    IupRefresh(tabs); /* update children layout */
  }
  return IUP_DEFAULT;
}
Exemplo n.º 27
0
static int iDetachBoxSetRestoreAttrib(Ihandle* ih, const char* value)
{
  Ihandle *dlg = IupGetDialog(ih);

  IupReparent(ih, ih->data->old_parent, ih->data->old_brother);

  /* Restores and shows the bar handler when the element returns to its previous parent */
  ih->data->barsize = 10;  /* default size */
  IupShow(ih->firstchild);

  /* Restores the cursor */
  IupSetAttribute(ih->firstchild, "CURSOR", "MOVE");

  IupRefresh(ih->data->old_parent);

  /* Reset previous parent and brother */
  ih->data->old_parent = NULL;
  ih->data->old_brother = NULL;

  IupDestroy(dlg);
  (void)value;
  return 0;
}
Exemplo n.º 28
0
static gboolean gtkDialogConfigureEvent(GtkWidget *widget, GdkEventConfigure *evt, Ihandle *ih)
{
  int old_width, old_height, old_x, old_y;
  gint x, y;
  (void)widget;

#ifndef HILDON
  /* In hildon the menu is not a menubar */
  if (ih->data->menu && ih->data->menu->handle)
    gtk_widget_set_size_request(ih->data->menu->handle, evt->width, -1);
#endif

  if (ih->data->ignore_resize) return FALSE; 

  old_width = iupAttribGetInt(ih, "_IUPGTK_OLD_WIDTH");
  old_height = iupAttribGetInt(ih, "_IUPGTK_OLD_HEIGHT");

  /* Check the size change, because configure is called also for position changes */
  if (evt->width != old_width || evt->height != old_height)
  {
    IFnii cb;
    int border, caption, menu;
    iupAttribSetInt(ih, "_IUPGTK_OLD_WIDTH", evt->width);
    iupAttribSetInt(ih, "_IUPGTK_OLD_HEIGHT", evt->height);

    iupdrvDialogGetDecoration(ih, &border, &caption, &menu);

  /* update dialog size */
#ifdef HILDON
    /* In Hildon, the configure event contains the window size, not the client area size */
    ih->currentwidth = evt->width;
    ih->currentheight = evt->height;
#else
    ih->currentwidth = evt->width + 2*border;
    ih->currentheight = evt->height + 2*border + caption;  /* menu is inside the window client area */
#endif

    cb = (IFnii)IupGetCallback(ih, "RESIZE_CB");
    if (!cb || cb(ih, evt->width, evt->height - menu)!=IUP_IGNORE)  /* width and height here are for the client area */
    {
      ih->data->ignore_resize = 1;
      IupRefresh(ih);
      ih->data->ignore_resize = 0;
    }
  }

  old_x = iupAttribGetInt(ih, "_IUPGTK_OLD_X");
  old_y = iupAttribGetInt(ih, "_IUPGTK_OLD_Y");
  iupdrvDialogGetPosition(ih, NULL, &x, &y);  /* ignore evt->x and evt->y because they are the clientpos and not X/Y */

  /* Check the position change, because configure is called also for size changes */
  if (x != old_x || y != old_y)
  {
    IFnii cb;
    iupAttribSetInt(ih, "_IUPGTK_OLD_X", x);
    iupAttribSetInt(ih, "_IUPGTK_OLD_Y", y);

    cb = (IFnii)IupGetCallback(ih, "MOVE_CB");
    if (cb)
      cb(ih, x, y);
  }

  return FALSE;
}
Exemplo n.º 29
0
static int iDetachBoxButton_CB(Ihandle* bar, int button, int pressed, int x, int y, char* status)
{
  Ihandle* ih = bar->parent;
  Ihandle* mainDlg = IupGetDialog(ih);

  if (button != IUP_BUTTON1)
    return IUP_DEFAULT;

  if (!ih->data->is_holding && pressed)  /* DRAG BEGIN */
  {
    ih->data->is_holding = 1;
    
    /* Change cursor */
    IupSetAttribute(bar, "CURSOR", "IupDetachBoxCursor");
  }
  else if (ih->data->is_holding && !pressed)  /* DRAG END */
  {
    Ihandle *new_parent;
    IFnnii detachedCB = (IFnnii)IupGetCallback(ih, "DETACHED_CB");
    int cur_x, cur_y;

    ih->data->is_holding = 0;

    iupStrToIntInt(IupGetGlobal("CURSORPOS"), &cur_x, &cur_y, 'x');

    /* Create new dialog */
    new_parent = IupDialog(NULL);

    /* Set new dialog as child of the current application */
    IupSetAttributeHandle(new_parent, "PARENTDIALOG", mainDlg);

    if (detachedCB)
    {
      int ret = detachedCB(ih, new_parent, cur_x, cur_y);
      if (ret == IUP_IGNORE)
      {
        IupDestroy(new_parent);
        return IUP_DEFAULT;
      }
    }

    /* Save current parent and reference child */
    ih->data->old_parent = ih->parent;
    ih->data->old_brother = ih->brother;

    IupMap(new_parent);

    /* Sets the new parent */
    IupReparent(ih, new_parent, NULL);

    /* Restores the cursor */
    IupSetAttribute(bar, "CURSOR", "MOVE");

    /* Hide canvas bar */
    ih->data->barsize = 0;
    IupHide(bar);

    /* Updates/redraws the layout of the dialog application */
    IupRefresh(mainDlg);

    IupSetAttribute(new_parent, "RASTERSIZE", NULL);
    IupRefresh(new_parent);

    /* Maps and shows the new dialog */
    IupShowXY(new_parent, cur_x, cur_y);
  }

  (void)x;
  (void)y;
  (void)status;
  return IUP_DEFAULT;
}
Exemplo n.º 30
0
static int Refresh (lua_State *L)
{
  IupRefresh(iuplua_checkihandle(L,1));
  return 0;
}