overview gui programming with gtk+ and glade 장정철
TRANSCRIPT
Overview
GUI Programming with GTK+ and GLADE 장정철
Overview – GTK+
• The GIMP ToolKit• the GNU LGPL 2.1• Base of GTK+• GLIB
• low-level core library – basis of GTK+• data structure, portability, event loop, thread, dynamic loading, object
• Pango• Layout and rendering of text• text and font handling
• Cairo• 2D graphics with support for multiple output devices
• ATK• Set of interface providing accessibility
Overview - GLADE
• User Interface Designer for GTK+ and GNOME• the GNU GPL• saved as XML• Generating C sources• using libglade, loaded by applications dynamically• Glade-3 is a complete rewrite• Useful new features
• Undo / Redo• Multiple project supportand
Environment - linux
Environment - linux
Sample – Linux
Environment – Win32
Environment – Win32
Sample – Win32
UI Design - GLADE
UI Design - GLADE
UI Dynamic Loading - libglade
• Simple usage1. Include header file libglade.h2. UI XML file open with function glade_xml_new3. get widget from XML with function glade_xml_get_widget4. Connect signal of loaded widget5. Linking with libglade
#include <glade/glade.h>#include <glade/glade-xml.h>sp_main_xml = glade_xml_new( UI_XML_FILE, NULL, NULL );sp_window = glade_xml_get_widget( sp_main_xml, "window_bm104" );g_signal_connect( G_OBJECT( sp_window ), "delete_event",
G_CALLBACK( on_window_exit ), NULL );
# gcc –o bm104 bm104.c ucs-utils.c ucs-cell-renderer.c `pkg-config –cflags –libs gtk+-2.0 libglade-2.0`
Languages
• not only support C• gtkmm for C++• java-gnome for JAVA• PyGTK for Python• gtk2-perl for Perl• RGtk2 for R• lua-gtk for Lua• gtkd for D• tGtk for Harbour(xHarbour)
Sample - gengdic
Sample – t-gtk with xHarbour