IupFlatLabel
Creates an interface element that is a label, but it does not have native decorations. Its visual presentation can contain a text and/or an image.
It behaves just like an IupLabel, but it is not a native control.
It inherits from IupCanvas.
Initialization and Usage
The IupControlsOpen function must be called after IupOpen. The "iupctrl.h" file must also be included in the source code. The program must be linked to the controls library (iupctrl).
Creation
Ihandle* IupFlatLabel(const char *title);
title: Text to be shown to the user. It can be NULL. It will set the TITLE attribute.
Returns: the identifier of the created element, or NULL if an error occurs.
Attributes
Inherits all attributes and callbacks of the IupCanvas, but redefines a few attributes.
ALIGNMENT (non-inheritable): horizontal and vertical alignment of the set image+text. Possible values: "ALEFT", "ACENTER" and "ARIGHT", combined to "ATOP", "ACENTER" and "ABOTTOM". Default: "ALEFT:ACENTER". Partial values are also accepted, like "ARIGHT" or ":ATOP", the other value will be obtained from the default value. Alignment does not include the padding area.
BACKIMAGE (non-inheritable): image name to be used as a background. Use IupSetHandle or IupSetAttributeHandle to associate an image to a name. See also IupImage.
BACKIMAGEZOOM (non-inheritable): if set, the back image will be zoomed to occupy the full background. Aspect ratio is NOT preserved. Can be YES or NO. Default: "NO".
BORDER (creation-only): the default value is "NO". This is the IupCanvas border.
BGCOLOR: ignored. It will use the background color of the native parent.
EXPAND (non-inheritable): The default value is "NO".
FGCOLOR: Text color. Default: the global attribute DLGFGCOLOR.
FITTOBACKIMAGE (non-inheritable): enable the natural size to be computed from the BACKIMAGE. If BACKIMAGE is not defined will be ignored. Can be YES or NO. Default: "NO".
FRONTIMAGE (non-inheritable): image name to be used as foreground. The foreground image is drawn in the same position as the background, but it is drawn at last. Use IupSetHandle or IupSetAttributeHandle to associate an image to a name. See also IupImage.
IMAGE (non-inheritable): Image name. Use IupSetHandle or IupSetAttributeHandle to associate an image to a name. See also IupImage.
IMAGEINACTIVE (non-inheritable): Image name of the element when inactive. If it is not defined then the IMAGE is used and its colors will be replaced by a modified version creating the disabled effect.
INACTIVEOPACITY: when set to a value between 1 and 254, an inactive control is drawn with its active colors and that opacity (0-255) over the parent background, instead of the inactive colors. Default: NULL.
IMAGETINT (non-inheritable): color "R G B" used to draw the image recolored, keeping its alpha channel. "YES" uses the current text color; "NO" draws the image unchanged. Default: "NO".
IMAGEPOSITION (non-inheritable): Position of the image relative to the text when both are displayed. Can be: LEFT, RIGHT, TOP, BOTTOM. Default: "LEFT".
PADDING: internal margin. Works just like the MARGIN attribute of the IupHbox and IupVbox containers, but uses a different name to avoid inheritance problems. Default: "0x0". Alignment does not include the padding area.
CPADDING: same as PADDING but using the units of the SIZE attribute. It will actually set the PADDING attribute.
SPACING (non-inheritable): spacing between the image and the text. Default: "2".
CSPACING: same as SPACING but using the units of the vertical part of the SIZE attribute. It will actually set the SPACING attribute.
TITLE (non-inheritable): Label's text. The '\n' character is accepted for line change.
TEXTALIGNMENT (non-inheritable): Horizontal text alignment for multiple lines. Can be: ALEFT, ARIGHT or ACENTER. Default: "ALEFT".
TEXTWRAP (non-inheritable): For single line texts if the text is larger than its box, the line will be automatically broken in multiple lines. The element natural size still uses only a single line. For the remaining lines to be visible, the element should use EXPAND=VERTICAL or set a SIZE/RASTERSIZE with enough height for the wrapped lines.
TEXTELLIPSIS (non-inheritable): If the text is larger than its box, an ellipsis ("...") will be placed near the last visible part of the text and replace the invisible part. It will be ignored when TEXTWRAP=YES.
TEXTCLIP (non-inheritable): If YES, the text will be clipped to the label area. Default: NO.
TEXTORIENTATION (non-inheritable): text angle in degrees and counterclockwise. The text size will adapt to include the rotated space.
ACTIVE, FONT, EXPAND, SCREENPOSITION, POSITION, MINSIZE, MAXSIZE, WID, TIP, SIZE, RASTERSIZE, ZORDER, VISIBLE, THEME: also accepted.
Notes
The IupFlatLabel can contain text and image simultaneously.
The natural size will be a combination of the size of the image and the title, if any, plus PADDING and SPACING (if both image and title are present).
The IupLabel SEPARATOR attribute to configure a separator (horizontal or vertical lines) is not supported. ELLIPSIS, MARKUP and WORDWRAP IupLabel attributes are also not supported. Mnemonics are not supported.
Examples
