refine group

This commit is contained in:
qPCR4vir
2015-04-13 10:53:20 +02:00
parent ae2a2aeec4
commit 73e5d3fd8f
2 changed files with 14 additions and 10 deletions

View File

@@ -33,14 +33,15 @@ namespace nana{
place plc_inner{content}; place plc_inner{content};
unsigned int gap; unsigned int gap;
public: public:
group( widget &owner, ///< group( window parent, ///<
string titel_ ={}, ///< string titel_ ={STR("")}, ///<
bool format =false, ///< Use a formated label? bool format =false, ///< Use a formated label?
unsigned gap =2, ///< betwen the content and the external limit unsigned gap =2, ///< betwen the content and the external limit
rectangle r ={} ///< rectangle r ={} ///<
); );
place& plc (){ return plc_inner; } place& plc (){ return plc_inner; }
window inner(){ return content; } window inner(){ return content; }
label& lbl (){ return titel; }
}; };
}//end namespace nana }//end namespace nana

View File

@@ -18,13 +18,13 @@
#include <nana/gui/widgets/group.hpp> #include <nana/gui/widgets/group.hpp>
namespace nana{ namespace nana{
group::group( widget &owner, ///< group::group( window parent, ///<
string titel_ /*={}*/, ///< string titel_ /*={}*/, ///<
bool format /*=false*/, ///< bool format /*=false*/, ///<
unsigned gap /*=2*/, ///< unsigned gap /*=2*/, ///<
rectangle r /*={} */ ///< rectangle r /*={} */ ///<
) )
: panel (owner, r), : panel (parent, r),
titel (*this, titel_) titel (*this, titel_)
{ {
titel.format(format); titel.format(format);
@@ -40,15 +40,18 @@ namespace nana{
plc_outer["content"] << content; plc_outer["content"] << content;
plc_outer.collocate(); plc_outer.collocate();
color obg = owner.bgcolor(); color pbg = API::bgcolor( parent);
titel.bgcolor(obg.blend(colors::black, 0.975) ); titel.bgcolor(pbg.blend(colors::black, 0.975) );
color bg=obg.blend(colors::black, 0.950 ); color bg=pbg.blend(colors::black, 0.950 );
bgcolor(bg); bgcolor(pbg);
content.bgcolor(bg);
drawing dw(*this); 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 ), graph.round_rectangle(rectangle( point ( gap-1 , sz.height/2 ),
nana::size (graph.width()-2*(gap-1), graph.height()-sz.height/2-(gap-1)) nana::size (graph.width()-2*(gap-1), graph.height()-sz.height/2-(gap-1))
), ),