summaryrefslogtreecommitdiff
path: root/src/gui/widgets
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/widgets')
-rw-r--r--src/gui/widgets/browserbox.cpp8
-rw-r--r--src/gui/widgets/chattab.cpp1
-rw-r--r--src/gui/widgets/itemcontainer.cpp2
-rw-r--r--src/gui/widgets/shopitems.cpp6
-rw-r--r--src/gui/widgets/shopitems.h2
-rw-r--r--src/gui/widgets/table.cpp39
-rw-r--r--src/gui/widgets/window.cpp7
-rw-r--r--src/gui/widgets/window.h2
8 files changed, 40 insertions, 27 deletions
diff --git a/src/gui/widgets/browserbox.cpp b/src/gui/widgets/browserbox.cpp
index 8546cbd7e..bc5583148 100644
--- a/src/gui/widgets/browserbox.cpp
+++ b/src/gui/widgets/browserbox.cpp
@@ -178,7 +178,7 @@ void BrowserBox::addRow(const std::string &row, bool atTop)
unsigned int nextChar;
const char *hyphen = "~";
int hyphenWidth = font->getWidth(hyphen);
- int x = 0;
+ unsigned x = 0;
for (TextRowIterator i = mTextRows.begin(); i != mTextRows.end(); ++i)
{
@@ -197,7 +197,7 @@ void BrowserBox::addRow(const std::string &row, bool atTop)
if (nextSpacePos <= 0)
nextSpacePos = static_cast<int>(row.size()) - 1;
- int nextWordWidth = font->getWidth(
+ unsigned nextWordWidth = font->getWidth(
row.substr(nextChar,
(nextSpacePos - nextChar)));
@@ -335,7 +335,7 @@ void BrowserBox::draw(gcn::Graphics *graphics)
int BrowserBox::calcHeight()
{
- int x = 0, y = 0;
+ unsigned x = 0, y = 0;
int wrappedLines = 0;
int link = 0;
gcn::Font *font = getFont();
@@ -360,7 +360,7 @@ int BrowserBox::calcHeight()
if (row.find("---", 0) == 0)
{
const int dashWidth = fontWidthMinus;
- for (x = 0; x < getWidth(); x++)
+ for (x = 0; x < (unsigned)getWidth(); x++)
{
mLineParts.push_back(LinePart(x, y, selColor, "-"));
x += dashWidth - 2;
diff --git a/src/gui/widgets/chattab.cpp b/src/gui/widgets/chattab.cpp
index 40bde104e..2c8db7e85 100644
--- a/src/gui/widgets/chattab.cpp
+++ b/src/gui/widgets/chattab.cpp
@@ -162,6 +162,7 @@ void ChatTab::chatLog(std::string line, Own own,
lineColor = "##Y";
break;
case BY_OTHER:
+ case BY_UNKNOWN:
tmp.nick += ": ";
lineColor = "##C";
break;
diff --git a/src/gui/widgets/itemcontainer.cpp b/src/gui/widgets/itemcontainer.cpp
index e0a0da87a..c9f1269aa 100644
--- a/src/gui/widgets/itemcontainer.cpp
+++ b/src/gui/widgets/itemcontainer.cpp
@@ -375,6 +375,8 @@ void ItemContainer::mouseReleased(gcn::MouseEvent &event)
case SEL_DRAGGING:
mSelectionStatus = SEL_SELECTED;
break;
+ case SEL_NONE:
+ case SEL_SELECTED:
default:
return;
};
diff --git a/src/gui/widgets/shopitems.cpp b/src/gui/widgets/shopitems.cpp
index 6cd0ef39d..764f22a57 100644
--- a/src/gui/widgets/shopitems.cpp
+++ b/src/gui/widgets/shopitems.cpp
@@ -105,12 +105,12 @@ void ShopItems::clear()
mShopItems.clear();
}
-ShopItem *ShopItems::findItem(int id, unsigned char color)
+ShopItem *ShopItems::findItem(int id, unsigned char color) const
{
ShopItem *item;
- std::vector<ShopItem*>::iterator it = mShopItems.begin();
- std::vector<ShopItem*>::iterator e = mShopItems.end();
+ std::vector<ShopItem*>::const_iterator it = mShopItems.begin();
+ std::vector<ShopItem*>::const_iterator e = mShopItems.end();
while (it != e)
{
item = *(it);
diff --git a/src/gui/widgets/shopitems.h b/src/gui/widgets/shopitems.h
index 2b2dcc5eb..cc444fe85 100644
--- a/src/gui/widgets/shopitems.h
+++ b/src/gui/widgets/shopitems.h
@@ -110,7 +110,7 @@ class ShopItems : public gcn::ListModel
*
* @return the item found or 0
*/
- ShopItem *findItem(int id, unsigned char color);
+ ShopItem *findItem(int id, unsigned char color) const;
/** The list of items in the shop. */
std::vector<ShopItem*> mShopItems;
diff --git a/src/gui/widgets/table.cpp b/src/gui/widgets/table.cpp
index 6011e4ceb..00f41a760 100644
--- a/src/gui/widgets/table.cpp
+++ b/src/gui/widgets/table.cpp
@@ -301,27 +301,31 @@ void GuiTable::draw(gcn::Graphics* graphics)
if (first_row < 0)
first_row = 0;
- int rows_nr = 1 + (getHeight() / getRowHeight()); // May overestimate
+ unsigned rows_nr = 1 + (getHeight() / getRowHeight()); // May overestimate
// by one.
- int max_rows_nr = mModel->getRows() - first_row; // clip if neccessary:
+ unsigned max_rows_nr;
+ if (mModel->getRows() < first_row)
+ max_rows_nr = 0;
+ else
+ max_rows_nr = mModel->getRows() - first_row; // clip if neccessary:
if (max_rows_nr < rows_nr)
rows_nr = max_rows_nr;
// Now determine the first and last column
// Take the easy way out; these are usually bounded and all visible.
- int first_column = 0;
- int last_column1 = mModel->getColumns();
+ unsigned first_column = 0;
+ unsigned last_column1 = mModel->getColumns();
// Set up everything for drawing
int height = getRowHeight();
int y_offset = first_row * height;
- for (int r = first_row; r < first_row + rows_nr; ++r)
+ for (unsigned r = first_row; r < first_row + rows_nr; ++r)
{
int x_offset = 0;
- for (int c = first_column; c + 1 <= last_column1; ++c)
+ for (unsigned c = first_column; c + 1 <= last_column1; ++c)
{
gcn::Widget *widget = mModel->getElementAt(r, c);
int width = getColumnWidth(c);
@@ -340,18 +344,21 @@ void GuiTable::draw(gcn::Graphics* graphics)
graphics->setColor(Theme::getThemeColor(Theme::HIGHLIGHT,
static_cast<int>(mAlpha * 255.0f)));
- if (mLinewiseMode && r == mSelectedRow && c == 0)
- {
- graphics->fillRectangle(gcn::Rectangle(0, y_offset,
- getWidth(), height));
- }
- else if (!mLinewiseMode &&
- c == mSelectedColumn && r == mSelectedRow)
+ if (mSelectedRow > 0)
{
- graphics->fillRectangle(gcn::Rectangle(x_offset, y_offset,
- width, height));
+ if (mLinewiseMode && r == (unsigned)mSelectedRow && c == 0)
+ {
+ graphics->fillRectangle(gcn::Rectangle(0, y_offset,
+ getWidth(), height));
+ }
+ else if (!mLinewiseMode && mSelectedColumn > 0
+ && c == (unsigned)mSelectedColumn
+ && r == (unsigned)mSelectedRow)
+ {
+ graphics->fillRectangle(gcn::Rectangle(x_offset, y_offset,
+ width, height));
+ }
}
-
graphics->pushClipArea(bounds);
widget->draw(graphics);
graphics->popClipArea();
diff --git a/src/gui/widgets/window.cpp b/src/gui/widgets/window.cpp
index 8c33b4787..1b008a087 100644
--- a/src/gui/widgets/window.cpp
+++ b/src/gui/widgets/window.cpp
@@ -768,14 +768,17 @@ void Window::resetToDefaultSize()
int Window::getResizeHandles(gcn::MouseEvent &event)
{
+ if (event.getX() < 0 || event.getY() < 0)
+ return 0;
+
int resizeHandles = 0;
- const int y = event.getY();
+ const unsigned y = event.getY();
if (mGrip && (y > static_cast<int>(mTitleBarHeight)
|| (y < static_cast<int>(getPadding()) && mTitleBarHeight
> getPadding())))
{
- const int x = event.getX();
+ const unsigned x = event.getX();
if (!getWindowArea().isPointInRect(x, y) && event.getSource() == this)
{
diff --git a/src/gui/widgets/window.h b/src/gui/widgets/window.h
index 6f856fc62..f455f1238 100644
--- a/src/gui/widgets/window.h
+++ b/src/gui/widgets/window.h
@@ -439,7 +439,7 @@ class Window : public gcn::Window, gcn::WidgetListener
* border width, and determines mostly the size of the corner area
* where two borders are moved at the same time.
*/
- static const int resizeBorderWidth = 10;
+ static const unsigned resizeBorderWidth = 10;
GraphicsVertexes *mVertexes;
bool mRedraw;
};