emit click event by pressing spacebar

This commit is contained in:
Jinhao
2016-02-07 00:49:29 +08:00
parent ca5b2e246e
commit e7cae6d17a
11 changed files with 217 additions and 64 deletions

View File

@@ -1,7 +1,7 @@
/*
* A Basic Window Widget Definition
* Nana C++ Library(http://www.nanapro.org)
* Copyright(C) 2003-2015 Jinhao(cnjinhao@hotmail.com)
* 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
@@ -167,7 +167,8 @@ namespace detail
bool make_bground_declared : 1; //explicitly make bground for bground effects
bool ignore_menubar_focus : 1; //A flag indicates whether the menubar sets the focus.
bool ignore_mouse_focus : 1; //A flag indicates whether the widget accepts focus when clicking on it
unsigned Reserved :19;
bool space_click_enabled : 1; //A flag indicates whether enable mouse_down/click/mouse_up when pressing and releasing whitespace key.
unsigned Reserved :18;
unsigned char tab; //indicate a window that can receive the keyboard TAB
mouse_action action;
}flags;

View File

@@ -119,8 +119,9 @@ namespace nana{
struct condition_tag
{
core_window_t* pressed{nullptr}; //The handle to a window which is being pressed
core_window_t* hovered{nullptr}; //the latest window that mouse moved
core_window_t* pressed{nullptr}; //The handle to a window which has been pressed by pressing left button of mouse.
core_window_t* pressed_by_space{ nullptr }; //The handle to a window which has been pressed by pressing spacebar.
core_window_t* hovered{nullptr}; //the latest window that mouse moved
}condition;
root_misc(core_window_t * wd, unsigned width, unsigned height)

View File

@@ -1,7 +1,7 @@
/*
* Nana GUI Programming Interface Implementation
* Nana C++ Library(http://www.nanapro.org)
* Copyright(C) 2003-2015 Jinhao(cnjinhao@hotmail.com)
* 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
@@ -86,6 +86,8 @@ namespace API
void register_menu_window(window, bool has_keyboard);
void set_menubar(window wd, bool attach);
void enable_space_click(window, bool enable);
}//end namespace dev

View File

@@ -43,9 +43,7 @@ namespace nana{
void mouse_leave(graph_reference, const arg_mouse&) override;
void mouse_down(graph_reference, const arg_mouse&) override;
void mouse_up(graph_reference, const arg_mouse&) override;
void key_char(graph_reference, const arg_keyboard&) override;
void key_press(graph_reference, const arg_keyboard&) override;
void key_release(graph_reference, const arg_keyboard&) override;
void focus(graph_reference, const arg_focus&) override;
private:
void _m_draw_title(graph_reference, bool enabled);

View File

@@ -65,7 +65,8 @@ namespace nana
label& format(bool); ///< Switches the format mode of the widget.
label& add_format_listener(std::function<void(command, const std::string&)>);
label& click_for(window associated_window) throw(); // as same as the "for" attribute of a label
/// as same as the HTML "for" attribute of a label
label& click_for(window associated_window) throw();
/// Returns the size of the text. If *allowed_width_in_pixel* is not zero, returns a
/// "corrected" size that changes lines to fit the text into the specified width