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 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132
|
/* Copyright (C) 2003, 2004 MySQL AB
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#ifndef _MGSCHEMABROWSERLIST_H_
#define _MGSCHEMABROWSERLIST_H_
#include "MGBrowserList.h"
#include "myx_library.h"
class MGSchemaBrowserList : public MGBrowserList {
public:
enum ViewType {
Normal,
SchemaOnly,
TableOnly,
FullSchemata
};
class Columns : public Gtk::TreeModel::ColumnRecord {
public:
Columns() {
add(_icon); add(_text); add(_catalog);
add(_type); add(_color); add(_data); add(_populated);
};
Gtk::TreeModelColumn<Glib::RefPtr<Gdk::Pixbuf> > _icon;
Gtk::TreeModelColumn<Glib::ustring> _text;
Gtk::TreeModelColumn<Glib::ustring> _catalog;
Gtk::TreeModelColumn<char> _type;
Gtk::TreeModelColumn<Gdk::Color> _color;
Gtk::TreeModelColumn<MYX_SCHEMA*> _data;
Gtk::TreeModelColumn<bool> _populated;
};
Columns _columns;
typedef bool (*MarkRowDelegate)(gpointer, const Glib::ustring&,
const Glib::ustring&,
const Glib::ustring&);
typedef sigc::slot2<bool,MGSchemaBrowserList*,const Gtk::TreeIter&> PopulateSlot;
protected:
void cursor_changed();
virtual void refresh_list(const Glib::ustring &filter);
ViewType _view_type;
bool _show_columns;
MYX_CATALOGS *_catalogs;
Glib::RefPtr<Gdk::Pixbuf> _schema_icon;
Glib::RefPtr<Gdk::Pixbuf> _sys_schema_icon;
Glib::RefPtr<Gdk::Pixbuf> _table_icon;
Glib::RefPtr<Gdk::Pixbuf> _sp_icon;
Glib::RefPtr<Gdk::Pixbuf> _index_icon;
Glib::RefPtr<Gdk::Pixbuf> _column_icon;
gpointer _mark_delegate_data;
MarkRowDelegate _mark_delegate;
PopulateSlot _populate_slot;
bool get_last_child_of_node(const Gtk::TreeIter &node,
Gtk::TreeIter &child_ret);
void refresh_column_markings(const Gtk::TreeIter &node,
const Glib::ustring &schema,
const Glib::ustring &table);
void refresh_table_markings(const Gtk::TreeIter &node,
const Glib::ustring &schema);
void append_schema(MYX_SCHEMA *schema);
bool contains_schema(MYX_SCHEMA *schema);
public:
void refresh_schema_list(const Gtk::TreeIter &schema_node,
MYX_SCHEMA_TABLES *tables,
MYX_SCHEMA_STORED_PROCEDURES *sps);
void refresh_markings();
MGSchemaBrowserList(const Glib::ustring &caption, ViewType type);
void set_icons(const Glib::RefPtr<Gdk::Pixbuf> &schema_icon,
const Glib::RefPtr<Gdk::Pixbuf> &sys_schema_icon,
const Glib::RefPtr<Gdk::Pixbuf> &sp_icon,
const Glib::RefPtr<Gdk::Pixbuf> &table_icon,
const Glib::RefPtr<Gdk::Pixbuf> &column_icon);
void set_index_icon(const Glib::RefPtr<Gdk::Pixbuf> &index_icon);
void append_child(const Gtk::TreeIter &node,
const Glib::RefPtr<Gdk::Pixbuf> &icon,
const Glib::ustring &text);
void set_catalogs(MYX_CATALOGS *catalogs);
void set_populate_func(const PopulateSlot &slot);
void set_mark_delegate(MarkRowDelegate deleg, gpointer data);
void populate_node(const Gtk::TreeIter &iter);
char get_row_object(const Gtk::TreeIter &iter,
Glib::ustring &catalog, Glib::ustring &schema,
Glib::ustring &table, Glib::ustring &column,
Glib::ustring &child);
bool get_selected_schema(Gtk::TreeIter &node,
Glib::ustring &catalog, Glib::ustring &schema,
Glib::ustring &child);
void mark(const Gtk::TreeIter &node, bool flag=true);
};
#endif /* _MGSCHEMABROWSERLIST_H_ */
|