gtkentry.inc 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348
  1. // included by gtk2.pas
  2. {$IFDEF read_forward_definitions}
  3. {$ENDIF read_forward_definitions}
  4. //------------------------------------------------------------------------------
  5. {$IFDEF read_interface_types}
  6. { Dragging within the selection }
  7. { length in use, in chars }
  8. {< private > }
  9. { Flag so we don't select all when clicking in entry to focus in }
  10. { Only used by GtkCellRendererText }
  11. { font ascent, in pango units }
  12. { font descent, in pango units }
  13. { allocated size, in bytes }
  14. { length in use, in bytes }
  15. { length of preedit string, in bytes }
  16. { offset of cursor within preedit string, in chars }
  17. { In chars, -1 == no DND cursor }
  18. PGtkEntry = ^TGtkEntry;
  19. TGtkEntry = record
  20. widget : TGtkWidget;
  21. text : Pgchar;
  22. flag0 : word;
  23. text_length : guint16;
  24. text_max_length : guint16;
  25. text_area : PGdkWindow;
  26. im_context : PGtkIMContext;
  27. popup_menu : PGtkWidget;
  28. current_pos : gint;
  29. selection_bound : gint;
  30. cached_layout : PPangoLayout;
  31. flag1 : word;
  32. button : guint;
  33. blink_timeout : guint;
  34. recompute_idle : guint;
  35. scroll_offset : gint;
  36. ascent : gint;
  37. descent : gint;
  38. text_size : guint16;
  39. n_bytes : guint16;
  40. preedit_length : guint16;
  41. preedit_cursor : guint16;
  42. dnd_position : gint;
  43. drag_start_x : gint;
  44. drag_start_y : gint;
  45. invisible_char : gunichar;
  46. width_chars : gint;
  47. end;
  48. { Hook to customize right-click popup }
  49. { Action signals
  50. }
  51. { Padding for future expansion }
  52. PGtkEntryClass = ^TGtkEntryClass;
  53. TGtkEntryClass = record
  54. parent_class : TGtkWidgetClass;
  55. populate_popup : procedure (entry:PGtkEntry; menu:PGtkMenu); cdecl;
  56. activate : procedure (entry:PGtkEntry); cdecl;
  57. move_cursor : procedure (entry:PGtkEntry; step:TGtkMovementStep; count:gint; extend_selection:gboolean); cdecl;
  58. insert_at_cursor : procedure (entry:PGtkEntry; str:Pgchar); cdecl;
  59. delete_from_cursor : procedure (entry:PGtkEntry; _type:TGtkDeleteType; count:gint); cdecl;
  60. cut_clipboard : procedure (entry:PGtkEntry); cdecl;
  61. copy_clipboard : procedure (entry:PGtkEntry); cdecl;
  62. paste_clipboard : procedure (entry:PGtkEntry); cdecl;
  63. toggle_overwrite : procedure (entry:PGtkEntry); cdecl;
  64. _gtk_reserved1 : procedure ; cdecl;
  65. _gtk_reserved2 : procedure ; cdecl;
  66. _gtk_reserved3 : procedure ; cdecl;
  67. _gtk_reserved4 : procedure ; cdecl;
  68. end;
  69. {$ENDIF read_interface_types}
  70. //------------------------------------------------------------------------------
  71. {$IFDEF read_interface_rest}
  72. const
  73. bm_TGtkEntry_editable = $1;
  74. bp_TGtkEntry_editable = 0;
  75. bm_TGtkEntry_visible = $2;
  76. bp_TGtkEntry_visible = 1;
  77. bm_TGtkEntry_overwrite_mode = $4;
  78. bp_TGtkEntry_overwrite_mode = 2;
  79. bm_TGtkEntry_in_drag = $8;
  80. bp_TGtkEntry_in_drag = 3;
  81. bm_TGtkEntry_cache_includes_preedit = $1;
  82. bp_TGtkEntry_cache_includes_preedit = 0;
  83. bm_TGtkEntry_need_im_reset = $2;
  84. bp_TGtkEntry_need_im_reset = 1;
  85. bm_TGtkEntry_has_frame = $4;
  86. bp_TGtkEntry_has_frame = 2;
  87. bm_TGtkEntry_activates_default = $8;
  88. bp_TGtkEntry_activates_default = 3;
  89. bm_TGtkEntry_cursor_visible = $10;
  90. bp_TGtkEntry_cursor_visible = 4;
  91. bm_TGtkEntry_in_click = $20;
  92. bp_TGtkEntry_in_click = 5;
  93. bm_TGtkEntry_is_cell_renderer = $40;
  94. bp_TGtkEntry_is_cell_renderer = 6;
  95. bm_TGtkEntry_editing_canceled = $80;
  96. bp_TGtkEntry_editing_canceled = 7;
  97. bm_TGtkEntry_mouse_cursor_obscured = $100;
  98. bp_TGtkEntry_mouse_cursor_obscured = 8;
  99. function GTK_TYPE_ENTRY : GType;
  100. function GTK_ENTRY(obj: pointer) : PGtkEntry;
  101. function GTK_ENTRY_CLASS(klass: pointer) : PGtkEntryClass;
  102. function GTK_IS_ENTRY(obj: pointer) : boolean;
  103. function GTK_IS_ENTRY_CLASS(klass: pointer) : boolean;
  104. function GTK_ENTRY_GET_CLASS(obj: pointer) : PGtkEntryClass;
  105. function editable(var a : TGtkEntry) : guint; overload;
  106. procedure set_editable(var a : TGtkEntry; __editable : guint); overload;
  107. function visible(var a : TGtkEntry) : guint; overload;
  108. procedure set_visible(var a : TGtkEntry; __visible : guint); overload;
  109. function overwrite_mode(var a : TGtkEntry) : guint; overload;
  110. procedure set_overwrite_mode(var a : TGtkEntry; __overwrite_mode : guint); overload;
  111. function in_drag(var a : TGtkEntry) : guint; overload;
  112. procedure set_in_drag(var a : TGtkEntry; __in_drag : guint); overload;
  113. function cache_includes_preedit(var a : TGtkEntry) : guint;
  114. procedure set_cache_includes_preedit(var a : TGtkEntry; __cache_includes_preedit : guint);
  115. function need_im_reset(var a : TGtkEntry) : guint; overload;
  116. procedure set_need_im_reset(var a : TGtkEntry; __need_im_reset : guint); overload;
  117. function has_frame(var a : TGtkEntry) : guint; overload;
  118. procedure set_has_frame(var a : TGtkEntry; __has_frame : guint); overload;
  119. function activates_default(var a : TGtkEntry) : guint;
  120. procedure set_activates_default(var a : TGtkEntry; __activates_default : guint);
  121. function cursor_visible(var a : TGtkEntry) : guint; overload;
  122. procedure set_cursor_visible(var a : TGtkEntry; __cursor_visible : guint); overload;
  123. function in_click(var a : TGtkEntry) : guint;
  124. procedure set_in_click(var a : TGtkEntry; __in_click : guint);
  125. function is_cell_renderer(var a : TGtkEntry) : guint;
  126. procedure set_is_cell_renderer(var a : TGtkEntry; __is_cell_renderer : guint);
  127. function editing_canceled(var a : TGtkEntry) : guint;
  128. procedure set_editing_canceled(var a : TGtkEntry; __editing_canceled : guint);
  129. function mouse_cursor_obscured(var a : TGtkEntry) : guint; overload;
  130. procedure set_mouse_cursor_obscured(var a : TGtkEntry; __mouse_cursor_obscured : guint); overload;
  131. function gtk_entry_get_type:TGtkType; cdecl; external gtklib;
  132. function gtk_entry_new:PGtkWidget; cdecl; external gtklib;
  133. procedure gtk_entry_set_visibility(entry:PGtkEntry; visible:gboolean); cdecl; external gtklib;
  134. function gtk_entry_get_visibility(entry:PGtkEntry):gboolean; cdecl; external gtklib;
  135. procedure gtk_entry_set_invisible_char(entry:PGtkEntry; ch:gunichar); cdecl; external gtklib;
  136. function gtk_entry_get_invisible_char(entry:PGtkEntry):gunichar; cdecl; external gtklib;
  137. procedure gtk_entry_set_has_frame(entry:PGtkEntry; setting:gboolean); cdecl; external gtklib;
  138. function gtk_entry_get_has_frame(entry:PGtkEntry):gboolean; cdecl; external gtklib;
  139. { text is truncated if needed }
  140. procedure gtk_entry_set_max_length(entry:PGtkEntry; max:gint); cdecl; external gtklib;
  141. function gtk_entry_get_max_length(entry:PGtkEntry):gint; cdecl; external gtklib;
  142. procedure gtk_entry_set_activates_default(entry:PGtkEntry; setting:gboolean); cdecl; external gtklib;
  143. function gtk_entry_get_activates_default(entry:PGtkEntry):gboolean; cdecl; external gtklib;
  144. procedure gtk_entry_set_width_chars(entry:PGtkEntry; n_chars:gint); cdecl; external gtklib;
  145. function gtk_entry_get_width_chars(entry:PGtkEntry):gint; cdecl; external gtklib;
  146. { Somewhat more convenient than the GtkEditable generic functions
  147. }
  148. procedure gtk_entry_set_text(entry:PGtkEntry; text:Pgchar); cdecl; external gtklib;
  149. { returns a reference to the text }
  150. function gtk_entry_get_text(entry:PGtkEntry):Pgchar; cdecl; external gtklib;
  151. function gtk_entry_get_layout(entry:PGtkEntry):PPangoLayout; cdecl; external gtklib;
  152. procedure gtk_entry_get_layout_offsets(entry:PGtkEntry; x:Pgint; y:Pgint); cdecl; external gtklib;
  153. {$IFDEF HasGTK2_4}
  154. function gtk_entry_get_alignment(window:PGtkEntry): GFloat; cdecl; external gtklib;
  155. procedure gtk_entry_set_alignment(window:PGtkEntry; xalign: GFloat); cdecl; external gtklib;
  156. {$ENDIF HasGTK2_4}
  157. { Deprecated compatibility functions }
  158. {$ifndef GTK_DISABLE_DEPRECATED}
  159. function gtk_entry_new_with_max_length(max:gint):PGtkWidget; cdecl; external gtklib;
  160. procedure gtk_entry_append_text(entry:PGtkEntry; text:Pgchar); cdecl; external gtklib;
  161. procedure gtk_entry_prepend_text(entry:PGtkEntry; text:Pgchar); cdecl; external gtklib;
  162. procedure gtk_entry_set_position(entry:PGtkEntry; position:gint); cdecl; external gtklib;
  163. procedure gtk_entry_select_region(entry:PGtkEntry; start:gint; theEnd:gint); cdecl; external gtklib;
  164. procedure gtk_entry_set_editable(entry:PGtkEntry; editable:gboolean); cdecl; external gtklib;
  165. {$endif}
  166. { GTK_DISABLE_DEPRECATED }
  167. {$ENDIF read_interface_rest}
  168. //------------------------------------------------------------------------------
  169. {$IFDEF read_implementation}
  170. function GTK_TYPE_ENTRY : GType;
  171. begin
  172. GTK_TYPE_ENTRY:=gtk_entry_get_type;
  173. end;
  174. function GTK_ENTRY(obj: pointer) : PGtkEntry;
  175. begin
  176. GTK_ENTRY:=PGtkEntry(GTK_CHECK_CAST(obj,GTK_TYPE_ENTRY));
  177. end;
  178. function GTK_ENTRY_CLASS(klass: pointer) : PGtkEntryClass;
  179. begin
  180. GTK_ENTRY_CLASS:=PGtkEntryClass(GTK_CHECK_CLASS_CAST(klass,GTK_TYPE_ENTRY));
  181. end;
  182. function GTK_IS_ENTRY(obj: pointer) : boolean;
  183. begin
  184. GTK_IS_ENTRY:=GTK_CHECK_TYPE(obj,GTK_TYPE_ENTRY);
  185. end;
  186. function GTK_IS_ENTRY_CLASS(klass: pointer) : boolean;
  187. begin
  188. GTK_IS_ENTRY_CLASS:=GTK_CHECK_CLASS_TYPE(klass,GTK_TYPE_ENTRY);
  189. end;
  190. function GTK_ENTRY_GET_CLASS(obj: pointer) : PGtkEntryClass;
  191. begin
  192. GTK_ENTRY_GET_CLASS:=PGtkEntryClass(GTK_CHECK_GET_CLASS(obj,GTK_TYPE_ENTRY));
  193. end;
  194. function editable(var a : TGtkEntry) : guint;
  195. begin
  196. editable:=(a.flag0 and bm_TGtkEntry_editable) shr bp_TGtkEntry_editable;
  197. end;
  198. procedure set_editable(var a : TGtkEntry; __editable : guint);
  199. begin
  200. a.flag0:=a.flag0 or ((__editable shl bp_TGtkEntry_editable) and bm_TGtkEntry_editable);
  201. end;
  202. function visible(var a : TGtkEntry) : guint;
  203. begin
  204. visible:=(a.flag0 and bm_TGtkEntry_visible) shr bp_TGtkEntry_visible;
  205. end;
  206. procedure set_visible(var a : TGtkEntry; __visible : guint);
  207. begin
  208. a.flag0:=a.flag0 or ((__visible shl bp_TGtkEntry_visible) and bm_TGtkEntry_visible);
  209. end;
  210. function overwrite_mode(var a : TGtkEntry) : guint;
  211. begin
  212. overwrite_mode:=(a.flag0 and bm_TGtkEntry_overwrite_mode) shr bp_TGtkEntry_overwrite_mode;
  213. end;
  214. procedure set_overwrite_mode(var a : TGtkEntry; __overwrite_mode : guint);
  215. begin
  216. a.flag0:=a.flag0 or ((__overwrite_mode shl bp_TGtkEntry_overwrite_mode) and bm_TGtkEntry_overwrite_mode);
  217. end;
  218. function in_drag(var a : TGtkEntry) : guint;
  219. begin
  220. in_drag:=(a.flag0 and bm_TGtkEntry_in_drag) shr bp_TGtkEntry_in_drag;
  221. end;
  222. procedure set_in_drag(var a : TGtkEntry; __in_drag : guint);
  223. begin
  224. a.flag0:=a.flag0 or ((__in_drag shl bp_TGtkEntry_in_drag) and bm_TGtkEntry_in_drag);
  225. end;
  226. function cache_includes_preedit(var a : TGtkEntry) : guint;
  227. begin
  228. cache_includes_preedit:=(a.flag1 and bm_TGtkEntry_cache_includes_preedit) shr bp_TGtkEntry_cache_includes_preedit;
  229. end;
  230. procedure set_cache_includes_preedit(var a : TGtkEntry; __cache_includes_preedit : guint);
  231. begin
  232. a.flag1:=a.flag1 or ((__cache_includes_preedit shl bp_TGtkEntry_cache_includes_preedit) and bm_TGtkEntry_cache_includes_preedit);
  233. end;
  234. function need_im_reset(var a : TGtkEntry) : guint;
  235. begin
  236. need_im_reset:=(a.flag1 and bm_TGtkEntry_need_im_reset) shr bp_TGtkEntry_need_im_reset;
  237. end;
  238. procedure set_need_im_reset(var a : TGtkEntry; __need_im_reset : guint);
  239. begin
  240. a.flag1:=a.flag1 or ((__need_im_reset shl bp_TGtkEntry_need_im_reset) and bm_TGtkEntry_need_im_reset);
  241. end;
  242. function has_frame(var a : TGtkEntry) : guint;
  243. begin
  244. has_frame:=(a.flag1 and bm_TGtkEntry_has_frame) shr bp_TGtkEntry_has_frame;
  245. end;
  246. procedure set_has_frame(var a : TGtkEntry; __has_frame : guint);
  247. begin
  248. a.flag1:=a.flag1 or ((__has_frame shl bp_TGtkEntry_has_frame) and bm_TGtkEntry_has_frame);
  249. end;
  250. function activates_default(var a : TGtkEntry) : guint;
  251. begin
  252. activates_default:=(a.flag1 and bm_TGtkEntry_activates_default) shr bp_TGtkEntry_activates_default;
  253. end;
  254. procedure set_activates_default(var a : TGtkEntry; __activates_default : guint);
  255. begin
  256. a.flag1:=a.flag1 or ((__activates_default shl bp_TGtkEntry_activates_default) and bm_TGtkEntry_activates_default);
  257. end;
  258. function cursor_visible(var a : TGtkEntry) : guint;
  259. begin
  260. cursor_visible:=(a.flag1 and bm_TGtkEntry_cursor_visible) shr bp_TGtkEntry_cursor_visible;
  261. end;
  262. procedure set_cursor_visible(var a : TGtkEntry; __cursor_visible : guint);
  263. begin
  264. a.flag1:=a.flag1 or ((__cursor_visible shl bp_TGtkEntry_cursor_visible) and bm_TGtkEntry_cursor_visible);
  265. end;
  266. function in_click(var a : TGtkEntry) : guint;
  267. begin
  268. in_click:=(a.flag1 and bm_TGtkEntry_in_click) shr bp_TGtkEntry_in_click;
  269. end;
  270. procedure set_in_click(var a : TGtkEntry; __in_click : guint);
  271. begin
  272. a.flag1:=a.flag1 or ((__in_click shl bp_TGtkEntry_in_click) and bm_TGtkEntry_in_click);
  273. end;
  274. function is_cell_renderer(var a : TGtkEntry) : guint;
  275. begin
  276. is_cell_renderer:=(a.flag1 and bm_TGtkEntry_is_cell_renderer) shr bp_TGtkEntry_is_cell_renderer;
  277. end;
  278. procedure set_is_cell_renderer(var a : TGtkEntry; __is_cell_renderer : guint);
  279. begin
  280. a.flag1:=a.flag1 or ((__is_cell_renderer shl bp_TGtkEntry_is_cell_renderer) and bm_TGtkEntry_is_cell_renderer);
  281. end;
  282. function editing_canceled(var a : TGtkEntry) : guint;
  283. begin
  284. editing_canceled:=(a.flag1 and bm_TGtkEntry_editing_canceled) shr bp_TGtkEntry_editing_canceled;
  285. end;
  286. procedure set_editing_canceled(var a : TGtkEntry; __editing_canceled : guint);
  287. begin
  288. a.flag1:=a.flag1 or ((__editing_canceled shl bp_TGtkEntry_editing_canceled) and bm_TGtkEntry_editing_canceled);
  289. end;
  290. function mouse_cursor_obscured(var a : TGtkEntry) : guint;
  291. begin
  292. mouse_cursor_obscured:=(a.flag1 and bm_TGtkEntry_mouse_cursor_obscured) shr bp_TGtkEntry_mouse_cursor_obscured;
  293. end;
  294. procedure set_mouse_cursor_obscured(var a : TGtkEntry; __mouse_cursor_obscured : guint);
  295. begin
  296. a.flag1:=a.flag1 or ((__mouse_cursor_obscured shl bp_TGtkEntry_mouse_cursor_obscured) and bm_TGtkEntry_mouse_cursor_obscured);
  297. end;
  298. {$ENDIF read_implementation}
  299. // included by gtk2.pas