A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
display-functions.cc
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
8#include "display-functions.h"
9
10#include "raw-text-config.h"
11
12#include "ns3/config.h"
13#include "ns3/pointer.h"
14#include "ns3/string.h"
15
16namespace ns3
17{
18/*
19 * This function includes the name of the attribute or the editable value
20 * in the second column
21 */
22void
23cell_data_function_col_1(GtkTreeViewColumn* col,
24 GtkCellRenderer* renderer,
25 GtkTreeModel* model,
26 GtkTreeIter* iter,
27 gpointer user_data)
28{
29 ModelNode* node = nullptr;
30 gtk_tree_model_get(model, iter, COL_NODE, &node, -1);
31 if (!node)
32 {
33 return;
34 }
36 {
37 StringValue str;
38 node->object->GetAttribute(node->name, str);
39 g_object_set(renderer, "text", str.Get().c_str(), nullptr);
40 g_object_set(renderer, "editable", TRUE, nullptr);
41 }
42 else
43 {
44 g_object_set(renderer, "text", "", nullptr);
45 g_object_set(renderer, "editable", FALSE, nullptr);
46 }
47}
48
49/*
50 * This function includes the name of the object, pointer, vector or vector item
51 * in the first column
52 */
53void
54cell_data_function_col_0(GtkTreeViewColumn* col,
55 GtkCellRenderer* renderer,
56 GtkTreeModel* model,
57 GtkTreeIter* iter,
58 gpointer user_data)
59{
60 ModelNode* node = nullptr;
61 gtk_tree_model_get(model, iter, COL_NODE, &node, -1);
62 g_object_set(renderer, "editable", FALSE, nullptr);
63 if (!node)
64 {
65 return;
66 }
67
68 switch (node->type)
69 {
71 g_object_set(renderer,
72 "text",
73 node->object->GetInstanceTypeId().GetName().c_str(),
74 nullptr);
75 break;
79 g_object_set(renderer, "text", node->name.c_str(), nullptr);
80 break;
82 std::stringstream oss;
83 oss << node->index;
84 g_object_set(renderer, "text", oss.str().c_str(), nullptr);
85 break;
86 }
87}
88
89/*
90 * This is the callback called when the value of an attribute is changed
91 */
92void
93cell_edited_callback(GtkCellRendererText* cell,
94 gchar* path_string,
95 gchar* new_text,
96 gpointer user_data)
97{
98 GtkTreeModel* model = GTK_TREE_MODEL(user_data);
99 GtkTreeIter iter;
100 gtk_tree_model_get_iter_from_string(model, &iter, path_string);
101 ModelNode* node = nullptr;
102 gtk_tree_model_get(model, &iter, COL_NODE, &node, -1);
103 if (!node)
104 {
105 return;
106 }
108 node->object->SetAttribute(node->name, StringValue(new_text));
109}
110
111/*
112 * This function gets the column number 0 or 1 from the mouse
113 * click
114 */
115int
117{
118 GList* cols;
119 int num;
120 g_return_val_if_fail(col != nullptr, -1);
121 g_return_val_if_fail(gtk_tree_view_column_get_tree_view(col) != nullptr, -1);
122 cols = gtk_tree_view_get_columns(GTK_TREE_VIEW(gtk_tree_view_column_get_tree_view(col)));
123 num = g_list_index(cols, (gpointer)col);
124 g_list_free(cols);
125 return num;
126}
127
128/*
129 * This function displays the tooltip for an object, pointer, vector
130 * item or an attribute
131 */
132gboolean
133cell_tooltip_callback(GtkWidget* widget,
134 gint x,
135 gint y,
136 gboolean keyboard_tip,
137 GtkTooltip* tooltip,
138 gpointer user_data)
139{
140 GtkTreeModel* model;
141 GtkTreeIter iter;
142 GtkTreeViewColumn* column;
143 if (!gtk_tree_view_get_tooltip_context(GTK_TREE_VIEW(widget),
144 &x,
145 &y,
146 keyboard_tip,
147 &model,
148 nullptr,
149 &iter))
150 {
151 return FALSE;
152 }
153 if (!gtk_tree_view_get_path_at_pos(GTK_TREE_VIEW(widget),
154 x,
155 y,
156 nullptr,
157 &column,
158 nullptr,
159 nullptr))
160 {
161 return FALSE;
162 }
163 int col = get_col_number_from_tree_view_column(column);
164
165 ModelNode* node = nullptr;
166 gtk_tree_model_get(model, &iter, COL_NODE, &node, -1);
167 if (!node)
168 {
169 return FALSE;
170 }
171
172 switch (node->type)
173 {
175 if (col == 0)
176 {
177 std::string tip =
178 "This object is of type " + node->object->GetInstanceTypeId().GetName();
179 gtk_tooltip_set_text(tooltip, tip.c_str());
180 return TRUE;
181 }
182 break;
184 if (col == 0)
185 {
186 PointerValue ptr;
187 node->object->GetAttribute(node->name, ptr);
188 std::string tip =
189 "This object is of type " + ptr.GetObject()->GetInstanceTypeId().GetName();
190 gtk_tooltip_set_text(tooltip, tip.c_str());
191 return TRUE;
192 }
193 break;
195 break;
197 if (col == 0)
198 {
199 std::string tip =
200 "This object is of type " + node->object->GetInstanceTypeId().GetName();
201 gtk_tooltip_set_text(tooltip, tip.c_str());
202 return TRUE;
203 }
204 break;
206 uint32_t attrIndex = 0;
207 TypeId tid;
208 for (tid = node->object->GetInstanceTypeId(); tid.HasParent(); tid = tid.GetParent())
209 {
210 for (uint32_t i = 0; i < tid.GetAttributeN(); ++i)
211 {
212 if (tid.GetAttribute(i).name == node->name)
213 {
214 attrIndex = i;
215 goto out;
216 }
217 }
218 }
219 out:
220 if (col == 0)
221 {
222 std::string tip = tid.GetAttribute(attrIndex).help;
223 gtk_tooltip_set_text(tooltip, tip.c_str());
224 }
225 else
226 {
227 TypeId::AttributeInformation info = tid.GetAttribute(attrIndex);
229 std::string tip;
230 tip = "This attribute is of type " + checker->GetValueTypeName();
231 if (checker->HasUnderlyingTypeInformation())
232 {
233 tip += " " + checker->GetUnderlyingTypeInformation();
234 }
235 gtk_tooltip_set_text(tooltip, tip.c_str());
236 }
237 return TRUE;
238 }
239 break;
240 }
241 return FALSE;
242}
243
244/*
245 * This is the main view opening the widget, getting tooltips and drawing the
246 * tree of attributes...
247 */
248GtkWidget*
249create_view(GtkTreeStore* model)
250{
251 GtkTreeViewColumn* col;
252 GtkCellRenderer* renderer;
253 GtkWidget* view;
254
255 view = gtk_tree_view_new();
256 g_object_set(view, "has-tooltip", TRUE, nullptr);
257 g_signal_connect(view, "query-tooltip", (GCallback)cell_tooltip_callback, 0);
258
259 gtk_tree_view_set_grid_lines(GTK_TREE_VIEW(view), GTK_TREE_VIEW_GRID_LINES_BOTH);
260 // gtk_tree_view_set_rules_hint (GTK_TREE_VIEW (view), TRUE);
261
262 col = gtk_tree_view_column_new();
263 gtk_tree_view_column_set_title(col, "Object Attributes");
264 gtk_tree_view_append_column(GTK_TREE_VIEW(view), col);
265 renderer = gtk_cell_renderer_text_new();
266 gtk_tree_view_column_pack_start(col, renderer, TRUE);
267 gtk_tree_view_column_set_cell_data_func(col,
268 renderer,
270 nullptr,
271 nullptr);
272 g_object_set(renderer, "editable", FALSE, nullptr);
273
274 col = gtk_tree_view_column_new();
275 gtk_tree_view_column_set_title(col, "Attribute Value");
276 gtk_tree_view_append_column(GTK_TREE_VIEW(view), col);
277 renderer = gtk_cell_renderer_text_new();
278 g_signal_connect(renderer, "edited", (GCallback)cell_edited_callback, model);
279 gtk_tree_view_column_pack_start(col, renderer, TRUE);
280 gtk_tree_view_column_set_cell_data_func(col,
281 renderer,
283 nullptr,
284 nullptr);
285
286 gtk_tree_view_set_model(GTK_TREE_VIEW(view), GTK_TREE_MODEL(model));
287
288 g_object_unref(model); /* destroy model automatically with view */
289
290 return view;
291}
292
293/*
294 * Exit the window when exit button is pressed
295 */
296void
297exit_clicked_callback(GtkButton* button, gpointer user_data)
298{
299 gtk_main_quit();
300 gtk_widget_hide(GTK_WIDGET(user_data));
301}
302
303/*
304 * Exit the application
305 */
306gboolean
307delete_event_callback(GtkWidget* widget, GdkEvent* event, gpointer user_data)
308{
309 gtk_main_quit();
310 gtk_widget_hide(GTK_WIDGET(user_data));
311 return TRUE;
312}
313
314/*
315 * Delete the tree model contents
316 */
317gboolean
318clean_model_callback(GtkTreeModel* model, GtkTreePath* path, GtkTreeIter* iter, gpointer data)
319{
320 ModelNode* node = nullptr;
321 gtk_tree_model_get(GTK_TREE_MODEL(model), iter, COL_NODE, &node, -1);
322 if (node)
323 {
324 delete node;
325 }
326 gtk_tree_store_set(GTK_TREE_STORE(model), iter, COL_NODE, nullptr, -1);
327 return FALSE;
328}
329
330// display functions used by default configurator
331/*
332 * This function writes data in the second column, this data is going to be editable
333 * if it is a NODE_ATTRIBUTE
334 */
335void
337 GtkCellRenderer* renderer,
338 GtkTreeModel* model,
339 GtkTreeIter* iter,
340 gpointer user_data)
341{
342 ModelTypeid* node = nullptr;
343 gtk_tree_model_get(model, iter, COL_TYPEID, &node, -1);
344 if (!node)
345 {
346 return;
347 }
349 {
350 g_object_set(renderer, "text", node->defaultValue.c_str(), nullptr);
351 g_object_set(renderer, "editable", TRUE, nullptr);
352 }
353 else
354 {
355 g_object_set(renderer, "text", "", nullptr);
356 g_object_set(renderer, "editable", FALSE, nullptr);
357 }
358}
359
360/*
361 * This function writes the attribute or typeid name in the column 0
362 */
363void
365 GtkCellRenderer* renderer,
366 GtkTreeModel* model,
367 GtkTreeIter* iter,
368 gpointer user_data)
369{
370 ModelTypeid* node = nullptr;
371 gtk_tree_model_get(model, iter, COL_NODE, &node, -1);
372 g_object_set(renderer, "editable", FALSE, nullptr);
373 if (!node)
374 {
375 return;
376 }
377
378 switch (node->type)
379 {
381 g_object_set(renderer, "text", node->tid.GetName().c_str(), nullptr);
382 break;
384 g_object_set(renderer, "text", node->name.c_str(), nullptr);
385 break;
386 }
387}
388
389/*
390 * This functions is called whenever there is a change in the value of an attribute
391 * If the input value is ok, it will be updated in the default value and in the
392 * gui, otherwise, it won't be updated in both.
393 */
394void
395cell_edited_callback_config_default(GtkCellRendererText* cell,
396 gchar* path_string,
397 gchar* new_text,
398 gpointer user_data)
399{
400 GtkTreeModel* model = GTK_TREE_MODEL(user_data);
401 GtkTreeIter iter;
402 gtk_tree_model_get_iter_from_string(model, &iter, path_string);
403 ModelTypeid* node = nullptr;
404 gtk_tree_model_get(model, &iter, COL_NODE, &node, -1);
405 if (!node)
406 {
407 return;
408 }
411 StringValue(new_text)))
412 {
413 node->defaultValue = new_text;
414 }
415}
416
417/*
418 * This function is used to display a tooltip whenever the user puts the mouse
419 * over a type ID or an attribute. It will give the type and the possible values of
420 * an attribute value and the type of the object for an attribute object or a
421 * typeID object
422 *
423 * \param widget is the display object
424 * \param x is the x position
425 * \param y is the y position
426 * \param keyboard_tip
427 * \param tooltip is the tooltip information to be displayed
428 * \param user_data
429 * \return false if the tooltip is not displayed
430 */
431gboolean
433 gint x,
434 gint y,
435 gboolean keyboard_tip,
436 GtkTooltip* tooltip,
437 gpointer user_data)
438{
439 GtkTreeModel* model;
440 GtkTreeIter iter;
441 GtkTreeViewColumn* column;
442 if (!gtk_tree_view_get_tooltip_context(GTK_TREE_VIEW(widget),
443 &x,
444 &y,
445 keyboard_tip,
446 &model,
447 nullptr,
448 &iter))
449 {
450 return FALSE;
451 }
452 if (!gtk_tree_view_get_path_at_pos(GTK_TREE_VIEW(widget),
453 x,
454 y,
455 nullptr,
456 &column,
457 nullptr,
458 nullptr))
459 {
460 return FALSE;
461 }
462 int col = get_col_number_from_tree_view_column(column);
463
464 ModelTypeid* node = nullptr;
465 gtk_tree_model_get(model, &iter, COL_NODE, &node, -1);
466 if (!node)
467 {
468 return FALSE;
469 }
470
471 switch (node->type)
472 {
474 if (col == 0)
475 {
476 std::string tip = "This object is of type " + node->tid.GetName();
477 gtk_tooltip_set_text(tooltip, tip.c_str());
478 return TRUE;
479 }
480 break;
482 uint32_t attrIndex = node->index;
483 if (col == 0)
484 {
485 std::string tip = node->tid.GetAttribute(attrIndex).help;
486 gtk_tooltip_set_text(tooltip, tip.c_str());
487 }
488 else
489 {
490 Ptr<const AttributeChecker> checker = node->tid.GetAttribute(attrIndex).checker;
491 std::string tip;
492 tip = "This attribute is of type " + checker->GetValueTypeName();
493 if (checker->HasUnderlyingTypeInformation())
494 {
495 tip += " " + checker->GetUnderlyingTypeInformation();
496 }
497 gtk_tooltip_set_text(tooltip, tip.c_str());
498 }
499 return TRUE;
500 }
501 break;
502 }
503 return FALSE;
504}
505
506/*
507 * This is the action done when the user presses on the save button.
508 * It will save the config to a file.
509 *
510 * \param button (unused)
511 * \param user_data
512 */
513void
514save_clicked_default(GtkButton* button, gpointer user_data)
515{
516 GtkWindow* parent_window = GTK_WINDOW(user_data);
517
518 GtkFileChooserNative* native;
519 GtkFileChooser* chooser;
520 GtkFileChooserAction action = GTK_FILE_CHOOSER_ACTION_SAVE;
521 gint res;
522
523 native = gtk_file_chooser_native_new("Save File", parent_window, action, "_Save", "_Cancel");
524 chooser = GTK_FILE_CHOOSER(native);
525
526 gtk_file_chooser_set_do_overwrite_confirmation(chooser, TRUE);
527
528 gtk_file_chooser_set_current_name(chooser, ("config-defaults.txt"));
529
530 res = gtk_native_dialog_run(GTK_NATIVE_DIALOG(native));
531 if (res == GTK_RESPONSE_ACCEPT)
532 {
533 char* filename;
534
535 filename = gtk_file_chooser_get_filename(chooser);
536 RawTextConfigSave config;
537 config.SetFilename(filename);
538 config.Default();
539 g_free(filename);
540 }
541
542 g_object_unref(native);
543}
544
545/*
546 * If the user presses the button load, it will load the config file into memory.
547 *
548 * \param button (unused)
549 * \param user_data
550 */
551void
552load_clicked_default(GtkButton* button, gpointer user_data)
553{
554 GtkWindow* parent_window = GTK_WINDOW(user_data);
555 GtkFileChooserNative* native;
556 GtkFileChooserAction action = GTK_FILE_CHOOSER_ACTION_OPEN;
557 gint res;
558
559 native = gtk_file_chooser_native_new("Open File", parent_window, action, "_Open", "_Cancel");
560
561 res = gtk_native_dialog_run(GTK_NATIVE_DIALOG(native));
562 if (res == GTK_RESPONSE_ACCEPT)
563 {
564 char* filename;
565 GtkFileChooser* chooser = GTK_FILE_CHOOSER(native);
566 filename = gtk_file_chooser_get_filename(chooser);
567 RawTextConfigLoad config;
568 config.SetFilename(filename);
569 config.Default();
570 g_free(filename);
571 }
572
573 g_object_unref(native);
574}
575
576/*
577 * This is the action done when the user presses on the save button.
578 * It will save the config to a file.
579 *
580 * \param button (unused)
581 * \param user_data
582 */
583void
584save_clicked_attribute(GtkButton* button, gpointer user_data)
585{
586 GtkWindow* parent_window = GTK_WINDOW(user_data);
587
588 GtkFileChooserNative* native;
589 GtkFileChooser* chooser;
590 GtkFileChooserAction action = GTK_FILE_CHOOSER_ACTION_SAVE;
591 gint res;
592
593 native = gtk_file_chooser_native_new("Save File", parent_window, action, "_Save", "_Cancel");
594 chooser = GTK_FILE_CHOOSER(native);
595
596 gtk_file_chooser_set_do_overwrite_confirmation(chooser, TRUE);
597
598 gtk_file_chooser_set_current_name(chooser, ("config-attributes.txt"));
599
600 res = gtk_native_dialog_run(GTK_NATIVE_DIALOG(native));
601 if (res == GTK_RESPONSE_ACCEPT)
602 {
603 char* filename;
604
605 filename = gtk_file_chooser_get_filename(chooser);
606 RawTextConfigSave config;
607 config.SetFilename(filename);
608 config.Attributes();
609 g_free(filename);
610 }
611
612 g_object_unref(native);
613}
614
615/*
616 * If the user presses the button load, it will load the config file into memory.
617 *
618 * \param button (unused)
619 * \param user_data
620 */
621void
622load_clicked_attribute(GtkButton* button, gpointer user_data)
623{
624 GtkWindow* parent_window = GTK_WINDOW(user_data);
625 GtkFileChooserNative* native;
626 GtkFileChooserAction action = GTK_FILE_CHOOSER_ACTION_OPEN;
627 gint res;
628
629 native = gtk_file_chooser_native_new("Open File", parent_window, action, "_Open", "_Cancel");
630
631 res = gtk_native_dialog_run(GTK_NATIVE_DIALOG(native));
632 if (res == GTK_RESPONSE_ACCEPT)
633 {
634 char* filename;
635 GtkFileChooser* chooser = GTK_FILE_CHOOSER(native);
636 filename = gtk_file_chooser_get_filename(chooser);
637 RawTextConfigLoad config;
638 config.SetFilename(filename);
639 config.Attributes();
640 g_free(filename);
641 }
642
643 g_object_unref(native);
644}
645
646/*
647 * This is the main view opening the widget, getting tooltips and drawing the
648 * tree of attributes
649 */
650GtkWidget*
651create_view_config_default(GtkTreeStore* model)
652{
653 GtkTreeViewColumn* col;
654 GtkCellRenderer* renderer;
655 GtkWidget* view;
656
657 view = gtk_tree_view_new();
658 g_object_set(view, "has-tooltip", TRUE, nullptr);
659 g_signal_connect(view, "query-tooltip", (GCallback)cell_tooltip_callback_config_default, 0);
660
661 gtk_tree_view_set_grid_lines(GTK_TREE_VIEW(view), GTK_TREE_VIEW_GRID_LINES_BOTH);
662 // gtk_tree_view_set_rules_hint (GTK_TREE_VIEW (view), TRUE);
663
664 col = gtk_tree_view_column_new();
665 gtk_tree_view_column_set_title(col, "Object Attributes");
666 gtk_tree_view_append_column(GTK_TREE_VIEW(view), col);
667 renderer = gtk_cell_renderer_text_new();
668 gtk_tree_view_column_pack_start(col, renderer, TRUE);
669 gtk_tree_view_column_set_cell_data_func(col,
670 renderer,
672 nullptr,
673 nullptr);
674 g_object_set(renderer, "editable", FALSE, nullptr);
675
676 col = gtk_tree_view_column_new();
677 gtk_tree_view_column_set_title(col, "Attribute Value");
678 gtk_tree_view_append_column(GTK_TREE_VIEW(view), col);
679 renderer = gtk_cell_renderer_text_new();
680 g_signal_connect(renderer, "edited", (GCallback)cell_edited_callback_config_default, model);
681 gtk_tree_view_column_pack_start(col, renderer, TRUE);
682 gtk_tree_view_column_set_cell_data_func(col,
683 renderer,
685 nullptr,
686 nullptr);
687
688 gtk_tree_view_set_model(GTK_TREE_VIEW(view), GTK_TREE_MODEL(model));
689
690 g_object_unref(model); /* destroy model automatically with view */
691
692 return view;
693}
694
695/*
696 * Delete the tree model contents
697 */
698gboolean
700 GtkTreePath* path,
701 GtkTreeIter* iter,
702 gpointer data)
703{
704 ModelTypeid* node = nullptr;
705 gtk_tree_model_get(GTK_TREE_MODEL(model), iter, COL_TYPEID, &node, -1);
706 if (node)
707 {
708 delete node;
709 }
710 gtk_tree_store_set(GTK_TREE_STORE(model), iter, COL_TYPEID, nullptr, -1);
711 return FALSE;
712}
713
714} // namespace ns3
void SetAttribute(std::string name, const AttributeValue &value)
Set a single attribute, raising fatal errors if unsuccessful.
void GetAttribute(std::string name, AttributeValue &value, bool permissive=false) const
Get the value of an attribute, raising fatal errors if unsuccessful.
TypeId GetInstanceTypeId() const override
Get the most derived TypeId for this Object.
Definition object.cc:83
AttributeValue implementation for Pointer.
Ptr< Object > GetObject() const
Get the Object referenced by the PointerValue.
Definition pointer.cc:46
Smart pointer class similar to boost::intrusive_ptr.
A class to enable loading of configuration store from a raw text file.
void SetFilename(std::string filename) override
Set the file name.
void Attributes() override
Load or save the attributes values.
void Default() override
Load or save the default values.
A class to enable saving of configuration store in a raw text file.
void Attributes() override
Load or save the attributes values.
void SetFilename(std::string filename) override
Set the file name.
void Default() override
Load or save the default values.
Hold variables of type string.
Definition string.h:45
a unique identifier for an interface.
Definition type-id.h:48
bool HasParent() const
Check if this TypeId has a parent.
Definition type-id.cc:1033
std::string GetAttributeFullName(std::size_t i) const
Get the Attribute name by index.
Definition type-id.cc:1185
std::size_t GetAttributeN() const
Get the number of attributes.
Definition type-id.cc:1170
TypeId GetParent() const
Get the parent of this TypeId.
Definition type-id.cc:1025
TypeId::AttributeInformation GetAttribute(std::size_t i) const
Get Attribute information by index.
Definition type-id.cc:1178
std::string GetName() const
Get the name.
Definition type-id.cc:1061
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file,...
Definition assert.h:55
bool SetDefaultFailSafe(std::string fullName, const AttributeValue &value)
Definition config.cc:893
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]
A class used in the implementation of the GtkConfigStore.
enum ns3::ModelNode::@1 type
node type structure
Ptr< Object > object
the object
uint32_t index
index
std::string name
node name
A class used in the implementation of the GtkConfigStore.
uint32_t index
stores the index of the attribute in list of attributes for a given TypeId
TypeId tid
The TypeId object and if it is an attribute, it's the TypeId object of the attribute.
enum ns3::ModelTypeid::@3 type
Whether the node represents an attribute or TypeId.
std::string defaultValue
TypeId default value.
std::string name
TypeId name.
Attribute implementation.
Definition type-id.h:70
std::string name
Attribute name.
Definition type-id.h:72
Ptr< const AttributeChecker > checker
Checker object.
Definition type-id.h:84
std::string help
Attribute help string.
Definition type-id.h:74