I've been thinking about how to design it, and this is what I came up with so far. Note that since this is not a small change, it would be added to 0.9-dev, not in the 0.8 branch.
I will only support cursors that are available on all platforms for now, but I will add the Linux implementation of the resize arrows in my own code so that resize cursors are also supported on all platforms.
There would be a Cursor class where you can change the look of each cursor type:
Each widget would have a setMouseCursor function where you tell it to change the mouse cursor on hover. The downside of this approach is that it has to be called on each widget separately, but it does provide full control over which widgets should change the cursor. It also allows e.g. setting a NotAllowed cursor on a disabled button, so you are not limited to only a hand icon for buttons.
For child windows (the part that you are interested in), there would be a function to enable/disable the resize cursors. I think I'll enable the option by default, because you probably always want this for resizable windows.
I will only support cursors that are available on all platforms for now, but I will add the Linux implementation of the resize arrows in my own code so that resize cursors are also supported on all platforms.
There would be a Cursor class where you can change the look of each cursor type:
Code (cpp) Select
class Cursor
{
public:
enum class Type
{
Arrow, //!< Arrow cursor (default)
Text, //!< I-beam, cursor when hovering over a text field
Hand, //!< Pointing hand cursor
SizeLeft, //!< Left arrow on Linux, horizontal double arrow cursor on Windows and macOS
SizeRight, //!< Right arrow on Linux, horizontal double arrow cursor on Windows and macOS
SizeTop, //!< Up arrow on Linux, vertical double arrow cursor on Windows and macOS
SizeBottom, //!< Down arrow on Linux, vertical double arrow cursor on Windows and macOS
SizeTopLeft //!< Top-left arrow on Linux, double arrow cursor going from top-left to bottom-right on Windows and macOS
SizeBottomRight, //!< Bottom-right arrow on Linux, double arrow cursor going from top-left to bottom-right on Windows and
SizeBottomLeft, //!< Bottom-left arrow on Linux, double arrow cursor going from bottom-left to top-right on Windows and macOS
SizeTopRight, //!< Top-right arrow on Linux, double arrow cursor going from bottom-left to top-right on Windows and macOS
Cross, //!< Crosshair cursor
Help, //!< Help cursor
NotAllowed //!< Action not allowed cursor
}
// Changes cursor until restoreOverrideCursor() is called, calls to setOverrideCursor stack (design taken from Qt)
void setOverrideCursor(Type);
// Undo last setOverrideCursor call
void restoreOverrideCursor();
// Changes how the mouse cursor of a specific type should look like. By default the system cursors are used,
// but you can use this function if you want to change them to bitmaps.
void setCursorLook(Type, sf::Cursor);
// Function called by TGUI to change the cursor. If you call this yourself then the cursor will change, but it will
// revert back when you move the mouse (since TGUI changes it)
void setCursor(Type);
}Each widget would have a setMouseCursor function where you tell it to change the mouse cursor on hover. The downside of this approach is that it has to be called on each widget separately, but it does provide full control over which widgets should change the cursor. It also allows e.g. setting a NotAllowed cursor on a disabled button, so you are not limited to only a hand icon for buttons.
Code (cpp) Select
editBox->setMouseCursor(tgui::Cursor::Text);For child windows (the part that you are interested in), there would be a function to enable/disable the resize cursors. I think I'll enable the option by default, because you probably always want this for resizable windows.
Code (cpp) Select
childWindow->enableResizeMouseCursors(true);