#ifndef __IMAGE_BUTTON_H__
#define __IMAGE_BUTTON_H__

#include <gtkmm/drawingarea.h>
#include "StateImage.h"

class ImageButton : public Gtk::DrawingArea {
public:
    explicit ImageButton();
    virtual ~ImageButton();

    void setStateImage(const StateImage& stImage);
    void setCornerRadius(uint32_t radius);

    sigc::signal<void> signalClicked();

private:
    bool onImageButtonRealDraw(const ::Cairo::RefPtr<::Cairo::Context>& cr);
    bool onEventReceived(GdkEvent* event);
    bool checkPointInside(int x, int y);

private:
    StateImage m_stImage;
    StateImage::State m_currentSt;
    sigc::signal<void> m_clickedSignal;

    sigc::connection m_drawIter;
    sigc::connection m_eventIter;

    uint32_t m_cornerRadius;
    uint32_t m_realCornerRd;
    int m_realWidth;
    int m_realHeight;
};

#endif  // __CF_IMAGE_BUTTON_H__