Hello,
I want a clear separation between the UI and the business logic.
How do you achieve this? How do you organize your source files for your
applications? Which folders do you generally create?
I have tried this for my first wxWidget application:
\main.cpp
\MyApp.h
\MyApp.cpp
\Controllers\MyAppController.h
\Controllers\MyAppController.cpp
\Models\MyAppModel.h
\Models\MyAppModel.cpp
\Views\MyMainWindow.h
\Views\MyMainWindow.cpp
- main.cpp contains only DECLARE_APP(MyApp) and IMPLEMENT_APP(MyApp)
- the MyApp class inherits from wxApp. MyApp.cpp contains the OnInit method and
creates a MyAppController object
- the MyAppController object creates a MyAppModel object and a MyMainWindow
object
- MyAppModel is the core of the application and knows nothing about the GUI
- MyMainWindow inherits from wxFrame and is the main window of the application
As you can see I've been trying to implement the MVC (model/view/controller)
pattern. But I don't know where's the best place to put the event handlers.
How do you organize your source files? Where do you catch events?
Kind regards,
Al