Editing Legacy Maemo 5 Documentation/Graphical UI Tutorial/Introduction

Warning: You are not logged in. Your IP address will be recorded in this page's edit history.
The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.
Latest revision Your text
Line 1: Line 1:
{{Legacy documentation}}
{{Legacy documentation}}
 +
 +
=Introduction=
The following code examples are used in this chapter:
The following code examples are used in this chapter:
Line 9: Line 11:
Hildon is based on [http://www.gnome.org/ GNOME] technologies to a great extent. Compared to a GNOME desktop from a user interface point of view, Hildon is designed to provide a new desktop for mobile embedded devices. Therefore, it uses, for example, a lighter window manager called [http://matchbox-project.org/ Matchbox].
Hildon is based on [http://www.gnome.org/ GNOME] technologies to a great extent. Compared to a GNOME desktop from a user interface point of view, Hildon is designed to provide a new desktop for mobile embedded devices. Therefore, it uses, for example, a lighter window manager called [http://matchbox-project.org/ Matchbox].
-
Hildon is a user interface toolkit based on GTK+ that targets mobile devices. Hildon was originally developed by Nokia for the Maemo operating system that powered its Internet Tablet devices.
+
Hildon is a user interface toolkit based on GTK that targets mobile devices. Hildon was originally developed by Nokia for the Maemo operating system that powered its Internet Tablet devices.
Because of Maemo version 5.0 (also known as Fremantle), Hildon widgets are specially designed to be finger-friendly, that is, easily used on touch-screen devices. Hildon is published under the LGPL license which gives you the right to develop free and open source, as well as commercial software with Hildon without being charged for licenses or royalties.
Because of Maemo version 5.0 (also known as Fremantle), Hildon widgets are specially designed to be finger-friendly, that is, easily used on touch-screen devices. Hildon is published under the LGPL license which gives you the right to develop free and open source, as well as commercial software with Hildon without being charged for licenses or royalties.
Line 15: Line 17:
Because Hildon is based on GTK, it offers an object-oriented API, although written in C.
Because Hildon is based on GTK, it offers an object-oriented API, although written in C.
-
GTK+ is a library for creating user interfaces that is used in a number of important projects like GNOME. This topic includes many references to GTK and Glib. Glib is a library that offers functions to manage memory and data structures, as well as some replacements for standard calls in order to increase portability. For more information on GTK and Glib, see [http://www.gtk.org/documentation.html GTK and Glib documentation].
+
GTK is a library for creating user interfaces that is used in a number of important projects like GNOME. This topic includes many references to GTK and Glib. Glib is a library that offers functions to manage memory and data structures, as well as some replacements for standard calls in order to increase portability. For more information on GTK and Glib, see [http://www.gtk.org/documentation.html GTK and Glib documentation].
This document is intended for developers and covers the usage of Hildon to create graphical user interfaces. It starts from a simple "Hello World" program and expands to more complex examples, presenting a number of widgets and their usage to accomplish some tasks from a technical point of view. It enables you to understand the process of graphical user interface programming and build effective touch interfaces for mobile devices with Hildon.
This document is intended for developers and covers the usage of Hildon to create graphical user interfaces. It starts from a simple "Hello World" program and expands to more complex examples, presenting a number of widgets and their usage to accomplish some tasks from a technical point of view. It enables you to understand the process of graphical user interface programming and build effective touch interfaces for mobile devices with Hildon.
Line 22: Line 24:
== Desktop overview==
== Desktop overview==
-
 
This section gives a brief overview of the Hildon desktop area in order to give you a better understanding of the application domains and layout.
This section gives a brief overview of the Hildon desktop area in order to give you a better understanding of the application domains and layout.
Line 33: Line 34:
* F: Application area. Shows the actual application's contents.
* F: Application area. Shows the actual application's contents.
-
[[Image:desktop_overview.png|frame|center|alt=Screenshot of desktop|Desktop overview]]
+
[[Image: desktop_overview.png|400px]]
Note that the above explanation refers to the normal view of an application. When using an application on fullscreen mode, only the application area is shown. Also note that if an application has a toolbar widget, it is displayed at the very bottom of the application's area, both in normal and in fullscreen views.
Note that the above explanation refers to the normal view of an application. When using an application on fullscreen mode, only the application area is shown. Also note that if an application has a toolbar widget, it is displayed at the very bottom of the application's area, both in normal and in fullscreen views.
== Typical Maemo GUI Application ==
== Typical Maemo GUI Application ==
-
 
The following shows the components making up a typical GUI application developed for Maemo (starting from the bottom):
The following shows the components making up a typical GUI application developed for Maemo (starting from the bottom):
-
* '''C library''': Implements wrappers around the system calls to the kernel and a lot of other useful things. However, the libraries presented below also provide their own APIs to similar functions, so always check whether they can be used directly, and avoid doing POSIX-level and system-level calls if possible. This makes the application easier to debug, and in some cases easier understand. This library is used (indirectly at least) by every application running on any Linux-based system.
+
* '''C library'''<nowiki>: Implements wrappers around the system calls to the kernel and a lot of other useful things. However, the libraries presented below also provide their own APIs to similar functions, so always check whether they can be used directly, and avoid doing POSIX-level and system-level calls if possible. This makes the application easier to debug, and in some cases easier understand. This library is used (indirectly at least) by every application running on any Linux-based system. </nowiki>
-
* '''Xlib''': A library that allows an application to send graphics-related commands to the X server, and receive HID events from the server. Normally an application does not use Xlib API directly, but uses some easier toolkit instead, which in turn uses Xlib.  
+
* '''Xlib'''<nowiki>: A library that allows an application to send graphics-related commands to the X server, and receive HID events from the server. Normally an application does not use Xlib API directly, but uses some easier toolkit instead, which in turn uses Xlib. </nowiki>
-
* '''GLib''': A utility library that provides portable types, an object-oriented framework (GObject/GType), a general event mechanism (sometimes referred to as <code>GSignal</code>), common abstract data structure types like hash tables, linked lists, etc.
+
* '''GLib'''<nowiki>: A utility library that provides portable types, an object-oriented framework (GObject/GType), a general event mechanism (sometimes referred to as GSignal), common abstract data structure types like hash tables, linked lists, etc. </nowiki>
-
* '''GDK''': A library that abstracts the Xlib and provides a lot of convenience code to implement most common graphical operations. Used by an application wanting to implement drawing directly, for example in order to implement custom widgets. In theory, GDK is meant to be independent of graphics systems, which it mostly is. Complete abstraction, however, is not yet complete, but for now, the original Xlib target is enough. GDK uses GLib internally.
+
* '''GDK'''<nowiki>: A library that abstracts the Xlib and provides a lot of convenience code to implement most common graphical operations. Used by an application wanting to implement drawing directly, for example in order to implement custom widgets. In theory, GDK is meant to be independent of graphics systems, which it mostly is. Complete abstraction, however, is not yet complete, but for now, the original Xlib target is enough. GDK uses GLib internally. </nowiki>
-
* '''Pango''': A portable library designed to implement correct and flexible text layout for all languages. This is necessary to support the different text entry directions. Uses GLib and GDK. Used by GTK+ for all displayed text.
+
* '''Pango'''<nowiki>: A portable library designed to implement correct and flexible text layout for all languages. This is necessary to support the different text entry directions. Uses GLib and GDK. Used by GTK+ for all displayed text. </nowiki>
-
* '''ATK''': The Accessibility ToolKit. Provides generic methods by which an application can support people with special needs with respect to using computers.
+
* '''ATK'''<nowiki>: The Accessibility ToolKit. Provides generic methods by which an application can support people with special needs with respect to using computers. </nowiki>
-
* '''GTK+''': A library that provides a portable set of graphical elements, graphical area layout capabilities and interaction functions for applications. Graphical elements in GTK+ are called widgets. GTK+ also supports the notion of themes, which are user-switchable sets of graphics and behavior models. These are called skins in some other systems. Uses GLib, GDK, Pango and ATK.
+
* '''GTK+'''<nowiki>: A library that provides a portable set of graphical elements, graphical area layout capabilities and interaction functions for applications. Graphical elements in GTK+ are called widgets. GTK+ also supports the notion of themes, which are user-switchable sets of graphics and behavior models. These are called skins in some other systems. Uses GLib, GDK, Pango and ATK. </nowiki>
-
* '''Hildon''': A library containing widgets and themes designed specifically for Maemo. This is necessary because the screen has very high PPI (compared to PCs), and applications are sometimes controlled with a stylus. Uses all of the libraries above.
+
* '''Hildon'''<nowiki>: A library containing widgets and themes designed specifically for Maemo. This is necessary because the screen has very high PPI (compared to PCs), and applications are sometimes controlled with a stylus. Uses all of the libraries above. </nowiki>
* Other support libraries of interest:
* Other support libraries of interest:
-
** '''GConf''': A library from the GNOME project that allows applications to store and retrieve their settings in a consistent manner (in a way, similar to the registry in Windows). Uses GLib.
+
** '''GConf'''<nowiki>: A library from the GNOME project that allows applications to store and retrieve their settings in a consistent manner (in a way, similar to the registry in Windows). Uses GLib. </nowiki>
-
** '''GnomeVFS''': A library that provides a coherent set of file access functions, and implements those functions using plug-in libraries for different kinds of files and devices. Allows the application to ignore the semantics of implementations between different kinds of devices and services. By using GnomeVFS, an application does not need to care whether it reads a file from a web server (URLs are supported), from a compressed file archive (.zip, .rpm, .tar.gz, etc.) or from a memory card. Modeled to follow POSIX-style file and directory operations.
+
** '''GnomeVFS'''<nowiki>: A library that provides a coherent set of file access functions, and implements those functions using plug-in libraries for different kinds of files and devices. Allows the application to ignore the semantics of implementations between different kinds of devices and services. By using GnomeVFS, an application does not need to care whether it reads a file from a web server (URLs are supported), from a compressed file archive (.zip, .rpm, .tar.gz, etc.) or from a memory card. Modeled to follow POSIX-style file and directory operations. </nowiki>
-
** '''GDK-Pixbuf''': A library that implements various graphical bitmap formats and also alpha-channeled blending operations using 32-bit pixels (RGBA). The Application Framework uses pixbufs to implement the shadows and background picture scaling if necessary. Uses GLib and GDK.
+
** '''GDK-Pixbuf'''<nowiki>: A library that implements various graphical bitmap formats and also alpha-channeled blending operations using 32-bit pixels (RGBA). The Application Framework uses pixbufs to implement the shadows and background picture scaling if necessary. Uses GLib and GDK. </nowiki>
-
** '''LibOSSO''': A library specific to the Maemo platform, allowing an application to connect to D-Bus in a simple and consistent manner. Also provides an application state serialization mechanism. This mechanism can be used by an application to store its state, so that it can continue from the exact point in time when the user switched to another application. Useful to conserve battery life on portable devices.
+
** '''LibOSSO'''<nowiki>: A library specific to the Maemo platform, allowing an application to connect to D-Bus in a simple and consistent manner. Also provides an application state serialization mechanism. This mechanism can be used by an application to store its state, so that it can continue from the exact point in time when the user switched to another application. Useful to conserve battery life on portable devices. </nowiki>
-
There are some caveats related to API changes between major GTK+ versions, so do not copy and paste existing code blindly.
+
There are some caveats related to API changes between major GTK+ versions, so do not copy paste existing codes blindly.
<hr/>
<hr/>

Learn more about Contributing to the wiki.


Please note that all contributions to maemo.org wiki may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see maemo.org wiki:Copyrights for details). Do not submit copyrighted work without permission!


Cancel | Editing help (opens in new window)

Templates used on this page: