/* 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 __PROPGUI_TYPES_H__
#define __PROPGUI_TYPES_H__


#include "display/display-enums.h"

#include "widgets/widgets-types.h"


/*  enums, move to propgui-enums.h if we get more  */

typedef enum
{
  PIKA_CONTROLLER_TYPE_LINE,
  PIKA_CONTROLLER_TYPE_SLIDER_LINE,
  PIKA_CONTROLLER_TYPE_TRANSFORM_GRID,
  PIKA_CONTROLLER_TYPE_TRANSFORM_GRIDS,
  PIKA_CONTROLLER_TYPE_GYROSCOPE,
  PIKA_CONTROLLER_TYPE_FOCUS
} PikaControllerType;


/*  structs  */

typedef struct
{
  gdouble        value;           /*  slider value                           */
  gdouble        min;             /*  minimal allowable slider value         */
  gdouble        max;             /*  maximal allowable slider value         */

  gboolean       visible    : 1;  /*  slider is visible                      */
  gboolean       selectable : 1;  /*  slider is selectable                   */
  gboolean       movable    : 1;  /*  slider movable                         */
  gboolean       removable  : 1;  /*  slider is removable                    */

  gboolean       autohide   : 1;  /*  whether to autohide the slider         */
  PikaHandleType type;            /*  slider handle type                     */
  gdouble        size;            /*  slider handle size, as a fraction of   *
                                   *  the default size                       */

  gpointer       data;            /*  user data                              */
} PikaControllerSlider;

#define PIKA_CONTROLLER_SLIDER_DEFAULT                                         \
  ((const PikaControllerSlider) {                                              \
    .value      = 0.0,                                                         \
    .min        = 0.0,                                                         \
    .max        = 1.0,                                                         \
                                                                               \
    .visible    = TRUE,                                                        \
    .selectable = TRUE,                                                        \
    .movable    = TRUE,                                                        \
    .removable  = FALSE,                                                       \
                                                                               \
    .autohide   = FALSE,                                                       \
    .type       = PIKA_HANDLE_FILLED_DIAMOND,                                  \
    .size       = 1.0,                                                         \
                                                                               \
    .data       = NULL                                                         \
  })


/*  function types  */

typedef void (* PikaPickerCallback)                   (gpointer                    data,
                                                       gpointer                    identifier,
                                                       gdouble                     x,
                                                       gdouble                     y,
                                                       const Babl                 *sample_format,
                                                       const PikaRGB              *color);

typedef void (* PikaControllerLineCallback)           (gpointer                    data,
                                                       GeglRectangle              *area,
                                                       gdouble                     x1,
                                                       gdouble                     y1,
                                                       gdouble                     x2,
                                                       gdouble                     y2);
typedef void (* PikaControllerSliderLineCallback)     (gpointer                    data,
                                                       GeglRectangle              *area,
                                                       gdouble                     x1,
                                                       gdouble                     y1,
                                                       gdouble                     x2,
                                                       gdouble                     y2,
                                                       const PikaControllerSlider *sliders,
                                                       gint                        n_sliders);
typedef void (* PikaControllerTransformGridCallback)  (gpointer                    data,
                                                       GeglRectangle              *area,
                                                       const PikaMatrix3          *transform);
typedef void (* PikaControllerTransformGridsCallback) (gpointer                    data,
                                                       GeglRectangle              *area,
                                                       const PikaMatrix3          *transforms,
                                                       gint                        n_transforms);
typedef void (* PikaControllerGyroscopeCallback)      (gpointer                    data,
                                                       GeglRectangle              *area,
                                                       gdouble                     yaw,
                                                       gdouble                     pitch,
                                                       gdouble                     roll,
                                                       gdouble                     zoom,
                                                       gboolean                    invert);
typedef void (* PikaControllerFocusCallback)          (gpointer                    data,
                                                       GeglRectangle              *area,
                                                       PikaLimitType               type,
                                                       gdouble                     x,
                                                       gdouble                     y,
                                                       gdouble                     radius,
                                                       gdouble                     aspect_ratio,
                                                       gdouble                     angle,
                                                       gdouble                     inner_limit,
                                                       gdouble                     midpoint);


typedef GtkWidget * (* PikaCreatePickerFunc)          (gpointer                    creator,
                                                       const gchar                *property_name,
                                                       const gchar                *icon_name,
                                                       const gchar                *tooltip,
                                                       gboolean                    pick_abyss,
                                                       PikaPickerCallback          callback,
                                                       gpointer                    callback_data);

typedef GCallback   (* PikaCreateControllerFunc)      (gpointer                    creator,
                                                       PikaControllerType          controller_type,
                                                       const gchar                *status_title,
                                                       GCallback                   callback,
                                                       gpointer                    callback_data,
                                                       gpointer                   *set_func_data);


#endif /* __PROPGUI_TYPES_H__ */
