1 2 /* 3 * Osmo - a handy personal organizer 4 * 5 * Copyright (C) 2007-2009 Tomasz Mąka <pasp@users.sourceforge.net> 6 * 2007-2009 Piotr Mąka <silloz@users.sourceforge.net> 7 * 8 * This program is free software; you can redistribute it and/or modify 9 * it under the terms of the GNU General Public License as published by 10 * the Free Software Foundation; either version 2 of the License, or 11 * (at your option) any later version. 12 * 13 * This program is distributed in the hope that it will be useful, 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 * GNU General Public License for more details. 17 * 18 * You should have received a copy of the GNU General Public License 19 * along with this program; if not, write to the Free Software 20 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 21 */ 22 23 #ifndef _UTILS_GUI_H 24 #define _UTILS_GUI_H 25 26 #include "gui.h" 27 28 typedef struct { 29 GUI *appGUI; 30 gchar *config; 31 GtkWidget *entry; 32 PangoFontDescription **font; 33 GtkWidget *widget; 34 gboolean save; 35 } FONT_SEL; 36 37 enum { 38 SW_MOVE_UP = 0, 39 SW_MOVE_DOWN 40 }; 41 42 #define VBOX_SPACING 8 43 #define HBOX_SPACING 8 44 #define ALIGNMENT_PADDING_TOP 4 45 #define ALIGNMENT_PADDING_RIGHT 4 46 #define ALIGNMENT_PADDING_BOTTOM 4 47 #define ALIGNMENT_PADDING_LEFT 12 48 #define CHECKBOX_PADDING 0 49 #define WINDOW_BORDER 8 50 #define BORDER_WIDTH 8 51 52 #define COLOR_BG_OK "#fff77a" 53 #define COLOR_BG_FAIL "#ff7770" 54 55 #define TAG (0xe000) 56 57 GtkWidget * utl_gui_create_label (const gchar *format, const gchar *name); 58 GtkWidget * utl_gui_create_window (const gchar *name, gint width, gint height, GUI *appGUI); 59 GtkWidget * utl_gui_create_vbox_in_frame (GtkWidget *container, const gchar *name); 60 GtkWidget * utl_gui_create_hbox_in_frame (GtkWidget *container, const gchar *name); 61 GtkWidget * utl_gui_create_icon_with_label (const gchar *icon_name, const gchar *label_str); 62 GtkWidget * utl_gui_insert_in_scrolled_window (GtkWidget *widget, GtkShadowType type); 63 64 void utl_gui_font_select_cb (GtkWidget *widget, gpointer user_data); 65 gint utl_gui_get_sw_vscrollbar_width (GtkWidget *scrolled_window); 66 void utl_gui_sw_vscrollbar_move_position (GtkWidget *scrolled_window, gint direction); 67 gint utl_gui_get_column_position (GtkTreeViewColumn *column, GtkTreeView *treeview, 68 gint M, GUI *appGUI); 69 70 gint utl_gui_get_combobox_items (GtkComboBox *combo_box); 71 void utl_gui_create_category_combobox (GtkComboBox *combo_box, GtkListStore *store, gboolean none); 72 73 gchar* utl_gui_text_buffer_get_text_with_tags (GtkTextBuffer *buffer); 74 void utl_gui_text_buffer_set_text_with_tags (GtkTextBuffer *buffer, const gchar *text, gboolean clear); 75 void utl_gui_text_buffer_toggle_tags (GtkTextBuffer *buffer, const gchar *tag_name); 76 void utl_gui_text_buffer_remove_tags (GtkTextBuffer *buffer); 77 gchar * utl_gui_text_strip_tags (gchar *text); 78 void utl_gui_clear_text_buffer (GtkTextBuffer *buffer, GtkTextIter *iter); 79 80 void utl_gui_change_bg_widget_state (GtkWidget *widget, gchar *color_str, GUI *appGUI); 81 GdkPixbuf* utl_gui_create_color_swatch (gchar *color); 82 83 void utl_gui_update_command_status (GtkEditable *editable, GtkWidget *icon_widget, GUI *appGUI); 84 85 gint utl_gui_create_dialog (gint dialog_type, gchar *message, GtkWindow *parent); 86 GtkWidget * utl_gui_create_save_file_dialog (const gchar *title, GtkWindow *parent); 87 GtkWidget * utl_gui_create_open_file_dialog (const gchar *title, GtkWindow *parent); 88 gint utl_gui_check_overwrite_file (gchar *filename, GtkWidget *window, GUI *appGUI); 89 90 gint utl_gui_list_store_get_text_index (GtkListStore *store, gchar *text); 91 92 GtkWidget* utl_gui_icon_label_radio_button (gchar *label, const gchar *icon_name, GtkIconSize size); 93 94 void utl_gui_url_initialize (GUI *appGUI); 95 void utl_gui_url_setup (GSList **links_list, gint *link_index, GtkWidget *textview, 96 GUI *appGUI); 97 void utl_gui_url_insert_link (GSList **links_list, gint *link_index, GtkWidget *textview, 98 GtkTextIter *iter, gchar *color, gchar *font, gchar *text, 99 gboolean center, GUI *appGUI); 100 void utl_gui_url_remove_links (GSList **links_list, gint *link_index); 101 102 void utl_gui_foreach_selected (GtkTreeSelection *selection, GtkTreeModel *model, GFunc foreach_function, gpointer user_data); 103 GtkTreeIter utl_gui_get_first_selection_iter (GtkTreeSelection *selection, GtkTreeModel **model); 104 void utl_gui_convert_color_to_string (GdkRGBA *color, gchar *string); 105 void utl_gui_convert_color_alpha_to_string (GdkRGBA *color, gchar *string, gint *alpha); 106 #ifdef HAVE_GSPELL 107 GspellTextView* utl_gui_create_spell_check_textview (GtkTextView *textview, gboolean enable_by_default); 108 void utl_gui_set_enable_spell_check (GspellTextView* text, gboolean enable); 109 #endif /* HAVE_GSPELL */ 110 111 #endif /* _UTILS_GUI_H */ 112 113