~ubuntu-branches/ubuntu/dapper/fpc/dapper

« back to all changes in this revision

Viewing changes to packages/extra/gtk2/gtk+/gtk/gtkobject.inc

  • Committer: Bazaar Package Importer
  • Author(s): Carlos Laviola
  • Date: 2005-05-30 11:59:10 UTC
  • mfrom: (1.2.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20050530115910-x5pbzm4qqta4i94h
Tags: 2.0.0-2
debian/fp-compiler.postinst.in: forgot to reapply the patch that
correctly creates the slave link to pc(1).  (Closes: #310907)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// included by gtk2.pas
 
2
 
 
3
{$IFDEF read_forward_definitions}
 
4
   PGtkObject = ^TGtkObject;
 
5
   PPGtkObject = ^PGtkObject;
 
6
{$ENDIF read_forward_definitions}
 
7
 
 
8
//------------------------------------------------------------------------------
 
9
 
 
10
{$IFDEF read_interface_types}
 
11
{ GtkObject only uses the first 4 bits of the flags field.
 
12
   Derived objects may use the remaining bits. Though this
 
13
   is a kinda nasty break up, it does make the size of
 
14
   derived objects smaller.
 
15
  }
 
16
{ Used internally during dispose  }
 
17
 
 
18
   PGtkObjectFlags = ^TGtkObjectFlags;
 
19
   TGtkObjectFlags = longint;
 
20
 
 
21
 
 
22
{ The GtkObject structure is the base of the Gtk+ objects hierarchy,
 
23
   it ``inherits'' from the GtkTypeObject by mirroring its fields,
 
24
   which must always be kept in sync completely. The GtkObject defines
 
25
   the few basic items that all derived classes contain.
 
26
  }
 
27
{ 32 bits of flags. GtkObject only uses 4 of these bits and
 
28
      GtkWidget uses the rest. This is done because structs are
 
29
      aligned on 4 or 8 byte boundaries. If a new bitfield were
 
30
      used in GtkWidget much space would be wasted.
 
31
    }
 
32
   TGtkObject = record
 
33
        parent_instance : TGObject;
 
34
        flags : guint32;
 
35
     end;
 
36
 
 
37
{ The GtkObjectClass is the base of the Gtk+ objects classes hierarchy,
 
38
   it ``inherits'' from the GtkTypeClass by mirroring its fields, which
 
39
   must always be kept in sync completely. The GtkObjectClass defines
 
40
   the basic necessities for the anObject inheritance mechanism to work.
 
41
  }
 
42
{ Non overridable class methods to set and get per class arguments  }
 
43
{ The function that will theEnd an objects life time. In one way ore
 
44
      another all three of them are defined for all objects. If an
 
45
      anObject class overrides one of the methods in order to perform class
 
46
      specific destruction then it must still invoke its superclass'
 
47
      implementation of the method after it is finished with its
 
48
      own cleanup. (See the destroy function for GtkWidget for
 
49
      an example of how to do this).
 
50
    }
 
51
   PGtkObjectClass = ^TGtkObjectClass;
 
52
   TGtkObjectClass = record
 
53
        parent_class : TGObjectClass;
 
54
        set_arg : procedure (anObject:PGtkObject; arg:PGtkArg; arg_id:guint); cdecl;
 
55
        get_arg : procedure (anObject:PGtkObject; arg:PGtkArg; arg_id:guint); cdecl;
 
56
        destroy : procedure (anObject:PGtkObject); cdecl;
 
57
     end;
 
58
 
 
59
{$ifndef GTK_DISABLE_DEPRECATED }
 
60
{ GtkArg flag bits for gtk_object_add_arg_type
 
61
  }
 
62
   PGtkArgFlags = ^TGtkArgFlags;
 
63
   TGtkArgFlags = longint;
 
64
{$endif}
 
65
{ GTK_DISABLE_DEPRECATED  }
 
66
 
 
67
{$ENDIF read_interface_types}
 
68
 
 
69
//------------------------------------------------------------------------------
 
70
 
 
71
{$IFDEF read_interface_rest}
 
72
const
 
73
   GTK_IN_DESTRUCTION = 1 shl 0;
 
74
   GTK_FLOATING       = 1 shl 1;
 
75
   GTK_RESERVED_1     = 1 shl 2;
 
76
   GTK_RESERVED_2     = 1 shl 3;
 
77
 
 
78
   GTK_ARG_READABLE   = G_PARAM_READABLE;
 
79
   GTK_ARG_WRITABLE   = G_PARAM_WRITABLE;
 
80
   GTK_ARG_CONSTRUCT  = G_PARAM_CONSTRUCT;
 
81
   GTK_ARG_CONSTRUCT_ONLY = G_PARAM_CONSTRUCT_ONLY;
 
82
   GTK_ARG_CHILD_ARG  = 1 shl 4;
 
83
 
 
84
{ macros for casting a pointer to a GtkObject or GtkObjectClass pointer,
 
85
   and to test whether `anObject' and `klass' are of type GTK_TYPE_OBJECT.
 
86
   these are the standard macros for all GtkObject-derived classes.
 
87
  }
 
88
function GTK_TYPE_OBJECT : GType;
 
89
function GTK_OBJECT(anObject: pointer) : PGtkObject;
 
90
function GTK_OBJECT_CLASS(klass: pointer) : PGtkObjectClass;
 
91
function GTK_IS_OBJECT(anObject: pointer) : boolean;
 
92
function GTK_IS_OBJECT_CLASS(klass: pointer) : boolean;
 
93
function GTK_OBJECT_GET_CLASS(anObject: pointer) : PGtkObjectClass;
 
94
 
 
95
{ Macros for extracting various fields from GtkObject and GtkObjectClass.
 
96
  }
 
97
function GTK_OBJECT_TYPE(anObject: pointer) : GType;
 
98
function GTK_OBJECT_TYPE_NAME(anObject: pointer) : PGChar;
 
99
 
 
100
{ Macros for extracting the object_flags from GtkObject.
 
101
  }
 
102
function GTK_OBJECT_FLAGS(obj: pointer) : guint32;
 
103
function GTK_OBJECT_FLOATING(obj: pointer) : gboolean;
 
104
 
 
105
{ Macros for setting and clearing bits in the object_flags field of GtkObject.
 
106
  }
 
107
procedure GTK_OBJECT_SET_FLAGS(obj: pointer; flag: guint32);
 
108
procedure GTK_OBJECT_UNSET_FLAGS(obj: pointer; flag: guint32);
 
109
 
 
110
{ Application-level methods  }
 
111
 
 
112
function gtk_object_get_type:TGtkType; cdecl; external gtklib;
 
113
function gtk_object_new(_type:TGtkType; first_property_name:Pgchar; args:array of const):PGtkObject; cdecl; overload; external gtklib;
 
114
function gtk_object_new(_type:TGtkType; first_property_name:Pgchar):PGtkObject; cdecl; overload; external gtklib;
 
115
procedure gtk_object_sink(anObject:PGtkObject); cdecl; external gtklib;
 
116
procedure gtk_object_destroy(anObject:PGtkObject); cdecl; external gtklib;
 
117
{                                                               }
 
118
 
 
119
{$ifndef GTK_DISABLE_DEPRECATED }
 
120
function gtk_object_ref(anObject:PGtkObject):PGtkObject; cdecl; external gtklib;
 
121
procedure gtk_object_unref(anObject:PGtkObject); cdecl; external gtklib;
 
122
procedure gtk_object_weakref(anObject:PGtkObject; notify:TGtkDestroyNotify; data:gpointer); cdecl; external gtklib;
 
123
procedure gtk_object_weakunref(anObject:PGtkObject; notify:TGtkDestroyNotify; data:gpointer); cdecl; external gtklib;
 
124
{ Set 'data' to the "object_data" field of the anObject. The
 
125
    data is indexed by the "key". If there is already data
 
126
    associated with "key" then the new data will replace it.
 
127
    If 'data' is NULL then this call is equivalent to
 
128
    'gtk_object_remove_data'.
 
129
    The gtk_object_set_data_full variant acts just the same,
 
130
    but takes an additional argument which is a function to
 
131
    be called when the data is removed.
 
132
    `gtk_object_remove_data' is equivalent to the above,
 
133
    where 'data' is NULL
 
134
    `gtk_object_get_data' gets the data associated with "key".
 
135
  }
 
136
procedure gtk_object_set_data(anObject:PGtkObject; key:Pgchar; data:gpointer); cdecl; external gtklib;
 
137
procedure gtk_object_set_data_full(anObject:PGtkObject; key:Pgchar; data:gpointer; destroy:TGtkDestroyNotify); cdecl; external gtklib;
 
138
procedure gtk_object_remove_data(anObject:PGtkObject; key:Pgchar); cdecl; external gtklib;
 
139
function gtk_object_get_data(anObject:PGtkObject; key:Pgchar):gpointer; cdecl; external gtklib;
 
140
procedure gtk_object_remove_no_notify(anObject:PGtkObject; key:Pgchar); cdecl; external gtklib;
 
141
{ Set/get the "user_data" anObject data field of "anObject". It should
 
142
    be noted that these functions are no different than calling
 
143
    `gtk_object_set_data'/`gtk_object_get_data' with a key of "user_data".
 
144
    They are merely provided as a convenience.
 
145
  }
 
146
procedure gtk_object_set_user_data(anObject:PGtkObject; data:gpointer); cdecl; external gtklib;
 
147
function gtk_object_get_user_data(anObject:PGtkObject):gpointer; cdecl; external gtklib;
 
148
{ Object-level methods  }
 
149
{ Object data method variants that operate on key ids.  }
 
150
procedure gtk_object_set_data_by_id(anObject:PGtkObject; data_id:TGQuark; data:gpointer); cdecl; external gtklib;
 
151
procedure gtk_object_set_data_by_id_full(anObject:PGtkObject; data_id:TGQuark; data:gpointer; destroy:TGtkDestroyNotify); cdecl; external gtklib;
 
152
function gtk_object_get_data_by_id(anObject:PGtkObject; data_id:TGQuark):gpointer; cdecl; external gtklib;
 
153
procedure gtk_object_remove_data_by_id(anObject:PGtkObject; data_id:TGQuark); cdecl; external gtklib;
 
154
procedure gtk_object_remove_no_notify_by_id(anObject:PGtkObject; key_id:TGQuark); cdecl; external gtklib;
 
155
 
 
156
function gtk_object_data_try_key(_string:Pgchar):TGQuark;
 
157
function gtk_object_data_force_id(_string:Pgchar):TGQuark;
 
158
 
 
159
const
 
160
   GTK_ARG_READWRITE = GTK_ARG_READABLE or GTK_ARG_WRITABLE;
 
161
 
 
162
procedure gtk_object_get(anObject:PGtkObject; first_property_name:Pgchar; args:array of const); cdecl; overload; external gtklib;
 
163
procedure gtk_object_get(anObject:PGtkObject; first_property_name:Pgchar); cdecl; overload; external gtklib;
 
164
procedure gtk_object_set(anObject:PGtkObject; first_property_name:Pgchar; args:array of const); cdecl; overload; external gtklib;
 
165
procedure gtk_object_set(anObject:PGtkObject; first_property_name:Pgchar); cdecl; overload; external gtklib;
 
166
procedure gtk_object_add_arg_type(arg_name:Pgchar; arg_type:TGtkType; arg_flags:guint; arg_id:guint); cdecl; external gtklib;
 
167
{$endif}
 
168
{ GTK_DISABLE_DEPRECATED  }
 
169
 
 
170
 
 
171
{$ENDIF read_interface_rest}
 
172
 
 
173
//------------------------------------------------------------------------------
 
174
 
 
175
{$IFDEF read_implementation}
 
176
function GTK_TYPE_OBJECT : GType;
 
177
begin
 
178
   GTK_TYPE_OBJECT:=gtk_object_get_type;
 
179
end;
 
180
 
 
181
function GTK_OBJECT(anObject: pointer) : PGtkObject;
 
182
begin
 
183
   GTK_OBJECT:=PGtkObject(GTK_CHECK_CAST(anObject,GTK_TYPE_OBJECT));
 
184
end;
 
185
 
 
186
function GTK_OBJECT_CLASS(klass: pointer) : PGtkObjectClass;
 
187
begin
 
188
   GTK_OBJECT_CLASS:=PGtkObjectClass(GTK_CHECK_CLASS_CAST(klass,GTK_TYPE_OBJECT));
 
189
end;
 
190
 
 
191
function GTK_IS_OBJECT(anObject: pointer) : boolean;
 
192
begin
 
193
   GTK_IS_OBJECT:=GTK_CHECK_TYPE(anObject,GTK_TYPE_OBJECT);
 
194
end;
 
195
 
 
196
function GTK_IS_OBJECT_CLASS(klass: pointer) : boolean;
 
197
begin
 
198
   GTK_IS_OBJECT_CLASS:=GTK_CHECK_CLASS_TYPE(klass,GTK_TYPE_OBJECT);
 
199
end;
 
200
 
 
201
function GTK_OBJECT_GET_CLASS(anObject: pointer) : PGtkObjectClass;
 
202
begin
 
203
   GTK_OBJECT_GET_CLASS:=PGtkObjectClass(GTK_CHECK_GET_CLASS(anObject,GTK_TYPE_OBJECT));
 
204
end;
 
205
 
 
206
function GTK_OBJECT_TYPE(anObject: pointer) : GType;
 
207
begin
 
208
   GTK_OBJECT_TYPE:=G_TYPE_FROM_INSTANCE(anObject);
 
209
end;
 
210
 
 
211
function GTK_OBJECT_TYPE_NAME(anObject: pointer) : PGChar;
 
212
begin
 
213
   GTK_OBJECT_TYPE_NAME:=g_type_name(GTK_OBJECT_TYPE(anObject));
 
214
end;
 
215
 
 
216
function GTK_OBJECT_FLAGS(obj: pointer) : guint32;
 
217
begin
 
218
   GTK_OBJECT_FLAGS:=(GTK_OBJECT(obj))^.flags;
 
219
end;
 
220
 
 
221
function GTK_OBJECT_FLOATING(obj: pointer) : gboolean;
 
222
begin
 
223
   GTK_OBJECT_FLOATING:=((GTK_OBJECT_FLAGS(obj)) and GTK_FLOATING) <> 0;
 
224
end;
 
225
 
 
226
procedure GTK_OBJECT_SET_FLAGS(obj: pointer; flag: guint32);
 
227
begin
 
228
  GTK_OBJECT(obj)^.flags:=GTK_OBJECT(obj)^.flags or flag;
 
229
end;
 
230
 
 
231
procedure GTK_OBJECT_UNSET_FLAGS(obj: pointer; flag: guint32);
 
232
begin
 
233
  GTK_OBJECT(obj)^.flags:=GTK_OBJECT(obj)^.flags and not flag;
 
234
end;
 
235
 
 
236
function gtk_object_data_try_key(_string:Pgchar):TGQuark;
 
237
begin
 
238
   gtk_object_data_try_key:=g_quark_try_string(_string);
 
239
end;
 
240
 
 
241
function gtk_object_data_force_id(_string:Pgchar):TGQuark;
 
242
begin
 
243
   gtk_object_data_force_id:=g_quark_from_string(_string);
 
244
end;
 
245
{$ENDIF read_implementation}
 
246
// included by gtk2.pas
 
247