2014-07-10 09:03:55 +00:00
|
|
|
#ifndef CSV_WIDGET_PUSHBUTTON_H
|
|
|
|
#define CSV_WIDGET_PUSHBUTTON_H
|
|
|
|
|
|
|
|
#include <QPushButton>
|
|
|
|
|
|
|
|
namespace CSVWidget
|
|
|
|
{
|
|
|
|
class PushButton : public QPushButton
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
2014-07-10 11:04:30 +00:00
|
|
|
public:
|
|
|
|
|
|
|
|
enum Type
|
|
|
|
{
|
|
|
|
Type_TopMode, // top level button for mode selector panel
|
2014-09-06 14:11:06 +00:00
|
|
|
Type_TopAction, // top level button that triggers an action
|
2014-07-31 11:05:08 +00:00
|
|
|
Type_Mode, // mode button
|
|
|
|
Type_Toggle
|
2014-07-10 11:04:30 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
2014-07-10 09:03:55 +00:00
|
|
|
bool mKeepOpen;
|
2014-07-10 11:04:30 +00:00
|
|
|
Type mType;
|
2014-07-13 12:21:50 +00:00
|
|
|
QString mToolTip;
|
2014-07-10 10:53:57 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
|
2014-08-01 07:50:49 +00:00
|
|
|
void setExtendedToolTip();
|
2014-07-10 09:03:55 +00:00
|
|
|
|
|
|
|
protected:
|
|
|
|
|
|
|
|
virtual void keyPressEvent (QKeyEvent *event);
|
|
|
|
|
2014-07-10 09:32:20 +00:00
|
|
|
virtual void keyReleaseEvent (QKeyEvent *event);
|
|
|
|
|
2014-07-10 09:03:55 +00:00
|
|
|
virtual void mouseReleaseEvent (QMouseEvent *event);
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
2014-07-10 09:44:01 +00:00
|
|
|
/// \param push Do not maintain a toggle state
|
2014-07-13 12:21:50 +00:00
|
|
|
PushButton (const QIcon& icon, Type type, const QString& tooltip = "",
|
2014-07-10 10:53:57 +00:00
|
|
|
QWidget *parent = 0);
|
2014-07-10 09:44:01 +00:00
|
|
|
|
|
|
|
/// \param push Do not maintain a toggle state
|
2014-07-13 12:21:50 +00:00
|
|
|
PushButton (Type type, const QString& tooltip = "",
|
2014-07-10 10:53:57 +00:00
|
|
|
QWidget *parent = 0);
|
2014-07-10 09:03:55 +00:00
|
|
|
|
|
|
|
bool hasKeepOpen() const;
|
2014-07-13 12:21:50 +00:00
|
|
|
|
|
|
|
/// Return tooltip used at construction (without any button-specific modifications)
|
|
|
|
QString getBaseToolTip() const;
|
2014-09-07 11:35:30 +00:00
|
|
|
|
|
|
|
Type getType() const;
|
2014-07-10 09:03:55 +00:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|