2001-04-19 14:21:46 +02:00
|
|
|
/*
|
|
|
|
* Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
|
2011-02-16 08:16:26 +01:00
|
|
|
* Copyright (C) 1999-2011 Hiroyuki Yamamoto and the Claws Mail team
|
2001-04-19 14:21:46 +02:00
|
|
|
*
|
|
|
|
* 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
|
2007-07-11 18:38:12 +02:00
|
|
|
* the Free Software Foundation; either version 3 of the License, or
|
2001-04-19 14:21:46 +02:00
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
2007-07-11 18:38:12 +02:00
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*
|
2001-04-19 14:21:46 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __TEXTVIEW_H__
|
|
|
|
#define __TEXTVIEW_H__
|
|
|
|
|
2001-09-24 10:15:52 +02:00
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
# include "config.h"
|
|
|
|
#endif
|
|
|
|
|
2001-04-19 14:21:46 +02:00
|
|
|
#include <glib.h>
|
2008-09-09 18:40:59 +02:00
|
|
|
#include <gtk/gtk.h>
|
2001-04-19 14:21:46 +02:00
|
|
|
|
|
|
|
typedef struct _TextView TextView;
|
2006-08-02 18:30:28 +02:00
|
|
|
typedef struct _ClickableText ClickableText;
|
2006-10-07 19:45:59 +02:00
|
|
|
struct _ClickableText
|
|
|
|
{
|
|
|
|
gchar *uri;
|
|
|
|
|
|
|
|
gchar *filename;
|
|
|
|
|
|
|
|
gpointer data;
|
|
|
|
|
|
|
|
guint start;
|
|
|
|
guint end;
|
|
|
|
|
|
|
|
gboolean is_quote;
|
|
|
|
gint quote_level;
|
|
|
|
gboolean q_expanded;
|
|
|
|
gchar *fg_color;
|
|
|
|
};
|
|
|
|
|
2001-04-19 14:21:46 +02:00
|
|
|
|
|
|
|
#include "messageview.h"
|
|
|
|
#include "procmime.h"
|
|
|
|
|
|
|
|
struct _TextView
|
|
|
|
{
|
|
|
|
GtkWidget *vbox;
|
|
|
|
GtkWidget *scrolledwin;
|
|
|
|
GtkWidget *text;
|
|
|
|
|
2008-10-30 18:46:46 +01:00
|
|
|
GtkUIManager *ui_manager;
|
2008-07-25 23:01:45 +02:00
|
|
|
GtkActionGroup *link_action_group;
|
2005-02-09 14:15:30 +01:00
|
|
|
GtkWidget *link_popup_menu;
|
2008-07-25 23:01:45 +02:00
|
|
|
GtkActionGroup *mail_action_group;
|
2005-02-09 14:15:30 +01:00
|
|
|
GtkWidget *mail_popup_menu;
|
2008-07-25 23:01:45 +02:00
|
|
|
GtkActionGroup *file_action_group;
|
2005-04-01 10:16:46 +02:00
|
|
|
GtkWidget *file_popup_menu;
|
2002-01-06 13:21:36 +01:00
|
|
|
|
2002-07-16 01:56:33 +02:00
|
|
|
gboolean default_text;
|
2002-09-03 16:45:07 +02:00
|
|
|
gboolean is_in_signature;
|
|
|
|
|
2001-04-19 14:21:46 +02:00
|
|
|
GSList *uri_list;
|
2001-09-24 10:15:52 +02:00
|
|
|
gint body_pos;
|
2001-04-19 14:21:46 +02:00
|
|
|
|
2002-02-04 10:56:44 +01:00
|
|
|
MessageView *messageview;
|
2001-12-09 21:44:24 +01:00
|
|
|
gint last_buttonpress;
|
2004-11-06 10:39:33 +01:00
|
|
|
|
2006-08-02 18:30:28 +02:00
|
|
|
ClickableText *uri_hover;
|
2004-11-06 10:39:33 +01:00
|
|
|
GtkTextIter uri_hover_start_iter;
|
|
|
|
GtkTextIter uri_hover_end_iter;
|
2005-10-20 19:49:21 +02:00
|
|
|
GtkWidget *image;
|
2006-09-04 18:56:18 +02:00
|
|
|
gboolean loading;
|
|
|
|
gboolean stop_loading;
|
2007-04-24 12:05:01 +02:00
|
|
|
gint prev_quote_level;
|
2001-04-19 14:21:46 +02:00
|
|
|
};
|
|
|
|
|
2005-05-19 11:16:26 +02:00
|
|
|
TextView *textview_create (void);
|
|
|
|
void textview_init (TextView *textview);
|
|
|
|
void textview_reflect_prefs (TextView *textview);
|
|
|
|
|
2001-04-19 14:21:46 +02:00
|
|
|
void textview_show_part (TextView *textview,
|
|
|
|
MimeInfo *mimeinfo,
|
|
|
|
FILE *fp);
|
2004-01-12 22:28:31 +01:00
|
|
|
void textview_show_error (TextView *textview);
|
2001-04-19 14:21:46 +02:00
|
|
|
void textview_show_mime_part (TextView *textview,
|
|
|
|
MimeInfo *partinfo);
|
|
|
|
void textview_clear (TextView *textview);
|
|
|
|
void textview_destroy (TextView *textview);
|
|
|
|
void textview_set_font (TextView *textview,
|
|
|
|
const gchar *codeset);
|
2004-01-12 22:28:31 +01:00
|
|
|
void textview_set_text (TextView *textview,
|
|
|
|
const gchar *text);
|
2001-09-30 13:07:34 +02:00
|
|
|
void textview_set_position (TextView *textview,
|
|
|
|
gint pos);
|
2001-04-19 14:21:46 +02:00
|
|
|
void textview_scroll_one_line (TextView *textview,
|
|
|
|
gboolean up);
|
|
|
|
gboolean textview_scroll_page (TextView *textview,
|
|
|
|
gboolean up);
|
2011-11-07 22:21:50 +01:00
|
|
|
void textview_scroll_max (TextView *textview,
|
|
|
|
gboolean up);
|
2001-09-24 10:15:52 +02:00
|
|
|
|
2001-09-30 13:07:34 +02:00
|
|
|
gboolean textview_search_string (TextView *textview,
|
|
|
|
const gchar *str,
|
|
|
|
gboolean case_sens);
|
|
|
|
gboolean textview_search_string_backward (TextView *textview,
|
|
|
|
const gchar *str,
|
|
|
|
gboolean case_sens);
|
2006-03-18 20:16:07 +01:00
|
|
|
void textview_cursor_wait(TextView *textview);
|
|
|
|
void textview_cursor_normal(TextView *textview);
|
2006-10-07 19:45:59 +02:00
|
|
|
void textview_show_icon(TextView *textview, const gchar *stock_id);
|
2006-12-14 10:49:25 +01:00
|
|
|
void textview_get_selection_offsets (TextView *textview,
|
|
|
|
gint *sel_start,
|
|
|
|
gint *sel_end);
|
2007-02-02 18:48:17 +01:00
|
|
|
gboolean textview_uri_security_check (TextView *textview,
|
|
|
|
ClickableText *uri);
|
|
|
|
gchar *textview_get_visible_uri (TextView *textview,
|
|
|
|
ClickableText *uri);
|
2006-10-07 19:45:59 +02:00
|
|
|
|
|
|
|
#define TEXTVIEW_INSERT(str) \
|
|
|
|
gtk_text_buffer_insert_with_tags_by_name \
|
|
|
|
(buffer, &iter, str, -1,\
|
|
|
|
"header", NULL)
|
|
|
|
|
2007-07-24 18:22:28 +02:00
|
|
|
#define TEXTVIEW_INSERT_BOLD(str) \
|
|
|
|
gtk_text_buffer_insert_with_tags_by_name \
|
|
|
|
(buffer, &iter, str, -1,\
|
|
|
|
"header", "header_title", NULL)
|
|
|
|
|
2006-10-07 19:45:59 +02:00
|
|
|
#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); \
|
|
|
|
}
|
2001-04-19 14:21:46 +02:00
|
|
|
|
|
|
|
#endif /* __TEXTVIEW_H__ */
|