Make all the controls non-copyable so that I don't get weird, insidious, hard-to-track errors from forgetting a reference mark like I did when converting the edit item type dialogs

This commit is contained in:
2014-11-29 02:14:48 -05:00
parent c855983de4
commit ed056368c1
7 changed files with 18 additions and 0 deletions

View File

@@ -55,6 +55,8 @@ public:
eBtnType getType(); eBtnType getType();
virtual ~cButton(); virtual ~cButton();
void draw(); void draw();
cButton& operator=(cButton& other) = delete;
cButton(cButton& other) = delete;
protected: protected:
eBtnType type; eBtnType type;
click_callback_t onClick; click_callback_t onClick;
@@ -83,6 +85,8 @@ public:
void setState(eLedState to); void setState(eLedState to);
eLedState getState(); eLedState getState();
void draw(); void draw();
cLed& operator=(cLed& other) = delete;
cLed(cLed& other) = delete;
private: private:
eLedState state; eLedState state;
eFont textFont; eFont textFont;
@@ -100,6 +104,8 @@ class cLedGroup : public cControl {
std::string fromList; std::string fromList;
std::string curSelect, prevSelect; std::string curSelect, prevSelect;
std::string clicking; std::string clicking;
cLedGroup& operator=(cLedGroup& other) = delete;
cLedGroup(cLedGroup& other) = delete;
public: public:
void attachClickHandler(click_callback_t f) throw(); // activated whenever a click is received, even on the currently active LED void attachClickHandler(click_callback_t f) throw(); // activated whenever a click is received, even on the currently active LED
void attachFocusHandler(focus_callback_t f) throw(); // activated only when the selection changes void attachFocusHandler(focus_callback_t f) throw(); // activated only when the selection changes

View File

@@ -100,6 +100,8 @@ public:
cControl(eControlType t, cDialog& p); cControl(eControlType t, cDialog& p);
virtual ~cControl(); virtual ~cControl();
virtual void draw() = 0; virtual void draw() = 0;
cControl& operator=(cControl& other) = delete;
cControl(cControl& other) = delete;
protected: protected:
cDialog* parent; cDialog* parent;
sf::RenderWindow* inWindow; sf::RenderWindow* inWindow;

View File

@@ -66,6 +66,8 @@ public:
void attachClickHandlers(std::function<bool(cDialog&,std::string,eKeyMod)> handler, std::vector<std::string> controls); void attachClickHandlers(std::function<bool(cDialog&,std::string,eKeyMod)> handler, std::vector<std::string> controls);
void attachFocusHandlers(std::function<bool(cDialog&,std::string,bool)> handler, std::vector<std::string> controls); void attachFocusHandlers(std::function<bool(cDialog&,std::string,bool)> handler, std::vector<std::string> controls);
RECT getBounds() {return winRect;} RECT getBounds() {return winRect;}
cDialog& operator=(cDialog& other) = delete;
cDialog(cDialog& other) = delete;
private: private:
void draw(); void draw();
std::string process_keystroke(cKey keyHit); std::string process_keystroke(cKey keyHit);

View File

@@ -34,6 +34,8 @@ public:
void draw(); void draw();
bool hasFocus(); bool hasFocus();
void handleInput(cKey key); void handleInput(cKey key);
cTextField& operator=(cTextField& other) = delete;
cTextField(cTextField& other) = delete;
private: private:
bool isNumericField; bool isNumericField;
focus_callback_t onFocus; focus_callback_t onFocus;

View File

@@ -29,6 +29,8 @@ public:
bool isClickable(); bool isClickable();
virtual ~cTextMsg(); virtual ~cTextMsg();
void draw(); void draw();
cTextMsg& operator=(cTextMsg& other) = delete;
cTextMsg(cTextMsg& other) = delete;
private: private:
bool drawFramed, clickable; bool drawFramed, clickable;
short textSize; short textSize;

View File

@@ -113,6 +113,8 @@ public:
static void advanceAnim(); static void advanceAnim();
virtual ~cPict(); virtual ~cPict();
void draw(); void draw();
cPict& operator=(cPict& other) = delete;
cPict(cPict& other) = delete;
private: private:
static std::shared_ptr<sf::Texture> getSheet(eSheetType type, size_t n = 0); static std::shared_ptr<sf::Texture> getSheet(eSheetType type, size_t n = 0);
static short animFrame; static short animFrame;

View File

@@ -42,6 +42,8 @@ public:
void setMaximum(long to); void setMaximum(long to);
void setPageSize(long to); void setPageSize(long to);
void draw(); void draw();
cScrollbar& operator=(cScrollbar& other) = delete;
cScrollbar(cScrollbar& other) = delete;
}; };
#endif #endif