From 73e5d3fd8f233700028c4e387012673f26b61cfb Mon Sep 17 00:00:00 2001 From: qPCR4vir Date: Mon, 13 Apr 2015 10:53:20 +0200 Subject: [PATCH] refine group --- include/nana/gui/widgets/group.hpp | 5 +++-- source/gui/widgets/group.cpp | 19 +++++++++++-------- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/include/nana/gui/widgets/group.hpp b/include/nana/gui/widgets/group.hpp index 6cd15af1..19cb6dce 100644 --- a/include/nana/gui/widgets/group.hpp +++ b/include/nana/gui/widgets/group.hpp @@ -33,14 +33,15 @@ namespace nana{ place plc_inner{content}; unsigned int gap; public: - group( widget &owner, ///< - string titel_ ={}, ///< + group( window parent, ///< + string titel_ ={STR("")}, ///< 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; } + label& lbl (){ return titel; } }; }//end namespace nana diff --git a/source/gui/widgets/group.cpp b/source/gui/widgets/group.cpp index d613b63d..b4905afe 100644 --- a/source/gui/widgets/group.cpp +++ b/source/gui/widgets/group.cpp @@ -18,13 +18,13 @@ #include namespace nana{ - group::group( widget &owner, ///< + group::group( window parent, ///< string titel_ /*={}*/, ///< bool format /*=false*/, ///< unsigned gap /*=2*/, ///< rectangle r /*={} */ ///< ) - : panel (owner, r), + : panel (parent, r), titel (*this, titel_) { titel.format(format); @@ -40,15 +40,18 @@ namespace nana{ 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); + color pbg = API::bgcolor( parent); + titel.bgcolor(pbg.blend(colors::black, 0.975) ); + color bg=pbg.blend(colors::black, 0.950 ); + bgcolor(pbg); + content.bgcolor(bg); drawing dw(*this); - dw.draw([gap,sz,bg,obg](paint::graphics& graph) + + // This drawing function is owner by the onwer of dw (the outer panel of the group widget), not by dw !! + dw.draw([gap,sz,bg,pbg](paint::graphics& graph) { - graph.rectangle(true, obg); + graph.rectangle(true, pbg); graph.round_rectangle(rectangle( point ( gap-1 , sz.height/2 ), nana::size (graph.width()-2*(gap-1), graph.height()-sz.height/2-(gap-1)) ),