root / src / gtkutils.h @ 1
History | View | Annotate | Download (4.6 kB)
| 1 | /*
|
|---|---|
| 2 | * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client |
| 3 | * Copyright (C) 1999-2004 Hiroyuki Yamamoto |
| 4 | * |
| 5 | * This program is free software; you can redistribute it and/or modify |
| 6 | * it under the terms of the GNU General Public License as published by |
| 7 | * the Free Software Foundation; either version 2 of the License, or |
| 8 | * (at your option) any later version. |
| 9 | * |
| 10 | * This program is distributed in the hope that it will be useful, |
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 | * GNU General Public License for more details. |
| 14 | * |
| 15 | * You should have received a copy of the GNU General Public License |
| 16 | * along with this program; if not, write to the Free Software |
| 17 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
| 18 | */ |
| 19 | |
| 20 | #ifndef __GTKUTILS_H__
|
| 21 | #define __GTKUTILS_H__
|
| 22 | |
| 23 | #ifdef HAVE_CONFIG_H
|
| 24 | # include "config.h" |
| 25 | #endif
|
| 26 | |
| 27 | #include <glib.h> |
| 28 | #include <gdk/gdk.h> |
| 29 | #include <gtk/gtkmain.h> |
| 30 | #include <gtk/gtkwidget.h> |
| 31 | #include <gtk/gtkcontainer.h> |
| 32 | #include <gtk/gtkeditable.h> |
| 33 | #include <gtk/gtkctree.h> |
| 34 | #include <gtk/gtkcombo.h> |
| 35 | #include <gtk/gtktextview.h> |
| 36 | #include <gtk/gtkitemfactory.h> |
| 37 | #include <stdlib.h> |
| 38 | #if HAVE_WCHAR_H
|
| 39 | # include <wchar.h> |
| 40 | #endif
|
| 41 | |
| 42 | typedef struct _ComboButton ComboButton; |
| 43 | |
| 44 | struct _ComboButton
|
| 45 | {
|
| 46 | GtkWidget *arrow; |
| 47 | GtkWidget *button; |
| 48 | GtkWidget *menu; |
| 49 | GtkItemFactory *factory; |
| 50 | gpointer data; |
| 51 | }; |
| 52 | |
| 53 | #define GTK_EVENTS_FLUSH() \
|
| 54 | { \
|
| 55 | while (gtk_events_pending()) \
|
| 56 | gtk_main_iteration(); \ |
| 57 | } |
| 58 | |
| 59 | #define PIXMAP_CREATE(widget, pixmap, mask, xpm_d) \
|
| 60 | { \
|
| 61 | if (!pixmap) { \
|
| 62 | GtkStyle *style = gtk_widget_get_style(widget); \ |
| 63 | pixmap = gdk_pixmap_create_from_xpm_d \ |
| 64 | (widget->window, &mask, \ |
| 65 | &style->bg[GTK_STATE_NORMAL], xpm_d); \ |
| 66 | } \ |
| 67 | } |
| 68 | |
| 69 | #define GTK_WIDGET_PTR(wid) (*(GtkWidget **)wid)
|
| 70 | |
| 71 | #define GTKUT_CTREE_NODE_SET_ROW_DATA(node, d) \
|
| 72 | { \
|
| 73 | GTK_CTREE_ROW(node)->row.data = d; \ |
| 74 | } |
| 75 | |
| 76 | #define GTKUT_CTREE_NODE_GET_ROW_DATA(node) \
|
| 77 | (GTK_CTREE_ROW(node)->row.data) |
| 78 | |
| 79 | #define GTKUT_CTREE_REFRESH(clist) \
|
| 80 | GTK_CLIST_GET_CLASS(clist)->refresh(clist) |
| 81 | |
| 82 | gboolean gtkut_get_font_size (GtkWidget *widget, |
| 83 | gint *width, |
| 84 | gint *height); |
| 85 | |
| 86 | GdkFont *gtkut_font_load (const gchar *fontset_name);
|
| 87 | GdkFont *gtkut_font_load_from_fontset (const gchar *fontset_name);
|
| 88 | |
| 89 | void gtkut_convert_int_to_gdk_color (gint rgbvalue,
|
| 90 | GdkColor *color); |
| 91 | |
| 92 | void gtkut_button_set_create (GtkWidget **bbox,
|
| 93 | GtkWidget **button1, |
| 94 | const gchar *label1,
|
| 95 | GtkWidget **button2, |
| 96 | const gchar *label2,
|
| 97 | GtkWidget **button3, |
| 98 | const gchar *label3);
|
| 99 | |
| 100 | ComboButton *gtkut_combo_button_create (GtkWidget *button, |
| 101 | GtkItemFactoryEntry *entries, |
| 102 | gint n_entries, |
| 103 | const gchar *path,
|
| 104 | gpointer data); |
| 105 | |
| 106 | void gtkut_ctree_node_move_if_on_the_edge
|
| 107 | (GtkCTree *ctree, |
| 108 | GtkCTreeNode *node); |
| 109 | gint gtkut_ctree_get_nth_from_node (GtkCTree *ctree, |
| 110 | GtkCTreeNode *node); |
| 111 | GtkCTreeNode *gtkut_ctree_node_next (GtkCTree *ctree, |
| 112 | GtkCTreeNode *node); |
| 113 | GtkCTreeNode *gtkut_ctree_node_prev (GtkCTree *ctree, |
| 114 | GtkCTreeNode *node); |
| 115 | gboolean gtkut_ctree_node_is_selected (GtkCTree *ctree, |
| 116 | GtkCTreeNode *node); |
| 117 | GtkCTreeNode *gtkut_ctree_find_collapsed_parent |
| 118 | (GtkCTree *ctree, |
| 119 | GtkCTreeNode *node); |
| 120 | void gtkut_ctree_expand_parent_all (GtkCTree *ctree,
|
| 121 | GtkCTreeNode *node); |
| 122 | void gtkut_ctree_set_focus_row (GtkCTree *ctree,
|
| 123 | GtkCTreeNode *node); |
| 124 | |
| 125 | void gtkut_clist_set_focus_row (GtkCList *clist,
|
| 126 | gint row); |
| 127 | |
| 128 | void gtkut_combo_set_items (GtkCombo *combo,
|
| 129 | const gchar *str1, ...);
|
| 130 | |
| 131 | gchar *gtkut_editable_get_selection (GtkEditable *editable); |
| 132 | void gtkut_editable_disable_im (GtkEditable *editable);
|
| 133 | |
| 134 | void gtkut_container_remove (GtkContainer *container,
|
| 135 | GtkWidget *widget); |
| 136 | |
| 137 | gboolean gtkut_text_buffer_match_string (GtkTextBuffer *text, |
| 138 | gint pos, |
| 139 | gunichar *wcs, |
| 140 | gint len, |
| 141 | gboolean case_sens); |
| 142 | guint gtkut_text_buffer_str_compare_n (GtkTextBuffer *text, |
| 143 | guint pos1, |
| 144 | guint pos2, |
| 145 | guint len, |
| 146 | guint text_len); |
| 147 | guint gtkut_text_buffer_str_compare (GtkTextBuffer *text, |
| 148 | guint start_pos, |
| 149 | guint text_len, |
| 150 | const gchar *str);
|
| 151 | gboolean gtkut_text_buffer_is_uri_string(GtkTextBuffer *text, |
| 152 | guint start_pos, |
| 153 | guint text_len); |
| 154 | |
| 155 | gchar *gtkut_text_view_get_selection (GtkTextView *textview); |
| 156 | |
| 157 | void gtkut_window_popup (GtkWidget *window);
|
| 158 | |
| 159 | void gtkut_widget_get_uposition (GtkWidget *widget,
|
| 160 | gint *px, |
| 161 | gint *py); |
| 162 | //void gtkut_widget_disable_theme_engine (GtkWidget *widget);
|
| 163 | void gtkut_widget_wait_for_draw (GtkWidget *widget);
|
| 164 | void gtkut_widget_init (void); |
| 165 | |
| 166 | #endif /* __GTKUTILS_H__ */ |