Use automatically generated ID values for wxPG sub-controls.
Currently in wxPG there are used fixed "magic" ID values to identify sub-controls and this can lead to side effects if these values overlap with ID values assigned to another controls in the application (like e.g. menu items). Closes #13634. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@76882 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
954ee459b4
commit
63a9cc4c2e
@ -332,15 +332,6 @@ wxPG_EX_TOOLBAR_SEPARATOR = 0x10000000
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
|
||||
//
|
||||
// Ids for sub-controls
|
||||
// NB: It should not matter what these are.
|
||||
#define wxPG_SUBID1 2
|
||||
#define wxPG_SUBID2 3
|
||||
#define wxPG_SUBID_TEMP1 4
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
|
||||
/** @class wxPGCommonValue
|
||||
|
||||
wxPropertyGrid stores information about common values in these
|
||||
|
@ -271,7 +271,7 @@ wxPGWindowList wxPGSpinCtrlEditor::CreateControls( wxPropertyGrid* propgrid, wxP
|
||||
#ifdef __WXMSW__
|
||||
wnd2->Hide();
|
||||
#endif
|
||||
wnd2->Create( propgrid->GetPanel(), wxPG_SUBID2, butPos, butSz, wxSP_VERTICAL );
|
||||
wnd2->Create( propgrid->GetPanel(), wxID_ANY, butPos, butSz, wxSP_VERTICAL );
|
||||
|
||||
wnd2->SetRange( INT_MIN, INT_MAX );
|
||||
wnd2->SetValue( 0 );
|
||||
@ -487,7 +487,7 @@ wxPGWindowList wxPGDatePickerCtrlEditor::CreateControls( wxPropertyGrid* propgri
|
||||
dateValue = value.GetDateTime();
|
||||
|
||||
ctrl->Create(propgrid->GetPanel(),
|
||||
wxPG_SUBID1,
|
||||
wxID_ANY,
|
||||
dateValue,
|
||||
pos,
|
||||
useSz,
|
||||
|
@ -1039,7 +1039,7 @@ wxWindow* wxPGChoiceEditor::CreateControlsBase( wxPropertyGrid* propGrid,
|
||||
cb->Hide();
|
||||
#endif
|
||||
cb->Create(ctrlParent,
|
||||
wxPG_SUBID1,
|
||||
wxID_ANY,
|
||||
wxString(),
|
||||
po,
|
||||
si,
|
||||
@ -1599,7 +1599,7 @@ wxPGWindowList wxPGCheckBoxEditor::CreateControls( wxPropertyGrid* propGrid,
|
||||
sz.x = propGrid->GetFontHeight() + (wxPG_XBEFOREWIDGET*2) + 4;
|
||||
|
||||
wxSimpleCheckBox* cb = new wxSimpleCheckBox(propGrid->GetPanel(),
|
||||
wxPG_SUBID1, pt, sz);
|
||||
wxID_ANY, pt, sz);
|
||||
|
||||
cb->SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW));
|
||||
|
||||
@ -1865,7 +1865,6 @@ wxWindow* wxPropertyGrid::GenerateEditorTextCtrl( const wxPoint& pos,
|
||||
int maxLen,
|
||||
unsigned int forColumn )
|
||||
{
|
||||
wxWindowID id = wxPG_SUBID1;
|
||||
wxPGProperty* prop = GetSelection();
|
||||
wxASSERT(prop);
|
||||
|
||||
@ -1910,7 +1909,7 @@ wxWindow* wxPropertyGrid::GenerateEditorTextCtrl( const wxPoint& pos,
|
||||
tc->Hide();
|
||||
#endif
|
||||
SetupTextCtrlValue(value);
|
||||
tc->Create(ctrlParent,id,value, p, s,tcFlags);
|
||||
tc->Create(ctrlParent,wxID_ANY,value, p, s,tcFlags);
|
||||
|
||||
#if defined(__WXMSW__)
|
||||
// On Windows, we need to override read-only text ctrl's background
|
||||
@ -1968,7 +1967,6 @@ wxWindow* wxPropertyGrid::GenerateEditorTextCtrl( const wxPoint& pos,
|
||||
|
||||
wxWindow* wxPropertyGrid::GenerateEditorButton( const wxPoint& pos, const wxSize& sz )
|
||||
{
|
||||
wxWindowID id = wxPG_SUBID2;
|
||||
wxPGProperty* selected = GetSelection();
|
||||
wxASSERT(selected);
|
||||
|
||||
@ -1981,7 +1979,7 @@ wxWindow* wxPropertyGrid::GenerateEditorButton( const wxPoint& pos, const wxSize
|
||||
wxSize s(25, -1);
|
||||
|
||||
wxButton* but = new wxButton();
|
||||
but->Create(GetPanel(),id,wxS("..."),p,s,wxWANTS_CHARS);
|
||||
but->Create(GetPanel(),wxID_ANY,wxS("..."),p,s,wxWANTS_CHARS);
|
||||
|
||||
// Now that we know the size, move to the correct position
|
||||
p.x = pos.x + sz.x - but->GetSize().x - 2;
|
||||
@ -2008,7 +2006,7 @@ wxWindow* wxPropertyGrid::GenerateEditorButton( const wxPoint& pos, const wxSize
|
||||
#ifdef __WXMSW__
|
||||
but->Hide();
|
||||
#endif
|
||||
but->Create(GetPanel(),id,wxS("..."),p,s,wxWANTS_CHARS);
|
||||
but->Create(GetPanel(),wxID_ANY,wxS("..."),p,s,wxWANTS_CHARS);
|
||||
|
||||
#ifdef __WXGTK__
|
||||
wxFont font = GetFont();
|
||||
@ -2135,7 +2133,7 @@ bool wxPGEditorDialogAdapter::ShowDialog( wxPropertyGrid* propGrid, wxPGProperty
|
||||
// -----------------------------------------------------------------------
|
||||
|
||||
wxPGMultiButton::wxPGMultiButton( wxPropertyGrid* pg, const wxSize& sz )
|
||||
: wxWindow( pg->GetPanel(), wxPG_SUBID2, wxPoint(-100,-100), wxSize(0, sz.y) ),
|
||||
: wxWindow( pg->GetPanel(), wxID_ANY, wxPoint(-100,-100), wxSize(0, sz.y) ),
|
||||
m_fullEditorSize(sz), m_buttonsWidth(0)
|
||||
{
|
||||
SetBackgroundColour(pg->GetCellBackgroundColour());
|
||||
@ -2151,10 +2149,7 @@ int wxPGMultiButton::GenId( int itemid ) const
|
||||
{
|
||||
if ( itemid < -1 )
|
||||
{
|
||||
if ( m_buttons.size() )
|
||||
itemid = GetButton(m_buttons.size()-1)->GetId() + 1;
|
||||
else
|
||||
itemid = wxPG_SUBID2;
|
||||
itemid = wxID_ANY;
|
||||
}
|
||||
return itemid;
|
||||
}
|
||||
|
@ -2181,7 +2181,7 @@ bool wxLongStringProperty::DisplayEditorDialog( wxPGProperty* prop, wxPropertyGr
|
||||
long edStyle = wxTE_MULTILINE;
|
||||
if ( prop->HasFlag(wxPG_PROP_READONLY) )
|
||||
edStyle |= wxTE_READONLY;
|
||||
wxTextCtrl* ed = new wxTextCtrl(dlg,11,value,
|
||||
wxTextCtrl* ed = new wxTextCtrl(dlg,wxID_ANY,value,
|
||||
wxDefaultPosition,wxDefaultSize,edStyle);
|
||||
|
||||
rowsizer->Add( ed, 1, wxEXPAND|wxALL, spacing );
|
||||
@ -2870,7 +2870,7 @@ bool wxPGInDialogValidator::DoValidate( wxPropertyGrid* propGrid,
|
||||
if ( !tc )
|
||||
{
|
||||
{
|
||||
tc = new wxTextCtrl( propGrid, wxPG_SUBID_TEMP1, wxEmptyString,
|
||||
tc = new wxTextCtrl( propGrid, wxID_ANY, wxEmptyString,
|
||||
wxPoint(30000,30000));
|
||||
tc->Hide();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user