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