mirror of
https://github.com/dankamongmen/notcurses
synced 2025-03-09 17:19:03 -04:00
add ncplane_set_resizecb() #1124
This commit is contained in:
parent
a5b6ce135d
commit
6084105c68
1
NEWS.md
1
NEWS.md
@ -10,6 +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()`.
|
||||||
|
|
||||||
* 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.
|
||||||
|
7
USAGE.md
7
USAGE.md
@ -670,6 +670,13 @@ struct ncplane* ncplane_create(struct ncplane* n, const ncplane_options* nopts);
|
|||||||
// 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.
|
||||||
struct ncplane* ncplane_reparent(struct ncplane* n, struct ncplane* newparent);
|
struct ncplane* ncplane_reparent(struct ncplane* n, struct ncplane* newparent);
|
||||||
|
|
||||||
|
// Replace the ncplane's existing resizecb with 'resizecb' (which may be NULL).
|
||||||
|
void ncplane_set_resizecb(struct ncplane* n, int(*resizecb)(struct ncplane*));
|
||||||
|
|
||||||
|
// Suitable for use as a 'resizecb'. This will realign the plane 'n' against its
|
||||||
|
// parent, using the alignment specified at ncplane_create()-time.
|
||||||
|
int ncplane_resize_realign(struct ncplane* n);
|
||||||
|
|
||||||
// Get the plane to which the plane 'n' is bound, if any.
|
// Get the plane to which the plane 'n' is bound, if any.
|
||||||
struct ncplane* ncplane_parent(struct ncplane* n);
|
struct ncplane* ncplane_parent(struct ncplane* n);
|
||||||
const struct ncplane* ncplane_parent_const(const struct ncplane* n);
|
const struct ncplane* ncplane_parent_const(const struct ncplane* n);
|
||||||
|
@ -33,6 +33,10 @@ typedef struct ncplane_options {
|
|||||||
|
|
||||||
**struct ncplane* ncplane_reparent(struct ncplane* ***n***, struct ncplane* ***newparent***);**
|
**struct ncplane* ncplane_reparent(struct ncplane* ***n***, struct ncplane* ***newparent***);**
|
||||||
|
|
||||||
|
**int ncplane_resize_realign(struct ncplane* ***n***);**
|
||||||
|
|
||||||
|
**void ncplane_set_resizecb(struct ncplane* ***n***, int(*resizecb)(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***);**
|
||||||
|
@ -1049,10 +1049,13 @@ API struct ncplane* ncplane_create(struct ncplane* n, const ncplane_options* nop
|
|||||||
API struct ncplane* ncplane_new(struct ncplane* n, int rows, int cols, int y, int x, void* opaque, const char* name)
|
API struct ncplane* ncplane_new(struct ncplane* n, int rows, int cols, int y, int x, void* opaque, const char* name)
|
||||||
__attribute__ ((deprecated));
|
__attribute__ ((deprecated));
|
||||||
|
|
||||||
// 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.
|
||||||
API int ncplane_resize_realign(struct ncplane* n);
|
API int ncplane_resize_realign(struct ncplane* n);
|
||||||
|
|
||||||
|
// Replace the ncplane's existing resizecb with 'resizecb' (which may be NULL).
|
||||||
|
API void ncplane_set_resizecb(struct ncplane* n, int(*resizecb)(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);
|
||||||
|
@ -2036,6 +2036,10 @@ const ncplane* ncplane_parent_const(const ncplane* n){
|
|||||||
return n->boundto;
|
return n->boundto;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ncplane_set_resizecb(ncplane* n, int(*resizecb)(ncplane*)){
|
||||||
|
n->resizecb = 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