/* Adds a tooltip containing the message tip_text to the specified GtkWidget. */ int clip_GTK_TOOLTIPSSETTIP(ClipMachine * ClipMachineMemory) { C_widget *ctt = _fetch_cw_arg(ClipMachineMemory); C_widget *cwid = _fetch_cwidget(ClipMachineMemory, _clip_spar(ClipMachineMemory, 2)); gchar *tip_text = _clip_parc(ClipMachineMemory, 3); gchar *tip_private = _clip_parc(ClipMachineMemory, 4); CHECKCWID(ctt, GTK_IS_TOOLTIPS); CHECKARG2(2, MAP_type_of_ClipVarType, NUMERIC_type_of_ClipVarType); CHECKCWID(cwid, GTK_IS_WIDGET); CHECKOPT(3, CHARACTER_type_of_ClipVarType); CHECKOPT(4, CHARACTER_type_of_ClipVarType); LOCALE_TO_UTF(tip_text); LOCALE_TO_UTF(tip_private); gtk_tooltips_set_tip(GTK_TOOLTIPS(ctt->widget), cwid->widget, tip_text, tip_private); FREE_TEXT(tip_text); FREE_TEXT(tip_private); return 0; err: return 1; }
int clip_GTK_ACTIONGROUPTRANSLATESTRING(ClipMachine * ClipMachineMemory) { C_object *cagroup = _fetch_co_arg(ClipMachineMemory); gchar *string = _clip_parc(ClipMachineMemory, 2); gchar *resstr; CHECKARG2(1, MAP_type_of_ClipVarType, NUMERIC_type_of_ClipVarType); CHECKCOBJ(cagroup, GTK_IS_ACTION_GROUP(cagroup->object)); CHECKARG(2, CHARACTER_type_of_ClipVarType); LOCALE_TO_UTF(string); resstr = (gchar *) gtk_action_group_translate_string(GTK_ACTION_GROUP(cagroup->object), string); LOCALE_FROM_UTF(resstr); _clip_retc(ClipMachineMemory, resstr); FREE_TEXT(string); FREE_TEXT(resstr); return 0; err: return 1; }
/* Inserts in notebook a new page whose content is child, whose bookmark is * tab_label, and whose menu label is menu_label. The page is inserted just * before the page number position, starting with 0. If position is out of * bounds, it is assumed to be the current number of pages. */ int clip_GTK_NOTEBOOKINSERTPAGEMENU(ClipMachine * ClipMachineMemory) { C_widget *cntb = _fetch_cw_arg(ClipMachineMemory); C_widget *cchild = _fetch_cwidget(ClipMachineMemory, _clip_spar(ClipMachineMemory, 2)); C_widget *ctab_label; GtkWidget *tab_label; C_widget *cmenu_label; GtkWidget *menu_label; gint position = _clip_parni(ClipMachineMemory, 5); CHECKCWID(cntb, GTK_IS_NOTEBOOK); CHECKARG2(2, MAP_type_of_ClipVarType, NUMERIC_type_of_ClipVarType); CHECKCWID(cchild, GTK_IS_WIDGET); CHECKARG3(3, MAP_type_of_ClipVarType, NUMERIC_type_of_ClipVarType, CHARACTER_type_of_ClipVarType); CHECKARG3(4, MAP_type_of_ClipVarType, NUMERIC_type_of_ClipVarType, CHARACTER_type_of_ClipVarType); CHECKOPT(5, NUMERIC_type_of_ClipVarType); if (_clip_parinfo(ClipMachineMemory, 3) == CHARACTER_type_of_ClipVarType) { char *caption = _clip_parc(ClipMachineMemory, 3); LOCALE_TO_UTF(caption); tab_label = gtk_label_new(caption); FREE_TEXT(caption); } else { ctab_label = _fetch_cwidget(ClipMachineMemory, _clip_spar(ClipMachineMemory, 3)); CHECKCWID(ctab_label, GTK_IS_WIDGET); if (ctab_label) tab_label = ctab_label->widget; } if (_clip_parinfo(ClipMachineMemory, 4) == CHARACTER_type_of_ClipVarType) { char *menu_text = _clip_parc(ClipMachineMemory, 4); LOCALE_TO_UTF(menu_text); menu_label = gtk_label_new(menu_text); FREE_TEXT(menu_text); } else { cmenu_label = _fetch_cwidget(ClipMachineMemory, _clip_spar(ClipMachineMemory, 4)); CHECKCWID(cmenu_label, GTK_IS_WIDGET); if (cmenu_label) menu_label = cmenu_label->widget; } if (_clip_parinfo(ClipMachineMemory, 5) == UNDEF_type_of_ClipVarType) position = 1; gtk_notebook_insert_page_menu(GTK_NOTEBOOK(cntb->widget), cchild->widget, tab_label, menu_label, position - 1); return 0; err: return 1; }
static gint handle_widget_selected_signal(GtkWidget * widget, GtkWidget * wid, gchar * tip_text, gchar * tip_private, GdkEventButton * event, C_signal * cs) { C_widget *cwid = _list_get_cwidget(cs->cw->cmachine, wid); PREPARECV(cs, cv); if (!cwid) cwid = _register_widget(cs->cw->cmachine, wid, NULL); if (cwid) _clip_madd(cs->cw->cmachine, &cv, HASH_WIDGET, &cwid->obj); LOCALE_FROM_UTF(tip_text); LOCALE_FROM_UTF(tip_private); _clip_mputc(cs->cw->cmachine, &cv, HASH_TIPTEXT, tip_text, strlen(tip_text)); _clip_mputc(cs->cw->cmachine, &cv, HASH_TIPPRIVATE, tip_private, strlen(tip_private)); _clip_mputn(cs->cw->cmachine, &cv, HASH_BUTTON, event->button); _clip_mputn(cs->cw->cmachine, &cv, HASH_X, event->x); _clip_mputn(cs->cw->cmachine, &cv, HASH_Y, event->y); _clip_mputn(cs->cw->cmachine, &cv, HASH_XROOT, event->x_root); _clip_mputn(cs->cw->cmachine, &cv, HASH_YROOT, event->y_root); _clip_mputn(cs->cw->cmachine, &cv, HASH_STATE, event->state); FREE_TEXT(tip_text); FREE_TEXT(tip_private); INVOKESIGHANDLER(widget, cs, cv); }
static int ippctl_action_mod( char *aname) { ipp_mod_id_t mid; ipp_action_id_t aid; char *modname; nvlist_t *nvlp; int ipp_rc; int rc; /* * Look up the action id and get the id of the module that * implements the action. If that succeeds then look up the * name of the module. */ aid = ipp_action_lookup(aname); FREE_TEXT(aname); if ((ipp_rc = ipp_action_mod(aid, &mid)) == 0) ipp_rc = ipp_mod_name(mid, &modname); /* * Add an nvlist containing the kernel return code to the * set of nvlists to pass back to libipp. */ if ((rc = ippctl_set_rc(ipp_rc)) != 0) return (rc); /* * If everything succeeded add an nvlist containing the * module name to the set of nvlists to pass back to libipp. */ if (ipp_rc == 0) { if ((rc = nvlist_alloc(&nvlp, NV_UNIQUE_NAME, KM_SLEEP)) != 0) return (rc); if ((rc = ippctl_attach_modname(nvlp, modname)) != 0) { nvlist_free(nvlp); return (rc); } FREE_TEXT(modname); rc = ippctl_callback(nvlp, NULL); nvlist_free(nvlp); } else rc = 0; return (rc); }
static int ippctl_action_create( char *modname, char *aname, nvlist_t *nvlp, ipp_flags_t flags) { int ipp_rc; int rc; ipp_mod_id_t mid; ipp_action_id_t aid; /* * Look up the module id from the name and create the new * action. */ mid = ipp_mod_lookup(modname); FREE_TEXT(modname); ipp_rc = ipp_action_create(mid, aname, &nvlp, flags, &aid); FREE_TEXT(aname); /* * Add an nvlist containing the kernel return code to the * set of nvlists to pass back to libipp. */ if ((rc = ippctl_set_rc(ipp_rc)) != 0) { if (nvlp != NULL) { nvlist_free(nvlp); if (ipp_action_destroy(aid, 0) != 0) { cmn_err(CE_PANIC, "ippctl: unrecoverable error (aid = %d)", aid); /*NOTREACHED*/ } } return (rc); } /* * If the module passed back an nvlist, add this as * well. */ if (nvlp != NULL) { rc = ippctl_callback(nvlp, NULL); nvlist_free(nvlp); } else rc = 0; return (rc); }
int clip_GTK_TOGGLEACTIONNEW(ClipMachine * ClipMachineMemory) { ClipVar *cv = _clip_spar(ClipMachineMemory, 1); gchar *name = _clip_parc(ClipMachineMemory, 2); gchar *label = _clip_parc(ClipMachineMemory, 3); gchar *tooltip = _clip_parc(ClipMachineMemory, 4); gchar *stock_id = _clip_parc(ClipMachineMemory, 5); C_object *caction; GtkToggleAction *action; CHECKOPT(1, MAP_type_of_ClipVarType); CHECKARG(2, CHARACTER_type_of_ClipVarType); CHECKARG(3, CHARACTER_type_of_ClipVarType); CHECKOPT(4, CHARACTER_type_of_ClipVarType); CHECKOPT(5, CHARACTER_type_of_ClipVarType); LOCALE_TO_UTF(name); LOCALE_TO_UTF(label); if (tooltip) LOCALE_TO_UTF(tooltip); if (stock_id) LOCALE_TO_UTF(stock_id); action = gtk_toggle_action_new(name, label, tooltip, stock_id); if (action) { caction = _list_get_cobject(ClipMachineMemory, action); if (!caction) caction = _register_object(ClipMachineMemory, action, GTK_TYPE_TOGGLE_ACTION, cv, NULL); if (caction) _clip_mclone(ClipMachineMemory, RETPTR(ClipMachineMemory), &caction->obj); } FREE_TEXT(name); FREE_TEXT(label); if (tooltip) FREE_TEXT(tooltip); if (stock_id) FREE_TEXT(stock_id); return 0; err: return 1; }
/* Signal handlers */ static gint handle_widget_entered_signal (GtkWidget *widget, GtkWidget *wid, gchar *tip_text, gchar *tip_private, C_signal *cs) { C_widget *cwid = _list_get_cwidget(cs->cw->cmachine,wid); PREPARECV(cs,cv); if (!cwid) cwid = _register_widget(cs->cw->cmachine,wid,NULL); if (cwid) _clip_madd(cs->cw->cmachine, &cv, HASH_WIDGET, &cwid->obj); LOCALE_FROM_UTF(tip_text); LOCALE_FROM_UTF(tip_private); _clip_mputc(cs->cw->cmachine, &cv, HASH_TIPTEXT, tip_text, strlen(tip_text)); _clip_mputc(cs->cw->cmachine, &cv, HASH_TIPPRIVATE, tip_private, strlen(tip_private)); FREE_TEXT(tip_text); FREE_TEXT(tip_private); INVOKESIGHANDLER(widget,cs,cv); }
/* Retrieves any GtkTooltipsData previously associated with the given widget. */ int clip_GTK_TOOLTIPSDATAGET(ClipMachine * ClipMachineMemory) { C_widget *cwid = _fetch_cw_arg(ClipMachineMemory); GtkTooltipsData *data; CHECKCWID(cwid, GTK_IS_WIDGET); data = gtk_tooltips_data_get(cwid->widget); if (data) { C_widget *ctt = _list_get_cwidget(ClipMachineMemory, data->tooltips); C_object *cfont = _list_get_cobject(ClipMachineMemory, data->font); ClipVar *ret = RETPTR(ClipMachineMemory); char *tip_text = data->tip_text ? data->tip_text : ""; char *tip_private = data->tip_private ? data->tip_private : ""; memset(ret, 0, sizeof(*ret)); _clip_map(ClipMachineMemory, ret); if (!ctt) ctt = _register_widget(ClipMachineMemory, (GtkWidget *) (data->tooltips), NULL); if (ctt) _clip_madd(ClipMachineMemory, ret, HASH_TOOLTIPS, &ctt->obj); if (!cfont) cfont = _register_object(ClipMachineMemory, data->font, GDK_OBJECT_FONT, NULL, (coDestructor) gdk_object_font_destructor); if (cfont) { cfont->ref_count = 1; _clip_madd(ClipMachineMemory, ret, HASH_FONT, &cfont->obj); } _clip_madd(ClipMachineMemory, ret, HASH_WIDGET, &cwid->obj); LOCALE_FROM_UTF(tip_text); LOCALE_FROM_UTF(tip_private); _clip_mputc(ClipMachineMemory, ret, HASH_TIPTEXT, tip_text, strlen(tip_text)); _clip_mputc(ClipMachineMemory, ret, HASH_TIPPRIVATE, tip_private, strlen(tip_private)); _clip_mputn(ClipMachineMemory, ret, HASH_WIDTH, data->width); FREE_TEXT(tip_text); FREE_TEXT(tip_private); } return 0; err: return 1; }
/* Changes the menu label of child. Nothing happens if child is not in notebook. */ int clip_GTK_NOTEBOOKSETMENULABEL(ClipMachine * ClipMachineMemory) { C_widget *cntb = _fetch_cw_arg(ClipMachineMemory); C_widget *cchild = _fetch_cwidget(ClipMachineMemory, _clip_spar(ClipMachineMemory, 2)); C_widget *clabel; CHECKCWID(cntb, GTK_IS_NOTEBOOK); CHECKARG2(2, MAP_type_of_ClipVarType, NUMERIC_type_of_ClipVarType); CHECKCWID(cchild, GTK_IS_WIDGET); CHECKARG3(3, MAP_type_of_ClipVarType, NUMERIC_type_of_ClipVarType, CHARACTER_type_of_ClipVarType); if (_clip_parinfo(ClipMachineMemory, 3) == CHARACTER_type_of_ClipVarType) { char *menu_text = _clip_parc(ClipMachineMemory, 3); LOCALE_TO_UTF(menu_text); gtk_notebook_set_menu_label_text(GTK_NOTEBOOK(cntb->widget), cchild->widget, menu_text); FREE_TEXT(menu_text); } else { clabel = _fetch_cwidget(ClipMachineMemory, _clip_spar(ClipMachineMemory, 3)); CHECKCWID(clabel, GTK_IS_WIDGET); if (clabel) gtk_notebook_set_menu_label(GTK_NOTEBOOK(cntb->widget), cchild->widget, clabel->widget); } return 0; err: return 1; }
int clip_GTK_ACTIONGROUPNEW(ClipMachine * ClipMachineMemory) { ClipVar *cv = _clip_spar(ClipMachineMemory, 1); gchar *name = _clip_parc(ClipMachineMemory, 2); C_object *cagroup; GtkActionGroup *agroup; CHECKOPT(1, MAP_type_of_ClipVarType); CHECKARG(2, CHARACTER_type_of_ClipVarType); LOCALE_TO_UTF(name); agroup = gtk_action_group_new(name); if (agroup) { cagroup = _list_get_cobject(ClipMachineMemory, agroup); if (!cagroup) cagroup = _register_object(ClipMachineMemory, agroup, GTK_TYPE_ACTION_GROUP, cv, NULL); if (cagroup) _clip_mclone(ClipMachineMemory, RETPTR(ClipMachineMemory), &cagroup->obj); } FREE_TEXT(name); return 0; err: return 1; }
/* Prepends to notebook a page whose content is child, and whose * bookmark is label. */ int clip_GTK_NOTEBOOKPREPENDPAGE(ClipMachine * ClipMachineMemory) { C_widget *cntb = _fetch_cw_arg(ClipMachineMemory); C_widget *cchild = _fetch_cwidget(ClipMachineMemory, _clip_spar(ClipMachineMemory, 2)); C_widget *clabel; GtkWidget *label; CHECKCWID(cntb, GTK_IS_NOTEBOOK); CHECKARG2(2, MAP_type_of_ClipVarType, NUMERIC_type_of_ClipVarType); CHECKCWID(cchild, GTK_IS_WIDGET); CHECKARG3(3, MAP_type_of_ClipVarType, NUMERIC_type_of_ClipVarType, CHARACTER_type_of_ClipVarType); if (_clip_parinfo(ClipMachineMemory, 3) == CHARACTER_type_of_ClipVarType) { char *caption = _clip_parc(ClipMachineMemory, 3); LOCALE_TO_UTF(caption); label = gtk_label_new(caption); FREE_TEXT(caption); } else { clabel = _fetch_cwidget(ClipMachineMemory, _clip_spar(ClipMachineMemory, 3)); CHECKCWID(clabel, GTK_IS_WIDGET); if (clabel) label = clabel->widget; } gtk_notebook_prepend_page(GTK_NOTEBOOK(cntb->widget), cchild->widget, label); return 0; err: return 1; }
int clip_GTK_ICONTHEMEGETICONSIZES(ClipMachine * cm) { C_object *cicon = _fetch_co_arg(cm); gchar *icon_name = _clip_parc(cm, 2); ClipVar *cv = RETPTR(cm); gint *a ; CHECKCOBJ(cicon, GTK_IS_ICON_THEME(cicon->object)); CHECKARG(2, CHARACTER_t); LOCALE_TO_UTF(icon_name); a = gtk_icon_theme_get_icon_sizes(GTK_ICON_THEME(cicon->object), icon_name); FREE_TEXT(icon_name); _clip_array(cm, cv, 0, 0); while (a) { ClipVar *item; item = NEW(ClipVar); item->t.type = NUMERIC_t; item->t.flags = 0; item->n.d = a[0]; _clip_aadd(cm, cv, item); _clip_delete(cm, item); a++; } free(a); return 0; err: return 1; }
static int ippctl_action_destroy( char *aname, ipp_flags_t flags) { ipp_action_id_t aid; int ipp_rc; int rc; /* * Look up the action id and destroy the action. */ aid = ipp_action_lookup(aname); FREE_TEXT(aname); ipp_rc = ipp_action_destroy(aid, flags); /* * Add an nvlist containing the kernel return code to the * set of nvlists to pass back to libipp. */ if ((rc = ippctl_set_rc(ipp_rc)) != 0) return (rc); /* * There's no more information to pass back. */ return (0); }
int clip_GTK_IMAGEMENUITEMNEWWITHMNEMONIC(ClipMachine * cm) { ClipVar *cv = _clip_spar(cm, 1); gchar *label = _clip_parc(cm, 2); C_widget *cimage ; GtkWidget *image ; CHECKOPT(1,MAP_t); CHECKARG(2, CHARACTER_t); LOCALE_TO_UTF(label); image = gtk_image_menu_item_new_with_mnemonic(label); if (image) { cimage = _list_get_cwidget(cm, image); if (!cimage) cimage = _register_widget(cm, image, cv); if (cimage) _clip_mclone(cm, RETPTR(cm), &cimage->obj); } FREE_TEXT(label); return 0; err: return 1; }
/**** INPUT DIALOG constructor ****/ int clip_GTK_INPUTDIALOGNEW(ClipMachine * ClipMachineMemory) { ClipVar *cv = _clip_spar(ClipMachineMemory, 1); char *title = _clip_parc(ClipMachineMemory, 2); GtkWidget *wid = NULL; C_widget *cwid; CHECKOPT(1, MAP_type_of_ClipVarType); CHECKOPT(2, CHARACTER_type_of_ClipVarType); wid = gtk_input_dialog_new(); if (!wid) goto err; if (_clip_parinfo(ClipMachineMemory, 2) == CHARACTER_type_of_ClipVarType) { LOCALE_TO_UTF(title); gtk_window_set_title(GTK_WINDOW(wid), title); FREE_TEXT(title); } //cwid = (C_widget*)calloc( 1, sizeof(C_widget) ); cwid = _register_widget(ClipMachineMemory, wid, cv); _clip_mclone(ClipMachineMemory, RETPTR(ClipMachineMemory), &cwid->obj); return 0; err: return 1; }
/**** WINDOW constructor ****/ int clip_GTK_WINDOWNEW(ClipMachine * cm) { ClipVar * cv = _clip_spar(cm, 1); char * title = _clip_parc(cm, 2); gint typ = INT_OPTION(cm, 3, 0); GtkWidget *wid = NULL; C_widget *cwid; CHECKOPT(1,MAP_t); CHECKOPT(2,CHARACTER_t); CHECKOPT(3,NUMERIC_t); //wid = gtk_window_new(GTK_WINDOW_TOPLEVEL); wid = gtk_window_new(typ); if (!wid) goto err; if (_clip_parinfo(cm,2)==CHARACTER_t) { LOCALE_TO_UTF(title); gtk_window_set_title(GTK_WINDOW(wid), title); FREE_TEXT(title); } //cwid = (C_widget*)calloc( 1, sizeof(C_widget) ); cwid = _register_widget(cm, wid, cv); cwid->accel_group = gtk_accel_group_new(); gtk_window_add_accel_group (GTK_WINDOW (wid), cwid->accel_group); // gtk_signal_connect( GTK_OBJECT( wid ), "delete-event", // GTK_SIGNAL_FUNC( delete_window_handler ), NULL ); _clip_mclone(cm,RETPTR(cm),&cwid->obj); return 0; err: return 1; }
/**** TREE ITEM constructor ****/ int clip_GTK_TREEITEMNEW(ClipMachine * ClipMachineMemory) { ClipVar *cv = _clip_spar(ClipMachineMemory, 1); char *label = _clip_parc(ClipMachineMemory, 2); GtkWidget *wid = NULL; C_widget *cwid; CHECKOPT(1, MAP_type_of_ClipVarType); CHECKOPT(2, CHARACTER_type_of_ClipVarType); if (_clip_parinfo(ClipMachineMemory, 2) == CHARACTER_type_of_ClipVarType) { LOCALE_TO_UTF(label); wid = gtk_tree_item_new_with_label(label); FREE_TEXT(label); } else wid = gtk_tree_item_new(); if (!wid) goto err; cwid = _register_widget(ClipMachineMemory, wid, cv); _clip_mclone(ClipMachineMemory, RETPTR(ClipMachineMemory), &cwid->obj); return 0; err: return 1; }
/**** BUTTON constructor ****/ int clip_GTK_BUTTONNEW(ClipMachine * ClipMachineMemory) { ClipVar *cv = _clip_spar(ClipMachineMemory, 1); char *title = _clip_parc(ClipMachineMemory, 2); char *pchar = _clip_parc(ClipMachineMemory, 3); GtkWidget *wid = NULL, *label = NULL; C_widget *cwid, *clabel = NULL; guint accel_key = 0; CHECKOPT(1, MAP_type_of_ClipVarType); CHECKOPT(2, CHARACTER_type_of_ClipVarType); CHECKOPT(3, CHARACTER_type_of_ClipVarType); if (pchar) { unsigned char *pc; for (pc = (unsigned char *) title; pc && *pc; pc++) if (*pc == *pchar) { *pc = '_'; accel_key = *(pc + 1); } } if (_clip_parinfo(ClipMachineMemory, 2) == CHARACTER_type_of_ClipVarType) { LOCALE_TO_UTF(title); wid = gtk_button_new_with_label(title); label = GTK_BIN(&(GTK_BUTTON(wid)->bin))->child; if (pchar) accel_key = gtk_label_parse_uline(GTK_LABEL(label), title); FREE_TEXT(title); } else { wid = gtk_button_new(); } if (!wid) goto err; cwid = _register_widget(ClipMachineMemory, wid, cv); if (label) clabel = _register_widget(ClipMachineMemory, label, NULL); if (clabel) _clip_madd(ClipMachineMemory, &cwid->obj, HASH_LABEL, &clabel->obj); _clip_mclone(ClipMachineMemory, RETPTR(ClipMachineMemory), &cwid->obj); _clip_mputn(ClipMachineMemory, &cwid->obj, HASH_ACCELKEY, accel_key); return 0; err: return 1; }
/**** LABEL constructor ****/ int clip_GTK_LABELNEW(ClipMachine * cm) { ClipVar * cv = _clip_spar(cm, 1); char * text = _clip_parc(cm, 2); char * pchar = _clip_parc(cm, 3); guint accel_key = 0; GtkWidget *wid = NULL; C_widget *cwid; CHECKOPT(1,MAP_t); CHECKOPT(2,CHARACTER_t); CHECKOPT(3,CHARACTER_t); if (pchar) { char *pc; for (pc = text;pc && *pc; pc++) if (*pc == *pchar) *pc='_'; } LOCALE_TO_UTF(text); wid = gtk_label_new(text); if (!wid) goto err; if (pchar) accel_key = gtk_label_parse_uline(GTK_LABEL(wid),text); FREE_TEXT(text); cwid = _register_widget(cm, wid, cv); _clip_mclone(cm,RETPTR(cm),&cwid->obj); _clip_mputn(cm,&cwid->obj,HASH_ACCELKEY,accel_key); return 0; err: return 1; }
int clip_GTK_MENUITEMNEWWITHMNEMONIC(ClipMachine * ClipMachineMemory) { ClipVar *cv = _clip_spar(ClipMachineMemory, 1); char *label = _clip_parc(ClipMachineMemory, 2); GtkWidget *wid = NULL; C_widget *cwid; CHECKOPT(1, MAP_type_of_ClipVarType); CHECKARG(2, CHARACTER_type_of_ClipVarType); LOCALE_TO_UTF(label); wid = gtk_menu_item_new_with_mnemonic(label); FREE_TEXT(label); if (!wid) goto err; cwid = _register_widget(ClipMachineMemory, wid, cv); _clip_mclone(ClipMachineMemory, RETPTR(ClipMachineMemory), &cwid->obj); return 0; err: return 1; }
/**** ACCEL LABEL constructor ****/ int clip_GTK_ACCELLABELNEW(ClipMachine * ClipMachineMemory) { ClipVar *cv = _clip_spar(ClipMachineMemory, 1); char *text = _clip_parc(ClipMachineMemory, 2); GtkWidget *wid = NULL; C_widget *cwid; CHECKOPT(1, MAP_type_of_ClipVarType); CHECKOPT(2, CHARACTER_type_of_ClipVarType); LOCALE_TO_UTF(text); wid = gtk_accel_label_new(text); FREE_TEXT(text); if (!wid) goto err; cwid = _register_widget(ClipMachineMemory, wid, cv); _clip_mclone(ClipMachineMemory, RETPTR(ClipMachineMemory), &cwid->obj); return 0; err: return 1; }
int clip_GTK_ACTIONGROUPGETACTION(ClipMachine * ClipMachineMemory) { C_object *cagroup = _fetch_co_arg(ClipMachineMemory); gchar *name = _clip_parc(ClipMachineMemory, 2); GtkAction *action; C_object *caction; CHECKARG2(1, MAP_type_of_ClipVarType, NUMERIC_type_of_ClipVarType); CHECKCOBJ(cagroup, GTK_IS_ACTION_GROUP(cagroup->object)); CHECKARG(2, CHARACTER_type_of_ClipVarType); LOCALE_TO_UTF(name); action = gtk_action_group_get_action(GTK_ACTION_GROUP(cagroup->object), name); if (action) { caction = _list_get_cobject(ClipMachineMemory, action); if (!caction) caction = _register_object(ClipMachineMemory, action, GTK_TYPE_ACTION, NULL, NULL); if (caction) _clip_mclone(ClipMachineMemory, RETPTR(ClipMachineMemory), &caction->obj); } FREE_TEXT(name); return 0; err: return 1; }
/* Set the pixmap in a node. */ int clip_GTK_CTREENODESETPIXTEXT(ClipMachine * cm) { C_widget *cctree = _fetch_cw_arg(cm); C_object *cnode = _fetch_cobject(cm,_clip_spar(cm,2)); gint column = _clip_parni(cm,3); gchar *text = _clip_parc(cm,4); gint spacing = _clip_parni(cm,5); C_widget *cpixmap = _fetch_cwidget(cm,_clip_spar(cm,6)); GdkPixmap *pixmap=NULL; GdkBitmap *mask=NULL; CHECKCWID(cctree,GTK_IS_CTREE); CHECKOPT2(2,MAP_t,NUMERIC_t); CHECKCOBJOPT(cnode,cnode->type==GTK_TYPE_CTREE_NODE); CHECKOPT(3,NUMERIC_t); CHECKOPT(4,CHARACTER_t); CHECKOPT(5,NUMERIC_t); CHECKOPT2(6,MAP_t,NUMERIC_t); CHECKCWIDOPT(cpixmap,GTK_IS_PIXMAP); if (_clip_parinfo(cm,3)==UNDEF_t) column = 1; if (_clip_parinfo(cm,4)==UNDEF_t) text = ""; if (cpixmap) { pixmap = GTK_PIXMAP(cpixmap->widget)->pixmap; mask = GTK_PIXMAP(cpixmap->widget)->mask; } LOCALE_TO_UTF(text); gtk_ctree_node_set_pixtext(GTK_CTREE(cctree->widget), GTK_CTREE_NODE(cnode->object), column-1, text,spacing,pixmap,mask); FREE_TEXT(text); return 0; err: return 1; }
/* Sets the text within the GtkLabel widget. It overwrites any text that was * there before. Note that underlines that were there before do not get * overwritten. If you want to erase underlines just send NULL to * gtk_label_set_pattern(). */ int clip_GTK_LABELSETTEXT(ClipMachine * ClipMachineMemory) { C_widget *clbl = _fetch_cw_arg(ClipMachineMemory); char *text = _clip_parc(ClipMachineMemory, 2); char *pchar = _clip_parc(ClipMachineMemory, 3); guint accel_key = 0; CHECKCWID(clbl, GTK_IS_LABEL); CHECKOPT(2, CHARACTER_type_of_ClipVarType); CHECKOPT(3, CHARACTER_type_of_ClipVarType); if (_clip_parinfo(ClipMachineMemory, 2) == UNDEF_type_of_ClipVarType) text = "\0"; LOCALE_TO_UTF(text); gtk_label_set_text(GTK_LABEL(clbl->widget), text); if (pchar) { char *pc; for (pc = text; pc && *pc; pc++) if (*pc == *pchar) *pc = '_'; accel_key = gtk_label_parse_uline(GTK_LABEL(clbl->widget), text); } FREE_TEXT(text); _clip_mputn(ClipMachineMemory, &clbl->obj, HASH_ACCELKEY, accel_key); return 0; err: return 1; }
/* Changes the bookmark label of child. Nothing happens if child is not in notebook. */ int clip_GTK_NOTEBOOKSETTABLABEL(ClipMachine * cm) { C_widget *cntb = _fetch_cw_arg(cm); C_widget *cchild = _fetch_cwidget(cm,_clip_spar(cm,2)); C_widget *clabel; CHECKCWID(cntb,GTK_IS_NOTEBOOK); CHECKARG2(2,MAP_t,NUMERIC_t); CHECKCWID(cchild,GTK_IS_WIDGET); CHECKARG3(3,MAP_t,NUMERIC_t,CHARACTER_t); if (_clip_parinfo(cm,3)==CHARACTER_t) { char * caption = _clip_parc(cm, 3); LOCALE_TO_UTF(caption); gtk_notebook_set_tab_label_text(GTK_NOTEBOOK(cntb->widget), cchild->widget,caption); FREE_TEXT(caption); } else { clabel = _fetch_cwidget(cm,_clip_spar(cm,3)); CHECKCWID(clabel,GTK_IS_WIDGET); if (clabel) gtk_notebook_set_tab_label(GTK_NOTEBOOK(cntb->widget), cchild->widget,clabel->widget); } return 0; err: return 1; }
/* Inserts in notebook a new page whose content is child, and whose bookmark * is tab_label. The page is inserted just before the page number position, * starting with 0. If position is out of bounds, it is assumed to be the * current number of pages. */ int clip_GTK_NOTEBOOKINSERTPAGE(ClipMachine * cm) { C_widget *cntb = _fetch_cw_arg(cm); C_widget *cchild = _fetch_cwidget(cm,_clip_spar(cm,2)); C_widget *clabel; GtkWidget *label; gint position = _clip_parni(cm,4); CHECKCWID(cntb,GTK_IS_NOTEBOOK); CHECKARG2(2,MAP_t,NUMERIC_t); CHECKCWID(cchild,GTK_IS_WIDGET); CHECKARG3(3,MAP_t,NUMERIC_t,CHARACTER_t); CHECKOPT(4,NUMERIC_t); if (_clip_parinfo(cm,3)==CHARACTER_t) { char * caption = _clip_parc(cm, 3); LOCALE_TO_UTF(caption); label = gtk_label_new_with_mnemonic(caption); FREE_TEXT(caption); } else { clabel = _fetch_cwidget(cm,_clip_spar(cm,3)); CHECKCWID(clabel,GTK_IS_WIDGET); if (clabel) label = clabel->widget; } if (_clip_parinfo(cm,4)==UNDEF_t) position = 1; gtk_notebook_insert_page(GTK_NOTEBOOK(cntb->widget), cchild->widget, label, position-1); return 0; err: return 1; }
/* Sets the text to display when the query is not in effect, and the * text to display when the query is in effect but the widget beneath * the pointer has no tooltip. */ int clip_GTK_TIPSQUERYSETLABELS(ClipMachine * cm) { C_widget *ctq = _fetch_cw_arg(cm); gchar *label_inactive = _clip_parc(cm,2); gchar *label_no_tip = _clip_parc(cm,3); CHECKCWID(ctq,GTK_IS_TIPS_QUERY); CHECKOPT(2,CHARACTER_t); CHECKOPT(3,CHARACTER_t); LOCALE_TO_UTF(label_inactive); LOCALE_TO_UTF(label_no_tip); gtk_tips_query_set_labels(GTK_TIPS_QUERY(ctq->widget), label_inactive, label_no_tip); FREE_TEXT(label_inactive); FREE_TEXT(label_no_tip); return 0; err: return 1; }
/* Prepends to notebook a page whose content is child, whose bookmark * is tab_label, and whose menu label is menu_label. */ int clip_GTK_NOTEBOOKPREPENDPAGEMENU(ClipMachine * cm) { C_widget *cntb = _fetch_cw_arg(cm); C_widget *cchild = _fetch_cwidget(cm,_clip_spar(cm,2)); C_widget *ctab_label; GtkWidget *tab_label; C_widget *cmenu_label; GtkWidget *menu_label; CHECKCWID(cntb,GTK_IS_NOTEBOOK); CHECKARG2(2,MAP_t,NUMERIC_t); CHECKCWID(cchild,GTK_IS_WIDGET); CHECKARG3(3,MAP_t,NUMERIC_t,CHARACTER_t); CHECKARG3(4,MAP_t,NUMERIC_t,CHARACTER_t); if (_clip_parinfo(cm,3)==CHARACTER_t) { char * caption = _clip_parc(cm, 3); LOCALE_TO_UTF(caption); tab_label = gtk_label_new_with_mnemonic(caption); FREE_TEXT(caption); } else { ctab_label = _fetch_cwidget(cm,_clip_spar(cm,3)); CHECKCWID(ctab_label,GTK_IS_WIDGET); if (ctab_label) tab_label = ctab_label->widget; } if (_clip_parinfo(cm,4)==CHARACTER_t) { char * menu_text = _clip_parc(cm, 4); LOCALE_TO_UTF(menu_text); menu_label = gtk_label_new_with_mnemonic(menu_text); FREE_TEXT(menu_text); } else { cmenu_label = _fetch_cwidget(cm,_clip_spar(cm,4)); CHECKCWID(cmenu_label,GTK_IS_WIDGET); if (cmenu_label) menu_label = cmenu_label->widget; } gtk_notebook_prepend_page_menu(GTK_NOTEBOOK(cntb->widget), cchild->widget, tab_label, menu_label); return 0; err: return 1; }
/* Sets title for window */ int clip_GTK_WINDOWSETTITLE(ClipMachine * cm) { C_widget *cwin = _fetch_cw_arg(cm); gchar *title = _clip_parc ( cm, 2); CHECKCWID(cwin,GTK_IS_WINDOW); CHECKARG(2,CHARACTER_t); LOCALE_TO_UTF(title); gtk_window_set_title(GTK_WINDOW(cwin->widget), title); FREE_TEXT(title); return 0; err: return 1; }