Thread: [Libufo-commits] ufo-0.5/include/ufo/widgets ustackwidget.hpp,NONE,1.1 utabbar.hpp,NONE,1.1 utabwidg
Status: Beta
Brought to you by:
schmidtjf
|
From: Johannes S. <sch...@us...> - 2005-10-24 15:52:23
|
Update of /cvsroot/libufo/ufo-0.5/include/ufo/widgets In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30102/include/ufo/widgets Added Files: ustackwidget.hpp utabbar.hpp utabwidget.hpp Log Message: Added tab widget, tab bar and stack widget. --- NEW FILE: utabbar.hpp --- /*************************************************************************** LibUFO - UI For OpenGL copyright : (C) 2001-2005 by Johannes Schmidt email : schmidtjf at users.sourceforge.net ------------------- file : include/ufo/widgets/utabbar.hpp begin : Fri Sep 23 2005 $Id: utabbar.hpp,v 1.1 2005/10/24 15:52:02 schmidtjf Exp $ ***************************************************************************/ /*************************************************************************** * This library is free software; you can redistribute it and/or * * modify it under the terms of the GNU Lesser General Public * * License as published by the Free Software Foundation; either * * version 2.1 of the License, or (at your option) any later version. * * * * This library 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 * * Lesser General Public License for more details. * * * * You should have received a copy of the GNU Lesser General Public * * License along with this library; if not, write to the Free Software * * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * ***************************************************************************/ #ifndef UTABBAR_HPP #define UTABBAR_HPP #include "uwidget.hpp" namespace ufo { /** @short A tab bar provides a box of tabs which may be used to select * tab panels of a tab widgets. * @ingroup widgets * * * @author Johannes Schmidt */ class UFO_EXPORT UTabBar : public UWidget { UFO_DECLARE_CLASS(UTabBar) public: UTabBar(); virtual ~UTabBar(); public: // Public methods void addTab(const std::string & label); /** Removes the tab at the given index and eventually resets * the selected index. */ void removeTab(int index); void setSelectedIndex(int index); int getSelectedIndex() const; /** Returns the label of the tab bar tab with the given index * or "" if the index is out of range. */ std::string getTabText(int index) const; /** Returns the index of the tab bar tab with the given label * or -1 if no tab has this label. */ int getTabIndex(const std::string & label) const; int getTabCount() const; private: int m_selectedIndex; public: // Public signals USignal1<UTabBar*> & sigSelectionChanged(); private: // Private signals USignal1<UTabBar*> m_sigSelectionChanged; }; // // inline implementation // inline USignal1<UTabBar*> & UTabBar::sigSelectionChanged() { return m_sigSelectionChanged; } } // namespace ufo #endif // UTABBAR_HPP --- NEW FILE: utabwidget.hpp --- /*************************************************************************** LibUFO - UI For OpenGL copyright : (C) 2001-2005 by Johannes Schmidt email : schmidtjf at users.sourceforge.net ------------------- file : include/ufo/widgets/utabwidget.hpp begin : Fri Sep 23 2005 $Id: utabwidget.hpp,v 1.1 2005/10/24 15:52:02 schmidtjf Exp $ ***************************************************************************/ /*************************************************************************** * This library is free software; you can redistribute it and/or * * modify it under the terms of the GNU Lesser General Public * * License as published by the Free Software Foundation; either * * version 2.1 of the License, or (at your option) any later version. * * * * This library 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 * * Lesser General Public License for more details. * * * * You should have received a copy of the GNU Lesser General Public * * License along with this library; if not, write to the Free Software * * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * ***************************************************************************/ #ifndef UTABWIDGET_HPP #define UTABWIDGET_HPP #include "uwidget.hpp" namespace ufo { class UStackWidget; class UTabBar; /** @short A tab widget provides a stack of widgets which order * may be changed via tabs. * @ingroup widgets * * * @author Johannes Schmidt */ class UFO_EXPORT UTabWidget : public UWidget { UFO_DECLARE_CLASS(UTabWidget) public: UTabWidget(); virtual ~UTabWidget(); public: // Public methods void addTab(UWidget * child, const std::string & label); void removeTab(int index); /** Returns the label of the tab bar tab with the given index * or "" if the index is out of range. */ std::string getTabText(int index) const; /** Returns the tab page with the given index * or NULL if the index is out of range. */ UWidget * getTabWidget(int index) const; /** Returns the index of the tab bar tab with the given label * or -1 if no tab has this label. */ int getTabIndex(const std::string & label) const; /** Returns the tab index for the given child (or -1). */ int getTabIndex(UWidget * child) const; void setSelectedIndex(int index); int getSelectedIndex() const; int getTabCount() const; protected: // Protected methods virtual void slotTabSelected(UTabBar * bar); public: // Public signals USignal1<UTabWidget*> & sigSelectionChanged(); private: // Private signals USignal1<UTabWidget*> m_sigSelectionChanged; private: UStackWidget * m_stackWidget; UTabBar * m_tabBar; }; // // inline implementation // inline USignal1<UTabWidget*> & UTabWidget::sigSelectionChanged() { return m_sigSelectionChanged; } } // namespace ufo #endif // UTABWIDGET_HPP --- NEW FILE: ustackwidget.hpp --- /*************************************************************************** LibUFO - UI For OpenGL copyright : (C) 2001-2005 by Johannes Schmidt email : schmidtjf at users.sourceforge.net ------------------- file : include/ufo/widgets/ustackwidget.hpp begin : Fri Sep 23 2005 $Id: ustackwidget.hpp,v 1.1 2005/10/24 15:52:02 schmidtjf Exp $ ***************************************************************************/ /*************************************************************************** * This library is free software; you can redistribute it and/or * * modify it under the terms of the GNU Lesser General Public * * License as published by the Free Software Foundation; either * * version 2.1 of the License, or (at your option) any later version. * * * * This library 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 * * Lesser General Public License for more details. * * * * You should have received a copy of the GNU Lesser General Public * * License along with this library; if not, write to the Free Software * * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * ***************************************************************************/ #ifndef USTACKWIDGET_HPP #define USTACKWIDGET_HPP #include "uwidget.hpp" namespace ufo { /** @short A stack widget orders its child widgets as stack. * @ingroup widgets * * There are two types of stacks. If exclusive mode is selected, only * the current selected widget is shown. Otherwise you get the whole stack * shown. * * @author Johannes Schmidt */ class UFO_EXPORT UStackWidget : public UWidget { UFO_DECLARE_CLASS(UStackWidget) public: /** Creates a stack widget which exclusively shows the selected widget. */ UStackWidget(); /** Creates a stack widget with the given selection mode. * FIXME: what is a selection mode, define selection model etc. */ UStackWidget(int selectionMode); public: // Public methods void setSelectedIndex(int index); int getSelectedIndex() const; protected: // Overrides UWidget virtual void addImpl(UWidget * w, UObject * constraints, int index); virtual bool removeImpl(int index); virtual UDimension getContentsSize(const UDimension & maxSize) const; private: int m_selectedIndex; int m_selectionMode; }; } // namespace ufo #endif // USTACKEDWIDGET_HPP |