comparison qt/d1/qt/QtDObject.d @ 188:7dd099050621

initial commit for D2 support
author eldar
date Sun, 12 Jul 2009 18:58:03 +0000
parents
children
comparison
equal deleted inserted replaced
187:34fe79a9915b 188:7dd099050621
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 void* nativeId() { return native__id; }
20
21 public final void nativeId(void *native_id) { native__id = native_id; }
22
23 private void* native__id = null;
24
25 mixin SignalHandlerOps;
26
27 public this()
28 {
29 /* intentionally empty */
30 }
31
32 package this(void* native_id, bool no_real_delete = false)
33 {
34 native__id = native_id;
35 /* auto qObj = cast(QObject) this;
36 if (qObj is null)
37 register(native__id);*/
38 __no_real_delete = no_real_delete;
39 }
40 /*
41 ~this() {
42 unregister(native__id);
43 }
44 */
45 // this flag controls if D object when destroying should or shouldn't delete real C++ object
46 public bool __no_real_delete = false;
47
48 package void __free_native_resources();
49
50
51 /* hash table of Object instances */
52 /* private static HashMap!(void*, Object) _map;
53
54 static this() {
55 _map = new HashMap!(void*, Object);
56 }
57
58 package static void register(void* qt_object, Object d_object) {
59 _map.add(qt_object, d_object);
60 }
61
62 package static void unregister(void* qt_object) {
63 _map.removeKey(qt_object);
64 }
65
66 package static Object lookup(void* qt_object) {
67 return _map[qt_object];
68 }
69 */
70 }