gimpwidgets.h 12.8 KB
Newer Older
1 2
/* LIBGIMP - The GIMP Library
 * Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball
3 4 5 6 7 8 9
 *
 * gimpwidgets.h
 * Copyright (C) 2000 Michael Natterer <mitch@gimp.org>
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
10 11 12 13 14
 * version 2 of the License, or (at your option) any later version.
 *
 * 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
15 16 17 18 19 20 21
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the
 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 * Boston, MA 02111-1307, USA.
 */
22

23 24 25
#ifndef __GIMP_WIDGETS_H__
#define __GIMP_WIDGETS_H__

26 27 28

#include <libgimpwidgets/gimpwidgetstypes.h>

29
#include <libgimpwidgets/gimpbutton.h>
30 31 32
#include <libgimpwidgets/gimpchainbutton.h>
#include <libgimpwidgets/gimpcolorarea.h>
#include <libgimpwidgets/gimpcolorbutton.h>
33
#include <libgimpwidgets/gimpcolordisplay.h>
34
#include <libgimpwidgets/gimpcolordisplaystack.h>
35
#include <libgimpwidgets/gimpcolornotebook.h>
36
#include <libgimpwidgets/gimpcolorscale.h>
37
#include <libgimpwidgets/gimpcolorscales.h>
38 39
#include <libgimpwidgets/gimpcolorselector.h>
#include <libgimpwidgets/gimpcolorselect.h>
40
#include <libgimpwidgets/gimpcolorselection.h>
41
#include <libgimpwidgets/gimpdialog.h>
Michael Natterer's avatar
Michael Natterer committed
42
#include <libgimpwidgets/gimpfileentry.h>
43
#include <libgimpwidgets/gimphelpui.h>
44
#include <libgimpwidgets/gimpmemsizeentry.h>
45
#include <libgimpwidgets/gimpoffsetarea.h>
46
#include <libgimpwidgets/gimppatheditor.h>
47
#include <libgimpwidgets/gimppickbutton.h>
48 49 50
#include <libgimpwidgets/gimppixmap.h>
#include <libgimpwidgets/gimpquerybox.h>
#include <libgimpwidgets/gimpsizeentry.h>
51
#include <libgimpwidgets/gimpstock.h>
52 53 54
#include <libgimpwidgets/gimpunitmenu.h>


55
G_BEGIN_DECLS
56

57 58
/* For information look into the C source or the html documentation */

59

60 61 62 63
/*
 *  Widget Constructors
 */

64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79
GtkWidget * gimp_int_option_menu_new        (gboolean        menu_only,
                                             GCallback       menu_item_callback,
                                             gpointer        menu_item_callback_data,
                                             gint            initial, /* item_data */

				            /* specify menu items as va_list:
                                             *  gchar       *label,
                                             *  gint         item_data,
                                             *  GtkWidget  **widget_ptr,
                                             */

                                             ...);

void        gimp_int_option_menu_set_history (GtkOptionMenu *option_menu,
                                              gint           item_data);

80 81 82 83 84 85 86
typedef gboolean (*GimpIntOptionMenuSensitivityCallback) (gint     item_data,
                                                          gpointer callback_data);
void  gimp_int_option_menu_set_sensitive (GtkOptionMenu    *option_menu,
                                          GimpIntOptionMenuSensitivityCallback callback,
                                          gpointer          callback_data);


87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111
GtkWidget * gimp_option_menu_new     (gboolean         menu_only,

                                      /* specify menu items as va_list:
                                       *  gchar       *label,
                                       *  GCallback    callback,
                                       *  gpointer     callback_data,
                                       *  gpointer     item_data,
                                       *  GtkWidget  **widget_ptr,
                                       *  gboolean     active
                                       */

                                      ...);
GtkWidget * gimp_option_menu_new2    (gboolean          menu_only,
                                      GCallback         menu_item_callback,
                                      gpointer          menu_item_callback_data,
                                      gpointer          initial, /* item_data */

                                      /* specify menu items as va_list:
                                       *  gchar        *label,
                                       *  gpointer      item_data,
                                       *  GtkWidget   **widget_ptr,
                                       */
                                      ...);
void  gimp_option_menu_set_history   (GtkOptionMenu    *option_menu,
                                      gpointer          item_data);
112

113

114 115
typedef gboolean (*GimpOptionMenuSensitivityCallback) (gpointer item_data,
                                                       gpointer callback_data);
116

117 118 119
void  gimp_option_menu_set_sensitive (GtkOptionMenu    *option_menu,
                                      GimpOptionMenuSensitivityCallback callback,
                                      gpointer          callback_data);
120 121


122 123 124 125 126
GtkWidget * gimp_int_radio_group_new (gboolean          in_frame,
				      const gchar      *frame_title,
				      GCallback         radio_button_callback,
				      gpointer          radio_button_callback_data,
				      gint              initial, /* item_data */
127

128 129 130 131
				      /* specify radio buttons as va_list:
				       *  const gchar  *label,
				       *  gint          item_data,
				       *  GtkWidget   **widget_ptr,
132 133 134 135
				       */

				      ...);

136 137 138
void        gimp_int_radio_group_set_active (GtkRadioButton *radio_button,
                                             gint            item_data);

139

140
GtkWidget * gimp_radio_group_new   (gboolean            in_frame,
141
				    const gchar        *frame_title,
142 143

				    /* specify radio buttons as va_list:
144
				     *  const gchar    *label,
145
				     *  GCallback       callback,
146 147
				     *  gpointer        callback_data,
				     *  gpointer        item_data,
148 149 150 151 152 153
				     *  GtkWidget     **widget_ptr,
				     *  gboolean        active,
				     */

				    ...);
GtkWidget * gimp_radio_group_new2  (gboolean            in_frame,
154
				    const gchar        *frame_title,
155
				    GCallback           radio_button_callback,
156 157
				    gpointer            radio_button_callback_data,
				    gpointer            initial, /* item_data */
158 159

				    /* specify radio buttons as va_list:
160
				     *  const gchar    *label,
161
				     *  gpointer        item_data,
162 163 164 165
				     *  GtkWidget     **widget_ptr,
				     */

				    ...);
166

167 168
void   gimp_radio_group_set_active (GtkRadioButton     *radio_button,
                                    gpointer            item_data);
169

170

171 172 173
GtkWidget * gimp_spin_button_new   (/* return value: */
				    GtkObject         **adjustment,

174 175 176 177 178 179 180
				    gdouble             value,
				    gdouble             lower,
				    gdouble             upper,
				    gdouble             step_increment,
				    gdouble             page_increment,
				    gdouble             page_size,
				    gdouble             climb_rate,
181 182
				    guint               digits);

183
#define GIMP_SCALE_ENTRY_LABEL(adj) \
184
        (g_object_get_data (G_OBJECT (adj), "label"))
185 186

#define GIMP_SCALE_ENTRY_SCALE(adj) \
187
        (g_object_get_data (G_OBJECT (adj), "scale"))
188 189
#define GIMP_SCALE_ENTRY_SCALE_ADJ(adj) \
        gtk_range_get_adjustment \
190
        (GTK_RANGE (g_object_get_data (G_OBJECT (adj), "scale")))
191 192

#define GIMP_SCALE_ENTRY_SPINBUTTON(adj) \
193
        (g_object_get_data (G_OBJECT (adj), "spinbutton"))
194 195
#define GIMP_SCALE_ENTRY_SPINBUTTON_ADJ(adj) \
        gtk_spin_button_get_adjustment \
196
        (GTK_SPIN_BUTTON (g_object_get_data (G_OBJECT (adj), "spinbutton")))
197

198 199 200 201 202 203
GtkObject * gimp_scale_entry_new       (GtkTable           *table,
                                        gint                column,
                                        gint                row,
                                        const gchar        *text,
                                        gint                scale_width,
                                        gint                spinbutton_width,
204 205 206 207 208
                                        gdouble             value,
                                        gdouble             lower,
                                        gdouble             upper,
                                        gdouble             step_increment,
                                        gdouble             page_increment,
209 210
                                        guint               digits,
                                        gboolean            constrain,
211 212
                                        gdouble             unconstrained_lower,
                                        gdouble             unconstrained_upper,
213
                                        const gchar        *tooltip,
214
                                        const gchar        *help_id);
215 216 217 218 219 220 221

GtkObject * gimp_color_scale_entry_new (GtkTable           *table,
                                        gint                column,
                                        gint                row,
                                        const gchar        *text,
                                        gint                scale_width,
                                        gint                spinbutton_width,
222 223 224 225 226
                                        gdouble             value,
                                        gdouble             lower,
                                        gdouble             upper,
                                        gdouble             step_increment,
                                        gdouble             page_increment,
227 228
                                        guint               digits,
                                        const gchar        *tooltip,
229
                                        const gchar        *help_id);
230 231 232

void    gimp_scale_entry_set_sensitive (GtkObject          *adjustment,
                                        gboolean            sensitive);
233 234


235
#define GIMP_RANDOM_SEED_SPINBUTTON(hbox) \
236
        (g_object_get_data (G_OBJECT (hbox), "spinbutton"))
237 238
#define GIMP_RANDOM_SEED_SPINBUTTON_ADJ(hbox) \
        gtk_spin_button_get_adjustment \
239
        (GTK_SPIN_BUTTON (g_object_get_data (G_OBJECT (hbox), "spinbutton")))
240 241
#define GIMP_RANDOM_SEED_TOGGLE(hbox) \
        (g_object_get_data (G_OBJECT(hbox), "toggle"))
242

243
GtkWidget * gimp_random_seed_new   (guint32            *seed,
244
				    gboolean           *random_seed);
245

246
#define GIMP_COORDINATES_CHAINBUTTON(sizeentry) \
247
        (g_object_get_data (G_OBJECT (sizeentry), "chainbutton"))
248

249
GtkWidget * gimp_coordinates_new   (GimpUnit            unit,
250
				    const gchar        *unit_format,
251 252
				    gboolean            menu_show_pixels,
				    gboolean            menu_show_percent,
253
				    gint                spinbutton_width,
254
				    GimpSizeEntryUpdatePolicy  update_policy,
255

256 257 258
				    gboolean            chainbutton_active,
				    gboolean            chain_constrains_ratio,

259
				    const gchar        *xlabel,
260 261
				    gdouble             x,
				    gdouble             xres,
262 263 264 265
				    gdouble             lower_boundary_x,
				    gdouble             upper_boundary_x,
				    gdouble             xsize_0,   /* % */
				    gdouble             xsize_100, /* % */
266

267
				    const gchar        *ylabel,
268 269
				    gdouble             y,
				    gdouble             yres,
270 271 272 273
				    gdouble             lower_boundary_y,
				    gdouble             upper_boundary_y,
				    gdouble             ysize_0,   /* % */
				    gdouble             ysize_100  /* % */);
274

Sven Neumann's avatar
Sven Neumann committed
275 276

GtkWidget * gimp_pixmap_button_new  (gchar             **xpm_data,
277
				     const gchar        *text);
278

279 280 281 282
/*
 *  Standard Callbacks
 */

283 284 285 286
void gimp_toggle_button_sensitive_update (GtkToggleButton *toggle_button);

void gimp_toggle_button_update           (GtkWidget       *widget,
					  gpointer         data);
287

288 289
void gimp_radio_button_update            (GtkWidget       *widget,
					  gpointer         data);
290

291 292
void gimp_menu_item_update               (GtkWidget       *widget,
					  gpointer         data);
293

294 295
void gimp_int_adjustment_update          (GtkAdjustment   *adjustment,
					  gpointer         data);
296

297 298 299
void gimp_uint_adjustment_update         (GtkAdjustment   *adjustment,
					  gpointer         data);

300 301
void gimp_float_adjustment_update        (GtkAdjustment   *adjustment,
					  gpointer         data);
302

303 304
void gimp_double_adjustment_update       (GtkAdjustment   *adjustment,
					  gpointer         data);
305

306 307
void gimp_unit_menu_update               (GtkWidget       *widget,
					  gpointer         data);
Michael Natterer's avatar
Michael Natterer committed
308

309

310 311 312 313
/*
 *  Helper Functions
 */

314 315 316 317 318 319 320 321 322
GtkWidget * gimp_table_attach_aligned    (GtkTable        *table,
					  gint             column,
					  gint             row,
					  const gchar     *label_text,
					  gfloat           xalign,
					  gfloat           yalign,
					  GtkWidget       *widget,
					  gint             colspan,
					  gboolean         left_align);
323

324

325
G_END_DECLS
326 327

#endif /* __GIMP_WIDGETS_H__ */