diff --git a/src/dialogxml/button.hpp b/src/dialogxml/button.hpp index 45998d09..638085b3 100644 --- a/src/dialogxml/button.hpp +++ b/src/dialogxml/button.hpp @@ -114,11 +114,11 @@ public: /// default toggle-selected action of an LED. /// @return true to indicate the event should continue. static bool noAction(cDialog&,std::string,eKeyMod) {return true;} - std::string parse(ticpp::Element& who, std::string fname); - void setFormat(eFormat prop, short val) throw(xUnsupportedProp); - short getFormat(eFormat prop) throw(xUnsupportedProp); - storage_t store(); - void restore(storage_t to); + std::string parse(ticpp::Element& who, std::string fname) override; + void setFormat(eFormat prop, short val) throw(xUnsupportedProp) override; + short getFormat(eFormat prop) throw(xUnsupportedProp) override; + storage_t store() override; + void restore(storage_t to) override; /// Create a new LED button. /// @param parent The parent dialog. explicit cLed(cDialog& parent); @@ -129,11 +129,11 @@ public: /// Get the LED's current state. /// @return The current state. eLedState getState(); - void draw(); + void draw() override; /// @copydoc cControl::getSupportedHandlers /// /// @todo Document possible handlers - const std::set getSupportedHandlers() const { + const std::set getSupportedHandlers() const override { return {EVT_CLICK, EVT_FOCUS, EVT_DEFOCUS}; } cLed& operator=(cLed& other) = delete; @@ -176,8 +176,8 @@ class cLedGroup : public cContainer { cLedGroup(cLedGroup& other) = delete; public: /// @deprecated in favour of @ref attachEventHandler - void attachFocusHandler(std::function f) throw(xHandlerNotSupported); - std::string parse(ticpp::Element& who, std::string fname); + void attachFocusHandler(std::function f) throw(xHandlerNotSupported) override; + std::string parse(ticpp::Element& who, std::string fname) override; /// @copydoc cControl::attachClickHandler() /// /// The click handler is called whenever an LED in the group is clicked, even if it's the currently selected LED. @@ -186,11 +186,11 @@ public: /// The third parameter is always false for an LED group's focus handler. /// You can determine what changed using getPrevSelection() and getSelected(), and can do whatever post-processing /// you want, including selecting a completely different option. - const std::set getSupportedHandlers() const { + const std::set getSupportedHandlers() const override { return {EVT_CLICK, EVT_FOCUS}; } - storage_t store(); - void restore(storage_t to); + storage_t store() override; + void restore(storage_t to) override; /// Add a new LED to this group. /// @param ctrl A pointer to the LED, which should already be constructed. /// @param key A key to be used to look up the LED later. @@ -210,24 +210,24 @@ public: /// Show one of the choices in this group. /// @param id The unique key of the choice. void show(std::string id); - void setFormat(eFormat prop, short val) throw(xUnsupportedProp); - short getFormat(eFormat prop) throw(xUnsupportedProp); - void setColour(sf::Color clr) throw(xUnsupportedProp); - sf::Color getColour() throw(xUnsupportedProp); + void setFormat(eFormat prop, short val) throw(xUnsupportedProp) override; + short getFormat(eFormat prop) throw(xUnsupportedProp) override; + void setColour(sf::Color clr) throw(xUnsupportedProp) override; + sf::Color getColour() throw(xUnsupportedProp) override; /// Create a new LED group. /// @param parent The parent dialog. explicit cLedGroup(cDialog& parent); - bool isClickable(); - bool isFocusable(); - bool isScrollable(); - bool handleClick(location where); + bool isClickable() override; + bool isFocusable() override; + bool isScrollable() override; + bool handleClick(location where) override; virtual ~cLedGroup(); /// Get one of the LEDs in this group. /// @param id The unique key of the choice. /// @return A reference to the LED object. /// @throw std::invalid_argument if the choice does not exist in the group. - cLed& getChild(std::string id); - bool hasChild(std::string id); + cLed& getChild(std::string id) override; + bool hasChild(std::string id) override; /// Set the currently selected LED in this group. /// @param id The unique key of the choice. /// @throw std::invalid_argument if the choice does not exist in the group. @@ -248,6 +248,6 @@ public: void forEach(std::function callback) override; /// A convenience type for making an iterator into the choice map. typedef std::map::iterator ledIter; - void draw(); + void draw() override; }; #endif diff --git a/src/dialogxml/control.hpp b/src/dialogxml/control.hpp index b3e3f669..5dbee0d4 100644 --- a/src/dialogxml/control.hpp +++ b/src/dialogxml/control.hpp @@ -396,8 +396,8 @@ public: virtual void forEach(std::function callback) = 0; /// @copydoc getChild() cControl& operator[](std::string id) {return getChild(id);} - bool isContainer() {return true;} - bool handleClick(location where); + bool isContainer() override {return true;} + bool handleClick(location where) override; }; // This is defined here instead of in dialog.hpp because it needs cControl to be complete. diff --git a/src/dialogxml/field.hpp b/src/dialogxml/field.hpp index d8e36898..8088e6c2 100644 --- a/src/dialogxml/field.hpp +++ b/src/dialogxml/field.hpp @@ -33,36 +33,36 @@ enum eFldType { /// There is no Unicode support. class cTextField : public cControl { public: - std::string parse(ticpp::Element& who, std::string fname); + std::string parse(ticpp::Element& who, std::string fname) override; /// For text fields, this is triggered when it loses or gains the input focus. /// @copydoc cControl::getSupportedHandlers /// /// @todo Document possible handlers - const std::set getSupportedHandlers() const { + const std::set getSupportedHandlers() const override { return {EVT_FOCUS, EVT_DEFOCUS}; } - bool handleClick(location where); - void setFormat(eFormat prop, short val) throw(xUnsupportedProp); - short getFormat(eFormat prop) throw(xUnsupportedProp); - void setColour(sf::Color clr) throw(xUnsupportedProp); - void setText(std::string to); - storage_t store(); - void restore(storage_t to); + bool handleClick(location where) override; + void setFormat(eFormat prop, short val) throw(xUnsupportedProp) override; + short getFormat(eFormat prop) throw(xUnsupportedProp) override; + void setColour(sf::Color clr) throw(xUnsupportedProp) override; + void setText(std::string to) override; + storage_t store() override; + void restore(storage_t to) override; /// Get the current input type of the field. /// @return The input type. eFldType getInputType(); /// Set the input type of the field. /// @param newType The new input type. void setInputType(eFldType newType); - sf::Color getColour() throw(xUnsupportedProp); + sf::Color getColour() throw(xUnsupportedProp) override; /// Create a new editable text field. /// @param parent The parent dialog. explicit cTextField(cDialog& parent); - bool isClickable(); - bool isFocusable(); - bool isScrollable(); + bool isClickable() override; + bool isFocusable() override; + bool isScrollable() override; virtual ~cTextField(); - void draw(); + void draw() override; /// Check if this text field currently has input focus. /// @return true if it it is currently focused. bool hasFocus(); diff --git a/src/dialogxml/scrollpane.hpp b/src/dialogxml/scrollpane.hpp index 268bd822..5ea1699d 100644 --- a/src/dialogxml/scrollpane.hpp +++ b/src/dialogxml/scrollpane.hpp @@ -23,19 +23,19 @@ class cScrollPane : public cContainer { public: /// Create a new scroll pane explicit cScrollPane(cDialog& parent); - std::string parse(ticpp::Element& who, std::string fname); - bool handleClick(location where); - void setFormat(eFormat prop, short val) throw(xUnsupportedProp); - short getFormat(eFormat prop) throw(xUnsupportedProp); - void setColour(sf::Color clr) throw(xUnsupportedProp); - sf::Color getColour() throw(xUnsupportedProp); - bool hasChild(std::string id); - cControl& getChild(std::string id); - storage_t store(); - void restore(storage_t to); - bool isClickable(); - bool isFocusable(); - bool isScrollable(); + std::string parse(ticpp::Element& who, std::string fname) override; + bool handleClick(location where) override; + void setFormat(eFormat prop, short val) throw(xUnsupportedProp) override; + short getFormat(eFormat prop) throw(xUnsupportedProp) override; + void setColour(sf::Color clr) throw(xUnsupportedProp) override; + sf::Color getColour() throw(xUnsupportedProp) override; + bool hasChild(std::string id) override; + cControl& getChild(std::string id) override; + storage_t store() override; + void restore(storage_t to) override; + bool isClickable() override; + bool isFocusable() override; + bool isScrollable() override; /// Add a new control to this pane. /// @param ctrl A pointer to the control, which should already be constructed. /// @param key A key to be used to look up the control later. @@ -58,11 +58,11 @@ public: /// Set the scrollbar style. /// @param newStyle The new style. void setStyle(eScrollStyle newStyle); - void draw(); + void draw() override; /// @copydoc cControl::getSupportedHandlers /// /// @todo Document possible handlers - const std::set getSupportedHandlers() const { + const std::set getSupportedHandlers() const override { return {EVT_CLICK, EVT_SCROLL, EVT_FOCUS, EVT_DEFOCUS}; } void forEach(std::function callback) override; diff --git a/src/dialogxml/stack.hpp b/src/dialogxml/stack.hpp index bf27b38d..886e9e1f 100644 --- a/src/dialogxml/stack.hpp +++ b/src/dialogxml/stack.hpp @@ -38,17 +38,17 @@ class cStack : public cContainer { std::map controls; bool drawFramed = false; public: - std::string parse(ticpp::Element& who, std::string fname); - void setFormat(eFormat prop, short val) throw(xUnsupportedProp); - short getFormat(eFormat prop) throw(xUnsupportedProp); - void setColour(sf::Color clr) throw(xUnsupportedProp); - sf::Color getColour() throw(xUnsupportedProp); - bool isClickable(); - bool isFocusable(); - bool isScrollable(); - void draw(); - bool hasChild(std::string id); - cControl& getChild(std::string id); + std::string parse(ticpp::Element& who, std::string fname) override; + void setFormat(eFormat prop, short val) throw(xUnsupportedProp) override; + short getFormat(eFormat prop) throw(xUnsupportedProp) override; + void setColour(sf::Color clr) throw(xUnsupportedProp) override; + sf::Color getColour() throw(xUnsupportedProp) override; + bool isClickable() override; + bool isFocusable() override; + bool isScrollable() override; + void draw() override; + bool hasChild(std::string id) override; + cControl& getChild(std::string id) override; /// Switch the stack to a particular page. /// You need to do this before retrieving data from that page. /// @param The new page number @@ -79,7 +79,7 @@ public: /// @copydoc cControl::getSupportedHandlers /// /// @todo Document possible handlers - const std::set getSupportedHandlers() const { + const std::set getSupportedHandlers() const override { return {EVT_CLICK, EVT_FOCUS, EVT_DEFOCUS}; } void forEach(std::function callback) override;