Exemplo n.º 1
0
void setactivelist(Ihandle* ih)
{
  Ihandle* dialog = IupGetDialog(ih);
  Ihandle* label = (Ihandle*)IupGetAttribute(dialog, "_LABEL");
  IupSetAttribute(dialog, "_ACTIVE_LIST", (char*)ih);
  IupSetAttribute(label, "TITLE", IupGetAttribute(IupGetParent(IupGetParent(ih)), "TITLE"));
}
Exemplo n.º 2
0
static Ihandle* getCBox(Ihandle* self)
{
  Ihandle* parent = IupGetParent(self);
  while (parent && !iupStrEqual("cbox", IupGetClassName(parent)))
    parent = IupGetParent(parent);
  return parent;
}
Exemplo n.º 3
0
int item_remove_cb(Ihandle* ih)
{
  Ihandle* item = IupGetNextChild(IupGetParent(ih), IupGetNextChild(IupGetParent(ih), ih));   /* the next after the separator */
  printf("ACTION(%s)\n", IupGetAttribute(ih, "TITLE"));
  if (item)
    IupDestroy(item);
  return IUP_DEFAULT;
}
Exemplo n.º 4
0
static int k_any(Ihandle *ih, int c)
{
  if (iup_isprint(c))
    printf("K_ANY(%s, %d = %s \'%c\')\n", IupGetAttribute(IupGetParent(IupGetParent(ih)), "TITLE"), c, iupKeyCodeToName(c), (char)c);
  else
    printf("K_ANY(%s, %d = %s)\n", IupGetAttribute(IupGetParent(IupGetParent(ih)), "TITLE"), c, iupKeyCodeToName(c));
  return IUP_DEFAULT;
}
Exemplo n.º 5
0
Arquivo: tree.c Projeto: Airr/iup_mac
static int k_any_cb(Ihandle* ih, int c)
{
  if (c == K_DEL) 
    IupSetAttribute(ih, "DELNODE", "MARKED");
  if (iup_isprint(c))
    printf("K_ANY(%s, %d = %s \'%c\')\n", IupGetAttribute(IupGetParent(IupGetParent(ih)), "TITLE"), c, iupKeyCodeToName(c), (char)c);
  else
    printf("K_ANY(%s, %d = %s)\n", IupGetAttribute(IupGetParent(IupGetParent(ih)), "TITLE"), c, iupKeyCodeToName(c));
  return IUP_CONTINUE;
}
Exemplo n.º 6
0
int item_insert_cb(Ihandle* ih)
{
  Ihandle* ref_item = IupGetChild(IupGetParent(ih), 4);   /* before the first appended item, just after the separator */
  printf("ACTION(%s)\n", IupGetAttribute(ih, "TITLE"));
  if (ref_item)
  {
    Ihandle* item = IupItem("New Inserted Item", "item_cb");
    IupInsert(IupGetParent(ih), ref_item, item);
    IupMap(item);
  }
  return IUP_DEFAULT;
}
Exemplo n.º 7
0
int item_rename_cb(Ihandle* ih)
{
  printf("ACTION(%s)\n", IupGetAttribute(ih, "TITLE"));
  ih = IupGetNextChild(IupGetParent(ih), ih);
  IupSetAttribute(ih, "TITLE", "New Title");
  return IUP_DEFAULT;
}
Exemplo n.º 8
0
static int GetParent(lua_State *L)
{
  Ihandle * ih = iuplua_checkihandle(L,1);
  Ihandle * parent = IupGetParent(ih);
  iuplua_pushihandle(L, parent);
  return 1;
}
Exemplo n.º 9
0
int IupQuakeScaleUpdate(Ihandle *ih)
{
    char buf[16];
    Ihandle *label_value = IupGetChild(IupGetChild(IupGetParent(ih), 1), 1);
    snprintf(buf, 16, "%.1f", atof(IupGetAttribute(ih, "VALUE")));
    IupStoreAttribute(label_value, "TITLE", buf);
}
Exemplo n.º 10
0
int item_add_cb(Ihandle* ih)
{
  Ihandle* item = IupItem("New Appended Item", "item_cb");
  printf("ACTION(%s)\n", IupGetAttribute(ih, "TITLE"));
  IupAppend(IupGetParent(ih), item);   /* after the last item */
  IupMap(item);
  return IUP_DEFAULT;
}
Exemplo n.º 11
0
int item_active_cb(Ihandle* ih)
{
  printf("ACTION(%s)\n", IupGetAttribute(ih, "TITLE"));
  ih = IupGetNextChild(IupGetParent(ih), ih);
  if (IupGetInt(ih, "ACTIVE"))
    IupSetAttribute(ih, "ACTIVE", "NO");
  else
    IupSetAttribute(ih, "ACTIVE", "YES");
  return IUP_DEFAULT;
}
Exemplo n.º 12
0
int item_image_cb(Ihandle* ih)
{
  printf("ACTION(%s)\n", IupGetAttribute(ih, "TITLE"));
  ih = IupGetNextChild(IupGetParent(ih), ih);
  if (IupGetAttributeHandle(ih, "IMAGE"))
    IupSetAttribute(ih, "IMAGE", NULL);
  else
    IupSetAttribute(ih, "IMAGE", "image_test");
  return IUP_DEFAULT;
}
Exemplo n.º 13
0
int item_toolbar_action_cb(Ihandle* item_toolbar)
{
  Ihandle* multitext = IupGetDialogChild(item_toolbar, "MULTITEXT");
  Ihandle* toolbar = IupGetChild(IupGetParent(multitext), 0);
  Ihandle* config = (Ihandle*)IupGetAttribute(multitext, "CONFIG");

  toggle_visibility(item_toolbar, toolbar);

  IupConfigSetVariableStr(config, "MainWindow", "Toolbar", IupGetAttribute(item_toolbar, "VALUE"));
  return IUP_DEFAULT;
}
Exemplo n.º 14
0
/***********************************************\
* Initializes the default values to the element *
\***********************************************/
static void iColorDlgInit_Defaults(IcolorDlgData* colordlg_data)
{
  Ihandle* box;
  int i;

  IupSetAttribute(colordlg_data->color_browser, "RGB", "0 0 0");

  IupSetAttribute(colordlg_data->red_txt,   "VALUE", "0");
  IupSetAttribute(colordlg_data->green_txt, "VALUE", "0");
  IupSetAttribute(colordlg_data->blue_txt,  "VALUE", "0");

  IupSetAttribute(colordlg_data->hue_txt,        "VALUE", "0");
  IupSetAttribute(colordlg_data->saturation_txt, "VALUE", "0");
  IupSetAttribute(colordlg_data->intensity_txt,  "VALUE", "0");
  
  IupSetAttribute(colordlg_data->colorhex_txt, "VALUE", "#000000");

  colordlg_data->alpha = 255;
  IupSetAttribute(colordlg_data->alpha_val, "VALUE", "255");
  IupSetAttribute(colordlg_data->alpha_txt, "VALUE", "255");

  box = IupGetParent(colordlg_data->alpha_val);
  IupSetAttribute(box, "FLOATING", "YES");
  IupSetAttribute(box, "VISIBLE", "NO");

  box = IupGetParent(colordlg_data->colortable_cbar);
  IupSetAttribute(box, "FLOATING", "YES");
  IupSetAttribute(box, "VISIBLE", "NO");

  box = IupGetParent(colordlg_data->colorhex_txt);
  IupSetAttribute(box, "FLOATING", "YES");
  IupSetAttribute(box, "VISIBLE", "NO");

  for (i = 0; i < COLORTABLE_MAX; i++)
    IupSetAttributeId(colordlg_data->colortable_cbar, "CELL", i, default_colortable_cells[i]);
}
Exemplo n.º 15
0
static gboolean gtkTabsButtonPressEvent(GtkWidget *widget, GdkEventButton *evt, Ihandle *child)
{
  Ihandle* ih = IupGetParent(child);
  IFni cb = (IFni)IupGetCallback(ih, "RIGHTCLICK_CB");
  
  if (evt->type == GDK_BUTTON_PRESS && evt->button == 3 && cb)
  {
    GtkWidget* tab_page = (GtkWidget*)iupAttribGet(child, "_IUPTAB_PAGE");
    int pos = gtk_notebook_page_num((GtkNotebook*)ih->handle, tab_page);
    cb(ih, pos);
  }

  (void)widget;

  return iupgtkButtonEvent(widget, evt, ih);
}
Exemplo n.º 16
0
char *iupGetParentBgColor (Ihandle* self)
{
  /* check native definition from parent */
  /* will check also for user definitions up to the dialog */
  char *color = IupGetAttribute(IupGetParent(self), IUP_BGCOLOR);

  /* if none check the native definition for the dialog */
  /* this will return the default value for the dialog */
  if (!color) 
    color = IupGetAttribute(IupGetDialog(self), IUP_BGCOLOR);

  if (!color) /* unlikely, but just in case */
    color = "128 128 128";

  return color;
}
Exemplo n.º 17
0
static int iColorDlgSetShowAlphaAttrib(Ihandle* ih, const char* value)
{
  IcolorDlgData* colordlg_data = (IcolorDlgData*)iupAttribGetInherit(ih, "_IUP_GC_DATA");

  /* valid only before map */
  if (ih->handle)
    return 1;

  if (iupStrBoolean(value))
  {
    Ihandle* box = IupGetParent(colordlg_data->alpha_val);
    IupSetAttribute(box, "FLOATING", NULL);
    IupSetAttribute(box, "VISIBLE", "YES");
  }

  return 1;
}
Exemplo n.º 18
0
static void gtkTabsCloseButtonClicked(GtkButton *widget, Ihandle* child)
{
  /* Close tab child */
  GtkWidget* tab_page = (GtkWidget*)iupAttribGet(child, "_IUPTAB_PAGE");
  if (tab_page)
  {
    Ihandle* ih = IupGetParent(child);
    int pos = gtk_notebook_page_num((GtkNotebook*)ih->handle, tab_page);
    int ret = IUP_DEFAULT;
    IFni cb = (IFni)IupGetCallback(ih, "TABCLOSE_CB");
    if (cb)
      ret = cb(ih, pos);

    if (ret == IUP_CONTINUE) /* destroy tab and children */
    {
      IupDestroy(child);
      IupRefreshChildren(ih);
    }
    else if (ret == IUP_DEFAULT) /* hide tab and children */
      gtk_widget_hide(tab_page);
  }

  (void)widget;
}
Exemplo n.º 19
0
static int killfocus_cb(Ihandle *ih)
{
  printf("KILLFOCUS_CB(%s)\n", IupGetAttribute(IupGetParent(IupGetParent(ih)), "TITLE"));
  return IUP_DEFAULT;
}
Exemplo n.º 20
0
static int leavewindow_cb(Ihandle *ih)
{
  printf("LEAVEWINDOW_CB(%s)\n", IupGetAttribute(IupGetParent(IupGetParent(ih)), "TITLE"));
  return IUP_DEFAULT;
}
Exemplo n.º 21
0
static int enterwindow_cb(Ihandle *ih)
{
  setactivelist(ih);
  printf("ENTERWINDOW_CB(%s)\n", IupGetAttribute(IupGetParent(IupGetParent(ih)), "TITLE"));
  return IUP_DEFAULT;
}
Exemplo n.º 22
0
int menuclose_cb(Ihandle* ih)
{
  printf("MENUCLOSE_CB(Menu of %s)\n", IupGetAttribute(IupGetParent(ih), "TITLE"));
  return IUP_DEFAULT;
}
Exemplo n.º 23
0
int open_cb(Ihandle* ih)
{
  printf("OPEN_CB(Menu of %s)\n", IupGetAttribute(IupGetParent(ih), "TITLE"));
  return IUP_DEFAULT;
}
Exemplo n.º 24
0
static int help_cb(Ihandle* ih)
{
  printf("HELP_CB(%s)\n", IupGetAttribute(IupGetParent(IupGetParent(ih)), "TITLE"));
  return IUP_DEFAULT;
}
Exemplo n.º 25
0
int getfocus_cb(Ihandle *ih)
{
  setactivelist(ih);
  printf("GETFOCUS_CB(%s)\n", IupGetAttribute(IupGetParent(IupGetParent(ih)), "TITLE"));
  return IUP_DEFAULT;
}
Exemplo n.º 26
0
static void GetParent(void)
{
  Ihandle *p = IupGetParent(iuplua_checkihandle(1));
  iuplua_pushihandle(p);
}