From d1d03c9c0a8895e3ec4feac103b966be57cbe8bd Mon Sep 17 00:00:00 2001 From: Jinhao Date: Tue, 11 Jul 2017 23:27:45 +0800 Subject: [PATCH] code refined --- include/nana/gui/msgbox.hpp | 2 +- source/gui/msgbox.cpp | 25 +++++++++++-------------- 2 files changed, 12 insertions(+), 15 deletions(-) diff --git a/include/nana/gui/msgbox.hpp b/include/nana/gui/msgbox.hpp index bb17c448..e23c043e 100644 --- a/include/nana/gui/msgbox.hpp +++ b/include/nana/gui/msgbox.hpp @@ -1,7 +1,7 @@ /* * A Message Box Class * Nana C++ Library(http://www.nanapro.org) -* Copyright(C) 2003-2015 Jinhao(cnjinhao@hotmail.com) +* Copyright(C) 2003-2017 Jinhao(cnjinhao@hotmail.com) * * Distributed under the Boost Software License, Version 1.0. * (See accompanying file LICENSE_1_0.txt or copy at diff --git a/source/gui/msgbox.cpp b/source/gui/msgbox.cpp index 6560fe93..d6620c7a 100644 --- a/source/gui/msgbox.cpp +++ b/source/gui/msgbox.cpp @@ -1,7 +1,7 @@ /* * A Message Box Class * Nana C++ Library(http://www.nanapro.org) - * Copyright(C) 2003-2016 Jinhao(cnjinhao@hotmail.com) + * Copyright(C) 2003-2017 Jinhao(cnjinhao@hotmail.com) * * Distributed under the Boost Software License, Version 1.0. * (See accompanying file LICENSE_1_0.txt or copy at @@ -18,7 +18,6 @@ #include #include #include -#include #include #include #include @@ -511,7 +510,6 @@ namespace nana unsigned height = 20 + desc_extent.height + 10 + 38; - place_.bind(*this); std::stringstream ss_content; ss_content << "<"<>"; - place_.div(ss.str().data()); - place_["desc"] << desc_; - place_["buttons"] << btn_ok_ << btn_cancel_; + auto& place = this->get_place(); + place.div(ss.str().c_str()); + place["desc"] << desc_; + place["buttons"] << btn_ok_ << btn_cancel_; const char * img_fields[4] = {"img_top", "img_bottom", "img_left", "img_right"}; @@ -611,11 +610,10 @@ namespace nana images_[i].create(*this, true); images_[i].load(imgs[i], valid_areas[i]); images_[i].stretchable(0, 0, 0, 0); - place_[img_fields[i]] << images_[i]; - place_.field_display(img_fields[i], true); + place[img_fields[i]] << images_[i]; } - else - place_.field_display(img_fields[i], false); + + place.field_display(img_fields[i], imgs[i]); } move(API::make_center(this->owner(), desc_extent.width, height)); @@ -626,14 +624,14 @@ namespace nana { verifier_ = std::move(verifier); - std::size_t index = 0; + unsigned index = 0; for (auto wd : inputs) { std::stringstream ss; ss << "input_" << index++; - place_[ss.str().data()] << wd; + this->operator[](ss.str().data()) << wd; } - place_.collocate(); + this->collocate(); show(); } @@ -646,7 +644,6 @@ namespace nana ::nana::button btn_ok_; ::nana::button btn_cancel_; bool valid_input_{ false }; - ::nana::place place_; std::function verifier_; ::nana::picture images_[4]; };