+#ifndef _ITEM_H_
+#define _ITEM_H_
-
-#ifndef GTKMM_EXAMPLE_DRAWINGAREALINES_H
-#define GTKMM_EXAMPLE_DRAWINGAREALINES_H
-
+#include <iostream>
#include <gtkmm/drawingarea.h>
+#include <gtkmm/spinbutton.h>
+#include <gtkmm/stock.h>
+#include <gtkmm.h>
#include <gdkmm.h>
+#include <libglademm.h>
+#include <gtkmm/entry.h>
+#include "itemptywnd.h"
+
+typedef enum { NONE, RIGHT, LEFT, MIDDLE } ConnectorSide;
+typedef enum { UNDEF, IN, OUT } ConnectorType;
+
+class Connector {
+ public:
+ int id_dest;
+ ConnectorType type;
+ Connector& operator= (Connector & c) {
+ id_dest = c.id_dest;
+ type = c.type;
+ return *this;
+ }
+};
-//Custom drawing area with modified expose_event.
+class WorkPlace;
+
class CItem:public Gtk::DrawingArea {
public:
CItem();
CItem(const char *filename);
- ~CItem();
+ virtual ~CItem();
virtual bool on_expose_event(GdkEventExpose* event);
+ virtual void on_menu_popup_propiedades();
+ virtual void on_menu_popup_rotar();
+ virtual void on_menu_popup_eliminar();
+ virtual void on_menu_popup_conectar();
Glib::RefPtr<Gdk::Pixbuf> get_image() { return image; }
+ int get_position_x();
+ int get_position_y();
+ int get_id();
+ int get_img_actual();
+ Glib::ustring get_name();
+ double get_caudal();
+ void set_position(int _x, int _y);
+ void set_id(int _id);
+ void set_caudal(double _caudal);
+ void set_name(Glib::ustring _name);
+ bool is_occupied_area(int _a, int _b);
+ ConnectorType is_other_connection_area(int _a, int _b);
+ virtual void save(FILE *archivo) = 0;
+ virtual bool check_connection()=0;
+ virtual void set_default_connector();
+ virtual ConnectorType get_connector_type( int _a, int _b );
+ WorkPlace *workplace;
+ Gtk::Entry *combo_entry;
+ std::list<CItem *> *listaItems;
+ bool is_union;
+ bool is_connected;
+ // Hay que ocultarlo --- problemas con el get y el set!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+ // 0 = izquierda/arriba , 1 = derecha/abajo , 2 = medio. tomando como referencia la imagen inicial de cada item cuando corresponda
+ std::vector<Connector> connect_vec;
protected:
+ int imgActual;
+ int ID;
+ Glib::ustring name;
+ double caudal_max;
+ Gtk::Menu menu_popup;
+ Gtk::Image menu_image_delete, menu_image_rotar, menu_image_propiedades, menu_image_linea;
Glib::RefPtr<Gdk::Pixbuf> image;
+ ItemPtyWnd *property_wnd;
+ int x, y;
};
-#endif //GTKMM_EXAMPLE_DRAWINGAREALINES_H
+#endif