/* PIKA - Photo and Image Kooker Application
 * a rebranding of The GNU Image Manipulation Program (created with heckimp)
 * A derived work which may be trivial. However, any changes may be (C)2023 by Aldercone Studio
 *
 * Original copyright, applying to most contents (license remains unchanged): 
 * Copyright (C) 1995 Spencer Kimball and Peter Mattis
 *
 * 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 3 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, see <https://www.gnu.org/licenses/>.
 */

#ifndef __PIKA_DEVICE_INFO_H__
#define __PIKA_DEVICE_INFO_H__


#include "core/pikatoolpreset.h"


G_BEGIN_DECLS


typedef struct _PikaDeviceKey PikaDeviceKey;

struct _PikaDeviceKey
{
  guint           keyval;
  GdkModifierType modifiers;
};


#define PIKA_TYPE_DEVICE_INFO            (pika_device_info_get_type ())
#define PIKA_DEVICE_INFO(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), PIKA_TYPE_DEVICE_INFO, PikaDeviceInfo))
#define PIKA_DEVICE_INFO_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), PIKA_TYPE_DEVICE_INFO, PikaDeviceInfoClass))
#define PIKA_IS_DEVICE_INFO(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), PIKA_TYPE_DEVICE_INFO))
#define PIKA_IS_DEVICE_INFO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PIKA_TYPE_DEVICE_INFO))
#define PIKA_DEVICE_INFO_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), PIKA_TYPE_DEVICE_INFO, PikaDeviceInfoClass))


typedef struct _PikaDeviceInfoPrivate PikaDeviceInfoPrivate;
typedef struct _PikaDeviceInfoClass   PikaDeviceInfoClass;

struct _PikaDeviceInfo
{
  PikaToolPreset  parent_instance;

  PikaDeviceInfoPrivate *priv;
};

struct _PikaDeviceInfoClass
{
  PikaToolPresetClass  parent_class;
};


GType             pika_device_info_get_type             (void) G_GNUC_CONST;

PikaDeviceInfo  * pika_device_info_new                  (Pika            *pika,
                                                         GdkDevice       *device,
                                                         GdkDisplay      *display);

GdkDevice       * pika_device_info_get_device           (PikaDeviceInfo  *info,
                                                         GdkDisplay     **display);
gboolean          pika_device_info_set_device           (PikaDeviceInfo  *info,
                                                         GdkDevice       *device,
                                                         GdkDisplay      *display);

void              pika_device_info_set_default_tool     (PikaDeviceInfo  *info);

void              pika_device_info_save_tool            (PikaDeviceInfo  *info);
void              pika_device_info_restore_tool         (PikaDeviceInfo  *info);

GdkInputMode      pika_device_info_get_mode             (PikaDeviceInfo  *info);
void              pika_device_info_set_mode             (PikaDeviceInfo  *info,
                                                         GdkInputMode     mode);

gboolean          pika_device_info_has_cursor           (PikaDeviceInfo  *info);

GdkInputSource    pika_device_info_get_source           (PikaDeviceInfo  *info);

const gchar     * pika_device_info_get_vendor_id        (PikaDeviceInfo  *info);
const gchar     * pika_device_info_get_product_id       (PikaDeviceInfo  *info);

GdkDeviceToolType pika_device_info_get_tool_type        (PikaDeviceInfo  *info);
guint64           pika_device_info_get_tool_serial      (PikaDeviceInfo  *info);
guint64           pika_device_info_get_tool_hardware_id (PikaDeviceInfo  *info);

gint             pika_device_info_get_n_axes            (PikaDeviceInfo  *info);
gboolean         pika_device_info_ignore_axis           (PikaDeviceInfo  *info,
                                                         gint             axis);
const gchar    * pika_device_info_get_axis_name         (PikaDeviceInfo  *info,
                                                         gint             axis);
GdkAxisUse       pika_device_info_get_axis_use          (PikaDeviceInfo  *info,
                                                         gint             axis);
void             pika_device_info_set_axis_use          (PikaDeviceInfo  *info,
                                                         gint             axis,
                                                         GdkAxisUse       use);

gint             pika_device_info_get_n_keys            (PikaDeviceInfo  *info);
void             pika_device_info_get_key               (PikaDeviceInfo  *info,
                                                         gint             key,
                                                         guint           *keyval,
                                                         GdkModifierType *modifiers);
void             pika_device_info_set_key               (PikaDeviceInfo  *info,
                                                         gint             key,
                                                         guint            keyval,
                                                         GdkModifierType  modifiers);

PikaCurve      * pika_device_info_get_curve             (PikaDeviceInfo  *info,
                                                         GdkAxisUse       use);
gdouble          pika_device_info_map_axis              (PikaDeviceInfo  *info,
                                                         GdkAxisUse       use,
                                                         gdouble          value);

void             pika_device_info_changed               (PikaDeviceInfo  *info);

PikaDeviceInfo * pika_device_info_get_by_device         (GdkDevice       *device);

gint             pika_device_info_compare               (PikaDeviceInfo  *a,
                                                         PikaDeviceInfo  *b);


G_END_DECLS

#endif /* __PIKA_DEVICE_INFO_H__ */
