summaryrefslogtreecommitdiffstats
path: root/kmdi/kmdi/mainwindow.h
blob: d7351a330b7ce8af31884c85828b519c6dea1d36 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
/* This file is part of the KDE libraries
   Copyright (C) 2004 Christoph Cullmann <cullmann@kde.org>
   Copyright (C) 2002,2003 Joseph Wenninger <jowenn@kde.org>

   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.

   Based on:

   //----------------------------------------------------------------------------
   //    Project              : KDE MDI extension
   //
   //    begin                : 07/1999       by Szymon Stefanek as part of kvirc
   //                                         (an IRC application)
   //    changes              : 09/1999       by Falk Brettschneider to create an
   //                           - 06/2000     stand-alone Qt extension set of
   //                                         classes and a Qt-based library
   //                         : 02/2000       by Massimo Morin (mmorin@schedsys.com)
   //                           2000-2003     maintained by the KDevelop project
   //    patches              : -/2000        by Lars Beikirch (Lars.Beikirch@gmx.net)
   //                         : 01/2003       by Jens Zurheide (jens.zurheide@gmx.de)
   //
   //    copyright            : (C) 1999-2003 by Falk Brettschneider
   //                                         and
   //                                         Szymon Stefanek (stefanek@tin.it)
   //    email                :  falkbr@kdevelop.org (Falk Brettschneider)
   //----------------------------------------------------------------------------
*/

#ifndef _KMDI_MAINWINDOW_H_
#define _KMDI_MAINWINDOW_H_

#include <kparts/dockmainwindow.h>
#include <kmenubar.h>
#include <kpopupmenu.h>

#include <tqptrlist.h>
#include <tqrect.h>
#include <tqapplication.h>
#include <tqguardedptr.h>

#include <kmdi/global.h>

class TQPopupMenu;
class TQMenuBar;

#include <kmdi/toolviewaccessor.h>

namespace KMDIPrivate {
  class MainWindowPrivate;
  class GUIClient;
}

namespace KMDI
{

class DockContainer;
class TabWidget;

class KMDI_EXPORT MainWindow : public KParts::DockMainWindow
{
  Q_OBJECT

  friend class KMDI::ToolViewAccessor;

  public:
    /**
     * Constructor.
     */
    MainWindow ( TQWidget* parentWidget, const char* name = "");

    /**
     * Destructor.
     */
    virtual ~MainWindow ();

  public:
    /**
     * get the central tabwidget
     * add all your content as child to this widget
     * or as multiple tabs
     * @return tabwidget in central of window
     */
    TabWidget *tabWidget ();

    /**
     * Using this method you have to use the setWidget method of the access object, and it is very recommendet, that you use
     * the widgetContainer() method for the parent of your newly created widget
     * @return created toolview
     */
    KMDI::ToolViewAccessor *createToolWindow();

    /**
     * Usually called from addWindow() when adding a tool view window. It reparents the given widget
     * as toplevel and stay-on-top on the application's main widget.
     * @param pWnd widget for the toolview
     * @param pos docking position
     * @param pTargetWnd
     * @param percent
     * @param tabToolTip
     * @param tabCaption
     * @return created toolview
     */
    KMDI::ToolViewAccessor *addToolWindow( TQWidget* pWnd, KDockWidget::DockPosition pos = KDockWidget::DockNone, TQWidget* pTargetWnd = 0L, int percent = 50, const TQString& tabToolTip = 0, const TQString& tabCaption = 0);

    /**
     * delete the toolview belonging to the given accessor
     * @param accessor toolview to delete
     */
    void deleteToolWindow( KMDI::ToolViewAccessor *accessor);

    /**
     * delete the toolview belonging to the given pWnd
     * @param pWnd toolview to be deleted
     */
    void deleteToolWindow( TQWidget* pWnd);

    /**
     * Sets the appearance of the toolview tabs.
     * @param flags See KMDI::ToolviewStyle.
     */
    void setToolViewStyle(int flags);

  public slots:
    void prevToolViewInDock();
    void nextToolViewInDock();

  signals:
    void collapseOverlapContainers();

  protected:
    void findToolViewsDockedToMain(TQPtrList<KDockWidget>* list,KDockWidget::DockPosition dprtmw);
    void dockToolViewsIntoContainers(TQPtrList<KDockWidget>& widgetsToReparent,KDockWidget *container);

  private:
    /**
     * setup main dock + tab widget
     */
    void setupMainDock ();

    /**
     * setup the sidebars for the toolviews
     * and other internals to get them working
     */
    void setupToolViews ();

    /**
     * setup the menuentries
     * must be done AFTER setupToolViews ()
     */
    void setupGUIClient ();

  private slots:
    void setActiveToolDock(DockContainer*);
    void removeFromActiveDockList(DockContainer*);

  #define protected public
  signals:
  #undef protected
    void toggleTop();
    void toggleLeft();
    void toggleRight();
    void toggleBottom();

  protected:
    KMDIPrivate::GUIClient *m_guiClient;
    TQMap <TQWidget*, KMDI::ToolViewAccessor*> *m_toolViews;

    KDockWidget *m_leftContainer;
    KDockWidget *m_rightContainer;
    KDockWidget *m_topContainer;
    KDockWidget *m_bottomContainer;

    KMDI::TabWidget *m_tabWidget;

  private:
    /**
     * private d-pointer for BC
     */
    KMDIPrivate::MainWindowPrivate *d;
};

}

#endif //_MainWindow_H_

// kate: space-indent on; indent-width 2; replace-tabs on;