mirror of https://github.com/PCSX2/pcsx2.git
wxGui branch: More improvements to CheckedStaticBox. It's mostly complete now, and I'll likely move on to implementing some new dialog boxes now.
git-svn-id: http://pcsx2.googlecode.com/svn/branches/wxgui@869 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
parent
5cfb4e6e49
commit
e79c1c3cd4
|
@ -94,7 +94,7 @@ struct LogSources
|
|||
VUMacro:1, // VU macro mode logs (pipelines)
|
||||
RPC:1,
|
||||
Counters:1, // EE's counters!
|
||||
|
||||
|
||||
IopMemory:1,
|
||||
IopHardware:1,
|
||||
IopBios:1,
|
||||
|
|
|
@ -0,0 +1,82 @@
|
|||
/* Pcsx2 - Pc Ps2 Emulator
|
||||
* Copyright (C) 2002-2009 Pcsx2 Team
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include "PrecompiledHeader.h"
|
||||
#include "CheckedStaticBox.h"
|
||||
|
||||
CheckedStaticBox::CheckedStaticBox( wxWindow* parent, int orientation, const wxString& title, int id ) :
|
||||
wxPanel( parent ),
|
||||
m_StaticBoxSizer( *new wxStaticBoxSizer( wxVERTICAL, this ) ),
|
||||
ThisToggle( *new wxCheckBox( this, id, title, wxPoint( 8, 1 ) ) ),
|
||||
ThisSizer( ( orientation != wxVERTICAL ) ? *new wxBoxSizer( orientation ) : m_StaticBoxSizer )
|
||||
{
|
||||
// Note on initializers above: Spacer required!
|
||||
// The checkbox uses more room than a standard group box label, so we need to insert some space
|
||||
// between the top of the groupbox and the first item. If the user is wanting a horizontal sizer
|
||||
// then we'll need to create a vertical sizer to act as a container for the spacer:
|
||||
|
||||
ThisToggle.SetSize( ThisToggle.GetSize() + wxSize( 8, 0 ) );
|
||||
|
||||
m_StaticBoxSizer.AddSpacer( 7 );
|
||||
SetSizer( &m_StaticBoxSizer );
|
||||
|
||||
if( &ThisSizer != &m_StaticBoxSizer )
|
||||
m_StaticBoxSizer.Add( &ThisSizer );
|
||||
|
||||
// Ensure that the right-side of the static group box isn't too cozy:
|
||||
m_StaticBoxSizer.SetMinSize( ThisToggle.GetSize() + wxSize( 22, 1 ) );
|
||||
}
|
||||
|
||||
// Adds a checkbox to this group panel's base sizer.
|
||||
// This is a helper function which saves some typographic red tape over using manual
|
||||
// checkbox creation and sizer appendage.
|
||||
wxCheckBox& CheckedStaticBox::AddCheckBox( const wxString& label, wxWindowID id )
|
||||
{
|
||||
return wxHelpers::AddCheckBoxTo( this, ThisSizer, label, id );
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
BEGIN_EVENT_TABLE(CheckedStaticBox, wxPanel)
|
||||
EVT_CHECKBOX(wxID_ANY, MainToggle_Click)
|
||||
END_EVENT_TABLE()
|
||||
|
||||
void CheckedStaticBox::MainToggle_Click( wxCommandEvent& evt )
|
||||
{
|
||||
SetValue( evt.IsChecked() );
|
||||
}
|
||||
|
||||
// Sets the main checkbox status, and enables/disables all child controls
|
||||
// bound to the StaticBox accordingly.
|
||||
void CheckedStaticBox::SetValue( bool val )
|
||||
{
|
||||
wxWindowList& list = GetChildren();
|
||||
|
||||
for( wxWindowList::iterator iter = list.begin(); iter != list.end(); ++iter)
|
||||
{
|
||||
wxWindow *current = *iter;
|
||||
if( current != &ThisToggle )
|
||||
current->Enable( val );
|
||||
}
|
||||
ThisToggle.SetValue( val );
|
||||
}
|
||||
|
||||
bool CheckedStaticBox::GetValue() const
|
||||
{
|
||||
return ThisToggle.GetValue();
|
||||
}
|
|
@ -0,0 +1,47 @@
|
|||
/* Pcsx2 - Pc Ps2 Emulator
|
||||
* Copyright (C) 2002-2009 Pcsx2 Team
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "wxHelpers.h"
|
||||
|
||||
class CheckedStaticBox : public wxPanel
|
||||
{
|
||||
protected:
|
||||
wxStaticBoxSizer& m_StaticBoxSizer;
|
||||
|
||||
public:
|
||||
wxBoxSizer& ThisSizer; // Boxsizer which holds all child items.
|
||||
wxCheckBox& ThisToggle; // toggle which can enable/disable all child controls
|
||||
|
||||
public:
|
||||
CheckedStaticBox( wxWindow* parent, int orientation, const wxString& title=wxEmptyString, int id=wxID_ANY );
|
||||
|
||||
void SetValue( bool val );
|
||||
bool GetValue() const;
|
||||
|
||||
wxCheckBox& AddCheckBox( const wxString& label, wxWindowID id=wxID_ANY );
|
||||
|
||||
protected:
|
||||
DECLARE_EVENT_TABLE();
|
||||
|
||||
public:
|
||||
// Event handler for click events for the main checkbox (default behavior: enables/disables all child controls)
|
||||
// This function can be overridden to implement custom handling of check enable/disable behavior.
|
||||
virtual void MainToggle_Click( wxCommandEvent& evt );
|
||||
};
|
|
@ -17,80 +17,111 @@
|
|||
*/
|
||||
|
||||
#include "PrecompiledHeader.h"
|
||||
#include "Misc.h"
|
||||
#include "DebugTools/Debug.h"
|
||||
#include "frmLogging.h"
|
||||
|
||||
#include <wx/statline.h>
|
||||
|
||||
|
||||
using namespace wxHelpers;
|
||||
|
||||
//wxString frmLogging::m_DisasmWarning( "\nWarning: Disasm dumps are incredibly slow, and generate extremely large logfiles." );
|
||||
|
||||
frmLogging::eeLogOptionsPanel::eeLogOptionsPanel( wxWindow* parent ) :
|
||||
CheckedStaticBox( parent, wxHORIZONTAL, "EE Logs" )
|
||||
void ConnectChildrenRecurse( wxWindow* parent, int eventType, wxObjectEventFunction handler )
|
||||
{
|
||||
wxStaticBoxSizer& eeDisasm = *new wxStaticBoxSizer( wxVERTICAL, this, _T("Disasm") );
|
||||
wxStaticBoxSizer& eeHw = *new wxStaticBoxSizer( wxVERTICAL, this, _T("Hardware") );
|
||||
|
||||
wxBoxSizer& eeStack = *new wxBoxSizer( wxVERTICAL );
|
||||
wxBoxSizer& eeMisc = *new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
//wxToolTip
|
||||
wxHelpers::AddCheckBox( this, eeDisasm,_T("Core"), EE_CPU_LOG );
|
||||
wxHelpers::AddCheckBox( this, eeDisasm,_T("Fpu"), EE_FPU_LOG );
|
||||
wxHelpers::AddCheckBox( this, eeDisasm,_T("VU0"), EE_VU0_LOG );
|
||||
wxHelpers::AddCheckBox( this, eeDisasm,_T("Cop0"), EE_COP0_LOG );
|
||||
wxHelpers::AddCheckBox( this, eeDisasm,_T("VU Macro"), EE_VU_MACRO_LOG );
|
||||
|
||||
wxHelpers::AddCheckBox( this, eeMisc, _T("Memory"), EE_MEM_LOG );
|
||||
wxHelpers::AddCheckBox( this, eeMisc, _T("Bios"), EE_BIOS_LOG );
|
||||
wxHelpers::AddCheckBox( this, eeMisc, _T("Elf"), EE_ELF_LOG );
|
||||
|
||||
wxHelpers::AddCheckBox( this, eeHw, _T("Registers"),EE_HW_LOG );
|
||||
wxHelpers::AddCheckBox( this, eeHw, _T("Dma"), EE_DMA_LOG );
|
||||
wxHelpers::AddCheckBox( this, eeHw, _T("Vif"), EE_VIF_LOG );
|
||||
wxHelpers::AddCheckBox( this, eeHw, _T("SPR"), EE_SPR_LOG );
|
||||
wxHelpers::AddCheckBox( this, eeHw, _T("GIF"), EE_GIF_LOG );
|
||||
wxHelpers::AddCheckBox( this, eeHw, _T("Sif"), EE_SIF_LOG );
|
||||
wxHelpers::AddCheckBox( this, eeHw, _T("IPU"), EE_IPU_LOG );
|
||||
wxHelpers::AddCheckBox( this, eeHw, _T("RPC"), EE_RPC_LOG );
|
||||
|
||||
// Sizer hierarchy:
|
||||
|
||||
eeStack.Add( &eeDisasm, stdSpacingFlags );
|
||||
eeStack.Add( &eeMisc );
|
||||
|
||||
BoxSizer.Add( &eeHw, stdSpacingFlags );
|
||||
BoxSizer.Add( &eeStack );
|
||||
|
||||
SetSizerAndFit( &BoxSizer, true );
|
||||
wxWindowList& list = parent->GetChildren();
|
||||
for( wxWindowList::iterator iter = list.begin(); iter != list.end(); ++iter)
|
||||
{
|
||||
wxWindow *current = *iter;
|
||||
ConnectChildrenRecurse( current, eventType, handler );
|
||||
parent->Connect( current->GetId(), eventType, handler );
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
frmLogging::eeLogOptionsPanel::eeLogOptionsPanel( wxWindow* parent ) :
|
||||
CheckedStaticBox( parent, wxHORIZONTAL, wxT( "EE Logs" ), LogID_EEBox )
|
||||
{
|
||||
wxBoxSizer& eeMisc = *new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
AddCheckBoxTo( this, eeMisc, wxT("Memory"), LogID_Memory );
|
||||
AddCheckBoxTo( this, eeMisc, wxT("Bios"), LogID_Bios );
|
||||
AddCheckBoxTo( this, eeMisc, wxT("Elf"), LogID_ELF );
|
||||
|
||||
wxBoxSizer& eeStack = *new wxBoxSizer( wxVERTICAL );
|
||||
eeStack.Add( new DisasmPanel( this ), stdSpacingFlags );
|
||||
eeStack.Add( &eeMisc );
|
||||
|
||||
ThisSizer.Add( new HwPanel( this ), stdSpacingFlags );
|
||||
ThisSizer.Add( &eeStack );
|
||||
|
||||
SetValue( true );
|
||||
Fit();
|
||||
}
|
||||
|
||||
frmLogging::eeLogOptionsPanel::DisasmPanel::DisasmPanel( wxWindow* parent ) :
|
||||
CheckedStaticBox( parent, wxVERTICAL, wxT( "Disasm" ), LogID_Disasm )
|
||||
{
|
||||
AddCheckBox( _T("Core"), LogID_CPU );
|
||||
AddCheckBox( _T("Fpu"), LogID_FPU );
|
||||
AddCheckBox( _T("VU0"), LogID_VU0 );
|
||||
AddCheckBox( _T("Cop0"), LogID_COP0 );
|
||||
AddCheckBox( _T("VU Macro"),LogID_VU_Macro );
|
||||
|
||||
SetValue( false );
|
||||
Fit();
|
||||
}
|
||||
|
||||
frmLogging::eeLogOptionsPanel::HwPanel::HwPanel( wxWindow* parent ) :
|
||||
CheckedStaticBox( parent, wxVERTICAL, wxT( "Hardware" ), LogID_Hardware )
|
||||
{
|
||||
AddCheckBox( _T("Registers"),LogID_Registers );
|
||||
AddCheckBox( _T("Dma"), LogID_DMA );
|
||||
AddCheckBox( _T("Vif"), LogID_VIF );
|
||||
AddCheckBox( _T("SPR"), LogID_SPR );
|
||||
AddCheckBox( _T("GIF"), LogID_GIF );
|
||||
AddCheckBox( _T("Sif"), LogID_SIF );
|
||||
AddCheckBox( _T("IPU"), LogID_IPU );
|
||||
AddCheckBox( _T("RPC"), LogID_RPC );
|
||||
|
||||
SetValue( false );
|
||||
Fit();
|
||||
}
|
||||
|
||||
void frmLogging::eeLogOptionsPanel::OnLogChecked(wxCommandEvent &event)
|
||||
{
|
||||
LogChecks checkId = (LogChecks)(int)event.m_callbackUserData;
|
||||
//ToggleLogOption( checkId );
|
||||
event.Skip();
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
frmLogging::iopLogOptionsPanel::iopLogOptionsPanel( wxWindow* parent ) :
|
||||
CheckedStaticBox( parent, wxVERTICAL, wxT( "IOP Logs" ), LogID_IopBox )
|
||||
{
|
||||
AddCheckBox( _T("Disasm"), LogID_Disasm);
|
||||
AddCheckBox( _T("Memory"), LogID_Memory );
|
||||
AddCheckBox( _T("Bios"), LogID_Bios );
|
||||
AddCheckBox( _T("Registers"), LogID_Hardware );
|
||||
AddCheckBox( _T("Dma"), LogID_DMA );
|
||||
AddCheckBox( _T("Pad"), LogID_Pad );
|
||||
AddCheckBox( _T("Cdrom"), LogID_Cdrom );
|
||||
AddCheckBox( _T("GPU (PSX)"), LogID_GPU );
|
||||
|
||||
SetValue( true );
|
||||
Fit();
|
||||
};
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
frmLogging::frmLogging(wxWindow* parent, int id, const wxPoint& pos, const wxSize& size):
|
||||
wxDialogWithHelpers( parent, id, _T("Logging"), true, pos, size )
|
||||
{
|
||||
int i;
|
||||
|
||||
//wxStaticBoxSizer& eeBox = *new wxStaticBoxSizer( wxHORIZONTAL, this );
|
||||
|
||||
eeLogOptionsPanel& eeBox = *new eeLogOptionsPanel( this );
|
||||
|
||||
wxStaticBoxSizer& iopSizer = *new wxStaticBoxSizer( wxVERTICAL, this, _T("IOP Logs") );
|
||||
iopLogOptionsPanel& iopSizer = *new iopLogOptionsPanel( this );
|
||||
|
||||
AddCheckBox( iopSizer, _T("Disasm"), IOP_IOP_LOG );
|
||||
AddCheckBox( iopSizer, _T("Memory"), IOP_MEM_LOG );
|
||||
AddCheckBox( iopSizer, _T("Bios"), IOP_BIOS_LOG );
|
||||
AddCheckBox( iopSizer, _T("Registers"), IOP_HW_LOG);
|
||||
AddCheckBox( iopSizer, _T("Dma"), IOP_DMA_LOG );
|
||||
AddCheckBox( iopSizer, _T("Pad"), IOP_PAD_LOG );
|
||||
AddCheckBox( iopSizer, _T("Cdrom"), IOP_CDR_LOG );
|
||||
AddCheckBox( iopSizer, _T("GPU (PSX)"), IOP_GPU_LOG );
|
||||
|
||||
wxStaticBoxSizer& miscSizer = *new wxStaticBoxSizer( wxHORIZONTAL, this, _T("Misc") );
|
||||
AddCheckBox( miscSizer, _T("Log to STDOUT"), STDOUT_LOG );
|
||||
AddCheckBox( miscSizer, _T("SYMs Log"), SYMS_LOG );
|
||||
wxStaticBoxSizer& miscSizer = *new wxStaticBoxSizer( wxHORIZONTAL, this, _T("Misc") );
|
||||
AddCheckBox( miscSizer, _T("Log to STDOUT"), LogID_StdOut );
|
||||
AddCheckBox( miscSizer, _T("SYMs Log"), LogID_Symbols );
|
||||
|
||||
wxBoxSizer& mainsizer = *new wxBoxSizer( wxVERTICAL );
|
||||
wxBoxSizer& topSizer = *new wxBoxSizer( wxHORIZONTAL );
|
||||
|
@ -105,17 +136,22 @@ frmLogging::frmLogging(wxWindow* parent, int id, const wxPoint& pos, const wxSiz
|
|||
|
||||
SetSizerAndFit( &mainsizer, true );
|
||||
|
||||
// Connect all the checkboxes to one function, and pass the checkbox id as user data.
|
||||
// (user data pointer isn't actually a pointer, but instead just the checkbox id)
|
||||
for (i = EE_CPU_LOG; i >= SYMS_LOG; i++)
|
||||
Connect( i, wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler(frmLogging::LogChecked), (wxObject*)i );
|
||||
ConnectChildrenRecurse( this, wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler(frmLogging::LogChecked) );
|
||||
}
|
||||
|
||||
|
||||
void frmLogging::LogChecked(wxCommandEvent &event)
|
||||
void frmLogging::LogChecked(wxCommandEvent &evt)
|
||||
{
|
||||
int checkId = (int)event.m_callbackUserData;
|
||||
event.Skip();
|
||||
// Anything going here should be a checkbox, unless non-checkbox controls send CheckBox_Clicked commands
|
||||
// (which would seem bad).
|
||||
wxCheckBox* checker = wxStaticCast( evt.GetEventObject(), wxCheckBox );
|
||||
|
||||
switch( checker->GetId() )
|
||||
{
|
||||
// [TODO] : Implement me!
|
||||
}
|
||||
|
||||
evt.Skip();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -15,13 +15,14 @@
|
|||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <wx/wx.h>
|
||||
#include <wx/image.h>
|
||||
|
||||
#include "wxHelpers.h"
|
||||
|
||||
#pragma once
|
||||
#include "CheckedStaticBox.h"
|
||||
|
||||
class frmLogging: public wxDialogWithHelpers
|
||||
{
|
||||
|
@ -29,42 +30,86 @@ public:
|
|||
frmLogging( wxWindow* parent, int id, const wxPoint& pos=wxDefaultPosition, const wxSize& size=wxDefaultSize );
|
||||
|
||||
protected:
|
||||
enum LogChecks
|
||||
{
|
||||
LogID_StdOut = 100,
|
||||
LogID_Symbols
|
||||
};
|
||||
|
||||
enum {
|
||||
EE_CPU_LOG = 100,
|
||||
EE_MEM_LOG,
|
||||
EE_HW_LOG,
|
||||
EE_DMA_LOG,
|
||||
EE_BIOS_LOG,
|
||||
EE_ELF_LOG,
|
||||
EE_FPU_LOG,
|
||||
EE_VU0_LOG,
|
||||
EE_COP0_LOG,
|
||||
EE_VIF_LOG,
|
||||
EE_SPR_LOG,
|
||||
EE_GIF_LOG,
|
||||
EE_SIF_LOG,
|
||||
EE_IPU_LOG,
|
||||
EE_VU_MACRO_LOG,
|
||||
EE_RPC_LOG,
|
||||
/////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
class iopLogOptionsPanel : public CheckedStaticBox
|
||||
{
|
||||
protected:
|
||||
enum LogCheckIDs
|
||||
{
|
||||
LogID_IopBox = 100,
|
||||
LogID_Disasm,
|
||||
LogID_Memory,
|
||||
LogID_Hardware,
|
||||
LogID_Bios,
|
||||
LogID_DMA,
|
||||
LogID_Pad,
|
||||
LogID_Cdrom,
|
||||
LogID_GPU
|
||||
};
|
||||
|
||||
IOP_IOP_LOG,
|
||||
IOP_MEM_LOG,
|
||||
IOP_HW_LOG,
|
||||
IOP_BIOS_LOG,
|
||||
IOP_DMA_LOG,
|
||||
IOP_PAD_LOG,
|
||||
IOP_CDR_LOG,
|
||||
IOP_GPU_LOG,
|
||||
|
||||
STDOUT_LOG,
|
||||
SYMS_LOG
|
||||
} LogChecks;
|
||||
public:
|
||||
iopLogOptionsPanel( wxWindow* parent );
|
||||
void OnLogChecked(wxCommandEvent &event);
|
||||
|
||||
};
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
class eeLogOptionsPanel : public CheckedStaticBox
|
||||
{
|
||||
protected:
|
||||
enum LogCheckIDs
|
||||
{
|
||||
// Group boxes and misc logs
|
||||
LogID_EEBox = 100,
|
||||
LogID_Disasm,
|
||||
LogID_Hardware,
|
||||
LogID_Memory,
|
||||
LogID_Bios,
|
||||
LogID_ELF,
|
||||
|
||||
// Disasm section
|
||||
LogID_CPU = 200,
|
||||
LogID_FPU,
|
||||
LogID_VU0,
|
||||
LogID_COP0,
|
||||
LogID_VU_Macro,
|
||||
|
||||
LogID_Registers = 300,
|
||||
LogID_DMA,
|
||||
LogID_VIF,
|
||||
LogID_SPR,
|
||||
LogID_GIF,
|
||||
LogID_SIF,
|
||||
LogID_IPU,
|
||||
LogID_RPC
|
||||
};
|
||||
|
||||
public:
|
||||
eeLogOptionsPanel( wxWindow* parent );
|
||||
void OnLogChecked(wxCommandEvent &event);
|
||||
|
||||
protected:
|
||||
class DisasmPanel : public CheckedStaticBox
|
||||
{
|
||||
public:
|
||||
DisasmPanel( wxWindow* parent );
|
||||
void OnLogChecked(wxCommandEvent &event);
|
||||
};
|
||||
|
||||
class HwPanel : public CheckedStaticBox
|
||||
{
|
||||
public:
|
||||
HwPanel( wxWindow* parent );
|
||||
void OnLogChecked(wxCommandEvent &event);
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -1,7 +1,22 @@
|
|||
/* Pcsx2 - Pc Ps2 Emulator
|
||||
* Copyright (C) 2002-2009 Pcsx2 Team
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include "PrecompiledHeader.h"
|
||||
|
||||
#include <wx/wx.h>
|
||||
#include "wxHelpers.h"
|
||||
|
||||
#include <wx/cshelp.h>
|
||||
|
@ -17,7 +32,7 @@ namespace wxHelpers
|
|||
wxSizerFlags stdButtonSizerFlags( wxSizerFlags().Align(wxALIGN_RIGHT).Border() );
|
||||
wxSizerFlags CheckboxFlags( wxSizerFlags().Border( wxALL, 6 ).Expand() );
|
||||
|
||||
wxCheckBox& AddCheckBox( wxWindow* parent, wxBoxSizer& sizer, const wxString& label, wxWindowID id )
|
||||
wxCheckBox& AddCheckBoxTo( wxWindow* parent, wxBoxSizer& sizer, const wxString& label, wxWindowID id )
|
||||
{
|
||||
wxCheckBox* retval = new wxCheckBox( parent, id, label );
|
||||
sizer.Add( retval, CheckboxFlags );
|
||||
|
@ -25,51 +40,8 @@ namespace wxHelpers
|
|||
}
|
||||
}
|
||||
|
||||
CheckedStaticBox::CheckedStaticBox( wxWindow* parent, int orientation, const wxString& title=wxEmptyString ) :
|
||||
wxPanel( parent ),
|
||||
BoxSizer( *new wxStaticBoxSizer( orientation, this ) ),
|
||||
MainToggle( *new wxCheckBox( this, wxID_ANY, title, wxPoint( 8, 1 ) ) )
|
||||
{
|
||||
MainToggle.SetSize( MainToggle.GetSize() + wxSize( 8, 0 ) );
|
||||
|
||||
//Connect( 100, wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( CheckedStaticBox::OnMainToggleEvent ), (wxObject*)this );
|
||||
}
|
||||
|
||||
BEGIN_EVENT_TABLE(CheckedStaticBox, wxPanel)
|
||||
EVT_CHECKBOX(wxID_ANY, MainToggle_Click)
|
||||
END_EVENT_TABLE()
|
||||
|
||||
void CheckedStaticBox::MainToggle_Click( wxCommandEvent& evt )
|
||||
{
|
||||
SetValue( evt.IsChecked() );
|
||||
}
|
||||
|
||||
// Sets the main checkbox status, and enables/disables all child controls
|
||||
// bound to the StaticBox accordingly.
|
||||
void CheckedStaticBox::SetValue( bool val )
|
||||
{
|
||||
wxWindowList& list = GetChildren();
|
||||
|
||||
for( wxWindowList::iterator iter = list.begin(); iter != list.end(); ++iter)
|
||||
{
|
||||
wxWindow *current = *iter;
|
||||
if( current != &MainToggle )
|
||||
current->Enable( val );
|
||||
}
|
||||
//MainToggle.Enable();
|
||||
MainToggle.SetValue( val );
|
||||
}
|
||||
|
||||
bool CheckedStaticBox::GetValue() const
|
||||
{
|
||||
return MainToggle.GetValue();
|
||||
}
|
||||
|
||||
wxCheckBox& wxDialogWithHelpers::AddCheckBox( wxBoxSizer& sizer, const wxString& label, wxWindowID id )
|
||||
{
|
||||
return wxHelpers::AddCheckBox( this, sizer, label, id );
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
wxDialogWithHelpers::wxDialogWithHelpers( wxWindow* parent, int id, const wxString& title, bool hasContextHelp, const wxPoint& pos, const wxSize& size ) :
|
||||
wxDialog( parent, id, title, pos, size ),
|
||||
m_hasContextHelp( hasContextHelp )
|
||||
|
@ -78,6 +50,11 @@ wxDialogWithHelpers::wxDialogWithHelpers( wxWindow* parent, int id, const wxStr
|
|||
wxHelpProvider::Set( new wxSimpleHelpProvider() );
|
||||
}
|
||||
|
||||
wxCheckBox& wxDialogWithHelpers::AddCheckBox( wxBoxSizer& sizer, const wxString& label, wxWindowID id )
|
||||
{
|
||||
return wxHelpers::AddCheckBoxTo( this, sizer, label, id );
|
||||
}
|
||||
|
||||
void wxDialogWithHelpers::AddOkCancel( wxBoxSizer &sizer )
|
||||
{
|
||||
wxBoxSizer* buttonSizer = &sizer;
|
||||
|
|
|
@ -1,10 +1,12 @@
|
|||
#pragma once
|
||||
|
||||
#include <wx/wx.h>
|
||||
|
||||
namespace wxHelpers
|
||||
{
|
||||
// Creates a new checkbox and adds it to the specified sizer/parent combo.
|
||||
// Uses the default spacer setting for adding checkboxes.
|
||||
extern wxCheckBox& AddCheckBox( wxWindow* parent, wxBoxSizer& sizer, const wxString& label, wxWindowID id=wxID_ANY );
|
||||
extern wxCheckBox& AddCheckBoxTo( wxWindow* parent, wxBoxSizer& sizer, const wxString& label, wxWindowID id=wxID_ANY );
|
||||
|
||||
extern wxSizerFlags stdCenteredFlags;
|
||||
extern wxSizerFlags stdSpacingFlags;
|
||||
|
@ -17,26 +19,6 @@ namespace wxHelpers
|
|||
extern wxSizerFlags CheckboxFlags;
|
||||
}
|
||||
|
||||
class CheckedStaticBox : public wxPanel
|
||||
{
|
||||
public:
|
||||
wxStaticBoxSizer& BoxSizer; // Boxsizer which olds all child items.
|
||||
wxCheckBox& MainToggle; // toggle which can enable/disable all child controls
|
||||
|
||||
public:
|
||||
CheckedStaticBox( wxWindow* parent, int orientation, const wxString& title );
|
||||
|
||||
//virtual bool Layout();
|
||||
void SetValue( bool val );
|
||||
bool GetValue() const;
|
||||
|
||||
protected:
|
||||
DECLARE_EVENT_TABLE();
|
||||
|
||||
public:
|
||||
void MainToggle_Click( wxCommandEvent& evt );
|
||||
};
|
||||
|
||||
class wxDialogWithHelpers : public wxDialog
|
||||
{
|
||||
protected:
|
||||
|
|
|
@ -2904,6 +2904,14 @@
|
|||
<Filter
|
||||
Name="NewGUI"
|
||||
>
|
||||
<File
|
||||
RelativePath="..\..\NewGUI\CheckedStaticBox.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\NewGUI\CheckedStaticBox.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\NewGUI\frmGameFixes.cpp"
|
||||
>
|
||||
|
|
Loading…
Reference in New Issue