optimize generated binary size

This commit is contained in:
Jinhao
2016-02-19 00:49:32 +08:00
parent d3120cbf35
commit a839cf8deb
11 changed files with 68 additions and 85 deletions

View File

@@ -479,7 +479,7 @@ namespace nana{ namespace drawerbase
void button::_m_complete_creation()
{
events().shortkey.connect_unignorable([this]
events().shortkey.connect_unignorable([this](const arg_keyboard&)
{
get_drawer_trigger().emit_click();
});

View File

@@ -571,7 +571,7 @@ namespace nana
style_.listbox = &(form_loader<nana::float_listbox>()(window_, r, true));
style_.listbox->set_module(style_.module, 16);
style_.listbox->events().destroy.connect_unignorable([this]
style_.listbox->events().destroy.connect_unignorable([this](const arg_destroy&)
{
//Close list when listbox is destoryed
style_.mode = mode::normal;

View File

@@ -1,7 +1,7 @@
/*
* A Combox Implementation
* Nana C++ Library(http://www.nanapro.org)
* Copyright(C) 2003-2015 Jinhao(cnjinhao@hotmail.com)
* Copyright(C) 2003-2016 Jinhao(cnjinhao@hotmail.com)
*
* Distributed under the Boost Software License, Version 1.0.
* (See accompanying file LICENSE_1_0.txt or copy at
@@ -253,12 +253,25 @@ namespace nana
state_.lister->renderer(item_renderer_);
state_.lister->set_module(module_, image_pixels_);
state_.item_index_before_selection = module_.index;
//The lister window closes by itself. I just take care about the destroy event.
//The event should be destroy rather than unload. Because the unload event is invoked while
//the lister is not closed, if popuping a message box, the lister will cover the message box.
state_.lister->events().destroy.connect_unignorable([this]
state_.lister->events().destroy.connect_unignorable([this](const arg_destroy&)
{
_m_lister_close_sig();
state_.lister = nullptr; //The lister closes by itself.
if ((module_.index != nana::npos) && (module_.index != state_.item_index_before_selection))
{
option(module_.index, true);
API::update_window(*widget_);
}
else
{
//Redraw the widget even though the index has not been changed,
//because the push button should be updated due to the state
//changed from pressed to normal/hovered.
API::refresh_window(*widget_);
}
});
}
}
@@ -432,23 +445,6 @@ namespace nana
return true;
}
private:
void _m_lister_close_sig()
{
state_.lister = nullptr; //The lister closes by itself.
if ((module_.index != nana::npos) && (module_.index != state_.item_index_before_selection))
{
option(module_.index, true);
API::update_window(*widget_);
}
else
{
//Redraw the widget even though the index has not been changed,
//because the push button should be updated due to the state
//changed from pressed to normal/hovered.
API::refresh_window(*widget_);
}
}
void _m_draw_push_button(bool enabled)
{
::nana::rectangle r{graph_->size()};

View File

@@ -3770,8 +3770,6 @@ namespace nana
else if (ess_->lister.last_selected_abs == pos_)
ess_->lister.last_selected_abs.set_both(npos);
ess_->update();
ess_->update();
return *this;
}

View File

@@ -13,7 +13,6 @@
#include <nana/gui/widgets/textbox.hpp>
#include <nana/gui/widgets/skeletons/text_editor.hpp>
#include <stdexcept>
#include <sstream>
namespace nana
{
@@ -495,11 +494,7 @@ namespace drawerbase {
auto s = _m_caption();
if (s.empty()) return 0;
std::stringstream ss;
int value;
ss << to_utf8(s);
ss >> value;
return value;
return std::stoi(s, nullptr, 0);
}
double textbox::to_double() const
@@ -507,11 +502,7 @@ namespace drawerbase {
auto s = _m_caption();
if (s.empty()) return 0;
std::stringstream ss;
double value;
ss << to_utf8(s);
ss >> value;
return value;
return std::stod(s);
}
textbox& textbox::from(int n)