aboutsummaryrefslogtreecommitdiffstats
path: root/CategoriesListBox.c
diff options
context:
space:
mode:
authorDaniel Lange <DLange@git.local>2016-04-11 13:00:19 +0200
committerDaniel Lange <DLange@git.local>2016-04-11 13:00:19 +0200
commit266ab52b3a741a58fb17c48b0f7939d7c5d266de (patch)
treeb4bccc59b9a35f3acbe7560f3d633940c71aedef /CategoriesListBox.c
parent2c8c1a156130aa40be7dcaeb3ce2977a03cf50c2 (diff)
downloaddebian_htop-266ab52b3a741a58fb17c48b0f7939d7c5d266de.tar.gz
debian_htop-266ab52b3a741a58fb17c48b0f7939d7c5d266de.tar.bz2
debian_htop-266ab52b3a741a58fb17c48b0f7939d7c5d266de.zip
Imported Upstream version 0.6upstream/0.6
Diffstat (limited to 'CategoriesListBox.c')
-rw-r--r--CategoriesListBox.c50
1 files changed, 32 insertions, 18 deletions
diff --git a/CategoriesListBox.c b/CategoriesListBox.c
index 249f75c..e846a57 100644
--- a/CategoriesListBox.c
+++ b/CategoriesListBox.c
@@ -3,7 +3,9 @@
#include "AvailableMetersListBox.h"
#include "MetersListBox.h"
#include "DisplayOptionsListBox.h"
+#include "ColumnsListBox.h"
#include "ColorsListBox.h"
+#include "AvailableColumnsListBox.h"
#include "ListBox.h"
@@ -22,14 +24,23 @@ typedef struct CategoriesListBox_ {
}*/
/* private property */
-char* MetersFunctions[10] = {" ", " ", " ", "Type ", "Add L ", "Add R ", "MoveUp", "MoveDn", "Remove", "Done "};
+char* MetersFunctions[10] = {" ", " ", " ", "Type ", " ", " ", "MoveUp", "MoveDn", "Remove", "Done "};
+
+/* private property */
+char* AvailableMetersFunctions[10] = {" ", " ", " ", " ", "Add L ", "Add R ", " ", " ", " ", "Done "};
/* private property */
char* DisplayOptionsFunctions[10] = {" ", " ", " ", " ", " ", " ", " ", " ", " ", "Done "};
/* private property */
+char* ColumnsFunctions[10] = {" ", " ", " ", " ", " ", " ", "MoveUp", "MoveDn", "Remove", "Done "};
+
+/* private property */
char* ColorsFunctions[10] = {" ", " ", " ", " ", " ", " ", " ", " ", " ", "Done "};
+/* private property */
+char* AvailableColumnsFunctions[10] = {" ", " ", " ", " ", "Add ", " ", " ", " ", " ", "Done "};
+
CategoriesListBox* CategoriesListBox_new(Settings* settings, ScreenManager* scr) {
CategoriesListBox* this = (CategoriesListBox*) malloc(sizeof(CategoriesListBox));
ListBox* super = (ListBox*) this;
@@ -39,10 +50,11 @@ CategoriesListBox* CategoriesListBox_new(Settings* settings, ScreenManager* scr)
this->settings = settings;
this->scr = scr;
super->eventHandler = CategoriesListBox_eventHandler;
- ListBox_setHeader(super, RichString_quickString(CRT_colors[PANEL_HEADER_FOCUS], "Setup"));
- ListBox_add(super, (Object*) ListItem_new(String_copy("Meters")));
- ListBox_add(super, (Object*) ListItem_new(String_copy("Display options")));
- ListBox_add(super, (Object*) ListItem_new(String_copy("Colors")));
+ ListBox_setHeader(super, "Setup");
+ ListBox_add(super, (Object*) ListItem_new("Meters", 0));
+ ListBox_add(super, (Object*) ListItem_new("Display options", 0));
+ ListBox_add(super, (Object*) ListItem_new("Colors", 0));
+ ListBox_add(super, (Object*) ListItem_new("Columns", 0));
return this;
}
@@ -83,6 +95,9 @@ HandlerResult CategoriesListBox_eventHandler(ListBox* super, int ch) {
case 2:
CategoriesListBox_makeColorsPage(this);
break;
+ case 3:
+ CategoriesListBox_makeColumnsPage(this);
+ break;
}
}
result = HANDLED;
@@ -92,29 +107,28 @@ HandlerResult CategoriesListBox_eventHandler(ListBox* super, int ch) {
return result;
}
-// TODO: factor out common code from these functions into a generic makePage
-
void CategoriesListBox_makeMetersPage(CategoriesListBox* this) {
- FunctionBar* fuBar = FunctionBar_new(10, MetersFunctions, NULL, NULL);
ListBox* lbLeftMeters = (ListBox*) MetersListBox_new(this->settings, "Left column", this->settings->header->leftMeters, this->scr);
ListBox* lbRightMeters = (ListBox*) MetersListBox_new(this->settings, "Right column", this->settings->header->rightMeters, this->scr);
ListBox* lbAvailableMeters = (ListBox*) AvailableMetersListBox_new(this->settings, lbLeftMeters, lbRightMeters, this->scr);
- ScreenManager_add(this->scr, lbLeftMeters, 20);
- ScreenManager_add(this->scr, lbRightMeters, 20);
- ScreenManager_add(this->scr, lbAvailableMeters, -1);
- ScreenManager_setFunctionBar(this->scr, fuBar);
+ ScreenManager_add(this->scr, lbLeftMeters, FunctionBar_new(10, MetersFunctions, NULL, NULL), 20);
+ ScreenManager_add(this->scr, lbRightMeters, FunctionBar_new(10, MetersFunctions, NULL, NULL), 20);
+ ScreenManager_add(this->scr, lbAvailableMeters, FunctionBar_new(10, AvailableMetersFunctions, NULL, NULL), -1);
}
void CategoriesListBox_makeDisplayOptionsPage(CategoriesListBox* this) {
- FunctionBar* fuBar = FunctionBar_new(10, DisplayOptionsFunctions, NULL, NULL);
ListBox* lbDisplayOptions = (ListBox*) DisplayOptionsListBox_new(this->settings, this->scr);
- ScreenManager_add(this->scr, lbDisplayOptions, -1);
- ScreenManager_setFunctionBar(this->scr, fuBar);
+ ScreenManager_add(this->scr, lbDisplayOptions, FunctionBar_new(10, DisplayOptionsFunctions, NULL, NULL), -1);
}
void CategoriesListBox_makeColorsPage(CategoriesListBox* this) {
- FunctionBar* fuBar = FunctionBar_new(10, ColorsFunctions, NULL, NULL);
ListBox* lbColors = (ListBox*) ColorsListBox_new(this->settings, this->scr);
- ScreenManager_add(this->scr, lbColors, -1);
- ScreenManager_setFunctionBar(this->scr, fuBar);
+ ScreenManager_add(this->scr, lbColors, FunctionBar_new(10, ColorsFunctions, NULL, NULL), -1);
+}
+
+void CategoriesListBox_makeColumnsPage(CategoriesListBox* this) {
+ ListBox* lbColumns = (ListBox*) ColumnsListBox_new(this->settings, this->scr);
+ ListBox* lbAvailableColumns = (ListBox*) AvailableColumnsListBox_new(this->settings, lbColumns, this->scr);
+ ScreenManager_add(this->scr, lbColumns, FunctionBar_new(10, ColumnsFunctions, NULL, NULL), 20);
+ ScreenManager_add(this->scr, lbAvailableColumns, FunctionBar_new(10, AvailableColumnsFunctions, NULL, NULL), -1);
}

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