gimp/libgimpwidgets/gimppropwidgets.h

238 lines
12 KiB
C
Raw Normal View History

/* LIBGIMP - The GIMP Library
* Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball
*
* gimppropwidgets.h
* Copyright (C) 2002 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
* version 3 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
* 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, see
* <https://www.gnu.org/licenses/>.
*/
#if !defined (__GIMP_WIDGETS_H_INSIDE__) && !defined (GIMP_WIDGETS_COMPILATION)
#error "Only <libgimpwidgets/gimpwidgets.h> can be included directly."
#endif
#ifndef __GIMP_PROP_WIDGETS_H__
#define __GIMP_PROP_WIDGETS_H__
G_BEGIN_DECLS
/* GParamBoolean */
GtkWidget * gimp_prop_check_button_new (GObject *config,
const gchar *property_name,
const gchar *label);
GtkWidget * gimp_prop_switch_new (GObject *config,
const gchar *property_name,
const gchar *label,
GtkWidget **label_out,
GtkWidget **switch_out);
GtkWidget * gimp_prop_boolean_combo_box_new (GObject *config,
const gchar *property_name,
const gchar *true_text,
const gchar *false_text);
GtkWidget * gimp_prop_boolean_radio_frame_new (GObject *config,
const gchar *property_name,
const gchar *title,
const gchar *true_text,
const gchar *false_text);
GtkWidget * gimp_prop_expander_new (GObject *config,
const gchar *property_name,
const gchar *label);
/* GParamInt */
GtkWidget * gimp_prop_int_combo_box_new (GObject *config,
const gchar *property_name,
GimpIntStore *store);
GtkWidget * gimp_prop_int_radio_frame_new (GObject *config,
const gchar *property_name,
const gchar *title,
GimpIntStore *store);
GtkWidget * gimp_prop_int_radio_box_new (GObject *config,
const gchar *property_name,
GimpIntStore *store);
/* GParamGType */
GtkWidget * gimp_prop_pointer_combo_box_new (GObject *config,
const gchar *property_name,
GimpIntStore *store);
/* GParamEnum */
GtkWidget * gimp_prop_enum_combo_box_new (GObject *config,
const gchar *property_name,
gint minimum,
gint maximum);
GtkWidget * gimp_prop_enum_check_button_new (GObject *config,
const gchar *property_name,
const gchar *label,
gint false_value,
gint true_value);
GtkWidget * gimp_prop_enum_radio_frame_new (GObject *config,
const gchar *property_name,
const gchar *title,
gint minimum,
gint maximum);
GtkWidget * gimp_prop_enum_radio_box_new (GObject *config,
const gchar *property_name,
gint minimum,
gint maximum);
GtkWidget * gimp_prop_enum_icon_box_new (GObject *config,
const gchar *property_name,
2017-06-04 03:22:12 +08:00
const gchar *icon_prefix,
gint minimum,
gint maximum);
GtkWidget * gimp_prop_enum_label_new (GObject *config,
const gchar *property_name);
/* GParamInt, GParamUInt, GParamLong, GParamULong, GParamDouble */
GtkWidget * gimp_prop_spin_button_new (GObject *config,
const gchar *property_name,
gdouble step_increment,
gdouble page_increment,
gint digits);
GtkWidget * gimp_prop_label_spin_new (GObject *config,
const gchar *property_name,
gint digits);
GtkWidget * gimp_prop_hscale_new (GObject *config,
const gchar *property_name,
gdouble step_increment,
gdouble page_increment,
gint digits);
libgimpwidgets: make GimpScaleEntry into its own widget. Instead of the gimp_scale_entry_new() which creates several bound yet independant widgets, and in the same time pack them into an existing grid and return a GtkAdjustment (while heavily relying on GObject data to link widgets), let's have a proper custom widget with its own clean API. This also simplifies the gimp_prop_scale_entry_new() property widget variant. First advantage is that we don't force the usage of a grid to use this widget (there are a few pieces of code which create a GtkGrid with only this inside just to be able to use this feature). Second thing is that I am creating a much simpler API. gimp_scale_entry_new() had 17 parameters! How crazy is that? So I removed all the grid packing related parameters. Also I moved the spin button/scale unconstraining parameters into their separate function, because the constrained behavior is the most common use case, so it's stupid to add 3 permanent dummy parameters for most calls. Instead the few times where we'll want different ranges for the spin button and the scale, we'll call the separate API gimp_scale_entry_set_range(). Thirdly the tooltip can be set directly with gimp_help_set_help_data() since this is now its own widget. No need to have dedicated logics anymore, better stay generic. Similarly no need of a custom function to switch sensitivitivy (instead of generic gtk_widget_set_sensitive()). Fourth thing is that we should not use macros for the public API, but proper functions, because macros are not properly introspected for binding. For future improvements, maybe we could even make this widget implement GtkOrientable interface, in order to be able to use it vertically. Note: right now, I created a separate gimp_scale_entry_new2() and only modified the property widget API to use this new code. Eventually I will remove fully the old gimp_scale_entry_new() function (and the new code will replace it).
2020-10-30 07:30:03 +08:00
GtkWidget * gimp_prop_scale_entry_new (GObject *config,
const gchar *property_name,
const gchar *label,
gdouble factor,
gboolean limit_scale,
gdouble lower_limit,
gdouble upper_limit);
Added object properties for almost all tool_options values and registered 2003-02-07 Michael Natterer <mitch@gimp.org> Added object properties for almost all tool_options values and registered lots of enums with the type system: Part I (enum and type cleanup): * app/core/core-enums.[ch] * app/core/core-types.h: removed InternalOrientaionType and register GimpOrientationType. Register GimpChannelOps. Removed GimpToolOptionsGUIFunc. * app/xcf/xcf-private.h: added XcfOrientationType with the same values as the old InternalOrientationType * app/xcf/xcf-load.c * app/xcf/xcf-save.c: translate between GimpOrientationType and XcfOrientationType. * app/core/gimpdrawable-transform-utils.[ch] * app/core/gimpdrawable-transform.[ch] * app/core/gimpimage-crop.c * app/core/gimpimage-duplicate.c * app/core/gimpimage-guides.c * app/core/gimpimage-resize.c * app/core/gimpimage-scale.c * app/core/gimpimage.h * app/display/gimpdisplayshell.c * tools/pdbgen/stddefs.pdb * tools/pdbgen/pdb/transform_tools.pdb: changed accordingly. * app/pdb/guides_cmds.c * app/pdb/transform_tools_cmds.c * libgimp/gimpenums.h * libgimpproxy/gimpproxytypes.h * plug-ins/script-fu/script-fu-constants.c * tools/pdbgen/enums.pl: regenerated. * libgimptool/gimptoolenums.[ch]: added GimpTransformGridType. * libgimptool/gimptooltypes.h: removed GimpToolOptionsResetFunc, added GimpToolOptionsGUIFunc. Part II (tool options changes): * app/config/gimpconfig-utils.c (gimp_config_reset_properties): don't reset object properties because they have NULL as default value. * app/widgets/gimppropwidgets.[ch]: added gimp_prop_[enum|boolean]_radio_frame_new(), gimp_prop_paint_mode_menu_new() and gimp_prop_scale_entry_new(), which are all needed by the new tool options GUI code. * app/tools/tool_options.[ch]: removed the "reset_func" since the virtual reset() method is used now. * app/paint/gimpairbrushoptions.[ch] * app/paint/gimpcloneoptions.[ch] * app/paint/gimpconvolveoptions.[ch] * app/paint/gimpdodgeburnoptions.[ch] * app/paint/gimperaseroptions.[ch] * app/paint/gimppaintoptions.[ch] * app/paint/gimpsmudgeoptions.[ch]: added properties all over the place and removed the widget and default_value members from the structs. Renamed some values (e.g. s/type/clone_type/). Don't #include <gtk/gtk.h>. * app/paint/gimpairbrush.c * app/paint/gimpclone.c * app/paint/gimpconvolve.c * app/paint/gimpdodgeburn.c * app/paint/gimperaser.c * app/paint/gimppaintbrush.c * app/paint/gimppaintcore-stroke.c * app/paint/gimppaintcore.c * app/paint/gimppencil.c * app/paint/gimpsmudge.c * app/paint/paint-types.h * app/paint/paint.c: changed accordingly. Don't #include <gtk/gtk.h>. * tools/pdbgen/pdb/paint_tools.pdb: changed accordingly. * app/pdb/paint_tools_cmds.c: regenerated. * app/tools/gimpblendoptions.[ch] * app/tools/gimpbucketfilloptions.[ch] * app/tools/gimpcolorpickeroptions.[ch] * app/tools/gimpcropoptions.[ch] * app/tools/gimpflipoptions.[ch] * app/tools/gimpinkoptions.c * app/tools/gimpmagnifyoptions.[ch] * app/tools/gimpmeasureoptions.[ch] * app/tools/gimpmoveoptions.[ch] * app/tools/gimptextoptions.c * app/tools/paint_options.[ch] * app/tools/selection_options.[ch] * app/tools/transform_options.[ch]: ditto: added properties and removed widget and default_value stuff. Removed most reset functions. Use gimp_prop widgets all over the place, renamed some values as above. * app/tools/Makefile.am * app/tools/gimpairbrushtool.c * app/tools/gimpblendtool.c * app/tools/gimpbucketfilltool.c * app/tools/gimpbycolorselecttool.c * app/tools/gimpclonetool.c * app/tools/gimpconvolvetool.c * app/tools/gimpcroptool.c * app/tools/gimpdodgeburntool.c * app/tools/gimperasertool.c * app/tools/gimpfliptool.c * app/tools/gimpfuzzyselecttool.c * app/tools/gimpmagnifytool.c * app/tools/gimpmovetool.c * app/tools/gimpselectiontool.c * app/tools/gimpsheartool.c * app/tools/gimpsmudgetool.c * app/tools/gimptransformtool.c * app/tools/gimpvectoroptions.c: changed accordingly. Ported the paint_options GUI constructors to gimp_prop widgets. * app/widgets/gimpselectioneditor.c * app/gui/tool-options-dialog.c: changed accordingly.
2003-02-08 01:12:21 +08:00
/* GimpParamMemsize */
GtkWidget * gimp_prop_memsize_entry_new (GObject *config,
const gchar *property_name);
/* GParamString */
GtkWidget * gimp_prop_label_new (GObject *config,
const gchar *property_name);
GtkWidget * gimp_prop_entry_new (GObject *config,
const gchar *property_name,
gint max_len);
GtkTextBuffer * gimp_prop_text_buffer_new (GObject *config,
const gchar *property_name,
gint max_len);
GtkWidget * gimp_prop_string_combo_box_new (GObject *config,
const gchar *property_name,
GtkTreeModel *model,
gint id_column,
gint label_column);
/* GimpParamPath */
GtkWidget * gimp_prop_file_chooser_button_new (GObject *config,
const gchar *property_name,
const gchar *title,
GtkFileChooserAction action);
GtkWidget * gimp_prop_file_chooser_button_new_with_dialog (GObject *config,
const gchar *property_name,
GtkWidget *dialog);
GtkWidget * gimp_prop_path_editor_new (GObject *config,
const gchar *path_property_name,
const gchar *writable_property_name,
const gchar *filechooser_title);
/* GParamInt, GParamUInt, GParamDouble unit: GimpParamUnit */
GtkWidget * gimp_prop_size_entry_new (GObject *config,
const gchar *property_name,
gboolean property_is_pixel,
const gchar *unit_property_name,
const gchar *unit_format,
GimpSizeEntryUpdatePolicy update_policy,
gdouble resolution);
/* x,y: GParamInt, GParamDouble unit: GimpParamUnit */
GtkWidget * gimp_prop_coordinates_new (GObject *config,
const gchar *x_property_name,
const gchar *y_property_name,
const gchar *unit_property_name,
const gchar *unit_format,
GimpSizeEntryUpdatePolicy update_policy,
gdouble xresolution,
gdouble yresolution,
gboolean has_chainbutton);
gboolean gimp_prop_coordinates_connect (GObject *config,
const gchar *x_property_name,
const gchar *y_property_name,
const gchar *unit_property_name,
GtkWidget *sizeentry,
GtkWidget *chainbutton,
gdouble xresolution,
gdouble yresolution);
removed gimp_config_values_equal(). 2002-11-23 Michael Natterer <mitch@gimp.org> * app/config/gimpconfig-utils.[ch]: removed gimp_config_values_equal(). * app/config/gimpconfig-serialize.c * app/config/gimpconfig.c: use g_param_values_cmp() instead so our registered compare methods are used. * app/config/gimpdisplayconfig.[ch]: added "canvas_padding_mode" and "canvas_padding_color" properties. * app/display/display-enums.[ch]: added enum GimpDisplayPaddingMode which can be one of { theme, light check, dark check, custom }. * app/display/gimpdisplay.h * app/display/gimpdisplay-handlers.c: removed cached monitor resolution values... * app/display/gimpdisplayshell.[ch]: ...and added them here. Added padding state as in GimpDisplayConfig. Added utility function gimp_display_shell_set_padding() which hides all the details. Added the new padding modes to the padding color button's context menu. * app/display/gimpdisplayshell-callbacks.[ch]: don't fiddle with colors manually but use gimp_display_shell_set_padding() in realize() and in the color button callbacks. * app/display/gimpdisplayshell-handlers.c: connect to notify::monitor-[xy]resolution and notify::canvas-padding-[mode|color] and update accordingly. * app/widgets/gimppropwidgets.[ch]: added gimp_prop_color_button_new(). * app/widgets/gimpdialogfactory.[ch]: added gimp_dialog_factories_session_clear() (unimplemented). * app/gui/preferences-dialog.c: added widgets for padding mode and color. Removed some callbacks by connecting the functions they called directly. Cleanup.
2002-11-24 06:22:21 +08:00
/* GimpParamColor */
GtkWidget * gimp_prop_color_area_new (GObject *config,
const gchar *property_name,
gint width,
gint height,
GimpColorAreaType type);
removed gimp_config_values_equal(). 2002-11-23 Michael Natterer <mitch@gimp.org> * app/config/gimpconfig-utils.[ch]: removed gimp_config_values_equal(). * app/config/gimpconfig-serialize.c * app/config/gimpconfig.c: use g_param_values_cmp() instead so our registered compare methods are used. * app/config/gimpdisplayconfig.[ch]: added "canvas_padding_mode" and "canvas_padding_color" properties. * app/display/display-enums.[ch]: added enum GimpDisplayPaddingMode which can be one of { theme, light check, dark check, custom }. * app/display/gimpdisplay.h * app/display/gimpdisplay-handlers.c: removed cached monitor resolution values... * app/display/gimpdisplayshell.[ch]: ...and added them here. Added padding state as in GimpDisplayConfig. Added utility function gimp_display_shell_set_padding() which hides all the details. Added the new padding modes to the padding color button's context menu. * app/display/gimpdisplayshell-callbacks.[ch]: don't fiddle with colors manually but use gimp_display_shell_set_padding() in realize() and in the color button callbacks. * app/display/gimpdisplayshell-handlers.c: connect to notify::monitor-[xy]resolution and notify::canvas-padding-[mode|color] and update accordingly. * app/widgets/gimppropwidgets.[ch]: added gimp_prop_color_button_new(). * app/widgets/gimpdialogfactory.[ch]: added gimp_dialog_factories_session_clear() (unimplemented). * app/gui/preferences-dialog.c: added widgets for padding mode and color. Removed some callbacks by connecting the functions they called directly. Cleanup.
2002-11-24 06:22:21 +08:00
GtkWidget * gimp_prop_color_select_new (GObject *config,
const gchar *property_name,
gint width,
gint height,
GimpColorAreaType type);
/* GimpParamUnit */
GtkWidget * gimp_prop_unit_combo_box_new (GObject *config,
const gchar *property_name);
/* GParamString (icon name) */
GtkWidget * gimp_prop_icon_image_new (GObject *config,
const gchar *property_name,
GtkIconSize icon_size);
G_END_DECLS
#endif /* __GIMP_PROP_WIDGETS_H__ */