gparam.inc 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  1. // included by glib2.pas
  2. {$IFDEF read_forward_definitions}
  3. { --- flags --- }
  4. PGParamFlags = ^TGParamFlags;
  5. TGParamFlags = longint;
  6. { --- typedefs & structures --- }
  7. { class using this property }
  8. {< private > }
  9. { sort-criteria }
  10. PGParamSpec = ^TGParamSpec;
  11. PPGParamSpec = ^PGParamSpec;
  12. TGParamSpec = record
  13. g_type_instance : TGTypeInstance;
  14. name : Pgchar;
  15. flags : TGParamFlags;
  16. value_type : GType;
  17. owner_type : GType;
  18. _nick : Pgchar;
  19. _blurb : Pgchar;
  20. qdata : PGData;
  21. ref_count : guint;
  22. param_id : guint;
  23. end;
  24. { GParam methods }
  25. PGParamSpecClass = ^TGParamSpecClass;
  26. TGParamSpecClass = record
  27. g_type_class : TGTypeClass;
  28. value_type : GType;
  29. finalize : procedure (pspec:PGParamSpec); cdecl;
  30. value_set_default : procedure (pspec:PGParamSpec; value:PGValue); cdecl;
  31. value_validate : function (pspec:PGParamSpec; value:PGValue):gboolean; cdecl;
  32. values_cmp : function (pspec:PGParamSpec; value1:PGValue; value2:PGValue):gint; cdecl;
  33. dummy : array[0..3] of gpointer;
  34. end;
  35. { auxillary structure for _setv() variants }
  36. PGParameter = ^TGParameter;
  37. TGParameter = record
  38. name : Pgchar;
  39. value : TGValue;
  40. end;
  41. {$ENDIF read_forward_definitions}
  42. //------------------------------------------------------------------------------
  43. {$IFDEF read_interface_rest}
  44. { --- standard type macros --- }
  45. function G_TYPE_IS_PARAM(_type : GType) : boolean;
  46. function G_PARAM_SPEC(pspec : Pointer) : PGParamSpec;
  47. function G_IS_PARAM_SPEC(pspec : Pointer) : boolean;
  48. function G_PARAM_SPEC_CLASS(pclass : Pointer) : PGParamSpecClass;
  49. function G_IS_PARAM_SPEC_CLASS(pclass : Pointer) : boolean;
  50. function G_PARAM_SPEC_GET_CLASS(pspec : Pointer) : PGParamSpecClass;
  51. { --- convenience macros --- }
  52. function G_PARAM_SPEC_TYPE(pspec : Pointer) : GType;
  53. function G_PARAM_SPEC_TYPE_NAME(pspec : Pointer) : PGChar;
  54. function G_PARAM_SPEC_VALUE_TYPE(pspec : Pointer) : GType;
  55. function G_VALUE_HOLDS_PARAM(value : Pointer) : boolean;
  56. const
  57. G_PARAM_READABLE = 1 shl 0;
  58. G_PARAM_WRITABLE = 1 shl 1;
  59. G_PARAM_CONSTRUCT = 1 shl 2;
  60. G_PARAM_CONSTRUCT_ONLY = 1 shl 3;
  61. G_PARAM_LAX_VALIDATION = 1 shl 4;
  62. G_PARAM_PRIVATE = 1 shl 5;
  63. G_PARAM_READWRITE = G_PARAM_READABLE or G_PARAM_WRITABLE;
  64. G_PARAM_MASK = $000000ff;
  65. { bits in the range 0xffffff00 are reserved for 3rd party usage }
  66. G_PARAM_USER_SHIFT = 8;
  67. { --- prototypes --- }
  68. function g_param_spec_ref(pspec:PGParamSpec):PGParamSpec; cdecl; external gliblib;
  69. procedure g_param_spec_unref(pspec:PGParamSpec); cdecl; external gliblib;
  70. procedure g_param_spec_sink(pspec:PGParamSpec); cdecl; external gliblib;
  71. function g_param_spec_get_qdata(pspec:PGParamSpec; quark:TGQuark):gpointer; cdecl; external gliblib;
  72. procedure g_param_spec_set_qdata(pspec:PGParamSpec; quark:TGQuark; data:gpointer); cdecl; external gliblib;
  73. procedure g_param_spec_set_qdata_full(pspec:PGParamSpec; quark:TGQuark; data:gpointer; destroy:TGDestroyNotify); cdecl; external gliblib;
  74. function g_param_spec_steal_qdata(pspec:PGParamSpec; quark:TGQuark):gpointer; cdecl; external gliblib;
  75. procedure g_param_value_set_default(pspec:PGParamSpec; value:PGValue); cdecl; external gliblib;
  76. function g_param_value_defaults(pspec:PGParamSpec; value:PGValue):gboolean; cdecl; external gliblib;
  77. function g_param_value_validate(pspec:PGParamSpec; value:PGValue):gboolean; cdecl; external gliblib;
  78. function g_param_value_convert(pspec:PGParamSpec; src_value:PGValue; dest_value:PGValue; strict_validation:gboolean):gboolean; cdecl; external gliblib;
  79. function g_param_values_cmp(pspec:PGParamSpec; value1:PGValue; value2:PGValue):gint; cdecl; external gliblib;
  80. function g_param_spec_get_name(pspec:PGParamSpec):Pgchar; cdecl; external gliblib;
  81. function g_param_spec_get_nick(pspec:PGParamSpec):Pgchar; cdecl; external gliblib;
  82. function g_param_spec_get_blurb(pspec:PGParamSpec):Pgchar; cdecl; external gliblib;
  83. procedure g_value_set_param(value:PGValue; param:PGParamSpec); cdecl; external gliblib;
  84. function g_value_get_param(value:PGValue):PGParamSpec; cdecl; external gliblib;
  85. function g_value_dup_param(value:PGValue):PGParamSpec; cdecl; external gliblib;
  86. { --- marshaller specific --- }
  87. procedure g_value_set_param_take_ownership(value:PGValue; param:PGParamSpec); cdecl; external gliblib;
  88. { --- convenience functions --- }
  89. type
  90. { type system portion }
  91. { obligatory }
  92. { optional }
  93. { optional }
  94. { class portion }
  95. { obligatory }
  96. { optional }
  97. { recommended }
  98. { optional }
  99. { recommended }
  100. PGParamSpecTypeInfo = ^TGParamSpecTypeInfo;
  101. TGParamSpecTypeInfo = record
  102. instance_size : guint16;
  103. n_preallocs : guint16;
  104. instance_init : procedure (pspec:PGParamSpec); cdecl;
  105. value_type : GType;
  106. finalize : procedure (pspec:PGParamSpec); cdecl;
  107. value_set_default : procedure (pspec:PGParamSpec; value:PGValue); cdecl;
  108. value_validate : function (pspec:PGParamSpec; value:PGValue):gboolean; cdecl;
  109. values_cmp : function (pspec:PGParamSpec; value1:PGValue; value2:PGValue):gint; cdecl;
  110. end;
  111. function g_param_type_register_static(name:Pgchar; pspec_info:PGParamSpecTypeInfo):GType; cdecl; external gliblib;
  112. { For registering builting types }
  113. function _g_param_type_register_static_constant(name:Pgchar; pspec_info:PGParamSpecTypeInfo; opt_type:GType):GType; cdecl; external gliblib;
  114. { --- protected --- }
  115. function g_param_spec_internal(param_type:GType; name:Pgchar; nick:Pgchar; blurb:Pgchar; flags:TGParamFlags):gpointer; cdecl; external gliblib;
  116. function g_param_spec_pool_new(type_prefixing:gboolean):PGParamSpecPool; cdecl; external gliblib;
  117. procedure g_param_spec_pool_insert(pool:PGParamSpecPool; pspec:PGParamSpec; owner_type:GType); cdecl; external gliblib;
  118. procedure g_param_spec_pool_remove(pool:PGParamSpecPool; pspec:PGParamSpec); cdecl; external gliblib;
  119. function g_param_spec_pool_lookup(pool:PGParamSpecPool; param_name:Pgchar; owner_type:GType; walk_ancestors:gboolean):PGParamSpec; cdecl; external gliblib;
  120. function g_param_spec_pool_list_owned(pool:PGParamSpecPool; owner_type:GType):PGList; cdecl; external gliblib;
  121. function g_param_spec_pool_list(pool:PGParamSpecPool; owner_type:GType; n_pspecs_p:Pguint):PPGParamSpec; cdecl; external gliblib;
  122. { contracts:
  123. gboolean value_validate (GParamSpec pspec,
  124. GValue value):
  125. modify value contents in the least destructive way, so
  126. that it complies with pspec's requirements (i.e.
  127. according to minimum/maximum ranges etc...). return
  128. whether modification was necessary.
  129. gint values_cmp (GParamSpec pspec,
  130. const GValue value1,
  131. const GValue value2):
  132. return value1 - value2, i.e. (-1) if value1 < value2,
  133. (+1) if value1 > value2, and (0) otherwise (equality)
  134. }
  135. {$ENDIF read_interface_rest}
  136. // included by glib2.pas