integrate place with root widget
This commit is contained in:
parent
9aa37d5238
commit
f84e91990d
@ -100,7 +100,7 @@ namespace nana
|
|||||||
};
|
};
|
||||||
public:
|
public:
|
||||||
/// reference to a field manipulator which refers to a field object created by place
|
/// 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();
|
||||||
place(window);///< Attaches to a specified widget.
|
place(window);///< Attaches to a specified widget.
|
||||||
|
@ -14,11 +14,10 @@
|
|||||||
#define NANA_GUI_WIDGET_HPP
|
#define NANA_GUI_WIDGET_HPP
|
||||||
|
|
||||||
#include <nana/push_ignore_diagnostic>
|
#include <nana/push_ignore_diagnostic>
|
||||||
#include "../basis.hpp"
|
#include <nana/gui/place.hpp>
|
||||||
#include "../programming_interface.hpp"
|
#include "../programming_interface.hpp"
|
||||||
#include <nana/internationalization.hpp>
|
#include <nana/internationalization.hpp>
|
||||||
#include <nana/gui/detail/drawer.hpp>
|
#include <nana/gui/detail/drawer.hpp>
|
||||||
#include <functional>
|
|
||||||
|
|
||||||
namespace nana
|
namespace nana
|
||||||
{
|
{
|
||||||
@ -392,6 +391,33 @@ namespace nana
|
|||||||
{
|
{
|
||||||
return API::window_outline_size(handle());
|
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:
|
protected:
|
||||||
DrawerTrigger& get_drawer_trigger()
|
DrawerTrigger& get_drawer_trigger()
|
||||||
{
|
{
|
||||||
@ -418,9 +444,10 @@ namespace nana
|
|||||||
return *events_;
|
return *events_;
|
||||||
}
|
}
|
||||||
private:
|
private:
|
||||||
DrawerTrigger trigger_;
|
DrawerTrigger trigger_;
|
||||||
std::shared_ptr<Events> events_;
|
std::shared_ptr<Events> events_;
|
||||||
std::unique_ptr<scheme_type> scheme_;
|
std::unique_ptr<scheme_type> scheme_;
|
||||||
|
std::unique_ptr<place> place_;
|
||||||
};//end class widget_object<root_tag>
|
};//end class widget_object<root_tag>
|
||||||
|
|
||||||
/// Base class of all the classes defined as a frame window. \see nana::frame
|
/// Base class of all the classes defined as a frame window. \see nana::frame
|
||||||
|
@ -34,55 +34,55 @@ namespace nana
|
|||||||
template<typename T>
|
template<typename T>
|
||||||
struct type_escape
|
struct type_escape
|
||||||
{
|
{
|
||||||
typedef T type;
|
using type = T;
|
||||||
};
|
};
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
struct type_escape<char*>
|
struct type_escape<char*>
|
||||||
{
|
{
|
||||||
typedef std::string type;
|
using type = ::std::string;
|
||||||
};
|
};
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
struct type_escape<const char*>
|
struct type_escape<const char*>
|
||||||
{
|
{
|
||||||
typedef std::string type;
|
using type = ::std::string;
|
||||||
};
|
};
|
||||||
|
|
||||||
template<int Size>
|
template<int Size>
|
||||||
struct type_escape<char[Size]>
|
struct type_escape<char[Size]>
|
||||||
{
|
{
|
||||||
typedef std::string type;
|
using type = ::std::string;
|
||||||
};
|
};
|
||||||
|
|
||||||
template<int Size>
|
template<int Size>
|
||||||
struct type_escape<const char[Size]>
|
struct type_escape<const char[Size]>
|
||||||
{
|
{
|
||||||
typedef std::string type;
|
using type = ::std::string;
|
||||||
};
|
};
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
struct type_escape<wchar_t*>
|
struct type_escape<wchar_t*>
|
||||||
{
|
{
|
||||||
typedef std::wstring type;
|
using type = ::std::wstring;
|
||||||
};
|
};
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
struct type_escape<const wchar_t*>
|
struct type_escape<const wchar_t*>
|
||||||
{
|
{
|
||||||
typedef std::wstring type;
|
using type = ::std::wstring;
|
||||||
};
|
};
|
||||||
|
|
||||||
template<int Size>
|
template<int Size>
|
||||||
struct type_escape<wchar_t[Size]>
|
struct type_escape<wchar_t[Size]>
|
||||||
{
|
{
|
||||||
typedef std::wstring type;
|
using type = ::std::wstring;
|
||||||
};
|
};
|
||||||
|
|
||||||
template<int Size>
|
template<int Size>
|
||||||
struct type_escape<const wchar_t[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