; -*- scheme -*-
;; Editable

(define-object GtkEditable (GtkWidget) 
  (fields (uint selection_start_pos)
	  (uint selection_end_pos)))

(define-func gtk_editable_select_region
  none
  ((GtkEditable editable)
   (int start) (int end)))

;gtk_editable_insert_text
(define-func gtk_editable_delete_text
  none
  ((GtkEditable editable)
   (int start) (int end)))

(define-func gtk_editable_get_chars
  string
  ((GtkEditable editable)
   (int start) (int end)))

(define-func gtk_editable_cut_clipboard
  none
  ((GtkEditable edtiable)))

(define-func gtk_editable_copy_clipboard
  none
  ((GtkEditable editable)))

(define-func gtk_editable_paste_clipboard
  none
  ((GtkEditable editable)))

(define-func gtk_editable_claim_selection
  none
  ((GtkEditable editable)
   (bool claim)
   (uint time)))

(define-func gtk_editable_delete_selection
  none
  ((GtkEditable editable)))

(define-func gtk_editable_changed
  none
  ((GtkEditable editable)))

(define-func gtk_editable_set_position
  none
  ((GtkEditable editable)
   (int position)))

(define-func gtk_editable_get_position
  int
  ((GtkEditable editable)))

(define-func gtk_editable_set_editable
  none
  ((GtkEditable editable)
   (bool is_editable)))

;; Entry

(define-object GtkEntry (GtkEditable))

(define-func gtk_entry_new
  GtkWidget
  ())

(define-func gtk_entry_new_with_max_length 
  GtkWidget
;; should actually be int16 - does it matter?
  ((int max)))

(define-func gtk_entry_set_text
  none
  ((GtkEntry entry)
   (string text)))

(define-func gtk_entry_append_text
  none
  ((GtkEntry entry)
   (string text)))

(define-func gtk_entry_prepend_text
  none
  ((GtkEntry entry)
   (string text)))

(define-func gtk_entry_set_position
  none
  ((GtkEntry entry)
   (int position)))

(define-func gtk_entry_get_text
  static_string
  ((GtkEntry entry)))

(define-func gtk_entry_select_region
  none
  ((GtkEntry entry)
   (int start)
   (int end)))

(define-func gtk_entry_set_visibility
  none
  ((GtkEntry entry)
   (bool visible)))

(define-func gtk_entry_set_editable
  none
  ((GtkEntry entry)
   (bool editable)))

(define-func gtk_entry_set_max_length
  none
  ((GtkEntry entry)
   (uint max)))

;; SpinButton

(define-object GtkSpinButton (GtkEntry))

(define-func gtk_spin_button_new   
  GtkWidget
  ((GtkAdjustment adjustment (null-ok))
   (float climb_rate)
   (uint digits)))

(define-func gtk_spin_button_set_adjustment 
  none
  ((GtkSpinButton spin_button)
   (GtkAdjustment adjustment)))

(define-func gtk_spin_button_get_adjustment 
  GtkAdjustment
  ((GtkSpinButton spin_button)))

(define-func gtk_spin_button_set_digits 
  none
  ((GtkSpinButton spin_button)
   (uint digits)))

(define-func gtk_spin_button_get_value_as_float 
  float 
  ((GtkSpinButton spin_button)))

(define-func gtk_spin_button_get_value_as_int  
  int
  ((GtkSpinButton spin_button)))

(define-func gtk_spin_button_set_value 
  none
  ((GtkSpinButton spin_button) 
   (float value)))

(define-func gtk_spin_button_set_update_policy 
  none
  ((GtkSpinButton spin_button)
   (GtkSpinButtonUpdatePolicy policy)))

(define-func gtk_spin_button_set_numeric
  none
  ((GtkSpinButton spin_button)
   (bool numeric)))

(define-func gtk_spin_button_spin
  none
  ((GtkSpinButton spin_button)
   (GtkSpinType direction)
   (float increment)))

(define-func gtk_spin_button_set_wrap
  none
  ((GtkSpinButton spin_button)
   (bool wrap)))

(define-func gtk_spin_button_set_shadow_type
  none
  ((GtkSpinButton spin_button)
   (GtkShadowType shadow_type)))

(define-func gtk_spin_button_set_snap_to_ticks
  none
  ((GtkSpinButton spin_button)
   (bool snap_to_ticks)))

(define-func gtk_spin_button_update
  none
  ((GtkSpinButton spin_button)))

;; Text

(define-object GtkText (GtkEditable)
  (fields
   (GtkAdjustment hadj)
   (GtkAdjustment vadj)))

(define-func gtk_text_new
  GtkWidget
  ((GtkAdjustment hadj (null-ok) (= "NULL"))
   (GtkAdjustment vadj (null-ok) (= "NULL"))))

(define-func gtk_text_set_editable
  none
  ((GtkText text)
   (bool editable)))

(define-func gtk_text_set_word_wrap
  none
  ((GtkText text)
   (int word_wrap)))

(define-func gtk_text_set_line_wrap
  none
  ((GtkText text)
   (int line_wrap)))

(define-func gtk_text_set_adjustments
  none
  ((GtkText text)
   (GtkAdjustment hadj (null-ok))
   (GtkAdjustment vadj (null-ok))))

(define-func gtk_text_set_point
  none
  ((GtkText text)
   (uint index)))

(define-func gtk_text_get_point
  uint
  ((GtkText text)))

(define-func gtk_text_get_length
  uint
  ((GtkText text)))

(define-func gtk_text_freeze
  none
  ((GtkText text)))

(define-func gtk_text_thaw
  none
  ((GtkText text)))

(define-func gtk_text_insert
  none
  ((GtkText text)
   (GdkFont font (null-ok))
   (GdkColor fore (null-ok))
   (GdkColor back (null-ok))
   (string chars)
   (int length)))

(define-func gtk_text_backward_delete
  none
  ((GtkText text)
   (uint nchars)))

(define-func gtk_text_forward_delete
  none
  ((GtkText text)
   (uint nchars)))

