PIKApp/libpika/pikadisplay_pdb.c

302 lines
8.9 KiB
C
Raw Normal View History

2023-09-26 00:35:21 +02:00
/* LIBPIKA - The PIKA Library
* Copyright (C) 1995-2003 Peter Mattis and Spencer Kimball
*
* pikadisplay_pdb.c
*
* 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 3 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, see
* <https://www.gnu.org/licenses/>.
*/
/* NOTE: This file is auto-generated by pdbgen.pl */
#include "config.h"
#include "stamp-pdbgen.h"
#include "pika.h"
/**
* SECTION: pikadisplay
* @title: pikadisplay
* @short_description: Functions to create, delete and flush displays (views) on an image.
*
* Functions to create, delete and flush displays (views) on an image.
**/
/**
* pika_display_id_is_valid:
* @display_id: The display ID to check.
*
* Returns TRUE if the display ID is valid.
*
* This procedure checks if the given display ID is valid and refers to
* an existing display.
*
* Returns: Whether the display ID is valid.
*
* Since: 3.0
**/
gboolean
pika_display_id_is_valid (gint display_id)
{
PikaValueArray *args;
PikaValueArray *return_vals;
gboolean valid = FALSE;
args = pika_value_array_new_from_types (NULL,
G_TYPE_INT, display_id,
G_TYPE_NONE);
2023-10-30 23:55:30 +01:00
return_vals = _pika_pdb_run_procedure_array (pika_get_pdb (),
"pika-display-id-is-valid",
args);
2023-09-26 00:35:21 +02:00
pika_value_array_unref (args);
if (PIKA_VALUES_GET_ENUM (return_vals, 0) == PIKA_PDB_SUCCESS)
valid = PIKA_VALUES_GET_BOOLEAN (return_vals, 1);
pika_value_array_unref (return_vals);
return valid;
}
/**
* pika_display_new:
* @image: The image.
*
* Create a new display for the specified image.
*
* Creates a new display for the specified image. If the image already
* has a display, another is added. Multiple displays are handled
* transparently by PIKA. The newly created display is returned and can
* be subsequently destroyed with a call to pika_display_delete(). This
* procedure only makes sense for use with the PIKA UI, and will result
* in an execution error if called when PIKA has no UI.
*
* Returns: (transfer none): The new display.
**/
PikaDisplay *
pika_display_new (PikaImage *image)
{
PikaValueArray *args;
PikaValueArray *return_vals;
PikaDisplay *display = NULL;
args = pika_value_array_new_from_types (NULL,
PIKA_TYPE_IMAGE, image,
G_TYPE_NONE);
2023-10-30 23:55:30 +01:00
return_vals = _pika_pdb_run_procedure_array (pika_get_pdb (),
"pika-display-new",
args);
2023-09-26 00:35:21 +02:00
pika_value_array_unref (args);
if (PIKA_VALUES_GET_ENUM (return_vals, 0) == PIKA_PDB_SUCCESS)
display = PIKA_VALUES_GET_DISPLAY (return_vals, 1);
pika_value_array_unref (return_vals);
return display;
}
/**
* pika_display_delete:
* @display: The display to delete.
*
* Delete the specified display.
*
* This procedure removes the specified display. If this is the last
* remaining display for the underlying image, then the image is
* deleted also. Note that the display is closed no matter if the image
* is dirty or not. Better save the image before calling this
* procedure.
*
* Returns: TRUE on success.
**/
gboolean
pika_display_delete (PikaDisplay *display)
{
PikaValueArray *args;
PikaValueArray *return_vals;
gboolean success = TRUE;
args = pika_value_array_new_from_types (NULL,
PIKA_TYPE_DISPLAY, display,
G_TYPE_NONE);
2023-10-30 23:55:30 +01:00
return_vals = _pika_pdb_run_procedure_array (pika_get_pdb (),
"pika-display-delete",
args);
2023-09-26 00:35:21 +02:00
pika_value_array_unref (args);
success = PIKA_VALUES_GET_ENUM (return_vals, 0) == PIKA_PDB_SUCCESS;
pika_value_array_unref (return_vals);
return success;
}
/**
* pika_display_get_window_handle:
* @display: The display to get the window handle from.
*
* Get a handle to the native window for an image display.
*
* This procedure returns a handle to the native window for a given
2023-10-30 23:55:30 +01:00
* image display.
* It can be different types of data depending on the platform you are
* running on. For example in the X backend of GDK, a native window
* handle is an Xlib XID whereas on Wayland, it is a string handle. A
* value of NULL is returned for an invalid display or if this function
* is unimplemented for the windowing system that is being used.
2023-09-26 00:35:21 +02:00
*
2023-10-30 23:55:30 +01:00
* Returns: (transfer full): The native window handle or NULL.
2023-09-26 00:35:21 +02:00
*
* Since: 2.4
**/
2023-10-30 23:55:30 +01:00
GBytes *
2023-09-26 00:35:21 +02:00
pika_display_get_window_handle (PikaDisplay *display)
{
PikaValueArray *args;
PikaValueArray *return_vals;
2023-10-30 23:55:30 +01:00
GBytes *handle = NULL;
2023-09-26 00:35:21 +02:00
args = pika_value_array_new_from_types (NULL,
PIKA_TYPE_DISPLAY, display,
G_TYPE_NONE);
2023-10-30 23:55:30 +01:00
return_vals = _pika_pdb_run_procedure_array (pika_get_pdb (),
"pika-display-get-window-handle",
args);
2023-09-26 00:35:21 +02:00
pika_value_array_unref (args);
if (PIKA_VALUES_GET_ENUM (return_vals, 0) == PIKA_PDB_SUCCESS)
2023-10-30 23:55:30 +01:00
handle = PIKA_VALUES_DUP_BYTES (return_vals, 1);
2023-09-26 00:35:21 +02:00
pika_value_array_unref (return_vals);
2023-10-30 23:55:30 +01:00
return handle;
2023-09-26 00:35:21 +02:00
}
/**
* pika_display_present:
* @display: The display to present.
*
* Present the specified display.
*
* This procedure presents the specified display at the top of the
* display stack.
*
* Returns: TRUE on success.
*
* Since: 3.0
**/
gboolean
pika_display_present (PikaDisplay *display)
{
PikaValueArray *args;
PikaValueArray *return_vals;
gboolean success = TRUE;
args = pika_value_array_new_from_types (NULL,
PIKA_TYPE_DISPLAY, display,
G_TYPE_NONE);
2023-10-30 23:55:30 +01:00
return_vals = _pika_pdb_run_procedure_array (pika_get_pdb (),
"pika-display-present",
args);
2023-09-26 00:35:21 +02:00
pika_value_array_unref (args);
success = PIKA_VALUES_GET_ENUM (return_vals, 0) == PIKA_PDB_SUCCESS;
pika_value_array_unref (return_vals);
return success;
}
/**
* pika_displays_flush:
*
* Flush all internal changes to the user interface
*
* This procedure takes no arguments and returns nothing except a
* success status. Its purpose is to flush all pending updates of image
* manipulations to the user interface. It should be called whenever
* appropriate.
*
* Returns: TRUE on success.
**/
gboolean
pika_displays_flush (void)
{
PikaValueArray *args;
PikaValueArray *return_vals;
gboolean success = TRUE;
args = pika_value_array_new_from_types (NULL,
G_TYPE_NONE);
2023-10-30 23:55:30 +01:00
return_vals = _pika_pdb_run_procedure_array (pika_get_pdb (),
"pika-displays-flush",
args);
2023-09-26 00:35:21 +02:00
pika_value_array_unref (args);
success = PIKA_VALUES_GET_ENUM (return_vals, 0) == PIKA_PDB_SUCCESS;
pika_value_array_unref (return_vals);
return success;
}
/**
* pika_displays_reconnect:
* @old_image: The old image (must have at least one display).
* @new_image: The new image (must not have a display).
*
* Reconnect displays from one image to another image.
*
* This procedure connects all displays of the old_image to the
* new_image. If the old_image has no display or new_image already has
* a display the reconnect is not performed and the procedure returns
* without success. You should rarely need to use this function.
*
* Returns: TRUE on success.
**/
gboolean
pika_displays_reconnect (PikaImage *old_image,
PikaImage *new_image)
{
PikaValueArray *args;
PikaValueArray *return_vals;
gboolean success = TRUE;
args = pika_value_array_new_from_types (NULL,
PIKA_TYPE_IMAGE, old_image,
PIKA_TYPE_IMAGE, new_image,
G_TYPE_NONE);
2023-10-30 23:55:30 +01:00
return_vals = _pika_pdb_run_procedure_array (pika_get_pdb (),
"pika-displays-reconnect",
args);
2023-09-26 00:35:21 +02:00
pika_value_array_unref (args);
success = PIKA_VALUES_GET_ENUM (return_vals, 0) == PIKA_PDB_SUCCESS;
pika_value_array_unref (return_vals);
return success;
}