File: MGRTShell.h

package info (click to toggle)
mysql-admin 1.2.5rc-2
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 80,944 kB
  • ctags: 43,103
  • sloc: sql: 295,916; pascal: 256,535; cpp: 74,487; ansic: 68,881; objc: 26,417; sh: 16,867; yacc: 10,755; java: 9,917; xml: 8,453; php: 2,806; python: 2,068; makefile: 1,252; perl: 3
file content (131 lines) | stat: -rw-r--r-- 4,039 bytes parent folder | download | duplicates (4)
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
/* Copyright (C) 2005 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 _MGRTSHELL_H_
#define _MGRTSHELL_H_

#include <gtkmm/paned.h>
#include <gtkmm/textview.h>
#include <gtkmm/notebook.h>
#include <gtkmm/combobox.h>
#include <gtkmm/entry.h>
#include <gtkmm/treeview.h>
#include <gtkmm/treestore.h>
#include <gtkmm/liststore.h>
#include <gtkmm/label.h>
#include <gtkmm/box.h>
#include <gtkmm/menubar.h>
#include <gtkmm/window.h>
#include <gtkmm/scrolledwindow.h>

#include <MySQLGRT/MGRT.h>
#include "MGShellView.h"

class MGRTShell : public MGShellInterface, public Gtk::Window {
    class TreeColumns : public Gtk::TreeModel::ColumnRecord {
      public:
        TreeColumns() {
          add(icon); add(text); add(path); add(detail); add(data);
        };
        Gtk::TreeModelColumn<Glib::RefPtr<Gdk::Pixbuf> > icon;
        Gtk::TreeModelColumn<Glib::ustring> text;
        Gtk::TreeModelColumn<Glib::ustring> path;
        Gtk::TreeModelColumn<int> detail;
        Gtk::TreeModelColumn<void*> data;
    } _columns;

    class DetailColumns : public Gtk::TreeModel::ColumnRecord {
      public:
        DetailColumns() {
          add(text); add(value);
        };
        Gtk::TreeModelColumn<Glib::ustring> text;
        Gtk::TreeModelColumn<Glib::ustring> value;
    } _dcolumns;

    Gtk::MenuBar _menu;
    Gtk::VBox _top_box;
    
    Gtk::HPaned _paned;
    Gtk::ScrolledWindow _text_scroll;
    MGShellView _text;
    Gtk::Notebook _sidenote;

    Gtk::VPaned _value_paned;
    Glib::RefPtr<Gtk::TreeStore> _value_store;
    Gtk::VBox _value_box;
    Gtk::ComboBox _value_combo;
    Gtk::ScrolledWindow _value_scroll;
    Gtk::TreeView _value_tree;
    Gtk::Entry _value_entry;
    Gtk::ScrolledWindow _detail_scroll;
    Gtk::TreeView _detail_tree;
    Glib::RefPtr<Gtk::ListStore> _detail_store;

    Gtk::ScrolledWindow _struct_scroll;
    Glib::RefPtr<Gtk::TreeStore> _struct_store;
    Gtk::TreeView _struct_tree;
    
    Gtk::ScrolledWindow _module_scroll;
    Glib::RefPtr<Gtk::TreeStore> _module_store;
    Gtk::VBox _module_box;
    Gtk::TreeView _module_tree;
    Gtk::Label _module_label;
    
    MGRT *_grt;
        
    Glib::ustring _root_path;

    Glib::RefPtr<Gdk::Pixbuf> _simple_icon;
    Glib::RefPtr<Gdk::Pixbuf> _dict_icon;
    Glib::RefPtr<Gdk::Pixbuf> _struct_icon;
    Glib::RefPtr<Gdk::Pixbuf> _list_icon;
    Glib::RefPtr<Gdk::Pixbuf> _folder_icon;
    Glib::RefPtr<Gdk::Pixbuf> _module_icon;
    Glib::RefPtr<Gdk::Pixbuf> _function_icon;

    Gtk::CheckMenuItem *_container_only_item;
    
    void setup_menu();
    
    void set_icon(Gtk::TreeRow row, MGRTValue value);
    Glib::ustring get_caption(MGRTValue value);
    void add_value_item(Gtk::TreeIter iter, MGRTValue value);
    
    void add_list_to_store(MGRTValue list, Gtk::TreeRow &parent, Glib::RefPtr<Gtk::TreeStore> store);
    void add_dict_to_store(MGRTValue dict, Gtk::TreeRow &parent, Glib::RefPtr<Gtk::TreeStore> store);
    

    void value_activated(const Gtk::TreeModel::Path &path,Gtk::TreeViewColumn *column);
    void value_selected();
    void module_selected();

    void toggle_view_option();
    
    void save_tree();

  public:
    MGRTShell(MGRT *grt);

    MGShellView *shell_view();

    Glib::ustring get_prompt();
    void perform_command(const Glib::ustring &command);
    
    void refresh();
};

#endif /* _MGRTSHELL_H_ */