gnttextview.h

Go to the documentation of this file.
00001 
00005 /*
00006  * GNT - The GLib Ncurses Toolkit
00007  *
00008  * GNT is the legal property of its developers, whose names are too numerous
00009  * to list here.  Please refer to the COPYRIGHT file distributed with this
00010  * source distribution.
00011  *
00012  * This library is free software; you can redistribute it and/or modify
00013  * it under the terms of the GNU General Public License as published by
00014  * the Free Software Foundation; either version 2 of the License, or
00015  * (at your option) any later version.
00016  *
00017  * This program is distributed in the hope that it will be useful,
00018  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00019  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00020  * GNU General Public License for more details.
00021  *
00022  * You should have received a copy of the GNU General Public License
00023  * along with this program; if not, write to the Free Software
00024  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02111-1301  USA
00025  */
00026 
00027 #ifndef GNT_TEXT_VIEW_H
00028 #define GNT_TEXT_VIEW_H
00029 
00030 #include "gntwidget.h"
00031 #include "gnt.h"
00032 #include "gntcolors.h"
00033 #include "gntkeys.h"
00034 
00035 #define GNT_TYPE_TEXT_VIEW              (gnt_text_view_get_gtype())
00036 #define GNT_TEXT_VIEW(obj)              (G_TYPE_CHECK_INSTANCE_CAST((obj), GNT_TYPE_TEXT_VIEW, GntTextView))
00037 #define GNT_TEXT_VIEW_CLASS(klass)      (G_TYPE_CHECK_CLASS_CAST((klass), GNT_TYPE_TEXT_VIEW, GntTextViewClass))
00038 #define GNT_IS_TEXT_VIEW(obj)           (G_TYPE_CHECK_INSTANCE_TYPE((obj), GNT_TYPE_TEXT_VIEW))
00039 #define GNT_IS_TEXT_VIEW_CLASS(klass)   (G_TYPE_CHECK_CLASS_TYPE((klass), GNT_TYPE_TEXT_VIEW))
00040 #define GNT_TEXT_VIEW_GET_CLASS(obj)    (G_TYPE_INSTANCE_GET_CLASS((obj), GNT_TYPE_TEXT_VIEW, GntTextViewClass))
00041 
00042 #define GNT_TEXT_VIEW_FLAGS(obj)                (GNT_TEXT_VIEW(obj)->priv.flags)
00043 #define GNT_TEXT_VIEW_SET_FLAGS(obj, flags)     (GNT_TEXT_VIEW_FLAGS(obj) |= flags)
00044 #define GNT_TEXT_VIEW_UNSET_FLAGS(obj, flags)   (GNT_TEXT_VIEW_FLAGS(obj) &= ~(flags))
00045 
00046 typedef struct _GntTextView         GntTextView;
00047 typedef struct _GntTextViewPriv     GntTextViewPriv;
00048 typedef struct _GntTextViewClass        GntTextViewClass;
00049 
00050 typedef enum
00051 {
00052     GNT_TEXT_VIEW_NO_SCROLL     = 1 << 0,
00053     GNT_TEXT_VIEW_WRAP_CHAR     = 1 << 1,
00054     GNT_TEXT_VIEW_TOP_ALIGN     = 1 << 2,
00055 } GntTextViewFlag;
00056 
00057 struct _GntTextView
00058 {
00059     GntWidget parent;
00060 
00061     GString *string;
00062     GList *list;        /* List of GntTextLine */
00063 
00064     GList *tags;       /* A list of tags */
00065     GntTextViewFlag flags;
00066 };
00067 
00068 typedef enum
00069 {
00070     GNT_TEXT_FLAG_NORMAL      = 0,
00071     GNT_TEXT_FLAG_BOLD        = 1 << 0,
00072     GNT_TEXT_FLAG_UNDERLINE   = 1 << 1,
00073     GNT_TEXT_FLAG_BLINK       = 1 << 2,
00074     GNT_TEXT_FLAG_DIM         = 1 << 3,
00075     GNT_TEXT_FLAG_HIGHLIGHT   = 1 << 4,
00076 } GntTextFormatFlags;
00077 
00078 struct _GntTextViewClass
00079 {
00080     GntWidgetClass parent;
00081 
00082     void (*gnt_reserved1)(void);
00083     void (*gnt_reserved2)(void);
00084     void (*gnt_reserved3)(void);
00085     void (*gnt_reserved4)(void);
00086 };
00087 
00088 G_BEGIN_DECLS
00089 
00093 GType gnt_text_view_get_gtype(void);
00094 
00100 GntWidget * gnt_text_view_new(void);
00101 
00107 void gnt_text_view_scroll(GntTextView *view, int scroll);
00108 
00116 void gnt_text_view_append_text_with_flags(GntTextView *view, const char *text, GntTextFormatFlags flags);
00117 
00126 void gnt_text_view_append_text_with_tag(GntTextView *view, const char *text, GntTextFormatFlags flags, const char *tag);
00127 
00134 void gnt_text_view_next_line(GntTextView *view);
00135 
00143 chtype gnt_text_format_flag_to_chtype(GntTextFormatFlags flags);
00144 
00150 void gnt_text_view_clear(GntTextView *view);
00151 
00159 int gnt_text_view_get_lines_below(GntTextView *view);
00160 
00168 int gnt_text_view_get_lines_above(GntTextView *view);
00169 
00181 int gnt_text_view_tag_change(GntTextView *view, const char *name, const char *text, gboolean all);
00182 
00190 void gnt_text_view_attach_scroll_widget(GntTextView *view, GntWidget *widget);
00191 
00209 void gnt_text_view_attach_pager_widget(GntTextView *view, GntWidget *pager);
00210 
00228 void gnt_text_view_attach_editor_widget(GntTextView *view, GntWidget *widget);
00229 
00238 void gnt_text_view_set_flag(GntTextView *view, GntTextViewFlag flag);
00239 
00240 G_END_DECLS
00241 
00242 #endif /* GNT_TEXT_VIEW_H */