bedrock has some minor changes
This commit is contained in:
parent
07b5b19545
commit
edfa397ddc
@ -71,6 +71,7 @@ namespace detail
|
||||
void event_expose(core_window_t *, bool exposed);
|
||||
void event_move(core_window_t*, int x, int y);
|
||||
bool event_msleave(core_window_t*);
|
||||
void event_focus_changed(core_window_t* root_wd, native_window_type receiver, bool getting);
|
||||
void thread_context_destroy(core_window_t*);
|
||||
void thread_context_lazy_refresh();
|
||||
void update_cursor(core_window_t*);
|
||||
|
@ -176,6 +176,41 @@ namespace nana
|
||||
return false;
|
||||
}
|
||||
|
||||
//The wd must be a root window
|
||||
void bedrock::event_focus_changed(core_window_t* root_wd, native_window_type receiver, bool getting)
|
||||
{
|
||||
auto focused = root_wd->other.attribute.root->focus;
|
||||
|
||||
arg_focus arg;
|
||||
arg.window_handle = reinterpret_cast<window>(focused);
|
||||
arg.getting = getting;
|
||||
arg.receiver = receiver;
|
||||
|
||||
if (getting)
|
||||
{
|
||||
if (root_wd->flags.enabled && root_wd->flags.take_active)
|
||||
{
|
||||
if (focused && focused->together.caret)
|
||||
focused->together.caret->set_active(false);
|
||||
|
||||
if (!emit(event_code::focus, focused, arg, true, get_thread_context()))
|
||||
this->wd_manager().set_focus(root_wd, true, arg_focus::reason::general);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (root_wd->other.attribute.root->focus)
|
||||
{
|
||||
if (emit(event_code::focus, focused, arg, true, get_thread_context()))
|
||||
{
|
||||
if (focused->together.caret)
|
||||
focused->together.caret->set_active(false);
|
||||
}
|
||||
close_menu_if_focus_other_window(receiver);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void bedrock::update_cursor(core_window_t * wd)
|
||||
{
|
||||
internal_scope_guard isg;
|
||||
|
@ -668,37 +668,15 @@ namespace detail
|
||||
hovered_wd = nullptr;
|
||||
break;
|
||||
case FocusIn:
|
||||
if(msgwnd->flags.enabled && msgwnd->flags.take_active)
|
||||
{
|
||||
auto focus = msgwnd->other.attribute.root->focus;
|
||||
if(focus && focus->together.caret)
|
||||
focus->together.caret->set_active(true);
|
||||
|
||||
arg_focus arg;
|
||||
arg.window_handle = reinterpret_cast<window>(focus);
|
||||
arg.receiver = native_window;
|
||||
arg.getting = true;
|
||||
if(!brock.emit(event_code::focus, focus, arg, true, &context))
|
||||
brock.wd_manager().set_focus(msgwnd, true, arg_focus::reason::general);
|
||||
}
|
||||
brock.event_focus_changed(msgwnd, native_window, true);
|
||||
break;
|
||||
case FocusOut:
|
||||
if(msgwnd->other.attribute.root->focus && native_interface::is_window(msgwnd->root))
|
||||
if(native_interface::is_window(msgwnd->root))
|
||||
{
|
||||
nana::point pos = native_interface::cursor_position();
|
||||
auto recv = native_interface::find_window(pos.x, pos.y);
|
||||
|
||||
auto focus = msgwnd->other.attribute.root->focus;
|
||||
arg_focus arg;
|
||||
arg.window_handle = reinterpret_cast<window>(focus);
|
||||
arg.getting = false;
|
||||
arg.receiver = recv;
|
||||
if(brock.emit(event_code::focus, focus, arg, true, &context))
|
||||
{
|
||||
if(focus->together.caret)
|
||||
focus->together.caret->set_active(false);
|
||||
}
|
||||
brock.close_menu_if_focus_other_window(recv);
|
||||
brock.event_focus_changed(msgwnd, recv, false);
|
||||
}
|
||||
break;
|
||||
case ConfigureNotify:
|
||||
|
@ -873,37 +873,12 @@ namespace detail
|
||||
def_window_proc = true;
|
||||
break;
|
||||
case WM_SETFOCUS:
|
||||
if(msgwnd->flags.enabled && msgwnd->flags.take_active)
|
||||
{
|
||||
auto focus = msgwnd->other.attribute.root->focus;
|
||||
|
||||
if(focus && focus->together.caret)
|
||||
focus->together.caret->set_active(true);
|
||||
|
||||
arg_focus arg;
|
||||
assign_arg(arg, focus, native_window, true);
|
||||
if (!brock.emit(event_code::focus, focus, arg, true, &context))
|
||||
brock.wd_manager().set_focus(msgwnd, true, arg_focus::reason::general);
|
||||
}
|
||||
brock.event_focus_changed(msgwnd, native_window, true);
|
||||
def_window_proc = true;
|
||||
break;
|
||||
case WM_KILLFOCUS:
|
||||
if(msgwnd->other.attribute.root->focus)
|
||||
{
|
||||
auto focus = msgwnd->other.attribute.root->focus;
|
||||
|
||||
arg_focus arg;
|
||||
assign_arg(arg, focus, reinterpret_cast<native_window_type>(wParam), false);
|
||||
if(brock.emit(event_code::focus, focus, arg, true, &context))
|
||||
{
|
||||
if(focus->together.caret)
|
||||
focus->together.caret->set_active(false);
|
||||
}
|
||||
|
||||
//wParam indicates a handle of window that receives the focus.
|
||||
brock.close_menu_if_focus_other_window(reinterpret_cast<native_window_type>(wParam));
|
||||
}
|
||||
|
||||
//wParam indicates a handle of window that receives the focus.
|
||||
brock.event_focus_changed(msgwnd, reinterpret_cast<native_window_type>(wParam), false);
|
||||
def_window_proc = true;
|
||||
break;
|
||||
case WM_MOUSEACTIVATE:
|
||||
|
@ -388,13 +388,7 @@ namespace nana
|
||||
if (trace_.empty_logic_pos())
|
||||
return 0;
|
||||
|
||||
int lines = 7, rows = 7; //for page::date
|
||||
|
||||
if (page_mode::month == page)
|
||||
{
|
||||
lines = 3;
|
||||
rows = 4;
|
||||
}
|
||||
const int rows = (page_mode::month == page ? 4 : 7);
|
||||
|
||||
int n = trace_.logic_pos.y * rows + trace_.logic_pos.x + 1;
|
||||
if (page_mode::date == page)
|
||||
@ -635,8 +629,6 @@ namespace nana
|
||||
void _m_draw_ex_days(graph_reference graph, const upoint& begin_logic_pos, bool before)
|
||||
{
|
||||
int x = nana::date::day_of_week(view_month_.year, view_month_.month, 1);
|
||||
int y = (x ? 1 : 2);
|
||||
|
||||
int year = view_month_.year;
|
||||
if (before)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user