neoGFX
Cross-platform C++ app/game engine
Loading...
Searching...
No Matches
layout_item_cache.hpp
Go to the documentation of this file.
1// layout_item_cache.hpp
2/*
3 neogfx C++ App/Game Engine
4 Copyright (c) 2015, 2020 Leigh Johnston. All Rights Reserved.
5
6 This program is free software: you can redistribute it and / or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation, either version 3 of the License, or
9 (at your option) any later version.
10
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with this program. If not, see <http://www.gnu.org/licenses/>.
18*/
19
20#pragma once
21
22#include <neogfx/neogfx.hpp>
28
29namespace neogfx
30{
31 class layout_item_cache : public object<reference_counted<i_layout_item_cache>>
32 {
33 public:
38 public:
39 i_anchor& anchor_to(i_anchorable& aRhs, const i_string& aLhsAnchor, anchor_constraint_function aLhsFunction, const i_string& aRhsAnchor, anchor_constraint_function aRhsFunction) final;
40 const anchor_map_type& anchors() const final;
41 anchor_map_type& anchors() final;
42 public:
43 const i_string& id() const final;
44 void set_id(const i_string& aId) final;
45 public:
46 bool is_cache() const final;
47 public:
48 bool is_layout() const final;
49 const i_layout& as_layout() const final;
51 bool is_spacer() const final;
52 const i_spacer& as_spacer() const final;
53 i_spacer& as_spacer() final;
54 bool is_widget() const final;
55 const i_widget& as_widget() const final;
57 public:
58 bool has_parent_layout_item() const final;
59 const i_layout_item& parent_layout_item() const final;
61 public:
62 bool has_parent_layout() const final;
63 const i_layout& parent_layout() const final;
65 void set_parent_layout(i_layout* aParentLayout);
66 bool has_parent_widget() const final;
67 const i_widget& parent_widget() const final;
69 void set_parent_widget(i_widget* aParentWidget) final;
70 bool has_layout_manager() const final;
71 const i_widget& layout_manager() const final;
73 public:
74 bool device_metrics_available() const final;
75 const i_device_metrics& device_metrics() const final;
76 public:
77 point origin() const final;
78 void reset_origin() const final;
79 point position() const final;
80 void set_position(const point& aPosition) final;
81 size extents() const final;
82 void set_extents(const size& aExtents) final;
83 bool has_size_policy() const noexcept final;
85 void set_size_policy(const optional_size_policy& aSizePolicy, bool aUpdateLayout = true) final;
86 bool has_weight() const noexcept final;
87 size weight() const final;
88 void set_weight(optional_size const& aWeight, bool aUpdateLayout = true) final;
89 bool has_ideal_size() const noexcept final;
90 bool is_ideal_size_constrained() const noexcept final;
91 size ideal_size(optional_size const& aAvailableSpace = optional_size{}) const final;
92 void set_ideal_size(optional_size const& aMinimumSize, bool aUpdateLayout = true) final;
93 bool has_minimum_size() const noexcept final;
94 bool is_minimum_size_constrained() const noexcept final;
95 size minimum_size(optional_size const& aAvailableSpace = optional_size{}) const final;
96 void set_minimum_size(optional_size const& aMinimumSize, bool aUpdateLayout = true) final;
97 bool has_maximum_size() const noexcept final;
98 bool is_maximum_size_constrained() const noexcept final;
99 size maximum_size(optional_size const& aAvailableSpace = optional_size{}) const final;
100 void set_maximum_size(optional_size const& aMaximumSize, bool aUpdateLayout = true) final;
101 bool has_fixed_size() const noexcept final;
102 size fixed_size(optional_size const& aAvailableSpace = {}) const final;
103 void set_fixed_size(optional_size const& aFixedSize, bool aUpdateLayout = true) final;
104 bool has_transformation() const noexcept final;
105 mat33 const& transformation(bool aCombineAncestorTransformations = false) const final;
106 void set_transformation(optional_mat33 const& aTransformation, bool aUpdateLayout = true) final;
107 public:
108 bool has_margin() const noexcept final;
109 neogfx::margin margin() const final;
110 void set_margin(optional_margin const& aMargin, bool aUpdateLayout = true) final;
111 bool has_border() const noexcept final;
112 neogfx::border border() const final;
113 void set_border(optional_border const& aBorder, bool aUpdateLayout = true) final;
114 bool has_padding() const noexcept final;
115 neogfx::padding padding() const final;
116 void set_padding(optional_padding const& aPadding, bool aUpdateLayout = true) final;
117 protected:
120 protected:
123 public:
124 bool visible() const final;
125 public:
126 void update_layout(bool aDeferLayout = true, bool aAncestors = true) final;
127 void layout_as(const point& aPosition, const size& aSize) final;
128 public:
130 void fix_weightings(bool aRecalculate = true) final;
131 public:
132 i_layout_item& subject() const final;
133 bool subject_destroyed() const final;
134 public:
136 public:
137 bool operator==(const layout_item_cache& aOther) const;
138 private:
139 ref_ptr<i_layout_item> iSubject;
140 destroyed_flag iSubjectDestroyed;
141 mutable layout_item_disposition iCachedDisposition = layout_item_disposition::Unknown;
142 mutable std::pair<uint32_t, bool> iVisible;
143 mutable std::pair<uint32_t, neogfx::size_policy> iSizePolicy;
144 mutable std::pair<uint32_t, size> iWeight;
145 mutable std::pair<uint32_t, std::pair<optional_size, size>> iIdealSize;
146 mutable std::pair<uint32_t, std::pair<optional_size, size>> iMinimumSize;
147 mutable std::pair<uint32_t, std::pair<optional_size, size>> iMaximumSize;
148 mutable std::pair<uint32_t, std::pair<optional_size, size>> iFixedSize;
149 mutable std::pair<uint32_t, mat33> iTransformation;
150 mutable std::pair<uint32_t, mat33> iCombinedTransformation;
151 };
152}
i_anchor & anchor_to(i_anchorable &aRhs, const i_string &aLhsAnchor, anchor_constraint_function aLhsFunction, const i_string &aRhsAnchor, anchor_constraint_function aRhsFunction) final
void fix_weightings(bool aRecalculate=true) final
bool is_widget() const final
void set_weight(optional_size const &aWeight, bool aUpdateLayout=true) final
bool has_maximum_size() const noexcept final
bool has_padding() const noexcept final
void invalidate_combined_transformation() final
void set_border(optional_border const &aBorder, bool aUpdateLayout=true) final
const i_spacer & as_spacer() const final
void set_minimum_size(optional_size const &aMinimumSize, bool aUpdateLayout=true) final
void set_size_policy(const optional_size_policy &aSizePolicy, bool aUpdateLayout=true) final
void update_layout(bool aDeferLayout=true, bool aAncestors=true) final
const i_layout & as_layout() const final
bool has_fixed_size() const noexcept final
size maximum_size(optional_size const &aAvailableSpace=optional_size{}) const final
size ideal_size(optional_size const &aAvailableSpace=optional_size{}) const final
point unconstrained_origin() const final
bool has_margin() const noexcept final
void set_maximum_size(optional_size const &aMaximumSize, bool aUpdateLayout=true) final
bool has_minimum_size() const noexcept final
void set_parent_widget(i_widget *aParentWidget) final
neogfx::size_policy size_policy() const final
void set_padding(optional_padding const &aPadding, bool aUpdateLayout=true) final
void set_extents(const size &aExtents) final
void set_fixed_size(optional_size const &aFixedSize, bool aUpdateLayout=true) final
void set_parent_layout(i_layout *aParentLayout)
bool has_border() const noexcept final
bool is_minimum_size_constrained() const noexcept final
const i_layout_item & parent_layout_item() const final
bool has_weight() const noexcept final
i_layout_item & subject() const final
size fixed_size(optional_size const &aAvailableSpace={}) const final
bool has_parent_layout_item() const final
bool is_ideal_size_constrained() const noexcept final
bool visible() const final
void layout_as(const point &aPosition, const size &aSize) final
bool subject_destroyed() const final
const i_device_metrics & device_metrics() const final
bool has_layout_manager() const final
point position() const final
void layout_item_enabled(i_layout_item &aItem) final
const anchor_map_type & anchors() const final
bool has_size_policy() const noexcept final
const i_layout & parent_layout() const final
void set_ideal_size(optional_size const &aMinimumSize, bool aUpdateLayout=true) final
void set_id(const i_string &aId) final
void layout_item_disabled(i_layout_item &aItem) final
bool device_metrics_available() const final
bool has_parent_widget() const final
const i_widget & parent_widget() const final
point origin() const final
size weight() const final
void set_margin(optional_margin const &aMargin, bool aUpdateLayout=true) final
const i_widget & as_widget() const final
bool is_layout() const final
mat33 const & transformation(bool aCombineAncestorTransformations=false) const final
size extents() const final
void set_position(const point &aPosition) final
bool has_ideal_size() const noexcept final
void reset_origin() const final
bool is_cache() const final
void set_transformation(optional_mat33 const &aTransformation, bool aUpdateLayout=true) final
bool has_parent_layout() const final
bool has_transformation() const noexcept final
layout_item_cache(i_ref_ptr< i_layout_item > const &aItem)
bool is_maximum_size_constrained() const noexcept final
size minimum_size(optional_size const &aAvailableSpace=optional_size{}) const final
bool is_spacer() const final
layout_item_cache(const layout_item_cache &aOther)
point unconstrained_position() const final
layout_item_cache(i_layout_item &aItem)
layout_item_disposition & cached_disposition() const final
optional< margin > optional_margin
anchor_constraint_function
Definition i_anchor.hpp:31
optional< border > optional_border
matrix33 mat33
optional< mat33 > optional_mat33
Definition plf_hive.h:79