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