void ListBox::refocus() { if (!mFocusHandler) return; if (isFocusable()) mFocusHandler->requestFocus(this); }
void HTMLLabelElement::focus(bool, FocusType type) { // to match other browsers, always restore previous selection if (HTMLElement* element = control()) element->focus(true, type); if (isFocusable()) HTMLElement::focus(true, type); }
void HTMLAreaElement::updateFocusAppearance(SelectionBehaviorOnFocus selectionBehavior) { if (!isFocusable()) return; if (HTMLImageElement* imageElement = this->imageElement()) imageElement->updateFocusAppearance(selectionBehavior); }
bool SVGAElement::isKeyboardFocusable() const { if (!isFocusable()) return false; if (Page* page = document().page()) return page->chrome().client().tabsToLinks(); return false; }
void HTMLLegendElement::focus(bool) { if (isFocusable()) Element::focus(); // To match other browsers' behavior, never restore previous selection. if (HTMLFormControlElement* control = associatedControl()) control->focus(false); }
void HTMLLegendElement::focus(bool) { if (isFocusable()) Element::focus(); // to match other browsers, never restore previous selection if (Element *element = formElement()) element->focus(false); }
bool SVGAElement::isKeyboardFocusable() const { if (isFocusable() && Element::supportsFocus()) return SVGElement::isKeyboardFocusable(); if (isLink()) return document().frameHost()->chrome().client().tabsToLinks(); return SVGElement::isKeyboardFocusable(); }
bool SVGAElement::isKeyboardFocusable(KeyboardEvent* event) const { if (isFocusable() && Element::supportsFocus()) return SVGElement::isKeyboardFocusable(event); if (isLink()) return document().frame()->eventHandler().tabsToLinks(event); return SVGElement::isKeyboardFocusable(event); }
bool SVGAElement::isKeyboardFocusable(KeyboardEvent* event) const { if (!isFocusable()) return false; if (!document()->frame()) return false; return document()->frame()->eventHandler()->tabsToLinks(event); }
void HTMLAreaElement::updateFocusAppearance(bool restorePreviousSelection) { if (!isFocusable()) return; HTMLImageElement* imageElement = this->imageElement(); if (!imageElement) return; imageElement->updateFocusAppearance(restorePreviousSelection); }
void Widget::requestFocus() { if (mFocusHandler == NULL) { throw GCN_EXCEPTION("No focushandler set (did you add the widget to the gui?)."); } if (isFocusable()) { mFocusHandler->requestFocus(this); } }
void Element::attach() { createRendererIfNeeded(); ContainerNode::attach(); if (hasRareData()) { ElementRareData* data = rareData(); if (data->needsFocusAppearanceUpdateSoonAfterAttach()) { if (isFocusable() && document()->focusedNode() == this) document()->updateFocusAppearanceSoon(); data->setNeedsFocusAppearanceUpdateSoonAfterAttach(false); } } }
void HTMLLegendElement::focus(bool restorePreviousSelection, FocusDirection direction) { if (document().haveStylesheetsLoaded()) { document().updateLayoutIgnorePendingStylesheets(); if (isFocusable()) { Element::focus(restorePreviousSelection, direction); return; } } // To match other browsers' behavior, never restore previous selection. if (auto* control = associatedControl()) control->focus(false, direction); }
bool HTMLAnchorElement::isKeyboardFocusable(KeyboardEvent* event) const { if (!isLink()) return HTMLElement::isKeyboardFocusable(event); if (!isFocusable()) return false; if (!document()->frame()) return false; if (!document()->frame()->eventHandler()->tabsToLinks(event)) return false; return hasNonEmptyBoundingBox(); }
/// Attempts focus on this control bool UIView::focus() { // Fails to get focus if it is not focusable if(!isFocusable()) return false; if(getContext()) { getContext()->m_focusControl = this; m_hasFocus = true; } else { //cout<<"Cant focus an element without a hierarchy"<<endl; } return true; };
bool HTMLAnchorElement::isKeyboardFocusable(KeyboardEvent* event) const { if (!isLink()) return HTMLElement::isKeyboardFocusable(event); if (!isFocusable()) return false; if (!document()->frame()) return false; if (!document()->frame()->eventHandler()->tabsToLinks(event)) return false; if (isInCanvasSubtree()) return true; return hasNonEmptyBox(renderBoxModelObject()); }
bool HTMLAnchorElement::isKeyboardFocusable(KeyboardEvent* event) const { if (!isLink()) return HTMLElement::isKeyboardFocusable(event); if (!isFocusable()) return false; if (!document().frame()) return false; if (!document().frame()->eventHandler().tabsToLinks(event)) return false; if (!renderer() && ancestorsOfType<HTMLCanvasElement>(*this).first()) return true; return hasNonEmptyBox(renderBoxModelObject()); }
void UIWidget::applyStyle(const OTMLNodePtr& styleNode) { if(m_destroyed) return; if(styleNode->size() == 0) return; m_loadingStyle = true; try { // translate ! style tags for(const OTMLNodePtr& node : styleNode->children()) { if(node->tag()[0] == '!') { std::string tag = node->tag().substr(1); std::string code = stdext::format("tostring(%s)", node->value()); std::string origin = "@" + node->source() + ": [" + node->tag() + "]"; g_lua.evaluateExpression(code, origin); std::string value = g_lua.popString(); node->setTag(tag); node->setValue(value); } } onStyleApply(styleNode->tag(), styleNode); callLuaField("onStyleApply", styleNode->tag(), styleNode); if(m_firstOnStyle) { UIWidgetPtr parent = getParent(); if(isFocusable() && isExplicitlyVisible() && isExplicitlyEnabled() && parent && ((!parent->getFocusedChild() && parent->getAutoFocusPolicy() == Fw::AutoFocusFirst) || parent->getAutoFocusPolicy() == Fw::AutoFocusLast)) { focus(); } } m_firstOnStyle = false; } catch(stdext::exception& e) { g_logger.traceError(stdext::format("failed to apply style to widget '%s': %s", m_id, e.what())); } m_loadingStyle = false; }
bool HTMLAnchorElement::isKeyboardFocusable(KeyboardEvent* event) const { if (!isLink()) return HTMLElement::isKeyboardFocusable(event); if (!isFocusable()) return false; Page* page = document()->page(); if (!page) return false; if (!page->chrome()->client()->tabsToLinks()) return false; if (isInCanvasSubtree()) return true; return hasNonEmptyBoundingBox(); }
void Element::focus(bool restorePreviousSelection) { Document* doc = document(); if (doc->focusedNode() == this) return; doc->updateLayoutIgnorePendingStylesheets(); if (!supportsFocus()) return; if (Page* page = doc->page()) page->focusController()->setFocusedNode(this, doc->frame()); if (!isFocusable()) { ensureRareData()->setNeedsFocusAppearanceUpdateSoonAfterAttach(true); return; } cancelFocusAppearanceUpdate(); updateFocusAppearance(restorePreviousSelection); }
void UIWidget::applyStyle(const OTMLNodePtr& styleNode) { if(m_destroyed) return; if(styleNode->size() == 0) return; m_loadingStyle = true; try { // translate ! style tags for(const OTMLNodePtr& node : styleNode->children()) { if(node->tag()[0] == '!') { std::string tag = node->tag().substr(1); std::string code = Fw::formatString("tostring(%s)", node->value().c_str()); std::string origin = "@" + node->source() + "[" + node->tag() + "]"; g_lua.evaluateExpression(code, origin); std::string value = g_lua.popString(); node->setTag(tag); node->setValue(value); } } onStyleApply(styleNode->tag(), styleNode); callLuaField("onStyleApply", styleNode->tag(), styleNode); if(m_firstOnStyle) { callLuaField("onSetup"); // always focus new child if(isFocusable() && isExplicitlyVisible() && isExplicitlyEnabled()) focus(); } m_firstOnStyle = false; } catch(Exception& e) { logError("Failed to apply style to widget '", m_id, "' style: ", e.what()); } m_loadingStyle = false; }
void UIWidget::applyStyle(const OTMLNodePtr& styleNode) { if(styleNode->size() == 0) return; m_loadingStyle = true; try { onStyleApply(styleNode->tag(), styleNode); callLuaField("onStyleApply", styleNode->tag(), styleNode); if(m_firstOnStyle) { callLuaField("onSetup"); // always focus new child if(isFocusable() && isExplicitlyVisible() && isExplicitlyEnabled()) focus(); } m_firstOnStyle = false; } catch(Exception& e) { logError("Failed to apply style to widget '", m_id, "' style: ", e.what()); } m_loadingStyle = false; }
bool HTMLTextAreaElement::isMouseFocusable() const { return isFocusable(); }
bool HTMLTextAreaElement::isKeyboardFocusable(KeyboardEvent*) const { // If a given text area can be focused at all, then it will always be keyboard focusable. return isFocusable(); }
//############################################################################## //# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # //############################################################################## void xWidgetInternal::requestFocus() { if(isFocusable()) gtk_widget_grab_focus(getGtkWidget()); }
bool SVGAElement::supportsFocus() const { if (isContentEditable()) return SVGStyledTransformableElement::supportsFocus(); return isFocusable() || (document() && !document()->haveStylesheetsLoaded()); }
bool HTMLAreaElement::isKeyboardFocusable() const { return isFocusable(); }
void HTMLTextFormControlElement::select(NeedToDispatchSelectEvent eventBehaviour) { document().updateLayoutIgnorePendingStylesheets(); setSelectionRange(0, std::numeric_limits<int>::max(), SelectionHasNoDirection, eventBehaviour, isFocusable() ? ChangeSelectionAndFocus : NotChangeSelection); }