mirror of
https://github.com/LIV2/amiberry.git
synced 2025-12-06 06:32:45 +00:00
enhancement: guisan: clang tidy, use const when possible
This commit is contained in:
parent
e465e3f845
commit
073da6c60d
@ -125,7 +125,7 @@ namespace gcn
|
||||
* @return A Guisan key value.
|
||||
* @see Key
|
||||
*/
|
||||
Key convertSDLEventToGuichanKeyValue(SDL_Event event);
|
||||
Key convertSDLEventToGuichanKeyValue(const SDL_Event& event);
|
||||
|
||||
std::queue<KeyInput> mKeyInputQueue;
|
||||
std::queue<MouseInput> mMouseInputQueue;
|
||||
|
||||
@ -150,7 +150,7 @@ namespace gcn
|
||||
* @return the ListModel used.
|
||||
* @see setListModel
|
||||
*/
|
||||
ListModel *getListModel();
|
||||
ListModel *getListModel() const;
|
||||
|
||||
/**
|
||||
* Adjusts the height of the drop down to fit the height of the
|
||||
|
||||
@ -78,7 +78,7 @@ namespace gcn
|
||||
* @param filename The filename of the image to display.
|
||||
* @param caption The text to display.
|
||||
*/
|
||||
ImageTextButton(const std::string& filename, std::string& caption);
|
||||
ImageTextButton(const std::string& filename, const std::string& caption);
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
@ -86,7 +86,7 @@ namespace gcn
|
||||
* @param image The image to display.
|
||||
* @param caption The text to display.
|
||||
*/
|
||||
ImageTextButton(Image* image, std::string& caption);
|
||||
ImageTextButton(const Image* image, const std::string& caption);
|
||||
|
||||
/**
|
||||
* Destructor.
|
||||
@ -110,7 +110,7 @@ namespace gcn
|
||||
*
|
||||
* @return The image of the image button.
|
||||
*/
|
||||
Image* getImage();
|
||||
Image* getImage() const;
|
||||
|
||||
|
||||
// Inherited from Widget
|
||||
|
||||
@ -134,7 +134,7 @@ namespace gcn
|
||||
* @return the list model used.
|
||||
* @see setListModel
|
||||
*/
|
||||
ListModel *getListModel();
|
||||
ListModel *getListModel() const;
|
||||
|
||||
/**
|
||||
* Adjusts the size of the list box to fit its list model.
|
||||
|
||||
@ -162,7 +162,7 @@ namespace gcn
|
||||
*
|
||||
* @return the title bar height.
|
||||
*/
|
||||
unsigned int getTitleBarHeight();
|
||||
unsigned int getTitleBarHeight() const;
|
||||
|
||||
/**
|
||||
* Check if the window is movable.
|
||||
@ -184,7 +184,7 @@ namespace gcn
|
||||
*
|
||||
* @return true or false.
|
||||
*/
|
||||
bool isOpaque();
|
||||
bool isOpaque() const;
|
||||
|
||||
/**
|
||||
* Add this MessageBox to a parent container, centered both horizontally and vertically
|
||||
|
||||
@ -133,7 +133,7 @@ namespace gcn
|
||||
*
|
||||
* @return the content of the ScrollArea.
|
||||
*/
|
||||
Widget* getContent();
|
||||
Widget* getContent() const;
|
||||
|
||||
/**
|
||||
* Sets the horizontal scrollbar policy.
|
||||
@ -416,42 +416,42 @@ namespace gcn
|
||||
*
|
||||
* @return the dimension of the up button.
|
||||
*/
|
||||
Rectangle getUpButtonDimension();
|
||||
Rectangle getUpButtonDimension() const;
|
||||
|
||||
/**
|
||||
* Gets the down button dimension.
|
||||
*
|
||||
* @return the dimension of the down button.
|
||||
*/
|
||||
Rectangle getDownButtonDimension();
|
||||
Rectangle getDownButtonDimension() const;
|
||||
|
||||
/**
|
||||
* Gets the left button dimension.
|
||||
*
|
||||
* @return the dimension of the left button.
|
||||
*/
|
||||
Rectangle getLeftButtonDimension();
|
||||
Rectangle getLeftButtonDimension() const;
|
||||
|
||||
/**
|
||||
* Gets the right button dimension.
|
||||
*
|
||||
* @return the dimension of the right button.
|
||||
*/
|
||||
Rectangle getRightButtonDimension();
|
||||
Rectangle getRightButtonDimension() const;
|
||||
|
||||
/**
|
||||
* Gets the vertical scrollbar dimension.
|
||||
*
|
||||
* @return the dimension of the vertical scrollbar.
|
||||
*/
|
||||
Rectangle getVerticalBarDimension();
|
||||
Rectangle getVerticalBarDimension() const;
|
||||
|
||||
/**
|
||||
* Gets the horizontal scrollbar dimension.
|
||||
*
|
||||
* @return the dimension of the horizontal scrollbar.
|
||||
*/
|
||||
Rectangle getHorizontalBarDimension();
|
||||
Rectangle getHorizontalBarDimension() const;
|
||||
|
||||
/**
|
||||
* Gets the vertical marker dimension.
|
||||
|
||||
@ -207,7 +207,7 @@ namespace gcn
|
||||
* @return The selected tab.
|
||||
* @see isTabSelected, setSelectedTab
|
||||
*/
|
||||
Tab* getSelectedTab();
|
||||
Tab* getSelectedTab() const;
|
||||
|
||||
|
||||
// Inherited from Widget
|
||||
@ -247,12 +247,12 @@ namespace gcn
|
||||
/**
|
||||
* Adjusts the size of the tab container and the widget container.
|
||||
*/
|
||||
void adjustSize();
|
||||
void adjustSize() const;
|
||||
|
||||
/**
|
||||
* Adjusts the positions of the tabs.
|
||||
*/
|
||||
void adjustTabPositions();
|
||||
void adjustTabPositions() const;
|
||||
|
||||
/**
|
||||
* Holds the selected tab.
|
||||
|
||||
@ -146,7 +146,7 @@ namespace gcn
|
||||
* @param position the positon of the caret.
|
||||
* @see getCaretPosition
|
||||
*/
|
||||
void setCaretPosition(unsigned int position);
|
||||
void setCaretPosition(unsigned int position) const;
|
||||
|
||||
/**
|
||||
* Gets the row number where the caret is currently located.
|
||||
@ -162,7 +162,7 @@ namespace gcn
|
||||
* @param The row where the caret should be currently located.
|
||||
* @see getCaretRow
|
||||
*/
|
||||
void setCaretRow(int row);
|
||||
void setCaretRow(int row) const;
|
||||
|
||||
/**
|
||||
* Gets the column where the caret is currently located.
|
||||
@ -178,7 +178,7 @@ namespace gcn
|
||||
* @param The column where the caret should be currently located.
|
||||
* @see getCaretColumn
|
||||
*/
|
||||
void setCaretColumn(int column);
|
||||
void setCaretColumn(int column) const;
|
||||
|
||||
/**
|
||||
* Sets the row and the column where the caret should be currently
|
||||
@ -188,7 +188,7 @@ namespace gcn
|
||||
* @param column The column where the caret should be currently located.
|
||||
* @see getCaretRow, getCaretColumn
|
||||
*/
|
||||
void setCaretRowColumn(int row, int column);
|
||||
void setCaretRowColumn(int row, int column) const;
|
||||
|
||||
/**
|
||||
* Scrolls the text to the caret if the text box is in a scroll area.
|
||||
@ -227,7 +227,7 @@ namespace gcn
|
||||
* @return True if the text box is opaque, false otherwise.
|
||||
* @see setOpaque
|
||||
*/
|
||||
bool isOpaque();
|
||||
bool isOpaque() const;
|
||||
|
||||
/**
|
||||
* Sets the text box to be opaque or not. An opaque text box will draw
|
||||
|
||||
@ -96,7 +96,7 @@ namespace gcn
|
||||
* @param text The text of the text field.
|
||||
* @see getText
|
||||
*/
|
||||
void setText(const std::string& text);
|
||||
void setText(const std::string& text) const;
|
||||
|
||||
/**
|
||||
* Gets the text of the text field.
|
||||
@ -140,7 +140,7 @@ namespace gcn
|
||||
* @param position The caret position.
|
||||
* @see getCaretPosition
|
||||
*/
|
||||
void setCaretPosition(unsigned int position);
|
||||
void setCaretPosition(unsigned int position) const;
|
||||
|
||||
/**
|
||||
* Gets the caret position. As there is only one line of text
|
||||
|
||||
@ -154,7 +154,7 @@ namespace gcn
|
||||
* @return The title bar height.
|
||||
* @see setTitleBarHeight
|
||||
*/
|
||||
unsigned int getTitleBarHeight();
|
||||
unsigned int getTitleBarHeight() const;
|
||||
|
||||
/**
|
||||
* Sets the window to be moveble or not.
|
||||
@ -187,7 +187,7 @@ namespace gcn
|
||||
* @return True if the window is opaque, false otherwise.
|
||||
* @see setOpaque
|
||||
*/
|
||||
bool isOpaque();
|
||||
bool isOpaque() const;
|
||||
|
||||
/**
|
||||
* Resizes the window to fit the content.
|
||||
|
||||
32
external/libguisan/src/basiccontainer.cpp
vendored
32
external/libguisan/src/basiccontainer.cpp
vendored
@ -131,7 +131,7 @@ namespace gcn
|
||||
{
|
||||
WidgetListIterator it;
|
||||
|
||||
for (it = mWidgets.begin(); it != mWidgets.end(); it++)
|
||||
for (it = mWidgets.begin(); it != mWidgets.end(); ++it)
|
||||
{
|
||||
if ((*it)->isFocused())
|
||||
{
|
||||
@ -146,9 +146,9 @@ namespace gcn
|
||||
it = mWidgets.begin();
|
||||
}
|
||||
|
||||
it++;
|
||||
++it;
|
||||
|
||||
for ( ; it != end; it++)
|
||||
for ( ; it != end; ++it)
|
||||
{
|
||||
if (it == mWidgets.end())
|
||||
{
|
||||
@ -167,7 +167,7 @@ namespace gcn
|
||||
{
|
||||
WidgetListReverseIterator it;
|
||||
|
||||
for (it = mWidgets.rbegin(); it != mWidgets.rend(); it++)
|
||||
for (it = mWidgets.rbegin(); it != mWidgets.rend(); ++it)
|
||||
{
|
||||
if ((*it)->isFocused())
|
||||
{
|
||||
@ -177,14 +177,14 @@ namespace gcn
|
||||
|
||||
WidgetListReverseIterator end = it;
|
||||
|
||||
it++;
|
||||
++it;
|
||||
|
||||
if (it == mWidgets.rend())
|
||||
{
|
||||
it = mWidgets.rbegin();
|
||||
}
|
||||
|
||||
for ( ; it != end; it++)
|
||||
for ( ; it != end; ++it)
|
||||
{
|
||||
if (it == mWidgets.rend())
|
||||
{
|
||||
@ -212,7 +212,7 @@ namespace gcn
|
||||
y -= r.y;
|
||||
|
||||
WidgetListReverseIterator it;
|
||||
for (it = mWidgets.rbegin(); it != mWidgets.rend(); it++)
|
||||
for (it = mWidgets.rbegin(); it != mWidgets.rend(); ++it)
|
||||
{
|
||||
if ((*it)->isVisible() && (*it)->getDimension().isContaining(x, y))
|
||||
{
|
||||
@ -254,7 +254,7 @@ namespace gcn
|
||||
}
|
||||
|
||||
WidgetListIterator iter;
|
||||
for (iter = mWidgets.begin(); iter != mWidgets.end(); iter++)
|
||||
for (iter = mWidgets.begin(); iter != mWidgets.end(); ++iter)
|
||||
{
|
||||
(*iter)->_setFocusHandler(focusHandler);
|
||||
}
|
||||
@ -280,7 +280,7 @@ namespace gcn
|
||||
void BasicContainer::remove(Widget* widget)
|
||||
{
|
||||
WidgetListIterator iter;
|
||||
for (iter = mWidgets.begin(); iter != mWidgets.end(); iter++)
|
||||
for (iter = mWidgets.begin(); iter != mWidgets.end(); ++iter)
|
||||
{
|
||||
if (*iter == widget)
|
||||
{
|
||||
@ -299,7 +299,7 @@ namespace gcn
|
||||
{
|
||||
WidgetListIterator iter;
|
||||
|
||||
for (iter = mWidgets.begin(); iter != mWidgets.end(); iter++)
|
||||
for (iter = mWidgets.begin(); iter != mWidgets.end(); ++iter)
|
||||
{
|
||||
(*iter)->_setFocusHandler(NULL);
|
||||
(*iter)->_setParent(NULL);
|
||||
@ -314,7 +314,7 @@ namespace gcn
|
||||
graphics->pushClipArea(getChildrenArea());
|
||||
|
||||
WidgetListIterator iter;
|
||||
for (iter = mWidgets.begin(); iter != mWidgets.end(); iter++)
|
||||
for (iter = mWidgets.begin(); iter != mWidgets.end(); ++iter)
|
||||
{
|
||||
if ((*iter)->isVisible())
|
||||
{
|
||||
@ -344,7 +344,7 @@ namespace gcn
|
||||
void BasicContainer::logicChildren()
|
||||
{
|
||||
WidgetListIterator iter;
|
||||
for (iter = mWidgets.begin(); iter != mWidgets.end(); iter++)
|
||||
for (iter = mWidgets.begin(); iter != mWidgets.end(); ++iter)
|
||||
{
|
||||
(*iter)->logic();
|
||||
}
|
||||
@ -383,7 +383,7 @@ namespace gcn
|
||||
Widget::setInternalFocusHandler(focusHandler);
|
||||
|
||||
WidgetListIterator iter;
|
||||
for (iter = mWidgets.begin(); iter != mWidgets.end(); iter++)
|
||||
for (iter = mWidgets.begin(); iter != mWidgets.end(); ++iter)
|
||||
{
|
||||
if (mInternalFocusHandler == NULL)
|
||||
{
|
||||
@ -399,7 +399,7 @@ namespace gcn
|
||||
Widget* BasicContainer::findWidgetById(const std::string& id)
|
||||
{
|
||||
WidgetListIterator iter;
|
||||
for (iter = mWidgets.begin(); iter != mWidgets.end(); iter++)
|
||||
for (iter = mWidgets.begin(); iter != mWidgets.end(); ++iter)
|
||||
{
|
||||
if ((*iter)->getId() == id)
|
||||
{
|
||||
@ -438,7 +438,7 @@ namespace gcn
|
||||
{
|
||||
int w = 0, h = 0;
|
||||
|
||||
for (WidgetListIterator it = mWidgets.begin(); it != mWidgets.end(); it++)
|
||||
for (WidgetListIterator it = mWidgets.begin(); it != mWidgets.end(); ++it)
|
||||
{
|
||||
if ((*it)->getX() + (*it)->getWidth() > w)
|
||||
{
|
||||
@ -458,7 +458,7 @@ namespace gcn
|
||||
{
|
||||
std::list<Widget*> result;
|
||||
|
||||
for (std::list<Widget*>::const_iterator iter = mWidgets.begin(); iter != mWidgets.end(); iter++)
|
||||
for (std::list<Widget*>::const_iterator iter = mWidgets.begin(); iter != mWidgets.end(); ++iter)
|
||||
{
|
||||
Widget* widget = (*iter);
|
||||
if (ignore != widget && widget->getDimension().isIntersecting(area))
|
||||
|
||||
2
external/libguisan/src/cliprectangle.cpp
vendored
2
external/libguisan/src/cliprectangle.cpp
vendored
@ -67,7 +67,7 @@ namespace gcn
|
||||
x = y = width = height = xOffset = yOffset = 0;
|
||||
}
|
||||
|
||||
ClipRectangle::ClipRectangle(int x, int y, int width, int height, int xOffset, int yOffset)
|
||||
ClipRectangle::ClipRectangle(const int x, const int y, const int width, const int height, const int xOffset, const int yOffset)
|
||||
{
|
||||
this->x = x;
|
||||
this->y = y;
|
||||
|
||||
6
external/libguisan/src/color.cpp
vendored
6
external/libguisan/src/color.cpp
vendored
@ -71,7 +71,7 @@ namespace gcn
|
||||
{
|
||||
}
|
||||
|
||||
Color::Color(int color)
|
||||
Color::Color(const int color)
|
||||
:
|
||||
r((color >> 16) & 0xFF),
|
||||
g((color >> 8) & 0xFF),
|
||||
@ -80,7 +80,7 @@ namespace gcn
|
||||
{
|
||||
}
|
||||
|
||||
Color::Color(int ar, int ag, int ab, int aa)
|
||||
Color::Color(const int ar, const int ag, const int ab, const int aa)
|
||||
:
|
||||
r(ar),
|
||||
g(ag),
|
||||
@ -111,7 +111,7 @@ namespace gcn
|
||||
return result;
|
||||
}
|
||||
|
||||
Color Color::operator*(float value) const
|
||||
Color Color::operator*(const float value) const
|
||||
{
|
||||
Color result(r * static_cast<int>(value), g * static_cast<int>(value), b * static_cast<int>(value), a);
|
||||
|
||||
|
||||
6
external/libguisan/src/defaultfont.cpp
vendored
6
external/libguisan/src/defaultfont.cpp
vendored
@ -77,14 +77,14 @@ namespace gcn
|
||||
return 8 * static_cast<int>(text.size());
|
||||
}
|
||||
|
||||
int DefaultFont::drawGlyph(Graphics* graphics, unsigned char glyph, int x, int y)
|
||||
int DefaultFont::drawGlyph(Graphics* graphics, unsigned char glyph, const int x, const int y)
|
||||
{
|
||||
graphics->drawRectangle(Rectangle(x, y, 8, 8));
|
||||
|
||||
return 8;
|
||||
}
|
||||
|
||||
void DefaultFont::drawString(Graphics* graphics, const std::string& text, int x, int y, bool enabled)
|
||||
void DefaultFont::drawString(Graphics* graphics, const std::string& text, int x, const int y, bool enabled)
|
||||
{
|
||||
for (auto i = 0; i < static_cast<int>(text.size()); ++i)
|
||||
{
|
||||
@ -93,7 +93,7 @@ namespace gcn
|
||||
}
|
||||
}
|
||||
|
||||
int DefaultFont::getStringIndexAt(const std::string& text, int x) const
|
||||
int DefaultFont::getStringIndexAt(const std::string& text, const int x) const
|
||||
{
|
||||
if (x > static_cast<int>(text.size()) * 8)
|
||||
{
|
||||
|
||||
3
external/libguisan/src/exception.cpp
vendored
3
external/libguisan/src/exception.cpp
vendored
@ -64,7 +64,6 @@ namespace gcn
|
||||
{
|
||||
Exception::Exception()
|
||||
: mFunction("?"),
|
||||
mMessage(""),
|
||||
mFilename("?"),
|
||||
mLine(0)
|
||||
{
|
||||
@ -81,7 +80,7 @@ namespace gcn
|
||||
Exception::Exception(std::string message,
|
||||
std::string function,
|
||||
std::string filename,
|
||||
unsigned int line)
|
||||
const unsigned int line)
|
||||
: mFunction(std::move(function)),
|
||||
mMessage(std::move(message)),
|
||||
mFilename(std::move(filename)),
|
||||
|
||||
2
external/libguisan/src/font.cpp
vendored
2
external/libguisan/src/font.cpp
vendored
@ -64,7 +64,7 @@
|
||||
|
||||
namespace gcn
|
||||
{
|
||||
int Font::getStringIndexAt(const std::string& text, int x) const
|
||||
int Font::getStringIndexAt(const std::string& text, const int x) const
|
||||
{
|
||||
int size = 0;
|
||||
|
||||
|
||||
10
external/libguisan/src/genericinput.cpp
vendored
10
external/libguisan/src/genericinput.cpp
vendored
@ -77,7 +77,7 @@ namespace gcn
|
||||
// TODO
|
||||
}
|
||||
|
||||
void GenericInput::pushMouseButtonPressed(int x, int y, int button)
|
||||
void GenericInput::pushMouseButtonPressed(const int x, const int y, const int button)
|
||||
{
|
||||
MouseInput mouseInput;
|
||||
mouseInput.setX(x);
|
||||
@ -88,7 +88,7 @@ namespace gcn
|
||||
mMouseInputQueue.push(mouseInput);
|
||||
}
|
||||
|
||||
void GenericInput::pushMouseButtonReleased(int x, int y, int button)
|
||||
void GenericInput::pushMouseButtonReleased(const int x, const int y, const int button)
|
||||
{
|
||||
MouseInput mouseInput;
|
||||
mouseInput.setX(x);
|
||||
@ -99,7 +99,7 @@ namespace gcn
|
||||
mMouseInputQueue.push(mouseInput);
|
||||
}
|
||||
|
||||
void GenericInput::pushMouseWheelMovedUp(int x, int y)
|
||||
void GenericInput::pushMouseWheelMovedUp(const int x, const int y)
|
||||
{
|
||||
MouseInput mouseInput;
|
||||
mouseInput.setX(x);
|
||||
@ -109,7 +109,7 @@ namespace gcn
|
||||
mMouseInputQueue.push(mouseInput);
|
||||
}
|
||||
|
||||
void GenericInput::pushMouseWheelMovedDown(int x, int y)
|
||||
void GenericInput::pushMouseWheelMovedDown(const int x, const int y)
|
||||
{
|
||||
MouseInput mouseInput;
|
||||
mouseInput.setX(x);
|
||||
@ -119,7 +119,7 @@ namespace gcn
|
||||
mMouseInputQueue.push(mouseInput);
|
||||
}
|
||||
|
||||
void GenericInput::pushMouseMoved(int x, int y)
|
||||
void GenericInput::pushMouseMoved(const int x, const int y)
|
||||
{
|
||||
MouseInput mouseInput;
|
||||
mouseInput.setX(x);
|
||||
|
||||
8
external/libguisan/src/graphics.cpp
vendored
8
external/libguisan/src/graphics.cpp
vendored
@ -71,7 +71,7 @@ namespace gcn
|
||||
mFont = nullptr;
|
||||
}
|
||||
|
||||
bool Graphics::pushClipArea(Rectangle area)
|
||||
bool Graphics::pushClipArea(const Rectangle area)
|
||||
{
|
||||
// Ignore area with a negative width or height
|
||||
// by simple pushing an empty clip area to the stack.
|
||||
@ -129,7 +129,7 @@ namespace gcn
|
||||
return mClipStack.top();
|
||||
}
|
||||
|
||||
void Graphics::drawImage(const Image* image, int dstX, int dstY)
|
||||
void Graphics::drawImage(const Image* image, const int dstX, const int dstY)
|
||||
{
|
||||
drawImage(image, 0, 0, dstX, dstY, image->getWidth(), image->getHeight());
|
||||
}
|
||||
@ -139,8 +139,8 @@ namespace gcn
|
||||
mFont = font;
|
||||
}
|
||||
|
||||
void Graphics::drawText(const std::string& text, int x, int y,
|
||||
Alignment alignment, bool enabled)
|
||||
void Graphics::drawText(const std::string& text, const int x, const int y,
|
||||
const Alignment alignment, const bool enabled)
|
||||
{
|
||||
if (mFont == nullptr)
|
||||
{
|
||||
|
||||
28
external/libguisan/src/gui.cpp
vendored
28
external/libguisan/src/gui.cpp
vendored
@ -208,7 +208,7 @@ namespace gcn
|
||||
mFocusHandler->focusNone();
|
||||
}
|
||||
|
||||
void Gui::setTabbingEnabled(bool tabbing)
|
||||
void Gui::setTabbingEnabled(const bool tabbing)
|
||||
{
|
||||
mTabbing = tabbing;
|
||||
}
|
||||
@ -356,7 +356,7 @@ namespace gcn
|
||||
|| !mTop->getDimension().isContaining(mouseInput.getX(), mouseInput.getY()))
|
||||
{
|
||||
std::set<Widget*>::const_iterator iter;
|
||||
for (iter = mLastWidgetsWithMouse.begin(); iter != mLastWidgetsWithMouse.end(); iter++)
|
||||
for (iter = mLastWidgetsWithMouse.begin(); iter != mLastWidgetsWithMouse.end(); ++iter)
|
||||
{
|
||||
distributeMouseEvent((*iter),
|
||||
MouseEvent::Exited,
|
||||
@ -392,7 +392,7 @@ namespace gcn
|
||||
|
||||
std::set<Widget*>::const_iterator iter;
|
||||
for (iter = mWidgetsWithMouseExited.begin(); iter != mWidgetsWithMouseExited.end();
|
||||
iter++)
|
||||
++iter)
|
||||
{
|
||||
distributeMouseEvent((*iter),
|
||||
MouseEvent::Exited,
|
||||
@ -409,7 +409,7 @@ namespace gcn
|
||||
}
|
||||
|
||||
for (iter = mWidgetsWithMouseEntered.begin(); iter != mWidgetsWithMouseEntered.end();
|
||||
iter++)
|
||||
++iter)
|
||||
{
|
||||
Widget* widget = (*iter);
|
||||
// If a widget has modal mouse input focus we
|
||||
@ -642,7 +642,7 @@ namespace gcn
|
||||
}
|
||||
}
|
||||
|
||||
Widget* Gui::getWidgetAt(int x, int y)
|
||||
Widget* Gui::getWidgetAt(const int x, const int y)
|
||||
{
|
||||
// If the widget's parent has no child then we have found the widget..
|
||||
Widget* parent = mTop;
|
||||
@ -660,7 +660,7 @@ namespace gcn
|
||||
return parent;
|
||||
}
|
||||
|
||||
std::set<Widget*> Gui::getWidgetsAt(int x, int y)
|
||||
std::set<Widget*> Gui::getWidgetsAt(const int x, const int y)
|
||||
{
|
||||
std::set<Widget*> result;
|
||||
|
||||
@ -677,7 +677,7 @@ namespace gcn
|
||||
return result;
|
||||
}
|
||||
|
||||
Widget* Gui::getMouseEventSource(int x, int y)
|
||||
Widget* Gui::getMouseEventSource(const int x, const int y)
|
||||
{
|
||||
Widget* widget = getWidgetAt(x, y);
|
||||
|
||||
@ -704,12 +704,12 @@ namespace gcn
|
||||
}
|
||||
|
||||
void Gui::distributeMouseEvent(Widget* source,
|
||||
int type,
|
||||
int button,
|
||||
int x,
|
||||
int y,
|
||||
bool force,
|
||||
bool toSourceOnly)
|
||||
const int type,
|
||||
const int button,
|
||||
const int x,
|
||||
const int y,
|
||||
const bool force,
|
||||
const bool toSourceOnly)
|
||||
{
|
||||
Widget* parent = source;
|
||||
Widget* widget = source;
|
||||
@ -963,7 +963,7 @@ namespace gcn
|
||||
|
||||
for (std::set<Widget*>::const_iterator iter = mWidgetsWithMouse.begin();
|
||||
iter != mWidgetsWithMouse.end();
|
||||
iter++)
|
||||
++iter)
|
||||
{
|
||||
distributeMouseEvent((*iter),
|
||||
MouseEvent::Exited,
|
||||
|
||||
2
external/libguisan/src/image.cpp
vendored
2
external/libguisan/src/image.cpp
vendored
@ -83,7 +83,7 @@ namespace gcn
|
||||
return mImageLoader;
|
||||
}
|
||||
|
||||
Image* Image::load(const std::string& filename, bool convertToDisplayFormat)
|
||||
Image* Image::load(const std::string& filename, const bool convertToDisplayFormat)
|
||||
{
|
||||
if (mImageLoader == nullptr)
|
||||
{
|
||||
|
||||
22
external/libguisan/src/imagefont.cpp
vendored
22
external/libguisan/src/imagefont.cpp
vendored
@ -164,8 +164,8 @@ namespace gcn
|
||||
}
|
||||
|
||||
ImageFont::ImageFont(const std::string& filename,
|
||||
unsigned char glyphsFrom,
|
||||
unsigned char glyphsTo)
|
||||
const unsigned char glyphsFrom,
|
||||
const unsigned char glyphsTo)
|
||||
{
|
||||
mFilename = filename;
|
||||
mImage = Image::load(filename, false);
|
||||
@ -214,7 +214,7 @@ namespace gcn
|
||||
delete mImage;
|
||||
}
|
||||
|
||||
int ImageFont::getWidth(unsigned char glyph) const
|
||||
int ImageFont::getWidth(const unsigned char glyph) const
|
||||
{
|
||||
if (mGlyph[glyph].width == 0)
|
||||
{
|
||||
@ -229,7 +229,7 @@ namespace gcn
|
||||
return mHeight + mRowSpacing;
|
||||
}
|
||||
|
||||
int ImageFont::drawGlyph(Graphics* graphics, unsigned char glyph, int x, int y)
|
||||
int ImageFont::drawGlyph(Graphics* graphics, const unsigned char glyph, const int x, const int y)
|
||||
{
|
||||
// This is needed for drawing the glyph in the middle if we have spacing
|
||||
int yoffset = getRowSpacing() / 2;
|
||||
@ -253,18 +253,16 @@ namespace gcn
|
||||
return mGlyph[glyph].width + mGlyphSpacing;
|
||||
}
|
||||
|
||||
void ImageFont::drawString(Graphics* graphics, const std::string& text, int x, int y, bool enabled)
|
||||
void ImageFont::drawString(Graphics* graphics, const std::string& text, int x, const int y, bool enabled)
|
||||
{
|
||||
unsigned int i;
|
||||
|
||||
for (i = 0; i < text.size(); ++i)
|
||||
for (unsigned int i = 0; i < text.size(); ++i)
|
||||
{
|
||||
drawGlyph(graphics, text.at(i), x, y);
|
||||
x += getWidth(text.at(i));
|
||||
}
|
||||
}
|
||||
|
||||
void ImageFont::setRowSpacing(int spacing)
|
||||
void ImageFont::setRowSpacing(const int spacing)
|
||||
{
|
||||
mRowSpacing = spacing;
|
||||
}
|
||||
@ -274,7 +272,7 @@ namespace gcn
|
||||
return mRowSpacing;
|
||||
}
|
||||
|
||||
void ImageFont::setGlyphSpacing(int spacing)
|
||||
void ImageFont::setGlyphSpacing(const int spacing)
|
||||
{
|
||||
mGlyphSpacing = spacing;
|
||||
}
|
||||
@ -335,7 +333,7 @@ namespace gcn
|
||||
|
||||
} while (color != separator);
|
||||
|
||||
return Rectangle(x, y, width, mHeight);
|
||||
return {x, y, width, mHeight};
|
||||
}
|
||||
|
||||
int ImageFont::getWidth(const std::string& text) const
|
||||
@ -350,7 +348,7 @@ namespace gcn
|
||||
return size - mGlyphSpacing;
|
||||
}
|
||||
|
||||
int ImageFont::getStringIndexAt(const std::string& text, int x) const
|
||||
int ImageFont::getStringIndexAt(const std::string& text, const int x) const
|
||||
{
|
||||
int size = 0;
|
||||
|
||||
|
||||
8
external/libguisan/src/inputevent.cpp
vendored
8
external/libguisan/src/inputevent.cpp
vendored
@ -64,10 +64,10 @@ namespace gcn
|
||||
{
|
||||
InputEvent::InputEvent(Widget* source,
|
||||
Widget* distributor,
|
||||
bool isShiftPressed,
|
||||
bool isControlPressed,
|
||||
bool isAltPressed,
|
||||
bool isMetaPressed) :
|
||||
const bool isShiftPressed,
|
||||
const bool isControlPressed,
|
||||
const bool isAltPressed,
|
||||
const bool isMetaPressed) :
|
||||
Event(source),
|
||||
mShiftPressed(isShiftPressed),
|
||||
mControlPressed(isControlPressed),
|
||||
|
||||
2
external/libguisan/src/key.cpp
vendored
2
external/libguisan/src/key.cpp
vendored
@ -62,7 +62,7 @@
|
||||
|
||||
namespace gcn
|
||||
{
|
||||
Key::Key(int value)
|
||||
Key::Key(const int value)
|
||||
: mValue(value)
|
||||
{
|
||||
}
|
||||
|
||||
12
external/libguisan/src/keyevent.cpp
vendored
12
external/libguisan/src/keyevent.cpp
vendored
@ -64,12 +64,12 @@ namespace gcn
|
||||
{
|
||||
KeyEvent::KeyEvent(Widget* source,
|
||||
Widget* distributor,
|
||||
bool isShiftPressed,
|
||||
bool isControlPressed,
|
||||
bool isAltPressed,
|
||||
bool isMetaPressed,
|
||||
unsigned int type,
|
||||
bool isNumericPad,
|
||||
const bool isShiftPressed,
|
||||
const bool isControlPressed,
|
||||
const bool isAltPressed,
|
||||
const bool isMetaPressed,
|
||||
const unsigned int type,
|
||||
const bool isNumericPad,
|
||||
const Key& key) :
|
||||
InputEvent(
|
||||
source, distributor, isShiftPressed, isControlPressed, isAltPressed, isMetaPressed),
|
||||
|
||||
14
external/libguisan/src/keyinput.cpp
vendored
14
external/libguisan/src/keyinput.cpp
vendored
@ -62,7 +62,7 @@
|
||||
|
||||
namespace gcn
|
||||
{
|
||||
KeyInput::KeyInput(const Key& key, unsigned int type)
|
||||
KeyInput::KeyInput(const Key& key, const unsigned int type)
|
||||
: mKey(key),
|
||||
mType(type),
|
||||
mShiftPressed(false),
|
||||
@ -73,7 +73,7 @@ namespace gcn
|
||||
{
|
||||
}
|
||||
|
||||
void KeyInput::setType(unsigned int type)
|
||||
void KeyInput::setType(const unsigned int type)
|
||||
{
|
||||
mType = type;
|
||||
}
|
||||
@ -98,7 +98,7 @@ namespace gcn
|
||||
return mShiftPressed;
|
||||
}
|
||||
|
||||
void KeyInput::setShiftPressed(bool pressed)
|
||||
void KeyInput::setShiftPressed(const bool pressed)
|
||||
{
|
||||
mShiftPressed = pressed;
|
||||
}
|
||||
@ -108,7 +108,7 @@ namespace gcn
|
||||
return mControlPressed;
|
||||
}
|
||||
|
||||
void KeyInput::setControlPressed(bool pressed)
|
||||
void KeyInput::setControlPressed(const bool pressed)
|
||||
{
|
||||
mControlPressed = pressed;
|
||||
}
|
||||
@ -118,7 +118,7 @@ namespace gcn
|
||||
return mAltPressed;
|
||||
}
|
||||
|
||||
void KeyInput::setAltPressed(bool pressed)
|
||||
void KeyInput::setAltPressed(const bool pressed)
|
||||
{
|
||||
mAltPressed = pressed;
|
||||
}
|
||||
@ -128,7 +128,7 @@ namespace gcn
|
||||
return mMetaPressed;
|
||||
}
|
||||
|
||||
void KeyInput::setMetaPressed(bool pressed)
|
||||
void KeyInput::setMetaPressed(const bool pressed)
|
||||
{
|
||||
mMetaPressed = pressed;
|
||||
}
|
||||
@ -138,7 +138,7 @@ namespace gcn
|
||||
return mNumericPad;
|
||||
}
|
||||
|
||||
void KeyInput::setNumericPad(bool numpad)
|
||||
void KeyInput::setNumericPad(const bool numpad)
|
||||
{
|
||||
mNumericPad = numpad;
|
||||
}
|
||||
|
||||
18
external/libguisan/src/mouseevent.cpp
vendored
18
external/libguisan/src/mouseevent.cpp
vendored
@ -64,15 +64,15 @@ namespace gcn
|
||||
{
|
||||
MouseEvent::MouseEvent(Widget* source,
|
||||
Widget* distributor,
|
||||
bool isShiftPressed,
|
||||
bool isControlPressed,
|
||||
bool isAltPressed,
|
||||
bool isMetaPressed,
|
||||
unsigned int type,
|
||||
unsigned int button,
|
||||
int x,
|
||||
int y,
|
||||
int clickCount) :
|
||||
const bool isShiftPressed,
|
||||
const bool isControlPressed,
|
||||
const bool isAltPressed,
|
||||
const bool isMetaPressed,
|
||||
const unsigned int type,
|
||||
const unsigned int button,
|
||||
const int x,
|
||||
const int y,
|
||||
const int clickCount) :
|
||||
InputEvent(
|
||||
source, distributor, isShiftPressed, isControlPressed, isAltPressed, isMetaPressed),
|
||||
mType(type),
|
||||
|
||||
20
external/libguisan/src/mouseinput.cpp
vendored
20
external/libguisan/src/mouseinput.cpp
vendored
@ -62,11 +62,11 @@
|
||||
|
||||
namespace gcn
|
||||
{
|
||||
MouseInput::MouseInput(unsigned int button,
|
||||
unsigned int type,
|
||||
int x,
|
||||
int y,
|
||||
int timeStamp)
|
||||
MouseInput::MouseInput(const unsigned int button,
|
||||
const unsigned int type,
|
||||
const int x,
|
||||
const int y,
|
||||
const int timeStamp)
|
||||
: mType(type),
|
||||
mButton(button),
|
||||
mTimeStamp(timeStamp),
|
||||
@ -75,7 +75,7 @@ namespace gcn
|
||||
{
|
||||
}
|
||||
|
||||
void MouseInput::setType(unsigned int type)
|
||||
void MouseInput::setType(const unsigned int type)
|
||||
{
|
||||
mType = type;
|
||||
}
|
||||
@ -85,7 +85,7 @@ namespace gcn
|
||||
return mType;
|
||||
}
|
||||
|
||||
void MouseInput::setButton(unsigned int button)
|
||||
void MouseInput::setButton(const unsigned int button)
|
||||
{
|
||||
mButton = button;
|
||||
}
|
||||
@ -100,12 +100,12 @@ namespace gcn
|
||||
return mTimeStamp;
|
||||
}
|
||||
|
||||
void MouseInput::setTimeStamp(int timeStamp)
|
||||
void MouseInput::setTimeStamp(const int timeStamp)
|
||||
{
|
||||
mTimeStamp = timeStamp;
|
||||
}
|
||||
|
||||
void MouseInput::setX(int x)
|
||||
void MouseInput::setX(const int x)
|
||||
{
|
||||
mX = x;
|
||||
}
|
||||
@ -115,7 +115,7 @@ namespace gcn
|
||||
return mX;
|
||||
}
|
||||
|
||||
void MouseInput::setY(int y)
|
||||
void MouseInput::setY(const int y)
|
||||
{
|
||||
mY = y;
|
||||
}
|
||||
|
||||
6
external/libguisan/src/rectangle.cpp
vendored
6
external/libguisan/src/rectangle.cpp
vendored
@ -70,7 +70,7 @@ namespace gcn
|
||||
height = 0;
|
||||
}
|
||||
|
||||
Rectangle::Rectangle(int x, int y, int width, int height)
|
||||
Rectangle::Rectangle(const int x, const int y, const int width, const int height)
|
||||
{
|
||||
this->x = x;
|
||||
this->y = y;
|
||||
@ -78,7 +78,7 @@ namespace gcn
|
||||
this->height = height;
|
||||
}
|
||||
|
||||
void Rectangle::setAll(int x, int y, int width, int height)
|
||||
void Rectangle::setAll(const int x, const int y, const int width, const int height)
|
||||
{
|
||||
this->x = x;
|
||||
this->y = y;
|
||||
@ -125,7 +125,7 @@ namespace gcn
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Rectangle::isContaining(int x, int y) const
|
||||
bool Rectangle::isContaining(const int x, const int y) const
|
||||
{
|
||||
if (isEmpty()) return false;
|
||||
return ((x >= this->x) && (y >= this->y)
|
||||
|
||||
18
external/libguisan/src/sdl/sdl2graphics.cpp
vendored
18
external/libguisan/src/sdl/sdl2graphics.cpp
vendored
@ -74,11 +74,11 @@
|
||||
|
||||
namespace gcn
|
||||
{
|
||||
SDL2Graphics::SDL2Graphics()
|
||||
SDL2Graphics::SDL2Graphics(): mTarget(nullptr), mRenderTarget(nullptr), mTexture(nullptr), r(0), g(0), b(0), a(0)
|
||||
{
|
||||
mAlpha = false;
|
||||
}
|
||||
|
||||
|
||||
SDL2Graphics::~SDL2Graphics()
|
||||
{
|
||||
if(mRenderTarget != NULL)
|
||||
@ -103,7 +103,7 @@ namespace gcn
|
||||
popClipArea();
|
||||
}
|
||||
|
||||
void SDL2Graphics::setTarget(SDL_Renderer* renderer, int width, int height)
|
||||
void SDL2Graphics::setTarget(SDL_Renderer* renderer, const int width, const int height)
|
||||
{
|
||||
mRenderTarget = renderer;
|
||||
// An internal surface is still required to be able to handle surfaces and colorkeys
|
||||
@ -115,7 +115,7 @@ namespace gcn
|
||||
SDL_SetTextureBlendMode(mTexture, SDL_BLENDMODE_BLEND);
|
||||
}
|
||||
|
||||
bool SDL2Graphics::pushClipArea(Rectangle area)
|
||||
bool SDL2Graphics::pushClipArea(const Rectangle area)
|
||||
{
|
||||
SDL_Rect rect;
|
||||
bool result = Graphics::pushClipArea(area);
|
||||
@ -157,9 +157,9 @@ namespace gcn
|
||||
return mRenderTarget;
|
||||
}
|
||||
|
||||
void SDL2Graphics::drawImage(const Image* image, int srcX,
|
||||
int srcY, int dstX, int dstY,
|
||||
int width, int height)
|
||||
void SDL2Graphics::drawImage(const Image* image, const int srcX,
|
||||
const int srcY, const int dstX, const int dstY,
|
||||
const int width, const int height)
|
||||
{
|
||||
if (mClipStack.empty()) {
|
||||
throw GCN_EXCEPTION("Clip stack is empty, perhaps you"
|
||||
@ -421,7 +421,7 @@ namespace gcn
|
||||
return mColor;
|
||||
}
|
||||
|
||||
void SDL2Graphics::drawSDLSurface(SDL_Surface* surface, SDL_Rect source,
|
||||
void SDL2Graphics::drawSDLSurface(SDL_Surface* surface, const SDL_Rect source,
|
||||
SDL_Rect destination)
|
||||
{
|
||||
if (mClipStack.empty()) {
|
||||
@ -446,7 +446,7 @@ namespace gcn
|
||||
SDL_RenderCopy(mRenderTarget, mTexture, &temp, &destination);
|
||||
}
|
||||
|
||||
void SDL2Graphics::drawSDLTexture(SDL_Texture * texture, SDL_Rect source,
|
||||
void SDL2Graphics::drawSDLTexture(SDL_Texture * texture, const SDL_Rect source,
|
||||
SDL_Rect destination)
|
||||
{
|
||||
if (mClipStack.empty()) {
|
||||
|
||||
10
external/libguisan/src/sdl/sdlgraphics.cpp
vendored
10
external/libguisan/src/sdl/sdlgraphics.cpp
vendored
@ -104,7 +104,7 @@ namespace gcn
|
||||
mTarget = target;
|
||||
}
|
||||
|
||||
bool SDLGraphics::pushClipArea(Rectangle area)
|
||||
bool SDLGraphics::pushClipArea(const Rectangle area)
|
||||
{
|
||||
SDL_Rect rect;
|
||||
const bool result = Graphics::pushClipArea(area);
|
||||
@ -144,9 +144,9 @@ namespace gcn
|
||||
return mTarget;
|
||||
}
|
||||
|
||||
void SDLGraphics::drawImage(const Image* image, int srcX,
|
||||
int srcY, int dstX, int dstY,
|
||||
int width, int height)
|
||||
void SDLGraphics::drawImage(const Image* image, const int srcX,
|
||||
const int srcY, const int dstX, const int dstY,
|
||||
const int width, const int height)
|
||||
{
|
||||
if (mClipStack.empty()) {
|
||||
throw GCN_EXCEPTION("Clip stack is empty, perhaps you"
|
||||
@ -668,7 +668,7 @@ namespace gcn
|
||||
return mColor;
|
||||
}
|
||||
|
||||
void SDLGraphics::drawSDLSurface(SDL_Surface* surface, SDL_Rect source,
|
||||
void SDLGraphics::drawSDLSurface(SDL_Surface* surface, const SDL_Rect source,
|
||||
SDL_Rect destination)
|
||||
{
|
||||
if (mClipStack.empty()) {
|
||||
|
||||
6
external/libguisan/src/sdl/sdlimage.cpp
vendored
6
external/libguisan/src/sdl/sdlimage.cpp
vendored
@ -65,7 +65,7 @@
|
||||
|
||||
namespace gcn
|
||||
{
|
||||
SDLImage::SDLImage(SDL_Surface* surface, bool autoFree, SDL_Renderer* renderer)
|
||||
SDLImage::SDLImage(SDL_Surface* surface, const bool autoFree, SDL_Renderer* renderer)
|
||||
{
|
||||
mAutoFree = autoFree;
|
||||
mSurface = surface;
|
||||
@ -115,7 +115,7 @@ namespace gcn
|
||||
return mSurface->h;
|
||||
}
|
||||
|
||||
Color SDLImage::getPixel(int x, int y)
|
||||
Color SDLImage::getPixel(const int x, const int y)
|
||||
{
|
||||
if (mSurface == NULL)
|
||||
{
|
||||
@ -125,7 +125,7 @@ namespace gcn
|
||||
return SDLgetPixel(mSurface, x, y);
|
||||
}
|
||||
|
||||
void SDLImage::putPixel(int x, int y, const Color& color)
|
||||
void SDLImage::putPixel(const int x, const int y, const Color& color)
|
||||
{
|
||||
if (mSurface == NULL)
|
||||
{
|
||||
|
||||
@ -71,7 +71,7 @@ namespace gcn
|
||||
{}
|
||||
|
||||
Image* SDLImageLoader::load(const std::string& filename,
|
||||
bool convertToDisplayFormat)
|
||||
const bool convertToDisplayFormat)
|
||||
{
|
||||
SDL_Surface *loadedSurface = loadSDLSurface(filename);
|
||||
|
||||
|
||||
6
external/libguisan/src/sdl/sdlinput.cpp
vendored
6
external/libguisan/src/sdl/sdlinput.cpp
vendored
@ -147,7 +147,7 @@ namespace gcn
|
||||
return mouseInput;
|
||||
}
|
||||
|
||||
void SDLInput::pushInput(SDL_Event event)
|
||||
void SDLInput::pushInput(const SDL_Event event)
|
||||
{
|
||||
KeyInput keyInput;
|
||||
MouseInput mouseInput;
|
||||
@ -258,7 +258,7 @@ namespace gcn
|
||||
} // end switch
|
||||
}
|
||||
|
||||
int SDLInput::convertMouseButton(int button)
|
||||
int SDLInput::convertMouseButton(const int button)
|
||||
{
|
||||
switch (button)
|
||||
{
|
||||
@ -277,7 +277,7 @@ namespace gcn
|
||||
}
|
||||
}
|
||||
|
||||
Key SDLInput::convertSDLEventToGuichanKeyValue(SDL_Event event)
|
||||
Key SDLInput::convertSDLEventToGuichanKeyValue(const SDL_Event& event)
|
||||
{
|
||||
int value = -1;
|
||||
|
||||
|
||||
11
external/libguisan/src/sdl/sdltruetypefont.cpp
vendored
11
external/libguisan/src/sdl/sdltruetypefont.cpp
vendored
@ -55,8 +55,9 @@
|
||||
|
||||
namespace gcn
|
||||
{
|
||||
SDLTrueTypeFont::SDLTrueTypeFont(const std::string& filename, int size)
|
||||
SDLTrueTypeFont::SDLTrueTypeFont(const std::string& filename, const int size)
|
||||
{
|
||||
mHeight = 0;
|
||||
mRowSpacing = 0;
|
||||
mGlyphSpacing = 0;
|
||||
mAntiAlias = true;
|
||||
@ -90,7 +91,7 @@ namespace gcn
|
||||
}
|
||||
|
||||
void SDLTrueTypeFont::drawString(Graphics* graphics, const std::string& text, const int x, const int y,
|
||||
bool enabled)
|
||||
const bool enabled)
|
||||
{
|
||||
if (text.empty())
|
||||
{
|
||||
@ -157,7 +158,7 @@ namespace gcn
|
||||
SDL_FreeSurface(textSurface);
|
||||
}
|
||||
|
||||
void SDLTrueTypeFont::setRowSpacing(int spacing)
|
||||
void SDLTrueTypeFont::setRowSpacing(const int spacing)
|
||||
{
|
||||
mRowSpacing = spacing;
|
||||
}
|
||||
@ -167,7 +168,7 @@ namespace gcn
|
||||
return mRowSpacing;
|
||||
}
|
||||
|
||||
void SDLTrueTypeFont::setGlyphSpacing(int spacing)
|
||||
void SDLTrueTypeFont::setGlyphSpacing(const int spacing)
|
||||
{
|
||||
mGlyphSpacing = spacing;
|
||||
}
|
||||
@ -177,7 +178,7 @@ namespace gcn
|
||||
return mGlyphSpacing;
|
||||
}
|
||||
|
||||
void SDLTrueTypeFont::setAntiAlias(bool antiAlias)
|
||||
void SDLTrueTypeFont::setAntiAlias(const bool antiAlias)
|
||||
{
|
||||
mAntiAlias = antiAlias;
|
||||
}
|
||||
|
||||
32
external/libguisan/src/text.cpp
vendored
32
external/libguisan/src/text.cpp
vendored
@ -52,18 +52,18 @@
|
||||
|
||||
namespace gcn
|
||||
{
|
||||
Text::Text() : mCaretPosition(0), mCaretColumn(0), mCaretRow(0)
|
||||
Text::Text() : mCaretPosition(0), mCaretRow(0), mCaretColumn(0)
|
||||
{
|
||||
mRows.emplace_back();
|
||||
}
|
||||
|
||||
Text::Text(const std::string& content) : mCaretPosition(0), mCaretColumn(0), mCaretRow(0)
|
||||
Text::Text(const std::string& content) : mCaretPosition(0), mCaretRow(0), mCaretColumn(0)
|
||||
{
|
||||
std::string::size_type pos, lastPos = 0;
|
||||
int length;
|
||||
do
|
||||
{
|
||||
pos = content.find("\n", lastPos);
|
||||
pos = content.find('\n', lastPos);
|
||||
|
||||
if (pos != std::string::npos)
|
||||
length = pos - lastPos;
|
||||
@ -77,7 +77,7 @@ namespace gcn
|
||||
}
|
||||
|
||||
Text::~Text()
|
||||
{}
|
||||
= default;
|
||||
|
||||
void Text::setContent(const std::string& content)
|
||||
{
|
||||
@ -86,7 +86,7 @@ namespace gcn
|
||||
int length;
|
||||
do
|
||||
{
|
||||
pos = content.find("\n", lastPos);
|
||||
pos = content.find('\n', lastPos);
|
||||
|
||||
if (pos != std::string::npos)
|
||||
length = pos - lastPos;
|
||||
@ -113,7 +113,7 @@ namespace gcn
|
||||
return result;
|
||||
}
|
||||
|
||||
void Text::setRow(unsigned int row, const std::string& content)
|
||||
void Text::setRow(const unsigned int row, const std::string& content)
|
||||
{
|
||||
if (row >= mRows.size()) throw GCN_EXCEPTION("Row out of bounds!");
|
||||
|
||||
@ -131,23 +131,23 @@ namespace gcn
|
||||
mRows.push_back(row);
|
||||
}
|
||||
|
||||
std::string Text::getRow(unsigned int row) const
|
||||
std::string Text::getRow(const unsigned int row) const
|
||||
{
|
||||
if (row >= mRows.size()) throw GCN_EXCEPTION("Row out of bounds!");
|
||||
|
||||
return mRows[row];
|
||||
}
|
||||
|
||||
void Text::insert(int character)
|
||||
void Text::insert(const int character)
|
||||
{
|
||||
char c = (char) character;
|
||||
|
||||
if (mRows.empty())
|
||||
{
|
||||
if (c == '\n')
|
||||
mRows.push_back("");
|
||||
mRows.emplace_back("");
|
||||
else
|
||||
mRows.push_back(std::string(1, c));
|
||||
mRows.emplace_back(1, c);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -229,7 +229,7 @@ namespace gcn
|
||||
return mCaretPosition;
|
||||
}
|
||||
|
||||
void Text::setCaretPosition(int position)
|
||||
void Text::setCaretPosition(const int position)
|
||||
{
|
||||
if (mRows.empty() || position < 0)
|
||||
{
|
||||
@ -264,7 +264,7 @@ namespace gcn
|
||||
mCaretColumn = mRows[mCaretRow].size();
|
||||
}
|
||||
|
||||
void Text::setCaretPosition(int x, int y, Font* font)
|
||||
void Text::setCaretPosition(const int x, const int y, Font* font)
|
||||
{
|
||||
if (mRows.empty()) return;
|
||||
|
||||
@ -282,7 +282,7 @@ namespace gcn
|
||||
return mCaretRow;
|
||||
}
|
||||
|
||||
void Text::setCaretColumn(int column)
|
||||
void Text::setCaretColumn(const int column)
|
||||
{
|
||||
if (mRows.empty() || column < 0)
|
||||
mCaretColumn = 0;
|
||||
@ -294,7 +294,7 @@ namespace gcn
|
||||
calculateCaretPositionFromRowAndColumn();
|
||||
}
|
||||
|
||||
void Text::setCaretRow(int row)
|
||||
void Text::setCaretRow(const int row)
|
||||
{
|
||||
if (mRows.empty() || row < 0)
|
||||
mCaretRow = 0;
|
||||
@ -321,7 +321,7 @@ namespace gcn
|
||||
|
||||
Rectangle Text::getDimension(Font* font) const
|
||||
{
|
||||
if (mRows.empty()) return Rectangle(0, 0, font->getWidth(" "), font->getHeight());
|
||||
if (mRows.empty()) return {0, 0, font->getWidth(" "), font->getHeight()};
|
||||
|
||||
int width = 0;
|
||||
for (unsigned int i = 0; i < mRows.size(); ++i)
|
||||
@ -373,7 +373,7 @@ namespace gcn
|
||||
return mRows.size();
|
||||
}
|
||||
|
||||
unsigned int Text::getNumberOfCharacters(unsigned int row) const
|
||||
unsigned int Text::getNumberOfCharacters(const unsigned int row) const
|
||||
{
|
||||
if (row >= mRows.size()) return 0;
|
||||
|
||||
|
||||
26
external/libguisan/src/widget.cpp
vendored
26
external/libguisan/src/widget.cpp
vendored
@ -149,7 +149,7 @@ namespace gcn
|
||||
return mParent;
|
||||
}
|
||||
|
||||
void Widget::setWidth(int width)
|
||||
void Widget::setWidth(const int width)
|
||||
{
|
||||
Rectangle newDimension = mDimension;
|
||||
newDimension.width = width;
|
||||
@ -162,7 +162,7 @@ namespace gcn
|
||||
return mDimension.width;
|
||||
}
|
||||
|
||||
void Widget::setHeight(int height)
|
||||
void Widget::setHeight(const int height)
|
||||
{
|
||||
Rectangle newDimension = mDimension;
|
||||
newDimension.height = height;
|
||||
@ -175,7 +175,7 @@ namespace gcn
|
||||
return mDimension.height;
|
||||
}
|
||||
|
||||
void Widget::setX(int x)
|
||||
void Widget::setX(const int x)
|
||||
{
|
||||
Rectangle newDimension = mDimension;
|
||||
newDimension.x = x;
|
||||
@ -188,7 +188,7 @@ namespace gcn
|
||||
return mDimension.x;
|
||||
}
|
||||
|
||||
void Widget::setY(int y)
|
||||
void Widget::setY(const int y)
|
||||
{
|
||||
Rectangle newDimension = mDimension;
|
||||
newDimension.y = y;
|
||||
@ -201,7 +201,7 @@ namespace gcn
|
||||
return mDimension.y;
|
||||
}
|
||||
|
||||
void Widget::setPosition(int x, int y)
|
||||
void Widget::setPosition(const int x, const int y)
|
||||
{
|
||||
Rectangle newDimension = mDimension;
|
||||
newDimension.x = x;
|
||||
@ -228,7 +228,7 @@ namespace gcn
|
||||
}
|
||||
}
|
||||
|
||||
void Widget::setFrameSize(unsigned int borderSize)
|
||||
void Widget::setFrameSize(const unsigned int borderSize)
|
||||
{
|
||||
mBorderSize = borderSize;
|
||||
}
|
||||
@ -263,7 +263,7 @@ namespace gcn
|
||||
return (mFocusHandler->isFocused(this));
|
||||
}
|
||||
|
||||
void Widget::setFocusable(bool focusable)
|
||||
void Widget::setFocusable(const bool focusable)
|
||||
{
|
||||
if (!focusable && isFocused())
|
||||
{
|
||||
@ -307,7 +307,7 @@ namespace gcn
|
||||
}
|
||||
}
|
||||
|
||||
void Widget::setVisible(bool visible)
|
||||
void Widget::setVisible(const bool visible)
|
||||
{
|
||||
if (!visible && isFocused())
|
||||
{
|
||||
@ -533,7 +533,7 @@ namespace gcn
|
||||
return mTabIn;
|
||||
}
|
||||
|
||||
void Widget::setTabInEnabled(bool enabled)
|
||||
void Widget::setTabInEnabled(const bool enabled)
|
||||
{
|
||||
mTabIn = enabled;
|
||||
}
|
||||
@ -543,12 +543,12 @@ namespace gcn
|
||||
return mTabOut;
|
||||
}
|
||||
|
||||
void Widget::setTabOutEnabled(bool enabled)
|
||||
void Widget::setTabOutEnabled(const bool enabled)
|
||||
{
|
||||
mTabOut = enabled;
|
||||
}
|
||||
|
||||
void Widget::setSize(int width, int height)
|
||||
void Widget::setSize(const int width, const int height)
|
||||
{
|
||||
Rectangle newDimension = mDimension;
|
||||
newDimension.width = width;
|
||||
@ -557,7 +557,7 @@ namespace gcn
|
||||
setDimension(newDimension);
|
||||
}
|
||||
|
||||
void Widget::setEnabled(bool enabled)
|
||||
void Widget::setEnabled(const bool enabled)
|
||||
{
|
||||
mEnabled = enabled;
|
||||
}
|
||||
@ -736,7 +736,7 @@ namespace gcn
|
||||
}
|
||||
}
|
||||
|
||||
void Widget::showPart(Rectangle rectangle)
|
||||
void Widget::showPart(const Rectangle rectangle)
|
||||
{
|
||||
if (mParent != NULL)
|
||||
{
|
||||
|
||||
4
external/libguisan/src/widgets/button.cpp
vendored
4
external/libguisan/src/widgets/button.cpp
vendored
@ -112,7 +112,7 @@ namespace gcn
|
||||
return mCaption;
|
||||
}
|
||||
|
||||
void Button::setAlignment(Graphics::Alignment alignment)
|
||||
void Button::setAlignment(const Graphics::Alignment alignment)
|
||||
{
|
||||
mAlignment = alignment;
|
||||
}
|
||||
@ -122,7 +122,7 @@ namespace gcn
|
||||
return mAlignment;
|
||||
}
|
||||
|
||||
void Button::setSpacing(unsigned int spacing)
|
||||
void Button::setSpacing(const unsigned int spacing)
|
||||
{
|
||||
mSpacing = spacing;
|
||||
}
|
||||
|
||||
4
external/libguisan/src/widgets/checkbox.cpp
vendored
4
external/libguisan/src/widgets/checkbox.cpp
vendored
@ -76,7 +76,7 @@ namespace gcn
|
||||
addKeyListener(this);
|
||||
}
|
||||
|
||||
CheckBox::CheckBox(const std::string &caption, bool selected)
|
||||
CheckBox::CheckBox(const std::string &caption, const bool selected)
|
||||
{
|
||||
setCaption(caption);
|
||||
setSelected(selected);
|
||||
@ -155,7 +155,7 @@ namespace gcn
|
||||
return mSelected;
|
||||
}
|
||||
|
||||
void CheckBox::setSelected(bool selected)
|
||||
void CheckBox::setSelected(const bool selected)
|
||||
{
|
||||
mSelected = selected;
|
||||
}
|
||||
|
||||
8
external/libguisan/src/widgets/container.cpp
vendored
8
external/libguisan/src/widgets/container.cpp
vendored
@ -71,9 +71,7 @@ namespace gcn
|
||||
}
|
||||
|
||||
Container::~Container()
|
||||
{
|
||||
|
||||
}
|
||||
= default;
|
||||
|
||||
void Container::draw(Graphics* graphics)
|
||||
{
|
||||
@ -86,7 +84,7 @@ namespace gcn
|
||||
drawChildren(graphics);
|
||||
}
|
||||
|
||||
void Container::setOpaque(bool opaque)
|
||||
void Container::setOpaque(const bool opaque)
|
||||
{
|
||||
mOpaque = opaque;
|
||||
}
|
||||
@ -102,7 +100,7 @@ namespace gcn
|
||||
distributeWidgetAddedEvent(widget);
|
||||
}
|
||||
|
||||
void Container::add(Widget* widget, int x, int y)
|
||||
void Container::add(Widget* widget, const int x, const int y)
|
||||
{
|
||||
widget->setPosition(x, y);
|
||||
BasicContainer::add(widget);
|
||||
|
||||
11
external/libguisan/src/widgets/dropdown.cpp
vendored
11
external/libguisan/src/widgets/dropdown.cpp
vendored
@ -276,7 +276,7 @@ namespace gcn
|
||||
return mListBox->getSelected();
|
||||
}
|
||||
|
||||
void DropDown::setSelected(int selected) const
|
||||
void DropDown::setSelected(const int selected) const
|
||||
{
|
||||
if (selected >= 0)
|
||||
{
|
||||
@ -400,7 +400,7 @@ namespace gcn
|
||||
adjustHeight();
|
||||
}
|
||||
|
||||
ListModel *DropDown::getListModel()
|
||||
ListModel *DropDown::getListModel() const
|
||||
{
|
||||
return mListBox->getListModel();
|
||||
}
|
||||
@ -504,11 +504,12 @@ namespace gcn
|
||||
if (mDroppedDown)
|
||||
{
|
||||
// Calculate the children area (with the one pixel border in mind)
|
||||
return Rectangle(
|
||||
1, mFoldedUpHeight + 1, getWidth() - 2, getHeight() - mFoldedUpHeight - 2);
|
||||
return {
|
||||
1, mFoldedUpHeight + 1, getWidth() - 2, getHeight() - mFoldedUpHeight - 2
|
||||
};
|
||||
}
|
||||
|
||||
return Rectangle();
|
||||
return {};
|
||||
}
|
||||
|
||||
void DropDown::setBaseColor(const Color& color)
|
||||
|
||||
4
external/libguisan/src/widgets/icon.cpp
vendored
4
external/libguisan/src/widgets/icon.cpp
vendored
@ -67,14 +67,14 @@
|
||||
namespace gcn
|
||||
{
|
||||
Icon::Icon()
|
||||
: mImage(0)
|
||||
: mImage(nullptr)
|
||||
, mInternalImage(false)
|
||||
{
|
||||
setSize(0, 0);
|
||||
}
|
||||
|
||||
Icon::Icon(const std::string& filename)
|
||||
: mImage(0),
|
||||
: mImage(nullptr),
|
||||
mInternalImage(false)
|
||||
{
|
||||
mImage = Image::load(filename);
|
||||
|
||||
@ -66,7 +66,7 @@
|
||||
namespace gcn
|
||||
{
|
||||
ImageButton::ImageButton()
|
||||
: mImage(0),
|
||||
: mImage(nullptr),
|
||||
mInternalImage(false)
|
||||
{
|
||||
setWidth(0);
|
||||
@ -74,7 +74,7 @@ namespace gcn
|
||||
}
|
||||
|
||||
ImageButton::ImageButton(const std::string& filename)
|
||||
: mImage(0),
|
||||
: mImage(nullptr),
|
||||
mInternalImage(false)
|
||||
{
|
||||
mImage = Image::load(filename);
|
||||
|
||||
@ -67,20 +67,20 @@
|
||||
|
||||
namespace gcn
|
||||
{
|
||||
ImageTextButton::ImageTextButton(const std::string& filename, std::string& caption) : ImageButton(filename)
|
||||
ImageTextButton::ImageTextButton(const std::string& filename, const std::string& caption) : ImageButton(filename)
|
||||
{
|
||||
setCaption(caption);
|
||||
setWidth(mImage->getWidth() + mImage->getWidth() / 2);
|
||||
setHeight(mImage->getHeight() + mImage->getHeight() / 2);
|
||||
mAlignment = ImageTextButton::BOTTOM;
|
||||
mAlignment = BOTTOM;
|
||||
}
|
||||
|
||||
ImageTextButton::ImageTextButton(Image* image, std::string& caption) : ImageButton(image)
|
||||
ImageTextButton::ImageTextButton(const Image* image, const std::string& caption) : ImageButton(image)
|
||||
{
|
||||
setCaption(caption);
|
||||
setWidth(mImage->getWidth() + mImage->getWidth() / 2);
|
||||
setHeight(mImage->getHeight() + mImage->getHeight() / 2);
|
||||
mAlignment = ImageTextButton::BOTTOM;
|
||||
mAlignment = BOTTOM;
|
||||
}
|
||||
|
||||
ImageTextButton::~ImageTextButton()
|
||||
@ -123,7 +123,7 @@ namespace gcn
|
||||
mInternalImage = false;
|
||||
}
|
||||
|
||||
Image* ImageTextButton::getImage()
|
||||
Image* ImageTextButton::getImage() const
|
||||
{
|
||||
return mImage;
|
||||
}
|
||||
@ -220,7 +220,7 @@ namespace gcn
|
||||
}
|
||||
}
|
||||
|
||||
void ImageTextButton::setAlignment(unsigned int alignment)
|
||||
void ImageTextButton::setAlignment(const unsigned int alignment)
|
||||
{
|
||||
mAlignment = alignment;
|
||||
}
|
||||
|
||||
2
external/libguisan/src/widgets/label.cpp
vendored
2
external/libguisan/src/widgets/label.cpp
vendored
@ -90,7 +90,7 @@ namespace gcn
|
||||
mCaption = caption;
|
||||
}
|
||||
|
||||
void Label::setAlignment(Graphics::Alignment alignment)
|
||||
void Label::setAlignment(const Graphics::Alignment alignment)
|
||||
{
|
||||
mAlignment = alignment;
|
||||
}
|
||||
|
||||
6
external/libguisan/src/widgets/listbox.cpp
vendored
6
external/libguisan/src/widgets/listbox.cpp
vendored
@ -176,7 +176,7 @@ namespace gcn
|
||||
return mSelected;
|
||||
}
|
||||
|
||||
void ListBox::setSelected(int selected)
|
||||
void ListBox::setSelected(const int selected)
|
||||
{
|
||||
if (mListModel == NULL)
|
||||
{
|
||||
@ -311,7 +311,7 @@ namespace gcn
|
||||
adjustSize();
|
||||
}
|
||||
|
||||
ListModel* ListBox::getListModel()
|
||||
ListModel* ListBox::getListModel() const
|
||||
{
|
||||
return mListModel;
|
||||
}
|
||||
@ -340,7 +340,7 @@ namespace gcn
|
||||
return mWrappingEnabled;
|
||||
}
|
||||
|
||||
void ListBox::setWrappingEnabled(bool wrappingEnabled)
|
||||
void ListBox::setWrappingEnabled(const bool wrappingEnabled)
|
||||
{
|
||||
mWrappingEnabled = wrappingEnabled;
|
||||
}
|
||||
|
||||
16
external/libguisan/src/widgets/messagebox.cpp
vendored
16
external/libguisan/src/widgets/messagebox.cpp
vendored
@ -106,7 +106,7 @@ namespace gcn
|
||||
}
|
||||
|
||||
MessageBox::MessageBox(const std::string& caption, const std::string& message,
|
||||
const std::string *buttons, int size)
|
||||
const std::string *buttons, const int size)
|
||||
:Window(caption),mMessage(message),mClickedButton(-1)
|
||||
{
|
||||
setCaption(caption);
|
||||
@ -179,7 +179,7 @@ namespace gcn
|
||||
delete mButtons;
|
||||
}
|
||||
|
||||
void MessageBox::setPadding(unsigned int padding)
|
||||
void MessageBox::setPadding(const unsigned int padding)
|
||||
{
|
||||
mPadding = padding;
|
||||
}
|
||||
@ -189,12 +189,12 @@ namespace gcn
|
||||
return mPadding;
|
||||
}
|
||||
|
||||
void MessageBox::setTitleBarHeight(unsigned int height)
|
||||
void MessageBox::setTitleBarHeight(const unsigned int height)
|
||||
{
|
||||
mTitleBarHeight = height;
|
||||
}
|
||||
|
||||
unsigned int MessageBox::getTitleBarHeight()
|
||||
unsigned int MessageBox::getTitleBarHeight() const
|
||||
{
|
||||
return mTitleBarHeight;
|
||||
}
|
||||
@ -209,7 +209,7 @@ namespace gcn
|
||||
return mCaption;
|
||||
}
|
||||
|
||||
void MessageBox::setButtonAlignment(Graphics::Alignment alignment)
|
||||
void MessageBox::setButtonAlignment(const Graphics::Alignment alignment)
|
||||
{
|
||||
mButtonAlignment = alignment;
|
||||
|
||||
@ -406,12 +406,12 @@ namespace gcn
|
||||
return mMovable;
|
||||
}
|
||||
|
||||
void MessageBox::setOpaque(bool opaque)
|
||||
void MessageBox::setOpaque(const bool opaque)
|
||||
{
|
||||
mOpaque = opaque;
|
||||
}
|
||||
|
||||
bool MessageBox::isOpaque()
|
||||
bool MessageBox::isOpaque() const
|
||||
{
|
||||
return mOpaque;
|
||||
}
|
||||
@ -421,7 +421,7 @@ namespace gcn
|
||||
WidgetListIterator it;
|
||||
|
||||
int w = 0, h = 0;
|
||||
for (it = mWidgets.begin(); it != mWidgets.end(); it++)
|
||||
for (it = mWidgets.begin(); it != mWidgets.end(); ++it)
|
||||
{
|
||||
if ((*it)->getX() + (*it)->getWidth() > w)
|
||||
{
|
||||
|
||||
@ -125,7 +125,7 @@ namespace gcn
|
||||
mCaption = caption;
|
||||
}
|
||||
|
||||
void ProgressBar::setAlignment(Graphics::Alignment alignment)
|
||||
void ProgressBar::setAlignment(const Graphics::Alignment alignment)
|
||||
{
|
||||
mAlignment = alignment;
|
||||
}
|
||||
|
||||
@ -80,7 +80,7 @@ namespace gcn
|
||||
|
||||
RadioButton::RadioButton(const std::string& caption,
|
||||
const std::string& group,
|
||||
bool selected)
|
||||
const bool selected)
|
||||
{
|
||||
setCaption(caption);
|
||||
setGroup(group);
|
||||
@ -199,7 +199,7 @@ namespace gcn
|
||||
return mSelected;
|
||||
}
|
||||
|
||||
void RadioButton::setSelected(bool selected)
|
||||
void RadioButton::setSelected(const bool selected)
|
||||
{
|
||||
if (selected && !mGroup.empty())
|
||||
{
|
||||
@ -207,7 +207,7 @@ namespace gcn
|
||||
|
||||
for (GroupIterator iter = mGroupMap.lower_bound(mGroup);
|
||||
iter != iterEnd;
|
||||
iter++)
|
||||
++iter)
|
||||
{
|
||||
if (iter->second->isSelected())
|
||||
{
|
||||
@ -264,7 +264,7 @@ namespace gcn
|
||||
|
||||
for (GroupIterator iter = mGroupMap.lower_bound(mGroup);
|
||||
iter != iterEnd;
|
||||
iter++)
|
||||
++iter)
|
||||
{
|
||||
if (iter->second == this)
|
||||
{
|
||||
|
||||
66
external/libguisan/src/widgets/scrollarea.cpp
vendored
66
external/libguisan/src/widgets/scrollarea.cpp
vendored
@ -110,7 +110,7 @@ namespace gcn
|
||||
addMouseListener(this);
|
||||
}
|
||||
|
||||
ScrollArea::ScrollArea(Widget *content, ScrollPolicy hPolicy, ScrollPolicy vPolicy)
|
||||
ScrollArea::ScrollArea(Widget *content, const ScrollPolicy hPolicy, const ScrollPolicy vPolicy)
|
||||
{
|
||||
mVScroll = 0;
|
||||
mHScroll = 0;
|
||||
@ -154,7 +154,7 @@ namespace gcn
|
||||
checkPolicies();
|
||||
}
|
||||
|
||||
Widget* ScrollArea::getContent()
|
||||
Widget* ScrollArea::getContent() const
|
||||
{
|
||||
if (!mWidgets.empty())
|
||||
{
|
||||
@ -164,7 +164,7 @@ namespace gcn
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void ScrollArea::setHorizontalScrollPolicy(ScrollPolicy hPolicy)
|
||||
void ScrollArea::setHorizontalScrollPolicy(const ScrollPolicy hPolicy)
|
||||
{
|
||||
mHPolicy = hPolicy;
|
||||
checkPolicies();
|
||||
@ -175,7 +175,7 @@ namespace gcn
|
||||
return mHPolicy;
|
||||
}
|
||||
|
||||
void ScrollArea::setVerticalScrollPolicy(ScrollPolicy vPolicy)
|
||||
void ScrollArea::setVerticalScrollPolicy(const ScrollPolicy vPolicy)
|
||||
{
|
||||
mVPolicy = vPolicy;
|
||||
checkPolicies();
|
||||
@ -186,14 +186,14 @@ namespace gcn
|
||||
return mVPolicy;
|
||||
}
|
||||
|
||||
void ScrollArea::setScrollPolicy(ScrollPolicy hPolicy, ScrollPolicy vPolicy)
|
||||
void ScrollArea::setScrollPolicy(const ScrollPolicy hPolicy, const ScrollPolicy vPolicy)
|
||||
{
|
||||
mHPolicy = hPolicy;
|
||||
mVPolicy = vPolicy;
|
||||
checkPolicies();
|
||||
}
|
||||
|
||||
void ScrollArea::setVerticalScrollAmount(int vScroll)
|
||||
void ScrollArea::setVerticalScrollAmount(const int vScroll)
|
||||
{
|
||||
const int max = getVerticalMaxScroll();
|
||||
|
||||
@ -215,7 +215,7 @@ namespace gcn
|
||||
return mVScroll;
|
||||
}
|
||||
|
||||
void ScrollArea::setHorizontalScrollAmount(int hScroll)
|
||||
void ScrollArea::setHorizontalScrollAmount(const int hScroll)
|
||||
{
|
||||
const int max = getHorizontalMaxScroll();
|
||||
|
||||
@ -236,7 +236,7 @@ namespace gcn
|
||||
return mHScroll;
|
||||
}
|
||||
|
||||
void ScrollArea::setScrollAmount(int hScroll, int vScroll)
|
||||
void ScrollArea::setScrollAmount(const int hScroll, const int vScroll)
|
||||
{
|
||||
setHorizontalScrollAmount(hScroll);
|
||||
setVerticalScrollAmount(vScroll);
|
||||
@ -284,7 +284,7 @@ namespace gcn
|
||||
return value;
|
||||
}
|
||||
|
||||
void ScrollArea::setScrollbarWidth(int width)
|
||||
void ScrollArea::setScrollbarWidth(const int width)
|
||||
{
|
||||
if (width > 0)
|
||||
{
|
||||
@ -912,11 +912,11 @@ namespace gcn
|
||||
}
|
||||
}
|
||||
|
||||
Rectangle ScrollArea::getUpButtonDimension()
|
||||
Rectangle ScrollArea::getUpButtonDimension() const
|
||||
{
|
||||
if (!mVBarVisible)
|
||||
{
|
||||
return Rectangle(0, 0, 0, 0);
|
||||
return {0, 0, 0, 0};
|
||||
}
|
||||
|
||||
return Rectangle(getWidth() - mScrollbarWidth,
|
||||
@ -925,11 +925,11 @@ namespace gcn
|
||||
mScrollbarWidth);
|
||||
}
|
||||
|
||||
Rectangle ScrollArea::getDownButtonDimension()
|
||||
Rectangle ScrollArea::getDownButtonDimension() const
|
||||
{
|
||||
if (!mVBarVisible)
|
||||
{
|
||||
return Rectangle(0, 0, 0, 0);
|
||||
return {0, 0, 0, 0};
|
||||
}
|
||||
|
||||
if (mVBarVisible && mHBarVisible)
|
||||
@ -946,11 +946,11 @@ namespace gcn
|
||||
mScrollbarWidth);
|
||||
}
|
||||
|
||||
Rectangle ScrollArea::getLeftButtonDimension()
|
||||
Rectangle ScrollArea::getLeftButtonDimension() const
|
||||
{
|
||||
if (!mHBarVisible)
|
||||
{
|
||||
return Rectangle(0, 0, 0, 0);
|
||||
return {0, 0, 0, 0};
|
||||
}
|
||||
|
||||
return Rectangle(0,
|
||||
@ -959,11 +959,11 @@ namespace gcn
|
||||
mScrollbarWidth);
|
||||
}
|
||||
|
||||
Rectangle ScrollArea::getRightButtonDimension()
|
||||
Rectangle ScrollArea::getRightButtonDimension() const
|
||||
{
|
||||
if (!mHBarVisible)
|
||||
{
|
||||
return Rectangle(0, 0, 0, 0);
|
||||
return {0, 0, 0, 0};
|
||||
}
|
||||
|
||||
if (mVBarVisible && mHBarVisible)
|
||||
@ -988,16 +988,16 @@ namespace gcn
|
||||
getHeight() - (mHBarVisible ? mScrollbarWidth : 0));
|
||||
if (area.isEmpty())
|
||||
{
|
||||
return Rectangle();
|
||||
return {};
|
||||
}
|
||||
return area;
|
||||
}
|
||||
|
||||
Rectangle ScrollArea::getVerticalBarDimension()
|
||||
Rectangle ScrollArea::getVerticalBarDimension() const
|
||||
{
|
||||
if (!mVBarVisible)
|
||||
{
|
||||
return Rectangle(0, 0, 0, 0);
|
||||
return {0, 0, 0, 0};
|
||||
}
|
||||
|
||||
if (mHBarVisible)
|
||||
@ -1019,11 +1019,11 @@ namespace gcn
|
||||
- getDownButtonDimension().height);
|
||||
}
|
||||
|
||||
Rectangle ScrollArea::getHorizontalBarDimension()
|
||||
Rectangle ScrollArea::getHorizontalBarDimension() const
|
||||
{
|
||||
if (!mHBarVisible)
|
||||
{
|
||||
return Rectangle(0, 0, 0, 0);
|
||||
return {0, 0, 0, 0};
|
||||
}
|
||||
|
||||
if (mVBarVisible)
|
||||
@ -1049,7 +1049,7 @@ namespace gcn
|
||||
{
|
||||
if (!mVBarVisible)
|
||||
{
|
||||
return Rectangle(0, 0, 0, 0);
|
||||
return {0, 0, 0, 0};
|
||||
}
|
||||
|
||||
int length, pos;
|
||||
@ -1092,7 +1092,7 @@ namespace gcn
|
||||
{
|
||||
if (!mHBarVisible)
|
||||
{
|
||||
return Rectangle(0, 0, 0, 0);
|
||||
return {0, 0, 0, 0};
|
||||
}
|
||||
|
||||
int length, pos;
|
||||
@ -1131,7 +1131,7 @@ namespace gcn
|
||||
return Rectangle(barDim.x + pos, barDim.y, length, mScrollbarWidth);
|
||||
}
|
||||
|
||||
void ScrollArea::showWidgetPart(Widget* widget, Rectangle area)
|
||||
void ScrollArea::showWidgetPart(Widget* widget, const Rectangle area)
|
||||
{
|
||||
if (widget != getContent())
|
||||
{
|
||||
@ -1144,7 +1144,7 @@ namespace gcn
|
||||
setVerticalScrollAmount(getContent()->getFrameSize() - getContent()->getY());
|
||||
}
|
||||
|
||||
Widget *ScrollArea::getWidgetAt(int x, int y)
|
||||
Widget *ScrollArea::getWidgetAt(const int x, const int y)
|
||||
{
|
||||
if (getChildrenArea().isContaining(x, y))
|
||||
{
|
||||
@ -1178,13 +1178,13 @@ namespace gcn
|
||||
mouseEvent.consume();
|
||||
}
|
||||
|
||||
void ScrollArea::setWidth(int width)
|
||||
void ScrollArea::setWidth(const int width)
|
||||
{
|
||||
Widget::setWidth(width);
|
||||
checkPolicies();
|
||||
}
|
||||
|
||||
void ScrollArea::setHeight(int height)
|
||||
void ScrollArea::setHeight(const int height)
|
||||
{
|
||||
Widget::setHeight(height);
|
||||
checkPolicies();
|
||||
@ -1196,22 +1196,22 @@ namespace gcn
|
||||
checkPolicies();
|
||||
}
|
||||
|
||||
void ScrollArea::setLeftButtonScrollAmount(int amount)
|
||||
void ScrollArea::setLeftButtonScrollAmount(const int amount)
|
||||
{
|
||||
mLeftButtonScrollAmount = amount;
|
||||
}
|
||||
|
||||
void ScrollArea::setRightButtonScrollAmount(int amount)
|
||||
void ScrollArea::setRightButtonScrollAmount(const int amount)
|
||||
{
|
||||
mRightButtonScrollAmount = amount;
|
||||
}
|
||||
|
||||
void ScrollArea::setUpButtonScrollAmount(int amount)
|
||||
void ScrollArea::setUpButtonScrollAmount(const int amount)
|
||||
{
|
||||
mUpButtonScrollAmount = amount;
|
||||
}
|
||||
|
||||
void ScrollArea::setDownButtonScrollAmount(int amount)
|
||||
void ScrollArea::setDownButtonScrollAmount(const int amount)
|
||||
{
|
||||
mDownButtonScrollAmount = amount;
|
||||
}
|
||||
@ -1236,7 +1236,7 @@ namespace gcn
|
||||
return mDownButtonScrollAmount;
|
||||
}
|
||||
|
||||
void ScrollArea::setOpaque(bool opaque)
|
||||
void ScrollArea::setOpaque(const bool opaque)
|
||||
{
|
||||
mOpaque = opaque;
|
||||
}
|
||||
|
||||
22
external/libguisan/src/widgets/slider.cpp
vendored
22
external/libguisan/src/widgets/slider.cpp
vendored
@ -66,7 +66,7 @@
|
||||
|
||||
namespace gcn
|
||||
{
|
||||
Slider::Slider(double scaleEnd)
|
||||
Slider::Slider(const double scaleEnd)
|
||||
{
|
||||
mDragged = false;
|
||||
|
||||
@ -84,7 +84,7 @@ namespace gcn
|
||||
addKeyListener(this);
|
||||
}
|
||||
|
||||
Slider::Slider(double scaleStart, double scaleEnd)
|
||||
Slider::Slider(const double scaleStart, const double scaleEnd)
|
||||
{
|
||||
mDragged = false;
|
||||
|
||||
@ -102,7 +102,7 @@ namespace gcn
|
||||
addKeyListener(this);
|
||||
}
|
||||
|
||||
void Slider::setScale(double scaleStart, double scaleEnd)
|
||||
void Slider::setScale(const double scaleStart, const double scaleEnd)
|
||||
{
|
||||
mScaleStart = scaleStart;
|
||||
mScaleEnd = scaleEnd;
|
||||
@ -113,7 +113,7 @@ namespace gcn
|
||||
return mScaleStart;
|
||||
}
|
||||
|
||||
void Slider::setScaleStart(double scaleStart)
|
||||
void Slider::setScaleStart(const double scaleStart)
|
||||
{
|
||||
mScaleStart = scaleStart;
|
||||
}
|
||||
@ -123,7 +123,7 @@ namespace gcn
|
||||
return mScaleEnd;
|
||||
}
|
||||
|
||||
void Slider::setScaleEnd(double scaleEnd)
|
||||
void Slider::setScaleEnd(const double scaleEnd)
|
||||
{
|
||||
mScaleEnd = scaleEnd;
|
||||
}
|
||||
@ -237,7 +237,7 @@ namespace gcn
|
||||
mouseEvent.consume();
|
||||
}
|
||||
|
||||
void Slider::setValue(double value)
|
||||
void Slider::setValue(const double value)
|
||||
{
|
||||
if (value > getScaleEnd())
|
||||
{
|
||||
@ -264,7 +264,7 @@ namespace gcn
|
||||
return mMarkerLength;
|
||||
}
|
||||
|
||||
void Slider::setMarkerLength(int length)
|
||||
void Slider::setMarkerLength(const int length)
|
||||
{
|
||||
mMarkerLength = length;
|
||||
}
|
||||
@ -305,7 +305,7 @@ namespace gcn
|
||||
}
|
||||
}
|
||||
|
||||
void Slider::setOrientation(Orientation orientation)
|
||||
void Slider::setOrientation(const Orientation orientation)
|
||||
{
|
||||
mOrientation = orientation;
|
||||
}
|
||||
@ -315,7 +315,7 @@ namespace gcn
|
||||
return mOrientation;
|
||||
}
|
||||
|
||||
double Slider::markerPositionToValue(int v) const
|
||||
double Slider::markerPositionToValue(const int v) const
|
||||
{
|
||||
int w;
|
||||
if (getOrientation() == Horizontal)
|
||||
@ -331,7 +331,7 @@ namespace gcn
|
||||
return (1.0 - pos) * getScaleStart() + pos * getScaleEnd();
|
||||
}
|
||||
|
||||
int Slider::valueToMarkerPosition(double value) const
|
||||
int Slider::valueToMarkerPosition(const double value) const
|
||||
{
|
||||
int v;
|
||||
if (getOrientation() == Horizontal)
|
||||
@ -360,7 +360,7 @@ namespace gcn
|
||||
return w;
|
||||
}
|
||||
|
||||
void Slider::setStepLength(double length)
|
||||
void Slider::setStepLength(const double length)
|
||||
{
|
||||
mStepLength = length;
|
||||
}
|
||||
|
||||
26
external/libguisan/src/widgets/tabbedarea.cpp
vendored
26
external/libguisan/src/widgets/tabbedarea.cpp
vendored
@ -116,7 +116,7 @@ namespace gcn
|
||||
tab->addActionListener(this);
|
||||
|
||||
mTabContainer->add(tab);
|
||||
mTabs.push_back(std::pair<Tab*, Widget*>(tab, widget));
|
||||
mTabs.emplace_back(tab, widget);
|
||||
|
||||
if (mSelectedTab == NULL)
|
||||
{
|
||||
@ -127,7 +127,7 @@ namespace gcn
|
||||
adjustSize();
|
||||
}
|
||||
|
||||
void TabbedArea::removeTabWithIndex(unsigned int index)
|
||||
void TabbedArea::removeTabWithIndex(const unsigned int index)
|
||||
{
|
||||
if (index >= mTabs.size())
|
||||
{
|
||||
@ -162,7 +162,7 @@ namespace gcn
|
||||
}
|
||||
|
||||
std::vector<std::pair<Tab*, Widget*> >::iterator iter;
|
||||
for (iter = mTabs.begin(); iter != mTabs.end(); iter++)
|
||||
for (iter = mTabs.begin(); iter != mTabs.end(); ++iter)
|
||||
{
|
||||
if (iter->first == tab)
|
||||
{
|
||||
@ -173,7 +173,7 @@ namespace gcn
|
||||
}
|
||||
|
||||
std::vector<Tab*>::iterator iter2;
|
||||
for (iter2 = mTabsToDelete.begin(); iter2 != mTabsToDelete.end(); iter2++)
|
||||
for (iter2 = mTabsToDelete.begin(); iter2 != mTabsToDelete.end(); ++iter2)
|
||||
{
|
||||
if (*iter2 == tab)
|
||||
{
|
||||
@ -197,7 +197,7 @@ namespace gcn
|
||||
adjustTabPositions();
|
||||
}
|
||||
|
||||
bool TabbedArea::isTabSelected(unsigned int index) const
|
||||
bool TabbedArea::isTabSelected(const unsigned int index) const
|
||||
{
|
||||
if (index >= mTabs.size())
|
||||
{
|
||||
@ -212,7 +212,7 @@ namespace gcn
|
||||
return mSelectedTab == tab;
|
||||
}
|
||||
|
||||
void TabbedArea::setSelectedTab(unsigned int index)
|
||||
void TabbedArea::setSelectedTab(const unsigned int index)
|
||||
{
|
||||
if (index >= mTabs.size())
|
||||
{
|
||||
@ -256,12 +256,12 @@ namespace gcn
|
||||
return -1;
|
||||
}
|
||||
|
||||
Tab* TabbedArea::getSelectedTab()
|
||||
Tab* TabbedArea::getSelectedTab() const
|
||||
{
|
||||
return mSelectedTab;
|
||||
}
|
||||
|
||||
void TabbedArea::setOpaque(bool opaque)
|
||||
void TabbedArea::setOpaque(const bool opaque)
|
||||
{
|
||||
mOpaque = opaque;
|
||||
}
|
||||
@ -315,7 +315,7 @@ namespace gcn
|
||||
drawChildren(graphics);
|
||||
}
|
||||
|
||||
void TabbedArea::adjustSize()
|
||||
void TabbedArea::adjustSize() const
|
||||
{
|
||||
int maxTabHeight = 0;
|
||||
for (unsigned int i = 0; i < mTabs.size(); i++)
|
||||
@ -332,7 +332,7 @@ namespace gcn
|
||||
mWidgetContainer->setSize(getWidth() - 2, getHeight() - maxTabHeight - 2);
|
||||
}
|
||||
|
||||
void TabbedArea::adjustTabPositions()
|
||||
void TabbedArea::adjustTabPositions() const
|
||||
{
|
||||
int maxTabHeight = 0;
|
||||
unsigned int i;
|
||||
@ -355,7 +355,7 @@ namespace gcn
|
||||
}
|
||||
}
|
||||
|
||||
void TabbedArea::setWidth(int width)
|
||||
void TabbedArea::setWidth(const int width)
|
||||
{
|
||||
// This may seem odd, but we want the TabbedArea to adjust
|
||||
// its size properly before we call Widget::setWidth as
|
||||
@ -367,7 +367,7 @@ namespace gcn
|
||||
Widget::setWidth(width);
|
||||
}
|
||||
|
||||
void TabbedArea::setHeight(int height)
|
||||
void TabbedArea::setHeight(const int height)
|
||||
{
|
||||
// This may seem odd, but we want the TabbedArea to adjust
|
||||
// its size properly before we call Widget::setHeight as
|
||||
@ -379,7 +379,7 @@ namespace gcn
|
||||
Widget::setHeight(height);
|
||||
}
|
||||
|
||||
void TabbedArea::setSize(int width, int height)
|
||||
void TabbedArea::setSize(const int width, const int height)
|
||||
{
|
||||
// This may seem odd, but we want the TabbedArea to adjust
|
||||
// its size properly before we call Widget::setSize as
|
||||
|
||||
20
external/libguisan/src/widgets/textbox.cpp
vendored
20
external/libguisan/src/widgets/textbox.cpp
vendored
@ -123,7 +123,7 @@ namespace gcn
|
||||
}
|
||||
}
|
||||
|
||||
void TextBox::drawCaret(Graphics* graphics, int x, int y)
|
||||
void TextBox::drawCaret(Graphics* graphics, const int x, const int y)
|
||||
{
|
||||
graphics->setColor(getForegroundColor());
|
||||
graphics->drawLine(x, y, x, y + getFont()->getHeight());
|
||||
@ -247,7 +247,7 @@ namespace gcn
|
||||
setSize(dim.width, dim.height);
|
||||
}
|
||||
|
||||
void TextBox::setCaretPosition(unsigned int position)
|
||||
void TextBox::setCaretPosition(const unsigned int position) const
|
||||
{
|
||||
mText->setCaretPosition(position);
|
||||
}
|
||||
@ -257,13 +257,13 @@ namespace gcn
|
||||
return mText->getCaretPosition();
|
||||
}
|
||||
|
||||
void TextBox::setCaretRowColumn(int row, int column)
|
||||
void TextBox::setCaretRowColumn(const int row, const int column) const
|
||||
{
|
||||
mText->setCaretRow(row);
|
||||
mText->setCaretColumn(column);
|
||||
}
|
||||
|
||||
void TextBox::setCaretRow(int row)
|
||||
void TextBox::setCaretRow(const int row) const
|
||||
{
|
||||
mText->setCaretRow(row);
|
||||
}
|
||||
@ -273,7 +273,7 @@ namespace gcn
|
||||
return mText->getCaretRow();
|
||||
}
|
||||
|
||||
void TextBox::setCaretColumn(int column)
|
||||
void TextBox::setCaretColumn(const int column) const
|
||||
{
|
||||
mText->setCaretColumn(column);
|
||||
}
|
||||
@ -283,12 +283,12 @@ namespace gcn
|
||||
return mText->getCaretColumn();
|
||||
}
|
||||
|
||||
std::string TextBox::getTextRow(int row) const
|
||||
std::string TextBox::getTextRow(const int row) const
|
||||
{
|
||||
return mText->getRow(row);
|
||||
}
|
||||
|
||||
void TextBox::setTextRow(int row, const std::string& text)
|
||||
void TextBox::setTextRow(const int row, const std::string& text)
|
||||
{
|
||||
mText->setRow(row, text);
|
||||
|
||||
@ -315,7 +315,7 @@ namespace gcn
|
||||
showPart(mText->getCaretDimension(getFont()));
|
||||
}
|
||||
|
||||
void TextBox::setEditable(bool editable)
|
||||
void TextBox::setEditable(const bool editable)
|
||||
{
|
||||
mEditable = editable;
|
||||
}
|
||||
@ -331,12 +331,12 @@ namespace gcn
|
||||
adjustSize();
|
||||
}
|
||||
|
||||
bool TextBox::isOpaque()
|
||||
bool TextBox::isOpaque() const
|
||||
{
|
||||
return mOpaque;
|
||||
}
|
||||
|
||||
void TextBox::setOpaque(bool opaque)
|
||||
void TextBox::setOpaque(const bool opaque)
|
||||
{
|
||||
mOpaque = opaque;
|
||||
}
|
||||
|
||||
6
external/libguisan/src/widgets/textfield.cpp
vendored
6
external/libguisan/src/widgets/textfield.cpp
vendored
@ -92,7 +92,7 @@ namespace gcn
|
||||
addKeyListener(this);
|
||||
}
|
||||
|
||||
void TextField::setText(const std::string& text)
|
||||
void TextField::setText(const std::string& text) const
|
||||
{
|
||||
mText->setRow(0, text);
|
||||
}
|
||||
@ -148,7 +148,7 @@ namespace gcn
|
||||
graphics->popClipArea();
|
||||
}
|
||||
|
||||
void TextField::drawCaret(Graphics* graphics, int x)
|
||||
void TextField::drawCaret(Graphics* graphics, const int x)
|
||||
{
|
||||
// Check the current clip area as a clip area with a different
|
||||
// size than the widget might have been pushed (which is the
|
||||
@ -270,7 +270,7 @@ namespace gcn
|
||||
}
|
||||
}
|
||||
|
||||
void TextField::setCaretPosition(unsigned int position)
|
||||
void TextField::setCaretPosition(const unsigned int position) const
|
||||
{
|
||||
mText->setCaretPosition(position);
|
||||
}
|
||||
|
||||
@ -161,7 +161,7 @@ namespace gcn
|
||||
return mSelected;
|
||||
}
|
||||
|
||||
void ToggleButton::setSelected(bool selected)
|
||||
void ToggleButton::setSelected(const bool selected)
|
||||
{
|
||||
mSelected = selected;
|
||||
}
|
||||
|
||||
14
external/libguisan/src/widgets/window.cpp
vendored
14
external/libguisan/src/widgets/window.cpp
vendored
@ -95,7 +95,7 @@ namespace gcn
|
||||
Window::~Window()
|
||||
= default;
|
||||
|
||||
void Window::setPadding(unsigned int padding)
|
||||
void Window::setPadding(const unsigned int padding)
|
||||
{
|
||||
mPadding = padding;
|
||||
}
|
||||
@ -105,12 +105,12 @@ namespace gcn
|
||||
return mPadding;
|
||||
}
|
||||
|
||||
void Window::setTitleBarHeight(unsigned int height)
|
||||
void Window::setTitleBarHeight(const unsigned int height)
|
||||
{
|
||||
mTitleBarHeight = height;
|
||||
}
|
||||
|
||||
unsigned int Window::getTitleBarHeight()
|
||||
unsigned int Window::getTitleBarHeight() const
|
||||
{
|
||||
return mTitleBarHeight;
|
||||
}
|
||||
@ -125,7 +125,7 @@ namespace gcn
|
||||
return mCaption;
|
||||
}
|
||||
|
||||
void Window::setAlignment(Graphics::Alignment alignment)
|
||||
void Window::setAlignment(const Graphics::Alignment alignment)
|
||||
{
|
||||
mAlignment = alignment;
|
||||
}
|
||||
@ -300,7 +300,7 @@ namespace gcn
|
||||
static_cast<int>(getHeight() - getPadding() - getTitleBarHeight()));
|
||||
}
|
||||
|
||||
void Window::setMovable(bool movable)
|
||||
void Window::setMovable(const bool movable)
|
||||
{
|
||||
mMovable = movable;
|
||||
}
|
||||
@ -310,12 +310,12 @@ namespace gcn
|
||||
return mMovable;
|
||||
}
|
||||
|
||||
void Window::setOpaque(bool opaque)
|
||||
void Window::setOpaque(const bool opaque)
|
||||
{
|
||||
mOpaque = opaque;
|
||||
}
|
||||
|
||||
bool Window::isOpaque()
|
||||
bool Window::isOpaque() const
|
||||
{
|
||||
return mOpaque;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user