From 9e734d5c477df1f82e67b6463d2d426d2152a448 Mon Sep 17 00:00:00 2001 From: Celtic Minstrel Date: Sat, 6 Dec 2014 00:56:07 -0500 Subject: [PATCH] Remove redundantly duplicated functions in cButton --- osx/dialogxml/button.cpp | 16 ++++------------ osx/dialogxml/button.h | 4 +--- osx/dialogxml/dlogutil.cpp | 2 +- 3 files changed, 6 insertions(+), 16 deletions(-) diff --git a/osx/dialogxml/button.cpp b/osx/dialogxml/button.cpp index cf0e0ba9..18550cf4 100644 --- a/osx/dialogxml/button.cpp +++ b/osx/dialogxml/button.cpp @@ -104,14 +104,6 @@ sf::Color cButton::getColour() throw(xUnsupportedProp) { return sf::Color(); } -void cButton::setBtnType(eBtnType newType) { - type = newType; -} - -eBtnType cButton::getBtnType() { - return type; -} - // Indices within the buttons array. size_t cButton::btnGW[14] = { 0, // BTN_SM @@ -192,7 +184,7 @@ cLed::cLed(cDialog* parent) : textFont(FONT_BOLD), textSize(10), color(parent->defTextClr) { - setBtnType(BTN_LED); + type = BTN_LED; } void cLed::attachClickHandler(click_callback_t f) throw(){ @@ -477,11 +469,11 @@ void cLedGroup::draw(){ } } -void cButton::setType(eBtnType newType){ - if(type == BTN_LED) return; // can't change type +void cButton::setBtnType(eBtnType newType){ + if(type == BTN_LED || newType == BTN_LED) return; // can't change type type = newType; } -eBtnType cButton::getType(){ +eBtnType cButton::getBtnType(){ return type; } diff --git a/osx/dialogxml/button.h b/osx/dialogxml/button.h index e30fcd22..bad8f443 100644 --- a/osx/dialogxml/button.h +++ b/osx/dialogxml/button.h @@ -47,12 +47,10 @@ public: short getFormat(eFormat prop) throw(xUnsupportedProp); void setColour(sf::Color clr) throw(xUnsupportedProp); sf::Color getColour() throw(xUnsupportedProp); - void setBtnType(eBtnType type); + void setBtnType(eBtnType newType); eBtnType getBtnType(); explicit cButton(cDialog* parent); bool isClickable(); - void setType(eBtnType newType); - eBtnType getType(); virtual ~cButton(); void draw(); cButton& operator=(cButton& other) = delete; diff --git a/osx/dialogxml/dlogutil.cpp b/osx/dialogxml/dlogutil.cpp index 46a41147..ddba7b9d 100644 --- a/osx/dialogxml/dlogutil.cpp +++ b/osx/dialogxml/dlogutil.cpp @@ -366,7 +366,7 @@ void cThreeChoice::init_buttons(cBasicButtonType btn1, cBasicButtonType btn2, cB cButton* btn = new cButton(me); btn->attachKey(btns[i]->defaultKey); btn->setText(btns[i]->label); - btn->setType(btns[i]->type); + btn->setBtnType(btns[i]->type); btn->attachClickHandler(std::bind(&cChoiceDlog::onClick,this,_1,_2)); switch(btns[i]->type){ case BTN_HELP: