From 12f90800104b06e819eb9a7c2cd6ffcaf2003e0a Mon Sep 17 00:00:00 2001 From: Andreas Monzner Date: Tue, 19 Dec 2006 15:41:53 +0000 Subject: [PATCH] remove unneeded test object, export windowstyle enums to python --- lib/gui/ewindowstyle.h | 39 +++++++++++++++++++++++--------------- lib/python/enigma_python.i | 5 ----- lib/python/python.cpp | 12 ------------ lib/python/python.h | 23 ---------------------- 4 files changed, 24 insertions(+), 55 deletions(-) diff --git a/lib/gui/ewindowstyle.h b/lib/gui/ewindowstyle.h index 91f2f0b7..a2a9e67b 100644 --- a/lib/gui/ewindowstyle.h +++ b/lib/gui/ewindowstyle.h @@ -7,22 +7,13 @@ class gFont; #include -SWIG_IGNORE(eWindowStyle); -class eWindowStyle: public iObject +class eWindowStyle_ENUMS { #ifdef SWIG - eWindowStyle(); + eWindowStyle_ENUMS(); + ~eWindowStyle_ENUMS(); #endif public: -#ifndef SWIG - virtual void handleNewSize(eWindow *wnd, eSize &size, eSize &offset) = 0; - virtual void paintWindowDecoration(eWindow *wnd, gPainter &painter, const std::string &title) = 0; - virtual void paintBackground(gPainter &painter, const ePoint &offset, const eSize &size) = 0; - virtual void setStyle(gPainter &painter, int what) = 0; - virtual void drawFrame(gPainter &painter, const eRect &frame, int type) = 0; - virtual RESULT getFont(int what, ePtr &font) = 0; -#endif - virtual ~eWindowStyle() = 0; enum { styleLabel, styleListboxSelected, @@ -30,18 +21,36 @@ public: styleListboxMarked, styleListboxMarkedAndSelected }; - + enum { frameButton, frameListboxEntry }; - + enum { fontStatic, fontButton, fontTitlebar }; }; + +SWIG_IGNORE(eWindowStyle); +class eWindowStyle: public eWindowStyle_ENUMS, public iObject +{ +#ifdef SWIG + eWindowStyle(); +#endif +public: +#ifndef SWIG + virtual void handleNewSize(eWindow *wnd, eSize &size, eSize &offset) = 0; + virtual void paintWindowDecoration(eWindow *wnd, gPainter &painter, const std::string &title) = 0; + virtual void paintBackground(gPainter &painter, const ePoint &offset, const eSize &size) = 0; + virtual void setStyle(gPainter &painter, int what) = 0; + virtual void drawFrame(gPainter &painter, const eRect &frame, int type) = 0; + virtual RESULT getFont(int what, ePtr &font) = 0; +#endif + virtual ~eWindowStyle() = 0; +}; SWIG_TEMPLATE_TYPEDEF(ePtr, eWindowStylePtr); SWIG_IGNORE(eWindowStyleManager); @@ -56,10 +65,10 @@ public: #ifndef SWIG eWindowStyleManager(); ~eWindowStyleManager(); + static SWIG_VOID(int) getInstance(ePtr &SWIG_NAMED_OUTPUT(mgr)) { mgr = m_instance; if (!mgr) return -1; return 0; } #endif void getStyle(int style_id, ePtr &SWIG_OUTPUT); void setStyle(int style_id, eWindowStyle *style); - static SWIG_VOID(int) getInstance(ePtr &SWIG_NAMED_OUTPUT(mgr)) { mgr = m_instance; if (!mgr) return -1; return 0; } private: static eWindowStyleManager *m_instance; std::map > m_current_style; diff --git a/lib/python/enigma_python.i b/lib/python/enigma_python.i index 1debfeed..6c2ece37 100644 --- a/lib/python/enigma_python.i +++ b/lib/python/enigma_python.i @@ -262,11 +262,6 @@ RESULT SwigFromPython(ePtr &result, PyObject *obj) result = *res; return 0; } -PyObject *New_TestObj() -{ - TestObj *result = (TestObj *)new TestObj(); - return SWIG_NewPointerObj((void*)(result), SWIGTYPE_p_TestObj, 1); -} PyObject *New_eServiceReference(const eServiceReference &ref) { eServiceReference *result = new eServiceReference(ref); diff --git a/lib/python/python.cpp b/lib/python/python.cpp index 8947bb3c..b5a7abbf 100644 --- a/lib/python/python.cpp +++ b/lib/python/python.cpp @@ -114,18 +114,6 @@ void ePyObject::decref(const char *file, int line) #include #undef SKIP_PART1 -DEFINE_REF(TestObj); - -TestObj::TestObj() -{ - eDebug("create %p", this); -} - -TestObj::~TestObj() -{ - eDebug("destroy %p", this); -} - ePython::ePython() { // Py_VerboseFlag = 1; diff --git a/lib/python/python.h b/lib/python/python.h index 76d2d197..f5f793ff 100644 --- a/lib/python/python.h +++ b/lib/python/python.h @@ -149,18 +149,7 @@ inline void ePyObject::decref() #endif // !SWIG && !SKIP_PART1 #ifndef SKIP_PART2 - -class TestObj -{ -DECLARE_REF(TestObj); -public: - TestObj(); - ~TestObj(); -}; -SWIG_TEMPLATE_TYPEDEF(ePtr, TestObjPtr); - #ifndef SWIG -extern PyObject *New_TestObj(); #ifdef PYTHON_REFCOUNT_DEBUG inline void Impl_Py_DECREF(const char* file, int line, const ePyObject &obj) { @@ -233,11 +222,6 @@ inline ePyObject Impl_PyLong_FromLongLong(const char* file, int line, long long return ePyObject(PyLong_FromLongLong(val), file, line); } -inline ePyObject Impl_New_TestObj(const char* file, int line) -{ - return ePyObject(New_TestObj(), file, line); -} - inline ePyObject Impl_PyList_GET_ITEM(const char *file, int line, ePyObject list, unsigned int pos) { return ePyObject(PyList_GET_ITEM(list, pos), file, line); @@ -319,11 +303,6 @@ inline ePyObject Impl_PyLong_FromLongLong(long long val) return PyLong_FromLongLong(val); } -inline ePyObject Impl_New_TestObj() -{ - return New_TestObj(); -} - inline ePyObject Impl_PyList_GET_ITEM(ePyObject list, unsigned int pos) { return PyList_GET_ITEM(list, pos); @@ -360,7 +339,6 @@ inline void Impl_DECREF(PyObject *ob) #define PyLong_FromLong(val) Impl_PyLong_FromLong(__FILE__, __LINE__, val) #define PyLong_FromUnsignedLong(val) Impl_PyLong_FromUnsignedLong(__FILE__, __LINE__, val) #define PyLong_FromLongLong(val) Impl_PyLong_FromLongLong(__FILE__, __LINE__, val) -#define NEW_TestObj(...) Impl_New_TestObj(__FILE__, __LINE__) #define PyList_GET_ITEM(list, pos) Impl_PyList_GET_ITEM(__FILE__, __LINE__, list, pos) #define PyTuple_GET_ITEM(list, pos) Impl_PyTuple_GET_ITEM(__FILE__, __LINE__, list, pos) #else @@ -377,7 +355,6 @@ inline void Impl_DECREF(PyObject *ob) #define PyLong_FromLong(val) Impl_PyLong_FromLong(val) #define PyLong_FromUnsignedLong(val) Impl_PyLong_FromUnsignedLong(val) #define PyLong_FromLongLong(val) Impl_PyLong_FromLongLong(val) -#define NEW_TestObj(...) Impl_New_TestObj() #define PyList_GET_ITEM(list, pos) Impl_PyList_GET_ITEM(list, pos) #define PyTuple_GET_ITEM(list, pos) Impl_PyTuple_GET_ITEM(list, pos) #endif -- 2.30.2