Close menu
Start
Download
Getting Started
License
References
Jam Build Tool
Class Index
Namespaces
Modules
Pt
›
Documentation
Documentation
›
Get Platinum
≡
Class Index
Namespaces
Modules
include
Pt
Forms
DockingLayout.h
1
/* Copyright (C) 2015 Marc Boris Duerner
2
Copyright (C) 2015 Laurentiu-Gheorghe Crisan
3
4
This library is free software; you can redistribute it and/or
5
modify it under the terms of the GNU Lesser General Public
6
License as published by the Free Software Foundation; either
7
version 2.1 of the License, or (at your option) any later version.
8
9
As a special exception, you may use this file as part of a free
10
software library without restriction. Specifically, if other files
11
instantiate templates or use macros or inline functions from this
12
file, or you compile this file and link it with other files to
13
produce an executable, this file does not by itself cause the
14
resulting executable to be covered by the GNU General Public
15
License. This exception does not however invalidate any other
16
reasons why the executable file might be covered by the GNU Library
17
General Public License.
18
19
This library is distributed in the hope that it will be useful,
20
but WITHOUT ANY WARRANTY; without even the implied warranty of
21
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
22
Lesser General Public License for more details.
23
24
You should have received a copy of the GNU Lesser General Public
25
License along with this library; if not, write to the Free Software
26
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
27
02110-1301 USA
28
*/
29
30
#ifndef Pt_Forms_DockingLayout_H
31
#define Pt_Forms_DockingLayout_H
32
33
#include <Pt/Forms/Api.h>
34
#include <Pt/Forms/Layout.h>
35
#include <map>
36
37
namespace
Pt
{
38
39
namespace
Forms
{
40
68
class
PT_FORMS_API
DockingLayout
:
public
Layout
69
{
70
typedef
Layout Base;
71
72
public
:
75
enum
DockMode
76
{
79
None
= 0,
80
83
Left
,
84
87
Top
,
88
91
Right
,
92
95
Bottom
,
96
99
Fill
100
};
101
102
public
:
105
explicit
DockingLayout
(
DockMode
ds =
None
);
106
109
virtual
~DockingLayout
();
110
115
void
addItem
(
Control
& control,
DockMode
ds);
116
119
void
removeItem
(
Control
& control);
120
123
void
setDockingStyle
(
Control
& control,
DockMode
ds);
124
125
protected
:
128
virtual
void
onAddControl
(
Control
& control);
129
132
virtual
void
onRemoveControl
(
Control
& control);
133
136
virtual
Gfx::SizeF
onMeasure
(
const
SizePolicy
& policy);
137
140
virtual
void
onLayout
(
const
Gfx::RectF& rect);
141
142
private
:
143
std::map<Control*, DockMode> _docking;
144
DockMode
_defaultDocking;
145
};
146
147
}
// namespace
148
149
}
// namespace
150
151
#endif
// include guard
Pt::Forms::Control
Reusable view used as application content.
Definition
Control.h:107
Pt::Forms::DockingLayout::removeItem
void removeItem(Control &control)
Detaches control without destroying it.
Pt::Forms::DockingLayout::DockMode
DockMode
Edge or leftover region assigned to a child.
Definition
DockingLayout.h:76
Pt::Forms::DockingLayout::Bottom
@ Bottom
Docks to the bottom edge.
Definition
DockingLayout.h:95
Pt::Forms::DockingLayout::Fill
@ Fill
Fills leftover space after edge docks.
Definition
DockingLayout.h:99
Pt::Forms::DockingLayout::Top
@ Top
Docks to the top edge.
Definition
DockingLayout.h:87
Pt::Forms::DockingLayout::Left
@ Left
Docks to the left edge.
Definition
DockingLayout.h:83
Pt::Forms::DockingLayout::None
@ None
The child is not docked.
Definition
DockingLayout.h:79
Pt::Forms::DockingLayout::Right
@ Right
Docks to the right edge.
Definition
DockingLayout.h:91
Pt::Forms::DockingLayout::addItem
void addItem(Control &control, DockMode ds)
Attaches control with dock mode ds.
Pt::Forms::DockingLayout::DockingLayout
DockingLayout(DockMode ds=None)
Creates an empty docking layout.
Pt::Forms::DockingLayout::onLayout
virtual void onLayout(const Gfx::RectF &rect)
Assigns edge docks, then leftover space to Fill children.
Pt::Forms::DockingLayout::onAddControl
virtual void onAddControl(Control &control)
Handles attachment of control.
Pt::Forms::DockingLayout::setDockingStyle
void setDockingStyle(Control &control, DockMode ds)
Sets the dock mode of attached control to ds.
Pt::Forms::DockingLayout::onRemoveControl
virtual void onRemoveControl(Control &control)
Removes the stored dock mode for control.
Pt::Forms::DockingLayout::onMeasure
virtual Gfx::SizeF onMeasure(const SizePolicy &policy)
Measures docked children and leftover Fill space.
Pt::Forms::DockingLayout::~DockingLayout
virtual ~DockingLayout()
Destroys the layout. Attached controls are not destroyed.
Pt::Forms::SizePolicy
Constraint used when measuring a control.
Definition
SizePolicy.h:48
Pt::Forms
Graphical user interfaces.
Definition
ActivateEvent.h:40
Pt
Core module.
Definition
Allocator.h:33