comparison console/libgnt/gnttextview.h @ 13882:5c750626eaa5

[gaim-migrate @ 16362] New widget GntTextView. It's really simple as it is. But it 'works'. committer: Tailor Script <tailor@pidgin.im>
author Sadrul Habib Chowdhury <imadil@gmail.com>
date Wed, 28 Jun 2006 00:17:35 +0000
parents
children a621329e8c85
comparison
equal deleted inserted replaced
13881:5d5e249c488e 13882:5c750626eaa5
1 #ifndef GNT_TEXT_VIEW_H
2 #define GNT_TEXT_VIEW_H
3
4 #include "gntwidget.h"
5 #include "gnt.h"
6 #include "gntcolors.h"
7 #include "gntkeys.h"
8
9 #define GNT_TYPE_TEXTVIEW (gnt_text_view_get_gtype())
10 #define GNT_TEXT_VIEW(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), GNT_TYPE_TEXTVIEW, GntTextView))
11 #define GNT_TEXT_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), GNT_TYPE_TEXTVIEW, GntTextViewClass))
12 #define GNT_IS_TEXTVIEW(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), GNT_TYPE_TEXTVIEW))
13 #define GNT_IS_TEXTVIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), GNT_TYPE_TEXTVIEW))
14 #define GNT_TEXT_VIEW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), GNT_TYPE_TEXTVIEW, GntTextViewClass))
15
16 #define GNT_TEXT_VIEW_FLAGS(obj) (GNT_TEXT_VIEW(obj)->priv.flags)
17 #define GNT_TEXT_VIEW_SET_FLAGS(obj, flags) (GNT_TEXT_VIEW_FLAGS(obj) |= flags)
18 #define GNT_TEXT_VIEW_UNSET_FLAGS(obj, flags) (GNT_TEXT_VIEW_FLAGS(obj) &= ~(flags))
19
20 typedef struct _GnTextView GntTextView;
21 typedef struct _GnTextViewPriv GntTextViewPriv;
22 typedef struct _GnTextViewClass GntTextViewClass;
23
24 struct _GnTextView
25 {
26 GntWidget parent;
27
28 WINDOW *scroll; /* XXX: For now, let's do with this. */
29 int pos; /* Scroll position. */
30 int lines; /* No. of lines of text. */
31 };
32
33 typedef enum
34 {
35 GNT_TEXT_FLAG_BOLD = 1 << 0,
36 GNT_TEXT_FLAG_UNDERLINE = 1 << 1,
37 GNT_TEXT_FLAG_BLINK = 1 << 2,
38 } GntTextViewFlags;
39
40 struct _GnTextViewClass
41 {
42 GntWidgetClass parent;
43
44 void (*gnt_reserved1)(void);
45 void (*gnt_reserved2)(void);
46 void (*gnt_reserved3)(void);
47 void (*gnt_reserved4)(void);
48 };
49
50 G_BEGIN_DECLS
51
52 GType gnt_text_view_get_gtype(void);
53
54 /* XXX: For now, don't set a textview to have any border.
55 * If you want borders real bad, put it in a box. */
56 GntWidget *gnt_text_view_new();
57
58 /* scroll > 0 means scroll up, < 0 means scroll down, == 0 means scroll to the end */
59 void gnt_text_view_scroll(GntTextView *view, int scroll);
60
61 void gnt_text_view_append_text_with_flags(GntTextView *view, const char *text, GntTextViewFlags flags);
62
63 /* Move the cursor to the beginning of the next line and resets text-attributes.
64 * It first completes the current line with the current text-attributes. */
65 void gnt_text_view_next_line(GntTextView *view);
66
67 G_END_DECLS
68
69 #endif /* GNT_TEXT_VIEW_H */