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();
virtual ~cButton();
void draw();
cButton& operator=(cButton& other) = delete;
cButton(cButton& other) = delete;
protected:
eBtnType type;
click_callback_t onClick;
@@ -83,6 +85,8 @@ public:
void setState(eLedState to);
eLedState getState();
void draw();
cLed& operator=(cLed& other) = delete;
cLed(cLed& other) = delete;
private:
eLedState state;
eFont textFont;
@@ -100,6 +104,8 @@ class cLedGroup : public cControl {
std::string fromList;
std::string curSelect, prevSelect;
std::string clicking;
cLedGroup& operator=(cLedGroup& other) = delete;
cLedGroup(cLedGroup& other) = delete;
public:
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

View File

@@ -100,6 +100,8 @@ public:
cControl(eControlType t, cDialog& p);
virtual ~cControl();
virtual void draw() = 0;
cControl& operator=(cControl& other) = delete;
cControl(cControl& other) = delete;
protected:
cDialog* parent;
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 attachFocusHandlers(std::function<bool(cDialog&,std::string,bool)> handler, std::vector<std::string> controls);
RECT getBounds() {return winRect;}
cDialog& operator=(cDialog& other) = delete;
cDialog(cDialog& other) = delete;
private:
void draw();
std::string process_keystroke(cKey keyHit);

View File

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

View File

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

View File

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

View File

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