fix menubar behavior issue

no key_press and key_release after destroying caret under X11
missing some key_press events
menu text color issue
This commit is contained in:
Jinhao
2015-04-21 22:33:18 +08:00
parent f11e5efe80
commit 3c4f8ae6d9
16 changed files with 315 additions and 249 deletions

View File

@@ -166,7 +166,8 @@ namespace detail
bool fullscreen :1; //When the window is maximizing whether it fit for fullscreen.
bool borderless :1;
bool make_bground_declared : 1; //explicitly make bground for bground effects
unsigned Reserved :21;
bool ignore_menubar_focus : 1; //A flag indicates whether the menubar sets the focus.
unsigned Reserved :20;
unsigned char tab; //indicate a window that can receive the keyboard TAB
mouse_action action;
}flags;

View File

@@ -54,13 +54,14 @@ namespace detail
native_window_type root(core_window_t*);
void set_menubar_taken(core_window_t*);
core_window_t* get_menubar_taken();
//Delay Restores focus when a menu which attached to menubar is closed
void delay_restore(int);
bool close_menu_if_focus_other_window(native_window_type focus);
void set_menu(native_window_type menu_window, bool is_keyboard_condition);
native_window_type get_menu(native_window_type owner, bool is_keyboard_condition);
native_window_type get_menu();
void remove_menu();
void empty_menu();
void erase_menu(bool try_destroy);
void get_key_state(arg_keyboard&);
bool set_keyboard_shortkey(bool yes);

View File

@@ -77,6 +77,8 @@ namespace API
window create_frame(window, const rectangle&, widget* attached);
paint::graphics* window_graphics(window);
void delay_restore(bool);
}//end namespace dev
@@ -290,7 +292,6 @@ namespace API
void register_menu_window(window, bool has_keyboard);
bool attach_menubar(window menubar);
void detach_menubar(window menubar);
void restore_menubar_taken_window();
bool is_window_zoomed(window, bool ask_for_max); ///<Tests a window whether it is maximized or minimized.

View File

@@ -24,12 +24,16 @@ namespace nana
class item_renderer
{
public:
enum state_t{state_normal, state_highlight, state_selected};
typedef nana::paint::graphics& graph_reference;
enum class state
{
normal, highlighted, selected
};
using graph_reference = paint::graphics&;
item_renderer(window, graph_reference);
virtual void background(const nana::point& pos, const nana::size& size, state_t);
virtual void caption(int x, int y, const nana::string& text);
virtual void background(const point&, const ::nana::size&, state);
virtual void caption(const point&, const ::nana::string&);
private:
window handle_;
graph_reference graph_;
@@ -59,9 +63,8 @@ namespace nana
private:
void _m_move(bool to_left);
bool _m_popup_menu();
void _m_total_close(bool try_restore);
void _m_total_close();
bool _m_close_menu();
void _m_unload_menu_window();
std::size_t _m_item_by_pos(const ::nana::point&);
bool _m_track_mouse(const ::nana::point&);
void _m_draw();
@@ -90,11 +93,6 @@ namespace nana
nana::menu *menu;
nana::point mouse_pos;
//The menu will restore the focus of taken window. But the restoring during
//key_press and key_release resets the focus to the taken window, it causes
//the taken window to receive a key_char which should be received by menubar.
bool delay_restore;
}state_;
};
}//end namespace menubar