X-Git-Url: https://git.distorted.org.uk/~mdw/clg/blobdiff_plain/c11e33f715c4ff39917712cc28390a05046c2244..38c604ec4b161103576e1ecad95d67209da2967c:/gtk/gtkglue.c diff --git a/gtk/gtkglue.c b/gtk/gtkglue.c index e7d2ec8..6d57b43 100644 --- a/gtk/gtkglue.c +++ b/gtk/gtkglue.c @@ -1,5 +1,5 @@ /* Common Lisp bindings for GTK+ v2.0 - * Copyright (C) 1999-2000 Espen S. Johnsen + * Copyright (C) 1999-2002 Espen S. Johnsen * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -16,69 +16,11 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -/* $Id: gtkglue.c,v 1.2 2000-08-15 19:41:26 espen Exp $ */ +/* $Id: gtkglue.c,v 1.12 2002-04-02 15:05:44 espen Exp $ */ #include -#ifdef CMUCL -#include "lisp.h" - -extern lispobj funcall1(lispobj function, lispobj arg0); -extern lispobj funcall3(lispobj function, lispobj arg0, - lispobj arg1, lispobj arg2); - -lispobj callback_trampoline; -lispobj destroy_user_data; -#endif - - -void callback_marshal (GtkObject *object, - gpointer data, - guint n_args, - GtkArg *args) -{ -#ifdef CMUCL - funcall3 (callback_trampoline, alloc_number ((unsigned long)data), - alloc_number (n_args), alloc_sap (args)); - - /* lispobj lisp_args[4]; - - lisp_args[0] = alloc_sap (object); - lisp_args[1] = alloc_number ((unsigned long)data); - lisp_args[2] = alloc_number (n_args); - lisp_args[3] = alloc_sap (args); - - call_into_lisp (callback_trampoline, lisp_args, 4);*/ -#elif defined(CLISP) - callback_trampoline ((unsigned long)data, n_args, (unsigned int) args); -#endif -} - - -void destroy_marshal (gpointer data) -{ -#ifdef CMUCL - funcall1 (destroy_user_data, alloc_number ((unsigned long)data)); -#elif defined(CLISP) - destroy_user_data ((unsigned long)data); -#endif -} - -#ifndef CMUCL -void* -callback_marshal_address () -{ - return (void*)callback_marshal; -} - -void* -destroy_marshal_address () -{ - return (void*)destroy_marshal; -} -#endif - /* * @@ -95,14 +37,31 @@ gtk_query_version (guint *major, guint *minor, guint *micro) } -/* Is this necessary? */ - -GtkType -gtk_object_type (GtkObject *obj) +void gtk_callback_marshal (GtkWidget *widget, gpointer data) { - return GTK_OBJECT_TYPE (obj); + GValue arg; + + memset (&arg, 0, sizeof (GValue)); + g_value_init (&arg, gtk_widget_get_type ()); + g_value_set_object (&arg, widget); + callback_marshal ((guint)data, NULL, 1, &arg); } +void gtk_menu_position_callback_marshal (GtkMenu *menu, gint x, gint y, + gboolean push_in, gpointer data) +{ + GValue args[3]; + + memset (args, 0, 3 * sizeof (GValue)); + g_value_init (&args[0], G_TYPE_INT); + g_value_set_int (&args[0], x); + g_value_init (&args[1], G_TYPE_INT); + g_value_set_int (&args[1], y); + g_value_init (&args[2], G_TYPE_BOOLEAN); + g_value_set_boolean (&args[2], push_in); + + callback_marshal ((guint)data, NULL, 3, args); +} /* Widget */ @@ -126,7 +85,7 @@ gtk_widget_mapped_p (GtkWidget *widget) } void -gtk_widget_allocation (GtkWidget *widget, int *width, int *height) +gtk_widget_get_size_allocation (GtkWidget *widget, int *width, int *height) { *width = widget->allocation.width; *height = widget->allocation.height; @@ -142,31 +101,18 @@ gtk_container_get_focus_child (GtkContainer *container) } - -/* Menu item */ +/* Dialog */ GtkWidget* -gtk_menu_item_get_submenu (GtkMenuItem* menu_item) -{ - return menu_item->submenu; -} - -GtkSubmenuPlacement -gtk_menu_item_get_placement (GtkMenuItem* menu_item) -{ - return menu_item->submenu_placement; -} - -gint -gtk_menu_item_get_show_toggle (GtkMenuItem* menu_item) +gtk_dialog_get_vbox (GtkDialog *dialog) { - return menu_item->show_toggle_indicator; + return dialog->vbox; } -gint -gtk_menu_item_get_show_submenu (GtkMenuItem* menu_item) +GtkWidget* +gtk_dialog_get_action_area (GtkDialog *dialog) { - return menu_item->show_submenu_indicator; + return dialog->action_area; } @@ -186,77 +132,13 @@ gtk_check_menu_item_get_show_toggle (GtkCheckMenuItem* check_menu_item) } -/* Tree item */ - -GtkWidget* -gtk_tree_item_get_subtree (GtkTreeItem* tree_item) -{ - return GTK_TREE_ITEM_SUBTREE (tree_item); -} - /* Window */ -void -gtk_window_wmclass (GtkWindow* window, gchar* name, gchar* class) -{ - name = window->wmclass_name; - class = window->wmclass_class; -} - - -/* Color selection dialog */ - -GtkWidget* -gtk_color_selection_dialog_get_colorsel (GtkColorSelectionDialog* dialog) -{ - return dialog->colorsel; -} - -/* GtkWidget* */ -/* gtk_color_selection_dialog_get_main_vbox (GtkColorSelectionDialog* dialog) */ -/* { */ -/* return dialog->main_vbox; */ -/* } */ - -GtkWidget* -gtk_color_selection_dialog_get_ok_button (GtkColorSelectionDialog* dialog) -{ - return dialog->ok_button; -} - -/* GtkWidget* */ -/* gtk_color_selection_dialog_get_reset_button (GtkColorSelectionDialog* dialog) */ -/* { */ -/* return dialog->reset_button; */ -/* } */ - GtkWidget* -gtk_color_selection_dialog_get_cancel_button (GtkColorSelectionDialog* dialog) +gtk_window_get_default (GtkWindow *window) { - return dialog->cancel_button; -} - -GtkWidget* -gtk_color_selection_dialog_get_help_button (GtkColorSelectionDialog* dialog) -{ - return dialog->help_button; -} - - -/* Dialog */ - -GtkWidget* -gtk_dialog_get_action_area (GtkDialog *dialog) -{ - return dialog->action_area; -} - - -GtkWidget* -gtk_dialog_get_vbox (GtkDialog *dialog) -{ - return dialog->vbox; + return window->default_widget; } @@ -283,7 +165,6 @@ gtk_file_selection_get_cancel_button (GtkFileSelection *filesel) /* Color selection */ -void gtk_color_selection_set_color_by_values (GtkColorSelection *colorsel, gdouble red, gdouble green, @@ -345,115 +226,6 @@ gtk_combo_get_case_sensitive (GtkCombo *combo) } -/* CList */ - -#ifdef CLIST -GList* -gtk_clist_selection (GtkCList *clist) -{ - return clist->selection; -} - -gint -gtk_clist_get_titles_visible (GtkCList *clist) -{ - return (clist->title_window && GTK_WIDGET_VISIBLE (clist->title_window)); -} - -gint -gtk_clist_get_n_rows (GtkCList *clist) -{ - return clist->rows; -} - -gint -gtk_clist_get_focus_row (GtkCList *clist) -{ - return clist->focus_row; -} - -gint -gtk_clist_get_sort_column (GtkCList *clist) -{ - return clist->sort_column; -} - -GtkJustification -gtk_clist_column_justification (GtkCList *clist, - gint column) -{ - return clist->column[column].justification; -} - -gboolean -gtk_clist_column_visible_p (GtkCList *clist, - gint column) -{ - return clist->column[column].visible; -} - -gboolean -gtk_clist_column_resizeable_p (GtkCList *clist, - gint column) -{ - return clist->column[column].resizeable; -} - -gboolean -gtk_clist_column_auto_resize_p (GtkCList *clist, - gint column) -{ - return clist->column[column].auto_resize; -} - -gint -gtk_clist_column_width (GtkCList *clist, - gint column) -{ - return clist->column[column].width; -} - -gboolean -gtk_clist_auto_sort_p (GtkCList *clist) -{ - return GTK_CLIST_AUTO_SORT (clist); -} -#endif - -/* CTree */ - -#ifdef CTREE -gboolean -gtk_ctree_node_leaf_p (GtkCTreeNode* node) -{ - return GTK_CTREE_ROW (node)->is_leaf; -} - -GtkCTreeNode* -gtk_ctree_node_child (GtkCTreeNode* node) -{ - return GTK_CTREE_ROW (node)->children; -} - -GtkCTreeNode* -gtk_ctree_node_parent (GtkCTreeNode* node) -{ - return GTK_CTREE_ROW (node)->parent; -} - -GtkCTreeNode* -gtk_ctree_node_sibling (GtkCTreeNode* node) -{ - return GTK_CTREE_ROW (node)->sibling; -} - -gint -gtk_ctree_node_level (GtkCTreeNode* node) -{ - return GTK_CTREE_ROW (node)->level; -} -#endif - /* Paned */ GtkWidget* @@ -475,34 +247,9 @@ gtk_paned_child2 (GtkPaned *paned, guint *resize, guint *shrink) return paned->child2; } -gint -gtk_paned_get_position (GtkPaned *paned) -{ - if (paned->position_set == TRUE) - return paned->child1_size; - else - return -1; -} - /* Layout */ -gint -gtk_layout_size (GtkLayout *layout, gint *width, gint *height) - -{ - *width = layout->width; - *height = layout->height; -} - -void -gtk_layout_offset (GtkLayout *layout, gint *x, gint *y) -{ - *x = layout->xoffset; - *y = layout->yoffset; -} - - GdkWindow* gtk_layout_get_bin_window (GtkLayout *layout) { @@ -519,86 +266,16 @@ gtk_list_selection (GtkList *list) } -/* Menu */ - -gboolean -gtk_menu_get_tearoff_state (GtkMenu *menu) -{ - return menu->torn_off; -} - -gchar* -gtk_menu_get_title (GtkMenu *menu) -{ - return g_strdup (gtk_object_get_data (GTK_OBJECT (menu), "gtk-menu-title")); -} - - -/* Table */ - -guint -gtk_table_row_spacing (GtkTable *table, - guint row) -{ - return table->rows[row].spacing; -} - -guint -gtk_table_column_spacing (GtkTable *table, - guint col) -{ - return table->cols[col].spacing; -} - /* Toolbar */ gint -gtk_toolbar_num_children (GtkToolbar *toolbar) -{ - return toolbar->num_children; -} - -gint gtk_toolbar_get_tooltips (GtkToolbar *toolbar) { return toolbar->tooltips->enabled; } -/* Tree */ - -GtkSelectionMode -gtk_tree_get_selection_mode (GtkTree *tree) -{ - return tree->selection_mode; -} - -GtkSelectionMode -gtk_tree_get_view_mode (GtkTree *tree) -{ - return tree->view_mode; -} - -GtkSelectionMode -gtk_tree_get_view_lines (GtkTree *tree) -{ - return tree->view_mode; -} - -GtkTree* -gtk_tree_get_root_tree (GtkTree *tree) -{ - return GTK_TREE_ROOT_TREE (tree); -} - -GList* -gtk_tree_selection (GtkTree *tree) -{ - return GTK_TREE_SELECTION (tree); -} - - /* Drawing area */ void @@ -627,30 +304,8 @@ gtk_progress_get_adjustment (GtkProgress *progress) } -/* Scrolled window */ - -GtkWidget* -gtk_scrolled_window_get_hscrollbar (GtkScrolledWindow *window) -{ - return window->hscrollbar; -} - -GtkWidget* -gtk_scrolled_window_get_vscrollbar (GtkScrolledWindow *window) -{ - return window->vscrollbar; -} - - - /* Tooltips */ -guint -gtk_tooltips_get_delay (GtkTooltips *tooltips) -{ - return tooltips->delay; -} - gboolean gtk_tooltips_get_enabled (GtkTooltips *tooltips) { @@ -729,7 +384,7 @@ gtk_style_set_color (GtkStyle *style, GtkColorType color_type, return gtk_style_get_color (style, color_type, state); } - +/* GdkFont* gtk_style_get_font (GtkStyle *style) { @@ -742,7 +397,7 @@ gtk_style_set_font (GtkStyle *style, GdkFont *font) { return style->font = font; } - +*/ GdkGC* gtk_style_get_gc (GtkStyle *style, GtkColorType color_type, GtkStateType state)