group with internal panel and place
Non tested
This commit is contained in:
parent
d13677f703
commit
ae2a2aeec4
@ -27,11 +27,21 @@ namespace nana{
|
||||
class group
|
||||
: public panel<true>
|
||||
{
|
||||
|
||||
|
||||
place plc_outer{*this};
|
||||
panel<false> 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
|
||||
|
@ -18,8 +18,43 @@
|
||||
#include <nana/gui/widgets/group.hpp>
|
||||
|
||||
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 << "]"
|
||||
<< " <weight=" << sz.height << " <weight=5> <titel weight=" << sz.width+1 << "> >"
|
||||
<< " <content>";
|
||||
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
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user