construct the inline widget for listbox

This commit is contained in:
Jinhao
2015-06-14 21:48:35 +08:00
parent 36b3e6e6cc
commit 1822fafd79
15 changed files with 472 additions and 179 deletions

View File

@@ -64,6 +64,26 @@ namespace nana
bedrock::instance().evt_operation.cancel(evt);
}
class bedrock::flag_guard
{
public:
flag_guard(bedrock* brock, core_window_t * wd)
: brock_{ brock }, wd_(wd)
{
wd_->flags.refreshing = true;
}
~flag_guard()
{
if (brock_->wd_manager.available((wd_)))
wd_->flags.refreshing = false;
}
private:
bedrock *const brock_;
core_window_t *const wd_;
};
void bedrock::event_expose(core_window_t * wd, bool exposed)
{
if (nullptr == wd) return;
@@ -79,11 +99,8 @@ namespace nana
{
if (category::flags::root != wd->other.category)
{
//If the wd->parent is a lite_widget then find a parent until it is not a lite_widget
wd = wd->parent;
while (category::flags::lite_widget == wd->other.category)
wd = wd->parent;
//find an ancestor until it is not a lite_widget
wd = wd->seek_non_lite_widget_ancestor();
}
else if (category::flags::frame == wd->other.category)
wd = wd_manager.find_window(wd->root, wd->pos_root.x, wd->pos_root.y);
@@ -162,6 +179,9 @@ namespace nana
auto retain = wd->together.events_ptr;
auto evts_ptr = retain.get();
//enable refreshing flag, this is a RAII class for exception-safe
flag_guard fguard(this, wd);
switch (evt_code)
{
case event_code::click:
@@ -214,9 +234,9 @@ namespace nana
}
(wd->drawer.*drawer_event_fn)(*arg);
if (!draw_only)
evt_addr->emit(*arg);
break;
}
case event_code::mouse_wheel: