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 133
|
/* Copyright (C) 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 */
// modules are the Query Browser and Script Editor
#ifndef _MQBASEMODULE_H_
#define _MQBASEMODULE_H_
#include <gtkmm/box.h>
#include <gtkmm/notebook.h>
#include <gtkmm/menu.h>
#include <gtkmm/window.h>
#include <gtkmm/treeview.h>
namespace Gtk {
class MenuBar;
};
#include "myx_public_interface.h"
#include "MGPtrWrap.h"
#include "MQSavedState.h"
class MQBookmarks;
class MQMainWindowInterface : public Gtk::Window {
public:
enum ViewType {
VNone,
VQuery,
VScript
};
MQSavedState *_state;
MQMainWindowInterface(GtkWindow *win) : Gtk::Window(win), _state(0) {};
virtual ~MQMainWindowInterface() {};
virtual void set_status(const Glib::ustring &text)= 0;
virtual void set_cursor(int line= -1, int column= -1)= 0;
virtual void quit()= 0;
//XXX move back to MQWorkArea?
virtual void bookmark_query(const Glib::ustring &catalog,
const Glib::ustring &schema,
const Glib::ustring &query)= 0;
virtual MQBookmarks *get_bookmarks()= 0;
};
class MQQueryDispatcher;
class MQBaseTab;
class MQBaseModule : public Gtk::VBox {
class SchemaColumns : public Gtk::TreeModel::ColumnRecord
{
public:
SchemaColumns()
{
add(icon); add(text); add(schema);
}
Gtk::TreeModelColumn<Glib::RefPtr<Gdk::Pixbuf> > icon;
Gtk::TreeModelColumn<Glib::ustring> text;
Gtk::TreeModelColumn<MYX_SCHEMA*> schema;
} _schema_columns;
protected:
MQQueryDispatcher *_dispatcher;
Gtk::Notebook *_note;
Glib::RefPtr<MGPtrWrap<MYX_CATALOGS*> > _catalogs;
Glib::RefPtr<Gtk::AccelGroup> _accel_group;
MQMainWindowInterface *_mainw;
virtual void set_dispatcher(MQQueryDispatcher *dispatcher);
virtual MQBaseTab *get_tab(int index=-1);
virtual void add_tab(MQBaseTab *tab);
virtual bool close_tab(MQBaseTab *tab);
virtual bool close_other_tabs(MQBaseTab *tab);
bool tab_clicked(GdkEventButton *ev,MQBaseTab *tab);
void ok_schema_selection(Gtk::TreeView *tree);
void cancel_schema_selection(GdkEventAny *a);
virtual void catalogs_refreshed() {};
virtual Gtk::Menu *get_tab_menu()= 0;
public:
bool schemata_fetch_tables(const Glib::ustring &catalog,const Glib::ustring&schema,MYX_SCHEMA_TABLES *&tables);
bool schemata_fetch_sps(const Glib::ustring &catalog,const Glib::ustring&schema,MYX_SCHEMA_STORED_PROCEDURES *&sps);
void select_schema();
void refresh_catalogs();
public:
MQBaseModule(GtkVBox *vbox);
Glib::RefPtr<Gtk::AccelGroup> get_accel_group() { return _accel_group; };
virtual void setup()= 0;
virtual void show()= 0;
virtual void hide()= 0;
virtual Gtk::Widget *get_widget()= 0;
};
#endif /* _MQBASEMODULE_H_ */
|