bugfix for buttons in message boxes. Init is init and not reuse ...

This commit is contained in:
Titus Tscharntke 2012-10-06 19:01:13 +00:00
parent 60355fa55d
commit 5fd233c72b
2 changed files with 8 additions and 13 deletions

View File

@ -492,6 +492,10 @@ GraphicMessageBox::GraphicMessageBox(std::string containerName, std::string objN
GraphicMessageBox::~GraphicMessageBox(){
//remove buttons
removeButtons();
}
void GraphicMessageBox::removeButtons(){
while(!buttons.empty()){
delete buttons.back();
buttons.pop_back();
@ -500,23 +504,13 @@ GraphicMessageBox::~GraphicMessageBox(){
void GraphicMessageBox::init(const string &button1Str, const string &button2Str, int newWidth, int newHeight){
init(button1Str, newWidth, newHeight);
if(getButtonCount()>1){
getButton(1)->setText(button2Str);
}
else{
addButton(button2Str);
}
addButton(button2Str);
}
void GraphicMessageBox::init(const string &button1Str, int newWidth, int newHeight){
init(newWidth,newHeight);
if(getButtonCount()>0){
getButton(0)->setText(button1Str);
}
else{
addButton(button1Str);
}
removeButtons();
addButton(button1Str);
}
void GraphicMessageBox::init(int newWidth, int newHeight){

View File

@ -273,6 +273,7 @@ public:
void init(const string &button1Str, const string &button2Str, int newWidth=-1,int newHeight=-1);
void init(const string &button1Str, int newWidth=-1,int newHeight=-1);
void init(int newWidth=-1,int newHeight=-1);
void removeButtons();
void addButton(const string &buttonStr, int width=-1,int height=-1);
int getButtonCount() const {return buttons.size();}