gimpsizeentry.h 7.07 KB
Newer Older
1 2
/* LIBGIMP - The GIMP Library
 * Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball
3 4 5
 *
 * gimpsizeentry.h
 * Copyright (C) 1999-2000 Sven Neumann <sven@gimp.org>
6
 *                         Michael Natterer <mitch@gimp.org>
7
 *
8
 * This library is free software: you can redistribute it and/or
Marc Lehmann's avatar
Marc Lehmann committed
9
 * modify it under the terms of the GNU Lesser General Public
10
 * License as published by the Free Software Foundation; either
11
 * version 3 of the License, or (at your option) any later version.
12 13 14 15
 *
 * 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
16
 * Lesser General Public License for more details.
17
 *
Marc Lehmann's avatar
Marc Lehmann committed
18
 * You should have received a copy of the GNU Lesser General Public
19
 * License along with this library.  If not, see
20
 * <https://www.gnu.org/licenses/>.
21
 */
22

23 24 25 26
#if !defined (__GIMP_WIDGETS_H_INSIDE__) && !defined (GIMP_WIDGETS_COMPILATION)
#error "Only <libgimpwidgets/gimpwidgets.h> can be included directly."
#endif

27 28
#ifndef __GIMP_SIZE_ENTRY_H__
#define __GIMP_SIZE_ENTRY_H__
29

30
G_BEGIN_DECLS
31

32 33 34
/* For information look into the C source or the html documentation */


35
#define GIMP_TYPE_SIZE_ENTRY            (gimp_size_entry_get_type ())
36 37 38 39
#define GIMP_SIZE_ENTRY(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_SIZE_ENTRY, GimpSizeEntry))
#define GIMP_SIZE_ENTRY_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_SIZE_ENTRY, GimpSizeEntryClass))
#define GIMP_IS_SIZE_ENTRY(obj)         (G_TYPE_CHECK_INSTANCE_TYPE (obj, GIMP_TYPE_SIZE_ENTRY))
#define GIMP_IS_SIZE_ENTRY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_SIZE_ENTRY))
40 41
#define GIMP_SIZE_ENTRY_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_SIZE_ENTRY, GimpSizeEntryClass))

42

43 44
typedef struct _GimpSizeEntryPrivate GimpSizeEntryPrivate;
typedef struct _GimpSizeEntryClass   GimpSizeEntryClass;
45

46 47
typedef struct _GimpSizeEntryField  GimpSizeEntryField;

48 49
struct _GimpSizeEntry
{
50
  GtkGrid               parent_instance;
51

52
  GimpSizeEntryPrivate *priv;
53 54 55 56
};

struct _GimpSizeEntryClass
{
57
  GtkGridClass  parent_class;
58

59 60 61
  void (* value_changed)  (GimpSizeEntry *gse);
  void (* refval_changed) (GimpSizeEntry *gse);
  void (* unit_changed)   (GimpSizeEntry *gse);
62 63 64 65 66 67

  /* Padding for future expansion */
  void (* _gimp_reserved1) (void);
  void (* _gimp_reserved2) (void);
  void (* _gimp_reserved3) (void);
  void (* _gimp_reserved4) (void);
68 69 70 71
  void (* _gimp_reserved5) (void);
  void (* _gimp_reserved6) (void);
  void (* _gimp_reserved7) (void);
  void (* _gimp_reserved8) (void);
72 73
};

74

75 76
/* For information look into the C source or the html documentation */

77
GType       gimp_size_entry_get_type (void) G_GNUC_CONST;
78 79

GtkWidget * gimp_size_entry_new (gint                       number_of_fields,
Sven Neumann's avatar
Sven Neumann committed
80 81 82 83 84 85 86
                                 GimpUnit                   unit,
                                 const gchar               *unit_format,
                                 gboolean                   menu_show_pixels,
                                 gboolean                   menu_show_percent,
                                 gboolean                   show_refval,
                                 gint                       spinbutton_width,
                                 GimpSizeEntryUpdatePolicy  update_policy);
87

88
void        gimp_size_entry_add_field  (GimpSizeEntry   *gse,
Sven Neumann's avatar
Sven Neumann committed
89 90
                                        GtkSpinButton   *value_spinbutton,
                                        GtkSpinButton   *refval_spinbutton);
91

92 93 94 95 96
GimpSizeEntryUpdatePolicy
            gimp_size_entry_get_update_policy     (GimpSizeEntry *gse);
gint        gimp_size_entry_get_n_fields          (GimpSizeEntry *gse);
GtkWidget * gimp_size_entry_get_unit_combo        (GimpSizeEntry *gse);

97
GtkWidget * gimp_size_entry_attach_label          (GimpSizeEntry *gse,
Sven Neumann's avatar
Sven Neumann committed
98 99 100 101
                                                   const gchar   *text,
                                                   gint           row,
                                                   gint           column,
                                                   gfloat         alignment);
102 103

void        gimp_size_entry_set_resolution        (GimpSizeEntry *gse,
Sven Neumann's avatar
Sven Neumann committed
104 105 106
                                                   gint           field,
                                                   gdouble        resolution,
                                                   gboolean       keep_size);
107

108
void        gimp_size_entry_set_size              (GimpSizeEntry *gse,
Sven Neumann's avatar
Sven Neumann committed
109 110 111
                                                   gint           field,
                                                   gdouble        lower,
                                                   gdouble        upper);
112

113
void        gimp_size_entry_set_value_boundaries  (GimpSizeEntry *gse,
Sven Neumann's avatar
Sven Neumann committed
114 115 116
                                                   gint           field,
                                                   gdouble        lower,
                                                   gdouble        upper);
117

118
gdouble     gimp_size_entry_get_value             (GimpSizeEntry *gse,
Sven Neumann's avatar
Sven Neumann committed
119
                                                   gint           field);
120
void        gimp_size_entry_set_value             (GimpSizeEntry *gse,
Sven Neumann's avatar
Sven Neumann committed
121 122
                                                   gint           field,
                                                   gdouble        value);
123 124

void        gimp_size_entry_set_refval_boundaries (GimpSizeEntry *gse,
Sven Neumann's avatar
Sven Neumann committed
125 126 127
                                                   gint           field,
                                                   gdouble        lower,
                                                   gdouble        upper);
128
void        gimp_size_entry_set_refval_digits     (GimpSizeEntry *gse,
Sven Neumann's avatar
Sven Neumann committed
129 130
                                                   gint           field,
                                                   gint           digits);
131

132
gdouble     gimp_size_entry_get_refval            (GimpSizeEntry *gse,
Sven Neumann's avatar
Sven Neumann committed
133
                                                   gint           field);
134
void        gimp_size_entry_set_refval            (GimpSizeEntry *gse,
Sven Neumann's avatar
Sven Neumann committed
135 136
                                                   gint           field,
                                                   gdouble        refval);
137

138
GimpUnit    gimp_size_entry_get_unit              (GimpSizeEntry *gse);
139
void        gimp_size_entry_set_unit              (GimpSizeEntry *gse,
Sven Neumann's avatar
Sven Neumann committed
140
                                                   GimpUnit       unit);
141 142
void        gimp_size_entry_show_unit_menu        (GimpSizeEntry *gse,
                                                   gboolean       show);
143

144 145 146
void        gimp_size_entry_set_pixel_digits      (GimpSizeEntry *gse,
                                                   gint           digits);

147
void        gimp_size_entry_grab_focus            (GimpSizeEntry *gse);
148 149
void        gimp_size_entry_set_activates_default (GimpSizeEntry *gse,
                                                   gboolean       setting);
150 151
GtkWidget * gimp_size_entry_get_help_widget       (GimpSizeEntry *gse,
                                                   gint           field);
152

153

154
G_END_DECLS
155

156
#endif /* __GIMP_SIZE_ENTRY_H__ */