Remove redundantly duplicated functions in cButton
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
@@ -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;
|
||||
|
@@ -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:
|
||||
|
Reference in New Issue
Block a user