Cross-platform C SDK logo

Cross-platform C SDK

SplitView

❮ Back
Next ❯
This page has been automatically translated using the Google Translate API services. We are working on improving texts. Thank you for your understanding and patience.

Functions

SplitView*splitview_horizontal (void)
SplitView*splitview_vertical (void)
voidsplitview_size (...)
voidsplitview_view (...)
voidsplitview_text (...)
voidsplitview_split (...)
voidsplitview_panel (...)
voidsplitview_pos (...)

The SplitView are views divided into two parts, where in each of them we place another view or a panel. The dividing line is scrollable, which allows resizing both halves, dividing the total size of the control between the children (Figure 1), (Figure 2), (Figure 3). In Hello SplitView! you have an example of use.

  • Use splitview_horizontal to create a split view.
  • Use splitview_size to set the initial size.
  • Capture of a window with split views in Windows system.
    Figure 1: SplitView in Windows.
    Capture of a window with split views in macOS system.
    Figure 2: SplitView in macOS.
    Capture of a window with split views in Linux system.
    Figure 3: SplitView in Linux.

1. Add controls

There are several functions for adding "child" controls to the splitview. The first call to any of them will place the view or panel on the left or top side. The second call will be on the right or lower side. Successive calls will generate an error.


2. Split modes

We have two modes of behavior of the dividing bar and both are activated from this function:

  • Use splitview_pos to set the mode of the splitter.
  • Proportional mode: The position of the divider will always remain constant with respect to the size of the splitview. That is, a value of 0.3 means that the left view will always occupy 1/3 of the total size and the right view 2/3. To do this, indicate a value between 0 and 1 in the pos parameter.
  • Fixed mode: Resizing the splitview will always leave one of the parts with a constant size. If pos > 1 the left/top child will keep the indicated number of pixels. On the contrary, if pos < 0 the same will happen with the right/bottom view.
The ratio or value will change if the user drags the dividing line, but the operating mode will not.

splitview_horizontal ()

Create a splitview with horizontal split.

SplitView*
splitview_horizontal(void);

Return

The newly created split view.


splitview_vertical ()

Create a splitview with vertical split.

SplitView*
splitview_vertical(void);

Return

The newly created split view.


splitview_size ()

Sets the default size of the view.

void
splitview_size(SplitView *split,
               const S2Df size);
split

The view.

size

The size.

Remarks

It corresponds to the Natural sizing of the control. Default 128x128.


splitview_view ()

Add a custom view to the splitview.

void
splitview_view(SplitView *split,
               View *view);
split

The splitview.

view

The custom view.

Remarks

See Add controls.


splitview_text ()

Add a text view to the splitview.

void
splitview_text(SplitView *split,
               TextView *view);
split

The splitview.

view

The text view.

Remarks

See Add controls.


splitview_split ()

Add a splitview (child) to the splitview.

void
splitview_split(SplitView *split,
                SplitView *child);
split

The splitview.

child

The splitview to add.

Remarks

See Add controls.


splitview_panel ()

Add a panel to the splitview.

void
splitview_panel(SplitView *split,
                Panel *panel);
split

The splitview.

panel

The panel.

Remarks

See Add controls.


splitview_pos ()

Sets the position of the view separator.

void
splitview_pos(SplitView *split,
              const real32_t pos);
split

The splitview.

pos

The new position of the separator.

Remarks

See Split modes.

❮ Back
Next ❯