From fc2f5b2cd655f1391f2abda1b39e37cdec98a951 Mon Sep 17 00:00:00 2001 From: Felix Domke Date: Fri, 17 Oct 2003 15:35:43 +0000 Subject: Initial revision --- lib/gui/multipage.cpp | 64 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 lib/gui/multipage.cpp (limited to 'lib/gui/multipage.cpp') diff --git a/lib/gui/multipage.cpp b/lib/gui/multipage.cpp new file mode 100644 index 00000000..e494078d --- /dev/null +++ b/lib/gui/multipage.cpp @@ -0,0 +1,64 @@ +#include +#include +#include + +eMultipage::eMultipage() +{ +} + +int eMultipage::prev() +{ + if (list.current() == list.begin()) + return -ENOENT; + if (list.current() != list.end()) + list.current()->hide(); + list.prev(); + list.current()->show(); + return 0; +} + +int eMultipage::next() +{ + if (list.current() == *--list.end()) + return -ENOENT; + list.current()->hide(); + list.next(); + if (list.current() == list.end()) + return 0; + list.current()->show(); + return 0; +} + +void eMultipage::set(eWidget *widget) +{ + if (list.current() == widget) + return; + if (list.current() != list.end()) + list.current()->hide(); + list.setCurrent(widget); + if (list.current() != list.end()) + list.current()->show(); +} + +void eMultipage::first() +{ + if (list.current() == list.begin()) + return; + if (list.current() != list.end()) + list.current()->hide(); + list.first(); + if (list.current() != list.end()) + list.current()->show(); +} + +int eMultipage::at() +{ + int num=0; + for (ePtrList::iterator i(list.begin()); (i != list.end()) && (i != list.current()); ++i, ++num) ; + return num; +} + +void eMultipage::addPage(eWidget *page) +{ + list.push_back(page); +} -- cgit v1.2.3