-
Notifications
You must be signed in to change notification settings - Fork 388
Expand file tree
/
Copy pathStdLayoutImpl.h
More file actions
102 lines (85 loc) · 2.75 KB
/
StdLayoutImpl.h
File metadata and controls
102 lines (85 loc) · 2.75 KB
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
// This may look like C code, but it's really -*- C++ -*-
/*
* Copyright (C) 2008 Emweb bv, Herent, Belgium.
*
* See the LICENSE file for terms of use.
*/
#ifndef STD_LAYOUT_IMPL_H_
#define STD_LAYOUT_IMPL_H_
#include "StdLayoutItemImpl.h"
#include "Wt/WLayoutImpl.h"
namespace Wt {
class WLayout;
/*! \class StdLayoutImpl Wt/StdLayoutImpl.h Wt/StdLayoutImpl.h
* \brief An abstract base class for implementing layout managers.
*
* \sa StdLayoutItemImpl, WLayout
*/
class WT_API StdLayoutImpl : public StdLayoutItemImpl, public WLayoutImpl
{
public:
/*! \brief Constructor.
*
* Creates a new StdLayoutImpl for the given WLayout.
*/
StdLayoutImpl(WLayout *layout);
/*! \brief Destructor.
*/
virtual ~StdLayoutImpl();
/*! \brief Updates the DomElements in the WLayout.
*
* This function should update the DomElements in the WLayout. This
* means creating DomElements for newly added StdLayoutItemImpl,
* deleting DomElements from deleted StdLayoutItemImpl and updating
* the placement and size of the DomElements.
*/
virtual void updateDom(DomElement& parent) = 0;
/*! \brief Called when a WLayoutItem in the WLayout is resized.
*
* When a WLayoutItem is resized, it may be necessary to update the
* whole layout. Items may have moved in such a way, that it would
* push other items of screen, requiring other items to adapt to it.
*
* If it returns \p true, a subsequent updateDom() may be necessary.
*
* \sa WContainerWidget::updateDomChildren()
*/
virtual bool itemResized(WLayoutItem *item) = 0;
/*! \brief Called when the parent is resized.
*
* When the parent is resized, it may be necessary to update the whole
* layout. More or less items could not potentially fit in the layout,
* or the layout's boundaries may have changed.
*
* If it returns \p true, a subsequent updateDom() may be necessary.
*
* \sa updateDom(), WContainerWidget::parentResized()
*/
virtual bool parentResized() = 0;
//! Returns the WLayout as a WLayoutItem.
WLayoutItem *layoutItem() const override;
/*! \brief Updates the layout.
*
* By default, this will trigger a call to updateDom().
*
* \note Several calls to update() may happens before updateDom() is
* called.
*
* \sa updateDom()
*/
void update() override;
void setObjectName(const std::string& name) override;
protected:
//! Returns the WLayout.
WLayout *layout() const { return layout_; }
/*! \brief Returns a WLayoutItem implementation.
*
* Returns a WLayoutItem implementation if the implementation is a
* subclass of StdLayoutItemImpl. Otherwise returns \p nullptr.
*/
static StdLayoutItemImpl *getImpl(WLayoutItem *item);
private:
WLayout *layout_;
};
}
#endif // STD_LAYOUT_IMPL_H_