GLADE is a RAD(Rapid Application Development) Tool which is used for quick and easy development of GUI for GTK+ toolkit and GNOME Desktop environment.
GUI designed by glade, can be saved in XML file (it can be saved in .C or .glade file also). Using GtkBuilder (A GTK+ object), this GUI xml can be loaded by applications dynamically.
By using GtkBuilder, Glade XML files can be used in numerous
programming languages
including C, C++, C#, Vala, Java, Perl, Python and others.
Building GUI using GtkBuilder in C-Program:
Assume we have designed a GUI using glade, which is saved as gem.glade /gem.xml /gem.c. Irrespective of their extensions all these files contains XML format strings/tags only, which contains information to build GUI. For example, if we consider gem.c file, it contains the code as shown below
gem.c
********
Now we send gui_buffer (see above code) as a parameter to GtkBuilder, which builds required GUI of our application. To access gui_buffer in any file make a declaration
extern const char *gui_buffer;
//Code to build gui by GtkBuilder
try {
widgets = Gtk::Builder::create_from_string(gui_buffer);
} catch (Gtk::BuilderError &e) {
printf("Error building GUI: %s\n", e.what().c_str());
exit(EXIT_FAILURE);
}
No comments:
Post a Comment