summaryrefslogtreecommitdiffstats
path: root/Panel.c
diff options
context:
space:
mode:
authorBenny Baumann <BenBE@geshi.org>2020-11-01 01:09:51 +0100
committerBenny Baumann <BenBE@geshi.org>2020-11-02 22:15:01 +0100
commit45869513bfebba80cc2ab42e4218f68b34b1e6ac (patch)
treef064631dbff141bf1c945db8cff40b7bb82fd169 /Panel.c
parent61e14d4bb25268593019e6df3eb02264b4ac8e0e (diff)
Embracing branches
Diffstat (limited to 'Panel.c')
-rw-r--r--Panel.c22
1 files changed, 15 insertions, 7 deletions
diff --git a/Panel.c b/Panel.c
index 5e92c9c7..870f89cc 100644
--- a/Panel.c
+++ b/Panel.c
@@ -97,8 +97,10 @@ void Panel_move(Panel* this, int x, int y) {
void Panel_resize(Panel* this, int w, int h) {
assert (this != NULL);
- if (RichString_sizeVal(this->header) > 0)
+ if (RichString_sizeVal(this->header) > 0) {
h--;
+ }
+
this->w = w;
this->h = h;
this->needsRedraw = true;
@@ -145,33 +147,38 @@ Object* Panel_remove(Panel* this, int i) {
this->needsRedraw = true;
Object* removed = Vector_remove(this->items, i);
- if (this->selected > 0 && this->selected >= Vector_size(this->items))
+ if (this->selected > 0 && this->selected >= Vector_size(this->items)) {
this->selected--;
+ }
+
return removed;
}
Object* Panel_getSelected(Panel* this) {
assert (this != NULL);
- if (Vector_size(this->items) > 0)
+ if (Vector_size(this->items) > 0) {
return Vector_get(this->items, this->selected);
- else
+ } else {
return NULL;
+ }
}
void Panel_moveSelectedUp(Panel* this) {
assert (this != NULL);
Vector_moveUp(this->items, this->selected);
- if (this->selected > 0)
+ if (this->selected > 0) {
this->selected--;
+ }
}
void Panel_moveSelectedDown(Panel* this) {
assert (this != NULL);
Vector_moveDown(this->items, this->selected);
- if (this->selected + 1 < Vector_size(this->items))
+ if (this->selected + 1 < Vector_size(this->items)) {
this->selected++;
+ }
}
int Panel_getSelectedIndex(Panel* this) {
@@ -193,8 +200,9 @@ void Panel_setSelected(Panel* this, int selected) {
if (selected >= size) {
selected = size - 1;
}
- if (selected < 0)
+ if (selected < 0) {
selected = 0;
+ }
this->selected = selected;
if (Panel_eventHandlerFn(this)) {
Panel_eventHandler(this, EVENT_SET_SELECTED);

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