68 return static_cast<window_style>(~static_cast<uint32_t>(aStyle));
73 return static_cast<window_style>(
static_cast<uint32_t
>(aLhs) |
static_cast<uint32_t
>(aRhs));
78 return static_cast<window_style>(
static_cast<uint32_t
>(aLhs) &
static_cast<uint32_t
>(aRhs));
83 return aLhs =
static_cast<window_style>(
static_cast<uint32_t
>(aLhs) |
static_cast<uint32_t
>(aRhs));
88 return aLhs =
static_cast<window_style>(
static_cast<uint32_t
>(aLhs) &
static_cast<uint32_t
>(aRhs));
139 class window_placement
142 struct geometry_not_specified : std::logic_error { geometry_not_specified() :
std::logic_error{
"neogfx::window_placement::geometry_not_specified" } {} };
143 struct invalid_state : std::logic_error { invalid_state() :
std::logic_error{
"neogfx::window_placement::invalid_state" } {} };
146 iPositionSpecified{},
149 iMaximizedGeometry{},
155 const rect& aNormalGeometry,
156 const optional_rect& aIconizedGeometry = rect{},
160 iPositionSpecified{ true },
161 iNormalGeometry{ aNormalGeometry },
162 iIconizedGeometry{ aIconizedGeometry },
163 iMaximizedGeometry{ aMaximizedGeometry },
164 iVideoMode{ aVideoMode },
170 const point& aNormalPosition,
171 const optional_rect& aIconizedGeometry = rect{},
175 iPositionSpecified{ true },
176 iNormalGeometry{ aNormalPosition },
177 iIconizedGeometry{ aIconizedGeometry },
178 iMaximizedGeometry{ aMaximizedGeometry },
179 iVideoMode{ aVideoMode },
185 const point& aNormalTopLeft,
186 const point& aNormalBottomRight,
187 const optional_rect& aIconizedGeometry = rect{},
191 iPositionSpecified{ true },
192 iNormalGeometry{
rect{ aNormalTopLeft, aNormalBottomRight } },
193 iIconizedGeometry{ aIconizedGeometry },
194 iMaximizedGeometry{ aMaximizedGeometry },
195 iVideoMode{ aVideoMode },
201 const point& aNormalPosition,
202 const size& aNormalSize,
203 const optional_rect& aIconizedGeometry = rect{},
207 iPositionSpecified{ true },
208 iNormalGeometry{
rect{ aNormalPosition, aNormalSize } },
209 iIconizedGeometry{ aIconizedGeometry },
210 iMaximizedGeometry{ aMaximizedGeometry },
211 iVideoMode{ aVideoMode },
217 const size& aNormalGeometry,
218 const optional_rect& aIconizedGeometry = rect{},
222 iPositionSpecified{ false },
223 iNormalGeometry{ aNormalGeometry },
224 iIconizedGeometry{ aIconizedGeometry },
225 iMaximizedGeometry{ aMaximizedGeometry },
226 iVideoMode{ aVideoMode },
232 const video_mode& aVideoMode) :
233 iPositionSpecified{ true },
234 iNormalGeometry{
rect{ aVideoMode.resolution() } },
235 iIconizedGeometry{
rect{} },
236 iMaximizedGeometry{
rect{ aVideoMode.resolution() } },
237 iVideoMode{ aVideoMode },
243 bool position_specified()
const
245 return iPositionSpecified;
250 return iNormalGeometry;
255 return iIconizedGeometry;
260 return iMaximizedGeometry;
272 window_placement& set_normal_geometry(
const optional_rect& aNormalGeometry)
274 iPositionSpecified = !!aNormalGeometry;
275 iNormalGeometry = aNormalGeometry;
278 window_placement& set_iconized_geometry(
const optional_rect& aIconizedGeometry)
280 iIconizedGeometry = aIconizedGeometry;
283 window_placement& set_maximized_geometry(
const optional_rect& aMaximizedGeometry)
285 iMaximizedGeometry = aMaximizedGeometry;
288 window_placement& set_video_mode(
const optional_video_mode& aVideoMode)
290 iVideoMode = aVideoMode;
293 window_placement& set_state(window_state aState)
299 static window_placement default_placement();
301 void check_state()
const
305 case window_state::Normal:
306 if (!iNormalGeometry)
307 throw geometry_not_specified();
309 case window_state::Iconized:
310 if (!iIconizedGeometry)
311 throw geometry_not_specified();
313 case window_state::Maximized:
314 if (!iMaximizedGeometry)
315 throw geometry_not_specified();
318 throw invalid_state();
322 bool iPositionSpecified;
330 typedef std::optional<window_placement> optional_window_placement;
#define end_declare_enum(enumName)
#define declare_enum_string(enumName, enumEnumerator)
#define begin_declare_enum(enumName)
optional< rect > optional_rect
constexpr font_style & operator&=(font_style &aLhs, font_style aRhs)
constexpr style_aspect operator&(style_aspect aLhs, style_aspect aRhs)
audio_channel operator~(audio_channel lhs)
std::optional< video_mode > optional_video_mode
constexpr font_style & operator|=(font_style &aLhs, font_style aRhs)
@ DefaultNonResizableDialog
constexpr style_aspect operator|(style_aspect aLhs, style_aspect aRhs)