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
|
#ifndef _LF_GRTTREEVIEW_H_
#define _LF_GRTTREEVIEW_H_
#include <mforms/mforms.h>
#include "lf_view.h"
#include "linux_utilities/treemodel_wrapper.h"
namespace mforms {
namespace gtk {
class GRTTreeViewImpl : public ViewImpl
{
private:
struct ColumnSpec
{
GRTTreeColumnType type;
int column;
int default_width;
std::string name;
bool editable;
};
Gtk::ScrolledWindow *_swin;
Gtk::TreeView *_tree;
ExpandedRowsStorage _expanded_rows;
Glib::RefPtr<TreeModelWrapper> _store;
std::vector<ColumnSpec> _columns;
virtual Gtk::Widget *get_outer() const { return _swin; }
virtual Gtk::Widget *get_inner() const { return _tree; }
GRTTreeViewImpl(GRTTreeView *self, TreeOptions options);
void row_activated(const Gtk::TreeModel::Path &path, Gtk::TreeViewColumn *column, GRTTreeView *tree);
void selection_changed(GRTTreeView *tree);
void set_model(bec::TreeModel *model);
void set_column_width(int model_column, int width);
int add_column(GRTTreeColumnType type, int model_column, const std::string &name, bool editable);
void refresh(const bec::NodeId &node);
static bool create(GRTTreeView *self, mforms::TreeOptions options);
static void set_model(GRTTreeView *self, bec::TreeModel *model);
static int add_column(GRTTreeView *self, GRTTreeColumnType type, int model_column, const std::string &name);
static int add_column_editable(GRTTreeView *self, GRTTreeColumnType type, int model_column, const std::string &name);
static void refresh(GRTTreeView *self, const bec::NodeId &node);
static void set_column_width(GRTTreeView *self, int model_column, int width);
static bool get_selected_node(GRTTreeView *self, bec::NodeId &node);
static int get_selection(GRTTreeView *self, std::vector<bec::NodeId> &nodes);
static void set_allow_multi_selection(GRTTreeView *self, bool flag);
static void row_count_changed(GRTTreeView *self, const bec::NodeId &parent, int old_count);
static void set_expanded(GRTTreeView *self, const bec::NodeId &node, bool expanded);
public:
static void init();
};
}
}
#endif
|