Cistern::Cistern()
{
+ caudal = 56;
+ fluido_max = 23;
imageE = Gdk::Pixbuf::create_from_file("tanque_e.png");
imageO = Gdk::Pixbuf::create_from_file("tanque_o.png");
null = Gdk::Pixbuf::create_from_file("tanque_null.png");
catch(const Gnome::Glade::XmlError &ex) {
std::cerr << ex.what() << std::endl;
}
- ref->get_widget_derived("cistern_pty_wnd",property_wnd);
+ ref->get_widget_derived("cistern_pty_wnd",cistern_pty_wnd);
}
Cistern::~Cistern()
}
if ((event->type == GDK_2BUTTON_PRESS) && (event->button ==1)){
- property_wnd->show();
+ cistern_pty_wnd->show();
}
return true;
}
void Cistern::on_menu_popup_propiedades()
{
+ cistern_pty_wnd->spin_caudal->set_value(caudal);
+ cistern_pty_wnd->spin_fluido_max->set_value(fluido_max);
GdkEventButton event;
event.type = GDK_2BUTTON_PRESS;
event.button = 1;
#define _CISTERN_H_
#include "item.h"
+#include "cisternptywnd.h"
class Cistern : public CItem {
public:
virtual bool on_button_press_event(GdkEventButton *event);
virtual void on_menu_popup_rotar();
virtual void on_menu_popup_propiedades();
- private:
+ protected:
+ double caudal, fluido_max;
int imgActual;
-
Glib::RefPtr<Gdk::Pixbuf> imageE; // 0
Glib::RefPtr<Gdk::Pixbuf> imageO; // 1
Glib::RefPtr<Gdk::Pixbuf> null;
+
+ CisternPtyWnd *cistern_pty_wnd;
};
#endif
--- /dev/null
+#include "cisternptywnd.h"
+
+CisternPtyWnd::CisternPtyWnd(BaseObjectType* cobject, const Glib::RefPtr<Gnome::Glade::Xml>& refGlade):PropertyWnd(cobject,refGlade)
+{
+ refGlade->get_widget("spin_caudal", spin_caudal);
+ refGlade->get_widget("spin_fluido_max", spin_fluido_max);
+}
+
+CisternPtyWnd::~CisternPtyWnd()
+{
+}
+
+void CisternPtyWnd::on_btn_accept_clicked()
+{
+ hide();
+}
--- /dev/null
+//cisternptywnd.h
+#ifndef _CISTERNPTYWND_H_
+#define _CISTERNPTYWND_H_
+
+#include "propertywnd.h"
+
+class CisternPtyWnd : public PropertyWnd {
+ public:
+ CisternPtyWnd(BaseObjectType* cobject, const Glib::RefPtr<Gnome::Glade::Xml>& refGlade);
+ virtual ~CisternPtyWnd();
+ //protected:
+ Gtk::SpinButton *spin_caudal, *spin_fluido_max;
+ virtual void on_btn_accept_clicked();
+};
+
+
+#endif
catch(const Gnome::Glade::XmlError &ex) {
std::cerr << ex.what() << std::endl;
}
- //tengo que crear una clase para esta ventana..!!!
ref->get_widget_derived("conduct_pty_wnd",property_wnd);
}
<property name="column_spacing">0</property>
<child>
- <widget class="GtkSpinButton" id="spinbutton7">
+ <widget class="GtkSpinButton" id="spin_caudal">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="climb_rate">1</property>
- <property name="digits">0</property>
- <property name="numeric">False</property>
+ <property name="digits">1</property>
+ <property name="numeric">True</property>
<property name="update_policy">GTK_UPDATE_ALWAYS</property>
<property name="snap_to_ticks">False</property>
<property name="wrap">False</property>
- <property name="adjustment">1 0 100 1 10 10</property>
+ <property name="adjustment">0 0 100 0.1 10 10</property>
</widget>
<packing>
<property name="left_attach">1</property>
</child>
<child>
- <widget class="GtkSpinButton" id="spinbutton8">
+ <widget class="GtkSpinButton" id="spin_fluido_max">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="climb_rate">1</property>
- <property name="digits">0</property>
- <property name="numeric">False</property>
+ <property name="digits">1</property>
+ <property name="numeric">True</property>
<property name="update_policy">GTK_UPDATE_ALWAYS</property>
<property name="snap_to_ticks">False</property>
<property name="wrap">False</property>
- <property name="adjustment">1 0 100 1 10 10</property>
+ <property name="adjustment">0 0 100 0.1 10 10</property>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="climb_rate">1</property>
- <property name="digits">0</property>
- <property name="numeric">False</property>
+ <property name="digits">1</property>
+ <property name="numeric">True</property>
<property name="update_policy">GTK_UPDATE_ALWAYS</property>
<property name="snap_to_ticks">False</property>
<property name="wrap">False</property>
- <property name="adjustment">1 0 100 1 10 10</property>
+ <property name="adjustment">0 0 100 0.1 10 10</property>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="climb_rate">1</property>
- <property name="digits">0</property>
+ <property name="digits">1</property>
<property name="numeric">False</property>
<property name="update_policy">GTK_UPDATE_ALWAYS</property>
<property name="snap_to_ticks">False</property>
<property name="wrap">False</property>
- <property name="adjustment">1 0 100 1 10 10</property>
+ <property name="adjustment">0 0 100 0.1 10 10</property>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="climb_rate">1</property>
- <property name="digits">0</property>
+ <property name="digits">1</property>
<property name="numeric">False</property>
<property name="update_policy">GTK_UPDATE_ALWAYS</property>
<property name="snap_to_ticks">False</property>
<property name="wrap">False</property>
- <property name="adjustment">1 0 100 1 10 10</property>
+ <property name="adjustment">0 0 100 0.1 10 10</property>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="climb_rate">1</property>
- <property name="digits">0</property>
+ <property name="digits">1</property>
<property name="numeric">False</property>
<property name="update_policy">GTK_UPDATE_ALWAYS</property>
<property name="snap_to_ticks">False</property>
<property name="wrap">False</property>
- <property name="adjustment">1 0 100 1 10 10</property>
+ <property name="adjustment">0 0 100 0.1 10 10</property>
</widget>
<packing>
<property name="left_attach">1</property>
{
image = Gdk::Pixbuf::create_from_file(filename);
set_size_request(image->get_width(), image->get_height());
-
}
CItem::CItem()
{
+ menu_image_propiedades.set(Gtk::Stock::PREFERENCES, Gtk::ICON_SIZE_MENU);
menu_image_delete.set(Gtk::Stock::CANCEL, Gtk::ICON_SIZE_MENU);
menu_image_rotar.set(Gtk::Stock::REFRESH, Gtk::ICON_SIZE_MENU);
Gtk::Menu::MenuList& menulist = menu_popup.items();
- menulist.push_back( Gtk::Menu_Helpers::MenuElem("Propiedades", SigC::slot(*this, &CItem::on_menu_popup_propiedades) ) );
- menulist.push_back( Gtk::Menu_Helpers::ImageMenuElem("Rotar",Gtk::Menu::AccelKey("<control>r"), menu_image_rotar ,SigC::slot(*this, &CItem::on_menu_popup_rotar) ) );
+ menulist.push_back( Gtk::Menu_Helpers::ImageMenuElem("Propiedades",menu_image_propiedades, SigC::slot(*this, &CItem::on_menu_popup_propiedades) ) );
+ menulist.push_back( Gtk::Menu_Helpers::ImageMenuElem("Rotar", menu_image_rotar ,SigC::slot(*this, &CItem::on_menu_popup_rotar) ) );
menulist.push_back( Gtk::Menu_Helpers::ImageMenuElem("Eliminar", menu_image_delete,SigC::slot(*this, &CItem::on_menu_popup_eliminar) ) ) ;
menu_popup.accelerate(*this);
}
#include <iostream>
#include <gtkmm/drawingarea.h>
+#include <gtkmm/spinbutton.h>
#include <gtkmm/stock.h>
#include <gtkmm.h>
#include <gdkmm.h>
#include <libglademm.h>
#include "propertywnd.h"
+
class CItem:public Gtk::DrawingArea {
public:
CItem();
Glib::RefPtr<Gdk::Pixbuf> get_image() { return image; }
protected:
Gtk::Menu menu_popup;
- Gtk::Image menu_image_delete, menu_image_rotar;
+ Gtk::Image menu_image_delete, menu_image_rotar, menu_image_propiedades;
Glib::RefPtr<Gdk::Pixbuf> image;
PropertyWnd *property_wnd;
};
#include "propertywnd.h"
PropertyWnd::PropertyWnd()
-{
+{
}
PropertyWnd::PropertyWnd(BaseObjectType* cobject, const Glib::RefPtr<Gnome::Glade::Xml>& refGlade): Gtk::Window(cobject)
refGlade->get_widget("btn_accept", btn_accept);
btn_cancel->signal_clicked().connect(SigC::slot(*this, &PropertyWnd::on_btn_cancel_clicked));
+ btn_accept->signal_clicked().connect(SigC::slot(*this, &PropertyWnd::on_btn_accept_clicked));
}
PropertyWnd::~PropertyWnd()
hide();
//oculto la ventana, tengo que ver como hago para cerrarla del todo.
}
+
+void PropertyWnd::on_btn_accept_clicked()
+{
+}
#include <gtkmm/window.h>
#include <gtkmm/button.h>
+#include <gtkmm/spinbutton.h>
#include <libglademm.h>
class PropertyWnd : public Gtk::Window{
protected:
Gtk::Button *btn_cancel, *btn_accept, *btn_apply;
virtual void on_btn_cancel_clicked();
+ virtual void on_btn_accept_clicked();
};