25
Ahmed Mohamed Saeed Sun Campus Amba s s a do r . . Ahme d Sa e e d@Sun c om GTK+ 101

G T K+ 101

Embed Size (px)

Citation preview

Page 1: G T K+ 101

Ahmed Mohamed Saeed

Sun Campus Ambas s ador. .Ahmed Sae e d@Sun c om

GTK+ 101

Page 2: G T K+ 101

2

Agenda

Introduction to GTK+Why GTK+?Supporting LibrariesGTK Applications StructureGTK Setup and Compilation on NetBeansDemo

Page 3: G T K+ 101

3

Introduction

Page 4: G T K+ 101

4

History

GNU Image Manipulation Program (GIMP) Peter Mattis, Spencer Kimball, and Josh

MacDonald (Class Project!!)MotifGTK

GIMP ToolKit (GTK)Object Oriented and renamed GTK+.

Page 5: G T K+ 101

5

What is GTK?

“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” http://www.gtk.org

LGPL

Part of the GNU Project

All written in C!

Page 6: G T K+ 101

6

Features

Stability

Cross Platform

Language Bindings

Mobile

Accommodating

Interfaces

Foundations

http://www.gtk.org

Page 7: G T K+ 101

7

Why GTK?

Page 8: G T K+ 101

8

Did you see the features ?!

Why GTK?

Page 9: G T K+ 101

9

Where is GTK?

Page 10: G T K+ 101

10

GTK Supporting Libraries

Page 11: G T K+ 101

11

Glib

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).

Page 12: G T K+ 101

12

GObjectA 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.

A collection of fundamental type implementations, such as integers, doubles, enums and structured types, to name a few.

A sample fundamental type implementation to base object hierarchies upon - the GObject fundamental type.

Page 13: G T K+ 101

13

Gobject (Cont'd)

A signal system that allows very flexible user customization of virtual/overridable object methods and can serve as a powerful notification mechanism.

An extensible parameter/value system, supporting all the provided fundamental types that can be used to generically handle object properties or otherwise parameterized types.

Page 14: G T K+ 101

14

GDK

GIMP DrawingKitMeant to deal with X Window SystemActs as an intermediate layer between GTK+ and Xlib

Page 15: G T K+ 101

15

Pango and ATK

PangoTexts and fonts rendering along with Cairo

ATKAccessibility ToolKit

Page 16: G T K+ 101

16

GTK Applications Structure

Page 17: G T K+ 101

17

GTK code anatomy

InitializationMain Event LoopData types Call back functions

Page 18: G T K+ 101

18

Initialization and the main event loop

gtk_init() initializes the GTK environment Should be called at the beginning of the programTerminates the program if it failed to initialize the

environment

get_main()Starts the event loop that will check for the signals

connected to the widgets

Page 19: G T K+ 101

19

Data Types (widgets hierarchy)

http://www.gtk.org/tutorial1.2/gtk_tut-5.html

Page 20: G T K+ 101

20

Call back functions

SignalsWidgets need to be notified if the user clicked, typed, etc.g_signal_connect (G_OBJECT (window),

"destroy", G_CALLBACK (destroy),

NULL);

Call back functionsSimply “Functions that signal handlers call in case that

signal occurred”

Page 21: G T K+ 101

21

GTK Setup and Compilation on

Netbeans/Ubuntu

Page 22: G T K+ 101

22

Compilation Parameter

Command Line Argument`pkg-config --cflags --libs gtk+-2.0`Don't miss the “`”

Page 23: G T K+ 101

23

Demo 1Setup and Configuration

Page 24: G T K+ 101

24

Demo 2GTK+ 2.0 Tutorial Code Samples walk through

Page 25: G T K+ 101

THANK YOU!

Ahmed Mohamed SaeedSun Campus [email protected]

GTK+ 101