gimp/libgimp/gimpcolorselector.h
Michael Natterer a11f33345d The GIMP Help System part II: press "F1" while browsing a menu to show the
1999-10-03  Michael Natterer  <mitch@gimp.org>

	The GIMP Help System part II: press "F1" while browsing a menu
	to show the help page for the menu entry you're currently over
	with the mouse.

	* app/color_notebook.c: all color selectors have to register with
	a help page now.

	* app/color_select.[ch]: register with a help string. Removed
	the dialog part of the files because it's use was deprecated
	anyway (use color notebooks instead).

	* app/colormap_dialog.i.c
	* app/colormap_dialog.p.h
	* app/palette.c
	* app/palette_select.c: use a color notebook instead of a color
	selector.

	* app/gimphelp.c
	* app/gimpui.c: minor changes.

	* app/gimprc.c: "use help" defaults to TRUE now.

	* app/lc_dialog.c
	* app/lc_dialogP.h: a special help function which shows the help
	for the currently selected notebook page.

	* app/menus.c: some weird code which catches "key_press_event"
	in all menu shells and pops up the corresp. help page for the
	selected item. Embedded the GtkItemFactoryEntry in a new
	GimpItemFactoryEntry to allow a help path to be stored.
	Will be partially exported and moved to gimphelp.[ch] later to
	catch key_press for plug-in menu items (don't try this now ;-)

	* app/app_procs.c
	* app/brush_edit.c
	* app/brush_select.c
	* app/channel_ops.c
	* app/channels_dialog.c
	* app/commands.c
	* app/convert.c
	* app/devices.c
	* app/file_new_dialog.c
	* app/fileops.c
	* app/gdisplay.c
	* app/gdisplay_color.c
	* app/gdisplay_color_ui.c
	* app/gdisplay_ops.c
	* app/global_edit.c
	* app/gradient.c
	* app/gradient_select.c
	* app/interface.c
	* app/layers_dialog.c
	* app/module_db.c
	* app/paths_dialog.c
	* app/pattern_select.c
	* app/preferences_dialog.c
	* app/qmask.c
	* app/resize.c
	* app/undo_history.c: changed all dialog constructors to point
	to the right place in the new help file structure.

	* configure.in
	* help/*: the basic new help file structure.

	* modules/colorsel_gtk.c
	* modules/colorsel_triangle.c
	* modules/colorsel_water.c: register a help page.

	* plug-ins/helpbrowser/helpbrowser.c: load the help files
	according to the new help file structure.
1999-10-03 13:50:19 +00:00

105 lines
4.1 KiB
C

/* The GIMP -- an image manipulation program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* Colour selector module (C) 1999 Austin Donnelly <austin@greenend.org.uk>
*
* 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 2 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, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef __COLOR_SELECTOR_H__
#define __COLOR_SELECTOR_H__
/********************************/
/* color selector registration */
/* A function of this type should be called by the color selector each
* time the user modifies the selected color. */
typedef void (*GimpColorSelector_Callback)(void *data, int r, int g, int b);
/* A function of this type is called to create a new instance of the
* color selector. The new selector should set its current color to
* the RGB triple given (each component is in the range 0 - 255
* inclusive, with white at 255,255,255 and black at 0,0,0).
*
* The selector should call "cb" with argument "data" each time the
* user modifies the selected color.
*
* The selector must return a GtkWidget which implements the color
* selection UI. The selector can optionally return "selector_data",
* an opaque pointer which will be passed in to subsequent invokations
* on the selector. */
typedef GtkWidget * (*GimpColorSelector_NewFunc)(int r, int g, int b,
GimpColorSelector_Callback cb,
void *data,
/* RETURNS: */
void **selector_data);
/* A function of this type is called when the color selector is no
* longer required. This function should not free widgets that are
* containted within the UI widget returned by new(), since they are
* destroyed on behalf of the selector by the caller of this
* function. */
typedef void (*GimpColorSelector_FreeFunc)(void *selector_data);
/* A function of this type is called to change the selector's current
* color. The required color is specified as in the new() function.
* If the "set_current" parameter is FALSE, then only the old color
* should be set - if "set_current" is TRUE, both the old color and
* the current color should be set to the RGB triple given. This
* function merely gives a hint to the color selector; the selector
* can choose to ignore this information. */
typedef void (*GimpColorSelector_SetColorFunc)(void *selector_data,
int r, int g, int b,
int set_current);
typedef struct _GimpColorSelectorMethods GimpColorSelectorMethods;
struct _GimpColorSelectorMethods {
GimpColorSelector_NewFunc new;
GimpColorSelector_FreeFunc free;
GimpColorSelector_SetColorFunc setcolor;
};
typedef void *GimpColorSelectorID;
#ifndef __COLOR_NOTEBOOK_C__ /* Bypass when compiling the source for
* these functions. */
/* Register a color selector. Returns an identifier for the color
* selector on success, or NULL if the name is already in use. Both
* the name and method table are internalised, so may be freed after
* this call. */
GimpColorSelectorID gimp_color_selector_register (const char *name,
const char *help_page,
GimpColorSelectorMethods *methods);
/* Remove the selector "id" from active service. New instances of the
* selector will not be created, but existing ones are allowed to
* continue. If "callback" is non-NULL, it will be called once all
* instances have finished. The callback could be used to unload
* dynamiclly loaded code, for example.
*
* Returns TRUE on success, FALSE if "id" was not found. */
gboolean gimp_color_selector_unregister (GimpColorSelectorID id,
void (*callback)(void *data),
void *data);
#endif /* !__COLOR_NOTEBOOK_C__ */
#endif /* __COLOR_SELECTOR_H__ */