#include <nana/gui.hpp>
#include <nana/gui/place.hpp>
#include <nana/gui/widgets/button.hpp>
#include <nana/gui/widgets/panel.hpp>
#include <nana/gui/widgets/form.hpp>
#include <nana/gui/widgets/label.hpp>
#include <nana/gui/drawing.hpp>
using namespace nana;
namespace dm
{
{
public:
template<typename T, typename ...Args>
{
widgets_.emplace_back(new T(*this, std::forward<Args>(args)...));
plc_["abc"] << widgets_.back()->handle();
plc_.collocate();
return static_cast<T*>(widgets_.back().get());
}
private:
void _m_complete_creation() override
{
plc_.bind(*this);
plc_.div("abc vert gap=5 margin=3");
{
});
}
private:
};
class group1:
public panel<true>
{
public:
unsigned gap=2,
titel (*this, titel_)
{
ft << "vertical margin=[0," << gap << "," << gap << "," << gap << "]"
<<
" <weight=" << sz.
height <<
" <weight=5> <titel weight=" << sz.
width+1 <<
"> >";
plc["titel"] << titel;
{
});
plc.div(fmt.c_str());
}
};
}
int main()
{
dm::group grp;
grp.create(fm );
grp.create_widget<
label>(
"Group:");
plc["left_field"] << grp;
dm::group1 grp_1(fm, "A new <bold=true, color=0xff0000, font=\"Consolas\">Group:</>", true );
label lab{grp_1,
"A label "};
button b1{grp_1,
"add button"};
grp_1.fmt += "<vertical margin=2 gap= 2 <lab> | 70% < <left_field> | 70% <right_field>> >";
grp_1.plc["left_field"] << b1 ;
grp_1.plc["right_field"] << b2 << b3;
grp_1.plc.div(grp_1.fmt.c_str());
plc["right_field"] << grp_1;
plc.div("horizontal gap=3 margin=30 < <left_field> | 70% <right_field>> ");
plc.collocate();
grp_1.plc.collocate();
{
auto p = grp.create_widget<
button>();
});
::nana::exec(
#ifdef NANA_AUTOMATIC_GUI_TESTING
1, 1, [&b1, &b2]()
{
}
#endif
);
}