/*************************************************************************** kilemultitabbar.h - description ------------------- begin : 2001 copyright : (C) 2001,2002,2003 by Joseph Wenninger ***************************************************************************/ /*************************************************************************** This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 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 Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. ***************************************************************************/ //FIXME: remove for the KDE4 version again #ifndef _KileMultitabbar_h_ #define _KileMultitabbar_h_ #include #include #include #include #include #include #include class TQPixmap; class TQPainter; class TQFrame; class KileMultiTabBarPrivate; class KileMultiTabBarTabPrivate; class KileMultiTabBarButtonPrivate; class KileMultiTabBarInternal; /** * @ingroup main * @ingroup multitabbar * A Widget for horizontal and vertical tabs. * It is possible to add normal buttons to the top/left * The handling if only one tab at a time or multiple tabs * should be raisable is left to the "user". *@author Joseph Wenninger */ class KileMultiTabBar: public TQWidget { Q_OBJECT public: /** * The tab bar's orientation. Also constraints the bar's position. */ enum KileMultiTabBarMode { Horizontal, ///* tabs(); /** * Returns the list of pointers to the tab buttons of type KileMultiTabBarButton. * @return The list of tab buttons. * @warning be careful, don't delete buttons yourself and don't delete the list itself */ TQPtrList* buttons(); /** * might vanish, not sure yet */ void showActiveTabTexts(bool show=true); protected: friend class KileMultiTabBarButton; virtual void fontChange( const TQFont& ); void updateSeparator(); private: class KileMultiTabBarInternal *m_internal; TQBoxLayout *m_l; TQFrame *m_btnTabSep; TQPtrList m_buttons; KileMultiTabBarPosition m_position; KileMultiTabBarPrivate *d; }; /** * @ingroup multitabbar * This class represents a tab bar button in a KileMultiTabBarWidget. * This class should never be created except with the appendButton call of KileMultiTabBar */ class KileMultiTabBarButton: public TQPushButton { Q_OBJECT public: /** @internal */ KileMultiTabBarButton(const TQPixmap& pic,const TQString&, TQPopupMenu *popup, int id,TQWidget *parent, KileMultiTabBar::KileMultiTabBarPosition pos, KileMultiTabBar::KileMultiTabBarStyle style); /** @internal */ KileMultiTabBarButton(const TQString&, TQPopupMenu *popup, int id,TQWidget *parent, KileMultiTabBar::KileMultiTabBarPosition pos, KileMultiTabBar::KileMultiTabBarStyle style); /** * Destructor */ virtual ~KileMultiTabBarButton(); /** * Returns the tab's ID * @return The tab's ID */ int id() const; public slots: /** * this is used internaly, but can be used by the user, if (s)he wants to * It the according call of KileMultiTabBar is invoked though this modifications will be overwritten */ void setPosition(KileMultiTabBar::KileMultiTabBarPosition); /** * this is used internaly, but can be used by the user, if (s)he wants to * It the according call of KileMultiTabBar is invoked though this modifications will be overwritten */ void setStyle(KileMultiTabBar::KileMultiTabBarStyle); /** * modify the text of the button */ void setText(const TQString &); TQSize sizeHint() const; protected: KileMultiTabBar::KileMultiTabBarPosition m_position; KileMultiTabBar::KileMultiTabBarStyle m_style; TQString m_text; virtual void hideEvent( class TQHideEvent*); virtual void showEvent( class TQShowEvent*); private: int m_id; KileMultiTabBarButtonPrivate *d; signals: /** * this is emitted if the button is clicked * @param id the ID identifying the button */ void clicked(int id); protected slots: virtual void slotClicked(); }; /** * @ingroup multitabbar * This class represents a tab bar's tab in a KileMultiTabBarWidget. * This class should never be created except with the appendTab call of KileMultiTabBar */ class KileMultiTabBarTab: public KileMultiTabBarButton { Q_OBJECT public: /** @internal */ KileMultiTabBarTab(const TQPixmap& pic,const TQString&,int id,TQWidget *parent, KileMultiTabBar::KileMultiTabBarPosition pos,KileMultiTabBar::KileMultiTabBarStyle style); /** * Destructor. */ virtual ~KileMultiTabBarTab(); /** * set the active state of the tab * @param state @c true if the tab should become active, @c false otherwise */ void setState(bool state); /** * choose if the text should always be displayed * this is only used in classic mode if at all * @param show Whether or not to show the text */ void showActiveTabText(bool show); /** * Resized the tab to the needed size. */ void resize(){ setSize( neededSize() ); } private: bool m_showActiveTabText; int m_expandedSize; KileMultiTabBarTabPrivate *d; protected: friend class KileMultiTabBarInternal; void setSize(int); int neededSize(); void updateState(); virtual void drawButton(TQPainter *); virtual void drawButtonLabel(TQPainter *); void drawButtonStyled(TQPainter *); void drawButtonClassic(TQPainter *); protected slots: virtual void slotClicked(); void setTabsPosition(KileMultiTabBar::KileMultiTabBarPosition); public slots: virtual void setIcon(const TQString&); virtual void setIcon(const TQPixmap&); }; #endif