/usr/include/kdevplatform/sublime/areaindex.h is in kdevelop-dev 4:5.2.1-1ubuntu4.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 | /***************************************************************************
* Copyright 2006-2007 Alexander Dymo <adymo@kdevelop.org> *
* *
* This program 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 program 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 General Public License for more details. *
* *
* You should have received a copy of the GNU Library General Public *
* License along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
***************************************************************************/
#ifndef KDEVPLATFORM_SUBLIMEAREAINDEX_H
#define KDEVPLATFORM_SUBLIMEAREAINDEX_H
#include <Qt>
#include <QList>
#include <QScopedPointer>
#include "sublimeexport.h"
namespace Sublime {
class View;
/**
@short Index denotes the position of the view in the split area.
B-Tree alike structure is used to represent an area with split
views. Area has a root index which can either contain one view or contain
two child nodes (@p first and @p second). In the later case area
is considered to be split into two parts. Each of those parts can
in turn contain a view or be split (with first/second children).
When a view at given index is split, then its index becomes an index of the splitter
and the original view goes into the @p first part of the splitter. The new view goes as
@p second part.
For example, consider an area which was split once horizontally
and then the second part of it was split vertically:
@code
1. initial state: one view in the area
|----------------|
| |
| 1 |
| |
|----------------|
Indices:
root_index (view 1)
2. the view is split horizontally
|----------------|
| | |
| 1 | 2 |
| | |
|----------------|
Indices:
root_index (no view)
|
----------------
| |
view 1 view 2
3. the second view is split vertically
|----------------|
| | 2 |
| 1 |--------|
| | 3 |
|----------------|
Indices:
root_index (horizontal splitter)
|
----------------
| |
view 1 vertical_splitter
|
-----------------
| |
view 2 view 3
@endcode
It is possible that several "stacked" views will have the same area index.
Those views can be considered as the view stack from which only one view
is visible at the time.
@code
|----------------|
| |
| 1,2,3,4 |
| |
|----------------|
Indices:
root_index (view1, view2, view3, view4)
@endcode
*/
class KDEVPLATFORMSUBLIME_EXPORT AreaIndex {
public:
~AreaIndex();
AreaIndex(const AreaIndex &index);
/**@return the parent index, returns 0 for root index.*/
AreaIndex *parent() const;
/**@return the first child index if there're any.*/
AreaIndex *first() const;
/**@return the second child index if there're any.*/
AreaIndex *second() const;
/**@return true if the index is split.*/
bool isSplit() const;
/**@return the orientation of the splitter for this index.*/
Qt::Orientation orientation() const;
/**Set the orientation of the splitter for this index.*/
void setOrientation(Qt::Orientation orientation) const;
/**Adds view to the list of views in this position.
Does nothing if the view is already split.
@param after if not 0, new view will be placed after this one.
@param view the view to be added.*/
void add(View *view, View *after = nullptr);
/**Removes view and unsplits the parent index when no views
are left at the current index.*/
void remove(View *view);
/**Splits the view in this position by given @p orientation
and adds the @p newView into the splitter.
Does nothing if the view is already split.
@p newView will be in the <b>second</b> child index.*/
void split(View *newView, Qt::Orientation orientation);
/**Splits the view in this position by given @p orientation.
* @p moveViewsToSecondChild Normally, the existing views in this index are moved to the first sub-index.
* If this is true, the views are moved to the _second_ sub-index instead.
* Does nothing if the view is already split.*/
void split(Qt::Orientation orientation, bool moveViewsToSecondChild = false);
/**Unsplits the index removing the given @p childToRemove and moving the contents
of another child to this index.*/
void unsplit(AreaIndex *childToRemove);
/** Returns a text-representation of the architecture of this area index and sub-indices. */
QString print() const;
/**@return the stacked view in @p position,
returns 0 for splitter's indices and when there's no view at the @p position.*/
View *viewAt(int position) const;
/**@return the number of stacked views.*/
int viewCount() const;
/**@return true if there's a stacked @p view at this index.*/
bool hasView(View *view) const;
/**@return the list of views at this index.*/
QList<View*> &views() const;
protected:
/**Constructor for Root index.*/
AreaIndex();
private:
/**Constructor for indices other than root.*/
explicit AreaIndex(AreaIndex *parent);
/**Sets the parent for this index.*/
void setParent(AreaIndex *parent);
/**Copies the data from this index to @p target.*/
void moveViewsTo(AreaIndex *target);
/**Copies the children indices from this index to @p target.*/
void copyChildrenTo(AreaIndex *target);
private:
const QScopedPointer<class AreaIndexPrivate> d;
};
/**
@short Root Area Index
This is the special index class returned by @ref Area::rootIndex().
Doesn't provide any additional functionality beyond AreaIndex.
*/
class KDEVPLATFORMSUBLIME_EXPORT RootAreaIndex: public AreaIndex {
public:
RootAreaIndex();
private:
class RootAreaIndexPrivate* const d;
};
}
#endif
|