Boost.UI
User Interface Boost library
label.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_LABEL_HPP
9 #define BOOST_UI_LABEL_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 
25 
26 class BOOST_UI_DECL label : public widget
27 {
28 public:
29  label() { init(); }
30 
32  explicit label(widget& parent, const uistring& txt = uistring())
33  { init(); create(parent, txt); }
34  explicit label(const uistring& txt)
35  { init(); create(txt); }
36  label& create(widget& parent, const uistring& txt = uistring());
37  label& create(const uistring& txt = uistring())
38  { text(txt); return *this; }
40 
42  void clear() { text(uistring()); }
43 
45  label& text(const uistring& txt);
46 
48  uistring text() const;
49 
50 private:
51  void init();
52 
53  class detail_impl;
54  detail_impl* get_impl();
55  const detail_impl* get_impl() const;
56 };
57 
58 } // namespace ui
59 } // namespace boost
60 
61 #endif // BOOST_UI_LABEL_HPP
boost::ui::label
Widget that displays static text.
Definition: label.hpp:26
boost::ui::uistring
Helper class to convert string between UI and application logic only.
Definition: string.hpp:49
config.hpp
Configuration options.
widget.hpp
Widget class.
boost
Boost C++ libraries namespace.
Definition: window.hpp:19
boost::ui::label::create
label & create(const uistring &txt=uistring())
Creates label widget with text.
Definition: label.hpp:37
boost::ui::label::label
label(widget &parent, const uistring &txt=uistring())
Creates label widget with text.
Definition: label.hpp:32
boost::ui::label::clear
void clear()
Clears text.
Definition: label.hpp:42
boost::ui::widget
Base class for all widgets.
Definition: widget.hpp:45
boost::ui::label::label
label(const uistring &txt)
Creates label widget with text.
Definition: label.hpp:34