refactor
remove typedef-name core_window_t remove get_color and get_text_color of the internal class drawable
This commit is contained in:
parent
01bd43f960
commit
363a80e935
@ -37,8 +37,6 @@ namespace detail
|
||||
bedrock(const bedrock&) = delete;
|
||||
bedrock& operator=(const bedrock&) = delete;
|
||||
public:
|
||||
using core_window_t = basic_window;
|
||||
|
||||
struct thread_context;
|
||||
|
||||
class flag_guard;
|
||||
@ -59,16 +57,16 @@ namespace detail
|
||||
|
||||
~bedrock();
|
||||
void pump_event(window, bool is_modal);
|
||||
void flush_surface(core_window_t*, bool forced, const rectangle* update_area = nullptr);
|
||||
void flush_surface(basic_window*, bool forced, const rectangle* update_area = nullptr);
|
||||
static int inc_window(thread_t tid = 0);
|
||||
thread_context* open_thread_context(thread_t tid = 0);
|
||||
thread_context* get_thread_context(thread_t tid = 0);
|
||||
void remove_thread_context(thread_t tid = 0);
|
||||
static bedrock& instance();
|
||||
|
||||
core_window_t* focus();
|
||||
basic_window* focus();
|
||||
|
||||
void set_menubar_taken(core_window_t*);
|
||||
void set_menubar_taken(basic_window*);
|
||||
|
||||
//Delay Restores focus when a menu which attached to menubar is closed
|
||||
void delay_restore(int);
|
||||
@ -84,7 +82,7 @@ namespace detail
|
||||
bool shortkey_occurred() const;
|
||||
|
||||
element_store& get_element_store() const;
|
||||
void map_through_widgets(core_window_t*, native_drawable_type);
|
||||
void map_through_widgets(basic_window*, native_drawable_type);
|
||||
|
||||
//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(thread_t thread_id);
|
||||
@ -94,28 +92,28 @@ namespace detail
|
||||
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);
|
||||
bool event_msleave(core_window_t*);
|
||||
void event_focus_changed(core_window_t* root_wd, native_window_type receiver, bool getting);
|
||||
void thread_context_destroy(core_window_t*);
|
||||
void event_expose(basic_window *, bool exposed);
|
||||
void event_move(basic_window*, int x, int y);
|
||||
bool event_msleave(basic_window*);
|
||||
void event_focus_changed(basic_window* root_wd, native_window_type receiver, bool getting);
|
||||
void thread_context_destroy(basic_window*);
|
||||
void thread_context_lazy_refresh();
|
||||
void update_cursor(core_window_t*);
|
||||
void set_cursor(core_window_t*, nana::cursor, thread_context*);
|
||||
void define_state_cursor(core_window_t*, nana::cursor, thread_context*);
|
||||
void undefine_state_cursor(core_window_t*, thread_context*);
|
||||
void update_cursor(basic_window*);
|
||||
void set_cursor(basic_window*, nana::cursor, thread_context*);
|
||||
void define_state_cursor(basic_window*, nana::cursor, thread_context*);
|
||||
void undefine_state_cursor(basic_window*, thread_context*);
|
||||
|
||||
color_schemes& scheme();
|
||||
events_operation& evt_operation();
|
||||
window_manager& wd_manager();
|
||||
|
||||
void manage_form_loader(core_window_t*, bool insert_or_remove);
|
||||
void manage_form_loader(basic_window*, bool insert_or_remove);
|
||||
public:
|
||||
// if 'bForce__EmitInternal', then ONLY internal (widget's) events are processed (even through explicit filtering)
|
||||
bool emit(event_code, core_window_t*, const event_arg&, bool ask_update, thread_context*, const bool bForce__EmitInternal = false);
|
||||
bool emit(event_code, basic_window*, const event_arg&, bool ask_update, thread_context*, const bool bForce__EmitInternal = false);
|
||||
private:
|
||||
void _m_emit_core(event_code, core_window_t*, bool draw_only, const event_arg&, const bool bForce__EmitInternal);
|
||||
void _m_event_filter(event_code, core_window_t*, thread_context*);
|
||||
void _m_emit_core(event_code, basic_window*, bool draw_only, const event_arg&, const bool bForce__EmitInternal);
|
||||
void _m_event_filter(event_code, basic_window*, thread_context*);
|
||||
private:
|
||||
static bedrock bedrock_object;
|
||||
|
||||
|
@ -35,11 +35,9 @@ namespace detail
|
||||
class window_layout
|
||||
{
|
||||
public:
|
||||
typedef basic_window core_window_t;
|
||||
|
||||
struct wd_rectangle
|
||||
{
|
||||
core_window_t * window;
|
||||
basic_window * window;
|
||||
rectangle r;
|
||||
};
|
||||
|
||||
@ -49,27 +47,27 @@ namespace detail
|
||||
try_refresh
|
||||
};
|
||||
public:
|
||||
static void paint(core_window_t*, paint_operation, bool request_refresh_children);
|
||||
static void paint(basic_window*, paint_operation, bool request_refresh_children);
|
||||
|
||||
static bool maproot(core_window_t*, bool have_refreshed, bool request_refresh_children);
|
||||
static bool maproot(basic_window*, bool have_refreshed, bool request_refresh_children);
|
||||
|
||||
static void paste_children_to_graphics(core_window_t*, nana::paint::graphics& graph);
|
||||
static void paste_children_to_graphics(basic_window*, nana::paint::graphics& graph);
|
||||
|
||||
//read_visual_rectangle
|
||||
//@brief: Reads the visual rectangle of a window, the visual rectangle's reference frame is to root widget,
|
||||
// the visual rectangle is a rectangular block that a window should be displayed on screen.
|
||||
// The result is a rectangle that is a visible area for its ancesters.
|
||||
static bool read_visual_rectangle(core_window_t*, nana::rectangle& visual);
|
||||
static bool read_visual_rectangle(basic_window*, nana::rectangle& visual);
|
||||
|
||||
//read_overlaps
|
||||
// reads the overlaps that are overlapped a rectangular block
|
||||
static bool read_overlaps(core_window_t*, const nana::rectangle& vis_rect, std::vector<wd_rectangle>& blocks);
|
||||
static bool read_overlaps(basic_window*, const nana::rectangle& vis_rect, std::vector<wd_rectangle>& blocks);
|
||||
|
||||
static bool enable_effects_bground(core_window_t *, bool enabled);
|
||||
static bool enable_effects_bground(basic_window *, bool enabled);
|
||||
|
||||
//make_bground
|
||||
// update the glass buffer of a glass window.
|
||||
static void make_bground(core_window_t* const);
|
||||
static void make_bground(basic_window* const);
|
||||
private:
|
||||
|
||||
/// _m_paste_children
|
||||
@ -82,16 +80,16 @@ namespace detail
|
||||
* @param graph A graphics object to which the child windows are pasted.
|
||||
* @param graph_rpos The reference point to the graph.
|
||||
*/
|
||||
static void _m_paste_children(core_window_t* window, bool has_refreshed, bool request_refresh_children, const nana::rectangle& parent_rect, nana::paint::graphics& graph, const nana::point& graph_rpos);
|
||||
static void _m_paste_children(basic_window* window, bool has_refreshed, bool request_refresh_children, const nana::rectangle& parent_rect, nana::paint::graphics& graph, const nana::point& graph_rpos);
|
||||
|
||||
static void _m_paint_glass_window(core_window_t*, bool is_redraw, bool is_child_refreshed, bool called_by_notify, bool notify_other);
|
||||
static void _m_paint_glass_window(basic_window*, bool is_redraw, bool is_child_refreshed, bool called_by_notify, bool notify_other);
|
||||
|
||||
//Notify the windows which have brground to update their background buffer.
|
||||
static void _m_notify_glasses(core_window_t* const sigwd);
|
||||
static void _m_notify_glasses(basic_window* const sigwd);
|
||||
private:
|
||||
struct data_section
|
||||
{
|
||||
std::vector<core_window_t*> effects_bground_windows;
|
||||
std::vector<basic_window*> effects_bground_windows;
|
||||
};
|
||||
static data_section data_sect;
|
||||
};//end class window_layout
|
||||
|
@ -67,95 +67,93 @@ namespace detail
|
||||
using native_window = native_window_type;
|
||||
using mutex_type = revertible_mutex;
|
||||
|
||||
using core_window_t = basic_window;
|
||||
|
||||
window_manager();
|
||||
~window_manager();
|
||||
|
||||
std::size_t number_of_core_window() const;
|
||||
std::size_t window_count() const;
|
||||
mutex_type & internal_lock() const;
|
||||
void all_handles(std::vector<core_window_t*>&) const;
|
||||
void all_handles(std::vector<basic_window*>&) const;
|
||||
|
||||
void event_filter(core_window_t*, bool is_make, event_code);
|
||||
void event_filter(basic_window*, bool is_make, event_code);
|
||||
|
||||
bool available(core_window_t*);
|
||||
bool available(core_window_t *, core_window_t*);
|
||||
bool available(basic_window*);
|
||||
bool available(basic_window *, basic_window*);
|
||||
|
||||
core_window_t* create_root(core_window_t*, bool nested, rectangle, const appearance&, widget*);
|
||||
core_window_t* create_widget(core_window_t*, const rectangle&, bool is_lite, widget*);
|
||||
void close(core_window_t*);
|
||||
basic_window* create_root(basic_window*, bool nested, rectangle, const appearance&, widget*);
|
||||
basic_window* create_widget(basic_window*, const rectangle&, bool is_lite, widget*);
|
||||
void close(basic_window*);
|
||||
|
||||
//destroy
|
||||
//@brief: Delete the window handle
|
||||
void destroy(core_window_t*);
|
||||
void destroy(basic_window*);
|
||||
|
||||
//destroy_handle
|
||||
//@brief: Delete window handle, the handle type must be a root and a frame.
|
||||
|
||||
// Deletes a window whose category type is a root type or a frame type.
|
||||
void destroy_handle(core_window_t*);
|
||||
void destroy_handle(basic_window*);
|
||||
|
||||
void icon(core_window_t*, const paint::image& small_icon, const paint::image& big_icon);
|
||||
void icon(basic_window*, const paint::image& small_icon, const paint::image& big_icon);
|
||||
|
||||
bool show(core_window_t* wd, bool visible);
|
||||
bool show(basic_window* wd, bool visible);
|
||||
|
||||
//find a widget window at specified position
|
||||
//@param root A root window
|
||||
//@param pos Position
|
||||
//@param ignore_captured A flag indicates whether to ignore redirecting the result to its captured window. If this paramter is true, it returns the window at the position, if the parameter is false, it returns the captured window if the captured window don't ignore children.
|
||||
core_window_t* find_window(native_window_type root, const point& pos, bool ignore_captured = false);
|
||||
basic_window* find_window(native_window_type root, const point& pos, bool ignore_captured = false);
|
||||
|
||||
//move the wnd and its all children window, x and y is a relatively coordinate for wnd's parent window
|
||||
bool move(core_window_t*, int x, int y, bool passive);
|
||||
bool move(core_window_t*, const rectangle&);
|
||||
bool move(basic_window*, int x, int y, bool passive);
|
||||
bool move(basic_window*, const rectangle&);
|
||||
|
||||
bool size(core_window_t*, nana::size, bool passive, bool ask_update);
|
||||
bool size(basic_window*, nana::size, bool passive, bool ask_update);
|
||||
|
||||
core_window_t* root(native_window_type) const;
|
||||
basic_window* root(native_window_type) const;
|
||||
|
||||
//Copy the root buffer that wnd specified into DeviceContext
|
||||
void map(core_window_t*, bool forced, const rectangle* update_area = nullptr);
|
||||
void map(basic_window*, bool forced, const rectangle* update_area = nullptr);
|
||||
|
||||
bool update(core_window_t*, bool redraw, bool force, const rectangle* update_area = nullptr);
|
||||
void update_requesters(core_window_t* root_wd);
|
||||
void refresh_tree(core_window_t*);
|
||||
bool update(basic_window*, bool redraw, bool force, const rectangle* update_area = nullptr);
|
||||
void update_requesters(basic_window* root_wd);
|
||||
void refresh_tree(basic_window*);
|
||||
|
||||
void do_lazy_refresh(core_window_t*, bool force_copy_to_screen, bool refresh_tree = false);
|
||||
void do_lazy_refresh(basic_window*, bool force_copy_to_screen, bool refresh_tree = false);
|
||||
|
||||
bool set_parent(core_window_t* wd, core_window_t* new_parent);
|
||||
core_window_t* set_focus(core_window_t*, bool root_has_been_focused, arg_focus::reason);
|
||||
bool set_parent(basic_window* wd, basic_window* new_parent);
|
||||
basic_window* set_focus(basic_window*, bool root_has_been_focused, arg_focus::reason);
|
||||
|
||||
core_window_t* capture_redirect(core_window_t*);
|
||||
basic_window* capture_redirect(basic_window*);
|
||||
|
||||
bool capture_window_entered(int root_x, int root_y, bool& prev);
|
||||
core_window_t * capture_window() const;
|
||||
void capture_window(core_window_t*, bool capture, bool ignore_children_if_captured);
|
||||
basic_window * capture_window() const;
|
||||
void capture_window(basic_window*, bool capture, bool ignore_children_if_captured);
|
||||
|
||||
void enable_tabstop(core_window_t*);
|
||||
core_window_t* tabstop(core_window_t*, bool forward) const; //forward means move to next in logic.
|
||||
void enable_tabstop(basic_window*);
|
||||
basic_window* tabstop(basic_window*, bool forward) const; //forward means move to next in logic.
|
||||
|
||||
void remove_trash_handle(thread_t tid);
|
||||
|
||||
bool enable_effects_bground(core_window_t*, bool);
|
||||
bool enable_effects_bground(basic_window*, bool);
|
||||
|
||||
bool calc_window_point(core_window_t*, nana::point&);
|
||||
bool calc_window_point(basic_window*, nana::point&);
|
||||
|
||||
root_misc* root_runtime(native_window) const;
|
||||
|
||||
bool register_shortkey(core_window_t*, unsigned long key);
|
||||
void unregister_shortkey(core_window_t*, bool with_children);
|
||||
bool register_shortkey(basic_window*, unsigned long key);
|
||||
void unregister_shortkey(basic_window*, bool with_children);
|
||||
|
||||
core_window_t* find_shortkey(native_window_type, unsigned long key);
|
||||
basic_window* find_shortkey(native_window_type, unsigned long key);
|
||||
|
||||
void set_safe_place(core_window_t* wd, std::function<void()>&& fn);
|
||||
void set_safe_place(basic_window* wd, std::function<void()>&& fn);
|
||||
void call_safe_place(thread_t thread_id);
|
||||
private:
|
||||
void _m_disengage(core_window_t*, core_window_t* for_new);
|
||||
void _m_destroy(core_window_t*);
|
||||
void _m_move_core(core_window_t*, const point& delta);
|
||||
void _m_shortkeys(core_window_t*, bool with_chlidren, std::vector<std::pair<core_window_t*, unsigned long>>& keys) const;
|
||||
core_window_t* _m_find(core_window_t*, const point&);
|
||||
static bool _m_effective(core_window_t*, const point& root_pos);
|
||||
void _m_disengage(basic_window*, basic_window* for_new);
|
||||
void _m_destroy(basic_window*);
|
||||
void _m_move_core(basic_window*, const point& delta);
|
||||
void _m_shortkeys(basic_window*, bool with_chlidren, std::vector<std::pair<basic_window*, unsigned long>>& keys) const;
|
||||
basic_window* _m_find(basic_window*, const point&);
|
||||
static bool _m_effective(basic_window*, const point& root_pos);
|
||||
private:
|
||||
mutable mutex_type mutex_;
|
||||
|
||||
@ -166,10 +164,10 @@ namespace detail
|
||||
{
|
||||
struct captured
|
||||
{
|
||||
core_window_t *window;
|
||||
basic_window *window;
|
||||
bool inside;
|
||||
bool ignore_children;
|
||||
std::vector<std::pair<core_window_t*, bool> > history;
|
||||
std::vector<std::pair<basic_window*, bool> > history;
|
||||
}capture;
|
||||
}attr_;
|
||||
|
||||
|
@ -73,7 +73,7 @@ namespace nana
|
||||
class bedrock::flag_guard
|
||||
{
|
||||
public:
|
||||
flag_guard(bedrock* brock, core_window_t * wd)
|
||||
flag_guard(bedrock* brock, basic_window * wd)
|
||||
: brock_{ brock }, wd_(wd)
|
||||
{
|
||||
wd_->flags.refreshing = true;
|
||||
@ -86,7 +86,7 @@ namespace nana
|
||||
}
|
||||
private:
|
||||
bedrock *const brock_;
|
||||
core_window_t *const wd_;
|
||||
basic_window *const wd_;
|
||||
};
|
||||
|
||||
//class root_guard
|
||||
@ -107,7 +107,7 @@ namespace nana
|
||||
}
|
||||
//end class root_guard
|
||||
|
||||
bedrock::core_window_t* bedrock::focus()
|
||||
basic_window* bedrock::focus()
|
||||
{
|
||||
auto wd = wd_manager().root(native_interface::get_focus_window());
|
||||
return (wd ? wd->other.attribute.root->focus : nullptr);
|
||||
@ -123,7 +123,7 @@ namespace nana
|
||||
return pi_data_->wd_manager;
|
||||
}
|
||||
|
||||
void bedrock::manage_form_loader(core_window_t* wd, bool insert_or_remove)
|
||||
void bedrock::manage_form_loader(basic_window* wd, bool insert_or_remove)
|
||||
{
|
||||
if (insert_or_remove)
|
||||
{
|
||||
@ -140,7 +140,7 @@ namespace nana
|
||||
|
||||
void bedrock::close_thread_window(thread_t thread_id)
|
||||
{
|
||||
std::vector<core_window_t*> v;
|
||||
std::vector<basic_window*> v;
|
||||
wd_manager().all_handles(v);
|
||||
|
||||
std::vector<native_window_type> roots;
|
||||
@ -159,7 +159,7 @@ namespace nana
|
||||
native_interface::close_window(i);
|
||||
}
|
||||
|
||||
void bedrock::event_expose(core_window_t * wd, bool exposed)
|
||||
void bedrock::event_expose(basic_window * wd, bool exposed)
|
||||
{
|
||||
if (nullptr == wd) return;
|
||||
|
||||
@ -171,7 +171,7 @@ namespace nana
|
||||
if (emit(event_code::expose, wd, arg, false, get_thread_context()))
|
||||
{
|
||||
//Get the window who has the activated caret
|
||||
const core_window_t * caret_wd = ((wd->annex.caret_ptr && wd->annex.caret_ptr->activated()) ? wd : wd->child_caret());
|
||||
auto const caret_wd = ((wd->annex.caret_ptr && wd->annex.caret_ptr->activated()) ? wd : wd->child_caret());
|
||||
if (caret_wd)
|
||||
{
|
||||
if (exposed)
|
||||
@ -194,7 +194,7 @@ namespace nana
|
||||
}
|
||||
}
|
||||
|
||||
void bedrock::event_move(core_window_t* wd, int x, int y)
|
||||
void bedrock::event_move(basic_window* wd, int x, int y)
|
||||
{
|
||||
if (wd)
|
||||
{
|
||||
@ -206,7 +206,7 @@ namespace nana
|
||||
}
|
||||
}
|
||||
|
||||
bool bedrock::event_msleave(core_window_t* hovered)
|
||||
bool bedrock::event_msleave(basic_window* hovered)
|
||||
{
|
||||
if (wd_manager().available(hovered) && hovered->flags.enabled)
|
||||
{
|
||||
@ -225,7 +225,7 @@ namespace nana
|
||||
}
|
||||
|
||||
//The wd must be a root window
|
||||
void bedrock::event_focus_changed(core_window_t* root_wd, native_window_type receiver, bool getting)
|
||||
void bedrock::event_focus_changed(basic_window* root_wd, native_window_type receiver, bool getting)
|
||||
{
|
||||
auto focused = root_wd->other.attribute.root->focus;
|
||||
|
||||
@ -256,7 +256,7 @@ namespace nana
|
||||
}
|
||||
}
|
||||
|
||||
void bedrock::update_cursor(core_window_t * wd)
|
||||
void bedrock::update_cursor(basic_window * wd)
|
||||
{
|
||||
internal_scope_guard isg;
|
||||
if (wd_manager().available(wd))
|
||||
@ -278,7 +278,7 @@ namespace nana
|
||||
}
|
||||
}
|
||||
|
||||
void bedrock::set_menubar_taken(core_window_t* wd)
|
||||
void bedrock::set_menubar_taken(basic_window* wd)
|
||||
{
|
||||
auto pre = pi_data_->menu.taken_window;
|
||||
pi_data_->menu.taken_window = wd;
|
||||
@ -392,7 +392,7 @@ namespace nana
|
||||
return pi_data_->scheme;
|
||||
}
|
||||
|
||||
void bedrock::_m_emit_core(event_code evt_code, core_window_t* wd, bool draw_only, const ::nana::event_arg& event_arg, const bool bForce__EmitInternal)
|
||||
void bedrock::_m_emit_core(event_code evt_code, basic_window* wd, bool draw_only, const ::nana::event_arg& event_arg, const bool bForce__EmitInternal)
|
||||
{
|
||||
auto retain = wd->annex.events_ptr;
|
||||
auto evts_ptr = retain.get();
|
||||
@ -622,7 +622,7 @@ namespace nana
|
||||
}
|
||||
}
|
||||
|
||||
void bedrock::thread_context_destroy(core_window_t * wd)
|
||||
void bedrock::thread_context_destroy(basic_window * wd)
|
||||
{
|
||||
auto ctx = get_thread_context(0);
|
||||
if(ctx && ctx->event_window == wd)
|
||||
@ -633,15 +633,15 @@ namespace nana
|
||||
{
|
||||
auto ctx = get_thread_context(0);
|
||||
if(ctx && ctx->event_window)
|
||||
ctx->event_window->other.upd_state = core_window_t::update_state::refreshed;
|
||||
ctx->event_window->other.upd_state = basic_window::update_state::refreshed;
|
||||
}
|
||||
|
||||
bool bedrock::emit(event_code evt_code, core_window_t* wd, const ::nana::event_arg& arg, bool ask_update, thread_context* thrd, const bool bForce__EmitInternal)
|
||||
bool bedrock::emit(event_code evt_code, basic_window* wd, const ::nana::event_arg& arg, bool ask_update, thread_context* thrd, const bool bForce__EmitInternal)
|
||||
{
|
||||
if(wd_manager().available(wd) == false)
|
||||
return false;
|
||||
|
||||
core_window_t * prev_wd = nullptr;
|
||||
basic_window * prev_wd = nullptr;
|
||||
if(thrd)
|
||||
{
|
||||
prev_wd = thrd->event_window;
|
||||
@ -676,7 +676,7 @@ namespace nana
|
||||
return good_wd;
|
||||
}
|
||||
|
||||
void bedrock::_m_event_filter(event_code event_id, core_window_t * wd, thread_context * thrd)
|
||||
void bedrock::_m_event_filter(event_code event_id, basic_window * wd, thread_context * thrd)
|
||||
{
|
||||
auto not_state_cur = (wd->root_widget->other.attribute.root->state_cursor == nana::cursor::arrow);
|
||||
|
||||
|
@ -141,7 +141,7 @@ namespace detail
|
||||
delete impl_;
|
||||
}
|
||||
|
||||
void bedrock::flush_surface(core_window_t* wd, bool forced, const rectangle* update_area)
|
||||
void bedrock::flush_surface(basic_window* wd, bool forced, const rectangle* update_area)
|
||||
{
|
||||
wd->drawer.map(wd, forced, update_area);
|
||||
}
|
||||
@ -248,7 +248,7 @@ namespace detail
|
||||
return impl_->estore;
|
||||
}
|
||||
|
||||
void bedrock::map_through_widgets(core_window_t*, native_drawable_type)
|
||||
void bedrock::map_through_widgets(basic_window*, native_drawable_type)
|
||||
{
|
||||
//No implementation for Linux
|
||||
}
|
||||
@ -579,11 +579,9 @@ namespace detail
|
||||
|
||||
void window_proc_for_xevent(Display* /*display*/, XEvent& xevent)
|
||||
{
|
||||
typedef detail::bedrock::core_window_t core_window_t;
|
||||
|
||||
static auto& brock = detail::bedrock::instance();
|
||||
static unsigned long last_mouse_down_time;
|
||||
static core_window_t* last_mouse_down_window;
|
||||
static basic_window* last_mouse_down_window;
|
||||
|
||||
auto native_window = reinterpret_cast<native_window_type>(event_window(xevent));
|
||||
auto & wd_manager = brock.wd_manager();
|
||||
@ -1257,7 +1255,7 @@ namespace detail
|
||||
lock.revert();
|
||||
|
||||
native_window_type owner_native{};
|
||||
core_window_t * owner = 0;
|
||||
basic_window * owner = nullptr;
|
||||
if(condition_wd && is_modal)
|
||||
{
|
||||
native_window_type modal = condition_wd->root;
|
||||
@ -1299,7 +1297,7 @@ namespace detail
|
||||
}//end bedrock::event_loop
|
||||
|
||||
//Dynamically set a cursor for a window
|
||||
void bedrock::set_cursor(core_window_t* wd, nana::cursor cur, thread_context* thrd)
|
||||
void bedrock::set_cursor(basic_window* wd, nana::cursor cur, thread_context* thrd)
|
||||
{
|
||||
if (nullptr == thrd)
|
||||
thrd = get_thread_context(wd->thread_id);
|
||||
@ -1342,14 +1340,14 @@ namespace detail
|
||||
}
|
||||
}
|
||||
|
||||
void bedrock::define_state_cursor(core_window_t* wd, nana::cursor cur, thread_context* thrd)
|
||||
void bedrock::define_state_cursor(basic_window* wd, nana::cursor cur, thread_context* thrd)
|
||||
{
|
||||
wd->root_widget->other.attribute.root->state_cursor = cur;
|
||||
wd->root_widget->other.attribute.root->state_cursor_window = wd;
|
||||
set_cursor(wd, cur, thrd);
|
||||
}
|
||||
|
||||
void bedrock::undefine_state_cursor(core_window_t * wd, thread_context* thrd)
|
||||
void bedrock::undefine_state_cursor(basic_window * wd, thread_context* thrd)
|
||||
{
|
||||
if (!wd_manager().available(wd))
|
||||
return;
|
||||
|
@ -18,12 +18,12 @@ namespace nana
|
||||
color_schemes scheme;
|
||||
events_operation evt_operation;
|
||||
window_manager wd_manager;
|
||||
std::set<core_window_t*> auto_form_set;
|
||||
std::set<basic_window*> auto_form_set;
|
||||
bool shortkey_occurred{ false };
|
||||
|
||||
struct menu_rep
|
||||
{
|
||||
core_window_t* taken_window{ nullptr };
|
||||
basic_window* taken_window{ nullptr };
|
||||
bool delay_restore{ false };
|
||||
native_window_type window{ nullptr };
|
||||
native_window_type owner{ nullptr };
|
||||
@ -37,7 +37,7 @@ namespace nana
|
||||
{
|
||||
unsigned event_pump_ref_count{0};
|
||||
int window_count{0}; //The number of windows
|
||||
core_window_t* event_window{nullptr};
|
||||
basic_window* event_window{nullptr};
|
||||
|
||||
struct platform_detail_tag
|
||||
{
|
||||
@ -46,7 +46,7 @@ namespace nana
|
||||
|
||||
struct cursor_tag
|
||||
{
|
||||
core_window_t * window;
|
||||
basic_window * window;
|
||||
native_window_type native_handle;
|
||||
nana::cursor predef_cursor;
|
||||
HCURSOR handle;
|
||||
@ -66,7 +66,7 @@ namespace nana
|
||||
unsigned event_pump_ref_count{0};
|
||||
|
||||
int window_count{0}; //The number of windows
|
||||
core_window_t* event_window{nullptr};
|
||||
basic_window* event_window{nullptr};
|
||||
bool is_alt_pressed{false};
|
||||
bool is_ctrl_pressed{false};
|
||||
|
||||
@ -78,7 +78,7 @@ namespace nana
|
||||
|
||||
struct cursor_tag
|
||||
{
|
||||
core_window_t * window;
|
||||
basic_window * window;
|
||||
native_window_type native_handle;
|
||||
nana::cursor predef_cursor;
|
||||
Cursor handle;
|
||||
|
@ -213,9 +213,9 @@ namespace detail
|
||||
|
||||
bedrock::~bedrock()
|
||||
{
|
||||
if(wd_manager().number_of_core_window())
|
||||
if(wd_manager().window_count())
|
||||
{
|
||||
std::string msg = "Nana.GUI detects a memory leaks in window_manager, " + std::to_string(wd_manager().number_of_core_window()) + " window(s) are not uninstalled.";
|
||||
std::string msg = "Nana.GUI detects a memory leaks in window_manager, " + std::to_string(wd_manager().window_count()) + " window(s) are not uninstalled.";
|
||||
std::cerr << msg; /// \todo add list of cations of opening windows and if auto testing GUI do auto OK after 2 seconds.
|
||||
::MessageBoxA(0, msg.c_str(), ("Nana C++ Library"), MB_OK);
|
||||
}
|
||||
@ -290,7 +290,7 @@ namespace detail
|
||||
return bedrock_object;
|
||||
}
|
||||
|
||||
void bedrock::flush_surface(core_window_t* wd, bool forced, const rectangle* update_area)
|
||||
void bedrock::flush_surface(basic_window* wd, bool forced, const rectangle* update_area)
|
||||
{
|
||||
if (nana::system::this_thread_id() != wd->thread_id)
|
||||
{
|
||||
@ -581,7 +581,7 @@ namespace detail
|
||||
case nana::detail::messages::remote_flush_surface:
|
||||
{
|
||||
auto stru = reinterpret_cast<detail::messages::map_thread*>(lParam);
|
||||
bedrock.wd_manager().map(reinterpret_cast<bedrock::core_window_t*>(wParam), stru->forced, (stru->ignore_update_area ? nullptr : &stru->update_area));
|
||||
bedrock.wd_manager().map(reinterpret_cast<basic_window*>(wParam), stru->forced, (stru->ignore_update_area ? nullptr : &stru->update_area));
|
||||
::UpdateWindow(wd);
|
||||
::HeapFree(::GetProcessHeap(), 0, stru);
|
||||
}
|
||||
@ -652,7 +652,7 @@ namespace detail
|
||||
return true;
|
||||
}
|
||||
|
||||
void adjust_sizing(bedrock::core_window_t* wd, ::RECT * const r, int edge, unsigned req_width, unsigned req_height)
|
||||
void adjust_sizing(basic_window* wd, ::RECT * const r, int edge, unsigned req_width, unsigned req_height)
|
||||
{
|
||||
unsigned width = static_cast<unsigned>(r->right - r->left) - wd->extra_width;
|
||||
unsigned height = static_cast<unsigned>(r->bottom - r->top) - wd->extra_height;
|
||||
@ -1638,7 +1638,7 @@ namespace detail
|
||||
return impl_->estore;
|
||||
}
|
||||
|
||||
void bedrock::map_through_widgets(core_window_t* wd, native_drawable_type drawable)
|
||||
void bedrock::map_through_widgets(basic_window* wd, native_drawable_type drawable)
|
||||
{
|
||||
auto graph_context = reinterpret_cast<HDC>(wd->root_graph->handle()->context);
|
||||
|
||||
@ -1685,7 +1685,7 @@ namespace detail
|
||||
}
|
||||
|
||||
//Dynamically set a cursor for a window
|
||||
void bedrock::set_cursor(core_window_t* wd, nana::cursor cur, thread_context* thrd)
|
||||
void bedrock::set_cursor(basic_window* wd, nana::cursor cur, thread_context* thrd)
|
||||
{
|
||||
if (nullptr == thrd)
|
||||
thrd = get_thread_context(wd->thread_id);
|
||||
@ -1730,7 +1730,7 @@ namespace detail
|
||||
}
|
||||
}
|
||||
|
||||
void bedrock::define_state_cursor(core_window_t* wd, nana::cursor cur, thread_context* thrd)
|
||||
void bedrock::define_state_cursor(basic_window* wd, nana::cursor cur, thread_context* thrd)
|
||||
{
|
||||
wd->root_widget->other.attribute.root->state_cursor = cur;
|
||||
wd->root_widget->other.attribute.root->state_cursor_window = wd;
|
||||
@ -1740,7 +1740,7 @@ namespace detail
|
||||
::ShowCursor(TRUE);
|
||||
}
|
||||
|
||||
void bedrock::undefine_state_cursor(core_window_t * wd, thread_context* thrd)
|
||||
void bedrock::undefine_state_cursor(basic_window * wd, thread_context* thrd)
|
||||
{
|
||||
HCURSOR rev_handle = ::LoadCursor(nullptr, IDC_ARROW);
|
||||
if (!wd_manager().available(wd))
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* A Drawer Implementation
|
||||
* Nana C++ Library(http://www.nanapro.org)
|
||||
* Copyright(C) 2003-2017 Jinhao(cnjinhao@hotmail.com)
|
||||
* Copyright(C) 2003-2019 Jinhao(cnjinhao@hotmail.com)
|
||||
*
|
||||
* Distributed under the Boost Software License, Version 1.0.
|
||||
* (See accompanying file LICENSE_1_0.txt or copy at
|
||||
@ -342,8 +342,7 @@ namespace nana
|
||||
{
|
||||
if(wd)
|
||||
{
|
||||
auto iwd = reinterpret_cast<bedrock_type::core_window_t*>(wd);
|
||||
bool owns_caret = (iwd->annex.caret_ptr) && (iwd->annex.caret_ptr->visible());
|
||||
bool owns_caret = (wd->annex.caret_ptr) && (wd->annex.caret_ptr->visible());
|
||||
|
||||
//The caret in X11 is implemented by Nana, it is different from Windows'
|
||||
//the caret in X11 is asynchronous, it is hard to hide and show the caret
|
||||
@ -352,20 +351,20 @@ namespace nana
|
||||
if(owns_caret)
|
||||
{
|
||||
#ifndef NANA_X11
|
||||
iwd->annex.caret_ptr->visible(false);
|
||||
wd->annex.caret_ptr->visible(false);
|
||||
#else
|
||||
owns_caret = nana::detail::platform_spec::instance().caret_update(iwd->root, *iwd->root_graph, false);
|
||||
owns_caret = nana::detail::platform_spec::instance().caret_update(wd->root, *wd->root_graph, false);
|
||||
#endif
|
||||
}
|
||||
|
||||
edge_nimbus_renderer::instance().render(iwd, forced, update_area);
|
||||
edge_nimbus_renderer::instance().render(wd, forced, update_area);
|
||||
|
||||
if(owns_caret)
|
||||
{
|
||||
#ifndef NANA_X11
|
||||
iwd->annex.caret_ptr->visible(true);
|
||||
wd->annex.caret_ptr->visible(true);
|
||||
#else
|
||||
nana::detail::platform_spec::instance().caret_update(iwd->root, *iwd->root_graph, true);
|
||||
nana::detail::platform_spec::instance().caret_update(wd->root, *wd->root_graph, true);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
@ -22,7 +22,7 @@ namespace nana
|
||||
namespace detail
|
||||
{
|
||||
//class window_layout
|
||||
void window_layout::paint(core_window_t* wd, paint_operation operation, bool req_refresh_children)
|
||||
void window_layout::paint(basic_window* wd, paint_operation operation, bool req_refresh_children)
|
||||
{
|
||||
if (wd->flags.refreshing && (paint_operation::try_refresh == operation))
|
||||
return;
|
||||
@ -41,7 +41,7 @@ namespace nana
|
||||
_m_paint_glass_window(wd, (paint_operation::try_refresh == operation), req_refresh_children, false, true);
|
||||
}
|
||||
|
||||
bool window_layout::maproot(core_window_t* wd, bool have_refreshed, bool req_refresh_children)
|
||||
bool window_layout::maproot(basic_window* wd, bool have_refreshed, bool req_refresh_children)
|
||||
{
|
||||
auto check_opaque = wd->seek_non_lite_widget_ancestor();
|
||||
if (check_opaque && check_opaque->flags.refreshing)
|
||||
@ -80,7 +80,7 @@ namespace nana
|
||||
return false;
|
||||
}
|
||||
|
||||
void window_layout::paste_children_to_graphics(core_window_t* wd, nana::paint::graphics& graph)
|
||||
void window_layout::paste_children_to_graphics(basic_window* wd, nana::paint::graphics& graph)
|
||||
{
|
||||
_m_paste_children(wd, false, false, rectangle{ wd->pos_root, wd->dimension }, graph, wd->pos_root);
|
||||
}
|
||||
@ -89,7 +89,7 @@ namespace nana
|
||||
///@brief Reads the visual rectangle of a window, the visual rectangle's reference frame is to root widget,
|
||||
/// the visual rectangle is a rectangular block that a window should be displayed on screen.
|
||||
/// The result is a rectangle that is a visible area for its ancestors.
|
||||
bool window_layout::read_visual_rectangle(core_window_t* wd, nana::rectangle& visual)
|
||||
bool window_layout::read_visual_rectangle(basic_window* wd, nana::rectangle& visual)
|
||||
{
|
||||
if (! wd->displayed()) return false;
|
||||
|
||||
@ -139,7 +139,7 @@ namespace nana
|
||||
|
||||
//read_overlaps
|
||||
// reads the overlaps that are overlapped a rectangular block
|
||||
bool window_layout::read_overlaps(core_window_t* wd, const nana::rectangle& vis_rect, std::vector<wd_rectangle>& blocks)
|
||||
bool window_layout::read_overlaps(basic_window* wd, const nana::rectangle& vis_rect, std::vector<wd_rectangle>& blocks)
|
||||
{
|
||||
auto const is_wd_root = (category::flags::root == wd->other.category);
|
||||
wd_rectangle block;
|
||||
@ -150,7 +150,7 @@ namespace nana
|
||||
{
|
||||
for (++i; i != wd->parent->children.cend(); ++i)
|
||||
{
|
||||
core_window_t* cover = *i;
|
||||
basic_window* cover = *i;
|
||||
|
||||
if (!cover->visible)
|
||||
continue;
|
||||
@ -182,7 +182,7 @@ namespace nana
|
||||
return (!blocks.empty());
|
||||
}
|
||||
|
||||
bool window_layout::enable_effects_bground(core_window_t * wd, bool enabled)
|
||||
bool window_layout::enable_effects_bground(basic_window * wd, bool enabled)
|
||||
{
|
||||
if (category::flags::widget != wd->other.category)
|
||||
return false;
|
||||
@ -220,15 +220,15 @@ namespace nana
|
||||
|
||||
//make_bground
|
||||
// update the glass buffer of a glass window.
|
||||
void window_layout::make_bground(core_window_t* const wd)
|
||||
void window_layout::make_bground(basic_window* const wd)
|
||||
{
|
||||
nana::point rpos{ wd->pos_root };
|
||||
auto & glass_buffer = wd->other.glass_buffer;
|
||||
|
||||
if (category::flags::lite_widget == wd->parent->other.category)
|
||||
{
|
||||
std::vector<core_window_t*> layers;
|
||||
core_window_t * beg = wd->parent;
|
||||
std::vector<basic_window*> layers;
|
||||
auto beg = wd->parent;
|
||||
while (beg && (category::flags::lite_widget == beg->other.category))
|
||||
{
|
||||
layers.push_back(beg);
|
||||
@ -240,11 +240,11 @@ namespace nana
|
||||
nana::rectangle r(wd->pos_owner, wd->dimension);
|
||||
for (auto i = layers.rbegin(), layers_rend = layers.rend(); i != layers_rend; ++i)
|
||||
{
|
||||
core_window_t * pre = *i;
|
||||
auto pre = *i;
|
||||
if (false == pre->visible)
|
||||
continue;
|
||||
|
||||
core_window_t * term = ((i + 1 != layers_rend) ? *(i + 1) : wd);
|
||||
auto term = ((i + 1 != layers_rend) ? *(i + 1) : wd);
|
||||
r.position(wd->pos_root - pre->pos_root);
|
||||
|
||||
for (auto child : pre->children)
|
||||
@ -289,7 +289,7 @@ namespace nana
|
||||
wd->effect.bground->take_effect(wd, glass_buffer);
|
||||
}
|
||||
|
||||
void window_layout::_m_paste_children(core_window_t* wd, bool have_refreshed, bool req_refresh_children, const nana::rectangle& parent_rect, nana::paint::graphics& graph, const nana::point& graph_rpos)
|
||||
void window_layout::_m_paste_children(basic_window* wd, bool have_refreshed, bool req_refresh_children, const nana::rectangle& parent_rect, nana::paint::graphics& graph, const nana::point& graph_rpos)
|
||||
{
|
||||
nana::rectangle rect;
|
||||
for (auto child : wd->children)
|
||||
@ -333,7 +333,7 @@ namespace nana
|
||||
}
|
||||
}
|
||||
|
||||
void window_layout::_m_paint_glass_window(core_window_t* wd, bool is_redraw, bool is_child_refreshed, bool called_by_notify, bool notify_other)
|
||||
void window_layout::_m_paint_glass_window(basic_window* wd, bool is_redraw, bool is_child_refreshed, bool called_by_notify, bool notify_other)
|
||||
{
|
||||
//A window which has an empty graphics(and lite-widget) does not notify
|
||||
//glass windows for updating their background.
|
||||
@ -381,7 +381,7 @@ namespace nana
|
||||
|
||||
/// Notify the glass windows that are overlapped with the specified visual rectangle.
|
||||
/// If a child window of sigwd is a glass window, it doesn't to be notified.
|
||||
void window_layout::_m_notify_glasses(core_window_t* const sigwd)
|
||||
void window_layout::_m_notify_glasses(basic_window* const sigwd)
|
||||
{
|
||||
nana::rectangle r_of_sigwd(sigwd->pos_root, sigwd->dimension);
|
||||
for (auto wd : data_sect.effects_bground_windows)
|
||||
@ -420,7 +420,7 @@ namespace nana
|
||||
else
|
||||
{
|
||||
//test if sigwnd is a parent of glass window x, or a slibing of the glass window, or a child of the slibing of the glass window.
|
||||
core_window_t *p = wd->parent, *signode = sigwd;
|
||||
basic_window *p = wd->parent, *signode = sigwd;
|
||||
while (signode->parent && (signode->parent != p))
|
||||
signode = signode->parent;
|
||||
|
||||
|
@ -282,7 +282,7 @@ namespace detail
|
||||
paint::image default_icon_big;
|
||||
paint::image default_icon_small;
|
||||
|
||||
lite_map<core_window_t*, std::vector<std::function<void()>>> safe_place;
|
||||
lite_map<basic_window*, std::vector<std::function<void()>>> safe_place;
|
||||
};
|
||||
//end struct wdm_private_impl
|
||||
|
||||
@ -455,7 +455,7 @@ namespace detail
|
||||
delete impl_;
|
||||
}
|
||||
|
||||
std::size_t window_manager::number_of_core_window() const
|
||||
std::size_t window_manager::window_count() const
|
||||
{
|
||||
//Thread-Safe Required!
|
||||
std::lock_guard<mutex_type> lock(mutex_);
|
||||
@ -468,14 +468,14 @@ namespace detail
|
||||
return mutex_;
|
||||
}
|
||||
|
||||
void window_manager::all_handles(std::vector<core_window_t*> &v) const
|
||||
void window_manager::all_handles(std::vector<basic_window*> &v) const
|
||||
{
|
||||
//Thread-Safe Required!
|
||||
std::lock_guard<mutex_type> lock(mutex_);
|
||||
v = impl_->wd_register.queue();
|
||||
}
|
||||
|
||||
void window_manager::event_filter(core_window_t* wd, bool is_make, event_code evtid)
|
||||
void window_manager::event_filter(basic_window* wd, bool is_make, event_code evtid)
|
||||
{
|
||||
switch(evtid)
|
||||
{
|
||||
@ -487,21 +487,21 @@ namespace detail
|
||||
}
|
||||
}
|
||||
|
||||
bool window_manager::available(core_window_t* wd)
|
||||
bool window_manager::available(basic_window* wd)
|
||||
{
|
||||
//Thread-Safe Required!
|
||||
std::lock_guard<mutex_type> lock(mutex_);
|
||||
return impl_->wd_register.available(wd);
|
||||
}
|
||||
|
||||
bool window_manager::available(core_window_t * a, core_window_t* b)
|
||||
bool window_manager::available(basic_window * a, basic_window* b)
|
||||
{
|
||||
//Thread-Safe Required!
|
||||
std::lock_guard<mutex_type> lock(mutex_);
|
||||
return (impl_->wd_register.available(a) && impl_->wd_register.available(b));
|
||||
}
|
||||
|
||||
window_manager::core_window_t* window_manager::create_root(core_window_t* owner, bool nested, rectangle r, const appearance& app, widget* wdg)
|
||||
basic_window* window_manager::create_root(basic_window* owner, bool nested, rectangle r, const appearance& app, widget* wdg)
|
||||
{
|
||||
native_window_type native = nullptr;
|
||||
if (owner)
|
||||
@ -525,7 +525,7 @@ namespace detail
|
||||
auto result = native_interface::create_window(native, nested, r, app);
|
||||
if (result.native_handle)
|
||||
{
|
||||
auto wd = new core_window_t(owner, widget_notifier_interface::get_notifier(wdg), (category::root_tag**)nullptr);
|
||||
auto wd = new basic_window(owner, widget_notifier_interface::get_notifier(wdg), (category::root_tag**)nullptr);
|
||||
if (nested)
|
||||
{
|
||||
wd->owner = nullptr;
|
||||
@ -553,7 +553,7 @@ namespace detail
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
window_manager::core_window_t* window_manager::create_widget(core_window_t* parent, const rectangle& r, bool is_lite, widget* wdg)
|
||||
basic_window* window_manager::create_widget(basic_window* parent, const rectangle& r, bool is_lite, widget* wdg)
|
||||
{
|
||||
//Thread-Safe Required!
|
||||
std::lock_guard<mutex_type> lock(mutex_);
|
||||
@ -565,17 +565,17 @@ namespace detail
|
||||
|
||||
auto wdg_notifier = widget_notifier_interface::get_notifier(wdg);
|
||||
|
||||
core_window_t * wd;
|
||||
basic_window * wd;
|
||||
if (is_lite)
|
||||
wd = new core_window_t(parent, std::move(wdg_notifier), r, (category::lite_widget_tag**)nullptr);
|
||||
wd = new basic_window(parent, std::move(wdg_notifier), r, (category::lite_widget_tag**)nullptr);
|
||||
else
|
||||
wd = new core_window_t(parent, std::move(wdg_notifier), r, (category::widget_tag**)nullptr);
|
||||
wd = new basic_window(parent, std::move(wdg_notifier), r, (category::widget_tag**)nullptr);
|
||||
|
||||
impl_->wd_register.insert(wd);
|
||||
return wd;
|
||||
}
|
||||
|
||||
void window_manager::close(core_window_t *wd)
|
||||
void window_manager::close(basic_window *wd)
|
||||
{
|
||||
//Thread-Safe Required!
|
||||
std::lock_guard<mutex_type> lock(mutex_);
|
||||
@ -617,7 +617,7 @@ namespace detail
|
||||
|
||||
//destroy
|
||||
//@brief: Delete the window handle
|
||||
void window_manager::destroy(core_window_t* wd)
|
||||
void window_manager::destroy(basic_window* wd)
|
||||
{
|
||||
//Thread-Safe Required!
|
||||
std::lock_guard<mutex_type> lock(mutex_);
|
||||
@ -641,7 +641,7 @@ namespace detail
|
||||
update(parent, false, false, &update_area);
|
||||
}
|
||||
|
||||
void window_manager::destroy_handle(core_window_t* wd)
|
||||
void window_manager::destroy_handle(basic_window* wd)
|
||||
{
|
||||
//Thread-Safe Required!
|
||||
std::lock_guard<mutex_type> lock(mutex_);
|
||||
@ -654,7 +654,7 @@ namespace detail
|
||||
}
|
||||
}
|
||||
|
||||
void window_manager::icon(core_window_t* wd, const paint::image& small_icon, const paint::image& big_icon)
|
||||
void window_manager::icon(basic_window* wd, const paint::image& small_icon, const paint::image& big_icon)
|
||||
{
|
||||
if(!big_icon.empty() || !small_icon.empty())
|
||||
{
|
||||
@ -677,7 +677,7 @@ namespace detail
|
||||
|
||||
//show
|
||||
//@brief: show or hide a window
|
||||
bool window_manager::show(core_window_t* wd, bool visible)
|
||||
bool window_manager::show(basic_window* wd, bool visible)
|
||||
{
|
||||
//Thread-Safe Required!
|
||||
std::lock_guard<mutex_type> lock(mutex_);
|
||||
@ -702,7 +702,7 @@ namespace detail
|
||||
return true;
|
||||
}
|
||||
|
||||
window_manager::core_window_t* window_manager::find_window(native_window_type root, const point& pos, bool ignore_captured)
|
||||
basic_window* window_manager::find_window(native_window_type root, const point& pos, bool ignore_captured)
|
||||
{
|
||||
if (nullptr == root)
|
||||
return nullptr;
|
||||
@ -740,7 +740,7 @@ namespace detail
|
||||
}
|
||||
|
||||
//move the wnd and its all children window, x and y is a relatively coordinate for wnd's parent window
|
||||
bool window_manager::move(core_window_t* wd, int x, int y, bool passive)
|
||||
bool window_manager::move(basic_window* wd, int x, int y, bool passive)
|
||||
{
|
||||
//Thread-Safe Required!
|
||||
std::lock_guard<mutex_type> lock(mutex_);
|
||||
@ -789,7 +789,7 @@ namespace detail
|
||||
return false;
|
||||
}
|
||||
|
||||
bool window_manager::move(core_window_t* wd, const rectangle& r)
|
||||
bool window_manager::move(basic_window* wd, const rectangle& r)
|
||||
{
|
||||
//Thread-Safe Required!
|
||||
std::lock_guard<mutex_type> lock(mutex_);
|
||||
@ -865,7 +865,7 @@ namespace detail
|
||||
// e.g, when the size of window is changed by OS/user, the function should not resize the
|
||||
// window again, otherwise, it causes an infinite loop, because when a root_widget is resized,
|
||||
// window_manager will call the function.
|
||||
bool window_manager::size(core_window_t* wd, nana::size sz, bool passive, bool ask_update)
|
||||
bool window_manager::size(basic_window* wd, nana::size sz, bool passive, bool ask_update)
|
||||
{
|
||||
//Thread-Safe Required!
|
||||
std::lock_guard<mutex_type> lock(mutex_);
|
||||
@ -903,7 +903,7 @@ namespace detail
|
||||
if (wd->dimension == sz)
|
||||
return false;
|
||||
|
||||
std::vector<core_window_t*> presence;
|
||||
std::vector<basic_window*> presence;
|
||||
|
||||
if (wd->dimension.width < sz.width || wd->dimension.height < sz.height)
|
||||
{
|
||||
@ -978,9 +978,9 @@ namespace detail
|
||||
return true;
|
||||
}
|
||||
|
||||
window_manager::core_window_t* window_manager::root(native_window_type wd) const
|
||||
basic_window* window_manager::root(native_window_type wd) const
|
||||
{
|
||||
static std::pair<native_window_type, core_window_t*> cache;
|
||||
static std::pair<native_window_type, basic_window*> cache;
|
||||
if(cache.first == wd) return cache.second;
|
||||
|
||||
//Thread-Safe Required!
|
||||
@ -997,7 +997,7 @@ namespace detail
|
||||
}
|
||||
|
||||
//Copy the root buffer that wnd specified into DeviceContext
|
||||
void window_manager::map(core_window_t* wd, bool forced, const rectangle* update_area)
|
||||
void window_manager::map(basic_window* wd, bool forced, const rectangle* update_area)
|
||||
{
|
||||
//Thread-Safe Required!
|
||||
std::lock_guard<mutex_type> lock(mutex_);
|
||||
@ -1009,7 +1009,7 @@ namespace detail
|
||||
//@brief: update is used for displaying the screen-off buffer.
|
||||
// Because of a good efficiency, if it is called in an event procedure and the event procedure window is the
|
||||
// same as update's, update would not map the screen-off buffer and just set the window for lazy refresh
|
||||
bool window_manager::update(core_window_t* wd, bool redraw, bool forced, const rectangle* update_area)
|
||||
bool window_manager::update(basic_window* wd, bool redraw, bool forced, const rectangle* update_area)
|
||||
{
|
||||
//Thread-Safe Required!
|
||||
std::lock_guard<mutex_type> lock(mutex_);
|
||||
@ -1046,13 +1046,13 @@ namespace detail
|
||||
else if (redraw)
|
||||
window_layer::paint(wd, paint_operation::try_refresh, false);
|
||||
|
||||
if (wd->other.upd_state == core_window_t::update_state::lazy)
|
||||
wd->other.upd_state = core_window_t::update_state::refreshed;
|
||||
if (wd->other.upd_state == basic_window::update_state::lazy)
|
||||
wd->other.upd_state = basic_window::update_state::refreshed;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void window_manager::update_requesters(core_window_t* root_wd)
|
||||
void window_manager::update_requesters(basic_window* root_wd)
|
||||
{
|
||||
//Thread-Safe Required!
|
||||
std::lock_guard<mutex_type> lock(mutex_);
|
||||
@ -1075,7 +1075,7 @@ namespace detail
|
||||
|
||||
}
|
||||
|
||||
void window_manager::refresh_tree(core_window_t* wd)
|
||||
void window_manager::refresh_tree(basic_window* wd)
|
||||
{
|
||||
//Thread-Safe Required!
|
||||
std::lock_guard<mutex_type> lock(mutex_);
|
||||
@ -1087,7 +1087,7 @@ namespace detail
|
||||
|
||||
//do_lazy_refresh
|
||||
//@brief: defined a behavior of flush the screen
|
||||
void window_manager::do_lazy_refresh(core_window_t* wd, bool force_copy_to_screen, bool refresh_tree)
|
||||
void window_manager::do_lazy_refresh(basic_window* wd, bool force_copy_to_screen, bool refresh_tree)
|
||||
{
|
||||
//Thread-Safe Required!
|
||||
std::lock_guard<mutex_type> lock(mutex_);
|
||||
@ -1101,11 +1101,11 @@ namespace detail
|
||||
using paint_operation = window_layer::paint_operation;
|
||||
if (wd->visible_parents())
|
||||
{
|
||||
if ((wd->other.upd_state == core_window_t::update_state::refreshed) || (wd->other.upd_state == core_window_t::update_state::request_refresh) || force_copy_to_screen)
|
||||
if ((wd->other.upd_state == basic_window::update_state::refreshed) || (wd->other.upd_state == basic_window::update_state::request_refresh) || force_copy_to_screen)
|
||||
{
|
||||
if (!wd->try_lazy_update(wd->other.upd_state == core_window_t::update_state::request_refresh))
|
||||
if (!wd->try_lazy_update(wd->other.upd_state == basic_window::update_state::request_refresh))
|
||||
{
|
||||
window_layer::paint(wd, (wd->other.upd_state == core_window_t::update_state::request_refresh ? paint_operation::try_refresh : paint_operation::have_refreshed), refresh_tree);
|
||||
window_layer::paint(wd, (wd->other.upd_state == basic_window::update_state::request_refresh ? paint_operation::try_refresh : paint_operation::have_refreshed), refresh_tree);
|
||||
this->map(wd, force_copy_to_screen);
|
||||
}
|
||||
}
|
||||
@ -1124,10 +1124,10 @@ namespace detail
|
||||
window_layer::paint(wd, paint_operation::try_refresh, refresh_tree); //only refreshing if it has an invisible parent
|
||||
}
|
||||
|
||||
wd->other.upd_state = core_window_t::update_state::none;
|
||||
wd->other.upd_state = basic_window::update_state::none;
|
||||
}
|
||||
|
||||
bool window_manager::set_parent(core_window_t* wd, core_window_t* newpa)
|
||||
bool window_manager::set_parent(basic_window* wd, basic_window* newpa)
|
||||
{
|
||||
//Thread-Safe Required!
|
||||
std::lock_guard<mutex_type> lock(mutex_);
|
||||
@ -1154,7 +1154,7 @@ namespace detail
|
||||
|
||||
//set_focus
|
||||
//@brief: set a keyboard focus to a window. this may fire a focus event.
|
||||
window_manager::core_window_t* window_manager::set_focus(core_window_t* wd, bool root_has_been_focused, arg_focus::reason reason)
|
||||
basic_window* window_manager::set_focus(basic_window* wd, bool root_has_been_focused, arg_focus::reason reason)
|
||||
{
|
||||
//Thread-Safe Required!
|
||||
std::lock_guard<mutex_type> lock(mutex_);
|
||||
@ -1218,7 +1218,7 @@ namespace detail
|
||||
return prev_focus;
|
||||
}
|
||||
|
||||
window_manager::core_window_t* window_manager::capture_redirect(core_window_t* wd)
|
||||
basic_window* window_manager::capture_redirect(basic_window* wd)
|
||||
{
|
||||
if(attr_.capture.window && (attr_.capture.ignore_children == false) && (attr_.capture.window != wd))
|
||||
{
|
||||
@ -1245,12 +1245,12 @@ namespace detail
|
||||
return false;
|
||||
}
|
||||
|
||||
window_manager::core_window_t * window_manager::capture_window() const
|
||||
basic_window * window_manager::capture_window() const
|
||||
{
|
||||
return attr_.capture.window;
|
||||
}
|
||||
|
||||
void window_manager::capture_window(core_window_t* wd, bool captured, bool ignore_children)
|
||||
void window_manager::capture_window(basic_window* wd, bool captured, bool ignore_children)
|
||||
{
|
||||
if (!this->available(wd))
|
||||
return;
|
||||
@ -1286,7 +1286,7 @@ namespace detail
|
||||
wd->flags.captured = false;
|
||||
if(attr_cap.size())
|
||||
{
|
||||
std::pair<core_window_t*, bool> last = attr_cap.back();
|
||||
std::pair<basic_window*, bool> last = attr_cap.back();
|
||||
attr_cap.pop_back();
|
||||
|
||||
if (impl_->wd_register.available(last.first))
|
||||
@ -1321,7 +1321,7 @@ namespace detail
|
||||
// this method insert a window which catches an user TAB into a TAB window container
|
||||
// the TAB window container is held by a wd's root widget. Not every widget has a TAB window container,
|
||||
// the container is created while a first Tab Window is setting
|
||||
void window_manager::enable_tabstop(core_window_t* wd)
|
||||
void window_manager::enable_tabstop(basic_window* wd)
|
||||
{
|
||||
//Thread-Safe Required!
|
||||
std::lock_guard<mutex_type> lock(mutex_);
|
||||
@ -1333,7 +1333,7 @@ namespace detail
|
||||
}
|
||||
|
||||
// preconditions of get_tabstop: tabstop is not empty and at least one window is visible
|
||||
window_manager::core_window_t* get_tabstop(window_manager::core_window_t* wd, bool forward)
|
||||
basic_window* get_tabstop(basic_window* wd, bool forward)
|
||||
{
|
||||
auto & tabs = wd->root_widget->other.attribute.root->tabstop;
|
||||
|
||||
@ -1348,7 +1348,7 @@ namespace detail
|
||||
if (i != end)
|
||||
{
|
||||
++i;
|
||||
window_manager::core_window_t* ts = (i != end ? (*i) : tabs.front());
|
||||
basic_window* ts = (i != end ? (*i) : tabs.front());
|
||||
return (ts != wd ? ts : 0);
|
||||
}
|
||||
else
|
||||
@ -1364,7 +1364,7 @@ namespace detail
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
auto window_manager::tabstop(core_window_t* wd, bool forward) const -> core_window_t*
|
||||
auto window_manager::tabstop(basic_window* wd, bool forward) const -> basic_window*
|
||||
{
|
||||
//Thread-Safe Required!
|
||||
std::lock_guard<mutex_type> lock(mutex_);
|
||||
@ -1408,7 +1408,7 @@ namespace detail
|
||||
impl_->wd_register.delete_trash(tid);
|
||||
}
|
||||
|
||||
bool window_manager::enable_effects_bground(core_window_t* wd, bool enabled)
|
||||
bool window_manager::enable_effects_bground(basic_window* wd, bool enabled)
|
||||
{
|
||||
//Thread-Safe Required!
|
||||
std::lock_guard<mutex_type> lock(mutex_);
|
||||
@ -1418,7 +1418,7 @@ namespace detail
|
||||
return false;
|
||||
}
|
||||
|
||||
bool window_manager::calc_window_point(core_window_t* wd, nana::point& pos)
|
||||
bool window_manager::calc_window_point(basic_window* wd, nana::point& pos)
|
||||
{
|
||||
//Thread-Safe Required!
|
||||
std::lock_guard<mutex_type> lock(mutex_);
|
||||
@ -1438,7 +1438,7 @@ namespace detail
|
||||
return impl_->misc_register.find(native_wd);
|
||||
}
|
||||
|
||||
bool window_manager::register_shortkey(core_window_t* wd, unsigned long key)
|
||||
bool window_manager::register_shortkey(basic_window* wd, unsigned long key)
|
||||
{
|
||||
//Thread-Safe Required!
|
||||
std::lock_guard<mutex_type> lock(mutex_);
|
||||
@ -1450,7 +1450,7 @@ namespace detail
|
||||
return false;
|
||||
}
|
||||
|
||||
void window_manager::unregister_shortkey(core_window_t* wd, bool with_children)
|
||||
void window_manager::unregister_shortkey(basic_window* wd, bool with_children)
|
||||
{
|
||||
//Thread-Safe Required!
|
||||
std::lock_guard<mutex_type> lock(mutex_);
|
||||
@ -1468,7 +1468,7 @@ namespace detail
|
||||
}
|
||||
}
|
||||
|
||||
window_manager::core_window_t* window_manager::find_shortkey(native_window_type native_window, unsigned long key)
|
||||
basic_window* window_manager::find_shortkey(native_window_type native_window, unsigned long key)
|
||||
{
|
||||
if(native_window)
|
||||
{
|
||||
@ -1481,7 +1481,7 @@ namespace detail
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void window_manager::set_safe_place(core_window_t* wd, std::function<void()>&& fn)
|
||||
void window_manager::set_safe_place(basic_window* wd, std::function<void()>&& fn)
|
||||
{
|
||||
if (fn)
|
||||
{
|
||||
@ -1523,7 +1523,7 @@ namespace detail
|
||||
return false;
|
||||
}
|
||||
|
||||
void window_manager::_m_disengage(core_window_t* wd, core_window_t* for_new)
|
||||
void window_manager::_m_disengage(basic_window* wd, basic_window* for_new)
|
||||
{
|
||||
auto * const wdpa = wd->parent;
|
||||
|
||||
@ -1537,7 +1537,7 @@ namespace detail
|
||||
|
||||
//Holds the shortkeys of wd and its children, and then
|
||||
//register these shortkeys for establishing.
|
||||
std::vector<std::pair<core_window_t*,unsigned long>> sk_holder;
|
||||
std::vector<std::pair<basic_window*,unsigned long>> sk_holder;
|
||||
|
||||
if ((!established) || (pa_root_attr != root_attr))
|
||||
{
|
||||
@ -1656,8 +1656,8 @@ namespace detail
|
||||
|
||||
auto delta_pos = wd->pos_root - for_new->pos_root;
|
||||
|
||||
std::function<void(core_window_t*, const nana::point&)> set_pos_root;
|
||||
set_pos_root = [&set_pos_root](core_window_t* wd, const nana::point& delta_pos)
|
||||
std::function<void(basic_window*, const nana::point&)> set_pos_root;
|
||||
set_pos_root = [&set_pos_root](basic_window* wd, const nana::point& delta_pos)
|
||||
{
|
||||
for (auto child : wd->children)
|
||||
{
|
||||
@ -1688,7 +1688,7 @@ namespace detail
|
||||
}
|
||||
}
|
||||
|
||||
void window_manager::_m_destroy(core_window_t* wd)
|
||||
void window_manager::_m_destroy(basic_window* wd)
|
||||
{
|
||||
if(wd->flags.destroying) return;
|
||||
|
||||
@ -1738,7 +1738,7 @@ namespace detail
|
||||
wd->drawer.graphics.release();
|
||||
}
|
||||
|
||||
void window_manager::_m_move_core(core_window_t* wd, const point& delta)
|
||||
void window_manager::_m_move_core(basic_window* wd, const point& delta)
|
||||
{
|
||||
if(category::flags::root != wd->other.category) //A root widget always starts at (0, 0) and its children are not to be changed
|
||||
{
|
||||
@ -1760,7 +1760,7 @@ namespace detail
|
||||
}
|
||||
}
|
||||
|
||||
void window_manager::_m_shortkeys(core_window_t* wd, bool with_children, std::vector<std::pair<core_window_t*, unsigned long>>& keys) const
|
||||
void window_manager::_m_shortkeys(basic_window* wd, bool with_children, std::vector<std::pair<basic_window*, unsigned long>>& keys) const
|
||||
{
|
||||
if (impl_->wd_register.available(wd))
|
||||
{
|
||||
@ -1785,7 +1785,7 @@ namespace detail
|
||||
//_m_find
|
||||
//@brief: find a window on root window through a given root coordinate.
|
||||
// the given root coordinate must be in the rectangle of wnd.
|
||||
window_manager::core_window_t* window_manager::_m_find(core_window_t* wd, const point& pos)
|
||||
basic_window* window_manager::_m_find(basic_window* wd, const point& pos)
|
||||
{
|
||||
if(!wd->visible)
|
||||
return nullptr;
|
||||
@ -1809,7 +1809,7 @@ namespace detail
|
||||
}
|
||||
|
||||
//_m_effective, test if the window is a handle of window that specified by (root_x, root_y)
|
||||
bool window_manager::_m_effective(core_window_t* wd, const point& root_pos)
|
||||
bool window_manager::_m_effective(basic_window* wd, const point& root_pos)
|
||||
{
|
||||
if(wd == nullptr || false == wd->visible) return false;
|
||||
return rectangle{ wd->pos_root, wd->dimension }.is_hit(root_pos);
|
||||
|
@ -260,24 +260,8 @@ namespace detail
|
||||
#if defined(NANA_WINDOWS)
|
||||
::TextOut(dw->context, pos.x, pos.y, str, static_cast<int>(len));
|
||||
#elif defined(NANA_X11)
|
||||
auto disp = ::nana::detail::platform_spec::instance().open_display();
|
||||
#if defined(NANA_USE_XFT)
|
||||
|
||||
#if 0
|
||||
auto fs = reinterpret_cast<XftFont*>(dw->font->native_handle());
|
||||
|
||||
//Fixed missing array declaration by dareg
|
||||
std::unique_ptr<FT_UInt[]> glyphs_ptr(new FT_UInt[len]);
|
||||
auto glyphs = glyphs_ptr.get();
|
||||
const auto endstr = str + len;
|
||||
for(auto chr = str; chr != endstr; ++chr)
|
||||
{
|
||||
(*glyphs++) = XftCharIndex(disp, fs, *chr);
|
||||
}
|
||||
XftDrawGlyphs(dw->xftdraw, &(dw->xft_fgcolor), fs, pos.x, pos.y + fs->ascent, glyphs_ptr.get(), len);
|
||||
#else
|
||||
nana_xft_draw_string(dw->xftdraw, &(dw->xft_fgcolor), dw->font.get(), pos, str, len);
|
||||
#endif
|
||||
#else
|
||||
XFontSet fs = reinterpret_cast<XFontSet>(dw->font->native_handle());
|
||||
XFontSetExtents * ext = ::XExtentsOfFontSet(fs);
|
||||
|
@ -506,8 +506,8 @@ namespace paint
|
||||
|
||||
if (!text.empty())
|
||||
{
|
||||
unsigned tab_pixels = impl_->handle->string.tab_length * impl_->handle->string.whitespace_pixels;
|
||||
#if defined(NANA_WINDOWS)
|
||||
unsigned tab_pixels = impl_->handle->string.tab_length * impl_->handle->string.whitespace_pixels;
|
||||
int * dx = new int[text.size()];
|
||||
SIZE extents;
|
||||
::GetTextExtentExPoint(impl_->handle->context, text.data(), static_cast<int>(text.size()), 0, 0, dx, &extents);
|
||||
@ -520,26 +520,7 @@ namespace paint
|
||||
}
|
||||
delete[] dx;
|
||||
#elif defined(NANA_X11) && defined(NANA_USE_XFT)
|
||||
|
||||
#if 0
|
||||
auto disp = nana::detail::platform_spec::instance().open_display();
|
||||
auto xft = reinterpret_cast<XftFont*>(impl_->handle->font->native_handle());
|
||||
|
||||
XGlyphInfo extents;
|
||||
for (std::size_t i = 0; i < text.size(); ++i)
|
||||
{
|
||||
if (text[i] != '\t')
|
||||
{
|
||||
FT_UInt glyphs = ::XftCharIndex(disp, xft, text[i]);
|
||||
::XftGlyphExtents(disp, xft, &glyphs, 1, &extents);
|
||||
pxbuf[i] = extents.xOff;
|
||||
}
|
||||
else
|
||||
pxbuf[i] = tab_pixels;
|
||||
}
|
||||
#else
|
||||
return nana_xft_glyph_pixels(impl_->handle->font.get(), text.data(), text.size());
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
return pxbuf;
|
||||
|
@ -263,8 +263,8 @@ namespace nana{ namespace system{
|
||||
spec.lock_xlib();
|
||||
|
||||
{
|
||||
internal_scope_guard isg;
|
||||
detail::bedrock::core_window_t * wd = detail::bedrock::instance().focus();
|
||||
internal_scope_guard lock;
|
||||
auto wd = detail::bedrock::instance().focus();
|
||||
if(wd) requester = wd->root;
|
||||
}
|
||||
spec.unlock_xlib();
|
||||
|
Loading…
x
Reference in New Issue
Block a user