summaryrefslogtreecommitdiff
path: root/attic/muse2-oom/muse2/muse/widgets/checkbox.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'attic/muse2-oom/muse2/muse/widgets/checkbox.cpp')
-rw-r--r--attic/muse2-oom/muse2/muse/widgets/checkbox.cpp59
1 files changed, 59 insertions, 0 deletions
diff --git a/attic/muse2-oom/muse2/muse/widgets/checkbox.cpp b/attic/muse2-oom/muse2/muse/widgets/checkbox.cpp
new file mode 100644
index 00000000..8f706361
--- /dev/null
+++ b/attic/muse2-oom/muse2/muse/widgets/checkbox.cpp
@@ -0,0 +1,59 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// $Id: checkbox.cpp,v 1.2.2.2 2006/10/29 07:54:52 terminator356 Exp $
+// (C) Copyright 2004 Werner Schweer (ws@seh.de)
+//=========================================================
+
+#include "checkbox.h"
+
+#include <QMouseEvent>
+
+//---------------------------------------------------------
+// CheckBox
+//---------------------------------------------------------
+
+CheckBox::CheckBox(QWidget* parent, int i, const char* name)
+ : QCheckBox(parent)
+ {
+ setObjectName(name);
+ _id = i;
+ connect(this, SIGNAL(toggled(bool)), SLOT(hasToggled(bool)));
+ }
+
+void CheckBox::hasToggled(bool val)
+ {
+ emit toggleChanged(val, _id);
+ }
+
+//------------------------------------------------------------
+// mousePressEvent
+//------------------------------------------------------------
+
+void CheckBox::mousePressEvent(QMouseEvent *e)
+{
+ if(e->button() == Qt::RightButton)
+ emit checkboxRightClicked(e->globalPos(), _id);
+ else
+ {
+ if(isChecked())
+ setChecked(false);
+ else
+ setChecked(true);
+ emit checkboxPressed(_id);
+ }
+}
+
+//------------------------------------------------------------
+// mouseReleaseEvent
+//------------------------------------------------------------
+
+void CheckBox::mouseReleaseEvent(QMouseEvent *e)
+{
+ if(e->button() == Qt::RightButton)
+ return;
+
+ emit checkboxReleased(_id);
+}
+
+