Mercurial > pidgin
annotate console/libgnt/gnttextview.h @ 14793:8a0cfee11af8
[gaim-migrate @ 17558]
Introduce actions. You can specify the bindings for the actions. Right now, only the tree and the entry widget have them. The manual includes the details. I believe Ethan had suggested something like this a while back. It made sense, so here it is.
committer: Tailor Script <tailor@pidgin.im>
author | Sadrul Habib Chowdhury <imadil@gmail.com> |
---|---|
date | Sat, 21 Oct 2006 21:08:24 +0000 |
parents | 5f3058c7a7df |
children | 70623f0d5cdc |
rev | line source |
---|---|
13882
5c750626eaa5
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1 #ifndef GNT_TEXT_VIEW_H |
5c750626eaa5
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
2 #define GNT_TEXT_VIEW_H |
5c750626eaa5
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
3 |
5c750626eaa5
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
4 #include "gntwidget.h" |
5c750626eaa5
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
5 #include "gnt.h" |
5c750626eaa5
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
6 #include "gntcolors.h" |
5c750626eaa5
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
7 #include "gntkeys.h" |
5c750626eaa5
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
8 |
5c750626eaa5
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
9 #define GNT_TYPE_TEXTVIEW (gnt_text_view_get_gtype()) |
5c750626eaa5
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
10 #define GNT_TEXT_VIEW(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), GNT_TYPE_TEXTVIEW, GntTextView)) |
5c750626eaa5
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
11 #define GNT_TEXT_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), GNT_TYPE_TEXTVIEW, GntTextViewClass)) |
5c750626eaa5
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
12 #define GNT_IS_TEXTVIEW(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), GNT_TYPE_TEXTVIEW)) |
5c750626eaa5
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
13 #define GNT_IS_TEXTVIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), GNT_TYPE_TEXTVIEW)) |
5c750626eaa5
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
14 #define GNT_TEXT_VIEW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), GNT_TYPE_TEXTVIEW, GntTextViewClass)) |
5c750626eaa5
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
15 |
5c750626eaa5
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
16 #define GNT_TEXT_VIEW_FLAGS(obj) (GNT_TEXT_VIEW(obj)->priv.flags) |
5c750626eaa5
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
17 #define GNT_TEXT_VIEW_SET_FLAGS(obj, flags) (GNT_TEXT_VIEW_FLAGS(obj) |= flags) |
5c750626eaa5
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
18 #define GNT_TEXT_VIEW_UNSET_FLAGS(obj, flags) (GNT_TEXT_VIEW_FLAGS(obj) &= ~(flags)) |
5c750626eaa5
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
19 |
5c750626eaa5
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
20 typedef struct _GnTextView GntTextView; |
5c750626eaa5
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
21 typedef struct _GnTextViewPriv GntTextViewPriv; |
5c750626eaa5
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
22 typedef struct _GnTextViewClass GntTextViewClass; |
5c750626eaa5
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
23 |
5c750626eaa5
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
24 struct _GnTextView |
5c750626eaa5
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
25 { |
5c750626eaa5
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
26 GntWidget parent; |
5c750626eaa5
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
27 |
14383
5f3058c7a7df
[gaim-migrate @ 17089]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14030
diff
changeset
|
28 GString *string; |
13896
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13882
diff
changeset
|
29 GList *list; /* List of GntTextLine */ |
13882
5c750626eaa5
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
30 }; |
5c750626eaa5
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
31 |
5c750626eaa5
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
32 typedef enum |
5c750626eaa5
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
33 { |
13964
0a0d2a1fd2bc
[gaim-migrate @ 16520]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13952
diff
changeset
|
34 GNT_TEXT_FLAG_NORMAL = 0, |
13882
5c750626eaa5
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
35 GNT_TEXT_FLAG_BOLD = 1 << 0, |
5c750626eaa5
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
36 GNT_TEXT_FLAG_UNDERLINE = 1 << 1, |
5c750626eaa5
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
37 GNT_TEXT_FLAG_BLINK = 1 << 2, |
13896
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13882
diff
changeset
|
38 GNT_TEXT_FLAG_DIM = 1 << 3, |
a621329e8c85
[gaim-migrate @ 16381]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13882
diff
changeset
|
39 GNT_TEXT_FLAG_HIGHLIGHT = 1 << 4, |
13931
917a71dd02eb
[gaim-migrate @ 16458]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13896
diff
changeset
|
40 } GntTextFormatFlags; |
13882
5c750626eaa5
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
41 |
5c750626eaa5
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
42 struct _GnTextViewClass |
5c750626eaa5
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
43 { |
5c750626eaa5
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
44 GntWidgetClass parent; |
5c750626eaa5
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
45 |
5c750626eaa5
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
46 void (*gnt_reserved1)(void); |
5c750626eaa5
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
47 void (*gnt_reserved2)(void); |
5c750626eaa5
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
48 void (*gnt_reserved3)(void); |
5c750626eaa5
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
49 void (*gnt_reserved4)(void); |
5c750626eaa5
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
50 }; |
5c750626eaa5
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
51 |
5c750626eaa5
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
52 G_BEGIN_DECLS |
5c750626eaa5
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
53 |
5c750626eaa5
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
54 GType gnt_text_view_get_gtype(void); |
5c750626eaa5
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
55 |
5c750626eaa5
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
56 /* XXX: For now, don't set a textview to have any border. |
5c750626eaa5
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
57 * If you want borders real bad, put it in a box. */ |
5c750626eaa5
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
58 GntWidget *gnt_text_view_new(); |
5c750626eaa5
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
59 |
5c750626eaa5
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
60 /* scroll > 0 means scroll up, < 0 means scroll down, == 0 means scroll to the end */ |
5c750626eaa5
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
61 void gnt_text_view_scroll(GntTextView *view, int scroll); |
5c750626eaa5
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
62 |
13931
917a71dd02eb
[gaim-migrate @ 16458]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13896
diff
changeset
|
63 void gnt_text_view_append_text_with_flags(GntTextView *view, const char *text, GntTextFormatFlags flags); |
13882
5c750626eaa5
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
64 |
5c750626eaa5
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
65 /* Move the cursor to the beginning of the next line and resets text-attributes. |
5c750626eaa5
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
66 * It first completes the current line with the current text-attributes. */ |
5c750626eaa5
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
67 void gnt_text_view_next_line(GntTextView *view); |
5c750626eaa5
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
68 |
13952
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13931
diff
changeset
|
69 chtype gnt_text_format_flag_to_chtype(GntTextFormatFlags flags); |
841a5ffbfee4
[gaim-migrate @ 16500]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13931
diff
changeset
|
70 |
13971
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
71 void gnt_text_view_clear(GntTextView *view); |
df8183b7fa2c
[gaim-migrate @ 16529]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13964
diff
changeset
|
72 |
14030
0e70bb6d32fd
[gaim-migrate @ 16632]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13971
diff
changeset
|
73 int gnt_text_view_get_lines_below(GntTextView *view); |
0e70bb6d32fd
[gaim-migrate @ 16632]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13971
diff
changeset
|
74 |
0e70bb6d32fd
[gaim-migrate @ 16632]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13971
diff
changeset
|
75 int gnt_text_view_get_lines_above(GntTextView *view); |
0e70bb6d32fd
[gaim-migrate @ 16632]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13971
diff
changeset
|
76 |
13882
5c750626eaa5
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
77 G_END_DECLS |
5c750626eaa5
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
78 |
5c750626eaa5
[gaim-migrate @ 16362]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
79 #endif /* GNT_TEXT_VIEW_H */ |