b782dd11 |
1 | #ifndef _DRAW_ITEM_H |
2 | #define _DRAW_ITEM_H |
3 | |
4 | typedef struct _DrawContext DrawContext; |
5 | typedef struct _DrawInfo DrawInfo; |
6 | typedef struct _ItemInfo ItemInfo; |
7 | |
8 | typedef struct _DrawOperation DrawOperation; |
9 | |
10 | |
11 | typedef struct _PropertiesText PropertiesText; |
12 | typedef struct _PropertiesIcon PropertiesIcon; |
13 | typedef struct _PropertiesLine PropertiesLine; |
14 | typedef struct _PropertiesArc PropertiesArc; |
15 | typedef struct _PropertiesBG PropertiesBG; |
16 | |
09e2606f |
17 | typedef enum _DrawableItems DrawableItems; |
18 | enum _DrawableItems { |
19 | ITEM_TEXT, ITEM_ICON, ITEM_LINE, ITEM_POINT, ITEM_BACKGROUND |
20 | }; |
21 | |
22 | |
23 | typedef enum _RelPos { |
24 | OVER, MIDDLE, UNDER |
25 | } RelPos; |
26 | |
b782dd11 |
27 | |
4c69e0cc |
28 | void draw_item( GdkDrawable *drawable, |
b782dd11 |
29 | gint x, |
30 | gint y, |
31 | LttvTraceState *ts, |
32 | LttvTracefileState *tfs, |
33 | LttvIAttribute *attributes); |
34 | |
35 | /* |
36 | * The tree of attributes used to store drawing operations goes like this : |
37 | * |
38 | * event_types/ |
39 | * "facility-event_type" |
40 | * cpus/ |
41 | * "cpu name" |
42 | * mode_types/ |
43 | * "execution mode"/ |
44 | * submodes/ |
45 | * "submode" |
46 | * process_states/ |
47 | * "state name" |
48 | * |
49 | * So if, for example, we want to add a hook to get called each time we |
50 | * receive an event that is in state LTTV_STATE_SYSCALL, we put the |
51 | * pointer to the GArray of DrawOperation in |
52 | * process_states/ "name associated with LTTV_STATE_SYSCALL" |
53 | */ |
54 | |
55 | /* |
4c69e0cc |
56 | * The add_operation has to do a quick sort by priority to keep the operations |
b782dd11 |
57 | * in the right order. |
58 | */ |
4c69e0cc |
59 | void add_operation( LttvIAttribute *attributes, |
b782dd11 |
60 | gchar *pathname, |
61 | DrawOperation *Operation); |
62 | |
63 | /* |
4c69e0cc |
64 | * The del_operation seeks the array present at pathname (if any) and |
b782dd11 |
65 | * removes the DrawOperation if present. It returns 0 on success, -1 |
66 | * if it fails. |
67 | */ |
4c69e0cc |
68 | gint del_operation( LttvIAttribute *attributes, |
b782dd11 |
69 | gchar *pathname, |
70 | DrawOperation *Operation); |
71 | |
72 | /* |
4c69e0cc |
73 | * The clean_operations removes all operations present at a pathname. |
b782dd11 |
74 | * returns 0 on success, -1 if it fails. |
75 | */ |
4c69e0cc |
76 | gint clean_operations( LttvIAttribute *attributes, |
b782dd11 |
77 | gchar *pathname ); |
78 | |
79 | |
80 | /* |
4c69e0cc |
81 | * The list_operations gives a pointer to the operation array associated |
b782dd11 |
82 | * with the pathname. It will be NULL if no operation is present. |
83 | */ |
4c69e0cc |
84 | void list_operations( LttvIAttribute *attributes, |
b782dd11 |
85 | gchar *pathname, |
86 | GArray **Operation); |
87 | |
88 | |
89 | |
90 | /* |
4c69e0cc |
91 | * exec_operation executes the operations if present in the attributes, or |
b782dd11 |
92 | * do nothing if not present. |
93 | */ |
4c69e0cc |
94 | void exec_operations( LttvIAttribute *attributes, |
b782dd11 |
95 | gchar *pathname); |
96 | |
97 | |
98 | /* |
99 | * Functions to create Properties structures. |
100 | */ |
101 | |
102 | PropertiesText *properties_text_create( |
103 | GdkColor *foreground, |
104 | GdkColor *background, |
105 | gint size, |
106 | gchar *Text, |
107 | RelPos position); |
108 | |
109 | PropertiesIcon *properties_icon_create( |
110 | gchar *icon_name, |
111 | gint width, |
112 | gint height, |
09e2606f |
113 | RelPos position); |
b782dd11 |
114 | |
115 | PropertiesLine *properties_line_create( |
116 | GdkColor *color, |
117 | gint line_width, |
118 | GdkLineStyle style, |
09e2606f |
119 | RelPos position); |
b782dd11 |
120 | |
121 | PropertiesArc *properties_arc_create( |
122 | GdkColor *color, |
123 | gint size, |
124 | gboolean filled, |
09e2606f |
125 | RelPos position); |
b782dd11 |
126 | |
127 | PropertiesBG *properties_bg_create( |
128 | GdkColor *color); |
129 | |
130 | |
131 | |
132 | |
133 | /* |
134 | * Here follow the prototypes of the hook functions used to draw the |
135 | * different items. |
136 | */ |
137 | |
4c69e0cc |
138 | gboolean draw_text( void *hook_data, void *call_data); |
139 | gboolean draw_icon( void *hook_data, void *call_data); |
140 | gboolean draw_line( void *hook_data, void *call_data); |
141 | gboolean draw_arc( void *hook_data, void *call_data); |
142 | gboolean draw_bg( void *hook_data, void *call_data); |
b782dd11 |
143 | |
144 | |
145 | #endif // _DRAW_ITEM_H |