[Cxxgui-devel] Design / lists / MVC
Brought to you by:
davidturner
|
From: David T. <dkt...@te...> - 2004-03-09 12:03:18
|
Hi, everyone
This is my preliminary design for the list widget. I'm concerned that it
might be too complicated. Let me know what you think.
The data ("Data") is stored in an unspecified container.
The user must provide an adaptor class, called the Model. Canned models
for various STL container types will be provided. The model also supplies
metadata, such as column names. The Model derived from an ABC called
gui::data_model.
The list widget itself is a view, called gui::data_view. The user
specifies the model to the view by passing it a pointer to a data_model.
The view automatically tracks the data.
One problem I have with this design is the following:
std::vector<std::string> my_data;
gui::linear_model<std::vector<std::string> > my_model;
gui::data_view view(my_model);
std::sort(my_data.begin(), my_data.end()); // view not updated
my_model.range_reordered(my_data.begin(), my_data.end()); // view updated
view.update(); // view updated
std::sort(my_model.begin(), my_model.end()); // view updated
I dislike having to work explicitly through the model if the view is to be
updated.
Regards
David Turner
|