Hide new functions in Gdk-2.18 behind conditional read
[cl-gtk2.git] / gtk / gtk.entry.lisp
blobc4362aed040aaee94f91850534977ca7f45e5e6b
1 (in-package :gtk)
3 ;; GtkEntry
5 (defcfun gtk-entry-get-layout-offsets :void
6 (entry (g-object entry))
7 (x (:pointer :int))
8 (y (:pointer :int)))
10 (defun gtk-entry-layout-offset (entry)
11 (with-foreign-objects ((x :int) (y :int))
12 (gtk-entry-get-layout-offsets entry x y)
13 (list (mem-ref x :int) (mem-ref y :int))))
15 (defcfun (entry-layout-index-to-text-index "gtk_entry_layout_index_to_text_index") :int
16 (entry (g-object entry))
17 (layout-index :int))
19 (export 'entry-layout-index-to-text-index)
21 (defcfun (entry-text-index-to-layout-index "gtk_entry_text_index_to_layout_index") :int
22 (entry (g-object entry))
23 (text-index :int))
25 (export 'entry-text-index-to-layout-info)
27 (defcfun (entry-icon-at-pos "gtk_entry_get_icon_at_pos") :int
28 (entry (g-object entry))
29 (x :int)
30 (y :int))
32 (export 'entry-icon-at-pos)
34 (defcfun (entry-progress-pulse "gtk_entry_progress_pulse") :void
35 (entry (g-object entry)))
37 (export 'entry-progress-pulse)
39 ;; GtkEditable
41 (defcfun (editable-select-region "gtk_editable_select_region") :void
42 (editable (g-object editable))
43 (start :int)
44 (end :int))
46 (export 'editable-select-region)
48 (defcfun gtk-editable-get-selection-bounds :boolean
49 (editable (g-object editable))
50 (start (:pointer :int))
51 (end (:pointer :int)))
53 (defun editable-selection (editable)
54 (with-foreign-objects ((start :int) (end :int))
55 (let ((selected-p (gtk-editable-get-selection-bounds editable start end)))
56 (values selected-p (mem-ref start :int) (mem-ref end :int)))))
58 (export 'editable-selection)
60 (defcfun gtk-editable-insert-text :void
61 (editable (g-object editable))
62 (new-text :string)
63 (new-text-length :int)
64 (position (:pointer :int)))
66 (defun editable-insert-text (editable text position)
67 (with-foreign-object (pos :int)
68 (setf (mem-ref pos :int) position)
69 (gtk-editable-insert-text editable text (length text) pos)
70 (mem-ref pos :int)))
72 (export 'editable-insert-text)
74 (defcfun gtk-editable-delete-text :void
75 (editable (g-object editable))
76 (start-pos :int)
77 (end-pos :int))
79 (defun editable-delete-text (editable &key start-pos end-pos)
80 (gtk-editable-delete-text editable (or start-pos -1) (or end-pos -1)))
82 (export 'editable-delete-text)
84 (defcfun gtk-editable-get-chars g-string
85 (editable (g-object editable))
86 (start-pos :int)
87 (end-pos :int))
89 (defun editable-get-chars (editable &key (start 0) (end -1))
90 (gtk-editable-get-chars editable start end))
92 (export 'editable-get-chars)
94 (defcfun (editable-cut-clipboard "gtk_editable_cut_clipboard") :void
95 (editable (g-object editable)))
97 (export 'editable-cut-clipboard)
99 (defcfun (editable-copy-clipboard "gtk_editable_copy_clipboard") :void
100 (editable (g-object editable)))
102 (export 'editable-copy-clipboard)
104 (defcfun (editable-paste-clipboard "gtk_editable_paste_clipboard") :void
105 (editable (g-object editable)))
107 (export 'editable-paste-clipboard)
109 (defcfun (editable-delete-selection "gtk_editable_delete_selection") :void
110 (editable (g-object editable)))
112 (export 'editable-delete-selection)
114 ;; GtkEntryCompletion
116 (define-cb-methods entry-completion-match-func :boolean
117 ((completion (g-object entry-completion))
118 (key :string)
119 (iter (g-boxed-foreign tree-iter))))
121 (defcfun (%gtk-entry-completion-set-match-func "gtk_entry_completion_set_match_func") :void
122 (completion (g-object entry-completion))
123 (func :pointer)
124 (data :pointer)
125 (destroy-notify :pointer))
127 (defun gtk-entry-completion-set-match-func (completion function)
128 (if function
129 (%gtk-entry-completion-set-match-func completion
130 (callback entry-completion-match-func-cb)
131 (create-fn-ref completion function)
132 (callback entry-completion-match-func-destroy-notify))
133 (%gtk-entry-completion-set-match-func completion
134 (null-pointer)
135 (null-pointer)
136 (null-pointer))))
138 (defcfun (entry-completion-complete "gtk_entry_completion_complete") :void
139 (completion (g-object entry-completion)))
141 (export 'entry-completion-complete)
143 (defcfun (entry-completion-completion-prefix "gtk_entry_completion_get_completion_prefix") (:string :free-from-foreign t)
144 (completion (g-object entry-completion)))
146 (export 'entry-completion-completion-prefix)
148 (defcfun (entry-completion-insert-prefix "gtk_entry_completion_insert_prefix") :void
149 (completion (g-object entry-completion)))
151 (export 'entry-completion-completion-prefix)
153 (defcfun (entry-completion-insert-action-text "gtk_entry_completion_insert_action_text") :void
154 (completion (g-object entry-completion))
155 (index :int)
156 (text :string))
158 (export 'entry-completion-insert-action-text)
160 (defcfun (entry-copmletion-insert-action-markup "gtk_entry_completion_insert_action_markup") :void
161 (completion (g-object entry-completion))
162 (index :int)
163 (markup :string))
165 (export 'entry-completion-insert-action-markup)
167 (defcfun (entry-completion-delete-action "gtk_entry_completion_delete_action") :void
168 (completion (g-object entry-completion))
169 (index :int))
171 (export 'entry-completion-delete-action)