diff options
author | Daniel Lange <DLange@git.local> | 2016-04-11 13:00:19 +0200 |
---|---|---|
committer | Daniel Lange <DLange@git.local> | 2016-04-11 13:00:19 +0200 |
commit | 266ab52b3a741a58fb17c48b0f7939d7c5d266de (patch) | |
tree | b4bccc59b9a35f3acbe7560f3d633940c71aedef /ListBox.c | |
parent | 2c8c1a156130aa40be7dcaeb3ce2977a03cf50c2 (diff) | |
download | debian_htop-266ab52b3a741a58fb17c48b0f7939d7c5d266de.tar.gz debian_htop-266ab52b3a741a58fb17c48b0f7939d7c5d266de.tar.bz2 debian_htop-266ab52b3a741a58fb17c48b0f7939d7c5d266de.zip |
Imported Upstream version 0.6upstream/0.6
Diffstat (limited to 'ListBox.c')
-rw-r--r-- | ListBox.c | 21 |
1 files changed, 18 insertions, 3 deletions
@@ -30,7 +30,7 @@ typedef enum HandlerResult_ { BREAK_LOOP } HandlerResult; -typedef HandlerResult(*ListBox_eventHandler)(ListBox*, int); +typedef HandlerResult(*ListBox_EventHandler)(ListBox*, int); struct ListBox_ { Object super; @@ -42,7 +42,7 @@ struct ListBox_ { int oldSelected; bool needsRedraw; RichString header; - ListBox_eventHandler eventHandler; + ListBox_EventHandler eventHandler; }; extern char* LISTBOX_CLASS; @@ -96,7 +96,7 @@ void ListBox_done(ListBox* this) { TypedVector_delete(this->items); } -void ListBox_setHeader(ListBox* this, RichString header) { +inline void ListBox_setRichHeader(ListBox* this, RichString header) { assert (this != NULL); if (this->header.len > 0) { @@ -106,6 +106,14 @@ void ListBox_setHeader(ListBox* this, RichString header) { this->needsRedraw = true; } +inline void ListBox_setHeader(ListBox* this, char* header) { + ListBox_setRichHeader(this, RichString_quickString(CRT_colors[PANEL_HEADER_FOCUS], header)); +} + +void ListBox_setEventHandler(ListBox* this, ListBox_EventHandler eh) { + this->eventHandler = eh; +} + void ListBox_move(ListBox* this, int x, int y) { assert (this != NULL); @@ -141,6 +149,13 @@ void ListBox_add(ListBox* this, Object* o) { this->needsRedraw = true; } +void ListBox_insert(ListBox* this, int i, Object* o) { + assert (this != NULL); + + TypedVector_insert(this->items, i, o); + this->needsRedraw = true; +} + void ListBox_set(ListBox* this, int i, Object* o) { assert (this != NULL); |