~ubuntu-branches/ubuntu/quantal/mysql-workbench/quantal

« back to all changes in this revision

Viewing changes to frontend/linux/sqlide/grid_view_model.h

  • Committer: Package Import Robot
  • Author(s): Dmitry Smirnov
  • Date: 2012-03-01 21:57:30 UTC
  • Revision ID: package-import@ubuntu.com-20120301215730-o7y8av8y38n162ro
Tags: upstream-5.2.38+dfsg
ImportĀ upstreamĀ versionĀ 5.2.38+dfsg

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#ifndef __GRID_VIEW_MODEL_H__
 
2
#define __GRID_VIEW_MODEL_H__
 
3
 
 
4
 
 
5
#include "linux_utilities/listmodel_wrapper.h"
 
6
#include "grt/tree_model.h"
 
7
 
 
8
 
 
9
class GridView;
 
10
 
 
11
 
 
12
class GridViewModel : public ListModelWrapper
 
13
{
 
14
public:
 
15
  typedef Glib::RefPtr<GridViewModel> Ref;
 
16
  static Ref create(bec::GridModel::Ref model, GridView *view, const std::string &name);
 
17
  ~GridViewModel();
 
18
 
 
19
  virtual bool handle_popup_event(GdkEvent* event);
 
20
  int refresh(bool reset_columns);
 
21
  int column_index(Gtk::TreeViewColumn* col);
 
22
  void row_numbers_visible(bool value) { _row_numbers_visible= value; }
 
23
  bool row_numbers_visible() { return _row_numbers_visible; }
 
24
  void set_ellipsize(const int column, const bool on);
 
25
 
 
26
  sigc::slot<void, const int, Glib::ValueBase*>   before_render;
 
27
 
 
28
protected:
 
29
  GridViewModel(bec::GridModel::Ref model, GridView *view, const std::string &name);
 
30
  virtual void get_value_vfunc(const iterator& iter, int column, Glib::ValueBase& value) const;
 
31
 
 
32
private:
 
33
  bec::GridModel::Ref                   _model;
 
34
  GridView                             *_view;
 
35
  std::map<Gtk::TreeViewColumn*, int>   _col_index_map;
 
36
  bool                                  _row_numbers_visible;
 
37
 
 
38
  template <typename ValueTypeTraits>
 
39
  Gtk::TreeViewColumn * add_column(int index, const std::string &name, Editable editable, Gtk::TreeModelColumnBase *color_column);
 
40
 
 
41
  void get_cell_value(const iterator& iter, int column, GType type, Glib::ValueBase& value);
 
42
  void set_cell_value(const iterator& itier, int column, GType type, const Glib::ValueBase& value);
 
43
};
 
44
 
 
45
 
 
46
#endif // __GRID_VIEW_MODEL_H__