void CL_GUIComponent::push_cliprect(CL_GraphicContext &gc, const CL_Rect &rect) { CL_Rect windcliprect = component_to_window_coords(rect); CL_GUIComponent *toplevel = get_top_level_component(); CL_GUITopLevelWindow *window = impl->gui_manager_impl->get_toplevel_window(toplevel); impl->gui_manager_impl->window_manager.push_cliprect(window, gc, windcliprect); }
void GUIComponent::push_cliprect(Canvas &canvas, const Rect &rect) { Rect windcliprect = component_to_window_coords(rect); GUIComponent *toplevel = get_top_level_component(); GUITopLevelWindow *window = impl->gui_manager_impl->get_toplevel_window(toplevel); impl->gui_manager_impl->window_manager.push_cliprect(window, canvas, windcliprect); }
void ViewDock::dock(DockableComponent *dockable) { if (!is_docked(dockable)) { views.push_back(new ViewFrame(this, dockable)); get_top_level_component()->update_layout(); } }
void CL_GUIComponent::paint(const CL_Rect &clip_rect) { CL_Rect update_region = component_to_window_coords(clip_rect); CL_GUIComponent *toplevel_component = get_top_level_component(); CL_GUITopLevelWindow *toplevel_window = impl->gui_manager.lock()->get_toplevel_window(this); CL_GraphicContext gc = impl->gui_manager.lock()->window_manager.begin_paint(toplevel_window, update_region); toplevel_component->render(gc, update_region, true); impl->gui_manager.lock()->window_manager.end_paint(toplevel_window, update_region); }
void GUIComponent::paint(const Rect &clip_rect) { Rect update_region = component_to_window_coords(clip_rect); GUIComponent *toplevel_component = get_top_level_component(); GUITopLevelWindow *toplevel_window = impl->gui_manager.lock()->get_toplevel_window(this); Canvas canvas = impl->gui_manager.lock()->window_manager.begin_paint(toplevel_window, update_region); toplevel_component->render(canvas, update_region, true); impl->gui_manager.lock()->window_manager.end_paint(canvas, toplevel_window, update_region); }
Rect GUIComponent::get_viewport() const { if (impl->parent) { return get_top_level_component()->get_viewport(); } else { return impl->gui_manager.lock()->window_manager.get_geometry(impl->gui_manager.lock()->get_toplevel_window(this), true); } }
void Window::bring_to_front() { const GUIComponent *root_component = get_top_level_component(); std::vector<GUITopLevelWindow>::size_type pos, size; size = GUIComponent::impl->gui_manager.lock()->root_components.size(); for (pos = 0; pos < size; pos++) { GUITopLevelWindow *cur = GUIComponent::impl->gui_manager.lock()->root_components[pos]; if (cur->component == root_component) return GUIComponent::impl->gui_manager.lock()->window_manager.bring_to_front(cur); } }
CL_InputContext& CL_GUIComponent::get_ic() { const CL_GUIComponent *root_component = get_top_level_component(); std::vector<CL_GUITopLevelWindow>::size_type pos, size; size = impl->gui_manager.lock()->root_components.size(); for (pos = 0; pos < size; pos++) { CL_GUITopLevelWindow *cur = impl->gui_manager.lock()->root_components[pos]; if (cur->component == root_component) return impl->gui_manager.lock()->window_manager.get_ic(cur); } return dummy_ic; }
InputContext GUIComponent::get_ic() { const GUIComponent *root_component = get_top_level_component(); std::vector<GUITopLevelWindow>::size_type pos, size; size = impl->gui_manager.lock()->root_components.size(); for (pos = 0; pos < size; pos++) { GUITopLevelWindow *cur = impl->gui_manager.lock()->root_components[pos]; if (cur->component == root_component) return impl->gui_manager.lock()->window_manager.get_ic(cur); } throw Exception("Input Context not found"); }
bool Window::is_maximized() const { const GUIComponent *root_component = get_top_level_component(); std::vector<GUITopLevelWindow>::size_type pos, size; size = GUIComponent::impl->gui_manager.lock()->root_components.size(); for (pos = 0; pos < size; pos++) { GUITopLevelWindow *cur = GUIComponent::impl->gui_manager.lock()->root_components[pos]; if (cur->component == root_component) return GUIComponent::impl->gui_manager.lock()->window_manager.is_maximized(cur); } return false; }
void ViewDock::undock(DockableComponent *dockable) { for (size_t i = 0; i < views.size(); i++) { if (views[i]->get_dockable() == dockable) { delete views[i]; views.erase(views.begin() + i); get_top_level_component()->update_layout(); break; } } }
CL_GUIComponent *CL_GUIComponent::get_next_component_in_tree() { if (has_child_components()) return get_first_child(); if (impl->next_sibling) return impl->next_sibling; CL_GUIComponent *parent = impl->parent; while (parent) { if (parent->get_next_sibling()) return parent->get_next_sibling(); parent = parent->get_parent_component(); } // Reached end of tree. Return first item. return get_top_level_component(); }
void GUIComponent::set_visible(bool visible, bool activate_root_win) { bool visibility_changed = visible != impl->visible; if (visibility_changed) { request_repaint(); if (!impl->func_visibility_change.is_null()) impl->func_visibility_change.invoke(visible); } impl->visible = visible; if (visibility_changed) { get_top_level_component()->update_layout(); } if (impl->parent == 0) { GUITopLevelWindow *toplevel_window = impl->gui_manager.lock()->get_toplevel_window(this); impl->gui_manager.lock()->window_manager.set_visible(toplevel_window, visible, activate_root_win); } }
CL_CSSLayout CL_GUIComponent::get_css_layout() { return get_top_level_component()->impl->css_layout; }
void CL_GUIComponent::pop_cliprect(CL_GraphicContext &gc) { CL_GUIComponent *toplevel = get_top_level_component(); CL_GUITopLevelWindow *window = impl->gui_manager_impl->get_toplevel_window(toplevel); impl->gui_manager_impl->window_manager.pop_cliprect(window, gc); }
void CL_GUIComponent::request_repaint(CL_Rect request_repaint) { get_gui_manager().request_repaint(component_to_window_coords(request_repaint), get_top_level_component()); }
void GUIComponent::pop_cliprect(Canvas &canvas) { GUIComponent *toplevel = get_top_level_component(); GUITopLevelWindow *window = impl->gui_manager_impl->get_toplevel_window(toplevel); impl->gui_manager_impl->window_manager.pop_cliprect(window, canvas); }
void GUIComponent::render(Canvas &canvas, const Rect &clip_rect, bool include_children) { if (!impl->visible) return; Rect viewport = get_top_level_component()->get_size(); CSSResourceCache *resource_cache = &impl->gui_manager_impl->resource_cache; CSSLayoutGraphics graphics(canvas, resource_cache, viewport, 0); Rect border_box = get_size(); Rect padding_box = Rect(border_box).shrink(impl->css_used_values.border.left, impl->css_used_values.border.top, impl->css_used_values.border.right, impl->css_used_values.border.bottom); Rect content_box = Rect(padding_box).shrink(impl->css_used_values.padding.left, impl->css_used_values.padding.top, impl->css_used_values.padding.right, impl->css_used_values.padding.bottom); CSSBackgroundRenderer background(&graphics, resource_cache, impl->element.get_css_values().get_background()); background.set_border_box(border_box); background.set_padding_box(padding_box); background.set_content_box(content_box); background.set_initial_containing_box(get_top_level_component()->get_viewport()); background.render(); CSSBorderRenderer border(&graphics, resource_cache, impl->element.get_css_values().get_border()); border.set_border_box(border_box); border.set_border_values(impl->css_used_values.border.left, impl->css_used_values.border.top, impl->css_used_values.border.right, impl->css_used_values.border.bottom); border.render(); if (impl->func_render.is_null() == false) { impl->func_render.invoke(canvas, clip_rect); } else { //GUIThemePart part(this); //Rect geometry = get_size(); //part.render_box(canvas, RectPS(0, 0, geometry.get_width(), geometry.get_height()), clip_rect); } if (include_children) { if (impl->clip_children) { push_cliprect(canvas, impl->clip_children_rect); } GUIComponent *cur = impl->first_child; while (cur) { Rect cur_geometry = cur->get_geometry(); Rect update_rect = component_to_window_coords(clip_rect); update_rect.overlap(component_to_window_coords(cur_geometry)); if (update_rect.get_width() > 0 && update_rect.get_height() > 0) { Rect child_dirty_rect = cur->window_to_component_coords(update_rect); canvas.push_translate((float)cur_geometry.left, (float)cur_geometry.top); cur->render(canvas, child_dirty_rect, true); canvas.pop_modelview(); } cur = cur->impl->next_sibling; } if (impl->clip_children) { pop_cliprect(canvas); } } }