Example #1
0
static int iDialogSetMenuAttrib(Ihandle* ih, const char* value)
{
  if (!ih->handle)
  {
    Ihandle* menu = IupGetHandle(value);
    ih->data->menu = menu;
    return 1;
  }

  if (!value)
  {
    if (ih->data->menu && ih->data->menu->handle)
    {
      ih->data->ignore_resize = 1;
      IupUnmap(ih->data->menu);  /* this will remove the menu from the dialog */
      ih->data->ignore_resize = 0;

      ih->data->menu = NULL;
    }
  }
  else
  {
    Ihandle* menu = IupGetHandle(value);
    if (!menu || menu->iclass->nativetype != IUP_TYPEMENU || menu->parent)
      return 0;

    /* already the current menu and it is mapped */
    if (ih->data->menu && ih->data->menu==menu && menu->handle)
      return 1;

    /* the current menu is mapped, so unmap it */
    if (ih->data->menu && ih->data->menu->handle && ih->data->menu!=menu)
    {
      ih->data->ignore_resize = 1;
      IupUnmap(ih->data->menu);   /* this will remove the menu from the dialog */
      ih->data->ignore_resize = 0;
    }

    ih->data->menu = menu;

    menu->parent = ih;    /* use this to create a menu bar instead of a popup menu */

    ih->data->ignore_resize = 1;
    IupMap(menu);     /* this will automatically add the menu to the dialog */
    ih->data->ignore_resize = 0;
  }
  return 1;
}
Example #2
0
void iupdrvReparent(Ihandle* ih)
{
  /* Intrinsics and Motif do NOT support reparent. 
     XReparentWindow can NOT be used because will reparent only the X-Windows windows.
     So must unmap and map again to obtain the same effect. */
  Widget new_parent = iupChildTreeGetNativeParentHandle(ih);
  Widget widget = (Widget)iupAttribGet(ih, "_IUP_EXTRAPARENT");  /* here is used as the native child because is the outmost component of the elemement */
  if (!widget) widget = ih->handle;
  if (XtParent(widget) != new_parent)
  {
    int old_visible = IupGetInt(ih, "VISIBLE");
    if (old_visible)
      IupSetAttribute(ih, "VISIBLE", "NO");
    motSaveAttributesRec(ih); /* this does not save everything... */
    IupUnmap(ih);
    IupMap(ih);
    if (old_visible)
      IupSetAttribute(ih, "VISIBLE", "Yes");
  }
}
Example #3
0
static int Unmap(lua_State *L)
{
  Ihandle *ih = iuplua_checkihandle(L,1);
  IupUnmap(ih);
  return 0;
}
Example #4
0
static void Unmap(void)
{
  IupUnmap(iuplua_checkihandle(1));
}