Mercurial > pidgin
comparison finch/libgnt/gntutils.h @ 18304:38ecbc8a70bd
Start filling in the doxygen-help skeleton.
author | Sadrul Habib Chowdhury <imadil@gmail.com> |
---|---|
date | Wed, 27 Jun 2007 06:32:56 +0000 |
parents | 5c6f019e48f8 |
children | 7ee0e0597a26 b25cb0775be3 |
comparison
equal
deleted
inserted
replaced
18303:5c6f019e48f8 | 18304:38ecbc8a70bd |
---|---|
30 #include "gntwidget.h" | 30 #include "gntwidget.h" |
31 | 31 |
32 typedef gpointer (*GDupFunc)(gconstpointer data); | 32 typedef gpointer (*GDupFunc)(gconstpointer data); |
33 | 33 |
34 /** | 34 /** |
35 * | 35 * Compute the width and height required to view the text on the screen. |
36 * @param text | 36 * |
37 * @param width | 37 * @param text The text to be displayed. |
38 * @param height | 38 * @param width The width required is set here, if not @c NULL. |
39 * @param height The height required is set here, if not @c NULL. | |
39 */ | 40 */ |
40 void gnt_util_get_text_bound(const char *text, int *width, int *height); | 41 void gnt_util_get_text_bound(const char *text, int *width, int *height); |
41 | 42 |
42 /* excluding *end */ | |
43 /** | 43 /** |
44 * | 44 * Get the onscreen width of a string, or a substring. |
45 * @param start | |
46 * @param end | |
47 * | 45 * |
48 * @return | 46 * @param start The beginning of the string. |
47 * @param end The end of the string. The width returned is the width | |
48 * upto (but not including) end. If end is NULL, then start | |
49 * is considered as a @c NULL-terminated string. | |
50 * | |
51 * @return The on-screen width of the string. | |
49 */ | 52 */ |
50 int gnt_util_onscreen_width(const char *start, const char *end); | 53 int gnt_util_onscreen_width(const char *start, const char *end); |
51 | 54 |
55 /** | |
56 * Computes and returns the string after a specific number of onscreen characters. | |
57 * | |
58 * @param str The string. | |
59 * @param len The length to consider. If non-positive, the entire screenlength is used. | |
60 * @param w The actual width of the string upto the returned offset, if not @c NULL. | |
61 * | |
62 * @return The string after len offset. | |
63 */ | |
52 const char *gnt_util_onscreen_width_to_pointer(const char *str, int len, int *w); | 64 const char *gnt_util_onscreen_width_to_pointer(const char *str, int len, int *w); |
53 | 65 |
54 /* Inserts newlines in 'string' where necessary so that its onscreen width is | 66 /** |
67 * Inserts newlines in 'string' where necessary so that its onscreen width is | |
55 * no more than 'maxw'. | 68 * no more than 'maxw'. |
56 * 'maxw' can be <= 0, in which case the maximum screen width is considered. | |
57 * | 69 * |
58 * Returns a newly allocated string. | 70 * @param string The string. |
59 */ | 71 * @param maxw The width that the string should fit into. If maxw is <= 0, |
60 /** | 72 * then the available maximum width is used. |
61 * | |
62 * @param string | |
63 * @param maxw | |
64 * | 73 * |
65 * @return | 74 * @return A newly allocated string that needs to be freed by the caller. |
66 */ | 75 */ |
67 char * gnt_util_onscreen_fit_string(const char *string, int maxw); | 76 char * gnt_util_onscreen_fit_string(const char *string, int maxw); |
68 | 77 |
69 /** | 78 /** |
70 * | 79 * Duplicate the contents of a hastable. |
71 * @param src | |
72 * @param hash | |
73 * @param equal | |
74 * @param key_d | |
75 * @param value_d | |
76 * @param key_dup | |
77 * @param value_dup | |
78 * | 80 * |
79 * @return | 81 * @param src The source hashtable. |
82 * @param hash The hash-function to use. | |
83 * @param equal The hash-equal function to use. | |
84 * @param key_d The key-destroy function to use. | |
85 * @param value_d The value-destroy function to use. | |
86 * @param key_dup The function to use to duplicate the key. | |
87 * @param value_dup The function to use to duplicate the value. | |
88 * | |
89 * @return The new hashtable. | |
80 */ | 90 */ |
81 GHashTable * g_hash_table_duplicate(GHashTable *src, GHashFunc hash, GEqualFunc equal, GDestroyNotify key_d, GDestroyNotify value_d, GDupFunc key_dup, GDupFunc value_dup); | 91 GHashTable * g_hash_table_duplicate(GHashTable *src, GHashFunc hash, GEqualFunc equal, GDestroyNotify key_d, GDestroyNotify value_d, GDupFunc key_dup, GDupFunc value_dup); |
82 | 92 |
83 /** | 93 /** |
84 * To be used with g_signal_new. Look in the key_pressed signal-definition in | 94 * To be used with g_signal_new. Look in the key_pressed signal-definition in |
85 * gntwidget.c for usage. | 95 * gntwidget.c for usage. |
86 */ | |
87 /** | |
88 * | |
89 * @param ihint | |
90 * @param return_accu | |
91 * @param handler_return | |
92 * @param dummy | |
93 * | 96 * |
94 * @return | 97 * @param ihint NA |
98 * @param return_accu NA | |
99 * @param handler_return NA | |
100 * @param dummy NA | |
101 * | |
102 * @return NA | |
95 */ | 103 */ |
96 gboolean gnt_boolean_handled_accumulator(GSignalInvocationHint *ihint, GValue *return_accu, const GValue *handler_return, gpointer dummy); | 104 gboolean gnt_boolean_handled_accumulator(GSignalInvocationHint *ihint, GValue *return_accu, const GValue *handler_return, gpointer dummy); |
97 | 105 |
98 /** | 106 /** |
99 * Returns a GntTree populated with "key" -> "binding" for the widget. | 107 * Get a helpful display about the bindings of a widget. |
100 */ | |
101 /** | |
102 * | 108 * |
103 * @param widget | 109 * @param widget The widget to get bindings for. |
104 * | 110 * |
105 * @return | 111 * @return Returns a GntTree populated with "key" -> "binding" for the widget. |
106 */ | 112 */ |
107 GntWidget * gnt_widget_bindings_view(GntWidget *widget); | 113 GntWidget * gnt_widget_bindings_view(GntWidget *widget); |
108 | 114 |
109 /** | 115 /** |
110 * Parse widgets from 'string'. | 116 * Parse widgets from an XML description. For example, |
111 */ | 117 * |
112 /** | 118 * @code |
119 * GntWidget *win, *button; | |
120 * gnt_util_parse_widgets("\ | |
121 * <vwindow id='0' fill='0' align='2'> \ | |
122 * <label>This is a test</label> \ | |
123 * <button id='1'>OK</button> \ | |
124 * </vwindow>", | |
125 * 2, &win, &button); | |
126 * @endcode | |
113 * | 127 * |
114 * @param string | 128 * @param string The XML string. |
115 * @param num | 129 * @param num The number of widgets to return, followed by 'num' GntWidget ** |
116 */ | 130 */ |
117 void gnt_util_parse_widgets(const char *string, int num, ...); | 131 void gnt_util_parse_widgets(const char *string, int num, ...); |
118 | 132 |