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


C++ ScrollbarThemeClient::enabled方法代码示例

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


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

示例1: paintTrackBackground

void ScrollbarThemeMock::paintTrackBackground(GraphicsContext& context, const ScrollbarThemeClient& scrollbar, const IntRect& trackRect)
{
    if (DrawingRecorder::useCachedDrawingIfPossible(context, scrollbar, DisplayItem::ScrollbarTrackBackground))
        return;

    DrawingRecorder recorder(context, scrollbar, DisplayItem::ScrollbarTrackBackground, trackRect);
    context.fillRect(trackRect, scrollbar.enabled() ? Color::lightGray : Color(0xFFE0E0E0));
}
开发者ID:aobzhirov,项目名称:ChromiumGStreamerBackend,代码行数:8,代码来源:ScrollbarThemeMock.cpp

示例2: paintThumb

void ScrollbarThemeMock::paintThumb(GraphicsContext& context, const ScrollbarThemeClient& scrollbar, const IntRect& thumbRect)
{
    if (!scrollbar.enabled())
        return;

    if (DrawingRecorder::useCachedDrawingIfPossible(context, scrollbar, DisplayItem::ScrollbarThumb))
        return;

    DrawingRecorder recorder(context, scrollbar, DisplayItem::ScrollbarThumb, thumbRect);
    context.fillRect(thumbRect, Color::darkGray);
}
开发者ID:aobzhirov,项目名称:ChromiumGStreamerBackend,代码行数:11,代码来源:ScrollbarThemeMock.cpp

示例3: thumbPosition

int ScrollbarTheme::thumbPosition(const ScrollbarThemeClient& scrollbar,
                                  float scrollPosition) {
  if (scrollbar.enabled()) {
    float size = scrollbar.totalSize() - scrollbar.visibleSize();
    // Avoid doing a floating point divide by zero and return 1 when
    // usedTotalSize == visibleSize.
    if (!size)
      return 0;
    float pos = std::max(0.0f, scrollPosition) *
                (trackLength(scrollbar) - thumbLength(scrollbar)) / size;
    return (pos < 1 && pos > 0) ? 1 : pos;
  }
  return 0;
}
开发者ID:ollie314,项目名称:chromium,代码行数:14,代码来源:ScrollbarTheme.cpp

示例4: thumbLength

int ScrollbarTheme::thumbLength(const ScrollbarThemeClient& scrollbar) {
  if (!scrollbar.enabled())
    return 0;

  float overhang = fabsf(scrollbar.elasticOverscroll());
  float proportion = 0.0f;
  float totalSize = scrollbar.totalSize();
  if (totalSize > 0.0f) {
    proportion = (scrollbar.visibleSize() - overhang) / totalSize;
  }
  int trackLen = trackLength(scrollbar);
  int length = round(proportion * trackLen);
  length = std::max(length, minimumThumbLength(scrollbar));
  if (length > trackLen)
    length = 0;  // Once the thumb is below the track length, it just goes away
                 // (to make more room for the track).
  return length;
}
开发者ID:ollie314,项目名称:chromium,代码行数:18,代码来源:ScrollbarTheme.cpp

示例5: hitTest

ScrollbarPart ScrollbarTheme::hitTest(const ScrollbarThemeClient& scrollbar,
                                      const IntPoint& positionInRootFrame) {
  ScrollbarPart result = NoPart;
  if (!scrollbar.enabled())
    return result;

  IntPoint testPosition = scrollbar.convertFromRootFrame(positionInRootFrame);
  testPosition.move(scrollbar.x(), scrollbar.y());

  if (!scrollbar.frameRect().contains(testPosition))
    return NoPart;

  result = ScrollbarBGPart;

  IntRect track = trackRect(scrollbar);
  if (track.contains(testPosition)) {
    IntRect beforeThumbRect;
    IntRect thumbRect;
    IntRect afterThumbRect;
    splitTrack(scrollbar, track, beforeThumbRect, thumbRect, afterThumbRect);
    if (thumbRect.contains(testPosition))
      result = ThumbPart;
    else if (beforeThumbRect.contains(testPosition))
      result = BackTrackPart;
    else if (afterThumbRect.contains(testPosition))
      result = ForwardTrackPart;
    else
      result = TrackBGPart;
  } else if (backButtonRect(scrollbar, BackButtonStartPart)
                 .contains(testPosition)) {
    result = BackButtonStartPart;
  } else if (backButtonRect(scrollbar, BackButtonEndPart)
                 .contains(testPosition)) {
    result = BackButtonEndPart;
  } else if (forwardButtonRect(scrollbar, ForwardButtonStartPart)
                 .contains(testPosition)) {
    result = ForwardButtonStartPart;
  } else if (forwardButtonRect(scrollbar, ForwardButtonEndPart)
                 .contains(testPosition)) {
    result = ForwardButtonEndPart;
  }
  return result;
}
开发者ID:ollie314,项目名称:chromium,代码行数:43,代码来源:ScrollbarTheme.cpp

示例6: paintTrackPiece

void ScrollbarThemeAura::paintTrackPiece(GraphicsContext& gc, const ScrollbarThemeClient& scrollbar, const IntRect& rect, ScrollbarPart partType)
{
    DisplayItem::Type displayItemType = trackPiecePartToDisplayItemType(partType);
    if (DrawingRecorder::useCachedDrawingIfPossible(gc, scrollbar, displayItemType))
        return;

    DrawingRecorder recorder(gc, scrollbar, displayItemType, rect);

    WebThemeEngine::State state = scrollbar.hoveredPart() == partType ? WebThemeEngine::StateHover : WebThemeEngine::StateNormal;

    if (useMockTheme() && !scrollbar.enabled())
        state = WebThemeEngine::StateDisabled;

    IntRect alignRect = trackRect(scrollbar, false);
    WebThemeEngine::ExtraParams extraParams;
    extraParams.scrollbarTrack.isBack = (partType == BackTrackPart);
    extraParams.scrollbarTrack.trackX = alignRect.x();
    extraParams.scrollbarTrack.trackY = alignRect.y();
    extraParams.scrollbarTrack.trackWidth = alignRect.width();
    extraParams.scrollbarTrack.trackHeight = alignRect.height();
    Platform::current()->themeEngine()->paint(gc.canvas(), scrollbar.orientation() == HorizontalScrollbar ? WebThemeEngine::PartScrollbarHorizontalTrack : WebThemeEngine::PartScrollbarVerticalTrack, state, WebRect(rect), &extraParams);
}
开发者ID:astojilj,项目名称:chromium-crosswalk,代码行数:22,代码来源:ScrollbarThemeAura.cpp


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