gparam.inc 6.5 KB

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