1 | /* gnome-macros.h |
---|
2 | * Macros for making GObject objects to avoid typos and reduce code size |
---|
3 | * Copyright (C) 2000 Eazel, Inc. |
---|
4 | * |
---|
5 | * Authors: George Lebl <jirka@5z.com> |
---|
6 | * |
---|
7 | * All rights reserved. |
---|
8 | * |
---|
9 | * This library is free software; you can redistribute it and/or |
---|
10 | * modify it under the terms of the GNU Library General Public |
---|
11 | * License as published by the Free Software Foundation; either |
---|
12 | * version 2 of the License, or (at your option) any later version. |
---|
13 | * |
---|
14 | * This library is distributed in the hope that it will be useful, |
---|
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
---|
17 | * Library General Public License for more details. |
---|
18 | * |
---|
19 | * You should have received a copy of the GNU Library General Public |
---|
20 | * License along with this library; if not, write to the |
---|
21 | * Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
---|
22 | * Boston, MA 02111-1307, USA. |
---|
23 | */ |
---|
24 | /* |
---|
25 | @NOTATION@ |
---|
26 | */ |
---|
27 | |
---|
28 | #ifndef GNOME_MACROS_H |
---|
29 | #define GNOME_MACROS_H |
---|
30 | |
---|
31 | #include <bonobo/bonobo-macros.h> |
---|
32 | |
---|
33 | /* Macros for defining classes. Ideas taken from Nautilus and GOB. */ |
---|
34 | |
---|
35 | /* Define the boilerplate type stuff to reduce typos and code size. Defines |
---|
36 | * the get_type method and the parent_class static variable. */ |
---|
37 | #define GNOME_CLASS_BOILERPLATE(type, type_as_function, \ |
---|
38 | parent_type, parent_type_macro) \ |
---|
39 | BONOBO_BOILERPLATE(type, type_as_function, type, \ |
---|
40 | parent_type, parent_type_macro, \ |
---|
41 | GNOME_REGISTER_TYPE) |
---|
42 | #define GNOME_REGISTER_TYPE(type, type_as_function, corba_type, \ |
---|
43 | parent_type, parent_type_macro) \ |
---|
44 | g_type_register_static (parent_type_macro, #type, &object_info, 0) |
---|
45 | |
---|
46 | /* Just call the parent handler. This assumes that there is a variable |
---|
47 | * named parent_class that points to the (duh!) parent class. Note that |
---|
48 | * this macro is not to be used with things that return something, use |
---|
49 | * the _WITH_DEFAULT version for that */ |
---|
50 | #define GNOME_CALL_PARENT(parent_class_cast, name, args) \ |
---|
51 | BONOBO_CALL_PARENT (parent_class_cast, name, args) |
---|
52 | |
---|
53 | /* Same as above, but in case there is no implementation, it evaluates |
---|
54 | * to def_return */ |
---|
55 | #define GNOME_CALL_PARENT_WITH_DEFAULT(parent_class_cast, \ |
---|
56 | name, args, def_return) \ |
---|
57 | BONOBO_CALL_PARENT_WITH_DEFAULT ( \ |
---|
58 | parent_class_cast, name, args, def_return) |
---|
59 | |
---|
60 | #endif /* GNOME_MACROS_H */ |
---|