return result;
}
-Widget *Container::get_child_at(int x, int y) const
+Widget *Container::find_child_at(int x, int y) const
{
for(auto i=children.end(); i!=children.begin();)
if((*--i)->widget->is_visible() && (*i)->widget->get_geometry().is_inside(x, y))
return nullptr;
}
-Widget *Container::get_descendant_at(int x, int y) const
+Widget *Container::find_descendant_at(int x, int y) const
{
- Widget *wdg = get_child_at(x, y);
+ Widget *wdg = find_child_at(x, y);
if(Container *cont = dynamic_cast<Container *>(wdg))
{
const Geometry &cgeom = wdg->get_geometry();
- Widget *wdg2 = cont->get_descendant_at(x-cgeom.x, y-cgeom.y);
+ Widget *wdg2 = cont->find_descendant_at(x-cgeom.x, y-cgeom.y);
if(wdg2)
return wdg2;
}
{
click_focus = nullptr;
if(!pointer_focus)
- set_pointer_focus(get_child_at(x, y));
+ set_pointer_focus(find_child_at(x, y));
}
const Geometry &cgeom = child->get_geometry();
return touch_focus;
else
{
- Widget *child = get_child_at(x, y);
+ Widget *child = find_child_at(x, y);
if(child && child->is_enabled())
return child;
else
void reposition_child(Widget &, const Part &) const;
public:
std::list<Widget *> get_children() const;
- Widget *get_child_at(int, int) const;
- Widget *get_descendant_at(int, int) const;
+ Widget *find_child_at(int, int) const;
+ Widget *find_descendant_at(int, int) const;
void raise(Widget &);
protected:
return;
}
- text_part = style->get_part("text");
+ text_part = style->find_part("text");
if(multiline)
check_view_range();
void Entry::check_cursor_blink()
{
- const Part *cursor_part = style->get_part("cursor");
+ const Part *cursor_part = style->find_part("cursor");
bool has_blink = (cursor_part && cursor_part->get_graphic(ACTIVE|FOCUS)!=cursor_part->get_graphic(NORMAL|FOCUS));
cursor_blink = (state&FOCUS);
void List::on_style_change()
{
- items_part = (style ? style->get_part("items") : nullptr);
+ items_part = (style ? style->find_part("items") : nullptr);
}
void List::move_focus(Navigation nav, bool select)
Widget *child = children.front()->widget;
child->autosize();
- if(const Part *part = style->get_part("children"))
+ if(const Part *part = style->find_part("children"))
{
const Sides &margin = part->get_margin();
child->set_position(margin.left, margin.bottom);
if(!style)
return;
- const Part *part = style->get_part("children");
+ const Part *part = style->find_part("children");
if(!part)
return;
if(tooltip_timeout && Time::now()>tooltip_timeout)
{
std::string tip;
- if(Widget *wdg = get_descendant_at(pointer_x, pointer_y))
+ if(Widget *wdg = find_descendant_at(pointer_x, pointer_y))
{
tip = wdg->get_tooltip();
tooltip_target = wdg;
pointer_y = y;
tooltip_timeout = Time::now()+700*Time::msec;
}
- else if(get_descendant_at(x, y)!=tooltip_target)
+ else if(find_descendant_at(x, y)!=tooltip_target)
{
if(lbl_tooltip)
lbl_tooltip->set_visible(false);
if(!style)
return;
- if(const Part *slider_part = style->get_part("slider"))
+ if(const Part *slider_part = style->find_part("slider"))
{
const Geometry &pgeom = slider_part->get_geometry();
const Sides &margin = slider_part->get_margin();
return *sampler;
}
-const Part *Style::get_part(const string &name) const
+const Part *Style::find_part(const string &name) const
{
auto i = find_if(parts, [&name](const Part &p){ return p.get_name()==name; });
return (i!=parts.end() ? &*i : nullptr);
const GL::Color &get_font_color(State) const;
const GL::Sampler &get_sampler() const;
const PartSeq &get_parts() const { return parts; }
- const Part *get_part(const std::string &) const;
+ const Part *find_part(const std::string &) const;
bool compare_states(State, State) const;
};