• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
Basics of gtk_ilugc
 

Basics of gtk_ilugc

on

  • 982 views

Basics of GTK Programming in C Session by Karthik at Indian Linux Users Group, Chennai Monthly meet.

Basics of GTK Programming in C Session by Karthik at Indian Linux Users Group, Chennai Monthly meet.
http://www.ilugc.in/content/ilugc-monthly-meet-december-11-th

Statistics

Views

Total Views
982
Views on SlideShare
982
Embed Views
0

Actions

Likes
1
Downloads
33
Comments
0

0 Embeds 0

No embeds

Accessibility

Categories

Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

    Basics of gtk_ilugc Basics of gtk_ilugc Presentation Transcript

    • Basic GTK+ & GUI Designing K. Karthikeyan CDAC, Chennai
    • Introduction● Linux Desktop Environments – GNOME, KDE – KDEs dependency on Qt drives towards GNOME● GIMP - GNU Image Manipulation Program – Peter Mattis, Spencer Kimball, to replace motif – GIMP Tool Kit(GTK) – Object Oriented and renamed as GTK+
    • GTK+Cross platform graphical tool kit, used by GNOMEapplications.Part of GNU project, LGPLWritten in C and Language Bindings for– C++ gtkmm– Python pygtk– PHP php-gtk etc.,Latest stable version gtk+ 2.22.0
    • GTK+ and Supporting Libraries Glib – General Purpose utility library, Provides Cross platform interfaces, Abstract Data types Gobject – Provides Data types, signals, Object oriented Interfaces GDK – Graphics Library for X window system GdkPixbuf – provides functions for client side image manipulation Pango – Font and layout rendering ATK – Accessibility Tool Kit
    • GTK+ Widget HierarchyGtkObject GtkWidget GtkContainer GtkBin GtkWindow
    • What we need..● GCC compiler● Editor● Gtk+ and its dependent packages – libgtk2.0-dev, libgtk2.0-0, libglib2.0-dev, ...● Pkg-config package● How to check ● $pkg-config - -cflags gtk+-2.0 ● $pkg-config - -libs gtk+-2.0
    • GTK+ hello world window/*hello.c */#include <gtk/gtk.h>int main(int argc, char *argv[ ]){GtkWidget *window;gtk_init (&argc, &argv); /* Initialization */window = gtk_window_new (GTK_WINDOW_TOPLEVEL);gtk_window_set_title(GTK_WINDOW(window),"Hello World");gtk_widget_show(window);gtk_main (); /* Main Event loop */return 0;}
    • How to compile & Run “hello.c”● To Compile “gcc -Wall program.c -o executable_name `pkg- config --cflags --libs gtk+-2.0` “ -Wall - Enable all types of compiler warnings● To Run ./executable_name
    • Hands on... :)
    • Signal Connection & Callback function● Connecting a signal with a function g_signal_connect(gpointer, “signal name”, callback_handler, gpointer);● Callback function format return_type callback_function(GtkWidget *, ... ,gpointer)
    • Basic Widgets and Initialization● Label - gtk_label_new()● Buttons - gtk_button_new() and more● Box - gtk_hbox_new(), gtk_vbox_new()● Pane - gtk_hpane_new(), gtk_vpane_new()● Table - gtk_table_new()● Expander - gtk_expander_new() and more● Notebooks- gtk_note_book_new()
    • Basic Widgets and Initialization● Stock_Buttons● Toggle Button – 1. Toggle Button 2. Radio button 3. Check button● Text Entry – 1. Text Entry 2. Spin button● Scale – 1. Horizontal scale 2. Vertical scale
    • Some Important functions● GtkWidget ● gtk_widget_set_size_request ● gtk_widget_grab_focus ● gtk_widget_set_sensitive ● gtk_widget_destroy● GtkWindow ● gtk_window_set_default_size ● gtk_window_move ● gtk_window_resizable
    • Resources & References● Books ● Foundations of GTK+ Development – by Andrew Krause ● The Offical GNOME 2 Developers Guide -by Matthias Warkus● IRC Channels ● Server --> irc.gnome.org ● Channels – #gtk+, #gnome-india, #gnome-love, #nosip ...● Websites library.gnome.org, en.wikipedia.org, ...
    • Thank You.... !karthikeyank@cdacchn.inkarthikk5phy@gmail.com To Tweet : @karthik2u