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/combo.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, *btn_find;
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::Combo *combo_entry;
46 Gtk::Dialog *dlg_connect;
47 Gtk::Label *dlg_label;
48 Gtk::Statusbar *status_bar;
49 Glib::RefPtr<Gdk::Pixbuf> ico_canio, ico_y, ico_codo, ico_tanque, ico_bomba, ico_exclusa, ico_drain, ico_and, ico_or, ico_not;
50 Glib::RefPtr<Gdk::Pixbuf> ico_last;
51 std::list<Gtk::TargetEntry> listTargets;
52 std::list<CItem *> listaItems, lista_logic_Items;
53 std::list<Glib::ustring> list_pointed;
56 bool can_drop(CItem *, int , int);
58 // /señales de control para los elementos de la ventana.
59 virtual void on_btn_canio_drag_get(const Glib::RefPtr<Gdk::DragContext>& context, GtkSelectionData* selection_data, guint info, guint time);
60 virtual void on_btn_y_drag_get(const Glib::RefPtr<Gdk::DragContext>& context, GtkSelectionData* selection_data, guint info, guint time);
61 virtual void on_btn_codo_drag_get(const Glib::RefPtr<Gdk::DragContext>& context, GtkSelectionData* selection_data, guint info, guint time);
62 virtual void on_btn_tanque_drag_get(const Glib::RefPtr<Gdk::DragContext>& context, GtkSelectionData* selection_data, guint info, guint time);
63 virtual void on_btn_bomba_drag_get(const Glib::RefPtr<Gdk::DragContext>& context, GtkSelectionData* selection_data, guint info, guint time);
64 virtual void on_btn_exclusa_drag_get(const Glib::RefPtr<Gdk::DragContext>& context, GtkSelectionData* selection_data, guint info, guint time);
65 virtual void on_btn_drain_drag_get(const Glib::RefPtr<Gdk::DragContext>& context, GtkSelectionData* selection_data, guint info, guint time);
66 virtual void on_btn_and_drag_get(const Glib::RefPtr<Gdk::DragContext>& context, GtkSelectionData* selection_data, guint info, guint time);
67 virtual void on_btn_or_drag_get(const Glib::RefPtr<Gdk::DragContext>& context, GtkSelectionData* selection_data, guint info, guint time);
68 virtual void on_btn_not_drag_get(const Glib::RefPtr<Gdk::DragContext>& context, GtkSelectionData* selection_data, guint info, guint time);
69 virtual void on_main_menu_quit();
70 virtual void on_main_menu_open();
71 virtual void on_main_menu_save();
72 virtual void on_edit_menu_del();
73 virtual void on_edit_menu_delete_all();
74 virtual void on_chk_btn_logica_clicked();
75 virtual void on_btn_open_cancel_clicked();
76 virtual void on_btn_file_ok_clicked();
77 virtual void on_btn_file_cancel_clicked();
78 virtual void on_btn_check_clicked();
79 virtual void on_btn_dlg_connect_clicked();
80 virtual void on_load_from_xml();
81 virtual void on_quick_btn_delete_all_clicked();
82 virtual void on_quick_btn_save_clicked();
83 virtual void on_quick_btn_new_clicked();
84 virtual void on_btn_find_clicked();
86 bool check_connection(Glib::ustring& name);
88 // señales para cambiar el icono.
89 virtual void on_canio_drag_begin(const Glib::RefPtr<Gdk::DragContext>& context);
90 virtual void on_y_drag_begin(const Glib::RefPtr<Gdk::DragContext>& context);
91 virtual void on_codo_drag_begin(const Glib::RefPtr<Gdk::DragContext>& context);
92 virtual void on_tanque_drag_begin(const Glib::RefPtr<Gdk::DragContext>& context);
93 virtual void on_bomba_drag_begin(const Glib::RefPtr<Gdk::DragContext>& context);
94 virtual void on_exclusa_drag_begin(const Glib::RefPtr<Gdk::DragContext>& context);
95 virtual void on_drain_drag_begin(const Glib::RefPtr<Gdk::DragContext>& context);
96 virtual void on_and_drag_begin(const Glib::RefPtr<Gdk::DragContext>& context);
97 virtual void on_or_drag_begin(const Glib::RefPtr<Gdk::DragContext>& context);
98 virtual void on_not_drag_begin(const Glib::RefPtr<Gdk::DragContext>& context);
100 virtual void on_item_drag_begin(const Glib::RefPtr<Gdk::DragContext>& context, CItem *);
101 virtual void on_item_drag_data_get(const Glib::RefPtr<Gdk::DragContext>& context, GtkSelectionData* selection_data, guint info, guint time);
103 virtual void on_item_drop_drag_received(const Glib::RefPtr<Gdk::DragContext>& context, int x, int y, GtkSelectionData* selection_data, guint info, guint time);
105 // Carga desde un XML
106 Pump *loadBomba(xmlNodePtr nodo);
107 Conduct *loadConduct(xmlNodePtr nodo);
108 Exclusa *loadExclusa(xmlNodePtr nodo);
109 Cistern *loadTank(xmlNodePtr nodo);
110 Union *loadUnion(xmlNodePtr nodo);
111 Drain *loadDrain(xmlNodePtr nodo);
112 Splitter *loadCodo(xmlNodePtr nodo);