A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
gtk-config-store.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 "gtk-config-store.h"
9
10#include "display-functions.h"
11#include "raw-text-config.h"
12
13#include "ns3/log.h"
14
15#include <fstream>
16
17namespace ns3
18{
19
20NS_LOG_COMPONENT_DEFINE("GtkconfigStore");
21
25
26void
28{
29 // this function should be called before running the script to enable the user
30 // to configure the default values for the objects he wants to use
31 GtkWidget* window;
34
35 gtk_init(nullptr, nullptr);
37 gtk_window_set_title(GTK_WINDOW(window), "ns-3 Default attributes.");
38 gtk_window_set_default_size(GTK_WINDOW(window), 600, 600);
39
40 g_signal_connect(window, "delete_event", (GCallback)delete_event_callback, window);
44
46 scroll = gtk_scrolled_window_new(nullptr, nullptr);
48
60 GtkWidget* exit = gtk_button_new_with_label("Run Simulation");
63
65
66 gtk_widget_show_all(window);
67
68 gtk_main();
69
71
72 gtk_widget_destroy(window);
73}
74
75void
77{
78 GtkWidget* window;
81
82 gtk_init(nullptr, nullptr);
83
85 gtk_window_set_title(GTK_WINDOW(window), "ns-3 Object attributes.");
86 gtk_window_set_default_size(GTK_WINDOW(window), 600, 600);
87
88 g_signal_connect(window, "delete_event", (GCallback)delete_event_callback, window);
89
93
95 scroll = gtk_scrolled_window_new(nullptr, nullptr);
97
109 GtkWidget* exit = gtk_button_new_with_label("Run Simulation");
112
114
115 gtk_widget_show_all(window);
116
117 gtk_main();
118
120
121 gtk_widget_destroy(window);
122}
123
124} // namespace ns3
void ConfigureDefaults()
Process default values.
void ConfigureAttributes()
Process attribute values.
ModelCreator class.
void Build(GtkTreeStore *treestore)
Allocate attribute tree.
ModelTypeIdCreator class.
void Build(GtkTreeStore *treestore)
This method will iterate on typeIds having default attributes and create a model for them,...
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition log.h:191
Ptr< T > Create(Ts &&... args)
Create class instances by constructors with varying numbers of arguments and return them by Ptr.
Definition ptr.h:436
Every class exported by the ns3 library is enclosed in the ns3 namespace.
gboolean clean_model_callback(GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter, gpointer data)
Delete the tree model contents.
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 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.
GtkWidget * create_view(GtkTreeStore *model)
This is the main view opening the widget, getting tooltips and drawing the tree of attributes....
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.