add event stop_propagation

This commit is contained in:
cnjinhao 2015-02-01 17:12:19 +08:00
parent fc76758197
commit 46f8182c50
28 changed files with 182 additions and 69 deletions

View File

@ -315,6 +315,7 @@ namespace nana
///< Blends two colors with the specified alpha, and the alpha values that come with these two colors are both ignored. ///< Blends two colors with the specified alpha, and the alpha values that come with these two colors are both ignored.
color blend(const color& bgcolor, double alpha) const; color blend(const color& bgcolor, double alpha) const;
///< Determines whether the color is completely transparent.
bool invisible() const; bool invisible() const;
pixel_color_t px_color() const; pixel_color_t px_color() const;
pixel_argb_t argb() const; pixel_argb_t argb() const;

View File

@ -1,7 +1,7 @@
/* /*
* A Bedrock Implementation * A Bedrock Implementation
* Nana C++ Library(http://www.nanapro.org) * Nana C++ Library(http://www.nanapro.org)
* Copyright(C) 2003-2014 Jinhao(cnjinhao@hotmail.com) * Copyright(C) 2003-2015 Jinhao(cnjinhao@hotmail.com)
* *
* Distributed under the Boost Software License, Version 1.0. * Distributed under the Boost Software License, Version 1.0.
* (See accompanying file LICENSE_1_0.txt or copy at * (See accompanying file LICENSE_1_0.txt or copy at
@ -81,16 +81,16 @@ namespace detail
widget_colors& get_scheme_template(scheme_factory_base&&); widget_colors& get_scheme_template(scheme_factory_base&&);
std::unique_ptr<widget_colors> make_scheme(scheme_factory_base&&); std::unique_ptr<widget_colors> make_scheme(scheme_factory_base&&);
public: public:
window_manager_t wd_manager;
events_operation evt_operation; events_operation evt_operation;
window_manager_t wd_manager;
runtime_manager<core_window_t*, bedrock> rt_manager; runtime_manager<core_window_t*, bedrock> rt_manager;
bool emit(event_code, core_window_t*, const arg_mouse&, bool ask_update, thread_context*); bool emit(event_code, core_window_t*, const arg_mouse&, bool ask_update, thread_context*);
bool emit(event_code, core_window_t*, const event_arg_interface&, bool ask_update, thread_context*); bool emit(event_code, core_window_t*, const event_arg&, bool ask_update, thread_context*);
bool emit_drawer(event_code, core_window_t*, const event_arg_interface&, thread_context*); bool emit_drawer(event_code, core_window_t*, const event_arg&, thread_context*);
private: private:
void _m_emit_core(event_code, core_window_t*, bool draw_only, const event_arg_interface&); void _m_emit_core(event_code, core_window_t*, bool draw_only, const event_arg&);
void _m_event_filter(event_code, core_window_t*, thread_context*); void _m_event_filter(event_code, core_window_t*, thread_context*);
void _m_except_handler(); void _m_except_handler();
private: private:

View File

@ -1,7 +1,7 @@
/* /*
* Definition of General Events * Definition of General Events
* Nana C++ Library(http://www.nanapro.org) * Nana C++ Library(http://www.nanapro.org)
* Copyright(C) 2003-2014 Jinhao(cnjinhao@hotmail.com) * Copyright(C) 2003-2015 Jinhao(cnjinhao@hotmail.com)
* *
* Distributed under the Boost Software License, Version 1.0. * Distributed under the Boost Software License, Version 1.0.
* (See accompanying file LICENSE_1_0.txt or copy at * (See accompanying file LICENSE_1_0.txt or copy at
@ -39,16 +39,21 @@ namespace nana
virtual event_interface* get_event() const = 0; virtual event_interface* get_event() const = 0;
}; };
class event_arg_interface
{
public:
virtual ~event_arg_interface() = default;
};
void events_operation_register(event_handle); void events_operation_register(event_handle);
void events_operation_cancel(event_handle); void events_operation_cancel(event_handle);
}//end namespace detail }//end namespace detail
class event_arg
{
public:
virtual ~event_arg();
void stop_propagation() const;
bool propagation_stopped() const;
private:
mutable bool stop_propagation_{ false };
};
struct general_events; struct general_events;
template<typename Arg> template<typename Arg>
@ -62,15 +67,16 @@ namespace nana
{ {
basic_event * const event_ptr; basic_event * const event_ptr;
std::function<void(arg_reference)> invoke; std::function<void(arg_reference)> invoke;
bool flag_entered = false; bool flag_entered{ false };
bool flag_deleted = false; bool flag_deleted{ false };
bool unignorable{false};
docker(basic_event * s, std::function<void(arg_reference)> && ivk) docker(basic_event * s, std::function<void(arg_reference)> && ivk, bool unignorable_flag)
: event_ptr(s), invoke(std::move(ivk)) : event_ptr(s), invoke(std::move(ivk)), unignorable(unignorable_flag)
{} {}
docker(basic_event * s, const std::function<void(arg_reference)> & ivk) docker(basic_event * s, const std::function<void(arg_reference)> & ivk, bool unignorable_flag)
: event_ptr(s), invoke(ivk) : event_ptr(s), invoke(ivk), unignorable(unignorable_flag)
{} {}
~docker() ~docker()
@ -91,8 +97,8 @@ namespace nana
if (nullptr == dockers_) if (nullptr == dockers_)
dockers_.reset(new std::vector<std::unique_ptr<docker>>); dockers_.reset(new std::vector<std::unique_ptr<docker>>);
typedef typename std::remove_reference<Function>::type prototype; using prototype = typename std::remove_reference<Function>::type;
std::unique_ptr<docker> dck(new docker(this, factory<prototype, std::is_bind_expression<prototype>::value>::build(std::forward<Function>(fn)))); std::unique_ptr<docker> dck(new docker(this, factory<prototype, std::is_bind_expression<prototype>::value>::build(std::forward<Function>(fn)), false));
auto evt = reinterpret_cast<event_handle>(static_cast<detail::docker_interface*>(dck.get())); auto evt = reinterpret_cast<event_handle>(static_cast<detail::docker_interface*>(dck.get()));
dockers_->emplace(dockers_->begin(), std::move(dck)); dockers_->emplace(dockers_->begin(), std::move(dck));
detail::events_operation_register(evt); detail::events_operation_register(evt);
@ -113,8 +119,8 @@ namespace nana
if (nullptr == dockers_) if (nullptr == dockers_)
dockers_.reset(new std::vector<std::unique_ptr<docker>>); dockers_.reset(new std::vector<std::unique_ptr<docker>>);
typedef typename std::remove_reference<Function>::type prototype; using prototype = typename std::remove_reference<Function>::type;
std::unique_ptr<docker> dck(new docker(this, factory<prototype, std::is_bind_expression<prototype>::value>::build(std::forward<Function>(fn)))); std::unique_ptr<docker> dck(new docker(this, factory<prototype, std::is_bind_expression<prototype>::value>::build(std::forward<Function>(fn)), false));
auto evt = reinterpret_cast<event_handle>(static_cast<detail::docker_interface*>(dck.get())); auto evt = reinterpret_cast<event_handle>(static_cast<detail::docker_interface*>(dck.get()));
dockers_->emplace_back(std::move(dck)); dockers_->emplace_back(std::move(dck));
detail::events_operation_register(evt); detail::events_operation_register(evt);
@ -127,6 +133,24 @@ namespace nana
return connect(std::forward<Function>(fn)); return connect(std::forward<Function>(fn));
} }
template<typename Function>
event_handle connect_unignorable(Function && fn, bool in_front = false)
{
internal_scope_guard lock;
if (nullptr == dockers_)
dockers_.reset(new std::vector<std::unique_ptr<docker>>);
using prototype = typename std::remove_reference<Function>::type;
std::unique_ptr<docker> dck(new docker(this, factory<prototype, std::is_bind_expression<prototype>::value>::build(std::forward<Function>(fn)), true));
auto evt = reinterpret_cast<event_handle>(static_cast<detail::docker_interface*>(dck.get()));
if (in_front)
dockers_->emplace(dockers_->begin(), std::move(dck));
else
dockers_->emplace_back(std::move(dck));
detail::events_operation_register(evt);
return evt;
}
std::size_t length() const std::size_t length() const
{ {
internal_scope_guard lock; internal_scope_guard lock;
@ -158,20 +182,30 @@ namespace nana
(*output++) = dck.get(); (*output++) = dck.get();
} }
bool stop_propagation = false;
for (; transitory != output; ++transitory) for (; transitory != output; ++transitory)
{ {
std::unique_ptr<docker> p(*transitory); auto docker_ptr = *transitory;
auto i = std::find(dockers.begin(), dockers.end(), p); if (stop_propagation && !docker_ptr->unignorable)
continue;
auto i = std::find_if(dockers.begin(), dockers.end(), [docker_ptr](std::unique_ptr<docker>& p){
return (docker_ptr == p.get());
});
if (i != dockers.end()) if (i != dockers.end())
{ {
(*transitory)->flag_entered = true; docker_ptr->flag_entered = true;
(*transitory)->invoke(arg); docker_ptr->invoke(arg);
(*transitory)->flag_entered = false;
if ((*transitory)->flag_deleted) if (arg.propagation_stopped())
stop_propagation = true;
docker_ptr->flag_entered = false;
if (docker_ptr->flag_deleted)
dockers.erase(i); dockers.erase(i);
} }
p.release();
} }
} }
@ -182,7 +216,7 @@ namespace nana
dockers_.reset(); dockers_.reset();
} }
void remove(event_handle evt) void remove(event_handle evt) override
{ {
internal_scope_guard lock; internal_scope_guard lock;
if (dockers_) if (dockers_)
@ -362,7 +396,7 @@ namespace nana
}; };
struct arg_mouse struct arg_mouse
: public detail::event_arg_interface : public event_arg
{ {
event_code evt_code; event_code evt_code;
::nana::window window_handle; ::nana::window window_handle;
@ -386,27 +420,27 @@ namespace nana
unsigned distance; //expressed in multiples or divisions of 120 unsigned distance; //expressed in multiples or divisions of 120
}; };
struct arg_dropfiles : public detail::event_arg_interface struct arg_dropfiles : public event_arg
{ {
::nana::window window_handle; ::nana::window window_handle;
::nana::point pos; ::nana::point pos;
std::vector<nana::string> files; std::vector<nana::string> files;
}; };
struct arg_expose : public detail::event_arg_interface struct arg_expose : public event_arg
{ {
::nana::window window_handle; ::nana::window window_handle;
bool exposed; bool exposed;
}; };
struct arg_focus : public detail::event_arg_interface struct arg_focus : public event_arg
{ {
::nana::window window_handle; ::nana::window window_handle;
::nana::native_window_type receiver; ::nana::native_window_type receiver;
bool getting; bool getting;
}; };
struct arg_keyboard : public detail::event_arg_interface struct arg_keyboard : public event_arg
{ {
event_code evt_code; event_code evt_code;
::nana::window window_handle; ::nana::window window_handle;
@ -416,21 +450,21 @@ namespace nana
bool shift; bool shift;
}; };
struct arg_move : public detail::event_arg_interface struct arg_move : public event_arg
{ {
::nana::window window_handle; ::nana::window window_handle;
int x; int x;
int y; int y;
}; };
struct arg_resized : public detail::event_arg_interface struct arg_resized : public event_arg
{ {
::nana::window window_handle; ::nana::window window_handle;
unsigned width; unsigned width;
unsigned height; unsigned height;
}; };
struct arg_resizing : public detail::event_arg_interface struct arg_resizing : public event_arg
{ {
::nana::window window_handle; ::nana::window window_handle;
window_border border; window_border border;
@ -438,13 +472,13 @@ namespace nana
mutable unsigned height; mutable unsigned height;
}; };
struct arg_unload : public detail::event_arg_interface struct arg_unload : public event_arg
{ {
::nana::window window_handle; ::nana::window window_handle;
mutable bool cancel; mutable bool cancel;
}; };
struct arg_destroy : public detail::event_arg_interface struct arg_destroy : public event_arg
{ {
::nana::window window_handle; ::nana::window window_handle;
}; };

View File

@ -1,7 +1,7 @@
/* /*
* Definition of Notifier * Definition of Notifier
* Nana C++ Library(http://www.nanapro.org) * Nana C++ Library(http://www.nanapro.org)
* Copyright(C) 2003-2014 Jinhao(cnjinhao@hotmail.com) * Copyright(C) 2003-2015 Jinhao(cnjinhao@hotmail.com)
* *
* Distributed under the Boost Software License, Version 1.0. * Distributed under the Boost Software License, Version 1.0.
* (See accompanying file LICENSE_1_0.txt or copy at * (See accompanying file LICENSE_1_0.txt or copy at
@ -20,6 +20,7 @@ namespace nana
class notifier; class notifier;
struct arg_notifier struct arg_notifier
: public event_arg
{ {
event_code evt_code; event_code evt_code;
notifier* notifier_ptr; notifier* notifier_ptr;

View File

@ -1,7 +1,7 @@
/* /*
* Nana GUI Programming Interface Implementation * Nana GUI Programming Interface Implementation
* Nana C++ Library(http://www.nanapro.org) * Nana C++ Library(http://www.nanapro.org)
* Copyright(C) 2003-2014 Jinhao(cnjinhao@hotmail.com) * Copyright(C) 2003-2015 Jinhao(cnjinhao@hotmail.com)
* *
* Distributed under the Boost Software License, Version 1.0. * Distributed under the Boost Software License, Version 1.0.
* (See accompanying file LICENSE_1_0.txt or copy at * (See accompanying file LICENSE_1_0.txt or copy at
@ -164,7 +164,7 @@ namespace API
return *widget_evt; return *widget_evt;
} }
template<typename EventArg, typename std::enable_if<std::is_base_of< ::nana::detail::event_arg_interface, EventArg>::value>::type* = nullptr> template<typename EventArg, typename std::enable_if<std::is_base_of< ::nana::event_arg, EventArg>::value>::type* = nullptr>
bool emit_event(event_code evt_code, window wd, const EventArg& arg) bool emit_event(event_code evt_code, window wd, const EventArg& arg)
{ {
auto & brock = ::nana::detail::bedrock::instance(); auto & brock = ::nana::detail::bedrock::instance();

View File

@ -1,6 +1,6 @@
/* /*
* A Timer Implementation * A Timer Implementation
* Copyright(C) 2003-2013 Jinhao(cnjinhao@hotmail.com) * Copyright(C) 2003-2015 Jinhao(cnjinhao@hotmail.com)
* *
* Distributed under the Boost Software License, Version 1.0. * Distributed under the Boost Software License, Version 1.0.
* (See accompanying file LICENSE_1_0.txt or copy at * (See accompanying file LICENSE_1_0.txt or copy at
@ -22,6 +22,7 @@ namespace nana
/// Can repeatedly call a piece of code. /// Can repeatedly call a piece of code.
struct arg_elapse struct arg_elapse
: public event_arg
{ {
long long id; //timer identifier; long long id; //timer identifier;
}; };

View File

@ -1,7 +1,7 @@
/* /*
* A Categorize Implementation * A Categorize Implementation
* Nana C++ Library(http://www.nanapro.org) * Nana C++ Library(http://www.nanapro.org)
* Copyright(C) 2003-2014 Jinhao(cnjinhao@hotmail.com) * Copyright(C) 2003-2015 Jinhao(cnjinhao@hotmail.com)
* *
* Distributed under the Boost Software License, Version 1.0. * Distributed under the Boost Software License, Version 1.0.
* (See accompanying file LICENSE_1_0.txt or copy at * (See accompanying file LICENSE_1_0.txt or copy at
@ -23,6 +23,7 @@ namespace nana
template<typename ValueType> template<typename ValueType>
struct arg_categorize struct arg_categorize
: public event_arg
{ {
categorize<ValueType> & widget; categorize<ValueType> & widget;
ValueType & value; ValueType & value;

View File

@ -25,6 +25,7 @@ namespace nana
class combox; class combox;
struct arg_combox struct arg_combox
: public event_arg
{ {
combox & widget; combox & widget;

View File

@ -1,7 +1,7 @@
/* /*
* A List Box Implementation * A List Box Implementation
* Nana C++ Library(http://www.nanapro.org) * Nana C++ Library(http://www.nanapro.org)
* Copyright(C) 2003-2014 Jinhao(cnjinhao@hotmail.com) * Copyright(C) 2003-2015 Jinhao(cnjinhao@hotmail.com)
* *
* Distributed under the Boost Software License, Version 1.0. * Distributed under the Boost Software License, Version 1.0.
* (See accompanying file LICENSE_1_0.txt or copy at * (See accompanying file LICENSE_1_0.txt or copy at
@ -416,9 +416,12 @@ namespace nana
}//end namespace drawerbase }//end namespace drawerbase
struct arg_listbox struct arg_listbox
: public event_arg
{ {
mutable drawerbase::listbox::item_proxy item; mutable drawerbase::listbox::item_proxy item;
bool selected; bool selected;
arg_listbox(drawerbase::listbox::item_proxy&, bool selected);
}; };
namespace drawerbase namespace drawerbase

View File

@ -1,7 +1,7 @@
/* /*
* A Panel Implementation * A Panel Implementation
* Nana C++ Library(http://www.nanaro.org) * Nana C++ Library(http://www.nanaro.org)
* Copyright(C) 2003-2014 Jinhao(cnjinhao@hotmail.com) * Copyright(C) 2003-2015 Jinhao(cnjinhao@hotmail.com)
* *
* Distributed under the Boost Software License, Version 1.0. * Distributed under the Boost Software License, Version 1.0.
* (See accompanying file LICENSE_1_0.txt or copy at * (See accompanying file LICENSE_1_0.txt or copy at

View File

@ -1,7 +1,7 @@
/* /*
* A Picture Implementation * A Picture Implementation
* Nana C++ Library(http://www.nanapro.org) * Nana C++ Library(http://www.nanapro.org)
* Copyright(C) 2003-2014 Jinhao(cnjinhao@hotmail.com) * Copyright(C) 2003-2015 Jinhao(cnjinhao@hotmail.com)
* *
* Distributed under the Boost Software License, Version 1.0. * Distributed under the Boost Software License, Version 1.0.
* (See accompanying file LICENSE_1_0.txt or copy at * (See accompanying file LICENSE_1_0.txt or copy at

View File

@ -1,7 +1,7 @@
/* /*
* A Progress Indicator Implementation * A Progress Indicator Implementation
* Nana C++ Library(http://www.nanapro.org) * Nana C++ Library(http://www.nanapro.org)
* Copyright(C) 2003-2014 Jinhao(cnjinhao@hotmail.com) * Copyright(C) 2003-2015 Jinhao(cnjinhao@hotmail.com)
* *
* Distributed under the Boost Software License, Version 1.0. * Distributed under the Boost Software License, Version 1.0.
* (See accompanying file LICENSE_1_0.txt or copy at * (See accompanying file LICENSE_1_0.txt or copy at

View File

@ -1,7 +1,7 @@
/* /*
* A Scroll Implementation * A Scroll Implementation
* Nana C++ Library(http://www.nanapro.org) * Nana C++ Library(http://www.nanapro.org)
* Copyright(C) 2003-2014 Jinhao(cnjinhao@hotmail.com) * Copyright(C) 2003-2015 Jinhao(cnjinhao@hotmail.com)
* *
* Distributed under the Boost Software License, Version 1.0. * Distributed under the Boost Software License, Version 1.0.
* (See accompanying file LICENSE_1_0.txt or copy at * (See accompanying file LICENSE_1_0.txt or copy at
@ -22,8 +22,13 @@ namespace nana
template<bool Vert> template<bool Vert>
struct arg_scroll struct arg_scroll
: public event_arg
{ {
scroll<Vert> & widget; scroll<Vert> & widget;
arg_scroll(scroll<Vert> & wdg)
: widget{ wdg }
{}
}; };
namespace drawerbase namespace drawerbase

View File

@ -1,7 +1,7 @@
/* /*
* A Slider Implementation * A Slider Implementation
* Nana C++ Library(http://www.nanapro.org) * Nana C++ Library(http://www.nanapro.org)
* Copyright(C) 2003-2014 Jinhao(cnjinhao@hotmail.com) * Copyright(C) 2003-2015 Jinhao(cnjinhao@hotmail.com)
* *
* Distributed under the Boost Software License, Version 1.0. * Distributed under the Boost Software License, Version 1.0.
* (See accompanying file LICENSE_1_0.txt or copy at * (See accompanying file LICENSE_1_0.txt or copy at
@ -19,8 +19,11 @@ namespace nana
class slider; class slider;
struct arg_slider struct arg_slider
: public event_arg
{ {
slider & widget; slider & widget;
arg_slider(slider&);
}; };
namespace drawerbase namespace drawerbase

View File

@ -20,6 +20,7 @@ namespace nana
class spinbox; class spinbox;
struct arg_spinbox struct arg_spinbox
: public event_arg
{ {
spinbox & widget; spinbox & widget;
@ -123,7 +124,17 @@ namespace nana
private: private:
::nana::string _m_caption() const; ::nana::string _m_caption() const;
void _m_caption(::nana::string&&); void _m_caption(::nana::string&&);
}; }; //end class spinbox
namespace dev
{
template<>
struct widget_traits<spinbox>
{
using event_type = drawerbase::spinbox::spinbox_events;
using scheme_type = ::nana::widgets::skeletons::text_editor_scheme;
};
}
}//end namespace nana }//end namespace nana
#endif //NANA_GUI_WIDGET_SPINBOX_HPP #endif //NANA_GUI_WIDGET_SPINBOX_HPP

View File

@ -1,7 +1,7 @@
/* /*
* A Tabbar implementation * A Tabbar implementation
* Nana C++ Library(http://www.nanapro.org) * Nana C++ Library(http://www.nanapro.org)
* Copyright(C) 2003-2014 Jinhao(cnjinhao@hotmail.com) * Copyright(C) 2003-2015 Jinhao(cnjinhao@hotmail.com)
* *
* Distributed under the Boost Software License, Version 1.0. * Distributed under the Boost Software License, Version 1.0.
* (See accompanying file LICENSE_1_0.txt or copy at * (See accompanying file LICENSE_1_0.txt or copy at
@ -24,9 +24,14 @@ namespace nana
template<typename T> template<typename T>
struct arg_tabbar struct arg_tabbar
: public event_arg
{ {
tabbar<T> & widget; tabbar<T> & widget;
T & value; T & value;
arg_tabbar(tabbar<T>& wdg, T& v)
: widget{ wdg }, value{ v }
{}
}; };
template<typename T> template<typename T>

View File

@ -20,8 +20,11 @@ namespace nana
class textbox; class textbox;
struct arg_textbox struct arg_textbox
: public event_arg
{ {
textbox& widget; textbox& widget;
arg_textbox(textbox&);
}; };
namespace widgets namespace widgets

View File

@ -1,7 +1,7 @@
/* /*
* A Toolbar Implementation * A Toolbar Implementation
* Nana C++ Library(http://www.nanapro.org) * Nana C++ Library(http://www.nanapro.org)
* Copyright(C) 2003-2014 Jinhao(cnjinhao@hotmail.com) * Copyright(C) 2003-2015 Jinhao(cnjinhao@hotmail.com)
* *
* Distributed under the Boost Software License, Version 1.0. * Distributed under the Boost Software License, Version 1.0.
* (See accompanying file LICENSE_1_0.txt or copy at * (See accompanying file LICENSE_1_0.txt or copy at
@ -21,9 +21,12 @@ namespace nana
class toolbar; class toolbar;
struct arg_toolbar struct arg_toolbar
: public event_arg
{ {
toolbar& widget; toolbar& widget;
std::size_t button; std::size_t button;
arg_toolbar(toolbar&, std::size_t);
}; };
namespace drawerbase namespace drawerbase

View File

@ -1,7 +1,7 @@
/* /*
* A Tree Box Implementation * A Tree Box Implementation
* Nana C++ Library(http://www.nanapro.org) * Nana C++ Library(http://www.nanapro.org)
* Copyright(C) 2003-2014 Jinhao(cnjinhao@hotmail.com) * Copyright(C) 2003-2015 Jinhao(cnjinhao@hotmail.com)
* *
* Distributed under the Boost Software License, Version 1.0. * Distributed under the Boost Software License, Version 1.0.
* (See accompanying file LICENSE_1_0.txt or copy at * (See accompanying file LICENSE_1_0.txt or copy at
@ -333,10 +333,13 @@ namespace nana
}//end namespace drawerbase }//end namespace drawerbase
struct arg_treebox struct arg_treebox
: public event_arg
{ {
treebox& widget; treebox& widget;
drawerbase::treebox::item_proxy & item; drawerbase::treebox::item_proxy & item;
bool operated; bool operated;
arg_treebox(treebox&, drawerbase::treebox::item_proxy&, bool operated);
}; };
namespace drawerbase namespace drawerbase

View File

@ -1,7 +1,7 @@
/* /*
* The fundamental widget class implementation * The fundamental widget class implementation
* Nana C++ Library(http://www.nanapro.org) * Nana C++ Library(http://www.nanapro.org)
* Copyright(C) 2003-2014 Jinhao(cnjinhao@hotmail.com) * Copyright(C) 2003-2015 Jinhao(cnjinhao@hotmail.com)
* *
* Distributed under the Boost Software License, Version 1.0. * Distributed under the Boost Software License, Version 1.0.
* (See accompanying file LICENSE_1_0.txt or copy at * (See accompanying file LICENSE_1_0.txt or copy at

View File

@ -1,7 +1,7 @@
/* /*
* A Bedrock Platform-Independent Implementation * A Bedrock Platform-Independent Implementation
* Nana C++ Library(http://www.nanapro.org) * Nana C++ Library(http://www.nanapro.org)
* Copyright(C) 2003-2014 Jinhao(cnjinhao@hotmail.com) * Copyright(C) 2003-2015 Jinhao(cnjinhao@hotmail.com)
* *
* Distributed under the Boost Software License, Version 1.0. * Distributed under the Boost Software License, Version 1.0.
* (See accompanying file LICENSE_1_0.txt or copy at * (See accompanying file LICENSE_1_0.txt or copy at
@ -25,6 +25,20 @@
namespace nana namespace nana
{ {
//class event_arg
event_arg::~event_arg(){}
void event_arg::stop_propagation() const
{
stop_propagation_ = true;
}
bool event_arg::propagation_stopped() const
{
return stop_propagation_;
}
//end class event_arg
namespace detail namespace detail
{ {
void events_operation_register(event_handle evt) void events_operation_register(event_handle evt)
@ -130,7 +144,7 @@ namespace nana
return pi_data_->scheme.create(std::move(factory)); return pi_data_->scheme.create(std::move(factory));
} }
void bedrock::_m_emit_core(event_code evt_code, core_window_t* wd, bool draw_only, const ::nana::detail::event_arg_interface& event_arg) void bedrock::_m_emit_core(event_code evt_code, core_window_t* wd, bool draw_only, const ::nana::event_arg& event_arg)
{ {
switch (evt_code) switch (evt_code)
{ {

View File

@ -381,10 +381,10 @@ namespace detail
{ {
if(evt_code != arg.evt_code) if(evt_code != arg.evt_code)
throw std::runtime_error("Nana.bedrock: Invalid event arg."); throw std::runtime_error("Nana.bedrock: Invalid event arg.");
return emit(evt_code, wd, static_cast<const ::nana::detail::event_arg_interface&>(arg), ask_update, thrd); return emit(evt_code, wd, static_cast<const ::nana::event_arg&>(arg), ask_update, thrd);
} }
bool bedrock::emit(event_code evt_code, core_window_t* wd, const ::nana::detail::event_arg_interface& arg, bool ask_update, thread_context* thrd) bool bedrock::emit(event_code evt_code, core_window_t* wd, const ::nana::event_arg& arg, bool ask_update, thread_context* thrd)
{ {
if(wd_manager.available(wd) == false) if(wd_manager.available(wd) == false)
return false; return false;
@ -411,7 +411,7 @@ namespace detail
return true; return true;
} }
bool bedrock::emit_drawer(event_code evt_code, core_window_t* wd, const ::nana::detail::event_arg_interface& arg, thread_context* thrd) bool bedrock::emit_drawer(event_code evt_code, core_window_t* wd, const ::nana::event_arg& arg, thread_context* thrd)
{ {
if(wd_manager.available(wd) == false) if(wd_manager.available(wd) == false)
return false; return false;

View File

@ -1,7 +1,7 @@
/* /*
* A Bedrock Implementation * A Bedrock Implementation
* Nana C++ Library(http://www.nanapro.org) * Nana C++ Library(http://www.nanapro.org)
* Copyright(C) 2003-2014 Jinhao(cnjinhao@hotmail.com) * Copyright(C) 2003-2015 Jinhao(cnjinhao@hotmail.com)
* *
* Distributed under the Boost Software License, Version 1.0. * Distributed under the Boost Software License, Version 1.0.
* (See accompanying file LICENSE_1_0.txt or copy at * (See accompanying file LICENSE_1_0.txt or copy at
@ -1607,10 +1607,10 @@ namespace detail
if (evt_code != arg.evt_code) if (evt_code != arg.evt_code)
throw std::runtime_error("Nana.bedrock: invalid event arg."); throw std::runtime_error("Nana.bedrock: invalid event arg.");
return emit(evt_code, wd, static_cast<const ::nana::detail::event_arg_interface&>(arg), ask_update, thrd); return emit(evt_code, wd, static_cast<const ::nana::event_arg&>(arg), ask_update, thrd);
} }
bool bedrock::emit(event_code evt_code, core_window_t* wd, const ::nana::detail::event_arg_interface& arg, bool ask_update, thread_context* thrd) bool bedrock::emit(event_code evt_code, core_window_t* wd, const ::nana::event_arg& arg, bool ask_update, thread_context* thrd)
{ {
if (wd_manager.available(wd) == false) if (wd_manager.available(wd) == false)
return false; return false;
@ -1637,7 +1637,7 @@ namespace detail
return true; return true;
} }
bool bedrock::emit_drawer(event_code evt_code, core_window_t* wd, const ::nana::detail::event_arg_interface& arg, thread_context* thrd) bool bedrock::emit_drawer(event_code evt_code, core_window_t* wd, const ::nana::event_arg& arg, thread_context* thrd)
{ {
if (bedrock_object.wd_manager.available(wd) == false) if (bedrock_object.wd_manager.available(wd) == false)
return false; return false;

View File

@ -1,7 +1,7 @@
/* /*
* A List Box Implementation * A List Box Implementation
* Nana C++ Library(http://www.nanapro.org) * Nana C++ Library(http://www.nanapro.org)
* Copyright(C) 2003-2014 Jinhao(cnjinhao@hotmail.com) * Copyright(C) 2003-2015 Jinhao(cnjinhao@hotmail.com)
* *
* Distributed under the Boost Software License, Version 1.0. * Distributed under the Boost Software License, Version 1.0.
* (See accompanying file LICENSE_1_0.txt or copy at * (See accompanying file LICENSE_1_0.txt or copy at
@ -3489,6 +3489,12 @@ namespace nana
} }
}//end namespace drawerbase }//end namespace drawerbase
arg_listbox::arg_listbox(drawerbase::listbox::item_proxy& m, bool selected)
: item(m), selected(selected)
{
}
//class listbox //class listbox
listbox::listbox(window wd, bool visible) listbox::listbox(window wd, bool visible)
{ {

View File

@ -3,6 +3,10 @@
namespace nana namespace nana
{ {
arg_slider::arg_slider(slider& wdg)
: widget{ wdg }
{}
namespace drawerbase namespace drawerbase
{ {
namespace slider namespace slider

View File

@ -15,7 +15,13 @@
#include <stdexcept> #include <stdexcept>
#include <sstream> #include <sstream>
namespace nana{ namespace drawerbase { namespace nana
{
arg_textbox::arg_textbox(textbox& wdg)
: widget{wdg}
{}
namespace drawerbase {
namespace textbox namespace textbox
{ {
//class event_agent //class event_agent

View File

@ -1,6 +1,6 @@
/* /*
* A Toolbar Implementation * A Toolbar Implementation
* Copyright(C) 2003-2013 Jinhao(cnjinhao@hotmail.com) * Copyright(C) 2003-2015 Jinhao(cnjinhao@hotmail.com)
* *
* Distributed under the Boost Software License, Version 1.0. * Distributed under the Boost Software License, Version 1.0.
* (See accompanying file LICENSE_1_0.txt or copy at * (See accompanying file LICENSE_1_0.txt or copy at
@ -16,6 +16,10 @@
namespace nana namespace nana
{ {
arg_toolbar::arg_toolbar(toolbar& tbar, std::size_t btn)
: widget{ tbar }, button{btn}
{}
namespace drawerbase namespace drawerbase
{ {
namespace toolbar namespace toolbar

View File

@ -1,7 +1,7 @@
/* /*
* A Treebox Implementation * A Treebox Implementation
* Nana C++ Library(http://www.nanapro.org) * Nana C++ Library(http://www.nanapro.org)
* Copyright(C) 2003-2014 Jinhao(cnjinhao@hotmail.com) * Copyright(C) 2003-2015 Jinhao(cnjinhao@hotmail.com)
* *
* Distributed under the Boost Software License, Version 1.0. * Distributed under the Boost Software License, Version 1.0.
* (See accompanying file LICENSE_1_0.txt or copy at * (See accompanying file LICENSE_1_0.txt or copy at
@ -18,6 +18,10 @@
namespace nana namespace nana
{ {
arg_treebox::arg_treebox(treebox& wdg, drawerbase::treebox::item_proxy& m, bool op)
: widget{ wdg }, item{ m }, operated{op}
{}
namespace drawerbase namespace drawerbase
{ {
//Here defines some function objects //Here defines some function objects