move lazy_refresh() from namespace API to API::dev

This commit is contained in:
Jinhao 2016-04-17 17:46:19 +08:00
parent afa253f924
commit 42990b8670
19 changed files with 121 additions and 120 deletions

View File

@ -88,10 +88,20 @@ namespace API
void set_menubar(window wd, bool attach);
void enable_space_click(window, bool enable);
/// Refreshs a widget surface
/*
* This function will copy the drawer surface into system window after the event process finished.
*/
void lazy_refresh();
}//end namespace dev
widget* get_widget(window);
/// Returns the widget pointer of the specified window.
/*
* @param window_handle A handle to a window owning the widget.
* @return A widget pointer.
*/
widget* get_widget(window window_handle);
namespace detail
{
@ -258,17 +268,6 @@ namespace API
void window_enabled(window, bool);
bool window_enabled(window);
/** @brief A widget drawer draws the widget surface in answering an event.
*
* This function will tell the drawer to copy the graphics into window after event answering.
* Tells Nana.GUI to copy the buffer of event window to screen after the event is processed.
* This function only works for a drawer_trigger, when a drawer_trigger receives an event,
* after drawing, a drawer_trigger should call lazy_refresh to tell the Nana.GUI to refresh
* the window to the screen after the event process finished.
*/
void lazy_refresh();
/// Refresh the window and display it immediately calling the refresh function of its drawer_trigger.
/*
* The drawer::refresh() will be called. If the currently state is lazy_refrsh, the window is delayed to update the graphics until an event is finished.
@ -296,6 +295,7 @@ namespace API
/// Sets the keyboard focus for a specified window.
void focus_window(window);
/// Returns a window which has grabbed the mouse input.
window capture_window();
/// Enables a window to grab the mouse input.
@ -311,7 +311,10 @@ namespace API
*/
void release_capture(window window_handle);
void modal_window(window); ///< Blocks the routine til the specified window is closed.
/// Blocks the execution and other windows' messages until the specified window is closed.
void modal_window(window);
/// Blocks the execution until the specified window is closesd.
void wait_for(window);
color fgcolor(window);

View File

@ -205,14 +205,14 @@ namespace nana
void resized(graph_reference graph, const ::nana::arg_resized&) override
{
drawer_.draw(graph, metrics_.what);
API::lazy_refresh();
API::dev::lazy_refresh();
}
void mouse_enter(graph_reference graph, const ::nana::arg_mouse& arg) override
{
metrics_.what = drawer_.what(graph, arg.pos);
drawer_.draw(graph, metrics_.what);
API::lazy_refresh();
API::dev::lazy_refresh();
}
void mouse_move(graph_reference graph, const ::nana::arg_mouse& arg) override
@ -238,7 +238,7 @@ namespace nana
if (redraw)
{
drawer_.draw(graph, metrics_.what);
API::lazy_refresh();
API::dev::lazy_refresh();
}
}
@ -278,7 +278,7 @@ namespace nana
break;
}
drawer_.draw(graph, metrics_.what);
API::lazy_refresh();
API::dev::lazy_refresh();
}
}
@ -291,7 +291,7 @@ namespace nana
metrics_.pressed = false;
metrics_.what = drawer_.what(graph, arg.pos);
drawer_.draw(graph, metrics_.what);
API::lazy_refresh();
API::dev::lazy_refresh();
}
void mouse_leave(graph_reference graph, const arg_mouse&) override
@ -300,7 +300,7 @@ namespace nana
metrics_.what = buttons::none;
drawer_.draw(graph, buttons::none);
API::lazy_refresh();
API::dev::lazy_refresh();
}
void mouse_wheel(graph_reference graph, const arg_wheel& arg) override
@ -308,7 +308,7 @@ namespace nana
if (make_step(arg.upwards == false, 3))
{
drawer_.draw(graph, metrics_.what);
API::lazy_refresh();
API::dev::lazy_refresh();
}
}
private:

View File

@ -109,14 +109,14 @@ namespace nana
x_pointed_ = _m_button_area().is_hit(arg.pos);
refresh(graph);
API::lazy_refresh();
API::dev::lazy_refresh();
}
void mouse_leave(graph_reference graph, const arg_mouse&) override
{
x_pointed_ = false;
refresh(graph);
API::lazy_refresh();
API::dev::lazy_refresh();
}
void mouse_down(graph_reference graph, const arg_mouse&) override
@ -127,7 +127,7 @@ namespace nana
x_state_ = ::nana::mouse_action::pressed;
refresh(graph);
API::lazy_refresh();
API::dev::lazy_refresh();
}
void mouse_up(graph_reference graph, const arg_mouse&) override
@ -137,7 +137,7 @@ namespace nana
x_state_ = ::nana::mouse_action::over;
refresh(graph);
API::lazy_refresh();
API::dev::lazy_refresh();
close_fn_();
}

View File

@ -314,6 +314,11 @@ namespace API
if (restrict::wd_manager().available(iwd))
iwd->flags.space_click_enabled = enable;
}
void lazy_refresh()
{
restrict::bedrock.thread_context_lazy_refresh();
}
}//end namespace dev
@ -824,13 +829,6 @@ namespace API
return (restrict::wd_manager().available(iwd) ? iwd->flags.enabled : false);
}
//lazy_refresh:
//@brief: A widget drawer draws the widget surface in answering an event. This function will tell the drawer to copy the graphics into window after event answering.
void lazy_refresh()
{
restrict::bedrock.thread_context_lazy_refresh();
}
//refresh_window
//@brief: Refresh the window and display it immediately.
void refresh_window(window wd)

View File

@ -134,7 +134,7 @@ namespace nana{ namespace drawerbase
{
attr_.e_state = (attr_.pushed || attr_.keep_pressed ? element_state::pressed : element_state::hovered);
refresh(graph);
API::lazy_refresh();
API::dev::lazy_refresh();
}
void trigger::mouse_leave(graph_reference graph, const arg_mouse&)
@ -144,7 +144,7 @@ namespace nana{ namespace drawerbase
attr_.e_state = element_state::normal;
refresh(graph);
API::lazy_refresh();
API::dev::lazy_refresh();
}
void trigger::mouse_down(graph_reference graph, const arg_mouse& arg)
@ -185,7 +185,7 @@ namespace nana{ namespace drawerbase
{
attr_.focused = arg.getting;
refresh(graph);
API::lazy_refresh();
API::dev::lazy_refresh();
}
void trigger::_m_draw_title(graph_reference graph, bool enabled)
@ -343,7 +343,7 @@ namespace nana{ namespace drawerbase
}
refresh(graph);
API::lazy_refresh();
API::dev::lazy_refresh();
}
void trigger::emit_click()

View File

@ -881,7 +881,7 @@ namespace nana
{
scheme_->mouse_pressed();
scheme_->draw(graph);
API::lazy_refresh();
API::dev::lazy_refresh();
}
}
}
@ -894,7 +894,7 @@ namespace nana
{
scheme_->mouse_release();
scheme_->draw(graph);
API::lazy_refresh();
API::dev::lazy_refresh();
}
}
}
@ -904,7 +904,7 @@ namespace nana
if(scheme_->locate(arg.pos.x, arg.pos.y) && API::window_enabled(scheme_->window_handle()))
{
scheme_->draw(graph);
API::lazy_refresh();
API::dev::lazy_refresh();
}
}
@ -913,7 +913,7 @@ namespace nana
if(API::window_enabled(scheme_->window_handle()) && (scheme_->is_list_shown() == false) && scheme_->erase_locate())
{
scheme_->draw(graph);
API::lazy_refresh();
API::dev::lazy_refresh();
}
}
//end class trigger

View File

@ -85,7 +85,7 @@ namespace nana{ namespace drawerbase
void drawer::mouse_down(graph_reference graph, const arg_mouse&)
{
refresh(graph);
API::lazy_refresh();
API::dev::lazy_refresh();
}
void drawer::mouse_up(graph_reference graph, const arg_mouse&)
@ -97,19 +97,19 @@ namespace nana{ namespace drawerbase
API::events<nana::checkbox>(impl_->widget_ptr->handle()).checked.emit(arg, impl_->widget_ptr->handle());
}
refresh(graph);
API::lazy_refresh();
API::dev::lazy_refresh();
}
void drawer::mouse_enter(graph_reference graph, const arg_mouse&)
{
refresh(graph);
API::lazy_refresh();
API::dev::lazy_refresh();
}
void drawer::mouse_leave(graph_reference graph, const arg_mouse&)
{
refresh(graph);
API::lazy_refresh();
API::dev::lazy_refresh();
}
drawer::implement * drawer::impl() const

View File

@ -586,7 +586,7 @@ namespace nana
{
drawer_->draw();
drawer_->editor()->reset_caret();
API::lazy_refresh();
API::dev::lazy_refresh();
}
}
@ -596,7 +596,7 @@ namespace nana
if(drawer_->widget_ptr()->enabled())
{
drawer_->draw();
API::lazy_refresh();
API::dev::lazy_refresh();
}
}
@ -607,7 +607,7 @@ namespace nana
if(drawer_->widget_ptr()->enabled())
{
drawer_->draw();
API::lazy_refresh();
API::dev::lazy_refresh();
}
}
@ -625,7 +625,7 @@ namespace nana
if(editor->attr().editable)
editor->reset_caret();
API::lazy_refresh();
API::dev::lazy_refresh();
}
}
@ -636,7 +636,7 @@ namespace nana
drawer_->editor()->mouse_pressed(arg);
drawer_->set_button_state(element_state::hovered, false);
drawer_->draw();
API::lazy_refresh();
API::dev::lazy_refresh();
}
}
@ -651,7 +651,7 @@ namespace nana
{
drawer_->draw();
drawer_->editor()->reset_caret();
API::lazy_refresh();
API::dev::lazy_refresh();
}
}
}
@ -711,13 +711,13 @@ namespace nana
if (call_other_keys)
drawer_->editor()->respond_key(arg);
API::lazy_refresh();
API::dev::lazy_refresh();
}
void trigger::key_char(graph_reference graph, const arg_keyboard& arg)
{
if (drawer_->editor()->respond_char(arg))
API::lazy_refresh();
API::dev::lazy_refresh();
}
//end class trigger

View File

@ -797,7 +797,7 @@ namespace nana
if (model_->set_where(pos) || (model::where::textarea == pos))
{
model_->render(graph);
API::lazy_refresh();
API::dev::lazy_refresh();
}
}
@ -806,7 +806,7 @@ namespace nana
if (model_->set_where(model::where::none))
{
model_->render(graph);
API::lazy_refresh();
API::dev::lazy_refresh();
}
}
@ -882,7 +882,7 @@ namespace nana
if (!transformed)
model_->render(graph);
API::lazy_refresh();
API::dev::lazy_refresh();
}
}
@ -894,7 +894,7 @@ namespace nana
if (!redrawn)
refresh(graph);
API::lazy_refresh();
API::dev::lazy_refresh();
}
}
//end class trigger

View File

@ -443,7 +443,7 @@ namespace nana
if(drawer_->set_mouse(graph, arg.pos.x, arg.pos.y))
{
drawer_->draw();
API::lazy_refresh();
API::dev::lazy_refresh();
}
}

View File

@ -3392,7 +3392,7 @@ namespace nana
if (2 == update)
refresh(graph);
API::lazy_refresh();
API::dev::lazy_refresh();
}
}
@ -3409,7 +3409,7 @@ namespace nana
}
refresh(graph);
API::lazy_refresh();
API::dev::lazy_refresh();
}
}
@ -3504,7 +3504,7 @@ namespace nana
if(update)
{
_m_draw_border();
API::lazy_refresh();
API::dev::lazy_refresh();
}
}
@ -3525,7 +3525,7 @@ namespace nana
{
essence_->trace_item_dpl({0,0});
refresh(graph);
API::lazy_refresh();
API::dev::lazy_refresh();
}
}
}
@ -3535,7 +3535,7 @@ namespace nana
essence_->widget_to_header(pos);
drawer_header_->grab(pos, false);
refresh(graph);
API::lazy_refresh();
API::dev::lazy_refresh();
essence_->lister.wd_ptr()->release_capture();
}
}
@ -3546,7 +3546,7 @@ namespace nana
{
refresh(graph);
essence_->adjust_scroll_value();
API::lazy_refresh();
API::dev::lazy_refresh();
}
}
@ -3588,7 +3588,7 @@ namespace nana
}
essence_->adjust_scroll_life();
refresh(graph);
API::lazy_refresh();
API::dev::lazy_refresh();
}
}
}
@ -3597,7 +3597,7 @@ namespace nana
{
essence_->adjust_scroll_life();
refresh(graph);
API::lazy_refresh();
API::dev::lazy_refresh();
}
void trigger::key_press(graph_reference graph, const arg_keyboard& arg)
@ -3670,7 +3670,7 @@ namespace nana
return;
}
refresh(graph);
API::lazy_refresh();
API::dev::lazy_refresh();
}
void trigger::key_char(graph_reference graph, const arg_keyboard& arg)
@ -3688,7 +3688,7 @@ namespace nana
case keyboard::select_all :
essence_->lister.select_for_all(true);
refresh(graph);
API::lazy_refresh();
API::dev::lazy_refresh();
break;
default:

View File

@ -350,7 +350,7 @@ namespace nana
if(track_mouse(arg.pos))
{
refresh(graph);
API::lazy_refresh();
API::dev::lazy_refresh();
}
}

View File

@ -253,7 +253,7 @@ namespace nana
{
_m_popup_menu();
refresh(graph);
API::lazy_refresh();
API::dev::lazy_refresh();
}
state_.mouse_pos = arg.pos;
@ -281,7 +281,7 @@ namespace nana
_m_total_close();
refresh(graph);
API::lazy_refresh();
API::dev::lazy_refresh();
}
void trigger::mouse_up(graph_reference graph, const arg_mouse&)
@ -298,7 +298,7 @@ namespace nana
state_.behavior = state_.behavior_none;
_m_total_close();
refresh(graph);
API::lazy_refresh();
API::dev::lazy_refresh();
}
}
@ -312,7 +312,7 @@ namespace nana
_m_close_menu();
state_.active = npos;
refresh(graph);
API::lazy_refresh();
API::dev::lazy_refresh();
}
}
@ -407,7 +407,7 @@ namespace nana
}
refresh(graph);
API::lazy_refresh();
API::dev::lazy_refresh();
}
void trigger::key_release(graph_reference graph, const arg_keyboard& arg)
@ -429,7 +429,7 @@ namespace nana
state_.menu_active = false;
refresh(graph);
API::lazy_refresh();
API::dev::lazy_refresh();
}
}
@ -449,7 +449,7 @@ namespace nana
state_.menu->goto_next(true);
refresh(graph);
API::lazy_refresh();
API::dev::lazy_refresh();
state_.behavior = state_.behavior_menu;
}
}
@ -477,7 +477,7 @@ namespace nana
{
state_.active = index;
refresh(*graph_);
API::lazy_refresh();
API::dev::lazy_refresh();
if(_m_popup_menu())
state_.menu->goto_next(true);

View File

@ -626,7 +626,7 @@ namespace nana
if(mkdir)
{
impl_->draw();
API::lazy_refresh();
API::dev::lazy_refresh();
}
}
}
@ -637,7 +637,7 @@ namespace nana
if(mkdraw)
{
impl_->draw();
API::lazy_refresh();
API::dev::lazy_refresh();
}
}
@ -660,7 +660,7 @@ namespace nana
if(mkdraw)
{
impl_->draw();
API::lazy_refresh();
API::dev::lazy_refresh();
}
}
@ -669,7 +669,7 @@ namespace nana
if(impl_->reset_adorn())
{
impl_->draw();
API::lazy_refresh();
API::dev::lazy_refresh();
}
}
@ -677,7 +677,7 @@ namespace nana
{
impl_->resize();
impl_->draw();
API::lazy_refresh();
API::dev::lazy_refresh();
}
//end class trigger
}//end namespace slider

View File

@ -524,38 +524,38 @@ namespace nana
impl_->reset_text();
impl_->render();
impl_->editor()->reset_caret();
API::lazy_refresh();
API::dev::lazy_refresh();
}
void drawer::mouse_wheel(graph_reference, const arg_wheel& arg)
{
impl_->mouse_wheel(arg.upwards);
impl_->editor()->reset_caret();
API::lazy_refresh();
API::dev::lazy_refresh();
}
void drawer::mouse_down(graph_reference, const arg_mouse& arg)
{
if (impl_->mouse_button(arg, true))
API::lazy_refresh();
API::dev::lazy_refresh();
}
void drawer::mouse_up(graph_reference, const arg_mouse& arg)
{
if (impl_->mouse_button(arg, false))
API::lazy_refresh();
API::dev::lazy_refresh();
}
void drawer::mouse_move(graph_reference, const arg_mouse& arg)
{
if (impl_->mouse_move(arg.left_button, arg.pos))
API::lazy_refresh();
API::dev::lazy_refresh();
}
void drawer::mouse_leave(graph_reference, const arg_mouse&)
{
impl_->render();
API::lazy_refresh();
API::dev::lazy_refresh();
}
void drawer::key_press(graph_reference, const arg_keyboard& arg)
@ -564,7 +564,7 @@ namespace nana
{
impl_->editor()->reset_caret();
impl_->draw_spins();
API::lazy_refresh();
API::dev::lazy_refresh();
}
}
@ -575,7 +575,7 @@ namespace nana
if (!impl_->value(to_utf8(impl_->editor()->text())))
impl_->draw_spins();
API::lazy_refresh();
API::dev::lazy_refresh();
}
}
@ -584,7 +584,7 @@ namespace nana
impl_->reset_text_area();
impl_->render();
impl_->editor()->reset_caret();
API::lazy_refresh();
API::dev::lazy_refresh();
}
}
}//end namespace drawerbase

View File

@ -1255,7 +1255,7 @@ namespace nana
if(false == layouter_->active_by_trace())
layouter_->toolbox_answer(arg);
layouter_->render();
API::lazy_refresh();
API::dev::lazy_refresh();
}
}
@ -1266,7 +1266,7 @@ namespace nana
if(rd)
{
layouter_->render();
API::lazy_refresh();
API::dev::lazy_refresh();
}
}
@ -1275,7 +1275,7 @@ namespace nana
if(layouter_->trace(arg.pos.x, arg.pos.y))
{
layouter_->render();
API::lazy_refresh();
API::dev::lazy_refresh();
}
}
@ -1284,7 +1284,7 @@ namespace nana
if(layouter_->leave())
{
layouter_->render();
API::lazy_refresh();
API::dev::lazy_refresh();
}
}
//end class trigger
@ -1535,7 +1535,7 @@ namespace nana
return;
refresh(graph);
API::lazy_refresh();
API::dev::lazy_refresh();
}
void driver::mouse_leave(graph_reference graph, const arg_mouse&)
@ -1544,7 +1544,7 @@ namespace nana
return;
refresh(graph);
API::lazy_refresh();
API::dev::lazy_refresh();
}
void driver::mouse_down(graph_reference graph, const arg_mouse&)
@ -1559,7 +1559,7 @@ namespace nana
model_->show_attached_window();
refresh(graph);
API::lazy_refresh();
API::dev::lazy_refresh();
event_arg arg;
model_->widget_ptr()->events().selected.emit(arg, model_->widget_ptr()->handle());

View File

@ -97,7 +97,7 @@ namespace drawerbase {
if (!editor_->focus_changed(arg))
refresh(graph);
API::lazy_refresh();
API::dev::lazy_refresh();
}
void drawer::mouse_down(graph_reference, const arg_mouse& arg)
@ -105,20 +105,20 @@ namespace drawerbase {
if (editor_->mouse_pressed(arg))
{
editor_->render(true);
API::lazy_refresh();
API::dev::lazy_refresh();
}
}
void drawer::mouse_move(graph_reference, const arg_mouse& arg)
{
if(editor_->mouse_move(arg.left_button, arg.pos))
API::lazy_refresh();
API::dev::lazy_refresh();
}
void drawer::mouse_up(graph_reference graph, const arg_mouse& arg)
{
if(editor_->mouse_pressed(arg))
API::lazy_refresh();
API::dev::lazy_refresh();
}
void drawer::mouse_wheel(graph_reference, const arg_wheel& arg)
@ -126,20 +126,20 @@ namespace drawerbase {
if(editor_->scroll(arg.upwards, true))
{
editor_->reset_caret();
API::lazy_refresh();
API::dev::lazy_refresh();
}
}
void drawer::mouse_enter(graph_reference, const arg_mouse&)
{
if(editor_->mouse_enter(true))
API::lazy_refresh();
API::dev::lazy_refresh();
}
void drawer::mouse_leave(graph_reference, const arg_mouse&)
{
if(editor_->mouse_enter(false))
API::lazy_refresh();
API::dev::lazy_refresh();
}
void drawer::key_press(graph_reference, const arg_keyboard& arg)
@ -147,14 +147,14 @@ namespace drawerbase {
if(editor_->respond_key(arg))
{
editor_->reset_caret();
API::lazy_refresh();
API::dev::lazy_refresh();
}
}
void drawer::key_char(graph_reference, const arg_keyboard& arg)
{
if (editor_->respond_char(arg))
API::lazy_refresh();
API::dev::lazy_refresh();
}
void drawer::resized(graph_reference graph, const arg_resized& arg)
@ -162,7 +162,7 @@ namespace drawerbase {
_m_text_area(arg.width, arg.height);
refresh(graph);
editor_->reset_caret();
API::lazy_refresh();
API::dev::lazy_refresh();
}
void drawer::typeface_changed(graph_reference graph)

View File

@ -317,7 +317,7 @@ namespace nana
impl_->state = item_renderer::state_t::highlighted;
refresh(graph);
API::lazy_refresh();
API::dev::lazy_refresh();
if (impl_->state == item_renderer::state_t::highlighted)
{
@ -341,7 +341,7 @@ namespace nana
impl_->which = npos;
refresh(graph);
API::lazy_refresh();
API::dev::lazy_refresh();
if (which != npos && impl_->items.at(which)->enable)
{
@ -359,7 +359,7 @@ namespace nana
{
impl_->state = item_renderer::state_t::selected;
refresh(graph);
API::lazy_refresh();
API::dev::lazy_refresh();
}
}
@ -382,7 +382,7 @@ namespace nana
}
refresh(graph);
API::lazy_refresh();
API::dev::lazy_refresh();
}
}

View File

@ -1879,7 +1879,7 @@ namespace nana
impl_->node_state.event_node = nl.node();
impl_->set_expanded(impl_->node_state.event_node, !impl_->node_state.event_node->value.second.expanded);
impl_->draw(true);
API::lazy_refresh();
API::dev::lazy_refresh();
}
}
@ -1927,7 +1927,7 @@ namespace nana
if(has_redraw)
{
impl_->draw(true);
API::lazy_refresh();
API::dev::lazy_refresh();
}
}
@ -1960,7 +1960,7 @@ namespace nana
return; //Do not refresh
impl_->draw(true);
API::lazy_refresh();
API::dev::lazy_refresh();
}
void trigger::mouse_move(graph_reference, const arg_mouse& arg)
@ -1968,7 +1968,7 @@ namespace nana
if(impl_->track_mouse(arg.pos.x, arg.pos.y))
{
impl_->draw(false);
API::lazy_refresh();
API::dev::lazy_refresh();
}
}
@ -1986,7 +1986,7 @@ namespace nana
impl_->track_mouse(arg.pos.x, arg.pos.y);
impl_->draw(false);
API::lazy_refresh();
API::dev::lazy_refresh();
}
}
@ -1998,14 +1998,14 @@ namespace nana
impl_->data.widget_ptr->events().hovered.emit(::nana::arg_treebox{ *impl_->data.widget_ptr, iprx, false }, impl_->data.widget_ptr->handle());
impl_->node_state.pointed = nullptr;
impl_->draw(false);
API::lazy_refresh();
API::dev::lazy_refresh();
}
}
void trigger::resized(graph_reference, const arg_resized&)
{
impl_->draw(false);
API::lazy_refresh();
API::dev::lazy_refresh();
impl_->show_scroll();
if(!impl_->shape.scroll.empty())
{
@ -2120,7 +2120,7 @@ namespace nana
if(redraw)
{
impl_->draw(scroll);
API::lazy_refresh();
API::dev::lazy_refresh();
}
}
@ -2150,7 +2150,7 @@ namespace nana
if (do_refresh)
{
impl_->draw(do_refresh & 1);
API::lazy_refresh();
API::dev::lazy_refresh();
}
}
//end class trigger