Ignore:
Timestamp:
Sep 16, 2009, 3:22:11 PM (10 years ago)
Author:
gb
Message:

Try to update this a bit (gtk+-1/gtk+-2), but it needs more work.
(It'd be nice to have a working GTK example or two, but some of this
hasn't worked in a long time.)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/source/examples/gtk-minesweeper.lisp

    r6 r12845  
    2121;;; Make GTK+ interface info available.
    2222(eval-when (:compile-toplevel :execute)
    23   (use-interface-dir :GTK))
     23  (use-interface-dir :GTK2))
    2424
    2525(eval-when (:compile-toplevel :load-toplevel :execute)
     
    5050(defstruct cell
    5151  (buttonstate :button-unknown
    52                :type (member (:button-down :button-unknown :button-flagged)))
     52               :type (member :button-down :button-unknown :button-flagged))
    5353  button
    5454  (bombsnearby 0)
     
    152152  (let* ((dialog-window (#_gtk_dialog_new)))
    153153    (with-cstrs ((destroy-name "destroy"))
    154       (#_gtk_signal_connect dialog-window destroy-name clear-show-message
    155                             (%null-ptr)))
     154      (#_gtk_signal_connect_full dialog-window destroy-name clear-show-message
     155                            (%null-ptr) (%null-ptr) (%null-ptr) 0 0))
    156156    (with-cstrs ((title title))
    157157      (#_gtk_window_set_title dialog-window title))
     
    161161                     (#_gtk_button_new_with_label ok))))
    162162      (with-cstrs ((clicked "clicked"))
    163         (#_gtk_signal_connect button clicked close-show-message dialog-window))
     163        (#_gtk_signal_connect_full button clicked close-show-message (%null-ptr) dialog-window (%null-ptr) 0 0))
    164164      (setf (pref button :<G>tk<O>bject.flags)
    165165            (logior (pref button :<G>tk<O>bject.flags) #$GTK_CAN_DEFAULT))
     
    221221                   (activate "activate"))
    222222        (setq menuitem (#_gtk_menu_item_new_with_label item-name))
    223         (#_gtk_signal_connect menuitem activate func (or data (%null-ptr))))
     223        (#_gtk_signal_connect_full menuitem activate func (%null-ptr) (or data (%null-ptr)) (%null-ptr) 0 0))
    224224      (setq menuitem (#_gtk_menu_item_new)))
    225     (#_gtk_menu_append menu menuitem)
     225    (#_gtk_menu_shell_append menu menuitem)
    226226    (#_gtk_widget_show menuitem)
    227227
     
    229229      (setq *accel-group*
    230230            (#_gtk_accel_group_new))
    231       (#_gtk_accel_group_attach *accel-group*
    232                                 *win-main*))
     231      (#_gtk_window_add_accel_group *win-main* *accel-group*))
    233232
    234233    (if (and accel (char= (schar accel 0) #\^))
     
    255254                      item-name)))
    256255      (setf (%get-ptr group-ptr)
    257             (#_gtk_radio_menu_item_group menuitem))
    258       (#_gtk_menu_append menu menuitem)
     256            (#_gtk_radio_menu_item_get_group menuitem))
     257      (#_gtk_menu_shell_append menu menuitem)
    259258      (#_gtk_widget_show menuitem)
    260       (#_gtk_signal_connect menuitem toggled func (or data (%null-ptr)))
     259      (#_gtk_signal_connect_full menuitem toggled func (%null-ptr) (or data (%null-ptr)) (%null-ptr) 0 0)
    261260      menuitem)))
    262261
     
    264263  (with-cstrs ((name name))
    265264    (let* ((menuitem (#_gtk_menu_item_new_with_label name)))
    266       (#_gtk_menu_bar_append menu menuitem)
     265      (#_gtk_menu_shell_append menu menuitem)
    267266      (#_gtk_widget_show menuitem)
    268267      (let* ((submenu (#_gtk_menu_new)))
     
    644643  (setq *win-main* window)
    645644  (setq *accel-group* (#_gtk_accel_group_new))
    646   (#_gtk_accel_group_attach *accel-group* *win-main*)
     645  (#_gtk_window_add_accel_group *win-main* *accel-group*)
    647646  (let* ((menubar (#_gtk_menu_bar_new)))
    648647    (#_gtk_box_pack_start vbox-main menubar #$FALSE #$TRUE 0)
     
    711710(defun free-children (widget)
    712711  (#_gtk_container_foreach
    713    (#_gtk_type_check_object_cast widget (#_gtk_container_get_type))
    714                                 FreeChildCallback (%null-ptr)))
     712   (#_g_type_check_instance_cast widget (#_gtk_container_get_type))
     713  FreeChildCallback (%null-ptr)))
    715714
    716715(defun add-image-to-mine (cell xpm-data)
    717716  (let* ((widget (create-widget-from-xpm *table* xpm-data)))
    718717    (#_gtk_container_add (cell-button cell) widget)
    719     (#_gdk_pixmap_unref widget)
     718    (#_gdk_drawable_unref widget)
    720719    nil))
    721720
     
    844843    (with-cstrs ((toggled "toggled")
    845844                 (button-press-event "button_press_event"))
    846       (#_gtk_signal_connect button toggled cell-toggled
    847                             (%int-to-ptr cell-id))
    848       (#_gtk_signal_connect button button-press-event
    849                             button-press (%int-to-ptr cell-id)))
     845      (#_gtk_signal_connect_full button toggled cell-toggled
     846                                 (%null-ptr) (%int-to-ptr cell-id) (%null-ptr) 0 0)
     847      (#_gtk_signal_connect_full button button-press-event
     848                            button-press (%null-ptr) (%int-to-ptr cell-id) (%null-ptr) 0 0))
    850849    (#_gtk_table_attach table button
    851850                        column (1+ column)
     
    977976        (setq *start-button* (#_gtk_button_new))
    978977        (with-cstrs ((clicked "clicked"))
    979           (#_gtk_signal_connect *start-button* clicked start-button-clicked
    980                                 (%null-ptr)))
     978          (#_gtk_signal_connect_full *start-button* clicked start-button-clicked
     979                                (%null-ptr) (%null-ptr) (%null-ptr) 0 0))
    981980        (#_gtk_box_pack_start hbox *start-button* #$FALSE #$FALSE 0)
    982981        (#_gtk_widget_show *start-button*)
     
    986985        (#_gtk_container_add window *vbox*)
    987986        (with-cstrs ((destroy "destroy"))
    988           (#_gtk_signal_connect window destroy action-quit window))
     987          (#_gtk_signal_connect_full window destroy action-quit (%null-ptr) window (%null-ptr) 0 0))
    989988        (#_gtk_widget_show window)
    990989
Note: See TracChangeset for help on using the changeset viewer.