• Skip to content
  • Skip to link menu
Trinity API Reference
  • Trinity API Reference
  • kate
 

kate

  • kate
  • app
katemdi.h
1 /* This file is part of the KDE libraries
2  Copyright (C) 2005 Christoph Cullmann <cullmann@kde.org>
3  Copyright (C) 2002, 2003 Joseph Wenninger <jowenn@kde.org>
4 
5  This library is free software; you can redistribute it and/or
6  modify it under the terms of the GNU Library General Public
7  License as published by the Free Software Foundation; either
8  version 2 of the License, or (at your option) any later version.
9 
10  This library is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  Library General Public License for more details.
14 
15  You should have received a copy of the GNU Library General Public License
16  along with this library; see the file COPYING.LIB. If not, write to
17  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18  Boston, MA 02110-1301, USA.
19 */
20 
21 #ifndef __KATE_MDI_H__
22 #define __KATE_MDI_H__
23 
24 #include <tdeparts/mainwindow.h>
25 
26 #include <tdemultitabbar.h>
27 #include <kxmlguiclient.h>
28 #include <tdeaction.h>
29 
30 #include <tqdict.h>
31 #include <tqintdict.h>
32 #include <tqmap.h>
33 #include <tqsplitter.h>
34 #include <tqpixmap.h>
35 #include <tqptrlist.h>
36 
37 namespace KateMDI {
38 
39 
41 class Splitter : public TQSplitter
42 {
43  TQ_OBJECT
44 
45 
46  public:
47  Splitter(Orientation o, TQWidget* parent=0, const char* name=0);
48  ~Splitter();
49 
56  bool isLastChild(TQWidget* w) const;
57 
58  int idAfter ( TQWidget * w ) const;
59 };
60 
61 class ToggleToolViewAction : public TDEToggleAction
62 {
63  TQ_OBJECT
64 
65 
66  public:
67  ToggleToolViewAction ( const TQString& text, const TDEShortcut& cut,
68  class ToolView *tv, TQObject* parent = 0, const char* name = 0 );
69 
70  virtual ~ToggleToolViewAction();
71 
72  protected slots:
73  void slotToggled(bool);
74  void visibleChanged(bool);
75 
76  private:
77  ToolView *m_tv;
78 };
79 
80 class GUIClient : public TQObject, public KXMLGUIClient
81 {
82  TQ_OBJECT
83 
84 
85  public:
86  GUIClient ( class MainWindow *mw );
87  virtual ~GUIClient();
88 
89  void registerToolView (ToolView *tv);
90  void unregisterToolView (ToolView *tv);
91  void updateSidebarsVisibleAction();
92 
93  private slots:
94  void clientAdded( KXMLGUIClient *client );
95  void updateActions();
96 
97  private:
98  MainWindow *m_mw;
99  TDEToggleAction *m_showSidebarsAction;
100  TQPtrList<TDEAction> m_toolViewActions;
101  TQMap<ToolView*, TDEAction*> m_toolToAction;
102  TDEActionMenu *m_toolMenu;
103 };
104 
105 class ToolView : public TQVBox
106 {
107  TQ_OBJECT
108 
109 
110  friend class Sidebar;
111  friend class MainWindow;
112  friend class GUIClient;
113  friend class ToggleToolViewAction;
114 
115  protected:
125  ToolView (class MainWindow *mainwin, class Sidebar *sidebar, TQWidget *parent);
126 
127  public:
132  virtual ~ToolView ();
133 
134  signals:
139  void visibleChanged (bool visible);
140 
144  protected:
145  MainWindow *mainWindow () { return m_mainWin; }
146 
147  Sidebar *sidebar () { return m_sidebar; }
148 
149  void setVisible (bool vis);
150 
151  public:
152  bool visible () const;
153 
154  protected:
155  void childEvent ( TQChildEvent *ev );
156 
157  private:
158  MainWindow *m_mainWin;
159  Sidebar *m_sidebar;
160 
164  TQString id;
165 
169  bool m_visible;
170 
174  bool persistent;
175 
176  TQPixmap icon;
177  TQString text;
178 };
179 
180 class Sidebar : public KMultiTabBar
181 {
182  TQ_OBJECT
183 
184 
185  public:
186  Sidebar (KMultiTabBar::KMultiTabBarPosition pos, class MainWindow *mainwin, TQWidget *parent);
187  virtual ~Sidebar ();
188 
189  void setSplitter (Splitter *sp);
190 
191  public:
192  ToolView *addWidget (const TQPixmap &icon, const TQString &text, ToolView *widget);
193  bool removeWidget (ToolView *widget);
194 
195  bool showWidget (ToolView *widget);
196  bool hideWidget (ToolView *widget);
197 
198  void setLastSize (int s) { m_lastSize = s; }
199  int lastSize () const { return m_lastSize; }
200  void updateLastSize ();
201 
202  bool splitterVisible () const { return m_ownSplit->isVisible(); }
203 
204  void restoreSession ();
205 
210  void restoreSession (TDEConfig *config);
211 
216  void saveSession (TDEConfig *config);
217 
218  public slots:
219  // reimplemented, to block a show() call if we have no children or if
220  // all sidebars are forced hidden.
221  virtual void show();
222 
223  private slots:
224  void tabClicked(int);
225 
226  protected:
227  bool eventFilter(TQObject *obj, TQEvent *ev);
228 
229  private slots:
230  void buttonPopupActivate (int id);
231 
232  private:
233  MainWindow *m_mainWin;
234 
235  KMultiTabBar::KMultiTabBarPosition m_pos;
236  Splitter *m_splitter;
237  KMultiTabBar *m_tabBar;
238  Splitter *m_ownSplit;
239 
240  TQIntDict<ToolView> m_idToWidget;
241  TQMap<ToolView*, int> m_widgetToId;
242 
246  TQValueList<ToolView*> m_toolviews;
247 
248  int m_lastSize;
249 
250  int m_popupButton;
251 };
252 
253 class MainWindow : public KParts::MainWindow
254 {
255  TQ_OBJECT
256 
257 
258  friend class ToolView;
259 
260  //
261  // Constructor area
262  //
263  public:
267  MainWindow (TQWidget* parentWidget = 0, const char* name = 0);
268 
272  virtual ~MainWindow ();
273 
274  //
275  // public interfaces
276  //
277  public:
284  TQWidget *centralWidget () const;
285 
294  ToolView *createToolView (const TQString &identifier, KMultiTabBar::KMultiTabBarPosition pos, const TQPixmap &icon, const TQString &text);
295 
301  ToolView *toolView (const TQString &identifier) const;
302 
307  void setToolViewStyle (KMultiTabBar::KMultiTabBarStyle style);
308 
314  KMultiTabBar::KMultiTabBarStyle toolViewStyle () const;
315 
320  bool sidebarsVisible() const;
321 
322  public slots:
329  void setSidebarsVisible( bool visible );
330 
331  protected:
336  void toolViewDeleted (ToolView *widget);
337 
341  public:
348  bool moveToolView (ToolView *widget, KMultiTabBar::KMultiTabBarPosition pos);
349 
355  bool showToolView (ToolView *widget);
356 
362  bool hideToolView (ToolView *widget);
363 
367  public:
373  void startRestore (TDEConfig *config, const TQString &group);
374 
378  void finishRestore ();
379 
385  void saveSession (TDEConfig *config, const TQString &group);
386 
390  private:
394  TQDict<ToolView> m_idToWidget;
395 
399  TQValueList<ToolView*> m_toolviews;
400 
405  TQWidget *m_centralWidget;
406 
410  Splitter *m_hSplitter;
411 
415  Splitter *m_vSplitter;
416 
420  Sidebar *m_sidebars[4];
421 
425  bool m_sidebarsVisible;
426 
431  TDEConfig *m_restoreConfig;
432 
436  TQString m_restoreGroup;
437 
441  GUIClient *m_guiClient;
442 };
443 
444 }
445 
446 #endif
KateMDI::Splitter
This class is needed because TQSplitter cant return an index for a widget.
Definition: katemdi.h:42
KateMDI::Splitter::isLastChild
bool isLastChild(TQWidget *w) const
Since there is supposed to be only 2 childs of a katesplitter, any child other than the last is the f...
Definition: katemdi.cpp:54

kate

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

kate

Skip menu "kate"
  • kate
  • libkonq
  • twin
  •   lib
Generated for kate by doxygen 1.9.1
This website is maintained by Timothy Pearson.