13
static void scaleDraw(newtComponent co);
15
static struct componentOps scaleOps = {
17
newtDefaultEventHandler,
19
newtDefaultPlaceHandler,
20
newtDefaultMappedHandler,
23
newtComponent newtScale(int left, int top, int width, long long fullValue) {
27
co = malloc(sizeof(*co));
28
sc = malloc(sizeof(struct scale));
39
sc->fullValue = fullValue;
45
void newtScaleSet(newtComponent co, unsigned long long amount) {
46
struct scale * sc = co->data;
49
newCharsSet = (amount * co->width) / sc->fullValue;
51
if (newCharsSet != sc->charsSet) {
52
sc->charsSet = newCharsSet;
57
static void scaleDraw(newtComponent co) {
58
struct scale * sc = co->data;
62
if (co->top == -1) return;
64
newtGotorc(co->top, co->left);
66
c = SLtt_Use_Ansi_Colors ? ' ' : '-';
67
newtColor(NEWT_COLORSET_FULLSCALE);
68
for (i = 0; i < sc->charsSet; i++)
71
newtColor(NEWT_COLORSET_EMPTYSCALE);
72
for (i = 0; i < (co->width - sc->charsSet); i++)