void WSelectList::hintSetCurrent(int idx)
{
selectedOption = idx;
- if (selectedOption >= options.size()) selectedOption = options.size() - 1;
+ if (selectedOption >= static_cast<int>(options.size())) selectedOption = options.size() - 1;
}
void WSelectList::hintSetTop(int idx)
numOptionsDisplayable = (area.h - 5) / ySeparation;
if (selectedOption == (topOption + numOptionsDisplayable)) topOption++;
- if (selectedOption == ((UINT)topOption - 1)) topOption--;
+ if (selectedOption == (topOption - 1)) topOption--;
// if still not visible...
- if ((selectedOption < (UINT)topOption) || (selectedOption > (topOption + numOptionsDisplayable)))
+ if ((selectedOption < topOption) || (selectedOption > (topOption + numOptionsDisplayable)))
{
topOption = selectedOption - (numOptionsDisplayable / 2);
}
if (topOption < 0) topOption = 0;
-
fillColour(backgroundColour);
UINT ypos = 5;
- for (UINT i = topOption; i < (topOption + numOptionsDisplayable); i++)
+ for (int i = topOption; i < (topOption + numOptionsDisplayable); i++)
{
- if (i == options.size()) return;
+ if (i == static_cast<int>(options.size())) return;
if ((ypos + ySeparation) > area.h) break;
if (i == selectedOption && showseloption)
{
-
- rectangle(0, ypos, area.w, (UINT)(fontHeight * linesPerOption-1), darkseloption ? DrawStyle::SELECTDARKHIGHLIGHT : DrawStyle::SELECTHIGHLIGHT);
-
+ rectangle(0, ypos, area.w, static_cast<UINT>(static_cast<float>(fontHeight) * linesPerOption) - 1, darkseloption ? DrawStyle::SELECTDARKHIGHLIGHT : DrawStyle::SELECTHIGHLIGHT);
drawOptionLine(options[i].text, 5, ypos, area.w - 5, DrawStyle::DARKTEXT, options[i].pict);
}
else
{
- rectangle(0, ypos, area.w, (UINT)(fontHeight * linesPerOption-1), DrawStyle::SELECTBACKGROUND);
-
- drawOptionLine(options[i].text, 5, ypos, area.w - 5, DrawStyle::LIGHTTEXT, options[i].pict);
+ rectangle(0, ypos, area.w, static_cast<UINT>(static_cast<float>(fontHeight) * linesPerOption) - 1, DrawStyle::SELECTBACKGROUND);
+ drawOptionLine(options[i].text, 5, ypos, area.w - 5, DrawStyle::LIGHTTEXT, options[i].pict);
}
ypos += ySeparation;
}
UINT curline = 0;
UINT taboffset = 0;
int fontHeight = getFontHeight();
- float ypos_mod = ypos + (linesPerOption - floor(linesPerOption)) * ((float)fontHeight) * 0.5f;
+ float ypos_mod = static_cast<float>(ypos) + (linesPerOption - floor(linesPerOption)) * static_cast<float>(fontHeight) * 0.5f;
int imagewidth = 0;
int xposmod = xpos;
if (numColumns > 1) imagewidth = columns[1] - columns[0];
if (pict)
{
- drawTVMedia(*pict, xpos, ypos, imagewidth, fontHeight * linesPerOption, TopLeftLimited);
+ drawTVMedia(*pict, static_cast<float>(xpos), static_cast<float>(ypos), static_cast<float>(imagewidth),
+ static_cast<float>(fontHeight) * linesPerOption, TopLeftLimited);
taboffset++;
xposmod += xpos;
}
pointer = STRTOKR(buffer, "\t\n", &savepointer);
while(pointer)
{
- drawText(pointer, xposmod + columns[currentColumn], (int)(ypos_mod + curline * fontHeight), width - columns[currentColumn], colour);
+ drawText(pointer, xposmod + columns[currentColumn], (fontHeight * curline) + static_cast<int>(ypos_mod), width - columns[currentColumn], colour);
pointer = STRTOKR(NULL, "\t\n", &savepointer);
if (pointer)
void WSelectList::down()
{
- if (selectedOption < options.size() - 1)
+ if (selectedOption < (static_cast<int>(options.size()) - 1))
{
selectedOption++;
}
void WSelectList::pageDown()
{
- if ((topOption + numOptionsDisplayable) >= options.size())
+ if ((topOption + numOptionsDisplayable) >= static_cast<int>(options.size()))
{
selectedOption = options.size() - 1;
}
bool WSelectList::mouseMove(int x, int y)
{
int ml = getMouseLine(x - getRootBoxOffsetX(), y - getRootBoxOffsetY());
- if (ml >= 0 && ml != static_cast<int>(selectedOption))
+ if (ml >= 0 && ml != selectedOption)
{
selectedOption = ml;
return true;
bool WSelectList::mouseLBDOWN(int x, int y)
{
int ml = getMouseLine(x - getRootBoxOffsetX(), y - getRootBoxOffsetY());
- if (ml == static_cast<int>(selectedOption))
+ if (ml == selectedOption)
{
/* caller should generate a OK message*/
return true;
return false;
}
-int WSelectList::getMouseLine(int x,int y)
+int WSelectList::getMouseLine(int x, int y)
{
int fontHeight = getFontHeight();
int ySeparation = static_cast<int>(static_cast<float>(fontHeight) * linesPerOption) + gap;
if (y < 0) return -1;
- if (x < 0 || x > (int)area.w) return -1;
- if (y > (int)(10 + numOptionsDisplayable * ySeparation)) return -1;
+ if (x < 0 || x > static_cast<int>(area.w)) return -1;
+ if (y > (10 + numOptionsDisplayable * ySeparation)) return -1;
int cy = y - 5;
int selected = cy / ySeparation;
if (y < 5) selected = -1;
- if (selected > static_cast<int>(numOptionsDisplayable)) return -1;
+ if (selected > numOptionsDisplayable) return -1;
/* Important: should be the same algorithm used in draw! */
if (selectedOption == (topOption + numOptionsDisplayable)) topOption++;
- if (selectedOption == static_cast<UINT>(topOption - 1)) topOption--;
+ if (selectedOption == (topOption - 1)) topOption--;
// if still not visible...
- if ((selectedOption < static_cast<UINT>(topOption)) || (selectedOption > (topOption + numOptionsDisplayable)))
+ if ((selectedOption < topOption) || (selectedOption > (topOption + numOptionsDisplayable)))
{
topOption = selectedOption - (numOptionsDisplayable / 2);
}