| 1 | /*! \file gtkTraceSet.h |
| 2 | * \brief API used by the graphical viewers to interact with their top window. |
| 3 | * |
| 4 | * Main window (gui module) is the place to contain and display viewers. |
| 5 | * Viewers (lttv plugins) interacte with main window through this API and |
| 6 | * events sent by gtk. |
| 7 | * This header file should be included in each graphic module. |
| 8 | * This library is used by graphical modules to interact with the |
| 9 | * tracesetWindow. |
| 10 | * |
| 11 | */ |
| 12 | |
| 13 | #include <gtk/gtk.h> |
| 14 | #include <ltt/ltt.h> |
| 15 | #include <lttv/hook.h> |
| 16 | |
| 17 | /** |
| 18 | * Function to register a view constructor so that main window can generate |
| 19 | * a toolbar item for the viewer in order to generate a new instance easily. |
| 20 | * It will be called by init function of the module. |
| 21 | * @param ButtonPixmap image shown on the toolbar item. |
| 22 | * @param tooltip tooltip of the toolbar item. |
| 23 | * @param view_constructor constructor of the viewer. |
| 24 | */ |
| 25 | |
| 26 | void ToolbarItemReg(gchar **ButtonPixmap, char *tooltip, void *view_constructor); |
| 27 | |
| 28 | |
| 29 | /** |
| 30 | * Function to unregister the viewer's constructor, release the space |
| 31 | * occupied by pixmap, tooltip and constructor of the viewer. |
| 32 | * It will be called when a module is unloaded. |
| 33 | * @param view_constructor constructor of the viewer which is used as |
| 34 | * a reference to find out where the pixmap and tooltip are. |
| 35 | */ |
| 36 | |
| 37 | void ToolbarItemUnreg(void *view_constructor); |
| 38 | |
| 39 | |
| 40 | /** |
| 41 | * Function to register a view constructor so that main window can generate |
| 42 | * a menu item for the viewer in order to generate a new instance easily. |
| 43 | * It will be called by init function of the module. |
| 44 | * @param menu_path path of the menu item. |
| 45 | * @param menu_text text of the menu item. |
| 46 | * @param view_constructor constructor of the viewer. |
| 47 | */ |
| 48 | |
| 49 | void MenuItemReg(char *menu_path, char *menu_text, void *view_constructor); |
| 50 | |
| 51 | |
| 52 | /** |
| 53 | * Function to unregister the viewer's constructor, release the space |
| 54 | * occupied by menu_path, menu_text and constructor of the viewer. |
| 55 | * It will be called when a module is unloaded. |
| 56 | * @param view_constructor constructor of the viewer which is used as |
| 57 | * a reference to find out where the menu_path and menu_text are. |
| 58 | */ |
| 59 | |
| 60 | void MenuItemUnreg(void *view_constructor); |
| 61 | |
| 62 | |
| 63 | /** |
| 64 | * Attach a viewer to the current tab. |
| 65 | * It will be called in the constructor of the viewer. |
| 66 | * @param main_win the main window the viewer belongs to. |
| 67 | * @param viewer viewer to be attached to the current tab |
| 68 | */ |
| 69 | |
| 70 | // Not Needed : Main window add widget returned by constructor |
| 71 | //void AttachViewer(MainWindow *main_win, GtkWidget *viewer); |
| 72 | |
| 73 | |
| 74 | /* ?? Maybe we do not need this function, when a widget is destroyed, |
| 75 | * it will be removed automatically from its container |
| 76 | */ |
| 77 | // Not needed |
| 78 | /** |
| 79 | * Detach a viewer from the current tab. |
| 80 | * It will be called in the destructor of the viewer. |
| 81 | * @param main_win the main window the viewer belongs to. |
| 82 | * @param viewer viewer to be detached from the current tab. |
| 83 | */ |
| 84 | |
| 85 | //void DetachViewer(MainWindow *main_win, GtkWidget *viewer); |
| 86 | |
| 87 | |
| 88 | /** |
| 89 | * Update the status bar whenever something changed in the viewer. |
| 90 | * @param main_win the main window the viewer belongs to. |
| 91 | * @param info the message which will be shown in the status bar. |
| 92 | */ |
| 93 | |
| 94 | void UpdateStatus(MainWindow *main_win, char *info); |
| 95 | |
| 96 | |
| 97 | /** |
| 98 | * Function to get the current time interval of the current tab. |
| 99 | * It will be called by a viewer's hook function to update the |
| 100 | * time interval of the viewer and also be called by the constructor |
| 101 | * of the viewer. |
| 102 | * @param main_win the main window the viewer belongs to. |
| 103 | * @param time_interval a pointer where time interval will be stored. |
| 104 | */ |
| 105 | |
| 106 | void GetTimeInterval(MainWindow *main_win, TimeInterval *time_interval); |
| 107 | |
| 108 | |
| 109 | /** |
| 110 | * Function to set the time interval of the current tab. |
| 111 | * It will be called by a viewer's signal handle associated with |
| 112 | * the move_slider signal |
| 113 | * @param main_win the main window the viewer belongs to. |
| 114 | * @param time_interval a pointer where time interval is stored. |
| 115 | */ |
| 116 | |
| 117 | void SetTimeInterval(MainWindow *main_win, TimeInterval *time_interval); |
| 118 | |
| 119 | |
| 120 | /** |
| 121 | * Function to get the current time/event of the current tab. |
| 122 | * It will be called by a viewer's hook function to update the |
| 123 | * current time/event of the viewer. |
| 124 | * @param main_win the main window the viewer belongs to. |
| 125 | * @param ltt_time a pointer where time will be stored. |
| 126 | */ |
| 127 | |
| 128 | void GetCurrentTime(MainWindow *main_win, ltt_time *time); |
| 129 | |
| 130 | |
| 131 | /** |
| 132 | * Function to set the current time/event of the current tab. |
| 133 | * It will be called by a viewer's signal handle associated with |
| 134 | * the button-release-event signal |
| 135 | * @param main_win the main window the viewer belongs to. |
| 136 | * @param ltt_time a pointer where time is stored. |
| 137 | */ |
| 138 | |
| 139 | void SetCurrentTime(MainWindow *main_win, ltt_time *time); |
| 140 | |
| 141 | |
| 142 | /** |
| 143 | * Function to get the traceset from the current tab. |
| 144 | * It will be called by the constructor of the viewer and also be |
| 145 | * called by a hook funtion of the viewer to update its traceset. |
| 146 | * @param main_win the main window the viewer belongs to. |
| 147 | * @param traceset a pointer to a traceset. |
| 148 | */ |
| 149 | |
| 150 | void GetTraceset(MainWindow *main_win, Traceset *traceset); |
| 151 | |
| 152 | |
| 153 | /** |
| 154 | * Function to get the filter of the current tab. |
| 155 | * It will be called by the constructor of the viewer and also be |
| 156 | * called by a hook funtion of the viewer to update its filter. |
| 157 | * @param main_win, the main window the viewer belongs to. |
| 158 | * @param filter, a pointer to a filter. |
| 159 | */ |
| 160 | |
| 161 | void GetFilter(MainWindow *main_win, Filter *filter); |
| 162 | |
| 163 | |
| 164 | /** |
| 165 | * Function to register a hook function for a viewer to set/update its |
| 166 | * time interval. |
| 167 | * It will be called by the constructor of the viewer. |
| 168 | * @param hook hook function of the viewer. |
| 169 | * @param hook_data hook data associated with the hook function. |
| 170 | * @param main_win the main window the viewer belongs to. |
| 171 | */ |
| 172 | |
| 173 | void RegUpdateTimeInterval(lttv_hook *hook, TimeInterval *hook_data, |
| 174 | MainWindow * main_win); |
| 175 | |
| 176 | |
| 177 | /** |
| 178 | * Function to unregister a viewer's hook function which is used to |
| 179 | * set/update the time interval of the viewer. |
| 180 | * It will be called by the destructor of the viewer. |
| 181 | * @param hook hook function of the viewer. |
| 182 | * @param hook_data hook data associated with the hook function. |
| 183 | * @param main_win the main window the viewer belongs to. |
| 184 | */ |
| 185 | |
| 186 | void UnregUpdateTimeInterval(lttv_hook *hook, TimeInterval *hook_data, |
| 187 | MainWindow * main_win); |
| 188 | |
| 189 | |
| 190 | /** |
| 191 | * Function to register a hook function for a viewer to set/update its |
| 192 | * traceset. |
| 193 | * It will be called by the constructor of the viewer. |
| 194 | * @param hook hook function of the viewer. |
| 195 | * @param hook_data hook data associated with the hook function. |
| 196 | * @param main_win the main window the viewer belongs to. |
| 197 | */ |
| 198 | |
| 199 | void RegUpdateTraceset(lttv_hook *hook, Traceset *hook_data, |
| 200 | MainWindow * main_win); |
| 201 | |
| 202 | |
| 203 | /** |
| 204 | * Function to unregister a viewer's hook function which is used to |
| 205 | * set/update the traceset of the viewer. |
| 206 | * It will be called by the destructor of the viewer. |
| 207 | * @param hook hook function of the viewer. |
| 208 | * @param hook_data hook data associated with the hook function. |
| 209 | * @param main_win the main window the viewer belongs to. |
| 210 | */ |
| 211 | |
| 212 | void UnregUpdateTraceset(lttv_hook *hook, Traceset *hook_data, |
| 213 | MainWindow * main_win); |
| 214 | |
| 215 | |
| 216 | /** |
| 217 | * Function to register a hook function for a viewer to set/update its |
| 218 | * filter. |
| 219 | * It will be called by the constructor of the viewer. |
| 220 | * @param hook hook function of the viewer. |
| 221 | * @param hook_data hook data associated with the hook function. |
| 222 | * @param main_win the main window the viewer belongs to. |
| 223 | */ |
| 224 | |
| 225 | void RegUpdateFilter(lttv_hook *hook, Filter *hook_data, |
| 226 | MainWindow *main_win); |
| 227 | |
| 228 | |
| 229 | /** |
| 230 | * Function to unregister a viewer's hook function which is used to |
| 231 | * set/update the filter of the viewer. |
| 232 | * It will be called by the destructor of the viewer. |
| 233 | * @param hook hook function of the viewer. |
| 234 | * @param hook_data hook data associated with the hook function. |
| 235 | * @param main_win the main window the viewer belongs to. |
| 236 | */ |
| 237 | |
| 238 | void UnregUpdateFilter(lttv_hook *hook, Filter *hook_data, |
| 239 | MainWindow * main_win); |
| 240 | |
| 241 | |
| 242 | /** |
| 243 | * Function to register a hook function for a viewer to set/update its |
| 244 | * current time. |
| 245 | * It will be called by the constructor of the viewer. |
| 246 | * @param hook hook function of the viewer. |
| 247 | * @param hook_data hook data associated with the hook function. |
| 248 | * @param main_win the main window the viewer belongs to. |
| 249 | */ |
| 250 | |
| 251 | void RegUpdateCurrentTime(lttv_hook *hook, ltt_time *hook_data, |
| 252 | MainWindow *main_win); |
| 253 | |
| 254 | |
| 255 | /** |
| 256 | * Function to unregister a viewer's hook function which is used to |
| 257 | * set/update the current time of the viewer. |
| 258 | * It will be called by the destructor of the viewer. |
| 259 | * @param hook hook function of the viewer. |
| 260 | * @param hook_data hook data associated with the hook function. |
| 261 | * @param main_win the main window the viewer belongs to. |
| 262 | */ |
| 263 | |
| 264 | void UnregUpdateCurrentTime(lttv_hook *hook, ltt_time *hook_data, |
| 265 | MainWindow * main_win); |
| 266 | |
| 267 | |