pike.git / src / post_modules / GTK2 / source / gtkwidget.pre

version» Context lines:

pike.git/src/post_modules/GTK2/source/gtkwidget.pre:1:   /* -*- C -*- */   class GTK2.Widget;   inherit GTK2.Object;      %{ - #ifndef __NT__ - #include <gdk/gdkx.h> - #else - #include <gdk/gdkwin32.h> - #endif +    #undef TWIN   #undef _GC   #define TWIN (GTK_WIDGET(THIS->obj)->window)   #define _GC(X) (GDK_GC(get_gobject(X)))   %}      //! The basic widget, inherited (directly or indirectly) by all widgets. Thus,   //! all functions and signals defined in this widget work on all widgets.   //! <p>   //! One of the most important functions in this class is 'show', it lets GTK2
pike.git/src/post_modules/GTK2/source/gtkwidget.pre:116:   //! The keyboard focus has entered the widget   signal focus_out_event;   //! The keyboard focus has left the widget   require gtk28;   signal grab_broken_event;   endrequire;   signal grab_focus;   signal grab_notify;   signal hide;   //! Called when the widget is hidden - signal heirarchy_changed; + signal hierarchy_changed;   signal key_press_event;   //! Called when a keyboard key is pressed   signal key_release_event;   //! Called when a keyboard key is released   require gtk212;   signal keynav_failed;   endrequire;   signal leave_notify_event;   //! Called when the mouse leaves the widget   signal map;
pike.git/src/post_modules/GTK2/source/gtkwidget.pre:381:   //! Gets the reading direction.      void shape_combine_mask(GDK2.Bitmap shape_mask, int offset_x, int offset_y)   //! Sets a shape for a widget's GDK2.Window. This allows for transparent   //! window, etc.   {    pgtk2_verify_inited();    {    struct object *o1;    INT_TYPE x,y; -  get_all_args("shape_combine_mask",args,"%o%i%i",&o1,&x,&y); +  get_all_args(NULL,args,"%o%i%i",&o1,&x,&y);    gtk_widget_shape_combine_mask(GTK_WIDGET(THIS->obj),    (GdkBitmap *)get_gdkobject(o1,bitmap),x,y);    }    RETURN_THIS();   }      require gtk210;   void input_shape_combine_mask(GDK2.Bitmap shape_mask, int offset_x, int offset_y)   //! Sets an input shape for this widget's GDK2.Window.   {    pgtk2_verify_inited();    {    struct object *o1;    INT_TYPE x,y; -  get_all_args("shape_combine_mask",args,"%o%i%i",&o1,&x,&y); +  get_all_args(NULL,args,"%o%i%i",&o1,&x,&y);    gtk_widget_input_shape_combine_mask(GTK_WIDGET(THIS->obj),    (GdkBitmap *)get_gdkobject(o1,bitmap),x,y);    }    RETURN_THIS();   }   endrequire;      string path()   //! Obtains the full path. The path is simply the name of a widget and all   //! its parents in the container hierarchy, separated by periods.
pike.git/src/post_modules/GTK2/source/gtkwidget.pre:441:   string get_composite_name();   //! Get the composite name.      void modify_style(GTK2.RcStyle style);   //! Modifies style values.   /*   {    pgtk2_verify_inited();    {    struct object *o1; -  get_all_args("modify_style",args,"%o",&o1); +  get_all_args(NULL,args,"%o",&o1);    gtk_widget_modify_style(GTK_WIDGET(THIS->obj),    GTK_RC_STYLE(get_gobject(o1)));    }    RETURN_THIS();   }   */         +GTK2.RcStyle get_modifier_style();   //! Returns the current modifier style.
pike.git/src/post_modules/GTK2/source/gtkwidget.pre:469:      void modify_fg(int state, ?GDK2.Color color)   //! Sets the foreground color of the widget in a particular state.   //! state is one of CONST(GTK_STATE_).   //! color can be omitted to undo the effect of a previous call.   {    pgtk2_verify_inited();    {    struct object *o1=NULL;    INT_TYPE state; -  get_all_args("modify_fg",args,"%i.%o",&state,&o1); +  get_all_args(NULL,args,"%i.%o",&state,&o1);    gtk_widget_modify_fg(GTK_WIDGET(THIS->obj),    state,(GdkColor *)get_gdkobject(o1,color));    }    RETURN_THIS();   }      void modify_bg(int state, ?GDK2.Color color)   //! Sets the background color of the widget in a particular state.   //! See modify_fg().   {    pgtk2_verify_inited();    {    struct object *o1=NULL;    INT_TYPE state; -  get_all_args("modify_bg",args,"%i.%o",&state,&o1); +  get_all_args(NULL,args,"%i.%o",&state,&o1);    gtk_widget_modify_bg(GTK_WIDGET(THIS->obj),    state,(GdkColor *)get_gdkobject(o1,color));    }    RETURN_THIS();   }      void modify_text(int state, ?GDK2.Color color)   //! Sets the text color of the widget in a particular state.   //! See modify_fg().   {    pgtk2_verify_inited();    {    struct object *o1=NULL;    INT_TYPE state; -  get_all_args("modify_text",args,"%i.%o",&state,&o1); +  get_all_args(NULL,args,"%i.%o",&state,&o1);    gtk_widget_modify_text(GTK_WIDGET(THIS->obj),    state,(GdkColor *)get_gdkobject(o1,color));    }    RETURN_THIS();   }      void modify_base(int state, ?GDK2.Color color)   //! Sets the base color of the widget in a particular state.   //! See modify_fg().   {    pgtk2_verify_inited();    {    struct object *o1=NULL;    INT_TYPE state; -  get_all_args("modify_base",args,"%i.%o",&state,&o1); +  get_all_args(NULL,args,"%i.%o",&state,&o1);    gtk_widget_modify_base(GTK_WIDGET(THIS->obj),    state,(GdkColor *)get_gdkobject(o1,color));    }    RETURN_THIS();   }      require gtk212;   void modify_cursor(GDK2.Color primary, GDK2.Color secondary);   //! Sets the cursor color to use in a widget.   endrequire;      require pango;   void modify_font(Pango.FontDescription font)   //! Sets the font.   {    pgtk2_verify_inited();    {    struct object *o1; -  get_all_args("modify_font",args,"%o",&o1); +  get_all_args(NULL,args,"%o",&o1);    gtk_widget_modify_font(GTK_WIDGET(THIS->obj),    (PangoFontDescription *)get_pg2object(o1,ppango2_font_description_program));    }    RETURN_THIS();   }      +Pango.Context create_pango_context();   //! Creates a new Pango.Context with the appropriate colormap, font   //! description, and base direction for drawing text for this widget.   /*
pike.git/src/post_modules/GTK2/source/gtkwidget.pre:567:      +Pango.Layout create_pango_layout(string text);   //! Creates a new Pango.Layout with the appropriate colormap, font   //! description, and base direction for drawing text.   /*   {    pgtk2_verify_inited();    {    PangoLayout *pl;    const gchar *str; -  get_all_args("create_pango_layout",args,"%s",&str); +  get_all_args(NULL,args,"%s",&str);    pl=gtk_widget_create_pango_layout(GTK_WIDGET(THIS->obj),str);    pgtk2_pop_n_elems(args);    push_gobject(pl);    }   }   */   endrequire;      +GDK2.Pixbuf render_icon(string stock_id, int size, string detail)   //! A convenience function that uses the theme engine and rc file settings   //! to look up stock_id and render it to a pixbuf. stock_id should be a   //! stock icon ID such as GTK2.STOCK_OPEN or GTK2.STOCK_OK. size should be a - //! size such as GTK2.ICON_SIZE_MENU. detail should be a string that identifies//! the widget or code doing the rendering, so that theme engines can + //! size such as GTK2.ICON_SIZE_MENU. detail should be a string that identifies + //! the widget or code doing the rendering, so that theme engines can   //! special-case rendering for that widget or code.   //! <p>   //! The pixels in the returned GDK2.Pixbuf are shared with the rest of the   //! application and should not be modified.   {    pgtk2_verify_inited();    {    const gchar *stock_id,*detail;    INT_TYPE size;    GdkPixbuf *gp; -  get_all_args("render_icon",args,"%s%i%s",&stock_id,&size,&detail); +  get_all_args(NULL,args,"%s%i%s",&stock_id,&size,&detail);    gp=gtk_widget_render_icon(GTK_WIDGET(THIS->obj),stock_id,size,detail);    pgtk2_pop_n_elems(args);    push_gobject(gp);    }   }      void queue_draw_area(int x, int y, int width, int height);   //! Invalidates the rectangular area defined by x,y,width,height by calling   //! GDK2.Window->invalidate_rect() on the widget's window and all its child   //! windows. Once the main loop becomse idle (after the current batch of
pike.git/src/post_modules/GTK2/source/gtkwidget.pre:627:   int mnemonic_activate(int group_cycling);   //! Not documented.      mixed style_get_property(string name)   //! Gets the value of the style property called name.   {    pgtk2_verify_inited();    {    char *name;    GValue v = {0}; -  get_all_args("style_get_property",args,"%s",&name); +  get_all_args(NULL,args,"%s",&name);    gtk_widget_style_get_property(GTK_WIDGET(THIS->obj),name,&v);   /* pgtk2_push_gvalue(&v); */    pgtk2_pop_n_elems(args);    push_gvalue_r(&v,G_VALUE_TYPE(&v));    g_value_unset( &v );   /* push_int(0); */    }   }      void child_notify(string prop);
pike.git/src/post_modules/GTK2/source/gtkwidget.pre:659:   //! RC file information, etc) used for this widget.      require gtk22;   +GTK2.Clipboard get_clipboard(GDK2.Atom selection)   //! Returns the clipboard object for the given selection.   {    pgtk2_verify_inited();    {    struct object *o1;    GtkClipboard *gcl; -  get_all_args("get",args,"%o",&o1); +  get_all_args(NULL,args,"%o",&o1);    gcl=gtk_widget_get_clipboard(GTK_WIDGET(THIS->obj),get_gdkatom(o1));    pgtk2_pop_n_elems(args);    push_gobject(gcl);    }   }      +GDK2.Display get_display();   //! Get the GDK2.Display for the toplevel window associated with this widget.   //! This function can only be called after the widget has been added to a   //! widget hierarchy with a GTK2.Window at the top.
pike.git/src/post_modules/GTK2/source/gtkwidget.pre:858:   //! will contain the exact widget-relative snapshot coordinates upon return.   //! A clip_rect of (-1,-1,0,0) can be used to preserve the auto-grown snapshot   //! area and use clip_rect as a pure output parameter.   //!   //! The return pixmap can be 0, if the resulting clip_area was empty.   {    pgtk2_verify_inited();    {    struct object *o1;    GdkPixmap *pixmap=NULL; -  get_all_args("get_snapshot",args,"%O",&o1); +  get_all_args(NULL,args,"%O",&o1);    pixmap=gtk_widget_get_snapshot(GTK_WIDGET(THIS->obj),    (GdkRectangle *)get_gdkobject(o1,rectangle));    pgtk2_pop_n_elems(args);    push_gobject(pixmap);    }   }      GDK2.Window get_window();   //! Returns the widget's window if it is realized, other NULL.   endrequire;      not gtk214;   GDK2.Window get_window()   {    pgtk2_verify_inited(); -  // Prior to GTK 2.14 this was retrieved straight from the struct. cf: -  // http://mail.gnome.org/archives/gtk-devel-list/2004-September/msg00087.html +  /* Prior to GTK 2.14 this was retrieved straight from the struct. cf: +  http://mail.gnome.org/archives/gtk-devel-list/2004-September/msg00087.html */    push_gobject(GTK_WIDGET(THIS->obj)->window);   }   endnot;    -  + %{ + //Helper for drag_source_set and drag_dest_set + //Returns 0 on success, 1 to raise an error + //Also used in gtktreeview.pre + int _decode_targets(struct array *targ, GtkTargetEntry *drag_targets) + { +  int i; +  for (i=0; i<targ->size; i++) { +  struct array *cur; +  struct pike_string *str; +  INT32 min, max; +  if (TYPEOF(ITEM(targ)[i]) != PIKE_T_ARRAY) return 1; +  cur = ITEM(targ)[i].u.array; +  if (cur->size != 3) return 1; +  if (TYPEOF(ITEM(cur)[0]) != PIKE_T_STRING +  || TYPEOF(ITEM(cur)[1]) != PIKE_T_INT +  || TYPEOF(ITEM(cur)[2]) != PIKE_T_INT) +  return 1; +  str = ITEM(cur)[0].u.string; +  /* The string has to be printable ASCII - it should be a MIME type. +  Quick check: ASCII strings will have size_shift of zero. */ +  if (str->size_shift) return 1; +  /* But not all eight-bit strings are printable ASCII. */ +  check_string_range(str, 0, &min, &max); +  if (min < ' ' || max >= 128) return 1; +  drag_targets[i].target = str->str; +  drag_targets[i].flags = ITEM(cur)[1].u.integer; +  drag_targets[i].info = ITEM(cur)[2].u.integer; +  } +  return 0; + } + %} +  + void drag_source_set(int buttons, array targets, int actions) + //! Set this widget up so a drag operation will start when the user clicks and + //! drags on this widget. + //! <p> + //! buttons is a bitwise 'or' of the mouse buttons that can initiate dragging, + //! eg GTK2.GDK_BUTTON1_MASK. + //! <p> + //! targets is an array of triples eg ({({"text/plain", GTK2.TARGET_SAME_APP, 0})}) + //! where each triple gives an identifying MIME type, a flag specifying whether the + //! drag should be allowed to go to other applications, and an ID which will be + //! passed on to signal handlers. NOTE: For internal reasons, you are currently + //! permitted a maximum of ten targets. + //! <p> + //! actions is the set of valid actions that can be performed; use constants + //! GTK2.GDK_ACTION_COPY|GTK2.GDK_ACTION_MOVE etc. + { +  pgtk2_verify_inited(); +  { +  INT_TYPE btn, act; +  struct array *targ; +  GtkTargetEntry drag_targets[10]; +  +  get_all_args(NULL, args, "%d%a%d", &btn, &targ, &act); +  /* Once C99 is supported - check the Windows builds - replace the above +  declaration with a dynamic array, and remove the guard condition in the +  arg type check. Then you'll be able to have more than ten drag targets, +  and memory will be allocated more tightly. Do this again in three other +  places where the same thing can be found. +  GtkTargetEntry drag_targets[targ->size]; */ +  if (targ->size > 10 || _decode_targets(targ, drag_targets)) +  SIMPLE_ARG_TYPE_ERROR("drag_source_set", 2, "array(array(string|int))"); +  gtk_drag_source_set(GTK_WIDGET(THIS->obj), btn, +  drag_targets, targ->size, act); +  } +  RETURN_THIS(); + } +  + void drag_dest_set(int flags, array targets, int actions) + //! Set this widget up so it can accept drops. Parallel to @[drag_source_set] + //! - see there for arg info. flags allows default drop behaviour to turned on + //! and off; use GTK2.DEST_DEFAULT_ALL for normal behaviour. + { +  pgtk2_verify_inited(); +  { +  INT_TYPE flags, act; +  struct array *targ; +  GtkTargetEntry drag_targets[10]; +  +  get_all_args(NULL, args, "%d%a%d", &flags, &targ, &act); +  if (targ->size > 10 || _decode_targets(targ, drag_targets)) +  SIMPLE_ARG_TYPE_ERROR("drag_dest_set", 2, "array(array(string|int))"); +  gtk_drag_dest_set(GTK_WIDGET(THIS->obj), flags, +  drag_targets, targ->size, act); +  } +  RETURN_THIS(); + } +    void set_flags(int flags)   //! Set certain flags, such as GTK2.CAN_DEFAULT.   {    pgtk2_verify_inited();    {    INT_TYPE flags; -  get_all_args("set_flags",args,"%i",&flags); +  get_all_args(NULL,args,"%i",&flags);    GTK_WIDGET_SET_FLAGS(GTK_WIDGET(THIS->obj),flags);    }    RETURN_THIS();   }      void unset_flags(int flags)   //! Unset flags.   {    pgtk2_verify_inited();    {    INT_TYPE flags; -  get_all_args("unset_flags",args,"%i",&flags); +  get_all_args(NULL,args,"%i",&flags);    GTK_WIDGET_UNSET_FLAGS(GTK_WIDGET(THIS->obj),flags);    }    RETURN_THIS();   }      void STATE()   //! Get the state.   {    pgtk2_verify_inited();    pgtk2_pop_n_elems(args);