1 #ifndef _CONSTRUCTOR_H_
2 #define _CONSTRUCTOR_H_
5 #include <libglademm.h>
7 #include <gtkmm/window.h>
9 #include <gtkmm/button.h>
10 #include <gtkmm/fixed.h>
11 #include <gtkmm/scrolledwindow.h>
12 #include <gtkmm/checkbutton.h>
13 #include <gtkmm/fileselection.h>
14 #include <gtkmm/entry.h>
15 #include "workplace.h"
27 #include "libxml/parser.h"
29 class Constructor : public Gtk::Window {
31 Constructor(BaseObjectType* cobject, const Glib::RefPtr<Gnome::Glade::Xml>& refGlade);
32 virtual ~Constructor();
36 std::string file_name;
39 // / defino los elementos de la ventana.
40 Gtk::Button *btn_canio, *btn_codo, *btn_y, *btn_tanque, *btn_bomba, *btn_exclusa, *btn_drain, *btn_file_ok, *btn_file_cancel, *btn_check, *btn_dlg_close,
41 *btn_and, *btn_or, *btn_not, *btn_open_ok, *btn_open_cancel, *quick_btn_clear, *quick_btn_save, *quick_btn_open, *quick_btn_new;
42 Gtk::ImageMenuItem *main_menu_quit,*main_menu_new, *edit_menu_del, *edit_menu_delete_all, *main_menu_save, *main_menu_open;
43 Gtk::CheckButton *chk_btn_logica;
44 Gtk::FileSelection *file_selection, *file_open_selection;
45 Gtk::Entry *combo_entry;
46 Gtk::Dialog *dlg_connect;
47 Gtk::Label *dlg_label;
48 Glib::RefPtr<Gdk::Pixbuf> ico_canio, ico_y, ico_codo, ico_tanque, ico_bomba, ico_exclusa, ico_drain, ico_and, ico_or, ico_not;
49 Glib::RefPtr<Gdk::Pixbuf> ico_last;
50 std::list<Gtk::TargetEntry> listTargets;
51 std::list<CItem *> listaItems, lista_logic_Items;
54 bool can_drop(CItem *, int , int);
56 // /señales de control para los elementos de la ventana.
57 virtual void on_btn_canio_drag_get(const Glib::RefPtr<Gdk::DragContext>& context, GtkSelectionData* selection_data, guint info, guint time);
58 virtual void on_btn_y_drag_get(const Glib::RefPtr<Gdk::DragContext>& context, GtkSelectionData* selection_data, guint info, guint time);
59 virtual void on_btn_codo_drag_get(const Glib::RefPtr<Gdk::DragContext>& context, GtkSelectionData* selection_data, guint info, guint time);
60 virtual void on_btn_tanque_drag_get(const Glib::RefPtr<Gdk::DragContext>& context, GtkSelectionData* selection_data, guint info, guint time);
61 virtual void on_btn_bomba_drag_get(const Glib::RefPtr<Gdk::DragContext>& context, GtkSelectionData* selection_data, guint info, guint time);
62 virtual void on_btn_exclusa_drag_get(const Glib::RefPtr<Gdk::DragContext>& context, GtkSelectionData* selection_data, guint info, guint time);
63 virtual void on_btn_drain_drag_get(const Glib::RefPtr<Gdk::DragContext>& context, GtkSelectionData* selection_data, guint info, guint time);
64 virtual void on_btn_and_drag_get(const Glib::RefPtr<Gdk::DragContext>& context, GtkSelectionData* selection_data, guint info, guint time);
65 virtual void on_btn_or_drag_get(const Glib::RefPtr<Gdk::DragContext>& context, GtkSelectionData* selection_data, guint info, guint time);
66 virtual void on_btn_not_drag_get(const Glib::RefPtr<Gdk::DragContext>& context, GtkSelectionData* selection_data, guint info, guint time);
67 virtual void on_main_menu_quit();
68 virtual void on_main_menu_open();
69 virtual void on_main_menu_save();
70 virtual void on_edit_menu_del();
71 virtual void on_edit_menu_delete_all();
72 virtual void on_chk_btn_clicked();
73 virtual void on_btn_open_cancel_clicked();
74 virtual void on_btn_file_ok_clicked();
75 virtual void on_btn_file_cancel_clicked();
76 virtual void on_btn_check_clicked();
77 virtual void on_btn_dlg_connect_clicked();
78 virtual void on_load_from_xml();
79 virtual void on_quick_btn_delete_all_clicked();
80 virtual void on_quick_btn_save_clicked();
81 virtual void on_quick_btn_new_clicked();
83 bool check_connection(Glib::ustring& name);
85 // señales para cambiar el icono.
86 virtual void on_canio_drag_begin(const Glib::RefPtr<Gdk::DragContext>& context);
87 virtual void on_y_drag_begin(const Glib::RefPtr<Gdk::DragContext>& context);
88 virtual void on_codo_drag_begin(const Glib::RefPtr<Gdk::DragContext>& context);
89 virtual void on_tanque_drag_begin(const Glib::RefPtr<Gdk::DragContext>& context);
90 virtual void on_bomba_drag_begin(const Glib::RefPtr<Gdk::DragContext>& context);
91 virtual void on_exclusa_drag_begin(const Glib::RefPtr<Gdk::DragContext>& context);
92 virtual void on_drain_drag_begin(const Glib::RefPtr<Gdk::DragContext>& context);
93 virtual void on_and_drag_begin(const Glib::RefPtr<Gdk::DragContext>& context);
94 virtual void on_or_drag_begin(const Glib::RefPtr<Gdk::DragContext>& context);
95 virtual void on_not_drag_begin(const Glib::RefPtr<Gdk::DragContext>& context);
97 virtual void on_item_drag_begin(const Glib::RefPtr<Gdk::DragContext>& context, CItem *);
98 virtual void on_item_drag_data_get(const Glib::RefPtr<Gdk::DragContext>& context, GtkSelectionData* selection_data, guint info, guint time);
100 virtual void on_item_drop_drag_received(const Glib::RefPtr<Gdk::DragContext>& context, int x, int y, GtkSelectionData* selection_data, guint info, guint time);
102 // Carga desde un XML
103 Pump *loadBomba(xmlNodePtr nodo);
104 Conduct *loadConduct(xmlNodePtr nodo);
105 Exclusa *loadExclusa(xmlNodePtr nodo);
106 Cistern *loadTank(xmlNodePtr nodo);
107 Union *loadUnion(xmlNodePtr nodo);
108 Drain *loadDrain(xmlNodePtr nodo);
109 Splitter *loadCodo(xmlNodePtr nodo);