labgrid: code refactoring to avoid duplication for adding reset buttons

This commit is contained in:
Alberto Griggio
2018-11-01 14:25:06 +01:00
parent e9f0b6ac60
commit a8bbc9cb8b
4 changed files with 82 additions and 63 deletions

View File

@@ -43,7 +43,7 @@
#include "toolpanel.h"
class LabGrid: public Gtk::DrawingArea, public BackBuffer {
class LabGridArea: public Gtk::DrawingArea, public BackBuffer {
private:
rtengine::ProcEvent evt;
Glib::ustring evtMsg;
@@ -73,7 +73,7 @@ private:
void getLitPoint();
public:
LabGrid(rtengine::ProcEvent evt, const Glib::ustring &msg, bool enable_low=true);
LabGridArea(rtengine::ProcEvent evt, const Glib::ustring &msg, bool enable_low=true);
void getParams(double &la, double &lb, double &ha, double &hb) const;
void setParams(double la, double lb, double ha, double hb, bool notify);
@@ -96,3 +96,24 @@ public:
void get_preferred_height_for_width_vfunc (int width, int &minimum_height, int &natural_height) const;
};
class LabGrid: public Gtk::HBox {
private:
LabGridArea grid;
bool resetPressed(GdkEventButton *event);
public:
LabGrid(rtengine::ProcEvent evt, const Glib::ustring &msg, bool enable_low=true);
void getParams(double &la, double &lb, double &ha, double &hb) const { return grid.getParams(la, lb, ha, hb); }
void setParams(double la, double lb, double ha, double hb, bool notify) { grid.setParams(la, lb, ha, hb, notify); }
void setDefault (double la, double lb, double ha, double hb) { grid.setDefault(la, lb, ha, hb); }
void setEdited(bool yes) { grid.setEdited(yes); }
bool getEdited() const { return grid.getEdited(); }
void reset(bool toInitial) { grid.reset(toInitial); }
void setListener(ToolPanelListener *l) { grid.setListener(l); }
bool lowEnabled() const { return grid.lowEnabled(); }
void setLowEnabled(bool yes) { grid.setLowEnabled(yes); }
};