File indexing completed on 2022-09-27 12:25:39

0001 /*
0002     This file is part of Kiten, a KDE Japanese Reference Tool
0003     SPDX-FileCopyrightText: 2006 Joseph Kerian <jkerian@gmail.com>
0004 
0005     SPDX-License-Identifier: LGPL-2.0-or-later
0006 */
0007 
0008 #ifndef RADICALBUTTON_H
0009 #define RADICALBUTTON_H
0010 
0011 #include <QPushButton>
0012 #include <QString>
0013 
0014 class QMouseEvent;
0015 
0016 class RadicalButton : public QPushButton
0017 {
0018   Q_OBJECT
0019 
0020   public:
0021              RadicalButton( const QString &text, QWidget *parent );
0022     ~RadicalButton() override;
0023     /**
0024      * Overriding QPushButton's event for mousewheel events on a disabled button
0025      */
0026     bool     event( QEvent *event ) override;
0027     QSize    minimumSizeHint() const override;
0028     QSize    sizeHint() const override;
0029 
0030     typedef enum
0031     {
0032       Normal,         /**< Normal button */
0033       Selected,       /**< This button has been selected (checked) */
0034       NotAppropriate, /**< Due to other selected buttons: disabled */
0035       Related,        /**< Display only this radical and related ones: italics? */
0036       Hidden          /**< Not related (to above), so hide() */
0037     } ButtonStatus;
0038 
0039   Q_SIGNALS:
0040     void userClicked( const QString &text, RadicalButton::ButtonStatus status );
0041 
0042   public Q_SLOTS:
0043     void mousePressEvent( QMouseEvent *e ) override;
0044     void mouseReleaseEvent( QMouseEvent *e ) override;
0045     void resetButton();
0046     void setStatus( RadicalButton::ButtonStatus newStatus );
0047 
0048   private:
0049     ButtonStatus m_status;
0050 };
0051 
0052 #endif