rep-gtk r357 - in trunk: . examples
- From: chrisb svn gnome org
- To: svn-commits-list gnome org
- Subject: rep-gtk r357 - in trunk: . examples
- Date: Thu, 31 Jul 2008 19:53:33 +0000 (UTC)
Author: chrisb
Date: Thu Jul 31 19:53:33 2008
New Revision: 357
URL: http://svn.gnome.org/viewvc/rep-gtk?rev=357&view=rev
Log:
- added status-icon widget and example
Added:
trunk/examples/status-icon
Modified:
trunk/ChangeLog
trunk/gtk-compat.c
trunk/gtk.defs
Added: trunk/examples/status-icon
==============================================================================
--- (empty file)
+++ trunk/examples/status-icon Thu Jul 31 19:53:33 2008
@@ -0,0 +1,55 @@
+#! /bin/sh
+exec rep --batch "$0" "$@"
+!#
+
+;;;; rep-gtk hello world program
+
+(structure ()
+
+ (open rep
+ rep.system
+ gui.gtk-2.gtk)
+
+ (define window (gtk-window-new 'toplevel))
+
+ (define button (gtk-button-new-with-label "say hello"))
+
+ (gtk-container-set-border-width window 10)
+
+ (g-signal-connect window "delete_event" (lambda (w) (throw 'quit 0)))
+
+ (g-signal-connect button "clicked"
+ (lambda ()
+ (write standard-output "hello, world\n")))
+
+ (gtk-container-add window button)
+ (gtk-widget-show-all window)
+ (define tray_icon (gtk-status-icon-new))
+ ;(gtk-status-icon-set-from-file tray_icon "/usr/share/pixmaps/mplayer.xpm")
+ (gtk-status-icon-set-from-icon-name tray_icon "stock_mail-unread")
+ (gtk-status-icon-set-tooltip tray_icon
+ "Example Tray Icon")
+ (gtk-status-icon-set-blinking tray_icon t)
+ (g-signal-connect tray_icon "activate"
+ (lambda ()
+ (write standard-output "activate tray_icon\n")))
+ (define menu (gtk-menu-new))
+ (define item (gtk-menu-item-new-with-label "Test Menu"))
+ (gtk-menu-shell-append menu item)
+ (gtk-widget-show-all menu)
+ (g-signal-connect tray_icon "popup-menu"
+ (lambda ()
+ (gtk-status-icon-popup-menu tray_icon menu 0 0)))
+
+ (let ((x (list #f))(y (list #f))(z (list #f)))
+ (gtk-status-icon-get-geometry-interp tray_icon x y z)
+ (write standard-output (format nil "(%d,%d) %s\n" (car x) (car y) (car z))))
+
+ ;(define x (gtk-status-icon-get-geometry-interp tray_icon))
+
+ (setq interrupt-mode 'exit)
+ (recursive-edit))
+
+;; Local variables:
+;; major-mode: lisp-mode
+;; End:
Modified: trunk/gtk-compat.c
==============================================================================
--- trunk/gtk-compat.c (original)
+++ trunk/gtk-compat.c Thu Jul 31 19:53:33 2008
@@ -267,3 +267,36 @@
{
gtk_widget_draw (widget, NULL);
}
+
+/* status icon hack */
+
+void
+gtk_status_icon_popup_menu(GtkStatusIcon *status_icon,
+ GtkMenu *menu,
+ guint button,
+ guint32 activate_time)
+{
+ GtkMenuPositionFunc pos_func = gtk_status_icon_position_menu;
+ gpointer user_data = status_icon;
+ gtk_menu_popup (menu, NULL, NULL,
+ pos_func, user_data, button, activate_time);
+}
+
+gboolean
+gtk_status_icon_get_geometry_interp(GtkStatusIcon *status_icon,
+ gint *x,
+ gint *y,
+ GtkOrientation *orientation)
+{
+ GdkRectangle area;
+ gboolean ret = gtk_status_icon_get_geometry(status_icon,
+ NULL,
+ &area,
+ orientation);
+ if(!ret)
+ return ret;
+ *x = area.x;
+ *y = area.y;
+ return ret;
+}
+
Modified: trunk/gtk.defs
==============================================================================
--- trunk/gtk.defs (original)
+++ trunk/gtk.defs Thu Jul 31 19:53:33 2008
@@ -4560,6 +4560,130 @@
(define-func gtk_separator_menu_item_new
GtkWidget
())
+;; hack for status icon
+(define-object GtkStatusIcon (GObject))
+
+(define-enum GtkImageType
+ (empty GTK_IMAGE_EMPTY)
+ (pixmap GTK_IMAGE_PIXMAP)
+ (image GTK_IMAGE_IMAGE)
+ (pixbuf GTK_IMAGE_PIXBUF)
+ (stock GTK_IMAGE_STOCK)
+ (icon-set GTK_IMAGE_ICON_SET)
+ (animation GTK_IMAGE_ANIMATION)
+ (icon-name GTK_IMAGE_ICON_NAME))
+
+(define-func gtk_status_icon_new
+ GtkStatusIcon
+ ())
+
+(define-func gtk_status_icon_new_from_pixbuf
+ GtkStatusIcon
+ ((GdkPixbuf pixbuf)))
+
+(define-func gtk_status_icon_new_from_file
+ GtkStatusIcon
+ ((string filename)))
+
+(define-func gtk_status_icon_new_from_stock
+ GtkStatusIcon
+ ((string stock_id)))
+
+(define-func gtk_status_icon_new_from_icon_name
+ GtkStatusIcon
+ ((string icon_name)))
+
+
+(define-func gtk_status_icon_set_from_pixbuf
+ none
+ ((GtkStatusIcon status_icon)
+ (GdkPixbuf pixbuf)))
+
+(define-func gtk_status_icon_set_from_file
+ none
+ ((GtkStatusIcon status_icon)
+ (string filename)))
+
+(define-func gtk_status_icon_set_from_stock
+ none
+ ((GtkStatusIcon status_icon)
+ (string stock_id)))
+
+(define-func gtk_status_icon_set_from_icon_name
+ none
+ ((GtkStatusIcon status_icon)
+ (string icon_name)))
+
+(define-func gtk_status_icon_get_storage_type
+ GtkImageType
+ ((GtkStatusIcon status_icon)))
+
+(define-func gtk_status_icon_get_pixbuf
+ GdkPixbuf
+((GtkStatusIcon status_icon)))
+
+(define-func gtk_status_icon_get_stock
+ GdkPixbuf
+ ((GtkStatusIcon status_icon)))
+
+(define-func gtk_status_icon_get_icon_name
+ GdkPixbuf
+ ((GtkStatusIcon status_icon)))
+
+(define-func gtk_status_icon_get_size
+ int
+ ((GtkStatusIcon status_icon)))
+
+;(define-func gtk_status_icon_set_screen
+; none
+; ((GtkStatusIcon status_icon)
+; (GdkScreen screen)))
+
+;(define-func gtk_status_icon_get_screen
+; GdkScreen
+; ((GtkStatusIcon status_icon)))
+
+(define-func gtk_status_icon_set_tooltip
+ none
+ ((GtkStatusIcon status_icon)
+ (string tooltip_text)))
+
+(define-func gtk_status_icon_set_visible
+ none
+ ((GtkStatusIcon status_icon)
+ (bool visible)))
+
+(define-func gtk_status_icon_get_visible
+ bool
+ ((GtkStatusIcon status_icon)))
+
+(define-func gtk_status_icon_set_blinking
+ none
+ ((GtkStatusIcon status_icon)
+ (bool blinking)))
+
+(define-func gtk_status_icon_get_blinking
+ bool
+ ((GtkStatusIcon status_icon)))
+
+(define-func gtk_status_icon_is_embedded
+ bool
+ ((GtkStatusIcon status_icon)))
+
+(define-func gtk_status_icon_popup_menu
+ none
+ ((GtkStatusIcon status_icon)
+ (GtkMenu menu)
+ (uint button)
+ (uint activate_time)))
+
+; remove screen
+(define-func gtk_status_icon_get_geometry_interp
+ bool
+ ((GtkStatusIcon status_icon)
+ ((ret int) x)
+ ((ret int) y)
+ ((ret GtkOrientation) orientation)))
;; More defs files
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]