summaryrefslogtreecommitdiffstats
path: root/kmdi/kmdi/dockcontainer.h
blob: ac27f86444ca4237f6876785a571ecee0945d4ad (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
/* This file is part of the KDE project
   Copyright (C) 2002, 2003 Joseph Wenninger <jowenn@kde.org>
   Copyright (C) 2002, 2004 Christoph Cullmann <cullmann@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 version 2 as published by the Free Software Foundation.

   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.
*/

#ifndef _KMDI_DOCK_CONTAINER_
#define _KMDI_DOCK_CONTAINER_

#include <tqwidget.h>
#include <tqstringlist.h>
#include <kdockwidget.h>
#include <tqmap.h>

# include <kdockwidget_p.h>

#include <tqpushbutton.h>

class TQWidgetStack;
class KMultiTabBar;
class KDockButton_Private;

namespace KMDI
{

class DockContainer: public TQWidget, public KDockContainer
{
  Q_OBJECT

  public:
    DockContainer(TQWidget *parent, TQWidget *win, int position, int flags);
    virtual ~DockContainer();

    /** Get the KDockWidget that is our parent */
    KDockWidget *parentDockWidget();

    /**
     * Add a widget to this container.
     * \param w the KDockWidget object to add
     * \todo Remove the extra parameters that we don't use?
     */
    virtual void insertWidget (KDockWidget *w, TQPixmap, const TQString &, int &);

    /**
     * Show a KDockWidget in our DockContainer
     * \param w the KDockWidget to show
     */
    virtual void showWidget (KDockWidget *w);

    /**
     * Set a tooltip for a widget
     *
     * \todo Actually implement it? Right now, it looks just it
     * does exactly nothing
     */
    virtual void setToolTip (KDockWidget *, TQString &);

    /**
     * Set a pixmap for one of our dock widgets
     * \param widget the KDockWidget to set the pixmap for
     * \param pixmap the pixmap you want to give the widget
     */
    virtual void setPixmap(KDockWidget* widget, const TQPixmap& pixmap);

    /**
     * Undock a widget from the container. This function is called
     * when you've dragged a tab off the dock it's attached to. 
     * \param dwdg the KDockWidget to undock
     */
    virtual void undockWidget(KDockWidget* dwdg);

    /**
     * Remove a widget from the container. The caller
     * of this function is responsible for deleting the widget after calling
     * this function.
     */
    virtual void removeWidget(KDockWidget*);

    void hideIfNeeded();

    virtual void save(KConfig *,const TQString& group_or_prefix);
    virtual void load(KConfig *,const TQString& group_or_prefix);

    void setStyle(int);
  protected:
    bool eventFilter(TQObject*,TQEvent*);

  public slots:
    void init();
    void collapseOverlapped();
    void toggle();
    void nextToolView();
    void prevToolView();
  protected slots:
    void tabClicked(int);
    void delayedRaise();
    void changeOverlapMode();
  private:
    TQWidget *m_mainWin;
    TQWidgetStack *m_ws;
    KMultiTabBar *m_tb;
    int mTabCnt;
    int oldtab;
    int m_previousTab;
    int m_position;
    int m_separatorPos;
    TQMap<KDockWidget*,int> m_map;
    TQMap<int,KDockWidget*> m_revMap;
    TQMap<KDockWidget*,KDockButton_Private*> m_overlapButtons;
    TQStringList itemNames;
    TQMap<TQString,TQString> tabCaptions;
    TQMap<TQString,TQString> tabTooltips;
    int m_inserted;
    int m_delayedRaise;
    bool m_vertical;
    bool m_block;
    bool m_tabSwitching;
    TQObject *m_dragPanel;
    KDockManager *m_dockManager;
    TQMouseEvent *m_startEvent;
    enum MovingState {NotMoving=0,WaitingForMoveStart,MovingInternal,Moving} m_movingState;
  signals:
        void activated(DockContainer*);
        void deactivated(DockContainer*);
};

}

#endif

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