Top |
void | glk_window_get_size () |
void | glk_window_set_arrangement () |
void | glk_window_get_arrangement () |
void glk_window_get_size (winid_t win
,glui32 *widthptr
,glui32 *heightptr
);
Simply returns the actual size of the window, in its measurement system.
As described in Other API Conventions,
either widthptr
or heightptr
can be NULL
, if you only want one
measurement.
Or, in fact, both, if you want to waste time.
void glk_window_set_arrangement (winid_t win
,glui32 method
,glui32 size
,winid_t keywin
);
Changes the size of an existing split — that is, it changes the constraint of a given pair window.
Consider the example above, where D has collapsed to zero height. Say D was a text buffer window. You could make a more useful layout by doing
1 2 3 |
winid_t o2; o2 = glk_window_get_parent(d); glk_window_set_arrangement(o2, winmethod_Above | winmethod_Fixed, 3, d); |
That would set D (the upper child of O2) to be O2's key window, and give it a fixed size of 3 rows.
If you later wanted to expand D, you could do
1 |
glk_window_set_arrangement(o2, winmethod_Above | winmethod_Fixed, 5, NULL); |
That expands D to five rows. Note that, since O2's key window is already set
to D, it is not necessary to provide the keywin
argument; you can pass NULL
to mean “leave the key window unchanged.”
If you do change the key window of a pair window, the new key window must be a descendant of that pair window. In the current example, you could change O2's key window to be A, but not B. The key window also cannot be a pair window itself.
1 |
glk_window_set_arrangement(o2, winmethod_Below | winmethod_Fixed, 3, NULL); |
This changes the constraint to be on the lower child of O2, which is A. The key window is still D; so A would then be three rows high as measured in D's font, and D would get the rest of O2's space. That may not be what you want. To set A to be three rows high as measured in A's font, you would do
1 |
glk_window_set_arrangement(o2, winmethod_Below | winmethod_Fixed, 3, a); |
Or you could change O2 to a proportional split:
1 |
glk_window_set_arrangement(o2, winmethod_Below | winmethod_Proportional, 30, NULL); |
or
1 |
glk_window_set_arrangement(o2, winmethod_Above | winmethod_Proportional, 70, NULL); |
These do exactly the same thing, since 30% above is the same as
70% below. You don't need to specify a key window with a proportional
split, so the keywin
argument is NULL
. (You could actually specify either A
or D as the key window, but it wouldn't affect the result.)
Whatever constraint you set, glk_window_get_size()
will tell you the actual
window size you got.
Note that you can resize windows, and alter the Border/NoBorder flag. But you can't flip or rotate them. You can't move A above D, or change O2 to a vertical split where A is left or right of D.
To get this effect you could close one of the windows, and re-split the
other one with glk_window_open()
.
win |
a pair window to rearrange. |
|
method |
new method of size computation. One of |
|
size |
new size constraint, in percentage points if |
|
keywin |
new key window, or |