5c7463ed |
1 | /*! \defgroup guiEvents libguiEvents: The GUI Events display plugin */ |
2 | /*\@{*/ |
3 | |
4 | /*! \file guiEvents.c |
5 | * \brief Graphical plugin for showing events. |
6 | * |
7 | * This plugin adds a Events Viewer functionnality to Linux TraceToolkit |
8 | * GUI when this plugin is loaded. The init and destroy functions add the |
9 | * viewer's insertion menu item and toolbar icon by calling gtkTraceSet's |
10 | * API functions. Then, when a viewer's object is created, the constructor |
11 | * creates ans register through API functions what is needed to interact |
12 | * with the TraceSet window. |
13 | * |
14 | * This plugin uses the gdk library to draw the events and gtk to interact |
15 | * with the user. |
16 | * |
17 | * Author : Mathieu Desnoyers, June 2003 |
18 | */ |
19 | |
20 | #include <glib.h> |
21 | #include <gmodule.h> |
22 | #include <gtk.h> |
23 | #include <gdk.h> |
24 | |
25 | #include <lttv/module.h> |
26 | |
27 | #include "guiEvents.h" |
28 | #include "icons/guiEventsInsert.xpm" |
29 | |
30 | //! Event Viewer's constructor |
31 | GtkWidget *guiEvents(GtkWidget *ParentWindow); |
32 | |
33 | //! Callback functions |
34 | gboolean |
35 | expose_event_callback (GtkWidget *widget, GdkEventExpose *event, gpointer data); |
36 | |
37 | /** |
38 | * plugin's init function |
39 | * |
40 | * This function initializes the Event Viewer functionnality through the |
41 | * gtkTraceSet API. |
42 | */ |
43 | G_MODULE_EXPORT void init() { |
44 | g_critical("GUI Event Viewer init()"); |
45 | |
46 | /* Register the toolbar insert button */ |
47 | ToolbarItemReg(guiEventsInsert_xpm, "Insert Event Viewer", guiEvent); |
48 | |
49 | /* Register the menu item insert entry */ |
50 | MenuItemReg("/", "Insert Event Viewer", guiEvent); |
51 | |
52 | } |
53 | |
54 | /** |
55 | * plugin's destroy function |
56 | * |
57 | * This function releases the memory reserved by the module and unregisters |
58 | * everything that has been registered in the gtkTraceSet API. |
59 | */ |
60 | G_MODULE_EXPORT void destroy() { |
61 | g_critical("GUI Event Viewer destroy()"); |
62 | |
63 | /* Unregister the toolbar insert button */ |
64 | ToolbarItemUnreg(guiEvent); |
65 | |
66 | /* Unregister the menu item insert entry */ |
67 | MenuItemUnreg(guiEvents); |
68 | } |
69 | |
70 | /** |
71 | * Event Viewer's constructor |
72 | * |
73 | * This constructor is given as a parameter to the menuitem and toolbar button |
74 | * registration. It creates the drawing widget. |
75 | * @param ParentWindow A pointer to the parent window. |
76 | * @return The widget created. |
77 | */ |
78 | static GtkWidget * |
79 | guiEvents(GtkWidget *ParentWindow) |
80 | { |
81 | GtkWidget *drawing_area = gtk_drawing_area_new (); |
82 | |
83 | g_signal_connect (G_OBJECT (drawing_area), "expose_event", |
84 | G_CALLBACK (expose_event_callback), NULL); |
85 | } |
86 | |
87 | |
88 | gboolean |
89 | expose_event_callback (GtkWidget *widget, GdkEventExpose *event, gpointer data) |
90 | { |
91 | |
92 | |
93 | } |
94 | |
95 | |
96 | /*\@}*/ |