2007-04-24 [wwp] 2.9.1cvs19
[claws.git] / src / textview.h
index 000cc89c01022416ba3ee67ae63c5146682b7990..e8ed572c85fb9ad2a8c0946ac782b7f8fd93fd33 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
- * Copyright (C) 1999-2006 Hiroyuki Yamamoto and the Sylpheed-Claws team
+ * Copyright (C) 1999-2007 Hiroyuki Yamamoto and the Claws Mail team
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
 
 typedef struct _TextView       TextView;
 typedef struct _ClickableText  ClickableText;
+struct _ClickableText
+{
+       gchar *uri;
+
+       gchar *filename;
+
+       gpointer data;
+
+       guint start;
+       guint end;
+       
+       gboolean is_quote;
+       gint quote_level;
+       gboolean q_expanded;
+       gchar *fg_color;
+};
+
 
 #include "messageview.h"
 #include "procmime.h"
@@ -62,6 +79,9 @@ struct _TextView
        GtkTextIter uri_hover_start_iter;
        GtkTextIter uri_hover_end_iter;
        GtkWidget *image;
+       gboolean loading;
+       gboolean stop_loading;
+       gint prev_quote_level;
 };
 
 TextView *textview_create              (void);
@@ -100,5 +120,34 @@ gboolean textview_search_string_backward   (TextView       *textview,
                                                 gboolean        case_sens);
 void textview_cursor_wait(TextView *textview);
 void textview_cursor_normal(TextView *textview);
+void textview_show_icon(TextView *textview, const gchar *stock_id);
+void textview_get_selection_offsets    (TextView       *textview, 
+                                        gint           *sel_start, 
+                                        gint           *sel_end);
+gboolean textview_uri_security_check   (TextView       *textview, 
+                                        ClickableText  *uri);
+gchar *textview_get_visible_uri                (TextView       *textview, 
+                                        ClickableText  *uri);
+
+#define TEXTVIEW_INSERT(str) \
+       gtk_text_buffer_insert_with_tags_by_name \
+                               (buffer, &iter, str, -1,\
+                                "header", NULL)
+
+#define TEXTVIEW_INSERT_LINK(str, fname, udata) {                              \
+       ClickableText *uri;                                                     \
+       uri = g_new0(ClickableText, 1);                                 \
+       uri->uri = g_strdup("");                                        \
+       uri->start = gtk_text_iter_get_offset(&iter);                   \
+       gtk_text_buffer_insert_with_tags_by_name                        \
+                               (buffer, &iter, str, -1,                \
+                                "link", "header_title", "header",      \
+                                NULL);                                 \
+       uri->end = gtk_text_iter_get_offset(&iter);                     \
+       uri->filename = fname?g_strdup(fname):NULL;                     \
+       uri->data = udata;                                              \
+       textview->uri_list =                                            \
+               g_slist_prepend(textview->uri_list, uri);               \
+}
 
 #endif /* __TEXTVIEW_H__ */