diff options
author | Eugene V. Lyubimkin <jackyf.devel@gmail.com> | 2008-11-16 20:36:18 +0200 |
---|---|---|
committer | Daniel Lange <DLange@git.local> | 2016-04-11 13:00:23 +0200 |
commit | bcb965d78ae0b4599fe77a2d641b3ff035658fc9 (patch) | |
tree | 59066e7fa5473b02eefaea37ac015cfaea7cd7c6 /CheckItem.c | |
parent | 2eabf3432b05b93ce4de9af283ae549d0f7c18c8 (diff) | |
parent | c74c38760df69bb87e93dff18cf91464e5d02f37 (diff) | |
download | debian_htop-bcb965d78ae0b4599fe77a2d641b3ff035658fc9.tar.gz debian_htop-bcb965d78ae0b4599fe77a2d641b3ff035658fc9.tar.bz2 debian_htop-bcb965d78ae0b4599fe77a2d641b3ff035658fc9.zip |
Imported Debian patch 0.8.1-1debian/0.8.1-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); -} |