talons

Fork of Claws Mail https://www.claws-mail
Log | Files | Refs | README | LICENSE

gtkunit.h (6103B)


      1 /* LIBGTK - The GTK Library
      2  * Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball
      3  *
      4  * gimpunit.h
      5  * Copyright (C) 1999-2003 Michael Natterer <mitch@gimp.org>
      6  *
      7  * This library is free software: you can redistribute it and/or
      8  * modify it under the terms of the GNU Lesser General Public
      9  * License as published by the Free Software Foundation; either
     10  * version 3 of the License, or (at your option) any later version.
     11  *
     12  * This library is distributed in the hope that it will be useful,
     13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
     14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
     15  * Lesser General Public License for more details.
     16  *
     17  * You should have received a copy of the GNU Lesser General Public
     18  * License along with this library.  If not, see
     19  * <http://www.gnu.org/licenses/>.
     20  */
     21 
     22 #ifndef __CM_UNIT_H__
     23 #define __CM_UNIT_H__
     24 
     25 #include <glib-object.h>
     26 
     27 typedef enum /*< skip >*/
     28 {
     29   CM_UNIT_PIXEL   = 0,
     30 
     31   CM_UNIT_INCH    = 1,
     32   CM_UNIT_MM      = 2,
     33   CM_UNIT_POINT   = 3,
     34   CM_UNIT_PICA    = 4,
     35 
     36   CM_UNIT_END     = 5,
     37 
     38   CM_UNIT_PERCENT = 65536 /*< pdb-skip >*/
     39 } GtkCMUnit;
     40 
     41 typedef struct _GtkCMUnitVtable GtkCMUnitVtable;
     42 
     43 struct _GtkCMUnitVtable
     44 {
     45   gint          (* unit_get_number_of_units)          (void);
     46   gint          (* unit_get_number_of_built_in_units) (void);
     47 
     48   GtkCMUnit       (* unit_new)                          (gchar    *identifier,
     49                                                        gdouble   factor,
     50                                                        gint      digits,
     51                                                        gchar    *symbol,
     52                                                        gchar    *abbreviation,
     53                                                        gchar    *singular,
     54                                                        gchar    *plural);
     55   gboolean      (* unit_get_deletion_flag)            (GtkCMUnit  unit);
     56   void          (* unit_set_deletion_flag)            (GtkCMUnit  unit,
     57                                                        gboolean  deletion_flag);
     58 
     59   gdouble       (* unit_get_factor)                   (GtkCMUnit  unit);
     60   gint          (* unit_get_digits)                   (GtkCMUnit  unit);
     61   const gchar * (* unit_get_identifier)               (GtkCMUnit  unit);
     62   const gchar * (* unit_get_symbol)                   (GtkCMUnit  unit);
     63   const gchar * (* unit_get_abbreviation)             (GtkCMUnit  unit);
     64   const gchar * (* unit_get_singular)                 (GtkCMUnit  unit);
     65   const gchar * (* unit_get_plural)                   (GtkCMUnit  unit);
     66 
     67   void          (* _reserved_1)                       (void);
     68   void          (* _reserved_2)                       (void);
     69   void          (* _reserved_3)                       (void);
     70   void          (* _reserved_4)                       (void);
     71 };
     72 
     73 
     74 extern GtkCMUnitVtable _gimp_unit_vtable;
     75 
     76 
     77 G_BEGIN_DECLS
     78 
     79 void  gimp_base_init (GtkCMUnitVtable *vtable);
     80 
     81 
     82 /* For information look into the C source or the html documentation */
     83 
     84 /**
     85  * GTK_TYPE_UNIT:
     86  *
     87  * #GTK_TYPE_UNIT is a #GType derived from #G_TYPE_INT.
     88  **/
     89 
     90 #define GTK_TYPE_UNIT               (gtk_unit_get_type ())
     91 #define GTK_VALUE_HOLDS_UNIT(value) (G_TYPE_CHECK_VALUE_TYPE ((value), GTK_TYPE_UNIT))
     92 
     93 
     94 GType        gtk_unit_get_type      (void) G_GNUC_CONST;
     95 
     96 
     97 /*
     98  * GTK_TYPE_PARAM_UNIT
     99  */
    100 
    101 #define GTK_TYPE_PARAM_UNIT              (gtk_param_unit_get_type ())
    102 #define GTK_IS_PARAM_SPEC_UNIT(pspec)    (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), GTK_TYPE_PARAM_UNIT))
    103 
    104 GType        gtk_param_unit_get_type     (void) G_GNUC_CONST;
    105 
    106 GParamSpec * gtk_param_spec_unit         (const gchar  *name,
    107                                           const gchar  *nick,
    108                                           const gchar  *blurb,
    109                                           gboolean      allow_pixels,
    110                                           gboolean      allow_percent,
    111                                           GtkCMUnit      default_value,
    112                                           GParamFlags   flags);
    113 
    114 
    115 
    116 gint          gtk_unit_get_number_of_units          (void);
    117 gint          gtk_unit_get_number_of_built_in_units (void) G_GNUC_CONST;
    118 
    119 GtkCMUnit       gtk_unit_new                 (gchar       *identifier,
    120                                             gdouble      factor,
    121                                             gint         digits,
    122                                             gchar       *symbol,
    123                                             gchar       *abbreviation,
    124                                             gchar       *singular,
    125                                             gchar       *plural);
    126 
    127 gboolean      gtk_unit_get_deletion_flag   (GtkCMUnit     unit);
    128 void          gtk_unit_set_deletion_flag   (GtkCMUnit     unit,
    129                                             gboolean     deletion_flag);
    130 
    131 gdouble       gtk_unit_get_factor          (GtkCMUnit     unit);
    132 
    133 gint          gtk_unit_get_digits          (GtkCMUnit     unit);
    134 
    135 const gchar * gtk_unit_get_identifier      (GtkCMUnit     unit);
    136 
    137 const gchar * gtk_unit_get_symbol          (GtkCMUnit     unit);
    138 const gchar * gtk_unit_get_abbreviation    (GtkCMUnit     unit);
    139 const gchar * gtk_unit_get_singular        (GtkCMUnit     unit);
    140 const gchar * gtk_unit_get_plural          (GtkCMUnit     unit);
    141 
    142 gchar       * gtk_unit_format_string       (const gchar *format,
    143                                             GtkCMUnit     unit);
    144 
    145 gdouble       gtk_pixels_to_units          (gdouble      pixels,
    146                                             GtkCMUnit     unit,
    147                                             gdouble      resolution);
    148 gdouble       gtk_units_to_pixels          (gdouble      value,
    149                                             GtkCMUnit     unit,
    150                                             gdouble      resolution);
    151 gdouble       gtk_units_to_points          (gdouble      value,
    152                                             GtkCMUnit     unit,
    153                                             gdouble      resolution);
    154 
    155 
    156 G_END_DECLS
    157 
    158 #endif /* __CM_UNIT_H__ */