RegisterAdditionalEditors() to work even if no wxPropertyGrids created, in sample moved editor registration before first CreateGrid() call to prevent crash, removed wxPG_USE_WXMODULE support
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@55953 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -2069,6 +2069,13 @@ FormMain::FormMain(const wxString& title, const wxPoint& pos, const wxSize& size
|
|||||||
wxInitAllImageHandlers();
|
wxInitAllImageHandlers();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// Register all editors (SpinCtrl etc.)
|
||||||
|
m_pPropGridManager->RegisterAdditionalEditors();
|
||||||
|
|
||||||
|
// Register our sample custom editors
|
||||||
|
m_pSampleMultiButtonEditor =
|
||||||
|
wxPropertyGrid::RegisterEditorClass(new wxSampleMultiButtonEditor());
|
||||||
|
|
||||||
CreateGrid( // style
|
CreateGrid( // style
|
||||||
wxPG_BOLD_MODIFIED |
|
wxPG_BOLD_MODIFIED |
|
||||||
wxPG_SPLITTER_AUTO_CENTER |
|
wxPG_SPLITTER_AUTO_CENTER |
|
||||||
@@ -2088,13 +2095,6 @@ FormMain::FormMain(const wxString& title, const wxPoint& pos, const wxSize& size
|
|||||||
//| wxPG_EX_HELP_AS_TOOLTIPS
|
//| wxPG_EX_HELP_AS_TOOLTIPS
|
||||||
);
|
);
|
||||||
|
|
||||||
// Register all editors (SpinCtrl etc.)
|
|
||||||
m_pPropGridManager->RegisterAdditionalEditors();
|
|
||||||
|
|
||||||
// Register our sample custom editors
|
|
||||||
m_pSampleMultiButtonEditor =
|
|
||||||
wxPropertyGrid::RegisterEditorClass(new wxSampleMultiButtonEditor());
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Create menubar
|
// Create menubar
|
||||||
wxMenu *menuFile = new wxMenu(wxEmptyString, wxMENU_TEAROFF);
|
wxMenu *menuFile = new wxMenu(wxEmptyString, wxMENU_TEAROFF);
|
||||||
|
@@ -1993,6 +1993,10 @@ void wxPropertyGridInterface::InitAllTypeHandlers()
|
|||||||
|
|
||||||
void wxPropertyGridInterface::RegisterAdditionalEditors()
|
void wxPropertyGridInterface::RegisterAdditionalEditors()
|
||||||
{
|
{
|
||||||
|
// Register editor classes, if necessary.
|
||||||
|
if ( wxPGGlobalVars->m_mapEditorClasses.empty() )
|
||||||
|
wxPropertyGrid::RegisterDefaultEditors();
|
||||||
|
|
||||||
#if wxUSE_SPINBTN
|
#if wxUSE_SPINBTN
|
||||||
wxPGRegisterEditorClass(SpinCtrl);
|
wxPGRegisterEditorClass(SpinCtrl);
|
||||||
#endif
|
#endif
|
||||||
|
@@ -138,17 +138,8 @@ const wxChar *wxPropertyGridNameStr = wxT("wxPropertyGrid");
|
|||||||
|
|
||||||
// -----------------------------------------------------------------------
|
// -----------------------------------------------------------------------
|
||||||
// Statics in one class for easy destruction.
|
// Statics in one class for easy destruction.
|
||||||
// NB: We prefer to use wxModule, as it offers more consistent behavior
|
|
||||||
// across platforms. However, for those rare problem situations, we
|
|
||||||
// also need to offer option to use simpler approach.
|
|
||||||
// -----------------------------------------------------------------------
|
// -----------------------------------------------------------------------
|
||||||
|
|
||||||
#ifndef wxPG_USE_WXMODULE
|
|
||||||
#define wxPG_USE_WXMODULE 1
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if wxPG_USE_WXMODULE
|
|
||||||
|
|
||||||
#include <wx/module.h>
|
#include <wx/module.h>
|
||||||
|
|
||||||
class wxPGGlobalVarsClassManager : public wxModule
|
class wxPGGlobalVarsClassManager : public wxModule
|
||||||
@@ -162,19 +153,6 @@ public:
|
|||||||
|
|
||||||
IMPLEMENT_DYNAMIC_CLASS(wxPGGlobalVarsClassManager, wxModule)
|
IMPLEMENT_DYNAMIC_CLASS(wxPGGlobalVarsClassManager, wxModule)
|
||||||
|
|
||||||
#else // !wxPG_USE_WXMODULE
|
|
||||||
|
|
||||||
class wxPGGlobalVarsClassManager
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
wxPGGlobalVarsClassManager() {}
|
|
||||||
~wxPGGlobalVarsClassManager() { delete wxPGGlobalVars; }
|
|
||||||
};
|
|
||||||
|
|
||||||
static wxPGGlobalVarsClassManager gs_pgGlobalVarsClassManager;
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
wxPGGlobalVarsClass* wxPGGlobalVars = (wxPGGlobalVarsClass*) NULL;
|
wxPGGlobalVarsClass* wxPGGlobalVars = (wxPGGlobalVarsClass*) NULL;
|
||||||
|
|
||||||
@@ -249,6 +227,10 @@ wxPGGlobalVarsClass::~wxPGGlobalVarsClass()
|
|||||||
delete wxPGProperty::sm_wxPG_LABEL;
|
delete wxPGProperty::sm_wxPG_LABEL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void wxPropertyGridInitGlobalsIfNeeded()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
// -----------------------------------------------------------------------
|
// -----------------------------------------------------------------------
|
||||||
// wxPGBrush
|
// wxPGBrush
|
||||||
// -----------------------------------------------------------------------
|
// -----------------------------------------------------------------------
|
||||||
@@ -567,14 +549,9 @@ bool wxPropertyGrid::Create( wxWindow *parent,
|
|||||||
//
|
//
|
||||||
void wxPropertyGrid::Init1()
|
void wxPropertyGrid::Init1()
|
||||||
{
|
{
|
||||||
#if !wxPG_USE_WXMODULE
|
|
||||||
if ( !wxPGGlobalVars )
|
|
||||||
wxPGGlobalVars = new wxPGGlobalVarsClass();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Register editor classes, if necessary.
|
// Register editor classes, if necessary.
|
||||||
if ( wxPGGlobalVars->m_mapEditorClasses.empty() )
|
if ( wxPGGlobalVars->m_mapEditorClasses.empty() )
|
||||||
RegisterDefaultEditors();
|
wxPropertyGrid::RegisterDefaultEditors();
|
||||||
|
|
||||||
m_iFlags = 0;
|
m_iFlags = 0;
|
||||||
m_pState = (wxPropertyGridPageState*) NULL;
|
m_pState = (wxPropertyGridPageState*) NULL;
|
||||||
|
Reference in New Issue
Block a user