File: mysql_table_editor_column_page.h

package info (click to toggle)
mysql-workbench 6.2.3%2Bdfsg-7
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 102,612 kB
  • ctags: 84,593
  • sloc: ansic: 804,682; cpp: 438,759; yacc: 59,129; python: 54,293; xml: 48,851; sql: 5,512; objc: 1,414; makefile: 505; sh: 455; java: 237; ruby: 6; perl: 5; php: 1
file content (80 lines) | stat: -rw-r--r-- 2,582 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
#ifndef __WB_COLUMN_PAGE_HANDLING_H__
#define __WB_COLUMN_PAGE_HANDLING_H__

#include "grt/tree_model.h"
#include <gtkmm/builder.h>

class MySQLTableEditorBE;
class ListModelWrapper;
class DbMySQLTableEditor;
class AutoCompletable;

namespace Gtk
{
  class ScrolledWindow;
  class ComboBox;
}

//==============================================================================
//
//==============================================================================
class DbMySQLTableEditorColumnPage : public sigc::trackable
{
  public:
    DbMySQLTableEditorColumnPage(DbMySQLTableEditor *owner, MySQLTableEditorBE* be, Glib::RefPtr<Gtk::Builder> xml);
    ~DbMySQLTableEditorColumnPage();
	
    void refresh();
    void partial_refresh(const int what);

    void switch_be(MySQLTableEditorBE* be);

  private:
    grt::StringListRef get_types_for_table(const db_TableRef table); //!< T

    bool process_event(GdkEvent* event);
    void type_column_event(GdkEvent* e);
    void cursor_changed();

    void update_column_details(const ::bec::NodeId &node);
    
    void set_comment(const std::string& comment);
    void set_collation();
    void update_collation();

    void check_resize(Gtk::Allocation& r);
    bool do_on_visible(GdkEventVisibility*);

    bec::NodeId get_selected();

   void start_auto_edit();
  private:
    void refill_completions();
    void refill_columns_tv();

    DbMySQLTableEditor                       *_owner;
    MySQLTableEditorBE                       *_be;
    Glib::RefPtr<Gtk::Builder>                _xml;

    Glib::RefPtr<ListModelWrapper>            _model;
    Gtk::TreeView                            *_tv;
    Gtk::ScrolledWindow                      *_tv_holder;

    Gtk::ComboBox                            *_collation_combo;

    gulong                                    _edit_conn;
    GtkCellEditable                          *_ce;
    int                                       _old_column_count;
    bool                                      _auto_edit_pending;

    // Auto completion of types and related functions
    static boost::shared_ptr<AutoCompletable> _types_completion;
    static boost::shared_ptr<AutoCompletable> _names_completion;
    static boost::shared_ptr<AutoCompletable> types_completion();
    static boost::shared_ptr<AutoCompletable> names_completion();
    static void type_cell_editing_started(GtkCellRenderer* cr, GtkCellEditable* ce, gchar* path, gpointer udata);
    static void cell_editing_done(GtkCellEditable* ce, gpointer udata);
    bool                                      _editing;
};

#endif