Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

G T K+ 101


Published on

Published in: Technology
  • Be the first to comment

G T K+ 101

  1. 1. Ahmed Mohamed Saeed GTK+ 101 Sun Campus Ambassador [email_address]
  2. 2. Agenda <ul><li>Introduction to GTK+
  3. 3. Why GTK+?
  4. 4. Supporting Libraries
  5. 5. GTK Applications Structure
  6. 6. GTK Setup and Compilation on NetBeans
  7. 7. Demo </li></ul>
  8. 8. Introduction
  9. 9. History <ul><li>GNU Image Manipulation Program ( GIMP ) </li><ul><li>Peter Mattis, Spencer Kimball, and Josh MacDonald (Class Project!!)
  10. 10. Motif
  11. 11. GTK </li></ul><li>GIMP ToolKit ( GTK)
  12. 12. Object Oriented and renamed GTK+. </li></ul>
  13. 13. What is GTK? <ul><li>“ GTK+ is a highly usable, feature rich toolkit for creating graphical user interfaces which boasts cross platform compatibility and an easy to use API. GTK+ it is written in C, but has bindings to many other popular programming languages”
  14. 14. LGPL
  15. 15. Part of the GNU Project
  16. 16. All written in C! </li></ul>
  17. 17. Features <ul><li>Stability
  18. 18. Cross Platform
  19. 19. Language Bindings
  20. 20. Mobile
  21. 21. Accommodating
  22. 22. Interfaces
  23. 23. Foundations </li></ul><ul> </ul>
  24. 24. Why GTK?
  25. 25. Did you see the features ?! Why GTK?
  26. 26. Where is GTK?
  27. 27. GTK Supporting Libraries
  28. 28. Glib <ul><li>GLib is a general-purpose utility library, which provides many useful data types, macros, type conversions, string utilities, file utilities, a main loop abstraction, and so on. It works on many UNIX-like platforms, Windows, OS/2 and BeOS. GLib is released under the GNU Library General Public License (GNU LGPL). </li></ul>
  29. 29. GObject <ul><li>A generic type system to register arbitrary single-inherited flat and deep derived types as well as interfaces for structured types. It takes care of creation, initialization and memory management of the assorted object and class structures, maintains parent/child relationships and deals with dynamic implementations of such types. That is, their type specific implementations are relocatable/unloadable during runtime.
  30. 30. A collection of fundamental type implementations, such as integers, doubles, enums and structured types, to name a few.
  31. 31. A sample fundamental type implementation to base object hierarchies upon - the GObject fundamental type. </li></ul>
  32. 32. Gobject (Cont'd) <ul><li>A signal system that allows very flexible user customization of virtual/overridable object methods and can serve as a powerful notification mechanism.
  33. 33. An extensible parameter/value system, supporting all the provided fundamental types that can be used to generically handle object properties or otherwise parameterized types. </li></ul>
  34. 34. GDK <ul><li>GIMP DrawingKit
  35. 35. Meant to deal with X Window System
  36. 36. Acts as an intermediate layer between GTK+ and Xlib </li></ul>
  37. 37. Pango and ATK <ul><li>Pango </li><ul><li>Texts and fonts rendering along with Cairo </li></ul><li>ATK </li><ul><li>Accessibility ToolKit </li></ul></ul>
  38. 38. GTK Applications Structure
  39. 39. GTK code anatomy <ul><li>Initialization
  40. 40. Main Event Loop
  41. 41. Data types
  42. 42. Call back functions </li></ul>
  43. 43. Initialization and the main event loop <ul><li>gtk_init() </li><ul><li>initializes the GTK environment
  44. 44. Should be called at the beginning of the program
  45. 45. Terminates the program if it failed to initialize the environment </li></ul><li>get_main() </li><ul><li>Starts the event loop that will check for the signals connected to the widgets </li></ul></ul>
  46. 46. Data Types (widgets hierarchy) <ul><li> </li></ul>
  47. 47. Call back functions <ul><li>Signals </li><ul><li>Widgets need to be notified if the user clicked, typed, etc.
  48. 48. g_signal_connect (G_OBJECT (window), &quot;destroy&quot;, G_CALLBACK (destroy), NULL); </li></ul><li>Call back functions </li><ul><li>Simply “Functions that signal handlers call in case that signal occurred” </li></ul></ul>
  49. 49. GTK Setup and Compilation on Netbeans/Ubuntu
  50. 50. Compilation Parameter <ul><li>Command Line Argument </li><ul><li>`pkg-config --cflags --libs gtk+-2.0`
  51. 51. Don't miss the “`” </li></ul></ul>
  52. 52. Demo 1 Setup and Configuration
  53. 53. Demo 2 GTK+ 2.0 Tutorial Code Samples walk through
  54. 54. THANK YOU! <ul><li>Ahmed Mohamed Saeed
  55. 55. Sun Campus Ambassador [email_address] </li></ul>GTK+ 101