fix resize and spliter issues of dockable window

This commit is contained in:
Jinhao
2015-11-12 01:54:35 +08:00
parent 41f7545822
commit f715fb613e
2 changed files with 16 additions and 15 deletions

View File

@@ -1920,7 +1920,13 @@ namespace nana
for (auto & child : children) for (auto & child : children)
{ {
if (!child->display) if (!child->display)
{
auto child_dv = dynamic_cast<div_dockpane*>(child.get());
if (child_dv)
child_dv->splitter.reset();
continue; continue;
}
auto child_dv = dynamic_cast<div_dockpane*>(child.get()); auto child_dv = dynamic_cast<div_dockpane*>(child.get());
const bool is_vert = _m_is_vert(child->dir); const bool is_vert = _m_is_vert(child->dir);
@@ -1949,6 +1955,8 @@ namespace nana
else else
split = dynamic_cast<splitter*>(child_dv->splitter.get()); split = dynamic_cast<splitter*>(child_dv->splitter.get());
} }
else
child_dv->splitter.reset();
::nana::rectangle child_r; ::nana::rectangle child_r;
double split_range_begin = -1, split_range_end; double split_range_begin = -1, split_range_end;

View File

@@ -171,20 +171,6 @@ namespace nana
} }
}; };
class dock_page
: public form
{
public:
dock_page(window host, const rectangle& r, const rectangle & tab_r)
: form(host, r, form::appear::bald<>())
{
tab_form_.reset(new form(handle(), tab_r, form::appear::bald<>()));
}
private:
std::unique_ptr<form> tab_form_;
};
class dockarea class dockarea
: public widget_object <category::lite_widget_tag, drawer_trigger> : public widget_object <category::lite_widget_tag, drawer_trigger>
{ {
@@ -362,16 +348,23 @@ namespace nana
API::capture_window(caption_, false); API::capture_window(caption_, false);
rectangle r{ pos() + move_pos, size() }; rectangle r{ pos() + move_pos, size() };
container_.reset(new form(host_window_, r.pare_off(-1), form::appear::bald<>())); container_.reset(new form(host_window_, r.pare_off(-1), form::appear::bald<form::appear::sizable>()));
drawing dw(container_->handle()); drawing dw(container_->handle());
dw.draw([](paint::graphics& graph) dw.draw([](paint::graphics& graph)
{ {
graph.rectangle(false, colors::coral); graph.rectangle(false, colors::coral);
}); });
API::set_parent_window(handle(), container_->handle()); API::set_parent_window(handle(), container_->handle());
this->move({ 1, 1 }); this->move({ 1, 1 });
container_->events().resized([this](const arg_resized& arg)
{
this->size({arg.width - 2, arg.height - 2});
});
container_->show(); container_->show();
API::capture_window(caption_, true); API::capture_window(caption_, true);