void Widget::refocus(void) { // Focus this window focused = true; on_focus(); }
void UIWidget::mouse_down_func() { if (disabled) return; // call this function on the children first for (auto &child : ElementID::recast_collection<UIWidget>(get_children())) child->mouse_down_func(); // now do the execution of the function if (mouse_over) { mouse_down_on_over = true; on_mouse_down(); focused = true; on_focus(); } else { if (focused) { focused = false; on_blur(); } } }
void Viewport::set_focus(bool value){ if(value == true){ if(_focus == false){ on_focus(); } } else{ if(_focus == true){ off_focus(); } } _focus = value; wrappee->set_focus(value); }
// iterates through all siblings and sets all parent's children to unfocused. // if the widget is not already focused, then set to focused and on_focus() is called void UIWidget::set_as_focused() { if (disabled) return; // TODO: this will need to "unfocus" all other elements in the tree if (!is_focused()) { focused=true; on_focus(); } }
virtual BOOL handle_focus(HELEMENT he, FOCUS_PARAMS ¶ms) { return on_focus(he, params.target, params.cmd); }
void kWindow::OnSetFocus(CWnd* ) { set_focused(); on_focus(); }