add throw() for some functions

This commit is contained in:
Jinhao 2015-08-03 01:37:36 +08:00
parent e0ee42d184
commit f4924ef2f8
15 changed files with 60 additions and 71 deletions

View File

@ -61,7 +61,7 @@ namespace API
widget_colors* get_scheme(window); widget_colors* get_scheme(window);
void attach_drawer(widget&, drawer_trigger&); void attach_drawer(widget&, drawer_trigger&);
nana::string window_caption(window); nana::string window_caption(window) throw();
void window_caption(window, nana::string); void window_caption(window, nana::string);
window create_window(window, bool nested, const rectangle&, const appearance&, widget* attached); window create_window(window, bool nested, const rectangle&, const appearance&, widget* attached);

View File

@ -224,7 +224,7 @@ namespace nana
const drawerbase::combox::drawer_impl& _m_impl() const; const drawerbase::combox::drawer_impl& _m_impl() const;
private: private:
//Overrides widget's virtual functions //Overrides widget's virtual functions
nana::string _m_caption() const override; nana::string _m_caption() const throw() override;
void _m_caption(nana::string&&) override; void _m_caption(nana::string&&) override;
nana::any * _m_anyobj(std::size_t pos, bool alloc_if_empty) const override; nana::any * _m_anyobj(std::size_t pos, bool alloc_if_empty) const override;
}; };

View File

@ -77,7 +77,7 @@ namespace nana{
void _m_add_child(const char* field, widget*); void _m_add_child(const char* field, widget*);
void _m_init(); void _m_init();
void _m_complete_creation() override; void _m_complete_creation() override;
::nana::string _m_caption() const override; ::nana::string _m_caption() const throw() override;
void _m_caption(::nana::string&&) override; void _m_caption(::nana::string&&) override;
private: private:
std::unique_ptr<implement> impl_; std::unique_ptr<implement> impl_;

View File

@ -58,16 +58,15 @@ namespace nana
label(); label();
label(window, bool visible); label(window, bool visible);
label(window, const nana::string& text, bool visible = true); label(window, const nana::string& text, bool visible = true);
label(window, const nana::char_t* text, bool visible = true);
label(window, const rectangle& = {}, bool visible = true); label(window, const rectangle& = {}, bool visible = true);
label& transparent(bool); ///< Switchs the label widget to the transparent background mode. label& transparent(bool); ///< Switchs the label widget to the transparent background mode.
bool transparent() const; bool transparent() const throw();
label& format(bool); ///< Switches the format mode of the widget. label& format(bool); ///< Switches the format mode of the widget.
label& add_format_listener(std::function<void(command, const nana::string&)>); label& add_format_listener(std::function<void(command, const nana::string&)>);
void click_for(window associated_window); // as same as the "for" attribute of a label label& click_for(window associated_window) throw(); // as same as the "for" attribute of a label
/// \briefReturn the size of the text. If *allowed_width_in_pixel* is not zero, returns a /// Returns the size of the text. If *allowed_width_in_pixel* is not zero, returns a
/// "corrected" size that changes lines to fit the text into the specified width /// "corrected" size that changes lines to fit the text into the specified width
nana::size measure(unsigned allowed_width_in_pixel) const; nana::size measure(unsigned allowed_width_in_pixel) const;

View File

@ -106,7 +106,7 @@ namespace nana
void modifier(std::wstring prefix, std::wstring suffix); void modifier(std::wstring prefix, std::wstring suffix);
void modifier(const std::string & prefix_utf8, const std::string& suffix_utf8); void modifier(const std::string & prefix_utf8, const std::string& suffix_utf8);
private: private:
::nana::string _m_caption() const; ::nana::string _m_caption() const throw();
void _m_caption(::nana::string&&); void _m_caption(::nana::string&&);
}; //end class spinbox }; //end class spinbox

View File

@ -187,7 +187,7 @@ namespace nana
void erase_keyword(const nana::string& kw); void erase_keyword(const nana::string& kw);
protected: protected:
//Overrides widget's virtual functions //Overrides widget's virtual functions
::nana::string _m_caption() const override; ::nana::string _m_caption() const throw() override;
void _m_caption(::nana::string&&) override; void _m_caption(::nana::string&&) override;
void _m_typeface(const paint::font&) override; void _m_typeface(const paint::font&) override;
}; };

View File

@ -41,9 +41,9 @@ namespace nana
window parent() const; window parent() const;
nana::string caption() const; nana::string caption() const throw();
void caption(std::string utf8); void caption(std::string utf8);
void caption(nana::string); void caption(std::wstring);
template<typename ...Args> template<typename ...Args>
void i18n(std::string msgid, Args&&... args) void i18n(std::string msgid, Args&&... args)
@ -105,7 +105,7 @@ namespace nana
virtual void _m_complete_creation(); virtual void _m_complete_creation();
virtual general_events& _m_get_general_events() const = 0; virtual general_events& _m_get_general_events() const = 0;
virtual nana::string _m_caption() const; virtual nana::string _m_caption() const throw();
virtual void _m_caption(nana::string&&); virtual void _m_caption(nana::string&&);
virtual nana::cursor _m_cursor() const; virtual nana::cursor _m_cursor() const;
virtual void _m_cursor(nana::cursor); virtual void _m_cursor(nana::cursor);

View File

@ -1305,24 +1305,20 @@ namespace detail
brock.event_move(msgwnd, (int)(short) LOWORD(lParam), (int)(short) HIWORD(lParam)); brock.event_move(msgwnd, (int)(short) LOWORD(lParam), (int)(short) HIWORD(lParam));
break; break;
case WM_PAINT: case WM_PAINT:
{
::PAINTSTRUCT ps;
::BeginPaint(root_window, &ps);
if (msgwnd->is_draw_through()) if (msgwnd->is_draw_through())
{ {
msgwnd->other.attribute.root->draw_through(); msgwnd->other.attribute.root->draw_through();
::PAINTSTRUCT ps;
::BeginPaint(root_window, &ps);
::EndPaint(root_window, &ps);
} }
else else
{ {
::PAINTSTRUCT ps;
::HDC dc = ::BeginPaint(root_window, &ps);
//Don't copy root_graph to the window directly, otherwise the edge nimbus effect will be missed. //Don't copy root_graph to the window directly, otherwise the edge nimbus effect will be missed.
::nana::rectangle update_area(ps.rcPaint.left, ps.rcPaint.top, ps.rcPaint.right - ps.rcPaint.left, ps.rcPaint.bottom - ps.rcPaint.top); ::nana::rectangle update_area(ps.rcPaint.left, ps.rcPaint.top, ps.rcPaint.right - ps.rcPaint.left, ps.rcPaint.bottom - ps.rcPaint.top);
if (!update_area.empty()) if (!update_area.empty())
msgwnd->drawer.map(reinterpret_cast<window>(msgwnd), true, &update_area); msgwnd->drawer.map(reinterpret_cast<window>(msgwnd), true, &update_area);
}
::EndPaint(root_window, &ps); ::EndPaint(root_window, &ps);
} }
break; break;

View File

@ -184,7 +184,7 @@ namespace API
} }
} }
nana::string window_caption(window wd) nana::string window_caption(window wd) throw()
{ {
auto const iwd = reinterpret_cast<restrict::core_window_t*>(wd); auto const iwd = reinterpret_cast<restrict::core_window_t*>(wd);
internal_scope_guard isg; internal_scope_guard isg;

View File

@ -988,7 +988,7 @@ namespace nana
API::refresh_window(*this); API::refresh_window(*this);
} }
nana::string combox::_m_caption() const nana::string combox::_m_caption() const throw()
{ {
internal_scope_guard lock; internal_scope_guard lock;
auto editor = _m_impl().editor(); auto editor = _m_impl().editor();

View File

@ -234,7 +234,7 @@ namespace nana{
_m_init(); _m_init();
} }
::nana::string group::_m_caption() const ::nana::string group::_m_caption() const throw()
{ {
return impl_->caption.caption(); return impl_->caption.caption();
} }

View File

@ -779,13 +779,6 @@ namespace nana
caption(text); caption(text);
} }
label::label(window wd, const nana::char_t* text, bool visible)
{
create(wd, rectangle(), visible);
bgcolor(API::bgcolor(wd));
caption(text);
}
label::label(window wd, const rectangle& r, bool visible) label::label(window wd, const rectangle& r, bool visible)
{ {
create(wd, r, visible); create(wd, r, visible);
@ -801,7 +794,7 @@ namespace nana
return *this; return *this;
} }
bool label::transparent() const bool label::transparent() const throw()
{ {
return (bground_mode::basic == API::effects_bground_mode(*this)); return (bground_mode::basic == API::effects_bground_mode(*this));
} }
@ -825,9 +818,10 @@ namespace nana
return *this; return *this;
} }
void label::click_for(window associated_window) label& label::click_for(window associated_window) throw()
{ {
get_drawer_trigger().impl()->for_associated_wd = associated_window; get_drawer_trigger().impl()->for_associated_wd = associated_window;
return *this;
} }
nana::size label::measure(unsigned limited) const nana::size label::measure(unsigned limited) const

View File

@ -682,7 +682,7 @@ namespace nana
modifier(static_cast<std::wstring>(::nana::charset(prefix_utf8, ::nana::unicode::utf8)), static_cast<std::wstring>(::nana::charset(suffix_utf8, ::nana::unicode::utf8))); modifier(static_cast<std::wstring>(::nana::charset(prefix_utf8, ::nana::unicode::utf8)), static_cast<std::wstring>(::nana::charset(suffix_utf8, ::nana::unicode::utf8)));
} }
::nana::string spinbox::_m_caption() const ::nana::string spinbox::_m_caption() const throw()
{ {
internal_scope_guard lock; internal_scope_guard lock;
auto editor = get_drawer_trigger().impl()->editor(); auto editor = get_drawer_trigger().impl()->editor();

View File

@ -515,7 +515,7 @@ namespace drawerbase {
} }
//Override _m_caption for caption() //Override _m_caption for caption()
nana::string textbox::_m_caption() const nana::string textbox::_m_caption() const throw()
{ {
internal_scope_guard lock; internal_scope_guard lock;
auto editor = get_drawer_trigger().editor(); auto editor = get_drawer_trigger().editor();

View File

@ -54,7 +54,7 @@ namespace nana
widget& wdg_; widget& wdg_;
}; };
nana::string widget::caption() const nana::string widget::caption() const throw()
{ {
return this->_m_caption(); return this->_m_caption();
} }
@ -64,7 +64,7 @@ namespace nana
_m_caption(std::wstring(::nana::charset(utf8, ::nana::unicode::utf8))); _m_caption(std::wstring(::nana::charset(utf8, ::nana::unicode::utf8)));
} }
void widget::caption(nana::string str) void widget::caption(std::wstring str)
{ {
_m_caption(std::move(str)); _m_caption(std::move(str));
} }
@ -252,7 +252,7 @@ namespace nana
void widget::_m_complete_creation() void widget::_m_complete_creation()
{} {}
nana::string widget::_m_caption() const nana::string widget::_m_caption() const throw()
{ {
return API::dev::window_caption(handle()); return API::dev::window_caption(handle());
} }