本文整理汇总了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));
}
示例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);
}
示例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;
}
示例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;
}
示例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;
}
示例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);
}