Gtk Marries Marries Ada Ada: : Gtk The GUI Technology The GUI - - PowerPoint PPT Presentation
Gtk Marries Marries Ada Ada: : Gtk The GUI Technology The GUI - - PowerPoint PPT Presentation
Gtk Marries Marries Ada Ada: : Gtk The GUI Technology The GUI Technology Revolution Revolution charlet@gnat.com Overview Overview History of GtkAda History of GtkAda GtkAda Features Features GtkAda Why Gtk Gtk Rather Than Other
Overview Overview
History of GtkAda History of GtkAda GtkAda GtkAda Features Features Why Why Gtk Gtk Rather Than Other Toolkits? Rather Than Other Toolkits? Why Why GtkAda GtkAda rather than rather than Gtk Gtk+? +?
GtkAda GtkAda -
- History
History
- The GIMP
The GIMP
– – GNU Photoshop clone GNU Photoshop clone
- The Gtk+ library
The Gtk+ library
– – Becomes independent Becomes independent
- GtkGlade: a Gtk+ GUI builder
GtkGlade: a Gtk+ GUI builder
- Gnome: a desktop manager
Gnome: a desktop manager
- GVD: the GNU Visual Debugger
GVD: the GNU Visual Debugger
GtkAda GtkAda Features Features
- High
High-
- level binding to the
level binding to the Gtk Gtk+ library + library
– – object
- bject-
- oriented
- riented
– – type safety type safety – – small and efficient small and efficient
- Highly portable
Highly portable
– – Unixes Unixes: : Linux Linux, Solaris, … , Solaris, … – – Windows Windows NT NT
- Native
Native
GtkAda Features (2) GtkAda Features (2)
- Event handling
Event handling
- Drawing services
Drawing services
– – Lines, rectangles, … Lines, rectangles, … – – OpenGL (3D graphics) OpenGL (3D graphics)
- Style support
Style support
- Large set of widgets
Large set of widgets
GtkAda GtkAda -
- Widget set
Widget set
- Two types of widgets
Two types of widgets
– – containers and visual containers and visual objects
- bjects
- About
About 100 100 widgets are widgets are provided provided
- High
High-
- level widgets
level widgets
– – notebook, text widget, tree, spin button, table, toolbar, ... notebook, text widget, tree, spin button, table, toolbar, ...
GtkAda GtkAda -
- Screenshots
Screenshots
- Ctree
Ctree
GtkAda GtkAda -
- Screenshots (2)
Screenshots (2)
- OpenGL
OpenGL
Why Gtk+? Why Gtk+?
- Portable
Portable
- Native
Native
- Extensible
Extensible
- Open Source
Open Source
- Actively developped
Actively developped
- Thread
Thread-
- safe
safe
Why Gtk+? (2) Why Gtk+? (2)
- High level widgets
High level widgets
- Easy to use scrolling capabilities
Easy to use scrolling capabilities
- Wide range of users
Wide range of users
- Very powerful layout capabilities
Very powerful layout capabilities
– – Complete set of containers Complete set of containers
- Powerful and easy to use GUI builder
Powerful and easy to use GUI builder
- Easy to bind
Easy to bind
The GUI Builder The GUI Builder
- Multi
Multi-
- language GUI builder
language GUI builder
– – Language Language-
- independent save file
independent save file (XML). (XML). – – Code Code-
- generation specific to each
generation specific to each language. language. – – Dynamic loading of XML files Dynamic loading of XML files
Why GtkAda? Why GtkAda?
- Compile time checks
Compile time checks
- Real Object Oriented hierarchy
Real Object Oriented hierarchy
- Code readability
Code readability
- Group most popular Gtk widgets
Group most popular Gtk widgets
- Can create new types and extend
Can create new types and extend widgets widgets
- More extensive documentation
More extensive documentation
#include <gtk/gtk.h> void main (int argc, char *argv[]) { GtkWidget *window; GtkWidget *button; gtk_init (&argc, &argv); window = gtk_window_new (GTK_WINDOW_TOPLEVEL); gtk_container_set_border_width (GTK_CONTAINER (window), 10); button = gtk_button_new_with_label ("Hello World"); gtk_container_add (GTK_CONTAINER (window), button); gtk_widget_show_all (window); gtk_main (); } #include <gtk/gtk.h> void main (int argc, char *argv[]) { GtkWidget *window; GtkWidget *button; gtk_init (&argc, &argv); window = gtk_window_new (GTK_WINDOW_TOPLEVEL); gtk_container_set_border_width (GTK_CONTAINER (window), 10); button = gtk_button_new_with_label ("Hello World"); gtk_container_add (GTK_CONTAINER (window), button); gtk_widget_show_all (window); gtk_main (); } with Gtk.Main; use Gtk.Main; with Gtk.Button; use Gtk.Button; with Gtk.Window; use Gtk.Window; with Gtk.Enums; use Gtk.Enums; procedure Hello is Window : Gtk_Window; Button : Gtk_Button; begin Init; Gtk_New (Window, Window_Toplevel); Set_Border_Width (Window, 10); Gtk_New (Button, "Hello World"); Add (Window, Button); Show_All (Window); Main; end Hello; with Gtk.Main; use Gtk.Main; with Gtk.Button; use Gtk.Button; with Gtk.Window; use Gtk.Window; with Gtk.Enums; use Gtk.Enums; procedure Hello is Window : Gtk_Window; Button : Gtk_Button; begin Init; Gtk_New (Window, Window_Toplevel); Set_Border_Width (Window, 10); Gtk_New (Button, "Hello World"); Add (Window, Button); Show_All (Window); Main; end Hello;
GtkAda vs Gtk+: Example GtkAda vs Gtk+: Example
GUI GUI Builder Builder Support with GtkAda Support with GtkAda
- Support built
Support built-
- in
in
- Takes
Takes advantage of object advantage of object-
- oriented
- riented
features. features.
– – Each widget generates its own Each widget generates its own code code
- Generated sources
Generated sources
– – easy to read sources (generates new easy to read sources (generates new composite widgets) composite widgets) – – sources can be modified and sources can be modified and regenerated regenerated
GtkAda GtkAda: a complete GUI Solution : a complete GUI Solution
- Portable
Portable
- Native
Native
- Easy to use
Easy to use
- Safe
Safe
- Object Oriented
Object Oriented
- Comes with a GUI builder
Comes with a GUI builder
- Same look
Same look-
- and
and-
- feel