1 /***************************************************************************
2 * Copyright (C) 2007-2009 by Peter Penz <peter.penz@gmx.at> *
4 * This program is free software; you can redistribute it and/or modify *
5 * it under the terms of the GNU General Public License as published by *
6 * the Free Software Foundation; either version 2 of the License, or *
7 * (at your option) any later version. *
9 * This program is distributed in the hope that it will be useful, *
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
12 * GNU General Public License for more details. *
14 * You should have received a copy of the GNU General Public License *
15 * along with this program; if not, write to the *
16 * Free Software Foundation, Inc., *
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
18 ***************************************************************************/
20 #ifndef DOLPHINCOLUMNVIEWCONTAINER_H
21 #define DOLPHINCOLUMNVIEWCONTAINER_H
23 #include "dolphinview.h"
28 #include <QScrollArea>
31 class DolphinColumnView
;
32 class DolphinController
;
37 * @brief Represents a container for columns represented as instances
38 * of DolphinColumnView.
40 * @see DolphinColumnView
42 class DolphinColumnViewContainer
: public QScrollArea
47 explicit DolphinColumnViewContainer(QWidget
* parent
,
48 DolphinController
* controller
);
49 virtual ~DolphinColumnViewContainer();
53 QAbstractItemView
* activeColumn() const;
56 * Shows the column which represents the URL \a url. If the column
57 * is already shown, it gets activated, otherwise it will be created.
59 void showColumn(const KUrl
& url
);
62 virtual void mousePressEvent(QMouseEvent
* event
);
63 virtual void keyPressEvent(QKeyEvent
* event
);
64 virtual void resizeEvent(QResizeEvent
* event
);
65 virtual void wheelEvent(QWheelEvent
* event
);
69 * Moves the content of the columns view to represent
70 * the scrollbar position \a x.
72 void moveContentHorizontally(int x
);
75 * Updates the background color of the columns to respect
76 * the current activation state \a active.
78 void updateColumnsBackground(bool active
);
82 * Deactivates the currently active column and activates
83 * the new column indicated by \a index. m_index represents
84 * the active column afterwards. Also the URL of the navigator
85 * will be adjusted to reflect the column URL.
87 void setActiveColumnIndex(int index
);
90 void updateScrollBar();
93 * Assures that the currently active column is fully visible
94 * by adjusting the horizontal position of the content.
96 void assureVisibleActiveColumn();
99 * Request the activation for the column \a column. It is assured
100 * that the columns gets fully visible by adjusting the horizontal
101 * position of the content.
103 void requestActivation(DolphinColumnView
* column
);
105 /** Removes all columns except of the root column. */
106 void removeAllColumns();
109 * Returns the position of the point \a point relative to the column
112 QPoint
columnPosition(DolphinColumnView
* column
, const QPoint
& point
) const;
115 * Deletes the column. If the itemview of the controller is set to the column,
116 * the controllers itemview is set to 0.
118 void deleteColumn(DolphinColumnView
* column
);
121 DolphinController
* m_controller
;
125 QList
<DolphinColumnView
*> m_columns
;
126 QFrame
* m_emptyViewport
;
127 QTimeLine
* m_animation
;
128 QAbstractItemView
* m_dragSource
;
130 friend class DolphinColumnView
;