ALL,
I have a program that contain multiple views. Some views contains different objects by itself and some just displays some data in a tale like manner.
All those views and the objects some are displaying have different options.
What I have right now is the following:
I have a dialog class that presents different tabs for every single object/view to display/change the options. I have the different handler classes that I used as a pointers to pass the options down to the properties dialog.
What I’d like to do is pass the view/object int the handler class in order to change the options.
I thought about using templates, but then realized I can’t really do that since every view/object class has different option and so applying them will depend on the object itself.
And using is_same
will actually defeats the purpose of templates.
What would be the better solution for that?
Some code:
std::unique_ptr<PropertiesHandler> propertiesPtr;
#if __cplusplus > 201300
auto ptr = std::make_unique<Handler>( m_conf->m_dbOptions, m_canvas );
#else
auto ptr = std::unique_ptr<Handler>( new DatabaseOptionsHandler( m_conf->m_dbOptions, m_canvas ) );
#endif
propertiesPtr = std::move( ptr );
propertiesPtr->SetType( m_type == View ? ViewProperties : ObjectProperties );
That’s how I pass the options down to the properties dialog.