neoGFX
Cross-platform C++ app/game engine
Loading...
Searching...
No Matches
spacer.hpp
Go to the documentation of this file.
1// spacer.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>
26
27namespace neogfx
28{
29 class i_layout;
30
31 class spacer : public layout_item<object<i_spacer>>
32 {
34 public:
35 struct no_parent : std::logic_error { no_parent() : std::logic_error("neogfx::spacer::no_parent") {} };
36 struct padding_unsupported : std::logic_error { padding_unsupported() : std::logic_error("neogfx::spacer::padding_unsupported") {} };
37 public:
38 typedef i_spacer abstract_type;
39 public:
41 spacer(i_layout& aParent, neogfx::expansion_policy aExpansionPolicy);
42 virtual ~spacer();
43 public:
44 bool has_parent_layout() const final;
45 const i_layout& parent_layout() const final;
47 void set_parent_layout(i_layout* aParentLayout) final;
48 bool has_parent_widget() const final;
49 const i_widget& parent_widget() const final;
51 void set_parent_widget(i_widget* aParentWidget) final;
52 public:
54 void set_expansion_policy(neogfx::expansion_policy aExpansionPolicy) override;
55 public:
56 neogfx::size_policy size_policy() const override;
57 public:
58 bool has_margin() const noexcept override;
59 neogfx::margin margin() const override;
60 bool has_border() const noexcept override;
61 neogfx::border border() const override;
62 bool has_padding() const noexcept override;
63 neogfx::padding padding() const override;
64 public:
65 bool device_metrics_available() const override;
66 const i_device_metrics& device_metrics() const override;
67 public:
68 void layout_as(const point& aPosition, const size& aSize) override;
69 public:
70 bool visible() const override;
71 private:
72 i_layout* iParentLayout;
73 neogfx::expansion_policy iExpansionPolicy;
74 };
75
77 {
78 public:
81 };
82
83 class vertical_spacer : public spacer
84 {
85 public:
88 };
89}
horizontal_spacer(i_layout &aParent)
void layout_as(const point &aPosition, const size &aSize) override
bool has_margin() const noexcept override
bool has_border() const noexcept override
void set_parent_widget(i_widget *aParentWidget) final
bool has_parent_widget() const final
bool has_padding() const noexcept override
i_spacer abstract_type
Definition spacer.hpp:38
const i_device_metrics & device_metrics() const override
const i_widget & parent_widget() const final
neogfx::size_policy size_policy() const override
bool device_metrics_available() const override
void set_parent_layout(i_layout *aParentLayout) final
bool has_parent_layout() const final
const i_layout & parent_layout() const final
void set_expansion_policy(neogfx::expansion_policy aExpansionPolicy) override
virtual ~spacer()
spacer(neogfx::expansion_policy aExpansionPolicy)
bool visible() const override
spacer(i_layout &aParent, neogfx::expansion_policy aExpansionPolicy)
vertical_spacer(i_layout &aParent)
expansion_policy
Definition i_spacer.hpp:32
#define meta_object(...)
Definition i_object.hpp:28