fix wrong position of sub menu

This commit is contained in:
Jinhao 2015-12-22 23:47:56 +08:00
parent 9bb0e8eb34
commit 3856543daf
2 changed files with 8 additions and 8 deletions

View File

@ -1235,13 +1235,14 @@ namespace nana{
native_window_type native_interface::parent_window(native_window_type child, native_window_type new_parent, bool returns_previous) native_window_type native_interface::parent_window(native_window_type child, native_window_type new_parent, bool returns_previous)
{ {
#ifdef NANA_WINDOWS #ifdef NANA_WINDOWS
auto prev = reinterpret_cast<native_window_type>( auto prev = ::SetParent(reinterpret_cast<HWND>(child), reinterpret_cast<HWND>(new_parent));
::SetParent(reinterpret_cast<HWND>(child), reinterpret_cast<HWND>(new_parent))
); if (prev)
::PostMessage(prev, WM_CHANGEUISTATE, UIS_INITIALIZE, NULL);
::SetWindowPos(reinterpret_cast<HWND>(child), NULL, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE | SWP_NOZORDER | SWP_FRAMECHANGED); ::SetWindowPos(reinterpret_cast<HWND>(child), NULL, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE | SWP_NOZORDER | SWP_FRAMECHANGED);
return (returns_previous ? prev : nullptr); return reinterpret_cast<native_window_type>(returns_previous ? prev : nullptr);
#elif defined(NANA_X11) #elif defined(NANA_X11)
native_window_type prev = nullptr; native_window_type prev = nullptr;

View File

@ -526,17 +526,16 @@ namespace nana
auto index = state_.active; auto index = state_.active;
for (auto & m : menu_->items) for (auto & m : menu_->items)
{ {
if (0 == index--)
break;
if (m.flags.splitter) if (m.flags.splitter)
{ {
pos.y += 2; pos.y += 2;
continue; continue;
} }
if (0 == index)
break;
pos.y += _m_item_height() + 1; pos.y += _m_item_height() + 1;
--index;
} }
tmstamp = state_.active_timestamp; tmstamp = state_.active_timestamp;