michael@0: /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ michael@0: /* vim:expandtab:shiftwidth=4:tabstop=4: michael@0: */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #ifndef nsGtkUtils_h__ michael@0: #define nsGtkUtils_h__ michael@0: michael@0: #include michael@0: michael@0: // Some gobject functions expect functions for gpointer arguments. michael@0: // gpointer is void* but C++ doesn't like casting functions to void*. michael@0: template static inline gpointer michael@0: FuncToGpointer(T aFunction) michael@0: { michael@0: return reinterpret_cast michael@0: (reinterpret_cast michael@0: // This cast just provides a warning if T is not a function. michael@0: (reinterpret_cast(aFunction))); michael@0: } michael@0: michael@0: #endif // nsGtkUtils_h__