diff options
author | Daniel Lange <DLange@git.local> | 2020-12-07 10:26:01 +0100 |
---|---|---|
committer | Daniel Lange <DLange@git.local> | 2020-12-07 10:26:01 +0100 |
commit | 65357c8c46154de4e4eca14075bfe5523bb5fc14 (patch) | |
tree | 8f430ee5a0d5de377c4e7c94e47842a27c70d7e8 /CheckItem.c | |
parent | f80394a20254938142011855f2954b3f63fe5909 (diff) | |
download | debian_htop-65357c8c46154de4e4eca14075bfe5523bb5fc14.tar.gz debian_htop-65357c8c46154de4e4eca14075bfe5523bb5fc14.tar.bz2 debian_htop-65357c8c46154de4e4eca14075bfe5523bb5fc14.zip |
New upstream version 3.0.3upstream/3.0.3
Diffstat (limited to 'CheckItem.c')
-rw-r--r-- | CheckItem.c | 69 |
1 files changed, 0 insertions, 69 deletions
diff --git a/CheckItem.c b/CheckItem.c deleted file mode 100644 index d14149e..0000000 --- a/CheckItem.c +++ /dev/null @@ -1,69 +0,0 @@ -/* -htop - CheckItem.c -(C) 2004-2011 Hisham H. Muhammad -Released under the GNU GPL, see the COPYING file -in the source distribution for its full text. -*/ - -#include "CheckItem.h" - -#include "CRT.h" - -#include <assert.h> -#include <stdlib.h> - - -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); -} - -ObjectClass CheckItem_class = { - .display = CheckItem_display, - .delete = CheckItem_delete -}; - -CheckItem* CheckItem_newByRef(char* text, bool* ref) { - CheckItem* this = AllocThis(CheckItem); - this->text = text; - this->value = false; - this->ref = ref; - return this; -} - -CheckItem* CheckItem_newByVal(char* text, bool value) { - CheckItem* this = AllocThis(CheckItem); - this->text = text; - this->value = value; - this->ref = NULL; - return this; -} - -void CheckItem_set(CheckItem* this, bool value) { - if (this->ref) - *(this->ref) = value; - else - this->value = value; -} - -bool CheckItem_get(CheckItem* this) { - if (this->ref) - return *(this->ref); - else - return this->value; -} |