From 780c9da133b956785cb9c0d9c5e3e67f8209e15c Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sun, 26 Aug 2012 14:28:58 +0300 Subject: Remove some unused code from guichan. --- src/guichan/widgets/listbox.cpp | 64 +---------------------------------------- 1 file changed, 1 insertion(+), 63 deletions(-) (limited to 'src/guichan/widgets/listbox.cpp') 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() -- cgit v1.2.3-70-g09d2