mirror of
https://github.com/libretro/pcsx2.git
synced 2025-02-22 18:41:04 +00:00
Fix the apply button not graying out anymore like it used to.
This is a patch from Jake. git-svn-id: http://pcsx2.googlecode.com/svn/trunk@4236 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
parent
5071456d53
commit
3d6ac25f3c
@ -109,7 +109,6 @@ void IEventListener_AppStatus::DispatchEvent( const AppEventInfo& evtinfo )
|
|||||||
AppStatusEvent_OnSettingsApplied();
|
AppStatusEvent_OnSettingsApplied();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
case AppStatus_Exiting:
|
case AppStatus_Exiting:
|
||||||
AppStatusEvent_OnExit();
|
AppStatusEvent_OnExit();
|
||||||
break;
|
break;
|
||||||
|
@ -42,6 +42,54 @@ using namespace Panels;
|
|||||||
static const int s_orient = wxBK_LEFT;
|
static const int s_orient = wxBK_LEFT;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
class ScopedOkButtonDisabler
|
||||||
|
{
|
||||||
|
protected:
|
||||||
|
Dialogs::BaseConfigurationDialog* m_parent;
|
||||||
|
|
||||||
|
wxWindow* m_apply;
|
||||||
|
wxWindow* m_ok;
|
||||||
|
wxWindow* m_cancel;
|
||||||
|
|
||||||
|
public:
|
||||||
|
ScopedOkButtonDisabler( Dialogs::BaseConfigurationDialog* parent )
|
||||||
|
{
|
||||||
|
m_parent = parent;
|
||||||
|
m_parent->AllowApplyActivation( false );
|
||||||
|
|
||||||
|
m_apply = m_parent->FindWindow( wxID_APPLY );
|
||||||
|
m_ok = m_parent->FindWindow( wxID_OK );
|
||||||
|
m_cancel = m_parent->FindWindow( wxID_CANCEL );
|
||||||
|
|
||||||
|
if (m_apply) m_apply ->Disable();
|
||||||
|
if (m_ok) m_ok ->Disable();
|
||||||
|
if (m_cancel) m_cancel->Disable();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Use this to prevent the Apply button from being re-enabled.
|
||||||
|
void DetachApply()
|
||||||
|
{
|
||||||
|
m_apply = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
void DetachAll()
|
||||||
|
{
|
||||||
|
m_apply = m_ok = m_cancel = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual ~ScopedOkButtonDisabler() throw()
|
||||||
|
{
|
||||||
|
if (m_apply) m_apply ->Enable();
|
||||||
|
if (m_ok) m_ok ->Enable();
|
||||||
|
if (m_cancel) m_cancel->Enable();
|
||||||
|
|
||||||
|
m_parent->AllowApplyActivation( true );
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// --------------------------------------------------------------------------------------
|
||||||
|
// BaseApplicableDialog (implementations)
|
||||||
|
// --------------------------------------------------------------------------------------
|
||||||
IMPLEMENT_DYNAMIC_CLASS(BaseApplicableDialog, wxDialogWithHelpers)
|
IMPLEMENT_DYNAMIC_CLASS(BaseApplicableDialog, wxDialogWithHelpers)
|
||||||
|
|
||||||
BaseApplicableDialog::BaseApplicableDialog( wxWindow* parent, const wxString& title, const pxDialogCreationFlags& cflags )
|
BaseApplicableDialog::BaseApplicableDialog( wxWindow* parent, const wxString& title, const pxDialogCreationFlags& cflags )
|
||||||
@ -86,7 +134,8 @@ Dialogs::BaseConfigurationDialog::BaseConfigurationDialog( wxWindow* parent, con
|
|||||||
: _parent( parent, title )
|
: _parent( parent, title )
|
||||||
{
|
{
|
||||||
SetMinWidth( idealWidth );
|
SetMinWidth( idealWidth );
|
||||||
m_listbook = NULL;
|
m_listbook = NULL;
|
||||||
|
m_allowApplyActivation = true;
|
||||||
|
|
||||||
Connect( wxID_OK, wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( BaseConfigurationDialog::OnOk_Click ) );
|
Connect( wxID_OK, wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( BaseConfigurationDialog::OnOk_Click ) );
|
||||||
Connect( wxID_CANCEL, wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( BaseConfigurationDialog::OnCancel_Click ) );
|
Connect( wxID_CANCEL, wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( BaseConfigurationDialog::OnCancel_Click ) );
|
||||||
@ -170,7 +219,8 @@ void Dialogs::BaseConfigurationDialog::SomethingChanged()
|
|||||||
void Dialogs::BaseConfigurationDialog::OnSomethingChanged( wxCommandEvent& evt )
|
void Dialogs::BaseConfigurationDialog::OnSomethingChanged( wxCommandEvent& evt )
|
||||||
{
|
{
|
||||||
evt.Skip();
|
evt.Skip();
|
||||||
if( (evt.GetId() != wxID_OK) && (evt.GetId() != wxID_CANCEL) && (evt.GetId() != wxID_APPLY) )
|
if (!m_allowApplyActivation) return;
|
||||||
|
if ((evt.GetId() != wxID_OK) && (evt.GetId() != wxID_CANCEL) && (evt.GetId() != wxID_APPLY))
|
||||||
SomethingChanged();
|
SomethingChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -181,44 +231,11 @@ void Dialogs::BaseConfigurationDialog::OnCloseWindow( wxCloseEvent& evt )
|
|||||||
evt.Skip();
|
evt.Skip();
|
||||||
}
|
}
|
||||||
|
|
||||||
class ScopedOkButtonDisabler
|
|
||||||
|
void Dialogs::BaseConfigurationDialog::AllowApplyActivation( bool allow )
|
||||||
{
|
{
|
||||||
protected:
|
m_allowApplyActivation = allow;
|
||||||
wxWindow* m_apply;
|
}
|
||||||
wxWindow* m_ok;
|
|
||||||
wxWindow* m_cancel;
|
|
||||||
|
|
||||||
public:
|
|
||||||
ScopedOkButtonDisabler( wxWindow* parent )
|
|
||||||
{
|
|
||||||
m_apply = parent->FindWindow( wxID_APPLY );
|
|
||||||
m_ok = parent->FindWindow( wxID_OK );
|
|
||||||
m_cancel = parent->FindWindow( wxID_CANCEL );
|
|
||||||
|
|
||||||
if (m_apply) m_apply ->Disable();
|
|
||||||
if (m_ok) m_ok ->Disable();
|
|
||||||
if (m_cancel) m_cancel->Disable();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Use this to prevent the Apply buton from being re-enabled.
|
|
||||||
//avih: Does this work?? As far as I know Apply is always enabled...
|
|
||||||
void DetachApply()
|
|
||||||
{
|
|
||||||
m_apply = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
void DetachAll()
|
|
||||||
{
|
|
||||||
m_apply = m_ok = m_cancel = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual ~ScopedOkButtonDisabler() throw()
|
|
||||||
{
|
|
||||||
if (m_apply) m_apply ->Enable();
|
|
||||||
if (m_ok) m_ok ->Enable();
|
|
||||||
if (m_cancel) m_cancel->Enable();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
void Dialogs::BaseConfigurationDialog::OnOk_Click( wxCommandEvent& evt )
|
void Dialogs::BaseConfigurationDialog::OnOk_Click( wxCommandEvent& evt )
|
||||||
{
|
{
|
||||||
|
@ -44,6 +44,7 @@ namespace Dialogs
|
|||||||
protected:
|
protected:
|
||||||
wxListbook* m_listbook;
|
wxListbook* m_listbook;
|
||||||
wxArrayString m_labels;
|
wxArrayString m_labels;
|
||||||
|
bool m_allowApplyActivation;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
virtual ~BaseConfigurationDialog() throw();
|
virtual ~BaseConfigurationDialog() throw();
|
||||||
@ -59,6 +60,8 @@ namespace Dialogs
|
|||||||
template< typename T >
|
template< typename T >
|
||||||
void AddPage( const wxChar* label, int iconid );
|
void AddPage( const wxChar* label, int iconid );
|
||||||
|
|
||||||
|
void AllowApplyActivation( bool allow=true );
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void OnSettingsApplied( wxCommandEvent& evt );
|
void OnSettingsApplied( wxCommandEvent& evt );
|
||||||
|
|
||||||
|
@ -199,12 +199,12 @@ void BaseApplicableConfigPanel::OnSettingsApplied( wxCommandEvent& evt )
|
|||||||
void BaseApplicableConfigPanel::AppStatusEvent_OnSettingsApplied() {}
|
void BaseApplicableConfigPanel::AppStatusEvent_OnSettingsApplied() {}
|
||||||
|
|
||||||
BaseApplicableConfigPanel_SpecificConfig::BaseApplicableConfigPanel_SpecificConfig(wxWindow* parent, wxOrientation orient)
|
BaseApplicableConfigPanel_SpecificConfig::BaseApplicableConfigPanel_SpecificConfig(wxWindow* parent, wxOrientation orient)
|
||||||
: BaseApplicableConfigPanel( parent, orient)
|
: BaseApplicableConfigPanel( parent, orient )
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
BaseApplicableConfigPanel_SpecificConfig::BaseApplicableConfigPanel_SpecificConfig(wxWindow* parent, wxOrientation orient, const wxString& staticLabel )
|
BaseApplicableConfigPanel_SpecificConfig::BaseApplicableConfigPanel_SpecificConfig(wxWindow* parent, wxOrientation orient, const wxString& staticLabel )
|
||||||
: BaseApplicableConfigPanel( parent, orient, staticLabel)
|
: BaseApplicableConfigPanel( parent, orient, staticLabel )
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user