void Scene::withoutFocus() { sf::Event event; while (_window->pollEvent(event)) { if (event.type == sf::Event::Resized) resizing(); else if (event.type != sf::Event::GainedFocus) continue; else { _focus = true; break; } } }
ChromeWidget::ChromeWidget(QGraphicsItem * parent, Qt::WindowFlags wFlags) : QObject(0), m_renderer(0), m_dom(0), m_viewController(new ViewController()), m_jsObject(new ChromeWidgetJSObject(0, this)), m_localeDelegate(new LocaleDelegate(this)), m_downloads(new Downloads()) { m_layout = new ChromeLayout(parent, wFlags); QObject::connect(m_layout, SIGNAL(resizing(QSizeF)), this, SLOT(onResize(QSizeF))); QObject::connect(m_layout, SIGNAL(aspectChanged(int)), this, SLOT(onAspectChanged(int))); DeviceImpl *deviceImpl = new DEVICEIMPL(); NetworkImpl *networkImpl = new NETWORKIMPL(); m_deviceDelegate = new DeviceDelegate(deviceImpl); m_networkDelegate = new NetworkDelegate(networkImpl); BEDROCK_PROVISIONING::BedrockProvisioning *provisioning = BEDROCK_PROVISIONING::BedrockProvisioning::createBedrockProvisioning(); ChromeEffect::disabledColor.setNamedColor(provisioning->valueAsString("DisabledColor", "#FFFFFF")); ChromeEffect::disabledOpacity = static_cast<qreal>(provisioning->valueAsString("DisabledOpacity", "0.65").toFloat()); #ifndef __gva_no_chrome__ m_snippets = new Snippets(this, this); #endif #ifndef __gva_no_chrome__ m_page = static_cast<QWebPage *>(new GVA::WebPageWrapper(this, "Chrome Javascript error")); m_page->mainFrame()->setScrollBarPolicy(Qt::Vertical, Qt::ScrollBarAlwaysOff); m_page->mainFrame()->setScrollBarPolicy(Qt::Horizontal, Qt::ScrollBarAlwaysOff); #endif m_viewController->setObjectName("views"); connect(m_viewController, SIGNAL(currentViewChanged()), this, SLOT(onCurrentViewChanged())); #ifndef __gva_no_chrome__ m_jsObject->setObjectName("chrome"); // Pass some signals from this object to the Javascript object. QObject::connect(this, SIGNAL(chromeComplete()), m_jsObject, SIGNAL(chromeComplete())); QObject::connect(this, SIGNAL(aspectChanged(int)), m_jsObject, SIGNAL(aspectChanged(int))); QObject::connect(this, SIGNAL(prepareForGeometryChange()), m_jsObject, SIGNAL(prepareForGeometryChange())); QObject::connect(this, SIGNAL(symbianCarriageReturn()), m_jsObject, SIGNAL(symbianCarriageReturn())); QObject::connect(this, SIGNAL(popupShown(const QString &)), m_jsObject, SIGNAL(popupShown(const QString &))); QObject::connect(this, SIGNAL(popupHidden(const QString &)), m_jsObject, SIGNAL(popupHidden(const QString &))); //addJSObjectToEngine(this); m_app = new GinebraApplication(); QObject::connect(this, SIGNAL(goToBackground()), m_app, SLOT(sendToBackground())); //addJSObjectToEngine(m_app); QObject::connect( WebPageController::getSingleton(), SIGNAL(pageCreated(WRT::WrtBrowserContainer*)), this, SLOT(pageCreated(WRT::WrtBrowserContainer*))); QObject::connect(m_page, SIGNAL(loadFinished(bool)), this, SLOT(loadFinished(bool))); QObject::connect(m_page, SIGNAL(loadStarted()), this, SLOT(loadStarted())); QObject::connect(m_page->mainFrame(), SIGNAL(javaScriptWindowObjectCleared()), this, SLOT(exportJSObjects())); #endif ViewStack * vs = ViewStack::getSingleton(); vs->setViewController(m_viewController); vs->setChromeWidget(this); // TO DO: need a better home for this. qMetaTypeId<QObjectList>(); qRegisterMetaType<QObjectList>("QObjectList"); //for QA Automation test tool purpose #if !defined(QT_NO_LIBRARY) QLibrary testLib("qttestability"); if(testLib.load()){ typedef void (*TasInitialize)(void); TasInitialize initFunction = (TasInitialize)testLib.resolve("qt_testability_init"); #ifdef Q_OS_SYMBIAN //not found so use ordinal if(!initFunction){ initFunction = (TasInitialize)testLib.resolve("1"); } #endif if(initFunction){ initFunction(); } } #endif }
void GcWindow::mouseMoveEvent(QMouseEvent *e) { if (!resizable()) return; if (dragState == None) { // set the cursor shape setCursorShape(spotHotSpot(e)); return; } // work out the relative move x and y int relx = mapFromGlobal(QCursor::pos()).x() - mX; int rely = mapFromGlobal(QCursor::pos()).y() - mY; switch (dragState) { default: case Move : //move(oX + relx, oY + rely); #if QT_VERSION < 0x040700 setCursor(Qt::ClosedHandCursor); #else setCursor(Qt::DragMoveCursor); #endif emit moving(this); break; case TLCorner : { int newWidth = oWidth - relx; int newHeight = oHeight - rely; // need to move and resize if (newWidth > 30 && newHeight > 30) { move(oX + relx, oY + rely); setNewSize(newWidth, newHeight); emit resizing(this); } } break; case TRCorner : { int newWidth = oWidth + relx; int newHeight = oHeight - rely; // need to move and resize if changes on y plane if (newWidth > 30 && newHeight > 30) { move(oX, oY + rely); setNewSize(newWidth, newHeight); emit resizing(this); } } break; case BLCorner : { int newWidth = oWidth - relx; int newHeight = oHeight + rely; // need to move and resize if (newWidth > 30 && newHeight > 30) { move(oX + relx, oY); setNewSize(newWidth, newHeight); emit resizing(this); } } break; case BRCorner : { int newWidth = oWidth + relx; int newHeight = oHeight + rely; // need to move and resize if (newWidth > 30 && newHeight > 30) { setNewSize(newWidth, newHeight); emit resizing(this); } } break; case Top : { int newHeight = oHeight - rely; // need to move and resize if (newHeight > 30) { move (oX, oY + rely); setNewSize(oWidth, newHeight); emit resizing(this); } } break; case Bottom : { int newHeight = oHeight + rely; // need to move and resize if (newHeight > 30) { setNewSize(oWidth, newHeight); emit resizing(this); } } break; case Left : { int newWidth = oWidth - relx; // need to move and resize if (newWidth > 30) { move (oX + relx, oY); setNewSize(newWidth, oHeight); emit resizing(this); } } break; case Right : { int newWidth = oWidth + relx; // need to move and resize if (newWidth > 30) { setNewSize(newWidth, oHeight); emit resizing(this); } } break; } oX = pos().x(); oY = pos().y(); //repaint(); //QApplication::processEvents(); // flicker... }