• Skip to content
  • Skip to link menu
KDE 3.5 API Reference
  • KDE API Reference
  • API Reference
  • Sitemap
  • Contact Us
 

kate

katemdi.h

Go to the documentation of this file.
00001 /* This file is part of the KDE libraries
00002    Copyright (C) 2005 Christoph Cullmann <cullmann@kde.org>
00003    Copyright (C) 2002, 2003 Joseph Wenninger <jowenn@kde.org>
00004 
00005    This library is free software; you can redistribute it and/or
00006    modify it under the terms of the GNU Library General Public
00007    License as published by the Free Software Foundation; either
00008    version 2 of the License, or (at your option) any later version.
00009 
00010    This library is distributed in the hope that it will be useful,
00011    but WITHOUT ANY WARRANTY; without even the implied warranty of
00012    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013    Library General Public License for more details.
00014 
00015    You should have received a copy of the GNU Library General Public License
00016    along with this library; see the file COPYING.LIB.  If not, write to
00017    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00018    Boston, MA 02110-1301, USA.
00019 */
00020 
00021 #ifndef __KATE_MDI_H__
00022 #define __KATE_MDI_H__
00023 
00024 #include <kparts/mainwindow.h>
00025 
00026 #include <kmultitabbar.h>
00027 #include <kxmlguiclient.h>
00028 #include <kaction.h>
00029 
00030 #include <qdict.h>
00031 #include <qintdict.h>
00032 #include <qmap.h>
00033 #include <qsplitter.h>
00034 #include <qpixmap.h>
00035 #include <qptrlist.h>
00036 
00037 namespace KateMDI {
00038 
00039 
00041 class Splitter : public QSplitter
00042 {
00043   Q_OBJECT
00044 
00045   public:
00046     Splitter(Orientation o, QWidget* parent=0, const char* name=0);
00047     ~Splitter();
00048 
00055     bool isLastChild(QWidget* w) const;
00056 
00057     int idAfter ( QWidget * w ) const;
00058 };
00059 
00060 class ToggleToolViewAction : public KToggleAction
00061 {
00062   Q_OBJECT
00063 
00064   public:
00065     ToggleToolViewAction ( const QString& text, const KShortcut& cut,
00066                            class ToolView *tv, QObject* parent = 0, const char* name = 0 );
00067 
00068     virtual ~ToggleToolViewAction();
00069 
00070   protected slots:
00071     void slotToggled(bool);
00072     void visibleChanged(bool);
00073 
00074   private:
00075     ToolView *m_tv;
00076 };
00077 
00078 class GUIClient : public QObject, public KXMLGUIClient
00079 {
00080   Q_OBJECT
00081 
00082   public:
00083     GUIClient ( class MainWindow *mw );
00084     virtual ~GUIClient();
00085 
00086     void registerToolView (ToolView *tv);
00087     void unregisterToolView (ToolView *tv);
00088     void updateSidebarsVisibleAction();
00089 
00090   private slots:
00091     void clientAdded( KXMLGUIClient *client );
00092     void updateActions();
00093 
00094   private:
00095     MainWindow *m_mw;
00096     KToggleAction *m_showSidebarsAction;
00097     QPtrList<KAction> m_toolViewActions;
00098     QMap<ToolView*, KAction*> m_toolToAction;
00099     KActionMenu *m_toolMenu;
00100 };
00101 
00102 class ToolView : public QVBox
00103 {
00104   Q_OBJECT
00105 
00106   friend class Sidebar;
00107   friend class MainWindow;
00108   friend class GUIClient;
00109   friend class ToggleToolViewAction;
00110 
00111   protected:
00121     ToolView (class MainWindow *mainwin, class Sidebar *sidebar, QWidget *parent);
00122 
00123   public:
00128     virtual ~ToolView ();
00129 
00130   signals:
00135     void visibleChanged (bool visible);
00136 
00140   protected:
00141     MainWindow *mainWindow () { return m_mainWin; }
00142 
00143     Sidebar *sidebar () { return m_sidebar; }
00144 
00145     void setVisible (bool vis);
00146 
00147   public:
00148     bool visible () const;
00149 
00150   protected:
00151     void childEvent ( QChildEvent *ev );
00152 
00153   private:
00154     MainWindow *m_mainWin;
00155     Sidebar *m_sidebar;
00156 
00160     QString id;
00161 
00165     bool m_visible;
00166 
00170     bool persistent;
00171 
00172     QPixmap icon;
00173     QString text;
00174 };
00175 
00176 class Sidebar : public KMultiTabBar
00177 {
00178   Q_OBJECT
00179 
00180   public:
00181     Sidebar (KMultiTabBar::KMultiTabBarPosition pos, class MainWindow *mainwin, QWidget *parent);
00182     virtual ~Sidebar ();
00183 
00184     void setSplitter (Splitter *sp);
00185 
00186   public:
00187     ToolView *addWidget (const QPixmap &icon, const QString &text, ToolView *widget);
00188     bool removeWidget (ToolView *widget);
00189 
00190     bool showWidget (ToolView *widget);
00191     bool hideWidget (ToolView *widget);
00192 
00193     void setLastSize (int s) { m_lastSize = s; }
00194     int lastSize () const { return m_lastSize; }
00195     void updateLastSize ();
00196 
00197     bool splitterVisible () const { return m_ownSplit->isVisible(); }
00198 
00199     void restoreSession ();
00200 
00205     void restoreSession (KConfig *config);
00206 
00211     void saveSession (KConfig *config);
00212 
00213   public slots:
00214     // reimplemented, to block a show() call if we have no children or if
00215     // all sidebars are forced hidden.
00216     virtual void show();
00217 
00218   private slots:
00219     void tabClicked(int);
00220 
00221   protected:
00222     bool eventFilter(QObject *obj, QEvent *ev);
00223 
00224   private slots:
00225     void buttonPopupActivate (int id);
00226 
00227   private:
00228     MainWindow *m_mainWin;
00229 
00230     KMultiTabBar::KMultiTabBarPosition m_pos;
00231     Splitter *m_splitter;
00232     KMultiTabBar *m_tabBar;
00233     Splitter *m_ownSplit;
00234 
00235     QIntDict<ToolView> m_idToWidget;
00236     QMap<ToolView*, int> m_widgetToId;
00237 
00241     QValueList<ToolView*> m_toolviews;
00242 
00243     int m_lastSize;
00244 
00245     int m_popupButton;
00246 };
00247 
00248 class MainWindow : public KParts::MainWindow
00249 {
00250   Q_OBJECT
00251 
00252   friend class ToolView;
00253 
00254   //
00255   // Constructor area
00256   //
00257   public:
00261     MainWindow (QWidget* parentWidget = 0, const char* name = 0);
00262 
00266     virtual ~MainWindow ();
00267 
00268   //
00269   // public interfaces
00270   //
00271   public:
00278     QWidget *centralWidget () const;
00279 
00288     ToolView *createToolView (const QString &identifier, KMultiTabBar::KMultiTabBarPosition pos, const QPixmap &icon, const QString &text);
00289 
00295     ToolView *toolView (const QString &identifier) const;
00296 
00301     void setToolViewStyle (KMultiTabBar::KMultiTabBarStyle style);
00302 
00308     KMultiTabBar::KMultiTabBarStyle toolViewStyle () const;
00309 
00314     bool sidebarsVisible() const;
00315 
00316   public slots:
00323     void setSidebarsVisible( bool visible );
00324 
00325   protected:
00330     void toolViewDeleted (ToolView *widget);
00331 
00335   public:
00342     bool moveToolView (ToolView *widget, KMultiTabBar::KMultiTabBarPosition pos);
00343 
00349     bool showToolView (ToolView *widget);
00350 
00356     bool hideToolView (ToolView *widget);
00357 
00361   public:
00367     void startRestore (KConfig *config, const QString &group);
00368 
00372     void finishRestore ();
00373 
00379     void saveSession (KConfig *config, const QString &group);
00380 
00384   private:
00388     QDict<ToolView> m_idToWidget;
00389 
00393     QValueList<ToolView*> m_toolviews;
00394 
00399     QWidget *m_centralWidget;
00400 
00404     Splitter *m_hSplitter;
00405 
00409     Splitter *m_vSplitter;
00410 
00414     Sidebar *m_sidebars[4];
00415 
00419     bool m_sidebarsVisible;
00420 
00425     KConfig *m_restoreConfig;
00426 
00430     QString m_restoreGroup;
00431 
00435     GUIClient *m_guiClient;
00436 };
00437 
00438 }
00439 
00440 #endif
00441 
00442 // kate: space-indent on; indent-width 2;

kate

Skip menu "kate"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members

API Reference

Skip menu "API Reference"
  • kate
Generated for API Reference by doxygen 1.5.9
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal