getcolor.gadget Reference¶
Comprehensive function reference for getcolor.gadget, synthesised from the AmigaOS NDK 3.2 Release 4 (Autodocs/getcolor).
This page documents 3 functions of getcolor.gadget. Each function entry follows the canonical autodoc format. struct Name, union Name, enum Name are clickable links to the type definition in the types reference.
Function index¶
getcolor.gadget()¶
**getcolor.gadget -- Create getcolor BOOPSI objects
SUPERCLASS
gadgetclass
REQUIRES
window.class, button.gadget, layout.gadget, slider.gadget,
colorwheel.gadget, gradientslider.gadget, space.gadget,
radiobutton.gadget, bevel.image, label.image
DESCRIPTION
The getcolor gadget class is used to define and select colors from a
standard color requester in an easy and consistent way. It consists
of a button gadget that is used to open the color requester and show
the result (the currently selected color).
PROGRAMMING STYLE
This class provides several attributes allowing to override the
user's global choices for the color requester contents and layout.
However, it is not recommended to do so without a good reason.
Good reasons may include the necessity of keeping the requester
size as small as possible, or other special requirements of your
application which make it necessary to filter out some of the
possible options. If you really need to do this, try to offer the
user the ability to switch off such limitations.
For normal applications, no attributes should ever be set other
than GETCOLOR_TitleText, GETCOLOR_Screen and those affecting the
current color value such as GETCOLOR_Color or the various 32-bit
variants thereof.
METHODS
OM_NEW -- Passed to superclass, defaults set, then OM_SET.
OM_SET -- Passed to superclass, custom tags set.
OM_GET -- Custom tag returned or passed to superclass.
OM_UPDATE -- Passed to superclass, options set then rendered.
OM_DISPOSE -- Disposes private data then passed to superclass.
GM_RENDER -- Passed to superclass, then rendered.
GM_HITTEST -- Overrides superclass, returns GMR_GADGETHIT if within
the button.
GM_HELPTEST -- Overrides superclass, returns GMR_HELPHIT if within
the domain of the gadget.
GM_GOACTIVE -- Passed to superclass, passed to button.
GM_HANDLEINPUT -- Overrides superclass, all input processed.
GM_GOINACTIVE -- Passed to superclass, button deactivated.
GM_DOMAIN -- Returns GDOMAIN_MINIMUM, GDOMAIN_NOMINAL and
GDOMAIN_MAXIMUM dimensions.
GM_LAYOUT -- Calculate relative gadget coordinates.
GM_CLIPRECT -- Installs ClipRect for virtual group support.
GM_KEYGOACTIVE -- Handle keyboard activation.
GM_KEYGOINACTIVE -- Handle keyboard deactivation.
GCOLOR_REQUEST -- Invokes the color requester.
ATTRIBUTES
GA_ID (UWORD)
Unique ID number for the gadget.
Defaults to 0.
Applicability is (OM_NEW, OM_SET, OM_GET, OM_NOTIFY)
GA_Disabled (BOOL)
Set to TRUE to disable gadget, FALSE otherwise.
Defaults to FALSE.
Applicability is (OM_NEW, OM_SET, OM_GET)
GA_TextAttr (struct TextAttr *)
Font to use for the gadget text.
Defaults to the screen's font.
Applicability is (OM_NEW, OM_SET, OM_GET)
GA_BackFill (struct Hook *)
A layer backfill hook to provide a more complex
background pattern. See InstallLayerHook() for
more details about the backfill hook.
Defaults to NULL.
Applicability is (OM_NEW, OM_SET)
GETCOLOR_TitleText (CONST_STRPTR)
Title of the color requester.
Defaults to "Color" (localized).
Applicability is (OM_NEW, OM_SET)
GETCOLOR_Screen (struct Screen *)
Screen for allocation of needed pens for the display.
This MUST be provided and MUST remain open until after
the gadget has been disposed.
Applicability is (OM_NEW, OM_SET, OM_GET)
GETCOLOR_Color (ULONG)
Current color value, expressed as a 0x00RRGGBB longword.
Defaults to 0 (black).
Applicability is (OM_NEW, OM_SET, OM_GET, OM_NOTIFY)
GETCOLOR_Red (ULONG)
Red component of the current color, expressed as a
32-bit left-justified fraction.
Defaults to 0 (no red).
Applicability is (OM_NEW, OM_SET, OM_GET, OM_NOTIFY)
GETCOLOR_Green (ULONG)
Green component of the current color, expressed as a
32-bit left-justified fraction.
Defaults to 0 (no green).
Applicability is (OM_NEW, OM_SET, OM_GET, OM_NOTIFY)
GETCOLOR_Blue (ULONG)
Blue component of the current color, expressed as a
32-bit left-justified fraction.
Defaults to 0 (no blue).
Applicability is (OM_NEW, OM_SET, OM_GET, OM_NOTIFY)
GETCOLOR_Hue (ULONG)
Hue value of the current color, expressed as a
32-bit left-justified fraction.
Defaults to 0 (full red).
Applicability is (OM_NEW, OM_SET, OM_GET, OM_NOTIFY)
GETCOLOR_Saturation (ULONG)
Saturation value of the current color, expressed as a
32-bit left-justified fraction.
Defaults to 0 (no saturation).
Applicability is (OM_NEW, OM_SET, OM_GET, OM_NOTIFY)
GETCOLOR_Brightness (ULONG)
Brightness value of the current color, expressed as a
32-bit left-justified fraction.
Defaults to 0L (full darkness).
Applicability is (OM_NEW, OM_SET, OM_GET, OM_NOTIFY)
GETCOLOR_RGB (struct ColorWheelRGB *)
RGB components of the current color, expressed as
32-bit left-justified fractions. This allows to set
or get all of them with a single operation.
Defaults to 0/0/0 (black).
Applicability is (OM_NEW, OM_SET, OM_GET)
GETCOLOR_HSB (struct ColorWheelHSB *)
HSB values of the current color, expressed as
32-bit left-justified fractions. This allows to set
or get all of them with a single operation.
Defaults to 0/0/0 (black).
Applicability is (OM_NEW, OM_SET, OM_GET)
GETCOLOR_ColorWheel (BOOL)
If TRUE, the color requester will include a color wheel
and a gradient slider.
Defaults to TRUE.
Applicability is (OM_NEW, OM_SET)
GETCOLOR_RGBSliders (BOOL)
If TRUE, the color requester will include sliders to
select the red/green/blue color components.
Defaults to TRUE.
Applicability is (OM_NEW, OM_SET)
GETCOLOR_HSBSliders (BOOL)
If TRUE, the color requester will include sliders to
select the hue/saturation/brightness color values.
Defaults to FALSE.
Applicability is (OM_NEW, OM_SET)
GETCOLOR_SwitchMode (BOOL)
If TRUE, the user will be able to switch between RGB
and HSB sliders in the color requester, rather than
having both sets displayed at the same time (to save
space). Setting this automatically implies TRUE for
the two previous attributes.
Defaults to TRUE.
Applicability is (OM_NEW, OM_SET)
GETCOLOR_Initial (UWORD)
Which set of sliders will be displayed initially, if
GETCOLOR_SwitchMode is TRUE (0 == RGB, 1 == HSB).
Defaults to 0 (RGB).
Applicability is (OM_NEW, OM_SET)
GETCOLOR_ShowRGB (BOOL)
If TRUE, the color requester will include display boxes
showing the current red/green/blue amounts.
Defaults to FALSE.
Applicability is (OM_NEW, OM_SET)
GETCOLOR_ShowHSB (BOOL)
If TRUE, the color requester will include display boxes
showing the current hue/saturation/brightness amounts.
Defaults to FALSE.
Applicability is (OM_NEW, OM_SET)
GETCOLOR_SmallTextAttr (struct TextAttr *)
Font to use for the RGB/HSB display boxes; it should be
as small as possible (while still being readable) to
avoid making the color requester too large.
Defaults to the current user-selected "fallback font"
from user preferences or to the normal gadget font if
no "fallback font" is defined.
Applicability is (OM_NEW, OM_SET)**
GCOLOR_REQUEST()¶
GCOLOR_REQUEST -- Invokes the color requester.
Synopsis
result = DoMethodA(obj, msg);
D0
ULONG DoMethodA(Object *, struct gcRequest *);
Function
Opens the color requester and blocks the given window. When the user has finished making adjustments the selection details are sent via the OM_NOTIFY mechanism. All the attributes marked with OM_NOTIFY are sent to the receiver.
Inputs
obj - getcolor object pointer
msg - pointer to fully initialized struct gcRequest
(see
RESULT
Returns non-zero if successful or 0 on error.
GETCOLOR_GetClass()¶
GETCOLOR_GetClass -- Gets the pointer to the color requester class.
Synopsis
getcolor_class = GETCOLOR_GetClass();
D0
Class * GETCOLOR_GetClass(VOID);
Function
Obtains the pointer to the getcolor gadget class for use with NewObject(). This function always returns a valid pointer so you do not need to check it. The reason is that if the library opens fine, then the pointer returned is already set up. (Of course this implies that if opening the library fails, you shouldn't be calling this.)
Note that this function does not create the class, that is done when the class library is opened.
Inputs
Nothing.
RESULT
getcolor_class - Pointer to the getcolor gadget class.
EXAMPLE