aboutsummaryrefslogtreecommitdiffstats
path: root/ListItem.c
diff options
context:
space:
mode:
authorDaniel Lange <DLange@git.local>2016-04-11 13:00:15 +0200
committerDaniel Lange <DLange@git.local>2016-04-11 13:00:15 +0200
commitd3c9975943df58e293359b87905d19ff1fd52061 (patch)
treee416378879f60e8d538b1b25963904f767d30ff4 /ListItem.c
downloaddebian_htop-d3c9975943df58e293359b87905d19ff1fd52061.tar.gz
debian_htop-d3c9975943df58e293359b87905d19ff1fd52061.tar.bz2
debian_htop-d3c9975943df58e293359b87905d19ff1fd52061.zip
Imported Upstream version 0.5upstream/0.5
Diffstat (limited to 'ListItem.c')
-rw-r--r--ListItem.c48
1 files changed, 48 insertions, 0 deletions
diff --git a/ListItem.c b/ListItem.c
new file mode 100644
index 0000000..840ca98
--- /dev/null
+++ b/ListItem.c
@@ -0,0 +1,48 @@
+/*
+htop
+(C) 2004 Hisham H. Muhammad
+Released under the GNU GPL, see the COPYING file
+in the source distribution for its full text.
+*/
+
+#include "ListItem.h"
+#include "Object.h"
+#include "CRT.h"
+
+#include "debug.h"
+
+/*{
+
+typedef struct ListItem_ {
+ Object super;
+ char* text;
+} ListItem;
+
+extern char* LISTITEM_CLASS;
+}*/
+
+/* private property */
+char* LISTITEM_CLASS = "ListItem";
+
+ListItem* ListItem_new(char* text) {
+ ListItem* this = malloc(sizeof(ListItem));
+ ((Object*)this)->class = LISTITEM_CLASS;
+ ((Object*)this)->display = ListItem_display;
+ ((Object*)this)->delete = ListItem_delete;
+ this->text = text;
+ return this;
+}
+
+void ListItem_delete(Object* cast) {
+ ListItem* this = (ListItem*)cast;
+ assert (this != NULL);
+
+ free(this->text);
+ free(this);
+}
+
+void ListItem_display(Object* cast, RichString* out) {
+ ListItem* this = (ListItem*)cast;
+ assert (this != NULL);
+ RichString_write(out, CRT_colors[DEFAULT_COLOR], this->text);
+}

© 2014-2024 Faster IT GmbH | imprint | privacy policy