summaryrefslogtreecommitdiffstats
path: root/MainPanel.c
diff options
context:
space:
mode:
authorChristian Göttsche <cgzones@googlemail.com>2020-12-16 21:46:11 +0100
committerChristian Göttsche <cgzones@googlemail.com>2020-12-20 17:01:50 +0100
commite3862aa67e37ecef0eb8f82ba1f4a710ffac9c02 (patch)
treeaa906dac3ffca307c01b9dc78ed75082aecf238c /MainPanel.c
parent7e7a53c415b82cceee6173922987b772b1d51c10 (diff)
Rework drawing of FunctionBar
Draw the FunctionBar within Panel_draw instead of manually throughout the code. Add an optional PanelClass function drawFunctionBar, to allow specific panels to override the default FunctionBar_draw call. Rework the code on color change, to really change all colors (selection markers and panel headers). Closes: #402
Diffstat (limited to 'MainPanel.c')
-rw-r--r--MainPanel.c19
1 files changed, 12 insertions, 7 deletions
diff --git a/MainPanel.c b/MainPanel.c
index 815609f6..949138dc 100644
--- a/MainPanel.c
+++ b/MainPanel.c
@@ -100,16 +100,12 @@ static HandlerResult MainPanel_eventHandler(Panel* super, int ch) {
if (reaction & HTOP_REDRAW_BAR) {
MainPanel_updateTreeFunctions(this, this->state->settings->treeView);
- IncSet_drawBar(this->inc);
- if (this->state->pauseProcessUpdate) {
- FunctionBar_append("PAUSED", CRT_colors[PAUSED]);
- }
}
if (reaction & HTOP_UPDATE_PANELHDR) {
ProcessList_printHeader(this->state->pl, Panel_getHeader(super));
}
if (reaction & HTOP_REFRESH) {
- result |= REDRAW;
+ result |= REFRESH;
}
if (reaction & HTOP_RECALCULATE) {
result |= RESCAN;
@@ -122,7 +118,7 @@ static HandlerResult MainPanel_eventHandler(Panel* super, int ch) {
}
if (!(reaction & HTOP_KEEP_FOLLOWING)) {
this->state->pl->following = -1;
- Panel_setSelectionColor(super, CRT_colors[PANEL_SELECTION_FOCUS]);
+ Panel_setSelectionColor(super, PANEL_SELECTION_FOCUS);
}
return result;
}
@@ -164,12 +160,21 @@ bool MainPanel_foreachProcess(MainPanel* this, MainPanel_ForeachProcessFn fn, Ar
return ok;
}
+static void MainPanel_drawFunctionBar(Panel* super) {
+ MainPanel* this = (MainPanel*) super;
+ IncSet_drawBar(this->inc);
+ if (this->state->pauseProcessUpdate) {
+ FunctionBar_append("PAUSED", CRT_colors[PAUSED]);
+ }
+}
+
const PanelClass MainPanel_class = {
.super = {
.extends = Class(Panel),
.delete = MainPanel_delete
},
- .eventHandler = MainPanel_eventHandler
+ .eventHandler = MainPanel_eventHandler,
+ .drawFunctionBar = MainPanel_drawFunctionBar
};
MainPanel* MainPanel_new() {

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