|
Packit |
1470ea |
|
|
Packit |
1470ea |
<page xmlns="http://projectmallard.org/1.0/" xmlns:its="http://www.w3.org/2005/11/its" type="topic" id="tech-gdk" xml:lang="ca">
|
|
Packit |
1470ea |
|
|
Packit |
1470ea |
<info>
|
|
Packit |
1470ea |
<link type="guide" xref="tech" group="gdk"/>
|
|
Packit |
1470ea |
<revision pkgversion="3.0" date="2011-04-05" status="candidate"/>
|
|
Packit |
1470ea |
|
|
Packit |
1470ea |
<credit type="author copyright">
|
|
Packit |
1470ea |
<name>Shaun McCance</name>
|
|
Packit |
1470ea |
<email its:translate="no">shaunm@gnome.org</email>
|
|
Packit |
1470ea |
<years>2011–2012</years>
|
|
Packit |
1470ea |
</credit>
|
|
Packit |
1470ea |
|
|
Packit |
1470ea |
<include xmlns="http://www.w3.org/2001/XInclude" href="cc-by-sa-3-0.xml"/>
|
|
Packit |
1470ea |
|
|
Packit |
1470ea |
<desc>Low-level abstraction for the windowing system</desc>
|
|
Packit |
1470ea |
</info>
|
|
Packit |
1470ea |
|
|
Packit |
1470ea |
<title>GDK</title>
|
|
Packit |
1470ea |
|
|
Packit |
1470ea |
GDK is the low-level library used by <link xref="tech-gtk">GTK+</link> to
|
|
Packit |
1470ea |
interact with the windowing system for graphics and input devices. Although
|
|
Packit |
1470ea |
you will rarely use GDK directly in application code, it contains all the
|
|
Packit |
1470ea |
necessary functionality to create low-level windows in the screen and to
|
|
Packit |
1470ea |
interact with the user with various input devices. GDK acts as an abstraction
|
|
Packit |
1470ea |
over various windowing systems, so that GTK+ can be portable to all of them:
|
|
Packit |
1470ea |
the X Window System (X11), Microsoft Windows, Mac OS X Quartz.
|
|
Packit |
1470ea |
|
|
Packit |
1470ea |
GDK enables you to access events from keyboards, mice, and other
|
|
Packit |
1470ea |
input devices. Implementations of widgets in GTK+ use this functionality, and
|
|
Packit |
1470ea |
translate the events into higher-level signals that can in turn be used from
|
|
Packit |
1470ea |
application code. For example, a GtkButton widget will track
|
|
Packit |
1470ea |
GDK_BUTTON_PRESS and GTK_BUTTON_RELEASE events,
|
|
Packit |
1470ea |
which come from the mouse, and translate them as appropriate into a
|
|
Packit |
1470ea |
GtkButton::clicked signal when the user presses and releases
|
|
Packit |
1470ea |
the button in the right location.
|
|
Packit |
1470ea |
|
|
Packit |
1470ea |
GDK also provides low-level routines to access drag and drop
|
|
Packit |
1470ea |
and clipboard data from the system. When implementing custom controls,
|
|
Packit |
1470ea |
you may need to access these features to implement proper user interaction
|
|
Packit |
1470ea |
behavior.
|
|
Packit |
1470ea |
|
|
Packit |
1470ea |
La GDK altres funcions necessàries per la creació d'un conjunt d'eines gràfiques com la GTK+. Com que la GDK serveix com a capa d'abstracció de la plataforma, i d'aquesta manera la GTK+ pot córrer en múltiples entorns, proporciona una API per a totes les funcions del sistema que necessita la GTK+. Això inclou informació sobre les pantalles, la seva resolució i profunditat de color, els mapes de colors i els cursors.
|
|
Packit |
1470ea |
|
|
Packit |
1470ea |
You should use GDK whenever you need low-level access to the underlying
|
|
Packit |
1470ea |
windowing system, including low-level access to events, windows, and the
|
|
Packit |
1470ea |
clipboard. Using GDK for these tasks ensures that your code is portable and
|
|
Packit |
1470ea |
integrates with the rest of your GTK+ code. The simple drawing routines in
|
|
Packit |
1470ea |
GDK should generally not be used; these are a left-over from when GDK simply
|
|
Packit |
1470ea |
wrapped the windowing system's drawing primitives. Instead, you should use
|
|
Packit |
1470ea |
the extensive functionality provided by <link xref="tech-cairo">Cairo</link>
|
|
Packit |
1470ea |
to draw high-quality 2D graphics.
|
|
Packit |
1470ea |
|
|
Packit |
1470ea |
<list style="compact">
|
|
Packit |
1470ea |
<item><link href="https://developer.gnome.org/gdk3/stable/">GDK Reference Manual</link> </item>
|
|
Packit |
1470ea |
</list>
|
|
Packit |
1470ea |
</page>
|