IUP-Go Documentation 4.0

IupFlatFrame

Creates a native container, which draws a frame with a title around its child. The decorations are manually drawn. The control inherits from IupBackgroundBox.

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* IupFlatFrame(Ihandle *child);

child: Identifier of an interface element which will receive the frame around. It can be NULL.

Returns: the identifier of the created element, or NULL if an error occurs.

Attributes

Inherits all attributes and callbacks of the IupBackgroundBox, but redefines a few attributes.

DECORATION (read-only) (non-inheritable): return YES.

DECOROFFSET and DECORSIZE (read-only) (non-inheritable): are calculated according to FRAME, FRAMEWIDTH, FRAMESPACE and the title area.

BGCOLOR: background color of the child area. If not defined it will use the background color of the native parent.

FRAME (non-inheritable): enables the frame line. Default: "YES". If value is CROSSTITLE the frame at top crosses the title, like traditional frames in native systems. When CROSSTITLE is used TITLELINE and TITLEALIGNMENT are ignored, the title line is never drawn and alignment is always left.

FRAMECOLOR (non-inheritable): frame line color. Default: "160 160 160".

CORNERRADIUS (non-inheritable): radius of the rounded corners for the frame line and background. Default: "0" (no rounding).

FRAMEWIDTH (non-inheritable): frame line width. Default: "1".

FRAMESPACE (non-inheritable): spacing between frame line and child area. Used only when FRAME=YES. Default: "2".

TITLE (non-inheritable): Text the user will see at the top of the frame. The natural width of the frame is at least the width of the title.

TITLECOLOR (non-inheritable): title text color. Default: the global attribute DLGFGCOLOR.

TITLEBGCOLOR (non-inheritable): background color of the title area. If not defined BGCOLOR will be used.

TITLELINE (non-inheritable): enables the title line. Horizontal line that separates the title area from the child area. Default: "YES".

TITLELINECOLOR (non-inheritable): title line color. Default: the global attribute DLGFGCOLOR.

TITLELINEWIDTH (non-inheritable): title line width. Default: "1".

TITLEIMAGE (non-inheritable): image name to be used in title. Use IupSetHandle or IupSetAttributeHandle to associate an image to a name. See also IupImage.

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 title image recolored, keeping its alpha channel. "YES" uses the current text color; "NO" draws the image unchanged. Default: "NO".

TITLEIMAGEINACTIVE (non-inheritable): image used in title when inactive. If it is not defined then the TITLEIMAGE is used and its colors will be replaced by a modified version creating the disabled effect.

TITLEIMAGEPOSITION (non-inheritable): position of the image relative to the text when both are displayed. Can be: LEFT, RIGHT, TOP, BOTTOM. Default: "LEFT".

TITLEIMAGESPACING (non-inheritable): spacing between the image and the text. Default: "2".

TITLEALIGNMENT (non-inheritable): horizontal alignment. Possible values: "ALEFT", "ACENTER" and "ARIGHT". Default: "ACENTER". Alignment does not include the padding area.

TITLETEXTALIGNMENT (non-inheritable): horizontal text alignment for multiple lines. Can be: ALEFT, ARIGHT or ACENTER. Default: "ALEFT".

TITLETEXTWRAP (non-inheritable): For single line texts if the text is larger than its box, the line will be automatically broken in multiple lines. The natural size still uses 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.

TITLETEXTELLIPSIS (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 TITLETEXTWRAP=YES.

TITLETEXTCLIP (non-inheritable): If YES, the title text will be clipped to the title area. Default: NO.

TITLETEXTORIENTATION (non-inheritable): text angle in degrees and counterclockwise. The text size will adapt to include the rotated space.

TITLEPADDING (non-inheritable): title internal margin. Alignment does not include the padding area. Default value: "0x0".

Notes

To replace an IupFrame with an IupFlatFrame, set TITLELINE=NO, TITLEALIGNMENT=ALEFT and FRAMECOLOR="160 160 160" (or a lighter version of the DLGFGCOLOR). FRAME=CROSSTITLE positions the line in the middle of the title text like in IupFrame.

Examples

Browse for Example Files

  frame1 = IupFlatFrame
          (
            IupVbox
            (
              IupLabel("Label1"),
              IupSetAttributes(IupLabel("Label2"), "SIZE=70x"),
              IupLabel("Label3"),
              NULL
            )
          );

  frame2 = IupFlatFrame
          (
            IupVbox
            (
              IupSetAttributes(IupLabel("Label4"), "EXPAND=HORIZONTAL"),
              IupLabel("Label5"),
              IupLabel("Label6"),
              NULL
            )
          );

  frame3 = IupFlatFrame
          (
            IupVbox
            (
              IupLabel("Label7"),
              IupSetAttributes(IupLabel("Label8"), "SIZE=70x"),
              IupLabel("Label9"),
              NULL
            )
          );

  IupSetAttribute(frame1, "TITLE", "Title Text");
  IupSetAttribute(frame1, "BGCOLOR", "64 192 255");
  IupSetAttribute(frame1, "FRAMECOLOR", "255 255 255");
  IupSetAttribute(frame1, "TITLELINECOLOR", "255 255 255");
  IupSetAttribute(frame1, "TITLEBGCOLOR", "64 128 255");
  IupSetAttribute(frame1, "TITLECOLOR", "255 255 255");
  IupSetAttribute(frame1, "TITLELINEWIDTH", "2");
  IupSetAttribute(frame1, "FRAMEWIDTH", "2");
  IupSetAttribute(frame1, "FRAMESPACE", "5");

  IupSetAttribute(frame2, "BGCOLOR", "0 128 0");
  IupSetAttribute(frame2, "FRAMEWIDTH", "5");
  IupSetAttribute(frame2, "FRAMESPACE", "20");
  IupSetAttribute(frame2, "FGCOLOR", "255 128 128");  /* recursive set for labels */
  IupSetAttribute(frame2, "FONTSTYLE", "Bold");
  IupSetAttribute(frame2, "FONTSIZE", "14");

  IupSetAttribute(frame3, "FRAME", "NO");
  IupSetAttribute(frame3, "TITLE", "Title Text");
  IupSetAttribute(frame3, "TITLELINE", "NO");
  IupSetAttribute(frame3, "TITLEBGCOLOR", "64 128 255");

\

See Also

IupFrame, IupBackgroundBox