diff options
author | Daniel Lange <DLange@git.local> | 2016-04-11 13:00:22 +0200 |
---|---|---|
committer | Daniel Lange <DLange@git.local> | 2016-04-11 13:00:22 +0200 |
commit | c74c38760df69bb87e93dff18cf91464e5d02f37 (patch) | |
tree | ee2a19a0ef3a808bdfc8c1e6a00e96d79966dcb0 /CheckItem.c | |
parent | 9379132a8234eeedf62d37ef57713e52c12db6ab (diff) | |
download | debian_htop-c74c38760df69bb87e93dff18cf91464e5d02f37.tar.gz debian_htop-c74c38760df69bb87e93dff18cf91464e5d02f37.tar.bz2 debian_htop-c74c38760df69bb87e93dff18cf91464e5d02f37.zip |
Imported Upstream version 0.8.1upstream/0.8.1
Diffstat (limited to 'CheckItem.c')
-rw-r--r-- | CheckItem.c | 40 |
1 files changed, 20 insertions, 20 deletions
diff --git a/CheckItem.c b/CheckItem.c index 45c0b22..3808f7a 100644 --- a/CheckItem.c +++ b/CheckItem.c @@ -28,6 +28,26 @@ char* CHECKITEM_CLASS = "CheckItem"; #define CHECKITEM_CLASS NULL #endif +static void CheckItem_delete(Object* cast) { + CheckItem* this = (CheckItem*)cast; + assert (this != NULL); + + free(this->text); + free(this); +} + +static void CheckItem_display(Object* cast, RichString* out) { + CheckItem* this = (CheckItem*)cast; + assert (this != NULL); + RichString_write(out, CRT_colors[CHECK_BOX], "["); + if (CheckItem_get(this)) + RichString_append(out, CRT_colors[CHECK_MARK], "x"); + else + RichString_append(out, CRT_colors[CHECK_MARK], " "); + RichString_append(out, CRT_colors[CHECK_BOX], "] "); + RichString_append(out, CRT_colors[CHECK_TEXT], this->text); +} + CheckItem* CheckItem_new(char* text, bool* ref, bool value) { CheckItem* this = malloc(sizeof(CheckItem)); Object_setClass(this, CHECKITEM_CLASS); @@ -39,14 +59,6 @@ CheckItem* CheckItem_new(char* text, bool* ref, bool value) { return this; } -void CheckItem_delete(Object* cast) { - CheckItem* this = (CheckItem*)cast; - assert (this != NULL); - - free(this->text); - free(this); -} - void CheckItem_set(CheckItem* this, bool value) { if (this->ref) *(this->ref) = value; @@ -60,15 +72,3 @@ bool CheckItem_get(CheckItem* this) { else return this->value; } - -void CheckItem_display(Object* cast, RichString* out) { - CheckItem* this = (CheckItem*)cast; - assert (this != NULL); - RichString_write(out, CRT_colors[CHECK_BOX], "["); - if (CheckItem_get(this)) - RichString_append(out, CRT_colors[CHECK_MARK], "x"); - else - RichString_append(out, CRT_colors[CHECK_MARK], " "); - RichString_append(out, CRT_colors[CHECK_BOX], "] "); - RichString_append(out, CRT_colors[CHECK_TEXT], this->text); -} |