GTK + Programming.

Slides:



Advertisements
Similar presentations
What Was I Thinking??. Key Terms 1. Control 1. Control 2. Design Mode 2. Design Mode 3. Event 3. Event 4. Form 4. Form 5. Interface 5. Interface 6. Properties.
Advertisements

WEB DESIGN TABLES, PAGE LAYOUT AND FORMS. Page Layout Page Layout is an important part of web design Why do you think your page layout is important?
VISUAL BASIC Visual Basic is derived from the Basic language (Beginner’s All-Purpose Symbolic Instruction Code) Visual Basic uses an event-driven programming.
COMP 6703 Project A GUI Interface to the Gene Microarray Data Analysis Program SigMotif. Student: Ye Luo (u ) Clients: Professor Susan Wilson and.
A graphical user interface (GUI) is a pictorial interface to a program. A good GUI can make programs easier to use by providing them with a consistent.
Guide to Oracle10G1 Introduction To Forms Builder Chapter 5.
A Guide to Oracle9i1 Introduction To Forms Builder Chapter 5.
Client-side Applications with PHP Andrei Zmievski & Frank M. Kromann Track: PHP Conference Date: Friday, July 27 Time: 3:45pm – 4:30pm Location: Fairbanks.
Programming with Microsoft Visual Basic 2012 Chapter 12: Web Applications.
An Introduction to Visual Basic
Introduction to Visual Basic. Quick Links Windows Application Programming Event-Driven Application Becoming familiar with VB Control Objects Saving and.
Java Software Solutions Lewis and Loftus Chapter 10 1 Copyright 1997 by John Lewis and William Loftus. All rights reserved. Graphical User Interfaces --
Tutorial 7 Creating Forms. Objectives Session 7.1 – Create an HTML form – Insert fields for text – Add labels for form elements – Create radio buttons.
CHAPTER TWO INTRODUCTION TO VISUAL BASIC © Prepared By: Razif Razali 1.
1 Computer Science of Graphics and Games MONT 105S, Spring 2009 Session 20 Graphical User Interface (GUI)
Creating Graphical User Interfaces (GUI’s) with MATLAB By Jeffrey A. Webb OSU Gateway Coalition Member.
CC111 Lec7 : Visual Basic 1 Visual Basic(1) Lecture 7.
Dale Roberts Introduction to Visual Programming Dale Roberts, Lecturer Computer Science, IUPUI Department of Computer and.
How the Session Works Outline Practical on arrival Talk 1 Reflect on practical Clarify concepts Practical exercises at your own pace Talk 2: Further concepts.
GUI With GTK+ Under Linux Fanfan Xiong. Introduction GTK+ (GIMP toolkit) : A library for creating graphical user interfaces(GUI) Two examples developed.
CHAPTER:07 JAVA IDE PROGRAMMING-II Prepared By Prepared By : VINAY ALEXANDER ( विनय अलेक्सजेंड़र ) PGT(CS),KV JHAGRAKHAND.
Copyright © 2010 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Starting Out with Programming Logic & Design Second Edition by Tony Gaddis.
Copyright © 2015 Pearson Education, Inc. Publishing as Pearson Addison-Wesley C H A P T E R 13 GUI Programming.
Overview GUI Programming with GTK+ and GLADE 장정철.
GUIs Basic Concepts. GUI GUI : Graphical User Interface Window/Frame : a window on the screen Controls/Widgets : GUI components.
Chapter 5 Introduction To Form Builder. Lesson A Objectives  Display Forms Builder forms in a Web browser  Use a data block form to view, insert, update,
CMPF114 Computer Literacy Chapter 3 The Visual Basic Environment 1.
MATLAB and SimulinkLecture 61 To days Outline Graphical User Interface (GUI) Exercise on this days topics.
CIS 270—Application Development II Chapter 11—GUI Components: Part I.
DB Implementation: MS Access Forms. MS Access Forms: Purpose Data entry, editing, & viewing data in Tables Forms are user-friendlier to end-users than.
Gtk2 GTK+ (the GIMP ToolKit) Bratislava, Gtk2 - Overview Graphical toolkit native to X11 (Linux, Unix) Ported to Windows and OS X Written in C,
Writing Really Rad GTK+ & GNOME Applications in C, Python or Java
Visual Basic.NET Windows Programming
Working with Data Blocks and Frames
Chapter 9: Graphical User Interfaces
Working in the Forms Developer Environment
Topics Graphical User Interfaces Using the tkinter Module
Event Loops and GUI Intro2CS – weeks
Introduction to Computer CC111
Fedora Project / Red Hat
Chapter Topics 15.1 Graphical User Interfaces
CSE 333 – Section 4 HW3, MVC, GTK+.
Chapter 2 – Introduction to the Visual Studio .NET IDE
Event Driven Programming Dick Steflik
1. Introduction to Visual Basic
Understand Windows Forms Applications and Console-based Applications
GNOME/GTK+ Introduction
Ellen Walker Hiram College
Chap 7. Building Java Graphical User Interfaces
DB Implementation: MS Access Forms
GUI Using Python.
Graphical User Interfaces -- Introduction
Fundamentals of Python: From First Programs Through Data Structures
Event Driven Programming
Objectives Learn about Function procedures (functions), Sub procedures (subroutines), and modules Review and modify an existing subroutine in an event.
This Week: Tkinter for GUI Interfaces Some examples
Qt Programming.
Introduction to Computing Using Java
Chapter 2 – Introduction to the Visual Studio .NET IDE
Development The Foundation Window.
DB Implementation: MS Access Forms
The Basic Usage and The Event Handling in Glade.
Topics Graphical User Interfaces Using the tkinter Module
Chapter 15: GUI Applications & Event-Driven Programming
Chapter 4 Enhancing the Graphical User Interface
Tutorial 11 Using and Writing Visual Basic for Applications Code
Web Application Development Using PHP
TA: Nouf Al-Harbi NoufNaief.net :::
TA: Nouf Al-Harbi NoufNaief.net :::
Presentation transcript:

GTK + Programming

What is GTK+ program? The GTK+ is a library for creating graphical user interfaces. The library is created in C programming language. The GTK+ library is also called the GIMP Toolkit. Today, most of the GUI software in the open source world is created in Qt or in GTK+.

Cont.. The GTK+ is an object oriented application programming interface. The object oriented system is created with the Glib object system, which is a base for the GTK+ library. The GObject also enables to create language bindings for various other programming languages. Language bindings exist for C++, Python, Perl, Java, C# and other programming languages.

Libraries The GTK+ itself depends on the following libraries. Glib Pango ATK GDK GdkPixbuf Cairo

Cont.. Glib - a general purpose utility library. It provides various data types, string utilities, enables error reporting, message logging, working with threads and other useful programming features. Pango - a library which enables internationalization. ATK - accessibility toolkit. This toolkit provides tools which help physically challenged people work with computers.

Cont.. GDK - a wrapper around the low-level drawing and windowing functions provided by the underlying graphics system. On Linux, GDK lies between the X Server and the GTK+ library. GdkPixbuf library - toolkit for image loading and pixel buffer manipulation.  Cairo - a library for creating 2D vector graphics.

Compiling GTK+ applications To compile GTK+ applications, we have a handy tool called pkg-config. The pkg-config returns metadata about installed libraries. The pkg-config program retrieves information about packages from special metadata files. Command- gcc -o simple simple.c `pkg-config --libs --cflags gtk+-2.0`

First programs in GTK+ We will show a basic window. #include <gtk/gtk.h> int main( int argc, char *argv[]) { GtkWidget *window; gtk_init(&argc, &argv); window = gtk_window_new(GTK_WINDOW_TOPLEVEL); gtk_widget_show(window); gtk_main(); return 0; }

Explaination We create a GtkWindow widget. The window type is GTK_WINDOW_TOPLEVEL. Toplevel windows have a titlebar and a border. They are managed by the window manager. After we have created a widget, we must show it. Main code enters the GTK+ main loop. From this point, the application waits for events to happen.

GTK+ layout management When we design the GUI of our application, we decide what widgets we will use and how we will organize those widgets in the application. To organize our widgets, we use specialized non visible widgets called layout containers. They are  GtkAlignment, GtkFixed, GtkVBox and GtkTable.

GtkFixed, GtkVBox, GtkHBox The GtkFixed container places child widgets at fixed positions and with fixed sizes. This container performs no automatic layout management. For example games, specialized applications that work with diagrams, resizable components that can be moved (like a chart in a spreadsheet application), small educational examples. GtkVBox is a vertical box container. It places its child widgets into a single column.  GtkHBox  is a very similar container. This container places its child widgets into a single row.

GtkTable, GtkAlignment The GtkTable widget arranges widgets in rows and columns. The GtkAlignment container controls the alignment and the size of its child widget.

GTK+ events and signals GTK+ library is an event driven system. All GUI applications are event driven. If there is no event, the application waits and does nothing. In GTK+ an event is a message from the X server. When the event reaches a widget, it may react to this event by emitting a signal. The GTK+ programmer can connect a specific callback to a signal. The callback is a handler function, that reacts to a signal.

Ex: We have two signals. The clicked signal and the destroy signal. g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(button_clicked), NULL); We use the g_signal_connect() function to connect the clicked signal to the button_clicked() callback.

GTK+ dialogs A dialog is used to input data, modify data, change the application settings etc. Dialogs are important means of communication between a user and a computer program.

Cont.. Message dialogs GtkAboutDialog GtkFontSelectionDialog Message dialogs are convenient dialogs that provide messages to the user of the application.  GtkAboutDialog The GtkAboutDialog displays information about the application. GtkFontSelectionDialog The GtkFontSelectionDialog is a dialog for selecting fonts. GtkColorSelectionDialog GtkColorSelectionDialog is a dialog for selecting a color.

GTK+ Widgets Widgets are basic building blocks of a GUI application. For example a button, a check box or a scroll bar. The GTK+ toolkit's philosophy is to keep the number of widgets at a minimum level. More specialized widgets are created as custom GTK+ widgets.

Cont.. GtkButton GtkCheckButton GtkFrame GtkLabel GtkButton is a simple widget, that is used to trigger an action. GtkCheckButton GtkCheckButton is a widget, that has two states. On and Off. The On state is visualized by a check mark. GtkFrame GtkFrame is a bin with a decorative frame and optional label GtkLabel displays text.