[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: branches/KDE/3.5/kdeutils/superkaramba/src
From: Ryan Nickell <p0z3r () earthlink ! net>
Date: 2006-04-28 23:12:20
Message-ID: 1146265940.913248.17361.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 535243 by nickell:
Add functions to set/clear input focus on the input box.
M +10 -0 input.cpp
M +3 -0 input.h
M +49 -0 input_python.cpp
M +41 -0 input_python.h
M +6 -0 karamba_python.cpp
M +5 -0 sklineedit.cpp
M +2 -0 sklineedit.h
--- branches/KDE/3.5/kdeutils/superkaramba/src/input.cpp #535242:535243
@@ -183,4 +183,14 @@
}
}
+void Input::setInputFocus()
+{
+ edit->setFocus();
+}
+
+void Input::clearInputFocus()
+{
+ edit->clearFocus();
+}
+
#include "input.moc"
--- branches/KDE/3.5/kdeutils/superkaramba/src/input.h #535242:535243
@@ -72,6 +72,9 @@
QString getFont() const;
void setFontSize(int size);
int getFontSize() const;
+
+ void setInputFocus();
+ void clearInputFocus();
private:
SKLineEdit *edit;
--- branches/KDE/3.5/kdeutils/superkaramba/src/input_python.cpp #535242:535243
@@ -304,3 +304,52 @@
return Py_BuildValue((char*)"l", ((Input*)inputBox)->getFontSize());
}
+
+PyObject* py_setInputFocus(PyObject *, PyObject *args)
+{
+ long widget, inputBox;
+ if (!PyArg_ParseTuple(args, (char*)"ll:setInputFocus", &widget, &inputBox))
+ return NULL;
+
+ if (!checkKarambaAndMeter(widget, inputBox, "Input"))
+ return NULL;
+
+ //((karamba*)widget)->setActiveWindow();
+
+ ((Input*)inputBox)->setInputFocus();
+ return Py_BuildValue((char*)"l", 1);
+}
+
+PyObject* py_clearInputFocus(PyObject *, PyObject *args)
+{
+ long widget, inputBox;
+ if (!PyArg_ParseTuple(args, (char*)"ll:clearInputFocus", &widget, &inputBox))
+ return NULL;
+
+ if (!checkKarambaAndMeter(widget, inputBox, "Input"))
+ return NULL;
+
+ ((Input*)inputBox)->clearInputFocus();
+ return Py_BuildValue((char*)"l", 1);
+}
+
+PyObject* py_getInputFocus(PyObject *, PyObject *args)
+{
+ long widget;
+ if (!PyArg_ParseTuple(args, (char*)"l:getInputFocus", &widget))
+ return NULL;
+
+ if (!checkKaramba(widget))
+ return NULL;
+
+ //
+ // FocusWidget() returns the currently focused line edit,
+ // but unfortunately we need an 'Input' object here.
+ //
+ QWidget *obj = ((karamba*)widget)->focusWidget();
+
+ if(obj->isA("QLineEdit")) // SKLineEdit is no Q_Object, but QLineEdit can only be here as a SKLineEdit
+ return Py_BuildValue((char*)"l", ((SKLineEdit*)obj)->getInput());
+
+ return Py_BuildValue((char*)"l", 0);
+}
--- branches/KDE/3.5/kdeutils/superkaramba/src/input_python.h #535242:535243
@@ -431,4 +431,45 @@
*/
PyObject* py_getInputBoxFontSize(PyObject *, PyObject *args);
+/** InputBox/setInputFocus
+ *
+ * SYNOPSIS
+ * long setInputFocus(widget, inputBox)
+ * DESCRIPTION
+ * Sets the Input Focus to the Input Box
+ * ARGUMENTS
+ * * long widget -- karamba
+ * * long inputBox -- pointer to Input Box
+ * RETURN VALUE
+ * 1 if successful
+ */
+PyObject* py_setInputFocus(PyObject *, PyObject *args);
+
+/** InputBox/clearInputFocus
+ *
+ * SYNOPSIS
+ * long clearInputFocus(widget, inputBox)
+ * DESCRIPTION
+ * releases the Input Focus from the Input Box
+ * ARGUMENTS
+ * * long widget -- karamba
+ * * long inputBox -- pointer to Input Box
+ * RETURN VALUE
+ * 1 if successful
+ */
+PyObject* py_clearInputFocus(PyObject *, PyObject *args);
+
+/** InputBox/getInputFocus
+ *
+ * SYNOPSIS
+ * long getInputFocus(widget)
+ * DESCRIPTION
+ * Get the Input Box currently focused
+ * ARGUMENTS
+ * * long widget -- karamba
+ * RETURN VALUE
+ * the input box or 0
+ */
+PyObject* py_getInputFocus(PyObject *, PyObject *args);
+
#endif
--- branches/KDE/3.5/kdeutils/superkaramba/src/karamba_python.cpp #535242:535243
@@ -291,6 +291,12 @@
(char*)"Change a Input Box Font Size"},
{(char*)"getInputBoxFontSize", py_getInputBoxFontSize, METH_VARARGS,
(char*)"Get a Input Box Font Size"},
+ {(char*)"setInputFocus", py_setInputFocus, METH_VARARGS,
+ (char*)"Set the Input Focus to the Input Box"},
+ {(char*)"clearInputFocus", py_clearInputFocus, METH_VARARGS,
+ (char*)"Clear the Input Focus of the Input Box"},
+ {(char*)"getInputFocus", py_getInputFocus, METH_VARARGS,
+ (char*)"Get the Input Box currently focused"},
{(char*)"setWidgetOnTop", py_set_widget_on_top, METH_VARARGS,
(char*)"changes 'on top' status"},
--- branches/KDE/3.5/kdeutils/superkaramba/src/sklineedit.cpp #535242:535243
@@ -75,3 +75,8 @@
{
QLineEdit::keyReleaseEvent(e);
}
+
+Input* SKLineEdit::getInput()
+{
+ return m_input;
+}
--- branches/KDE/3.5/kdeutils/superkaramba/src/sklineedit.h #535242:535243
@@ -42,6 +42,8 @@
QColor getFrameColor() const;
void setBackgroundColor(QColor c);
+
+ Input* getInput();
protected:
virtual void keyReleaseEvent(QKeyEvent* e);
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic