File: mysql_table_editor_column_page.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 (75 lines) | stat: -rw-r--r-- 2,331 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
#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:
    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();
  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;

    // Auto completion of types and related functions
    static AutoCompletable                    _types_completion;
    static 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