Initial commit
This commit is contained in:
commit
cc0faeee08
61 changed files with 1410 additions and 0 deletions
52
Button.h
Normal file
52
Button.h
Normal file
|
@ -0,0 +1,52 @@
|
|||
#ifndef __BUTTON_H__
|
||||
#define __BUTTON_H__
|
||||
|
||||
#include <QWidget>
|
||||
#include "PixWidget.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
class Button : public PixWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
Button (QWidget *parent, uint btn1, uint btn2);
|
||||
~Button ();
|
||||
void setFunc (void (*func)(void *userdata), void *userdata) { m_func = func; m_userdata = userdata; }
|
||||
|
||||
protected:
|
||||
void mousePressEvent (QMouseEvent *event);
|
||||
void mouseReleaseEvent (QMouseEvent *event);
|
||||
|
||||
QPixmap m_pixmap_normal;
|
||||
QPixmap m_pixmap_pressed;
|
||||
void (*m_func)(void *userdata);
|
||||
void *m_userdata;
|
||||
};
|
||||
|
||||
class ToggleButton : public Button
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
ToggleButton (QWidget *parent, uint, uint, uint, uint);
|
||||
~ToggleButton ();
|
||||
|
||||
void toggleOn (bool);
|
||||
void setFunc (void (*func)(void *userdata), void *userdata) { m_func2 = func; m_userdata2 = userdata; }
|
||||
|
||||
bool getOn () const { return m_toggled_on; }
|
||||
void runFunc ();
|
||||
|
||||
private:
|
||||
void (*m_func2)(void *userdata);
|
||||
void *m_userdata2;
|
||||
|
||||
QPixmap m_pixmap_on_normal;
|
||||
QPixmap m_pixmap_on_pressed;
|
||||
QPixmap m_pixmap_off_normal;
|
||||
QPixmap m_pixmap_off_pressed;
|
||||
|
||||
bool m_toggled_on;
|
||||
};
|
||||
|
||||
#endif
|
Loading…
Add table
Add a link
Reference in a new issue