Compare commits
12 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 11140f8ba9 | |||
| ffd079a411 | |||
| 175f361d33 | |||
| 406d1981be | |||
| f0e7c9fc64 | |||
| 8017a12b46 | |||
| 1f7966c143 | |||
| a0950f0f54 | |||
| f618f781b9 | |||
| 5a11341c19 | |||
| 9c2dde1c27 | |||
| 23715e121a |
+2
-1
@@ -7,7 +7,6 @@ SUBDIRS = po po-properties $(SRC_SUBDIRS) docs m4macros build
|
||||
ACLOCAL_AMFLAGS = -I m4 ${ACLOCAL_FLAGS}
|
||||
|
||||
EXTRA_DIST += \
|
||||
autogen.sh \
|
||||
HACKING \
|
||||
makecopyright \
|
||||
NEWS.pre-1-0 \
|
||||
@@ -71,6 +70,8 @@ EXTRA_DIST += \
|
||||
examples/packbox/packbox.c \
|
||||
examples/paned/Makefile \
|
||||
examples/paned/paned.c \
|
||||
examples/pixmap/Makefile \
|
||||
examples/pixmap/pixmap.c \
|
||||
examples/progressbar/Makefile \
|
||||
examples/progressbar/progressbar.c \
|
||||
examples/radiobuttons/Makefile \
|
||||
|
||||
@@ -1,88 +1,3 @@
|
||||
Overview of Changes from GTK+ 2.90.7 to 2.91.0
|
||||
==============================================
|
||||
|
||||
* The rendering cleanup work has landed. This is a large change that
|
||||
affects many APIs.
|
||||
- All gtkstyle functions have been changed to take a cairo_t argument
|
||||
instead of a window + area.
|
||||
- GdkPixmap is gone. APIs that took pixmaps are being replaced by ones
|
||||
that take pixbufs or cairo surfaces, or regions (where pixmaps were
|
||||
used as masks). In background handling, pixmaps have been replaced
|
||||
by cairo patterns, see gdk_window_set_background_pattern().
|
||||
- GdkColormap is gone. It is replaced by visuals, see
|
||||
gtk_widget_set_visual().
|
||||
- The ::expose-event signal on GtkWidget has been replaced by a
|
||||
::draw signal.
|
||||
- gtk_widget_get_snapshot() has been removed. Instead, gtk_widget_draw()
|
||||
can render a widget onto an cairo_t.
|
||||
|
||||
* The GtkSizeRequest interface has been merged into GtkWidget, and
|
||||
GtkCellSizeRequest has been merged into GtkCellRenderer. The wrapper
|
||||
functions have been renamed to include 'preferred', e.g
|
||||
gtk_size_request_get_width() is now gtk_widget_get_preferred_width()
|
||||
and gtk_cell_size_request_get_width_for_height() is now
|
||||
gtk_cell_renderer_get_preferred_width_for_height().
|
||||
|
||||
* GtkObject has been removed. The ::destroy signal has been moved
|
||||
to GtkWidget. At the same time, GtkWidgetFlags have been removed,
|
||||
they already had getters and setters anyway.
|
||||
|
||||
* GtkWidget has gained generic alignment and padding properties:
|
||||
halign, valign, margin-left, margin-right, margin-top, margin-bottom
|
||||
These can be used instead of container-specific child properties or
|
||||
GtkMisc and GtkAlignment widgets.
|
||||
|
||||
* Container widgets can now let GTK+ handle border-width for them, using
|
||||
gtk_container_class_handle_border_width()
|
||||
|
||||
* The GtkEditableClass struct has been renamed to GtkEditableInterface
|
||||
|
||||
* Mouse wheel scrolling has been removed from GtkNotebook
|
||||
|
||||
* The default policy for scrolled windows has been changed to 'automatic'
|
||||
|
||||
* Global url hooks have been removed from GtkAboutDialog and GtkLinkButton
|
||||
|
||||
* The global window creation hook has been removed from GtkNotebook
|
||||
|
||||
* The error handling in GDK has been modernized and avoids synchronizing
|
||||
X requests as much as possible
|
||||
|
||||
* Fixed Bugs:
|
||||
323904 GtkEditable header is slightly incorrect
|
||||
339745 Return value of gtk_link_button_set_uri_hook not usable
|
||||
468672 GTK_POLICY_AUTOMATIC should be the default policy...
|
||||
486839 Filechooser 'Places' items should not move up and down...
|
||||
601731 Drag and Drop from Workspace to Activities Overview
|
||||
617316 Move documentation to inline comments: GtkEditable
|
||||
621590 Add length to gtk_tree_path_get_indices
|
||||
623664 Missing accessors for gtk_menu_get_position_func{,_data}
|
||||
628829 Chain get_width_for_height default impl to vfunc...
|
||||
629177 Do not use deprecated gtk_widget_get_child_requisition()
|
||||
629277 Hanging because do_syntheszie_crossing_event is called...
|
||||
629387 Use gint16 for GtkBorder
|
||||
629598 Do not use deprecated gtk_widget_size_request()
|
||||
629608 Revamp and modernize X error traps
|
||||
629733 There is a misprint in the description of the gtk_check_...
|
||||
629748 Fails to build without XComposite
|
||||
629785 Do not use deprecated gtk_cell_renderer_get_size()
|
||||
630033 Improve tests for X error traps, fix two bugs
|
||||
630226 Removing tab scrolling from GtkNotebook
|
||||
630520 Don't try to unref event->dnd.context unconditionally...
|
||||
630521 Remove some remaining API warts from tab dnd api
|
||||
630532 invalid drop point in drag-data-received callback
|
||||
|
||||
Updated translations:
|
||||
Catalan
|
||||
Czech
|
||||
Danish
|
||||
Dutch
|
||||
German
|
||||
Gujarati
|
||||
Japanese
|
||||
Simplified Chinese
|
||||
|
||||
|
||||
Overview of Changes from GTK+ 2.90.6 to 2.90.7
|
||||
==============================================
|
||||
|
||||
|
||||
+56
-5
@@ -11,8 +11,8 @@ AC_PREREQ([2.62])
|
||||
# set GTK_BINARY_AGE and GTK_INTERFACE_AGE to 0.
|
||||
|
||||
m4_define([gtk_major_version], [2])
|
||||
m4_define([gtk_minor_version], [91])
|
||||
m4_define([gtk_micro_version], [1])
|
||||
m4_define([gtk_minor_version], [90])
|
||||
m4_define([gtk_micro_version], [8])
|
||||
m4_define([gtk_interface_age], [0])
|
||||
m4_define([gtk_binary_age],
|
||||
[m4_eval(100 * gtk_minor_version + gtk_micro_version)])
|
||||
@@ -34,7 +34,7 @@ m4_define([gtk_binary_version], [3.0.0])
|
||||
m4_define([glib_required_version], [2.27.0])
|
||||
m4_define([pango_required_version], [1.20])
|
||||
m4_define([atk_required_version], [1.29.2])
|
||||
m4_define([cairo_required_version], [1.10.0])
|
||||
m4_define([cairo_required_version], [1.9.10])
|
||||
m4_define([gdk_pixbuf_required_version], [2.21.0])
|
||||
GLIB_REQUIRED_VERSION=glib_required_version
|
||||
PANGO_REQUIRED_VERSION=pango_required_version
|
||||
@@ -237,6 +237,10 @@ AC_ARG_ENABLE(debug,
|
||||
AC_HELP_STRING([--enable-debug=@<:@no/minimum/yes@:>@],
|
||||
[turn on debugging @<:@default=debug_default@:>@]),,
|
||||
enable_debug=debug_default)
|
||||
AC_ARG_ENABLE(shm,
|
||||
[AC_HELP_STRING([--enable-shm],
|
||||
[support shared memory if available [default=yes]])],,
|
||||
[enable_shm="yes"])
|
||||
AC_ARG_ENABLE(xkb,
|
||||
[AC_HELP_STRING([--enable-xkb],
|
||||
[support XKB [default=maybe]])],,
|
||||
@@ -362,7 +366,6 @@ PKG_CHECK_MODULES(BASE_DEPENDENCIES,
|
||||
atk >= atk_required_version dnl
|
||||
pango >= pango_required_version dnl
|
||||
cairo >= cairo_required_version dnl
|
||||
cairo-gobject >= cairo_required_version dnl
|
||||
gdk-pixbuf-2.0 >= gdk_pixbuf_required_version])
|
||||
|
||||
## In addition to checking that cairo is present, we also need to
|
||||
@@ -1036,6 +1039,54 @@ if test "x$gdktarget" = "xx11"; then
|
||||
|
||||
CFLAGS="$gtk_save_CFLAGS"
|
||||
|
||||
# Xshm checks
|
||||
|
||||
if test "x$enable_shm" = "xyes"; then
|
||||
# Check for the XShm extension, normally in Xext
|
||||
AC_CHECK_FUNC(XShmAttach,
|
||||
:,
|
||||
# On AIX, it is in XextSam instead
|
||||
[AC_CHECK_LIB(XextSam, XShmAttach,
|
||||
[GTK_ADD_LIB(x_extra_libs,XextSam)])])
|
||||
fi
|
||||
|
||||
if test "x$enable_shm" = "xyes"; then
|
||||
# Check for shared memory
|
||||
AC_CHECK_HEADER(sys/ipc.h,
|
||||
AC_DEFINE(HAVE_IPC_H, 1,
|
||||
[Define to 1 if ipc.h is available]),
|
||||
no_sys_ipc=yes)
|
||||
AC_CHECK_HEADER(sys/shm.h,
|
||||
AC_DEFINE(HAVE_SHM_H, 1,
|
||||
[Define to 1 if shm.h is available]),
|
||||
no_sys_shm=yes)
|
||||
|
||||
# Check for the X shared memory extension header file
|
||||
have_xshm=no
|
||||
AC_MSG_CHECKING(X11/extensions/XShm.h)
|
||||
if test "x$no_xext_lib" = "xyes"; then
|
||||
:
|
||||
else
|
||||
gtk_save_CFLAGS="$CFLAGS"
|
||||
CFLAGS="$CFLAGS $x_cflags"
|
||||
AC_TRY_COMPILE([
|
||||
#include <stdlib.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/ipc.h>
|
||||
#include <sys/shm.h>
|
||||
#include <X11/Xlib.h>
|
||||
#include <X11/Xutil.h>
|
||||
#include <X11/extensions/XShm.h>
|
||||
], [XShmSegmentInfo *x_shm_info;], have_xshm=yes)
|
||||
CFLAGS="$gtk_save_CFLAGS"
|
||||
fi
|
||||
AC_MSG_RESULT($have_xshm)
|
||||
if test $have_xshm = yes ; then
|
||||
AC_DEFINE(HAVE_XSHM_H, 1,
|
||||
[Define to 1 if xshm.h is available])
|
||||
fi
|
||||
fi
|
||||
|
||||
if test "x$enable_xinerama" = "xyes"; then
|
||||
# Check for Xinerama extension (Solaris impl or Xfree impl)
|
||||
gtk_save_cppflags="$CPPFLAGS"
|
||||
@@ -1277,7 +1328,7 @@ else
|
||||
LIBS="$gtk_save_LIBS"
|
||||
fi
|
||||
|
||||
GTK_PACKAGES="atk cairo cairo-gobject gdk-pixbuf-2.0 gio-2.0"
|
||||
GTK_PACKAGES="atk cairo gdk-pixbuf-2.0 gio-2.0"
|
||||
if test "x$gdktarget" = "xx11"; then
|
||||
GTK_PACKAGES="$GTK_PACKAGES pangoft2"
|
||||
fi
|
||||
|
||||
@@ -585,7 +585,7 @@ destroy_info (ChangeDisplayInfo *info)
|
||||
}
|
||||
|
||||
static void
|
||||
destroy_cb (GObject *object,
|
||||
destroy_cb (GtkObject *object,
|
||||
ChangeDisplayInfo **info)
|
||||
{
|
||||
destroy_info (*info);
|
||||
|
||||
@@ -15,16 +15,28 @@ static GtkWidget *frame;
|
||||
/* Expose callback for the drawing area
|
||||
*/
|
||||
static gboolean
|
||||
draw_callback (GtkWidget *widget,
|
||||
cairo_t *cr,
|
||||
gpointer data)
|
||||
expose_event_callback (GtkWidget *widget,
|
||||
GdkEventExpose *event,
|
||||
gpointer data)
|
||||
{
|
||||
GtkStyle *style;
|
||||
GdkWindow *window;
|
||||
|
||||
style = gtk_widget_get_style (widget);
|
||||
window = gtk_widget_get_window (widget);
|
||||
if (window)
|
||||
{
|
||||
GtkStyle *style;
|
||||
cairo_t *cr;
|
||||
|
||||
gdk_cairo_set_source_color (cr, &style->bg[GTK_STATE_NORMAL]);
|
||||
cairo_paint (cr);
|
||||
style = gtk_widget_get_style (widget);
|
||||
|
||||
cr = gdk_cairo_create (window);
|
||||
|
||||
gdk_cairo_set_source_color (cr, &style->bg[GTK_STATE_NORMAL]);
|
||||
gdk_cairo_rectangle (cr, &event->area);
|
||||
cairo_fill (cr);
|
||||
|
||||
cairo_destroy (cr);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
@@ -100,8 +112,8 @@ do_colorsel (GtkWidget *do_widget)
|
||||
|
||||
da = gtk_drawing_area_new ();
|
||||
|
||||
g_signal_connect (da, "draw",
|
||||
G_CALLBACK (draw_callback), NULL);
|
||||
g_signal_connect (da, "expose_event",
|
||||
G_CALLBACK (expose_event_callback), NULL);
|
||||
|
||||
/* set a minimum size */
|
||||
gtk_widget_set_size_request (da, 200, 200);
|
||||
|
||||
@@ -51,12 +51,19 @@ scribble_configure_event (GtkWidget *widget,
|
||||
|
||||
/* Redraw the screen from the surface */
|
||||
static gboolean
|
||||
scribble_draw (GtkWidget *widget,
|
||||
cairo_t *cr,
|
||||
gpointer data)
|
||||
scribble_expose_event (GtkWidget *widget,
|
||||
GdkEventExpose *event,
|
||||
gpointer data)
|
||||
{
|
||||
cairo_t *cr;
|
||||
|
||||
cr = gdk_cairo_create (gtk_widget_get_window (widget));
|
||||
|
||||
cairo_set_source_surface (cr, surface, 0, 0);
|
||||
cairo_paint (cr);
|
||||
gdk_cairo_rectangle (cr, &event->area);
|
||||
cairo_fill (cr);
|
||||
|
||||
cairo_destroy (cr);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
@@ -137,38 +144,45 @@ scribble_motion_notify_event (GtkWidget *widget,
|
||||
|
||||
|
||||
static gboolean
|
||||
checkerboard_draw (GtkWidget *da,
|
||||
cairo_t *cr,
|
||||
gpointer data)
|
||||
checkerboard_expose (GtkWidget *da,
|
||||
GdkEventExpose *event,
|
||||
gpointer data)
|
||||
{
|
||||
gint i, j, xcount, ycount, width, height;
|
||||
GtkAllocation allocation;
|
||||
gint i, j, xcount, ycount;
|
||||
cairo_t *cr;
|
||||
|
||||
#define CHECK_SIZE 10
|
||||
#define SPACING 2
|
||||
|
||||
/* At the start of a draw handler, a clip region has been set on
|
||||
* the Cairo context, and the contents have been cleared to the
|
||||
/* At the start of an expose handler, a clip region of event->area
|
||||
* is set on the window, and event->area has been cleared to the
|
||||
* widget's background color. The docs for
|
||||
* gdk_window_begin_paint_region() give more details on how this
|
||||
* works.
|
||||
*/
|
||||
|
||||
cr = gdk_cairo_create (gtk_widget_get_window (da));
|
||||
gdk_cairo_rectangle (cr, &event->area);
|
||||
cairo_clip (cr);
|
||||
|
||||
gtk_widget_get_allocation (da, &allocation);
|
||||
xcount = 0;
|
||||
width = gtk_widget_get_allocated_width (da);
|
||||
height = gtk_widget_get_allocated_height (da);
|
||||
i = SPACING;
|
||||
while (i < width)
|
||||
while (i < allocation.width)
|
||||
{
|
||||
j = SPACING;
|
||||
ycount = xcount % 2; /* start with even/odd depending on row */
|
||||
while (j < height)
|
||||
while (j < allocation.height)
|
||||
{
|
||||
if (ycount % 2)
|
||||
cairo_set_source_rgb (cr, 0.45777, 0, 0.45777);
|
||||
else
|
||||
cairo_set_source_rgb (cr, 1, 1, 1);
|
||||
|
||||
/* If we're outside the clip, this will do nothing.
|
||||
/* If we're outside event->area, this will do nothing.
|
||||
* It might be mildly more efficient if we handled
|
||||
* the clipping ourselves, but again we're feeling lazy.
|
||||
*/
|
||||
cairo_rectangle (cr, i, j, CHECK_SIZE, CHECK_SIZE);
|
||||
cairo_fill (cr);
|
||||
@@ -181,6 +195,8 @@ checkerboard_draw (GtkWidget *da,
|
||||
++xcount;
|
||||
}
|
||||
|
||||
cairo_destroy (cr);
|
||||
|
||||
/* return TRUE because we've handled this event, so no
|
||||
* further processing is required.
|
||||
*/
|
||||
@@ -239,8 +255,8 @@ do_drawingarea (GtkWidget *do_widget)
|
||||
|
||||
gtk_container_add (GTK_CONTAINER (frame), da);
|
||||
|
||||
g_signal_connect (da, "draw",
|
||||
G_CALLBACK (checkerboard_draw), NULL);
|
||||
g_signal_connect (da, "expose-event",
|
||||
G_CALLBACK (checkerboard_expose), NULL);
|
||||
|
||||
/*
|
||||
* Create the scribble area
|
||||
@@ -263,8 +279,8 @@ do_drawingarea (GtkWidget *do_widget)
|
||||
|
||||
/* Signals used to handle backing surface */
|
||||
|
||||
g_signal_connect (da, "draw",
|
||||
G_CALLBACK (scribble_draw), NULL);
|
||||
g_signal_connect (da, "expose-event",
|
||||
G_CALLBACK (scribble_expose_event), NULL);
|
||||
g_signal_connect (da,"configure-event",
|
||||
G_CALLBACK (scribble_configure_event), NULL);
|
||||
|
||||
|
||||
@@ -261,7 +261,7 @@ start_progressive_loading (GtkWidget *image)
|
||||
}
|
||||
|
||||
static void
|
||||
cleanup_callback (GObject *object,
|
||||
cleanup_callback (GtkObject *object,
|
||||
gpointer data)
|
||||
{
|
||||
if (load_timeout)
|
||||
|
||||
@@ -223,6 +223,7 @@ static gchar *types[] =
|
||||
"FALSE",
|
||||
"TRUE",
|
||||
"FILE ",
|
||||
"GtkObject ",
|
||||
"GtkColorSelection ",
|
||||
"GtkWidget ",
|
||||
"GtkButton ",
|
||||
|
||||
@@ -45,8 +45,8 @@ static void gtk_rotated_bin_size_allocate (GtkWidget *widget,
|
||||
GtkAllocation *allocation);
|
||||
static gboolean gtk_rotated_bin_damage (GtkWidget *widget,
|
||||
GdkEventExpose *event);
|
||||
static gboolean gtk_rotated_bin_draw (GtkWidget *widget,
|
||||
cairo_t *cr);
|
||||
static gboolean gtk_rotated_bin_expose (GtkWidget *widget,
|
||||
GdkEventExpose *offscreen);
|
||||
|
||||
static void gtk_rotated_bin_add (GtkContainer *container,
|
||||
GtkWidget *child);
|
||||
@@ -150,7 +150,7 @@ gtk_rotated_bin_class_init (GtkRotatedBinClass *klass)
|
||||
widget_class->unrealize = gtk_rotated_bin_unrealize;
|
||||
widget_class->size_request = gtk_rotated_bin_size_request;
|
||||
widget_class->size_allocate = gtk_rotated_bin_size_allocate;
|
||||
widget_class->draw = gtk_rotated_bin_draw;
|
||||
widget_class->expose_event = gtk_rotated_bin_expose;
|
||||
|
||||
g_signal_override_class_closure (g_signal_lookup ("damage-event", GTK_TYPE_WIDGET),
|
||||
GTK_TYPE_ROTATED_BIN,
|
||||
@@ -252,9 +252,10 @@ gtk_rotated_bin_realize (GtkWidget *widget)
|
||||
| GDK_LEAVE_NOTIFY_MASK;
|
||||
|
||||
attributes.visual = gtk_widget_get_visual (widget);
|
||||
attributes.colormap = gtk_widget_get_colormap (widget);
|
||||
attributes.wclass = GDK_INPUT_OUTPUT;
|
||||
|
||||
attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL;
|
||||
attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP;
|
||||
|
||||
window = gdk_window_new (gtk_widget_get_parent_window (widget),
|
||||
&attributes, attributes_mask);
|
||||
@@ -391,7 +392,7 @@ gtk_rotated_bin_size_request (GtkWidget *widget,
|
||||
child_requisition.height = 0;
|
||||
|
||||
if (bin->child && gtk_widget_get_visible (bin->child))
|
||||
gtk_widget_get_preferred_size ( (bin->child),
|
||||
gtk_size_request_get_size (GTK_SIZE_REQUEST (bin->child),
|
||||
&child_requisition, NULL);
|
||||
|
||||
s = sin (bin->angle);
|
||||
@@ -434,8 +435,8 @@ gtk_rotated_bin_size_allocate (GtkWidget *widget,
|
||||
s = sin (bin->angle);
|
||||
c = cos (bin->angle);
|
||||
|
||||
gtk_widget_get_preferred_size (bin->child,
|
||||
&child_requisition, NULL);
|
||||
gtk_size_request_get_size (GTK_SIZE_REQUEST (bin->child),
|
||||
&child_requisition, NULL);
|
||||
child_allocation.x = 0;
|
||||
child_allocation.y = 0;
|
||||
child_allocation.height = child_requisition.height;
|
||||
@@ -470,60 +471,65 @@ gtk_rotated_bin_damage (GtkWidget *widget,
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gtk_rotated_bin_draw (GtkWidget *widget,
|
||||
cairo_t *cr)
|
||||
gtk_rotated_bin_expose (GtkWidget *widget,
|
||||
GdkEventExpose *event)
|
||||
{
|
||||
GtkRotatedBin *bin = GTK_ROTATED_BIN (widget);
|
||||
GdkWindow *window;
|
||||
gint width, height;
|
||||
gdouble s, c;
|
||||
gdouble w, h;
|
||||
|
||||
window = gtk_widget_get_window (widget);
|
||||
if (gtk_cairo_should_draw_window (cr, window))
|
||||
if (gtk_widget_is_drawable (widget))
|
||||
{
|
||||
cairo_surface_t *surface;
|
||||
GtkAllocation child_area;
|
||||
|
||||
if (bin->child && gtk_widget_get_visible (bin->child))
|
||||
window = gtk_widget_get_window (widget);
|
||||
if (event->window == window)
|
||||
{
|
||||
surface = gdk_offscreen_window_get_surface (bin->offscreen_window);
|
||||
gtk_widget_get_allocation (bin->child, &child_area);
|
||||
GdkPixmap *pixmap;
|
||||
GtkAllocation child_area;
|
||||
cairo_t *cr;
|
||||
|
||||
/* transform */
|
||||
s = sin (bin->angle);
|
||||
c = cos (bin->angle);
|
||||
w = c * child_area.width + s * child_area.height;
|
||||
h = s * child_area.width + c * child_area.height;
|
||||
if (bin->child && gtk_widget_get_visible (bin->child))
|
||||
{
|
||||
pixmap = gdk_offscreen_window_get_pixmap (bin->offscreen_window);
|
||||
gtk_widget_get_allocation (bin->child, &child_area);
|
||||
|
||||
cairo_translate (cr, (w - child_area.width) / 2, (h - child_area.height) / 2);
|
||||
cairo_translate (cr, child_area.width / 2, child_area.height / 2);
|
||||
cairo_rotate (cr, bin->angle);
|
||||
cairo_translate (cr, -child_area.width / 2, -child_area.height / 2);
|
||||
cr = gdk_cairo_create (window);
|
||||
|
||||
/* clip */
|
||||
cairo_rectangle (cr,
|
||||
0, 0,
|
||||
gdk_window_get_width (bin->offscreen_window),
|
||||
gdk_window_get_height (bin->offscreen_window));
|
||||
cairo_clip (cr);
|
||||
/* paint */
|
||||
cairo_set_source_surface (cr, surface, 0, 0);
|
||||
cairo_paint (cr);
|
||||
/* transform */
|
||||
s = sin (bin->angle);
|
||||
c = cos (bin->angle);
|
||||
w = c * child_area.width + s * child_area.height;
|
||||
h = s * child_area.width + c * child_area.height;
|
||||
|
||||
cairo_translate (cr, (w - child_area.width) / 2, (h - child_area.height) / 2);
|
||||
cairo_translate (cr, child_area.width / 2, child_area.height / 2);
|
||||
cairo_rotate (cr, bin->angle);
|
||||
cairo_translate (cr, -child_area.width / 2, -child_area.height / 2);
|
||||
|
||||
/* clip */
|
||||
gdk_drawable_get_size (pixmap, &width, &height);
|
||||
cairo_rectangle (cr, 0, 0, width, height);
|
||||
cairo_clip (cr);
|
||||
/* paint */
|
||||
gdk_cairo_set_source_pixmap (cr, pixmap, 0, 0);
|
||||
cairo_paint (cr);
|
||||
|
||||
cairo_destroy (cr);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (gtk_cairo_should_draw_window (cr, bin->offscreen_window))
|
||||
{
|
||||
gtk_paint_flat_box (gtk_widget_get_style (widget), cr,
|
||||
GTK_STATE_NORMAL, GTK_SHADOW_NONE,
|
||||
widget, "blah",
|
||||
0, 0,
|
||||
gdk_window_get_width (bin->offscreen_window),
|
||||
gdk_window_get_height (bin->offscreen_window));
|
||||
else if (event->window == bin->offscreen_window)
|
||||
{
|
||||
gtk_paint_flat_box (gtk_widget_get_style (widget), event->window,
|
||||
GTK_STATE_NORMAL, GTK_SHADOW_NONE,
|
||||
&event->area, widget, "blah",
|
||||
0, 0, -1, -1);
|
||||
|
||||
if (bin->child)
|
||||
gtk_container_propagate_draw (GTK_CONTAINER (widget),
|
||||
bin->child,
|
||||
cr);
|
||||
if (bin->child)
|
||||
gtk_container_propagate_expose (GTK_CONTAINER (widget),
|
||||
bin->child,
|
||||
event);
|
||||
}
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
|
||||
@@ -41,8 +41,8 @@ static void gtk_mirror_bin_size_allocate (GtkWidget *widget,
|
||||
GtkAllocation *allocation);
|
||||
static gboolean gtk_mirror_bin_damage (GtkWidget *widget,
|
||||
GdkEventExpose *event);
|
||||
static gboolean gtk_mirror_bin_draw (GtkWidget *widget,
|
||||
cairo_t *cr);
|
||||
static gboolean gtk_mirror_bin_expose (GtkWidget *widget,
|
||||
GdkEventExpose *offscreen);
|
||||
|
||||
static void gtk_mirror_bin_add (GtkContainer *container,
|
||||
GtkWidget *child);
|
||||
@@ -88,7 +88,7 @@ gtk_mirror_bin_class_init (GtkMirrorBinClass *klass)
|
||||
widget_class->unrealize = gtk_mirror_bin_unrealize;
|
||||
widget_class->size_request = gtk_mirror_bin_size_request;
|
||||
widget_class->size_allocate = gtk_mirror_bin_size_allocate;
|
||||
widget_class->draw = gtk_mirror_bin_draw;
|
||||
widget_class->expose_event = gtk_mirror_bin_expose;
|
||||
|
||||
g_signal_override_class_closure (g_signal_lookup ("damage-event", GTK_TYPE_WIDGET),
|
||||
GTK_TYPE_MIRROR_BIN,
|
||||
@@ -190,9 +190,10 @@ gtk_mirror_bin_realize (GtkWidget *widget)
|
||||
| GDK_LEAVE_NOTIFY_MASK;
|
||||
|
||||
attributes.visual = gtk_widget_get_visual (widget);
|
||||
attributes.colormap = gtk_widget_get_colormap (widget);
|
||||
attributes.wclass = GDK_INPUT_OUTPUT;
|
||||
|
||||
attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL;
|
||||
attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP;
|
||||
|
||||
window = gdk_window_new (gtk_widget_get_parent_window (widget),
|
||||
&attributes, attributes_mask);
|
||||
@@ -315,7 +316,7 @@ gtk_mirror_bin_size_request (GtkWidget *widget,
|
||||
child_requisition.height = 0;
|
||||
|
||||
if (bin->child && gtk_widget_get_visible (bin->child))
|
||||
gtk_widget_get_preferred_size ( (bin->child),
|
||||
gtk_size_request_get_size (GTK_SIZE_REQUEST (bin->child),
|
||||
&child_requisition, NULL);
|
||||
|
||||
border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
|
||||
@@ -349,8 +350,8 @@ gtk_mirror_bin_size_allocate (GtkWidget *widget,
|
||||
GtkRequisition child_requisition;
|
||||
GtkAllocation child_allocation;
|
||||
|
||||
gtk_widget_get_preferred_size (bin->child,
|
||||
&child_requisition, NULL);
|
||||
gtk_size_request_get_size (GTK_SIZE_REQUEST (bin->child),
|
||||
&child_requisition, NULL);
|
||||
child_allocation.x = 0;
|
||||
child_allocation.y = 0;
|
||||
child_allocation.height = child_requisition.height;
|
||||
@@ -376,63 +377,78 @@ gtk_mirror_bin_damage (GtkWidget *widget,
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gtk_mirror_bin_draw (GtkWidget *widget,
|
||||
cairo_t *cr)
|
||||
gtk_mirror_bin_expose (GtkWidget *widget,
|
||||
GdkEventExpose *event)
|
||||
{
|
||||
GtkMirrorBin *bin = GTK_MIRROR_BIN (widget);
|
||||
GdkWindow *window;
|
||||
gint width, height;
|
||||
|
||||
window = gtk_widget_get_window (widget);
|
||||
if (gtk_cairo_should_draw_window (cr, window))
|
||||
if (gtk_widget_is_drawable (widget))
|
||||
{
|
||||
cairo_surface_t *surface;
|
||||
cairo_matrix_t matrix;
|
||||
cairo_pattern_t *mask;
|
||||
int height;
|
||||
|
||||
if (bin->child && gtk_widget_get_visible (bin->child))
|
||||
window = gtk_widget_get_window (widget);
|
||||
if (event->window == window)
|
||||
{
|
||||
surface = gdk_offscreen_window_get_surface (bin->offscreen_window);
|
||||
height = gdk_window_get_height (bin->offscreen_window);
|
||||
GdkPixmap *pixmap;
|
||||
cairo_t *cr;
|
||||
cairo_matrix_t matrix;
|
||||
cairo_pattern_t *mask;
|
||||
|
||||
/* paint the offscreen child */
|
||||
cairo_set_source_surface (cr, surface, 0, 0);
|
||||
cairo_paint (cr);
|
||||
if (bin->child && gtk_widget_get_visible (bin->child))
|
||||
{
|
||||
pixmap = gdk_offscreen_window_get_pixmap (bin->offscreen_window);
|
||||
gdk_drawable_get_size (pixmap, &width, &height);
|
||||
|
||||
cairo_matrix_init (&matrix, 1.0, 0.0, 0.3, 1.0, 0.0, 0.0);
|
||||
cairo_matrix_scale (&matrix, 1.0, -1.0);
|
||||
cairo_matrix_translate (&matrix, -10, - 3 * height - 10);
|
||||
cairo_transform (cr, &matrix);
|
||||
cr = gdk_cairo_create (window);
|
||||
|
||||
cairo_set_source_surface (cr, surface, 0, height);
|
||||
cairo_save (cr);
|
||||
|
||||
/* create linear gradient as mask-pattern to fade out the source */
|
||||
mask = cairo_pattern_create_linear (0.0, height, 0.0, 2*height);
|
||||
cairo_pattern_add_color_stop_rgba (mask, 0.0, 0.0, 0.0, 0.0, 0.0);
|
||||
cairo_pattern_add_color_stop_rgba (mask, 0.25, 0.0, 0.0, 0.0, 0.01);
|
||||
cairo_pattern_add_color_stop_rgba (mask, 0.5, 0.0, 0.0, 0.0, 0.25);
|
||||
cairo_pattern_add_color_stop_rgba (mask, 0.75, 0.0, 0.0, 0.0, 0.5);
|
||||
cairo_pattern_add_color_stop_rgba (mask, 1.0, 0.0, 0.0, 0.0, 1.0);
|
||||
cairo_rectangle (cr, 0, 0, width, height);
|
||||
cairo_clip (cr);
|
||||
|
||||
/* paint the reflection */
|
||||
cairo_mask (cr, mask);
|
||||
/* paint the offscreen child */
|
||||
gdk_cairo_set_source_pixmap (cr, pixmap, 0, 0);
|
||||
cairo_paint (cr);
|
||||
|
||||
cairo_pattern_destroy (mask);
|
||||
cairo_restore (cr);
|
||||
|
||||
cairo_matrix_init (&matrix, 1.0, 0.0, 0.3, 1.0, 0.0, 0.0);
|
||||
cairo_matrix_scale (&matrix, 1.0, -1.0);
|
||||
cairo_matrix_translate (&matrix, -10, - 3 * height - 10);
|
||||
cairo_transform (cr, &matrix);
|
||||
|
||||
cairo_rectangle (cr, 0, height, width, height);
|
||||
cairo_clip (cr);
|
||||
|
||||
gdk_cairo_set_source_pixmap (cr, pixmap, 0, height);
|
||||
|
||||
/* create linear gradient as mask-pattern to fade out the source */
|
||||
mask = cairo_pattern_create_linear (0.0, height, 0.0, 2*height);
|
||||
cairo_pattern_add_color_stop_rgba (mask, 0.0, 0.0, 0.0, 0.0, 0.0);
|
||||
cairo_pattern_add_color_stop_rgba (mask, 0.25, 0.0, 0.0, 0.0, 0.01);
|
||||
cairo_pattern_add_color_stop_rgba (mask, 0.5, 0.0, 0.0, 0.0, 0.25);
|
||||
cairo_pattern_add_color_stop_rgba (mask, 0.75, 0.0, 0.0, 0.0, 0.5);
|
||||
cairo_pattern_add_color_stop_rgba (mask, 1.0, 0.0, 0.0, 0.0, 1.0);
|
||||
|
||||
/* paint the reflection */
|
||||
cairo_mask (cr, mask);
|
||||
|
||||
cairo_pattern_destroy (mask);
|
||||
cairo_destroy (cr);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (gtk_cairo_should_draw_window (cr, bin->offscreen_window))
|
||||
{
|
||||
gtk_paint_flat_box (gtk_widget_get_style (widget), cr,
|
||||
GTK_STATE_NORMAL, GTK_SHADOW_NONE,
|
||||
widget, "blah",
|
||||
0, 0,
|
||||
gdk_window_get_width (bin->offscreen_window),
|
||||
gdk_window_get_height (bin->offscreen_window));
|
||||
else if (event->window == bin->offscreen_window)
|
||||
{
|
||||
gtk_paint_flat_box (gtk_widget_get_style (widget), event->window,
|
||||
GTK_STATE_NORMAL, GTK_SHADOW_NONE,
|
||||
&event->area, widget, "blah",
|
||||
0, 0, -1, -1);
|
||||
|
||||
if (bin->child)
|
||||
gtk_container_propagate_draw (GTK_CONTAINER (widget),
|
||||
bin->child,
|
||||
cr);
|
||||
if (bin->child)
|
||||
gtk_container_propagate_expose (GTK_CONTAINER (widget),
|
||||
bin->child,
|
||||
event);
|
||||
}
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
|
||||
@@ -96,12 +96,19 @@ load_pixbufs (GError **error)
|
||||
|
||||
/* Expose callback for the drawing area */
|
||||
static gint
|
||||
draw_cb (GtkWidget *widget,
|
||||
cairo_t *cr,
|
||||
gpointer data)
|
||||
expose_cb (GtkWidget *widget,
|
||||
GdkEventExpose *event,
|
||||
gpointer data)
|
||||
{
|
||||
cairo_t *cr;
|
||||
|
||||
cr = gdk_cairo_create (event->window);
|
||||
|
||||
gdk_cairo_set_source_pixbuf (cr, frame, 0, 0);
|
||||
cairo_paint (cr);
|
||||
gdk_cairo_rectangle (cr, &event->area);
|
||||
cairo_fill (cr);
|
||||
|
||||
cairo_destroy (cr);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
@@ -186,7 +193,7 @@ timeout (gpointer data)
|
||||
static guint timeout_id;
|
||||
|
||||
static void
|
||||
cleanup_callback (GObject *object,
|
||||
cleanup_callback (GtkObject *object,
|
||||
gpointer data)
|
||||
{
|
||||
g_source_remove (timeout_id);
|
||||
@@ -239,8 +246,8 @@ do_pixbufs (GtkWidget *do_widget)
|
||||
|
||||
da = gtk_drawing_area_new ();
|
||||
|
||||
g_signal_connect (da, "draw",
|
||||
G_CALLBACK (draw_cb), NULL);
|
||||
g_signal_connect (da, "expose-event",
|
||||
G_CALLBACK (expose_cb), NULL);
|
||||
|
||||
gtk_container_add (GTK_CONTAINER (window), da);
|
||||
|
||||
|
||||
@@ -91,32 +91,39 @@ create_fancy_attr_list_for_layout (PangoLayout *layout)
|
||||
}
|
||||
|
||||
static gboolean
|
||||
rotated_text_draw (GtkWidget *widget,
|
||||
cairo_t *cr,
|
||||
gpointer data)
|
||||
rotated_text_expose_event (GtkWidget *widget,
|
||||
GdkEventExpose *event,
|
||||
gpointer data)
|
||||
{
|
||||
#define RADIUS 150
|
||||
#define N_WORDS 5
|
||||
#define FONT "Serif 18"
|
||||
|
||||
GtkAllocation allocation;
|
||||
|
||||
PangoContext *context;
|
||||
PangoLayout *layout;
|
||||
PangoFontDescription *desc;
|
||||
|
||||
cairo_t *cr;
|
||||
cairo_pattern_t *pattern;
|
||||
|
||||
PangoAttrList *attrs;
|
||||
|
||||
int width;
|
||||
int height;
|
||||
double device_radius;
|
||||
int width, height;
|
||||
int i;
|
||||
|
||||
gtk_widget_get_allocation (widget, &allocation);
|
||||
width = allocation.width;
|
||||
height = allocation.height;
|
||||
|
||||
/* Create a cairo context and set up a transformation matrix so that the user
|
||||
* space coordinates for the centered square where we draw are [-RADIUS, RADIUS],
|
||||
* [-RADIUS, RADIUS].
|
||||
* We first center, then change the scale. */
|
||||
width = gtk_widget_get_allocated_width (widget);
|
||||
height = gtk_widget_get_allocated_height (widget);
|
||||
cr = gdk_cairo_create (gtk_widget_get_window (widget));
|
||||
device_radius = MIN (width, height) / 2.;
|
||||
cairo_translate (cr,
|
||||
device_radius + (width - 2 * device_radius) / 2,
|
||||
@@ -166,6 +173,7 @@ rotated_text_draw (GtkWidget *widget,
|
||||
g_object_unref (layout);
|
||||
g_object_unref (context);
|
||||
cairo_pattern_destroy (pattern);
|
||||
cairo_destroy (cr);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
@@ -201,8 +209,8 @@ do_rotated_text (GtkWidget *do_widget)
|
||||
/* This overrides the background color from the theme */
|
||||
gtk_widget_modify_bg (drawing_area, GTK_STATE_NORMAL, &white);
|
||||
|
||||
g_signal_connect (drawing_area, "draw",
|
||||
G_CALLBACK (rotated_text_draw), NULL);
|
||||
g_signal_connect (drawing_area, "expose-event",
|
||||
G_CALLBACK (rotated_text_expose_event), NULL);
|
||||
|
||||
/* And a label */
|
||||
|
||||
|
||||
@@ -81,13 +81,22 @@ canvas_item_draw (const CanvasItem *item,
|
||||
}
|
||||
|
||||
static gboolean
|
||||
canvas_draw (GtkWidget *widget,
|
||||
cairo_t *cr)
|
||||
canvas_expose_event (GtkWidget *widget,
|
||||
GdkEventExpose *event)
|
||||
{
|
||||
GtkAllocation allocation;
|
||||
cairo_t *cr;
|
||||
GList *iter;
|
||||
|
||||
cr = gdk_cairo_create (gtk_widget_get_window (widget));
|
||||
gdk_cairo_region (cr, event->region);
|
||||
cairo_clip (cr);
|
||||
|
||||
gtk_widget_get_allocation (widget, &allocation);
|
||||
|
||||
cairo_set_source_rgb (cr, 1, 1, 1);
|
||||
cairo_paint (cr);
|
||||
cairo_rectangle (cr, 0, 0, allocation.width, allocation.height);
|
||||
cairo_fill (cr);
|
||||
|
||||
for (iter = canvas_items; iter; iter = iter->next)
|
||||
canvas_item_draw (iter->data, cr, FALSE);
|
||||
@@ -95,6 +104,8 @@ canvas_draw (GtkWidget *widget,
|
||||
if (drop_item)
|
||||
canvas_item_draw (drop_item, cr, TRUE);
|
||||
|
||||
cairo_destroy (cr);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@@ -561,7 +572,7 @@ do_toolpalette (GtkWidget *do_widget)
|
||||
gtk_widget_set_app_paintable (contents, TRUE);
|
||||
|
||||
g_object_connect (contents,
|
||||
"signal::draw", canvas_draw, NULL,
|
||||
"signal::expose-event", canvas_expose_event, NULL,
|
||||
"signal::drag-data-received", passive_canvas_drag_data_received, NULL,
|
||||
NULL);
|
||||
|
||||
@@ -589,7 +600,7 @@ do_toolpalette (GtkWidget *do_widget)
|
||||
gtk_widget_set_app_paintable (contents, TRUE);
|
||||
|
||||
g_object_connect (contents,
|
||||
"signal::draw", canvas_draw, NULL,
|
||||
"signal::expose-event", canvas_expose_event, NULL,
|
||||
"signal::drag-motion", interactive_canvas_drag_motion, NULL,
|
||||
"signal::drag-data-received", interactive_canvas_drag_data_received, NULL,
|
||||
"signal::drag-leave", interactive_canvas_drag_leave, NULL,
|
||||
|
||||
+12
-6
@@ -86,11 +86,17 @@ load_pixbufs (void)
|
||||
}
|
||||
|
||||
/* Expose callback for the drawing area */
|
||||
static gboolean
|
||||
draw_cb (GtkWidget *widget, cairo_t *cr, gpointer data)
|
||||
static gint
|
||||
expose_cb (GtkWidget *widget, GdkEventExpose *event, gpointer data)
|
||||
{
|
||||
cairo_t *cr;
|
||||
|
||||
cr = gdk_cairo_create (event->window);
|
||||
gdk_cairo_set_source_pixbuf (cr, frame, 0, 0);
|
||||
cairo_paint (cr);
|
||||
gdk_cairo_rectangle (cr, &event->area);
|
||||
cairo_fill (cr);
|
||||
|
||||
cairo_destroy (cr);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
@@ -173,7 +179,7 @@ static guint timeout_id;
|
||||
|
||||
/* Destroy handler for the window */
|
||||
static void
|
||||
destroy_cb (GObject *object, gpointer data)
|
||||
destroy_cb (GtkObject *object, gpointer data)
|
||||
{
|
||||
g_source_remove (timeout_id);
|
||||
timeout_id = 0;
|
||||
@@ -208,8 +214,8 @@ main (int argc, char **argv)
|
||||
|
||||
da = gtk_drawing_area_new ();
|
||||
|
||||
g_signal_connect (da, "draw",
|
||||
G_CALLBACK (draw_cb), NULL);
|
||||
g_signal_connect (da, "expose_event",
|
||||
G_CALLBACK (expose_cb), NULL);
|
||||
|
||||
gtk_container_add (GTK_CONTAINER (window), da);
|
||||
|
||||
|
||||
@@ -112,8 +112,8 @@ main (int argc, char **argv)
|
||||
gtk_init (&argc, &argv);
|
||||
|
||||
root = gdk_get_default_root_window ();
|
||||
pixbuf = gdk_pixbuf_get_from_window (root,
|
||||
0, 0, 150, 160);
|
||||
pixbuf = gdk_pixbuf_get_from_drawable (NULL, root, NULL,
|
||||
0, 0, 0, 0, 150, 160);
|
||||
|
||||
/* PASS */
|
||||
g_debug ("try to save PNG with a profile");
|
||||
|
||||
+14
-9
@@ -307,16 +307,21 @@ close_app (GtkWidget *widget, gpointer data)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
draw_cb (GtkWidget *drawing_area, cairo_t *cr, gpointer data)
|
||||
static int
|
||||
expose_cb (GtkWidget *drawing_area, GdkEventExpose *evt, gpointer data)
|
||||
{
|
||||
GdkPixbuf *pixbuf;
|
||||
cairo_t *cr;
|
||||
|
||||
pixbuf = (GdkPixbuf *) g_object_get_data (G_OBJECT (drawing_area),
|
||||
"pixbuf");
|
||||
|
||||
cr = gdk_cairo_create (evt->window);
|
||||
gdk_cairo_set_source_pixbuf (cr, pixbuf, 0, 0);
|
||||
cairo_paint (cr);
|
||||
gdk_cairo_rectangle (cr, &evt->area);
|
||||
cairo_fill (cr);
|
||||
|
||||
cairo_destroy (cr);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
@@ -335,8 +340,8 @@ configure_cb (GtkWidget *drawing_area, GdkEventConfigure *evt, gpointer data)
|
||||
GdkPixbuf *new_pixbuf;
|
||||
|
||||
root = gdk_get_default_root_window ();
|
||||
new_pixbuf = gdk_pixbuf_get_from_window (root,
|
||||
0, 0, evt->width, evt->height);
|
||||
new_pixbuf = gdk_pixbuf_get_from_drawable (NULL, root, NULL,
|
||||
0, 0, 0, 0, evt->width, evt->height);
|
||||
g_object_set_data_full (G_OBJECT (drawing_area), "pixbuf", new_pixbuf,
|
||||
(GDestroyNotify) g_object_unref);
|
||||
}
|
||||
@@ -356,8 +361,8 @@ main (int argc, char **argv)
|
||||
gtk_init (&argc, &argv);
|
||||
|
||||
root = gdk_get_default_root_window ();
|
||||
pixbuf = gdk_pixbuf_get_from_window (root,
|
||||
0, 0, 150, 160);
|
||||
pixbuf = gdk_pixbuf_get_from_drawable (NULL, root, NULL,
|
||||
0, 0, 0, 0, 150, 160);
|
||||
|
||||
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
||||
g_signal_connect (window, "delete_event",
|
||||
@@ -372,8 +377,8 @@ main (int argc, char **argv)
|
||||
gtk_widget_set_size_request (GTK_WIDGET (drawing_area),
|
||||
gdk_pixbuf_get_width (pixbuf),
|
||||
gdk_pixbuf_get_height (pixbuf));
|
||||
g_signal_connect (drawing_area, "draw",
|
||||
G_CALLBACK (draw_cb), NULL);
|
||||
g_signal_connect (drawing_area, "expose_event",
|
||||
G_CALLBACK (expose_cb), NULL);
|
||||
|
||||
g_signal_connect (drawing_area, "configure_event",
|
||||
G_CALLBACK (configure_cb), NULL);
|
||||
|
||||
+21
-15
@@ -32,27 +32,33 @@ overall_changed_cb (GtkAdjustment *adjustment, gpointer data)
|
||||
}
|
||||
|
||||
gboolean
|
||||
draw_cb (GtkWidget *widget, cairo_t *cr, gpointer data)
|
||||
expose_cb (GtkWidget *widget, GdkEventExpose *event, gpointer data)
|
||||
{
|
||||
GtkAllocation allocation;
|
||||
GdkPixbuf *dest;
|
||||
int width, height;
|
||||
cairo_t *cr;
|
||||
|
||||
width = gtk_widget_get_allocated_width (widget);
|
||||
height = gtk_widget_get_allocated_height (widget);
|
||||
gdk_window_set_back_pixmap (gtk_widget_get_window (widget),
|
||||
NULL, FALSE);
|
||||
|
||||
dest = gdk_pixbuf_new (GDK_COLORSPACE_RGB, FALSE, 8, width, height);
|
||||
dest = gdk_pixbuf_new (GDK_COLORSPACE_RGB, FALSE, 8, event->area.width, event->area.height);
|
||||
|
||||
gtk_widget_get_allocation (widget, &allocation);
|
||||
gdk_pixbuf_composite_color (pixbuf, dest,
|
||||
0, 0, width, height,
|
||||
0, 0,
|
||||
(double) width / gdk_pixbuf_get_width (pixbuf),
|
||||
(double) height / gdk_pixbuf_get_height (pixbuf),
|
||||
0, 0, event->area.width, event->area.height,
|
||||
-event->area.x, -event->area.y,
|
||||
(double) allocation.width / gdk_pixbuf_get_width (pixbuf),
|
||||
(double) allocation.height / gdk_pixbuf_get_height (pixbuf),
|
||||
interp_type, overall_alpha,
|
||||
0, 0, 16, 0xaaaaaa, 0x555555);
|
||||
event->area.x, event->area.y, 16, 0xaaaaaa, 0x555555);
|
||||
|
||||
cr = gdk_cairo_create (event->window);
|
||||
|
||||
gdk_cairo_set_source_pixbuf (cr, dest, 0, 0);
|
||||
cairo_paint (cr);
|
||||
gdk_cairo_rectangle (cr, &event->area);
|
||||
cairo_fill (cr);
|
||||
|
||||
cairo_destroy (cr);
|
||||
g_object_unref (dest);
|
||||
|
||||
return TRUE;
|
||||
@@ -123,7 +129,7 @@ main(int argc, char **argv)
|
||||
label = gtk_label_new ("Overall Alpha:");
|
||||
gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
|
||||
|
||||
adjustment = gtk_adjustment_new (overall_alpha, 0, 255, 1, 10, 0);
|
||||
adjustment = GTK_ADJUSTMENT (gtk_adjustment_new (overall_alpha, 0, 255, 1, 10, 0));
|
||||
g_signal_connect (adjustment, "value_changed",
|
||||
G_CALLBACK (overall_changed_cb), NULL);
|
||||
|
||||
@@ -135,14 +141,14 @@ main(int argc, char **argv)
|
||||
gtk_widget_show_all (vbox);
|
||||
|
||||
/* Compute the size without the drawing area, so we know how big to make the default size */
|
||||
gtk_widget_get_preferred_size ( (vbox),
|
||||
gtk_size_request_get_size (GTK_SIZE_REQUEST (vbox),
|
||||
&scratch_requisition, NULL);
|
||||
|
||||
darea = gtk_drawing_area_new ();
|
||||
gtk_box_pack_start (GTK_BOX (vbox), darea, TRUE, TRUE, 0);
|
||||
|
||||
g_signal_connect (darea, "draw",
|
||||
G_CALLBACK (draw_cb), NULL);
|
||||
g_signal_connect (darea, "expose_event",
|
||||
G_CALLBACK (expose_cb), NULL);
|
||||
|
||||
gtk_window_set_default_size (GTK_WINDOW (window),
|
||||
gdk_pixbuf_get_width (pixbuf),
|
||||
|
||||
+6
-8
@@ -4,22 +4,20 @@ include $(top_srcdir)/Makefile.decl
|
||||
SUBDIRS = tutorial faq reference tools
|
||||
|
||||
EXTRA_DIST += \
|
||||
CODING-STYLE \
|
||||
defsformat.txt \
|
||||
developers.txt \
|
||||
dnd_internals.txt \
|
||||
focus_tracking.txt \
|
||||
generation.txt \
|
||||
gtkdocs_fix \
|
||||
make-todo \
|
||||
refcounting.txt \
|
||||
RELEASE-HOWTO \
|
||||
sizing-test.txt \
|
||||
styles.txt \
|
||||
text_widget_internals.txt \
|
||||
text_widget.txt \
|
||||
tree-column-sizing.png \
|
||||
text_widget_internals.txt \
|
||||
tree-column-sizing.txt \
|
||||
widget_geometry.txt \
|
||||
widget_system.txt
|
||||
widget_system.txt \
|
||||
generation.txt \
|
||||
gtkdocs_fix \
|
||||
RELEASE-HOWTO
|
||||
|
||||
-include $(top_srcdir)/git.mk
|
||||
|
||||
@@ -26,6 +26,9 @@
|
||||
<xi:include href="xml/regions.xml" />
|
||||
<xi:include href="xml/drawing.xml" />
|
||||
|
||||
<xi:include href="xml/pixmaps.xml" />
|
||||
<xi:include href="xml/pixbufs.xml" />
|
||||
|
||||
<xi:include href="xml/colors.xml" />
|
||||
<xi:include href="xml/visuals.xml" />
|
||||
|
||||
|
||||
@@ -190,7 +190,11 @@ gdk_display_manager_get_type
|
||||
<TITLE>GdkScreen</TITLE>
|
||||
GdkScreen
|
||||
gdk_screen_get_default
|
||||
gdk_screen_get_default_colormap
|
||||
gdk_screen_set_default_colormap
|
||||
gdk_screen_get_system_colormap
|
||||
gdk_screen_get_system_visual
|
||||
gdk_screen_get_rgba_colormap
|
||||
gdk_screen_get_rgba_visual
|
||||
gdk_screen_is_composited
|
||||
gdk_screen_get_root_window
|
||||
@@ -236,17 +240,50 @@ GdkScreenClass
|
||||
gdk_screen_get_type
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
<TITLE>Bitmaps and Pixmaps</TITLE>
|
||||
<FILE>pixmaps</FILE>
|
||||
GdkPixmap
|
||||
gdk_pixmap_new
|
||||
GdkBitmap
|
||||
|
||||
<SUBSECTION Standard>
|
||||
GDK_PIXMAP
|
||||
GDK_PIXMAP_GET_CLASS
|
||||
GDK_PIXMAP_OBJECT
|
||||
GDK_TYPE_PIXMAP
|
||||
GDK_IS_PIXMAP
|
||||
GDK_PIXMAP_CLASS
|
||||
GDK_IS_PIXMAP_CLASS
|
||||
|
||||
<SUBSECTION Private>
|
||||
gdk_pixmap_get_type
|
||||
GdkPixmapObject
|
||||
GdkPixmapObjectClass
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
<TITLE>Pixbufs</TITLE>
|
||||
<FILE>pixbufs</FILE>
|
||||
gdk_pixbuf_get_from_window
|
||||
gdk_pixbuf_render_threshold_alpha
|
||||
gdk_pixbuf_render_pixmap_and_mask
|
||||
gdk_pixbuf_render_pixmap_and_mask_for_colormap
|
||||
gdk_pixbuf_get_from_drawable
|
||||
gdk_pixbuf_get_from_surface
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
<TITLE>Colors</TITLE>
|
||||
<TITLE>Colormaps and Colors</TITLE>
|
||||
<FILE>colors</FILE>
|
||||
GdkColor
|
||||
GdkColormap
|
||||
gdk_colormap_new
|
||||
gdk_colormap_get_system
|
||||
gdk_colormap_alloc_colors
|
||||
gdk_colormap_alloc_color
|
||||
gdk_colormap_free_colors
|
||||
gdk_colormap_get_visual
|
||||
gdk_colormap_get_screen
|
||||
gdk_color_copy
|
||||
gdk_color_free
|
||||
gdk_color_parse
|
||||
@@ -255,14 +292,31 @@ gdk_color_hash
|
||||
gdk_color_to_string
|
||||
|
||||
<SUBSECTION Standard>
|
||||
GDK_COLORMAP
|
||||
GDK_COLORMAP_GET_CLASS
|
||||
GDK_TYPE_COLORMAP
|
||||
GDK_IS_COLORMAP
|
||||
GDK_COLORMAP_CLASS
|
||||
GDK_IS_COLORMAP_CLASS
|
||||
GDK_TYPE_COLOR
|
||||
|
||||
<SUBSECTION Private>
|
||||
GdkColormapClass
|
||||
gdk_colormap_get_type
|
||||
gdk_color_get_type
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
<TITLE>Drawing Primitives</TITLE>
|
||||
<FILE>drawing</FILE>
|
||||
GdkDrawable
|
||||
gdk_drawable_get_display
|
||||
gdk_drawable_get_screen
|
||||
gdk_drawable_get_visual
|
||||
gdk_drawable_set_colormap
|
||||
gdk_drawable_get_colormap
|
||||
gdk_drawable_get_depth
|
||||
gdk_drawable_get_size
|
||||
gdk_drawable_get_clip_region
|
||||
gdk_drawable_get_visible_region
|
||||
|
||||
@@ -335,9 +389,6 @@ GdkWindowAttributesType
|
||||
gdk_window_new
|
||||
gdk_window_destroy
|
||||
gdk_window_get_window_type
|
||||
gdk_window_get_display
|
||||
gdk_window_get_screen
|
||||
gdk_window_get_visual
|
||||
gdk_window_at_pointer
|
||||
gdk_window_show
|
||||
gdk_window_show_unraised
|
||||
@@ -371,6 +422,9 @@ gdk_window_flush
|
||||
gdk_window_has_native
|
||||
gdk_window_ensure_native
|
||||
gdk_window_reparent
|
||||
gdk_window_clear
|
||||
gdk_window_clear_area
|
||||
gdk_window_clear_area_e
|
||||
gdk_window_raise
|
||||
gdk_window_lower
|
||||
gdk_window_restack
|
||||
@@ -389,7 +443,6 @@ gdk_window_end_paint
|
||||
<SUBSECTION>
|
||||
gdk_window_invalidate_rect
|
||||
gdk_window_invalidate_region
|
||||
GdkWindowChildFunc
|
||||
gdk_window_invalidate_maybe_recurse
|
||||
gdk_window_get_update_area
|
||||
gdk_window_freeze_updates
|
||||
@@ -397,6 +450,7 @@ gdk_window_thaw_updates
|
||||
gdk_window_process_all_updates
|
||||
gdk_window_process_updates
|
||||
gdk_window_set_debug_updates
|
||||
gdk_window_get_internal_paint_info
|
||||
gdk_window_enable_synchronized_configure
|
||||
gdk_window_configure_finished
|
||||
|
||||
@@ -412,16 +466,18 @@ gdk_window_remove_filter
|
||||
GdkFilterFunc
|
||||
GdkFilterReturn
|
||||
GdkXEvent
|
||||
gdk_window_shape_combine_mask
|
||||
gdk_window_shape_combine_region
|
||||
gdk_window_set_child_shapes
|
||||
gdk_window_merge_child_shapes
|
||||
gdk_window_input_shape_combine_mask
|
||||
gdk_window_input_shape_combine_region
|
||||
gdk_window_set_child_input_shapes
|
||||
gdk_window_merge_child_input_shapes
|
||||
gdk_window_set_static_gravities
|
||||
gdk_window_set_title
|
||||
gdk_window_set_background
|
||||
gdk_window_set_background_pattern
|
||||
gdk_window_set_back_pixmap
|
||||
gdk_window_get_background_pattern
|
||||
GDK_PARENT_RELATIVE
|
||||
gdk_window_set_cursor
|
||||
@@ -429,8 +485,6 @@ gdk_window_get_cursor
|
||||
gdk_window_get_user_data
|
||||
gdk_window_get_geometry
|
||||
gdk_window_set_geometry_hints
|
||||
gdk_window_get_width
|
||||
gdk_window_get_height
|
||||
gdk_window_set_icon_list
|
||||
gdk_window_set_modal_hint
|
||||
gdk_window_get_modal_hint
|
||||
@@ -443,6 +497,7 @@ gdk_window_get_position
|
||||
gdk_window_get_root_origin
|
||||
gdk_window_get_frame_extents
|
||||
gdk_window_get_origin
|
||||
gdk_window_get_deskrelative_origin
|
||||
gdk_window_get_root_coords
|
||||
gdk_window_get_pointer
|
||||
gdk_window_get_device_position
|
||||
@@ -453,6 +508,7 @@ gdk_window_get_children
|
||||
gdk_window_peek_children
|
||||
gdk_window_get_events
|
||||
gdk_window_set_events
|
||||
gdk_window_set_icon
|
||||
gdk_window_set_icon_name
|
||||
gdk_window_set_transient_for
|
||||
gdk_window_set_role
|
||||
@@ -479,10 +535,12 @@ GdkPointerHooks
|
||||
gdk_set_pointer_hooks
|
||||
|
||||
<SUBSECTION>
|
||||
gdk_offscreen_window_get_surface
|
||||
gdk_offscreen_window_get_pixmap
|
||||
gdk_offscreen_window_set_embedder
|
||||
gdk_offscreen_window_get_embedder
|
||||
gdk_window_geometry_changed
|
||||
gdk_window_redirect_to_drawable
|
||||
gdk_window_remove_redirection
|
||||
gdk_window_coords_from_parent
|
||||
gdk_window_coords_to_parent
|
||||
gdk_window_get_effective_parent
|
||||
@@ -593,14 +651,12 @@ gdk_pango_context_get_for_screen
|
||||
<FILE>cairo_interaction</FILE>
|
||||
gdk_window_create_similar_surface
|
||||
gdk_cairo_create
|
||||
gdk_cairo_get_clip_rectangle
|
||||
gdk_cairo_set_source_color
|
||||
gdk_cairo_set_source_pixbuf
|
||||
gdk_cairo_set_source_window
|
||||
gdk_cairo_set_source_pixmap
|
||||
gdk_cairo_rectangle
|
||||
gdk_cairo_region
|
||||
gdk_cairo_reset_clip
|
||||
gdk_cairo_region_create_from_surface
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
@@ -625,6 +681,7 @@ GDK_THREADS_LEAVE
|
||||
gdk_threads_init
|
||||
gdk_threads_enter
|
||||
gdk_threads_leave
|
||||
gdk_threads_mutex
|
||||
gdk_threads_set_lock_functions
|
||||
gdk_threads_add_idle
|
||||
gdk_threads_add_idle_full
|
||||
@@ -883,6 +940,7 @@ gdk_owner_change_get_type
|
||||
GdkCursor
|
||||
GdkCursorType
|
||||
gdk_cursor_new
|
||||
gdk_cursor_new_from_pixmap
|
||||
gdk_cursor_new_from_pixbuf
|
||||
gdk_cursor_new_from_name
|
||||
gdk_cursor_new_for_display
|
||||
@@ -951,22 +1009,32 @@ gdk_drag_context_get_type
|
||||
GDK_ROOT_WINDOW
|
||||
GDK_WINDOW_XDISPLAY
|
||||
GDK_WINDOW_XID
|
||||
GDK_PIXMAP_XDISPLAY
|
||||
GDK_PIXMAP_XID
|
||||
GDK_DISPLAY_XDISPLAY
|
||||
GDK_DRAWABLE_XDISPLAY
|
||||
GDK_DRAWABLE_XID
|
||||
GDK_COLORMAP_XDISPLAY
|
||||
GDK_COLORMAP_XCOLORMAP
|
||||
GDK_SCREEN_XDISPLAY
|
||||
GDK_SCREEN_XNUMBER
|
||||
GDK_SCREEN_XSCREEN
|
||||
GDK_VISUAL_XVISUAL
|
||||
GDK_CURSOR_XCURSOR
|
||||
GDK_CURSOR_XDISPLAY
|
||||
GDK_WINDOW_XWINDOW
|
||||
gdkx_visual_get
|
||||
gdk_pixmap_foreign_new
|
||||
gdk_pixmap_foreign_new_for_display
|
||||
gdk_pixmap_foreign_new_for_screen
|
||||
gdk_window_foreign_new
|
||||
gdk_window_foreign_new_for_display
|
||||
gdk_xid_table_lookup
|
||||
gdk_xid_table_lookup_for_display
|
||||
gdk_window_lookup
|
||||
gdk_window_lookup_for_display
|
||||
gdk_pixmap_lookup
|
||||
gdk_pixmap_lookup_for_display
|
||||
gdk_x11_lookup_xdisplay
|
||||
gdk_x11_get_server_time
|
||||
gdk_net_wm_supports
|
||||
@@ -977,6 +1045,9 @@ gdk_x11_screen_lookup_visual
|
||||
gdk_x11_window_set_user_time
|
||||
gdk_x11_window_move_to_current_desktop
|
||||
gdk_x11_display_get_user_time
|
||||
gdk_x11_colormap_foreign_new
|
||||
gdk_x11_colormap_get_xcolormap
|
||||
gdk_x11_colormap_get_xdisplay
|
||||
gdk_x11_cursor_get_xcursor
|
||||
gdk_x11_cursor_get_xdisplay
|
||||
gdk_x11_display_broadcast_startup_message
|
||||
@@ -1011,6 +1082,7 @@ gdk_x11_get_xatom_name_for_display
|
||||
<SUBSECTION Private>
|
||||
GDK_HAVE_WCHAR_H
|
||||
GDK_HAVE_WCTYPE_H
|
||||
gdk_x11_pixmap_get_drawable_impl
|
||||
gdk_x11_window_get_drawable_impl
|
||||
</SECTION>
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@ gdk_display_manager_get_type
|
||||
gdk_screen_get_type
|
||||
gdk_drawable_get_type
|
||||
gdk_window_object_get_type
|
||||
gdk_pixmap_get_type
|
||||
gdk_keymap_get_type
|
||||
gdk_device_get_type
|
||||
gdk_device_manager_get_type
|
||||
|
||||
@@ -1,6 +1,2 @@
|
||||
cairo_interaction.sgml
|
||||
colors.sgml
|
||||
dnd.sgml
|
||||
pixbufs.sgml
|
||||
regions.sgml
|
||||
windows.sgml
|
||||
|
||||
@@ -0,0 +1,99 @@
|
||||
<!-- ##### SECTION Title ##### -->
|
||||
Cairo Interaction
|
||||
|
||||
<!-- ##### SECTION Short_Description ##### -->
|
||||
Functions to support using Cairo
|
||||
|
||||
<!-- ##### SECTION Long_Description ##### -->
|
||||
<para>
|
||||
<link href="http://cairographics.org">Cairo</link> is a graphics
|
||||
library that supports vector graphics and image compositing that
|
||||
can be used with GDK. Since 2.8, GTK+ does most of its drawing
|
||||
using Cairo.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
GDK does not wrap the Cairo API, instead it allows to create Cairo
|
||||
contexts which can be used to draw on GDK drawables. Additional
|
||||
functions allow to convert GDK's rectangles and regions into
|
||||
Cairo paths and to use pixbufs as sources for drawing operations.
|
||||
</para>
|
||||
|
||||
<!-- ##### SECTION See_Also ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
<!-- ##### SECTION Stability_Level ##### -->
|
||||
|
||||
|
||||
<!-- ##### SECTION Image ##### -->
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gdk_cairo_create ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@drawable:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gdk_cairo_set_source_color ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@cr:
|
||||
@color:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gdk_cairo_set_source_pixbuf ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@cr:
|
||||
@pixbuf:
|
||||
@pixbuf_x:
|
||||
@pixbuf_y:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gdk_cairo_set_source_pixmap ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@cr:
|
||||
@pixmap:
|
||||
@pixmap_x:
|
||||
@pixmap_y:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gdk_cairo_rectangle ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@cr:
|
||||
@rectangle:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gdk_cairo_region ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@cr:
|
||||
@region:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gdk_cairo_reset_clip ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@cr:
|
||||
@drawable:
|
||||
|
||||
|
||||
@@ -0,0 +1,185 @@
|
||||
<!-- ##### SECTION Title ##### -->
|
||||
Colormaps and Colors
|
||||
|
||||
<!-- ##### SECTION Short_Description ##### -->
|
||||
Manipulation of colors and colormaps
|
||||
|
||||
<!-- ##### SECTION Long_Description ##### -->
|
||||
<para>
|
||||
These functions are used to modify colormaps.
|
||||
A colormap is an object that contains the mapping
|
||||
between the color values stored in memory and
|
||||
the RGB values that are used to display color
|
||||
values. In general, colormaps only contain
|
||||
significant information for pseudo-color visuals,
|
||||
but even for other visual types, a colormap object
|
||||
is required in some circumstances.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
There are a couple of special colormaps that can
|
||||
be retrieved. The system colormap (retrieved
|
||||
with gdk_colormap_get_system()) is the default
|
||||
colormap of the system. If you are using GdkRGB,
|
||||
there is another colormap that is important - the
|
||||
colormap in which GdkRGB works, retrieved with
|
||||
gdk_rgb_get_colormap(). However, when using GdkRGB,
|
||||
it is not generally necessary to allocate colors
|
||||
directly.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
In previous revisions of this interface, a number
|
||||
of functions that take a #GdkColormap parameter
|
||||
were replaced with functions whose names began
|
||||
with "gdk_colormap_".
|
||||
</para>
|
||||
|
||||
<!-- ##### SECTION See_Also ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
<!-- ##### SECTION Stability_Level ##### -->
|
||||
|
||||
|
||||
<!-- ##### SECTION Image ##### -->
|
||||
|
||||
|
||||
<!-- ##### STRUCT GdkColor ##### -->
|
||||
<para>
|
||||
The #GdkColor structure is used to describe an
|
||||
allocated or unallocated color.
|
||||
</para>
|
||||
|
||||
@pixel: For allocated colors, the value used to
|
||||
draw this color on the screen.
|
||||
@red: The red component of the color. This is
|
||||
a value between 0 and 65535, with 65535 indicating
|
||||
full intensitiy.
|
||||
@green: The green component of the color.
|
||||
@blue: The blue component of the color.
|
||||
|
||||
<!-- ##### STRUCT GdkColormap ##### -->
|
||||
<para>
|
||||
The colormap structure contains the following public fields.
|
||||
</para>
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gdk_colormap_new ##### -->
|
||||
<para>
|
||||
</para>
|
||||
|
||||
@visual:
|
||||
@allocate:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gdk_colormap_get_system ##### -->
|
||||
<para>
|
||||
</para>
|
||||
|
||||
@void:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gdk_colormap_alloc_colors ##### -->
|
||||
<para>
|
||||
</para>
|
||||
|
||||
@colormap:
|
||||
@colors:
|
||||
@n_colors:
|
||||
@writeable:
|
||||
@best_match:
|
||||
@success:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gdk_colormap_alloc_color ##### -->
|
||||
<para>
|
||||
</para>
|
||||
|
||||
@colormap:
|
||||
@color:
|
||||
@writeable:
|
||||
@best_match:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gdk_colormap_free_colors ##### -->
|
||||
<para>
|
||||
</para>
|
||||
|
||||
@colormap:
|
||||
@colors:
|
||||
@n_colors:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gdk_colormap_get_visual ##### -->
|
||||
<para>
|
||||
</para>
|
||||
|
||||
@colormap:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gdk_colormap_get_screen ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@cmap:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gdk_color_copy ##### -->
|
||||
<para>
|
||||
</para>
|
||||
|
||||
@color:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gdk_color_free ##### -->
|
||||
<para>
|
||||
</para>
|
||||
|
||||
@color:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gdk_color_parse ##### -->
|
||||
<para>
|
||||
</para>
|
||||
|
||||
@spec:
|
||||
@color:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gdk_color_equal ##### -->
|
||||
<para>
|
||||
</para>
|
||||
|
||||
@colora:
|
||||
@colorb:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gdk_color_hash ##### -->
|
||||
<para>
|
||||
</para>
|
||||
|
||||
@colora:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gdk_color_to_string ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@color:
|
||||
@Returns:
|
||||
|
||||
|
||||
@@ -125,7 +125,7 @@ The standard cursors available.
|
||||
@GDK_LAST_CURSOR: last cursor type
|
||||
@GDK_BLANK_CURSOR: Blank cursor. Since 2.16
|
||||
@GDK_CURSOR_IS_PIXMAP: type of cursors constructed with
|
||||
gdk_cursor_new_from_pixbuf()
|
||||
gdk_cursor_new_from_pixmap() or gdk_cursor_new_from_pixbuf()
|
||||
|
||||
<!-- ##### FUNCTION gdk_cursor_new ##### -->
|
||||
<para>
|
||||
@@ -136,6 +136,19 @@ The standard cursors available.
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gdk_cursor_new_from_pixmap ##### -->
|
||||
<para>
|
||||
</para>
|
||||
|
||||
@source:
|
||||
@mask:
|
||||
@fg:
|
||||
@bg:
|
||||
@x:
|
||||
@y:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gdk_cursor_new_from_pixbuf ##### -->
|
||||
<para>
|
||||
|
||||
|
||||
@@ -45,6 +45,15 @@ or a #GdkWindow.
|
||||
</para>
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gdk_drawable_get_display ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@drawable:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gdk_drawable_get_screen ##### -->
|
||||
<para>
|
||||
|
||||
@@ -72,6 +81,15 @@ or a #GdkWindow.
|
||||
@colormap:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gdk_drawable_get_colormap ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@drawable:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gdk_drawable_get_depth ##### -->
|
||||
<para>
|
||||
|
||||
|
||||
@@ -0,0 +1,101 @@
|
||||
<!-- ##### SECTION Title ##### -->
|
||||
Pixbufs
|
||||
|
||||
<!-- ##### SECTION Short_Description ##### -->
|
||||
Functions for rendering pixbufs on drawables
|
||||
|
||||
<!-- ##### SECTION Long_Description ##### -->
|
||||
<para>
|
||||
These functions allow to render pixbufs on drawables. Pixbufs are
|
||||
client-side images. For details on how to create and manipulate
|
||||
pixbufs, see the #GdkPixbuf API documentation.
|
||||
</para>
|
||||
|
||||
<!-- ##### SECTION See_Also ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
<!-- ##### SECTION Stability_Level ##### -->
|
||||
|
||||
|
||||
<!-- ##### SECTION Image ##### -->
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gdk_pixbuf_render_threshold_alpha ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@pixbuf:
|
||||
@bitmap:
|
||||
@src_x:
|
||||
@src_y:
|
||||
@dest_x:
|
||||
@dest_y:
|
||||
@width:
|
||||
@height:
|
||||
@alpha_threshold:
|
||||
|
||||
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gdk_pixbuf_render_pixmap_and_mask ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@pixbuf:
|
||||
@pixmap_return:
|
||||
@mask_return:
|
||||
@alpha_threshold:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gdk_pixbuf_render_pixmap_and_mask_for_colormap ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@pixbuf:
|
||||
@colormap:
|
||||
@pixmap_return:
|
||||
@mask_return:
|
||||
@alpha_threshold:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gdk_pixbuf_get_from_drawable ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@dest:
|
||||
@src:
|
||||
@cmap:
|
||||
@src_x:
|
||||
@src_y:
|
||||
@dest_x:
|
||||
@dest_y:
|
||||
@width:
|
||||
@height:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gdk_pixbuf_get_from_surface ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@dest:
|
||||
@surface:
|
||||
@src_x:
|
||||
@src_y:
|
||||
@dest_x:
|
||||
@dest_y:
|
||||
@width:
|
||||
@height:
|
||||
@Returns:
|
||||
|
||||
|
||||
@@ -0,0 +1,72 @@
|
||||
<!-- ##### SECTION Title ##### -->
|
||||
Points and Rectangles
|
||||
|
||||
<!-- ##### SECTION Short_Description ##### -->
|
||||
Simple graphical data types
|
||||
|
||||
<!-- ##### SECTION Long_Description ##### -->
|
||||
<para>
|
||||
GDK provides the #GdkPoint and #GdkRectangle data types for representing pixels
|
||||
and sets of pixels on the screen. Together with Cairo's #cairo_region_t data
|
||||
type, they make up the central types for representing graphical data.
|
||||
</para>
|
||||
<para>
|
||||
#GdkPoint is a simple structure containing an x and y coordinate of a point.
|
||||
</para>
|
||||
<para>
|
||||
#GdkRectangle is a structure holding the position and size of a rectangle.
|
||||
The intersection of two rectangles can be computed with
|
||||
gdk_rectangle_intersect(). To find the union of two rectangles use
|
||||
gdk_rectangle_union().
|
||||
</para>
|
||||
<para>
|
||||
#cairo_region_t is usually used for managing clipping of graphical operations.
|
||||
</para>
|
||||
|
||||
<!-- ##### SECTION See_Also ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
<!-- ##### SECTION Stability_Level ##### -->
|
||||
|
||||
|
||||
<!-- ##### SECTION Image ##### -->
|
||||
|
||||
|
||||
<!-- ##### STRUCT GdkPoint ##### -->
|
||||
<para>
|
||||
Defines the x and y coordinates of a point.
|
||||
</para>
|
||||
|
||||
@x: the x coordinate of the point.
|
||||
@y: the y coordinate of the point.
|
||||
|
||||
<!-- ##### TYPEDEF GdkRectangle ##### -->
|
||||
<para>
|
||||
Defines the position and size of a rectangle. It is identical to
|
||||
#cairo_rectangle_int_t.
|
||||
</para>
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gdk_rectangle_intersect ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@src1:
|
||||
@src2:
|
||||
@dest:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gdk_rectangle_union ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@src1:
|
||||
@src2:
|
||||
@dest:
|
||||
|
||||
|
||||
@@ -18,8 +18,12 @@ of an RGB pixel may be in the top 8 bits of the pixel, or may be in the lower
|
||||
</para>
|
||||
<para>
|
||||
There are several standard visuals. The visual returned
|
||||
by gdk_screen_get_system_visual() is the system's default
|
||||
visual.
|
||||
by gdk_visual_get_system() is the system's default
|
||||
visual. gdk_rgb_get_visual() return the visual most
|
||||
suited to displaying full-color image data. If you
|
||||
use the calls in #GdkRGB, you should create your windows
|
||||
using this visual (and the colormap returned by
|
||||
gdk_rgb_get_colormap()).
|
||||
</para>
|
||||
<para>
|
||||
A number of functions are provided for determining
|
||||
|
||||
@@ -369,6 +369,7 @@ that is, GUI components such as #GtkButton or #GtkTextView.
|
||||
<xi:include href="xml/gtkcontainer.xml" />
|
||||
<xi:include href="xml/gtkmenushell.xml" />
|
||||
<xi:include href="xml/gtkmisc.xml" />
|
||||
<xi:include href="xml/gtkobject.xml" />
|
||||
<xi:include href="xml/gtkrange.xml" />
|
||||
<xi:include href="xml/gtkwidget.xml" />
|
||||
<xi:include href="xml/gtkimcontext.xml" />
|
||||
|
||||
@@ -37,6 +37,9 @@ gtk_about_dialog_get_logo
|
||||
gtk_about_dialog_set_logo
|
||||
gtk_about_dialog_get_logo_icon_name
|
||||
gtk_about_dialog_set_logo_icon_name
|
||||
GtkAboutDialogActivateLinkFunc
|
||||
gtk_about_dialog_set_email_hook
|
||||
gtk_about_dialog_set_url_hook
|
||||
gtk_show_about_dialog
|
||||
<SUBSECTION Standard>
|
||||
GTK_ABOUT_DIALOG
|
||||
@@ -865,15 +868,13 @@ gtk_container_child_set_valist
|
||||
gtk_container_forall
|
||||
gtk_container_get_border_width
|
||||
gtk_container_set_border_width
|
||||
gtk_container_propagate_draw
|
||||
gtk_container_propagate_expose
|
||||
gtk_container_get_focus_chain
|
||||
gtk_container_set_focus_chain
|
||||
gtk_container_unset_focus_chain
|
||||
gtk_container_class_find_child_property
|
||||
gtk_container_class_install_child_property
|
||||
gtk_container_class_list_child_properties
|
||||
gtk_container_class_handle_border_width
|
||||
|
||||
<SUBSECTION Standard>
|
||||
GTK_CONTAINER
|
||||
GTK_IS_CONTAINER
|
||||
@@ -1674,6 +1675,7 @@ GtkImage
|
||||
GtkImageType
|
||||
gtk_image_get_icon_set
|
||||
gtk_image_get_pixbuf
|
||||
gtk_image_get_pixmap
|
||||
gtk_image_get_stock
|
||||
gtk_image_get_animation
|
||||
gtk_image_get_icon_name
|
||||
@@ -1682,6 +1684,7 @@ gtk_image_get_storage_type
|
||||
gtk_image_new_from_file
|
||||
gtk_image_new_from_icon_set
|
||||
gtk_image_new_from_pixbuf
|
||||
gtk_image_new_from_pixmap
|
||||
gtk_image_new_from_stock
|
||||
gtk_image_new_from_animation
|
||||
gtk_image_new_from_icon_name
|
||||
@@ -1689,6 +1692,7 @@ gtk_image_new_from_gicon
|
||||
gtk_image_set_from_file
|
||||
gtk_image_set_from_icon_set
|
||||
gtk_image_set_from_pixbuf
|
||||
gtk_image_set_from_pixmap
|
||||
gtk_image_set_from_stock
|
||||
gtk_image_set_from_animation
|
||||
gtk_image_set_from_icon_name
|
||||
@@ -2235,12 +2239,34 @@ GtkNotebookTab
|
||||
GtkNotebookPrivate
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
<FILE>gtkobject</FILE>
|
||||
<TITLE>GtkObject</TITLE>
|
||||
GtkObject
|
||||
GtkObjectFlags
|
||||
GTK_OBJECT_FLAGS
|
||||
gtk_object_destroy
|
||||
<SUBSECTION Standard>
|
||||
GTK_OBJECT
|
||||
GTK_IS_OBJECT
|
||||
GTK_TYPE_OBJECT
|
||||
GTK_OBJECT_CLASS
|
||||
GTK_IS_OBJECT_CLASS
|
||||
GTK_OBJECT_GET_CLASS
|
||||
|
||||
<SUBSECTION Private>
|
||||
gtk_object_get_type
|
||||
GTK_ARG_READWRITE
|
||||
GTK_OBJECT_SET_FLAGS
|
||||
GTK_OBJECT_UNSET_FLAGS
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
<FILE>gtkoffscreenwindow</FILE>
|
||||
<TITLE>GtkOffscreenWindow</TITLE>
|
||||
GtkOffscreenWindow
|
||||
gtk_offscreen_window_new
|
||||
gtk_offscreen_window_get_surface
|
||||
gtk_offscreen_window_get_pixmap
|
||||
gtk_offscreen_window_get_pixbuf
|
||||
<SUBSECTION Standard>
|
||||
GTK_OFFSCREEN_WINDOW
|
||||
@@ -2367,7 +2393,6 @@ gtk_radio_button_new_with_mnemonic
|
||||
gtk_radio_button_new_with_mnemonic_from_widget
|
||||
gtk_radio_button_set_group
|
||||
gtk_radio_button_get_group
|
||||
gtk_radio_button_join_group
|
||||
<SUBSECTION Standard>
|
||||
GTK_RADIO_BUTTON
|
||||
GTK_IS_RADIO_BUTTON
|
||||
@@ -2686,6 +2711,8 @@ GTK_RULER_GET_CLASS
|
||||
<SUBSECTION Private>
|
||||
GtkRulerPrivate
|
||||
gtk_ruler_get_type
|
||||
gtk_ruler_draw_ticks
|
||||
gtk_ruler_draw_pos
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
@@ -4352,16 +4379,6 @@ gtk_cell_renderer_set_alignment
|
||||
gtk_cell_renderer_get_padding
|
||||
gtk_cell_renderer_set_padding
|
||||
|
||||
<SUBSECTION Width-for-height>
|
||||
gtk_cell_renderer_get_preferred_height
|
||||
gtk_cell_renderer_get_preferred_height_for_width
|
||||
gtk_cell_renderer_get_preferred_size
|
||||
gtk_cell_renderer_get_preferred_width
|
||||
gtk_cell_renderer_get_preferred_width_for_height
|
||||
gtk_cell_renderer_get_request_mode
|
||||
gtk_cell_view_get_desired_height_for_width_of_row
|
||||
gtk_cell_view_get_desired_width_of_row
|
||||
|
||||
<SUBSECTION Standard>
|
||||
GTK_CELL_RENDERER
|
||||
GTK_IS_CELL_RENDERER
|
||||
@@ -4729,15 +4746,19 @@ gtk_vseparator_get_type
|
||||
<TITLE>GtkWidget</TITLE>
|
||||
GtkWidget
|
||||
GtkWidgetClass
|
||||
GtkWidgetFlags
|
||||
GTK_WIDGET_FLAGS
|
||||
GTK_WIDGET_SET_FLAGS
|
||||
GTK_WIDGET_UNSET_FLAGS
|
||||
GtkCallback
|
||||
GtkRequisition
|
||||
GtkAllocation
|
||||
GtkSelectionData
|
||||
GtkWidgetAuxInfo
|
||||
GtkWidgetShapeInfo
|
||||
GtkWidgetHelpType
|
||||
gtk_widget_new
|
||||
gtk_widget_destroy
|
||||
gtk_widget_in_destruction
|
||||
gtk_widget_destroyed
|
||||
gtk_widget_unparent
|
||||
gtk_widget_show
|
||||
@@ -4749,7 +4770,6 @@ gtk_widget_map
|
||||
gtk_widget_unmap
|
||||
gtk_widget_realize
|
||||
gtk_widget_unrealize
|
||||
gtk_widget_draw
|
||||
gtk_widget_queue_draw
|
||||
gtk_widget_queue_resize
|
||||
gtk_widget_queue_resize_no_redraw
|
||||
@@ -4785,8 +4805,9 @@ gtk_widget_get_device_events
|
||||
gtk_widget_add_device_events
|
||||
gtk_widget_get_toplevel
|
||||
gtk_widget_get_ancestor
|
||||
gtk_widget_get_colormap
|
||||
gtk_widget_set_colormap
|
||||
gtk_widget_get_visual
|
||||
gtk_widget_set_visual
|
||||
gtk_widget_get_pointer
|
||||
gtk_widget_is_ancestor
|
||||
gtk_widget_translate_coordinates
|
||||
@@ -4795,14 +4816,19 @@ gtk_widget_set_style
|
||||
gtk_widget_ensure_style
|
||||
gtk_widget_get_style
|
||||
gtk_widget_reset_rc_styles
|
||||
gtk_widget_push_colormap
|
||||
gtk_widget_pop_colormap
|
||||
gtk_widget_set_default_colormap
|
||||
gtk_widget_get_default_style
|
||||
gtk_widget_get_default_colormap
|
||||
gtk_widget_get_default_visual
|
||||
gtk_widget_set_direction
|
||||
GtkTextDirection
|
||||
gtk_widget_get_direction
|
||||
gtk_widget_set_default_direction
|
||||
gtk_widget_get_default_direction
|
||||
gtk_widget_shape_combine_region
|
||||
gtk_widget_input_shape_combine_region
|
||||
gtk_widget_shape_combine_mask
|
||||
gtk_widget_input_shape_combine_mask
|
||||
gtk_widget_path
|
||||
gtk_widget_class_path
|
||||
gtk_widget_get_composite_name
|
||||
@@ -4873,11 +4899,8 @@ gtk_widget_set_tooltip_window
|
||||
gtk_widget_get_has_tooltip
|
||||
gtk_widget_set_has_tooltip
|
||||
gtk_widget_trigger_tooltip_query
|
||||
gtk_widget_get_snapshot
|
||||
gtk_widget_get_window
|
||||
gtk_cairo_should_draw_window
|
||||
gtk_cairo_transform_to_window
|
||||
gtk_widget_get_allocated_width
|
||||
gtk_widget_get_allocated_height
|
||||
gtk_widget_get_allocation
|
||||
gtk_widget_set_allocation
|
||||
gtk_widget_get_app_paintable
|
||||
@@ -5160,11 +5183,11 @@ GTKMAIN_C_VAR
|
||||
<SECTION>
|
||||
<FILE>gtkfeatures</FILE>
|
||||
<TITLE>Feature Test Macros</TITLE>
|
||||
gtk_get_major_version
|
||||
gtk_get_minor_version
|
||||
gtk_get_micro_version
|
||||
gtk_get_binary_age
|
||||
gtk_get_interface_age
|
||||
gtk_major_version
|
||||
gtk_minor_version
|
||||
gtk_micro_version
|
||||
gtk_binary_age
|
||||
gtk_interface_age
|
||||
gtk_check_version
|
||||
|
||||
<SUBSECTION>
|
||||
@@ -5415,13 +5438,14 @@ gtk_drag_unhighlight
|
||||
<SUBSECTION Source Side>
|
||||
gtk_drag_begin
|
||||
gtk_drag_set_icon_widget
|
||||
gtk_drag_set_icon_pixmap
|
||||
gtk_drag_set_icon_pixbuf
|
||||
gtk_drag_set_icon_stock
|
||||
gtk_drag_set_icon_surface
|
||||
gtk_drag_set_icon_name
|
||||
gtk_drag_set_icon_default
|
||||
gtk_drag_check_threshold
|
||||
gtk_drag_source_set
|
||||
gtk_drag_source_set_icon
|
||||
gtk_drag_source_set_icon_pixbuf
|
||||
gtk_drag_source_set_icon_stock
|
||||
gtk_drag_source_set_icon_name
|
||||
@@ -5457,6 +5481,7 @@ gtk_binding_set_add_path
|
||||
<FILE>gtkenums</FILE>
|
||||
<TITLE>Standard Enumerations</TITLE>
|
||||
GtkAccelFlags
|
||||
GtkAnchorType
|
||||
GtkArrowPlacement
|
||||
GtkArrowType
|
||||
GtkAttachOptions
|
||||
@@ -5487,6 +5512,7 @@ GtkSubmenuDirection
|
||||
GtkSubmenuPlacement
|
||||
GtkToolbarStyle
|
||||
GtkUpdateType
|
||||
GtkVisibility
|
||||
GtkWindowPosition
|
||||
GtkWindowType
|
||||
GtkSortType
|
||||
@@ -6268,14 +6294,16 @@ gtk_orientable_get_type
|
||||
<SECTION>
|
||||
<FILE>gtksizerequest</FILE>
|
||||
<TITLE>GtkSizeRequest</TITLE>
|
||||
GtkSizeRequest
|
||||
GtkSizeRequestIface
|
||||
GtkSizeRequestMode
|
||||
GtkRequestedSize
|
||||
gtk_widget_get_preferred_height
|
||||
gtk_widget_get_preferred_width
|
||||
gtk_widget_get_preferred_height_for_width
|
||||
gtk_widget_get_preferred_width_for_height
|
||||
gtk_widget_get_request_mode
|
||||
gtk_widget_get_preferred_size
|
||||
gtk_size_request_get_height
|
||||
gtk_size_request_get_width
|
||||
gtk_size_request_get_height_for_width
|
||||
gtk_size_request_get_width_for_height
|
||||
gtk_size_request_get_request_mode
|
||||
gtk_size_request_get_size
|
||||
gtk_distribute_natural_allocation
|
||||
|
||||
<SUBSECTION Standard>
|
||||
@@ -6286,7 +6314,7 @@ GTK_IS_SIZE_REQUEST
|
||||
GTK_TYPE_SIZE_REQUEST
|
||||
|
||||
<SUBSECTION Private>
|
||||
gtk_widget_get_type
|
||||
gtk_size_request_get_type
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
@@ -6320,18 +6348,16 @@ GtkApplicationPrivate
|
||||
<FILE>gtkwrapbox</FILE>
|
||||
<TITLE>GtkWrapBox</TITLE>
|
||||
GtkWrapBox
|
||||
|
||||
gtk_wrap_box_new
|
||||
GtkWrapBoxPacking
|
||||
gtk_wrap_box_insert_child
|
||||
gtk_wrap_box_reorder_child
|
||||
GtkWrapAllocationMode
|
||||
gtk_wrap_box_set_allocation_mode
|
||||
gtk_wrap_box_get_allocation_mode
|
||||
GtkWrapBoxSpreading
|
||||
gtk_wrap_box_set_vertical_spreading
|
||||
gtk_wrap_box_get_vertical_spreading
|
||||
gtk_wrap_box_set_horizontal_spreading
|
||||
gtk_wrap_box_get_horizontal_spreading
|
||||
gtk_wrap_box_set_spreading
|
||||
gtk_Wrap_box_get_spreading
|
||||
gtk_wrap_box_set_vertical_spacing
|
||||
gtk_wrap_box_get_vertical_spacing
|
||||
gtk_wrap_box_set_horizontal_spacing
|
||||
|
||||
@@ -93,6 +93,7 @@ gtk_message_dialog_get_type
|
||||
gtk_misc_get_type
|
||||
gtk_mount_operation_get_type
|
||||
gtk_notebook_get_type
|
||||
gtk_object_get_type
|
||||
gtk_offscreen_window_get_type
|
||||
gtk_orientable_get_type
|
||||
gtk_page_setup_get_type
|
||||
@@ -130,6 +131,7 @@ gtk_separator_menu_item_get_type
|
||||
gtk_separator_tool_item_get_type
|
||||
gtk_settings_get_type
|
||||
gtk_size_group_get_type
|
||||
gtk_size_request_get_type
|
||||
gtk_socket_get_type
|
||||
gtk_spin_button_get_type
|
||||
gtk_spinner_get_type
|
||||
|
||||
@@ -20,11 +20,11 @@
|
||||
|
||||
<para>
|
||||
The steps outlined in the following sections assume that your
|
||||
application is working with GTK+ 2.24, which is the final stable
|
||||
application is working with GTK+ 2.22, which is the final stable
|
||||
release of GTK+ 2.x. It includes all the necessary APIs and tools
|
||||
to help you port your application to GTK+ 3. If you are still using
|
||||
an older version of GTK+ 2.x, you should first get your application
|
||||
to build and work with 2.24.
|
||||
to build and work with 2.22.
|
||||
</para>
|
||||
|
||||
<section>
|
||||
@@ -44,6 +44,10 @@
|
||||
<term><filename>gtk/gtkunixprint.h</filename></term>
|
||||
<listitem>for low-level, UNIX-specific printing functions</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><filename>gdk-pixbuf/gdk-pixbuf.h</filename></term>
|
||||
<listitem>for GdkPixbuf</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><filename>gdk/gdk.h</filename></term>
|
||||
<listitem>for GDK</listitem>
|
||||
@@ -53,8 +57,8 @@
|
||||
<listitem>for GDK functions that are X11-specific</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><filename>gdk/gdkwin32.h</filename></term>
|
||||
<listitem>for GDK functions that are Windows-specific</listitem>
|
||||
<term><filename>gdk/gdkkeysyms.h</filename></term>
|
||||
<listitem>if you need the GDK keysym definitions</listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
(these relative paths are assuming that you are using the include
|
||||
@@ -66,7 +70,7 @@
|
||||
you can use defines to disable inclusion of individual headers,
|
||||
as follows:
|
||||
<programlisting>
|
||||
make CFLAGS+="-DGTK_DISABLE_SINGLE_INCLUDES"
|
||||
make CFLAGS+="-DG_DISABLE_SINGLE_INCLUDES -DGDK_PIXBUF_DISABLE_SINGLE_INCLUDES -DGTK_DISABLE_SINGLE_INCLUDES"
|
||||
</programlisting>
|
||||
</para>
|
||||
</section>
|
||||
@@ -86,7 +90,7 @@
|
||||
you can use defines to remove deprecated symbols from the header files,
|
||||
as follows:
|
||||
<programlisting>
|
||||
make CFLAGS+="-DGDK_DISABLE_DEPRECATED -DGTK_DISABLE_DEPRECATED"
|
||||
make CFLAGS+="-DG_DISABLE_DEPRECATED -DGDK_PIXBUF_DISABLE_DEPRECATED -DGDK_DISABLE_DEPRECATED -DGTK_DISABLE_DEPRECATED"
|
||||
</programlisting>
|
||||
</para>
|
||||
</section>
|
||||
@@ -113,11 +117,12 @@
|
||||
<title>Replace GDK_<keyname> with GDK_KEY_<keyname></title>
|
||||
|
||||
<para>
|
||||
Key constants have gained a <literal>_KEY_</literal> infix.
|
||||
Key constants have gained a <literal>_KEY</literal>, prefix.
|
||||
For example, <literal>GDK_a</literal> is now
|
||||
<literal>GDK_KEY_a</literal>. In GTK+ 2, the old names continue
|
||||
to be available. In GTK+ 3 however, the old names will require
|
||||
an explicit include of the <literal>gdkkeysyms-compat.h</literal> header.
|
||||
an explicit include of the
|
||||
<literal>gdkkeysyms-compat.h</literal> header.
|
||||
</para>
|
||||
|
||||
</section>
|
||||
@@ -131,7 +136,7 @@
|
||||
</para>
|
||||
<para>
|
||||
The #GdkGC and #GdkImage objects, as well as all the functions using
|
||||
them, are gone. This includes the <literal>gdk_draw</literal> family
|
||||
them are gone. This includes the <literal>gdk_draw_</literal> family
|
||||
of functions like gdk_draw_rectangle() and gdk_draw_drawable(). As
|
||||
#GdkGC is roughly equivalent to #cairo_t and #GdkImage was used for
|
||||
drawing images to GdkDrawables, which cairo supports automatically,
|
||||
@@ -245,7 +250,7 @@ cairo_destroy (cr);
|
||||
</para>
|
||||
</example>
|
||||
<section>
|
||||
<title>What should you be aware of ?</title>
|
||||
<title>what should you be aware of ?</title>
|
||||
<formalpara><title>No more stippling</title>
|
||||
<para>
|
||||
Stippling is the usage of a bi-level mask, called a #GdkBitmap.
|
||||
@@ -316,7 +321,7 @@ cairo_destroy (cr);
|
||||
development to be able to change your code.
|
||||
</para>
|
||||
</formalpara>
|
||||
<formalpara><title>Using pango_cairo_show_layout(<!-- -->) instead of gdk_draw_layout_with_colors(<!-- -->)</title>
|
||||
<formalpara><title>Using pango_cairo_show_layout() instead of gdk_draw_layout_with_colors()</title>
|
||||
<para>
|
||||
GDK provided a way to ignore the color attributes of text and use
|
||||
a hardcoded text color with the gdk_draw_layout_with_colors()
|
||||
@@ -339,7 +344,7 @@ cairo_destroy (cr);
|
||||
<para>
|
||||
This section outlines porting tasks that you need to tackle when
|
||||
you get to the point that you actually build your application against
|
||||
GTK+ 3. Making it possible to prepare for these in GTK+ 2.24 would
|
||||
GTK+ 3. Making it possible to prepare for these in GTK+ 2.22 would
|
||||
have been either impossible or impractical.
|
||||
</para>
|
||||
|
||||
@@ -389,208 +394,6 @@ cairo_destroy (cr);
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<title>Replace GdkPixmap by cairo surfaces</title>
|
||||
<para>
|
||||
The #GdkPixmap object and related functions have been removed.
|
||||
In the cairo-centric world of GTK+ 3, cairo surfaces take over
|
||||
the role of pixmaps.
|
||||
</para>
|
||||
<example>
|
||||
<title>Creating custom cursors</title>
|
||||
<para>
|
||||
One place where pixmaps were commonly used is to create custom
|
||||
cursors:
|
||||
<programlisting>
|
||||
GdkCursor *cursor;
|
||||
GdkPixmap *pixmap;
|
||||
cairo_t *cr;
|
||||
GdkColor fg = { 0, 0, 0, 0 };
|
||||
|
||||
pixmap = gdk_pixmap_new (NULL, 1, 1, 1);
|
||||
|
||||
cr = gdk_cairo_create (pixmap);
|
||||
cairo_rectangle (cr, 0, 0, 1, 1);
|
||||
cairo_fill (cr);
|
||||
cairo_destroy (cr);
|
||||
|
||||
cursor = gdk_cursor_new_from_pixmap (pixmap, pixmap, &fg, &fg, 0, 0);
|
||||
|
||||
g_object_unref (pixmap);
|
||||
</programlisting>
|
||||
The same can be achieved without pixmaps, by drawing onto
|
||||
an image surface:
|
||||
<programlisting>
|
||||
GdkCursor *cursor;
|
||||
cairo_surface_t *s;
|
||||
cairo_t *cr;
|
||||
GdkPixbuf *pixbuf;
|
||||
|
||||
s = cairo_image_surface_create (CAIRO_FORMAT_A1, 3, 3);
|
||||
cr = cairo_create (s);
|
||||
cairo_arc (cr, 1.5, 1.5, 1.5, 0, 2 * M_PI);
|
||||
cairo_fill (cr);
|
||||
cairo_destroy (cr);
|
||||
|
||||
pixbuf = gdk_pixbuf_get_from_surface (NULL, s,
|
||||
0, 0, 0, 0,
|
||||
3, 3);
|
||||
|
||||
cairo_surface_destroy (s);
|
||||
|
||||
cursor = gdk_cursor_new_from_pixbuf (display, pixbuf, 0, 0);
|
||||
|
||||
g_object_unref (pixbuf);
|
||||
</programlisting>
|
||||
</para>
|
||||
</example>
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<title>Replace colormaps by visuals</title>
|
||||
<para>
|
||||
For drawing with cairo, it is not necessary to allocate colors, and
|
||||
a #GdkVisual provides enough information for cairo to handle colors
|
||||
in 'native' surfaces. Therefore, #GdkColormap and related functions
|
||||
have been removed in GTK+ 3, and visuals are used instead. The
|
||||
colormap-handling functions of #GtkWidget (gtk_widget_set_colormap(),
|
||||
etc) have been removed and gtk_window_set_visual() has been added.
|
||||
</para>
|
||||
<example><title>Setting up a translucent window</title>
|
||||
<para>You might have a screen-changed handler like the following
|
||||
to set up a translucent window with an alpha-channel:
|
||||
</para>
|
||||
<programlisting>
|
||||
static void
|
||||
on_alpha_screen_changed (GtkWidget *widget,
|
||||
GdkScreen *old_screen,
|
||||
GtkWidget *label)
|
||||
{
|
||||
GdkScreen *screen = gtk_widget_get_screen (widget);
|
||||
GdkColormap *colormap = gdk_screen_get_rgba_colormap (screen);
|
||||
|
||||
if (colormap == NULL)
|
||||
colormap = gdk_screen_get_default_colormap (screen);
|
||||
|
||||
gtk_widget_set_colormap (widget, colormap);
|
||||
}
|
||||
</programlisting>
|
||||
<para>
|
||||
With visuals instead of colormaps, this will look as follows:
|
||||
</para>
|
||||
<programlisting>
|
||||
static void
|
||||
on_alpha_screen_changed (GtkWindow *window,
|
||||
GdkScreen *old_screen,
|
||||
GtkWidget *label)
|
||||
{
|
||||
GdkScreen *screen = gtk_widget_get_screen (GTK_WIDGET (window));
|
||||
GdkVisual *visual = gdk_screen_get_rgba_visual (screen);
|
||||
|
||||
if (visual == NULL)
|
||||
visual = gdk_screen_get_system_visual (screen);
|
||||
|
||||
gtk_window_set_visual (window, visual);
|
||||
}
|
||||
</programlisting>
|
||||
</example>
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<title>The GtkWidget::draw signal</title>
|
||||
<para>
|
||||
The GtkWidget #GtkWidget::expose-event signal has been replaced by
|
||||
a new #GtkWidget::draw signal, which takes a #cairo_t instead of
|
||||
an expose event. The cairo context is being set up so that the origin
|
||||
at (0, 0) coincides with the upper left corner of the widget, and
|
||||
is properly clipped.
|
||||
</para>
|
||||
<note><para>In other words, the cairo context of the draw signal is set
|
||||
up in 'widget coordinates', which is different from traditional expose
|
||||
event handlers, which always assume 'window coordinates'.
|
||||
</para></note>
|
||||
<para>
|
||||
The widget is expected to draw itself with its allocated size, which
|
||||
is available via the new gtk_widget_get_allocated_width() and
|
||||
gtk_widget_get_allocated_height() functions. It is not necessary to
|
||||
check for GTK_WIDGET_IS_DRAWABLE(), since GTK+ already does this check
|
||||
before emitting the ::draw signal.
|
||||
</para>
|
||||
<para>
|
||||
There are some special considerations for widgets with multiple windows.
|
||||
Expose events are window-specific, and widgets with multiple windows
|
||||
could expect to get an expose event for each window that needs to be
|
||||
redrawn. Therefore, multi-window expose event handlers typically look
|
||||
like this:
|
||||
<informalexample><programlisting>
|
||||
if (event->window == widget->window1)
|
||||
{
|
||||
/* ... draw window1 ... */
|
||||
}
|
||||
else if (event->window == widget->window2)
|
||||
{
|
||||
/* ... draw window2 ... */
|
||||
}
|
||||
...
|
||||
</programlisting></informalexample>
|
||||
In contrast, the ::draw signal handler may have to draw multiple
|
||||
windows in one call. GTK+ has a convenience function
|
||||
gtk_cairo_should_draw_window() that can be used to find out if
|
||||
a window needs to be drawn. With that, the example above would look
|
||||
like this (note that the 'else' is gone):
|
||||
<informalexample><programlisting>
|
||||
if (gtk_cairo_should_draw_window (cr, widget->window1)
|
||||
{
|
||||
/* ... draw window1 ... */
|
||||
}
|
||||
if (gtk_cairo_should_draw_window (cr, widget->window2)
|
||||
{
|
||||
/* ... draw window2 ... */
|
||||
}
|
||||
...
|
||||
</programlisting></informalexample>
|
||||
Another convenience function that can help when implementing
|
||||
::draw for multi-window widgets is gtk_cairo_transform_to_window(),
|
||||
which transforms a cairo context from widget-relative coordinates
|
||||
to window-relative coordinates.
|
||||
</para>
|
||||
<para>
|
||||
All GtkStyle drawing functions (gtk_paint_box(), etc) have been changed
|
||||
to take a #cairo_t instead of a window and a clip area. ::draw
|
||||
implementations will usually just use the cairo context that has been
|
||||
passed in for this.
|
||||
</para>
|
||||
<example><title>A simple ::draw function</title>
|
||||
<programlisting>
|
||||
gboolean
|
||||
gtk_arrow_draw (GtkWidget *widget,
|
||||
cairo_t *cr)
|
||||
{
|
||||
gint x, y;
|
||||
gint width, height;
|
||||
gint extent;
|
||||
|
||||
width = gtk_widget_get_allocated_width (widget);
|
||||
height = gtk_widget_get_allocated_height (widget);
|
||||
|
||||
extent = MIN (width - 2 * PAD, height - 2 * PAD);
|
||||
x = PAD;
|
||||
y = PAD;
|
||||
|
||||
gtk_paint_arrow (gtk_widget_get_style (widget),
|
||||
cr,
|
||||
gtk_widget_get_state (widget),
|
||||
GTK_SHADOW_OUT,
|
||||
widget,
|
||||
"arrow",
|
||||
widget->priv->arrow_type,
|
||||
TRUE,
|
||||
x, y, extent, extent);
|
||||
}
|
||||
</programlisting>
|
||||
</example>
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<title>GtkProgressBar orientation</title>
|
||||
|
||||
@@ -623,45 +426,6 @@ gtk_arrow_draw (GtkWidget *widget,
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<title>GtkScrolledWindow policy</title>
|
||||
|
||||
<para>
|
||||
The default values for the #GtkScrolledWindow:hscrollbar-policy and
|
||||
#GtkScrolledWindow:vscrollbar-policy properties have been changed from
|
||||
'never' to 'automatic'. If your application was relying on the default
|
||||
value, you will have explicitly set it explicitly.
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<title>GtkObject is gone</title>
|
||||
|
||||
<para>
|
||||
GtkObject has been removed in GTK+ 3. Its remaining functionality,
|
||||
the ::destroy signal, has been moved to GtkWidget. If you have non-widget
|
||||
classes that are directly derived from GtkObject, you have to make
|
||||
them derive from #GInitiallyUnowned (or, if you don't need the floating
|
||||
functionality, #GObject). If you have widgets that override the
|
||||
destroy class handler, you have to adust your class_init function,
|
||||
since destroy is now a member of GtkWidgetClass:
|
||||
<informalexample><programlisting>
|
||||
GtkObjectClass *object_class = GTK_OBJECT_CLASS (class);
|
||||
|
||||
object_class->destroy = my_destroy;
|
||||
</programlisting></informalexample>
|
||||
becomes
|
||||
<informalexample><programlisting>
|
||||
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (class);
|
||||
|
||||
widget_class->destroy = my_destroy;
|
||||
</programlisting></informalexample>
|
||||
In the unlikely case that you have a non-widget class that is derived
|
||||
from GtkObject and makes use of the destroy functionality, you have
|
||||
to implement ::destroy yourself.
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<title>Prevent mixed linkage</title>
|
||||
<para>
|
||||
|
||||
@@ -95,10 +95,10 @@ from functions?
|
||||
<answer>
|
||||
|
||||
<para>
|
||||
See the documentation for #GObject and #GInitiallyUnowned. For #GObject note
|
||||
specifically g_object_ref() and g_object_unref(). #GInitiallyUnowned is a
|
||||
subclass of #GObject so the same points apply, except that it has a "floating"
|
||||
state (explained in its documentation).
|
||||
See the documentation for #GObject and #GtkObject. For #GObject note
|
||||
specifically g_object_ref() and g_object_unref(). #GtkObject is a subclass
|
||||
of #GObject so the same points apply, except that it has a "floating" state
|
||||
(explained in its documentation).
|
||||
</para>
|
||||
|
||||
<para>
|
||||
@@ -115,7 +115,7 @@ url="http://bugzilla.gnome.org">http://bugzilla.gnome.org</ulink>.)
|
||||
<qandaentry>
|
||||
<question>
|
||||
<para>
|
||||
Why does my program leak memory, if I destroy a widget immediately
|
||||
Why does my program leak memory, if I destroy a widget immediately
|
||||
after creating it ?
|
||||
</para>
|
||||
</question>
|
||||
@@ -127,26 +127,27 @@ If <structname>GtkFoo</structname> isn't a toplevel window, then
|
||||
foo = gtk_foo_new (<!-- -->);
|
||||
gtk_widget_destroy (foo);
|
||||
</programlisting></informalexample>
|
||||
is a memory leak, because no one assumed the initial floating
|
||||
reference. If you are using a widget and you aren't immediately
|
||||
packing it into a container, then you probably want standard
|
||||
is a memory leak, because no one assumed the initial floating
|
||||
reference. If you are using a widget and you aren't immediately
|
||||
packing it into a container, then you probably want standard
|
||||
reference counting, not floating reference counting.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
To to get this, you must acquire a reference to the widget and drop the
|
||||
floating reference (<quote>ref and sink</quote> in GTK+ parlance) after
|
||||
To to get this, you must acquire a reference to the widget and drop the
|
||||
floating reference (<quote>ref and sink</quote> in GTK+ parlance) after
|
||||
creating it:
|
||||
<informalexample><programlisting>
|
||||
foo = gtk_foo_new (<!-- -->);
|
||||
g_object_ref_sink (foo);
|
||||
g_object_ref (foo);
|
||||
gtk_object_sink (GTK_OBJECT (foo));
|
||||
</programlisting></informalexample>
|
||||
When you want to get rid of the widget, you must call gtk_widget_destroy()
|
||||
to break any external connections to the widget before dropping your
|
||||
to break any external connections to the widget before dropping your
|
||||
reference:
|
||||
<informalexample><programlisting>
|
||||
gtk_widget_destroy (foo);
|
||||
g_object_unref (foo);
|
||||
gtk_widget_destroy (foo);
|
||||
g_object_unref (foo);
|
||||
</programlisting></informalexample>
|
||||
When you immediately add a widget to a container, it takes care of
|
||||
assuming the initial floating reference and you don't have to worry
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
gtkaccelmap.sgml
|
||||
gtkactiongroup.sgml
|
||||
gtkaboutdialog.sgml
|
||||
gtkbbox.sgml
|
||||
@@ -7,21 +6,16 @@ gtkbuilder.sgml
|
||||
gtkbutton.sgml
|
||||
gtkcalendar.sgml
|
||||
gtkcelleditable.sgml
|
||||
gtkcombobox.sgml
|
||||
gtkcomboboxentry.sgml
|
||||
gtkeditable.sgml
|
||||
gtkentrybuffer.sgml
|
||||
gtkhbox.sgml
|
||||
gtkiconview.sgml
|
||||
gtkimcontextsimple.sgml
|
||||
gtkimmulticontext.sgml
|
||||
gtklinkbutton.sgml
|
||||
gtkmessagedialog.sgml
|
||||
gtknotebook.sgml
|
||||
gtkobject.sgml
|
||||
gtkorientable.sgml
|
||||
gtkpagesetupunixdialog.sgml
|
||||
gtkpapersize.sgml
|
||||
gtkprinter.sgml
|
||||
gtkradioaction.sgml
|
||||
gtkradiobutton.sgml
|
||||
@@ -43,9 +37,7 @@ gtktesting.sgml
|
||||
gtktextiter.sgml
|
||||
gtktexttagtable.sgml
|
||||
gtktoggleaction.sgml
|
||||
gtktoolbar.sgml
|
||||
gtktoolitem.sgml
|
||||
gtktooltip.sgml
|
||||
gtktreednd.sgml
|
||||
gtktypeutils.sgml
|
||||
gtkwindow.sgml
|
||||
|
||||
@@ -0,0 +1,173 @@
|
||||
<!-- ##### SECTION Title ##### -->
|
||||
Accelerator Maps
|
||||
|
||||
<!-- ##### SECTION Short_Description ##### -->
|
||||
Loadable keyboard accelerator specifications
|
||||
|
||||
<!-- ##### SECTION Long_Description ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
<!-- ##### SECTION See_Also ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
<!-- ##### SECTION Stability_Level ##### -->
|
||||
|
||||
|
||||
<!-- ##### SECTION Image ##### -->
|
||||
|
||||
|
||||
<!-- ##### STRUCT GtkAccelMap ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
|
||||
<!-- ##### SIGNAL GtkAccelMap::changed ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@accelmap: the object which received the signal.
|
||||
@arg1:
|
||||
@arg2:
|
||||
@arg3:
|
||||
|
||||
<!-- ##### USER_FUNCTION GtkAccelMapForeach ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@data:
|
||||
@accel_path:
|
||||
@accel_key:
|
||||
@accel_mods:
|
||||
@changed:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_accel_map_add_entry ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@accel_path:
|
||||
@accel_key:
|
||||
@accel_mods:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_accel_map_lookup_entry ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@accel_path:
|
||||
@key:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_accel_map_change_entry ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@accel_path:
|
||||
@accel_key:
|
||||
@accel_mods:
|
||||
@replace:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_accel_map_load ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@file_name:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_accel_map_save ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@file_name:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_accel_map_foreach ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@data:
|
||||
@foreach_func:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_accel_map_load_fd ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@fd:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_accel_map_save_fd ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@fd:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_accel_map_load_scanner ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@scanner:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_accel_map_add_filter ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@filter_pattern:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_accel_map_foreach_unfiltered ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@data:
|
||||
@foreach_func:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_accel_map_get ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@void:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_accel_map_lock_path ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@accel_path:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_accel_map_unlock_path ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@accel_path:
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
GtkAdjustment
|
||||
|
||||
<!-- ##### SECTION Short_Description ##### -->
|
||||
A representation of an adjustable bounded value
|
||||
A GtkObject representing an adjustable bounded value
|
||||
|
||||
<!-- ##### SECTION Long_Description ##### -->
|
||||
<para>
|
||||
|
||||
@@ -0,0 +1,461 @@
|
||||
<!-- ##### SECTION Title ##### -->
|
||||
GtkComboBox
|
||||
|
||||
<!-- ##### SECTION Short_Description ##### -->
|
||||
A widget used to choose from a list of items
|
||||
|
||||
<!-- ##### SECTION Long_Description ##### -->
|
||||
<para>
|
||||
A #GtkComboBox is a widget that allows the user to choose from a
|
||||
list of valid choices. The #GtkComboBox displays the selected
|
||||
choice. When activated, the #GtkComboBox displays a popup
|
||||
which allows the user to make a new choice. The style in which
|
||||
the selected value is displayed, and the style of the popup is
|
||||
determined by the current theme. It may be similar to a #GtkOptionMenu,
|
||||
or similar to a Windows-style combo box.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Unlike its predecessors #GtkCombo and #GtkOptionMenu, the #GtkComboBox
|
||||
uses the model-view pattern; the list of valid choices is specified in the
|
||||
form of a tree model, and the display of the choices can be adapted to
|
||||
the data in the model by using cell renderers, as you would in a tree view.
|
||||
This is possible since #GtkComboBox implements the #GtkCellLayout interface.
|
||||
The tree model holding the valid choices is not restricted to a flat list,
|
||||
it can be a real tree, and the popup will reflect the tree structure.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
In addition to the model-view API, #GtkComboBox offers a simple API which
|
||||
is suitable for text-only combo boxes, and hides the complexity of managing
|
||||
the data in a model. It consists of the functions gtk_combo_box_new_text(),
|
||||
gtk_combo_box_append_text(), gtk_combo_box_insert_text(),
|
||||
gtk_combo_box_prepend_text(), gtk_combo_box_remove_text() and
|
||||
gtk_combo_box_get_active_text().
|
||||
</para>
|
||||
|
||||
<!-- ##### SECTION See_Also ##### -->
|
||||
<para>
|
||||
#GtkComboBoxEntry, #GtkTreeModel, #GtkCellRenderer
|
||||
</para>
|
||||
|
||||
<!-- ##### SECTION Stability_Level ##### -->
|
||||
|
||||
|
||||
<!-- ##### SECTION Image ##### -->
|
||||
|
||||
|
||||
<!-- ##### STRUCT GtkComboBox ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
|
||||
<!-- ##### SIGNAL GtkComboBox::changed ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@combobox: the object which received the signal.
|
||||
|
||||
<!-- ##### SIGNAL GtkComboBox::move-active ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@combobox: the object which received the signal.
|
||||
@arg1:
|
||||
|
||||
<!-- ##### SIGNAL GtkComboBox::popdown ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@combobox: the object which received the signal.
|
||||
@Returns:
|
||||
|
||||
<!-- ##### SIGNAL GtkComboBox::popup ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@combobox: the object which received the signal.
|
||||
|
||||
<!-- ##### ARG GtkComboBox:active ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
<!-- ##### ARG GtkComboBox:add-tearoffs ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
<!-- ##### ARG GtkComboBox:button-sensitivity ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
<!-- ##### ARG GtkComboBox:column-span-column ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
<!-- ##### ARG GtkComboBox:focus-on-click ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
<!-- ##### ARG GtkComboBox:has-frame ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
<!-- ##### ARG GtkComboBox:model ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
<!-- ##### ARG GtkComboBox:popup-shown ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
<!-- ##### ARG GtkComboBox:row-span-column ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
<!-- ##### ARG GtkComboBox:tearoff-title ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
<!-- ##### ARG GtkComboBox:wrap-width ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
<!-- ##### ARG GtkComboBox:appears-as-list ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
<!-- ##### ARG GtkComboBox:arrow-size ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
<!-- ##### ARG GtkComboBox:shadow-type ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
<!-- ##### FUNCTION gtk_combo_box_new ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@void:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_combo_box_new_with_model ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@model:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_combo_box_get_wrap_width ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@combo_box:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_combo_box_set_wrap_width ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@combo_box:
|
||||
@width:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_combo_box_get_row_span_column ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@combo_box:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_combo_box_set_row_span_column ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@combo_box:
|
||||
@row_span:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_combo_box_get_column_span_column ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@combo_box:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_combo_box_set_column_span_column ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@combo_box:
|
||||
@column_span:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_combo_box_get_active ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@combo_box:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_combo_box_set_active ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@combo_box:
|
||||
@index_:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_combo_box_get_active_iter ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@combo_box:
|
||||
@iter:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_combo_box_set_active_iter ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@combo_box:
|
||||
@iter:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_combo_box_get_model ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@combo_box:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_combo_box_set_model ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@combo_box:
|
||||
@model:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_combo_box_new_text ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@void:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_combo_box_append_text ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@combo_box:
|
||||
@text:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_combo_box_insert_text ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@combo_box:
|
||||
@position:
|
||||
@text:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_combo_box_prepend_text ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@combo_box:
|
||||
@text:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_combo_box_remove_text ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@combo_box:
|
||||
@position:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_combo_box_get_active_text ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@combo_box:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_combo_box_popup_for_device ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@combo_box:
|
||||
@device:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_combo_box_popup ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@combo_box:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_combo_box_popdown ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@combo_box:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_combo_box_get_popup_accessible ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@combo_box:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_combo_box_get_row_separator_func ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@combo_box:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_combo_box_set_row_separator_func ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@combo_box:
|
||||
@func:
|
||||
@data:
|
||||
@destroy:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_combo_box_set_add_tearoffs ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@combo_box:
|
||||
@add_tearoffs:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_combo_box_get_add_tearoffs ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@combo_box:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_combo_box_set_title ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@combo_box:
|
||||
@title:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_combo_box_get_title ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@combo_box:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_combo_box_set_focus_on_click ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@combo:
|
||||
@focus_on_click:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_combo_box_get_focus_on_click ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@combo:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_combo_box_set_button_sensitivity ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@combo_box:
|
||||
@sensitivity:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_combo_box_get_button_sensitivity ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@combo_box:
|
||||
@Returns:
|
||||
|
||||
|
||||
@@ -0,0 +1,123 @@
|
||||
<!-- ##### SECTION Title ##### -->
|
||||
GtkComboBoxEntry
|
||||
|
||||
<!-- ##### SECTION Short_Description ##### -->
|
||||
A text entry field with a dropdown list
|
||||
|
||||
<!-- ##### SECTION Long_Description ##### -->
|
||||
<para>
|
||||
A #GtkComboBoxEntry is a widget that allows the user to choose from a
|
||||
list of valid choices or enter a different value. It is very similar
|
||||
to a #GtkComboBox, but it displays the selected value in an entry to
|
||||
allow modifying it.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
In contrast to a #GtkComboBox, the underlying model of a #GtkComboBoxEntry
|
||||
must always have a text column (see gtk_combo_box_entry_set_text_column()),
|
||||
and the entry will show the content of the text column in the selected row.
|
||||
To get the text from the entry, use gtk_combo_box_get_active_text().
|
||||
</para>
|
||||
|
||||
<para>
|
||||
The changed signal will be emitted while typing into a GtkComboBoxEntry,
|
||||
as well as when selecting an item from the GtkComboBoxEntry's list. Use
|
||||
gtk_combo_box_get_active() or gtk_combo_box_get_active_iter() to discover
|
||||
whether an item was actually selected from the list.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Connect to the activate signal of the GtkEntry (use gtk_bin_get_child())
|
||||
to detect when the user actually finishes entering text.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
The convenience API to construct simple text-only #GtkComboBox<!-- -->es
|
||||
can also be used with #GtkComboBoxEntry<!-- -->s which have been constructed
|
||||
with gtk_combo_box_entry_new_text().
|
||||
</para>
|
||||
|
||||
<para>
|
||||
If you have special needs that go beyond a simple entry (e.g. input validation),
|
||||
it is possible to replace the child entry by a different widget using
|
||||
gtk_container_remove() and gtk_container_add().
|
||||
</para>
|
||||
|
||||
<refsect2 id="GtkComboBoxEntry-BUILDER-UI">
|
||||
<title>GtkComboBoxEntry as GtkBuildable</title>
|
||||
<para>
|
||||
Beyond the <attributes> support that is shared by all
|
||||
<link linkend="GtkCellLayout-BUILDER-UI">GtkCellLayout</link> implementation,
|
||||
GtkComboBoxEntry makes the entry available in UI definitions as an internal
|
||||
child with name "entry".
|
||||
</para>
|
||||
</refsect2>
|
||||
|
||||
<!-- ##### SECTION See_Also ##### -->
|
||||
<para>
|
||||
#GtkComboBox
|
||||
</para>
|
||||
|
||||
<!-- ##### SECTION Stability_Level ##### -->
|
||||
|
||||
|
||||
<!-- ##### SECTION Image ##### -->
|
||||
|
||||
|
||||
<!-- ##### STRUCT GtkComboBoxEntry ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
|
||||
<!-- ##### ARG GtkComboBoxEntry:text-column ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
<!-- ##### FUNCTION gtk_combo_box_entry_new ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@void:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_combo_box_entry_new_with_model ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@model:
|
||||
@text_column:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_combo_box_entry_new_text ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@void:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_combo_box_entry_set_text_column ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@entry_box:
|
||||
@text_column:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_combo_box_entry_get_text_column ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@entry_box:
|
||||
@Returns:
|
||||
|
||||
|
||||
@@ -58,7 +58,7 @@ of their children.
|
||||
<para>
|
||||
The size requisition phase of the widget layout process operates top-down.
|
||||
It starts at a top-level widget, typically a #GtkWindow. The top-level widget
|
||||
asks its child for its size requisition by calling gtk_widget_get_preferred_size().
|
||||
asks its child for its size requisition by calling gtk_size_request_get_size().
|
||||
To determine its requisition, the child asks its own children for their
|
||||
requisitions and so on. Finally, the top-level widget will get a requisition
|
||||
back from its child.
|
||||
|
||||
@@ -0,0 +1,171 @@
|
||||
<!-- ##### SECTION Title ##### -->
|
||||
GtkEntryBuffer
|
||||
|
||||
<!-- ##### SECTION Short_Description ##### -->
|
||||
|
||||
|
||||
<!-- ##### SECTION Long_Description ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
<!-- ##### SECTION See_Also ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
<!-- ##### SECTION Stability_Level ##### -->
|
||||
|
||||
|
||||
<!-- ##### SECTION Image ##### -->
|
||||
|
||||
|
||||
<!-- ##### STRUCT GtkEntryBuffer ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
|
||||
<!-- ##### SIGNAL GtkEntryBuffer::deleted-text ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@entrybuffer: the object which received the signal.
|
||||
@arg1:
|
||||
@arg2:
|
||||
|
||||
<!-- ##### SIGNAL GtkEntryBuffer::inserted-text ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@entrybuffer: the object which received the signal.
|
||||
@arg1:
|
||||
@arg2:
|
||||
@arg3:
|
||||
|
||||
<!-- ##### ARG GtkEntryBuffer:length ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
<!-- ##### ARG GtkEntryBuffer:max-length ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
<!-- ##### ARG GtkEntryBuffer:text ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
<!-- ##### FUNCTION gtk_entry_buffer_new ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@initial_chars:
|
||||
@n_initial_chars:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_entry_buffer_get_text ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@buffer:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_entry_buffer_set_text ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@buffer:
|
||||
@chars:
|
||||
@n_chars:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_entry_buffer_get_bytes ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@buffer:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_entry_buffer_get_length ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@buffer:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_entry_buffer_get_max_length ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@buffer:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_entry_buffer_set_max_length ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@buffer:
|
||||
@max_length:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_entry_buffer_insert_text ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@buffer:
|
||||
@position:
|
||||
@chars:
|
||||
@n_chars:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_entry_buffer_delete_text ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@buffer:
|
||||
@position:
|
||||
@n_chars:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_entry_buffer_emit_deleted_text ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@buffer:
|
||||
@position:
|
||||
@n_chars:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_entry_buffer_emit_inserted_text ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@buffer:
|
||||
@position:
|
||||
@chars:
|
||||
@n_chars:
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@ The #GtkFileChooserButton supports the #GtkFileChooserAction<!--
|
||||
<para>
|
||||
The #GtkFileChooserButton will ellipsize the label,
|
||||
and thus will thus request little horizontal space. To give the button
|
||||
more space, you should call gtk_widget_get_preferred_size(),
|
||||
more space, you should call gtk_size_request_get_size(),
|
||||
gtk_file_chooser_button_set_width_chars(), or pack the button in
|
||||
such a way that other interface elements give space to the widget.
|
||||
</para>
|
||||
|
||||
@@ -0,0 +1,709 @@
|
||||
<!-- ##### SECTION Title ##### -->
|
||||
GtkNotebook
|
||||
|
||||
<!-- ##### SECTION Short_Description ##### -->
|
||||
A tabbed notebook container
|
||||
|
||||
<!-- ##### SECTION Long_Description ##### -->
|
||||
<para>
|
||||
The #GtkNotebook widget is a #GtkContainer whose children are pages that
|
||||
can be switched between using tab labels along one edge.
|
||||
</para>
|
||||
<para>
|
||||
There are many configuration options for #GtkNotebook. Among other
|
||||
things, you can choose on which edge the tabs appear
|
||||
(see gtk_notebook_set_tab_pos()), whether, if there are too many
|
||||
tabs to fit the notebook should be made bigger or scrolling
|
||||
arrows added (see gtk_notebook_set_scrollable), and whether there
|
||||
will be a popup menu allowing the users to switch pages.
|
||||
(see gtk_notebook_popup_enable(), gtk_notebook_popup_disable())
|
||||
</para>
|
||||
|
||||
<refsect2 id="GtkNotebook-BUILDER-UI">
|
||||
<title>GtkNotebook as GtkBuildable</title>
|
||||
<para>
|
||||
The GtkNoteboopk implementation of the GtkBuildable interface
|
||||
supports placing children into tabs by specifying "tab" as the
|
||||
"type" attribute of a <child> element. Note that the content
|
||||
of the tab must be created before the tab can be filled.
|
||||
A tab child can be specified without specifying a <child>
|
||||
type attribute.
|
||||
</para>
|
||||
<para>
|
||||
To add a child widget in the notebooks action area, specify
|
||||
"action-start" or "action-end" as the "type" attribute of the <child>
|
||||
element.
|
||||
</para>
|
||||
<example>
|
||||
<title>A UI definition fragment with GtkNotebook</title>
|
||||
<programlisting><![CDATA[
|
||||
<object class="GtkNotebook">
|
||||
<child>
|
||||
<object class="GtkLabel" id="notebook-content">
|
||||
<property name="label">Content</property>
|
||||
</object>
|
||||
</child>
|
||||
<child type="tab">
|
||||
<object class="GtkLabel" id="notebook-tab">
|
||||
<property name="label">Tab</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
]]></programlisting>
|
||||
</example>
|
||||
</refsect2>
|
||||
|
||||
<!-- ##### SECTION See_Also ##### -->
|
||||
<para>
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term>#GtkContainer</term>
|
||||
<listitem><para>For functions that apply to every #GtkContainer</para></listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</para>
|
||||
|
||||
<!-- ##### SECTION Stability_Level ##### -->
|
||||
|
||||
|
||||
<!-- ##### SECTION Image ##### -->
|
||||
|
||||
|
||||
<!-- ##### STRUCT GtkNotebook ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
|
||||
<!-- ##### SIGNAL GtkNotebook::change-current-page ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@notebook: the object which received the signal.
|
||||
@arg1:
|
||||
@Returns:
|
||||
|
||||
<!-- ##### SIGNAL GtkNotebook::create-window ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@notebook: the object which received the signal.
|
||||
@widget:
|
||||
@arg1:
|
||||
@arg2:
|
||||
@Returns:
|
||||
|
||||
<!-- ##### SIGNAL GtkNotebook::focus-tab ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@notebook: the object which received the signal.
|
||||
@arg1:
|
||||
@Returns:
|
||||
|
||||
<!-- ##### SIGNAL GtkNotebook::move-focus-out ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@notebook: the object which received the signal.
|
||||
@arg1:
|
||||
|
||||
<!-- ##### SIGNAL GtkNotebook::page-added ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@notebook: the object which received the signal.
|
||||
@widget:
|
||||
@arg1:
|
||||
|
||||
<!-- ##### SIGNAL GtkNotebook::page-removed ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@notebook: the object which received the signal.
|
||||
@widget:
|
||||
@arg1:
|
||||
|
||||
<!-- ##### SIGNAL GtkNotebook::page-reordered ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@notebook: the object which received the signal.
|
||||
@widget:
|
||||
@arg1:
|
||||
|
||||
<!-- ##### SIGNAL GtkNotebook::reorder-tab ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@notebook: the object which received the signal.
|
||||
@arg1:
|
||||
@Param3:
|
||||
@Returns:
|
||||
|
||||
<!-- ##### SIGNAL GtkNotebook::select-page ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@notebook: the object which received the signal.
|
||||
@arg1:
|
||||
@Returns:
|
||||
|
||||
<!-- ##### SIGNAL GtkNotebook::switch-page ##### -->
|
||||
<para>
|
||||
Emitted when the user or a function changes the current page.
|
||||
</para>
|
||||
|
||||
@notebook: the object which received the signal.
|
||||
@page: the new current page
|
||||
@page_num: the index of the page
|
||||
|
||||
<!-- ##### ARG GtkNotebook:enable-popup ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
<!-- ##### ARG GtkNotebook:group ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
<!-- ##### ARG GtkNotebook:page ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
<!-- ##### ARG GtkNotebook:scrollable ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
<!-- ##### ARG GtkNotebook:show-border ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
<!-- ##### ARG GtkNotebook:show-tabs ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
<!-- ##### ARG GtkNotebook:tab-pos ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
<!-- ##### ARG GtkNotebook:detachable ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
<!-- ##### ARG GtkNotebook:menu-label ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
<!-- ##### ARG GtkNotebook:position ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
<!-- ##### ARG GtkNotebook:reorderable ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
<!-- ##### ARG GtkNotebook:tab-expand ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
<!-- ##### ARG GtkNotebook:tab-fill ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
<!-- ##### ARG GtkNotebook:tab-label ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
<!-- ##### ARG GtkNotebook:tab-pack ##### -->
|
||||
<para>
|
||||
Deprecated: 2.20: The tab packing functionality of children should not
|
||||
be used anymore and support will be removed in the future.
|
||||
</para>
|
||||
|
||||
<!-- ##### ARG GtkNotebook:arrow-spacing ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
<!-- ##### ARG GtkNotebook:has-backward-stepper ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
<!-- ##### ARG GtkNotebook:has-forward-stepper ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
<!-- ##### ARG GtkNotebook:has-secondary-backward-stepper ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
<!-- ##### ARG GtkNotebook:has-secondary-forward-stepper ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
<!-- ##### ARG GtkNotebook:tab-curvature ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
<!-- ##### ARG GtkNotebook:tab-overlap ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
<!-- ##### FUNCTION gtk_notebook_new ##### -->
|
||||
<para>
|
||||
</para>
|
||||
|
||||
@void:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_notebook_append_page ##### -->
|
||||
<para>
|
||||
</para>
|
||||
|
||||
@notebook:
|
||||
@child:
|
||||
@tab_label:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_notebook_append_page_menu ##### -->
|
||||
<para>
|
||||
</para>
|
||||
|
||||
@notebook:
|
||||
@child:
|
||||
@tab_label:
|
||||
@menu_label:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_notebook_prepend_page ##### -->
|
||||
<para>
|
||||
</para>
|
||||
|
||||
@notebook:
|
||||
@child: the
|
||||
@tab_label:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_notebook_prepend_page_menu ##### -->
|
||||
<para>
|
||||
</para>
|
||||
|
||||
@notebook:
|
||||
@child:
|
||||
@tab_label:
|
||||
@menu_label:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_notebook_insert_page ##### -->
|
||||
<para>
|
||||
</para>
|
||||
|
||||
@notebook:
|
||||
@child:
|
||||
@tab_label:
|
||||
@position:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_notebook_insert_page_menu ##### -->
|
||||
<para>
|
||||
</para>
|
||||
|
||||
@notebook:
|
||||
@child:
|
||||
@tab_label:
|
||||
@menu_label:
|
||||
@position:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_notebook_remove_page ##### -->
|
||||
<para>
|
||||
</para>
|
||||
|
||||
@notebook:
|
||||
@page_num:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_notebook_page_num ##### -->
|
||||
<para>
|
||||
</para>
|
||||
|
||||
@notebook:
|
||||
@child:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_notebook_next_page ##### -->
|
||||
<para>
|
||||
</para>
|
||||
|
||||
@notebook:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_notebook_prev_page ##### -->
|
||||
<para>
|
||||
</para>
|
||||
|
||||
@notebook:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_notebook_reorder_child ##### -->
|
||||
<para>
|
||||
</para>
|
||||
|
||||
@notebook:
|
||||
@child:
|
||||
@position:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_notebook_set_tab_pos ##### -->
|
||||
<para>
|
||||
</para>
|
||||
|
||||
@notebook: the notebook widget
|
||||
@pos: the position
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_notebook_set_show_tabs ##### -->
|
||||
<para>
|
||||
</para>
|
||||
|
||||
@notebook:
|
||||
@show_tabs:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_notebook_set_show_border ##### -->
|
||||
<para>
|
||||
</para>
|
||||
|
||||
@notebook:
|
||||
@show_border:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_notebook_set_scrollable ##### -->
|
||||
<para>
|
||||
</para>
|
||||
|
||||
@notebook:
|
||||
@scrollable:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_notebook_popup_enable ##### -->
|
||||
<para>
|
||||
</para>
|
||||
|
||||
@notebook:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_notebook_popup_disable ##### -->
|
||||
<para>
|
||||
</para>
|
||||
|
||||
@notebook:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_notebook_get_current_page ##### -->
|
||||
<para>
|
||||
</para>
|
||||
|
||||
@notebook: the notebook widget
|
||||
@Returns: the page number
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_notebook_get_menu_label ##### -->
|
||||
<para>
|
||||
</para>
|
||||
|
||||
@notebook:
|
||||
@child:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_notebook_get_nth_page ##### -->
|
||||
<para>
|
||||
</para>
|
||||
|
||||
@notebook:
|
||||
@page_num:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_notebook_get_n_pages ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@notebook:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_notebook_get_tab_label ##### -->
|
||||
<para>
|
||||
</para>
|
||||
|
||||
@notebook:
|
||||
@child:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_notebook_set_menu_label ##### -->
|
||||
<para>
|
||||
</para>
|
||||
|
||||
@notebook:
|
||||
@child:
|
||||
@menu_label:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_notebook_set_menu_label_text ##### -->
|
||||
<para>
|
||||
</para>
|
||||
|
||||
@notebook:
|
||||
@child:
|
||||
@menu_text:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_notebook_set_tab_label ##### -->
|
||||
<para>
|
||||
</para>
|
||||
|
||||
@notebook:
|
||||
@child:
|
||||
@tab_label:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_notebook_set_tab_label_text ##### -->
|
||||
<para>
|
||||
</para>
|
||||
|
||||
@notebook:
|
||||
@child:
|
||||
@tab_text:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_notebook_set_tab_reorderable ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@notebook:
|
||||
@child:
|
||||
@reorderable:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_notebook_set_tab_detachable ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@notebook:
|
||||
@child:
|
||||
@detachable:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_notebook_get_menu_label_text ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@notebook:
|
||||
@child:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_notebook_get_scrollable ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@notebook:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_notebook_get_show_border ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@notebook:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_notebook_get_show_tabs ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@notebook:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_notebook_get_tab_label_text ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@notebook:
|
||||
@child:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_notebook_get_tab_pos ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@notebook:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_notebook_get_tab_reorderable ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@notebook:
|
||||
@child:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_notebook_get_tab_detachable ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@notebook:
|
||||
@child:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_notebook_get_tab_hborder ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@notebook:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_notebook_get_tab_vborder ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@notebook:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_notebook_set_current_page ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@notebook:
|
||||
@page_num:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_notebook_set_group ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@notebook:
|
||||
@group:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_notebook_get_group ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@notebook:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_notebook_set_action_widget ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@notebook:
|
||||
@widget:
|
||||
@pack_type:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_notebook_get_action_widget ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@notebook:
|
||||
@pack_type:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### USER_FUNCTION GtkNotebookWindowCreationFunc ##### -->
|
||||
<para>
|
||||
A function used by GtkNotebook when a detachable tab is dropped
|
||||
in the root window, it's used to create a window containing a notebook
|
||||
where the tab will be attached. This function will also be responsible
|
||||
of moving/resizing the window and adding the necessary properties to
|
||||
the notebook (i.e.: group-id).
|
||||
|
||||
If the function returns %NULL, the drag will be cancelled.
|
||||
</para>
|
||||
|
||||
@source: The source #GtkNotebook of the drag operation
|
||||
@page: the child #GtkWidget affected
|
||||
@x: the X coordinate where the drop happens
|
||||
@y: the Y coordinate where the drop happens
|
||||
@data: user data
|
||||
@Returns: The created #GtkNotebook where the tab will be attached, or NULL to cancel the drag
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_notebook_set_window_creation_hook ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@func:
|
||||
@data:
|
||||
@destroy:
|
||||
|
||||
|
||||
@@ -0,0 +1,308 @@
|
||||
<!-- ##### SECTION Title ##### -->
|
||||
GtkPaperSize
|
||||
|
||||
<!-- ##### SECTION Short_Description ##### -->
|
||||
Support for named paper sizes
|
||||
|
||||
<!-- ##### SECTION Long_Description ##### -->
|
||||
<para>
|
||||
GtkPaperSize handles paper sizes. It uses the standard called
|
||||
"PWG 5101.1-2002 PWG: Standard for Media Standardized Names"
|
||||
<!-- FIXME link here -->
|
||||
to name the paper sizes (and to get the data for the page sizes).
|
||||
In addition to standard paper sizes, GtkPaperSize allows to
|
||||
construct custom paper sizes with arbitrary dimensions.
|
||||
</para>
|
||||
<para>
|
||||
The #GtkPaperSize object stores not only the dimensions (width
|
||||
and height) of a paper size and its name, it also provides
|
||||
default <link linkend="print-margins">print margins</link>.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Printing support has been added in GTK+ 2.10.
|
||||
</para>
|
||||
|
||||
<!-- ##### SECTION See_Also ##### -->
|
||||
<para>
|
||||
#GtkPageSetup
|
||||
</para>
|
||||
|
||||
<!-- ##### SECTION Stability_Level ##### -->
|
||||
|
||||
|
||||
<!-- ##### SECTION Image ##### -->
|
||||
|
||||
|
||||
<!-- ##### STRUCT GtkPaperSize ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
|
||||
<!-- ##### ENUM GtkUnit ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@GTK_UNIT_PIXEL:
|
||||
@GTK_UNIT_POINTS:
|
||||
@GTK_UNIT_INCH:
|
||||
@GTK_UNIT_MM:
|
||||
|
||||
<!-- ##### MACRO GTK_PAPER_NAME_A3 ##### -->
|
||||
<para>
|
||||
Name for the A4 paper size.
|
||||
</para>
|
||||
|
||||
|
||||
|
||||
<!-- ##### MACRO GTK_PAPER_NAME_A4 ##### -->
|
||||
<para>
|
||||
Name for the A4 paper size.
|
||||
</para>
|
||||
|
||||
|
||||
|
||||
<!-- ##### MACRO GTK_PAPER_NAME_A5 ##### -->
|
||||
<para>
|
||||
Name for the A5 paper size.
|
||||
</para>
|
||||
|
||||
|
||||
|
||||
<!-- ##### MACRO GTK_PAPER_NAME_B5 ##### -->
|
||||
<para>
|
||||
Name for the B5 paper size.
|
||||
</para>
|
||||
|
||||
|
||||
|
||||
<!-- ##### MACRO GTK_PAPER_NAME_LETTER ##### -->
|
||||
<para>
|
||||
Name for the Letter paper size.
|
||||
</para>
|
||||
|
||||
|
||||
|
||||
<!-- ##### MACRO GTK_PAPER_NAME_EXECUTIVE ##### -->
|
||||
<para>
|
||||
Name for the Executive paper size.
|
||||
</para>
|
||||
|
||||
|
||||
|
||||
<!-- ##### MACRO GTK_PAPER_NAME_LEGAL ##### -->
|
||||
<para>
|
||||
Name for the Legal paper size.
|
||||
</para>
|
||||
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_paper_size_new ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@name:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_paper_size_new_from_ppd ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@ppd_name:
|
||||
@ppd_display_name:
|
||||
@width:
|
||||
@height:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_paper_size_new_custom ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@name:
|
||||
@display_name:
|
||||
@width:
|
||||
@height:
|
||||
@unit:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_paper_size_copy ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@other:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_paper_size_free ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@size:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_paper_size_is_equal ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@size1:
|
||||
@size2:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_paper_size_get_paper_sizes ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@include_custom:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_paper_size_get_name ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@size:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_paper_size_get_display_name ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@size:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_paper_size_get_ppd_name ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@size:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_paper_size_get_width ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@size:
|
||||
@unit:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_paper_size_get_height ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@size:
|
||||
@unit:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_paper_size_is_custom ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@size:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_paper_size_set_size ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@size:
|
||||
@width:
|
||||
@height:
|
||||
@unit:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_paper_size_get_default_top_margin ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@size:
|
||||
@unit:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_paper_size_get_default_bottom_margin ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@size:
|
||||
@unit:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_paper_size_get_default_left_margin ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@size:
|
||||
@unit:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_paper_size_get_default_right_margin ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@size:
|
||||
@unit:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_paper_size_get_default ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@void:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_paper_size_new_from_key_file ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@key_file:
|
||||
@group_name:
|
||||
@error:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_paper_size_to_key_file ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@size:
|
||||
@key_file:
|
||||
@group_name:
|
||||
|
||||
|
||||
@@ -34,8 +34,8 @@ void create_integer_spin_button (void) {
|
||||
GtkWidget *window, *spinner;
|
||||
GtkAdjustment *spinner_adj;
|
||||
|
||||
spinner_adj = gtk_adjustment_new (50.0, 0.0, 100.0, 1.0, 5.0, 5.0);
|
||||
|
||||
spinner_adj = (GtkAdjustment *) gtk_adjustment_new (50.0, 0.0, 100.0, 1.0, 5.0, 5.0);
|
||||
|
||||
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (window), 5);
|
||||
|
||||
@@ -69,8 +69,8 @@ void create_floating_spin_button (void) {
|
||||
GtkWidget *window, *spinner;
|
||||
GtkAdjustment *spinner_adj;
|
||||
|
||||
spinner_adj = gtk_adjustment_new (2.500, 0.0, 5.0, 0.001, 0.1, 0.1);
|
||||
|
||||
spinner_adj = (GtkAdjustment *) gtk_adjustment_new (2.500, 0.0, 5.0, 0.001, 0.1, 0.1);
|
||||
|
||||
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (window), 5);
|
||||
|
||||
|
||||
@@ -0,0 +1,305 @@
|
||||
<!-- ##### SECTION Title ##### -->
|
||||
GtkToolbar
|
||||
|
||||
<!-- ##### SECTION Short_Description ##### -->
|
||||
Create bars of buttons and other widgets
|
||||
|
||||
<!-- ##### SECTION Long_Description ##### -->
|
||||
<para>
|
||||
A toolbar is created with a call to gtk_toolbar_new().
|
||||
</para>
|
||||
<para>
|
||||
A toolbar can contain instances of a subclass of #GtkToolItem. To add
|
||||
a #GtkToolItem to the a toolbar, use gtk_toolbar_insert(). To remove
|
||||
an item from the toolbar use gtk_container_remove(). To add a button
|
||||
to the toolbar, add an instance of #GtkToolButton.
|
||||
</para>
|
||||
<para>
|
||||
Toolbar items can be visually grouped by adding instances of
|
||||
#GtkSeparatorToolItem to the toolbar. If a #GtkSeparatorToolItem has
|
||||
the "expand" property set to #TRUE and the "draw" property set to
|
||||
#FALSE the effect is to force all following items to the end of the
|
||||
toolbar.
|
||||
</para>
|
||||
<para>
|
||||
Creating a context menu for the toolbar can be done by connecting to
|
||||
the #GtkToolbar::popup-context-menu signal.
|
||||
</para>
|
||||
|
||||
<!-- ##### SECTION See_Also ##### -->
|
||||
<para>
|
||||
<variablelist>
|
||||
|
||||
<varlistentry>
|
||||
<term>#GtkToolItem</term>
|
||||
<listitem><para>Base class of widgets that can be added to a toolbar.</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
</variablelist>
|
||||
</para>
|
||||
|
||||
<!-- ##### SECTION Stability_Level ##### -->
|
||||
|
||||
|
||||
<!-- ##### SECTION Image ##### -->
|
||||
|
||||
|
||||
<!-- ##### STRUCT GtkToolbar ##### -->
|
||||
<para>
|
||||
The #GtkToolbar struct only contains private data and should only be
|
||||
accessed through the function described below.
|
||||
</para>
|
||||
|
||||
|
||||
<!-- ##### SIGNAL GtkToolbar::focus-home-or-end ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@toolbar: the object which received the signal.
|
||||
@arg1:
|
||||
@Returns:
|
||||
|
||||
<!-- ##### SIGNAL GtkToolbar::orientation-changed ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@toolbar: the object which received the signal.
|
||||
@orientation: the new #GtkOrientation of the toolbar.
|
||||
|
||||
<!-- ##### SIGNAL GtkToolbar::popup-context-menu ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@toolbar: the object which received the signal.
|
||||
@Returns:
|
||||
@Returns:
|
||||
@Returns:
|
||||
@Returns:
|
||||
|
||||
<!-- ##### SIGNAL GtkToolbar::style-changed ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@toolbar:
|
||||
@style:
|
||||
|
||||
<!-- ##### ARG GtkToolbar:icon-size ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
<!-- ##### ARG GtkToolbar:icon-size-set ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
<!-- ##### ARG GtkToolbar:show-arrow ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
<!-- ##### ARG GtkToolbar:toolbar-style ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
<!-- ##### ARG GtkToolbar:expand ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
<!-- ##### ARG GtkToolbar:homogeneous ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
<!-- ##### ARG GtkToolbar:button-relief ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
<!-- ##### ARG GtkToolbar:internal-padding ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
<!-- ##### ARG GtkToolbar:max-child-expand ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
<!-- ##### ARG GtkToolbar:shadow-type ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
<!-- ##### ARG GtkToolbar:space-size ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
<!-- ##### ARG GtkToolbar:space-style ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
<!-- ##### ENUM GtkToolbarSpaceStyle ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@GTK_TOOLBAR_SPACE_EMPTY:
|
||||
@GTK_TOOLBAR_SPACE_LINE:
|
||||
|
||||
<!-- ##### FUNCTION gtk_toolbar_new ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@void:
|
||||
@Returns: the newly-created toolbar.
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_toolbar_insert ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@toolbar:
|
||||
@item:
|
||||
@pos:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_toolbar_get_item_index ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@toolbar:
|
||||
@item:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_toolbar_get_n_items ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@toolbar:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_toolbar_get_nth_item ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@toolbar:
|
||||
@n:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_toolbar_get_drop_index ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@toolbar:
|
||||
@x:
|
||||
@y:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_toolbar_set_drop_highlight_item ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@toolbar:
|
||||
@tool_item:
|
||||
@index_:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_toolbar_set_show_arrow ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@toolbar:
|
||||
@show_arrow:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_toolbar_unset_icon_size ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@toolbar:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_toolbar_get_show_arrow ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@toolbar:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_toolbar_get_style ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@toolbar:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_toolbar_get_icon_size ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@toolbar:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_toolbar_get_relief_style ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@toolbar:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_toolbar_set_style ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@toolbar:
|
||||
@style:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_toolbar_set_icon_size ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@toolbar:
|
||||
@icon_size:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_toolbar_unset_style ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@toolbar:
|
||||
|
||||
|
||||
@@ -0,0 +1,173 @@
|
||||
<!-- ##### SECTION Title ##### -->
|
||||
GtkTooltip
|
||||
|
||||
<!-- ##### SECTION Short_Description ##### -->
|
||||
Add tips to your widgets
|
||||
|
||||
<!-- ##### SECTION Long_Description ##### -->
|
||||
<para>
|
||||
#GtkTooltip belongs to the new tooltips API that was
|
||||
introduced in GTK+ 2.12 and which deprecates the old
|
||||
#GtkTooltips API.
|
||||
</para>
|
||||
<para>
|
||||
Basic tooltips can be realized simply by using gtk_widget_set_tooltip_text()
|
||||
or gtk_widget_set_tooltip_markup() without any explicit tooltip object.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
When you need a tooltip with a little more fancy contents, like
|
||||
adding an image, or you want the tooltip to have different contents
|
||||
per GtkTreeView row or cell, you will have to do a little more work:
|
||||
<itemizedlist>
|
||||
|
||||
<listitem><para>
|
||||
Set the #GtkWidget:has-tooltip property to %TRUE, this will
|
||||
make GTK+ monitor the widget for motion and related events
|
||||
which are needed to determine when and where to show a tooltip.
|
||||
</para></listitem>
|
||||
|
||||
<listitem><para>
|
||||
Connect to the #GtkWidget::query-tooltip signal. This signal
|
||||
will be emitted when a tooltip is supposed to be shown. One
|
||||
of the arguments passed to the signal handler is a #GtkTooltip
|
||||
object. This is the object that we are about to display as a
|
||||
tooltip, and can be manipulated in your callback using functions
|
||||
like gtk_tooltip_set_icon(). There are functions for setting
|
||||
the tooltip's markup, setting an image from a stock icon, or
|
||||
even putting in a custom widget.
|
||||
</para></listitem>
|
||||
|
||||
<listitem><para>
|
||||
Return %TRUE from your query-tooltip handler. This causes
|
||||
the tooltip to be show. If you return %FALSE, it will not be shown.
|
||||
</para></listitem>
|
||||
</itemizedlist>
|
||||
</para>
|
||||
|
||||
<para>
|
||||
In the probably rare case where you want to have even more control
|
||||
over the tooltip that is about to be shown, you can set your own
|
||||
#GtkWindow which will be used as tooltip window. This works as
|
||||
follows:
|
||||
<itemizedlist>
|
||||
|
||||
<listitem><para>
|
||||
Set #GtkWidget:has-tooltip and connect to #GtkWidget::query-tooltip as
|
||||
before.
|
||||
</para></listitem>
|
||||
|
||||
<listitem><para>
|
||||
Use gtk_widget_set_tooltip_window() to set a #GtkWindow created
|
||||
by you as tooltip window.
|
||||
</para></listitem>
|
||||
|
||||
<listitem><para>
|
||||
In the ::query-tooltip callback you can access your window
|
||||
using gtk_widget_get_tooltip_window() and manipulate as you
|
||||
wish. The semantics of the return value are exactly as before,
|
||||
return %TRUE to show the window, %FALSE to not show it.
|
||||
</para></listitem>
|
||||
</itemizedlist>
|
||||
</para>
|
||||
|
||||
<!-- ##### SECTION See_Also ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
<!-- ##### SECTION Stability_Level ##### -->
|
||||
|
||||
|
||||
<!-- ##### SECTION Image ##### -->
|
||||
|
||||
|
||||
<!-- ##### STRUCT GtkTooltip ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_tooltip_set_markup ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@tooltip:
|
||||
@markup:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_tooltip_set_text ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@tooltip:
|
||||
@text:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_tooltip_set_icon ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@tooltip:
|
||||
@pixbuf:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_tooltip_set_icon_from_stock ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@tooltip:
|
||||
@stock_id:
|
||||
@size:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_tooltip_set_icon_from_icon_name ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@tooltip:
|
||||
@icon_name:
|
||||
@size:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_tooltip_set_icon_from_gicon ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@tooltip:
|
||||
@gicon:
|
||||
@size:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_tooltip_set_custom ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@tooltip:
|
||||
@custom_widget:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_tooltip_trigger_tooltip_query ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@display:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_tooltip_set_tip_area ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@tooltip:
|
||||
@rect:
|
||||
|
||||
|
||||
@@ -140,8 +140,7 @@ take_window_shot (Window child,
|
||||
|
||||
window = gdk_window_foreign_new (xid);
|
||||
|
||||
width = gdk_window_get_width (window);
|
||||
height = gdk_window_get_height (window);
|
||||
gdk_drawable_get_size (window, &width, &height);
|
||||
gdk_window_get_origin (window, &x_orig, &y_orig);
|
||||
|
||||
if (x_orig < 0)
|
||||
@@ -164,8 +163,8 @@ take_window_shot (Window child,
|
||||
if (y_orig + height > gdk_screen_height ())
|
||||
height = gdk_screen_height () - y_orig;
|
||||
|
||||
tmp = gdk_pixbuf_get_from_window (window,
|
||||
x, y, width, height);
|
||||
tmp = gdk_pixbuf_get_from_drawable (NULL, window, NULL,
|
||||
x, y, 0, 0, width, height);
|
||||
|
||||
if (include_decoration)
|
||||
tmp2 = remove_shaped_area (tmp, xid);
|
||||
|
||||
+32
-28
@@ -2584,12 +2584,12 @@ but some cases will be shown in later examples where you may need to
|
||||
create one yourself. You create an adjustment using:</para>
|
||||
|
||||
<programlisting role="C">
|
||||
GtkAdjustment *gtk_adjustment_new( gdouble value,
|
||||
gdouble lower,
|
||||
gdouble upper,
|
||||
gdouble step_increment,
|
||||
gdouble page_increment,
|
||||
gdouble page_size );
|
||||
GtkObject *gtk_adjustment_new( gdouble value,
|
||||
gdouble lower,
|
||||
gdouble upper,
|
||||
gdouble step_increment,
|
||||
gdouble page_increment,
|
||||
gdouble page_size );
|
||||
</programlisting>
|
||||
|
||||
<para>The <literal>value</literal> argument is the initial value you want to give to the
|
||||
@@ -3151,7 +3151,7 @@ static void create_range_controls( void )
|
||||
GtkWidget *opt, *menu, *item;
|
||||
GtkWidget *label;
|
||||
GtkWidget *scale;
|
||||
GtkAdjustment *adj1, *adj2;
|
||||
GtkObject *adj1, *adj2;
|
||||
|
||||
/* Standard window-creating stuff */
|
||||
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
||||
@@ -4732,12 +4732,12 @@ button can take. This makes for a powerful Spin Button widget.</para>
|
||||
function, which illustrates the information that it holds:</para>
|
||||
|
||||
<programlisting role="C">
|
||||
GtkAdjustment *gtk_adjustment_new( gdouble value,
|
||||
gdouble lower,
|
||||
gdouble upper,
|
||||
gdouble step_increment,
|
||||
gdouble page_increment,
|
||||
gdouble page_size );
|
||||
GtkObject *gtk_adjustment_new( gdouble value,
|
||||
gdouble lower,
|
||||
gdouble upper,
|
||||
gdouble step_increment,
|
||||
gdouble page_increment,
|
||||
gdouble page_size );
|
||||
</programlisting>
|
||||
|
||||
<para>These attributes of an Adjustment are used by the Spin Button in the
|
||||
@@ -5030,8 +5030,9 @@ int main( int argc,
|
||||
label = gtk_label_new ("Day :");
|
||||
gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5);
|
||||
gtk_box_pack_start (GTK_BOX (vbox2), label, FALSE, TRUE, 0);
|
||||
|
||||
adj = gtk_adjustment_new (1.0, 1.0, 31.0, 1.0, 5.0, 0.0);
|
||||
|
||||
adj = (GtkAdjustment *) gtk_adjustment_new (1.0, 1.0, 31.0, 1.0,
|
||||
5.0, 0.0);
|
||||
spinner = gtk_spin_button_new (adj, 0, 0);
|
||||
gtk_spin_button_set_wrap (GTK_SPIN_BUTTON (spinner), TRUE);
|
||||
gtk_box_pack_start (GTK_BOX (vbox2), spinner, FALSE, TRUE, 0);
|
||||
@@ -5042,8 +5043,9 @@ int main( int argc,
|
||||
label = gtk_label_new ("Month :");
|
||||
gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5);
|
||||
gtk_box_pack_start (GTK_BOX (vbox2), label, FALSE, TRUE, 0);
|
||||
|
||||
adj = gtk_adjustment_new (1.0, 1.0, 12.0, 1.0, 5.0, 0.0);
|
||||
|
||||
adj = (GtkAdjustment *) gtk_adjustment_new (1.0, 1.0, 12.0, 1.0,
|
||||
5.0, 0.0);
|
||||
spinner = gtk_spin_button_new (adj, 0, 0);
|
||||
gtk_spin_button_set_wrap (GTK_SPIN_BUTTON (spinner), TRUE);
|
||||
gtk_box_pack_start (GTK_BOX (vbox2), spinner, FALSE, TRUE, 0);
|
||||
@@ -5054,8 +5056,9 @@ int main( int argc,
|
||||
label = gtk_label_new ("Year :");
|
||||
gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5);
|
||||
gtk_box_pack_start (GTK_BOX (vbox2), label, FALSE, TRUE, 0);
|
||||
|
||||
adj = gtk_adjustment_new (1998.0, 0.0, 2100.0, 1.0, 100.0, 0.0);
|
||||
|
||||
adj = (GtkAdjustment *) gtk_adjustment_new (1998.0, 0.0, 2100.0,
|
||||
1.0, 100.0, 0.0);
|
||||
spinner = gtk_spin_button_new (adj, 0, 0);
|
||||
gtk_spin_button_set_wrap (GTK_SPIN_BUTTON (spinner), FALSE);
|
||||
gtk_widget_set_size_request (spinner, 55, -1);
|
||||
@@ -5077,8 +5080,9 @@ int main( int argc,
|
||||
label = gtk_label_new ("Value :");
|
||||
gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5);
|
||||
gtk_box_pack_start (GTK_BOX (vbox2), label, FALSE, TRUE, 0);
|
||||
|
||||
adj = gtk_adjustment_new (0.0, -10000.0, 10000.0, 0.5, 100.0, 0.0);
|
||||
|
||||
adj = (GtkAdjustment *) gtk_adjustment_new (0.0, -10000.0, 10000.0,
|
||||
0.5, 100.0, 0.0);
|
||||
spinner1 = gtk_spin_button_new (adj, 1.0, 2);
|
||||
gtk_spin_button_set_wrap (GTK_SPIN_BUTTON (spinner1), TRUE);
|
||||
gtk_widget_set_size_request (spinner1, 100, -1);
|
||||
@@ -5090,8 +5094,8 @@ int main( int argc,
|
||||
label = gtk_label_new ("Digits :");
|
||||
gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5);
|
||||
gtk_box_pack_start (GTK_BOX (vbox2), label, FALSE, TRUE, 0);
|
||||
|
||||
adj = gtk_adjustment_new (2, 1, 5, 1, 1, 0);
|
||||
|
||||
adj = (GtkAdjustment *) gtk_adjustment_new (2, 1, 5, 1, 1, 0);
|
||||
spinner2 = gtk_spin_button_new (adj, 0.0, 0);
|
||||
gtk_spin_button_set_wrap (GTK_SPIN_BUTTON (spinner2), TRUE);
|
||||
g_signal_connect (adj, "value_changed",
|
||||
@@ -11792,7 +11796,7 @@ gtk_dial_new (GtkAdjustment *adjustment)
|
||||
dial = gtk_type_new (gtk_dial_get_type ());
|
||||
|
||||
if (!adjustment)
|
||||
adjustment = gtk_adjustment_new (0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
|
||||
adjustment = (GtkAdjustment*) gtk_adjustment_new (0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
|
||||
|
||||
gtk_dial_set_adjustment (dial, adjustment);
|
||||
|
||||
@@ -14998,7 +15002,7 @@ gtk_dial_new (GtkAdjustment *adjustment)
|
||||
dial = g_object_new (gtk_dial_get_type (), NULL);
|
||||
|
||||
if (!adjustment)
|
||||
adjustment = gtk_adjustment_new (0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
|
||||
adjustment = (GtkAdjustment*) gtk_adjustment_new (0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
|
||||
|
||||
gtk_dial_set_adjustment (dial, adjustment);
|
||||
|
||||
@@ -15586,9 +15590,9 @@ int main( int argc,
|
||||
gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_IN);
|
||||
gtk_container_add (GTK_CONTAINER (vbox), frame);
|
||||
gtk_widget_show (frame);
|
||||
|
||||
adjustment = gtk_adjustment_new (0, 0, 100, 0.01, 0.1, 0);
|
||||
|
||||
|
||||
adjustment = GTK_ADJUSTMENT (gtk_adjustment_new (0, 0, 100, 0.01, 0.1, 0));
|
||||
|
||||
dial = gtk_dial_new (adjustment);
|
||||
gtk_dial_set_update_policy (GTK_DIAL (dial), GTK_UPDATE_DELAYED);
|
||||
/* gtk_widget_set_size_request (dial, 100, 100); */
|
||||
|
||||
@@ -17,6 +17,7 @@ SUBDIRS = arrow \
|
||||
notebook \
|
||||
packbox \
|
||||
paned \
|
||||
pixmap \
|
||||
progressbar \
|
||||
radiobuttons \
|
||||
rangewidgets \
|
||||
|
||||
@@ -96,7 +96,7 @@ gint main( gint argc,
|
||||
|
||||
/* Attach to the "delete" and "destroy" events so we can exit */
|
||||
|
||||
g_signal_connect (window, "delete_event",
|
||||
g_signal_connect (GTK_OBJECT (window), "delete_event",
|
||||
G_CALLBACK (destroy_window), (gpointer) window);
|
||||
|
||||
/* Create drawingarea, set size and catch button events */
|
||||
@@ -112,7 +112,7 @@ gint main( gint argc,
|
||||
|
||||
gtk_widget_set_events (drawingarea, GDK_BUTTON_PRESS_MASK);
|
||||
|
||||
g_signal_connect (drawingarea, "event",
|
||||
g_signal_connect (GTK_OBJECT (drawingarea), "event",
|
||||
G_CALLBACK (area_event), (gpointer) drawingarea);
|
||||
|
||||
/* Add drawingarea to window, then show them both */
|
||||
|
||||
@@ -43,7 +43,7 @@ int main( int argc,
|
||||
gtk_container_add (GTK_CONTAINER (vbox), frame);
|
||||
gtk_widget_show (frame);
|
||||
|
||||
adjustment = gtk_adjustment_new (0, 0, 100, 0.01, 0.1, 0);
|
||||
adjustment = GTK_ADJUSTMENT (gtk_adjustment_new (0, 0, 100, 0.01, 0.1, 0));
|
||||
|
||||
dial = gtk_dial_new (adjustment);
|
||||
gtk_dial_set_update_policy (GTK_DIAL (dial), GTK_UPDATE_DELAYED);
|
||||
|
||||
+17
-14
@@ -31,7 +31,7 @@
|
||||
|
||||
static void gtk_dial_class_init (GtkDialClass *klass);
|
||||
static void gtk_dial_init (GtkDial *dial);
|
||||
static void gtk_dial_destroy (GtkWidget *widget);
|
||||
static void gtk_dial_destroy (GtkObject *object);
|
||||
static void gtk_dial_realize (GtkWidget *widget);
|
||||
static void gtk_dial_size_request (GtkWidget *widget,
|
||||
GtkRequisition *requisition);
|
||||
@@ -87,13 +87,16 @@ gtk_dial_get_type ()
|
||||
static void
|
||||
gtk_dial_class_init (GtkDialClass *class)
|
||||
{
|
||||
GtkObjectClass *object_class;
|
||||
GtkWidgetClass *widget_class;
|
||||
|
||||
object_class = (GtkObjectClass*) class;
|
||||
widget_class = (GtkWidgetClass*) class;
|
||||
|
||||
parent_class = g_type_class_peek_parent (class);
|
||||
|
||||
widget_class->destroy = gtk_dial_destroy;
|
||||
object_class->destroy = gtk_dial_destroy;
|
||||
|
||||
widget_class->realize = gtk_dial_realize;
|
||||
widget_class->expose_event = gtk_dial_expose;
|
||||
widget_class->size_request = gtk_dial_size_request;
|
||||
@@ -126,7 +129,7 @@ gtk_dial_new (GtkAdjustment *adjustment)
|
||||
dial = g_object_new (gtk_dial_get_type (), NULL);
|
||||
|
||||
if (!adjustment)
|
||||
adjustment = gtk_adjustment_new (0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
|
||||
adjustment = (GtkAdjustment*) gtk_adjustment_new (0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
|
||||
|
||||
gtk_dial_set_adjustment (dial, adjustment);
|
||||
|
||||
@@ -134,22 +137,22 @@ gtk_dial_new (GtkAdjustment *adjustment)
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_dial_destroy (GtkWidget *widget)
|
||||
gtk_dial_destroy (GtkObject *object)
|
||||
{
|
||||
GtkDial *dial;
|
||||
|
||||
g_return_if_fail (object != NULL);
|
||||
g_return_if_fail (GTK_IS_DIAL (object));
|
||||
|
||||
dial = GTK_DIAL (widget);
|
||||
dial = GTK_DIAL (object);
|
||||
|
||||
if (dial->adjustment)
|
||||
{
|
||||
g_object_unref (dial->adjustment);
|
||||
g_object_unref (GTK_OBJECT (dial->adjustment));
|
||||
dial->adjustment = NULL;
|
||||
}
|
||||
|
||||
GTK_WIDGET_CLASS (parent_class)->destroy (widget);
|
||||
GTK_OBJECT_CLASS (parent_class)->destroy (object);
|
||||
}
|
||||
|
||||
GtkAdjustment*
|
||||
@@ -180,12 +183,12 @@ gtk_dial_set_adjustment (GtkDial *dial,
|
||||
|
||||
if (dial->adjustment)
|
||||
{
|
||||
g_signal_handlers_disconnect_by_func (dial->adjustment, NULL, (gpointer) dial);
|
||||
g_object_unref (dial->adjustment);
|
||||
g_signal_handlers_disconnect_by_func (GTK_OBJECT (dial->adjustment), NULL, (gpointer) dial);
|
||||
g_object_unref (GTK_OBJECT (dial->adjustment));
|
||||
}
|
||||
|
||||
dial->adjustment = adjustment;
|
||||
g_object_ref (dial->adjustment);
|
||||
g_object_ref (GTK_OBJECT (dial->adjustment));
|
||||
|
||||
g_signal_connect (G_OBJECT (adjustment), "changed",
|
||||
G_CALLBACK (gtk_dial_adjustment_changed),
|
||||
@@ -478,7 +481,7 @@ gtk_dial_button_release( GtkWidget *widget,
|
||||
|
||||
if ((dial->policy != GTK_UPDATE_CONTINUOUS) &&
|
||||
(dial->old_value != dial->adjustment->value))
|
||||
g_signal_emit_by_name (dial->adjustment, "value_changed");
|
||||
g_signal_emit_by_name (GTK_OBJECT (dial->adjustment), "value_changed");
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
@@ -536,7 +539,7 @@ gtk_dial_timer( GtkDial *dial )
|
||||
g_return_val_if_fail (GTK_IS_DIAL (dial), FALSE);
|
||||
|
||||
if (dial->policy == GTK_UPDATE_DELAYED)
|
||||
g_signal_emit_by_name (dial->adjustment, "value_changed");
|
||||
g_signal_emit_by_name (GTK_OBJECT (dial->adjustment), "value_changed");
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
@@ -572,7 +575,7 @@ gtk_dial_update_mouse( GtkDial *dial, gint x, gint y )
|
||||
{
|
||||
if (dial->policy == GTK_UPDATE_CONTINUOUS)
|
||||
{
|
||||
g_signal_emit_by_name (dial->adjustment, "value_changed");
|
||||
g_signal_emit_by_name (GTK_OBJECT (dial->adjustment), "value_changed");
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -610,7 +613,7 @@ gtk_dial_update (GtkDial *dial)
|
||||
if (new_value != dial->adjustment->value)
|
||||
{
|
||||
dial->adjustment->value = new_value;
|
||||
g_signal_emit_by_name (dial->adjustment, "value_changed");
|
||||
g_signal_emit_by_name (GTK_OBJECT (dial->adjustment), "value_changed");
|
||||
}
|
||||
|
||||
dial->angle = 7.*M_PI/6. - (new_value - dial->adjustment->lower) * 4.*M_PI/3. /
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
|
||||
CC = gcc
|
||||
|
||||
CFLAGS = -Wall \
|
||||
-DG_DISABLE_DEPRECATED \
|
||||
-DGDK_DISABLE_DEPRECATED \
|
||||
-DGDK_PIXBUF_DISABLE_DEPRECATED \
|
||||
-DGTK_DISABLE_DEPRECATED
|
||||
|
||||
pixmap: pixmap.c
|
||||
$(CC) pixmap.c -o pixmap $(CFLAGS) `pkg-config gtk+-2.0 --cflags --libs`
|
||||
|
||||
clean:
|
||||
rm -f *.o pixmap
|
||||
@@ -0,0 +1,89 @@
|
||||
|
||||
#include "config.h"
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
|
||||
/* XPM data of Open-File icon */
|
||||
static const char * xpm_data[] = {
|
||||
"16 16 3 1",
|
||||
" c None",
|
||||
". c #000000000000",
|
||||
"X c #FFFFFFFFFFFF",
|
||||
" ",
|
||||
" ...... ",
|
||||
" .XXX.X. ",
|
||||
" .XXX.XX. ",
|
||||
" .XXX.XXX. ",
|
||||
" .XXX..... ",
|
||||
" .XXXXXXX. ",
|
||||
" .XXXXXXX. ",
|
||||
" .XXXXXXX. ",
|
||||
" .XXXXXXX. ",
|
||||
" .XXXXXXX. ",
|
||||
" .XXXXXXX. ",
|
||||
" .XXXXXXX. ",
|
||||
" ......... ",
|
||||
" ",
|
||||
" "};
|
||||
|
||||
|
||||
/* when invoked (via signal delete_event), terminates the application.
|
||||
*/
|
||||
gint close_application( GtkWidget *widget,
|
||||
GdkEvent *event,
|
||||
gpointer data )
|
||||
{
|
||||
gtk_main_quit ();
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
/* is invoked when the button is clicked. It just prints a message.
|
||||
*/
|
||||
void button_clicked( GtkWidget *widget,
|
||||
gpointer data ) {
|
||||
g_print ("button clicked\n");
|
||||
}
|
||||
|
||||
int main( int argc,
|
||||
char *argv[] )
|
||||
{
|
||||
/* GtkWidget is the storage type for widgets */
|
||||
GtkWidget *window, *pixmapwid, *button;
|
||||
GdkPixmap *pixmap;
|
||||
GdkBitmap *mask;
|
||||
GtkStyle *style;
|
||||
|
||||
/* create the main window, and attach delete_event signal to terminating
|
||||
the application */
|
||||
gtk_init (&argc, &argv);
|
||||
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
||||
g_signal_connect (window, "delete-event",
|
||||
G_CALLBACK (close_application), NULL);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (window), 10);
|
||||
gtk_widget_show (window);
|
||||
|
||||
/* now for the pixmap from gdk */
|
||||
style = gtk_widget_get_style (window);
|
||||
pixmap = gdk_pixmap_create_from_xpm_d (window->window, &mask,
|
||||
&style->bg[GTK_STATE_NORMAL],
|
||||
(gchar **)xpm_data);
|
||||
|
||||
/* a pixmap widget to contain the pixmap */
|
||||
pixmapwid = gtk_image_new_from_pixmap (pixmap, mask);
|
||||
gtk_widget_show (pixmapwid);
|
||||
|
||||
/* a button to contain the pixmap widget */
|
||||
button = gtk_button_new ();
|
||||
gtk_container_add (GTK_CONTAINER (button), pixmapwid);
|
||||
gtk_container_add (GTK_CONTAINER (window), button);
|
||||
gtk_widget_show (button);
|
||||
|
||||
g_signal_connect (button, "clicked",
|
||||
G_CALLBACK (button_clicked), NULL);
|
||||
|
||||
/* show the window */
|
||||
gtk_main ();
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -87,7 +87,7 @@ static void create_range_controls( void )
|
||||
GtkWidget *opt, *menu, *item;
|
||||
GtkWidget *label;
|
||||
GtkWidget *scale;
|
||||
GtkAdjustment *adj1, *adj2;
|
||||
GtkObject *adj1, *adj2;
|
||||
|
||||
/* Standard window-creating stuff */
|
||||
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
||||
|
||||
@@ -92,7 +92,8 @@ int main( int argc,
|
||||
gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5);
|
||||
gtk_box_pack_start (GTK_BOX (vbox2), label, FALSE, TRUE, 0);
|
||||
|
||||
adj = gtk_adjustment_new (1.0, 1.0, 31.0, 1.0, 5.0, 0.0);
|
||||
adj = (GtkAdjustment *) gtk_adjustment_new (1.0, 1.0, 31.0, 1.0,
|
||||
5.0, 0.0);
|
||||
spinner = gtk_spin_button_new (adj, 0, 0);
|
||||
gtk_spin_button_set_wrap (GTK_SPIN_BUTTON (spinner), TRUE);
|
||||
gtk_box_pack_start (GTK_BOX (vbox2), spinner, FALSE, TRUE, 0);
|
||||
@@ -104,7 +105,8 @@ int main( int argc,
|
||||
gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5);
|
||||
gtk_box_pack_start (GTK_BOX (vbox2), label, FALSE, TRUE, 0);
|
||||
|
||||
adj = gtk_adjustment_new (1.0, 1.0, 12.0, 1.0, 5.0, 0.0);
|
||||
adj = (GtkAdjustment *) gtk_adjustment_new (1.0, 1.0, 12.0, 1.0,
|
||||
5.0, 0.0);
|
||||
spinner = gtk_spin_button_new (adj, 0, 0);
|
||||
gtk_spin_button_set_wrap (GTK_SPIN_BUTTON (spinner), TRUE);
|
||||
gtk_box_pack_start (GTK_BOX (vbox2), spinner, FALSE, TRUE, 0);
|
||||
@@ -116,7 +118,8 @@ int main( int argc,
|
||||
gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5);
|
||||
gtk_box_pack_start (GTK_BOX (vbox2), label, FALSE, TRUE, 0);
|
||||
|
||||
adj = gtk_adjustment_new (1998.0, 0.0, 2100.0, 1.0, 100.0, 0.0);
|
||||
adj = (GtkAdjustment *) gtk_adjustment_new (1998.0, 0.0, 2100.0,
|
||||
1.0, 100.0, 0.0);
|
||||
spinner = gtk_spin_button_new (adj, 0, 0);
|
||||
gtk_spin_button_set_wrap (GTK_SPIN_BUTTON (spinner), FALSE);
|
||||
gtk_widget_set_size_request (spinner, 55, -1);
|
||||
@@ -139,7 +142,8 @@ int main( int argc,
|
||||
gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5);
|
||||
gtk_box_pack_start (GTK_BOX (vbox2), label, FALSE, TRUE, 0);
|
||||
|
||||
adj = gtk_adjustment_new (0.0, -10000.0, 10000.0, 0.5, 100.0, 0.0);
|
||||
adj = (GtkAdjustment *) gtk_adjustment_new (0.0, -10000.0, 10000.0,
|
||||
0.5, 100.0, 0.0);
|
||||
spinner1 = gtk_spin_button_new (adj, 1.0, 2);
|
||||
gtk_spin_button_set_wrap (GTK_SPIN_BUTTON (spinner1), TRUE);
|
||||
gtk_widget_set_size_request (spinner1, 100, -1);
|
||||
@@ -152,7 +156,7 @@ int main( int argc,
|
||||
gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5);
|
||||
gtk_box_pack_start (GTK_BOX (vbox2), label, FALSE, TRUE, 0);
|
||||
|
||||
adj = gtk_adjustment_new (2, 1, 5, 1, 1, 0);
|
||||
adj = (GtkAdjustment *) gtk_adjustment_new (2, 1, 5, 1, 1, 0);
|
||||
spinner2 = gtk_spin_button_new (adj, 0.0, 0);
|
||||
gtk_spin_button_set_wrap (GTK_SPIN_BUTTON (spinner2), TRUE);
|
||||
g_signal_connect (adj, "value-changed",
|
||||
|
||||
+5
-2
@@ -87,6 +87,7 @@ gdk_public_h_sources = \
|
||||
gdkkeysyms-compat.h \
|
||||
gdkpango.h \
|
||||
gdkpixbuf.h \
|
||||
gdkpixmap.h \
|
||||
gdkprivate.h \
|
||||
gdkproperty.h \
|
||||
gdkscreen.h \
|
||||
@@ -126,6 +127,8 @@ gdk_c_sources = \
|
||||
gdkoffscreenwindow.c \
|
||||
gdkpango.c \
|
||||
gdkpixbuf-drawable.c \
|
||||
gdkpixbuf-render.c \
|
||||
gdkpixmap.c \
|
||||
gdkrectangle.c \
|
||||
gdkscreen.c \
|
||||
gdkselection.c \
|
||||
@@ -187,6 +190,7 @@ x11_introspection_files = \
|
||||
x11/checksettings.c \
|
||||
x11/gdkapplaunchcontext-x11.c \
|
||||
x11/gdkasync.c \
|
||||
x11/gdkcolor-x11.c \
|
||||
x11/gdkcursor-x11.c \
|
||||
x11/gdkdevice-core.c \
|
||||
x11/gdkdevicemanager-core.c \
|
||||
@@ -206,6 +210,7 @@ x11_introspection_files = \
|
||||
x11/gdkinput.c \
|
||||
x11/gdkkeys-x11.c \
|
||||
x11/gdkmain-x11.c \
|
||||
x11/gdkpixmap-x11.c \
|
||||
x11/gdkproperty-x11.c \
|
||||
x11/gdkscreen-x11.c \
|
||||
x11/gdkselection-x11.c \
|
||||
@@ -244,7 +249,6 @@ endif # HAVE_INTROSPECTION
|
||||
|
||||
if OS_WIN32
|
||||
install-def-file: gdk.def
|
||||
mkdir -p $(DESTDIR)$(libdir)
|
||||
$(INSTALL) $(srcdir)/gdk.def $(DESTDIR)$(libdir)/gdk-win32-3.0.def
|
||||
uninstall-def-file:
|
||||
-rm $(DESTDIR)$(libdir)/gdk-win32-3.0.def
|
||||
@@ -260,7 +264,6 @@ gdk-win32-$(GTK_API_VERSION).lib: libgdk-win32-$(GTK_API_VERSION).la gdk.def
|
||||
lib -machine:@LIB_EXE_MACHINE_FLAG@ -name:libgdk-win32-$(GTK_API_VERSION)-@LT_CURRENT_MINUS_AGE@.dll -def:gdk.def -out:$@
|
||||
|
||||
install-ms-lib:
|
||||
mkdir -p $(DESTDIR)$(libdir)
|
||||
$(INSTALL) gdk-win32-$(GTK_API_VERSION).lib $(DESTDIR)$(libdir)
|
||||
|
||||
uninstall-ms-lib:
|
||||
|
||||
@@ -76,6 +76,7 @@ static const GDebugKey gdk_debug_keys[] = {
|
||||
{"xim", GDK_DEBUG_XIM},
|
||||
{"nograbs", GDK_DEBUG_NOGRABS},
|
||||
{"colormap", GDK_DEBUG_COLORMAP},
|
||||
{"pixmap", GDK_DEBUG_PIXMAP},
|
||||
{"input", GDK_DEBUG_INPUT},
|
||||
{"cursor", GDK_DEBUG_CURSOR},
|
||||
{"multihead", GDK_DEBUG_MULTIHEAD},
|
||||
|
||||
@@ -46,6 +46,7 @@
|
||||
#include <gdk/gdkkeysyms.h>
|
||||
#include <gdk/gdkpango.h>
|
||||
#include <gdk/gdkpixbuf.h>
|
||||
#include <gdk/gdkpixmap.h>
|
||||
#include <gdk/gdkproperty.h>
|
||||
#include <gdk/gdkscreen.h>
|
||||
#include <gdk/gdkselection.h>
|
||||
|
||||
+83
-11
@@ -288,13 +288,11 @@ gdk_visual_type_get_type G_GNUC_CONST
|
||||
#if IN_FILE(__GDK_CAIRO_C__)
|
||||
gdk_cairo_create
|
||||
gdk_cairo_reset_clip
|
||||
gdk_cairo_get_clip_rectangle
|
||||
gdk_cairo_set_source_color
|
||||
gdk_cairo_set_source_pixbuf
|
||||
gdk_cairo_set_source_window
|
||||
gdk_cairo_set_source_pixmap
|
||||
gdk_cairo_rectangle
|
||||
gdk_cairo_region
|
||||
gdk_cairo_region_create_from_surface
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -305,11 +303,24 @@ gdk_color_equal
|
||||
gdk_color_free
|
||||
gdk_color_get_type G_GNUC_CONST
|
||||
gdk_color_hash
|
||||
gdk_colormap_alloc_color
|
||||
gdk_colormap_get_system
|
||||
gdk_colormap_get_visual
|
||||
gdk_color_parse
|
||||
gdk_color_to_string
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if IN_HEADER(__GDK_COLOR_H__)
|
||||
#if IN_FILE(__GDK_COLOR_X11_C__)
|
||||
gdk_colormap_new
|
||||
gdk_colormap_get_type G_GNUC_CONST
|
||||
gdk_colormap_alloc_colors
|
||||
gdk_colormap_free_colors
|
||||
gdk_colormap_get_screen
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if IN_HEADER(__GDK_CURSOR_H__)
|
||||
#if IN_FILE(__GDK_CURSOR_C__)
|
||||
gdk_cursor_get_type G_GNUC_CONST
|
||||
@@ -325,6 +336,7 @@ gdk_cursor_unref
|
||||
gdk_cursor_get_display
|
||||
gdk_cursor_new_for_display
|
||||
gdk_cursor_new_from_pixbuf
|
||||
gdk_cursor_new_from_pixmap
|
||||
gdk_cursor_new_from_name
|
||||
gdk_cursor_get_image
|
||||
#endif
|
||||
@@ -521,8 +533,23 @@ gdk_drag_get_protocol
|
||||
#if IN_HEADER(__GDK_DRAWABLE_H__)
|
||||
#if IN_FILE(__GDK_DRAW_C__)
|
||||
gdk_drawable_get_clip_region
|
||||
gdk_drawable_get_colormap
|
||||
gdk_drawable_get_depth
|
||||
gdk_drawable_get_display
|
||||
gdk_drawable_get_screen
|
||||
gdk_drawable_get_size
|
||||
gdk_drawable_get_type G_GNUC_CONST
|
||||
gdk_drawable_get_visible_region
|
||||
gdk_drawable_get_visual
|
||||
gdk_drawable_set_colormap
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if IN_HEADER(__GDK_PIXMAP_X11_H__)
|
||||
#if IN_FILE(__GDK_PIXMAP_X11_C__)
|
||||
#ifdef GDK_WINDOWING_X11
|
||||
gdk_pixmap_impl_x11_get_type G_GNUC_CONST
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -556,25 +583,22 @@ gdk_window_get_accept_focus
|
||||
gdk_window_get_background_pattern
|
||||
gdk_window_get_composited
|
||||
gdk_window_get_cursor
|
||||
gdk_window_get_display
|
||||
gdk_window_get_focus_on_map
|
||||
gdk_window_get_geometry
|
||||
gdk_window_get_height
|
||||
gdk_window_get_modal_hint
|
||||
gdk_window_get_origin
|
||||
gdk_window_get_root_coords
|
||||
gdk_window_set_support_multidevice
|
||||
gdk_window_get_support_multidevice
|
||||
gdk_window_get_screen
|
||||
gdk_window_get_visual
|
||||
gdk_window_get_width
|
||||
gdk_window_has_native
|
||||
gdk_window_set_background
|
||||
gdk_window_set_background_pattern
|
||||
gdk_window_set_back_pixmap
|
||||
gdk_window_set_cursor
|
||||
gdk_window_shape_combine_mask
|
||||
gdk_window_shape_combine_region
|
||||
gdk_window_set_child_shapes
|
||||
gdk_window_merge_child_shapes
|
||||
gdk_window_input_shape_combine_mask
|
||||
gdk_window_input_shape_combine_region
|
||||
gdk_window_set_child_input_shapes
|
||||
gdk_window_merge_child_input_shapes
|
||||
@@ -586,6 +610,9 @@ gdk_window_at_pointer
|
||||
#endif
|
||||
gdk_window_begin_paint_rect
|
||||
gdk_window_begin_paint_region
|
||||
gdk_window_clear
|
||||
gdk_window_clear_area
|
||||
gdk_window_clear_area_e
|
||||
gdk_window_constrain_size
|
||||
gdk_window_coords_from_parent
|
||||
gdk_window_coords_to_parent
|
||||
@@ -597,6 +624,7 @@ gdk_window_foreign_new
|
||||
gdk_window_freeze_toplevel_updates_libgtk_only
|
||||
gdk_window_freeze_updates
|
||||
gdk_window_get_children
|
||||
gdk_window_get_internal_paint_info
|
||||
gdk_window_get_parent
|
||||
gdk_window_get_effective_parent
|
||||
#ifndef GDK_MULTIDEVICE_SAFE
|
||||
@@ -621,7 +649,9 @@ gdk_window_object_get_type G_GNUC_CONST
|
||||
gdk_window_peek_children
|
||||
gdk_window_process_all_updates
|
||||
gdk_window_process_updates
|
||||
gdk_window_redirect_to_drawable
|
||||
gdk_window_remove_filter
|
||||
gdk_window_remove_redirection
|
||||
gdk_window_set_debug_updates
|
||||
gdk_window_set_user_data
|
||||
gdk_window_thaw_toplevel_updates_libgtk_only
|
||||
@@ -643,7 +673,7 @@ gdk_window_get_device_position
|
||||
|
||||
#if IN_HEADER(__GDK_WINDOW_H__)
|
||||
#if IN_FILE(__GDK_OFFSCREEN_WINDOW_C__)
|
||||
gdk_offscreen_window_get_surface
|
||||
gdk_offscreen_window_get_pixmap
|
||||
gdk_offscreen_window_set_embedder
|
||||
gdk_offscreen_window_get_embedder
|
||||
#endif
|
||||
@@ -684,6 +714,7 @@ gdk_window_set_override_redirect
|
||||
gdk_window_set_accept_focus
|
||||
gdk_window_set_focus_on_map
|
||||
gdk_window_set_icon_list
|
||||
gdk_window_set_icon
|
||||
gdk_window_set_icon_name
|
||||
gdk_window_set_opacity
|
||||
gdk_window_iconify
|
||||
@@ -786,11 +817,36 @@ gdk_pango_layout_line_get_clip_region
|
||||
|
||||
#if IN_HEADER(__GDK_PIXBUF_H__)
|
||||
#if IN_FILE(__GDK_PIXBUF_DRAWABLE_C__)
|
||||
gdk_pixbuf_get_from_window
|
||||
gdk_pixbuf_get_from_drawable
|
||||
gdk_pixbuf_get_from_surface
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if IN_HEADER(__GDK_PIXBUF_H__)
|
||||
#if IN_FILE(__GDK_PIXBUF_RENDER_C__)
|
||||
gdk_pixbuf_render_pixmap_and_mask
|
||||
gdk_pixbuf_render_pixmap_and_mask_for_colormap
|
||||
gdk_pixbuf_render_threshold_alpha
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if IN_HEADER(__GDK_PIXMAP_H__)
|
||||
#if IN_FILE(__GDK_PIXMAP_C__)
|
||||
gdk_pixmap_get_type G_GNUC_CONST
|
||||
gdk_pixmap_new
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if IN_HEADER(__GDK_PIXMAP_H__)
|
||||
#if IN_FILE(__GDK_PIXMAP_X11_C__)
|
||||
gdk_pixmap_foreign_new
|
||||
gdk_pixmap_foreign_new_for_display
|
||||
gdk_pixmap_foreign_new_for_screen
|
||||
gdk_pixmap_lookup
|
||||
gdk_pixmap_lookup_for_display
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if IN_HEADER(__GDK_SCREEN_H__)
|
||||
#if IN_FILE(__GDK_SCREEN_C__)
|
||||
gdk_screen_get_type G_GNUC_CONST
|
||||
@@ -834,11 +890,14 @@ gdk_screen_get_number
|
||||
gdk_screen_get_primary_monitor
|
||||
gdk_screen_get_root_window
|
||||
gdk_screen_get_setting
|
||||
gdk_screen_get_default_colormap
|
||||
gdk_screen_set_default_colormap
|
||||
gdk_screen_get_n_monitors
|
||||
gdk_screen_get_monitor_geometry
|
||||
gdk_screen_get_monitor_width_mm
|
||||
gdk_screen_get_monitor_height_mm
|
||||
gdk_screen_get_monitor_plug_name
|
||||
gdk_screen_get_rgba_colormap
|
||||
gdk_screen_get_rgba_visual
|
||||
gdk_screen_get_active_window
|
||||
gdk_screen_get_window_stack
|
||||
@@ -847,6 +906,12 @@ gdk_screen_make_display_name
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if IN_HEADER(__GDK_SCREEN_H__)
|
||||
#if IN_FILE(__GDK_COLOR_X11_C__)
|
||||
gdk_screen_get_system_colormap
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if IN_HEADER(__GDK_SELECTION_H__)
|
||||
#if IN_FILE(__GDK_SELECTION_C__)
|
||||
gdk_selection_owner_set
|
||||
@@ -943,6 +1008,12 @@ gdk_x11_xatom_to_atom
|
||||
gdk_x11_xatom_to_atom_for_display
|
||||
#endif
|
||||
|
||||
#if IN_FILE(__GDK_COLOR_X11_C__)
|
||||
gdk_x11_colormap_foreign_new
|
||||
gdk_x11_colormap_get_xcolormap
|
||||
gdk_x11_colormap_get_xdisplay
|
||||
#endif
|
||||
|
||||
#if IN_FILE(__GDK_CURSOR_X11_C__)
|
||||
gdk_x11_cursor_get_xcursor
|
||||
gdk_x11_cursor_get_xdisplay
|
||||
@@ -967,6 +1038,7 @@ gdk_x11_display_error_trap_pop_ignored
|
||||
gdk_x11_drawable_get_xdisplay
|
||||
gdk_x11_drawable_get_xid
|
||||
gdk_x11_window_get_drawable_impl
|
||||
gdk_x11_pixmap_get_drawable_impl
|
||||
#endif
|
||||
|
||||
#if IN_FILE(__GDK_MAIN_X11_C__)
|
||||
|
||||
+15
-219
@@ -18,30 +18,10 @@
|
||||
*/
|
||||
|
||||
#include "gdkcairo.h"
|
||||
|
||||
#include <math.h>
|
||||
|
||||
#include "gdkdrawable.h"
|
||||
#include "gdkinternals.h"
|
||||
|
||||
|
||||
/**
|
||||
* SECTION:cairo_interaction
|
||||
* @Short_description: Functions to support using Cairo
|
||||
* @Title: Cairo Interaction
|
||||
*
|
||||
* <link href="http://cairographics.org">Cairo</link> is a graphics
|
||||
* library that supports vector graphics and image compositing that
|
||||
* can be used with GDK. Since 2.8, GTK+ does most of its drawing
|
||||
* using Cairo.
|
||||
*
|
||||
* GDK does not wrap the Cairo API, instead it allows to create Cairo
|
||||
* contexts which can be used to draw on #GdkDrawables. Additional
|
||||
* functions allow to convert GDK's rectangles and regions into
|
||||
* Cairo paths and to use pixbufs as sources for drawing operations.
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* gdk_cairo_create:
|
||||
* @drawable: a #GdkDrawable
|
||||
@@ -106,45 +86,6 @@ gdk_cairo_reset_clip (cairo_t *cr,
|
||||
GDK_DRAWABLE_GET_CLASS (drawable)->set_cairo_clip (drawable, cr);
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_cairo_get_clip_rectangle:
|
||||
* @cr: a cairo context
|
||||
* @rect: (out) (allow-none): return location for the clip, or %NULL
|
||||
*
|
||||
* This is a convenience function around cairo_clip_extents(). It rounds
|
||||
* the clip extents to integer coordinates and returns a boolean
|
||||
* indicating if a clip area exists.
|
||||
*
|
||||
* Returns: %TRUE if a clip rectangle exists, %FALSE if all of @cr is
|
||||
* clipped and all drawing can be skipped.
|
||||
**/
|
||||
gboolean
|
||||
gdk_cairo_get_clip_rectangle (cairo_t *cr,
|
||||
GdkRectangle *rect)
|
||||
{
|
||||
double x1, y1, x2, y2;
|
||||
gboolean clip_exists;
|
||||
|
||||
cairo_clip_extents (cr, &x1, &y1, &x2, &y2);
|
||||
|
||||
clip_exists = x1 < x2 && y1 < y2;
|
||||
|
||||
if (rect)
|
||||
{
|
||||
x1 = floor (x1);
|
||||
y1 = floor (y1);
|
||||
x2 = ceil (x2);
|
||||
y2 = ceil (y2);
|
||||
|
||||
rect->x = CLAMP (x1, G_MININT, G_MAXINT);
|
||||
rect->y = CLAMP (y1, G_MININT, G_MAXINT);
|
||||
rect->width = CLAMP (x2 - x1, G_MININT, G_MAXINT);
|
||||
rect->height = CLAMP (y2 - y1, G_MININT, G_MAXINT);
|
||||
}
|
||||
|
||||
return clip_exists;
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_cairo_set_source_color:
|
||||
* @cr: a #cairo_t
|
||||
@@ -322,172 +263,27 @@ gdk_cairo_set_source_pixbuf (cairo_t *cr,
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_cairo_set_source_window:
|
||||
* gdk_cairo_set_source_pixmap:
|
||||
* @cr: a #Cairo context
|
||||
* @window: a #GdkWindow
|
||||
* @x: X coordinate of location to place upper left corner of @window
|
||||
* @y: Y coordinate of location to place upper left corner of @window
|
||||
*
|
||||
* Sets the given window as the source pattern for the Cairo context.
|
||||
* @pixmap: a #GdkPixmap
|
||||
* @pixmap_x: X coordinate of location to place upper left corner of @pixmap
|
||||
* @pixmap_y: Y coordinate of location to place upper left corner of @pixmap
|
||||
*
|
||||
* Sets the given pixmap as the source pattern for the Cairo context.
|
||||
* The pattern has an extend mode of %CAIRO_EXTEND_NONE and is aligned
|
||||
* so that the origin of @window is @x, @y. The window contains all its
|
||||
* subwindows when rendering.
|
||||
* so that the origin of @pixmap is @pixmap_x, @pixmap_y
|
||||
*
|
||||
* Note that the contents of @window are undefined outside of the
|
||||
* visible part of @window, so use this function with care.
|
||||
*
|
||||
* Since: 2.24
|
||||
*/
|
||||
* Since: 2.10
|
||||
**/
|
||||
void
|
||||
gdk_cairo_set_source_window (cairo_t *cr,
|
||||
GdkWindow *window,
|
||||
double x,
|
||||
double y)
|
||||
gdk_cairo_set_source_pixmap (cairo_t *cr,
|
||||
GdkPixmap *pixmap,
|
||||
double pixmap_x,
|
||||
double pixmap_y)
|
||||
{
|
||||
cairo_surface_t *surface;
|
||||
|
||||
g_return_if_fail (cr != NULL);
|
||||
g_return_if_fail (GDK_IS_WINDOW (window));
|
||||
|
||||
surface = _gdk_drawable_ref_cairo_surface (GDK_DRAWABLE (window));
|
||||
cairo_set_source_surface (cr, surface, x, y);
|
||||
surface = _gdk_drawable_ref_cairo_surface (GDK_DRAWABLE (pixmap));
|
||||
cairo_set_source_surface (cr, surface, pixmap_x, pixmap_y);
|
||||
cairo_surface_destroy (surface);
|
||||
}
|
||||
|
||||
/**
|
||||
* _gdk_cairo_surface_extents:
|
||||
* @surface: surface to measure
|
||||
* @extents: (out): rectangle to put the extents
|
||||
*
|
||||
* Measures the area covered by @surface and puts it into @extents.
|
||||
* Note that this function respects device offsets set on @surface.
|
||||
* if @surface is unbounded, the resulting extents will be empty and
|
||||
* not be a maximal sized rectangle. This is to avoid careless coding.
|
||||
* You must explicitly check the return value of you want to handle
|
||||
* that case.
|
||||
*
|
||||
* Returns: %TRUE if the extents fit in a #GdkRectangle, %FALSE if not.
|
||||
**/
|
||||
gboolean
|
||||
_gdk_cairo_surface_extents (cairo_surface_t *surface,
|
||||
GdkRectangle *extents)
|
||||
{
|
||||
double x1, x2, y1, y2;
|
||||
cairo_t *cr;
|
||||
|
||||
g_return_val_if_fail (surface != NULL, FALSE);
|
||||
g_return_val_if_fail (extents != NULL, FALSE);
|
||||
|
||||
cr = cairo_create (surface);
|
||||
cairo_clip_extents (cr, &x1, &y1, &x2, &y2);
|
||||
|
||||
x1 = floor (x1);
|
||||
y1 = floor (y1);
|
||||
x2 = ceil (x2);
|
||||
y2 = ceil (y2);
|
||||
x2 -= x1;
|
||||
y2 -= y1;
|
||||
|
||||
if (x1 < G_MININT || x1 > G_MAXINT ||
|
||||
y1 < G_MININT || y1 > G_MAXINT ||
|
||||
x2 > G_MAXINT || y2 > G_MAXINT)
|
||||
{
|
||||
extents->x = extents->y = extents->width = extents->height = 0;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
extents->x = x1;
|
||||
extents->y = y1;
|
||||
extents->width = x2;
|
||||
extents->height = y2;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* This function originally from Jean-Edouard Lachand-Robert, and
|
||||
* available at www.codeguru.com. Simplified for our needs, not sure
|
||||
* how much of the original code left any longer. Now handles just
|
||||
* one-bit deep bitmaps (in Window parlance, ie those that GDK calls
|
||||
* bitmaps (and not pixmaps), with zero pixels being transparent.
|
||||
*/
|
||||
/**
|
||||
* gdk_cairo_region_create_from_surface:
|
||||
* @surface: A surface
|
||||
*
|
||||
* Creates region that describes covers the area where the given @surface
|
||||
* is more than 50% opaque. This function takes into account device
|
||||
* offsets that might be set with cairo_surface_set_device_offset().
|
||||
*
|
||||
* Returns: A new region
|
||||
**/
|
||||
cairo_region_t *
|
||||
gdk_cairo_region_create_from_surface (cairo_surface_t *surface)
|
||||
{
|
||||
cairo_region_t *region;
|
||||
GdkRectangle extents, rect;
|
||||
cairo_surface_t *image;
|
||||
cairo_t *cr;
|
||||
gint x, y, stride;
|
||||
guchar *data;
|
||||
|
||||
_gdk_cairo_surface_extents (surface, &extents);
|
||||
|
||||
if (cairo_surface_get_content (surface) == CAIRO_CONTENT_COLOR)
|
||||
return cairo_region_create_rectangle (&extents);
|
||||
|
||||
if (cairo_surface_get_type (surface) != CAIRO_SURFACE_TYPE_IMAGE ||
|
||||
cairo_image_surface_get_format (surface) != CAIRO_FORMAT_A1)
|
||||
{
|
||||
/* coerce to an A1 image */
|
||||
image = cairo_image_surface_create (CAIRO_FORMAT_A1,
|
||||
extents.width, extents.height);
|
||||
cr = cairo_create (image);
|
||||
cairo_set_source_surface (cr, surface, -extents.x, -extents.y);
|
||||
cairo_paint (cr);
|
||||
cairo_destroy (cr);
|
||||
}
|
||||
else
|
||||
image = cairo_surface_reference (surface);
|
||||
|
||||
data = cairo_image_surface_get_data (image);
|
||||
stride = cairo_image_surface_get_stride (image);
|
||||
|
||||
region = cairo_region_create ();
|
||||
|
||||
for (y = 0; y < extents.height; y++)
|
||||
{
|
||||
for (x = 0; x < extents.width; x++)
|
||||
{
|
||||
/* Search for a continuous range of "non transparent pixels"*/
|
||||
gint x0 = x;
|
||||
while (x < extents.width)
|
||||
{
|
||||
if (((data[x / 8] >> (x%8)) & 1) == 0)
|
||||
/* This pixel is "transparent"*/
|
||||
break;
|
||||
x++;
|
||||
}
|
||||
|
||||
if (x > x0)
|
||||
{
|
||||
/* Add the pixels (x0, y) to (x, y+1) as a new rectangle
|
||||
* in the region
|
||||
*/
|
||||
rect.x = x0;
|
||||
rect.width = x - x0;
|
||||
rect.y = y;
|
||||
rect.height = 1;
|
||||
|
||||
cairo_region_union_rectangle (region, &rect);
|
||||
}
|
||||
}
|
||||
data += stride;
|
||||
}
|
||||
|
||||
cairo_surface_destroy (image);
|
||||
|
||||
cairo_region_translate (region, extents.x, extents.y);
|
||||
|
||||
return region;
|
||||
}
|
||||
|
||||
|
||||
+4
-10
@@ -33,8 +33,6 @@ G_BEGIN_DECLS
|
||||
cairo_t *gdk_cairo_create (GdkDrawable *drawable);
|
||||
void gdk_cairo_reset_clip (cairo_t *cr,
|
||||
GdkDrawable *drawable);
|
||||
gboolean gdk_cairo_get_clip_rectangle(cairo_t *cr,
|
||||
GdkRectangle *rect);
|
||||
|
||||
void gdk_cairo_set_source_color (cairo_t *cr,
|
||||
const GdkColor *color);
|
||||
@@ -42,20 +40,16 @@ void gdk_cairo_set_source_pixbuf (cairo_t *cr,
|
||||
const GdkPixbuf *pixbuf,
|
||||
double pixbuf_x,
|
||||
double pixbuf_y);
|
||||
void gdk_cairo_set_source_window (cairo_t *cr,
|
||||
GdkWindow *window,
|
||||
double x,
|
||||
double y);
|
||||
void gdk_cairo_set_source_pixmap (cairo_t *cr,
|
||||
GdkPixmap *pixmap,
|
||||
double pixmap_x,
|
||||
double pixmap_y);
|
||||
|
||||
void gdk_cairo_rectangle (cairo_t *cr,
|
||||
const GdkRectangle *rectangle);
|
||||
void gdk_cairo_region (cairo_t *cr,
|
||||
const cairo_region_t *region);
|
||||
|
||||
cairo_region_t *
|
||||
gdk_cairo_region_create_from_surface
|
||||
(cairo_surface_t *surface);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GDK_CAIRO_H__ */
|
||||
|
||||
+69
-11
@@ -33,11 +33,20 @@
|
||||
|
||||
|
||||
/**
|
||||
* SECTION:colors
|
||||
* @Short_description: Manipulation of colors
|
||||
* @Title: Colors
|
||||
*/
|
||||
* gdk_colormap_get_visual:
|
||||
* @colormap: a #GdkColormap.
|
||||
*
|
||||
* Returns the visual for which a given colormap was created.
|
||||
*
|
||||
* Return value: the visual of the colormap.
|
||||
**/
|
||||
GdkVisual *
|
||||
gdk_colormap_get_visual (GdkColormap *colormap)
|
||||
{
|
||||
g_return_val_if_fail (GDK_IS_COLORMAP (colormap), NULL);
|
||||
|
||||
return colormap->visual;
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_color_copy:
|
||||
@@ -75,6 +84,39 @@ gdk_color_free (GdkColor *color)
|
||||
g_slice_free (GdkColor, color);
|
||||
}
|
||||
|
||||
/********************
|
||||
* Color allocation *
|
||||
********************/
|
||||
|
||||
/**
|
||||
* gdk_colormap_alloc_color:
|
||||
* @colormap: a #GdkColormap.
|
||||
* @color: the color to allocate. On return the
|
||||
* <structfield>pixel</structfield> field will be
|
||||
* filled in if allocation succeeds.
|
||||
* @writeable: this parameter has no effect, and it's here for mere
|
||||
* compatibility.
|
||||
* @best_match: If %TRUE, GDK will attempt to do matching against
|
||||
* existing colors if the color cannot be allocated as requested.
|
||||
*
|
||||
* Allocates a single color from a colormap.
|
||||
*
|
||||
* Return value: %TRUE if the allocation succeeded.
|
||||
**/
|
||||
gboolean
|
||||
gdk_colormap_alloc_color (GdkColormap *colormap,
|
||||
GdkColor *color,
|
||||
gboolean writeable,
|
||||
gboolean best_match)
|
||||
{
|
||||
gboolean success;
|
||||
|
||||
gdk_colormap_alloc_colors (colormap, color, 1, writeable, best_match,
|
||||
&success);
|
||||
|
||||
return success;
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_color_hash:
|
||||
* @colora: a #GdkColor.
|
||||
@@ -126,13 +168,15 @@ G_DEFINE_BOXED_TYPE (GdkColor, gdk_color,
|
||||
* Parses a textual specification of a color and fill in the
|
||||
* <structfield>red</structfield>, <structfield>green</structfield>,
|
||||
* and <structfield>blue</structfield> fields of a #GdkColor
|
||||
* structure. The string can either one of a large set of standard
|
||||
* names. (Taken from the X11 <filename>rgb.txt</filename> file), or
|
||||
* it can be a hex value in the form '#rgb' '#rrggbb'
|
||||
* '#rrrgggbbb' or '#rrrrggggbbbb' where 'r', 'g' and 'b' are
|
||||
* hex digits of the red, green, and blue components of the color,
|
||||
* respectively. (White in the four forms is '#fff' '#ffffff'
|
||||
* '#fffffffff' and '#ffffffffffff')
|
||||
* structure. The color is <emphasis>not</emphasis> allocated, you
|
||||
* must call gdk_colormap_alloc_color() yourself. The string can
|
||||
* either one of a large set of standard names. (Taken from the X11
|
||||
* <filename>rgb.txt</filename> file), or it can be a hex value in the
|
||||
* form '#rgb' '#rrggbb' '#rrrgggbbb' or
|
||||
* '#rrrrggggbbbb' where 'r', 'g' and 'b' are hex digits of the
|
||||
* red, green, and blue components of the color, respectively. (White
|
||||
* in the four forms is '#fff' '#ffffff' '#fffffffff' and
|
||||
* '#ffffffffffff')
|
||||
*
|
||||
* Return value: %TRUE if the parsing succeeded.
|
||||
**/
|
||||
@@ -180,3 +224,17 @@ gdk_color_to_string (const GdkColor *color)
|
||||
|
||||
return pango_color_to_string (&pango_color);
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_colormap_get_system:
|
||||
*
|
||||
* Gets the system's default colormap for the default screen. (See
|
||||
* gdk_colormap_get_system_for_screen ())
|
||||
*
|
||||
* Return value: the default colormap.
|
||||
**/
|
||||
GdkColormap*
|
||||
gdk_colormap_get_system (void)
|
||||
{
|
||||
return gdk_screen_get_system_colormap (gdk_screen_get_default ());
|
||||
}
|
||||
|
||||
+66
-13
@@ -36,19 +36,12 @@
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
|
||||
/**
|
||||
* GdkColor:
|
||||
* @pixel: For allocated colors, the value used to
|
||||
* draw this color on the screen.
|
||||
* @red: The red component of the color. This is
|
||||
* a value between 0 and 65535, with 65535 indicating
|
||||
* full intensitiy.
|
||||
* @green: The green component of the color.
|
||||
* @blue: The blue component of the color.
|
||||
*
|
||||
* The #GdkColor structure is used to describe an
|
||||
* allocated or unallocated color.
|
||||
/* The color type.
|
||||
* A color consists of red, green and blue values in the
|
||||
* range 0-65535 and a pixel value. The pixel value is highly
|
||||
* dependent on the depth and colormap which this color will
|
||||
* be used to draw into. Therefore, sharing colors between
|
||||
* colormaps is a bad idea.
|
||||
*/
|
||||
struct _GdkColor
|
||||
{
|
||||
@@ -58,8 +51,68 @@ struct _GdkColor
|
||||
guint16 blue;
|
||||
};
|
||||
|
||||
/* The colormap type.
|
||||
*/
|
||||
|
||||
typedef struct _GdkColormapClass GdkColormapClass;
|
||||
|
||||
#define GDK_TYPE_COLORMAP (gdk_colormap_get_type ())
|
||||
#define GDK_COLORMAP(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_COLORMAP, GdkColormap))
|
||||
#define GDK_COLORMAP_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_COLORMAP, GdkColormapClass))
|
||||
#define GDK_IS_COLORMAP(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_COLORMAP))
|
||||
#define GDK_IS_COLORMAP_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_COLORMAP))
|
||||
#define GDK_COLORMAP_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_COLORMAP, GdkColormapClass))
|
||||
|
||||
#define GDK_TYPE_COLOR (gdk_color_get_type ())
|
||||
|
||||
struct _GdkColormap
|
||||
{
|
||||
/*< private >*/
|
||||
GObject parent_instance;
|
||||
|
||||
/*< public >*/
|
||||
gint GSEAL (size);
|
||||
GdkColor *GSEAL (colors);
|
||||
|
||||
/*< private >*/
|
||||
GdkVisual *GSEAL (visual);
|
||||
|
||||
gpointer GSEAL (windowing_data);
|
||||
};
|
||||
|
||||
struct _GdkColormapClass
|
||||
{
|
||||
GObjectClass parent_class;
|
||||
|
||||
};
|
||||
|
||||
GType gdk_colormap_get_type (void) G_GNUC_CONST;
|
||||
|
||||
GdkColormap* gdk_colormap_new (GdkVisual *visual,
|
||||
gboolean allocate);
|
||||
|
||||
#ifndef GDK_MULTIHEAD_SAFE
|
||||
GdkColormap* gdk_colormap_get_system (void);
|
||||
#endif
|
||||
|
||||
GdkScreen *gdk_colormap_get_screen (GdkColormap *cmap);
|
||||
|
||||
gint gdk_colormap_alloc_colors (GdkColormap *colormap,
|
||||
GdkColor *colors,
|
||||
gint n_colors,
|
||||
gboolean writeable,
|
||||
gboolean best_match,
|
||||
gboolean *success);
|
||||
gboolean gdk_colormap_alloc_color (GdkColormap *colormap,
|
||||
GdkColor *color,
|
||||
gboolean writeable,
|
||||
gboolean best_match);
|
||||
void gdk_colormap_free_colors (GdkColormap *colormap,
|
||||
const GdkColor *colors,
|
||||
gint n_colors);
|
||||
|
||||
GdkVisual *gdk_colormap_get_visual (GdkColormap *colormap);
|
||||
|
||||
GdkColor *gdk_color_copy (const GdkColor *color);
|
||||
void gdk_color_free (GdkColor *color);
|
||||
gboolean gdk_color_parse (const gchar *spec,
|
||||
|
||||
@@ -141,6 +141,12 @@ GdkCursor* gdk_cursor_new_for_display (GdkDisplay *display,
|
||||
#ifndef GDK_MULTIHEAD_SAFE
|
||||
GdkCursor* gdk_cursor_new (GdkCursorType cursor_type);
|
||||
#endif
|
||||
GdkCursor* gdk_cursor_new_from_pixmap (GdkPixmap *source,
|
||||
GdkPixmap *mask,
|
||||
const GdkColor *fg,
|
||||
const GdkColor *bg,
|
||||
gint x,
|
||||
gint y);
|
||||
GdkCursor* gdk_cursor_new_from_pixbuf (GdkDisplay *display,
|
||||
GdkPixbuf *pixbuf,
|
||||
gint x,
|
||||
|
||||
+6
-7
@@ -1060,7 +1060,7 @@ gdk_device_grab (GdkDevice *device,
|
||||
GdkDisplay *display;
|
||||
gulong serial;
|
||||
|
||||
display = gdk_window_get_display (window);
|
||||
display = gdk_drawable_get_display (window);
|
||||
serial = _gdk_windowing_window_get_next_serial (display);
|
||||
|
||||
_gdk_display_add_device_grab (display,
|
||||
@@ -1242,7 +1242,7 @@ _gdk_device_translate_window_coord (GdkDevice *device,
|
||||
x_min = axis_info_x->min_value;
|
||||
else
|
||||
{
|
||||
device_width = gdk_screen_get_width (gdk_window_get_screen (window));
|
||||
device_width = gdk_screen_get_width (gdk_drawable_get_screen (window));
|
||||
x_min = 0;
|
||||
}
|
||||
|
||||
@@ -1250,13 +1250,12 @@ _gdk_device_translate_window_coord (GdkDevice *device,
|
||||
y_min = axis_info_y->min_value;
|
||||
else
|
||||
{
|
||||
device_height = gdk_screen_get_height (gdk_window_get_screen (window));
|
||||
device_height = gdk_screen_get_height (gdk_drawable_get_screen (window));
|
||||
y_min = 0;
|
||||
}
|
||||
|
||||
window_private = (GdkWindowObject *) window;
|
||||
window_width = gdk_window_get_width (window);
|
||||
window_height = gdk_window_get_height (window);
|
||||
gdk_drawable_get_size (window, &window_width, &window_height);
|
||||
|
||||
x_resolution = axis_info_x->resolution;
|
||||
y_resolution = axis_info_y->resolution;
|
||||
@@ -1344,7 +1343,7 @@ _gdk_device_translate_screen_coord (GdkDevice *device,
|
||||
if (axis_info.use == GDK_AXIS_X)
|
||||
{
|
||||
if (axis_width > 0)
|
||||
scale = gdk_screen_get_width (gdk_window_get_screen (window)) / axis_width;
|
||||
scale = gdk_screen_get_width (gdk_drawable_get_screen (window)) / axis_width;
|
||||
else
|
||||
scale = 1;
|
||||
|
||||
@@ -1353,7 +1352,7 @@ _gdk_device_translate_screen_coord (GdkDevice *device,
|
||||
else
|
||||
{
|
||||
if (axis_width > 0)
|
||||
scale = gdk_screen_get_height (gdk_window_get_screen (window)) / axis_width;
|
||||
scale = gdk_screen_get_height (gdk_drawable_get_screen (window)) / axis_width;
|
||||
else
|
||||
scale = 1;
|
||||
|
||||
|
||||
+1
-1
@@ -1107,7 +1107,7 @@ singlehead_default_window_get_pointer (GdkWindow *window,
|
||||
{
|
||||
GdkDisplay *display;
|
||||
|
||||
display = gdk_window_get_display (window);
|
||||
display = gdk_drawable_get_display (window);
|
||||
|
||||
return gdk_window_real_window_get_device_position (display,
|
||||
display->core_pointer,
|
||||
|
||||
+2
-2
@@ -26,8 +26,8 @@
|
||||
|
||||
#include "config.h"
|
||||
#include <gdkdnd.h>
|
||||
#include <gdkdrawable.h>
|
||||
#include <gdkdisplay.h>
|
||||
#include <gdkwindow.h>
|
||||
|
||||
|
||||
/**
|
||||
@@ -71,7 +71,7 @@ gdk_drag_find_window (GdkDragContext *context,
|
||||
GdkDragProtocol *protocol)
|
||||
{
|
||||
gdk_drag_find_window_for_screen (context, drag_window,
|
||||
gdk_window_get_screen (context->source_window),
|
||||
gdk_drawable_get_screen (context->source_window),
|
||||
x_root, y_root, dest_window, protocol);
|
||||
}
|
||||
|
||||
|
||||
+175
@@ -36,11 +36,17 @@
|
||||
#include "gdkpixbuf.h"
|
||||
|
||||
|
||||
static cairo_region_t * gdk_drawable_real_get_visible_region (GdkDrawable *drawable);
|
||||
|
||||
|
||||
G_DEFINE_ABSTRACT_TYPE (GdkDrawable, gdk_drawable, G_TYPE_OBJECT)
|
||||
|
||||
static void
|
||||
gdk_drawable_class_init (GdkDrawableClass *klass)
|
||||
{
|
||||
/* Default implementation for clip and visible region is the same */
|
||||
klass->get_clip_region = gdk_drawable_real_get_visible_region;
|
||||
klass->get_visible_region = gdk_drawable_real_get_visible_region;
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -48,6 +54,142 @@ gdk_drawable_init (GdkDrawable *drawable)
|
||||
{
|
||||
}
|
||||
|
||||
/* Manipulation of drawables
|
||||
*/
|
||||
|
||||
/**
|
||||
* gdk_drawable_get_size:
|
||||
* @drawable: a #GdkDrawable
|
||||
* @width: (out) (allow-none): location to store drawable's width, or %NULL
|
||||
* @height: (out) (allow-none): location to store drawable's height, or %NULL
|
||||
*
|
||||
* Fills *@width and *@height with the size of @drawable.
|
||||
* @width or @height can be %NULL if you only want the other one.
|
||||
*
|
||||
* On the X11 platform, if @drawable is a #GdkWindow, the returned
|
||||
* size is the size reported in the most-recently-processed configure
|
||||
* event, rather than the current size on the X server.
|
||||
*
|
||||
**/
|
||||
void
|
||||
gdk_drawable_get_size (GdkDrawable *drawable,
|
||||
gint *width,
|
||||
gint *height)
|
||||
{
|
||||
g_return_if_fail (GDK_IS_DRAWABLE (drawable));
|
||||
|
||||
GDK_DRAWABLE_GET_CLASS (drawable)->get_size (drawable, width, height);
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_drawable_get_visual:
|
||||
* @drawable: a #GdkDrawable
|
||||
*
|
||||
* Gets the #GdkVisual describing the pixel format of @drawable.
|
||||
*
|
||||
* Return value: a #GdkVisual
|
||||
**/
|
||||
GdkVisual*
|
||||
gdk_drawable_get_visual (GdkDrawable *drawable)
|
||||
{
|
||||
g_return_val_if_fail (GDK_IS_DRAWABLE (drawable), NULL);
|
||||
|
||||
return GDK_DRAWABLE_GET_CLASS (drawable)->get_visual (drawable);
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_drawable_get_depth:
|
||||
* @drawable: a #GdkDrawable
|
||||
*
|
||||
* Obtains the bit depth of the drawable, that is, the number of bits
|
||||
* that make up a pixel in the drawable's visual. Examples are 8 bits
|
||||
* per pixel, 24 bits per pixel, etc.
|
||||
*
|
||||
* Return value: number of bits per pixel
|
||||
**/
|
||||
gint
|
||||
gdk_drawable_get_depth (GdkDrawable *drawable)
|
||||
{
|
||||
g_return_val_if_fail (GDK_IS_DRAWABLE (drawable), 0);
|
||||
|
||||
return GDK_DRAWABLE_GET_CLASS (drawable)->get_depth (drawable);
|
||||
}
|
||||
/**
|
||||
* gdk_drawable_get_screen:
|
||||
* @drawable: a #GdkDrawable
|
||||
*
|
||||
* Gets the #GdkScreen associated with a #GdkDrawable.
|
||||
*
|
||||
* Return value: the #GdkScreen associated with @drawable
|
||||
*
|
||||
* Since: 2.2
|
||||
**/
|
||||
GdkScreen*
|
||||
gdk_drawable_get_screen(GdkDrawable *drawable)
|
||||
{
|
||||
g_return_val_if_fail (GDK_IS_DRAWABLE (drawable), NULL);
|
||||
|
||||
return GDK_DRAWABLE_GET_CLASS (drawable)->get_screen (drawable);
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_drawable_get_display:
|
||||
* @drawable: a #GdkDrawable
|
||||
*
|
||||
* Gets the #GdkDisplay associated with a #GdkDrawable.
|
||||
*
|
||||
* Return value: the #GdkDisplay associated with @drawable
|
||||
*
|
||||
* Since: 2.2
|
||||
**/
|
||||
GdkDisplay*
|
||||
gdk_drawable_get_display (GdkDrawable *drawable)
|
||||
{
|
||||
g_return_val_if_fail (GDK_IS_DRAWABLE (drawable), NULL);
|
||||
|
||||
return gdk_screen_get_display (gdk_drawable_get_screen (drawable));
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_drawable_set_colormap:
|
||||
* @drawable: a #GdkDrawable
|
||||
* @colormap: a #GdkColormap
|
||||
*
|
||||
* Sets the colormap associated with @drawable. Normally this will
|
||||
* happen automatically when the drawable is created; you only need to
|
||||
* use this function if the drawable-creating function did not have a
|
||||
* way to determine the colormap, and you then use drawable operations
|
||||
* that require a colormap. The colormap for all drawables and
|
||||
* graphics contexts you intend to use together should match.
|
||||
**/
|
||||
void
|
||||
gdk_drawable_set_colormap (GdkDrawable *drawable,
|
||||
GdkColormap *cmap)
|
||||
{
|
||||
g_return_if_fail (GDK_IS_DRAWABLE (drawable));
|
||||
g_return_if_fail (cmap == NULL || gdk_drawable_get_depth (drawable)
|
||||
== cmap->visual->depth);
|
||||
|
||||
GDK_DRAWABLE_GET_CLASS (drawable)->set_colormap (drawable, cmap);
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_drawable_get_colormap:
|
||||
* @drawable: a #GdkDrawable
|
||||
*
|
||||
* Gets the colormap for @drawable, if one is set; returns
|
||||
* %NULL otherwise.
|
||||
*
|
||||
* Return value: the colormap, or %NULL
|
||||
**/
|
||||
GdkColormap*
|
||||
gdk_drawable_get_colormap (GdkDrawable *drawable)
|
||||
{
|
||||
g_return_val_if_fail (GDK_IS_DRAWABLE (drawable), NULL);
|
||||
|
||||
return GDK_DRAWABLE_GET_CLASS (drawable)->get_colormap (drawable);
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_drawable_get_clip_region:
|
||||
* @drawable: a #GdkDrawable
|
||||
@@ -90,6 +232,19 @@ gdk_drawable_get_visible_region (GdkDrawable *drawable)
|
||||
return GDK_DRAWABLE_GET_CLASS (drawable)->get_visible_region (drawable);
|
||||
}
|
||||
|
||||
static cairo_region_t *
|
||||
gdk_drawable_real_get_visible_region (GdkDrawable *drawable)
|
||||
{
|
||||
GdkRectangle rect;
|
||||
|
||||
rect.x = 0;
|
||||
rect.y = 0;
|
||||
|
||||
gdk_drawable_get_size (drawable, &rect.width, &rect.height);
|
||||
|
||||
return cairo_region_create_rectangle (&rect);
|
||||
}
|
||||
|
||||
/**
|
||||
* _gdk_drawable_ref_cairo_surface:
|
||||
* @drawable: a #GdkDrawable
|
||||
@@ -111,6 +266,26 @@ _gdk_drawable_ref_cairo_surface (GdkDrawable *drawable)
|
||||
|
||||
/************************************************************************/
|
||||
|
||||
/*
|
||||
* _gdk_drawable_get_source_drawable:
|
||||
* @drawable: a #GdkDrawable
|
||||
*
|
||||
* Returns a drawable for the passed @drawable that is guaranteed to be
|
||||
* usable to create a pixmap (e.g.: not an offscreen window).
|
||||
*
|
||||
* Since: 2.16
|
||||
*/
|
||||
GdkDrawable *
|
||||
_gdk_drawable_get_source_drawable (GdkDrawable *drawable)
|
||||
{
|
||||
g_return_val_if_fail (GDK_IS_DRAWABLE (drawable), NULL);
|
||||
|
||||
if (GDK_DRAWABLE_GET_CLASS (drawable)->get_source_drawable)
|
||||
return GDK_DRAWABLE_GET_CLASS (drawable)->get_source_drawable (drawable);
|
||||
|
||||
return drawable;
|
||||
}
|
||||
|
||||
cairo_surface_t *
|
||||
_gdk_drawable_create_cairo_surface (GdkDrawable *drawable,
|
||||
int width,
|
||||
|
||||
@@ -56,11 +56,25 @@ struct _GdkDrawableClass
|
||||
{
|
||||
GObjectClass parent_class;
|
||||
|
||||
gint (*get_depth) (GdkDrawable *drawable);
|
||||
void (*get_size) (GdkDrawable *drawable,
|
||||
gint *width,
|
||||
gint *height);
|
||||
|
||||
void (*set_colormap) (GdkDrawable *drawable,
|
||||
GdkColormap *cmap);
|
||||
|
||||
GdkColormap* (*get_colormap) (GdkDrawable *drawable);
|
||||
GdkVisual* (*get_visual) (GdkDrawable *drawable);
|
||||
GdkScreen* (*get_screen) (GdkDrawable *drawable);
|
||||
|
||||
cairo_region_t* (*get_clip_region) (GdkDrawable *drawable);
|
||||
cairo_region_t* (*get_visible_region) (GdkDrawable *drawable);
|
||||
|
||||
cairo_surface_t *(*ref_cairo_surface) (GdkDrawable *drawable);
|
||||
|
||||
GdkDrawable *(*get_source_drawable) (GdkDrawable *drawable);
|
||||
|
||||
void (*set_cairo_clip) (GdkDrawable *drawable,
|
||||
cairo_t *cr);
|
||||
|
||||
@@ -81,6 +95,19 @@ struct _GdkDrawableClass
|
||||
|
||||
GType gdk_drawable_get_type (void) G_GNUC_CONST;
|
||||
|
||||
/* Manipulation of drawables
|
||||
*/
|
||||
void gdk_drawable_get_size (GdkDrawable *drawable,
|
||||
gint *width,
|
||||
gint *height);
|
||||
void gdk_drawable_set_colormap (GdkDrawable *drawable,
|
||||
GdkColormap *colormap);
|
||||
GdkColormap* gdk_drawable_get_colormap (GdkDrawable *drawable);
|
||||
GdkVisual* gdk_drawable_get_visual (GdkDrawable *drawable);
|
||||
gint gdk_drawable_get_depth (GdkDrawable *drawable);
|
||||
GdkScreen* gdk_drawable_get_screen (GdkDrawable *drawable);
|
||||
GdkDisplay* gdk_drawable_get_display (GdkDrawable *drawable);
|
||||
|
||||
cairo_region_t *gdk_drawable_get_clip_region (GdkDrawable *drawable);
|
||||
cairo_region_t *gdk_drawable_get_visible_region (GdkDrawable *drawable);
|
||||
|
||||
|
||||
+6
-6
@@ -319,7 +319,7 @@ gdk_event_put (const GdkEvent *event)
|
||||
g_return_if_fail (event != NULL);
|
||||
|
||||
if (event->any.window)
|
||||
display = gdk_window_get_display (event->any.window);
|
||||
display = gdk_drawable_get_display (event->any.window);
|
||||
else
|
||||
{
|
||||
GDK_NOTE (MULTIHEAD,
|
||||
@@ -1040,9 +1040,9 @@ gdk_event_get_device (const GdkEvent *event)
|
||||
"It is most likely synthesized outside Gdk/GTK+\n",
|
||||
event->type);
|
||||
|
||||
display = gdk_window_get_display (event->any.window);
|
||||
display = gdk_drawable_get_display (event->any.window);
|
||||
device_manager = gdk_display_get_device_manager (display);
|
||||
core_pointer = gdk_display_get_core_pointer (display);
|
||||
core_pointer = gdk_device_manager_get_client_pointer (device_manager);
|
||||
|
||||
if (event->type == GDK_KEY_PRESS ||
|
||||
event->type == GDK_KEY_RELEASE)
|
||||
@@ -1090,7 +1090,7 @@ gdk_event_request_motions (const GdkEventMotion *event)
|
||||
{
|
||||
gdk_device_get_state (event->device, event->window, NULL, NULL);
|
||||
|
||||
display = gdk_window_get_display (event->window);
|
||||
display = gdk_drawable_get_display (event->window);
|
||||
_gdk_display_enable_motion_hints (display, event->device);
|
||||
}
|
||||
}
|
||||
@@ -1278,7 +1278,7 @@ gdk_event_get_screen (const GdkEvent *event)
|
||||
}
|
||||
|
||||
if (event->any.window)
|
||||
return gdk_window_get_screen (event->any.window);
|
||||
return gdk_drawable_get_screen (event->any.window);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
@@ -1449,7 +1449,7 @@ gdk_synthesize_window_state (GdkWindow *window,
|
||||
{
|
||||
case GDK_WINDOW_TOPLEVEL:
|
||||
case GDK_WINDOW_TEMP: /* ? */
|
||||
gdk_display_put_event (gdk_window_get_display (window), &temp_event);
|
||||
gdk_display_put_event (gdk_drawable_get_display (window), &temp_event);
|
||||
break;
|
||||
|
||||
case GDK_WINDOW_FOREIGN:
|
||||
|
||||
+31
-9
@@ -77,12 +77,13 @@ typedef enum {
|
||||
GDK_DEBUG_XIM = 1 << 3,
|
||||
GDK_DEBUG_NOGRABS = 1 << 4,
|
||||
GDK_DEBUG_COLORMAP = 1 << 5,
|
||||
GDK_DEBUG_INPUT = 1 << 6,
|
||||
GDK_DEBUG_CURSOR = 1 << 7,
|
||||
GDK_DEBUG_MULTIHEAD = 1 << 8,
|
||||
GDK_DEBUG_XINERAMA = 1 << 9,
|
||||
GDK_DEBUG_DRAW = 1 <<10,
|
||||
GDK_DEBUG_EVENTLOOP = 1 <<11
|
||||
GDK_DEBUG_PIXMAP = 1 << 6,
|
||||
GDK_DEBUG_INPUT = 1 << 7,
|
||||
GDK_DEBUG_CURSOR = 1 << 8,
|
||||
GDK_DEBUG_MULTIHEAD = 1 << 9,
|
||||
GDK_DEBUG_XINERAMA = 1 <<10,
|
||||
GDK_DEBUG_DRAW = 1 <<11,
|
||||
GDK_DEBUG_EVENTLOOP = 1 <<12
|
||||
} GdkDebugFlag;
|
||||
|
||||
extern GList *_gdk_default_filters;
|
||||
@@ -191,7 +192,6 @@ struct _GdkWindowObject
|
||||
GdkDrawable *impl; /* window-system-specific delegate object */
|
||||
|
||||
GdkWindowObject *parent;
|
||||
GdkVisual *visual;
|
||||
|
||||
gpointer user_data;
|
||||
|
||||
@@ -203,6 +203,8 @@ struct _GdkWindowObject
|
||||
GList *filters;
|
||||
GList *children;
|
||||
|
||||
GdkColor bg_color;
|
||||
GdkPixmap *bg_pixmap;
|
||||
cairo_pattern_t *background;
|
||||
|
||||
GSList *paint_stack;
|
||||
@@ -232,6 +234,8 @@ struct _GdkWindowObject
|
||||
|
||||
guint update_and_descendants_freeze_count;
|
||||
|
||||
GdkWindowRedirect *redirect;
|
||||
|
||||
/* The GdkWindowObject that has the impl, ref:ed if another window.
|
||||
* This ref is required to keep the wrapper of the impl window alive
|
||||
* for as long as any GdkWindow references the impl. */
|
||||
@@ -309,11 +313,10 @@ void gdk_synthesize_window_state (GdkWindow *window,
|
||||
|
||||
GdkDeviceManager * _gdk_device_manager_new (GdkDisplay *display);
|
||||
|
||||
gboolean _gdk_cairo_surface_extents (cairo_surface_t *surface,
|
||||
GdkRectangle *extents);
|
||||
|
||||
cairo_surface_t *_gdk_drawable_ref_cairo_surface (GdkDrawable *drawable);
|
||||
|
||||
GdkDrawable *_gdk_drawable_get_source_drawable (GdkDrawable *drawable);
|
||||
cairo_surface_t * _gdk_drawable_create_cairo_surface (GdkDrawable *drawable,
|
||||
int width,
|
||||
int height);
|
||||
@@ -322,9 +325,15 @@ cairo_surface_t * _gdk_drawable_create_cairo_surface (GdkDrawable *drawable,
|
||||
* Interfaces used by windowing code *
|
||||
*************************************/
|
||||
|
||||
GdkPixmap *_gdk_pixmap_new (GdkDrawable *drawable,
|
||||
gint width,
|
||||
gint height,
|
||||
gint depth);
|
||||
|
||||
void _gdk_window_impl_new (GdkWindow *window,
|
||||
GdkWindow *real_parent,
|
||||
GdkScreen *screen,
|
||||
GdkVisual *visual,
|
||||
GdkEventMask event_mask,
|
||||
GdkWindowAttr *attributes,
|
||||
gint attributes_mask);
|
||||
@@ -347,6 +356,8 @@ const char *_gdk_get_sm_client_id (void);
|
||||
|
||||
/* Font/string functions implemented in module-specific code */
|
||||
|
||||
void _gdk_colormap_real_destroy (GdkColormap *colormap);
|
||||
|
||||
void _gdk_cursor_destroy (GdkCursor *cursor);
|
||||
|
||||
void _gdk_windowing_init (void);
|
||||
@@ -363,6 +374,7 @@ void _gdk_windowing_window_get_offsets (GdkWindow *window,
|
||||
gint *y_offset);
|
||||
cairo_region_t *_gdk_windowing_window_get_shape (GdkWindow *window);
|
||||
cairo_region_t *_gdk_windowing_window_get_input_shape(GdkWindow *window);
|
||||
cairo_region_t *_gdk_windowing_get_shape_for_mask (GdkBitmap *mask);
|
||||
void _gdk_windowing_window_beep (GdkWindow *window);
|
||||
|
||||
|
||||
@@ -439,6 +451,7 @@ GType _gdk_paintable_get_type (void) G_GNUC_CONST;
|
||||
|
||||
/* Implementation types */
|
||||
GType _gdk_window_impl_get_type (void) G_GNUC_CONST;
|
||||
GType _gdk_pixmap_impl_get_type (void) G_GNUC_CONST;
|
||||
|
||||
struct GdkAppLaunchContextPrivate
|
||||
{
|
||||
@@ -495,6 +508,13 @@ void _gdk_display_pointer_info_foreach (GdkDisplay *display,
|
||||
void _gdk_window_invalidate_for_expose (GdkWindow *window,
|
||||
cairo_region_t *region);
|
||||
|
||||
gboolean _gdk_windowing_set_cairo_surface_size (cairo_surface_t *surface,
|
||||
int width,
|
||||
int height);
|
||||
|
||||
cairo_surface_t * _gdk_windowing_create_cairo_surface (GdkDrawable *drawable,
|
||||
int width,
|
||||
int height);
|
||||
GdkWindow * _gdk_window_find_child_at (GdkWindow *window,
|
||||
int x, int y);
|
||||
GdkWindow * _gdk_window_find_descendant_at (GdkWindow *toplevel,
|
||||
@@ -548,6 +568,8 @@ GdkWindow *_gdk_window_get_input_window_for_event (GdkWindow *native_window,
|
||||
*****************************/
|
||||
GType gdk_offscreen_window_get_type (void);
|
||||
void _gdk_offscreen_window_new (GdkWindow *window,
|
||||
GdkScreen *screen,
|
||||
GdkVisual *visual,
|
||||
GdkWindowAttr *attributes,
|
||||
gint attributes_mask);
|
||||
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
#ifndef __GDKINTL_H__
|
||||
#define __GDKINTL_H__
|
||||
|
||||
#include "config.h"
|
||||
#include <glib/gi18n-lib.h>
|
||||
|
||||
#ifdef ENABLE_NLS
|
||||
|
||||
+176
-46
@@ -24,13 +24,18 @@
|
||||
* GTK+ at ftp://ftp.gtk.org/pub/gtk/.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <config.h>
|
||||
#include <math.h>
|
||||
|
||||
#include "gdk.h"
|
||||
#include "gdkwindow.h"
|
||||
#include "gdkinternals.h"
|
||||
#include "gdkwindowimpl.h"
|
||||
#include "gdkpixmap.h"
|
||||
#include "gdkdrawable.h"
|
||||
#include "gdktypes.h"
|
||||
#include "gdkscreen.h"
|
||||
#include "gdkcolor.h"
|
||||
#include "gdkcursor.h"
|
||||
|
||||
|
||||
/* LIMITATIONS:
|
||||
@@ -48,8 +53,11 @@ struct _GdkOffscreenWindow
|
||||
GdkDrawable parent_instance;
|
||||
|
||||
GdkWindow *wrapper;
|
||||
GdkCursor *cursor;
|
||||
GdkColormap *colormap;
|
||||
GdkScreen *screen;
|
||||
|
||||
cairo_surface_t *surface;
|
||||
GdkPixmap *pixmap;
|
||||
GdkWindow *embedder;
|
||||
};
|
||||
|
||||
@@ -80,7 +88,12 @@ gdk_offscreen_window_finalize (GObject *object)
|
||||
{
|
||||
GdkOffscreenWindow *offscreen = GDK_OFFSCREEN_WINDOW (object);
|
||||
|
||||
cairo_surface_destroy (offscreen->surface);
|
||||
if (offscreen->cursor)
|
||||
gdk_cursor_unref (offscreen->cursor);
|
||||
|
||||
offscreen->cursor = NULL;
|
||||
|
||||
g_object_unref (offscreen->pixmap);
|
||||
|
||||
G_OBJECT_CLASS (gdk_offscreen_window_parent_class)->finalize (object);
|
||||
}
|
||||
@@ -104,6 +117,9 @@ gdk_offscreen_window_destroy (GdkWindow *window,
|
||||
|
||||
if (!recursing)
|
||||
gdk_offscreen_window_hide (window);
|
||||
|
||||
g_object_unref (offscreen->colormap);
|
||||
offscreen->colormap = NULL;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
@@ -129,11 +145,74 @@ gdk_offscreen_window_ref_cairo_surface (GdkDrawable *drawable)
|
||||
{
|
||||
GdkOffscreenWindow *offscreen = GDK_OFFSCREEN_WINDOW (drawable);
|
||||
|
||||
return cairo_surface_reference (offscreen->surface);
|
||||
return _gdk_drawable_ref_cairo_surface (offscreen->pixmap);
|
||||
}
|
||||
|
||||
static GdkColormap*
|
||||
gdk_offscreen_window_get_colormap (GdkDrawable *drawable)
|
||||
{
|
||||
GdkOffscreenWindow *offscreen = GDK_OFFSCREEN_WINDOW (drawable);
|
||||
|
||||
return offscreen->colormap;
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_offscreen_window_set_colormap (GdkDrawable *drawable,
|
||||
GdkColormap*colormap)
|
||||
{
|
||||
GdkOffscreenWindow *offscreen = GDK_OFFSCREEN_WINDOW (drawable);
|
||||
|
||||
if (colormap && GDK_WINDOW_DESTROYED (offscreen->wrapper))
|
||||
return;
|
||||
|
||||
if (offscreen->colormap == colormap)
|
||||
return;
|
||||
|
||||
if (offscreen->colormap)
|
||||
g_object_unref (offscreen->colormap);
|
||||
|
||||
offscreen->colormap = colormap;
|
||||
if (offscreen->colormap)
|
||||
g_object_ref (offscreen->colormap);
|
||||
}
|
||||
|
||||
|
||||
static gint
|
||||
gdk_offscreen_window_get_depth (GdkDrawable *drawable)
|
||||
{
|
||||
GdkOffscreenWindow *offscreen = GDK_OFFSCREEN_WINDOW (drawable);
|
||||
|
||||
return gdk_drawable_get_depth (offscreen->wrapper);
|
||||
}
|
||||
|
||||
static GdkDrawable *
|
||||
gdk_offscreen_window_get_source_drawable (GdkDrawable *drawable)
|
||||
{
|
||||
GdkOffscreenWindow *offscreen = GDK_OFFSCREEN_WINDOW (drawable);
|
||||
|
||||
return _gdk_drawable_get_source_drawable (offscreen->pixmap);
|
||||
}
|
||||
|
||||
static GdkScreen*
|
||||
gdk_offscreen_window_get_screen (GdkDrawable *drawable)
|
||||
{
|
||||
GdkOffscreenWindow *offscreen = GDK_OFFSCREEN_WINDOW (drawable);
|
||||
|
||||
return offscreen->screen;
|
||||
}
|
||||
|
||||
static GdkVisual*
|
||||
gdk_offscreen_window_get_visual (GdkDrawable *drawable)
|
||||
{
|
||||
GdkOffscreenWindow *offscreen = GDK_OFFSCREEN_WINDOW (drawable);
|
||||
|
||||
return gdk_drawable_get_visual (offscreen->wrapper);
|
||||
}
|
||||
|
||||
void
|
||||
_gdk_offscreen_window_new (GdkWindow *window,
|
||||
GdkScreen *screen,
|
||||
GdkVisual *visual,
|
||||
GdkWindowAttr *attributes,
|
||||
gint attributes_mask)
|
||||
{
|
||||
@@ -154,10 +233,26 @@ _gdk_offscreen_window_new (GdkWindow *window,
|
||||
offscreen = GDK_OFFSCREEN_WINDOW (private->impl);
|
||||
offscreen->wrapper = window;
|
||||
|
||||
offscreen->surface = gdk_window_create_similar_surface ((GdkWindow *)private->parent,
|
||||
CAIRO_CONTENT_COLOR,
|
||||
private->width,
|
||||
private->height);
|
||||
offscreen->screen = screen;
|
||||
|
||||
if (attributes_mask & GDK_WA_COLORMAP)
|
||||
offscreen->colormap = g_object_ref (attributes->colormap);
|
||||
else
|
||||
{
|
||||
if (gdk_screen_get_system_visual (screen) == visual)
|
||||
{
|
||||
offscreen->colormap = gdk_screen_get_system_colormap (screen);
|
||||
g_object_ref (offscreen->colormap);
|
||||
}
|
||||
else
|
||||
offscreen->colormap = gdk_colormap_new (visual, FALSE);
|
||||
}
|
||||
|
||||
offscreen->pixmap = gdk_pixmap_new ((GdkDrawable *)private->parent,
|
||||
private->width,
|
||||
private->height,
|
||||
private->depth);
|
||||
gdk_drawable_set_colormap (offscreen->pixmap, offscreen->colormap);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
@@ -311,17 +406,19 @@ gdk_offscreen_window_get_device_state (GdkWindow *window,
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_offscreen_window_get_surface:
|
||||
* gdk_offscreen_window_get_pixmap:
|
||||
* @window: a #GdkWindow
|
||||
*
|
||||
* Gets the offscreen surface that an offscreen window renders into.
|
||||
* Gets the offscreen pixmap that an offscreen window renders into.
|
||||
* If you need to keep this around over window resizes, you need to
|
||||
* add a reference to it.
|
||||
*
|
||||
* Returns: The offscreen surface, or %NULL if not offscreen
|
||||
* Returns: The offscreen pixmap, or %NULL if not offscreen
|
||||
*
|
||||
* Since: 2.18
|
||||
*/
|
||||
cairo_surface_t *
|
||||
gdk_offscreen_window_get_surface (GdkWindow *window)
|
||||
GdkPixmap *
|
||||
gdk_offscreen_window_get_pixmap (GdkWindow *window)
|
||||
{
|
||||
GdkWindowObject *private = (GdkWindowObject *)window;
|
||||
GdkOffscreenWindow *offscreen;
|
||||
@@ -332,7 +429,7 @@ gdk_offscreen_window_get_surface (GdkWindow *window)
|
||||
return NULL;
|
||||
|
||||
offscreen = GDK_OFFSCREEN_WINDOW (private->impl);
|
||||
return offscreen->surface;
|
||||
return offscreen->pixmap;
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -360,7 +457,7 @@ gdk_offscreen_window_move_resize_internal (GdkWindow *window,
|
||||
GdkWindowObject *private = (GdkWindowObject *)window;
|
||||
GdkOffscreenWindow *offscreen;
|
||||
gint dx, dy, dw, dh;
|
||||
cairo_surface_t *old_surface;
|
||||
GdkPixmap *old_pixmap;
|
||||
|
||||
offscreen = GDK_OFFSCREEN_WINDOW (private->impl);
|
||||
|
||||
@@ -388,18 +485,16 @@ gdk_offscreen_window_move_resize_internal (GdkWindow *window,
|
||||
private->width = width;
|
||||
private->height = height;
|
||||
|
||||
old_surface = offscreen->surface;
|
||||
offscreen->surface = cairo_surface_create_similar (old_surface,
|
||||
cairo_surface_get_content (old_surface),
|
||||
width,
|
||||
height);
|
||||
old_pixmap = offscreen->pixmap;
|
||||
offscreen->pixmap = gdk_pixmap_new (GDK_DRAWABLE (old_pixmap),
|
||||
width,
|
||||
height,
|
||||
private->depth);
|
||||
|
||||
cr = cairo_create (offscreen->surface);
|
||||
cairo_set_source_surface (cr, old_surface, 0, 0);
|
||||
cr = gdk_cairo_create (offscreen->pixmap);
|
||||
gdk_cairo_set_source_pixmap (cr, old_pixmap, 0, 0);
|
||||
cairo_paint (cr);
|
||||
cairo_destroy (cr);
|
||||
|
||||
cairo_surface_destroy (old_surface);
|
||||
}
|
||||
|
||||
if (GDK_WINDOW_IS_MAPPED (private))
|
||||
@@ -445,9 +540,9 @@ gdk_offscreen_window_show (GdkWindow *window,
|
||||
gboolean already_mapped)
|
||||
{
|
||||
GdkWindowObject *private = (GdkWindowObject *)window;
|
||||
GdkRectangle area = { 0, 0, private->width, private->height };
|
||||
|
||||
gdk_window_invalidate_rect (window, &area, FALSE);
|
||||
gdk_window_clear_area_e (window, 0, 0,
|
||||
private->width, private->height);
|
||||
}
|
||||
|
||||
|
||||
@@ -464,7 +559,7 @@ gdk_offscreen_window_hide (GdkWindow *window)
|
||||
offscreen = GDK_OFFSCREEN_WINDOW (private->impl);
|
||||
|
||||
/* May need to break grabs on children */
|
||||
display = gdk_window_get_display (window);
|
||||
display = gdk_drawable_get_display (window);
|
||||
|
||||
/* TODO: This needs updating to the new grab world */
|
||||
#if 0
|
||||
@@ -504,8 +599,46 @@ gdk_offscreen_window_set_events (GdkWindow *window,
|
||||
|
||||
static void
|
||||
gdk_offscreen_window_set_background (GdkWindow *window,
|
||||
cairo_pattern_t *pattern)
|
||||
const GdkColor *color)
|
||||
{
|
||||
GdkWindowObject *private = (GdkWindowObject *)window;
|
||||
|
||||
private->bg_color = *color;
|
||||
|
||||
if (private->bg_pixmap &&
|
||||
private->bg_pixmap != GDK_PARENT_RELATIVE_BG &&
|
||||
private->bg_pixmap != GDK_NO_BG)
|
||||
g_object_unref (private->bg_pixmap);
|
||||
|
||||
private->bg_pixmap = NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_offscreen_window_set_back_pixmap (GdkWindow *window,
|
||||
GdkPixmap *pixmap)
|
||||
{
|
||||
GdkWindowObject *private = (GdkWindowObject *)window;
|
||||
|
||||
if (pixmap &&
|
||||
private->bg_pixmap != GDK_PARENT_RELATIVE_BG &&
|
||||
private->bg_pixmap != GDK_NO_BG &&
|
||||
!gdk_drawable_get_colormap (pixmap))
|
||||
{
|
||||
g_warning ("gdk_window_set_back_pixmap(): pixmap must have a colormap");
|
||||
return;
|
||||
}
|
||||
|
||||
if (private->bg_pixmap &&
|
||||
private->bg_pixmap != GDK_PARENT_RELATIVE_BG &&
|
||||
private->bg_pixmap != GDK_NO_BG)
|
||||
g_object_unref (private->bg_pixmap);
|
||||
|
||||
private->bg_pixmap = pixmap;
|
||||
|
||||
if (pixmap &&
|
||||
private->bg_pixmap != GDK_PARENT_RELATIVE_BG &&
|
||||
private->bg_pixmap != GDK_NO_BG)
|
||||
g_object_ref (pixmap);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -571,10 +704,13 @@ gdk_offscreen_window_translate (GdkWindow *window,
|
||||
gint dx,
|
||||
gint dy)
|
||||
{
|
||||
GdkOffscreenWindow *offscreen = GDK_OFFSCREEN_WINDOW (((GdkWindowObject *) window)->impl);
|
||||
cairo_surface_t *surface;
|
||||
cairo_t *cr;
|
||||
|
||||
cr = cairo_create (offscreen->surface);
|
||||
/* Can't use gdk_cairo_create here due to clipping */
|
||||
surface = _gdk_drawable_ref_cairo_surface (window);
|
||||
cr = cairo_create (surface);
|
||||
cairo_surface_destroy (surface);
|
||||
|
||||
area = cairo_region_copy (area);
|
||||
|
||||
@@ -586,7 +722,7 @@ gdk_offscreen_window_translate (GdkWindow *window,
|
||||
*/
|
||||
cairo_push_group (cr);
|
||||
|
||||
cairo_set_source_surface (cr, offscreen->surface, dx, dy);
|
||||
gdk_cairo_set_source_pixmap (cr, window, dx, dy);
|
||||
cairo_paint (cr);
|
||||
|
||||
cairo_pop_group_to_source (cr);
|
||||
@@ -597,18 +733,6 @@ gdk_offscreen_window_translate (GdkWindow *window,
|
||||
_gdk_window_add_damage (window, area);
|
||||
}
|
||||
|
||||
static cairo_surface_t *
|
||||
gdk_offscreen_window_resize_cairo_surface (GdkWindow *window,
|
||||
cairo_surface_t *surface,
|
||||
gint width,
|
||||
gint height)
|
||||
{
|
||||
/* No-op. The surface gets resized in
|
||||
* gdk_offscreen_window_move_resize_internal().
|
||||
*/
|
||||
return surface;
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_offscreen_window_set_embedder:
|
||||
* @window: a #GdkWindow
|
||||
@@ -688,6 +812,12 @@ gdk_offscreen_window_class_init (GdkOffscreenWindowClass *klass)
|
||||
object_class->finalize = gdk_offscreen_window_finalize;
|
||||
|
||||
drawable_class->ref_cairo_surface = gdk_offscreen_window_ref_cairo_surface;
|
||||
drawable_class->set_colormap = gdk_offscreen_window_set_colormap;
|
||||
drawable_class->get_colormap = gdk_offscreen_window_get_colormap;
|
||||
drawable_class->get_depth = gdk_offscreen_window_get_depth;
|
||||
drawable_class->get_screen = gdk_offscreen_window_get_screen;
|
||||
drawable_class->get_visual = gdk_offscreen_window_get_visual;
|
||||
drawable_class->get_source_drawable = gdk_offscreen_window_get_source_drawable;
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -700,6 +830,7 @@ gdk_offscreen_window_impl_iface_init (GdkWindowImplIface *iface)
|
||||
iface->lower = gdk_offscreen_window_lower;
|
||||
iface->move_resize = gdk_offscreen_window_move_resize;
|
||||
iface->set_background = gdk_offscreen_window_set_background;
|
||||
iface->set_back_pixmap = gdk_offscreen_window_set_back_pixmap;
|
||||
iface->get_events = gdk_offscreen_window_get_events;
|
||||
iface->set_events = gdk_offscreen_window_set_events;
|
||||
iface->reparent = gdk_offscreen_window_reparent;
|
||||
@@ -712,5 +843,4 @@ gdk_offscreen_window_impl_iface_init (GdkWindowImplIface *iface)
|
||||
iface->get_root_coords = gdk_offscreen_window_get_root_coords;
|
||||
iface->get_device_state = gdk_offscreen_window_get_device_state;
|
||||
iface->destroy = gdk_offscreen_window_destroy;
|
||||
iface->resize_cairo_surface = gdk_offscreen_window_resize_cairo_surface;
|
||||
}
|
||||
|
||||
+179
-53
@@ -28,47 +28,66 @@
|
||||
#include "gdkcolor.h"
|
||||
#include "gdkwindow.h"
|
||||
#include "gdkpixbuf.h"
|
||||
#include "gdkpixmap.h"
|
||||
#include "gdkinternals.h"
|
||||
|
||||
|
||||
/**
|
||||
* SECTION:pixbufs
|
||||
* @Short_description: Functions for rendering pixbufs on drawables
|
||||
* @Title: Pixbufs
|
||||
*
|
||||
* These functions allow to render pixbufs on drawables. Pixbufs are
|
||||
* client-side images. For details on how to create and manipulate
|
||||
* pixbufs, see the #GdkPixbuf API documentation.
|
||||
*/
|
||||
|
||||
/* Exported functions */
|
||||
|
||||
/**
|
||||
* gdk_pixbuf_get_from_window:
|
||||
* @window: Source window
|
||||
* @src_x: Source X coordinate within @window
|
||||
* @src_y: Source Y coordinate within @window
|
||||
* @width: Width in pixels of region to get
|
||||
* @height: Height in pixels of region to get
|
||||
* gdk_pixbuf_get_from_drawable:
|
||||
* @dest: (allow-none): Destination pixbuf, or %NULL if a new pixbuf should be created.
|
||||
* @src: Source drawable.
|
||||
* @cmap: A colormap if @src doesn't have one set.
|
||||
* @src_x: Source X coordinate within drawable.
|
||||
* @src_y: Source Y coordinate within drawable.
|
||||
* @dest_x: Destination X coordinate in pixbuf, or 0 if @dest is NULL.
|
||||
* @dest_y: Destination Y coordinate in pixbuf, or 0 if @dest is NULL.
|
||||
* @width: Width in pixels of region to get.
|
||||
* @height: Height in pixels of region to get.
|
||||
*
|
||||
* Transfers image data from a #GdkWindow and converts it to an RGB(A)
|
||||
* Transfers image data from a #GdkDrawable and converts it to an RGB(A)
|
||||
* representation inside a #GdkPixbuf. In other words, copies
|
||||
* image data from a server-side drawable to a client-side RGB(A) buffer.
|
||||
* This allows you to efficiently read individual pixels on the client side.
|
||||
*
|
||||
* This function will create an RGB pixbuf with 8 bits per channel with
|
||||
* the same size specified by the @width and @height arguments. The pixbuf
|
||||
* will contain an alpha channel if the @window contains one.
|
||||
* If the drawable @src has no colormap (gdk_drawable_get_colormap()
|
||||
* returns %NULL), then a suitable colormap must be specified.
|
||||
* Typically a #GdkWindow or a pixmap created by passing a #GdkWindow
|
||||
* to gdk_pixmap_new() will already have a colormap associated with
|
||||
* it. If the drawable has a colormap, the @cmap argument will be
|
||||
* ignored. If the drawable is a bitmap (1 bit per pixel pixmap),
|
||||
* then a colormap is not required; pixels with a value of 1 are
|
||||
* assumed to be white, and pixels with a value of 0 are assumed to be
|
||||
* black. For taking screenshots, gdk_colormap_get_system() returns
|
||||
* the correct colormap to use.
|
||||
*
|
||||
* If the window is off the screen, then there is no image data in the
|
||||
* obscured/offscreen regions to be placed in the pixbuf. The contents of
|
||||
* portions of the pixbuf corresponding to the offscreen region are undefined.
|
||||
* If the specified destination pixbuf @dest is %NULL, then this
|
||||
* function will create an RGB pixbuf with 8 bits per channel and no
|
||||
* alpha, with the same size specified by the @width and @height
|
||||
* arguments. In this case, the @dest_x and @dest_y arguments must be
|
||||
* specified as 0. If the specified destination pixbuf is not %NULL
|
||||
* and it contains alpha information, then the filled pixels will be
|
||||
* set to full opacity (alpha = 255).
|
||||
*
|
||||
* If the specified drawable is a pixmap, then the requested source
|
||||
* rectangle must be completely contained within the pixmap, otherwise
|
||||
* the function will return %NULL. For pixmaps only (not for windows)
|
||||
* passing -1 for width or height is allowed to mean the full width
|
||||
* or height of the pixmap.
|
||||
*
|
||||
* If the specified drawable is a window, and the window is off the
|
||||
* screen, then there is no image data in the obscured/offscreen
|
||||
* regions to be placed in the pixbuf. The contents of portions of the
|
||||
* pixbuf corresponding to the offscreen region are undefined.
|
||||
*
|
||||
* If the window you're obtaining data from is partially obscured by
|
||||
* other windows, then the contents of the pixbuf areas corresponding
|
||||
* to the obscured regions are undefined.
|
||||
*
|
||||
* If the window is not mapped (typically because it's iconified/minimized
|
||||
* or not on the current workspace), then %NULL will be returned.
|
||||
*
|
||||
* If the target drawable is not mapped (typically because it's
|
||||
* iconified/minimized or not on the current workspace), then %NULL
|
||||
* will be returned.
|
||||
*
|
||||
* If memory can't be allocated for the return value, %NULL will be returned
|
||||
* instead.
|
||||
@@ -76,23 +95,83 @@
|
||||
* (In short, there are several ways this function can fail, and if it fails
|
||||
* it returns %NULL; so check the return value.)
|
||||
*
|
||||
* Return value: (transfer full): A newly-created pixbuf with a reference
|
||||
* count of 1, or %NULL on error
|
||||
* Return value: The same pixbuf as @dest if it was non-%NULL, or a newly-created
|
||||
* pixbuf with a reference count of 1 if no destination pixbuf was specified, or %NULL on error
|
||||
**/
|
||||
GdkPixbuf *
|
||||
gdk_pixbuf_get_from_window (GdkWindow *src,
|
||||
int src_x, int src_y,
|
||||
int width, int height)
|
||||
gdk_pixbuf_get_from_drawable (GdkPixbuf *dest,
|
||||
GdkDrawable *src,
|
||||
GdkColormap *cmap,
|
||||
int src_x, int src_y,
|
||||
int dest_x, int dest_y,
|
||||
int width, int height)
|
||||
{
|
||||
int src_width, src_height;
|
||||
cairo_surface_t *surface;
|
||||
GdkPixbuf *dest;
|
||||
int depth;
|
||||
|
||||
g_return_val_if_fail (GDK_IS_WINDOW (src), NULL);
|
||||
g_return_val_if_fail (gdk_window_is_viewable (src), NULL);
|
||||
/* General sanity checks */
|
||||
|
||||
g_return_val_if_fail (src != NULL, NULL);
|
||||
|
||||
if (GDK_IS_WINDOW (src))
|
||||
/* FIXME: this is not perfect, since is_viewable() only tests
|
||||
* recursively up the Gdk parent window tree, but stops at
|
||||
* foreign windows or Gdk toplevels. I.e. if a window manager
|
||||
* unmapped one of its own windows, this won't work.
|
||||
*/
|
||||
g_return_val_if_fail (gdk_window_is_viewable (src), NULL);
|
||||
|
||||
if (!dest)
|
||||
g_return_val_if_fail (dest_x == 0 && dest_y == 0, NULL);
|
||||
else
|
||||
{
|
||||
g_return_val_if_fail (gdk_pixbuf_get_colorspace (dest) == GDK_COLORSPACE_RGB, NULL);
|
||||
g_return_val_if_fail (gdk_pixbuf_get_n_channels (dest) == 3 ||
|
||||
gdk_pixbuf_get_n_channels (dest) == 4, NULL);
|
||||
g_return_val_if_fail (gdk_pixbuf_get_bits_per_sample (dest) == 8, NULL);
|
||||
}
|
||||
|
||||
if (cmap == NULL)
|
||||
cmap = gdk_drawable_get_colormap (src);
|
||||
|
||||
depth = gdk_drawable_get_depth (src);
|
||||
|
||||
if (depth != 1 && cmap == NULL)
|
||||
{
|
||||
g_warning ("%s: Source drawable has no colormap; either pass "
|
||||
"in a colormap, or set the colormap on the drawable "
|
||||
"with gdk_drawable_set_colormap()", G_STRLOC);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (cmap != NULL && depth != cmap->visual->depth)
|
||||
{
|
||||
g_warning ("%s: Depth of the source drawable is %d where as "
|
||||
"the visual depth of the colormap passed is %d",
|
||||
G_STRLOC, depth, cmap->visual->depth);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Coordinate sanity checks */
|
||||
|
||||
if (GDK_IS_PIXMAP (src))
|
||||
{
|
||||
gdk_drawable_get_size (src, &src_width, &src_height);
|
||||
if (width < 0)
|
||||
width = src_width;
|
||||
if (height < 0)
|
||||
height = src_height;
|
||||
|
||||
g_return_val_if_fail (src_x >= 0 && src_y >= 0, NULL);
|
||||
g_return_val_if_fail (src_x + width <= src_width && src_y + height <= src_height, NULL);
|
||||
}
|
||||
|
||||
surface = _gdk_drawable_ref_cairo_surface (src);
|
||||
dest = gdk_pixbuf_get_from_surface (surface,
|
||||
dest = gdk_pixbuf_get_from_surface (dest,
|
||||
surface,
|
||||
src_x, src_y,
|
||||
dest_x, dest_y,
|
||||
width, height);
|
||||
cairo_surface_destroy (surface);
|
||||
|
||||
@@ -149,11 +228,14 @@ convert_alpha (guchar *dest_data,
|
||||
int src_stride,
|
||||
int src_x,
|
||||
int src_y,
|
||||
int dest_x,
|
||||
int dest_y,
|
||||
int width,
|
||||
int height)
|
||||
{
|
||||
int x, y;
|
||||
|
||||
dest_data += dest_stride * dest_y + dest_x * 4;
|
||||
src_data += src_stride * src_y + src_x * 4;
|
||||
|
||||
for (y = 0; y < height; y++) {
|
||||
@@ -189,11 +271,14 @@ convert_no_alpha (guchar *dest_data,
|
||||
int src_stride,
|
||||
int src_x,
|
||||
int src_y,
|
||||
int dest_x,
|
||||
int dest_y,
|
||||
int width,
|
||||
int height)
|
||||
{
|
||||
int x, y;
|
||||
|
||||
dest_data += dest_stride * dest_y + dest_x * 3;
|
||||
src_data += src_stride * src_y + src_x * 4;
|
||||
|
||||
for (y = 0; y < height; y++) {
|
||||
@@ -212,43 +297,82 @@ convert_no_alpha (guchar *dest_data,
|
||||
|
||||
/**
|
||||
* gdk_pixbuf_get_from_surface:
|
||||
* @dest: (allow-none): Destination pixbuf, or %NULL if a new pixbuf should be created.
|
||||
* @surface: surface to copy from
|
||||
* @src_x: Source X coordinate within @surface
|
||||
* @src_y: Source Y coordinate within @surface
|
||||
* @width: Width in pixels of region to get
|
||||
* @height: Height in pixels of region to get
|
||||
* @src_x: Source X coordinate within drawable.
|
||||
* @src_y: Source Y coordinate within drawable.
|
||||
* @dest_x: Destination X coordinate in pixbuf, or 0 if @dest is NULL.
|
||||
* @dest_y: Destination Y coordinate in pixbuf, or 0 if @dest is NULL.
|
||||
* @width: Width in pixels of region to get.
|
||||
* @height: Height in pixels of region to get.
|
||||
*
|
||||
* Transfers image data from a #cairo_surface_t and converts it to an RGB(A)
|
||||
* representation inside a #GdkPixbuf. This allows you to efficiently read
|
||||
* individual pixels from cairo surfaces. For #GdkWindows, use
|
||||
* gdk_pixbuf_get_from_window() instead.
|
||||
* representation inside a #GdkPixbuf. This allows you to efficiently read individual
|
||||
* pixels from Cairo surfaces. For #GdkWindows, use gdk_pixbuf_get_from_drawable()
|
||||
* instead.
|
||||
*
|
||||
* If the specified destination pixbuf @dest is %NULL, then this
|
||||
* function will create an RGB pixbuf with 8 bits per channel. The pixbuf will
|
||||
* contain an alpha channel if the @surface contains one. In this case, the @dest_x
|
||||
* and @dest_y arguments must be specified as 0.
|
||||
*
|
||||
* This function will create an RGB pixbuf with 8 bits per channel. The pixbuf
|
||||
* will contain an alpha channel if the @surface contains one.
|
||||
* If the specified drawable is a window, and the window is off the
|
||||
* screen, then there is no image data in the obscured/offscreen
|
||||
* regions to be placed in the pixbuf. The contents of portions of the
|
||||
* pixbuf corresponding to the offscreen region are undefined.
|
||||
*
|
||||
* Return value: (transfer full): A newly-created pixbuf with a reference count
|
||||
* of 1, or %NULL on error
|
||||
* If the window you're obtaining data from is partially obscured by
|
||||
* other windows, then the contents of the pixbuf areas corresponding
|
||||
* to the obscured regions are undefined.
|
||||
*
|
||||
* If memory can't be allocated for the return value, %NULL will be returned
|
||||
* instead.
|
||||
*
|
||||
* (In short, there are several ways this function can fail, and if it fails
|
||||
* it returns %NULL; so check the return value.)
|
||||
*
|
||||
* Return value: The same pixbuf as @dest if it was non-%NULL, or a newly-created
|
||||
* pixbuf with a reference count of 1 if no destination pixbuf was specified, or %NULL on error
|
||||
**/
|
||||
GdkPixbuf *
|
||||
gdk_pixbuf_get_from_surface (cairo_surface_t *surface,
|
||||
gdk_pixbuf_get_from_surface (GdkPixbuf *dest,
|
||||
cairo_surface_t *surface,
|
||||
int src_x,
|
||||
int src_y,
|
||||
int dest_x,
|
||||
int dest_y,
|
||||
int width,
|
||||
int height)
|
||||
{
|
||||
cairo_content_t content;
|
||||
GdkPixbuf *dest;
|
||||
|
||||
/* General sanity checks */
|
||||
g_return_val_if_fail (surface != NULL, NULL);
|
||||
g_return_val_if_fail (src_x >= 0 && src_y >= 0, NULL);
|
||||
g_return_val_if_fail (width > 0 && height > 0, NULL);
|
||||
|
||||
content = cairo_surface_get_content (surface) | CAIRO_CONTENT_COLOR;
|
||||
dest = gdk_pixbuf_new (GDK_COLORSPACE_RGB,
|
||||
!!(content & CAIRO_CONTENT_ALPHA),
|
||||
8,
|
||||
width, height);
|
||||
if (!dest)
|
||||
{
|
||||
g_return_val_if_fail (dest_x == 0 && dest_y == 0, NULL);
|
||||
|
||||
content = cairo_surface_get_content (surface) | CAIRO_CONTENT_COLOR;
|
||||
dest = gdk_pixbuf_new (GDK_COLORSPACE_RGB,
|
||||
!!(content & CAIRO_CONTENT_ALPHA),
|
||||
8,
|
||||
width, height);
|
||||
}
|
||||
else
|
||||
{
|
||||
g_return_val_if_fail (gdk_pixbuf_get_colorspace (dest) == GDK_COLORSPACE_RGB, NULL);
|
||||
g_return_val_if_fail (gdk_pixbuf_get_n_channels (dest) == 3 ||
|
||||
gdk_pixbuf_get_n_channels (dest) == 4, NULL);
|
||||
g_return_val_if_fail (gdk_pixbuf_get_bits_per_sample (dest) == 8, NULL);
|
||||
g_return_val_if_fail (dest_x >= 0 && dest_y >= 0, NULL);
|
||||
g_return_val_if_fail (dest_x + width <= gdk_pixbuf_get_width (dest), NULL);
|
||||
g_return_val_if_fail (dest_y + height <= gdk_pixbuf_get_height (dest), NULL);
|
||||
|
||||
content = gdk_pixbuf_get_has_alpha (dest) ? CAIRO_CONTENT_COLOR_ALPHA : CAIRO_CONTENT_COLOR;
|
||||
}
|
||||
|
||||
surface = gdk_cairo_surface_coerce_to_image (surface, content, src_x + width, src_y + height);
|
||||
cairo_surface_flush (surface);
|
||||
@@ -264,6 +388,7 @@ gdk_pixbuf_get_from_surface (cairo_surface_t *surface,
|
||||
cairo_image_surface_get_data (surface),
|
||||
cairo_image_surface_get_stride (surface),
|
||||
src_x, src_y,
|
||||
dest_x, dest_y,
|
||||
width, height);
|
||||
else
|
||||
convert_no_alpha (gdk_pixbuf_get_pixels (dest),
|
||||
@@ -271,6 +396,7 @@ gdk_pixbuf_get_from_surface (cairo_surface_t *surface,
|
||||
cairo_image_surface_get_data (surface),
|
||||
cairo_image_surface_get_stride (surface),
|
||||
src_x, src_y,
|
||||
dest_x, dest_y,
|
||||
width, height);
|
||||
|
||||
cairo_surface_destroy (surface);
|
||||
|
||||
@@ -0,0 +1,293 @@
|
||||
/* GdkPixbuf library - Rendering functions
|
||||
*
|
||||
* Copyright (C) 1999 The Free Software Foundation
|
||||
*
|
||||
* Author: Federico Mena-Quintero <federico@gimp.org>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#include <gdk/gdk.h>
|
||||
#include <gdk-pixbuf/gdk-pixbuf.h>
|
||||
#include "gdkpixbuf.h"
|
||||
#include "gdkscreen.h"
|
||||
#include "gdkinternals.h"
|
||||
|
||||
|
||||
/**
|
||||
* gdk_pixbuf_render_threshold_alpha:
|
||||
* @pixbuf: A pixbuf.
|
||||
* @bitmap: Bitmap where the bilevel mask will be painted to.
|
||||
* @src_x: Source X coordinate.
|
||||
* @src_y: source Y coordinate.
|
||||
* @dest_x: Destination X coordinate.
|
||||
* @dest_y: Destination Y coordinate.
|
||||
* @width: Width of region to threshold, or -1 to use pixbuf width
|
||||
* @height: Height of region to threshold, or -1 to use pixbuf height
|
||||
* @alpha_threshold: Opacity values below this will be painted as zero; all
|
||||
* other values will be painted as one.
|
||||
*
|
||||
* Takes the opacity values in a rectangular portion of a pixbuf and thresholds
|
||||
* them to produce a bi-level alpha mask that can be used as a clipping mask for
|
||||
* a drawable.
|
||||
*
|
||||
**/
|
||||
void
|
||||
gdk_pixbuf_render_threshold_alpha (GdkPixbuf *pixbuf,
|
||||
GdkBitmap *bitmap,
|
||||
int src_x,
|
||||
int src_y,
|
||||
int dest_x,
|
||||
int dest_y,
|
||||
int width,
|
||||
int height,
|
||||
int alpha_threshold)
|
||||
{
|
||||
cairo_t *cr;
|
||||
int x, y;
|
||||
guchar *p;
|
||||
int start, start_status;
|
||||
int status;
|
||||
|
||||
g_return_if_fail (gdk_pixbuf_get_colorspace (pixbuf) == GDK_COLORSPACE_RGB);
|
||||
g_return_if_fail (gdk_pixbuf_get_n_channels (pixbuf) == 3 ||
|
||||
gdk_pixbuf_get_n_channels (pixbuf) == 4);
|
||||
g_return_if_fail (gdk_pixbuf_get_bits_per_sample (pixbuf) == 8);
|
||||
|
||||
if (width == -1)
|
||||
width = gdk_pixbuf_get_width (pixbuf);
|
||||
if (height == -1)
|
||||
height = gdk_pixbuf_get_height (pixbuf);
|
||||
|
||||
g_return_if_fail (bitmap != NULL);
|
||||
g_return_if_fail (width >= 0 && height >= 0);
|
||||
g_return_if_fail (src_x >= 0 && src_x + width <= gdk_pixbuf_get_width (pixbuf));
|
||||
g_return_if_fail (src_y >= 0 && src_y + height <= gdk_pixbuf_get_height (pixbuf));
|
||||
|
||||
g_return_if_fail (alpha_threshold >= 0 && alpha_threshold <= 255);
|
||||
|
||||
if (width == 0 || height == 0)
|
||||
return;
|
||||
|
||||
cr = gdk_cairo_create (bitmap);
|
||||
cairo_rectangle (cr, dest_x, dest_y, width, height);
|
||||
cairo_clip (cr);
|
||||
|
||||
if (!gdk_pixbuf_get_has_alpha (pixbuf))
|
||||
{
|
||||
cairo_set_source_rgba (cr, 0, 0, 0, alpha_threshold == 255 ? 0 : 1);
|
||||
cairo_paint (cr);
|
||||
cairo_destroy (cr);
|
||||
return;
|
||||
}
|
||||
|
||||
cairo_set_operator (cr, CAIRO_OPERATOR_CLEAR);
|
||||
cairo_paint (cr);
|
||||
|
||||
cairo_set_operator (cr, CAIRO_OPERATOR_SOURCE);
|
||||
if (alpha_threshold == 128)
|
||||
{
|
||||
gdk_cairo_set_source_pixbuf (cr, pixbuf, src_x - dest_x, src_y - dest_y);
|
||||
cairo_paint (cr);
|
||||
cairo_destroy (cr);
|
||||
return;
|
||||
}
|
||||
|
||||
cairo_set_source_rgb (cr, 0, 0, 0);
|
||||
|
||||
for (y = 0; y < height; y++)
|
||||
{
|
||||
p = (gdk_pixbuf_get_pixels (pixbuf) + (y + src_y) * gdk_pixbuf_get_rowstride (pixbuf) + src_x * gdk_pixbuf_get_n_channels (pixbuf)
|
||||
+ gdk_pixbuf_get_n_channels (pixbuf) - 1);
|
||||
|
||||
start = 0;
|
||||
start_status = *p < alpha_threshold;
|
||||
|
||||
for (x = 0; x < width; x++)
|
||||
{
|
||||
status = *p < alpha_threshold;
|
||||
|
||||
if (status != start_status)
|
||||
{
|
||||
if (!start_status)
|
||||
cairo_rectangle (cr,
|
||||
start + dest_x, y + dest_y,
|
||||
x + dest_x, y + dest_y + 1);
|
||||
|
||||
start = x;
|
||||
start_status = status;
|
||||
}
|
||||
|
||||
p += gdk_pixbuf_get_n_channels (pixbuf);
|
||||
}
|
||||
|
||||
if (!start_status)
|
||||
cairo_rectangle (cr,
|
||||
start + dest_x, y + dest_y,
|
||||
x + dest_x, y + dest_y + 1);
|
||||
}
|
||||
|
||||
cairo_fill (cr);
|
||||
cairo_destroy (cr);
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_pixbuf_render_pixmap_and_mask:
|
||||
* @pixbuf: A pixbuf.
|
||||
* @pixmap_return: Location to store a pointer to the created pixmap,
|
||||
* or %NULL if the pixmap is not needed.
|
||||
* @mask_return: Location to store a pointer to the created mask,
|
||||
* or %NULL if the mask is not needed.
|
||||
* @alpha_threshold: Threshold value for opacity values.
|
||||
*
|
||||
* Creates a pixmap and a mask bitmap which are returned in the @pixmap_return
|
||||
* and @mask_return arguments, respectively, and renders a pixbuf and its
|
||||
* corresponding thresholded alpha mask to them. This is merely a convenience
|
||||
* function; applications that need to render pixbufs with dither offsets or to
|
||||
* given drawables should use Cairo and gdk_pixbuf_render_threshold_alpha().
|
||||
*
|
||||
* The pixmap that is created is created for the colormap returned
|
||||
* by gdk_colormap_get_system(). You normally will want to instead use
|
||||
* the actual colormap for a widget, and use
|
||||
* gdk_pixbuf_render_pixmap_and_mask_for_colormap().
|
||||
*
|
||||
* If the pixbuf does not have an alpha channel, then *@mask_return will be set
|
||||
* to %NULL.
|
||||
**/
|
||||
void
|
||||
gdk_pixbuf_render_pixmap_and_mask (GdkPixbuf *pixbuf,
|
||||
GdkPixmap **pixmap_return,
|
||||
GdkBitmap **mask_return,
|
||||
int alpha_threshold)
|
||||
{
|
||||
gdk_pixbuf_render_pixmap_and_mask_for_colormap (pixbuf,
|
||||
gdk_colormap_get_system (),
|
||||
pixmap_return, mask_return,
|
||||
alpha_threshold);
|
||||
}
|
||||
|
||||
static GdkPixbuf *
|
||||
remove_alpha_channel (GdkPixbuf *orig)
|
||||
{
|
||||
GdkPixbuf *pixbuf;
|
||||
|
||||
unsigned int x, y, width, height, stride;
|
||||
unsigned char *data;
|
||||
|
||||
if (!gdk_pixbuf_get_has_alpha (orig))
|
||||
return g_object_ref (orig);
|
||||
|
||||
pixbuf = gdk_pixbuf_copy (orig);
|
||||
|
||||
width = gdk_pixbuf_get_width (pixbuf);
|
||||
height = gdk_pixbuf_get_height (pixbuf);
|
||||
stride = gdk_pixbuf_get_rowstride (pixbuf);
|
||||
data = gdk_pixbuf_get_pixels (pixbuf);
|
||||
|
||||
for (y = 0; y < height; y++)
|
||||
{
|
||||
for (x = 0; x < width; x++)
|
||||
{
|
||||
data[x * 4 + 3] = 0xFF;
|
||||
}
|
||||
|
||||
data += stride;
|
||||
}
|
||||
|
||||
return pixbuf;
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_pixbuf_render_pixmap_and_mask_for_colormap:
|
||||
* @pixbuf: A pixbuf.
|
||||
* @colormap: A #GdkColormap
|
||||
* @pixmap_return: Location to store a pointer to the created pixmap,
|
||||
* or %NULL if the pixmap is not needed.
|
||||
* @mask_return: Location to store a pointer to the created mask,
|
||||
* or %NULL if the mask is not needed.
|
||||
* @alpha_threshold: Threshold value for opacity values.
|
||||
*
|
||||
* Creates a pixmap and a mask bitmap which are returned in the @pixmap_return
|
||||
* and @mask_return arguments, respectively, and renders a pixbuf and its
|
||||
* corresponding tresholded alpha mask to them. This is merely a convenience
|
||||
* function; applications that need to render pixbufs with dither offsets or to
|
||||
* given drawables should use Cairo and gdk_pixbuf_render_threshold_alpha().
|
||||
*
|
||||
* The pixmap that is created uses the #GdkColormap specified by @colormap.
|
||||
* This colormap must match the colormap of the window where the pixmap
|
||||
* will eventually be used or an error will result.
|
||||
*
|
||||
* If the pixbuf does not have an alpha channel, then *@mask_return will be set
|
||||
* to %NULL.
|
||||
**/
|
||||
void
|
||||
gdk_pixbuf_render_pixmap_and_mask_for_colormap (GdkPixbuf *pixbuf,
|
||||
GdkColormap *colormap,
|
||||
GdkPixmap **pixmap_return,
|
||||
GdkBitmap **mask_return,
|
||||
int alpha_threshold)
|
||||
{
|
||||
GdkScreen *screen;
|
||||
|
||||
g_return_if_fail (GDK_IS_PIXBUF (pixbuf));
|
||||
g_return_if_fail (GDK_IS_COLORMAP (colormap));
|
||||
|
||||
screen = gdk_colormap_get_screen (colormap);
|
||||
|
||||
if (pixmap_return)
|
||||
{
|
||||
GdkPixbuf *tmp_pixbuf;
|
||||
cairo_t *cr;
|
||||
|
||||
*pixmap_return = gdk_pixmap_new (gdk_screen_get_root_window (screen),
|
||||
gdk_pixbuf_get_width (pixbuf), gdk_pixbuf_get_height (pixbuf),
|
||||
gdk_colormap_get_visual (colormap)->depth);
|
||||
|
||||
gdk_drawable_set_colormap (GDK_DRAWABLE (*pixmap_return), colormap);
|
||||
|
||||
/* If the pixbuf has an alpha channel, using gdk_cairo_set_source_pixbuf()
|
||||
* would give
|
||||
* random pixel values in the area that are within the mask, but semi-
|
||||
* transparent. So we treat the pixbuf like a pixbuf without alpha channel;
|
||||
* see bug #487865.
|
||||
*/
|
||||
tmp_pixbuf = remove_alpha_channel (pixbuf);
|
||||
|
||||
cr = gdk_cairo_create (*pixmap_return);
|
||||
gdk_cairo_set_source_pixbuf (cr, pixbuf, 0, 0);
|
||||
cairo_paint (cr);
|
||||
|
||||
cairo_destroy (cr);
|
||||
g_object_unref (tmp_pixbuf);
|
||||
}
|
||||
|
||||
if (mask_return)
|
||||
{
|
||||
if (gdk_pixbuf_get_has_alpha (pixbuf))
|
||||
{
|
||||
*mask_return = gdk_pixmap_new (gdk_screen_get_root_window (screen),
|
||||
gdk_pixbuf_get_width (pixbuf), gdk_pixbuf_get_height (pixbuf), 1);
|
||||
|
||||
gdk_pixbuf_render_threshold_alpha (pixbuf, *mask_return,
|
||||
0, 0, 0, 0,
|
||||
gdk_pixbuf_get_width (pixbuf), gdk_pixbuf_get_height (pixbuf),
|
||||
alpha_threshold);
|
||||
}
|
||||
else
|
||||
*mask_return = NULL;
|
||||
}
|
||||
}
|
||||
+33
-2
@@ -37,16 +37,47 @@
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
/* Rendering to a drawable */
|
||||
|
||||
void gdk_pixbuf_render_threshold_alpha (GdkPixbuf *pixbuf,
|
||||
GdkBitmap *bitmap,
|
||||
int src_x,
|
||||
int src_y,
|
||||
int dest_x,
|
||||
int dest_y,
|
||||
int width,
|
||||
int height,
|
||||
int alpha_threshold);
|
||||
void gdk_pixbuf_render_pixmap_and_mask_for_colormap (GdkPixbuf *pixbuf,
|
||||
GdkColormap *colormap,
|
||||
GdkPixmap **pixmap_return,
|
||||
GdkBitmap **mask_return,
|
||||
int alpha_threshold);
|
||||
#ifndef GDK_MULTIHEAD_SAFE
|
||||
void gdk_pixbuf_render_pixmap_and_mask (GdkPixbuf *pixbuf,
|
||||
GdkPixmap **pixmap_return,
|
||||
GdkBitmap **mask_return,
|
||||
int alpha_threshold);
|
||||
#endif
|
||||
|
||||
|
||||
/* Fetching a region from a drawable */
|
||||
GdkPixbuf *gdk_pixbuf_get_from_window (GdkWindow *window,
|
||||
GdkPixbuf *gdk_pixbuf_get_from_drawable (GdkPixbuf *dest,
|
||||
GdkDrawable *src,
|
||||
GdkColormap *cmap,
|
||||
int src_x,
|
||||
int src_y,
|
||||
int dest_x,
|
||||
int dest_y,
|
||||
int width,
|
||||
int height);
|
||||
|
||||
GdkPixbuf *gdk_pixbuf_get_from_surface (cairo_surface_t *surface,
|
||||
GdkPixbuf *gdk_pixbuf_get_from_surface (GdkPixbuf *dest,
|
||||
cairo_surface_t *surface,
|
||||
int src_x,
|
||||
int src_y,
|
||||
int dest_x,
|
||||
int dest_y,
|
||||
int width,
|
||||
int height);
|
||||
|
||||
|
||||
+196
@@ -0,0 +1,196 @@
|
||||
/* GDK - The GIMP Drawing Kit
|
||||
* Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
|
||||
* file for a list of people on the GTK+ Team. See the ChangeLog
|
||||
* files for a list of changes. These files are distributed with
|
||||
* GTK+ at ftp://ftp.gtk.org/pub/gtk/.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#include "gdkpixmap.h"
|
||||
#include "gdkinternals.h"
|
||||
#include "gdkpixbuf.h"
|
||||
#include "gdkscreen.h"
|
||||
|
||||
|
||||
static void gdk_pixmap_real_get_size (GdkDrawable *drawable,
|
||||
gint *width,
|
||||
gint *height);
|
||||
|
||||
static cairo_surface_t *gdk_pixmap_ref_cairo_surface (GdkDrawable *drawable);
|
||||
static cairo_surface_t *gdk_pixmap_create_cairo_surface (GdkDrawable *drawable,
|
||||
int width,
|
||||
int height);
|
||||
|
||||
static GdkVisual* gdk_pixmap_real_get_visual (GdkDrawable *drawable);
|
||||
static gint gdk_pixmap_real_get_depth (GdkDrawable *drawable);
|
||||
static void gdk_pixmap_real_set_colormap (GdkDrawable *drawable,
|
||||
GdkColormap *cmap);
|
||||
static GdkColormap* gdk_pixmap_real_get_colormap (GdkDrawable *drawable);
|
||||
static GdkScreen* gdk_pixmap_real_get_screen (GdkDrawable *drawable);
|
||||
|
||||
static void gdk_pixmap_init (GdkPixmapObject *pixmap);
|
||||
static void gdk_pixmap_class_init (GdkPixmapObjectClass *klass);
|
||||
static void gdk_pixmap_finalize (GObject *object);
|
||||
|
||||
static gpointer parent_class = NULL;
|
||||
|
||||
GType
|
||||
gdk_pixmap_get_type (void)
|
||||
{
|
||||
static GType object_type = 0;
|
||||
|
||||
if (!object_type)
|
||||
object_type = g_type_register_static_simple (GDK_TYPE_DRAWABLE,
|
||||
"GdkPixmap",
|
||||
sizeof (GdkPixmapObjectClass),
|
||||
(GClassInitFunc) gdk_pixmap_class_init,
|
||||
sizeof (GdkPixmapObject),
|
||||
(GInstanceInitFunc) gdk_pixmap_init,
|
||||
0);
|
||||
|
||||
return object_type;
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_pixmap_init (GdkPixmapObject *pixmap)
|
||||
{
|
||||
/* 0-initialization is good for all other fields. */
|
||||
pixmap->impl = g_object_new (_gdk_pixmap_impl_get_type (), NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_pixmap_class_init (GdkPixmapObjectClass *klass)
|
||||
{
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||
GdkDrawableClass *drawable_class = GDK_DRAWABLE_CLASS (klass);
|
||||
|
||||
parent_class = g_type_class_peek_parent (klass);
|
||||
|
||||
object_class->finalize = gdk_pixmap_finalize;
|
||||
|
||||
drawable_class->get_depth = gdk_pixmap_real_get_depth;
|
||||
drawable_class->get_screen = gdk_pixmap_real_get_screen;
|
||||
drawable_class->get_size = gdk_pixmap_real_get_size;
|
||||
drawable_class->set_colormap = gdk_pixmap_real_set_colormap;
|
||||
drawable_class->get_colormap = gdk_pixmap_real_get_colormap;
|
||||
drawable_class->get_visual = gdk_pixmap_real_get_visual;
|
||||
drawable_class->ref_cairo_surface = gdk_pixmap_ref_cairo_surface;
|
||||
drawable_class->create_cairo_surface = gdk_pixmap_create_cairo_surface;
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_pixmap_finalize (GObject *object)
|
||||
{
|
||||
GdkPixmapObject *obj = (GdkPixmapObject *) object;
|
||||
|
||||
g_object_unref (obj->impl);
|
||||
obj->impl = NULL;
|
||||
|
||||
G_OBJECT_CLASS (parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
GdkPixmap *
|
||||
gdk_pixmap_new (GdkDrawable *drawable,
|
||||
gint width,
|
||||
gint height,
|
||||
gint depth)
|
||||
{
|
||||
GdkDrawable *source_drawable;
|
||||
|
||||
if (drawable)
|
||||
source_drawable = _gdk_drawable_get_source_drawable (drawable);
|
||||
else
|
||||
source_drawable = NULL;
|
||||
return _gdk_pixmap_new (source_drawable, width, height, depth);
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_pixmap_real_get_size (GdkDrawable *drawable,
|
||||
gint *width,
|
||||
gint *height)
|
||||
{
|
||||
g_return_if_fail (GDK_IS_PIXMAP (drawable));
|
||||
|
||||
gdk_drawable_get_size (GDK_DRAWABLE (((GdkPixmapObject*)drawable)->impl),
|
||||
width, height);
|
||||
}
|
||||
|
||||
static GdkVisual*
|
||||
gdk_pixmap_real_get_visual (GdkDrawable *drawable)
|
||||
{
|
||||
GdkColormap *colormap;
|
||||
|
||||
g_return_val_if_fail (GDK_IS_PIXMAP (drawable), NULL);
|
||||
|
||||
colormap = gdk_drawable_get_colormap (drawable);
|
||||
return colormap ? gdk_colormap_get_visual (colormap) : NULL;
|
||||
}
|
||||
|
||||
static gint
|
||||
gdk_pixmap_real_get_depth (GdkDrawable *drawable)
|
||||
{
|
||||
gint depth;
|
||||
|
||||
g_return_val_if_fail (GDK_IS_PIXMAP (drawable), 0);
|
||||
|
||||
depth = GDK_PIXMAP_OBJECT (drawable)->depth;
|
||||
|
||||
return depth;
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_pixmap_real_set_colormap (GdkDrawable *drawable,
|
||||
GdkColormap *cmap)
|
||||
{
|
||||
g_return_if_fail (GDK_IS_PIXMAP (drawable));
|
||||
|
||||
gdk_drawable_set_colormap (((GdkPixmapObject*)drawable)->impl, cmap);
|
||||
}
|
||||
|
||||
static GdkColormap*
|
||||
gdk_pixmap_real_get_colormap (GdkDrawable *drawable)
|
||||
{
|
||||
g_return_val_if_fail (GDK_IS_PIXMAP (drawable), NULL);
|
||||
|
||||
return gdk_drawable_get_colormap (((GdkPixmapObject*)drawable)->impl);
|
||||
}
|
||||
|
||||
static cairo_surface_t *
|
||||
gdk_pixmap_ref_cairo_surface (GdkDrawable *drawable)
|
||||
{
|
||||
return _gdk_drawable_ref_cairo_surface (((GdkPixmapObject*)drawable)->impl);
|
||||
}
|
||||
|
||||
static cairo_surface_t *
|
||||
gdk_pixmap_create_cairo_surface (GdkDrawable *drawable,
|
||||
int width,
|
||||
int height)
|
||||
{
|
||||
return _gdk_windowing_create_cairo_surface (GDK_PIXMAP_OBJECT(drawable)->impl,
|
||||
width, height);
|
||||
}
|
||||
|
||||
static GdkScreen*
|
||||
gdk_pixmap_real_get_screen (GdkDrawable *drawable)
|
||||
{
|
||||
return gdk_drawable_get_screen (GDK_PIXMAP_OBJECT (drawable)->impl);
|
||||
}
|
||||
@@ -0,0 +1,94 @@
|
||||
/* GDK - The GIMP Drawing Kit
|
||||
* Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
|
||||
* file for a list of people on the GTK+ Team. See the ChangeLog
|
||||
* files for a list of changes. These files are distributed with
|
||||
* GTK+ at ftp://ftp.gtk.org/pub/gtk/.
|
||||
*/
|
||||
|
||||
#if !defined (__GDK_H_INSIDE__) && !defined (GDK_COMPILATION)
|
||||
#error "Only <gdk/gdk.h> can be included directly."
|
||||
#endif
|
||||
|
||||
#ifndef __GDK_PIXMAP_H__
|
||||
#define __GDK_PIXMAP_H__
|
||||
|
||||
#include <gdk/gdktypes.h>
|
||||
#include <gdk/gdkdrawable.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
typedef struct _GdkPixmapObject GdkPixmapObject;
|
||||
typedef struct _GdkPixmapObjectClass GdkPixmapObjectClass;
|
||||
|
||||
#define GDK_TYPE_PIXMAP (gdk_pixmap_get_type ())
|
||||
#define GDK_PIXMAP(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_PIXMAP, GdkPixmap))
|
||||
#define GDK_PIXMAP_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_PIXMAP, GdkPixmapObjectClass))
|
||||
#define GDK_IS_PIXMAP(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_PIXMAP))
|
||||
#define GDK_IS_PIXMAP_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_PIXMAP))
|
||||
#define GDK_PIXMAP_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_PIXMAP, GdkPixmapObjectClass))
|
||||
#define GDK_PIXMAP_OBJECT(object) ((GdkPixmapObject *) GDK_PIXMAP (object))
|
||||
|
||||
struct _GdkPixmapObject
|
||||
{
|
||||
GdkDrawable parent_instance;
|
||||
|
||||
GdkDrawable *GSEAL (impl); /* window-system-specific delegate object */
|
||||
|
||||
gint GSEAL (depth);
|
||||
};
|
||||
|
||||
struct _GdkPixmapObjectClass
|
||||
{
|
||||
GdkDrawableClass parent_class;
|
||||
|
||||
};
|
||||
|
||||
GType gdk_pixmap_get_type (void) G_GNUC_CONST;
|
||||
|
||||
/* Pixmaps
|
||||
*/
|
||||
GdkPixmap* gdk_pixmap_new (GdkDrawable *drawable,
|
||||
gint width,
|
||||
gint height,
|
||||
gint depth);
|
||||
|
||||
/* Functions to create/lookup pixmaps from their native equivalents
|
||||
*/
|
||||
#ifndef GDK_MULTIHEAD_SAFE
|
||||
GdkPixmap* gdk_pixmap_foreign_new (GdkNativeWindow anid);
|
||||
GdkPixmap* gdk_pixmap_lookup (GdkNativeWindow anid);
|
||||
#endif /* GDK_MULTIHEAD_SAFE */
|
||||
|
||||
GdkPixmap* gdk_pixmap_foreign_new_for_display (GdkDisplay *display,
|
||||
GdkNativeWindow anid);
|
||||
GdkPixmap* gdk_pixmap_lookup_for_display (GdkDisplay *display,
|
||||
GdkNativeWindow anid);
|
||||
GdkPixmap* gdk_pixmap_foreign_new_for_screen (GdkScreen *screen,
|
||||
GdkNativeWindow anid,
|
||||
gint width,
|
||||
gint height,
|
||||
gint depth);
|
||||
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GDK_PIXMAP_H__ */
|
||||
@@ -31,6 +31,9 @@
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define GDK_PARENT_RELATIVE_BG ((GdkPixmap *)1L)
|
||||
#define GDK_NO_BG ((GdkPixmap *)2L)
|
||||
|
||||
#ifndef GDK_COMPILATION
|
||||
#define GDK_WINDOW_TYPE(d) (gdk_window_get_window_type (GDK_WINDOW (d)))
|
||||
#define GDK_WINDOW_DESTROYED(d) (gdk_window_is_destroyed (GDK_WINDOW (d)))
|
||||
|
||||
@@ -28,26 +28,6 @@
|
||||
#include <gdk/gdk.h>
|
||||
|
||||
|
||||
/**
|
||||
* SECTION:regions
|
||||
* @Short_description: Simple graphical data types
|
||||
* @Title: Points and Rectangles
|
||||
*
|
||||
* GDK provides the #GdkPoint and #GdkRectangle data types for representing pixels
|
||||
* and sets of pixels on the screen. Together with Cairo's #cairo_region_t data
|
||||
* type, they make up the central types for representing graphical data.
|
||||
*
|
||||
* #GdkPoint is a simple structure containing an x and y coordinate of a point.
|
||||
*
|
||||
* #GdkRectangle is a structure holding the position and size of a rectangle.
|
||||
* The intersection of two rectangles can be computed with
|
||||
* gdk_rectangle_intersect(). To find the union of two rectangles use
|
||||
* gdk_rectangle_union().
|
||||
*
|
||||
* #cairo_region_t is usually used for managing clipping of graphical operations.
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* gdk_rectangle_union:
|
||||
* @src1: a #GdkRectangle
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
|
||||
#include "config.h"
|
||||
#include "gdk.h" /* For gdk_rectangle_intersect() */
|
||||
#include "gdkcolor.h"
|
||||
#include "gdkwindow.h"
|
||||
#include "gdkscreen.h"
|
||||
#include "gdkintl.h"
|
||||
|
||||
@@ -63,7 +63,12 @@ struct _GdkScreenClass
|
||||
};
|
||||
|
||||
GType gdk_screen_get_type (void) G_GNUC_CONST;
|
||||
GdkColormap *gdk_screen_get_default_colormap (GdkScreen *screen);
|
||||
void gdk_screen_set_default_colormap (GdkScreen *screen,
|
||||
GdkColormap *colormap);
|
||||
GdkColormap* gdk_screen_get_system_colormap (GdkScreen *screen);
|
||||
GdkVisual* gdk_screen_get_system_visual (GdkScreen *screen);
|
||||
GdkColormap *gdk_screen_get_rgba_colormap (GdkScreen *screen);
|
||||
GdkVisual * gdk_screen_get_rgba_visual (GdkScreen *screen);
|
||||
gboolean gdk_screen_is_composited (GdkScreen *screen);
|
||||
|
||||
|
||||
+16
-17
@@ -51,8 +51,8 @@
|
||||
/**
|
||||
* GDK_PARENT_RELATIVE:
|
||||
*
|
||||
* A special value, indicating that the background
|
||||
* for a window should be inherited from the parent window.
|
||||
* A special value for #GdkPixmap variables, indicating that the background
|
||||
* pixmap for a window should be inherited from the parent window.
|
||||
*/
|
||||
#define GDK_PARENT_RELATIVE 1L
|
||||
|
||||
@@ -64,14 +64,8 @@ G_BEGIN_DECLS
|
||||
/* Type definitions for the basic structures.
|
||||
*/
|
||||
typedef struct _GdkPoint GdkPoint;
|
||||
|
||||
/**
|
||||
* GdkRectangle:
|
||||
*
|
||||
* Defines the position and size of a rectangle. It is identical to
|
||||
* #cairo_rectangle_int_t.
|
||||
*/
|
||||
typedef cairo_rectangle_int_t GdkRectangle;
|
||||
typedef struct _GdkSpan GdkSpan;
|
||||
|
||||
typedef struct _GdkAtom *GdkAtom;
|
||||
|
||||
@@ -96,15 +90,21 @@ typedef guint32 GdkNativeWindow;
|
||||
/* Forward declarations of commonly used types
|
||||
*/
|
||||
typedef struct _GdkColor GdkColor;
|
||||
typedef struct _GdkColormap GdkColormap;
|
||||
typedef struct _GdkCursor GdkCursor;
|
||||
typedef struct _GdkVisual GdkVisual;
|
||||
|
||||
typedef struct _GdkDrawable GdkDrawable;
|
||||
typedef struct _GdkDrawable GdkBitmap;
|
||||
typedef struct _GdkDrawable GdkPixmap;
|
||||
|
||||
/**
|
||||
* GdkWindow:
|
||||
*
|
||||
* An opaque structure representing an onscreen drawable.
|
||||
* An opaque structure representing an onscreen drawable. Pointers to structures
|
||||
* of type #GdkPixmap, #GdkBitmap, and #GdkWindow can often be used
|
||||
* interchangeably. The type #GdkDrawable refers generically to any of these
|
||||
* types.
|
||||
*/
|
||||
typedef struct _GdkDrawable GdkWindow;
|
||||
typedef struct _GdkDisplay GdkDisplay;
|
||||
@@ -252,19 +252,18 @@ typedef enum
|
||||
GDK_ALL_EVENTS_MASK = 0x3FFFFE
|
||||
} GdkEventMask;
|
||||
|
||||
/**
|
||||
* GdkPoint:
|
||||
* @x: the x coordinate of the point.
|
||||
* @y: the y coordinate of the point.
|
||||
*
|
||||
* Defines the x and y coordinates of a point.
|
||||
*/
|
||||
struct _GdkPoint
|
||||
{
|
||||
gint x;
|
||||
gint y;
|
||||
};
|
||||
|
||||
struct _GdkSpan
|
||||
{
|
||||
gint x;
|
||||
gint y;
|
||||
gint width;
|
||||
};
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
||||
+1
-5
@@ -42,7 +42,6 @@ G_BEGIN_DECLS
|
||||
#define GDK_IS_VISUAL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_VISUAL))
|
||||
#define GDK_VISUAL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_VISUAL, GdkVisualClass))
|
||||
|
||||
typedef struct _GdkVisualPrivate GdkVisualPrivate;
|
||||
typedef struct _GdkVisualClass GdkVisualClass;
|
||||
|
||||
/* Types of visuals.
|
||||
@@ -78,8 +77,7 @@ typedef enum
|
||||
struct _GdkVisual
|
||||
{
|
||||
GObject parent_instance;
|
||||
|
||||
/*< private >*/
|
||||
|
||||
GdkVisualType GSEAL (type);
|
||||
gint GSEAL (depth);
|
||||
GdkByteOrder GSEAL (byte_order);
|
||||
@@ -97,8 +95,6 @@ struct _GdkVisual
|
||||
guint32 GSEAL (blue_mask);
|
||||
gint GSEAL (blue_shift);
|
||||
gint GSEAL (blue_prec);
|
||||
|
||||
GdkVisualPrivate *priv;
|
||||
};
|
||||
|
||||
GType gdk_visual_get_type (void) G_GNUC_CONST;
|
||||
|
||||
+1040
-310
File diff suppressed because it is too large
Load Diff
+55
-33
@@ -89,6 +89,7 @@ typedef enum
|
||||
* @GDK_WA_X: Honor the X coordinate field
|
||||
* @GDK_WA_Y: Honor the Y coordinate field
|
||||
* @GDK_WA_CURSOR: Honor the cursor field
|
||||
* @GDK_WA_COLORMAP: Honor the colormap field
|
||||
* @GDK_WA_VISUAL: Honor the visual field
|
||||
* @GDK_WA_WMCLASS: Honor the wmclass_class and wmclass_name fields
|
||||
* @GDK_WA_NOREDIR: Honor the override_redirect field
|
||||
@@ -107,10 +108,11 @@ typedef enum
|
||||
GDK_WA_X = 1 << 2,
|
||||
GDK_WA_Y = 1 << 3,
|
||||
GDK_WA_CURSOR = 1 << 4,
|
||||
GDK_WA_VISUAL = 1 << 5,
|
||||
GDK_WA_WMCLASS = 1 << 6,
|
||||
GDK_WA_NOREDIR = 1 << 7,
|
||||
GDK_WA_TYPE_HINT = 1 << 8
|
||||
GDK_WA_COLORMAP = 1 << 5,
|
||||
GDK_WA_VISUAL = 1 << 6,
|
||||
GDK_WA_WMCLASS = 1 << 7,
|
||||
GDK_WA_NOREDIR = 1 << 8,
|
||||
GDK_WA_TYPE_HINT = 1 << 9
|
||||
} GdkWindowAttributesType;
|
||||
|
||||
/* Size restriction enumeration.
|
||||
@@ -330,6 +332,7 @@ typedef enum
|
||||
* @wclass: #GDK_INPUT_OUTPUT (normal window) or #GDK_INPUT_ONLY (invisible
|
||||
* window that receives events)
|
||||
* @visual: #GdkVisual for window
|
||||
* @colormap: #GdkColormap for window
|
||||
* @window_type: type of window
|
||||
* @cursor: cursor for the window (see gdk_window_set_cursor())
|
||||
* @wmclass_name: don't use (see gtk_window_set_wmclass())
|
||||
@@ -348,6 +351,7 @@ struct _GdkWindowAttr
|
||||
gint height;
|
||||
GdkWindowClass wclass;
|
||||
GdkVisual *visual;
|
||||
GdkColormap *colormap;
|
||||
GdkWindowType window_type;
|
||||
GdkCursor *cursor;
|
||||
gchar *wmclass_name;
|
||||
@@ -501,9 +505,6 @@ void gdk_window_destroy (GdkWindow *window);
|
||||
GdkWindowType gdk_window_get_window_type (GdkWindow *window);
|
||||
gboolean gdk_window_is_destroyed (GdkWindow *window);
|
||||
|
||||
GdkVisual * gdk_window_get_visual (GdkWindow *window);
|
||||
GdkScreen * gdk_window_get_screen (GdkWindow *window);
|
||||
GdkDisplay * gdk_window_get_display (GdkWindow *window);
|
||||
#ifndef GDK_MULTIDEVICE_SAFE
|
||||
GdkWindow* gdk_window_at_pointer (gint *win_x,
|
||||
gint *win_y);
|
||||
@@ -527,6 +528,17 @@ void gdk_window_reparent (GdkWindow *window,
|
||||
GdkWindow *new_parent,
|
||||
gint x,
|
||||
gint y);
|
||||
void gdk_window_clear (GdkWindow *window);
|
||||
void gdk_window_clear_area (GdkWindow *window,
|
||||
gint x,
|
||||
gint y,
|
||||
gint width,
|
||||
gint height);
|
||||
void gdk_window_clear_area_e (GdkWindow *window,
|
||||
gint x,
|
||||
gint y,
|
||||
gint width,
|
||||
gint height);
|
||||
void gdk_window_raise (GdkWindow *window);
|
||||
void gdk_window_lower (GdkWindow *window);
|
||||
void gdk_window_restack (GdkWindow *window,
|
||||
@@ -563,6 +575,10 @@ gboolean gdk_window_ensure_native (GdkWindow *window);
|
||||
* This allows for making shaped (partially transparent) windows
|
||||
* - cool feature, needed for Drag and Drag for example.
|
||||
*/
|
||||
void gdk_window_shape_combine_mask (GdkWindow *window,
|
||||
GdkBitmap *mask,
|
||||
gint x,
|
||||
gint y);
|
||||
void gdk_window_shape_combine_region (GdkWindow *window,
|
||||
const cairo_region_t *shape_region,
|
||||
gint offset_x,
|
||||
@@ -590,6 +606,10 @@ void gdk_window_set_composited (GdkWindow *window,
|
||||
*/
|
||||
void gdk_window_merge_child_shapes (GdkWindow *window);
|
||||
|
||||
void gdk_window_input_shape_combine_mask (GdkWindow *window,
|
||||
GdkBitmap *mask,
|
||||
gint x,
|
||||
gint y);
|
||||
void gdk_window_input_shape_combine_region (GdkWindow *window,
|
||||
const cairo_region_t *shape_region,
|
||||
gint offset_x,
|
||||
@@ -668,8 +688,9 @@ void gdk_window_set_transient_for (GdkWindow *window,
|
||||
GdkWindow *parent);
|
||||
void gdk_window_set_background (GdkWindow *window,
|
||||
const GdkColor *color);
|
||||
void gdk_window_set_background_pattern (GdkWindow *window,
|
||||
cairo_pattern_t *pattern);
|
||||
void gdk_window_set_back_pixmap (GdkWindow *window,
|
||||
GdkPixmap *pixmap,
|
||||
gboolean parent_relative);
|
||||
cairo_pattern_t *gdk_window_get_background_pattern (GdkWindow *window);
|
||||
|
||||
void gdk_window_set_cursor (GdkWindow *window,
|
||||
@@ -688,8 +709,6 @@ void gdk_window_get_geometry (GdkWindow *window,
|
||||
gint *width,
|
||||
gint *height,
|
||||
gint *depth);
|
||||
int gdk_window_get_width (GdkWindow *window);
|
||||
int gdk_window_get_height (GdkWindow *window);
|
||||
void gdk_window_get_position (GdkWindow *window,
|
||||
gint *x,
|
||||
gint *y);
|
||||
@@ -748,6 +767,10 @@ GdkEventMask gdk_window_get_device_events (GdkWindow *window,
|
||||
|
||||
void gdk_window_set_icon_list (GdkWindow *window,
|
||||
GList *pixbufs);
|
||||
void gdk_window_set_icon (GdkWindow *window,
|
||||
GdkWindow *icon_window,
|
||||
GdkPixmap *pixmap,
|
||||
GdkBitmap *mask);
|
||||
void gdk_window_set_icon_name (GdkWindow *window,
|
||||
const gchar *name);
|
||||
void gdk_window_set_group (GdkWindow *window,
|
||||
@@ -802,26 +825,11 @@ void gdk_window_invalidate_rect (GdkWindow *window,
|
||||
void gdk_window_invalidate_region (GdkWindow *window,
|
||||
const cairo_region_t *region,
|
||||
gboolean invalidate_children);
|
||||
|
||||
/**
|
||||
* GdkWindowChildFunc:
|
||||
* @window: a #GdkWindow
|
||||
* @user_data: user data
|
||||
*
|
||||
* A function of this type is passed to gdk_window_invalidate_maybe_recurse().
|
||||
* It gets called for each child of the window to determine whether to
|
||||
* recursively invalidate it or now.
|
||||
*
|
||||
* Returns: %TRUE to invalidate @window recursively
|
||||
*/
|
||||
typedef gboolean (*GdkWindowChildFunc) (GdkWindow *window,
|
||||
gpointer user_data);
|
||||
|
||||
void gdk_window_invalidate_maybe_recurse (GdkWindow *window,
|
||||
const cairo_region_t *region,
|
||||
GdkWindowChildFunc child_func,
|
||||
gpointer user_data);
|
||||
cairo_region_t *gdk_window_get_update_area (GdkWindow *window);
|
||||
void gdk_window_invalidate_maybe_recurse (GdkWindow *window,
|
||||
const cairo_region_t *region,
|
||||
gboolean (*child_func) (GdkWindow *, gpointer),
|
||||
gpointer user_data);
|
||||
cairo_region_t *gdk_window_get_update_area (GdkWindow *window);
|
||||
|
||||
void gdk_window_freeze_updates (GdkWindow *window);
|
||||
void gdk_window_thaw_updates (GdkWindow *window);
|
||||
@@ -843,6 +851,11 @@ void gdk_window_constrain_size (GdkGeometry *geometry,
|
||||
gint *new_width,
|
||||
gint *new_height);
|
||||
|
||||
void gdk_window_get_internal_paint_info (GdkWindow *window,
|
||||
GdkDrawable **real_drawable,
|
||||
gint *x_offset,
|
||||
gint *y_offset);
|
||||
|
||||
void gdk_window_enable_synchronized_configure (GdkWindow *window);
|
||||
void gdk_window_configure_finished (GdkWindow *window);
|
||||
|
||||
@@ -853,13 +866,22 @@ GdkPointerHooks *gdk_set_pointer_hooks (const GdkPointerHooks *new_hooks);
|
||||
GdkWindow *gdk_get_default_root_window (void);
|
||||
|
||||
/* Offscreen redirection */
|
||||
cairo_surface_t *
|
||||
gdk_offscreen_window_get_surface (GdkWindow *window);
|
||||
GdkPixmap *gdk_offscreen_window_get_pixmap (GdkWindow *window);
|
||||
void gdk_offscreen_window_set_embedder (GdkWindow *window,
|
||||
GdkWindow *embedder);
|
||||
GdkWindow *gdk_offscreen_window_get_embedder (GdkWindow *window);
|
||||
void gdk_window_geometry_changed (GdkWindow *window);
|
||||
|
||||
void gdk_window_redirect_to_drawable (GdkWindow *window,
|
||||
GdkDrawable *drawable,
|
||||
gint src_x,
|
||||
gint src_y,
|
||||
gint dest_x,
|
||||
gint dest_y,
|
||||
gint width,
|
||||
gint height);
|
||||
void gdk_window_remove_redirection (GdkWindow *window);
|
||||
|
||||
/* Multidevice support */
|
||||
void gdk_window_set_support_multidevice (GdkWindow *window,
|
||||
gboolean support_multidevice);
|
||||
|
||||
+24
-6
@@ -62,7 +62,9 @@ struct _GdkWindowImplIface
|
||||
gint width,
|
||||
gint height);
|
||||
void (* set_background) (GdkWindow *window,
|
||||
cairo_pattern_t *pattern);
|
||||
const GdkColor *color);
|
||||
void (* set_back_pixmap) (GdkWindow *window,
|
||||
GdkPixmap *pixmap);
|
||||
|
||||
GdkEventMask (* get_events) (GdkWindow *window);
|
||||
void (* set_events) (GdkWindow *window,
|
||||
@@ -72,6 +74,9 @@ struct _GdkWindowImplIface
|
||||
GdkWindow *new_parent,
|
||||
gint x,
|
||||
gint y);
|
||||
void (* clear_region) (GdkWindow *window,
|
||||
cairo_region_t *region,
|
||||
gboolean send_expose);
|
||||
|
||||
void (* set_device_cursor) (GdkWindow *window,
|
||||
GdkDevice *device,
|
||||
@@ -141,16 +146,29 @@ struct _GdkWindowImplIface
|
||||
void (* destroy) (GdkWindow *window,
|
||||
gboolean recursing,
|
||||
gboolean foreign_destroy);
|
||||
|
||||
cairo_surface_t * (* resize_cairo_surface) (GdkWindow *window,
|
||||
cairo_surface_t *surface,
|
||||
gint width,
|
||||
gint height);
|
||||
gboolean supports_native_bg;
|
||||
};
|
||||
|
||||
/* Interface Functions */
|
||||
GType gdk_window_impl_get_type (void) G_GNUC_CONST;
|
||||
|
||||
/* private definitions from gdkwindow.h */
|
||||
|
||||
struct _GdkWindowRedirect
|
||||
{
|
||||
GdkWindowObject *redirected;
|
||||
GdkDrawable *pixmap;
|
||||
|
||||
gint src_x;
|
||||
gint src_y;
|
||||
gint dest_x;
|
||||
gint dest_y;
|
||||
gint width;
|
||||
gint height;
|
||||
|
||||
cairo_region_t *damage;
|
||||
guint damage_idle;
|
||||
};
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
||||
@@ -84,6 +84,7 @@ gdk_OBJECTS = \
|
||||
gdkpango.obj \
|
||||
gdkpixbuf-drawable.obj \
|
||||
gdkpixbuf-render.obj \
|
||||
gdkpixmap.obj \
|
||||
gdkrectangle.obj \
|
||||
gdkscreen.obj \
|
||||
gdkselection.obj \
|
||||
@@ -103,6 +104,7 @@ gdk_public_h_sources = \
|
||||
gdkkeys.h \
|
||||
gdkpango.h \
|
||||
gdkpixbuf.h \
|
||||
gdkpixmap.h \
|
||||
gdkproperty.h \
|
||||
gdkselection.h \
|
||||
gdktypes.h \
|
||||
|
||||
@@ -61,8 +61,8 @@
|
||||
if (GDK_WINDOW_DESTROYED (gdk_window))
|
||||
return YES;
|
||||
|
||||
/* A view is opaque if its GdkWindow doesn't have the RGBA visual */
|
||||
return gdk_window_get_visual (gdk_window) != gdk_screen_get_rgba_visual (_gdk_screen);
|
||||
/* A view is opaque if its GdkWindow doesn't have the RGBA colormap */
|
||||
return gdk_drawable_get_colormap (gdk_window) != gdk_screen_get_rgba_colormap (_gdk_screen);
|
||||
}
|
||||
|
||||
-(void)drawRect:(NSRect)rect
|
||||
|
||||
@@ -454,7 +454,7 @@ update_context_from_dragging_info (id <NSDraggingInfo> sender)
|
||||
|
||||
- (NSDragOperation)draggingEntered:(id <NSDraggingInfo>)sender
|
||||
{
|
||||
GdkDeviceManager *device_manager;
|
||||
GdkDeviceManager device_manager;
|
||||
GdkEvent *event;
|
||||
GdkWindow *window;
|
||||
|
||||
|
||||
@@ -22,6 +22,7 @@ libgdk_quartz_la_SOURCES = \
|
||||
GdkQuartzWindow.c \
|
||||
GdkQuartzWindow.h \
|
||||
gdkapplaunchcontext-quartz.c \
|
||||
gdkcolor-quartz.c \
|
||||
gdkcursor-quartz.c \
|
||||
gdkdevice-core.c \
|
||||
gdkdevicemanager-core.c \
|
||||
@@ -38,6 +39,8 @@ libgdk_quartz_la_SOURCES = \
|
||||
gdkinputprivate.h \
|
||||
gdkkeys-quartz.c \
|
||||
gdkmain-quartz.c \
|
||||
gdkpixmap-quartz.c \
|
||||
gdkpixmap-quartz.h \
|
||||
gdkprivate-quartz.h \
|
||||
gdkproperty-quartz.c \
|
||||
gdkquartz.h \
|
||||
|
||||
@@ -0,0 +1,199 @@
|
||||
/* gdkcolor-quartz.c
|
||||
*
|
||||
* Copyright (C) 2005 Imendio AB
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include "gdkcolor.h"
|
||||
#include "gdkprivate-quartz.h"
|
||||
|
||||
GType
|
||||
gdk_colormap_get_type (void)
|
||||
{
|
||||
static GType object_type = 0;
|
||||
|
||||
if (!object_type)
|
||||
{
|
||||
const GTypeInfo object_info =
|
||||
{
|
||||
sizeof (GdkColormapClass),
|
||||
(GBaseInitFunc) NULL,
|
||||
(GBaseFinalizeFunc) NULL,
|
||||
(GClassInitFunc) NULL,
|
||||
NULL, /* class_finalize */
|
||||
NULL, /* class_data */
|
||||
sizeof (GdkColormap),
|
||||
0, /* n_preallocs */
|
||||
(GInstanceInitFunc) NULL,
|
||||
};
|
||||
|
||||
object_type = g_type_register_static (G_TYPE_OBJECT,
|
||||
"GdkColormap",
|
||||
&object_info,
|
||||
0);
|
||||
}
|
||||
|
||||
return object_type;
|
||||
}
|
||||
|
||||
GdkColormap *
|
||||
gdk_colormap_new (GdkVisual *visual,
|
||||
gint private_cmap)
|
||||
{
|
||||
g_return_val_if_fail (visual != NULL, NULL);
|
||||
|
||||
/* FIXME: Implement */
|
||||
return NULL;
|
||||
}
|
||||
|
||||
GdkColormap *
|
||||
gdk_screen_get_system_colormap (GdkScreen *screen)
|
||||
{
|
||||
static GdkColormap *colormap = NULL;
|
||||
|
||||
g_return_val_if_fail (GDK_IS_SCREEN (screen), NULL);
|
||||
|
||||
if (!colormap)
|
||||
{
|
||||
colormap = g_object_new (GDK_TYPE_COLORMAP, NULL);
|
||||
|
||||
colormap->visual = gdk_visual_get_system ();
|
||||
colormap->size = colormap->visual->colormap_size;
|
||||
}
|
||||
|
||||
return colormap;
|
||||
}
|
||||
|
||||
|
||||
GdkColormap *
|
||||
gdk_screen_get_rgba_colormap (GdkScreen *screen)
|
||||
{
|
||||
static GdkColormap *colormap = NULL;
|
||||
|
||||
g_return_val_if_fail (GDK_IS_SCREEN (screen), NULL);
|
||||
|
||||
if (!colormap)
|
||||
{
|
||||
colormap = g_object_new (GDK_TYPE_COLORMAP, NULL);
|
||||
|
||||
colormap->visual = gdk_screen_get_rgba_visual (screen);
|
||||
colormap->size = colormap->visual->colormap_size;
|
||||
}
|
||||
|
||||
return colormap;
|
||||
}
|
||||
|
||||
void
|
||||
gdk_colormap_free_colors (GdkColormap *colormap,
|
||||
const GdkColor *colors,
|
||||
gint n_colors)
|
||||
{
|
||||
/* This function shouldn't do anything since colors are never allocated. */
|
||||
}
|
||||
|
||||
gint
|
||||
gdk_colormap_alloc_colors (GdkColormap *colormap,
|
||||
GdkColor *colors,
|
||||
gint ncolors,
|
||||
gboolean writeable,
|
||||
gboolean best_match,
|
||||
gboolean *success)
|
||||
{
|
||||
int i;
|
||||
int alpha;
|
||||
|
||||
g_return_val_if_fail (GDK_IS_COLORMAP (colormap), ncolors);
|
||||
g_return_val_if_fail (colors != NULL, ncolors);
|
||||
g_return_val_if_fail (success != NULL, ncolors);
|
||||
|
||||
if (gdk_colormap_get_visual (colormap)->depth == 32)
|
||||
alpha = 0xff;
|
||||
else
|
||||
alpha = 0;
|
||||
|
||||
for (i = 0; i < ncolors; i++)
|
||||
{
|
||||
colors[i].pixel = alpha << 24 |
|
||||
((colors[i].red >> 8) & 0xff) << 16 |
|
||||
((colors[i].green >> 8) & 0xff) << 8 |
|
||||
((colors[i].blue >> 8) & 0xff);
|
||||
}
|
||||
|
||||
*success = TRUE;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
GdkScreen*
|
||||
gdk_colormap_get_screen (GdkColormap *cmap)
|
||||
{
|
||||
g_return_val_if_fail (cmap != NULL, NULL);
|
||||
|
||||
return gdk_screen_get_default ();
|
||||
}
|
||||
|
||||
CGColorRef
|
||||
_gdk_quartz_colormap_get_cgcolor_from_pixel (GdkDrawable *drawable,
|
||||
guint32 pixel)
|
||||
{
|
||||
CGFloat components[4] = { 0.0f, };
|
||||
CGColorRef color;
|
||||
CGColorSpaceRef colorspace;
|
||||
const GdkVisual *visual;
|
||||
GdkColormap *colormap;
|
||||
|
||||
colormap = gdk_drawable_get_colormap (drawable);
|
||||
if (colormap)
|
||||
visual = gdk_colormap_get_visual (colormap);
|
||||
else
|
||||
visual = gdk_visual_get_best_with_depth (gdk_drawable_get_depth (drawable));
|
||||
|
||||
switch (visual->type)
|
||||
{
|
||||
case GDK_VISUAL_STATIC_GRAY:
|
||||
case GDK_VISUAL_GRAYSCALE:
|
||||
components[0] = (pixel & 0xff) / 255.0f;
|
||||
|
||||
if (visual->depth == 1)
|
||||
components[0] = components[0] == 0.0f ? 0.0f : 1.0f;
|
||||
components[1] = 1.0f;
|
||||
|
||||
colorspace = CGColorSpaceCreateWithName (kCGColorSpaceGenericGray);
|
||||
color = CGColorCreate (colorspace, components);
|
||||
CGColorSpaceRelease (colorspace);
|
||||
break;
|
||||
|
||||
default:
|
||||
components[0] = (pixel >> 16 & 0xff) / 255.0;
|
||||
components[1] = (pixel >> 8 & 0xff) / 255.0;
|
||||
components[2] = (pixel & 0xff) / 255.0;
|
||||
|
||||
if (visual->depth == 32)
|
||||
components[3] = (pixel >> 24 & 0xff) / 255.0;
|
||||
else
|
||||
components[3] = 1.0;
|
||||
|
||||
colorspace = CGColorSpaceCreateWithName (kCGColorSpaceGenericRGB);
|
||||
color = CGColorCreate (colorspace, components);
|
||||
CGColorSpaceRelease (colorspace);
|
||||
break;
|
||||
}
|
||||
|
||||
return color;
|
||||
}
|
||||
@@ -237,6 +237,91 @@ gdk_cursor_new_for_display (GdkDisplay *display,
|
||||
return gdk_quartz_cursor_new_from_nscursor (nscursor, cursor_type);
|
||||
}
|
||||
|
||||
GdkCursor*
|
||||
gdk_cursor_new_from_pixmap (GdkPixmap *source,
|
||||
GdkPixmap *mask,
|
||||
const GdkColor *fg,
|
||||
const GdkColor *bg,
|
||||
gint x,
|
||||
gint y)
|
||||
{
|
||||
NSBitmapImageRep *bitmap_rep;
|
||||
NSImage *image;
|
||||
NSCursor *nscursor;
|
||||
GdkCursor *cursor;
|
||||
int width, height;
|
||||
gint tmp_x, tmp_y;
|
||||
guchar *dst_data, *mask_data, *src_data;
|
||||
guchar *mask_start, *src_start;
|
||||
int dst_stride;
|
||||
|
||||
g_return_val_if_fail (GDK_IS_PIXMAP (source), NULL);
|
||||
g_return_val_if_fail (GDK_IS_PIXMAP (mask), NULL);
|
||||
g_return_val_if_fail (fg != NULL, NULL);
|
||||
g_return_val_if_fail (bg != NULL, NULL);
|
||||
|
||||
GDK_QUARTZ_ALLOC_POOL;
|
||||
|
||||
gdk_drawable_get_size (source, &width, &height);
|
||||
|
||||
bitmap_rep = [[NSBitmapImageRep alloc] initWithBitmapDataPlanes:NULL
|
||||
pixelsWide:(NSInteger)width pixelsHigh:(NSInteger)height
|
||||
bitsPerSample:8 samplesPerPixel:4
|
||||
hasAlpha:YES isPlanar:NO colorSpaceName:NSDeviceRGBColorSpace
|
||||
bytesPerRow:0 bitsPerPixel:0];
|
||||
|
||||
dst_stride = [bitmap_rep bytesPerRow];
|
||||
mask_start = GDK_PIXMAP_IMPL_QUARTZ (GDK_PIXMAP_OBJECT (mask)->impl)->data;
|
||||
src_start = GDK_PIXMAP_IMPL_QUARTZ (GDK_PIXMAP_OBJECT (source)->impl)->data;
|
||||
|
||||
for (tmp_y = 0; tmp_y < height; tmp_y++)
|
||||
{
|
||||
dst_data = [bitmap_rep bitmapData] + tmp_y * dst_stride;
|
||||
mask_data = mask_start + tmp_y * width;
|
||||
src_data = src_start + tmp_y * width;
|
||||
|
||||
for (tmp_x = 0; tmp_x < width; tmp_x++)
|
||||
{
|
||||
if (*mask_data++)
|
||||
{
|
||||
const GdkColor *color;
|
||||
|
||||
if (*src_data++)
|
||||
color = fg;
|
||||
else
|
||||
color = bg;
|
||||
|
||||
*dst_data++ = (color->red >> 8) & 0xff;
|
||||
*dst_data++ = (color->green >> 8) & 0xff;
|
||||
*dst_data++ = (color->blue >> 8) & 0xff;
|
||||
*dst_data++ = 0xff;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
*dst_data++ = 0x00;
|
||||
*dst_data++ = 0x00;
|
||||
*dst_data++ = 0x00;
|
||||
*dst_data++ = 0x00;
|
||||
|
||||
src_data++;
|
||||
}
|
||||
}
|
||||
}
|
||||
image = [[NSImage alloc] init];
|
||||
[image addRepresentation:bitmap_rep];
|
||||
[bitmap_rep release];
|
||||
|
||||
nscursor = [[NSCursor alloc] initWithImage:image hotSpot:NSMakePoint(x, y)];
|
||||
[image release];
|
||||
|
||||
cursor = gdk_quartz_cursor_new_from_nscursor (nscursor, GDK_CURSOR_IS_PIXMAP);
|
||||
|
||||
GDK_QUARTZ_RELEASE_POOL;
|
||||
|
||||
return cursor;
|
||||
}
|
||||
|
||||
static NSImage *
|
||||
_gdk_quartz_pixbuf_to_ns_image (GdkPixbuf *pixbuf)
|
||||
{
|
||||
|
||||
@@ -268,7 +268,7 @@ gdk_device_core_query_state (GdkDevice *device,
|
||||
if (!found_window)
|
||||
return FALSE;
|
||||
|
||||
display = gdk_window_get_display (window);
|
||||
display = gdk_drawable_get_display (window);
|
||||
|
||||
if (root_window)
|
||||
*root_window = _gdk_root;
|
||||
|
||||
@@ -32,6 +32,15 @@ typedef struct {
|
||||
CGContextRef cg_context;
|
||||
} GdkQuartzCairoSurfaceData;
|
||||
|
||||
gboolean
|
||||
_gdk_windowing_set_cairo_surface_size (cairo_surface_t *surface,
|
||||
int width,
|
||||
int height)
|
||||
{
|
||||
/* This is not supported with quartz surfaces. */
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_quartz_cairo_surface_destroy (void *data)
|
||||
{
|
||||
@@ -46,10 +55,10 @@ gdk_quartz_cairo_surface_destroy (void *data)
|
||||
g_free (surface_data);
|
||||
}
|
||||
|
||||
static cairo_surface_t *
|
||||
gdk_quartz_create_cairo_surface (GdkDrawable *drawable,
|
||||
int width,
|
||||
int height)
|
||||
cairo_surface_t *
|
||||
_gdk_windowing_create_cairo_surface (GdkDrawable *drawable,
|
||||
int width,
|
||||
int height)
|
||||
{
|
||||
CGContextRef cg_context;
|
||||
GdkQuartzCairoSurfaceData *surface_data;
|
||||
@@ -85,10 +94,11 @@ gdk_quartz_ref_cairo_surface (GdkDrawable *drawable)
|
||||
|
||||
if (!impl->cairo_surface)
|
||||
{
|
||||
impl->cairo_surface =
|
||||
gdk_quartz_create_cairo_surface (drawable,
|
||||
gdk_window_get_width (impl->wrapper),
|
||||
gdk_window_get_height (impl->wrapper));
|
||||
int width, height;
|
||||
|
||||
gdk_drawable_get_size (drawable, &width, &height);
|
||||
impl->cairo_surface = _gdk_windowing_create_cairo_surface (drawable,
|
||||
width, height);
|
||||
}
|
||||
else
|
||||
cairo_surface_reference (impl->cairo_surface);
|
||||
@@ -96,9 +106,56 @@ gdk_quartz_ref_cairo_surface (GdkDrawable *drawable)
|
||||
return impl->cairo_surface;
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_quartz_set_colormap (GdkDrawable *drawable,
|
||||
GdkColormap *colormap)
|
||||
{
|
||||
GdkDrawableImplQuartz *impl = GDK_DRAWABLE_IMPL_QUARTZ (drawable);
|
||||
|
||||
if (impl->colormap == colormap)
|
||||
return;
|
||||
|
||||
if (impl->colormap)
|
||||
g_object_unref (impl->colormap);
|
||||
impl->colormap = colormap;
|
||||
if (impl->colormap)
|
||||
g_object_ref (impl->colormap);
|
||||
}
|
||||
|
||||
static GdkColormap*
|
||||
gdk_quartz_get_colormap (GdkDrawable *drawable)
|
||||
{
|
||||
return GDK_DRAWABLE_IMPL_QUARTZ (drawable)->colormap;
|
||||
}
|
||||
|
||||
static GdkScreen*
|
||||
gdk_quartz_get_screen (GdkDrawable *drawable)
|
||||
{
|
||||
return _gdk_screen;
|
||||
}
|
||||
|
||||
static GdkVisual*
|
||||
gdk_quartz_get_visual (GdkDrawable *drawable)
|
||||
{
|
||||
return gdk_drawable_get_visual (GDK_DRAWABLE_IMPL_QUARTZ (drawable)->wrapper);
|
||||
}
|
||||
|
||||
static int
|
||||
gdk_quartz_get_depth (GdkDrawable *drawable)
|
||||
{
|
||||
/* This is a bit bogus but I'm not sure the other way is better */
|
||||
|
||||
return gdk_drawable_get_depth (GDK_DRAWABLE_IMPL_QUARTZ (drawable)->wrapper);
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_drawable_impl_quartz_finalize (GObject *object)
|
||||
{
|
||||
GdkDrawableImplQuartz *impl = GDK_DRAWABLE_IMPL_QUARTZ (object);
|
||||
|
||||
if (impl->colormap)
|
||||
g_object_unref (impl->colormap);
|
||||
|
||||
G_OBJECT_CLASS (parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
@@ -113,7 +170,13 @@ gdk_drawable_impl_quartz_class_init (GdkDrawableImplQuartzClass *klass)
|
||||
object_class->finalize = gdk_drawable_impl_quartz_finalize;
|
||||
|
||||
drawable_class->ref_cairo_surface = gdk_quartz_ref_cairo_surface;
|
||||
drawable_class->create_cairo_surface = gdk_quartz_create_cairo_surface;
|
||||
|
||||
drawable_class->set_colormap = gdk_quartz_set_colormap;
|
||||
drawable_class->get_colormap = gdk_quartz_get_colormap;
|
||||
|
||||
drawable_class->get_depth = gdk_quartz_get_depth;
|
||||
drawable_class->get_screen = gdk_quartz_get_screen;
|
||||
drawable_class->get_visual = gdk_quartz_get_visual;
|
||||
}
|
||||
|
||||
GType
|
||||
@@ -158,20 +221,6 @@ gdk_quartz_drawable_get_context (GdkDrawable *drawable,
|
||||
return GDK_DRAWABLE_IMPL_QUARTZ_GET_CLASS (drawable)->get_context (drawable, antialias);
|
||||
}
|
||||
|
||||
void
|
||||
gdk_quartz_drawable_release_context (GdkDrawable *drawable,
|
||||
CGContextRef cg_context)
|
||||
{
|
||||
if (!GDK_DRAWABLE_IMPL_QUARTZ_GET_CLASS (drawable)->release_context)
|
||||
{
|
||||
g_warning ("%s doesn't implement GdkDrawableImplQuartzClass::release_context()",
|
||||
G_OBJECT_TYPE_NAME (drawable));
|
||||
return;
|
||||
}
|
||||
|
||||
GDK_DRAWABLE_IMPL_QUARTZ_GET_CLASS (drawable)->release_context (drawable, cg_context);
|
||||
}
|
||||
|
||||
/* Help preventing "beam sync penalty" where CG makes all graphics code
|
||||
* block until the next vsync if we try to flush (including call display on
|
||||
* a view) too often. We do this by limiting the manual flushing done
|
||||
@@ -217,6 +266,28 @@ _gdk_quartz_drawable_flush (GdkDrawable *drawable)
|
||||
prev_tv = tv;
|
||||
}
|
||||
|
||||
void
|
||||
gdk_quartz_drawable_release_context (GdkDrawable *drawable,
|
||||
CGContextRef cg_context)
|
||||
{
|
||||
if (GDK_IS_WINDOW_IMPL_QUARTZ (drawable))
|
||||
{
|
||||
GdkWindowImplQuartz *window_impl = GDK_WINDOW_IMPL_QUARTZ (drawable);
|
||||
|
||||
CGContextRestoreGState (cg_context);
|
||||
CGContextSetAllowsAntialiasing (cg_context, TRUE);
|
||||
|
||||
/* See comment in gdk_quartz_drawable_get_context(). */
|
||||
if (window_impl->in_paint_rect_count == 0)
|
||||
{
|
||||
_gdk_quartz_drawable_flush (drawable);
|
||||
[window_impl->view unlockFocus];
|
||||
}
|
||||
}
|
||||
else if (GDK_IS_PIXMAP_IMPL_QUARTZ (drawable))
|
||||
CGContextRelease (cg_context);
|
||||
}
|
||||
|
||||
void
|
||||
_gdk_quartz_drawable_finish (GdkDrawable *drawable)
|
||||
{
|
||||
|
||||
@@ -23,8 +23,6 @@
|
||||
|
||||
#include <gdk/gdkdrawable.h>
|
||||
|
||||
#include <AppKit/AppKit.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
/* Drawable implementation for Quartz
|
||||
@@ -46,6 +44,8 @@ struct _GdkDrawableImplQuartz
|
||||
|
||||
GdkDrawable *wrapper;
|
||||
|
||||
GdkColormap *colormap;
|
||||
|
||||
cairo_surface_t *cairo_surface;
|
||||
};
|
||||
|
||||
@@ -56,8 +56,6 @@ struct _GdkDrawableImplQuartzClass
|
||||
/* vtable */
|
||||
CGContextRef (*get_context) (GdkDrawable* drawable,
|
||||
gboolean antialias);
|
||||
void (*release_context) (GdkDrawable *drawable,
|
||||
CGContextRef cg_context);
|
||||
};
|
||||
|
||||
GType gdk_drawable_impl_quartz_get_type (void);
|
||||
|
||||
@@ -366,7 +366,7 @@ generate_motion_event (GdkWindow *window)
|
||||
nswindow = ((GdkWindowImplQuartz *)private->impl)->toplevel;
|
||||
view = (GdkQuartzView *)[nswindow contentView];
|
||||
|
||||
display = gdk_window_get_display (window);
|
||||
display = gdk_drawable_get_display (window);
|
||||
|
||||
screen_point = [NSEvent mouseLocation];
|
||||
|
||||
@@ -540,7 +540,7 @@ find_toplevel_for_keyboard_event (NSEvent *nsevent)
|
||||
view = (GdkQuartzView *)[[nsevent window] contentView];
|
||||
window = [view gdkWindow];
|
||||
|
||||
display = gdk_window_get_display (window);
|
||||
display = gdk_drawable_get_display (GDK_DRAWABLE (window));
|
||||
|
||||
device_manager = gdk_display_get_device_manager (display);
|
||||
list = gdk_device_manager_list_devices (device_manager,
|
||||
@@ -583,7 +583,7 @@ find_toplevel_for_mouse_event (NSEvent *nsevent,
|
||||
view = (GdkQuartzView *)[[nsevent window] contentView];
|
||||
toplevel = [view gdkWindow];
|
||||
|
||||
display = gdk_window_get_display (toplevel);
|
||||
display = gdk_drawable_get_display (toplevel);
|
||||
private = GDK_WINDOW_OBJECT (toplevel);
|
||||
|
||||
event_type = [nsevent type];
|
||||
|
||||
@@ -277,10 +277,10 @@ maybe_update_keymap (void)
|
||||
}
|
||||
|
||||
/* Special-case shift-tab since GTK+ expects
|
||||
* GDK_KEY_ISO_Left_Tab for that.
|
||||
* GDK_ISO_Left_Tab for that.
|
||||
*/
|
||||
if (found && p[j] == GDK_KEY_Tab && modifiers[j] == shiftKey)
|
||||
p[j] = GDK_KEY_ISO_Left_Tab;
|
||||
if (found && p[j] == GDK_Tab && modifiers[j] == shiftKey)
|
||||
p[j] = GDK_ISO_Left_Tab;
|
||||
|
||||
if (!found)
|
||||
{
|
||||
@@ -359,7 +359,7 @@ maybe_update_keymap (void)
|
||||
}
|
||||
|
||||
/* Special-case shift-tab since GTK+ expects
|
||||
* GDK_KEY_ISO_Left_Tab for that.
|
||||
* GDK_ISO_Left_Tab for that.
|
||||
*/
|
||||
if (found && p[j] == GDK_KEY_Tab && modifiers[j] == shiftKey)
|
||||
p[j] = GDK_KEY_ISO_Left_Tab;
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user