/*
 *  $Id: app-data-window.c 30131 2026-06-25 07:59:03Z yeti-dn $
 *  Copyright (C) 2026 David Nečas (Yeti).
 *  E-mail: yeti@gwyddion.net.
 *
 *  This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public
 *  License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any
 *  later version.
 *
 *  This program 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 General Public License for more
 *  details.
 *
 *  You should have received a copy of the GNU General Public License along with this program; if not, write to the
 *  Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 */

#include "config.h"
#include <string.h>
#include <gtk/gtk.h>

#include "libgwyapp/app-data-window.h"

G_DEFINE_INTERFACE(GwyAppDataWindow, gwy_app_data_window, GTK_TYPE_WINDOW);

static void
gwy_app_data_window_default_init(G_GNUC_UNUSED GwyAppDataWindowInterface *iface)
{
}

/**
 * gwy_app_data_window_get_file:
 * @window: A window showing some data.
 *
 * Gets the file containing the data displayed in a window.
 *
 * Returns: (transfer none): The file data container.
 **/
GwyFile*
gwy_app_data_window_get_file(GwyAppDataWindow *window)
{
    GwyAppDataWindowInterface *iface = GWY_APP_DATA_WINDOW_GET_INTERFACE(window);
    g_return_val_if_fail(iface && iface->get_file, NULL);

    return iface->get_file(window);
}

/**
 * gwy_app_data_window_get_data_kind:
 * @window: A window showing some data.
 *
 * Gets the kind of data displayed in a window.
 *
 * Returns: The data kind.
 **/
GwyDataKind
gwy_app_data_window_get_data_kind(GwyAppDataWindow *window)
{
    GwyAppDataWindowInterface *iface = GWY_APP_DATA_WINDOW_GET_INTERFACE(window);
    g_return_val_if_fail(iface && iface->get_data_kind, GWY_FILE_NONE);

    return iface->get_data_kind(window);
}

/**
 * gwy_app_data_window_get_id:
 * @window: A window showing some data.
 *
 * Gets the numerical id of data item displayed in a window.
 *
 * Returns: The numerical id in the file.
 **/
gint
gwy_app_data_window_get_id(GwyAppDataWindow *window)
{
    GwyAppDataWindowInterface *iface = GWY_APP_DATA_WINDOW_GET_INTERFACE(window);
    g_return_val_if_fail(iface && iface->get_id, -1);

    return iface->get_id(window);
}

/**
 * gwy_app_data_window_get_accel_root:
 * @window: A window showing some data.
 *
 * Gets root of accelerator map entries for a window displaying some data.
 *
 * The returned string is the "&lt;WINDOWTYPE&gt;" part of the accelerator path for the particular window, which GTK+
 * defines as a unique application-specific identifier that corresponds to the kind of window the accelerator is being
 * used in. Many data windows of the same kind can exist simultaneously and they all have the same prefix, for example
 * all volume data windows have the prefix "&lt;volume&gt;".
 *
 * Returns: The accelerator map root.
 **/
const gchar*
gwy_app_data_window_get_accel_root(GwyAppDataWindow *window)
{
    GwyAppDataWindowInterface *iface = GWY_APP_DATA_WINDOW_GET_INTERFACE(window);
    g_return_val_if_fail(iface && iface->get_id, "<NONE>");

    return iface->get_accel_root(window);
}

/**
 * SECTION: app-data-window
 * @title: GwyAppDataWindow
 * @short_description: Common interface of windows for different data kinds
 *
 * #GwyAppDataWindow is an abstract interface provided by application-level windows showing various data objects, such
 * as #GwyAppImageWindow and #GwyAppGraphWindow.
 **/

/**
 * GwyAppDataWindow:
 *
 * Formal type of application data windows.
 **/

/**
 * GWY_APP_DATA_WINDOW_GET_INTERFACE:
 * @obj: An object.
 *
 * Gets the application data window interface for an object implementing this interface.
 *
 * You can use the interface to call the interface's methods for the object. However, all are available as
 * gwy_app_data_window_get_data_kind() and similar function.
 **/

/* vim: set cin columns=120 tw=118 et ts=4 sw=4 cino=>1s,e0,n0,f0,{0,}0,^0,\:1s,=0,g1s,h0,t0,+1s,c3,(0,u0 : */
