diff options
author | Robin Haberkorn <robin.haberkorn@googlemail.com> | 2016-01-31 06:58:18 +0100 |
---|---|---|
committer | Robin Haberkorn <robin.haberkorn@googlemail.com> | 2016-01-31 06:58:18 +0100 |
commit | d7e4aa16ecb0595ff0248e17fcdcfc09c7616ca0 (patch) | |
tree | 6903f426e8ee97d79c30626050a67d3686ce97cb /src/interface-curses/interface-curses.h | |
parent | 406cf5a58b5873f89df710d56883039ff496580e (diff) | |
download | sciteco-d7e4aa16ecb0595ff0248e17fcdcfc09c7616ca0.tar.gz |
CursesInfoPopup: separated the Curses popup widget from the rest of the UI code
* this has been prepared a long time ago
* the popup widget does not in any way depend on the InterfaceCurses
class and could be used elsewhere.
* common and generic Curses drawing functions required by both the
Curses UI and the CursesInfoPopup widget have been factored out
into curses-utils.cpp (namespace Curses)
* this improved the UI-logic separation and helped in making
interface-curses.cpp smaller
Diffstat (limited to 'src/interface-curses/interface-curses.h')
-rw-r--r-- | src/interface-curses/interface-curses.h | 51 |
1 files changed, 5 insertions, 46 deletions
diff --git a/src/interface-curses/interface-curses.h b/src/interface-curses/interface-curses.h index a6b0e1c..f29b1b4 100644 --- a/src/interface-curses/interface-curses.h +++ b/src/interface-curses/interface-curses.h @@ -28,6 +28,7 @@ #include <ScintillaTerm.h> #include "interface.h" +#include "curses-info-popup.h" namespace SciTECO { @@ -114,51 +115,7 @@ typedef class InterfaceCurses : public Interface<InterfaceCurses, ViewCurses> { WINDOW *cmdline_window, *cmdline_pad; gsize cmdline_len, cmdline_rubout_len; - class Popup { - WINDOW *window; /**! window showing part of pad */ - WINDOW *pad; /**! full-height entry list */ - - struct Entry { - PopupEntryType type; - bool highlight; - gchar name[]; - }; - - GSList *list; /**! list of popup entries */ - gint longest; /**! size of longest entry */ - gint length; /**! total number of popup entries */ - - gint pad_first_line; /**! first line in pad to show */ - - public: - Popup() : window(NULL), pad(NULL), - list(NULL), longest(0), length(0), - pad_first_line(0) {} - - void add(PopupEntryType type, - const gchar *name, bool highlight = false); - - void show(attr_t attr); - inline bool - is_shown(void) - { - return window != NULL; - } - - void clear(void); - - inline void - noutrefresh(void) - { - if (window) - wnoutrefresh(window); - } - - ~Popup(); - - private: - void init_pad(attr_t attr); - } popup; + CursesInfoPopup popup; public: InterfaceCurses(); @@ -190,9 +147,11 @@ public: popup_add_impl(PopupEntryType type, const gchar *name, bool highlight = false) { + /* FIXME: The enum casting is dangerous */ if (cmdline_window) /* interactive mode */ - popup.add(type, name, highlight); + popup.add((CursesInfoPopup::PopupEntryType)type, + name, highlight); } /* implementation of Interface::popup_show() */ |