From c5a046da8c5ca824b266ff48034a860790dc1aa3 Mon Sep 17 00:00:00 2001 From: Andrey Kutejko Date: Tue, 24 Nov 2009 21:09:12 +0200 Subject: [PATCH] some new code --- gtk/cl-gtk2-gtk.asd | 1 + gtk/gtk.cell-renderer.lisp | 23 +++++++- gtk/gtk.icon-factory.lisp | 140 ++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 163 insertions(+), 1 deletion(-) create mode 100644 gtk/gtk.icon-factory.lisp diff --git a/gtk/cl-gtk2-gtk.asd b/gtk/cl-gtk2-gtk.asd index 823139e..0672a17 100644 --- a/gtk/cl-gtk2-gtk.asd +++ b/gtk/cl-gtk2-gtk.asd @@ -15,6 +15,7 @@ (:file "gtk.dialog") (:file "gtk.window") (:file "gtk.window-group") + (:file "gtk.icon-factory") (:file "gtk.image") (:file "gtk.label") (:file "gtk.progress-bar") diff --git a/gtk/gtk.cell-renderer.lisp b/gtk/gtk.cell-renderer.lisp index 4f8d4a6..4de7f00 100644 --- a/gtk/gtk.cell-renderer.lisp +++ b/gtk/gtk.cell-renderer.lisp @@ -14,7 +14,28 @@ ; TODO: gtk_cell_renderer_stop_editing -; TODO: gtk_cell_renderer_get_fixed_size +(defcfun gtk-cell-renderer-get-fixed-size :void + (cell g-object) + (width :pointer) + (height :pointer)) + +(defun cell-renderer-get-fixed-size (cell) + (with-foreign-objects ((width :int) (height :int)) + (gtk-cell-renderer-get-fixed-size cell width height) + (values (mem-ref width :int) + (mem-ref height :int)))) + +(export 'cell-renderer-get-fixed-size) + +(defcfun gtk-cell-renderer-set-fixed-size :void + (cell g-object) + (width :int) + (height :int)) + +(defun cell-renderer-set-fixed-size (cell width height) + (gtk-cell-renderer-set-fixed-size cell width height)) + +(export 'cell-renderer-set-fixed-size) ; TODO: GtkCellRendererAccel diff --git a/gtk/gtk.icon-factory.lisp b/gtk/gtk.icon-factory.lisp new file mode 100644 index 0000000..d8502ad --- /dev/null +++ b/gtk/gtk.icon-factory.lisp @@ -0,0 +1,140 @@ +(in-package :gtk) + +;; icon-source + +(at-init () (foreign-funcall "gtk_icon_source_get_type" :int)) + +(defcfun gtk-icon-source-new :pointer) + +(define-g-boxed-opaque icon-source "GtkIconSource" + :alloc (gtk-icon-source-new)) + +(export 'icon-source) + +(define-boxed-opaque-accessor icon-source icon-source-filename + :reader "gtk_icon_source_get_filename" + :writer "gtk_icon_source_set_filename" + :type (:string :free-from-foreign nil)) + +(export 'icon-source-filename) + +(define-boxed-opaque-accessor icon-source icon-source-icon-name + :reader "gtk_icon_source_get_icon_name" + :writer "gtk_icon_source_set_icon_name" + :type (:string :free-from-foreign nil)) + +(export 'icon-source-icon-name) + +#| +GtkTextDirection gtk_icon_source_get_direction (const GtkIconSource *source); +gboolean gtk_icon_source_get_direction_wildcarded + (const GtkIconSource *source); +GdkPixbuf* gtk_icon_source_get_pixbuf (const GtkIconSource *source); +GtkIconSize gtk_icon_source_get_size (const GtkIconSource *source); +gboolean gtk_icon_source_get_size_wildcarded (const GtkIconSource *source); +GtkStateType gtk_icon_source_get_state (const GtkIconSource *source); +gboolean gtk_icon_source_get_state_wildcarded + (const GtkIconSource *source); + +void gtk_icon_source_set_direction (GtkIconSource *source, + GtkTextDirection direction); +void gtk_icon_source_set_direction_wildcarded + (GtkIconSource *source, + gboolean setting); +void gtk_icon_source_set_pixbuf (GtkIconSource *source, + GdkPixbuf *pixbuf); +void gtk_icon_source_set_size (GtkIconSource *source, + GtkIconSize size); +void gtk_icon_source_set_size_wildcarded (GtkIconSource *source, + gboolean setting); +void gtk_icon_source_set_state (GtkIconSource *source, + GtkStateType state); +void gtk_icon_source_set_state_wildcarded + (GtkIconSource *source, + gboolean setting); +|# + + +;; icon-set + +(at-init () (foreign-funcall "gtk_icon_set_get_type" :int)) + +(defcfun gtk-icon-set-new :pointer) + +(define-g-boxed-opaque icon-set "GtkIconSet" + :alloc (gtk-icon-set-new)) + +(export 'icon-set) + +(defcfun gtk-icon-set-add-source :void + (icon-set (g-boxed-foreign icon-set)) + (source (g-boxed-foreign icon-source))) + +(defun icon-set-add-source (icon-set icon-source) + (gtk-icon-set-add-source icon-set icon-source)) + +(export 'icon-set-add-source) + +#| +GtkIconSet* gtk_icon_set_new_from_pixbuf (GdkPixbuf *pixbuf); +GdkPixbuf* gtk_icon_set_render_icon (GtkIconSet *icon_set, + GtkStyle *style, + GtkTextDirection direction, + GtkStateType state, + GtkIconSize size, + GtkWidget *widget, + const char *detail); +void gtk_icon_set_get_sizes (GtkIconSet *icon_set, + GtkIconSize **sizes, + gint *n_sizes); + +gboolean gtk_icon_size_lookup (GtkIconSize size, + gint *width, + gint *height); +gboolean gtk_icon_size_lookup_for_settings (GtkSettings *settings, + GtkIconSize size, + gint *width, + gint *height); +GtkIconSize gtk_icon_size_register (const gchar *name, + gint width, + gint height); +void gtk_icon_size_register_alias (const gchar *alias, + GtkIconSize target); +GtkIconSize gtk_icon_size_from_name (const gchar *name); +const gchar* gtk_icon_size_get_name (GtkIconSize size); +|# + +;; icon-factory + +(defcfun gtk-icon-factory-add :void + (factory (g-object icon-factory)) + (stock-id :string) + (icon-set (g-boxed-foreign icon-set))) + +(defun icon-factory-add (factory stock-id icon-set) + (gtk-icon-factory-add factory stock-id icon-set)) + +(export 'icon-factory-add) + +(defcfun gtk-icon-factory-add-default :void + (factory (g-object icon-factory))) + +(defun icon-factory-add-default (factory) + (gtk-icon-factory-add-default factory)) + +(export 'icon-factory-add-default) + +(defcfun gtk-icon-factory-lookup (g-boxed-foreign icon-set :return) + (factory (g-object icon-factory)) + (stock-id :string)) + +(defun icon-factory-lookup (factory stock-id) + (gtk-icon-factory-lookup factory stock-id)) + +(export 'icon-factory-lookup) + +#| +GtkIconSet* gtk_icon_factory_lookup_default (const gchar *stock_id); +void gtk_icon_factory_remove_default (GtkIconFactory *factory); +|# + -- 1.7.10.4