diff --git a/osx/dialogxml/button.cpp b/osx/dialogxml/button.cpp index 537d842b..b9046e3a 100644 --- a/osx/dialogxml/button.cpp +++ b/osx/dialogxml/button.cpp @@ -80,7 +80,7 @@ void cButton::draw(){ // TODO: How is it supposed to know it's a default button when this fact is stored in the dialog, not the button? if(key.spec && key.k == key_enter) drawFrame(2,frameStyle); // frame default button, to provide a visual cue that it's the default }else{ - tileImage(*inWindow,frame,bg_gworld,bg[parent->bg]); + tileImage(*inWindow,frame,bg_gworld,bg[parent->getBg()]); } } @@ -184,7 +184,7 @@ cLed::cLed(cDialog* parent) : state(led_off), textFont(FONT_BOLD), textSize(10), - color(parent->defTextClr) { + color(parent->getDefTextClr()) { type = BTN_LED; } @@ -246,12 +246,12 @@ void cLed::draw(){ to_rect = frame; to_rect.right = to_rect.left + 14; rect_draw_some_item(buttons[btnGW[BTN_LED]],from_rect,*inWindow,to_rect); - style.colour = parent->defTextClr; + style.colour = parent->getDefTextClr(); to_rect.right = frame.right; to_rect.left = frame.left + 18; // Possibly could be 20 win_draw_string(*inWindow,to_rect,lbl,eTextMode::LEFT_TOP,style); }else{ - tileImage(*inWindow,frame,bg_gworld,bg[parent->bg]); + tileImage(*inWindow,frame,bg_gworld,bg[parent->getBg()]); } } diff --git a/osx/dialogxml/control.cpp b/osx/dialogxml/control.cpp index 7518926e..92cfe377 100644 --- a/osx/dialogxml/control.cpp +++ b/osx/dialogxml/control.cpp @@ -178,14 +178,18 @@ void cControl::setActive(bool active) { depressed = active; } +void cControl::redraw() { + // If there's no parent dialog, we're not responsible for redrawing + if(parent) parent->draw(); +} + bool cControl::handleClick(location){ sf::Event e; bool done = false, clicked = false; inWindow->setActive(); depressed = true; while(!done){ - // If there's no parent dialog, we're not responsible for redrawing - if(parent) parent->draw(); + redraw(); if(!inWindow->pollEvent(e)) continue; if(e.type == sf::Event::MouseButtonReleased){ done = true; @@ -202,7 +206,7 @@ bool cControl::handleClick(location){ sf::sleep(time_in_ticks(6)); } else sf::sleep(time_in_ticks(14)); - if(parent) parent->draw(); + redraw(); return clicked; } diff --git a/osx/dialogxml/control.h b/osx/dialogxml/control.h index ad4071d2..44357689 100644 --- a/osx/dialogxml/control.h +++ b/osx/dialogxml/control.h @@ -111,6 +111,7 @@ protected: int frameStyle; cKey key; void drawFrame(short amt, bool med_or_lt); + void redraw(); private: eControlType type; }; diff --git a/osx/dialogxml/dialog.cpp b/osx/dialogxml/dialog.cpp index 3b06ef1c..428c8e52 100644 --- a/osx/dialogxml/dialog.cpp +++ b/osx/dialogxml/dialog.cpp @@ -1127,6 +1127,10 @@ void cDialog::setBg(short n){ bg = n; } +short cDialog::getBg() { + return bg; +} + void cDialog::setDefBtn(std::string defBtn) { defaultButton = defBtn; } diff --git a/osx/dialogxml/dialog.h b/osx/dialogxml/dialog.h index f7fcb0e1..6bf68073 100644 --- a/osx/dialogxml/dialog.h +++ b/osx/dialogxml/dialog.h @@ -60,6 +60,7 @@ public: result = val; } void setBg(short n); + short getBg(); void setDefTextClr(sf::Color clr); void setDefBtn(std::string defBtn); sf::Color getDefTextClr(); @@ -84,14 +85,6 @@ private: boost::any result; std::string fname; friend class cControl; - friend class cButton; - friend class cLed; - friend class cLedGroup; - friend class cPict; - friend class cTextField; - friend class cTextMsg; - friend class cScrollbar; - friend class _init; }; class xBadNode : std::exception { diff --git a/osx/dialogxml/message.cpp b/osx/dialogxml/message.cpp index 4106a59e..880d7557 100644 --- a/osx/dialogxml/message.cpp +++ b/osx/dialogxml/message.cpp @@ -78,7 +78,7 @@ cTextMsg::cTextMsg(cDialog& parent) : drawFramed(false), textFont(FONT_BOLD), textSize(10), - color(parent.defTextClr), + color(parent.getDefTextClr()), clickable(false), fromList("none") {} diff --git a/osx/dialogxml/pict.cpp b/osx/dialogxml/pict.cpp index 91ffa9a7..edb288a5 100644 --- a/osx/dialogxml/pict.cpp +++ b/osx/dialogxml/pict.cpp @@ -522,7 +522,7 @@ void cPict::draw(){ if(!visible){ // Erase it rect.inset(-3, -3); - tileImage(*inWindow,rect,bg_gworld,bg[parent->bg]); + tileImage(*inWindow,rect,bg_gworld,bg[parent->getBg()]); return; } if(picNum < 0) { // Just fill with black diff --git a/osx/dialogxml/scrollbar.cpp b/osx/dialogxml/scrollbar.cpp index 13a6afac..39c9dacb 100644 --- a/osx/dialogxml/scrollbar.cpp +++ b/osx/dialogxml/scrollbar.cpp @@ -83,8 +83,7 @@ bool cScrollbar::handleClick(location where) { else pressedPart = PART_DOWN; int dy = where.y - thumbRect.top; while(!done){ - // If there's no parent dialog, we're not responsible for redrawing - if(parent) parent->draw(); + redraw(); if(!inWindow->pollEvent(e)) continue; if(e.type == sf::Event::MouseButtonReleased){ done = true; @@ -127,7 +126,7 @@ bool cScrollbar::handleClick(location where) { thumbRect.top = minmax(sf::Mouse::getPosition(*inWindow).y,frame.bottom - 32,thumbRect.top); thumbRect.height() = 16; } - if(parent) parent->draw(); + redraw(); return clicked; }