~ubuntu-branches/ubuntu/dapper/htop/dapper

« back to all changes in this revision

Viewing changes to CategoriesListBox.c

  • Committer: Bazaar Package Importer
  • Author(s): Bartosz Fenski
  • Date: 2005-11-04 17:25:27 UTC
  • mfrom: (1.1.3 upstream)
  • Revision ID: james.westby@ubuntu.com-20051104172527-ob8flxaf5409e2y7
Tags: 0.5.4-1
* New upstream version.
  - does not leave cruft on console on exit. (Closes: #334657) 

Show diffs side-by-side

added added

removed removed

Lines of Context:
3
3
#include "AvailableMetersListBox.h"
4
4
#include "MetersListBox.h"
5
5
#include "DisplayOptionsListBox.h"
 
6
#include "ColorsListBox.h"
6
7
 
7
8
#include "ListBox.h"
8
9
 
26
27
/* private property */
27
28
char* DisplayOptionsFunctions[10] = {"      ", "      ", "      ", "      ", "      ", "      ", "      ", "      ", "      ", "Done  "};
28
29
 
 
30
/* private property */
 
31
char* ColorsFunctions[10] = {"      ", "      ", "      ", "      ", "      ", "      ", "      ", "      ", "      ", "Done  "};
 
32
 
29
33
CategoriesListBox* CategoriesListBox_new(Settings* settings, ScreenManager* scr) {
30
34
   CategoriesListBox* this = (CategoriesListBox*) malloc(sizeof(CategoriesListBox));
31
35
   ListBox* super = (ListBox*) this;
38
42
   ListBox_setHeader(super, RichString_quickString(CRT_colors[PANEL_HEADER_FOCUS], "Setup"));
39
43
   ListBox_add(super, (Object*) ListItem_new(String_copy("Meters")));
40
44
   ListBox_add(super, (Object*) ListItem_new(String_copy("Display options")));
 
45
   ListBox_add(super, (Object*) ListItem_new(String_copy("Colors")));
41
46
   return this;
42
47
}
43
48
 
73
78
                  CategoriesListBox_makeMetersPage(this);
74
79
                  break;
75
80
               case 1:
76
 
                  CategoriesListBox_makeProcessListPage(this);
 
81
                  CategoriesListBox_makeDisplayOptionsPage(this);
 
82
                  break;
 
83
               case 2:
 
84
                  CategoriesListBox_makeColorsPage(this);
77
85
                  break;
78
86
            }
79
87
         }
84
92
   return result;
85
93
}
86
94
 
 
95
// TODO: factor out common code from these functions into a generic makePage
 
96
 
87
97
void CategoriesListBox_makeMetersPage(CategoriesListBox* this) {
88
98
   FunctionBar* fuBar = FunctionBar_new(10, MetersFunctions, NULL, NULL);
89
99
   ListBox* lbLeftMeters = (ListBox*) MetersListBox_new(this->settings, "Left column", this->settings->header->leftMeters, this->scr);
95
105
   ScreenManager_setFunctionBar(this->scr, fuBar);
96
106
}
97
107
 
98
 
void CategoriesListBox_makeProcessListPage(CategoriesListBox* this) {
 
108
void CategoriesListBox_makeDisplayOptionsPage(CategoriesListBox* this) {
99
109
   FunctionBar* fuBar = FunctionBar_new(10, DisplayOptionsFunctions, NULL, NULL);
100
110
   ListBox* lbDisplayOptions = (ListBox*) DisplayOptionsListBox_new(this->settings, this->scr);
101
111
   ScreenManager_add(this->scr, lbDisplayOptions, -1);
102
112
   ScreenManager_setFunctionBar(this->scr, fuBar);
103
113
}
 
114
 
 
115
void CategoriesListBox_makeColorsPage(CategoriesListBox* this) {
 
116
   FunctionBar* fuBar = FunctionBar_new(10, ColorsFunctions, NULL, NULL);
 
117
   ListBox* lbColors = (ListBox*) ColorsListBox_new(this->settings, this->scr);
 
118
   ScreenManager_add(this->scr, lbColors, -1);
 
119
   ScreenManager_setFunctionBar(this->scr, fuBar);
 
120
}