summaryrefslogtreecommitdiffstats
path: root/Source/CursesDialog/cmCursesOptionsWidget.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'Source/CursesDialog/cmCursesOptionsWidget.cxx')
-rw-r--r--Source/CursesDialog/cmCursesOptionsWidget.cxx45
1 files changed, 22 insertions, 23 deletions
diff --git a/Source/CursesDialog/cmCursesOptionsWidget.cxx b/Source/CursesDialog/cmCursesOptionsWidget.cxx
index 5892e53..9a88aef 100644
--- a/Source/CursesDialog/cmCursesOptionsWidget.cxx
+++ b/Source/CursesDialog/cmCursesOptionsWidget.cxx
@@ -13,10 +13,7 @@
#include "cmCursesMainForm.h"
-inline int ctrl(int z)
-{
- return (z & 037);
-}
+#define ctrl(z) ((z)&037)
cmCursesOptionsWidget::cmCursesOptionsWidget(int width, int height, int left,
int top)
@@ -34,25 +31,27 @@ cmCursesOptionsWidget::cmCursesOptionsWidget(int width, int height, int left,
bool cmCursesOptionsWidget::HandleInput(int& key, cmCursesMainForm* /*fm*/,
WINDOW* w)
{
-
- // 10 == enter
- if (key == 10 || key == KEY_ENTER) {
- this->NextOption();
- touchwin(w);
- wrefresh(w);
- return true;
- } else if (key == KEY_LEFT || key == ctrl('b')) {
- touchwin(w);
- wrefresh(w);
- this->PreviousOption();
- return true;
- } else if (key == KEY_RIGHT || key == ctrl('f')) {
- this->NextOption();
- touchwin(w);
- wrefresh(w);
- return true;
- } else {
- return false;
+ switch (key) {
+ case 10: // 10 == enter
+ case KEY_ENTER:
+ this->NextOption();
+ touchwin(w);
+ wrefresh(w);
+ return true;
+ case KEY_LEFT:
+ case ctrl('b'):
+ touchwin(w);
+ wrefresh(w);
+ this->PreviousOption();
+ return true;
+ case KEY_RIGHT:
+ case ctrl('f'):
+ this->NextOption();
+ touchwin(w);
+ wrefresh(w);
+ return true;
+ default:
+ return false;
}
}