diff dwt/internal/gtk/c/gtktypes.d @ 15:758bbbe4b86a

Fixup gtk bindings; OS.d updates
author John Reimer<terminal.node@gmail.com>
date Sun, 06 Jan 2008 13:35:33 -0800
parents 5f725d09c076
children 09f5459a5014
line wrap: on
line diff
--- a/dwt/internal/gtk/c/gtktypes.d	Sat Jan 05 15:13:44 2008 -0800
+++ b/dwt/internal/gtk/c/gtktypes.d	Sun Jan 06 13:35:33 2008 -0800
@@ -33,7 +33,43 @@
 ******************************************************************************/
 
 alias void GtkAccelGroupEntry;
-alias void GtkContainerClass;
+
+// GtkContainerClass Needed by dwt macros - JJR
+struct GtkContainerClass
+{
+  GtkWidgetClass parent_class;
+
+  void    (*add)            (GtkContainer    *container,
+                 GtkWidget   *widget);
+  void    (*remove)         (GtkContainer    *container,
+                 GtkWidget   *widget);
+  void    (*check_resize)   (GtkContainer    *container);
+  void    (*forall)         (GtkContainer    *container,
+                 gboolean     include_internals,
+                 GtkCallback      callback,
+                 gpointer     callback_data);
+  void    (*set_focus_child)    (GtkContainer    *container,
+                 GtkWidget   *widget);
+  GType   (*child_type)     (GtkContainer    *container);
+  gchar*  (*composite_name) (GtkContainer    *container,
+                 GtkWidget   *child);
+  void    (*set_child_property) (GtkContainer    *container,
+                 GtkWidget       *child,
+                 guint            property_id,
+                 GValue    *value,
+                 GParamSpec      *pspec);
+  void    (*get_child_property) (GtkContainer    *container,
+                                 GtkWidget       *child,
+                 guint            property_id,
+                 GValue          *value,
+                 GParamSpec      *pspec);
+
+  /* Padding for future expansion */
+  void (*_gtk_reserved1) ();
+  void (*_gtk_reserved2) ();
+  void (*_gtk_reserved3) ();
+  void (*_gtk_reserved4) ();
+}
 
 //alias GTokenType.G_TOKEN_LAST G_TOKEN_LAST;";
 //alias GtkSignalRunType.G_SIGNAL_RUN_FIRST G_SIGNAL_RUN_FIRST;
@@ -2460,7 +2496,18 @@
  * The GtkAccelLabel struct contains private data only, and
  * should be accessed using the functions below.
  */
-public struct GtkAccelLabel{}
+public struct GtkAccelLabel
+{
+    GtkLabel label;
+
+    guint          gtk_reserved;
+    guint          accel_padding;
+    GtkWidget     *accel_widget;
+    GClosure  *accel_closure;
+    GtkAccelGroup *accel_group;
+    gchar         *accel_string;
+    guint16        accel_string_width;
+}
 
 
 /**
@@ -2554,7 +2601,68 @@
  * Main Gtk struct.
  * The GtkEntry struct contains only private data.
  */
-public struct GtkEntry{}
+public struct GtkEntry
+{
+  GtkWidget  widget;
+
+  gchar     *text;
+  guint     flags;
+
+//  guint      editable : 1;
+//  guint      visible  : 1;
+//  guint      overwrite_mode : 1;
+//  guint      in_drag : 1;   /* Dragging within the selection */
+
+  guint16 text_length;  /* length in use, in chars */
+  guint16 text_max_length;
+
+  /*< private >*/
+  GdkWindow *text_area;
+  GtkIMContext *im_context;
+  GtkWidget   *popup_menu;
+  
+  gint         current_pos;
+  gint         selection_bound;
+  
+  PangoLayout *cached_layout;
+
+  guint     flags2;
+//  guint        cache_includes_preedit : 1;
+//  guint        need_im_reset          : 1;
+//  guint        has_frame              : 1;
+//  guint        activates_default      : 1;
+//  guint        cursor_visible         : 1;
+//  guint        in_click               : 1;  /* Flag so we don't select all when clicking in entry to focus in */
+//  guint        is_cell_renderer       : 1;
+//  guint        editing_canceled       : 1; /* Only used by GtkCellRendererText */
+//  guint        mouse_cursor_obscured  : 1;
+//  guint        select_words           : 1;
+//  guint        select_lines           : 1;
+//  guint        resolved_dir           : 4; /* PangoDirection */
+//  guint        truncate_multiline     : 1;
+
+  guint   button;
+  guint   blink_timeout;
+  guint   recompute_idle;
+  gint    scroll_offset;
+  gint    ascent;   /* font ascent, in pango units  */
+  gint    descent;  /* font descent, in pango units  */
+  
+  guint16 text_size;    /* allocated size, in bytes */
+  guint16 n_bytes;  /* length in use, in bytes */
+
+  guint16 preedit_length;   /* length of preedit string, in bytes */
+  guint16 preedit_cursor;   /* offset of cursor within preedit string, in chars */
+
+  gint dnd_position;        /* In chars, -1 == no DND cursor */
+
+  gint drag_start_x;
+  gint drag_start_y;
+  
+  gunichar invisible_char;
+
+  gint width_chars;
+}
 
 
 /**
@@ -2754,7 +2862,92 @@
 /**
  * Main Gtk struct.
  */
-public struct GtkTextView{}
+public struct GtkTextView
+{
+  GtkContainer parent_instance;
+
+//  GtkTextLayout *layout;
+  void *layout;
+  GtkTextBuffer *buffer;
+
+  guint selection_drag_handler;
+  guint scroll_timeout;
+
+  /* Default style settings */
+  gint pixels_above_lines;
+  gint pixels_below_lines;
+  gint pixels_inside_wrap;
+  GtkWrapMode wrap_mode;  
+  GtkJustification justify;
+  gint left_margin;
+  gint right_margin;
+  gint indent;
+  PangoTabArray *tabs;
+  guint flags;
+//  guint editable : 1;
+//  guint overwrite_mode : 1;
+//  guint cursor_visible : 1;
+
+  /* if we have reset the IM since the last character entered */  
+//  guint  need_im_reset : 1; 
+//  guint accepts_tab : 1;
+//  guint width_changed : 1;
+  
+  /* debug flag - means that we've validated onscreen since the
+   * last "invalidate" signal from the layout
+   */
+//  guint onscreen_validated : 1;
+//  guint mouse_cursor_obscured : 1;
+
+  // changed next five declarations to void* from GtkTextWindow*
+  void *text_window;
+  void *left_window;
+  void *right_window;
+  void *top_window;
+  void *bottom_window;
+
+  GtkAdjustment *hadjustment;
+  GtkAdjustment *vadjustment;
+
+  gint xoffset;                 /* Offsets between widget coordinates and buffer coordinates */
+  gint yoffset;
+  gint width;                   /* Width and height of the buffer */
+  gint height;
+
+  /* The virtual cursor position is normally the same as the
+   * actual (strong) cursor position, except in two circumstances:
+   *
+   * a) When the cursor is moved vertically with the keyboard
+   * b) When the text view is scrolled with the keyboard
+   *
+   * In case a), virtual_cursor_x is preserved, but not virtual_cursor_y
+   * In case b), both virtual_cursor_x and virtual_cursor_y are preserved.
+   */
+  gint virtual_cursor_x;           /* -1 means use actual cursor position */
+  gint virtual_cursor_y;           /* -1 means use actual cursor position */
+
+  GtkTextMark *first_para_mark;    /* Mark at the beginning of the first onscreen paragraph */
+  gint first_para_pixels;          /* Offset of top of screen in the first onscreen paragraph */
+
+  GtkTextMark *dnd_mark;
+  guint blink_timeout;
+
+  guint first_validate_idle;            /* Idle to revalidate onscreen portion, runs before resize */
+  guint incremental_validate_idle;      /* Idle to revalidate offscreen portions, runs after redraw */
+
+  GtkIMContext *im_context;
+  GtkWidget *popup_menu;
+
+  gint drag_start_x;
+  gint drag_start_y;
+
+  GSList *children;
+  // changed next to void* from GtkTextPendingScroll* - JJR
+  void *pending_scroll;
+
+  gint pending_place_cursor_button;
+}
+
 
 
 /**
@@ -3897,12 +4090,60 @@
  * There are no public fields in the GtkScrolledWindow struct; it should
  * only be accessed using the functions below.
  */
-public struct GtkScrolledWindow{}
-// GtkWidget *hscrollbar;
-// GtkScrolledWindow.html
-// GtkWidget *vscrollbar;
-// GtkScrolledWindow.html
-
+public struct GtkScrolledWindow
+{
+  GtkBin container;
+
+  /*< public >*/
+  GtkWidget *hscrollbar;
+  GtkWidget *vscrollbar;
+
+  /*< private >*/
+  guint flags;
+//  guint hscrollbar_policy      : 2;
+//  guint vscrollbar_policy      : 2;
+//  guint hscrollbar_visible     : 1;
+//  guint vscrollbar_visible     : 1;
+//  guint window_placement       : 2;
+//  guint focus_out              : 1; 
+
+  guint16 shadow_type;
+}
+
+
+public struct GtkBinClass
+{
+  GtkContainerClass parent_class;
+}
+
+// GtkScrolledWindowClass is accessed by dwt macros :p - JJR
+
+public struct GtkScrolledWindowClass
+{
+  GtkBinClass parent_class;
+  
+  gint scrollbar_spacing;
+
+  /* Action signals for keybindings. Do not connect to these signals
+   */
+
+  /* Unfortunately, GtkScrollType is deficient in that there is
+   * no horizontal/vertical variants for GTK_SCROLL_START/END,
+   * so we have to add an additional boolean flag.
+   */
+  gboolean (*scroll_child) (GtkScrolledWindow *scrolled_window,
+                GtkScrollType      scroll,
+                gboolean           horizontal);
+
+  void (* move_focus_out) (GtkScrolledWindow *scrolled_window,
+               GtkDirectionType   direction);
+
+  /* Padding for future expansion */
+  void (*_gtk_reserved1) ();
+  void (*_gtk_reserved2) ();
+  void (*_gtk_reserved3) ();
+  void (*_gtk_reserved4) ();
+}
 
 /**
  * Main Gtk struct.
@@ -4166,7 +4407,21 @@
 /**
  * Main Gtk struct.
  */
-public struct GtkContainer{}
+public struct GtkContainer
+{
+  GtkWidget widget;
+  
+  GtkWidget *focus_child;
+  
+  guint flags;
+//  guint border_width : 16;
+
+  /*< private >*/
+//  guint need_resize : 1;
+//  guint resize_mode : 2;
+//  guint reallocate_redraws : 1;
+//  guint has_focus_chain : 1;
+}
 
 
 /**
@@ -4211,7 +4466,18 @@
  * Main Gtk struct.
  * The object itself. You should never use these members directly -
  */
-public struct GtkObject{}
+
+public struct GtkObject
+{
+  GInitiallyUnowned parent_instance;
+  
+  /* 32 bits of flags. GtkObject only uses 4 of these bits and
+   *  GtkWidget uses the rest. This is done because structs are
+   *  aligned on 4 or 8 byte boundaries. If a new bitfield were
+   *  used in GtkWidget much space would be wasted.
+   */
+  guint32 flags;
+}
 
 
 /**
@@ -4262,7 +4528,41 @@
  * GtkStyle*style;
  * The style for the widget. The style contains the colors the widget should be
  */
-public struct GtkWidget{}
+public struct GtkWidget
+{
+    GtkObject   object;
+    guint16     private_flags;
+    guint8      state;
+    guint8      saved_state;
+    gchar*      name;
+    
+    /*< public >*/
+
+    /* The style for the widget. The style contains the
+     *  colors the widget should be drawn in for each state
+     *  along with graphics contexts used to draw with and
+     *  the font to use for text.
+     */
+    GtkStyle *style;
+  
+    /* The widget's desired size.
+     */
+    GtkRequisition requisition;
+  
+    /* The widget's allocated size.
+     */
+    GtkAllocation allocation;
+  
+    /* The widget's window or its parent window if it does
+     *  not have a window. (Which will be indicated by the
+     *  GTK_NO_WINDOW flag being set).
+     */
+    GdkWindow *window;
+  
+    /* The widget's parent.
+     */
+    GtkWidget *parent;
+}
 // /+* The style for the widget. The style contains the
 // GtkWidget.html
 // * colors the widget should be drawn inn for each state
@@ -4316,26 +4616,226 @@
  * handles the emission.
  * Implementation of this signal is optional.
  */
-public struct GtkWidgetClass{}
-// /+* The object class structure needs to be the first
-// GtkWidget.html
-// * element inn the widget class structure inn order for
-// GtkWidget.html
-// * the class mechanism to work correctly. This allows a
-// GtkWidget.html
-// * GtkWidgetClass pointer to be cast to a GtkObjectClass
-// GtkWidget.html
-// * pointer.
-// GtkWidget.html
-// +/
-// GtkWidget.html
-// GtkObjectClass parentClass;
-// GtkWidget.html
-// uint activateSignal;
-// GtkWidget.html
-// uint setScrollAdjustmentsSignal;
-// GtkWidget.html
-
+struct GtkObjectClass
+{
+  GInitiallyUnownedClass parent_class;
+  
+  /* Non overridable class methods to set and get per class arguments */
+  void (*set_arg) (GtkObject *object,
+           GtkArg    *arg,
+           guint      arg_id);
+  void (*get_arg) (GtkObject *object,
+           GtkArg    *arg,
+           guint      arg_id);
+  
+  /* Default signal handler for the ::destroy signal, which is
+   *  invoked to request that references to the widget be dropped.
+   *  If an object class overrides destroy() in order to perform class
+   *  specific destruction then it must still invoke its superclass'
+   *  implementation of the method after it is finished with its
+   *  own cleanup. (See gtk_widget_real_destroy() for an example of
+   *  how to do this).
+   */
+  void (*destroy)  (GtkObject *object);
+}
+
+struct GtkWidgetClass
+{
+  /* The object class structure needs to be the first
+   *  element in the widget class structure in order for
+   *  the class mechanism to work correctly. This allows a
+   *  GtkWidgetClass pointer to be cast to a GtkObjectClass
+   *  pointer.
+   */
+  GtkObjectClass parent_class;
+
+  /*< public >*/
+  
+  guint activate_signal;
+
+  guint set_scroll_adjustments_signal;
+
+  /*< private >*/
+  
+  /* seldomly overidden */
+  void (*dispatch_child_properties_changed) (GtkWidget   *widget,
+                         guint        n_pspecs,
+                         GParamSpec **pspecs);
+
+  /* basics */
+  void (* show)            (GtkWidget        *widget);
+  void (* show_all)            (GtkWidget        *widget);
+  void (* hide)            (GtkWidget        *widget);
+  void (* hide_all)            (GtkWidget        *widget);
+  void (* map)             (GtkWidget        *widget);
+  void (* unmap)           (GtkWidget        *widget);
+  void (* realize)         (GtkWidget        *widget);
+  void (* unrealize)           (GtkWidget        *widget);
+  void (* size_request)        (GtkWidget        *widget,
+                GtkRequisition   *requisition);
+  void (* size_allocate)       (GtkWidget        *widget,
+                GtkAllocation    *allocation);
+  void (* state_changed)       (GtkWidget        *widget,
+                GtkStateType      previous_state);
+  void (* parent_set)          (GtkWidget        *widget,
+                GtkWidget        *previous_parent);
+  void (* hierarchy_changed)   (GtkWidget        *widget,
+                GtkWidget        *previous_toplevel);
+  void (* style_set)           (GtkWidget        *widget,
+                GtkStyle         *previous_style);
+  void (* direction_changed)   (GtkWidget        *widget,
+                GtkTextDirection  previous_direction);
+  void (* grab_notify)         (GtkWidget        *widget,
+                gboolean          was_grabbed);
+  void (* child_notify)        (GtkWidget    *widget,
+                GParamSpec       *pspec);
+  
+  /* Mnemonics */
+  gboolean (* mnemonic_activate) (GtkWidget    *widget,
+                  gboolean      group_cycling);
+  
+  /* explicit focus */
+  void     (* grab_focus)      (GtkWidget        *widget);
+  gboolean (* focus)           (GtkWidget        *widget,
+                                GtkDirectionType  direction);
+  
+  /* events */
+  gboolean (* event)            (GtkWidget       *widget,
+                     GdkEvent        *event);
+  gboolean (* button_press_event)   (GtkWidget       *widget,
+                     GdkEventButton      *event);
+  gboolean (* button_release_event) (GtkWidget       *widget,
+                     GdkEventButton      *event);
+  gboolean (* scroll_event)     (GtkWidget           *widget,
+                     GdkEventScroll      *event);
+  gboolean (* motion_notify_event)  (GtkWidget       *widget,
+                     GdkEventMotion      *event);
+  gboolean (* delete_event)     (GtkWidget       *widget,
+                     GdkEventAny         *event);
+  gboolean (* destroy_event)        (GtkWidget       *widget,
+                     GdkEventAny         *event);
+  gboolean (* expose_event)     (GtkWidget       *widget,
+                     GdkEventExpose      *event);
+  gboolean (* key_press_event)      (GtkWidget       *widget,
+                     GdkEventKey         *event);
+  gboolean (* key_release_event)    (GtkWidget       *widget,
+                     GdkEventKey         *event);
+  gboolean (* enter_notify_event)   (GtkWidget       *widget,
+                     GdkEventCrossing    *event);
+  gboolean (* leave_notify_event)   (GtkWidget       *widget,
+                     GdkEventCrossing    *event);
+  gboolean (* configure_event)      (GtkWidget       *widget,
+                     GdkEventConfigure   *event);
+  gboolean (* focus_in_event)       (GtkWidget       *widget,
+                     GdkEventFocus       *event);
+  gboolean (* focus_out_event)      (GtkWidget       *widget,
+                     GdkEventFocus       *event);
+  gboolean (* map_event)        (GtkWidget       *widget,
+                     GdkEventAny         *event);
+  gboolean (* unmap_event)      (GtkWidget       *widget,
+                     GdkEventAny         *event);
+  gboolean (* property_notify_event)    (GtkWidget       *widget,
+                     GdkEventProperty    *event);
+  gboolean (* selection_clear_event)    (GtkWidget       *widget,
+                     GdkEventSelection   *event);
+  gboolean (* selection_request_event)  (GtkWidget       *widget,
+                     GdkEventSelection   *event);
+  gboolean (* selection_notify_event)   (GtkWidget       *widget,
+                     GdkEventSelection   *event);
+  gboolean (* proximity_in_event)   (GtkWidget       *widget,
+                     GdkEventProximity   *event);
+  gboolean (* proximity_out_event)  (GtkWidget       *widget,
+                     GdkEventProximity   *event);
+  gboolean (* visibility_notify_event)  (GtkWidget       *widget,
+                     GdkEventVisibility  *event);
+  gboolean (* client_event)     (GtkWidget       *widget,
+                     GdkEventClient      *event);
+  gboolean (* no_expose_event)      (GtkWidget       *widget,
+                     GdkEventAny         *event);
+  gboolean (* window_state_event)   (GtkWidget       *widget,
+                     GdkEventWindowState *event);
+  
+  /* selection */
+  void (* selection_get)           (GtkWidget          *widget,
+                    GtkSelectionData   *selection_data,
+                    guint               info,
+                    guint               time_);
+  void (* selection_received)      (GtkWidget          *widget,
+                    GtkSelectionData   *selection_data,
+                    guint               time_);
+
+  /* Source side drag signals */
+  void (* drag_begin)              (GtkWidget          *widget,
+                    GdkDragContext     *context);
+  void (* drag_end)            (GtkWidget          *widget,
+                    GdkDragContext     *context);
+  void (* drag_data_get)           (GtkWidget          *widget,
+                    GdkDragContext     *context,
+                    GtkSelectionData   *selection_data,
+                    guint               info,
+                    guint               time_);
+  void (* drag_data_delete)        (GtkWidget          *widget,
+                    GdkDragContext     *context);
+
+  /* Target side drag signals */
+  void (* drag_leave)              (GtkWidget          *widget,
+                    GdkDragContext     *context,
+                    guint               time_);
+  gboolean (* drag_motion)         (GtkWidget          *widget,
+                    GdkDragContext     *context,
+                    gint                x,
+                    gint                y,
+                    guint               time_);
+  gboolean (* drag_drop)           (GtkWidget          *widget,
+                    GdkDragContext     *context,
+                    gint                x,
+                    gint                y,
+                    guint               time_);
+  void (* drag_data_received)      (GtkWidget          *widget,
+                    GdkDragContext     *context,
+                    gint                x,
+                    gint                y,
+                    GtkSelectionData   *selection_data,
+                    guint               info,
+                    guint               time_);
+
+  /* Signals used only for keybindings */
+  gboolean (* popup_menu)          (GtkWidget          *widget);
+
+  /* If a widget has multiple tooltips/whatsthis, it should show the
+   * one for the current focus location, or if that doesn't make
+   * sense, should cycle through them showing each tip alongside
+   * whatever piece of the widget it applies to.
+   */
+  gboolean (* show_help)           (GtkWidget          *widget,
+                                    GtkWidgetHelpType   help_type);
+  
+  /* accessibility support 
+   */
+  AtkObject*   (*get_accessible)     (GtkWidget *widget);
+
+  void         (*screen_changed)     (GtkWidget *widget,
+                                      GdkScreen *previous_screen);
+  gboolean     (*can_activate_accel) (GtkWidget *widget,
+                                      guint      signal_id);
+
+  /* Sent when a grab is broken. */
+  gboolean (*grab_broken_event) (GtkWidget       *widget,
+                                 GdkEventGrabBroken  *event);
+
+  void         (* composited_changed) (GtkWidget *widget);
+
+  gboolean     (* query_tooltip)      (GtkWidget  *widget,
+                       gint        x,
+                       gint        y,
+                       gboolean    keyboard_tooltip,
+                       GtkTooltip *tooltip);
+
+  /* Padding for future expansion */
+  void (*_gtk_reserved5) ();
+  void (*_gtk_reserved6) ();
+  void (*_gtk_reserved7) ();
+}
 
 /**
  * A GtkRequisition represents the desired size of a widget. See
@@ -4886,7 +5386,26 @@
  * GtkTooltips is deprecated and should not be used in newly-written code.
  * Holds information about a group of tooltips. Fields should be changed using the functions provided, rather than directly accessing the struct's members.
  */
-public struct GtkTooltips{}
+public struct GtkTooltips
+{
+  GtkObject parent_instance;
+
+  /*< private >*/
+  GtkWidget *tip_window;
+  GtkWidget *tip_label;
+  GtkTooltipsData *active_tips_data;
+  GList *tips_data_list; /* unused */
+
+  guint   flags1;
+  guint   flags2;
+
+//  guint   delay : 30;
+//  guint   enabled : 1;
+//  guint   have_grab : 1;
+//  guint   use_sticky_delay : 1;
+//  gint    timer_tag;
+  GTimeVal last_popdown;
+}
 
 
 /**