本文整理汇总了C++中RenderWidget类的典型用法代码示例。如果您正苦于以下问题:C++ RenderWidget类的具体用法?C++ RenderWidget怎么用?C++ RenderWidget使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了RenderWidget类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: renderer
RenderWidget* HTMLObjectElement::renderWidgetForJSBindings() const
{
RenderWidget* renderWidget = (renderer() && renderer()->isWidget()) ? static_cast<RenderWidget*>(renderer()) : 0;
if (renderWidget && !renderWidget->widget()) {
document()->updateLayoutIgnorePendingStylesheets();
renderWidget = (renderer() && renderer()->isWidget()) ? static_cast<RenderWidget*>(renderer()) : 0;
}
return renderWidget;
}
示例2: findWidgetRenderer
RenderWidget* HTMLEmbedElement::renderWidgetForJSBindings() const
{
RenderWidget* renderWidget = findWidgetRenderer(this);
if (renderWidget && !renderWidget->widget()) {
document()->updateLayoutIgnorePendingStylesheets();
renderWidget = findWidgetRenderer(this);
}
return renderWidget;
}
示例3: main
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
RadialImage renderer(512, 512);
// renderer.run();
//exit(0);
RenderWidget render;
render.show();
return a.exec();
}
示例4: renderWidgetForJSBindings
Widget* HTMLPlugInElement::pluginWidget() const
{
if (m_inBeforeLoadEventHandler) {
// The plug-in hasn't loaded yet, and it makes no sense to try to load if beforeload handler happened to touch the plug-in element.
// That would recursively call beforeload for the same element.
return 0;
}
RenderWidget* renderWidget = renderWidgetForJSBindings();
if (!renderWidget)
return 0;
return renderWidget->widget();
}
示例5: renderWidgetLoadingPlugin
Widget* HTMLPlugInElement::pluginWidget(PluginLoadingPolicy loadPolicy) const
{
if (m_inBeforeLoadEventHandler) {
// The plug-in hasn't loaded yet, and it makes no sense to try to load if beforeload handler happened to touch the plug-in element.
// That would recursively call beforeload for the same element.
return nullptr;
}
RenderWidget* renderWidget = loadPolicy == PluginLoadingPolicy::Load ? renderWidgetLoadingPlugin() : this->renderWidget();
if (!renderWidget)
return nullptr;
return renderWidget->widget();
}
示例6: element
ScriptInstance WebMediaPlayerProxy::pluginInstance()
{
if (!m_instance) {
RenderObject* r = element()->renderer();
if (!r || !r->isWidget())
return 0;
Frame* frame = element()->document()->frame();
RenderWidget* renderWidget = static_cast<RenderWidget*>(element()->renderer());
if (renderWidget && renderWidget->widget())
m_instance = frame->script()->createScriptInstanceForWidget(renderWidget->widget());
}
return m_instance;
}
示例7: document
PassScriptInstance HTMLPlugInElement::getInstance() const
{
Frame* frame = document()->frame();
if (!frame)
return 0;
// If the host dynamically turns off JavaScript (or Java) we will still return
// the cached allocated Bindings::Instance. Not supporting this edge-case is OK.
if (m_instance)
return m_instance;
RenderWidget* renderWidget = renderWidgetForJSBindings();
if (renderWidget && renderWidget->widget())
m_instance = frame->script()->createScriptInstanceForWidget(renderWidget->widget());
return m_instance;
}
示例8: document
KJS::Bindings::Instance *HTMLObjectElement::getInstance() const
{
Frame* frame = document()->frame();
if (!frame)
return 0;
if (m_instance)
return m_instance.get();
RenderWidget* renderWidget = (renderer() && renderer()->isWidget()) ? static_cast<RenderWidget*>(renderer()) : 0;
if (renderWidget && !renderWidget->widget()) {
document()->updateLayoutIgnorePendingStylesheets();
renderWidget = (renderer() && renderer()->isWidget()) ? static_cast<RenderWidget*>(renderer()) : 0;
}
if (renderWidget && renderWidget->widget())
m_instance = frame->createScriptInstanceForWidget(renderWidget->widget());
return m_instance.get();
}
示例9: document
KJS::Bindings::Instance* HTMLEmbedElement::getInstance() const
{
Frame* frame = document()->frame();
if (!frame)
return 0;
if (m_instance)
return m_instance.get();
RenderWidget* renderWidget = findWidgetRenderer(this);
if (renderWidget && !renderWidget->widget()) {
document()->updateLayoutIgnorePendingStylesheets();
renderWidget = findWidgetRenderer(this);
}
if (renderWidget && renderWidget->widget())
m_instance = frame->createScriptInstanceForWidget(renderWidget->widget());
return m_instance.get();
}
示例10: ASSERT
PassRefPtr<Widget> SubframeLoader::loadMediaPlayerProxyPlugin(Node* node, const URL& url,
const Vector<String>& paramNames, const Vector<String>& paramValues)
{
ASSERT(node->hasTagName(videoTag) || isHTMLAudioElement(node));
URL completedURL;
if (!url.isEmpty())
completedURL = completeURL(url);
if (!m_frame.document()->securityOrigin()->canDisplay(completedURL)) {
FrameLoader::reportLocalLoadFailed(m_frame, completedURL.string());
return 0;
}
if (!m_frame.document()->contentSecurityPolicy()->allowMediaFromSource(completedURL))
return 0;
HTMLMediaElement* mediaElement = toHTMLMediaElement(node);
RenderWidget* renderer = toRenderWidget(node->renderer());
IntSize size;
if (renderer)
size = roundedIntSize(LayoutSize(renderer->contentWidth(), renderer->contentHeight()));
else if (mediaElement->isVideo())
size = RenderVideo::defaultSize();
if (!m_frame.loader().mixedContentChecker().canRunInsecureContent(m_frame.document()->securityOrigin(), completedURL))
return 0;
RefPtr<Widget> widget = m_frame.loader().client().createMediaPlayerProxyPlugin(size, mediaElement, completedURL,
paramNames, paramValues, "application/x-media-element-proxy-plugin");
if (widget && renderer) {
renderer->setWidget(widget);
renderer->node()->setNeedsStyleRecalc(SyntheticStyleChange);
}
m_containsPlugins = true;
return widget ? widget.release() : 0;
}
示例11: document
PassScriptInstance HTMLPlugInElement::getInstance() const
{
Frame* frame = document()->frame();
if (!frame)
return 0;
// If the host dynamically turns off JavaScript (or Java) we will still return
// the cached allocated Bindings::Instance. Not supporting this edge-case is OK.
if (m_instance)
return m_instance;
if (m_inBeforeLoadEventHandler) {
// The plug-in hasn't loaded yet, and it makes no sense to try to load if beforeload handler happened to touch the plug-in element.
// That would recursively call beforeload for the same element.
return 0;
}
RenderWidget* renderWidget = renderWidgetForJSBindings();
if (renderWidget && renderWidget->widget())
m_instance = frame->script()->createScriptInstanceForWidget(renderWidget->widget());
return m_instance;
}
示例12: main
int main( int argc, char** argv )
{
// initialize the entire render system
RenderSystem* render_system = RenderSystem::get();
QApplication app( argc, argv );
// make the render window
RenderWidget* window = new RenderWidget( render_system );
window->setWindowTitle( "I hope this is not all black." );
QVBoxLayout* layout = new QVBoxLayout;
layout->addWidget( window );
QPushButton* hide_button = new QPushButton( "hide" );
layout->addWidget( hide_button );
QPushButton* show_button = new QPushButton( "show" );
layout->addWidget( show_button );
QWidget container;
container.setLayout( layout );
container.resize( 900, 600 );
container.show();
// Make a scene and show it in the window.
Ogre::SceneManager* scene_manager = render_system->root()->createSceneManager( Ogre::ST_GENERIC );
Ogre::Entity* thing = scene_manager->createEntity( "thing", "rviz_cone.mesh" );
Ogre::SceneNode* node = scene_manager->getRootSceneNode()->createChildSceneNode();
node->attachObject( thing );
scene_manager->setAmbientLight( Ogre::ColourValue( .5, .5, .5 ));
Ogre::Light* light = scene_manager->createLight( "light" );
light->setPosition( 20, 80, 50 );
Ogre::Camera* camera = scene_manager->createCamera( "SampleCam" );
camera->setPosition( Ogre::Vector3( 0, 0, 10 ));
camera->lookAt( Ogre::Vector3( 0, 0, -300 ));
camera->setNearClipDistance( 5 );
Ogre::Viewport* viewport = window->getRenderWindow()->addViewport( camera );
viewport->setBackgroundColour( Ogre::ColourValue( 0, 0, 1.0 ));
camera->setAspectRatio( Ogre::Real( viewport->getActualWidth() ) / Ogre::Real( viewport->getActualHeight() ));
// redraw every 33ms.
QTimer timer;
QObject::connect( &timer, SIGNAL(timeout()), window, SLOT(update()) );
timer.start( 33 );
RenderWidget window2( render_system );
window2.resize( 400, 400 );
window2.setWindowTitle( "I hope this is also not all black." );
window2.show();
hide_button->connect( hide_button, SIGNAL( clicked() ), &window2, SLOT( hide() ));
show_button->connect( show_button, SIGNAL( clicked() ), &window2, SLOT( show() ));
Ogre::Camera* camera2 = scene_manager->createCamera( "SampleCam2" );
camera2->setPosition( Ogre::Vector3( 0, 10, 0 ));
camera2->setFixedYawAxis( false );
camera2->lookAt( Ogre::Vector3( 0, 0, 0 ));
camera2->setNearClipDistance( 5 );
Ogre::Viewport* viewport2 = window2.getRenderWindow()->addViewport( camera2 );
viewport2->setBackgroundColour( Ogre::ColourValue( 0, 1.0, 0 ));
camera2->setAspectRatio( Ogre::Real( viewport2->getActualWidth() ) / Ogre::Real( viewport2->getActualHeight() ));
// redraw every 33ms.
QTimer timer2;
QObject::connect( &timer2, SIGNAL(timeout()), &window2, SLOT(update()) );
timer2.start( 33 );
// main loop
return app.exec();
}
示例13: Region
Region ScrollingCoordinator::absoluteNonFastScrollableRegionForFrame(const Frame& frame) const
{
RenderView* renderView = frame.contentRenderer();
if (!renderView || renderView->documentBeingDestroyed())
return Region();
#if ENABLE(IOS_TOUCH_EVENTS)
// On iOS, we use nonFastScrollableRegion to represent the region covered by elements with touch event handlers.
ASSERT(frame.isMainFrame());
Document* document = frame.document();
if (!document)
return Region();
Vector<IntRect> touchRects;
document->getTouchRects(touchRects);
Region touchRegion;
for (const auto& rect : touchRects)
touchRegion.unite(rect);
// FIXME: use absoluteRegionForEventTargets().
return touchRegion;
#else
Region nonFastScrollableRegion;
FrameView* frameView = frame.view();
if (!frameView)
return nonFastScrollableRegion;
// FIXME: should ASSERT(!frameView->needsLayout()) here, but need to fix DebugPageOverlays
// to not ask for regions at bad times.
if (const FrameView::ScrollableAreaSet* scrollableAreas = frameView->scrollableAreas()) {
for (auto& scrollableArea : *scrollableAreas) {
// Composited scrollable areas can be scrolled off the main thread.
if (scrollableArea->usesAsyncScrolling())
continue;
bool isInsideFixed;
IntRect box = scrollableArea->scrollableAreaBoundingBox(&isInsideFixed);
if (isInsideFixed)
box = IntRect(frameView->fixedScrollableAreaBoundsInflatedForScrolling(LayoutRect(box)));
nonFastScrollableRegion.unite(box);
}
}
for (auto& widget : frameView->widgetsInRenderTree()) {
RenderWidget* renderWidget = RenderWidget::find(widget);
if (!renderWidget || !is<PluginViewBase>(*widget))
continue;
if (downcast<PluginViewBase>(*widget).wantsWheelEvents())
nonFastScrollableRegion.unite(renderWidget->absoluteBoundingBoxRect());
}
// FIXME: if we've already accounted for this subframe as a scrollable area, we can avoid recursing into it here.
for (Frame* subframe = frame.tree().firstChild(); subframe; subframe = subframe->tree().nextSibling()) {
FrameView* subframeView = subframe->view();
if (!subframeView)
continue;
Region subframeRegion = absoluteNonFastScrollableRegionForFrame(*subframe);
// Map from the frame document to our document.
IntPoint offset = subframeView->contentsToContainingViewContents(IntPoint());
// FIXME: this translation ignores non-trival transforms on the frame.
subframeRegion.translate(toIntSize(offset));
nonFastScrollableRegion.unite(subframeRegion);
}
Document::RegionFixedPair wheelHandlerRegion = frame.document()->absoluteRegionForEventTargets(frame.document()->wheelEventTargets());
bool wheelHandlerInFixedContent = wheelHandlerRegion.second;
if (wheelHandlerInFixedContent) {
// FIXME: need to handle position:sticky here too.
LayoutRect inflatedWheelHandlerBounds = frameView->fixedScrollableAreaBoundsInflatedForScrolling(LayoutRect(wheelHandlerRegion.first.bounds()));
wheelHandlerRegion.first.unite(enclosingIntRect(inflatedWheelHandlerBounds));
}
nonFastScrollableRegion.unite(wheelHandlerRegion.first);
// FIXME: If this is not the main frame, we could clip the region to the frame's bounds.
return nonFastScrollableRegion;
#endif
}
示例14: main
int main(int argc, char **argv) {
char * image = NULL;
char * activity = NULL;
switch(argc){
case 3:
if (strcmp(argv[1],"-in")==0){
image= argv[2];
activity = NULL;
}else{
perror("Wrong parameters");
exit(-1);
}
break;
case 5:
if (strcmp(argv[1],"-in")==0 && strcmp(argv[3],"-z")==0){
image= argv[2];
activity = argv[4];
}else{
if (strcmp(argv[1],"-z")==0 && strcmp(argv[3],"-in")==0){
activity = argv[2];
image= argv[4];
}else{
perror("Wrong parameters");
exit(-1);
}
}
break;
default:
perror("Wrong parameters");
exit(-1);
break;
}
QApplication app(argc, argv);
RenderWidget *widget = new RenderWidget(image, activity);
QPushButton front("vorn");
QObject::connect( &front, SIGNAL( clicked() ),
widget, SLOT( setCameraFront() ) );
front.show();
QPushButton back("hinten");
QObject::connect( &back, SIGNAL( clicked() ),
widget, SLOT( setCameraBack() ) );
back.show();
QPushButton right("rechts");
QObject::connect( &right, SIGNAL( clicked() ),
widget, SLOT( setCameraRight() ) );
right.show();
QPushButton left("links");
QObject::connect( &left, SIGNAL( clicked() ),
widget, SLOT( setCameraLeft() ) );
left.show();
QPushButton top("oben");
QObject::connect( &top, SIGNAL( clicked() ),
widget, SLOT( setCameraTop() ) );
top.show();
QPushButton bottom("unten");
QObject::connect( &bottom, SIGNAL( clicked() ),
widget, SLOT( setCameraBottom() ) );
bottom.show();
widget->show();
return app.exec();
}