-
-
Notifications
You must be signed in to change notification settings - Fork 112
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
After a long delay, apologies :) Added: * NotCurses: `can_sextant` (`notcurses_cansextant`) * Notcurses: `linesigs_enable` (`notcurses_linesigs_enable`) * Notcurses: `linesigs_disable` (`notcurses_linesigs_disable`) * Pile: `top_with` (`ncpile_top`) * Pile: `bottom_with` (`ncpile_bottom`) * Plane: `resize_maximize` (`ncplane_resize_maximize`) * Plane: `get_abs_x` (`ncplane_abs_x`) * Plane: `get_abs_y` (`ncplane_abs_y`) * Plane: `get_abs_yx` (`ncplane_abs_yx`) * Plane: `load_egc32` (`cell_load_egc32`) * Plane: `is_descendant_of` (`ncplane_descendant_p`) * Progbar: new class, wraps `ncprogbar_*` Changed: * Plane (ABI break): `at_cursor` overloads now return `int` where before they returned `bool` because the underlying Notcurses API only signalled the operation status with the return value while now it returns actual information.
- Loading branch information
1 parent
15d5c48
commit d32bef3
Showing
6 changed files
with
132 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
#ifndef __NCPP_PROGBAR_HH | ||
#define __NCPP_PROGBAR_HH | ||
|
||
#include <exception> | ||
#include <notcurses/notcurses.h> | ||
|
||
#include "NotCurses.hh" | ||
#include "Plane.hh" | ||
|
||
namespace ncpp | ||
{ | ||
class NCPP_API_EXPORT Progbar : public Root | ||
{ | ||
public: | ||
Progbar (Plane& n, const ncprogbar_options* opts) | ||
: Root (nullptr) | ||
{ | ||
if (opts == nullptr) { | ||
throw invalid_argument ("Argument 'opts' must be a valid pointer"); | ||
} | ||
|
||
progbar = ncprogbar_create (n, opts); | ||
if (progbar == nullptr) { | ||
throw init_error ("Notcurses failed to create ncprogbar"); | ||
} | ||
} | ||
|
||
~Progbar () | ||
{ | ||
if (!is_notcurses_stopped ()) { | ||
ncprogbar_destroy (progbar); | ||
} | ||
} | ||
|
||
Plane* get_plane () const noexcept | ||
{ | ||
ncplane *ret = ncprogbar_plane (progbar); | ||
if (ret == nullptr) { | ||
return nullptr; | ||
} | ||
|
||
return Plane::map_plane (ret); | ||
} | ||
|
||
void set_progress (double p) const noexcept | ||
{ | ||
ncprogbar_set_progress (progbar, p); | ||
} | ||
|
||
double get_progress () const noexcept | ||
{ | ||
return ncprogbar_progress (progbar); | ||
} | ||
|
||
private: | ||
ncprogbar *progbar = nullptr; | ||
}; | ||
} | ||
|
||
#endif // __NCPP_PROGBAR_HH |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters