mirror of
https://github.com/dankamongmen/notcurses
synced 2025-03-09 17:19:03 -04:00
add ncplane_resizecb() #1124
This commit is contained in:
parent
6084105c68
commit
c0cb5c7ff9
2
NEWS.md
2
NEWS.md
@ -10,7 +10,7 @@ rearrangements of Notcurses.
|
|||||||
self-documenting `struct ncplane_options` argument. So long as the
|
self-documenting `struct ncplane_options` argument. So long as the
|
||||||
arguments to `ncplane_new()` do not have side-effects, calls can be
|
arguments to `ncplane_new()` do not have side-effects, calls can be
|
||||||
mechanically translated to their `ncplane_create()` equivalents.
|
mechanically translated to their `ncplane_create()` equivalents.
|
||||||
* Added `nplane_set_resize()`.
|
* Added `ncplane_set_resizecb()` and `ncplane_resizecb()`.
|
||||||
|
|
||||||
* 2.0.4 (2020-11-10)
|
* 2.0.4 (2020-11-10)
|
||||||
* Fixed unit tests for non UTF-8 case, brown bagger, alas.
|
* Fixed unit tests for non UTF-8 case, brown bagger, alas.
|
||||||
|
3
USAGE.md
3
USAGE.md
@ -673,6 +673,9 @@ struct ncplane* ncplane_reparent(struct ncplane* n, struct ncplane* newparent);
|
|||||||
// Replace the ncplane's existing resizecb with 'resizecb' (which may be NULL).
|
// Replace the ncplane's existing resizecb with 'resizecb' (which may be NULL).
|
||||||
void ncplane_set_resizecb(struct ncplane* n, int(*resizecb)(struct ncplane*));
|
void ncplane_set_resizecb(struct ncplane* n, int(*resizecb)(struct ncplane*));
|
||||||
|
|
||||||
|
// Returns the ncplane's current resize callback.
|
||||||
|
int (*ncplane_resizecb(const struct ncplane* n))(struct ncplane*);
|
||||||
|
|
||||||
// Suitable for use as a 'resizecb'. This will realign the plane 'n' against its
|
// Suitable for use as a 'resizecb'. This will realign the plane 'n' against its
|
||||||
// parent, using the alignment specified at ncplane_create()-time.
|
// parent, using the alignment specified at ncplane_create()-time.
|
||||||
int ncplane_resize_realign(struct ncplane* n);
|
int ncplane_resize_realign(struct ncplane* n);
|
||||||
|
@ -37,6 +37,8 @@ typedef struct ncplane_options {
|
|||||||
|
|
||||||
**void ncplane_set_resizecb(struct ncplane* ***n***, int(*resizecb)(struct ncplane*));**
|
**void ncplane_set_resizecb(struct ncplane* ***n***, int(*resizecb)(struct ncplane*));**
|
||||||
|
|
||||||
|
**int (*ncplane_resizecb(const struct ncplane* ***n***))(struct ncplane*);**
|
||||||
|
|
||||||
**struct ncplane* ncplane_dup(struct ncplane* ***n***, void* ***opaque***);**
|
**struct ncplane* ncplane_dup(struct ncplane* ***n***, void* ***opaque***);**
|
||||||
|
|
||||||
**int ncplane_resize(struct ncplane* ***n***, int ***keepy***, int ***keepx***, int ***keepleny***, int ***keeplenx***, int ***yoff***, int ***xoff***, int ***ylen***, int ***xlen***);**
|
**int ncplane_resize(struct ncplane* ***n***, int ***keepy***, int ***keepx***, int ***keepleny***, int ***keeplenx***, int ***yoff***, int ***xoff***, int ***ylen***, int ***xlen***);**
|
||||||
|
@ -1056,6 +1056,9 @@ API int ncplane_resize_realign(struct ncplane* n);
|
|||||||
// Replace the ncplane's existing resizecb with 'resizecb' (which may be NULL).
|
// Replace the ncplane's existing resizecb with 'resizecb' (which may be NULL).
|
||||||
API void ncplane_set_resizecb(struct ncplane* n, int(*resizecb)(struct ncplane*));
|
API void ncplane_set_resizecb(struct ncplane* n, int(*resizecb)(struct ncplane*));
|
||||||
|
|
||||||
|
// Returns the ncplane's current resize callback.
|
||||||
|
API int (*ncplane_resizecb(const struct ncplane* n))(struct ncplane*);
|
||||||
|
|
||||||
// Plane 'n' will be unbound from its parent plane, if it is currently bound,
|
// Plane 'n' will be unbound from its parent plane, if it is currently bound,
|
||||||
// and will be made a bound child of 'newparent', if 'newparent' is not NULL.
|
// and will be made a bound child of 'newparent', if 'newparent' is not NULL.
|
||||||
API struct ncplane* ncplane_reparent(struct ncplane* n, struct ncplane* newparent);
|
API struct ncplane* ncplane_reparent(struct ncplane* n, struct ncplane* newparent);
|
||||||
|
@ -2040,6 +2040,10 @@ void ncplane_set_resizecb(ncplane* n, int(*resizecb)(ncplane*)){
|
|||||||
n->resizecb = resizecb;
|
n->resizecb = resizecb;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int (*ncplane_resizecb(const ncplane* n))(ncplane*){
|
||||||
|
return n->resizecb;
|
||||||
|
}
|
||||||
|
|
||||||
int ncplane_resize_realign(ncplane* n){
|
int ncplane_resize_realign(ncplane* n){
|
||||||
const ncplane* parent = ncplane_parent_const(n);
|
const ncplane* parent = ncplane_parent_const(n);
|
||||||
if(parent == n){ // somehow got stdplane, should never get here
|
if(parent == n){ // somehow got stdplane, should never get here
|
||||||
|
Loading…
x
Reference in New Issue
Block a user