summaryrefslogtreecommitdiff
path: root/src/guichan/widgets
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2012-08-26 14:28:58 +0300
committerAndrei Karas <akaras@inbox.ru>2012-08-26 14:28:58 +0300
commit780c9da133b956785cb9c0d9c5e3e67f8209e15c (patch)
tree515fea9f3993a7480ef48c324f65c8f3303f261e /src/guichan/widgets
parent2241f009d34a1c67a87723210e9d7cd6892f8646 (diff)
downloadmv-780c9da133b956785cb9c0d9c5e3e67f8209e15c.tar.gz
mv-780c9da133b956785cb9c0d9c5e3e67f8209e15c.tar.bz2
mv-780c9da133b956785cb9c0d9c5e3e67f8209e15c.tar.xz
mv-780c9da133b956785cb9c0d9c5e3e67f8209e15c.zip
Remove some unused code from guichan.
Diffstat (limited to 'src/guichan/widgets')
-rw-r--r--src/guichan/widgets/listbox.cpp64
-rw-r--r--src/guichan/widgets/scrollarea.cpp350
-rw-r--r--src/guichan/widgets/tabbedarea.cpp51
3 files changed, 12 insertions, 453 deletions
diff --git a/src/guichan/widgets/listbox.cpp b/src/guichan/widgets/listbox.cpp
index ac71852e1..3f6565785 100644
--- a/src/guichan/widgets/listbox.cpp
+++ b/src/guichan/widgets/listbox.cpp
@@ -84,70 +84,8 @@ namespace gcn
addKeyListener(this);
}
- void ListBox::draw(Graphics* graphics)
+ void ListBox::draw(Graphics* graphics A_UNUSED)
{
- graphics->setColor(getBackgroundColor());
- graphics->fillRectangle(Rectangle(0, 0, getWidth(), getHeight()));
-
- if (!mListModel)
- return;
-
- graphics->setColor(getForegroundColor());
- graphics->setFont(getFont());
-
- // Check the current clip area so we don't draw unnecessary items
- // that are not visible.
- const ClipRectangle currentClipArea = graphics->getCurrentClipArea();
- int rowHeight = getRowHeight();
-
- // Calculate the number of rows to draw by checking the clip area.
- // The addition of two makes covers a partial visible row at the top
- // and a partial visible row at the bottom.
- int numberOfRows = currentClipArea.height / rowHeight + 2;
-
- if (numberOfRows > mListModel->getNumberOfElements())
- numberOfRows = mListModel->getNumberOfElements();
-
- // Calculate which row to start drawing. If the list box
- // has a negative y coordinate value we should check if
- // we should drop rows in the begining of the list as
- // they might not be visible. A negative y value is very
- // common if the list box for instance resides in a scroll
- // area and the user has scrolled the list box downwards.
- int startRow;
- if (getY() < 0)
- startRow = -1 * (getY() / rowHeight);
- else
- startRow = 0;
-
- int i;
- // The y coordinate where we start to draw the text is
- // simply the y coordinate multiplied with the font height.
- int y = rowHeight * startRow;
- for (i = startRow; i < startRow + numberOfRows; ++i)
- {
- if (i == mSelected)
- {
- graphics->setColor(getSelectionColor());
- graphics->fillRectangle(Rectangle(0, y,
- getWidth(), rowHeight));
- graphics->setColor(getForegroundColor());
- }
-
- // If the row height is greater than the font height we
- // draw the text with a center vertical alignment.
- if (rowHeight > getFont()->getHeight())
- {
- graphics->drawText(mListModel->getElementAt(i), 1,
- y + rowHeight / 2 - getFont()->getHeight() / 2);
- }
- else
- {
- graphics->drawText(mListModel->getElementAt(i), 1, y);
- }
-
- y += rowHeight;
- }
}
void ListBox::logic()
diff --git a/src/guichan/widgets/scrollarea.cpp b/src/guichan/widgets/scrollarea.cpp
index c0734a926..9668f9778 100644
--- a/src/guichan/widgets/scrollarea.cpp
+++ b/src/guichan/widgets/scrollarea.cpp
@@ -407,374 +407,44 @@ namespace gcn
mouseEvent.consume();
}
- void ScrollArea::draw(Graphics *graphics)
+ void ScrollArea::draw(Graphics *graphics A_UNUSED)
{
- drawBackground(graphics);
-
- if (mVBarVisible)
- {
- drawUpButton(graphics);
- drawDownButton(graphics);
- drawVBar(graphics);
- drawVMarker(graphics);
- }
-
- if (mHBarVisible)
- {
- drawLeftButton(graphics);
- drawRightButton(graphics);
- drawHBar(graphics);
- drawHMarker(graphics);
- }
-
- if (mHBarVisible && mVBarVisible)
- {
- graphics->setColor(getBaseColor());
- graphics->fillRectangle(Rectangle(getWidth() - mScrollbarWidth,
- getHeight() - mScrollbarWidth,
- mScrollbarWidth, mScrollbarWidth));
- }
-
- drawChildren(graphics);
}
- void ScrollArea::drawHBar(Graphics* graphics)
+ void ScrollArea::drawHBar(Graphics* graphics A_UNUSED)
{
- Rectangle dim = getHorizontalBarDimension();
-
- graphics->pushClipArea(dim);
-
- int alpha = getBaseColor().a;
- Color trackColor = getBaseColor() - 0x101010;
- trackColor.a = alpha;
- Color shadowColor = getBaseColor() - 0x303030;
- shadowColor.a = alpha;
-
- graphics->setColor(trackColor);
- graphics->fillRectangle(Rectangle(0, 0, dim.width, dim.height));
-
- graphics->setColor(shadowColor);
- graphics->drawLine(0, 0, dim.width, 0);
-
- graphics->popClipArea();
}
- void ScrollArea::drawVBar(Graphics* graphics)
+ void ScrollArea::drawVBar(Graphics* graphics A_UNUSED)
{
- Rectangle dim = getVerticalBarDimension();
-
- graphics->pushClipArea(dim);
-
- int alpha = getBaseColor().a;
- Color trackColor = getBaseColor() - 0x101010;
- trackColor.a = alpha;
- Color shadowColor = getBaseColor() - 0x303030;
- shadowColor.a = alpha;
-
- graphics->setColor(trackColor);
- graphics->fillRectangle(Rectangle(0, 0, dim.width, dim.height));
-
- graphics->setColor(shadowColor);
- graphics->drawLine(0, 0, 0, dim.height);
-
- graphics->popClipArea();
}
- void ScrollArea::drawBackground(Graphics *graphics)
+ void ScrollArea::drawBackground(Graphics *graphics A_UNUSED)
{
- if (isOpaque())
- {
- graphics->setColor(getBackgroundColor());
- graphics->fillRectangle(getChildrenArea());
- }
}
- void ScrollArea::drawUpButton(Graphics* graphics)
+ void ScrollArea::drawUpButton(Graphics* graphics A_UNUSED)
{
- Rectangle dim = getUpButtonDimension();
- graphics->pushClipArea(dim);
-
- Color highlightColor;
- Color shadowColor;
- Color faceColor;
- int offset;
- int alpha = getBaseColor().a;
-
- if (mUpButtonPressed)
- {
- faceColor = getBaseColor() - 0x303030;
- faceColor.a = alpha;
- highlightColor = faceColor - 0x303030;
- highlightColor.a = alpha;
- shadowColor = getBaseColor();
- shadowColor.a = alpha;
-
- offset = 1;
- }
- else
- {
- faceColor = getBaseColor();
- faceColor.a = alpha;
- highlightColor = faceColor + 0x303030;
- highlightColor.a = alpha;
- shadowColor = faceColor - 0x303030;
- shadowColor.a = alpha;
-
- offset = 0;
- }
-
- graphics->setColor(faceColor);
- graphics->fillRectangle(Rectangle(0, 0, dim.width, dim.height));
-
- graphics->setColor(highlightColor);
- graphics->drawLine(0, 0, dim.width - 1, 0);
- graphics->drawLine(0, 1, 0, dim.height - 1);
-
- graphics->setColor(shadowColor);
- graphics->drawLine(dim.width - 1, 0, dim.width - 1, dim.height - 1);
- graphics->drawLine(1, dim.height - 1, dim.width - 1, dim.height - 1);
-
- graphics->setColor(getForegroundColor());
-
- const int w = dim.height / 2;
- const int h = w / 2 + 2;
- for (int i = 0; i < w / 2; ++i)
- {
- graphics->drawLine(w - i + offset, i + h + offset,
- w + i + offset, i + h + offset);
- }
-
- graphics->popClipArea();
}
- void ScrollArea::drawDownButton(Graphics* graphics)
+ void ScrollArea::drawDownButton(Graphics* graphics A_UNUSED)
{
- Rectangle dim = getDownButtonDimension();
- graphics->pushClipArea(dim);
-
- Color highlightColor;
- Color shadowColor;
- Color faceColor;
- int offset;
- int alpha = getBaseColor().a;
-
- if (mDownButtonPressed)
- {
- faceColor = getBaseColor() - 0x303030;
- faceColor.a = alpha;
- highlightColor = faceColor - 0x303030;
- highlightColor.a = alpha;
- shadowColor = getBaseColor();
- shadowColor.a = alpha;
-
- offset = 1;
- }
- else
- {
- faceColor = getBaseColor();
- faceColor.a = alpha;
- highlightColor = faceColor + 0x303030;
- highlightColor.a = alpha;
- shadowColor = faceColor - 0x303030;
- shadowColor.a = alpha;
-
- offset = 0;
- }
-
- graphics->setColor(faceColor);
- graphics->fillRectangle(Rectangle(0, 0, dim.width, dim.height));
-
- graphics->setColor(highlightColor);
- graphics->drawLine(0, 0, dim.width - 1, 0);
- graphics->drawLine(0, 1, 0, dim.height - 1);
-
- graphics->setColor(shadowColor);
- graphics->drawLine(dim.width - 1, 0, dim.width - 1, dim.height - 1);
- graphics->drawLine(1, dim.height - 1, dim.width - 1, dim.height - 1);
-
- graphics->setColor(getForegroundColor());
-
- const int w = dim.height / 2;
- const int h = w + 1;
- for (int i = 0; i < w / 2; ++i)
- {
- graphics->drawLine(w - i + offset, -i + h + offset,
- w + i + offset, -i + h + offset);
- }
-
- graphics->popClipArea();
}
- void ScrollArea::drawLeftButton(Graphics* graphics)
+ void ScrollArea::drawLeftButton(Graphics* graphics A_UNUSED)
{
- Rectangle dim = getLeftButtonDimension();
- graphics->pushClipArea(dim);
-
- Color highlightColor;
- Color shadowColor;
- Color faceColor;
- int offset;
- int alpha = getBaseColor().a;
-
- if (mLeftButtonPressed)
- {
- faceColor = getBaseColor() - 0x303030;
- faceColor.a = alpha;
- highlightColor = faceColor - 0x303030;
- highlightColor.a = alpha;
- shadowColor = getBaseColor();
- shadowColor.a = alpha;
-
- offset = 1;
- }
- else
- {
- faceColor = getBaseColor();
- faceColor.a = alpha;
- highlightColor = faceColor + 0x303030;
- highlightColor.a = alpha;
- shadowColor = faceColor - 0x303030;
- shadowColor.a = alpha;
-
- offset = 0;
- }
-
- graphics->setColor(faceColor);
- graphics->fillRectangle(Rectangle(0, 0, dim.width, dim.height));
-
- graphics->setColor(highlightColor);
- graphics->drawLine(0, 0, dim.width - 1, 0);
- graphics->drawLine(0, 1, 0, dim.height - 1);
-
- graphics->setColor(shadowColor);
- graphics->drawLine(dim.width - 1, 0, dim.width - 1, dim.height - 1);
- graphics->drawLine(1, dim.height - 1, dim.width - 1, dim.height - 1);
-
- graphics->setColor(getForegroundColor());
-
- const int w = dim.width / 2;
- const int h = w - 2;
- for (int i = 0; i < w / 2; ++i)
- {
- graphics->drawLine(i + h + offset, w - i + offset,
- i + h + offset, w + i + offset);
- }
-
- graphics->popClipArea();
}
- void ScrollArea::drawRightButton(Graphics* graphics)
+ void ScrollArea::drawRightButton(Graphics* graphics A_UNUSED)
{
- Rectangle dim = getRightButtonDimension();
- graphics->pushClipArea(dim);
-
- Color highlightColor;
- Color shadowColor;
- Color faceColor;
- int offset;
- int alpha = getBaseColor().a;
-
- if (mRightButtonPressed)
- {
- faceColor = getBaseColor() - 0x303030;
- faceColor.a = alpha;
- highlightColor = faceColor - 0x303030;
- highlightColor.a = alpha;
- shadowColor = getBaseColor();
- shadowColor.a = alpha;
-
- offset = 1;
- }
- else
- {
- faceColor = getBaseColor();
- faceColor.a = alpha;
- highlightColor = faceColor + 0x303030;
- highlightColor.a = alpha;
- shadowColor = faceColor - 0x303030;
- shadowColor.a = alpha;
-
- offset = 0;
- }
-
- graphics->setColor(faceColor);
- graphics->fillRectangle(Rectangle(0, 0, dim.width, dim.height));
-
- graphics->setColor(highlightColor);
- graphics->drawLine(0, 0, dim.width - 1, 0);
- graphics->drawLine(0, 1, 0, dim.height - 1);
-
- graphics->setColor(shadowColor);
- graphics->drawLine(dim.width - 1, 0, dim.width - 1, dim.height - 1);
- graphics->drawLine(1, dim.height - 1, dim.width - 1, dim.height - 1);
-
- graphics->setColor(getForegroundColor());
-
- const int w = dim.width / 2;
- const int h = w + 1;
- for (int i = 0; i < w / 2; ++i)
- {
- graphics->drawLine(-i + h + offset, w - i + offset,
- -i + h + offset, w + i + offset);
- }
-
- graphics->popClipArea();
}
- void ScrollArea::drawVMarker(Graphics* graphics)
+ void ScrollArea::drawVMarker(Graphics* graphics A_UNUSED)
{
- Rectangle dim = getVerticalMarkerDimension();
- graphics->pushClipArea(dim);
-
- int alpha = getBaseColor().a;
- Color faceColor = getBaseColor();
- faceColor.a = alpha;
- Color highlightColor = faceColor + 0x303030;
- highlightColor.a = alpha;
- Color shadowColor = faceColor - 0x303030;
- shadowColor.a = alpha;
-
- graphics->setColor(faceColor);
- graphics->fillRectangle(Rectangle(1, 1,
- dim.width - 1, dim.height - 1));
-
- graphics->setColor(highlightColor);
- graphics->drawLine(0, 0, dim.width - 1, 0);
- graphics->drawLine(0, 1, 0, dim.height - 1);
-
- graphics->setColor(shadowColor);
- graphics->drawLine(1, dim.height - 1, dim.width - 1, dim.height - 1);
- graphics->drawLine(dim.width - 1, 0, dim.width - 1, dim.height - 1);
-
- graphics->popClipArea();
}
- void ScrollArea::drawHMarker(Graphics* graphics)
+ void ScrollArea::drawHMarker(Graphics* graphics A_UNUSED)
{
- Rectangle dim = getHorizontalMarkerDimension();
- graphics->pushClipArea(dim);
-
- int alpha = getBaseColor().a;
- Color faceColor = getBaseColor();
- faceColor.a = alpha;
- Color highlightColor = faceColor + 0x303030;
- highlightColor.a = alpha;
- Color shadowColor = faceColor - 0x303030;
- shadowColor.a = alpha;
-
- graphics->setColor(faceColor);
- graphics->fillRectangle(Rectangle(1, 1,
- dim.width - 1, dim.height - 1));
-
- graphics->setColor(highlightColor);
- graphics->drawLine(0, 0, dim.width - 1, 0);
- graphics->drawLine(0, 1, 0, dim.height - 1);
-
- graphics->setColor(shadowColor);
- graphics->drawLine(1, dim.height - 1, dim.width - 1, dim.height - 1);
- graphics->drawLine(dim.width - 1, 0, dim.width - 1, dim.height - 1);
-
- graphics->popClipArea();
}
void ScrollArea::logic()
diff --git a/src/guichan/widgets/tabbedarea.cpp b/src/guichan/widgets/tabbedarea.cpp
index 141bbf96e..6f4c4a2b9 100644
--- a/src/guichan/widgets/tabbedarea.cpp
+++ b/src/guichan/widgets/tabbedarea.cpp
@@ -185,57 +185,8 @@ namespace gcn
return mOpaque;
}
- void TabbedArea::draw(Graphics *graphics)
+ void TabbedArea::draw(Graphics *graphics A_UNUSED)
{
- const Color &faceColor = getBaseColor();
- const int alpha = getBaseColor().a;
- Color highlightColor = faceColor + 0x303030;
- highlightColor.a = alpha;
- Color shadowColor = faceColor - 0x303030;
- shadowColor.a = alpha;
-
- // Draw a border.
- graphics->setColor(highlightColor);
- graphics->drawLine(0,
- mTabContainer->getHeight(),
- 0,
- getHeight() - 2);
- graphics->setColor(shadowColor);
- graphics->drawLine(getWidth() - 1,
- mTabContainer->getHeight() + 1,
- getWidth() - 1,
- getHeight() - 1);
- graphics->drawLine(1,
- getHeight() - 1,
- getWidth() - 1,
- getHeight() - 1);
-
- if (isOpaque())
- {
- graphics->setColor(getBaseColor());
- graphics->fillRectangle(Rectangle(1, 1,
- getWidth() - 2,
- getHeight() - 2));
- }
-
- // Draw a line underneath the tabs.
- graphics->setColor(highlightColor);
- graphics->drawLine(1, mTabContainer->getHeight(),
- getWidth() - 1, mTabContainer->getHeight());
-
- // If a tab is selected, remove the line right underneath
- // the selected tab.
- if (mSelectedTab)
- {
- graphics->setColor(getBaseColor());
- graphics->drawLine(mSelectedTab->getX() + 1,
- mTabContainer->getHeight(),
- mSelectedTab->getX() + mSelectedTab->getWidth() - 2,
- mTabContainer->getHeight());
-
- }
-
- drawChildren(graphics);
}
void TabbedArea::adjustSize()