File: stub_treenode.h

package info (click to toggle)
mysql-workbench 6.3.8%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 113,932 kB
  • ctags: 87,814
  • sloc: ansic: 955,521; cpp: 427,465; python: 59,728; yacc: 59,129; xml: 54,204; sql: 7,091; objc: 965; makefile: 638; sh: 613; java: 237; perl: 30; ruby: 6; php: 1
file content (116 lines) | stat: -rw-r--r-- 3,743 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
/* 
 * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License as
 * published by the Free Software Foundation; version 2 of the
 * License.
 * 
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
 * 02110-1301  USA
 */

#pragma once

#include "mforms/treenodeview.h"

namespace MySQL {
  namespace Forms {
    //class TreeViewNode : mforms::Node
    //{
    //private:
    //  std::string* _mytag;
    //  mforms::TreeNodeData *_data;
    //  std::vector<std::string> _text;
    //  std::vector<mforms::TreeNodeTextAttributes>* _attributes;
    //  std::map<int, void*> _icon;

    //public:
    //  TreeViewNode();
    //  ~TreeViewNode();
    //};
  };
};


class TreeNodeWrapper : public mforms::TreeNode
{
  friend struct mforms::TreeNodeRef;

  mforms::TreeNodeRef _parent;
  std::string _tag;
  std::vector<std::string> _values;
  std::vector<mforms::TreeNodeTextAttributes> _attributes;
  std::vector<std::string> _icons;
  std::vector<TreeNodeWrapper*> _children;
  mforms::TreeNodeData *pdata;
  bool _expanded;

  int _index;

protected:
  bool is_root() const;

public:
  TreeNodeWrapper();
  
  int node_index() const { return _index; }

  virtual void release();
  virtual void retain();

  virtual bool equals(const mforms::TreeNode &other);
  virtual bool is_valid() const;
  virtual int level() const;
    
  virtual void set_icon_path(int column, const std::string &icon);

  virtual void set_attributes(int column, const mforms::TreeNodeTextAttributes& attrs);
  virtual void set_string(int column, const std::string &value);
  virtual void set_int(int column, int value);
  virtual void set_long(int column, boost::int64_t value);
  virtual void set_bool(int column, bool value);
  virtual void set_float(int column, double value);

  virtual std::string get_string(int column) const;
  virtual int get_int(int column) const;
  virtual boost::int64_t get_long(int column) const;
  virtual bool get_bool(int column) const;
  virtual double get_float(int column) const;
    
  virtual int count() const;
  virtual mforms::TreeNodeRef insert_child(int index);
  virtual void insert_child(int index, const mforms::TreeNode &node);
  virtual void move_child(mforms::TreeNodeRef child, int new_index);
  virtual void remove_from_parent();
  virtual mforms::TreeNodeRef get_child(int index) const;
  virtual int get_child_index(mforms::TreeNodeRef child) const;
  virtual mforms::TreeNodeRef get_parent() const;
  virtual mforms::TreeNodeRef previous_sibling() const;
  virtual mforms::TreeNodeRef next_sibling() const;
  virtual void remove_children();
  virtual void move_node(mforms::TreeNodeRef node, bool before);

  virtual std::vector<mforms::TreeNodeRef> add_node_collection(const mforms::TreeNodeCollectionSkeleton &nodes, int position = -1);
  void add_children_from_skeletons(std::vector<TreeNodeWrapper*> &parents, const std::vector<mforms::TreeNodeSkeleton>& children);

  virtual void expand();
  virtual void collapse();
  virtual bool is_expanded();

  virtual void toggle();

  virtual void set_tag(const std::string &tag);
  virtual std::string get_tag() const;

  virtual void set_data(mforms::TreeNodeData *data);
  virtual mforms::TreeNodeData *get_data() const;
};