File: grid_view_model.h

package info (click to toggle)
mysql-workbench 5.2.40%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 53,880 kB
  • sloc: cpp: 419,850; yacc: 74,784; xml: 54,510; python: 31,455; sh: 9,423; ansic: 4,736; makefile: 2,442; php: 529; java: 237
file content (46 lines) | stat: -rw-r--r-- 1,571 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
#ifndef __GRID_VIEW_MODEL_H__
#define __GRID_VIEW_MODEL_H__


#include "linux_utilities/listmodel_wrapper.h"
#include "grt/tree_model.h"


class GridView;


class GridViewModel : public ListModelWrapper
{
public:
  typedef Glib::RefPtr<GridViewModel> Ref;
  static Ref create(bec::GridModel::Ref model, GridView *view, const std::string &name);
  ~GridViewModel();

  virtual bool handle_popup_event(GdkEvent* event);
  int refresh(bool reset_columns);
  int column_index(Gtk::TreeViewColumn* col);
  void row_numbers_visible(bool value) { _row_numbers_visible= value; }
  bool row_numbers_visible() { return _row_numbers_visible; }
  void set_ellipsize(const int column, const bool on);

  sigc::slot<void, const int, Glib::ValueBase*>   before_render;

protected:
  GridViewModel(bec::GridModel::Ref model, GridView *view, const std::string &name);
  virtual void get_value_vfunc(const iterator& iter, int column, Glib::ValueBase& value) const;

private:
  bec::GridModel::Ref                   _model;
  GridView                             *_view;
  std::map<Gtk::TreeViewColumn*, int>   _col_index_map;
  bool                                  _row_numbers_visible;

  template <typename ValueTypeTraits>
  Gtk::TreeViewColumn * add_column(int index, const std::string &name, Editable editable, Gtk::TreeModelColumnBase *color_column);

  void get_cell_value(const iterator& iter, int column, GType type, Glib::ValueBase& value);
  void set_cell_value(const iterator& itier, int column, GType type, const Glib::ValueBase& value);
};


#endif // __GRID_VIEW_MODEL_H__