kmditaskbar.h

00001 //----------------------------------------------------------------------------
00002 //    filename             : kmditaskbar.h
00003 //----------------------------------------------------------------------------
00004 //    Project              : KDE MDI extension
00005 //
00006 //    begin                : 07/1999       by Szymon Stefanek as part of kvirc
00007 //                                         (an IRC application)
00008 //    changes              : 09/1999       by Falk Brettschneider to create an
00009 //                           - 06/2000     stand-alone Qt extension set of
00010 //                                         classes and a Qt-based library
00011 //                           2000-2003     maintained by the KDevelop project
00012 //
00013 //    copyright            : (C) 1999-2003 by Falk Brettschneider
00014 //                                         and
00015 //                                         Szymon Stefanek (stefanek@tin.it)
00016 //    email                :  falkbr@kdevelop.org (Falk Brettschneider)
00017 //----------------------------------------------------------------------------
00018 //
00019 //----------------------------------------------------------------------------
00020 //
00021 //    This program is free software; you can redistribute it and/or modify
00022 //    it under the terms of the GNU Library General Public License as
00023 //    published by the Free Software Foundation; either version 2 of the
00024 //    License, or (at your option) any later version.
00025 //
00026 //----------------------------------------------------------------------------
00027 
00028 #ifndef _KMDITASKBAR_H_
00029 #define _KMDITASKBAR_H_
00030 
00031 #include <ktoolbar.h>
00032 #include <qptrlist.h>
00033 #include <qpixmap.h>
00034 #include <qlabel.h>
00035 #include <qpushbutton.h>
00036 
00037 #include "kmdidefines.h"
00038 
00039 class KMdiMainFrm;
00040 class KMdiChildView;
00041 class KMdiTaskBar;
00042 
00043 class KMdiTaskBarButtonPrivate;
00044 
00051 class KMDI_EXPORT KMdiTaskBarButton : public QPushButton
00052 {
00053     Q_OBJECT
00054     // methods
00055 public:
00059     KMdiTaskBarButton( KMdiTaskBar *pTaskBar, KMdiChildView *win_ptr );
00063     ~KMdiTaskBarButton();
00067     QString actualText() const;
00071     void fitText( const QString&, int newWidth );
00075     void setText( const QString& );
00076 signals:
00080     void clicked( KMdiChildView* );
00084     void leftMouseButtonClicked( KMdiChildView* );
00088     void rightMouseButtonClicked( KMdiChildView* );
00092     void buttonTextChanged( int );
00093 public slots:
00097     void setNewText( const QString& );
00098 protected slots:
00102     void mousePressEvent( QMouseEvent* );
00103 
00104     // attributes
00105 public:
00109     KMdiChildView *m_pWindow;
00110 protected:
00114     QString m_actualText;
00115 
00116 private:
00117     KMdiTaskBarButtonPrivate *d;
00118 };
00119 
00120 
00121 class KMdiTaskBarPrivate;
00129 class KMDI_EXPORT KMdiTaskBar : public KToolBar
00130 {
00131     Q_OBJECT
00132 public:
00136     KMdiTaskBar( KMdiMainFrm *parent, QMainWindow::ToolBarDock dock );
00140     ~KMdiTaskBar();
00146     KMdiTaskBarButton * addWinButton( KMdiChildView *win_ptr );
00151     void removeWinButton( KMdiChildView *win_ptr, bool haveToLayoutTaskBar = true );
00156     KMdiTaskBarButton * getNextWindowButton( bool bRight, KMdiChildView *win_ptr );
00160     KMdiTaskBarButton * getButton( KMdiChildView *win_ptr );
00164     void switchOn( bool bOn );
00168     bool isSwitchedOn() const
00169     {
00170         return m_bSwitchedOn;
00171     };
00172 protected:
00176     void resizeEvent( QResizeEvent* );
00177 protected slots:
00185     void layoutTaskBar( int taskBarWidth = 0 );
00186 public slots:
00191     void setActiveButton( KMdiChildView *win_ptr );
00192 protected:
00197     QPtrList<KMdiTaskBarButton>* m_pButtonList;
00201     KMdiMainFrm* m_pFrm;
00205     KMdiChildView* m_pCurrentFocusedWindow;
00209     QLabel* m_pStretchSpace;
00210     bool m_layoutIsPending;
00211     bool m_bSwitchedOn;
00212 
00213 private:
00214     KMdiTaskBarPrivate *d;
00215 };
00216 
00217 #endif //_KMDITASKBAR_H_ 
00218 // kate: space-indent off; tab-width 4; replace-tabs off; indent-mode csands;
00219 
KDE Home | KDE Accessibility Home | Description of Access Keys