add keyboard accelerator
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
*
|
||||
* Basis Implementation
|
||||
* Nana C++ Library(http://www.nanapro.org)
|
||||
* Copyright(C) 2003-2016 Jinhao(cnjinhao@hotmail.com)
|
||||
* Copyright(C) 2003-2018 Jinhao(cnjinhao@hotmail.com)
|
||||
*
|
||||
* Distributed under the Boost Software License, Version 1.0.
|
||||
* (See accompanying file LICENSE_1_0.txt or copy at
|
||||
@@ -30,6 +30,15 @@ namespace nana
|
||||
struct native_drawable_impl{};
|
||||
}
|
||||
|
||||
struct accel_key
|
||||
{
|
||||
char key;
|
||||
bool case_sensitive{ false };
|
||||
bool alt{ false };
|
||||
bool ctrl{ false };
|
||||
bool shift{ false };
|
||||
};
|
||||
|
||||
enum class checkstate
|
||||
{
|
||||
unchecked, checked, partial
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/**
|
||||
* A Bedrock Implementation
|
||||
* Nana C++ Library(http://www.nanapro.org)
|
||||
* Copyright(C) 2003-2017 Jinhao(cnjinhao@hotmail.com)
|
||||
* Copyright(C) 2003-2018 Jinhao(cnjinhao@hotmail.com)
|
||||
*
|
||||
* Distributed under the Boost Software License, Version 1.0.
|
||||
* (See accompanying file LICENSE_1_0.txt or copy at
|
||||
@@ -27,6 +27,7 @@ namespace detail
|
||||
struct basic_window;
|
||||
class window_manager;
|
||||
|
||||
struct window_platform_assoc;
|
||||
|
||||
/// @brief fundamental core component, it provides an abstraction to the OS platform and some basic functions.
|
||||
class bedrock
|
||||
@@ -73,6 +74,11 @@ namespace detail
|
||||
|
||||
//Closes the windows which are associated with the specified thread. If the given thread_id is 0, it closes all windows
|
||||
void close_thread_window(unsigned thread_id);
|
||||
|
||||
public:
|
||||
//Platform-dependent functions
|
||||
static void delete_platform_assoc(window_platform_assoc*);
|
||||
void keyboard_accelerator(native_window_type, const accel_key&, const std::function<void()>&);
|
||||
public:
|
||||
void event_expose(core_window_t *, bool exposed);
|
||||
void event_move(core_window_t*, int x, int y);
|
||||
|
||||
@@ -1,105 +0,0 @@
|
||||
/*
|
||||
* Implementations of Inner Forward Declaration
|
||||
* Nana C++ Library(http://www.nanapro.org)
|
||||
* Copyright(C) 2003-2016 Jinhao(cnjinhao@hotmail.com)
|
||||
*
|
||||
* Distributed under the Boost Software License, Version 1.0.
|
||||
* (See accompanying file LICENSE_1_0.txt or copy at
|
||||
* http://www.boost.org/LICENSE_1_0.txt)
|
||||
*
|
||||
* @file: nana/gui/detail/inner_fwd_implement.hpp
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef NANA_GUI_INNER_FWD_IMPLEMENT_HPP
|
||||
#define NANA_GUI_INNER_FWD_IMPLEMENT_HPP
|
||||
|
||||
#include <nana/push_ignore_diagnostic>
|
||||
#include "inner_fwd.hpp"
|
||||
#include "basic_window.hpp"
|
||||
#include "../../paint/graphics.hpp"
|
||||
|
||||
#include <map>
|
||||
|
||||
namespace nana{
|
||||
namespace detail
|
||||
{
|
||||
class shortkey_container
|
||||
{
|
||||
struct item_type;
|
||||
|
||||
//Noncopyable
|
||||
shortkey_container(const shortkey_container&) = delete;
|
||||
shortkey_container& operator=(const shortkey_container&) = delete;
|
||||
|
||||
shortkey_container& operator=(shortkey_container&&) = delete;
|
||||
public:
|
||||
shortkey_container();
|
||||
|
||||
shortkey_container(shortkey_container&&);
|
||||
|
||||
~shortkey_container();
|
||||
|
||||
void clear();
|
||||
|
||||
bool make(window wd, unsigned long key);
|
||||
|
||||
void umake(window wd);
|
||||
|
||||
std::vector<unsigned long> keys(window wd) const;
|
||||
|
||||
window find(unsigned long key) const;
|
||||
private:
|
||||
struct implementation;
|
||||
implementation * impl_;
|
||||
};
|
||||
|
||||
|
||||
struct root_misc
|
||||
{
|
||||
basic_window * window;
|
||||
nana::paint::graphics root_graph;
|
||||
shortkey_container shortkeys;
|
||||
|
||||
struct condition_rep
|
||||
{
|
||||
bool ignore_tab; //ignore tab when the focus is changed by TAB key.
|
||||
basic_window* pressed; //The handle to a window which has been pressed by mouse left button.
|
||||
basic_window* pressed_by_space; //The handle to a window which has been pressed by SPACEBAR key.
|
||||
basic_window* hovered; //the latest window that mouse moved
|
||||
}condition;
|
||||
|
||||
root_misc(root_misc&&);
|
||||
root_misc(basic_window * wd, unsigned width, unsigned height);
|
||||
};//end struct root_misc
|
||||
|
||||
|
||||
|
||||
class root_register
|
||||
{
|
||||
//Noncopyable
|
||||
root_register(const root_register&) = delete;
|
||||
root_register& operator=(const root_register&) = delete;
|
||||
|
||||
//Nonmovable
|
||||
root_register(root_register&&) = delete;
|
||||
root_register& operator=(root_register&&) = delete;
|
||||
public:
|
||||
root_register();
|
||||
~root_register();
|
||||
|
||||
root_misc* insert(native_window_type, root_misc&&);
|
||||
|
||||
root_misc * find(native_window_type);
|
||||
|
||||
void erase(native_window_type);
|
||||
private:
|
||||
struct implementation;
|
||||
implementation * const impl_;
|
||||
};
|
||||
}
|
||||
}//end namespace nana
|
||||
|
||||
#include <nana/pop_ignore_diagnostic>
|
||||
|
||||
#endif //NANA_GUI_INNER_FWD_IMPLEMENT_HPP
|
||||
@@ -1,7 +1,7 @@
|
||||
/**
|
||||
* A Form Implementation
|
||||
* Nana C++ Library(http://www.nanapro.org)
|
||||
* Copyright(C) 2003-2015 Jinhao(cnjinhao@hotmail.com)
|
||||
* Copyright(C) 2003-2018 Jinhao(cnjinhao@hotmail.com)
|
||||
*
|
||||
* Distributed under the Boost Software License, Version 1.0.
|
||||
* (See accompanying file LICENSE_1_0.txt or copy at
|
||||
@@ -68,6 +68,8 @@ namespace nana
|
||||
|
||||
void modality() const;
|
||||
void wait_for_this();
|
||||
|
||||
void keyboard_accelerator(const accel_key&, const std::function<void()>& fn);
|
||||
};
|
||||
|
||||
class nested_form
|
||||
|
||||
Reference in New Issue
Block a user