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
|
/* 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 */
#ifndef _MGBLOBEDITOR_H_
#define _MGBLOBEDITOR_H_
#include <gtkmm/window.h>
#include <gtkmm/label.h>
#include <gtkmm/box.h>
#include <gtkmm/notebook.h>
#include <gtkmm/textview.h>
#include <gtkmm/image.h>
#include <gtkmm/treeview.h>
#include <gtkmm/liststore.h>
#include <gtkmm/buttonbox.h>
class MGBlobListStore;
class MGBlobEditor : public Gtk::Window
{
class Columns : public Gtk::TreeModel::ColumnRecord
{
public:
Columns()
{
add(offset);
for (int i= 0; i < 16; i++)
{
data.push_back(Gtk::TreeModelColumn<std::string>());
add(data[i]);
}
for (int i= 0; i < 4; i++)
{
text.push_back(Gtk::TreeModelColumn<std::string>());
add(text[i]);
}
}
Gtk::TreeModelColumn<std::string> offset;
std::vector<Gtk::TreeModelColumn<std::string> > data;
std::vector<Gtk::TreeModelColumn<std::string> > text;
} _columns;
public:
enum ViewType {
VText=(1<<0),
VImage=(1<<1),
VBinary=(1<<2)
};
protected:
Gtk::Label _summary;
Gtk::VBox _topbox;
Gtk::Notebook _note;
Gtk::TextView *_text;
Gtk::HButtonBox _bbox;
Gtk::Button *_button1, *_button2;
Gtk::Image *_image;
Gtk::Label *_image_label;
Gtk::TreeView *_tree;
Glib::RefPtr<MGBlobListStore> _tree_store;
ViewType _vtypes;
gpointer _data;
gsize _size;
sigc::signal0<void> _save_signal;
bool _delete_on_close;
bool delete_event(GdkEventAny *ev);
void close();
void save();
public:
MGBlobEditor(ViewType vtypes, bool edit= false);
virtual ~MGBlobEditor();
void set_delete_on_close(bool flag= true);
void set_data(gpointer data, gsize size);
void get_data(gpointer &data, gsize &size);
void note_page_switched(GtkNotebookPage *, guint);
sigc::signal0<void> signal_save() { return _save_signal; }
};
#endif /* _MGBLOBEDITOR_H_ */
|