Boost.UI
User Interface Boost library
window.hpp
Go to the documentation of this file.
1 // Copyright (c) 2017 Kolya Kosenko
2 
3 // Distributed under the Boost Software License, Version 1.0.
4 // See http://www.boost.org/LICENSE_1_0.txt
5 
7 
8 #ifndef BOOST_UI_WINDOW_HPP
9 #define BOOST_UI_WINDOW_HPP
10 
11 #include <boost/ui/config.hpp>
12 
13 #ifdef BOOST_HAS_PRAGMA_ONCE
14 #pragma once
15 #endif
16 
17 #include <boost/ui/widget.hpp>
18 
19 namespace boost {
20 namespace ui {
21 
24 
25 class close_event : public event
26 {
27 public:
28  close_event() : m_veto(false) {}
29  ~close_event();
30 
32  void veto() { m_veto = true; }
33 
34 private:
35  bool m_veto;
36  boost::function<void(bool)> m_veto_fn;
37  boost::function<void(bool)> m_skip_fn;
38 
39 #ifndef DOXYGEN
40  template <class NativeEvent, class UIEvent>
41  friend class native::event_functor_event;
42 #endif
43 };
44 
52 
53 class BOOST_UI_DECL window : public widget
54 {
55 public:
58  window& title(const uistring& title);
59 
61  uistring title() const;
62 
65  void show_modal();
66 
68  bool close();
69 
71  BOOST_UI_DETAIL_HANDLER(close, window);
72  BOOST_UI_DETAIL_HANDLER_EVENT(close_event, window, close_event);
74 
75 private:
76  void on_close_raw(const boost::function<void()>& handler);
77  void on_close_event_raw(const boost::function<void(close_event&)>& handler);
78 };
79 } // namespace ui
80 } // namespace boost
81 
82 #endif // BOOST_UI_WINDOW_HPP
boost::ui::uistring
Helper class to convert string between UI and application logic only.
Definition: string.hpp:49
boost::ui::close_event
Close event class.
Definition: window.hpp:25
config.hpp
Configuration options.
widget.hpp
Widget class.
boost::ui::close_event::veto
void veto()
Don't close application.
Definition: window.hpp:32
boost
Boost C++ libraries namespace.
Definition: window.hpp:19
boost::ui::event
Base class for all events.
Definition: event.hpp:37
boost::ui::window
Abstract top level widget that hosts other widgets.
Definition: window.hpp:53
boost::ui::widget
Base class for all widgets.
Definition: widget.hpp:45