SplitView
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.
Header
#include <gui/splitview.h>
Functions
SplitView* | splitview_horizontal (void) |
SplitView* | splitview_vertical (void) |
void | splitview_view (...) |
void | splitview_textview (...) |
void | splitview_webview (...) |
void | splitview_tableview (...) |
void | splitview_splitview (...) |
void | splitview_panel (...) |
void | splitview_pos (...) |
real32_t | splitview_get_pos (...) |
void | splitview_visible0 (...) |
void | splitview_visible1 (...) |
void | splitview_minsize0 (...) |
void | splitview_minsize1 (...) |
The SplitView
are views divided into two parts, where in each of them we place another child view or panel. The divider line is draggable, which allows to resize parts, distributing the total control size between both descendants. In Hello SplitView! you have an example of use (Listing 1), (Figure 1).
- Use splitview_horizontal to create a up/down view.
- Use splitview_vertical to create a left/right view.
1 2 3 4 5 6 7 8 9 10 11 |
SplitView *split1 = splitview_vertical(); SplitView *split2 = splitview_horizontal(); Panel *panel = i_left_panel(); View *view = view_create(); TextView *text = textview_create(); view_size(view, s2df(400, 200)); textview_size(text, s2df(400, 200)); splitview_panel(split1, panel); splitview_view(split2, view, FALSE); splitview_textview(split2, text, FALSE); splitview_splitview(split1, split2); |

1. Add controls
We have several functions to add content to the SplitView
. The first call will place the view or panel on the left or upper side. The second call will make it on the right or bottom side. Successive calls will generate an error, since each view supports a maximum of two descendants.
- Use splitview_view to add a view.
- Use splitview_textview to add a text view.
- Use splitview_webview to add a web view.
- Use splitview_tableview to add a table.
- Use splitview_splitview to add a nested SplitView (Figure 2).
- Use splitview_panel to add a panel.

2. Positioning the divider
- Use splitview_pos to set the divider position.
- Use splitview_get_pos to get the divider position.
The initial position of the divider, as well as the size of the SplitView
will be calculated according to the Natural sizing of children controls (Figure 3).

The divider will have different behaviors when the size of SplitView
changes, depending on the parameter split_mode_t of splitview_pos:
- ekSPLIT_NORMAL: The position of the divider will always remain constant with respect to the size of the
SplitView
. That is, a 0.3 value means that the left view will always occupy 1/3 of the total size and right 2/3. To do this, indicate a value between 0 and 1 in thepos
parameter. - ekSPLIT_FIXED0: The size changes of the
SplitView
will always leave the left/upper child with a constant size. - ekSPLIT_FIXED1: The right/lower child will maintain its size.
The divider proportional or fixed value will change if the user drags it with the mouse, but the mode will not change.
3. Divider minimum size
- Use splitview_minsize0 to set the minimum size of the left/upper child.
- Use splitview_visible0 to completely hide the left/upper child.
It is possible that the children controls impose minimal size restrictions that prevent the divisor from moving beyond these limits. However, it is possible to establish minimums from the SplitView
itself. It is also possible to completely hide one of the descendants. In this case, the divider bar will disappear, using the entire SplitView
space for the visible descendant.
splitview_horizontal ()
Create a SplitView with horizontal division.
SplitView* splitview_horizontal(void);
Return
The new view.
splitview_vertical ()
Create a SplitView with vertical division.
SplitView* splitview_vertical(void);
Return
The new view.
splitview_view ()
Add a view to SplitView.
void splitview_view(SplitView *split, View *view, const bool_t tabstop);
split | The SplitView. |
view | The child view. |
tabstop |
|
Remarks
See Add controls.
splitview_textview ()
Add a text view to SplitView.
void splitview_textview(SplitView *split, TextView *view, const bool_t tabstop);
split | The SplitView. |
view | The text view. |
tabstop |
|
Remarks
See Add controls.
splitview_webview ()
Add a web view to SplitView.
void splitview_webview(SplitView *split, WebView *view, const bool_t tabstop);
split | The SplitView. |
view | The web view. |
tabstop |
|
Remarks
See Add controls.
splitview_tableview ()
Add a table view to SplitView.
void splitview_tableview(SplitView *split, TableView *view, const bool_t tabstop);
split | The SplitView. |
view | The table view. |
tabstop |
|
Remarks
See Add controls.
splitview_splitview ()
Add a child SplitView to SplitView.
void splitview_splitview(SplitView *split, SplitView *view);
split | The SplitView. |
view | The child SplitView. |
Remarks
See Add controls.
splitview_panel ()
Add a panel to SplitView.
void splitview_panel(SplitView *split, Panel *panel);
split | The SplitView. |
panel | The panel. |
Remarks
See Add controls.
splitview_pos ()
Set the divider position and mode.
void splitview_pos(SplitView *split, const split_mode_t mode, const real32_t pos);
split | The SplitView. |
mode | The behavior mode. |
pos | The new divider position. |
Remarks
splitview_get_pos ()
Get the current divider position.
real32_t splitview_get_pos(const SplitView *split, const split_mode_t mode);
split | The SplitView. |
mode | The unit in which we want the result. |
Return
The divider position.
Remarks
splitview_visible0 ()
Show/hide the left/upper child.
void splitview_visible0(SplitView *split, const bool_t visible);
split | The SplitView. |
visible | Show or hide. |
Remarks
Ver Divider minimum size.
splitview_visible1 ()
Show/hide the right/bottom child.
void splitview_visible1(SplitView *split, const bool_t visible);
split | The SplitView. |
visible | Show or hide. |
Remarks
Ver Divider minimum size.
splitview_minsize0 ()
Set the minimum size of the left/upper child.
void splitview_minsize0(SplitView *split, const real32_t size);
split | The SplitView. |
size | Minimum size. |
Remarks
Ver Divider minimum size.
splitview_minsize1 ()
Set the minimum size of the right/bottom child.
void splitview_minsize1(SplitView *split, const real32_t size);
split | The SplitView. |
size | Minimum size. |
Remarks
Ver Divider minimum size.