From f715fb613ec77b2ac2f5d3434de4f98f7b9fbea4 Mon Sep 17 00:00:00 2001 From: Jinhao Date: Thu, 12 Nov 2015 01:54:35 +0800 Subject: [PATCH] fix resize and spliter issues of dockable window --- source/gui/place.cpp | 8 ++++++++ source/gui/place_parts.hpp | 23 ++++++++--------------- 2 files changed, 16 insertions(+), 15 deletions(-) diff --git a/source/gui/place.cpp b/source/gui/place.cpp index cc57df39..c31daf36 100644 --- a/source/gui/place.cpp +++ b/source/gui/place.cpp @@ -1920,7 +1920,13 @@ namespace nana for (auto & child : children) { if (!child->display) + { + auto child_dv = dynamic_cast(child.get()); + if (child_dv) + child_dv->splitter.reset(); + continue; + } auto child_dv = dynamic_cast(child.get()); const bool is_vert = _m_is_vert(child->dir); @@ -1949,6 +1955,8 @@ namespace nana else split = dynamic_cast(child_dv->splitter.get()); } + else + child_dv->splitter.reset(); ::nana::rectangle child_r; double split_range_begin = -1, split_range_end; diff --git a/source/gui/place_parts.hpp b/source/gui/place_parts.hpp index 2b9da143..f8026ce7 100644 --- a/source/gui/place_parts.hpp +++ b/source/gui/place_parts.hpp @@ -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
tab_form_; - }; - class dockarea : public widget_object { @@ -362,16 +348,23 @@ namespace nana API::capture_window(caption_, false); 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())); drawing dw(container_->handle()); dw.draw([](paint::graphics& graph) { graph.rectangle(false, colors::coral); }); + + API::set_parent_window(handle(), container_->handle()); this->move({ 1, 1 }); + container_->events().resized([this](const arg_resized& arg) + { + this->size({arg.width - 2, arg.height - 2}); + }); + container_->show(); API::capture_window(caption_, true);