#ifndef _GDKMM_LIST_H_ #define _GDKMM_LIST_H_ namespace Gdk { #ifdef GTKMM_CXX_HAVE_PARTIAL_SPECIALIZATION // Dummy class to make it appear as though the user has the list. /* template class List { public: typedef List List; private: Parent* parent; public: List(Parent& p):parent(p) {} List():parent(0) {} List(const List& list):parent(list.parent) {} Iterator begin() { if (parent) return Access::begin(parent); return Iterator(); } Iterator end(); { if (parent) return Access::end(parent); return Iterator(); } }; */ // An iterator that caches the current object to C++ for speed template class List_Iterator { public: typedef List_Iterator self; private: GList *node; Cpp_Obj cache; public: self& operator=(const self& x) { cache.free(); node=x.node; } bool operator==(const self& x) const { return node == x.node; } bool operator!=(const self& x) const { return node != x.node; } List_Iterator(GList *n) : node(n),cache(0) {} List_Iterator() :node(0),cache(0) {} List_Iterator(const self& x) : node(x.node),cache(0) {} Cpp_Obj& operator*() const { if (node) {if (cache.gobj()!=node->data) cache=Cpp_Obj(node->data); } else cache=Cpp_Obj(0); cache=0; return ; } Cpp_Obj* operator->() const { return &(operator*()); } self& operator++() { cache.free(); if (node && node->next) node = node->next; return *this; } self operator++(int) { self tmp = *this; ++*this; return tmp; } self& operator--() { cache.free(); if (node && node->prev) node=node->prev; return *this; } self operator--(int) { self tmp = *this; --*this; return tmp; } }; /* List_Iterator iter; (*iter) should be a Widget Example usage: class Foo() { public: typedef List_Iterator Iterator; typedef List