本文整理汇总了C++中RenderSlider类的典型用法代码示例。如果您正苦于以下问题:C++ RenderSlider类的具体用法?C++ RenderSlider怎么用?C++ RenderSlider使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了RenderSlider类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: mediaController
void MediaControlTimelineElement::defaultEventHandler(Event* event)
{
// Left button is 0. Rejects mouse events not from left button.
if (event->isMouseEvent() && static_cast<MouseEvent*>(event)->button())
return;
if (!attached())
return;
if (event->type() == eventNames().mousedownEvent)
mediaController()->beginScrubbing();
if (event->type() == eventNames().mouseupEvent)
mediaController()->endScrubbing();
MediaControlInputElement::defaultEventHandler(event);
if (event->type() == eventNames().mouseoverEvent || event->type() == eventNames().mouseoutEvent || event->type() == eventNames().mousemoveEvent)
return;
float time = narrowPrecisionToFloat(value().toDouble());
if (event->type() == eventNames().inputEvent && time != mediaController()->currentTime()) {
ExceptionCode ec;
mediaController()->setCurrentTime(time, ec);
}
RenderSlider* slider = toRenderSlider(renderer());
if (slider && slider->inDragMode())
m_controls->updateTimeDisplay();
}
示例2: mediaController
void MediaControlFullscreenTimelineElement::defaultEventHandler(Event* event)
{
// Left button is 0. Rejects mouse events not from left button.
if (event->isMouseEvent() && static_cast<MouseEvent*>(event)->button())
return;
if (!attached())
return;
if (event->type() == eventNames().mousedownEvent)
mediaController()->beginScrubbing();
if (event->type() == eventNames().mouseupEvent)
mediaController()->endScrubbing();
MediaControlInputElement::defaultEventHandler(event);
if (event->type() == eventNames().mouseoverEvent || event->type() == eventNames().mouseoutEvent || event->type() == eventNames().mousemoveEvent)
return;
double time = value().toDouble();
if (event->type() == eventNames().inputEvent && time != mediaController()->currentTime())
mediaController()->setCurrentTime(time, IGNORE_EXCEPTION);
RenderSlider* slider = toRenderSlider(renderer());
if (slider && slider->inDragMode())
m_controls->updateCurrentTimeDisplay();
}
示例3: defaultEventHandler
void MediaControlTimelineElement::defaultEventHandler(Event* event)
{
RenderSlider* slider = static_cast<RenderSlider*>(renderer());
bool oldInDragMode = slider && slider->inDragMode();
float oldTime = narrowPrecisionToFloat(value().toDouble());
bool oldEnded = m_mediaElement->ended();
HTMLInputElement::defaultEventHandler(event);
float time = narrowPrecisionToFloat(value().toDouble());
if (oldTime != time || event->type() == inputEvent) {
ExceptionCode ec;
m_mediaElement->setCurrentTime(time, ec);
}
// Media element stays in non-paused state when it reaches end. If the slider is now dragged
// to some other position the playback resumes which does not match usual media player UIs.
// Get the expected behavior by pausing explicitly in this case.
if (oldEnded && !m_mediaElement->ended() && !m_mediaElement->paused()) {
ExceptionCode ec;
m_mediaElement->pause(ec);
}
// Pause playback during drag, but do it without using DOM API which would generate events
bool inDragMode = slider && slider->inDragMode();
if (inDragMode != oldInDragMode)
m_mediaElement->setPausedInternal(inDragMode);
}
示例4: mediaControls
void MediaControlTimelineElement::defaultEventHandler(Event* event)
{
if (event->isMouseEvent() && toMouseEvent(event)->button() != LeftButton)
return;
if (!inDocument() || !document().isActive())
return;
if (event->type() == EventTypeNames::mousedown)
mediaControls().beginScrubbing();
if (event->type() == EventTypeNames::mouseup)
mediaControls().endScrubbing();
MediaControlInputElement::defaultEventHandler(event);
if (event->type() == EventTypeNames::mouseover || event->type() == EventTypeNames::mouseout || event->type() == EventTypeNames::mousemove)
return;
double time = value().toDouble();
if (event->type() == EventTypeNames::input && time != mediaControllerInterface().currentTime())
mediaControllerInterface().setCurrentTime(time, IGNORE_EXCEPTION);
RenderSlider* slider = toRenderSlider(renderer());
if (slider && slider->inDragMode())
mediaControls().updateCurrentTimeDisplay();
}
示例5: mediaController
void MediaControlTimelineElement::defaultEventHandler(Event* event)
{
// Left button is 0. Rejects mouse events not from left button.
if (event->isMouseEvent() && toMouseEvent(event)->button())
return;
if (!inDocument() || !document().isActive())
return;
if (event->type() == EventTypeNames::mousedown)
mediaController()->beginScrubbing();
if (event->type() == EventTypeNames::mouseup)
mediaController()->endScrubbing();
MediaControlInputElement::defaultEventHandler(event);
if (event->type() == EventTypeNames::mouseover || event->type() == EventTypeNames::mouseout || event->type() == EventTypeNames::mousemove)
return;
double time = value().toDouble();
if (event->type() == EventTypeNames::input && time != mediaController()->currentTime())
mediaController()->setCurrentTime(time, IGNORE_EXCEPTION);
RenderSlider* slider = toRenderSlider(renderer());
if (slider && slider->inDragMode())
m_controls->updateCurrentTimeDisplay();
}
示例6: mediaControls
void MediaControlTimelineElement::defaultEventHandler(Event* event)
{
if (event->isMouseEvent() && toMouseEvent(event)->button() != LeftButton)
return;
if (!inDocument() || !document().isActive())
return;
if (event->type() == EventTypeNames::mousedown)
mediaControls().beginScrubbing();
if (event->type() == EventTypeNames::mouseup)
mediaControls().endScrubbing();
MediaControlInputElement::defaultEventHandler(event);
if (event->type() == EventTypeNames::mouseover || event->type() == EventTypeNames::mouseout || event->type() == EventTypeNames::mousemove)
return;
double time = value().toDouble();
if (event->type() == EventTypeNames::input) {
// FIXME: This will need to take the timeline offset into consideration
// once that concept is supported, see https://crbug.com/312699
if (mediaElement().controller())
mediaElement().controller()->setCurrentTime(time, IGNORE_EXCEPTION);
else
mediaElement().setCurrentTime(time, IGNORE_EXCEPTION);
}
RenderSlider* slider = toRenderSlider(renderer());
if (slider && slider->inDragMode())
mediaControls().updateCurrentTimeDisplay();
}
开发者ID:PDi-Communication-Systems-Inc,项目名称:lollipop_external_chromium_org,代码行数:33,代码来源:MediaControlElements.cpp
示例7: p
bool RenderThemeQt::paintSliderTrack(RenderObject* o, const PaintInfo& pi,
const IntRect& r)
{
StylePainter p(this, pi);
if (!p.isValid())
return true;
QStyleOptionSlider option;
initStyleOption(p.widget, option);
option.subControls = QStyle::SC_SliderGroove | QStyle::SC_SliderHandle;
ControlPart appearance = initializeCommonQStyleOptions(option, o);
RenderSlider* renderSlider = toRenderSlider(o);
IntRect thumbRect = renderSlider->thumbRect();
option.rect = r;
int value;
if (appearance == SliderVerticalPart) {
option.maximum = r.height() - thumbRect.height();
value = thumbRect.y();
} else {
option.maximum = r.width() - thumbRect.width();
value = thumbRect.x();
}
value = QStyle::sliderValueFromPosition(0, option.maximum, value, option.maximum);
option.sliderValue = value;
option.sliderPosition = value;
if (appearance == SliderVerticalPart)
option.orientation = Qt::Vertical;
if (renderSlider->inDragMode()) {
option.activeSubControls = QStyle::SC_SliderHandle;
option.state |= QStyle::State_Sunken;
}
const QPoint topLeft = r.location();
p.painter->translate(topLeft);
option.rect.moveTo(QPoint(0, 0));
option.rect.setSize(r.size());
p.drawComplexControl(QStyle::CC_Slider, option);
p.painter->translate(-topLeft);
return false;
}
示例8: IntPoint
void HTMLSliderThumbElement::defaultEventHandler(Event* event)
{
const AtomicString& eventType = event->type();
if (eventType == eventNames().mousedownEvent && event->isMouseEvent() && static_cast<MouseEvent*>(event)->button() == LeftButton) {
MouseEvent* mouseEvent = static_cast<MouseEvent*>(event);
if (document()->frame() && renderer() && renderer()->parent()
&& static_cast<RenderSlider*>(renderer()->parent())->mouseEventIsInThumb(mouseEvent)) {
// Cache the initial point where the mouse down occurred.
m_initialClickPoint = IntPoint(mouseEvent->pageX(), mouseEvent->pageY());
// Cache the initial position of the thumb.
m_initialPosition = static_cast<RenderSlider*>(renderer()->parent())->currentPosition();
m_inDragMode = true;
document()->frame()->eventHandler()->setCapturingMouseEventsNode(m_shadowParent);
event->setDefaultHandled();
return;
}
} else if (eventType == eventNames().mouseupEvent && event->isMouseEvent() && static_cast<MouseEvent*>(event)->button() == LeftButton) {
if (m_inDragMode) {
if (Frame* frame = document()->frame())
frame->eventHandler()->setCapturingMouseEventsNode(0);
m_inDragMode = false;
event->setDefaultHandled();
return;
}
} else if (eventType == eventNames().mousemoveEvent && event->isMouseEvent()) {
if (m_inDragMode && renderer() && renderer()->parent()) {
// Move the slider
MouseEvent* mouseEvent = static_cast<MouseEvent*>(event);
RenderSlider* slider = static_cast<RenderSlider*>(renderer()->parent());
int newPosition = slider->positionForOffset(
IntPoint(m_initialPosition + mouseEvent->pageX() - m_initialClickPoint.x()
+ (renderer()->width() / 2),
m_initialPosition + mouseEvent->pageY() - m_initialClickPoint.y()
+ (renderer()->height() / 2)));
if (slider->currentPosition() != newPosition) {
slider->setCurrentPosition(newPosition);
slider->valueChanged();
}
event->setDefaultHandled();
return;
}
}
HTMLDivElement::defaultEventHandler(event);
}
示例9: toRenderSlider
void SliderThumbElement::defaultEventHandler(Event* event)
{
if (!event->isMouseEvent()) {
HTMLDivElement::defaultEventHandler(event);
return;
}
MouseEvent* mouseEvent = static_cast<MouseEvent*>(event);
bool isLeftButton = mouseEvent->button() == LeftButton;
const AtomicString& eventType = event->type();
if (eventType == eventNames().mousedownEvent && isLeftButton) {
if (document()->frame() && renderer()) {
RenderSlider* slider = toRenderSlider(renderer()->parent());
if (slider) {
if (slider->mouseEventIsInThumb(mouseEvent)) {
// We selected the thumb, we want the cursor to always stay at
// the same position relative to the thumb.
m_offsetToThumb = slider->mouseEventOffsetToThumb(mouseEvent);
} else {
// We are outside the thumb, move the thumb to the point were
// we clicked. We'll be exactly at the center of the thumb.
m_offsetToThumb.setX(0);
m_offsetToThumb.setY(0);
}
m_inDragMode = true;
document()->frame()->eventHandler()->setCapturingMouseEventsNode(m_shadowParent);
event->setDefaultHandled();
return;
}
}
} else if (eventType == eventNames().mouseupEvent && isLeftButton) {
if (m_inDragMode) {
if (Frame* frame = document()->frame())
frame->eventHandler()->setCapturingMouseEventsNode(0);
m_inDragMode = false;
event->setDefaultHandled();
return;
}
} else if (eventType == eventNames().mousemoveEvent) {
if (m_inDragMode && renderer() && renderer()->parent()) {
RenderSlider* slider = toRenderSlider(renderer()->parent());
if (slider) {
FloatPoint curPoint = slider->absoluteToLocal(mouseEvent->absoluteLocation(), false, true);
IntPoint eventOffset(curPoint.x() + m_offsetToThumb.x(), curPoint.y() + m_offsetToThumb.y());
slider->setValueForPosition(slider->positionForOffset(eventOffset));
event->setDefaultHandled();
return;
}
}
}
HTMLDivElement::defaultEventHandler(event);
}