From: Dmitry Kalyanov Date: Mon, 16 Mar 2009 23:43:58 +0000 (+0300) Subject: initial attempt at tree-view X-Git-Url: http://repo.macrolet.net/gitweb/?a=commitdiff_plain;h=51aa0c04d9522fa9c17555cc779036aa9703ef02;p=cl-gtk2.git initial attempt at tree-view --- diff --git a/generating.lisp b/generating.lisp index b6dff32..9ba1034 100644 --- a/generating.lisp +++ b/generating.lisp @@ -64,11 +64,56 @@ "GtkTextBuffer" "GtkTextChildAnchor" "GtkTextMark" "GtkTextTag" "GtkTextTagTable" "GtkTreeModelFilter" "GtkTreeModelSort" "GtkTreeSelection" "GtkTreeStore" "GtkUIManager" "GtkWindowGroup") - :flags '("GtkTextSearchFlags") - :enums '("GtkTextBufferTargetInfo") + :flags '("GtkTextSearchFlags" "GtkAccelFlags" "GtkArgFlags" "GtkAttachOptions" + "GtkButtonAction" "GtkCalendarDisplayOptions" "GtkCellRendererState" + "GtkDebugFlag" "GtkDestDefaults" "GtkDialogFlags" "GtkFileFilterFlags" + "GtkIconLookupFlags" "GtkObjectFlags" "GtkPrivateFlags" "GtkRcFlags" + "GtkRecentFilterFlags" "GtkSignalRunType" "GtkTargetFlags" + "GtkTreeModelFlags" "GtkUIManagerItemType" "GtkWidgetFlags") + :enums '("GtkTextDirection" "GtkSizeGroupMode" "GtkUnit" "GtkPrintStatus" + "GtkRecentSortType" "GtkFileChooserAction" "GtkCellRendererAccelMode" + "GtkCellRendererMode" "GtkTreeViewColumnSizing" + "GtkProgressBarOrientation" "GtkProgressBarStyle" "GtkUpdateType" + "GtkMetricType" "GtkSpinButtonUpdatePolicy" "GtkCurveType" "GtkImageType" + "GtkArrowType" "GtkSortType" "GtkToolbarStyle" "GtkWrapMode" + "GtkJustification" "GtkButtonBoxStyle" "GtkSelectionMode" + "GtkTreeViewGridLines" "GtkPackDirection" "GtkPolicyType" "GtkCornerType" + "GtkSensitivityType" "GtkShadowType" "GtkIconSize" "GtkOrientation" + "GtkPositionType" "GtkReliefStyle" "GtkMessageType" "GtkButtonsType" + "GtkWindowType" "GtkWindowPosition" "GtkResizeMode" + "GtkTextBufferTargetInfo" "GtkStateType" "GtkDirectionType" + "GtkDragResult" "GtkWidgetHelpType" "GtkPackType" "GtkNotebookTab" + "GtkMovementStep" "GtkAnchorType" "GtkAssistantPageType" + "GtkBuilderError" "GtkCellType" "GtkCListDragPos" "GtkCTreeExpanderStyle" + "GtkCTreeExpansionType" "GtkCTreeLineStyle" "GtkCTreePos" "GtkDeleteType" + "GtkExpanderStyle" "GtkFileChooserConfirmation" "GtkFileChooserError" + "GtkIconThemeError" "GtkIconViewDropPosition" "GtkIMPreeditStyle" + "GtkIMStatusStyle" "GtkMatchType" "GtkMenuDirectionType" + "GtkNumberUpLayout" "GtkPageOrientation" "GtkPageSet" + "GtkPathPriorityType" "GtkPathType" "GtkPreviewType" "GtkPrintDuplex" + "GtkPrintError" "GtkPrintOperationAction" "GtkPrintOperationResult" + "GtkPrintPages" "GtkPrintQuality" "GtkRcTokenType" + "GtkRecentChooserError" "GtkRecentManagerError" "GtkResponseType" + "GtkScrollStep" "GtkScrollType" "GtkSideType" "GtkSpinType" + "GtkSubmenuDirection" "GtkSubmenuPlacement" "GtkTextWindowType" + "GtkToolbarChildType" "GtkToolbarSpaceStyle" "GtkTreeViewDropPosition" + "GtkTreeViewMode" "GtkVisibility") :exclusions '("PangoStretch" "PangoVariant" "PangoStyle" "PangoUnderline") :additional-properties '(("GtkTreeViewColumn" (:cffi gtk::tree-view gtk::tree-view-column-tree-view g-object "gtk_tree_view_column_get_tree_view" nil) (:cffi gtk::sort-column-id gtk::tree-view-column-sort-column-id :int "gtk_tree_view_column_get_sort_column_id" "gtk_tree_view_column_set_sort_column_id") - (:cffi gtk::cell-renderers gtk::tree-view-column-cell-renderers (glist g-object :free-from-foreign t) "gtk_tree_view_column_get_cell_renderers" nil)))))) \ No newline at end of file + (:cffi gtk::cell-renderers gtk::tree-view-column-cell-renderers (glist g-object :free-from-foreign t) "gtk_tree_view_column_get_cell_renderers" nil)) + ("GtkTreeSelection" + (:cffi gtk::mode gtk::tree-selection-mode gtk::tree-selection-mode "gtk_tree_selection_get_mode" "gtk_tree_selection_set_mode") + (:cffi gtk::select-function gtk::tree-selection-select-function nil gtk::tree-selection-get-selection-function gtk::tree-selection-set-select-function)) + ("GtkTreeView" + (:cffi gtk::selection gtk::tree-view-selection g-object "gtk_tree_view_get_selection" nil) + (:cffi gtk::column-drag-function gtk::tree-view-column-drag-function nil nil gtk::tree-view-set-column-drag-function) + (:cffi gtk::bin-window gtk::tree-view-bin-window g-object "gtk_tree_view_get_bin_window" nil) + (:cffi gtk::search-equal-func gtk::tree-view-search-equal-func nil nil gtk::tree-view-set-search-equal-func) + (:cffi gtk::search-entry gtk::tree-view-search-entry g-object "gtk_tree_view_get_search_entry" "gtk_tree_view_set_search_entry") + (:cffi gtk::search-position-func gtk::tree-view-search-position-func nil nil gtk::tree-view-set-search-position-func) + (:cffi gtk::row-separator-func gtk::tree-view-row-separator-func nil nil gtk::tree-view-set-row-separartor-func)) + ("GtkCellView" + (:cffi gtk::displayed-row gtk::cell-view-displayed-row (g-boxed-ref gtk::tree-path) "gtk_cell_view_get_displayed_row" "gtk_cell_view_set_displayed_row")))))) \ No newline at end of file diff --git a/gtk/gtk.asd b/gtk/gtk.asd index 54b4167..14d9ef1 100644 --- a/gtk/gtk.asd +++ b/gtk/gtk.asd @@ -2,8 +2,9 @@ :name "gtk" :serial t :components ((:file "gtk.package") - (:file "gtk.generated-classes") + (:file "gtk.misc") (:file "gtk.objects") + (:file "gtk.generated-classes") (:file "gtk.main_loop_events") (:file "gtk.functions") (:file "gtk.base-classes") @@ -19,6 +20,12 @@ (:file "gtk.spin-button") (:file "gtk.text") (:file "gtk.tree-model") + (:file "gtk.tree-view-column") + (:file "gtk.tree-selection") + (:file "gtk.tree-view") + (:file "gtk.icon-view") + (:file "gtk.cell-layout") + (:file "gtk.cell-renderer") (:file "gtk.dialog.example") diff --git a/gtk/gtk.cell-layout.lisp b/gtk/gtk.cell-layout.lisp new file mode 100644 index 0000000..1cdef1d --- /dev/null +++ b/gtk/gtk.cell-layout.lisp @@ -0,0 +1,77 @@ +(in-package :gtk) + +; TODO: GtkCellLayout vtable + +(defcfun gtk-cell-layout-pack-start :void + (cell-layout g-object) + (cell g-object) + (expand :boolean)) + +(defun cell-layout-pack-start (cell-layout cell &key (expand t)) + (gtk-cell-layout-pack-start cell-layout cell expand)) + +(export 'cell-layout-pack-start) + +(defcfun gtk-cell-layout-pack-end :void + (cell-layout g-object) + (cell g-object) + (expand :boolean)) + +(defun cell-layout-pack-end (cell-layout cell &key (expand t)) + (gtk-cell-layout-pack-end cell-layout cell expand)) + +(export 'cell-layout-pack-end) + +(defcfun (cell-layout-cells "gtk_cell_layout_get_cells") (glist g-object :free-from-foreign t) + (cell-layout g-object)) + +(export 'cell-layout-cells) + +(defcfun (cell-layout-reorder "gtk_cell_layout_reorder") :void + (cell-layout g-object) + (cell g-object) + (positin :int)) + +(export 'cell-layout-reorder) + +(defcfun (cell-layout-clear "gtk_cell_layout_clear") :void + (cell-layout g-object)) + +(export 'cell-layout-clear) + +(defcfun (cell-layout-add-attribute "gtk_cell_layout_add_attribute") :void + (cell-layout g-object) + (cell g-object) + (attribute (:string :free-to-foreign t)) + (column :int)) + +(export 'cell-layout-add-attribute) + +(defcallback gtk-cell-layout-cell-data-func-callback :void + ((cell-layout g-object) (cell g-object) (tree-model g-object) (iter (g-boxed-ref tree-iter)) (data :pointer)) + (restart-case + (funcall (get-stable-pointer-value data) + cell-layout cell tree-model iter) + (return () nil))) + +(defcfun gtk-cell-layout-set-cell-data-func :void + (cell-layout g-object) + (cell g-object) + (func :pointer) + (data :pointer) + (destroy-notify :pointer)) + +(defun cell-layout-set-cell-data-func (cell-layout cell func) + (gtk-cell-layout-set-cell-data-func cell-layout + cell + (callback gtk-cell-layout-cell-data-func-callback) + (allocate-stable-pointer func) + (callback stable-pointer-free-destroy-notify-callback))) + +(export 'cell-layout-set-cell-data-func) + +(defcfun (cell-layout-clear-attributes "gtk_cell_layout_clear_attributes") :void + (cell-layout g-object) + (cell g-object)) + +(export 'cell-layout-clear-attributes) \ No newline at end of file diff --git a/gtk/gtk.cell-renderer.lisp b/gtk/gtk.cell-renderer.lisp new file mode 100644 index 0000000..1578a7f --- /dev/null +++ b/gtk/gtk.cell-renderer.lisp @@ -0,0 +1,31 @@ +(in-package :gtk) + +; TODO: GtkCellEditable + +; TODO: GtkCellRenderer vtable + +; TODO: gtk_cell_renderer_get_size + +; TODO: gtk_cell_renderer_render + +; TODO: gtk_cell_renderer_activate + +; TODO: gtk_cell_renderer_start_editing + +; TODO: gtk_cell_renderer_stop_editing + +; TODO: gtk_cell_renderer_get_fixed_size + +; TODO: GtkCellRendererAccel + +; TODO: GtkCellRendererCombo + +; TODO: GtkCellRendererPixbuf + +; TODO: GtkCellRendererProgress + +; TODO: GtkCellRendererSpin + +; TODO: GtkCellRendererText + +; TODO: GtkCellRendererToggle \ No newline at end of file diff --git a/gtk/gtk.demo.lisp b/gtk/gtk.demo.lisp index 1664d09..c0fc691 100644 --- a/gtk/gtk.demo.lisp +++ b/gtk/gtk.demo.lisp @@ -9,7 +9,8 @@ #:test-status-bar #:test-scale-button #:test-text-view - #:demo-code-editor)) + #:demo-code-editor + #:test-treeview-list)) (in-package :gtk-demo) @@ -239,4 +240,59 @@ (g-signal-connect buffer "insert-text" (lambda (buffer location text len) (using* ((buffer buffer) (location location)) (format t "~A~%" (list buffer location text len))))) + (gtk-main))) + +(defstruct tvi title value) + +(defun test-treeview-list () + (let* ((window (make-instance 'gtk-window :type :toplevel :title "Treeview (list)")) + (model (make-instance 'array-list-store)) + (scroll (make-instance 'scrolled-window :hscrollbar-policy :automatic :vscrollbar-policy :automatic)) + (tv (make-instance 'tree-view :headers-visible t :width-request 100 :height-request 400 :rules-hint t)) + (h-box (make-instance 'h-box)) + (v-box (make-instance 'v-box)) + (title-entry (make-instance 'entry)) + (value-entry (make-instance 'entry)) + (button (make-instance 'button :label "Add"))) + (store-add-column model "gchararray" #'tvi-title) + (store-add-column model "gint" #'tvi-value) + (store-add-item model (make-tvi :title "Monday" :value 1)) + (store-add-item model (make-tvi :title "Tuesday" :value 2)) + (store-add-item model (make-tvi :title "Wednesday" :value 3)) + (store-add-item model (make-tvi :title "Thursday" :value 4)) + (store-add-item model (make-tvi :title "Friday" :value 5)) + (store-add-item model (make-tvi :title "Saturday" :value 6)) + (store-add-item model (make-tvi :title "Sunday" :value 7)) + (setf (tree-view-model tv) model (tree-view-tooltip-column tv) 0) + (gobject:g-signal-connect window "destroy" (lambda (w) (gobject:release w) (gtk-main-quit))) + (gobject:g-signal-connect button "clicked" (lambda (b) (gobject:release b) + (store-add-item model (make-tvi :title (entry-text title-entry) + :value (or (parse-integer (entry-text value-entry) + :junk-allowed t) + 0))))) + (g-signal-connect tv "row-activated" (lambda (tv path column) + (release* tv path column) + (format t "You clicked on row ~A~%" (tree-path-indices path)))) + (container-add window v-box) + (box-pack-start v-box h-box :expand nil) + (box-pack-start h-box title-entry :expand nil) + (box-pack-start h-box value-entry :expand nil) + (box-pack-start h-box button :expand nil) + (box-pack-start v-box scroll) + (container-add scroll tv) + (let ((column (make-instance 'tree-view-column :title "Title" :sort-column-id 0)) + (renderer (make-instance 'cell-renderer-text :text "A text"))) + (tree-view-column-pack-start column renderer) + (tree-view-column-add-attribute column renderer "text" 0) + (tree-view-append-column tv column) + (print (tree-view-column-tree-view column)) + (print (tree-view-column-cell-renderers column))) + (let ((column (make-instance 'tree-view-column :title "Value")) + (renderer (make-instance 'cell-renderer-text :text "A text"))) + (tree-view-column-pack-start column renderer) + (tree-view-column-add-attribute column renderer "text" 1) + (tree-view-append-column tv column) + (print (tree-view-column-tree-view column)) + (print (tree-view-column-cell-renderers column))) + (gtk-widget-show-all window) (gtk-main))) \ No newline at end of file diff --git a/gtk/gtk.generated-classes.lisp b/gtk/gtk.generated-classes.lisp index e1b0db2..3aba15b 100644 --- a/gtk/gtk.generated-classes.lisp +++ b/gtk/gtk.generated-classes.lisp @@ -7,15 +7,15 @@ (:export t :type-initializer "gtk_size_group_mode_get_type") (:none 0) (:horizontal 1) (:vertical 2) (:both 3)) -(define-g-enum "GtkUnit" unit (:export t :type-initializer "gtk_unit_get_type") - (:pixel 0) (:points 1) (:inch 2) (:mm 3)) - (define-g-enum "GtkPrintStatus" print-status (:export t :type-initializer "gtk_print_status_get_type") (:initial 0) (:preparing 1) (:generating-data 2) (:sending-data 3) (:pending 4) (:pending-issue 5) (:printing 6) (:finished 7) (:finished-aborted 8)) +(define-g-enum "GtkUnit" unit (:export t :type-initializer "gtk_unit_get_type") + (:pixel 0) (:points 1) (:inch 2) (:mm 3)) + (define-g-enum "GtkRecentSortType" recent-sort-type (:export t :type-initializer "gtk_recent_sort_type_get_type") (:none 0) (:mru 1) (:lru 2) (:custom 3)) @@ -38,16 +38,16 @@ "gtk_tree_view_column_sizing_get_type") (:grow-only 0) (:autosize 1) (:fixed 2)) +(define-g-enum "GtkProgressBarStyle" progress-bar-style + (:export t :type-initializer "gtk_progress_bar_style_get_type") + (:continuous 0) (:discrete 1)) + (define-g-enum "GtkProgressBarOrientation" progress-bar-orientation (:export t :type-initializer "gtk_progress_bar_orientation_get_type") (:left-to-right 0) (:right-to-left 1) (:bottom-to-top 2) (:top-to-bottom 3)) -(define-g-enum "GtkProgressBarStyle" progress-bar-style - (:export t :type-initializer "gtk_progress_bar_style_get_type") - (:continuous 0) (:discrete 1)) - (define-g-enum "GtkUpdateType" update-type (:export t :type-initializer "gtk_update_type_get_type") (:continuous 0) (:discontinuous 1) (:delayed 2)) @@ -82,14 +82,14 @@ (:export t :type-initializer "gtk_toolbar_style_get_type") (:icons 0) (:text 1) (:both 2) (:both-horiz 3)) -(define-g-enum "GtkWrapMode" wrap-mode - (:export t :type-initializer "gtk_wrap_mode_get_type") (:none 0) - (:char 1) (:word 2) (:word-char 3)) - (define-g-enum "GtkJustification" justification (:export t :type-initializer "gtk_justification_get_type") (:left 0) (:right 1) (:center 2) (:fill 3)) +(define-g-enum "GtkWrapMode" wrap-mode + (:export t :type-initializer "gtk_wrap_mode_get_type") (:none 0) + (:char 1) (:word 2) (:word-char 3)) + (define-g-enum "GtkButtonBoxStyle" button-box-style (:export t :type-initializer "gtk_button_box_style_get_type") (:default-style 0) (:spread 1) (:edge 2) (:start 3) (:end 4) @@ -178,10 +178,376 @@ "gtk_text_buffer_target_info_get_type") (:buffer-contents -1) (:rich-text -2) (:text -3)) +(define-g-enum "GtkStateType" state-type + (:export t :type-initializer "gtk_state_type_get_type") + (:normal 0) (:active 1) (:prelight 2) (:selected 3) + (:insensitive 4)) + +(define-g-enum "GtkDirectionType" direction-type + (:export t :type-initializer "gtk_direction_type_get_type") + (:tab-forward 0) (:tab-backward 1) (:up 2) (:down 3) (:left 4) + (:right 5)) + +(define-g-enum "GtkDragResult" drag-result + (:export t :type-initializer "gtk_drag_result_get_type") + (:success 0) (:no-target 1) (:user-cancelled 2) + (:timeout-expired 3) (:grab-broken 4) (:error 5)) + +(define-g-enum "GtkWidgetHelpType" widget-help-type + (:export t :type-initializer "gtk_widget_help_type_get_type") + (:tooltip 0) (:whats-this 1)) + +(define-g-enum "GtkPackType" pack-type + (:export t :type-initializer "gtk_pack_type_get_type") + (:start 0) (:end 1)) + +(define-g-enum "GtkNotebookTab" notebook-tab + (:export t :type-initializer "gtk_notebook_tab_get_type") + (:first 0) (:last 1)) + +(define-g-enum "GtkMovementStep" movement-step + (:export t :type-initializer "gtk_movement_step_get_type") + (:logical-positions 0) (:visual-positions 1) (:words 2) + (:display-lines 3) (:display-line-ends 4) (:paragraphs 5) + (:paragraph-ends 6) (:pages 7) (:buffer-ends 8) + (:horizontal-pages 9)) + +(define-g-enum "GtkAnchorType" anchor-type + (:export t :type-initializer "gtk_anchor_type_get_type") + (:center 0) (:north 1) (:north-west 2) (:north-east 3) + (:south 4) (:south-west 5) (:south-east 6) (:west 7) (:east 8) + (:n 1) (:nw 2) (:ne 3) (:s 4) (:sw 5) (:se 6) (:w 7) (:e 8)) + +(define-g-enum "GtkAssistantPageType" assistant-page-type + (:export t :type-initializer "gtk_assistant_page_type_get_type") + (:content 0) (:intro 1) (:confirm 2) (:summary 3) (:progress 4)) + +(define-g-enum "GtkBuilderError" builder-error + (:export t :type-initializer "gtk_builder_error_get_type") + (:invalid-type-function 0) (:unhandled-tag 1) + (:missing-attribute 2) (:invalid-attribute 3) (:invalid-tag 4) + (:missing-property-value 5) (:invalid-value 6) + (:version-mismatch 7)) + +(define-g-enum "GtkCellType" cell-type + (:export t :type-initializer "gtk_cell_type_get_type") + (:empty 0) (:text 1) (:pixmap 2) (:pixtext 3) (:widget 4)) + +(define-g-enum "GtkCListDragPos" c-list-drag-pos + (:export t :type-initializer "gtk_clist_drag_pos_get_type") + (:none 0) (:before 1) (:into 2) (:after 3)) + +(define-g-enum "GtkCTreeExpanderStyle" c-tree-expander-style + (:export t :type-initializer + "gtk_ctree_expander_style_get_type") + (:none 0) (:square 1) (:triangle 2) (:circular 3)) + +(define-g-enum "GtkCTreeExpansionType" c-tree-expansion-type + (:export t :type-initializer + "gtk_ctree_expansion_type_get_type") + (:expand 0) (:expand-recursive 1) (:collapse 2) + (:collapse-recursive 3) (:toggle 4) (:toggle-recursive 5)) + +(define-g-enum "GtkCTreeLineStyle" c-tree-line-style + (:export t :type-initializer "gtk_ctree_line_style_get_type") + (:none 0) (:solid 1) (:dotted 2) (:tabbed 3)) + +(define-g-enum "GtkCTreePos" c-tree-pos + (:export t :type-initializer "gtk_ctree_pos_get_type") + (:before 0) (:as-child 1) (:after 2)) + +(define-g-enum "GtkDeleteType" delete-type + (:export t :type-initializer "gtk_delete_type_get_type") + (:chars 0) (:word-ends 1) (:words 2) (:display-lines 3) + (:display-line-ends 4) (:paragraph-ends 5) (:paragraphs 6) + (:whitespace 7)) + +(define-g-enum "GtkExpanderStyle" expander-style + (:export t :type-initializer "gtk_expander_style_get_type") + (:collapsed 0) (:semi-collapsed 1) (:semi-expanded 2) + (:expanded 3)) + +(define-g-enum "GtkFileChooserConfirmation" file-chooser-confirmation + (:export t :type-initializer + "gtk_file_chooser_confirmation_get_type") + (:confirm 0) (:accept-filename 1) (:select-again 2)) + +(define-g-enum "GtkFileChooserError" file-chooser-error + (:export t :type-initializer "gtk_file_chooser_error_get_type") + (:nonexistent 0) (:bad-filename 1) (:already-exists 2)) + +(define-g-enum "GtkIconThemeError" icon-theme-error + (:export t :type-initializer "gtk_icon_theme_error_get_type") + (:not-found 0) (:failed 1)) + +(define-g-enum "GtkIconViewDropPosition" icon-view-drop-position + (:export t :type-initializer + "gtk_icon_view_drop_position_get_type") + (:no-drop 0) (:drop-into 1) (:drop-left 2) (:drop-right 3) + (:drop-above 4) (:drop-below 5)) + +(define-g-enum "GtkIMPreeditStyle" i-m-preedit-style (:export t) (:nothing 0) + (:callback 1) (:none 2)) + +(define-g-enum "GtkIMStatusStyle" i-m-status-style (:export t) (:nothing 0) + (:callback 1) (:none 2)) + +(define-g-enum "GtkMatchType" match-type + (:export t :type-initializer "gtk_match_type_get_type") (:all 0) + (:all-tail 1) (:head 2) (:tail 3) (:exact 4) (:last 5)) + +(define-g-enum "GtkMenuDirectionType" menu-direction-type + (:export t :type-initializer "gtk_menu_direction_type_get_type") + (:parent 0) (:child 1) (:next 2) (:prev 3)) + +(define-g-enum "GtkNumberUpLayout" number-up-layout + (:export t :type-initializer "gtk_number_up_layout_get_type") + (:lrtb 0) (:lrbt 1) (:rltb 2) (:rlbt 3) (:tblr 4) (:tbrl 5) + (:btlr 6) (:btrl 7)) + +(define-g-enum "GtkPageOrientation" page-orientation + (:export t :type-initializer "gtk_page_orientation_get_type") + (:portrait 0) (:landscape 1) (:reverse-portrait 2) + (:reverse-landscape 3)) + +(define-g-enum "GtkPageSet" page-set + (:export t :type-initializer "gtk_page_set_get_type") (:all 0) + (:even 1) (:odd 2)) + +(define-g-enum "GtkPathPriorityType" path-priority-type + (:export t :type-initializer "gtk_path_priority_type_get_type") + (:lowest 0) (:gtk 4) (:application 8) (:theme 10) (:rc 12) + (:highest 15)) + +(define-g-enum "GtkPathType" path-type + (:export t :type-initializer "gtk_path_type_get_type") + (:widget 0) (:widget-class 1) (:class 2)) + +(define-g-enum "GtkPreviewType" preview-type + (:export t :type-initializer "gtk_preview_type_get_type") + (:color 0) (:grayscale 1)) + +(define-g-enum "GtkPrintDuplex" print-duplex + (:export t :type-initializer "gtk_print_duplex_get_type") + (:simplex 0) (:horizontal 1) (:vertical 2)) + +(define-g-enum "GtkPrintError" print-error + (:export t :type-initializer "gtk_print_error_get_type") + (:general 0) (:internal-error 1) (:nomem 2) (:invalid-file 3)) + +(define-g-enum "GtkPrintOperationAction" print-operation-action + (:export t :type-initializer + "gtk_print_operation_action_get_type") + (:print-dialog 0) (:print 1) (:preview 2) (:export 3)) + +(define-g-enum "GtkPrintOperationResult" print-operation-result + (:export t :type-initializer + "gtk_print_operation_result_get_type") + (:error 0) (:apply 1) (:cancel 2) (:in-progress 3)) + +(define-g-enum "GtkPrintPages" print-pages + (:export t :type-initializer "gtk_print_pages_get_type") + (:all 0) (:current 1) (:ranges 2)) + +(define-g-enum "GtkPrintQuality" print-quality + (:export t :type-initializer "gtk_print_quality_get_type") + (:low 0) (:normal 1) (:high 2) (:draft 3)) + +(define-g-enum "GtkRcTokenType" rc-token-type + (:export t :type-initializer "gtk_rc_token_type_get_type") + (:invalid 270) (:include 271) (:normal 272) (:active 273) + (:prelight 274) (:selected 275) (:insensitive 276) (:fg 277) + (:bg 278) (:text 279) (:base 280) (:xthickness 281) + (:ythickness 282) (:font 283) (:fontset 284) (:font-name 285) + (:bg-pixmap 286) (:pixmap-path 287) (:style 288) (:binding 289) + (:bind 290) (:widget 291) (:widget-class 292) (:class 293) + (:lowest 294) (:gtk 295) (:application 296) (:theme 297) + (:rc 298) (:highest 299) (:engine 300) (:module-path 301) + (:im-module-path 302) (:im-module-file 303) (:stock 304) + (:ltr 305) (:rtl 306) (:color 307) (:unbind 308) (:last 309)) + +(define-g-enum "GtkRecentChooserError" recent-chooser-error + (:export t :type-initializer + "gtk_recent_chooser_error_get_type") + (:not-found 0) (:invalid-uri 1)) + +(define-g-enum "GtkRecentManagerError" recent-manager-error + (:export t :type-initializer + "gtk_recent_manager_error_get_type") + (:not-found 0) (:invalid-uri 1) (:invalid-encoding 2) + (:not-registered 3) (:read 4) (:write 5) (:unknown 6)) + +(define-g-enum "GtkResponseType" response-type + (:export t :type-initializer "gtk_response_type_get_type") + (:none -1) (:reject -2) (:accept -3) (:delete-event -4) (:ok -5) + (:cancel -6) (:close -7) (:yes -8) (:no -9) (:apply -10) + (:help -11)) + +(define-g-enum "GtkScrollStep" scroll-step + (:export t :type-initializer "gtk_scroll_step_get_type") + (:steps 0) (:pages 1) (:ends 2) (:horizontal-steps 3) + (:horizontal-pages 4) (:horizontal-ends 5)) + +(define-g-enum "GtkScrollType" scroll-type + (:export t :type-initializer "gtk_scroll_type_get_type") + (:none 0) (:jump 1) (:step-backward 2) (:step-forward 3) + (:page-backward 4) (:page-forward 5) (:step-up 6) (:step-down 7) + (:page-up 8) (:page-down 9) (:step-left 10) (:step-right 11) + (:page-left 12) (:page-right 13) (:start 14) (:end 15)) + +(define-g-enum "GtkSideType" side-type + (:export t :type-initializer "gtk_side_type_get_type") (:top 0) + (:bottom 1) (:left 2) (:right 3)) + +(define-g-enum "GtkSpinType" spin-type + (:export t :type-initializer "gtk_spin_type_get_type") + (:step-forward 0) (:step-backward 1) (:page-forward 2) + (:page-backward 3) (:home 4) (:end 5) (:user-defined 6)) + +(define-g-enum "GtkSubmenuDirection" submenu-direction + (:export t :type-initializer "gtk_submenu_direction_get_type") + (:left 0) (:right 1)) + +(define-g-enum "GtkSubmenuPlacement" submenu-placement + (:export t :type-initializer "gtk_submenu_placement_get_type") + (:top-bottom 0) (:left-right 1)) + +(define-g-enum "GtkTextWindowType" text-window-type + (:export t :type-initializer "gtk_text_window_type_get_type") + (:private 0) (:widget 1) (:text 2) (:left 3) (:right 4) (:top 5) + (:bottom 6)) + +(define-g-enum "GtkToolbarChildType" toolbar-child-type + (:export t :type-initializer "gtk_toolbar_child_type_get_type") + (:space 0) (:button 1) (:togglebutton 2) (:radiobutton 3) + (:widget 4)) + +(define-g-enum "GtkToolbarSpaceStyle" toolbar-space-style + (:export t :type-initializer "gtk_toolbar_space_style_get_type") + (:empty 0) (:line 1)) + +(define-g-enum "GtkTreeViewDropPosition" tree-view-drop-position + (:export t :type-initializer + "gtk_tree_view_drop_position_get_type") + (:before 0) (:after 1) (:into-or-before 2) (:into-or-after 3)) + +(define-g-enum "GtkTreeViewMode" tree-view-mode + (:export t :type-initializer "gtk_tree_view_mode_get_type") + (:line 0) (:item 1)) + +(define-g-enum "GtkVisibility" visibility + (:export t :type-initializer "gtk_visibility_get_type") + (:none 0) (:partial 1) (:full 2)) + (define-g-flags "GtkTextSearchFlags" text-search-flags (:export t :type-initializer "gtk_text_search_flags_get_type") (:visible-only 1) (:text-only 2)) +(define-g-flags "GtkAccelFlags" accel-flags + (:export t :type-initializer "gtk_accel_flags_get_type") + (:visible 1) (:locked 2) (:mask 7)) + +(define-g-flags "GtkArgFlags" arg-flags + (:export t :type-initializer "gtk_arg_flags_get_type") + (:readable 1) (:writable 2) (:construct 4) (:construct-only 8) + (:child-arg 16)) + +(define-g-flags "GtkAttachOptions" attach-options + (:export t :type-initializer "gtk_attach_options_get_type") + (:expand 1) (:shrink 2) (:fill 4)) + +(define-g-flags "GtkButtonAction" button-action + (:export t :type-initializer "gtk_button_action_get_type") + (:ignored 0) (:selects 1) (:drags 2) (:expands 4)) + +(define-g-flags "GtkCalendarDisplayOptions" calendar-display-options + (:export t :type-initializer + "gtk_calendar_display_options_get_type") + (:show-heading 1) (:show-day-names 2) (:no-month-change 4) + (:show-week-numbers 8) (:week-start-monday 16) + (:show-details 32)) + +(define-g-flags "GtkCellRendererState" cell-renderer-state + (:export t :type-initializer + "gtk_cell_renderer_state_get_type") + (:selected 1) (:prelit 2) (:insensitive 4) (:sorted 8) + (:focused 16)) + +(define-g-flags "GtkDebugFlag" debug-flag + (:export t :type-initializer "gtk_debug_flag_get_type") + (:misc 1) (:plugsocket 2) (:text 4) (:tree 8) (:updates 16) + (:keybindings 32) (:multihead 64) (:modules 128) + (:geometry 256) (:icontheme 512) (:printing 1024) + (:builder 2048)) + +(define-g-flags "GtkDestDefaults" dest-defaults + (:export t :type-initializer "gtk_dest_defaults_get_type") + (:motion 1) (:highlight 2) (:drop 4) (:all 7)) + +(define-g-flags "GtkDialogFlags" dialog-flags + (:export t :type-initializer "gtk_dialog_flags_get_type") + (:modal 1) (:destroy-with-parent 2) (:no-separator 4)) + +(define-g-flags "GtkFileFilterFlags" file-filter-flags + (:export t :type-initializer "gtk_file_filter_flags_get_type") + (:filename 1) (:uri 2) (:display-name 4) (:mime-type 8)) + +(define-g-flags "GtkIconLookupFlags" icon-lookup-flags + (:export t :type-initializer "gtk_icon_lookup_flags_get_type") + (:no-svg 1) (:force-svg 2) (:use-builtin 4) + (:generic-fallback 8) (:force-size 16)) + +(define-g-flags "GtkObjectFlags" object-flags + (:export t :type-initializer "gtk_object_flags_get_type") + (:in-destruction 1) (:floating 2) (:reserved-1 4) + (:reserved-2 8)) + +(define-g-flags "GtkPrivateFlags" private-flags + (:export t :type-initializer "gtk_private_flags_get_type") + (:user-style 1) (:resize-pending 4) (:has-pointer 8) + (:shadowed 16) (:has-shape-mask 32) (:in-reparent 64) + (:direction-set 128) (:direction-ltr 256) (:anchored 512) + (:child-visible 1024) (:redraw-on-alloc 2048) + (:alloc-needed 4096) (:request-needed 8192)) + +(define-g-flags "GtkRcFlags" rc-flags + (:export t :type-initializer "gtk_rc_flags_get_type") (:fg 1) + (:bg 2) (:text 4) (:base 8)) + +(define-g-flags "GtkRecentFilterFlags" recent-filter-flags + (:export t :type-initializer + "gtk_recent_filter_flags_get_type") + (:uri 1) (:display-name 2) (:mime-type 4) (:application 8) + (:group 16) (:age 32)) + +(define-g-flags "GtkSignalRunType" signal-run-type + (:export t :type-initializer "gtk_signal_run_type_get_type") + (:first 1) (:last 2) (:both 3) (:no-recurse 8) (:action 32) + (:no-hooks 64)) + +(define-g-flags "GtkTargetFlags" target-flags + (:export t :type-initializer "gtk_target_flags_get_type") + (:same-app 1) (:same-widget 2) (:other-app 4) (:other-widget 8)) + +(define-g-flags "GtkTreeModelFlags" tree-model-flags + (:export t :type-initializer "gtk_tree_model_flags_get_type") + (:iters-persist 1) (:list-only 2)) + +(define-g-flags "GtkUIManagerItemType" u-i-manager-item-type (:export t) + (:auto 0) (:menubar 1) (:menu 2) (:toolbar 4) (:placeholder 8) + (:popup 16) (:menuitem 32) (:toolitem 64) (:separator 128) + (:accelerator 256)) + +(define-g-flags "GtkWidgetFlags" widget-flags + (:export t :type-initializer "gtk_widget_flags_get_type") + (:toplevel 16) (:no-window 32) (:realized 64) (:mapped 128) + (:visible 256) (:sensitive 512) (:parent-sensitive 1024) + (:can-focus 2048) (:has-focus 4096) (:can-default 8192) + (:has-default 16384) (:has-grab 32768) (:rc-style 65536) + (:composite-child 131072) (:no-reparent 262144) + (:app-paintable 524288) (:receives-default 1048576) + (:double-buffered 2097152) (:no-show-all 4194304)) + (define-g-interface "GtkBuildable" buildable (:export t :type-initializer "gtk_buildable_get_type")) @@ -196,27 +562,27 @@ (define-g-interface "GtkFileChooser" file-chooser (:export t :type-initializer "gtk_file_chooser_get_type") + (use-preview-label file-chooser-use-preview-label + "use-preview-label" "gboolean" t t) + (extra-widget file-chooser-extra-widget "extra-widget" + "GtkWidget" t t) (do-overwrite-confirmation file-chooser-do-overwrite-confirmation "do-overwrite-confirmation" "gboolean" t t) - (show-hidden file-chooser-show-hidden "show-hidden" - "gboolean" t t) - (preview-widget file-chooser-preview-widget - "preview-widget" "GtkWidget" t t) - (local-only file-chooser-local-only "local-only" "gboolean" + (filter file-chooser-filter "filter" "GtkFileFilter" t t) + (select-multiple file-chooser-select-multiple + "select-multiple" "gboolean" t t) + (action file-chooser-action "action" "GtkFileChooserAction" t t) (file-system-backend file-chooser-file-system-backend "file-system-backend" "gchararray" nil nil) - (select-multiple file-chooser-select-multiple - "select-multiple" "gboolean" t t) + (preview-widget file-chooser-preview-widget + "preview-widget" "GtkWidget" t t) (preview-widget-active file-chooser-preview-widget-active "preview-widget-active" "gboolean" t t) - (extra-widget file-chooser-extra-widget "extra-widget" - "GtkWidget" t t) - (filter file-chooser-filter "filter" "GtkFileFilter" t t) - (use-preview-label file-chooser-use-preview-label - "use-preview-label" "gboolean" t t) - (action file-chooser-action "action" "GtkFileChooserAction" + (show-hidden file-chooser-show-hidden "show-hidden" + "gboolean" t t) + (local-only file-chooser-local-only "local-only" "gboolean" t t)) (define-g-interface "GtkFileChooserEmbed" file-chooser-embed (:export t)) @@ -240,24 +606,24 @@ (define-g-interface "GtkRecentChooser" recent-chooser (:export t :type-initializer "gtk_recent_chooser_get_type") + (select-multiple recent-chooser-select-multiple + "select-multiple" "gboolean" t t) + (limit recent-chooser-limit "limit" "gint" t t) (show-tips recent-chooser-show-tips "show-tips" "gboolean" t t) + (recent-manager recent-chooser-recent-manager + "recent-manager" "GtkRecentManager" nil nil) + (show-private recent-chooser-show-private "show-private" + "gboolean" t t) (show-not-found recent-chooser-show-not-found "show-not-found" "gboolean" t t) (sort-type recent-chooser-sort-type "sort-type" "GtkRecentSortType" t t) - (filter recent-chooser-filter "filter" "GtkRecentFilter" t - t) (show-icons recent-chooser-show-icons "show-icons" "gboolean" t t) - (select-multiple recent-chooser-select-multiple - "select-multiple" "gboolean" t t) + (filter recent-chooser-filter "filter" "GtkRecentFilter" t + t) (local-only recent-chooser-local-only "local-only" - "gboolean" t t) - (limit recent-chooser-limit "limit" "gint" t t) - (recent-manager recent-chooser-recent-manager - "recent-manager" "GtkRecentManager" nil nil) - (show-private recent-chooser-show-private "show-private" "gboolean" t t)) (define-g-interface "GtkToolShell" tool-shell @@ -332,9 +698,9 @@ :type-initializer "gtk_window_get_type") ((type gtk-window-type "type" "GtkWindowType" t nil) (title gtk-window-title "title" "gchararray" t t) + (role gtk-window-role "role" "gchararray" t t) (startup-id gtk-window-startup-id "startup-id" "gchararray" nil t) - (role gtk-window-role "role" "gchararray" t t) (allow-shrink gtk-window-allow-shrink "allow-shrink" "gboolean" t t) (allow-grow gtk-window-allow-grow "allow-grow" @@ -679,8 +1045,8 @@ (define-g-object-class "GtkComboBox" combo-box (:superclass bin :export t :interfaces - ("AtkImplementorIface" "GtkBuildable" "GtkCellLayout" - "GtkCellEditable") + ("AtkImplementorIface" "GtkBuildable" "GtkCellEditable" + "GtkCellLayout") :type-initializer "gtk_combo_box_get_type") ((model combo-box-model "model" "GtkTreeModel" t t) (wrap-width combo-box-wrap-width "wrap-width" "gint" t @@ -705,8 +1071,8 @@ (define-g-object-class "GtkComboBoxEntry" combo-box-entry (:superclass combo-box :export t :interfaces - ("AtkImplementorIface" "GtkBuildable" "GtkCellLayout" - "GtkCellEditable") + ("AtkImplementorIface" "GtkBuildable" "GtkCellEditable" + "GtkCellLayout") :type-initializer "gtk_combo_box_entry_get_type") ((text-column combo-box-entry-text-column "text-column" "gint" t t))) @@ -941,7 +1307,24 @@ (enable-tree-lines tree-view-enable-tree-lines "enable-tree-lines" "gboolean" t t) (tooltip-column tree-view-tooltip-column - "tooltip-column" "gint" t t))) + "tooltip-column" "gint" t t) + (:cffi selection tree-view-selection g-object + "gtk_tree_view_get_selection" nil) + (:cffi column-drag-function + tree-view-column-drag-function nil nil + tree-view-set-column-drag-function) + (:cffi bin-window tree-view-bin-window g-object + "gtk_tree_view_get_bin_window" nil) + (:cffi search-equal-func tree-view-search-equal-func + nil nil tree-view-set-search-equal-func) + (:cffi search-entry tree-view-search-entry g-object + "gtk_tree_view_get_search_entry" + "gtk_tree_view_set_search_entry") + (:cffi search-position-func + tree-view-search-position-func nil nil + tree-view-set-search-position-func) + (:cffi row-separator-func tree-view-row-separator-func + nil nil tree-view-set-row-separartor-func))) (define-g-object-class "GtkIconView" icon-view (:superclass container :export t :interfaces @@ -1337,7 +1720,11 @@ "background-gdk" "GdkColor" t t) (background-set cell-view-background-set "background-set" "gboolean" t t) - (model cell-view-model "model" "GtkTreeModel" t t))) + (model cell-view-model "model" "GtkTreeModel" t t) + (:cffi displayed-row cell-view-displayed-row + (g-boxed-ref tree-path) + "gtk_cell_view_get_displayed_row" + "gtk_cell_view_set_displayed_row"))) (define-g-object-class "GtkDrawingArea" drawing-area (:superclass widget :export t :interfaces @@ -1625,7 +2012,15 @@ (sort-indicator tree-view-column-sort-indicator "sort-indicator" "gboolean" t t) (sort-order tree-view-column-sort-order "sort-order" - "GtkSortType" t t))) + "GtkSortType" t t) + (:cffi tree-view tree-view-column-tree-view g-object + "gtk_tree_view_column_get_tree_view" nil) + (:cffi sort-column-id tree-view-column-sort-column-id + :int "gtk_tree_view_column_get_sort_column_id" + "gtk_tree_view_column_set_sort_column_id") + (:cffi cell-renderers tree-view-column-cell-renderers + (glist g-object :free-from-foreign t) + "gtk_tree_view_column_get_cell_renderers" nil))) (define-g-object-class "GtkCellRenderer" cell-renderer (:superclass gtk-object :export t :interfaces nil @@ -1967,20 +2362,11 @@ "gtk-enable-tooltips" "gboolean" t t) (gtk-button-images settings-gtk-button-images "gtk-button-images" "gboolean" t t) - (gtk-entry-select-on-focus - settings-gtk-entry-select-on-focus - "gtk-entry-select-on-focus" "gboolean" t t) - (gtk-entry-password-hint-timeout - settings-gtk-entry-password-hint-timeout - "gtk-entry-password-hint-timeout" "guint" t t) - (gtk-label-select-on-focus - settings-gtk-label-select-on-focus - "gtk-label-select-on-focus" "gboolean" t t) + (gtk-menu-images settings-gtk-menu-images + "gtk-menu-images" "gboolean" t t) (gtk-scrolled-window-placement settings-gtk-scrolled-window-placement "gtk-scrolled-window-placement" "GtkCornerType" t t) - (gtk-menu-images settings-gtk-menu-images - "gtk-menu-images" "gboolean" t t) (gtk-can-change-accels settings-gtk-can-change-accels "gtk-can-change-accels" "gboolean" t t) (gtk-menu-popup-delay settings-gtk-menu-popup-delay @@ -1995,7 +2381,16 @@ (gtk-toolbar-style settings-gtk-toolbar-style "gtk-toolbar-style" "GtkToolbarStyle" t t) (gtk-toolbar-icon-size settings-gtk-toolbar-icon-size - "gtk-toolbar-icon-size" "GtkIconSize" t t))) + "gtk-toolbar-icon-size" "GtkIconSize" t t) + (gtk-label-select-on-focus + settings-gtk-label-select-on-focus + "gtk-label-select-on-focus" "gboolean" t t) + (gtk-entry-select-on-focus + settings-gtk-entry-select-on-focus + "gtk-entry-select-on-focus" "gboolean" t t) + (gtk-entry-password-hint-timeout + settings-gtk-entry-password-hint-timeout + "gtk-entry-password-hint-timeout" "guint" t t))) (define-g-object-class "GtkRcStyle" rc-style (:superclass g-object :export t :interfaces nil @@ -2110,8 +2505,8 @@ (define-g-object-class "GtkListStore" list-store (:superclass g-object :export t :interfaces - ("GtkBuildable" "GtkTreeModel" "GtkTreeDragSource" - "GtkTreeDragDest" "GtkTreeSortable") + ("GtkBuildable" "GtkTreeDragDest" "GtkTreeDragSource" + "GtkTreeModel" "GtkTreeSortable") :type-initializer "gtk_list_store_get_type") nil) @@ -2353,7 +2748,7 @@ (define-g-object-class "GtkTreeModelFilter" tree-model-filter (:superclass g-object :export t :interfaces - ("GtkTreeModel" "GtkTreeDragSource") :type-initializer + ("GtkTreeDragSource" "GtkTreeModel") :type-initializer "gtk_tree_model_filter_get_type") ((child-model tree-model-filter-child-model "child-model" "GtkTreeModel" t nil) @@ -2362,7 +2757,7 @@ (define-g-object-class "GtkTreeModelSort" tree-model-sort (:superclass g-object :export t :interfaces - ("GtkTreeModel" "GtkTreeDragSource" "GtkTreeSortable") + ("GtkTreeDragSource" "GtkTreeModel" "GtkTreeSortable") :type-initializer "gtk_tree_model_sort_get_type") ((model tree-model-sort-model "model" "GtkTreeModel" t nil))) @@ -2370,12 +2765,17 @@ (define-g-object-class "GtkTreeSelection" tree-selection (:superclass g-object :export t :interfaces nil :type-initializer "gtk_tree_selection_get_type") - nil) + ((:cffi mode tree-selection-mode tree-selection-mode + "gtk_tree_selection_get_mode" + "gtk_tree_selection_set_mode") + (:cffi select-function tree-selection-select-function + nil tree-selection-get-selection-function + tree-selection-set-select-function))) (define-g-object-class "GtkTreeStore" tree-store (:superclass g-object :export t :interfaces - ("GtkBuildable" "GtkTreeModel" "GtkTreeDragSource" - "GtkTreeDragDest" "GtkTreeSortable") + ("GtkBuildable" "GtkTreeDragDest" "GtkTreeDragSource" + "GtkTreeModel" "GtkTreeSortable") :type-initializer "gtk_tree_store_get_type") nil) diff --git a/gtk/gtk.icon-view.lisp b/gtk/gtk.icon-view.lisp new file mode 100644 index 0000000..560b433 --- /dev/null +++ b/gtk/gtk.icon-view.lisp @@ -0,0 +1,160 @@ +(in-package :gtk) + +(defcfun (icon-view-get-path-at-pos "gtk_icon_view_get_path_at_pos") g-object + (icon-view g-object) + (x :int) + (y :int)) + +(export 'icon-view-get-path-at-pos) + +(defcfun gtk-icon-view-get-item-at-pos :boolean + (icon-view g-object) + (x :int) + (y :int) + (path :pointer) + (cell :pointer)) + +(defun icon-view-get-item-at-pos (icon-view x y) + (with-foreign-objects ((path :pointer) (cell :pointer)) + (when (gtk-icon-view-get-item-at-pos icon-view x y path cell) + (values (mem-ref path '(g-boxed-ref tree-path :owner :lisp)) + (mem-ref cell 'g-object))))) + +(export 'icon-view-get-item-at-pos) + +(defcfun gtk-icon-view-convert-widget-to-bin-window-coords :void + (icon-view g-object) + (x :int) + (y :int) + (rx :pointer) + (ry :pointer)) + +(defun icon-view-convert-widget-to-bin-window-coords (icon-view x y) + (with-foreign-objects ((rx :int) (ry :int)) + (gtk-icon-view-convert-widget-to-bin-window-coords icon-view x y rx ry) + (values (mem-ref rx :int) + (mem-ref ry :int)))) + +(export 'icon-view-conver-widget-to-bin-window-coords) + +(defcfun (icon-view-set-cursor "gtk_icon_view_set_cursor") :void + (icon-view g-object) + (path (g-boxed-ref tree-path)) + (cell g-object) + (start-editing :boolean)) + +(export 'icon-view-set-cursor) + +(defcfun gtk-icon-view-get-cursor :boolean + (icon-view g-object) + (path :pointer) + (cell :pointer)) + +(defun icon-view-get-cursor (icon-view) + (with-foreign-objects ((path :pointer) (cell :pointer)) + (when (gtk-icon-view-get-cursor icon-view path cell) + (values (mem-ref path '(g-boxed-ref tree-path)) + (mem-ref cell 'g-object))))) + +(export 'icon-view-get-cursor) + +(defcallback gtk-icon-view-foreach-func-callback :void + ((icon-view g-object) (path (g-boxed-ref tree-path)) (data :pointer)) + (restart-case + (funcall (get-stable-pointer-value data) + icon-view + path) + (return () nil))) + +(defcfun gtk-icon-view-selected-foreach :void + (icon-view g-object) + (func :pointer) + (data :pointer)) + +(defun map-icon-view-selected (icon-view func) + (with-stable-pointer (ptr func) + (gtk-icon-view-selected-foreach icon-view + (callback gtk-icon-view-foreach-func-callback) + ptr))) + +(export 'map-icon-view-selected) + +(defcfun (icon-view-select-path "gtk_icon_view_select_path") :void + (icon-view g-object) + (path (g-boxed-ref tree-path))) + +(export 'icon-view-select-path) + +(defcfun (icon-view-unselect-path "gtk_icon_view_unselect_path") :void + (icon-view g-object) + (path (g-boxed-ref tree-path))) + +(export 'icon-view-unselect-path) + +(defcfun (icon-view-path-selected-p "gtk_icon_view_is_path_selected") :boolean + (icon-view g-object) + (path (g-boxed-ref tree-path))) + +(export 'icon-view-path-selected-p) + +(defcfun (icon-view-selected-items "gtk_icon_view_get_selected_items") (glist (g-boxed-ref tree-path) :free-from-foreign t) + (icon-view g-object)) + +(export 'icon-view-selected-items) + +(defcfun (icon-view-select-all "gtk_icon_view_select_all") :void + (icon-view g-object)) + +(export 'icon-view-select-all) + +(defcfun (icon-view-unselect-all "gtk_icon_view_unselect_all") :void + (icon-view g-object)) + +(export 'icon-view-unselect-all) + +(defcfun gtk-icon-view-scroll-to-path :void + (icon-view g-object) + (path (g-boxed-ref tree-path)) + (use-align :boolean) + (row-align :float) + (col-align :float)) + +(defun icon-view-scroll-to-path (icon-view path &key (row-align 0.5 row-align-supplied-p) (col-align 0.5 col-align-supplied-p)) + (gtk-icon-view-scroll-to-path icon-view path (or row-align-supplied-p col-align-supplied-p) row-align col-align)) + +(export 'icon-view-scroll-to-path) + +(defcfun gtk-icon-view-get-visible-range :boolean + (icon-view g-object) + (start-path :pointer) + (end-path :pointer)) + +(defun icon-view-get-visible-range (icon-view) + (with-foreign-objects ((start-path :pointer) (end-path :pointer)) + (when (gtk-icon-view-get-visible-range icon-view start-path end-path) + (values (mem-ref start-path '(g-boxed-ref tree-path :owner :lisp)) + (mem-ref end-path '(g-boxed-ref tree-path :owner :lisp)))))) + +(export 'icon-view-get-visible-range) + +; TODO: gtk_icon_view_set_tooltip_item + +; TODO: gtk_icon_view_set_tooltip_cell + +; TODO: gtk_icon_view_get_tooltip_context + +; TODO: gtk_icon_view_enable_model_drag_source + +; TODO: gtk_icon_view_enable_model_drag_dest + +; TODO: gtk_icon_view_unset_model_drag_source + +; TODO: gtk_icon_view_unset_model_drag_dest + +; TODO: gtk_icon_view_set_drag_dest_item + +; TODO: gtk_icon_view_get_drag_dest_item + +; TODO: gtk_icon_view_get_dest_item_at_pos + +; TODO: gtk_icon_view_create_drag_icon \ No newline at end of file diff --git a/gtk/gtk.misc.lisp b/gtk/gtk.misc.lisp new file mode 100644 index 0000000..924fe1a --- /dev/null +++ b/gtk/gtk.misc.lisp @@ -0,0 +1,4 @@ +(in-package :gtk) + +(defcallback stable-pointer-free-destroy-notify-callback :void ((data :pointer)) + (free-stable-pointer data)) \ No newline at end of file diff --git a/gtk/gtk.objects.lisp b/gtk/gtk.objects.lisp index 7837a1e..6e095ac 100644 --- a/gtk/gtk.objects.lisp +++ b/gtk/gtk.objects.lisp @@ -4,4 +4,69 @@ (left :int :initform 0) (right :int :initform 0) (top :int :initform 0) - (bottom :int :initform 0)) \ No newline at end of file + (bottom :int :initform 0)) + +(defcstruct tree-iter + (stamp :int) + (user-data :pointer) + (user-data-2 :pointer) + (user-data-3 :pointer)) + +(defun tree-iter-get-stamp (i) (foreign-slot-value (pointer i) 'tree-iter 'stamp)) +(defun tree-iter-set-stamp (value i) (setf (foreign-slot-value (pointer i) 'tree-iter 'stamp) value)) +(defun tree-iter-get-user-data (i) (pointer-address (foreign-slot-value (pointer i) 'tree-iter 'user-data))) +(defun tree-iter-set-user-data (value i) (setf (foreign-slot-value (pointer i) 'tree-iter 'user-data) (make-pointer value))) + +(defun tree-iter-alloc () (glib::g-malloc (foreign-type-size 'tree-iter))) +(defun tree-iter-free (v) (glib::g-free v)) + +(define-g-boxed-ref "GtkTreeIter" tree-iter + (:slots (stamp :reader tree-iter-get-stamp :writer tree-iter-set-stamp :accessor tree-iter-stamp) + (user-data :reader tree-iter-get-user-data :writer tree-iter-set-user-data :accessor tree-iter-user-data)) + (:alloc-function tree-iter-alloc) + (:free-function tree-iter-free)) + +(export 'tree-iter) +(export 'tree-iter-stamp) +(export 'tree-iter-user-data) + +(defctype tree-path :pointer) +(defcfun (%gtk-tree-path-get-depth "gtk_tree_path_get_depth") :int + (path tree-path)) + +(defcfun (%gtk-tree-path-get-indices "gtk_tree_path_get_indices") (:pointer :int) + (path tree-path)) + +(defcfun (%gtk-tree-path-new "gtk_tree_path_new") :pointer) + +(defcfun (%gtk-tree-path-append-index "gtk_tree_path_append_index") :void + (path :pointer) + (index :int)) + +(defun tree-path-get-indices (path) + (setf path (pointer path)) + (let ((n (%gtk-tree-path-get-depth path)) + (indices (%gtk-tree-path-get-indices path))) + (loop + for i from 0 below n + collect (mem-aref indices :int i)))) + +(defun tree-path-set-indices (indices path) + (setf path (pointer path)) + (loop + repeat (%gtk-tree-path-get-depth path) + do (foreign-funcall "gtk_tree_path_up" :pointer path :boolean)) + (loop + for index in indices + do(foreign-funcall "gtk_tree_path_append_index" :pointer path :int index :void))) + +(defcfun gtk-tree-path-new :pointer) +(defcfun gtk-tree-path-free :void (path :pointer)) + +(define-g-boxed-ref "GtkTreePath" tree-path + (:alloc-function gtk-tree-path-new) + (:free-function gtk-tree-path-free) + (:slots (indices :reader tree-path-get-indices :writer tree-path-set-indices :accessor tree-path-indices))) + +(export 'tree-path) +(export 'tree-path-indices) diff --git a/gtk/gtk.tree-model.lisp b/gtk/gtk.tree-model.lisp index 50026c8..788e028 100644 --- a/gtk/gtk.tree-model.lisp +++ b/gtk/gtk.tree-model.lisp @@ -1,68 +1,5 @@ (in-package :gtk) -(define-g-flags "GtkTreeModelFlags" tree-model-flags (:type-initializer "gtk_tree_model_flags_get_type") - (:iters-persist 1) (:list-only 2)) - -(export 'tree-model-flags) - -(defcstruct tree-iter - (stamp :int) - (user-data :pointer) - (user-data-2 :pointer) - (user-data-3 :pointer)) - -(defun tree-iter-get-stamp (i) (foreign-slot-value (pointer i) 'tree-iter 'stamp)) -(defun tree-iter-set-stamp (value i) (setf (foreign-slot-value (pointer i) 'tree-iter 'stamp) value)) -(defun tree-iter-get-user-data (i) (pointer-address (foreign-slot-value (pointer i) 'tree-iter 'user-data))) -(defun tree-iter-set-user-data (value i) (setf (foreign-slot-value (pointer i) 'tree-iter 'user-data) (make-pointer value))) - -(defun tree-iter-alloc () (glib::g-malloc (foreign-type-size 'tree-iter))) -(defun tree-iter-free (v) (glib::g-free v)) - -(define-g-boxed-ref "GtkTreeIter" tree-iter - (:slots (stamp :reader tree-iter-get-stamp :writer tree-iter-set-stamp :accessor tree-iter-stamp) - (user-data :reader tree-iter-get-user-data :writer tree-iter-set-user-data :accessor tree-iter-user-data)) - (:alloc-function tree-iter-alloc) - (:free-function tree-iter-free)) - -(defctype tree-path :pointer) -(defcfun (%gtk-tree-path-get-depth "gtk_tree_path_get_depth") :int - (path tree-path)) - -(defcfun (%gtk-tree-path-get-indices "gtk_tree_path_get_indices") (:pointer :int) - (path tree-path)) - -(defcfun (%gtk-tree-path-new "gtk_tree_path_new") :pointer) - -(defcfun (%gtk-tree-path-append-index "gtk_tree_path_append_index") :void - (path :pointer) - (index :int)) - -(defun tree-path-get-indices (path) - (setf path (pointer path)) - (let ((n (%gtk-tree-path-get-depth path)) - (indices (%gtk-tree-path-get-indices path))) - (loop - for i from 0 below n - collect (mem-aref indices :int i)))) - -(defun tree-path-set-indices (indices path) - (setf path (pointer path)) - (loop - repeat (%gtk-tree-path-get-depth path) - do (foreign-funcall "gtk_tree_path_up" :pointer path :boolean)) - (loop - for index in indices - do(foreign-funcall "gtk_tree_path_append_index" :pointer path :int index :void))) - -(defcfun gtk-tree-path-new :pointer) -(defcfun gtk-tree-path-free :void (path :pointer)) - -(define-g-boxed-ref "GtkTreePath" tree-path - (:alloc-function gtk-tree-path-new) - (:free-function gtk-tree-path-free) - (:slots (indices :reader tree-path-get-indices :writer tree-path-set-indices :accessor tree-path-indices))) - (define-vtable ("GtkTreeModel" c-gtk-tree-model) (:skip parent-instance g-type-interface) ;;some signals @@ -87,7 +24,13 @@ (tree-model-ref-node-impl tree-model-ref-node-cb :void (tree-model g-object) (iter (g-boxed-ref tree-iter))) (tree-model-unref-node-impl tree-model-unref-node-cb :void (tree-model g-object) (iter (g-boxed-ref tree-iter)))) -(defclass array-list-store (g-object gtk:tree-model) +; TODO: GtkTreeSortable + +; TODO: GtkTreeModelSort + +; TODO: GtkTreeModelFilter + +(defclass array-list-store (g-object tree-model) ((items :initform (make-array 0 :adjustable t :fill-pointer t) :reader store-items) (columns-getters :initform (make-array 0 :adjustable t :fill-pointer t) :reader store-getters) (columns-types :initform (make-array 0 :adjustable t :fill-pointer t) :reader store-types))) @@ -125,7 +68,8 @@ (defmethod tree-model-get-iter-impl ((model array-list-store) iter path) (using* (iter path) (let ((indices (tree-path-indices path))) - (when (= 1 (length indices)) + (when (and (= 1 (length indices)) + (< (first indices) (length (store-items model)))) (setf (tree-iter-stamp iter) 0 (tree-iter-user-data iter) (first indices)) t)))) @@ -160,6 +104,18 @@ (release iter) nil) +(defgeneric tree-model-item (model iter-or-path)) + +(defmethod tree-model-item ((model array-list-store) (iter tree-iter)) + (let ((n-row (tree-iter-user-data iter))) + (aref (store-items model) n-row))) + +(defmethod tree-model-item ((model array-list-store) (path tree-path)) + (let ((n-row (first (tree-path-indices path)))) + (aref (store-items model) n-row))) + +(export 'tree-model-item) + (defmethod tree-model-get-value-impl ((model array-list-store) iter n value) (using (iter) (let ((n-row (tree-iter-user-data iter))) @@ -168,26 +124,21 @@ (aref (store-items model) n-row)) (aref (store-types model) n))))) -(defcfun (tree-view-append-column "gtk_tree_view_append_column") :int - (tree-view (g-object gtk:tree-view)) - (column (g-object gtk:tree-view-column))) - -(export 'tree-view-append-column) +(defstruct tree-node + store + (columns-values (make-array 0 :adjustable t :fill-pointer t) :type vector) + (children (make-array 0 :adjustable t :fill-pointer t) :type (vector tree-node))) -(defcfun (tree-view-column-pack-start "gtk_tree_view_column_pack_start") :void - (tree-column (g-object gtk:tree-view-column)) - (cell (g-object gtk:cell-renderer)) - (expand :boolean)) +(export 'tree-node) -(export 'tree-view-column-pack-start) +(defclass tree-store (g-object tree-model) + ((root :reader tree-store-root) + (columns-types :initform (make-array 0 :adjustable t :fill-pointer t) :reader tree-store-types) + (columns-getters :initform (make-array 0 :adjustable t :fill-pointer t) :reader tree-store-getters))) -(defcfun (tree-view-column-add-attribute "gtk_tree_view_column_add_attribute") :void - (tree-column (g-object gtk:tree-view-column)) - (cell-renderer (g-object gtk:cell-renderer)) - (attribute :string) - (column-number :int)) +(export 'tree-store) -(export 'tree-view-column-add-attribute) +(register-object-type-implementation "LispTreeStore" tree-store "GObject" ("GtkTreeModel") nil) (defcfun (tree-model-flags "gtk_tree_model_get_flags") tree-model-flags (tree-model g-object)) @@ -199,7 +150,7 @@ (export 'tree-model-flags) -(defcfun (tree-model-column-type "gtk_tree_model_column_get_type") g-type +(defcfun (tree-model-column-type "gtk_tree_model_get_column_type") g-type (tree-model g-object) (index :int)) @@ -283,11 +234,11 @@ (export 'tree-model-iter-first-child) -(defcfun (tree-model-has-children "gtk_tree_model_has_child") :boolean +(defcfun (tree-model-iter-has-child "gtk_tree_model_iter_has_child") :boolean (tree-model g-object) (iter (g-boxed-ref tree-iter))) -(export 'tree-model-has-children) +(export 'tree-model-iter-has-child) (defcfun (tree-model-iter-n-children "gtk_tree_model_iter_n_children") :int (tree-model g-object) diff --git a/gtk/gtk.tree-selection.lisp b/gtk/gtk.tree-selection.lisp new file mode 100644 index 0000000..9c2be62 --- /dev/null +++ b/gtk/gtk.tree-selection.lisp @@ -0,0 +1,131 @@ +(in-package :gtk) + +(defcfun gtk-tree-selection-set-select-function :void + (selection g-object) + (select-function :pointer) + (data :pointer) + (destroy-notify :pointer)) + +(defcallback gtk-tree-selection-select-function-callback :boolean + ((selection g-object) (model g-object) (path (g-boxed-ref tree-path)) (path-currently-selected :boolean) (data :pointer)) + (let ((fn (get-stable-pointer-value data))) + (restart-case + (funcall fn selection model path path-currently-selected) + (return-true () t) + (return-false () nil)))) + +(defun tree-selection-set-select-function (tree-selection fn) + (gtk-tree-selection-set-select-function tree-selection + (callback gtk-tree-selection-select-function-callback) + (allocate-stable-pointer fn) + (callback stable-pointer-free-destroy-notify-callback))) + +(defcfun gtk-tree-selection-get-user-data :pointer (tree-selection g-object)) + +(defun tree-selection-get-select-function (tree-selection) + (let ((ptr (gtk-tree-selection-get-user-data tree-selection))) + (unless (null-pointer-p ptr) + (get-stable-pointer-value ptr)))) + +(defcfun gtk-tree-selection-selected :boolean + (selection g-object) + (model :pointer) + (iter (g-boxed-ref tree-iter))) + +(defun tree-selection-selected (tree-selection) + (let ((iter (make-instance 'tree-iter))) + (if (gtk-tree-selection-selected tree-selection (null-pointer) iter) + iter + (release iter)))) + +(export 'tree-selection-selected) + +(defcfun gtk-tree-selection-selected-foreach :void + (selection g-object) + (func :pointer) + (data :pointer)) + +(defcallback gtk-tree-selection-foreach-callback :void + ((model g-object) (path (g-boxed-ref tree-path)) (iter (g-boxed-ref tree-iter)) (data :pointer)) + (let ((fn (get-stable-pointer-value data))) + (funcall fn model path iter))) + +(defun map-tree-selection-rows (tree-selection fn) + (with-stable-pointer (ptr fn) + (gtk-tree-selection-selected-foreach tree-selection (callback gtk-tree-selection-foreach-callback) ptr))) + +(export 'map-tree-selection-rows) + +(defcfun gtk-tree-selection-selected-rows (glist (g-boxed-ref tree-path) :free-from-foreign t) + (selection g-object) + (model :pointer)) + +(defun tree-selection-selected-rows (tree-selection) + (gtk-tree-selection-selected-rows tree-selection (null-pointer))) + +(export 'tree-selection-selected-rows) + +(defcfun (tree-selection-count-selected-rows "gtk_tree_selection_count_selected_rows") :int + (selection g-object)) + +(export 'tree-selection-count-selected-rows) + +(defcfun (tree-selection-select-path "gtk_tree_selection_select_path") :void + (selection g-object) + (path (g-boxed-ref tree-path))) + +(export 'tree-selection-select-path) + +(defcfun (tree-selection-unselect-path "gtk_tree_selection_unselect_path") :void + (selection g-object) + (path (g-boxed-ref tree-path))) + +(export 'tree-selection-unselect-path) + +(defcfun (tree-selection-path-selected-p "gtk_tree_selection_path_is_selected") :boolean + (selection g-object) + (path (g-boxed-ref tree-path))) + +(export 'tree-selection-path-selected-p) + +(defcfun (tree-selection-select-iter "gtk_tree_selection_select_iter") :void + (selection g-object) + (iter (g-boxed-ref tree-iter))) + +(export 'tree-selection-select-iter) + +(defcfun (tree-selection-unselect-iter "gtk_tree_selection_unselect_iter") :void + (selection g-object) + (iter (g-boxed-ref tree-iter))) + +(export 'tree-selection-unselect-iter) + +(defcfun (tree-selection-iter-selected-p "gtk_tree_selection_iter_is_selected") :boolean + (selection g-object) + (iter (g-boxed-ref tree-iter))) + +(export 'tree-selection-iter-selected-p) + +(defcfun (tree-selection-select-all "gtk_tree_selection_select_all") :void + (selection g-object)) + +(export 'tree-selection-select-all) + +(defcfun (tree-selection-unselect-all "gtk_tree_selection_unselect_all") :void + (selection g-object)) + +(export 'tree-selection-unselect-all) + +(defcfun (tree-selection-select-range "gtk_tree_selection_select_range") :void + (selection g-object) + (start-path (g-boxed-ref tree-path)) + (end-path (g-boxed-ref tree-path))) + +(export 'tree-selection-select-range) + +(defcfun (tree-selection-unselect-range "gtk_tree_selection_unselect_range") :void + (selection g-object) + (start-path (g-boxed-ref tree-path)) + (end-path (g-boxed-ref tree-path))) + +(export 'tree-selection-unselect-range) \ No newline at end of file diff --git a/gtk/gtk.tree-view-column.lisp b/gtk/gtk.tree-view-column.lisp new file mode 100644 index 0000000..ac3f371 --- /dev/null +++ b/gtk/gtk.tree-view-column.lisp @@ -0,0 +1,91 @@ +(in-package :gtk) + +(defcfun gtk-tree-view-column-pack-start :void + (tree-column (g-object tree-view-column)) + (cell (g-object cell-renderer)) + (expand :boolean)) + +(defun tree-view-column-pack-start (tree-column cell &key (expand t)) + (gtk-tree-view-column-pack-start tree-column cell expand)) + +(export 'tree-view-column-pack-start) + +(defcfun gtk-tree-view-column-pack-end :void + (tree-column (g-object tree-view-column)) + (cell (g-object cell-renderer)) + (expand :boolean)) + +(defun tree-view-column-pack-end (tree-column cell &key (expand t)) + (gtk-tree-view-column-pack-end tree-column cell expand)) + +(export 'tree-view-column-pack-end) + +(defcfun (tree-view-column-clear "gtk_tree_view_column_clear") :void + (tree-column (g-object tree-view-column))) + +(export 'tree-view-column-clear) + +(defcfun (tree-view-column-add-attribute "gtk_tree_view_column_add_attribute") :void + (tree-column (g-object tree-view-column)) + (cell-renderer (g-object cell-renderer)) + (attribute :string) + (column :int)) + +(export 'tree-view-column-add-attribute) + +(defcallback gtk-tree-cell-data-func-cb :void + ((tree-column (g-object tree-column)) + (cell (g-object cell-renderer)) + (tree-model (g-object tree-model)) + (iter (g-boxed-ref tree-iter)) + (data :pointer)) + (let ((fn (get-stable-pointer-value data))) + (restart-case + (funcall fn tree-column cell tree-model iter) + (return-from-tree-cell-data-function () nil)))) + +(defcallback gtk-tree-cell-data-func-destroy-cb :void ((data :pointer)) + (free-stable-pointer data)) + +(defcfun gtk-tree-view-column-set-cell-data-func :void + (tree-column (g-object tree-column)) + (cell-renderer (g-object cell-renderer)) + (func :pointer) + (func-data :pointer) + (destroy-notify :pointer)) + +(defun tree-view-column-set-cell-data-function (tree-column cell-renderer function) + (gtk-tree-view-column-set-cell-data-func + tree-column + cell-renderer + (callback gtk-tree-cell-data-func-cb) + (allocate-stable-pointer function) + (callback gtk-tree-cell-data-func-destroy-cb))) + +(defcfun (tree-view-column-clear-attributes "gtk_tree_view_column_clear_attributes") :void + (tree-column (g-object tree-column)) + (cell-renderer (g-object cell-renderer))) + +(export 'tree-view-column-clear-attributes) + +(defcfun (tree-view-column-cell-set-cell-data "gtk_tree_view_column_cell_set_cell_data") :void + (tree-column (g-object tree-view-column)) + (tree-model (g-object tree-model)) + (iter (g-boxed-ref tree-iter)) + (is-expander :boolean) + (is-expanded :boolean)) + +(export 'tree-view-column-set-cell-data) + +;; TODO gtk_tree_view_column_cell_get_size () gtk_tree_view_column_cell_get_position () + +(defcfun (tree-view-column-focus-cell "gtk_tree_view_column_focus_cell") :void + (tree-column (g-object tree-view-column)) + (cell-renderer (g-object cell-renderer))) + +(export 'tree-view-column-focus-cell) + +(defcfun (tree-view-column-queue-resize "gtk_tree_view_column_queue_resize") :void + (tree-column (g-object tree-view-column))) + +(export 'tree-view-column-queue-resize) diff --git a/gtk/gtk.tree-view.lisp b/gtk/gtk.tree-view.lisp new file mode 100644 index 0000000..487ddb2 --- /dev/null +++ b/gtk/gtk.tree-view.lisp @@ -0,0 +1,452 @@ +(in-package :gtk) + +(defcfun (tree-view-columns-autosize "gtk_tree_view_columns_autosize") :void + (tree-view g-object)) + +(export 'tree-view-columns-autosize) + +(defcfun (tree-view-append-column "gtk_tree_view_append_column") :int + (tree-view (g-object gtk:tree-view)) + (column (g-object gtk:tree-view-column))) + +(export 'tree-view-append-column) + +(defcfun (tree-view-remove-column "gtk_tree_view_remove_column") :int + (tree-view (g-object gtk:tree-view)) + (column (g-object gtk:tree-view-column))) + +(export 'tree-view-remove-column) + +(defcfun (tree-view-insert-column "gtk_tree_view_insert_column") :int + (tree-view g-object) + (column g-object) + (position :int)) + +(export 'tree-view-insert-column) + +(defcfun (tree-view-get-column "gtk_tree_view_get_column") g-object + (tree-view g-object) + (position :int)) + +(export 'tree-view-get-column) + +(defcfun (tree-view-columns "gtk_tree_view_columns") (glist g-object) + (tree-view g-object)) + +(export 'tree-view-columns) + +(defcfun (tree-view-move-column-after "gtk_tree_view_move_column_after") :void + (tree-view g-object) + (column g-object) + (base-column g-object)) + +(export 'tree-view-move-column-after) + +(defcallback gtk-tree-view-column-drop-func-callback :boolean + ((tree-view g-object) (column g-object) (prev-column g-object) (next-column g-object) (data :pointer)) + (let ((fn (get-stable-pointer-value data))) + (funcall fn tree-view column prev-column next-column))) + +(defcfun gtk-tree-view-set-column-drag-function :void + (tree-view g-object) + (func :pointer) + (data :pointer) + (destroy-notify :pointer)) + +(defun tree-view-set-column-drag-fuction (tree-view function) + (gtk-tree-view-set-column-drag-function tree-view + (callback gtk-tree-view-column-drop-func-callback) + (allocate-stable-pointer function) + (callback stable-pointer-free-destroy-notify-callback))) + +(defcfun (tree-view-scroll-to-point "gtk_tree_view_scroll_to_point") :void + (tree-view g-object) + (tree-x :int) + (tree-y :int)) + +(export 'tree-view-scroll-to-point) + +(defcfun gtk-tree-view-scroll-to-cell :void + (tree-view g-object) + (path (g-boxed-ref tree-path)) + (column g-object) + (use-align :boolean) + (row-align :float) + (col-align :float)) + +(defun tree-view-scroll-to-cell (tree-view path column &optional (row-align 0.5 row-align-supplied-p) (col-align 0.5 col-align-supplied-p)) + (gtk-tree-view-scroll-to-cell tree-view path column (or row-align-supplied-p col-align-supplied-p) row-align col-align)) + +(export 'tree-view-scroll-to-cell) + +(defcfun gtk-tree-view-set-cursor :void + (tree-view g-object) + (path (g-boxed-ref tree-path)) + (focus-column g-object) + (start-editing :boolean)) + +(defun tree-view-set-cursor (tree-view path &key focus-column start-editing) + (gtk-tree-view-set-cursor tree-view path focus-column start-editing)) + +(export 'tree-view-set-cursor) + +(defcfun gtk-tree-view-set-cursor-on-cell :void + (tree-view g-object) + (path (g-boxed-ref tree-path)) + (focus-column g-object) + (focus-cell g-object) + (start-editing :boolean)) + +(defun tree-view-set-cursor-on-cell (tree-view path &key focus-column focus-cell start-editing) + (gtk-tree-view-set-cursor-on-cell tree-view path focus-column focus-cell start-editing)) + +(export 'tree-view-set-cursor-on-cell) + +(defcfun gtk-tree-view-get-cursor :void + (tree-view g-object) + (path :pointer) + (focus-column :pointer)) + +(defun tree-view-get-cursor (tree-view) + (with-foreign-objects ((path :pointer) (focus-column :pointer)) + (gtk-tree-view-get-cursor tree-view path focus-column) + (values (mem-ref path '(g-boxed-ref tree-path :owner :lisp)) + (mem-ref focus-column 'g-object)))) + +(export 'tree-view-get-cursor) + +(defcfun (tree-view-expand-all "gtk_tree_view_expand_all") :void + (tree-view g-object)) + +(export 'tree-view-expand-all) + +(defcfun (tree-view-collapse-all "gtk_tree_view_collapse_all") :void + (tree-view g-object)) + +(export 'tree-view-collapse-all) + +(defcfun (tree-view-expand-to-path "gtk_tree_view_expand_to_path") :void + (tree-view g-object) + (path (g-boxed-ref tree-path))) + +(export 'tree-view-expand-to-path) + +(defcfun (tree-view-expand-row "gtk_tree_view_expand_row") :boolean + (tree-view g-object) + (path (g-boxed-ref tree-path))) + +(export 'tree-view-expand-row) + +(defcfun (tree-view-collapse-row "gtk_tree_view_collapse_row") :boolean + (tree-view g-object) + (path (g-boxed-ref tree-path))) + +(export 'tree-view-collapse-row) + +(defcallback gtk-tree-view-mapping-func-callback :void + ((tree-view g-object) (path (g-boxed-ref tree-path)) (data :pointer)) + (funcall (get-stable-pointer-value data) + tree-view path)) + +(defcfun gtk-tree-view-map-expanded-rows :void + (tree-view g-object) + (func :pointer) + (data :pointer)) + +(defun tree-view-map-expanded-rows (tree-view function) + (with-stable-pointer (ptr function) + (gtk-tree-view-map-expanded-rows tree-view (callback gtk-tree-view-mapping-func-callback) ptr))) + +(export 'tree-view-map-expanded-rows) + +(defcfun (tree-view-row-expanded-p "gtk_tree_view_row_expanded") :boolean + (tree-view g-object) + (path (g-boxed-ref tree-path))) + +(export 'tree-view-row-expanded-p) + +(defcfun gtk-tree-view-get-path-at-pos :boolean + (tree-view g-object) + (x :int) + (y :int) + (path :pointer) + (column :pointer) + (cell-x :pointer) + (cell-y :pointer)) + +(defun tree-view-get-path-at-pos (tree-view x y) + (with-foreign-objects ((path :pointer) (column :pointer) (cell-x :int) (cell-y :int)) + (when (gtk-tree-view-get-path-at-pos tree-view x y path column cell-x cell-y) + (values (mem-ref path '(g-boxed-ref tree-path :owner :lisp)) + (mem-ref column 'g-object) + (mem-ref cell-x :int) + (mem-ref cell-y :int))))) + +(export 'tree-view-get-path-at-pos) + +(defcfun gtk-tree-view-get-cell-area :void + (tree-view g-object) + (path (g-boxed-ref tree-path)) + (column g-object) + (rectangle (g-boxed-ptr rectangle))) + +(defun tree-view-get-cell-area (tree-view path column) + (aprog1 (make-rectangle :x 0 :y 0 :width 0 :height 0) + (gtk-tree-view-get-cell-area tree-view path column it))) + +(export 'tree-view-get-cell-area) + +(defcfun gtk-tree-view-get-background-area :void + (tree-view g-object) + (path (g-boxed-ref tree-path)) + (column g-object) + (rectangle (g-boxed-ptr rectangle))) + +(defun tree-view-get-background-area (tree-view path column) + (aprog1 (make-rectangle :x 0 :y 0 :width 0 :height 0) + (gtk-tree-view-get-background-area tree-view path column it))) + +(export 'tree-view-get-background-area) + +(defcfun gtk-tree-view-get-visible-rect :void + (tree-view g-object) + (rectangle (g-boxed-ptr rectangle))) + +(defun tree-view-get-visible-rect (tree-view) + (aprog1 (make-rectangle :x 0 :y 0 :width 0 :height 0) + (gtk-tree-view-get-visible-rect tree-view it))) + +(export 'tree-view-get-visible-rect) + +(defcfun gtk-tree-view-get-visible-range :boolean + (tree-view g-object) + (start-path :pointer) + (end-path :pointer)) + +(defun tree-view-get-visible-range (tree-view) + (with-foreign-objects ((start-path :pointer) (end-path :pointer)) + (when (gtk-tree-view-get-visible-range tree-view start-path end-path) + (values (mem-ref start-path '(g-boxed-ref tree-path :owner :lisp)) + (mem-ref end-path '(g-boxed-ref tree-path :owner :lisp)))))) + +(export 'tree-view-get-visible-range) + +(defcfun gtk-tree-view-convert-bin-window-to-tree-coords :void + (tree-view g-object) + (x :int) + (y :int) + (rx :pointer) + (ry :pointer)) + +(defun tree-view-convert-bin-window-to-tree-coords (tree-view x y) + (with-foreign-objects ((rx :int) (ry :int)) + (gtk-tree-view-convert-bin-window-to-tree-coords tree-view x y rx ry) + (values (mem-ref rx :int) + (mem-ref ry :int)))) + +(export 'tree-view-convert-bin-window-to-tree-coords) + +(defcfun gtk-tree-view-convert-bin-window-to-widget-coords :void + (tree-view g-object) + (x :int) + (y :int) + (rx :pointer) + (ry :pointer)) + +(defun tree-view-convert-bin-window-to-widget-coords (tree-view x y) + (with-foreign-objects ((rx :int) (ry :int)) + (gtk-tree-view-convert-bin-window-to-widget-coords tree-view x y rx ry) + (values (mem-ref rx :int) + (mem-ref ry :int)))) + +(export 'tree-view-convert-bin-window-to-widget-coords) + +(defcfun gtk-tree-view-convert-tree-to-bin-window-coords :void + (tree-view g-object) + (x :int) + (y :int) + (rx :pointer) + (ry :pointer)) + +(defun tree-view-convert-tree-to-bin-window-coords (tree-view x y) + (with-foreign-objects ((rx :int) (ry :int)) + (gtk-tree-view-convert-tree-to-bin-window-coords tree-view x y rx ry) + (values (mem-ref rx :int) + (mem-ref ry :int)))) + +(export 'tree-view-convert-tree-to-bin-window-coords) + +(defcfun gtk-tree-view-convert-tree-to-widget-coords :void + (tree-view g-object) + (x :int) + (y :int) + (rx :pointer) + (ry :pointer)) + +(defun tree-view-convert-tree-to-widget-coords (tree-view x y) + (with-foreign-objects ((rx :int) (ry :int)) + (gtk-tree-view-convert-tree-to-widget-coords tree-view x y rx ry) + (values (mem-ref rx :int) + (mem-ref ry :int)))) + +(export 'tree-view-convert-tree-to-widget-coords) + +(defcfun gtk-tree-view-convert-widget-to-bin-window-coords :void + (tree-view g-object) + (x :int) + (y :int) + (rx :pointer) + (ry :pointer)) + +(defun tree-view-convert-widget-to-bin-window-coords (tree-view x y) + (with-foreign-objects ((rx :int) (ry :int)) + (gtk-tree-view-convert-widget-to-bin-window-coords tree-view x y rx ry) + (values (mem-ref rx :int) + (mem-ref ry :int)))) + +(export 'tree-view-convert-widget-to-bin-window-coords) + +(defcfun gtk-tree-view-convert-widget-to-tree-coords :void + (tree-view g-object) + (x :int) + (y :int) + (rx :pointer) + (ry :pointer)) + +(defun tree-view-convert-widget-to-tree-coords (tree-view x y) + (with-foreign-objects ((rx :int) (ry :int)) + (gtk-tree-view-convert-widget-to-tree-coords tree-view x y rx ry) + (values (mem-ref rx :int) + (mem-ref ry :int)))) + +(export 'tree-view-convert-widget-to-tree-coords) + +; TODO: gtk_tree_view_enable_model_drag_dest + +; TODO: gtk_tree_view_enable_model_drag_source + +; TODO: gtk_tree_view_unset_rows_drag_source + +; TODO: gtk_tree_view_unset_rows_drag_dest + +; TOOD: gtk_tree_view_set_drag_dest_row + +; TOOD: gtk_tree_view_get_drag_dest_row + +; TOOD: gtk_tree_view_get_dest_row_at_pos + +; TOOD: gtk_tree_view_create_drag_icon + +(defcallback gtk-tree-view-search-equal-func-callback :boolean + ((model g-object) (column :int) (key (:string :free-from-foreign nil)) (iter (g-boxed-ref tree-iter)) (data :pointer)) + (restart-case + (funcall (get-stable-pointer-value data) + model column key iter) + (return-true () t) + (return-false () t))) + +(defcfun gtk-tree-view-set-search-equal-func :void + (tree-view g-object) + (func :pointer) + (data :pointer) + (destroy-notify :pointer)) + +(defun tree-view-set-search-equal-func (tree-view func) + (gtk-tree-view-set-search-equal-func tree-view + (callback gtk-tree-view-search-equal-func-callback) + (allocate-stable-pointer func) + (callback stable-pointer-free-destroy-notify-callback))) + +(defcallback gtk-tree-view-search-position-func :void + ((tree-view g-object) (search-dialog g-object) (data :pointer)) + (restart-case + (funcall (get-stable-pointer-value data) + tree-view + search-dialog) + (return () nil))) + +(defcfun gtk-tree-view-set-search-position-func :void + (tree-view g-object) + (func :pointer) + (data :pointer) + (destroy-notify :pointer)) + +(defun tree-view-set-search-position-func (tree-view func) + (if func + (gtk-tree-view-set-search-position-func tree-view + (callback gtk-tree-view-set-search-position-func) + (allocate-stable-pointer func) + (callback stable-pointer-free-destroy-notify-callback)) + (gtk-tree-view-set-search-position-func tree-view + (null-pointer) + (null-pointer) + (null-pointer)))) + +; TODO: gtk_tree_view_set_destroy_count_func + +(defcallback gtk-tree-view-row-separator-func-callback :boolean + ((tree-model g-object) (iter (g-boxed-ref tree-iter)) (data :pointer)) + (restart-case + (funcall (get-stable-pointer-value data) + tree-model + iter) + (return-true () t) + (return-false () nil))) + +(defcfun gtk-tree-view-set-row-separator-func :void + (tree-view g-object) + (func :pointer) + (data :pointer) + (destroy-notify :pointer)) + +(defun tree-view-set-row-separartor-func (tree-view func) + (if func + (gtk-tree-view-set-row-separator-func tree-view + (callback gtk-tree-view-row-separator-func-callback) + (allocate-stable-pointer func) + (callback stable-pointer-free-destroy-notify-callback)) + (gtk-tree-view-set-row-separator-func tree-view (null-pointer) (null-pointer) (null-pointer)))) + +(defcfun (tree-view-rubber-banding-active "gtk_tree_view_get_rubber_banding_active") :boolean + (tree-view g-object)) + +(export 'tree-view-rubber-banding-active) + +(defcfun (tree-view-set-tooltip-row "gtk_tree_view_set_tooltip_row") :void + (tree-view g-object) + (tooltip g-object) + (tree-path (g-boxed-ref tree-path))) + +(export 'tree-view-set-tooltip-row) + +(defcfun (tree-view-set-tooltip-cell "gtk_tree_view_set_tooltip_cell") :void + (tree-view g-object) + (tooltip g-object) + (path (g-boxed-ref tree-path)) + (column g-object) + (cell g-object)) + +(export 'tree-view-set-tooltip-cell) + +(defcfun gtk-tree-view-get-tooltip-context :boolean + (tree-view g-object) + (x :int) + (y :int) + (keyboard-tip :boolean) + (model :pointer) + (path :pointer) + (iter :pointer)) + +(defun tree-view-get-tooltip-context (tree-view) + (with-foreign-objects ((x :int) (y :int) (keyboard-tip :boolean) (model :pointer) (path :pointer) (iter :pointer)) + (when (gtk-tree-view-get-tooltip-context tree-view x y keyboard-tip model path iter) + (values (mem-ref x :int) + (mem-ref y :int) + (mem-ref keyboard-tip :boolean) + (mem-ref model 'g-object) + (mem-ref path '(g-boxed-ref tree-path :owner :lisp)) + (mem-ref iter '(g-boxed-ref tree-iter :owner :lisp)))))) + +(export 'tree-view-get-tooltip-context) + +; TODO: GtkTreeView drag-and-drop \ No newline at end of file