25'ten fazla konu seçemezsiniz Konular bir harf veya rakamla başlamalı, kısa çizgiler ('-') içerebilir ve en fazla 35 karakter uzunluğunda olabilir.
 
 
 
 
 
 

335 satır
15 KiB

  1. /* GTK - The GIMP Toolkit
  2. * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
  3. *
  4. * Copyright (C) 2004-2006 Christian Hammond
  5. * Copyright (C) 2008 Cody Russell
  6. * Copyright (C) 2008 Red Hat, Inc.
  7. *
  8. * This library is free software; you can redistribute it and/or
  9. * modify it under the terms of the GNU Lesser General Public
  10. * License as published by the Free Software Foundation; either
  11. * version 2 of the License, or (at your option) any later version.
  12. *
  13. * This library is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  16. * Lesser General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU Lesser General Public
  19. * License along with this library; if not, write to the
  20. * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
  21. * Boston, MA 02111-1307, USA.
  22. */
  23. /*
  24. * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
  25. * file for a list of people on the GTK+ Team. See the ChangeLog
  26. * files for a list of changes. These files are distributed with
  27. * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
  28. */
  29. #if defined(GTK_DISABLE_SINGLE_INCLUDES) && !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION)
  30. #error "Only <gtk/gtk.h> can be included directly."
  31. #endif
  32. #ifndef __GTK_ENTRY_H__
  33. #define __GTK_ENTRY_H__
  34. #include <gtk/gtkeditable.h>
  35. #include <gtk/gtkimcontext.h>
  36. #include <gtk/gtkmenu.h>
  37. #include <gtk/gtkentrybuffer.h>
  38. #include <gtk/gtkentrycompletion.h>
  39. #include <gtk/gtkimage.h>
  40. #include <gtk/gtkselection.h>
  41. G_BEGIN_DECLS
  42. #define GTK_TYPE_ENTRY (gtk_entry_get_type ())
  43. #define GTK_ENTRY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_ENTRY, GtkEntry))
  44. #define GTK_ENTRY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_ENTRY, GtkEntryClass))
  45. #define GTK_IS_ENTRY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_ENTRY))
  46. #define GTK_IS_ENTRY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_ENTRY))
  47. #define GTK_ENTRY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_ENTRY, GtkEntryClass))
  48. typedef enum
  49. {
  50. GTK_ENTRY_ICON_PRIMARY,
  51. GTK_ENTRY_ICON_SECONDARY
  52. } GtkEntryIconPosition;
  53. typedef struct _GtkEntry GtkEntry;
  54. typedef struct _GtkEntryClass GtkEntryClass;
  55. struct _GtkEntry
  56. {
  57. GtkWidget widget;
  58. gchar *GSEAL (text); /* COMPAT: Deprecated, not used. Remove in GTK+ 3.x */
  59. guint GSEAL (editable) : 1;
  60. guint GSEAL (visible) : 1;
  61. guint GSEAL (overwrite_mode) : 1;
  62. guint GSEAL (in_drag) : 1; /* FIXME: Should be private?
  63. Dragging within the selection */
  64. guint16 GSEAL (text_length); /* COMPAT: Deprecated, not used. Remove in GTK+ 3.x */
  65. guint16 GSEAL (text_max_length); /* COMPAT: Deprecated, not used. Remove in GTK+ 3.x */
  66. /*< private >*/
  67. GdkWindow *GSEAL (text_area);
  68. GtkIMContext *GSEAL (im_context);
  69. GtkWidget *GSEAL (popup_menu);
  70. gint GSEAL (current_pos);
  71. gint GSEAL (selection_bound);
  72. PangoLayout *GSEAL (cached_layout);
  73. guint GSEAL (cache_includes_preedit) : 1;
  74. guint GSEAL (need_im_reset) : 1;
  75. guint GSEAL (has_frame) : 1;
  76. guint GSEAL (activates_default) : 1;
  77. guint GSEAL (cursor_visible) : 1;
  78. guint GSEAL (in_click) : 1; /* Flag so we don't select all when clicking in entry to focus in */
  79. guint GSEAL (is_cell_renderer) : 1;
  80. guint GSEAL (editing_canceled) : 1; /* Only used by GtkCellRendererText */
  81. guint GSEAL (mouse_cursor_obscured) : 1;
  82. guint GSEAL (select_words) : 1;
  83. guint GSEAL (select_lines) : 1;
  84. guint GSEAL (resolved_dir) : 4; /* PangoDirection */
  85. guint GSEAL (truncate_multiline) : 1;
  86. guint GSEAL (button);
  87. guint GSEAL (blink_timeout);
  88. guint GSEAL (recompute_idle);
  89. gint GSEAL (scroll_offset);
  90. gint GSEAL (ascent); /* font ascent in pango units */
  91. gint GSEAL (descent); /* font descent in pango units */
  92. guint16 GSEAL (x_text_size); /* allocated size, in bytes */
  93. guint16 GSEAL (x_n_bytes); /* length in use, in bytes */
  94. guint16 GSEAL (preedit_length); /* length of preedit string, in bytes */
  95. guint16 GSEAL (preedit_cursor); /* offset of cursor within preedit string, in chars */
  96. gint GSEAL (dnd_position); /* In chars, -1 == no DND cursor */
  97. gint GSEAL (drag_start_x);
  98. gint GSEAL (drag_start_y);
  99. gunichar GSEAL (invisible_char);
  100. gint GSEAL (width_chars);
  101. };
  102. struct _GtkEntryClass
  103. {
  104. GtkWidgetClass parent_class;
  105. /* Hook to customize right-click popup */
  106. void (* populate_popup) (GtkEntry *entry,
  107. GtkMenu *menu);
  108. /* Action signals
  109. */
  110. void (* activate) (GtkEntry *entry);
  111. void (* move_cursor) (GtkEntry *entry,
  112. GtkMovementStep step,
  113. gint count,
  114. gboolean extend_selection);
  115. void (* insert_at_cursor) (GtkEntry *entry,
  116. const gchar *str);
  117. void (* delete_from_cursor) (GtkEntry *entry,
  118. GtkDeleteType type,
  119. gint count);
  120. void (* backspace) (GtkEntry *entry);
  121. void (* cut_clipboard) (GtkEntry *entry);
  122. void (* copy_clipboard) (GtkEntry *entry);
  123. void (* paste_clipboard) (GtkEntry *entry);
  124. void (* toggle_overwrite) (GtkEntry *entry);
  125. /* hook to add other objects beside the entry (like in GtkSpinButton) */
  126. void (* get_text_area_size) (GtkEntry *entry,
  127. gint *x,
  128. gint *y,
  129. gint *width,
  130. gint *height);
  131. /* Padding for future expansion */
  132. void (*_gtk_reserved1) (void);
  133. void (*_gtk_reserved2) (void);
  134. };
  135. GType gtk_entry_get_type (void) G_GNUC_CONST;
  136. GtkWidget* gtk_entry_new (void);
  137. GtkWidget* gtk_entry_new_with_buffer (GtkEntryBuffer *buffer);
  138. GtkEntryBuffer* gtk_entry_get_buffer (GtkEntry *entry);
  139. void gtk_entry_set_buffer (GtkEntry *entry,
  140. GtkEntryBuffer *buffer);
  141. GdkWindow *gtk_entry_get_text_window (GtkEntry *entry);
  142. void gtk_entry_set_visibility (GtkEntry *entry,
  143. gboolean visible);
  144. gboolean gtk_entry_get_visibility (GtkEntry *entry);
  145. void gtk_entry_set_invisible_char (GtkEntry *entry,
  146. gunichar ch);
  147. gunichar gtk_entry_get_invisible_char (GtkEntry *entry);
  148. void gtk_entry_unset_invisible_char (GtkEntry *entry);
  149. void gtk_entry_set_has_frame (GtkEntry *entry,
  150. gboolean setting);
  151. gboolean gtk_entry_get_has_frame (GtkEntry *entry);
  152. void gtk_entry_set_inner_border (GtkEntry *entry,
  153. const GtkBorder *border);
  154. G_CONST_RETURN GtkBorder* gtk_entry_get_inner_border (GtkEntry *entry);
  155. void gtk_entry_set_overwrite_mode (GtkEntry *entry,
  156. gboolean overwrite);
  157. gboolean gtk_entry_get_overwrite_mode (GtkEntry *entry);
  158. /* text is truncated if needed */
  159. void gtk_entry_set_max_length (GtkEntry *entry,
  160. gint max);
  161. gint gtk_entry_get_max_length (GtkEntry *entry);
  162. guint16 gtk_entry_get_text_length (GtkEntry *entry);
  163. void gtk_entry_set_activates_default (GtkEntry *entry,
  164. gboolean setting);
  165. gboolean gtk_entry_get_activates_default (GtkEntry *entry);
  166. void gtk_entry_set_width_chars (GtkEntry *entry,
  167. gint n_chars);
  168. gint gtk_entry_get_width_chars (GtkEntry *entry);
  169. /* Somewhat more convenient than the GtkEditable generic functions
  170. */
  171. void gtk_entry_set_text (GtkEntry *entry,
  172. const gchar *text);
  173. /* returns a reference to the text */
  174. G_CONST_RETURN gchar* gtk_entry_get_text (GtkEntry *entry);
  175. PangoLayout* gtk_entry_get_layout (GtkEntry *entry);
  176. void gtk_entry_get_layout_offsets (GtkEntry *entry,
  177. gint *x,
  178. gint *y);
  179. void gtk_entry_set_alignment (GtkEntry *entry,
  180. gfloat xalign);
  181. gfloat gtk_entry_get_alignment (GtkEntry *entry);
  182. void gtk_entry_set_completion (GtkEntry *entry,
  183. GtkEntryCompletion *completion);
  184. GtkEntryCompletion *gtk_entry_get_completion (GtkEntry *entry);
  185. gint gtk_entry_layout_index_to_text_index (GtkEntry *entry,
  186. gint layout_index);
  187. gint gtk_entry_text_index_to_layout_index (GtkEntry *entry,
  188. gint text_index);
  189. /* For scrolling cursor appropriately
  190. */
  191. void gtk_entry_set_cursor_hadjustment (GtkEntry *entry,
  192. GtkAdjustment *adjustment);
  193. GtkAdjustment* gtk_entry_get_cursor_hadjustment (GtkEntry *entry);
  194. /* Progress API
  195. */
  196. void gtk_entry_set_progress_fraction (GtkEntry *entry,
  197. gdouble fraction);
  198. gdouble gtk_entry_get_progress_fraction (GtkEntry *entry);
  199. void gtk_entry_set_progress_pulse_step (GtkEntry *entry,
  200. gdouble fraction);
  201. gdouble gtk_entry_get_progress_pulse_step (GtkEntry *entry);
  202. void gtk_entry_progress_pulse (GtkEntry *entry);
  203. /* Setting and managing icons
  204. */
  205. void gtk_entry_set_icon_from_pixbuf (GtkEntry *entry,
  206. GtkEntryIconPosition icon_pos,
  207. GdkPixbuf *pixbuf);
  208. void gtk_entry_set_icon_from_stock (GtkEntry *entry,
  209. GtkEntryIconPosition icon_pos,
  210. const gchar *stock_id);
  211. void gtk_entry_set_icon_from_icon_name (GtkEntry *entry,
  212. GtkEntryIconPosition icon_pos,
  213. const gchar *icon_name);
  214. void gtk_entry_set_icon_from_gicon (GtkEntry *entry,
  215. GtkEntryIconPosition icon_pos,
  216. GIcon *icon);
  217. GtkImageType gtk_entry_get_icon_storage_type (GtkEntry *entry,
  218. GtkEntryIconPosition icon_pos);
  219. GdkPixbuf* gtk_entry_get_icon_pixbuf (GtkEntry *entry,
  220. GtkEntryIconPosition icon_pos);
  221. const gchar* gtk_entry_get_icon_stock (GtkEntry *entry,
  222. GtkEntryIconPosition icon_pos);
  223. const gchar* gtk_entry_get_icon_name (GtkEntry *entry,
  224. GtkEntryIconPosition icon_pos);
  225. GIcon* gtk_entry_get_icon_gicon (GtkEntry *entry,
  226. GtkEntryIconPosition icon_pos);
  227. void gtk_entry_set_icon_activatable (GtkEntry *entry,
  228. GtkEntryIconPosition icon_pos,
  229. gboolean activatable);
  230. gboolean gtk_entry_get_icon_activatable (GtkEntry *entry,
  231. GtkEntryIconPosition icon_pos);
  232. void gtk_entry_set_icon_sensitive (GtkEntry *entry,
  233. GtkEntryIconPosition icon_pos,
  234. gboolean sensitive);
  235. gboolean gtk_entry_get_icon_sensitive (GtkEntry *entry,
  236. GtkEntryIconPosition icon_pos);
  237. gint gtk_entry_get_icon_at_pos (GtkEntry *entry,
  238. gint x,
  239. gint y);
  240. void gtk_entry_set_icon_tooltip_text (GtkEntry *entry,
  241. GtkEntryIconPosition icon_pos,
  242. const gchar *tooltip);
  243. gchar * gtk_entry_get_icon_tooltip_text (GtkEntry *entry,
  244. GtkEntryIconPosition icon_pos);
  245. void gtk_entry_set_icon_tooltip_markup (GtkEntry *entry,
  246. GtkEntryIconPosition icon_pos,
  247. const gchar *tooltip);
  248. gchar * gtk_entry_get_icon_tooltip_markup (GtkEntry *entry,
  249. GtkEntryIconPosition icon_pos);
  250. void gtk_entry_set_icon_drag_source (GtkEntry *entry,
  251. GtkEntryIconPosition icon_pos,
  252. GtkTargetList *target_list,
  253. GdkDragAction actions);
  254. gint gtk_entry_get_current_icon_drag_source (GtkEntry *entry);
  255. GdkWindow * gtk_entry_get_icon_window (GtkEntry *entry,
  256. GtkEntryIconPosition icon_pos);
  257. gboolean gtk_entry_im_context_filter_keypress (GtkEntry *entry,
  258. GdkEventKey *event);
  259. void gtk_entry_reset_im_context (GtkEntry *entry);
  260. /* Deprecated compatibility functions
  261. */
  262. #ifndef GTK_DISABLE_DEPRECATED
  263. GtkWidget* gtk_entry_new_with_max_length (gint max);
  264. void gtk_entry_append_text (GtkEntry *entry,
  265. const gchar *text);
  266. void gtk_entry_prepend_text (GtkEntry *entry,
  267. const gchar *text);
  268. void gtk_entry_set_position (GtkEntry *entry,
  269. gint position);
  270. void gtk_entry_select_region (GtkEntry *entry,
  271. gint start,
  272. gint end);
  273. void gtk_entry_set_editable (GtkEntry *entry,
  274. gboolean editable);
  275. #endif /* GTK_DISABLE_DEPRECATED */
  276. G_END_DECLS
  277. #endif /* __GTK_ENTRY_H__ */