--- /dev/null
+#ifndef _ITEM_DRAIN_H_
+#define _ITEM_DRAIN_H_
+
+#include "item.h"
+
+// Hago una clase porque despues van a tener comportamientos distintos!
+class ViewDrain:public ViewItem {
+public:
+ ViewDrain(Glib::ustring _name, int orientacion);
+ virtual ~ViewDrain();
+};
+
+#endif
void loadExclusa(xmlNodePtr nodo);
void loadTank(xmlNodePtr nodo);
void loadUnion(xmlNodePtr nodo);
-
+ void loadDrain(xmlNodePtr nodo);
+
// Archivo XML del Padre
Glib::RefPtr<Gnome::Glade::Xml> refXml;
item_conduct.cpp \
item_exclusa.cpp \
item_tank.cpp \
- item_union.cpp
+ item_union.cpp \
+ item_drain.cpp
plaqui_client_LDADD = @PACKAGE_LIBS@ ../../Server/src/server.a -lsocket++
</child>
<child>
- <widget class="GtkImage" id="ico_conected">
+ <widget class="GtkFrame" id="frame5">
<property name="visible">True</property>
- <property name="stock">gtk-no</property>
- <property name="icon_size">3</property>
- <property name="xalign">0.5</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
+ <property name="label_xalign">0</property>
+ <property name="label_yalign">0.5</property>
+ <property name="shadow_type">GTK_SHADOW_OUT</property>
+
+ <child>
+ <widget class="GtkImage" id="ico_conected">
+ <property name="visible">True</property>
+ <property name="stock">gtk-no</property>
+ <property name="icon_size">3</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ </child>
</widget>
<packing>
<property name="padding">0</property>
--- /dev/null
+
+#include "item_drain.h"
+#include <iostream>
+
+ViewDrain::ViewDrain(Glib::ustring _name, int orientacion):ViewItem(_name)
+{
+ switch (orientacion) {
+ case 0:
+ image.set("drain_n.png");
+ break;
+ case 1:
+ image.set("drain_e.png");
+ break;
+ case 2:
+ image.set("drain_s.png");
+ break;
+ case 3:
+ image.set("drain_o.png");
+ }
+ image.show();
+ set_size_request();
+}
+
+ViewDrain::~ViewDrain()
+{
+}
+
#include "item_tank.h"
#include "item_pump.h"
#include "item_union.h"
+#include "item_drain.h"
Principal::Principal(BaseObjectType *co, const Glib::RefPtr<Gnome::Glade::Xml> &rg):Gtk::Window(co),refXml(rg)
{
loadTank(items);
} else if (xmlStrcmp(items->name, BAD_CAST"empalme")==0) {
loadUnion(items);
+ } else if (xmlStrcmp(items->name, BAD_CAST"drenaje")==0) {
+ loadDrain(items);
}
+
}
items = items->next;
}
mapItems[name] = b;
}
+void Principal::loadDrain(xmlNodePtr nodo)
+{
+ Glib::ustring name = (char *)xmlGetProp(nodo, BAD_CAST"nombre");
+ int orientacion=0, x, y;
+
+ nodo = nodo->children;
+ while (nodo != NULL) {
+ if (nodo->type == XML_ELEMENT_NODE) {
+ if (xmlStrcmp(nodo->name, BAD_CAST"orientacion") == 0) {
+ orientacion = atoi( (char *)XML_GET_CONTENT(nodo->children) );
+ } else if (xmlStrcmp(nodo->name, BAD_CAST"x") == 0) {
+ x = atoi( (char *)XML_GET_CONTENT(nodo->children) );
+ } else if (xmlStrcmp(nodo->name, BAD_CAST"y") == 0) {
+ y = atoi( (char *)XML_GET_CONTENT(nodo->children) );
+ }
+ }
+ nodo = nodo->next;
+ }
+
+ // listo, ya recolecte todos los datos, ahora creo el objeto!
+ ViewDrain *b = Gtk::manage( new ViewDrain(name, orientacion) );
+ b->signal_button_release_event().connect(SigC::bind( SigC::slot(*this, &Principal::on_item_clicked), b) );
+ b->set_position(x,y);
+ work_place->put(*b, x, y);
+ b->show();
+ // los agrego al hash
+ mapItems[name] = b;
+}