List/Tree Widget
From Adobe Open Source Wiki
(Difference between revisions)
| Line 13: | Line 13: | ||
[http://developer.apple.com/documentation/Carbon/Conceptual/display_databrowser/databrowser_intro/chapter_1_section_1.html| Carbon Tree Control API Documentation (Data Browser)] | [http://developer.apple.com/documentation/Carbon/Conceptual/display_databrowser/databrowser_intro/chapter_1_section_1.html| Carbon Tree Control API Documentation (Data Browser)] | ||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
== Typedefs == | == Typedefs == | ||
| Line 32: | Line 18: | ||
Assume for the time being that the model_type is simple: | Assume for the time being that the model_type is simple: | ||
| − | typedef std:: | + | typedef std::string value_type; |
| + | typedef std::vector<value_type> model_type; | ||
typedef model_type::iterator iterator; | typedef model_type::iterator iterator; | ||
typedef std::pair<iterator, iterator> sequence_type; | typedef std::pair<iterator, iterator> sequence_type; | ||
| Line 38: | Line 25: | ||
== Model API == | == Model API == | ||
| − | typedef boost::function<void ()> monitor_value_callback_t; | + | typedef boost::function<void (const value_type&)> monitor_value_callback_t; |
| − | typedef boost::function<void ()> monitor_child_insert_callback_t; | + | typedef boost::function<void (iterator who)> monitor_child_insert_callback_t; |
| − | void insert(const | + | void insert(const value_type& what, iterator where); |
void monitor_child_insert(iterator parent, const monitor_child_insert_callback_t& how); | void monitor_child_insert(iterator parent, const monitor_child_insert_callback_t& how); | ||
void monitor_value(iterator where, const monitor_value_callback_t& how); | void monitor_value(iterator where, const monitor_value_callback_t& how); | ||
| + | void monitor_erase(...); | ||
| + | void monitor_child_erase(...); | ||
| + | |||
| + | == View API == | ||
| + | |||
| + | void set(iterator where, const value_type& value); | ||
| + | void erase(iterator who); | ||
| + | |||
| + | == Controller API == | ||
| + | |||
| + | typedef boost::function<void (const value_type&)> monitor_value_callback_t; | ||
| + | |||
| + | void monitor(iterator who, const monitor_child_insert_callback_t& how); | ||
| + | void erase(iterator who); | ||
Revision as of 00:19, 10 January 2007
(For the time being the focus will be on lists, not heirarchical trees.)
The tricky part of a list controller/view is that you have a controller/view on a sequence. You need to figure out:
- How to communicate requests for changes to the sequence
- What those requests are
- How to communicate a change in the visible portion of the sequence to the view
We assume the sequences in a list are disjoint.
Contents |
Related Docs
Win32 Tree Control API Documentation (Tree View)
Carbon Tree Control API Documentation (Data Browser)
Typedefs
Assume for the time being that the model_type is simple:
typedef std::string value_type; typedef std::vector<value_type> model_type; typedef model_type::iterator iterator; typedef std::pair<iterator, iterator> sequence_type;
Model API
typedef boost::function<void (const value_type&)> monitor_value_callback_t; typedef boost::function<void (iterator who)> monitor_child_insert_callback_t; void insert(const value_type& what, iterator where); void monitor_child_insert(iterator parent, const monitor_child_insert_callback_t& how); void monitor_value(iterator where, const monitor_value_callback_t& how); void monitor_erase(...); void monitor_child_erase(...);
View API
void set(iterator where, const value_type& value); void erase(iterator who);
Controller API
typedef boost::function<void (const value_type&)> monitor_value_callback_t;
void monitor(iterator who, const monitor_child_insert_callback_t& how); void erase(iterator who);