当前位置: 首页>>代码示例>>C++>>正文


C++ HTMLSelectElement::updateListBoxSelection方法代码示例

本文整理汇总了C++中HTMLSelectElement::updateListBoxSelection方法的典型用法代码示例。如果您正苦于以下问题:C++ HTMLSelectElement::updateListBoxSelection方法的具体用法?C++ HTMLSelectElement::updateListBoxSelection怎么用?C++ HTMLSelectElement::updateListBoxSelection使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在HTMLSelectElement的用法示例。


在下文中一共展示了HTMLSelectElement::updateListBoxSelection方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: autoscroll

void RenderListBox::autoscroll()
{
    IntPoint pos = document()->frame()->view()->windowToContents(document()->frame()->eventHandler()->currentMousePosition());

    int rx = 0;
    int ry = 0;
    absolutePosition(rx, ry);
    int offsetX = pos.x() - rx;
    int offsetY = pos.y() - ry;
    
    int endIndex = -1;
    int rows = numVisibleItems();
    int offset = m_indexOffset;
    if (offsetY < borderTop() + paddingTop() && scrollToRevealElementAtListIndex(offset - 1))
        endIndex = offset - 1;
    else if (offsetY > height() - paddingBottom() - borderBottom() && scrollToRevealElementAtListIndex(offset + rows))
        endIndex = offset + rows - 1;
    else
        endIndex = listIndexAtOffset(offsetX, offsetY);

    if (endIndex >= 0) {
        HTMLSelectElement* select = static_cast<HTMLSelectElement*>(node());
        m_inAutoscroll = true;
        if (!select->multiple())
            select->setActiveSelectionAnchorIndex(endIndex);
        select->setActiveSelectionEndIndex(endIndex);
        select->updateListBoxSelection(!select->multiple());
        m_inAutoscroll = false;
    }
}
开发者ID:jackiekaon,项目名称:owb-mirror,代码行数:30,代码来源:RenderListBox.cpp

示例2: autoscroll

void RenderListBox::autoscroll()
{
    IntPoint pos = frame()->view()->windowToContents(frame()->eventHandler()->currentMousePosition());

    int endIndex = scrollToward(pos);
    if (endIndex >= 0) {
        HTMLSelectElement* select = toHTMLSelectElement(node());
        m_inAutoscroll = true;

        if (!select->multiple())
            select->setActiveSelectionAnchorIndex(endIndex);

        select->setActiveSelectionEndIndex(endIndex);
        select->updateListBoxSelection(!select->multiple());
        m_inAutoscroll = false;
    }
}
开发者ID:,项目名称:,代码行数:17,代码来源:

示例3: panScroll

void RenderListBox::panScroll(const IntPoint& panStartMousePosition)
{
    const int maxSpeed = 20;
    const int iconRadius = 7;
    const int speedReducer = 4;

    // FIXME: This doesn't work correctly with transforms.
    FloatPoint absOffset = localToAbsolute();

    IntPoint currentMousePosition = roundedIntPoint(frame()->eventHandler()->currentMousePosition());
    // We need to check if the current mouse position is out of the window. When the mouse is out of the window, the position is incoherent
    static IntPoint previousMousePosition;
    if (currentMousePosition.y() < 0)
        currentMousePosition = previousMousePosition;
    else
        previousMousePosition = currentMousePosition;

    int yDelta = currentMousePosition.y() - panStartMousePosition.y();

    // If the point is too far from the center we limit the speed
    yDelta = max<int>(min<int>(yDelta, maxSpeed), -maxSpeed);
    
    if (abs(yDelta) < iconRadius) // at the center we let the space for the icon
        return;

    if (yDelta > 0)
        //offsetY = view()->viewHeight();
        absOffset.move(0, listHeight());
    else if (yDelta < 0)
        yDelta--;

    // Let's attenuate the speed
    yDelta /= speedReducer;

    IntPoint scrollPoint(0, 0);
    scrollPoint.setY(absOffset.y() + yDelta);
    int newOffset = scrollToward(scrollPoint);
    if (newOffset < 0) 
        return;

    m_inAutoscroll = true;
    HTMLSelectElement* select = toHTMLSelectElement(node());
    select->updateListBoxSelection(!select->multiple());
    m_inAutoscroll = false;
}
开发者ID:,项目名称:,代码行数:45,代码来源:


注:本文中的HTMLSelectElement::updateListBoxSelection方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。