diff --git a/include/nana/gui/place.hpp b/include/nana/gui/place.hpp index 2f5dc52c..4f674cf2 100644 --- a/include/nana/gui/place.hpp +++ b/include/nana/gui/place.hpp @@ -100,7 +100,7 @@ namespace nana }; public: /// reference to a field manipulator which refers to a field object created by place - typedef field_interface & field_reference; + using field_reference = field_interface &; place(); place(window);///< Attaches to a specified widget. diff --git a/include/nana/gui/widgets/widget.hpp b/include/nana/gui/widgets/widget.hpp index ae70b77b..952cd2a4 100644 --- a/include/nana/gui/widgets/widget.hpp +++ b/include/nana/gui/widgets/widget.hpp @@ -14,11 +14,10 @@ #define NANA_GUI_WIDGET_HPP #include -#include "../basis.hpp" +#include #include "../programming_interface.hpp" #include #include -#include namespace nana { @@ -392,6 +391,33 @@ namespace nana { return API::window_outline_size(handle()); } + + place & get_place() + { + if (this->empty()) + throw std::runtime_error("form::get_plac: the form has destroyed."); + + if (!place_) + place_.reset(new place{ *this }); + + return *place_; + } + + void div(const char* div_text) + { + get_place().div(div_text); + } + + place::field_reference operator[](const char* field_name) + { + return get_place()[field_name]; + } + + void collocate() noexcept + { + if (place_) + place_->collocate(); + } protected: DrawerTrigger& get_drawer_trigger() { @@ -418,9 +444,10 @@ namespace nana return *events_; } private: - DrawerTrigger trigger_; - std::shared_ptr events_; - std::unique_ptr scheme_; + DrawerTrigger trigger_; + std::shared_ptr events_; + std::unique_ptr scheme_; + std::unique_ptr place_; };//end class widget_object /// Base class of all the classes defined as a frame window. \see nana::frame diff --git a/include/nana/key_type.hpp b/include/nana/key_type.hpp index dcfa4f79..ced29c50 100644 --- a/include/nana/key_type.hpp +++ b/include/nana/key_type.hpp @@ -34,55 +34,55 @@ namespace nana template struct type_escape { - typedef T type; + using type = T; }; template<> struct type_escape { - typedef std::string type; + using type = ::std::string; }; template<> struct type_escape { - typedef std::string type; + using type = ::std::string; }; template struct type_escape { - typedef std::string type; + using type = ::std::string; }; template struct type_escape { - typedef std::string type; + using type = ::std::string; }; template<> struct type_escape { - typedef std::wstring type; + using type = ::std::wstring; }; template<> struct type_escape { - typedef std::wstring type; + using type = ::std::wstring; }; template struct type_escape { - typedef std::wstring type; + using type = ::std::wstring; }; template struct type_escape { - typedef std::wstring type; + using type = ::std::wstring; }; }