3d76632005-11-03Lance Dillon /* -*- C -*- */
1a05542005-07-28Martin Nilsson class GTK2.CellRenderer; inherit GTK2.Data; //! Properties: //! string cell-background //! GDK2.Color cell-background-gdk //! int cell-background-set //! int height //! int is-expanded //! int is-expander //! int mode CONST(GTK_CELL_RENDERER_MODE_) //! int sensitive //! int visible //! int width //! float xalign //! int xpad //! float yalign //! int ypad signal editing_canceled; require gtk26; signal editing_started; endrequire; mapping(string:int) get_size(GTK2.Widget widget, ?GDK2.Rectangle cell_area) //! Obtains the width and heigh needed to render the cell. Used by widgets //! to determine the appropriate size for the cell_area passed to render(). //! If cell_area is present, fills in the x and y offset of the cell relative //! to this location. Please note that the values set in width and height, //! as well as those in x_offset and y_offset are inclusive of the xpad and //! ypad properties. {
ba9e802006-02-27Martin Stjernholm  pgtk2_verify_inited();
1a05542005-07-28Martin Nilsson  { struct object *o1,*o2=NULL; gint x_offset,y_offset,width,height;
96f5f42018-08-05Martin Nilsson  get_all_args(NULL,args,"%o.%o",&o1,&o2);
7b7dab2005-10-07Henrik Grubbström (Grubba) #ifdef HAVE_GTK_BETA gtk_cell_renderer_get_size(GTK_CELL_RENDERER(THIS->obj), GTK_WIDGET(get_gobject(o1)), &width,&height);
9fb5032006-01-14Martin Nilsson  ref_push_string(_STR("width")); push_int(width); ref_push_string(_STR("height")); push_int(height);
7b7dab2005-10-07Henrik Grubbström (Grubba)  f_aggregate_mapping(4); #else /* !HAVE_GTK_BETA */
1a05542005-07-28Martin Nilsson  gtk_cell_renderer_get_size(GTK_CELL_RENDERER(THIS->obj), GTK_WIDGET(get_gobject(o1)), o2?(GdkRectangle *)get_gdkobject(o2,rectangle):NULL, &x_offset,&y_offset,&width,&height);
ba9e802006-02-27Martin Stjernholm  pgtk2_pop_n_elems(args);
9fb5032006-01-14Martin Nilsson  ref_push_string(_STR("x_offset")); push_int(x_offset); ref_push_string(_STR("y_offset")); push_int(y_offset); ref_push_string(_STR("width")); push_int(width); ref_push_string(_STR("height")); push_int(height);
1a05542005-07-28Martin Nilsson  f_aggregate_mapping(8);
7b7dab2005-10-07Henrik Grubbström (Grubba) #endif /* HAVE_GTK_BETA */
1a05542005-07-28Martin Nilsson  } } void render(GDK2.Window window, GTK2.Widget widget, GDK2.Rectangle background_area, GDK2.Rectangle cell_area, GDK2.Rectangle expose_area, int flags) //! Invokes the virtual render function of the W(CellRenderer). The three //! passed-in rectangles are areas of window. Most renderers will draw within //! cell_area; the xalign, yalign, xpad, and ypad fields of the W(CellRenderer) //! should be honored with respect to cell_area. background_area includes the //! blank space around the cell, and also the area containing the tree //! expander; so the background_area rectangles for all cells tile to cover the //! entire window. expose_area is a clip rectangle. //! flags is one of CONST(GTK_CELL_RENDERER_). {
ba9e802006-02-27Martin Stjernholm  pgtk2_verify_inited();
1a05542005-07-28Martin Nilsson  { struct object *o1,*o2,*o3,*o4,*o5;
cac4202005-12-17Marcus Comstedt  INT_TYPE flags;
96f5f42018-08-05Martin Nilsson  get_all_args(NULL,args,"%o%o%o%o%o%i",&o1,&o2,&o3,&o4,&o5,&flags);
1a05542005-07-28Martin Nilsson  gtk_cell_renderer_render(GTK_CELL_RENDERER(THIS->obj), GDK_WINDOW(get_gobject(o1)), GTK_WIDGET(get_gobject(o2)), (GdkRectangle *)get_gdkobject(o3,rectangle), (GdkRectangle *)get_gdkobject(o4,rectangle), (GdkRectangle *)get_gdkobject(o5,rectangle),flags); } RETURN_THIS(); } int activate(GDK2.Event event, GTK2.Widget widget, string path, GDK2.Rectangle background_area, GDK2.Rectangle cell_area, int flags) //! Passes an activate event to the cell renderer for possible processing. //! Some cell renderers may use events; for example, W(CellRendererToggle) //! toggles when it gets a mouse click. {
ba9e802006-02-27Martin Stjernholm  pgtk2_verify_inited();
1a05542005-07-28Martin Nilsson  { struct object *o1,*o2,*o3,*o4; const gchar *path;
cac4202005-12-17Marcus Comstedt  INT_TYPE flags;
1a05542005-07-28Martin Nilsson  int res;
96f5f42018-08-05Martin Nilsson  get_all_args(NULL,args,"%o%o%s%o%o%i",&o1,&o2,&path,&o3,&o4,&flags);
1a05542005-07-28Martin Nilsson  res=gtk_cell_renderer_activate(GTK_CELL_RENDERER(THIS->obj), (GdkEvent *)get_gdkobject(o1,event), GTK_WIDGET(get_gobject(o2)), path,(GdkRectangle *)get_gdkobject(o3,rectangle), (GdkRectangle *)get_gdkobject(o4,rectangle),flags);
ba9e802006-02-27Martin Stjernholm  pgtk2_pop_n_elems(args);
1a05542005-07-28Martin Nilsson  push_int(res); } } void start_editing(GDK2.Event event, GTK2.Widget widget, string path, GDK2.Rectangle background_area, GDK2.Rectangle cell_area, int flags) //! Passes an activate event to the cell renderer for possible processing. {
ba9e802006-02-27Martin Stjernholm  pgtk2_verify_inited();
1a05542005-07-28Martin Nilsson  { struct object *o1,*o2,*o3,*o4; const gchar *path;
cac4202005-12-17Marcus Comstedt  INT_TYPE flags;
96f5f42018-08-05Martin Nilsson  get_all_args(NULL,args,"%o%o%s%o%o%i",&o1,&o2,&path,&o3,&o4,&flags);
1a05542005-07-28Martin Nilsson  gtk_cell_renderer_start_editing(GTK_CELL_RENDERER(THIS->obj), (GdkEvent *)get_gdkobject(o1,event), GTK_WIDGET(get_gobject(o2)),path, (GdkRectangle *)get_gdkobject(o3,rectangle), (GdkRectangle *)get_gdkobject(o4,rectangle),flags); }
3d76632005-11-03Lance Dillon  RETURN_THIS();
1a05542005-07-28Martin Nilsson } require gtk26; void stop_editing(int canceled); //! Informs the cell renderer that the editing is stopped. If canceled is //! true, the cell renderer will emit the "editing-canceled" signal. This //! function should be called by cell renderer implementations in response to //! the "editing-done" signal of W(CellEditable). endrequire; mapping get_fixed_size() //! Fills in width and height with the appropriate size of the cell. {
ba9e802006-02-27Martin Stjernholm  pgtk2_verify_inited();
1a05542005-07-28Martin Nilsson  { gint width,height;
ba9e802006-02-27Martin Stjernholm  pgtk2_pop_n_elems(args);
1a05542005-07-28Martin Nilsson  gtk_cell_renderer_get_fixed_size(GTK_CELL_RENDERER(THIS->obj), &width,&height);
9fb5032006-01-14Martin Nilsson  ref_push_string(_STR("width")); push_int(width); ref_push_string(_STR("height")); push_int(height);
1a05542005-07-28Martin Nilsson  f_aggregate_mapping(4); } } void set_fixed_size(int width, int height); //! Sets the renderer size to be explicit, independent of the properties set.