1 #ifndef NEMO_ICON_INFO_H 2 #define NEMO_ICON_INFO_H 3 4 #include <glib-object.h> 5 #include <gdk-pixbuf/gdk-pixbuf.h> 6 #include <gdk/gdk.h> 7 #include <gio/gio.h> 8 #include <gtk/gtk.h> 9 10 G_BEGIN_DECLS 11 12 /* Names for Nemo's different zoom levels, from tiniest items to largest items */ 13 typedef enum { 14 NEMO_ZOOM_LEVEL_NULL = -1, 15 NEMO_ZOOM_LEVEL_SMALLEST = 0, 16 NEMO_ZOOM_LEVEL_SMALLER, 17 NEMO_ZOOM_LEVEL_SMALL, 18 NEMO_ZOOM_LEVEL_STANDARD, 19 NEMO_ZOOM_LEVEL_LARGE, 20 NEMO_ZOOM_LEVEL_LARGER, 21 NEMO_ZOOM_LEVEL_LARGEST 22 } NemoZoomLevel; 23 24 #define NEMO_ZOOM_LEVEL_N_ENTRIES (NEMO_ZOOM_LEVEL_LARGEST + 1) 25 26 /* Nominal icon sizes for each Nemo zoom level. 27 * This scheme assumes that icons are designed to 28 * fit in a square space, though each image needn't 29 * be square. Since individual icons can be stretched, 30 * each icon is not constrained to this nominal size. 31 */ 32 33 #define NEMO_COMPACT_FORCED_ICON_SIZE 16 34 35 #define NEMO_LIST_ICON_SIZE_SMALLEST 16 36 #define NEMO_LIST_ICON_SIZE_SMALLER 24 37 #define NEMO_LIST_ICON_SIZE_SMALL 32 38 #define NEMO_LIST_ICON_SIZE_STANDARD 48 39 #define NEMO_LIST_ICON_SIZE_LARGE 72 40 #define NEMO_LIST_ICON_SIZE_LARGER 96 41 #define NEMO_LIST_ICON_SIZE_LARGEST 192 42 43 #define NEMO_ICON_SIZE_SMALLEST 24 44 #define NEMO_ICON_SIZE_SMALLER 32 45 #define NEMO_ICON_SIZE_SMALL 48 46 #define NEMO_ICON_SIZE_STANDARD 64 47 #define NEMO_ICON_SIZE_LARGE 96 48 #define NEMO_ICON_SIZE_LARGER 128 49 #define NEMO_ICON_SIZE_LARGEST 256 50 51 #define NEMO_DESKTOP_ICON_SIZE_SMALLER 24 52 #define NEMO_DESKTOP_ICON_SIZE_SMALL 32 53 #define NEMO_DESKTOP_ICON_SIZE_STANDARD 48 54 #define NEMO_DESKTOP_ICON_SIZE_LARGE 64 55 #define NEMO_DESKTOP_ICON_SIZE_LARGER 96 56 57 #define NEMO_DESKTOP_TEXT_WIDTH_SMALLER 64 58 #define NEMO_DESKTOP_TEXT_WIDTH_SMALL 84 59 #define NEMO_DESKTOP_TEXT_WIDTH_STANDARD 110 60 #define NEMO_DESKTOP_TEXT_WIDTH_LARGE 150 61 #define NEMO_DESKTOP_TEXT_WIDTH_LARGER 200 62 63 #define NEMO_ICON_TEXT_WIDTH_SMALLEST 0 64 #define NEMO_ICON_TEXT_WIDTH_SMALLER 64 65 #define NEMO_ICON_TEXT_WIDTH_SMALL 84 66 #define NEMO_ICON_TEXT_WIDTH_STANDARD 110 67 #define NEMO_ICON_TEXT_WIDTH_LARGE 96 68 #define NEMO_ICON_TEXT_WIDTH_LARGER 128 69 #define NEMO_ICON_TEXT_WIDTH_LARGEST 256 70 71 /* Maximum size of an icon that the icon factory will ever produce */ 72 #define NEMO_ICON_MAXIMUM_SIZE 320 73 74 typedef struct { 75 gint ref_count; 76 gboolean sole_owner; 77 gint64 last_use_time; 78 GdkPixbuf *pixbuf; 79 80 char *icon_name; 81 gint orig_scale; 82 } NemoIconInfo; 83 84 NemoIconInfo * nemo_icon_info_ref (NemoIconInfo *icon); 85 void nemo_icon_info_unref (NemoIconInfo *icon); 86 void nemo_icon_info_clear (NemoIconInfo **info); 87 NemoIconInfo * nemo_icon_info_new_for_pixbuf (GdkPixbuf *pixbuf, 88 int scale); 89 NemoIconInfo * nemo_icon_info_lookup (GIcon *icon, 90 int size, 91 int scale); 92 NemoIconInfo * nemo_icon_info_lookup_from_name (const char *name, 93 int size, 94 int scale); 95 NemoIconInfo * nemo_icon_info_lookup_from_path (const char *path, 96 int size, 97 int scale); 98 gboolean nemo_icon_info_is_fallback (NemoIconInfo *icon); 99 GdkPixbuf * nemo_icon_info_get_pixbuf (NemoIconInfo *icon); 100 GdkPixbuf * nemo_icon_info_get_pixbuf_nodefault (NemoIconInfo *icon); 101 GdkPixbuf * nemo_icon_info_get_pixbuf_nodefault_at_size (NemoIconInfo *icon, 102 gsize forced_size); 103 GdkPixbuf * nemo_icon_info_get_pixbuf_at_size (NemoIconInfo *icon, 104 gsize forced_size); 105 GdkPixbuf * nemo_icon_info_get_desktop_pixbuf_at_size (NemoIconInfo *icon, 106 gsize max_height, 107 gsize max_width); 108 const char * nemo_icon_info_get_used_name (NemoIconInfo *icon); 109 110 void nemo_icon_info_clear_caches (void); 111 112 /* Relationship between zoom levels and icons sizes. */ 113 guint nemo_get_icon_size_for_zoom_level (NemoZoomLevel zoom_level); 114 guint nemo_get_icon_text_width_for_zoom_level (NemoZoomLevel zoom_level); 115 116 guint nemo_get_list_icon_size_for_zoom_level (NemoZoomLevel zoom_level); 117 118 guint nemo_get_desktop_icon_size_for_zoom_level (NemoZoomLevel zoom_level); 119 guint nemo_get_desktop_text_width_for_zoom_level (NemoZoomLevel zoom_level); 120 121 gint nemo_get_icon_size_for_stock_size (GtkIconSize size); 122 guint nemo_icon_get_emblem_size_for_icon_size (guint size); 123 124 GIcon * nemo_user_special_directory_get_gicon (GUserDirectory directory); 125 126 127 G_END_DECLS 128 129 #endif /* NEMO_ICON_INFO_H */ 130 131