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