;;;;
;;;; menu3.stk          -- GTK+ Menu Demo
;;;;
;;;; Copyright © 2009-2021 Erick Gallesio - I3S-CNRS/ESSI <eg@unice.fr>
;;;;
;;;;
;;;; This program is free software; you can redistribute it and/or modify
;;;; it under the terms of the GNU General Public License as published by
;;;; the Free Software Foundation; either version 2 of the License, or
;;;; (at your option) any later version.
;;;;
;;;; This program is distributed in the hope that it will be useful,
;;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;;;; GNU General Public License for more details.
;;;;
;;;; You should have received a copy of the GNU General Public License
;;;; along with this program; if not, write to the Free Software
;;;; Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
;;;; USA.
;;;;
;;;;           Author: Erick Gallesio [eg@unice.fr]
;;;;    Creation date: 13-Aug-2009 20:56 (eg)
;;;;

(include "demos-utils.stk")

(define *menu-msg* "
Menu Bar Demo

This demo just shows a simple menu bar with various types of
menus.
")


(define (action w e)
  (eprintf "You have clicked ~S\n" (text w)))


(define (main args)
  (let* ((win (make <demo-window> :title "Labels Demo" :x 100 :y 100
                    :file "menu3" :border-width 10 :padding 10
                    :message *menu-msg*))
     (mb   (make <menu-bar> :parent win)))
    (add-items-to-menubar mb
                           `(("File"
                                 ("Load"   :action ,action)
                                 ("Save"   :action ,action)
                                 (""       :type   :separator)
                                 ("Quit"   :action ,(lambda _ (exit 0))))
                             ("Edit"
                                 ("Copy"   :action ,action)
                                 ("Cut"    :action ,action)
                                 ("Paste"  :action ,action))
                             ("Cascade"
                                 ("  1  " :type :cascade
                                  :menu (("One"  :action ,action)
                                         ("Un"   :action ,action)
                                         ("Eins" :action ,action)))
                                 ("  2  " :type :cascade
                                  :menu (("Two"  :action ,action)
                                         ("Deux" :action ,action)
                                         ("Zwei" :action ,action)))
                                 ("  3  " :action ,action)
                                 ("  4  " :action ,action))
                             ("Check"
                                 ("option1" :type :check :action ,action)
                                 ("option2" :type :check :action ,action :value #t))
                             ("Radio"
                                 ("radio1 group1" :type :radio :action ,action)
                                 ("radio2 group1" :type :radio :action ,action :value #t)
                                 (""       :type :separator)
                                 ("radio1 group2" :type :radio :action ,action :first #t)
                                 ("radio2 group2" :type :radio :action ,action))
                             ()  ;; Add an empty list to make space
                             ;; Now "Help" will be on the right part of the tool-bar
                             ("Help"
                                 ("About"     :action ,action)
                                 ("More Info" :action ,action))))
    (gtk-main)))
