summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2015-05-25 20:12:20 +0300
committerAndrei Karas <akaras@inbox.ru>2015-05-25 20:12:20 +0300
commit80b0caa35e4b84b745daef7e4102b428539cdee5 (patch)
treeeb24de08cd9bed429569b34f35fa0f638fcdc93d
parent7369332bb0a6d219cb2415a0b5e65bf2825da349 (diff)
downloadplus-80b0caa35e4b84b745daef7e4102b428539cdee5.tar.gz
plus-80b0caa35e4b84b745daef7e4102b428539cdee5.tar.bz2
plus-80b0caa35e4b84b745daef7e4102b428539cdee5.tar.xz
plus-80b0caa35e4b84b745daef7e4102b428539cdee5.zip
Remove safeDraw implimentation from Widget.
-rw-r--r--src/gui/widgets/basiccontainer2.cpp5
-rw-r--r--src/gui/widgets/basiccontainer2.h2
-rw-r--r--src/gui/widgets/browserbox.cpp5
-rw-r--r--src/gui/widgets/browserbox.h2
-rw-r--r--src/gui/widgets/checkbox.cpp5
-rw-r--r--src/gui/widgets/checkbox.h2
-rw-r--r--src/gui/widgets/dropdown.cpp5
-rw-r--r--src/gui/widgets/dropdown.h2
-rw-r--r--src/gui/widgets/extendedlistbox.cpp5
-rw-r--r--src/gui/widgets/extendedlistbox.h2
-rw-r--r--src/gui/widgets/guitable.cpp5
-rw-r--r--src/gui/widgets/guitable.h2
-rw-r--r--src/gui/widgets/icon.cpp12
-rw-r--r--src/gui/widgets/icon.h2
-rw-r--r--src/gui/widgets/itemcontainer.cpp5
-rw-r--r--src/gui/widgets/itemcontainer.h2
-rw-r--r--src/gui/widgets/label.cpp5
-rw-r--r--src/gui/widgets/label.h2
-rw-r--r--src/gui/widgets/listbox.cpp5
-rw-r--r--src/gui/widgets/listbox.h2
-rw-r--r--src/gui/widgets/playerbox.cpp5
-rw-r--r--src/gui/widgets/playerbox.h2
-rw-r--r--src/gui/widgets/progressindicator.cpp5
-rw-r--r--src/gui/widgets/progressindicator.h2
-rw-r--r--src/gui/widgets/radiobutton.cpp5
-rw-r--r--src/gui/widgets/radiobutton.h2
-rw-r--r--src/gui/widgets/tabbedarea.cpp13
-rw-r--r--src/gui/widgets/tabbedarea.h2
-rw-r--r--src/gui/widgets/textbox.cpp5
-rw-r--r--src/gui/widgets/textbox.h2
-rw-r--r--src/gui/widgets/textfield.cpp5
-rw-r--r--src/gui/widgets/textfield.h2
-rw-r--r--src/gui/widgets/textpreview.cpp5
-rw-r--r--src/gui/widgets/textpreview.h2
-rw-r--r--src/gui/widgets/widget.h3
35 files changed, 135 insertions, 2 deletions
diff --git a/src/gui/widgets/basiccontainer2.cpp b/src/gui/widgets/basiccontainer2.cpp
index e78584585..4a4184f2c 100644
--- a/src/gui/widgets/basiccontainer2.cpp
+++ b/src/gui/widgets/basiccontainer2.cpp
@@ -92,6 +92,11 @@ void BasicContainer2::draw(Graphics* graphics)
BLOCK_END("BasicContainer2::draw")
}
+void BasicContainer2::safeDraw(Graphics* graphics)
+{
+ BasicContainer2::draw(graphics);
+}
+
void BasicContainer2::setOpaque(bool opaque)
{
mOpaque = opaque;
diff --git a/src/gui/widgets/basiccontainer2.h b/src/gui/widgets/basiccontainer2.h
index 49371cfa7..435f00c43 100644
--- a/src/gui/widgets/basiccontainer2.h
+++ b/src/gui/widgets/basiccontainer2.h
@@ -153,6 +153,8 @@ class BasicContainer2: public BasicContainer
void draw(Graphics* graphics) override;
+ void safeDraw(Graphics* graphics) override;
+
protected:
/**
* True if the container is opaque, false otherwise.
diff --git a/src/gui/widgets/browserbox.cpp b/src/gui/widgets/browserbox.cpp
index 47f9821b7..d12a3038c 100644
--- a/src/gui/widgets/browserbox.cpp
+++ b/src/gui/widgets/browserbox.cpp
@@ -549,6 +549,11 @@ void BrowserBox::draw(Graphics *graphics)
BLOCK_END("BrowserBox::draw")
}
+void BrowserBox::safeDraw(Graphics *graphics)
+{
+ BrowserBox::draw(graphics);
+}
+
int BrowserBox::calcHeight()
{
unsigned int y = mPadding;
diff --git a/src/gui/widgets/browserbox.h b/src/gui/widgets/browserbox.h
index d8e0f0748..7769d6e9c 100644
--- a/src/gui/widgets/browserbox.h
+++ b/src/gui/widgets/browserbox.h
@@ -123,6 +123,8 @@ class BrowserBox final : public Widget,
*/
void draw(Graphics *graphics) override final;
+ void safeDraw(Graphics *graphics) override final;
+
void updateHeight();
/**
diff --git a/src/gui/widgets/checkbox.cpp b/src/gui/widgets/checkbox.cpp
index e2141058c..27e7d563b 100644
--- a/src/gui/widgets/checkbox.cpp
+++ b/src/gui/widgets/checkbox.cpp
@@ -184,6 +184,11 @@ void CheckBox::draw(Graphics *const graphics)
BLOCK_END("CheckBox::draw")
}
+void CheckBox::safeDraw(Graphics *const graphics)
+{
+ CheckBox::draw(graphics);
+}
+
void CheckBox::updateAlpha()
{
const float alpha = std::max(settings.guiAlpha,
diff --git a/src/gui/widgets/checkbox.h b/src/gui/widgets/checkbox.h
index 0aa3a6faf..5555046ba 100644
--- a/src/gui/widgets/checkbox.h
+++ b/src/gui/widgets/checkbox.h
@@ -111,6 +111,8 @@ class CheckBox final : public Widget,
*/
void draw(Graphics *const graphics) override final;
+ void safeDraw(Graphics *const graphics) override final;
+
/**
* Update the alpha value to the checkbox components.
*/
diff --git a/src/gui/widgets/dropdown.cpp b/src/gui/widgets/dropdown.cpp
index 81729c58d..ddd409c3a 100644
--- a/src/gui/widgets/dropdown.cpp
+++ b/src/gui/widgets/dropdown.cpp
@@ -289,6 +289,11 @@ void DropDown::draw(Graphics* graphics)
BLOCK_END("DropDown::draw")
}
+void DropDown::safeDraw(Graphics* graphics)
+{
+ DropDown::draw(graphics);
+}
+
void DropDown::drawFrame(Graphics *graphics)
{
BLOCK_START("DropDown::drawFrame")
diff --git a/src/gui/widgets/dropdown.h b/src/gui/widgets/dropdown.h
index 7f101e3e6..5f12cca31 100644
--- a/src/gui/widgets/dropdown.h
+++ b/src/gui/widgets/dropdown.h
@@ -81,6 +81,8 @@ class DropDown final : public ActionListener,
void draw(Graphics *graphics) override final;
+ void safeDraw(Graphics *graphics) override final;
+
void drawFrame(Graphics *graphics) override final;
// Inherited from KeyListener
diff --git a/src/gui/widgets/extendedlistbox.cpp b/src/gui/widgets/extendedlistbox.cpp
index 6dabc0584..7f74ab01f 100644
--- a/src/gui/widgets/extendedlistbox.cpp
+++ b/src/gui/widgets/extendedlistbox.cpp
@@ -215,6 +215,11 @@ void ExtendedListBox::draw(Graphics *graphics)
BLOCK_END("ExtendedListBox::draw")
}
+void ExtendedListBox::safeDraw(Graphics *graphics)
+{
+ ExtendedListBox::draw(graphics);
+}
+
void ExtendedListBox::adjustSize()
{
if (mHeight)
diff --git a/src/gui/widgets/extendedlistbox.h b/src/gui/widgets/extendedlistbox.h
index c7541eed4..aca0ba8a8 100644
--- a/src/gui/widgets/extendedlistbox.h
+++ b/src/gui/widgets/extendedlistbox.h
@@ -44,6 +44,8 @@ class ExtendedListBox final : public ListBox
*/
void draw(Graphics *graphics) override final;
+ void safeDraw(Graphics *graphics) override final;
+
void adjustSize() override;
int getSelectionByMouse(const int y) const override final;
diff --git a/src/gui/widgets/guitable.cpp b/src/gui/widgets/guitable.cpp
index 5314dc95f..4f8b89027 100644
--- a/src/gui/widgets/guitable.cpp
+++ b/src/gui/widgets/guitable.cpp
@@ -347,6 +347,11 @@ void GuiTable::draw(Graphics* graphics)
BLOCK_END("GuiTable::draw")
}
+void GuiTable::safeDraw(Graphics* graphics)
+{
+ GuiTable::draw(graphics);
+}
+
void GuiTable::moveToTop(Widget *widget)
{
Widget::moveToTop(widget);
diff --git a/src/gui/widgets/guitable.h b/src/gui/widgets/guitable.h
index 2257a8cb0..af94c4ec9 100644
--- a/src/gui/widgets/guitable.h
+++ b/src/gui/widgets/guitable.h
@@ -112,6 +112,8 @@ class GuiTable final : public Widget,
// Inherited from Widget
void draw(Graphics* graphics) override final;
+ void safeDraw(Graphics* graphics) override final;
+
Widget *getWidgetAt(int x, int y) override final A_WARN_UNUSED;
void moveToTop(Widget *child) override final;
diff --git a/src/gui/widgets/icon.cpp b/src/gui/widgets/icon.cpp
index 1d5de684d..4be9ae127 100644
--- a/src/gui/widgets/icon.cpp
+++ b/src/gui/widgets/icon.cpp
@@ -82,3 +82,15 @@ void Icon::draw(Graphics *graphics)
}
BLOCK_END("Icon::draw")
}
+
+void Icon::safeDraw(Graphics *graphics)
+{
+ BLOCK_START("Icon::draw")
+ if (mImage)
+ {
+ graphics->drawImage(mImage,
+ (mDimension.width - mImage->mBounds.w) / 2,
+ (mDimension.height - mImage->mBounds.h) / 2);
+ }
+ BLOCK_END("Icon::draw")
+}
diff --git a/src/gui/widgets/icon.h b/src/gui/widgets/icon.h
index 29c17edef..bb2101b01 100644
--- a/src/gui/widgets/icon.h
+++ b/src/gui/widgets/icon.h
@@ -69,6 +69,8 @@ class Icon final : public Widget
*/
void draw(Graphics *g) override final;
+ void safeDraw(Graphics *g) override final;
+
private:
Image *mImage;
};
diff --git a/src/gui/widgets/itemcontainer.cpp b/src/gui/widgets/itemcontainer.cpp
index 7fbe9970c..ee95f1e61 100644
--- a/src/gui/widgets/itemcontainer.cpp
+++ b/src/gui/widgets/itemcontainer.cpp
@@ -339,6 +339,11 @@ void ItemContainer::draw(Graphics *graphics)
BLOCK_END("ItemContainer::draw")
}
+void ItemContainer::safeDraw(Graphics *graphics)
+{
+ ItemContainer::draw(graphics);
+}
+
void ItemContainer::selectNone()
{
dragDrop.clear();
diff --git a/src/gui/widgets/itemcontainer.h b/src/gui/widgets/itemcontainer.h
index 302eeaea7..8b30e5f8b 100644
--- a/src/gui/widgets/itemcontainer.h
+++ b/src/gui/widgets/itemcontainer.h
@@ -76,6 +76,8 @@ class ItemContainer final : public Widget,
*/
void draw(Graphics *graphics) override final;
+ void safeDraw(Graphics *graphics) override final;
+
// KeyListener
void keyPressed(KeyEvent &event) override final;
void keyReleased(KeyEvent &event) override final;
diff --git a/src/gui/widgets/label.cpp b/src/gui/widgets/label.cpp
index 2addac309..abe7b62b6 100644
--- a/src/gui/widgets/label.cpp
+++ b/src/gui/widgets/label.cpp
@@ -186,6 +186,11 @@ void Label::draw(Graphics* graphics)
BLOCK_END("Label::draw")
}
+void Label::safeDraw(Graphics* graphics)
+{
+ Label::draw(graphics);
+}
+
void Label::adjustSize()
{
const Font *const font = getFont();
diff --git a/src/gui/widgets/label.h b/src/gui/widgets/label.h
index 813248da8..29280e17a 100644
--- a/src/gui/widgets/label.h
+++ b/src/gui/widgets/label.h
@@ -110,6 +110,8 @@ class Label final : public Widget,
*/
void draw(Graphics *graphics) override final;
+ void safeDraw(Graphics *graphics) override final;
+
void adjustSize();
void setForegroundColor(const Color &color);
diff --git a/src/gui/widgets/listbox.cpp b/src/gui/widgets/listbox.cpp
index d4b6f7a76..4d7befa8c 100644
--- a/src/gui/widgets/listbox.cpp
+++ b/src/gui/widgets/listbox.cpp
@@ -272,6 +272,11 @@ void ListBox::keyPressed(KeyEvent &event)
}
}
+void ListBox::safeDraw(Graphics *graphics)
+{
+ ListBox::draw(graphics);
+}
+
// Don't do anything on scrollwheel. ScrollArea will deal with that.
void ListBox::mouseWheelMovedUp(MouseEvent &event A_UNUSED)
diff --git a/src/gui/widgets/listbox.h b/src/gui/widgets/listbox.h
index 105f569cf..6e3cd2015 100644
--- a/src/gui/widgets/listbox.h
+++ b/src/gui/widgets/listbox.h
@@ -110,6 +110,8 @@ class ListBox notfinal : public Widget,
*/
void draw(Graphics *graphics) override;
+ void safeDraw(Graphics *graphics) override;
+
/**
* Update the alpha value to the graphic components.
*/
diff --git a/src/gui/widgets/playerbox.cpp b/src/gui/widgets/playerbox.cpp
index 4775e266f..09ebe610d 100644
--- a/src/gui/widgets/playerbox.cpp
+++ b/src/gui/widgets/playerbox.cpp
@@ -138,6 +138,11 @@ void PlayerBox::draw(Graphics *graphics)
BLOCK_END("PlayerBox::draw")
}
+void PlayerBox::safeDraw(Graphics *graphics)
+{
+ PlayerBox::draw(graphics);
+}
+
void PlayerBox::drawFrame(Graphics *graphics)
{
BLOCK_START("PlayerBox::drawFrame")
diff --git a/src/gui/widgets/playerbox.h b/src/gui/widgets/playerbox.h
index 0eabda203..f428fcbfa 100644
--- a/src/gui/widgets/playerbox.h
+++ b/src/gui/widgets/playerbox.h
@@ -78,6 +78,8 @@ class PlayerBox final : public Widget,
*/
void draw(Graphics *graphics) override final;
+ void safeDraw(Graphics *graphics) override final;
+
/**
* Draws the background and border of the scroll area.
*/
diff --git a/src/gui/widgets/progressindicator.cpp b/src/gui/widgets/progressindicator.cpp
index abcb12fda..a3df73b8a 100644
--- a/src/gui/widgets/progressindicator.cpp
+++ b/src/gui/widgets/progressindicator.cpp
@@ -79,3 +79,8 @@ void ProgressIndicator::draw(Graphics *graphics)
}
BLOCK_END("ProgressIndicator::draw")
}
+
+void ProgressIndicator::safeDraw(Graphics *graphics)
+{
+ ProgressIndicator::draw(graphics);
+}
diff --git a/src/gui/widgets/progressindicator.h b/src/gui/widgets/progressindicator.h
index 2bee3ca43..cc278e8a2 100644
--- a/src/gui/widgets/progressindicator.h
+++ b/src/gui/widgets/progressindicator.h
@@ -45,6 +45,8 @@ class ProgressIndicator final : public Widget
void draw(Graphics *graphics) override final;
+ void safeDraw(Graphics *graphics) override final;
+
private:
SimpleAnimation *mIndicator;
};
diff --git a/src/gui/widgets/radiobutton.cpp b/src/gui/widgets/radiobutton.cpp
index 5b9ce7aca..30749da66 100644
--- a/src/gui/widgets/radiobutton.cpp
+++ b/src/gui/widgets/radiobutton.cpp
@@ -249,6 +249,11 @@ void RadioButton::draw(Graphics* graphics)
BLOCK_END("RadioButton::draw")
}
+void RadioButton::safeDraw(Graphics* graphics)
+{
+ RadioButton::draw(graphics);
+}
+
void RadioButton::mouseEntered(MouseEvent& event A_UNUSED)
{
mHasMouse = true;
diff --git a/src/gui/widgets/radiobutton.h b/src/gui/widgets/radiobutton.h
index d33634546..ab586b2d4 100644
--- a/src/gui/widgets/radiobutton.h
+++ b/src/gui/widgets/radiobutton.h
@@ -114,6 +114,8 @@ class RadioButton final : public Widget,
*/
void draw(Graphics* graphics) override final;
+ void safeDraw(Graphics* graphics) override final;
+
/**
* Called when the mouse enteres the widget area.
*/
diff --git a/src/gui/widgets/tabbedarea.cpp b/src/gui/widgets/tabbedarea.cpp
index 081b61aae..0afa71033 100644
--- a/src/gui/widgets/tabbedarea.cpp
+++ b/src/gui/widgets/tabbedarea.cpp
@@ -189,6 +189,19 @@ void TabbedArea::draw(Graphics *graphics)
BLOCK_END("TabbedArea::draw")
}
+void TabbedArea::safeDraw(Graphics *graphics)
+{
+ BLOCK_START("TabbedArea::draw")
+ if (mTabs.empty())
+ {
+ BLOCK_END("TabbedArea::draw")
+ return;
+ }
+
+ drawChildren(graphics);
+ BLOCK_END("TabbedArea::draw")
+}
+
Widget *TabbedArea::getWidget(const std::string &name) const
{
TabContainer::const_iterator itr = mTabs.begin();
diff --git a/src/gui/widgets/tabbedarea.h b/src/gui/widgets/tabbedarea.h
index 7c192dac9..0950d740b 100644
--- a/src/gui/widgets/tabbedarea.h
+++ b/src/gui/widgets/tabbedarea.h
@@ -104,6 +104,8 @@ class TabbedArea final : public ActionListener,
*/
void draw(Graphics *graphics) override final;
+ void safeDraw(Graphics *graphics) override final;
+
/**
* Return how many tabs have been created.
*
diff --git a/src/gui/widgets/textbox.cpp b/src/gui/widgets/textbox.cpp
index 82713ec86..60d8bd13b 100644
--- a/src/gui/widgets/textbox.cpp
+++ b/src/gui/widgets/textbox.cpp
@@ -470,6 +470,11 @@ void TextBox::draw(Graphics* graphics)
BLOCK_END("TextBox::draw")
}
+void TextBox::safeDraw(Graphics* graphics)
+{
+ TextBox::draw(graphics);
+}
+
void TextBox::setForegroundColor(const Color &color)
{
mForegroundColor = color;
diff --git a/src/gui/widgets/textbox.h b/src/gui/widgets/textbox.h
index 1f085d0c6..611efd4a0 100644
--- a/src/gui/widgets/textbox.h
+++ b/src/gui/widgets/textbox.h
@@ -109,6 +109,8 @@ class TextBox final : public Widget,
void draw(Graphics* graphics) override final;
+ void safeDraw(Graphics* graphics) override final;
+
void setForegroundColor(const Color &color);
void setForegroundColorAll(const Color &color1,
diff --git a/src/gui/widgets/textfield.cpp b/src/gui/widgets/textfield.cpp
index 603485f65..49d3fd412 100644
--- a/src/gui/widgets/textfield.cpp
+++ b/src/gui/widgets/textfield.cpp
@@ -206,6 +206,11 @@ void TextField::draw(Graphics *graphics)
BLOCK_END("TextField::draw")
}
+void TextField::safeDraw(Graphics *graphics)
+{
+ TextField::draw(graphics);
+}
+
void TextField::drawFrame(Graphics *graphics)
{
BLOCK_START("TextField::drawFrame")
diff --git a/src/gui/widgets/textfield.h b/src/gui/widgets/textfield.h
index bb512e281..2b5f4196f 100644
--- a/src/gui/widgets/textfield.h
+++ b/src/gui/widgets/textfield.h
@@ -105,6 +105,8 @@ class TextField notfinal : public Widget,
*/
void draw(Graphics *graphics) override;
+ void safeDraw(Graphics *graphics) override;
+
/**
* Update the alpha value to the graphic components.
*/
diff --git a/src/gui/widgets/textpreview.cpp b/src/gui/widgets/textpreview.cpp
index 5c829ecd7..d07ae4e7f 100644
--- a/src/gui/widgets/textpreview.cpp
+++ b/src/gui/widgets/textpreview.cpp
@@ -138,6 +138,11 @@ void TextPreview::draw(Graphics* graphics)
BLOCK_END("TextPreview::draw")
}
+void TextPreview::safeDraw(Graphics* graphics)
+{
+ TextPreview::draw(graphics);
+}
+
void TextPreview::adjustSize()
{
setHeight(getFont()->getHeight() + 2 * mPadding);
diff --git a/src/gui/widgets/textpreview.h b/src/gui/widgets/textpreview.h
index e83790e68..62e3d1cd1 100644
--- a/src/gui/widgets/textpreview.h
+++ b/src/gui/widgets/textpreview.h
@@ -102,6 +102,8 @@ class TextPreview final : public Widget
*/
void draw(Graphics *graphics) override final;
+ void safeDraw(Graphics *graphics) override final;
+
/**
* Set opacity for this widget (whether or not to show the background
* color)
diff --git a/src/gui/widgets/widget.h b/src/gui/widgets/widget.h
index 86e54510f..723811e66 100644
--- a/src/gui/widgets/widget.h
+++ b/src/gui/widgets/widget.h
@@ -122,8 +122,7 @@ class Widget notfinal : public Widget2
*/
virtual void draw(Graphics* graphics) = 0;
- virtual void safeDraw(Graphics* graphics)
- { draw(graphics); }
+ virtual void safeDraw(Graphics* graphics) = 0;
/**
* Called when a widget is given a chance to draw a frame around itself.