neoGFX
Cross-platform C++ app/game engine
Loading...
Searching...
No Matches
framed_widget.hpp
Go to the documentation of this file.
1// framed_widget.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>
24
25namespace neogfx
26{
42
43 template <typename Base = widget<>>
44 class framed_widget : public Base
45 {
48 public:
49 template <typename... Args>
50 framed_widget(Args&&... aArgs) :
51 base_type{ std::forward<Args>(aArgs)... }, iStyle{ frame_style::SolidFrame }, iLineWidth{ 1.0 }
52 {
53 base_type::set_background_opacity(1.0);
54 }
55 template <typename... Args>
56 framed_widget(i_widget& aParent, Args&&... aArgs) :
57 base_type{ aParent, std::forward<Args>(aArgs)... }, iStyle{ frame_style::SolidFrame }, iLineWidth{ 1.0 }
58 {
59 base_type::set_background_opacity(1.0);
60 }
61 template <typename... Args>
62 framed_widget(i_layout& aLayout, Args&&... aArgs) :
63 base_type{ aLayout, std::forward<Args>(aArgs)... }, iStyle{ frame_style::SolidFrame }, iLineWidth{ 1.0 }
64 {
65 base_type::set_background_opacity(1.0);
66 }
67 template <typename... Args>
68 framed_widget(dimension aLineWidth, Args&&... aArgs) :
69 base_type{ std::forward<Args>(aArgs)... }, iStyle{ frame_style::SolidFrame }, iLineWidth{ aLineWidth }
70 {
71 base_type::set_background_opacity(1.0);
72 }
73 template <typename... Args>
74 framed_widget(i_widget& aParent, dimension aLineWidth, Args&&... aArgs) :
75 base_type{ aParent, std::forward<Args>(aArgs)... }, iStyle{ frame_style::SolidFrame }, iLineWidth{ aLineWidth }
76 {
77 base_type::set_background_opacity(1.0);
78 }
79 template <typename... Args>
80 framed_widget(i_layout& aLayout, dimension aLineWidth, Args&&... aArgs) :
81 base_type{ aLayout, std::forward<Args>(aArgs)... }, iStyle{ frame_style::SolidFrame }, iLineWidth{ aLineWidth }
82 {
83 base_type::set_background_opacity(1.0);
84 }
85 template <typename... Args>
86 framed_widget(frame_style aStyle, Args&&... aArgs) :
87 base_type{ std::forward<Args>(aArgs)... }, iStyle{ aStyle }, iLineWidth{ 1.0 }
88 {
89 base_type::set_background_opacity(1.0);
90 }
91 template <typename... Args>
92 framed_widget(i_widget& aParent, frame_style aStyle, Args&&... aArgs) :
93 base_type{ aParent, std::forward<Args>(aArgs)... }, iStyle{ aStyle }, iLineWidth{ 1.0 }
94 {
95 base_type::set_background_opacity(1.0);
96 }
97 template <typename... Args>
98 framed_widget(i_layout& aLayout, frame_style aStyle, Args&&... aArgs) :
99 base_type{ aLayout, std::forward<Args>(aArgs)... }, iStyle{ aStyle }, iLineWidth{ 1.0 }
100 {
101 base_type::set_background_opacity(1.0);
102 }
103 template <typename... Args>
104 framed_widget(frame_style aStyle, dimension aLineWidth, Args&&... aArgs) :
105 base_type{ std::forward<Args>(aArgs)... }, iStyle{ aStyle }, iLineWidth{ aLineWidth }
106 {
107 base_type::set_background_opacity(1.0);
108 }
109 template <typename... Args>
110 framed_widget(i_widget& aParent, frame_style aStyle, dimension aLineWidth, Args&&... aArgs) :
111 base_type{ aParent, std::forward<Args>(aArgs)... }, iStyle{ aStyle }, iLineWidth{ aLineWidth }
112 {
113 base_type::set_background_opacity(1.0);
114 }
115 template <typename... Args>
116 framed_widget(i_layout& aLayout, frame_style aStyle, dimension aLineWidth, Args&&... aArgs) :
117 base_type{ aLayout, std::forward<Args>(aArgs)... }, iStyle{ aStyle }, iLineWidth{ aLineWidth }
118 {
119 base_type::set_background_opacity(1.0);
120 }
121 public:
122 using base_type::as_widget;
123 public:
124 neogfx::border border() const override;
125 public:
126 void paint_non_client(i_graphics_context& aGc) const override;
127 public:
128 void set_frame_style(frame_style aStyle);
129 public:
130 virtual bool has_frame_color() const;
131 virtual color frame_color() const;
132 virtual void set_frame_color(const optional_color& aFrameColor = optional_color{});
133 virtual color inner_frame_color() const;
134 virtual bool has_frame_radius() const;
135 virtual vec4 frame_radius() const;
136 virtual void set_frame_radius(const optional_vec4& aFrameRadius = optional_vec4{});
137 public:
138 dimension line_width() const;
140 private:
141 frame_style iStyle;
142 dimension iLineWidth;
143 optional_color iFrameColor;
144 optional_vec4 iFrameRadius;
145 };
146}
virtual bool has_frame_color() const
framed_widget(frame_style aStyle, dimension aLineWidth, Args &&... aArgs)
neogfx::border border() const override
framed_widget(i_widget &aParent, frame_style aStyle, Args &&... aArgs)
virtual void set_frame_color(const optional_color &aFrameColor=optional_color{})
framed_widget(Args &&... aArgs)
framed_widget(dimension aLineWidth, Args &&... aArgs)
framed_widget(i_widget &aParent, Args &&... aArgs)
virtual color inner_frame_color() const
void paint_non_client(i_graphics_context &aGc) const override
void set_frame_style(frame_style aStyle)
framed_widget(i_layout &aLayout, frame_style aStyle, dimension aLineWidth, Args &&... aArgs)
framed_widget(i_layout &aLayout, Args &&... aArgs)
virtual bool has_frame_radius() const
virtual vec4 frame_radius() const
framed_widget(i_widget &aParent, dimension aLineWidth, Args &&... aArgs)
framed_widget(i_layout &aLayout, dimension aLineWidth, Args &&... aArgs)
dimension line_width() const
virtual color frame_color() const
framed_widget(i_widget &aParent, frame_style aStyle, dimension aLineWidth, Args &&... aArgs)
virtual void set_frame_radius(const optional_vec4 &aFrameRadius=optional_vec4{})
framed_widget(frame_style aStyle, Args &&... aArgs)
framed_widget(i_layout &aLayout, frame_style aStyle, Args &&... aArgs)
dimension effective_frame_width() const
optional< color > optional_color
Definition color.hpp:1069
default_geometry_value_type dimension
sRGB_color color
Definition color.hpp:1067
optional< vec4 > optional_vec4
Definition plf_hive.h:79
#define meta_object(...)
Definition i_object.hpp:28