gtkentry.inc 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350
  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. function gtk_entry_get_completion(entry:PGtkEntry): PGtkEntryCompletion; cdecl; external gtklib;
  157. procedure gtk_entry_set_completion(entry:PGtkEntry; entryCompletion: PGtkEntryCompletion); cdecl; external gtklib;
  158. {$ENDIF HasGTK2_4}
  159. { Deprecated compatibility functions }
  160. {$ifndef GTK_DISABLE_DEPRECATED}
  161. function gtk_entry_new_with_max_length(max:gint):PGtkWidget; cdecl; external gtklib;
  162. procedure gtk_entry_append_text(entry:PGtkEntry; text:Pgchar); cdecl; external gtklib;
  163. procedure gtk_entry_prepend_text(entry:PGtkEntry; text:Pgchar); cdecl; external gtklib;
  164. procedure gtk_entry_set_position(entry:PGtkEntry; position:gint); cdecl; external gtklib;
  165. procedure gtk_entry_select_region(entry:PGtkEntry; start:gint; theEnd:gint); cdecl; external gtklib;
  166. procedure gtk_entry_set_editable(entry:PGtkEntry; editable:gboolean); cdecl; external gtklib;
  167. {$endif}
  168. { GTK_DISABLE_DEPRECATED }
  169. {$ENDIF read_interface_rest}
  170. //------------------------------------------------------------------------------
  171. {$IFDEF read_implementation}
  172. function GTK_TYPE_ENTRY : GType;
  173. begin
  174. GTK_TYPE_ENTRY:=gtk_entry_get_type;
  175. end;
  176. function GTK_ENTRY(obj: pointer) : PGtkEntry;
  177. begin
  178. GTK_ENTRY:=PGtkEntry(GTK_CHECK_CAST(obj,GTK_TYPE_ENTRY));
  179. end;
  180. function GTK_ENTRY_CLASS(klass: pointer) : PGtkEntryClass;
  181. begin
  182. GTK_ENTRY_CLASS:=PGtkEntryClass(GTK_CHECK_CLASS_CAST(klass,GTK_TYPE_ENTRY));
  183. end;
  184. function GTK_IS_ENTRY(obj: pointer) : boolean;
  185. begin
  186. GTK_IS_ENTRY:=GTK_CHECK_TYPE(obj,GTK_TYPE_ENTRY);
  187. end;
  188. function GTK_IS_ENTRY_CLASS(klass: pointer) : boolean;
  189. begin
  190. GTK_IS_ENTRY_CLASS:=GTK_CHECK_CLASS_TYPE(klass,GTK_TYPE_ENTRY);
  191. end;
  192. function GTK_ENTRY_GET_CLASS(obj: pointer) : PGtkEntryClass;
  193. begin
  194. GTK_ENTRY_GET_CLASS:=PGtkEntryClass(GTK_CHECK_GET_CLASS(obj,GTK_TYPE_ENTRY));
  195. end;
  196. function editable(var a : TGtkEntry) : guint;
  197. begin
  198. editable:=(a.flag0 and bm_TGtkEntry_editable) shr bp_TGtkEntry_editable;
  199. end;
  200. procedure set_editable(var a : TGtkEntry; __editable : guint);
  201. begin
  202. a.flag0:=a.flag0 or ((__editable shl bp_TGtkEntry_editable) and bm_TGtkEntry_editable);
  203. end;
  204. function visible(var a : TGtkEntry) : guint;
  205. begin
  206. visible:=(a.flag0 and bm_TGtkEntry_visible) shr bp_TGtkEntry_visible;
  207. end;
  208. procedure set_visible(var a : TGtkEntry; __visible : guint);
  209. begin
  210. a.flag0:=a.flag0 or ((__visible shl bp_TGtkEntry_visible) and bm_TGtkEntry_visible);
  211. end;
  212. function overwrite_mode(var a : TGtkEntry) : guint;
  213. begin
  214. overwrite_mode:=(a.flag0 and bm_TGtkEntry_overwrite_mode) shr bp_TGtkEntry_overwrite_mode;
  215. end;
  216. procedure set_overwrite_mode(var a : TGtkEntry; __overwrite_mode : guint);
  217. begin
  218. a.flag0:=a.flag0 or ((__overwrite_mode shl bp_TGtkEntry_overwrite_mode) and bm_TGtkEntry_overwrite_mode);
  219. end;
  220. function in_drag(var a : TGtkEntry) : guint;
  221. begin
  222. in_drag:=(a.flag0 and bm_TGtkEntry_in_drag) shr bp_TGtkEntry_in_drag;
  223. end;
  224. procedure set_in_drag(var a : TGtkEntry; __in_drag : guint);
  225. begin
  226. a.flag0:=a.flag0 or ((__in_drag shl bp_TGtkEntry_in_drag) and bm_TGtkEntry_in_drag);
  227. end;
  228. function cache_includes_preedit(var a : TGtkEntry) : guint;
  229. begin
  230. cache_includes_preedit:=(a.flag1 and bm_TGtkEntry_cache_includes_preedit) shr bp_TGtkEntry_cache_includes_preedit;
  231. end;
  232. procedure set_cache_includes_preedit(var a : TGtkEntry; __cache_includes_preedit : guint);
  233. begin
  234. a.flag1:=a.flag1 or ((__cache_includes_preedit shl bp_TGtkEntry_cache_includes_preedit) and bm_TGtkEntry_cache_includes_preedit);
  235. end;
  236. function need_im_reset(var a : TGtkEntry) : guint;
  237. begin
  238. need_im_reset:=(a.flag1 and bm_TGtkEntry_need_im_reset) shr bp_TGtkEntry_need_im_reset;
  239. end;
  240. procedure set_need_im_reset(var a : TGtkEntry; __need_im_reset : guint);
  241. begin
  242. a.flag1:=a.flag1 or ((__need_im_reset shl bp_TGtkEntry_need_im_reset) and bm_TGtkEntry_need_im_reset);
  243. end;
  244. function has_frame(var a : TGtkEntry) : guint;
  245. begin
  246. has_frame:=(a.flag1 and bm_TGtkEntry_has_frame) shr bp_TGtkEntry_has_frame;
  247. end;
  248. procedure set_has_frame(var a : TGtkEntry; __has_frame : guint);
  249. begin
  250. a.flag1:=a.flag1 or ((__has_frame shl bp_TGtkEntry_has_frame) and bm_TGtkEntry_has_frame);
  251. end;
  252. function activates_default(var a : TGtkEntry) : guint;
  253. begin
  254. activates_default:=(a.flag1 and bm_TGtkEntry_activates_default) shr bp_TGtkEntry_activates_default;
  255. end;
  256. procedure set_activates_default(var a : TGtkEntry; __activates_default : guint);
  257. begin
  258. a.flag1:=a.flag1 or ((__activates_default shl bp_TGtkEntry_activates_default) and bm_TGtkEntry_activates_default);
  259. end;
  260. function cursor_visible(var a : TGtkEntry) : guint;
  261. begin
  262. cursor_visible:=(a.flag1 and bm_TGtkEntry_cursor_visible) shr bp_TGtkEntry_cursor_visible;
  263. end;
  264. procedure set_cursor_visible(var a : TGtkEntry; __cursor_visible : guint);
  265. begin
  266. a.flag1:=a.flag1 or ((__cursor_visible shl bp_TGtkEntry_cursor_visible) and bm_TGtkEntry_cursor_visible);
  267. end;
  268. function in_click(var a : TGtkEntry) : guint;
  269. begin
  270. in_click:=(a.flag1 and bm_TGtkEntry_in_click) shr bp_TGtkEntry_in_click;
  271. end;
  272. procedure set_in_click(var a : TGtkEntry; __in_click : guint);
  273. begin
  274. a.flag1:=a.flag1 or ((__in_click shl bp_TGtkEntry_in_click) and bm_TGtkEntry_in_click);
  275. end;
  276. function is_cell_renderer(var a : TGtkEntry) : guint;
  277. begin
  278. is_cell_renderer:=(a.flag1 and bm_TGtkEntry_is_cell_renderer) shr bp_TGtkEntry_is_cell_renderer;
  279. end;
  280. procedure set_is_cell_renderer(var a : TGtkEntry; __is_cell_renderer : guint);
  281. begin
  282. a.flag1:=a.flag1 or ((__is_cell_renderer shl bp_TGtkEntry_is_cell_renderer) and bm_TGtkEntry_is_cell_renderer);
  283. end;
  284. function editing_canceled(var a : TGtkEntry) : guint;
  285. begin
  286. editing_canceled:=(a.flag1 and bm_TGtkEntry_editing_canceled) shr bp_TGtkEntry_editing_canceled;
  287. end;
  288. procedure set_editing_canceled(var a : TGtkEntry; __editing_canceled : guint);
  289. begin
  290. a.flag1:=a.flag1 or ((__editing_canceled shl bp_TGtkEntry_editing_canceled) and bm_TGtkEntry_editing_canceled);
  291. end;
  292. function mouse_cursor_obscured(var a : TGtkEntry) : guint;
  293. begin
  294. mouse_cursor_obscured:=(a.flag1 and bm_TGtkEntry_mouse_cursor_obscured) shr bp_TGtkEntry_mouse_cursor_obscured;
  295. end;
  296. procedure set_mouse_cursor_obscured(var a : TGtkEntry; __mouse_cursor_obscured : guint);
  297. begin
  298. a.flag1:=a.flag1 or ((__mouse_cursor_obscured shl bp_TGtkEntry_mouse_cursor_obscured) and bm_TGtkEntry_mouse_cursor_obscured);
  299. end;
  300. {$ENDIF read_implementation}
  301. // included by gtk2.pas