A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
display-functions.h
Go to the documentation of this file.
1/*
2 * SPDX-License-Identifier: GPL-2.0-only
3 *
4 * Authors: Faker Moatamri <faker.moatamri@sophia.inria.fr>
5 * Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
6 */
7#ifndef DISPLAY_FUNCTIONS_H
8#define DISPLAY_FUNCTIONS_H
9
10#include "model-node-creator.h"
12
13#include <gtk/gtk.h>
14
15namespace ns3
16{
17/**
18 * This function includes the name of the attribute or the editable value
19 * in the second column
20 *
21 * \param col Pointer to the GtkTreeViewColumn
22 * \param renderer Pointer to the GtkCellRenderer
23 * \param model Pointer to the GtkTreeModel
24 * \param iter Pointer to the GtkTreeIter
25 * \param user_data Pointer to the data to be displayed (or modified)
26 */
27void cell_data_function_col_1(GtkTreeViewColumn* col,
28 GtkCellRenderer* renderer,
29 GtkTreeModel* model,
30 GtkTreeIter* iter,
31 gpointer user_data);
32/**
33 * This function includes the name of the object, pointer, vector or vector item
34 * in the first column
35 * \param col Pointer to the GtkTreeViewColumn
36 * \param renderer Pointer to the GtkCellRenderer
37 * \param model Pointer to the GtkTreeModel
38 * \param iter Pointer to the GtkTreeIter
39 * \param user_data Pointer to the data to be displayed (or modified)
40 */
41void cell_data_function_col_0(GtkTreeViewColumn* col,
42 GtkCellRenderer* renderer,
43 GtkTreeModel* model,
44 GtkTreeIter* iter,
45 gpointer user_data);
46/**
47 * This is the callback called when the value of an attribute is changed
48 *
49 * \param cell the changed cell
50 * \param path_string the path
51 * \param new_text the updated text in the cell
52 * \param user_data user data
53 */
54void cell_edited_callback(GtkCellRendererText* cell,
55 gchar* path_string,
56 gchar* new_text,
57 gpointer user_data);
58/**
59 * This function gets the column number 0 or 1 from the mouse
60 * click
61 * \param col the column being clicked
62 * \returns the column index
63 */
64int get_col_number_from_tree_view_column(GtkTreeViewColumn* col);
65/**
66 * This function displays the tooltip for an object, pointer, vector
67 * item or an attribute
68 *
69 * \param widget is the display object
70 * \param x is the x position
71 * \param y is the y position
72 * \param keyboard_tip
73 * \param tooltip is the tooltip information to be displayed
74 * \param user_data
75 * \return false if the tooltip is not displayed
76 */
77gboolean cell_tooltip_callback(GtkWidget* widget,
78 gint x,
79 gint y,
80 gboolean keyboard_tip,
81 GtkTooltip* tooltip,
82 gpointer user_data);
83/**
84 * This is the main view opening the widget, getting tooltips and drawing the
85 * tree of attributes...
86 * \param model the GtkTreeStore model
87 * \returns a GtkWidget on success
88 */
89GtkWidget* create_view(GtkTreeStore* model);
90/**
91 * Exit the window when exit button is pressed
92 * \param button the pressed button
93 * \param user_data
94 */
95void exit_clicked_callback(GtkButton* button, gpointer user_data);
96/**
97 * Exit the application
98 * \param widget a pointer to the widget
99 * \param event the event responsible for the application exit
100 * \param user_data user data
101 * \returns true on clean exit
102 */
103gboolean delete_event_callback(GtkWidget* widget, GdkEvent* event, gpointer user_data);
104/**
105 * Delete the tree model contents
106 * \param model the GtkTreeModel
107 * \param path the GtkTreePath
108 * \param iter a GtkTreeIter
109 * \param data user data
110 * \return true if an error occurred.
111 */
112gboolean clean_model_callback(GtkTreeModel* model,
113 GtkTreePath* path,
114 GtkTreeIter* iter,
115 gpointer data);
116
117// display functions used by default configurator
118
119/**
120 * This function writes data in the second column, this data is going to be editable
121 * if it is a NODE_ATTRIBUTE
122 *
123 * \param col Pointer to the GtkTreeViewColumn
124 * \param renderer Pointer to the GtkCellRenderer
125 * \param model Pointer to the GtkTreeModel
126 * \param iter Pointer to the GtkTreeIter
127 * \param user_data Pointer to the data to be displayed (or modified)
128 */
129void cell_data_function_col_1_config_default(GtkTreeViewColumn* col,
130 GtkCellRenderer* renderer,
131 GtkTreeModel* model,
132 GtkTreeIter* iter,
133 gpointer user_data);
134/**
135 * This function writes the attribute or typeid name in the column 0
136 * \param col Pointer to the GtkTreeViewColumn
137 * \param renderer Pointer to the GtkCellRenderer
138 * \param model Pointer to the GtkTreeModel
139 * \param iter Pointer to the GtkTreeIter
140 * \param user_data Pointer to the data to be displayed (or modified)
141 */
142void cell_data_function_col_0_config_default(GtkTreeViewColumn* col,
143 GtkCellRenderer* renderer,
144 GtkTreeModel* model,
145 GtkTreeIter* iter,
146 gpointer user_data);
147/**
148 * This is the action done when the user presses on the save button for the Default attributes.
149 * It will save the config to a file.
150 *
151 * \param button (unused)
152 * \param user_data
153 */
154void save_clicked_default(GtkButton* button, gpointer user_data);
155/**
156 * If the user presses the button load, it will load the config file into memory for the Default
157 * attributes.
158 *
159 * \param button (unused)
160 * \param user_data
161 */
162void load_clicked_default(GtkButton* button, gpointer user_data);
163/**
164 * This is the action done when the user presses on the save button for the Attributes.
165 * It will save the config to a file.
166 *
167 * \param button (unused)
168 * \param user_data
169 */
170void save_clicked_attribute(GtkButton* button, gpointer user_data);
171/**
172 * If the user presses the button load, it will load the config file into memory for the Attributes.
173 *
174 * \param button (unused)
175 * \param user_data
176 */
177void load_clicked_attribute(GtkButton* button, gpointer user_data);
178/**
179 * This functions is called whenever there is a change in the value of an attribute
180 * If the input value is ok, it will be updated in the default value and in the
181 * GUI, otherwise, it won't be updated in both.
182 *
183 * \param cell the changed cell
184 * \param path_string the path
185 * \param new_text the updated text in the cell
186 * \param user_data user data
187 */
188void cell_edited_callback_config_default(GtkCellRendererText* cell,
189 gchar* path_string,
190 gchar* new_text,
191 gpointer user_data);
192/**
193 * This function is used to display a tooltip whenever the user puts the mouse
194 * over a type ID or an attribute. It will give the type and the possible values of
195 * an attribute value and the type of the object for an attribute object or a
196 * typeID object
197 *
198 * \param widget is the display object
199 * \param x is the x position
200 * \param y is the y position
201 * \param keyboard_tip
202 * \param tooltip is the tooltip information to be displayed
203 * \param user_data
204 * \return false if the tooltip is not displayed
205 */
206gboolean cell_tooltip_callback_config_default(GtkWidget* widget,
207 gint x,
208 gint y,
209 gboolean keyboard_tip,
210 GtkTooltip* tooltip,
211 gpointer user_data);
212/**
213 * This is the main view opening the widget, getting tooltips and drawing the
214 * tree of attributes
215 * \param model the GtkTreeStore model
216 * \returns a GtkWidget on success
217 */
218GtkWidget* create_view_config_default(GtkTreeStore* model);
219/**
220 * Delete the tree model contents
221 * \param model the GtkTreeModel
222 * \param path the GtkTreePath
223 * \param iter a GtkTreeIter
224 * \param data user data
225 * \return true if an error occurred.
226 */
227gboolean clean_model_callback_config_default(GtkTreeModel* model,
228 GtkTreePath* path,
229 GtkTreeIter* iter,
230 gpointer data);
231} // end namespace ns3
232
233#endif
Every class exported by the ns3 library is enclosed in the ns3 namespace.
void cell_data_function_col_1_config_default(GtkTreeViewColumn *col, GtkCellRenderer *renderer, GtkTreeModel *model, GtkTreeIter *iter, gpointer user_data)
This function writes data in the second column, this data is going to be editable if it is a NODE_ATT...
gboolean cell_tooltip_callback(GtkWidget *widget, gint x, gint y, gboolean keyboard_tip, GtkTooltip *tooltip, gpointer user_data)
This function displays the tooltip for an object, pointer, vector item or an attribute.
gboolean clean_model_callback(GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter, gpointer data)
Delete the tree model contents.
void cell_data_function_col_0_config_default(GtkTreeViewColumn *col, GtkCellRenderer *renderer, GtkTreeModel *model, GtkTreeIter *iter, gpointer user_data)
This function writes the attribute or typeid name in the column 0.
void cell_data_function_col_1(GtkTreeViewColumn *col, GtkCellRenderer *renderer, GtkTreeModel *model, GtkTreeIter *iter, gpointer user_data)
This function includes the name of the attribute or the editable value in the second column.
void cell_edited_callback(GtkCellRendererText *cell, gchar *path_string, gchar *new_text, gpointer user_data)
This is the callback called when the value of an attribute is changed.
void save_clicked_attribute(GtkButton *button, gpointer user_data)
This is the action done when the user presses on the save button for the Attributes.
gboolean cell_tooltip_callback_config_default(GtkWidget *widget, gint x, gint y, gboolean keyboard_tip, GtkTooltip *tooltip, gpointer user_data)
This function is used to display a tooltip whenever the user puts the mouse over a type ID or an attr...
gboolean delete_event_callback(GtkWidget *widget, GdkEvent *event, gpointer user_data)
Exit the application.
void exit_clicked_callback(GtkButton *button, gpointer user_data)
Exit the window when exit button is pressed.
GtkWidget * create_view_config_default(GtkTreeStore *model)
This is the main view opening the widget, getting tooltips and drawing the tree of attributes.
gboolean clean_model_callback_config_default(GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter, gpointer data)
Delete the tree model contents.
int get_col_number_from_tree_view_column(GtkTreeViewColumn *col)
This function gets the column number 0 or 1 from the mouse click.
GtkWidget * create_view(GtkTreeStore *model)
This is the main view opening the widget, getting tooltips and drawing the tree of attributes....
void cell_data_function_col_0(GtkTreeViewColumn *col, GtkCellRenderer *renderer, GtkTreeModel *model, GtkTreeIter *iter, gpointer user_data)
This function includes the name of the object, pointer, vector or vector item in the first column.
void cell_edited_callback_config_default(GtkCellRendererText *cell, gchar *path_string, gchar *new_text, gpointer user_data)
This functions is called whenever there is a change in the value of an attribute If the input value i...
void save_clicked_default(GtkButton *button, gpointer user_data)
This is the action done when the user presses on the save button for the Default attributes.
void load_clicked_default(GtkButton *button, gpointer user_data)
If the user presses the button load, it will load the config file into memory for the Default attribu...
void load_clicked_attribute(GtkButton *button, gpointer user_data)
If the user presses the button load, it will load the config file into memory for the Attributes.
uint8_t data[writeSize]