#!/usr/bin/env ruby
# frozen_string_literal: false
require 'tk'
require 'tkextlib/iwidgets'

##########################################
# icon images
editcopy22 = TkPhotoImage.new(:data=><<'EOD')
   R0lGODlhFgAWAIUAAPwCBBQSFPz+/DQyNISChDw6PMzKzMTGxERGRIyKjFxa
   XMTCvKSmpHR2dPz6/Pz29PTq3MS2rPz69MTCxFxWVHx6dJyWjNzSzPz27Pzy
   7Pzu5PTm3NTKvIR+fJyGfHxuZHxqXNTCtPTq5PTi1PTezNS+rExOTFRORMyy
   lPTaxOzWxOzSvNze3NTOxMy2nMyulMyqjAQCBAAAAAAAAAAAAAAAAAAAAAAA
   AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAEAAAAALAAAAAAWABYAAAbY
   QIBwSCwahYGkUnk0BgTQ6IAQaBKfUWhBYKhaAU+CgXAQIAyChLeJzSIQhcH6
   GFaM0QtGY5kstqEODw8QEQELAhJTc08KBBMEFBUWDRcBE1pca20SGBkaEBsc
   AY5maFRIAgoLHRQRHh8gIQFlZnByqA8ZGSIQIyQjJQEmYgJ5p2ACrK4gJx4g
   KIZZAgdeAQ4ZI9kjKSor0AwEjeAs1S0cHAslLi4vMDDRWeRIfEsxMeET4ATy
   VoYLC5fizXEiAR84BeMG+pEm8EsAFhAjSlR4hR6fLxiF0AkCACH+aENyZWF0
   ZWQgYnkgQk1QVG9HSUYgUHJvIHZlcnNpb24gMi41DQqpIERldmVsQ29yIDE5
   OTcsMTk5OC4gQWxsIHJpZ2h0cyByZXNlcnZlZC4NCmh0dHA6Ly93d3cuZGV2
   ZWxjb3IuY29tADs=
EOD

editcut22 = TkPhotoImage.new(:data=><<'EOD')
   R0lGODlhFgAWAIMAAPwCBAQCBAwCBPz+/OTi5JyanOzq7DQyNGxqbAAAAAAA
   AAAAAAAAAAAAAAAAAAAAACH5BAEAAAAALAAAAAAWABYAAARbEMhJq704gxBE
   0Bf3cZo4kRJqBQNRfBucyudgvJS6VaxLzyMa6/bLiWA9HOg4VIIkL5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BAUGBwgJCgsLgpCRAAwNlZYODxALEY+SkAMN
   EqKjEw0UD5yegqCjrRMVEqidkgWhraMWF7GptLa3EgEWFRSOnhW+vxgZEBqz
   kBvItxwdHryRCNGjHyAhHSLOgtgSI60c2yQjJd+eJqEnKK0hJCgnJSngAO0S
   F+8qEvL0VrBogW+BLX4oVKgIyMIFQU8KfDV4R+8FDBcxZBREthAFiRIsOsyg
   sVEUh4Un3pGoUcPGjZInK65QicPlxg8oX5RwqNJGjo0hdJwQ6EIkjRM6dvDY
   CKIHSBc1Ztjw4eOH0oIrsgIJEqSFDBo0cuTgsdSTo7No0xYTZCcQACH+aENy
   ZWF0ZWQgYnkgQk1QVG9HSUYgUHJvIHZlcnNpb24gMi41DQqpIERldmVsQ29y
   IDE5OTcsMTk5OC4gQWxsIHJpZ2h0cyByZXNlcnZlZC4NCmh0dHA6Ly93d3cu
   ZGV2ZWxjb3IuY29tADs=
EOD

text22 = TkPhotoImage.new(:data=><<'EOD')
   R0lGODlhFgAWAIQAAPwCBAQCBBwaHAwKDBQSFLy+vLS2tJSWlBQWFKyqrFRS
   VCwqLDQyNNTS1GxqbFxaXJyanIyOjAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
   AAAAAAAAAAAAAAAAAAAAAAAAACH5BAEAAAAALAAAAAAWABYAAAVcICCOZGmK
   QSoMaZsShBsQBdAapHvgaIDUqUPJlRjSbAoT0fRDKgODRbF0PLUYjZO2F2Bs
   t9evNix+dsvDlGKK5jraudQb7qbX6a2HEJ+ycyF+LRE8ZTI+fX5oGCEAIf5o
   Q3JlYXRlZCBieSBCTVBUb0dJRiBQcm8gdmVyc2lvbiAyLjUNCqkgRGV2ZWxD
   b3IgMTk5NywxOTk4LiBBbGwgcmlnaHRzIHJlc2VydmVkLg0KaHR0cDovL3d3
   dy5kZXZlbGNvci5jb20AOw==
EOD

##########################################

bmp_dir = File.join(File.dirname(File.expand_path(__FILE__)),
                    '../catalog_demo/images')

##########################################

status_var = TkVariable.new
radio_var  = TkVariable.new
check_var1 = TkVariable.new
check_var2 = TkVariable.new

tb = Tk::Iwidgets::Toolbar.new(:helpvariable=>status_var)

##########################################

tb.add(:button, :helpstr=>'Copy It', :image=>editcopy22,
       :balloonstr=>'Copy', :command=>proc{puts 'Copy It'})

tb.add(:button, :helpstr=>'Cut It', :image=>editcut22,
       :balloonstr=>'Cut', :command=>proc{puts 'Cut It'})

tb.add(:button, :helpstr=>'Paste It', :image=>editpaste22,
       :balloonstr=>'Paste', :command=>proc{puts 'Paste It'})

tb.add(:button, :helpstr=>'Delete It', :image=>editdelete22,
       :balloonstr=>'Delete', :command=>proc{puts 'Delete It'})

#--------------------------------

tb.add(:frame, :borderwidth=>1, :width=>10, :height=>10)

#--------------------------------

tb.add(:radiobutton, :variable=>radio_var, :value=>'Box',
       :bitmap=>"@#{bmp_dir}/box.xbm",
       :helpstr=>'Radio Button #1', :balloonstr=>'Radio',
       :command=>proc{puts 'Radio Button "Box"'})

tb.add(:radiobutton, :variable=>radio_var, :value=>'Line',
       :bitmap=>"@#{bmp_dir}/line.xbm",
       :helpstr=>'Radio Button #2', :balloonstr=>'Radio',
       :command=>proc{puts 'Radio Button "Line"'})

tb.add(:radiobutton, :variable=>radio_var, :value=>'Oval',
       :bitmap=>"@#{bmp_dir}/oval.xbm",
       :helpstr=>'Radio Button #3', :balloonstr=>'Radio',
       :command=>proc{puts 'Radio Button "Oval"'})

#--------------------------------

tb.add(:frame, :borderwidth=>1, :width=>10, :height=>10)

#--------------------------------

tb.add(:checkbutton, :variable=>check_var1, :onvalue=>'yes', :offvalue=>'no',
       :image=>text22, :command=>proc{puts 'Checkbutton 1'})

tb.add(:checkbutton, :variable=>check_var2, :onvalue=>'yes', :offvalue=>'no',
       :bitmap=>"@#{bmp_dir}/points.xbm", :command=>proc{puts 'Checkbutton 2'})

tb.pack(:side=>:top, :anchor=>:nw)

Tk.mainloop
