Mercurial > projects > qtd
comparison qt/d2/qt/QtDObject.d @ 252:37eed70de029
More things broken than fixed. Rolling back to 263
author | maxter |
---|---|
date | Sat, 22 Aug 2009 12:50:58 +0000 |
parents | 7dd099050621 |
children |
comparison
equal
deleted
inserted
replaced
251:739d0ee5bd91 | 252:37eed70de029 |
---|---|
1 /** | |
2 * | |
3 * Copyright: Copyright QtD Team, 2008-2009 | |
4 * License: <a href="http://www.boost.org/LICENSE_1_0.txt>Boost License 1.0</a> | |
5 * | |
6 * Copyright QtD Team, 2008-2009 | |
7 * Distributed under the Boost Software License, Version 1.0. | |
8 * (See accompanying file boost-license-1.0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) | |
9 * | |
10 */ | |
11 | |
12 module qt.QtDObject; | |
13 | |
14 //import tango.util.container.HashMap; | |
15 import qt.Signal; | |
16 | |
17 package class QtDObject | |
18 { | |
19 // public final const(void*) nativeId() const { return native__id; } | |
20 public final void* nativeId() { return native__id; } | |
21 | |
22 public final void nativeId(void *native_id) { native__id = native_id; } | |
23 | |
24 private void* native__id = null; | |
25 | |
26 mixin SignalHandlerOps; | |
27 | |
28 public this() | |
29 { | |
30 /* intentionally empty */ | |
31 } | |
32 | |
33 package this(void* native_id, bool no_real_delete = false) | |
34 { | |
35 native__id = native_id; | |
36 /* auto qObj = cast(QObject) this; | |
37 if (qObj is null) | |
38 register(native__id);*/ | |
39 __no_real_delete = no_real_delete; | |
40 } | |
41 /* | |
42 ~this() { | |
43 unregister(native__id); | |
44 } | |
45 */ | |
46 // this flag controls if D object when destroying should or shouldn't delete real C++ object | |
47 public bool __no_real_delete = false; | |
48 | |
49 package void __free_native_resources(); | |
50 | |
51 | |
52 /* hash table of Object instances */ | |
53 /* private static HashMap!(void*, Object) _map; | |
54 | |
55 static this() { | |
56 _map = new HashMap!(void*, Object); | |
57 } | |
58 | |
59 package static void register(void* qt_object, Object d_object) { | |
60 _map.add(qt_object, d_object); | |
61 } | |
62 | |
63 package static void unregister(void* qt_object) { | |
64 _map.removeKey(qt_object); | |
65 } | |
66 | |
67 package static Object lookup(void* qt_object) { | |
68 return _map[qt_object]; | |
69 } | |
70 */ | |
71 } |