summaryrefslogtreecommitdiffstats
path: root/CategoriesPanel.c
diff options
context:
space:
mode:
authorHisham Muhammad <hisham@gobolinux.org>2006-05-30 13:52:12 +0000
committerHisham Muhammad <hisham@gobolinux.org>2006-05-30 13:52:12 +0000
commit73de9f1ed4fad1c55a1116c411a1e8bb13c0ae72 (patch)
treefdf44194175e52255dd9bd6130062b2fdbb3fa7e /CategoriesPanel.c
parentc2cdcd0c1d2950291243b3a8645b5f061a0cdb2a (diff)
Rename ListBox'es to Panel's, matching dit.
Diffstat (limited to 'CategoriesPanel.c')
-rw-r--r--CategoriesPanel.c134
1 files changed, 134 insertions, 0 deletions
diff --git a/CategoriesPanel.c b/CategoriesPanel.c
new file mode 100644
index 00000000..2fc807f3
--- /dev/null
+++ b/CategoriesPanel.c
@@ -0,0 +1,134 @@
+
+#include "CategoriesPanel.h"
+#include "AvailableMetersPanel.h"
+#include "MetersPanel.h"
+#include "DisplayOptionsPanel.h"
+#include "ColumnsPanel.h"
+#include "ColorsPanel.h"
+#include "AvailableColumnsPanel.h"
+
+#include "Panel.h"
+
+#include "debug.h"
+#include <assert.h>
+
+/*{
+
+typedef struct CategoriesPanel_ {
+ Panel super;
+
+ Settings* settings;
+ ScreenManager* scr;
+} CategoriesPanel;
+
+}*/
+
+/* private property */
+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 "};
+
+CategoriesPanel* CategoriesPanel_new(Settings* settings, ScreenManager* scr) {
+ CategoriesPanel* this = (CategoriesPanel*) malloc(sizeof(CategoriesPanel));
+ Panel* super = (Panel*) this;
+ Panel_init(super, 1, 1, 1, 1, LISTITEM_CLASS, true);
+ ((Object*)this)->delete = CategoriesPanel_delete;
+
+ this->settings = settings;
+ this->scr = scr;
+ super->eventHandler = CategoriesPanel_eventHandler;
+ Panel_setHeader(super, "Setup");
+ Panel_add(super, (Object*) ListItem_new("Meters", 0));
+ Panel_add(super, (Object*) ListItem_new("Display options", 0));
+ Panel_add(super, (Object*) ListItem_new("Colors", 0));
+ Panel_add(super, (Object*) ListItem_new("Columns", 0));
+ return this;
+}
+
+void CategoriesPanel_delete(Object* object) {
+ Panel* super = (Panel*) object;
+ CategoriesPanel* this = (CategoriesPanel*) object;
+ Panel_done(super);
+ free(this);
+}
+
+HandlerResult CategoriesPanel_eventHandler(Panel* super, int ch) {
+ CategoriesPanel* this = (CategoriesPanel*) super;
+
+ HandlerResult result = IGNORED;
+
+ int previous = Panel_getSelectedIndex(super);
+
+ switch (ch) {
+ case KEY_UP:
+ case KEY_DOWN:
+ case KEY_NPAGE:
+ case KEY_PPAGE:
+ case KEY_HOME:
+ case KEY_END: {
+ Panel_onKey(super, ch);
+ int selected = Panel_getSelectedIndex(super);
+ if (previous != selected) {
+ int size = ScreenManager_size(this->scr);
+ for (int i = 1; i < size; i++)
+ ScreenManager_remove(this->scr, 1);
+ switch (selected) {
+ case 0:
+ CategoriesPanel_makeMetersPage(this);
+ break;
+ case 1:
+ CategoriesPanel_makeDisplayOptionsPage(this);
+ break;
+ case 2:
+ CategoriesPanel_makeColorsPage(this);
+ break;
+ case 3:
+ CategoriesPanel_makeColumnsPage(this);
+ break;
+ }
+ }
+ result = HANDLED;
+ }
+ }
+
+ return result;
+}
+
+void CategoriesPanel_makeMetersPage(CategoriesPanel* this) {
+ Panel* lbLeftMeters = (Panel*) MetersPanel_new(this->settings, "Left column", this->settings->header->leftMeters, this->scr);
+ Panel* lbRightMeters = (Panel*) MetersPanel_new(this->settings, "Right column", this->settings->header->rightMeters, this->scr);
+ Panel* lbAvailableMeters = (Panel*) AvailableMetersPanel_new(this->settings, lbLeftMeters, lbRightMeters, this->scr);
+ 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 CategoriesPanel_makeDisplayOptionsPage(CategoriesPanel* this) {
+ Panel* lbDisplayOptions = (Panel*) DisplayOptionsPanel_new(this->settings, this->scr);
+ ScreenManager_add(this->scr, lbDisplayOptions, FunctionBar_new(10, DisplayOptionsFunctions, NULL, NULL), -1);
+}
+
+void CategoriesPanel_makeColorsPage(CategoriesPanel* this) {
+ Panel* lbColors = (Panel*) ColorsPanel_new(this->settings, this->scr);
+ ScreenManager_add(this->scr, lbColors, FunctionBar_new(10, ColorsFunctions, NULL, NULL), -1);
+}
+
+void CategoriesPanel_makeColumnsPage(CategoriesPanel* this) {
+ Panel* lbColumns = (Panel*) ColumnsPanel_new(this->settings, this->scr);
+ Panel* lbAvailableColumns = (Panel*) AvailableColumnsPanel_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