refactor functions

This commit is contained in:
Jinhao
2015-05-01 16:45:05 +08:00
parent 4154c8e132
commit 99564a9161
7 changed files with 253 additions and 268 deletions

View File

@@ -1,7 +1,7 @@
/*
* Implementations of Inner Forward Declaration
* 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.
* (See accompanying file LICENSE_1_0.txt or copy at
@@ -19,7 +19,6 @@
#include "../../paint/graphics.hpp"
#include <map>
#include <algorithm>
namespace nana{
namespace detail
@@ -62,12 +61,15 @@ namespace nana{
void umake(window wd)
{
if (wd == nullptr) return;
auto i = std::find_if(keybase_.begin(), keybase_.end(), [wd](const item_type& m){
return (m.handle == wd);
});
if (i != keybase_.end())
keybase_.erase(i);
for (auto i = keybase_.begin(), end = keybase_.end(); i != end; ++i)
{
if (i->handle == wd)
{
keybase_.erase(i);
break;
}
}
}
std::vector<unsigned long> keys(window wd) const

View File

@@ -139,16 +139,16 @@ namespace nana
void clear(); ///< Erases all of the items.
/// Closes the menu. It does not destroy the menu; just close the window for the menu.
void close();
void image(std::size_t index, const paint::image& icon);
void check_style(std::size_t index, checks);
void checked(std::size_t index, bool);
bool checked(std::size_t index) const;
void enabled(std::size_t index, bool);///< Enables or disables the mouse or keyboard input for the item.
bool enabled(std::size_t index) const;
void erase(std::size_t index); ///< Removes the item
bool link(std::size_t index, menu& menu_obj);///< Link a menu to the item as a sub menu.
menu * link(std::size_t index); ///< Retrieves a linked sub menu of the item.
menu *create_sub_menu(std::size_t index);
void image(std::size_t pos, const paint::image& icon);
void check_style(std::size_t pos, checks);
void checked(std::size_t pos, bool);
bool checked(std::size_t pos) const;
void enabled(std::size_t pos, bool);///< Enables or disables the mouse or keyboard input for the item.
bool enabled(std::size_t pos) const;
void erase(std::size_t pos); ///< Removes the item
bool link(std::size_t pos, menu& menu_obj);///< Link a menu to the item as a sub menu.
menu * link(std::size_t pos); ///< Retrieves a linked sub menu of the item.
menu *create_sub_menu(std::size_t pos);
void popup(window owner, int x, int y); ///< Popup the menu at the owner window.
void popup_await(window owner, int x, int y);
void answerer(std::size_t index, const event_fn_t&); ///< Modify answerer of the specified item.
@@ -171,7 +171,6 @@ namespace nana
const pat::cloneable<renderer_interface>& renderer() const;
private:
void _m_destroy_menu_window();
void _m_popup(window, int x, int y, bool called_by_menubar);
private:
implement * impl_;