<commit_before>#ifndef BUTTON_H
#define BUTTON_H

#include <Tempest/Widget>
#include <Tempest/Shortcut>
#include <Tempest/Sprite>
#include <Tempest/Font>
#include <Tempest/Icon>

#include <ctime>

namespace Tempest {

class Button : public Tempest::Widget {
  public:
    Button();

    enum Type{
      T_PushButton,
      T_ToolButton,
      T_FlatButton
      };

    Tempest::signal<> onClicked;

    void  setIcon(const Tempest::Sprite& s);
    void  setIcon(const Tempest::Icon&   s);
    const Tempest::Icon& icon() const;

    void  setEnabled(bool e);
    bool  isEnabled() const;

    const Tempest::Shortcut& shortcut() const;
    void  setShortcut( const Tempest::Shortcut & sc );

    const std::u16string& text() const;
    void  setText(const std::u16string &t );
    void  setText( const std::string& t   );

    const std::u16string &hint() const;
    void  setHint( const std::u16string & str );
    void  setHint( const std::string & str    );

    const Tempest::Font& font() const;
    void  setFont( const Tempest::Font& f );

    void setFontColor(const Tempest::Color& color);
    const Tempest::Color& fontColor() const;

    void setButtonType(Type t);
    Type buttonType() const;

  protected:
    virtual void drawFrame(Tempest::Painter &p, const Tempest::Rect& r );
    virtual void drawFrame(Tempest::Painter &p);

    virtual void drawBack(Tempest::Painter &p, const Tempest::Rect& r );
    virtual void drawBack(Tempest::Painter &p);

    virtual Tempest::Rect viewRect() const;

    void mouseDownEvent(Tempest::MouseEvent &e);
    void mouseMoveEvent(Tempest::MouseEvent &e);
    void mouseUpEvent(Tempest::MouseEvent &e);
    void mouseDragEvent(Tempest::MouseEvent &e);

    void mouseEnterEvent(Tempest::MouseEvent& e);
    void mouseLeaveEvent(Tempest::MouseEvent& e);

    void paintEvent( Tempest::PaintEvent &p);

    void gestureEvent(Tempest::AbstractGestureEvent &e);

    void keyUpEvent(Tempest::KeyEvent &e);

    void focusChange(bool);

    void onShortcut();
    virtual void emitClick();

    bool isPressed() const;
    void finishPaint();

  private:
    clock_t timePressed;
    bool pressed, presAnim;
    std::u16string txt, hnt;

    Tempest::Shortcut hotKey;
    Tempest::Font  fnt;
    Tempest::Color fntColor;
    Tempest::Icon  icn;
    bool           enabled=true;

    Type           type       =T_PushButton;
    bool           isMouseOver=false;
  };
}

#endif // BUTTON_H<commit_msg>replace clock_t to uint64_t<commit_after>#ifndef BUTTON_H
#define BUTTON_H

#include <Tempest/Widget>
#include <Tempest/Shortcut>
#include <Tempest/Sprite>
#include <Tempest/Font>
#include <Tempest/Icon>

#include <ctime>

namespace Tempest {

class Button : public Tempest::Widget {
  public:
    Button();

    enum Type{
      T_PushButton,
      T_ToolButton,
      T_FlatButton
      };

    Tempest::signal<> onClicked;

    void  setIcon(const Tempest::Sprite& s);
    void  setIcon(const Tempest::Icon&   s);
    const Tempest::Icon& icon() const;

    void  setEnabled(bool e);
    bool  isEnabled() const;

    const Tempest::Shortcut& shortcut() const;
    void  setShortcut( const Tempest::Shortcut & sc );

    const std::u16string& text() const;
    void  setText(const std::u16string &t );
    void  setText( const std::string& t   );

    const std::u16string &hint() const;
    void  setHint( const std::u16string & str );
    void  setHint( const std::string & str    );

    const Tempest::Font& font() const;
    void  setFont( const Tempest::Font& f );

    void setFontColor(const Tempest::Color& color);
    const Tempest::Color& fontColor() const;

    void setButtonType(Type t);
    Type buttonType() const;

  protected:
    virtual void drawFrame(Tempest::Painter &p, const Tempest::Rect& r );
    virtual void drawFrame(Tempest::Painter &p);

    virtual void drawBack(Tempest::Painter &p, const Tempest::Rect& r );
    virtual void drawBack(Tempest::Painter &p);

    virtual Tempest::Rect viewRect() const;

    void mouseDownEvent(Tempest::MouseEvent &e);
    void mouseMoveEvent(Tempest::MouseEvent &e);
    void mouseUpEvent(Tempest::MouseEvent &e);
    void mouseDragEvent(Tempest::MouseEvent &e);

    void mouseEnterEvent(Tempest::MouseEvent& e);
    void mouseLeaveEvent(Tempest::MouseEvent& e);

    void paintEvent( Tempest::PaintEvent &p);

    void gestureEvent(Tempest::AbstractGestureEvent &e);

    void keyUpEvent(Tempest::KeyEvent &e);

    void focusChange(bool);

    void onShortcut();
    virtual void emitClick();

    bool isPressed() const;
    void finishPaint();

  private:
    uint64_t timePressed;
    bool pressed, presAnim;
    std::u16string txt, hnt;

    Tempest::Shortcut hotKey;
    Tempest::Font  fnt;
    Tempest::Color fntColor;
    Tempest::Icon  icn;
    bool           enabled=true;

    Type           type       =T_PushButton;
    bool           isMouseOver=false;
  };
}

#endif // BUTTON_H
{'fraction_non_alphanumeric': 0.11719226856561546, 'fraction_numerical': 0.0048830111902339775, 'mean_word_length': 3.493601462522852, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2946386', 'n_tokens_mistral': 1630, 'n_tokens_neox': 1557, 'n_words': 404}