Example #1
0
bool GUIpane::MouseMoveAction(int x, int y, int xrel, int yrel, int buttons)
{
	if(buttons==2)
	{
		if(resizing)
		{
			w+=xrel;
			h+=yrel;
			if(w<minW) w=minW;
			if(h<minH) h=minH;
			SizeChanged();
			return true;
		}
		else if(dragging)
		{
			this->x+=xrel;
			this->y+=yrel;
			return true;
		}
	}
	// no buttons pressed or neither dragging nor resizing:
	// this event doesn't belong to us
	dragging=false;
	resizing=false;
	return false;
}
void CEditorContainer::CreateEditorL(void)
	{
	iEditor = new (ELeave) CEikRichTextEditor;
	iEditor->SetAknEditorFlags(EAknEditorFlagEnableScrollBars);
	iEditor->SetContainerWindowL(*this);
	iEditor->SetAvkonWrap(ETrue);
	iEditor->ConstructL(this, 0, 0, 0);

	iEditor->SetFocus(ETrue);
	iEditor->SetReadOnly(EFalse);
	iEditor->EnableCcpuSupportL(ETrue);
	iEditor->SetCursorPosL(0, EFalse);
	iEditor->SetAvkonWrap(ETrue);
	iEditor->SetInputCapabilitiesL(TCoeInputCapabilities::EAllText);
	iEditor->SetAknEditorAllowedInputModes(EAknEditorAllInputModes);
	iEditor->SetAknEditorInputMode(EAknEditorTextInputMode);
	iEditor->SetAknEditorCase(EAknEditorLowerCase);

	//iEditor->SetTextL(&_L("CIAO!!!!"));

	TFontSpec fontspec = LatinBold16()->FontSpecInTwips();
	TCharFormat charFormat(fontspec.iTypeface.iName, fontspec.iHeight);
	TCharFormatMask charFormatMask;

	charFormat.iFontPresentation.iTextColor = KRgbBlack;
	charFormatMask.SetAttrib(EAttColor);

	charFormatMask.SetAttrib(EAttFontTypeface);
	charFormatMask.SetAttrib(EAttFontHeight);
	iEditor->ApplyCharFormatL(charFormat, charFormatMask);

	iEditor->UpdateScrollBarsL();
	SizeChanged();
	}
// ----------------------------------------------------------------------------
// void CChangeConnectionDlg::HandleResourceChange( TInt aType )
// Handle resource change events. 
// ----------------------------------------------------------------------------
//
void CChangeConnectionDlg::HandleResourceChange( TInt aType )
    {
    if ( aType == KAknsMessageSkinChange )
        {
        CAknListQueryDialog::HandleResourceChange( aType );

        SizeChanged();
        }
    else
        {
        if ( aType == KEikDynamicLayoutVariantSwitch )
            {
            TRect mainPaneRect;
            AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EMainPane,
                                               mainPaneRect );

            TAknLayoutRect layoutRect;
            layoutRect.LayoutRect( TRect( TPoint( 0, 0 ), 
                                   mainPaneRect.Size() ),
                                   AKN_LAYOUT_WINDOW_list_gen_pane( 0 ) );

            ListBox()->SetRect( layoutRect.Rect() );
            }

        // Base call
        CAknListQueryDialog::HandleResourceChange( aType );
        }
    }
// ---------------------------------------------------------
// CCommonDialogsExContainer::ShowTextL
// Show dynamic text;
// ---------------------------------------------------------
//
void CCommonDialogsExContainer::ShowTextL(
    const TDesC& aText, const TDesC& aTextSub)
    {
    iLabel->SetTextL(aText);
    iToDoLabel->SetTextL(aTextSub);
    SizeChanged();
    DrawDeferred();
    }
Example #5
0
void SjLogListCtrl::MessagesChanged(long firstNewIndex)
{
	long newCount = m_logGui->m_aPacked.GetCount();
	SetItemCount(newCount);
	SizeChanged();
	ScrollDownTo(newCount-1);
	Refresh();
}
Example #6
0
/*
-----------------------------------------------------------------------------
-----------------------------------------------------------------------------
*/			
void CMyHelpContainer::ConstructL()
    {
    CreateWindowL();
    iBgContext = CAknsBasicBackgroundControlContext::NewL(KAknsIIDQsnBgAreaMain,TRect(0,0,1,1), ETrue);
    iMirroRed = AknLayoutUtils::LayoutMirrored();
    
	iEditor = new (ELeave) CEikRichTextEditor;
	iEditor->SetAknEditorFlags(EAknEditorFlagEnableScrollBars);
	iEditor->SetContainerWindowL(*this);
	iEditor->ConstructL(this,0,0,0);
	
	iEditor->CreateScrollBarFrameL();
	iEditor->ScrollBarFrame()->SetScrollBarVisibilityL(CEikScrollBarFrame::EAuto, CEikScrollBarFrame::EAuto);
	    
	TCharFormat		charFormat;	
    TCharFormatMask charFormatMask;	

	_LIT(KFontArial,"Arial");
	
	TRgb textcol;
	MAknsSkinInstance* skin = AknsUtils::SkinInstance();
	AknsUtils::GetCachedColor(skin,textcol,KAknsIIDQsnTextColors,EAknsCIQsnTextColorsCG6);
	
	charFormat.iFontSpec = AknLayoutUtils::FontFromId(EAknLogicalFontPrimaryFont)->FontSpecInTwips();
	charFormat.iFontPresentation.iTextColor = TLogicalRgb(textcol);;
	charFormatMask.SetAll();

	iParaformMe = CParaFormatLayer::NewL(); 
	iCharformMe = CCharFormatLayer::NewL(charFormat,charFormatMask); 
	iRichMessageMe  = CRichText::NewL(iParaformMe,iCharformMe);
	
	AddTextToEditorL();
	iEditor->SetDocumentContentL(*iRichMessageMe);
	iEditor->SetDocumentContentL(*iRichMessageMe);
	iEditor->SetCursorPosL(0,EFalse);
	
	iEditor->SetFocus(EFalse);
	iEditor->SetFocusing(ETrue);
	
	
	TRect MyRect(CEikonEnv::Static()->EikAppUi()->ClientRect());
	SetRect(MyRect);
	ActivateL();
	DrawNow();
	
	SizeChanged();
	iEditor->ClearSelectionL();	
	iEditor->MoveCursorL(TCursorPosition::EFPageUp, EFalse);
	iEditor->MoveCursorL(TCursorPosition::EFPageUp, EFalse);
	iEditor->MoveCursorL(TCursorPosition::EFPageUp, EFalse);
	iEditor->MoveCursorL(TCursorPosition::EFPageUp, EFalse);
	iEditor->MoveCursorL(TCursorPosition::EFPageUp, EFalse);
	iEditor->MoveCursorL(TCursorPosition::EFPageUp, EFalse);
	iEditor->MoveCursorL(TCursorPosition::EFPageUp, EFalse);
	iEditor->MoveCursorL(TCursorPosition::EFPageUp, EFalse);	
	iEditor->UpdateScrollBarsL();
	iEditor->DrawNow();
    }
Example #7
0
void RenderWidget::showFullScreen()
{
  QWidget::showFullScreen();

  const auto dpr =
      QGuiApplication::screens()[QApplication::desktop()->screenNumber(this)]->devicePixelRatio();

  emit SizeChanged(width() * dpr, height() * dpr);
}
Example #8
0
BOOL COrnament::UpdateNeeded(void)
{
	CPropertyState* pState = UpdateState();

	return
		CPropertyObject::UpdateNeeded()
	|| SizeChanged(pState)
	|| PositionChanged(pState);
}
void CAafAppCameraView::HandleResourceChange(TInt aType)
{
	if ( aType == KEikDynamicLayoutVariantSwitch )
	{
		SizeChanged();
	}

	CCoeControl::HandleResourceChange(aType);
}
void CPositionDisplay::SetIndent(TInt aIndent)
{
   if(aIndent != iIndent){
      iIndent = aIndent;
      SizeChanged();
      if (IsVisible()) {
         Window().Invalidate(Rect());
      }
   }
}
Example #11
0
// Set the font to use
void CTerminalContainer::SetFontL(const TDesC &aFontFile) {

    CS2Font *newFont = CS2Font::NewL(aFontFile);
    CleanupStack::PushL(newFont);    
    iTerminal->SetFontL(*newFont);
    delete iFont;
    iFont = newFont;
    CleanupStack::Pop();
    SizeChanged(); // recalculate terminal rect
}
void CAknBatteryIcon::HandleResourceChange( TInt aType ) 
    {
    CCoeControl::HandleResourceChange( aType );
    if ( aType == KEikColorResourceChange || aType == KAknsMessageSkinChange )
        {
        iColorIndex = 0;
        // SizeChanged updates bitmap which is used for color skinning the icons.
		SizeChanged();
        }
    }
void CTrialContainer::ReportProgress(TInt /*aVal*/, TInt /*aMax*/)
{
   TBool showList;
   if (iView->DoShowIAPProgress()) {
      showList = EFalse;
   } else {
      showList = ETrue;
   }
   SizeChanged();
   DrawNow();
}
Example #14
0
void VisualisationContainer::Init() {
  setWindowTitle(tr("Clementine Visualization"));
  setWindowIcon(QIcon(":/icon.png"));

  // Set up the graphics view
  setScene(vis_);
  setViewport(new QGLWidget(QGLFormat(QGL::SampleBuffers)));
  setViewportUpdateMode(QGraphicsView::FullViewportUpdate);
  setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
  setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
  setFrameStyle(QFrame::NoFrame);

  // Add the overlay
  overlay_proxy_ = scene()->addWidget(overlay_);
  connect(overlay_, SIGNAL(OpacityChanged(qreal)), SLOT(ChangeOverlayOpacity(qreal)));
  connect(overlay_, SIGNAL(ShowPopupMenu(QPoint)), SLOT(ShowPopupMenu(QPoint)));
  ChangeOverlayOpacity(0.0);

  vis_->SetTextureSize(size_);
  SizeChanged();

  // Selector
  selector_->SetVisualisation(vis_);

  // Settings menu
  menu_->addAction(IconLoader::Load("view-fullscreen"), tr("Toggle fullscreen"),
                   this, SLOT(ToggleFullscreen()));

  QMenu* fps_menu = menu_->addMenu(tr("Framerate"));
  QSignalMapper* fps_mapper = new QSignalMapper(this);
  QActionGroup* fps_group = new QActionGroup(this);
  AddMenuItem(tr("Low (15 fps)"), 15, fps_, fps_group, fps_mapper);
  AddMenuItem(tr("Medium (25 fps)"), 25, fps_, fps_group, fps_mapper);
  AddMenuItem(tr("High (35 fps)"), 35, fps_, fps_group, fps_mapper);
  AddMenuItem(tr("Super high (60 fps)"), 60, fps_, fps_group, fps_mapper);
  fps_menu->addActions(fps_group->actions());
  connect(fps_mapper, SIGNAL(mapped(int)), SLOT(SetFps(int)));

  QMenu* quality_menu = menu_->addMenu(tr("Quality"));
  QSignalMapper* quality_mapper = new QSignalMapper(this);
  QActionGroup* quality_group = new QActionGroup(this);
  AddMenuItem(tr("Low (256x256)"), 256, size_, quality_group, quality_mapper);
  AddMenuItem(tr("Medium (512x512)"), 512, size_, quality_group, quality_mapper);
  AddMenuItem(tr("High (1024x1024)"), 1024, size_, quality_group, quality_mapper);
  quality_menu->addActions(quality_group->actions());
  connect(quality_mapper, SIGNAL(mapped(int)), SLOT(SetQuality(int)));

  menu_->addAction(tr("Select visualizations..."), selector_, SLOT(show()));

  menu_->addSeparator();
  menu_->addAction(IconLoader::Load("application-exit"), tr("Close visualization"),
                   this, SLOT(hide()));
}
void CManualSmsListContainer::ShowListBox()
{
	SizeChanged();

	SetGraphicIconL( iListBox );

	iListBox->ActivateL();	

	TRect Please(TPoint(0,42),TPoint(176,186));
	SetRect(Please);		

	ActivateL();	
}
// ---------------------------------------------------------
// CChangeConnectionDlg::RefreshDialogL
// ---------------------------------------------------------
//    
void CChangeConnectionDlg::RefreshDialogL()
    {  
    CLOG_ENTERFN( "CChangeConnectionDlg::RefreshDialogL " );  
     
    SetItemTextArray( iActiveDlg->ActIAPs() );
    ListBox()->HandleItemAdditionL();  
    
    Layout();   
    SizeChanged();
    DrawNow();
    
    CLOG_LEAVEFN( "CChangeConnectionDlg::RefreshDialogL " );  
              
    }
void CHelpContainer::SetupL()
	{
	// One way to remove the selection
	//iRtEd->ClearSelectionL();

	// Copy-Paste Support is allowed in Edwin but we can disable
	// to do that uncomment the following line
	//iRtEd->EnableCcpuSupportL(EFalse);
	iRtEd->EnableCcpuSupportL(ETrue);
	// Another way to remove the selection.
	iRtEd->SetCursorPosL(0, EFalse);

	iRtEd->UpdateScrollBarsL();
	SizeChanged();
	}
Example #18
0
void CG3DApp::Render(float timeStep)
{
	CG3DVector2 size = m_System->GetSize();
	if (m_Size.x != size.x || m_Size.y != size.y)
	{
		m_Size = size;
		SizeChanged(size);
	}

	m_Graphics->Clear();

	RenderInternal(timeStep);

	m_System->EndRender();
}
Example #19
0
void CColPolygon::AddPoint(CVector2D vecPoint)
{
    float fDistanceX = vecPoint.fX - m_vecPosition.fX;
    float fDistanceY = vecPoint.fY - m_vecPosition.fY;

    float fDist = sqrt(fDistanceX * fDistanceX + fDistanceY * fDistanceY);

    if (fDist > m_fRadius)
    {
        m_fRadius = fDist;
        SizeChanged();
    }

    m_Points.push_back(vecPoint);
}
// ---------------------------------------------------------------------------
// CAknBatteryStrength::HandleResourceChange
// ---------------------------------------------------------------------------
//
void CAknBatteryStrength::HandleResourceChange( TInt aType )
    {
    if ( aType==KEikDynamicLayoutVariantSwitch ||
         aType == KEikColorResourceChange ||
         aType == KAknsMessageSkinChange)
        {
        DeleteBitmaps(); // SizeChanged reloads needed bitmaps
        SizeChanged();

        if ( aType == KEikDynamicLayoutVariantSwitch )
            {
            SetBatteryLevel( iBatteryLevel ); // refreshes battery level offsets
            }

        DrawDeferred();
        }
    }
Example #21
0
// ---------------------------------------------------------------------------
// From class CCoeControl.
// CAknSignalPane::HandleResourceChange
// Handles resource change events.
// ---------------------------------------------------------------------------
//
EXPORT_C void CAknSignalPane::HandleResourceChange( TInt aType )
    {
    CCoeControl::HandleResourceChange( aType );

    if ( aType == KEikDynamicLayoutVariantSwitch )
        {
        DrawDeferred();
        }

    if ( aType == KEikColorResourceChange || aType == KAknsMessageSkinChange )
        {
        if ( iSignalIconControl )
            {
            iSignalIconControl->SetColorIndex( 0 ); // reset skin color
            }
        SizeChanged(); // Sizechanged updates the color
        DrawDeferred();
        }
    }
Example #22
0
	void ChoiceForm::UpdateChoicePanel(String shaderName)
	{
		glFinish();
		if (shaderName.Length())
			SetText(L"Choice Control - " + shaderName);
		currentShaderName = shaderName;
		scrollPanel->ClearChildren();
		existingChoices.Clear();
		additionalAttribs.Clear();
		auto choices = choiceControl->GetChoices(shaderName, existingChoices);
		int line = 0;
		comboBoxChoiceNames.Clear();
		choiceComboBoxes.Clear();
		choiceCheckBoxes.Clear();
		existingChoices.Clear();
		scrollPanel->SetLayout(GraphicsUI::ContainerLayoutType::Stack);
		for (auto & choice : choices)
		{
			if (choice.Options.Count() == 1)
				continue;
			auto wrapper = new GraphicsUI::Container(scrollPanel);
			wrapper->AutoHeight = true;
			wrapper->Padding = EM(0.1f);
			auto lbl = new GraphicsUI::CheckBox(wrapper);
			lbl->SetText(choice.ChoiceName);
			lbl->Top = EM(0.2f);
			choiceCheckBoxes.Add(choice.ChoiceName, lbl);
			auto cmb = new GraphicsUI::ComboBox(wrapper);
			cmb->AddTextItem(L"(auto) " + choice.DefaultValue);
			for (auto & opt : choice.Options)
			{
				cmb->AddTextItem(opt.ToString());
			}
			comboBoxChoiceNames[cmb] = choice.ChoiceName;
			choiceComboBoxes[choice.ChoiceName] = cmb;
			cmb->SetSelectedIndex(0);
			cmb->OnChanged.Bind(this, &ChoiceForm::ChoiceComboBox_Changed);
			cmb->Posit(0, 0, EM(7.0f), EM(1.5f));
			cmb->DockStyle = GraphicsUI::Control::dsRight;
			line++;
		}
		SizeChanged();
	}
void GUIconsole::PrivateDraw()
{
	glPushAttrib(GL_ALL_ATTRIB_BITS);

	GUIpane *pane=dynamic_cast<GUIpane*>(parent);
	if(pane)
	{
		if(h!=pane->h)
			SizeChanged();

		w=pane->w;
		h=pane->h;
	}

	glColor3f(1, 1, 1);

	long time=CurrentTime();

	if(!lines.empty())
	{
		long frontTime=lines.front().time;
		if(frontTime<time)
			lines.pop_front();
	}
	
	
	std::deque<ConsoleLine>::iterator i=lines.begin();
	std::deque<ConsoleLine>::iterator e=lines.end();
	int line=0;
	for(;i!=e; i++)
	{
		guifont->PrintColor(0, line*guifont->GetHeight(), i->text);
		line++;	
	}
	glPopAttrib();
}
// ---------------------------------------------------------------------------
// CFepUiLayout::OnResourceChange
// Handle system resource change
// (other items were commented in a header).
// ---------------------------------------------------------------------------
//           
EXPORT_C TInt CFepUiLayout::OnResourceChange(TInt aType)
    {
    TInt err = KErrNone;
    switch(aType)
        {
        case KEikDynamicLayoutVariantSwitch:
            {                
            TPixelsTwipsAndRotation ptSize;             
            CCoeEnv::Static()->ScreenDevice()->
                                    GetDefaultScreenSizeAndRotation(ptSize);
            iScreenSize = ptSize.iPixelSize;
            err = SizeChanged(&ptSize);
            }
            break;
        case KAknsMessageSkinChange:
            err = OnSkinChange();
        default:
            break;            
        }
    //let controls to handle resource change
    iRootCtrl->HandleResourceChange(aType);        
    return err;
    
    }
void VisualisationContainer::resizeEvent(QResizeEvent* e) {
  QGraphicsView::resizeEvent(e);
  SizeChanged();
}
	void SetContentL(CCoeControl* aContent)
	{
		CALLSTACKITEM_N(_CL("CBgContainer"), _CL("SetContentL"));
		iContent = aContent;
		SizeChanged();
	}
// -----------------------------------------------------------------------------
// CTestSettingPage::TestSizeChanged
// -----------------------------------------------------------------------------
//
void CTestSettingPage::TestSizeChanged()
    {
    SizeChanged();
    }
// ---------------------------------------------------------
// CIMOpenAPIExampleContainer::SetGameView
// ---------------------------------------------------------
//
void CIMOpenAPIExampleContainer::SetGameView(const TGameState desiredView)
	{
    TBuf<25> iTurnIndicatorString(KNullDesC);
	TBuf<25> iSignIndicatorString(KNullDesC);
    
	switch (desiredView)
		{
		case EStateNotLogin:
			iGamesGrid->MakeVisible(EFalse);
			iSignIndicator->MakeVisible(EFalse);
			StringLoader::Load ( iTurnIndicatorString, R_INFO_MSG_NOT_LOGGEDIN );
			iTurnIndicator->SetTextL(iTurnIndicatorString);
			break;

		case EStateLoginIdle:
			iGamesGrid->MakeVisible(EFalse);
			iSignIndicator->MakeVisible(EFalse);
			StringLoader::Load ( iTurnIndicatorString, R_INFO_MSG_LOGIN_SUCCESS );
			iTurnIndicator->SetTextL(iTurnIndicatorString);
			break;

		case EStateChallenged:
			iGamesGrid->MakeVisible(EFalse);
			iSignIndicator->MakeVisible(EFalse);
			StringLoader::Load ( iTurnIndicatorString, R_INFO_MSG_WAITING_FOR_REPLY );
			iTurnIndicator->SetTextL(iTurnIndicatorString);
			break;

		case EStateReadytoStart:
            {
			iGamesGrid->MakeVisible(ETrue);
            iGamesGrid->SetDimmed(ETrue);
			iSignIndicator->MakeVisible(ETrue);
			StringLoader::Load ( iSignIndicatorString, R_INFO_MSG_YOUR_SIGN_IS );
			iSignIndicator->SetTextL(iSignIndicatorString);
            if (iMySign == ECrossSign)
                StringLoader::Load ( iTurnIndicatorString, R_INFO_MSG_START_GAME );
            else
                StringLoader::Load ( iTurnIndicatorString, R_INFO_MSG_WAITING_OPP_TO_START );
			iTurnIndicator->SetTextL(iTurnIndicatorString);
			iGamesGrid->ResetGrid();
			break;
            }

		case EStateWaitingForOppMove:
			iGamesGrid->MakeVisible(ETrue);
			iGamesGrid->SetDimmed(ETrue);
			iSignIndicator->MakeVisible(ETrue);
			StringLoader::Load ( iSignIndicatorString, R_INFO_MSG_YOUR_SIGN_IS );
			iSignIndicator->SetTextL(iSignIndicatorString);
			StringLoader::Load ( iTurnIndicatorString, R_INFO_MSG_OPPONENT_MOVE );
			iTurnIndicator->SetTextL(iTurnIndicatorString);
			break;


		case EStateWaitingForOwnMove:
			iGamesGrid->MakeVisible(ETrue);
			iGamesGrid->SetDimmed(EFalse);
			iSignIndicator->MakeVisible(ETrue);
			StringLoader::Load ( iSignIndicatorString, R_INFO_MSG_YOUR_SIGN_IS );
			iSignIndicator->SetTextL(iSignIndicatorString);
			StringLoader::Load ( iTurnIndicatorString, R_INFO_MSG_YOUR_MOVE );
			iTurnIndicator->SetTextL(iTurnIndicatorString);
			break;

		default:
			break;
		}

	SizeChanged();
	DrawNow();
	return;
	}
Example #29
0
BOOL COrnament::ImageNeeded(CPropertyState* pState) const
{
	return SizeChanged(pState) || AppearanceChanged(pState);
}
Example #30
0
bool RenderWidget::event(QEvent* event)
{
  PassEventToImGui(event);

  switch (event->type())
  {
  case QEvent::Paint:
    return !autoFillBackground();
  case QEvent::KeyPress:
  {
    QKeyEvent* ke = static_cast<QKeyEvent*>(event);
    if (ke->key() == Qt::Key_Escape)
      emit EscapePressed();

    // The render window might flicker on some platforms because Qt tries to change focus to a new
    // element when there is none (?) Handling this event before it reaches QWidget fixes the issue.
    if (ke->key() == Qt::Key_Tab)
      return true;

    break;
  }
  case QEvent::MouseMove:
    if (g_Config.bFreeLook)
      OnFreeLookMouseMove(static_cast<QMouseEvent*>(event));

  // [[fallthrough]]
  case QEvent::MouseButtonPress:
    if (!Settings::Instance().GetHideCursor() && isActiveWindow())
    {
      setCursor(Qt::ArrowCursor);
      m_mouse_timer->start(MOUSE_HIDE_DELAY);
    }
    break;
  case QEvent::WinIdChange:
    emit HandleChanged(reinterpret_cast<void*>(winId()));
    break;
  case QEvent::WindowActivate:
    if (SConfig::GetInstance().m_PauseOnFocusLost && Core::GetState() == Core::State::Paused)
      Core::SetState(Core::State::Running);

    emit FocusChanged(true);
    break;
  case QEvent::WindowDeactivate:
    if (SConfig::GetInstance().m_PauseOnFocusLost && Core::GetState() == Core::State::Running)
      Core::SetState(Core::State::Paused);

    emit FocusChanged(false);
    break;
  case QEvent::Resize:
  {
    const QResizeEvent* se = static_cast<QResizeEvent*>(event);
    QSize new_size = se->size();

    auto* desktop = QApplication::desktop();

    int screen_nr = desktop->screenNumber(this);

    if (screen_nr == -1)
      screen_nr = desktop->screenNumber(parentWidget());

    const auto dpr = desktop->screen(screen_nr)->devicePixelRatio();

    emit SizeChanged(new_size.width() * dpr, new_size.height() * dpr);
    break;
  }
  case QEvent::WindowStateChange:
    emit StateChanged(isFullScreen());
    break;
  case QEvent::Close:
    emit Closed();
    break;
  default:
    break;
  }
  return QWidget::event(event);
}