Skip to content

Commit

Permalink
Adjust the code for the wxComboBox fallback solution used in non-MSW …
Browse files Browse the repository at this point in the history
…platforms
  • Loading branch information
codereader committed Dec 30, 2019
1 parent 5dd1974 commit b416c6b
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 9 deletions.
35 changes: 26 additions & 9 deletions plugins/dm.stimresponse/ResponseEditor.cpp
Expand Up @@ -149,16 +149,18 @@ void ResponseEditor::setupPage()
// Response property section
_type = findNamedObject<wxBitmapComboBox>(_mainPanel, "ResponseEditorTypeCombo");
#else
// Response property section
wxControl* typeBox = findNamedObject<wxControl>(_mainPanel, "ResponseEditorTypeCombo");

// Replace the bitmap combo with an ordinary one
wxComboBox* combo = new wxComboBox(typeBox->GetParent(), wxID_ANY);
typeBox->GetContainingSizer()->Add(combo, 1, wxEXPAND);
typeBox->Destroy();
{
// Response property section
wxControl* typeBox = findNamedObject<wxControl>(_mainPanel, "ResponseEditorTypeCombo");

// Replace the bitmap combo with an ordinary one
wxComboBox* combo = new wxComboBox(typeBox->GetParent(), wxID_ANY);
typeBox->GetContainingSizer()->Add(combo, 1, wxEXPAND);
typeBox->Destroy();

_type = combo;
_type->SetName("ResponseEditorTypeCombo");
_type = combo;
_type->SetName("ResponseEditorTypeCombo");
}
#endif

_type->Connect(wxEVT_COMBOBOX, wxCommandEventHandler(ResponseEditor::onStimTypeSelect), NULL, this);
Expand Down Expand Up @@ -195,7 +197,22 @@ void ResponseEditor::setupPage()

createEffectWidgets();

#ifdef USE_BMP_COMBO_BOX
_addType = findNamedObject<wxBitmapComboBox>(_mainPanel, "ResponseTypeComboBox");
#else
{
// Type selector box
wxControl* addTypeBox = findNamedObject<wxControl>(_mainPanel, "ResponseTypeComboBox");

// Replace the bitmap combo with an ordinary one
wxComboBox* newTypeCombo = new wxComboBox(addTypeBox->GetParent(), wxID_ANY);
addTypeBox->GetContainingSizer()->Prepend(newTypeCombo, 1, wxEXPAND | wxRIGHT, 6);
addTypeBox->Destroy();

_addType = newTypeCombo;
_addType->SetName("ResponseTypeComboBox");
}
#endif
_addType->Bind(wxEVT_COMBOBOX, std::bind(&ResponseEditor::onAddTypeSelect, this, std::placeholders::_1));

auto addButton = findNamedObject<wxButton>(_mainPanel, "AddResponseButton");
Expand Down
16 changes: 16 additions & 0 deletions plugins/dm.stimresponse/StimEditor.cpp
Expand Up @@ -37,7 +37,23 @@ void StimEditor::setupPage()

setupEditPanel();

#ifdef USE_BMP_COMBO_BOX
_addType = findNamedObject<wxBitmapComboBox>(_mainPanel, "StimTypeComboBox");
#else
{
// Type selector box
wxControl* typeBox = findNamedObject<wxControl>(_mainPanel, "StimTypeComboBox");

// Replace the bitmap combo with an ordinary one
wxComboBox* combo = new wxComboBox(typeBox->GetParent(), wxID_ANY);
typeBox->GetContainingSizer()->Prepend(combo, 1, wxEXPAND | wxRIGHT, 6);
typeBox->Destroy();

_addType = combo;
_addType->SetName("StimTypeComboBox");
}
#endif

_addType->Bind(wxEVT_COMBOBOX, std::bind(&StimEditor::onAddTypeSelect, this, std::placeholders::_1));

auto addButton = findNamedObject<wxButton>(_mainPanel, "AddStimButton");
Expand Down

0 comments on commit b416c6b

Please sign in to comment.