19 #ifndef _MFORMS_TREENODEVIEW_H_
20 #define _MFORMS_TREENODEVIEW_H_
23 #include <boost/cstdint.hpp>
93 TreeNodeSkeleton(
const std::string& caption,
const std::string& icon,
const std::string& tag);
118 void release() { _refcount--;
if (_refcount == 0)
delete this; }
143 operator bool ()
const {
return node !=0; }
155 virtual void release() = 0;
156 virtual void retain() = 0;
160 virtual bool equals(
const TreeNode &other) = 0;
162 virtual bool is_valid()
const = 0;
164 virtual void set_icon_path(
int column,
const std::string &icon) = 0;
166 virtual void set_string(
int column,
const std::string &value) = 0;
167 virtual void set_int(
int column,
int value) = 0;
168 virtual void set_long(
int column, boost::int64_t value) = 0;
169 virtual void set_bool(
int column,
bool value) = 0;
170 virtual void set_float(
int column,
double value) = 0;
174 virtual std::string get_string(
int column)
const = 0;
175 virtual int get_int(
int column)
const = 0;
176 virtual boost::int64_t get_long(
int column)
const = 0;
177 virtual bool get_bool(
int column)
const = 0;
178 virtual double get_float(
int column)
const = 0;
180 virtual int count()
const = 0;
183 virtual void remove_from_parent() = 0;
184 virtual void remove_children();
185 virtual TreeNodeRef get_child(
int index)
const = 0;
187 virtual TreeNodeRef find_child_with_tag(
const std::string &tag);
191 virtual void expand() = 0;
192 virtual void collapse() = 0;
193 virtual bool is_expanded() = 0;
198 virtual void set_tag(
const std::string &tag) = 0;
199 virtual std::string get_tag()
const = 0;
206 #ifndef DOXYGEN_SHOULD_SKIP_THIS
208 struct TreeNodeViewImplPtrs
210 bool (*create)(TreeNodeView *
self,
TreeOptions options);
213 int (*add_column)(TreeNodeView *
self,
TreeColumnType type,
const std::string &name,
int initial_width,
bool editable);
215 int (*add_column)(TreeNodeView *
self,
TreeColumnType type,
const std::string &name,
int initial_width,
bool editable,
bool attributed);
217 void (*end_columns)(TreeNodeView *
self);
219 void (*clear)(TreeNodeView *
self);
221 TreeNodeRef (*root_node)(TreeNodeView *
self);
223 void (*set_row_height)(TreeNodeView *
self,
int height);
225 void (*set_allow_sorting)(TreeNodeView *
self, bool);
227 void (*freeze_refresh)(TreeNodeView *
self, bool);
232 std::list<TreeNodeRef> (*get_selection)(TreeNodeView *
self);
233 TreeNodeRef (*get_selected_node)(TreeNodeView *
self);
235 void (*clear_selection)(TreeNodeView *
self);
236 void (*set_selected)(TreeNodeView *
self, TreeNodeRef node,
bool state);
238 int (*row_for_node)(TreeNodeView *
self, TreeNodeRef node);
239 TreeNodeRef (*node_at_row)(TreeNodeView *
self,
int row);
240 TreeNodeRef (*node_with_tag)(TreeNodeView *
self,
const std::string &tag);
242 void (*set_column_visible)(TreeNodeView *
self,
int column,
bool flag);
243 bool (*get_column_visible)(TreeNodeView *
self,
int column);
245 void (*set_column_width)(TreeNodeView *
self,
int column,
int width);
246 int (*get_column_width)(TreeNodeView *
self,
int column);
271 int add_column(
TreeColumnType type,
const std::string &name,
int initial_width,
bool editable =
false,
bool attributed =
false);
290 std::list<TreeNodeRef> get_selection();
293 int get_selected_row();
294 void clear_selection();
298 void set_node_selected(
TreeNodeRef node,
bool flag);
307 void set_row_height(
int height);
318 void set_allow_sorting(
bool flag);
321 void freeze_refresh();
326 void set_column_visible(
int column,
bool flag);
328 bool get_column_visible(
int column);
353 void set_cell_edit_handler(
const boost::function<
void (
TreeNodeRef,
int, std::string)> &handler);
365 int get_column_width(
int column);
368 void set_column_width(
int column,
int width);
373 int count() {
return root_node()->count(); }
375 #ifndef DOXYGEN_SHOULD_SKIP_THIS
379 virtual void changed();
380 virtual void node_activated(
TreeNodeRef row,
int column);
384 virtual void expand_toggle(
TreeNodeRef row,
bool expanded);
387 static double parse_string_with_unit(
const char *s);
391 virtual bool cell_edited(
TreeNodeRef row,
int column,
const std::string &value);
400 virtual bool get_drag_data(
DragDetails &details,
void **data, std::string &format);
406 virtual void column_resized(
int column);