/*************************************************************************** * Copyright (C) 2008 by Andrzej Rybczak * * electricityispower@gmail.com * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ #ifndef HAVE_MENU_H #define HAVE_MENU_H #include "window.h" #include "strbuffer.h" //include //enum Location { lLeft, lCenter, lRight }; class List { public: class InvalidItem { }; List() { } virtual ~List() { }; virtual void Select(int, bool) = 0; virtual void Static(int, bool) = 0; virtual bool isSelected(int = -1) const = 0; virtual bool isStatic(int = -1) const = 0; virtual bool hasSelected() const = 0; virtual void GetSelected(std::vector &) const = 0; virtual void Highlight(size_t) = 0; virtual size_t Size() const = 0; virtual size_t Choice() const = 0; virtual size_t RealChoice() const = 0; }; template class Menu : public Window, public List { typedef void (*ItemDisplayer) (const T &, void *, Menu *); struct Option { Option() : Item(0), isBold(0), isSelected(0), isStatic(0), haveSeparator(0) { } T *Item; bool isBold; bool isSelected; bool isStatic; bool haveSeparator; }; typedef typename std::vector