[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: branches/KDE/3.5/kdeutils/superkaramba/src
From: Alexander Wiedenbruch <wirr01 () gmail ! com>
Date: 2007-04-19 16:04:44
Message-ID: 1176998684.311213.7265.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 655860 by wirr:
FEATURE: Allow themes to receive mouse wheel events on meters
Approved by k-c-d
M +30 -0 karamba.cpp
M +3 -0 karamba.h
M +2 -0 karamba_python.cpp
M +1 -1 main.cpp
M +17 -1 misc_python.cpp
M +20 -2 misc_python.h
--- branches/KDE/3.5/kdeutils/superkaramba/src/karamba.cpp #655859:655860
@@ -64,6 +64,7 @@
{
themeStarted = false;
want_right_button = false;
+ want_meter_wheel_event = false;
prettyName = name;
m_sub_theme = sub_theme;
@@ -1374,6 +1375,35 @@
else
button = 5;
+ // We create a temporary click list here because original
+ // can change during the loop (infinite loop Bug 994359)
+ if (want_meter_wheel_event)
+ {
+ QObjectList clickListTmp(*clickList);
+ QObjectListIt it(clickListTmp);
+
+ QMouseEvent fakeEvent(QEvent::MouseButtonPress, e->pos(), e->globalPos(), button, e->state());
+
+ while (it != 0)
+ {
+ Meter* meter = (Meter*)(*it);
+ // Check if meter is still in list
+ if (clickList->containsRef(meter) && meter->click(&fakeEvent))
+ {
+ if (RichTextLabel* richText = dynamic_cast<RichTextLabel*>(meter))
+ {
+ pythonIface->meterClicked(this, richText->anchorAt(fakeEvent.x(), fakeEvent.y()),
+ button);
+ }
+ else
+ {
+ pythonIface->meterClicked(this, meter, button);
+ }
+ }
+ ++it;
+ }
+ }
+
pythonIface->widgetClicked(this, e->x(), e->y(), button);
}
}
--- branches/KDE/3.5/kdeutils/superkaramba/src/karamba.h #655859:655860
@@ -199,6 +199,7 @@
bool repaintInProgress;
//bool reloading;
bool want_right_button;
+ bool want_meter_wheel_event;
NETWinInfo* info;
bool onTop;
@@ -290,6 +291,8 @@
*/
void setWantRightButton(bool yesno) { want_right_button = yesno; }
+ void setWantMeterWheelEvent(bool yesno) { want_meter_wheel_event = yesno; }
+
/**
* can be used to fire up the karamba management popup menu
*/
--- branches/KDE/3.5/kdeutils/superkaramba/src/karamba_python.cpp #655859:655860
@@ -326,6 +326,8 @@
(char*)"Get last updated time"},
{(char*)"setWantRightButton", py_want_right_button, METH_VARARGS,
(char*)"Set to 1 to deactivate management popups"},
+ {(char*)"setWantMeterWheelEvent", py_want_wheel_event, METH_VARARGS,
+ (char*)"Enables wheel events over meters."},
{(char*)"managementPopup", py_management_popup, METH_VARARGS,
(char*)"Activates the Management Popup menu"},
--- branches/KDE/3.5/kdeutils/superkaramba/src/main.cpp #655859:655860
@@ -42,7 +42,7 @@
static const char *description =
I18N_NOOP("A KDE Eye-candy Application");
-static const char *version = "0.41";
+static const char *version = "0.42";
static KCmdLineOptions options[] =
{
--- branches/KDE/3.5/kdeutils/superkaramba/src/misc_python.cpp #655859:655860
@@ -807,7 +807,7 @@
PyObject* py_want_right_button(PyObject *, PyObject *args)
{
long widget, i;
- if (!PyArg_ParseTuple(args, (char*)"ll:wantRightButton", &widget, &i))
+ if (!PyArg_ParseTuple(args, (char*)"ll:setWantRightButton", &widget, &i))
return NULL;
if (!checkKaramba(widget))
return NULL;
@@ -815,7 +815,23 @@
return Py_BuildValue((char*)"l", 1);
}
+static void set_want_wheel_event(long widget, long yesno)
+{
+ karamba* currTheme = (karamba*)widget;
+ currTheme->setWantMeterWheelEvent(yesno);
+}
+PyObject* py_want_wheel_event(PyObject *, PyObject *args)
+{
+ long widget, i;
+ if (!PyArg_ParseTuple(args, (char*)"ll:setWantMeterWheelEvent", &widget, &i))
+ return NULL;
+ if (!checkKaramba(widget))
+ return NULL;
+ set_want_wheel_event(widget, i);
+ return Py_BuildValue((char*)"l", 1);
+}
+
static void changeInterval(long widget, long interval)
{
karamba* currTheme = (karamba*)widget;
--- branches/KDE/3.5/kdeutils/superkaramba/src/misc_python.h #655859:655860
@@ -534,10 +534,10 @@
*/
PyObject* py_get_update_time(PyObject *self, PyObject *args);
-/** Misc/wantRightButton
+/** Misc/setWantRightButton
*
* SYNOPSIS
-* long wantRightButton(widget, want_receive_right_button)
+* long setWantRightButton(widget, want_receive_right_button)
* DESCRIPTION
* There's a management menu for SuperKaramba themes which
* allows themes to be loaded, closed, moved to other
@@ -552,6 +552,24 @@
*/
PyObject* py_want_right_button(PyObject *self, PyObject *args);
+/** Misc/setWantMeterWheelEvent
+*
+* SYNOPSIS
+* long setWantMeterWheelEvent(widget, want_receive_wheel_event)
+* DESCRIPTION
+* Enabling this allows themes to receive a wheel event when
+* the wheel is turned over a meter.
+* This function is available after version 0.42.
+* This behaviour is default in SuperKaramba 0.50 and later,
+* so this function will be not available after the 0.50 version.
+* ARGUMENTS
+* * long widget -- karamba
+* * long want_receive_wheel_event -- whether the theme will receive mouse wheel events
+* RETURN VALUE
+* 1 if successful
+*/
+PyObject* py_want_wheel_event(PyObject *, PyObject *args);
+
/** Misc/managementPopup
*
* SYNOPSIS
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic