integrate place with root widget
This commit is contained in:
parent
9aa37d5238
commit
f84e91990d
@ -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.
|
||||
|
@ -14,11 +14,10 @@
|
||||
#define NANA_GUI_WIDGET_HPP
|
||||
|
||||
#include <nana/push_ignore_diagnostic>
|
||||
#include "../basis.hpp"
|
||||
#include <nana/gui/place.hpp>
|
||||
#include "../programming_interface.hpp"
|
||||
#include <nana/internationalization.hpp>
|
||||
#include <nana/gui/detail/drawer.hpp>
|
||||
#include <functional>
|
||||
|
||||
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> events_;
|
||||
std::unique_ptr<scheme_type> scheme_;
|
||||
DrawerTrigger trigger_;
|
||||
std::shared_ptr<Events> events_;
|
||||
std::unique_ptr<scheme_type> scheme_;
|
||||
std::unique_ptr<place> place_;
|
||||
};//end class widget_object<root_tag>
|
||||
|
||||
/// Base class of all the classes defined as a frame window. \see nana::frame
|
||||
|
@ -34,55 +34,55 @@ namespace nana
|
||||
template<typename T>
|
||||
struct type_escape
|
||||
{
|
||||
typedef T type;
|
||||
using type = T;
|
||||
};
|
||||
|
||||
template<>
|
||||
struct type_escape<char*>
|
||||
{
|
||||
typedef std::string type;
|
||||
using type = ::std::string;
|
||||
};
|
||||
|
||||
template<>
|
||||
struct type_escape<const char*>
|
||||
{
|
||||
typedef std::string type;
|
||||
using type = ::std::string;
|
||||
};
|
||||
|
||||
template<int Size>
|
||||
struct type_escape<char[Size]>
|
||||
{
|
||||
typedef std::string type;
|
||||
using type = ::std::string;
|
||||
};
|
||||
|
||||
template<int Size>
|
||||
struct type_escape<const char[Size]>
|
||||
{
|
||||
typedef std::string type;
|
||||
using type = ::std::string;
|
||||
};
|
||||
|
||||
template<>
|
||||
struct type_escape<wchar_t*>
|
||||
{
|
||||
typedef std::wstring type;
|
||||
using type = ::std::wstring;
|
||||
};
|
||||
|
||||
template<>
|
||||
struct type_escape<const wchar_t*>
|
||||
{
|
||||
typedef std::wstring type;
|
||||
using type = ::std::wstring;
|
||||
};
|
||||
|
||||
template<int Size>
|
||||
struct type_escape<wchar_t[Size]>
|
||||
{
|
||||
typedef std::wstring type;
|
||||
using type = ::std::wstring;
|
||||
};
|
||||
|
||||
template<int Size>
|
||||
struct type_escape<const wchar_t[Size]>
|
||||
{
|
||||
typedef std::wstring type;
|
||||
using type = ::std::wstring;
|
||||
};
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user