1 /* Desktop icon widget for the Midnight Commander
3 * Copyright (C) 1998 The Free Software Foundation
5 * Author: Federico Mena <federico@nuclecu.unam.mx>
8 #ifndef GDESKTOP_ICON_H
9 #define GDESKTOP_ICON_H
11 #include <libgnome/gnome-defs.h>
12 #include <gtk/gtkwindow.h>
13 #include <libgnomeui/gnome-canvas.h>
14 #include <libgnomeui/gnome-icon-text.h>
20 #define DESKTOP_ICON_FONT "-*-helvetica-medium-r-normal--10-*-*-*-p-*-*-*," \
21 "-*-*-medium-r-normal-*-10-*-*-*-*-*-*-*,*"
23 #define DESKTOP_ICON_FONT \
24 "-*-helvetica-bold-r-normal--10-*-*-*-p-*-*-*," \
25 "-*-*-bold-r-normal-*-10-*-*-*-*-*-*-*,*"
29 #define TYPE_DESKTOP_ICON (desktop_icon_get_type ())
30 #define DESKTOP_ICON(obj) (GTK_CHECK_CAST ((obj), TYPE_DESKTOP_ICON, DesktopIcon))
31 #define DESKTOP_ICON_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), TYPE_DESKTOP_ICON, DesktopIconClass))
32 #define IS_DESKTOP_ICON(obj) (GTK_CHECK_TYPE ((obj), TYPE_DESKTOP_ICON))
33 #define IS_DESKTOP_ICON_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), TYPE_DESKTOP_ICON))
36 typedef struct _DesktopIcon DesktopIcon
;
37 typedef struct _DesktopIconClass DesktopIconClass
;
42 GtkWidget
*canvas
; /* The canvas that holds the icon and the icon text item */
44 GnomeCanvasItem
*icon
; /* The item that contains the icon */
45 GnomeCanvasItem
*text
; /* The item that contains the editable text */
46 GnomeCanvasItem
*stipple
; /* The stippled rectangle used when the icon is selected */
48 int width
, height
; /* Total size of the window */
50 int icon_x
, icon_y
; /* Icon offsets */
51 int icon_w
, icon_h
; /* Icon size */
52 int text_x
, text_y
; /* Text offsets */
53 int text_w
, text_h
; /* Text size */
55 int w_changed_id
; /* Signal connection ID for "width_changed" from the icon text item */
56 int h_changed_id
; /* Signal connection ID for "height_changed" from the icon text item */
59 struct _DesktopIconClass
{
60 GtkWindowClass parent_class
;
64 /* Standard Gtk function */
65 GtkType
desktop_icon_get_type (void);
67 /* Creates a new desktop icon from the specified image, and with the specified title */
68 GtkWidget
*desktop_icon_new (GdkImlibImage
*image
, char *text
);
70 /* Sets the icon from the specified image */
71 void desktop_icon_set_icon (DesktopIcon
*dicon
, GdkImlibImage
*image
);
73 /* Sets the icon's text */
74 void desktop_icon_set_text (DesktopIcon
*dicon
, char *text
);
76 /* Makes the desktop icon reshape itself (for when the global desktop_use_shaped_icons flag changes) */
77 void desktop_icon_reshape (DesktopIcon
*dicon
);
79 /* Selects or unselects the icon based on the value of sel (TRUE is selected, FALSE is unselected) */
80 void desktop_icon_select (DesktopIcon
*dicon
, int sel
);