Is using sf::Shape for drawing the boxes a good idea?
If the functionality it brings is enough for you, then yes. For example you can't have textured shapes (yet), but if you don't need it, no problem. Color gradients are possible.
- And should I derive from sf::Drawable or make a void draw(sf::RenderWindow* window)
function?
Write a Draw() function. This offers more flexibility and you don't inherit all properties of sf::Drawable (like the blend mode). You should never use inheritance if it doesn't come with relevant advantages.
- How could I stretch and shrink buttons if I'd use images. I know I could make one image part for the middle (which I can stretch) and one for the sides. Are there any other methods to do this?
You can repeat textures instead of stretching them. You can calculate and pre-render them (using sf::RenderTexture).
- For event checking, what would be a better approach:
void checkEvent(const sf::Event& event) //which checks all the possibilites
Orvoid onHover()
void onClick()
Which are to be called manually?
You should primarily care about the API, the implementation will be adapted to it. From my point of view as a user, callbacks are the most flexible way of binding GUI events (click, hover, etc.) to actions. There are classic Java ways, where you need to inherit from certain classes and override virtual functions. The C++ approach would use function objects (maybe combined with Boost.Function, Boost.Bind, Boost.Signals). You can read the Boost documentations to get an impression of the ideas.
And you learn really much when writing a GUI framework. It is quite complex, and you have to meet difficult design decisions when you want the API to be as user-friendly as possible. However if you only write it to have a GUI framework, you had better use
one of the existing GUIs for SFML. SFGUI looks very promising. I began to write a GUI a long time ago, too -- it really takes a lot of time, don't underestimate it. I haven't developped it further since last year, because it would have required a huge amount of time to make it really flexible, which I preferred to invest in the development of Thor.