bool JSResourceEditor::OnEvent(const TBWidgetEvent &ev)
{
    if (ev.type == EVENT_TYPE_SHORTCUT)
    {
        if (ev.ref_id == TBIDC("close"))
        {
            RequestClose();
        }
    }

    return false;
}
Exemplo n.º 2
0
bool CWaveDevice::CheckResult(MMRESULT result)
//--------------------------------------------
{
	if(result == MMSYSERR_NOERROR)
	{
		return true;
	}
	if(!m_Failed)
	{ // only show the first error
		m_Failed = true;
		WCHAR errortext[MAXERRORLENGTH + 1];
		MemsetZero(errortext);
		waveOutGetErrorTextW(result, errortext, MAXERRORLENGTH);
		SendDeviceMessage(LogError, mpt::format(MPT_USTRING("WaveOut error: 0x%1: %2"))(mpt::ufmt::hex0<8>(result), mpt::ToUnicode(errortext)));
	}
	RequestClose();
	return false;
}
    bool OnEvent(const TBWidgetEvent &ev)
    {
        if (ev.type == EVENT_TYPE_CLICK)
        {
            if (ev.target->GetID() == TBIDC("unsaved_modifications_dialog"))
            {
                if (ev.ref_id == TBIDC("dont_save"))
                {
                    container_->OnEvent(ev);
                    editor_->Close(container_->GetNumPages()>1);
                }
                else if (ev.ref_id == TBIDC("TBMessageWindow.cancel"))
                {
                    editor_->SendEvent(E_EDITORRESOURCECLOSECANCELED);
                    SetFocus(WIDGET_FOCUS_REASON_UNKNOWN);
                }
                else if (ev.ref_id == TBIDC("save"))
                {
                    editor_->Save();
                    container_->OnEvent(ev);
                    editor_->Close(container_->GetNumPages()>1);
                }
                return true;
            }
            else if (ev.target->GetID() == TBIDC("tabclose"))
            {
                if (RequestClose())
                {
                    container_->OnEvent(ev);
                }

                return true;
            }
            else
            {
                TBWidgetEvent nevent = ev;
                nevent.target = this;
                return container_->OnEvent(nevent);
            }
        }

        return false;
    }
Exemplo n.º 4
0
//-----------------------------------------------------------------------------
//!
//-----------------------------------------------------------------------------
tPageFluid::tPageFluid( tMfdUiFluidFactory& mfdUiFactory, tSiriusXmWeatherManager& siriusXmWeatherManager, QWidget* parent )
    : tPage( siriusXmWeatherManager, parent )
    , m_pStatusIcon(0)
    , m_PagesTimerID(0)
    , m_pHoldIndicator(0)
    , m_pPageOverlay(0)
    , m_pMenuButton(0)
    , m_PanelButtonPressed(false)
    , m_HasVideoPanel()
    , m_pControlBar(0)
    , m_pPrevPanel(0)
    , m_pCommandBarHideTimer(0)
    , m_pWinKeyTimer(0)
    , m_pSettingsMenuTimer(0)
    , m_pApBar(0)
    , m_ApBarVisible(false)
    , m_MfdUiFactory(mfdUiFactory)
{
    m_pStatusIcon = new tStatusIcon( this );
    m_pStatusIcon->hide();
    // this widget is positioned manually in LayoutChildren()

    m_pPageOverlay = new tPageOverlay( this );
    m_pPageOverlay->setVisible( tPagesSettings::Instance()->DataOverlayVisible() );
    Connect( tPagesSettings::Instance(), SIGNAL( DataOverlayVisibleChanged( bool ) ), m_pPageOverlay, SLOT( setVisible( bool ) ) );
    Connect( m_pPageOverlay, SIGNAL( ContextMenuRequest() ), this, SLOT( FocusOnCommandBar() ) );
    // this widget is positioned manually in LayoutChildren()

    // add the command bar
    
    // NSW-19831: We must initialise the command bar to NOT accept focus, otherwise it it can consume physical key presses
    // whilst actually being in touch mode, rendering physical keys temporarily unusable
    m_pCommandBar = new tCommandBar( false, this );
    
    m_pCommandBar->installEventFilter( this ); // For intercepting press-hold show/hide of the command bar.
    m_pMainLayout->addWidget( m_pCommandBar, 0, 2, eLR_MaxRows, 1 );
    Connect( m_pCommandBar, SIGNAL( ItemSizeChanged( QSize ) ), this, SLOT( ResizePanelButtons( QSize) ) );
    Connect( m_pCommandBar, SIGNAL( RequestClose() ), this, SLOT( ReturnFocusToPanel() ) );

    m_pMenuButton = new tPanelButton( Qt::AlignTop | Qt::AlignRight, this );
    m_pMenuButton->SetText( tr( "Menu" ) );
    m_pMenuButton->SetOverlayOnGL( true );
    m_pMenuButton->setIcon( style()->standardIcon( NIT(tNOSStyle::NIT_CommandBarMenu) ) );
    int iconWidth = ( font().pixelSize() * 3 ) / 2;
    QSize iconSize( iconWidth, iconWidth );
    m_pMenuButton->setIconSize( iconSize );
    m_pMenuButton->SetManualPositioning( true );
    m_pMenuButton->installEventFilter( this );
    m_pMenuButton->hide();
     
    m_pQuickActionButton = new tClearCursorButton( Qt::AlignTop | Qt::AlignRight, this );
    m_pQuickActionButton->SetOverlayOnGL( true );
    m_pQuickActionButton->installEventFilter(this);
    m_pQuickActionButton->hide();

    m_pControlBar = mfdUiFactory.ControlBar(this);
    m_pMainLayout->addWidget(m_pControlBar, eLR_Page, 0);
    AddCollateralPanel(m_pControlBar);

    Connect( m_pCommandBar, SIGNAL( RequestMinimise() ), this, SLOT( MinimiseCommandBar() ) );
    Connect( m_pMenuButton, SIGNAL( clicked() ), this, SLOT( RestoreCommandBar() ) );
    Connect( m_pPageOverlay, SIGNAL( ActionsChanged( QList< tAction* > ) ), m_pCommandBar, SLOT( SetActions( QList< tAction* > ) ) );

    setLayout( m_pMainLayout );
    
    Connect( m_pPageOverlay, SIGNAL( SelectedEvent( bool ) ), this, SLOT( OverlaySelected( bool ) ) );

    m_pCommandBarHideTimer = new QTimer(this);
    m_pCommandBarHideTimer->setInterval(2000);
    Connect( m_pCommandBarHideTimer, SIGNAL( timeout() ), this, SLOT( HideCommandBar() ) );

    Assert( tUiConfig::Instance()->MediaWidgetType() == tUiConfig::eMWT_AudioBar ); // Fluid should be using the media bar, rather than the media dialog

    if ( tProductSettings::Instance().AutopilotBarAllowed() && 
         tSystemSettings::Instance()->AutopilotEnabled() )
    {
        m_pApBar = new tAutopilotBar( tGlobal<tPilotManager>::Instance()->GetActivePilotController(), this);
        m_pApBar->adjustSize();
        m_pApBar->setSizePolicy( QSizePolicy::Preferred, QSizePolicy::Fixed );
        m_pApBar->hide();
        m_ApBarVisible = false;

        Connect( tAutopilotSettings::Instance(), SIGNAL( AutoHideOnStandbyChanged(bool) ), this, SLOT( UpdateAutopilotVisibility() ) );

        Connect( tGlobal<tPilotManager>::Instance(), SIGNAL( ActivePilotControllerChanged( tPilotController* ) ),
                 this, SLOT( UpdateAutopilotVisibility() ) );

        Connect( tGlobal<tPilotManager>::Instance(), SIGNAL( PilotModesChanged() ),
                 this, SLOT( UpdateAutopilotVisibility() ) );

        m_pMainLayout->addWidget( m_pApBar, eLR_AutopilotBar, 1 );
    }