/* Parse a textual specification of a color and fill in the red, green, and * blue fields of a GdkColor structure. The color is not allocated, you must * call gdk_colormap_alloc_color() yourself. The text string can be in any of * the forms accepted by XParseColor; these include name for a color from * rgb.txt, such as DarkSlateGray, or a hex specification such as 305050.*/ int clip_GDK_COLORPARSE(ClipMachine * cm) { gchar * color_name = _clip_parc(cm,1); GdkColor color; CHECKARG(1,CHARACTER_t); if (gdk_color_parse(color_name, &color)) { memset(RETPTR(cm),0,sizeof(ClipVar)); _clip_map(cm,RETPTR(cm)); _gdk_color_to_map(cm,color,RETPTR(cm)); } return 0; err: return 1; }
/* Returns the difference between the union and the intersection of two * regions. This is a region containing the pixels that are in one of the * source regions, but which are not in both. */ int clip_GDK_REGIONXOR(ClipMachine * ClipMachineMemory) { C_object *creg = _fetch_co_arg(ClipMachineMemory); C_object *creg2 = _fetch_cobject(ClipMachineMemory, _clip_spar(ClipMachineMemory, 2)); C_object *cdest; CHECKCOBJ(creg, GDK_IS_REGION(creg->object)); CHECKARG2(2, MAP_type_of_ClipVarType, NUMERIC_type_of_ClipVarType); CHECKCOBJ(creg2, GDK_IS_REGION(creg->object)); gdk_region_xor(GDK_REGION(creg), GDK_REGION(creg2)); if (creg) { cdest = _register_object(ClipMachineMemory, GDK_REGION(creg), GDK_TYPE_REGION, NULL, NULL); if (cdest) _clip_mclone(ClipMachineMemory, RETPTR(ClipMachineMemory), &cdest->obj); } return 0; err: return 1; }
/**** SCROLLED WINDOW constructor ****/ int clip_GTK_SCROLLEDWINDOWNEW(ClipMachine * cm) { ClipVar * cv = _clip_spar(cm, 1); C_widget * chadj = _fetch_cwidget(cm,_clip_spar(cm, 2)); C_widget * cvadj = _fetch_cwidget(cm,_clip_spar(cm, 3)); GtkWidget *wid = NULL; C_widget *cwid; C_widget *chscr, *cvscr; GtkAdjustment *hadj, *vadj; CHECKOPT(1,MAP_t); CHECKOPT2(2,MAP_t,NUMERIC_t); CHECKCWIDOPT(chadj,GTK_IS_ADJUSTMENT); CHECKOPT2(3,MAP_t,NUMERIC_t); CHECKCWIDOPT(cvadj,GTK_IS_ADJUSTMENT); hadj = chadj ? GTK_ADJUSTMENT(chadj->widget) : NULL; vadj = cvadj ? GTK_ADJUSTMENT(cvadj->widget) : NULL; wid = gtk_scrolled_window_new(hadj,vadj); if (!wid) goto err; cwid = _register_widget(cm, wid, cv); chscr = _register_widget(cm, GTK_SCROLLED_WINDOW(wid)->hscrollbar, NULL); cvscr = _register_widget(cm, GTK_SCROLLED_WINDOW(wid)->vscrollbar, NULL); if (chscr) _clip_madd(cm,&cwid->obj,HASH_HSCROLLBAR,&chscr->obj); if (cvscr) _clip_madd(cm,&cwid->obj,HASH_VSCROLLBAR,&cvscr->obj); _clip_mclone(cm,RETPTR(cm),&cwid->obj); return 0; err: return 1; }
/****************************************************************************** * gtk_ItemFactoryNew( container_type, spath, accel_group ) --> ItemFactoryNewObject * container_type is one of :GTK_TYPE_MENU_BAR, GTK_TYPE_MENU or GTK_TYPE_OPTION_MENU ******************************************************************************/ int clip_GTK_ITEMFACTORYNEW(ClipMachine * cm) { gint itype = INT_OPTION(cm, 1, CLIP_GTK_TYPE_MENU_BAR); const gchar *path = _clip_parc(cm, 2); C_object *caccel = _fetch_cobject(cm, _clip_spar(cm, 3)); C_object *citem ; GtkItemFactory *item ; GtkType type = 0; CHECKARG(1, NUMERIC_t); CHECKARG(2, CHARACTER_t); CHECKOPT(3, MAP_t); CHECKCOBJOPT(caccel, GTK_IS_ACCEL_GROUP(caccel->object)); switch (itype) { case CLIP_GTK_TYPE_MENU_BAR: type = GTK_TYPE_MENU_BAR; break; case CLIP_GTK_TYPE_MENU: type = GTK_TYPE_MENU; break; case CLIP_GTK_TYPE_OPTION_MENU: type = GTK_TYPE_OPTION_MENU; break; } item = gtk_item_factory_new(type, path, GTK_ACCEL_GROUP(caccel->object)); if (item) { citem = _list_get_cobject(cm,item); if (!citem) citem = _register_object(cm,item,GTK_TYPE_ITEM_FACTORY,NULL,NULL); if (citem) _clip_mclone(cm,RETPTR(cm),&citem->obj); } return 0; err: return 1; }
int clip_GTK_FILECHOOSERGETURIS(ClipMachine * ClipMachineMemory) { C_object *cchooser = _fetch_co_arg(ClipMachineMemory); GSList *list; ClipVar *cv = RETPTR(ClipMachineMemory); long l; CHECKCOBJ(cchooser, GTK_IS_FILE_CHOOSER(cchooser->object)); list = gtk_file_chooser_get_uris(GTK_FILE_CHOOSER(cchooser->object)); l = g_slist_length(list); _clip_array(ClipMachineMemory, cv, 1, &l); for (l = 0; list; list = g_slist_next(list), l++) { ClipVar c; gchar *str; memset(&c, 0, sizeof(c)); str = (gchar *) list->data; _clip_var_str(str, strlen(str), &c); _clip_aset(ClipMachineMemory, cv, &c, 1, &l); _clip_destroy(ClipMachineMemory, &c); } g_slist_free(list); return 0; err: return 1; }
/**** Viewport constructor ****/ int clip_GTK_VIEWPORTNEW(ClipMachine * cm) { ClipVar * cv = _clip_spar(cm, 1); C_widget * chadj = _fetch_cwidget(cm,_clip_spar(cm, 2)); C_widget * cvadj = _fetch_cwidget(cm,_clip_spar(cm, 3)); GtkWidget *wid = NULL; C_widget *cwid; GtkAdjustment *hadj, *vadj; CHECKOPT(1,MAP_t); CHECKOPT2(2,MAP_t,NUMERIC_t); CHECKCWIDOPT(chadj,GTK_IS_ADJUSTMENT); CHECKOPT2(3,MAP_t,NUMERIC_t); CHECKCWIDOPT(cvadj,GTK_IS_ADJUSTMENT); hadj = chadj ? GTK_ADJUSTMENT(chadj->widget) : NULL; vadj = cvadj ? GTK_ADJUSTMENT(cvadj->widget) : NULL; wid = gtk_viewport_new(hadj,vadj); if (!wid) goto err; cwid = _register_widget(cm, wid, cv); _clip_mclone(cm,RETPTR(cm),&cwid->obj); return 0; err: return 1; }
// Sets shape of mouse cursor int clip_GDK_WINDOWSETCURSOR(ClipMachine * ClipMachineMemory) { C_widget *cwin = _fetch_cw_arg(ClipMachineMemory); GdkCursorType cursor_type = _clip_parni(ClipMachineMemory, 2); CHECKCWID(cwin, GTK_IS_WIDGET); CHECKOPT(2, NUMERIC_type_of_ClipVarType); if (cwin && cwin->widget) { GdkCursor *cursor = gdk_cursor_new(cursor_type); C_object *ccur; if (cursor) { ccur = _register_object(ClipMachineMemory, cursor, GDK_TYPE_CURSOR, NULL, (coDestructor) gdk_object_cursor_destructor); ccur->ref_count = 1; _clip_mclone(ClipMachineMemory, RETPTR(ClipMachineMemory), &ccur->obj); } gdk_window_set_cursor(cwin->widget->window, cursor); } return 0; err: return 1; }
int clip_EVP_ALG_LIST(ClipMachine *mp) { const char *s; int i, n; ClipVar *rp = RETPTR(mp), *ap; long vect[1]; for(i=0, n=0; (s=alg_names[i]); i++, n++) ; vect[0] = n; _clip_array(mp, rp, 1, vect); ap = _clip_vptr(rp); for(i=0; (s=alg_names[i]); i++) { ClipVar *vp; vp = ap->a.items + i; vp->t.type = CHARACTER_t; vp->s.str.buf = strdup(s); vp->s.str.len = strlen(s); } return 0; }
int clip_GTK_UIMANAGERNEW(ClipMachine * ClipMachineMemory) { ClipVar *cv = _clip_spar(ClipMachineMemory, 1); C_object *cmanager; GtkUIManager *manager; CHECKOPT(1, MAP_type_of_ClipVarType); manager = gtk_ui_manager_new(); if (manager) { cmanager = _list_get_cobject(ClipMachineMemory, manager); if (!cmanager) cmanager = _register_object(ClipMachineMemory, manager, GTK_TYPE_UI_MANAGER, cv, NULL); if (cmanager) _clip_mclone(ClipMachineMemory, RETPTR(ClipMachineMemory), &cmanager->obj); } return 0; err: return 1; }
/**** Adjustment constructor ****/ int clip_GTK_ADJUSTMENTNEW(ClipMachine * cm) { ClipVar * cv = _clip_spar (cm, 1); gfloat value = _clip_parnd(cm,2); gfloat lower = _clip_parnd(cm,3); gfloat upper = _clip_parnd(cm,4); gfloat step_inc = _clip_parnd(cm,5); gfloat page_inc = _clip_parnd(cm,6); gfloat page_size = _clip_parnd(cm,7); GtkWidget *wid = NULL; C_widget *cwid; CHECKOPT(1,MAP_t); CHECKOPT(2,NUMERIC_t); CHECKOPT(3,NUMERIC_t); CHECKOPT(4,NUMERIC_t); CHECKOPT(5,NUMERIC_t); CHECKOPT(6,NUMERIC_t); CHECKOPT(7,NUMERIC_t); if (_clip_parinfo(cm,2)==UNDEF_t) value = 0; if (_clip_parinfo(cm,3)==UNDEF_t) lower = 0; if (_clip_parinfo(cm,4)==UNDEF_t) upper = 100; if (_clip_parinfo(cm,5)==UNDEF_t) step_inc = 1; if (_clip_parinfo(cm,6)==UNDEF_t) page_inc = 10; if (_clip_parinfo(cm,7)==UNDEF_t) page_size = 10; wid = (GtkWidget*)gtk_adjustment_new(value,lower,upper,step_inc,page_inc,page_size); if (!wid) goto err; cwid = _register_widget(cm, wid, cv); _clip_mclone(cm,RETPTR(cm),&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; }
int clip_GTK_ENTRYCOMPLETIONNEW(ClipMachine * ClipMachineMemory) { ClipVar *cv = _clip_spar(ClipMachineMemory, 1); GtkEntryCompletion *completion; C_object *ccompletion; CHECKOPT(1, MAP_type_of_ClipVarType); completion = gtk_entry_completion_new(); if (completion) { ccompletion = _list_get_cobject(ClipMachineMemory, completion); if (!ccompletion) ccompletion = _register_object(ClipMachineMemory, completion, GTK_TYPE_ENTRY_COMPLETION, cv, NULL); if (ccompletion) _clip_mclone(ClipMachineMemory, RETPTR(ClipMachineMemory), &ccompletion->obj); } return 0; err: return 1; }
int clip_GTK_ENTRYCOMPLETIONGETMODEL(ClipMachine * ClipMachineMemory) { C_object *ccompletion = _fetch_co_arg(ClipMachineMemory); C_object *cmodell; GtkTreeModel *model; CHECKCOBJ(ccompletion, GTK_IS_ENTRY_COMPLETION(ccompletion->object)); model = gtk_entry_completion_get_model(GTK_ENTRY_COMPLETION(ccompletion->object)); if (model) { cmodell = _list_get_cobject(ClipMachineMemory, model); if (!cmodell) cmodell = _register_object(ClipMachineMemory, model, GTK_TYPE_TREE_MODEL, NULL, NULL); if (cmodell) _clip_mclone(ClipMachineMemory, RETPTR(ClipMachineMemory), &cmodell->obj); } return 0; err: return 1; }
int clip_GTK_ENTRYCOMPLETIONGETENTRY(ClipMachine * ClipMachineMemory) { C_object *ccompletion = _fetch_co_arg(ClipMachineMemory); C_widget *cwid; GtkWidget *wid; CHECKCOBJ(ccompletion, GTK_IS_ENTRY_COMPLETION(ccompletion->object)); wid = gtk_entry_completion_get_entry(GTK_ENTRY_COMPLETION(ccompletion->object)); if (wid) { cwid = _list_get_cwidget(ClipMachineMemory, wid); if (!cwid) cwid = _register_widget(ClipMachineMemory, wid, NULL); if (cwid) _clip_mclone(ClipMachineMemory, RETPTR(ClipMachineMemory), &cwid->obj); } return 0; err: return 1; }
/* Returns the union of a region and a rectangle. */ int clip_GDK_REGIONUNIONWITHRECT(ClipMachine * ClipMachineMemory) { C_object *creg = _fetch_co_arg(ClipMachineMemory); ClipVar *crect = _clip_spar(ClipMachineMemory, 2); C_object *cdest; GdkRectangle rect; CHECKCOBJ(creg, GDK_IS_REGION(creg->object)); CHECKARG(2, MAP_type_of_ClipVarType); _map_get_gdk_rectangle(ClipMachineMemory, crect, &rect); gdk_region_union_with_rect(GDK_REGION(creg), &rect); if (creg) { cdest = _register_object(ClipMachineMemory, GDK_REGION(creg), GDK_TYPE_REGION, NULL, NULL); if (cdest) _clip_mclone(ClipMachineMemory, RETPTR(ClipMachineMemory), &cdest->obj); } return 0; err: return 1; }
/* Returns the content of the page number page_num, or * NULL if page_num is out of bounds. */ int clip_GTK_NOTEBOOKGETNTHPAGE(ClipMachine * ClipMachineMemory) { C_widget *cntb = _fetch_cw_arg(ClipMachineMemory); gint page_num = _clip_parni(ClipMachineMemory, 2); C_widget *cwid; GtkWidget *wid; CHECKCWID(cntb, GTK_IS_NOTEBOOK); CHECKOPT(2, NUMERIC_type_of_ClipVarType); if (_clip_parinfo(ClipMachineMemory, 2) == UNDEF_type_of_ClipVarType) page_num = 1; wid = gtk_notebook_get_nth_page(GTK_NOTEBOOK(cntb->widget), page_num - 1); cwid = _list_get_cwidget(ClipMachineMemory, wid); if (!cwid) cwid = _register_widget(ClipMachineMemory, wid, NULL); if (cwid) _clip_mclone(ClipMachineMemory, RETPTR(ClipMachineMemory), &cwid->obj); return 0; err: return 1; }
/**** FONT COMBO constructor ****/ int clip_GTK_FONTCOMBONEW(ClipMachine * cm) { ClipVar * cv = _clip_spar (cm,1); GtkWidget *wid = NULL; C_widget *cwid, *cname_combo, *csize_combo, *cbold_btn, *citalic_btn; CHECKOPT(1,MAP_t); wid = gtk_font_combo_new(); if (!wid) goto err; cwid = _register_widget(cm, wid, cv); cname_combo = _register_widget(cm, GTK_FONT_COMBO(wid)->name_combo, NULL); csize_combo = _register_widget(cm, GTK_FONT_COMBO(wid)->size_combo, NULL); cbold_btn = _register_widget(cm, GTK_FONT_COMBO(wid)->bold_button, NULL); citalic_btn = _register_widget(cm, GTK_FONT_COMBO(wid)->italic_button, NULL); _clip_madd(cm, &cwid->obj, HASH_NAMECOMBO, &cname_combo->obj); _clip_madd(cm, &cwid->obj, HASH_SIZECOMBO, &csize_combo->obj); _clip_madd(cm, &cwid->obj, HASH_BOLDBUTTON, &cbold_btn->obj); _clip_madd(cm, &cwid->obj, HASH_ITALICBUTTON, &citalic_btn->obj); _clip_mclone(cm,RETPTR(cm),&cwid->obj); return 0; err: return 1; }
int clip_GTK_UIMANAGERGETACCELGROUP(ClipMachine * ClipMachineMemory) { C_object *cmanager = _fetch_co_arg(ClipMachineMemory); GtkAccelGroup *agroup; C_widget *cagroup; CHECKARG2(1, MAP_type_of_ClipVarType, NUMERIC_type_of_ClipVarType); CHECKCOBJ(cmanager, GTK_IS_UI_MANAGER(cmanager->object)); agroup = gtk_ui_manager_get_accel_group(GTK_UI_MANAGER(cmanager->object)); if (agroup) { cagroup = _list_get_cwidget(ClipMachineMemory, agroup); if (!cagroup) cagroup = _register_widget(ClipMachineMemory, GTK_WIDGET(agroup), NULL); if (cagroup) _clip_mclone(ClipMachineMemory, RETPTR(ClipMachineMemory), &cagroup->obj); } return 0; err: return 1; }
int clip_GTK_DRAGDESTFINDTARGET(ClipMachine * cm) { C_widget *cwid = _fetch_cw_arg(cm); C_object *ccontext = _fetch_cobject(cm, _clip_spar(cm, 2)); C_object *ctlist = _fetch_cobject(cm, _clip_spar(cm, 3)); GdkAtom atom ; C_object *catom ; CHECKCWID(cwid, GTK_IS_WIDGET); if (!ccontext || ccontext->type != GDK_TYPE_DRAG_CONTEXT) goto err; if (!ctlist || ctlist->type != GTK_TYPE_TARGET_LIST) goto err; atom = gtk_drag_dest_find_target(GTK_WIDGET(cwid->widget), (GdkDragContext*)ccontext->object, (GtkTargetList*)ctlist->object); if (atom) { catom = _list_get_cobject(cm, &atom); if (!catom) catom = _register_object(cm, &atom, GDK_TYPE_ATOM, NULL, NULL); if (catom) _clip_mclone(cm, RETPTR(cm), &catom->obj); } return 0; err: return 1; }
int clip_GTK_UIMANAGERGETWIDGET(ClipMachine * ClipMachineMemory) { C_object *cmanager = _fetch_co_arg(ClipMachineMemory); gchar *path = _clip_parc(ClipMachineMemory, 2); GtkWidget *wid; C_widget *cwid; CHECKARG2(1, MAP_type_of_ClipVarType, NUMERIC_type_of_ClipVarType); CHECKCOBJ(cmanager, GTK_IS_UI_MANAGER(cmanager->object)); CHECKARG(2, CHARACTER_type_of_ClipVarType); wid = gtk_ui_manager_get_widget(GTK_UI_MANAGER(cmanager->object), path); if (wid) { cwid = _list_get_cwidget(ClipMachineMemory, wid); if (!cwid) cwid = _register_widget(ClipMachineMemory, wid, NULL); if (cwid) _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; }
int clip_GTK_UIMANAGERGETACTION(ClipMachine * ClipMachineMemory) { C_object *cmanager = _fetch_co_arg(ClipMachineMemory); gchar *path = _clip_parc(ClipMachineMemory, 2); GtkAction *action; C_object *caction; CHECKARG2(1, MAP_type_of_ClipVarType, NUMERIC_type_of_ClipVarType); CHECKCOBJ(cmanager, GTK_IS_UI_MANAGER(cmanager->object)); CHECKARG(2, CHARACTER_type_of_ClipVarType); action = gtk_ui_manager_get_action(GTK_UI_MANAGER(cmanager->object), path); 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); } return 0; err: return 1; }
int clip_GTK_FILECHOOSERWIDGETNEWWITHBACKEND(ClipMachine * ClipMachineMemory) { ClipVar *cv = _clip_spar(ClipMachineMemory, 1); GtkFileChooserAction action = _clip_parni(ClipMachineMemory, 2); gchar *backend = _clip_parc(ClipMachineMemory, 2); GtkWidget *wid; C_widget *cwid; CHECKOPT2(1, NUMERIC_type_of_ClipVarType, MAP_type_of_ClipVarType); CHECKARG(2, NUMERIC_type_of_ClipVarType); CHECKARG(3, CHARACTER_type_of_ClipVarType); wid = gtk_file_chooser_widget_new_with_backend(action, backend); if (wid) { cwid = _list_get_cwidget(ClipMachineMemory, wid); if (!cwid) cwid = _register_widget(ClipMachineMemory, wid, cv); if (cwid) _clip_mclone(ClipMachineMemory, RETPTR(ClipMachineMemory), &cwid->obj); } 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; }
int clip_GTK_CTREENODEGETPIXMAP(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); GdkPixmap *pixmap; GdkBitmap *mask; C_widget *cpixmap; CHECKCWID(cctree,GTK_IS_CTREE); CHECKOPT2(2,MAP_t,NUMERIC_t); CHECKCOBJOPT(cnode,cnode->type==GTK_TYPE_CTREE_NODE); CHECKOPT(3,NUMERIC_t); if (_clip_parinfo(cm,3)==UNDEF_t) column = 1; if (gtk_ctree_node_get_pixmap(GTK_CTREE(cctree->widget), GTK_CTREE_NODE(cnode->object),column-1,&pixmap,&mask)) { if (pixmap) { cpixmap = _list_get_cwidget_by_data(cm,pixmap); if (!cpixmap) cpixmap = _register_widget(cm,gtk_pixmap_new(pixmap,mask),NULL); if (cpixmap) _clip_mclone(cm,RETPTR(cm),&cpixmap->obj); } } return 0; err: return 1; }
/**** LIST ITEM constructor ****/ int clip_GTK_LISTITEMNEW(ClipMachine * cm) { ClipVar * cv = _clip_spar(cm, 1); C_widget *cchild; GtkWidget *wid = NULL; C_widget *cwid; CHECKOPT(1,MAP_t); CHECKOPT3(2,CHARACTER_t,MAP_t,NUMERIC_t); switch (_clip_parinfo(cm,2)) { case CHARACTER_t: wid = gtk_list_item_new_with_label(_clip_parc(cm,2)); break; case MAP_t: case NUMERIC_t: wid = gtk_list_item_new(); cchild = _fetch_cwidget(cm,_clip_spar(cm,2)); CHECKCWID(cchild,GTK_IS_WIDGET); gtk_container_add(GTK_CONTAINER(wid), cchild->widget); break; } if (!wid) goto err; cwid = _register_widget(cm, wid, cv); _clip_mclone(cm,RETPTR(cm),&cwid->obj); return 0; err: return 1; }
/**** Horizontal scrollbar constructor ****/ int clip_GTK_HSCROLLBARNEW(ClipMachine * ClipMachineMemory) { ClipVar *cv = _clip_spar(ClipMachineMemory, 1); C_widget *cadj = _fetch_cwidget(ClipMachineMemory, _clip_spar(ClipMachineMemory, 2)); GtkAdjustment *adj; GtkWidget *wid = NULL; C_widget *cwid; CHECKOPT(1, MAP_type_of_ClipVarType); CHECKOPT2(2, MAP_type_of_ClipVarType, NUMERIC_type_of_ClipVarType); CHECKCWIDOPT(cadj, GTK_IS_ADJUSTMENT); adj = cadj ? GTK_ADJUSTMENT(cadj->widget) : NULL; wid = gtk_hscrollbar_new(adj); if (!wid) goto err; cwid = _register_widget(ClipMachineMemory, wid, cv); _clip_mclone(ClipMachineMemory, RETPTR(ClipMachineMemory), &cwid->obj); return 0; err: return 1; }
/* Some stock ids have preprocessor macros like GTK_STOCK_OK and GTK_STOCK_APPLY.*/ int clip_GTK_BUTTONNEWFROMSTOCK(ClipMachine * ClipMachineMemory) { ClipVar *cv = _clip_spar(ClipMachineMemory, 1); const char *stock_id = _clip_parc(ClipMachineMemory, 2); GtkWidget *wid; C_widget *cwid; CHECKOPT(1, MAP_type_of_ClipVarType); CHECKOPT(2, CHARACTER_type_of_ClipVarType); wid = gtk_button_new_from_stock(stock_id); 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; }
/* Creates a new empty GdkRegion. */ int clip_GDK_REGIONNEW(ClipMachine * ClipMachineMemory) { ClipVar *cv = _clip_spar(ClipMachineMemory, 1); GdkRegion *region; C_object *cregion; CHECKOPT(1, MAP_type_of_ClipVarType); region = gdk_region_new(); if (region) { cregion = _register_object(ClipMachineMemory, region, GDK_TYPE_REGION, cv, NULL); if (cregion) _clip_mclone(ClipMachineMemory, RETPTR(ClipMachineMemory), &cregion->obj); else gdk_region_destroy(region); } return 0; err: return 1; }