puts "work in progress..." exit

require 'foxtails'

include Fox include FoxTails

class TreeWindow < FXMainWindow

def initialize(*args)
  super

  resize 300, 500

  status = FXStatusbar.new(self,
    LAYOUT_SIDE_BOTTOM|LAYOUT_FILL_X|STATUSBAR_WITH_DRAGCORNER)

  mb = FXMenuBar.new(self, LAYOUT_SIDE_TOP|LAYOUT_FILL_X)

  file_menu = FXMenuPane.new(self)
  FXMenuTitle.new(mb, "&File", nil, file_menu)

  FXMenuCommand.new(file_menu, "&Quit\tCtl-Q\tQuit the application.").
    connect (SEL_COMMAND) { getApp().exit }

  edit_menu = FXMenuPane.new(self)
  FXMenuTitle.new(mb, "&Edit", nil, edit_menu)

  view_menu = FXMenuPane.new(self)
  FXMenuTitle.new(mb, "&View", nil, view_menu)

  help_menu = FXMenuPane.new(self)
  FXMenuTitle.new(mb, "&Help", nil, help_menu, LAYOUT_RIGHT)

  splitter = FXSplitter.new(self, LAYOUT_SIDE_TOP|SPLITTER_HORIZONTAL|
    LAYOUT_FILL_X|LAYOUT_FILL_Y|SPLITTER_REVERSED|SPLITTER_TRACKING)

  f1 = FXVerticalFrame.new(splitter, FRAME_SUNKEN|FRAME_THICK,
         0,0,0,0, 0,0,0,0)
  tree = FXTreeList.new(f1, 0, nil, 0, (FRAME_SUNKEN|FRAME_THICK|
    LAYOUT_FILL_X|LAYOUT_FILL_Y|TREELIST_SHOWS_LINES|
    TREELIST_SHOWS_BOXES|TREELIST_ROOT_BOXES|TREELIST_EXTENDEDSELECT))

  folder_open   = FOLDER_OPEN_ICON
  folder_closed = FOLDER_CLOSED_ICON
  doc           = DOC_ICON

  topmost = tree.addItemLast(nil, "Top", folder_open, folder_closed)
  tree.expandTree(topmost)
    tree.addItemLast(topmost, "First", doc, doc)
    tree.addItemLast(topmost, "Second", doc, doc)
    tree.addItemLast(topmost, "Third", doc, doc)
    branch = tree.addItemLast(topmost, "Fourth", folder_open, folder_closed)
    tree.expandTree(branch)
      tree.addItemLast(branch, "Fourth-First", doc, doc)
      tree.addItemLast(branch, "Fourth-Second", doc, doc)
      twig = tree.addItemLast(branch, "Fourth-Third",
                              folder_open, folder_closed)t
        tree.addItemLast(twig, "Fourth-Third-First", doc, doc)
        tree.addItemLast(twig, "Fourth-Third-Second", doc, doc)
        tree.addItemLast(twig, "Fourth-Third-Third", doc, doc)
        leaf = tree.addItemLast(twig, "Fourth-Third-Fourth",
                                folder_open, folder_closed)
        leaf.setEnabled(false)
          tree.addItemLast(leaf, "Fourth-Third-Fourth-First", doc, doc)
          tree.addItemLast(leaf, "Fourth-Third-Fourth-Second", doc, doc)
          tree.addItemLast(leaf, "Fourth-Third-Fourth-Third", doc, doc)
      twig = tree.addItemLast(branch, "Fourth-Fourth",
                              folder_open, folder_closed)
        tree.addItemLast(twig, "Fourth-Fourth-First", doc, doc)
        tree.addItemLast(twig, "Fourth-Fourth-Second", doc, doc)
        tree.addItemLast(twig, "Fourth-Fourth-Third", doc, doc)
        0.upto(9) { |i| tree.addItemLast(twig, i.to_s, doc, doc) }
      twig = tree.addItemLast(branch, "Fourth-Fifth",
                              folder_open, folder_closed)
      tree.expandTree(twig)
        tree.addItemLast(twig, "Fourth-Fifth-First", doc, doc)
        tree.addItemLast(twig, "Fourth-Fifth-Second", doc, doc)
        tree.addItemLast(twig, "Fourth-Fifth-Third", doc, doc)
        0.upto(9) { |i| tree.addItemLast(twig, i.to_s, doc, doc) }
    tree.addItemLast(topmost, "Fifth", doc, doc)
    tree.addItemLast(topmost, "Sixth", doc, doc)
    branch = tree.addItemLast(topmost, "Seventh", folder_open, folder_closed)
      tree.addItemLast(branch, "Seventh-First", doc, doc)
      tree.addItemLast(branch, "Seventh-Second", doc, doc)
      tree.addItemLast(branch, "Seventh-Third", doc, doc)
    tree.addItemLast(topmost, "Eighth", doc, doc)

  f2 = FXVerticalFrame.new(splitter, FRAME_SUNKEN|FRAME_THICK)
  FXButton.new(f2, "FOO", nil, nil, 0, LAYOUT_FILL_X|LAYOUT_FILL_Y)
end

def create
  super
  show
end

end

class TreeApp < FTApp

def initialize
  super("Tree", "TEST")
  TreeWindow.new(self, "Tree")
end

end

TreeApp.new.run