////////////////////////////////////////////////////////////////////////////////
// GLButton.h
// Copyright Bjoern Ganster
// Developed since 2007
////////////////////////////////////////////////////////////////////////////////

#ifndef GLButton__H
#define GLButton__H

#include "GLWindow.h"
#include "BGCPString.h"

////////////////////////////////////////////////////////////////////////////////
// Base class for a button

class GLButton: public GLWindow {
public:
   // Constructor
   GLButton (GLWindow* _parent = NULL, int _left = 0, int _top = 0, int _width = 0, int _height = 0);

   // Destructor
   ~GLButton() OVERRIDE;

   // Title access
   const BGCPString& getTitle () const;
   void setTitle (const BGCPString& newTitle);
   void setTitle (int textNum);

   // Render
   void render(int x, int y, int w, int h) OVERRIDE;

   // Events
   void keypressed (BGKey key, bool shiftHeld, bool ctrlHeld, bool down, bool repeat) OVERRIDE;

   // Button state changed over a window: returns child that was clicked
   GLWindow* buttonStateChanged (int /*button*/, bool down, int /*x*/, int /*y*/) OVERRIDE;

   void mouseMoved (int /*x*/, int /*y*/) OVERRIDE;

   // Event: widget looses focus
   void loseFocus () OVERRIDE;

protected:
   BGCPString mTitle;
   Color mTextColor;
};

#endif
