diff --git a/include/nana/gui/widgets/group.hpp b/include/nana/gui/widgets/group.hpp index d876becb..6cd15af1 100644 --- a/include/nana/gui/widgets/group.hpp +++ b/include/nana/gui/widgets/group.hpp @@ -27,11 +27,21 @@ namespace nana{ class group : public panel { - - + place plc_outer{*this}; + panel content {*this}; + label titel/* {*this}*/; + place plc_inner{content}; + unsigned int gap; + public: + group( widget &owner, ///< + string titel_ ={}, ///< + bool format =false, ///< Use a formated label? + unsigned gap =2, ///< betwen the content and the external limit + rectangle r ={} ///< + ); + place& plc (){ return plc_inner; } + window inner(){ return content; } }; - - }//end namespace nana #endif diff --git a/source/gui/widgets/group.cpp b/source/gui/widgets/group.cpp index e0958124..d613b63d 100644 --- a/source/gui/widgets/group.cpp +++ b/source/gui/widgets/group.cpp @@ -18,8 +18,43 @@ #include namespace nana{ + group::group( widget &owner, ///< + string titel_ /*={}*/, ///< + bool format /*=false*/, ///< + unsigned gap /*=2*/, ///< + rectangle r /*={} */ ///< + ) + : panel (owner, r), + titel (*this, titel_) + { + titel.format(format); + ::nana::size sz = titel.measure(1000); + std::stringstream ft; + ft << "vertical margin=[0," << gap << "," << gap << "," << gap << "]" + << " >" + << " "; + plc_outer.div(ft.str().c_str()); + plc_outer["titel" ] << titel; + plc_outer["content"] << content; + plc_outer.collocate(); + + color obg = owner.bgcolor(); + titel.bgcolor(obg.blend(colors::black, 0.975) ); + color bg=obg.blend(colors::black, 0.950 ); + bgcolor(bg); + + drawing dw(*this); + dw.draw([gap,sz,bg,obg](paint::graphics& graph) + { + graph.rectangle(true, obg); + graph.round_rectangle(rectangle( point ( gap-1 , sz.height/2 ), + nana::size (graph.width()-2*(gap-1), graph.height()-sz.height/2-(gap-1)) + ), + 3,3, colors::gray_border, true, bg); + }); + } }//end namespace nana