# /********************************************************************************
# *                                                                               *
# *                                 Test Switcher                                 *
# *                                                                               *
# *********************************************************************************
# * Copyright (C) 1997,2006 by Jeroen van der Zijp.   All Rights Reserved.        *
# *********************************************************************************
# * $Id: switcher.cpp,v 1.16 2006/01/22 17:59:02 fox Exp $                        *
# ********************************************************************************/

from FXPy import *


# Switcher Test Window
class SwitcherTest(FXMainWindow):

    #  Generated by reswrap from file bigfolder.gif
    bigfolder = "47494638376120002000f20000b2c0dc808080ffffffffff00c0c0c00000008080000000002c000000002000200000038308badcfe30ca496b0c38670b83f82018708d3710678a12230998abaab65640dc78ae6b3c5fbca1a070382c1460b2983299341c05cb2853ea444aafd32a74cac56abbe0a8164b667ecbe8d338cc469ddbe175bafc9e77e570ef331f7fdae97b7f777e7c7a56854d8482548188624706919293949596913f469a9b9c9d9e9a2ea1a21309003b"

        # Generated by reswrap from file minifolder.gif
    minifolder = "47494638376110001000f20000b2c0dc808080c0c0c0ffff00000000ffffff0000000000002c000000001000100000033b08badc1b103a16c4b0224c50afcf91c41564699201317eac958e587bbd4121c77411efb35adf9e1c6f9703ba7ca164480520389f50e8664a752400003b"

    # Make some windows
    def __init__(self, app):
        super().__init__(app, "Switcher Test")

        # Tooltip
        FXToolTip(app)

        # Make icons
        icon1 = bytes.fromhex(SwitcherTest.bigfolder)
        big_folder = FXGIFIcon(app, icon1)

        icon2 = bytes.fromhex(SwitcherTest.minifolder)
        mini_folder = FXGIFIcon(app, icon2)

        # Menubar
        menubar = FXMenuBar(self,LAYOUT_SIDE_TOP|LAYOUT_FILL_X)

        # Separator
        FXHorizontalSeparator(self,LAYOUT_SIDE_TOP|LAYOUT_FILL_X|SEPARATOR_GROOVE)

        # Contents
        contents = FXHorizontalFrame(self,LAYOUT_SIDE_TOP|FRAME_NONE|LAYOUT_FILL_X|LAYOUT_FILL_Y|PACK_UNIFORM_WIDTH)

        # Buttons
        buttons = FXVerticalFrame(contents,LAYOUT_FILL_Y|LAYOUT_LEFT|PACK_UNIFORM_WIDTH)

        # Switcher
        switcher = FXSwitcher(contents,LAYOUT_FILL_X|LAYOUT_FILL_Y|LAYOUT_RIGHT|FRAME_THICK|FRAME_RAISED)

        # First item in switcher is a list
        simplelist = FXList(switcher,None,0,LIST_EXTENDEDSELECT)
        simplelist.appendItem("First Entry",mini_folder)
        simplelist.appendItem("Second Entry",big_folder)
        simplelist.appendItem("Third Entry",mini_folder)
        simplelist.appendItem("Fourth Entry",mini_folder)
        simplelist.appendItem("Fifth Entry",big_folder)
        simplelist.appendItem("Sixth Entry",mini_folder)

        # Second item is a file list
        filelist = FXFileList(switcher,None,0,ICONLIST_EXTENDEDSELECT)

        # Third item is a directory list
        dirlist = FXDirList(switcher,None,0,TREELIST_SHOWS_LINES|TREELIST_SHOWS_BOXES)

        # Add buttons
        FXLabel(buttons,"These buttons below\nare connected to the\nFXSwitcher Control.\nSo they are checked\nautomatically depending\non the active page\nof the switcher.",None,LAYOUT_FILL_Y|JUSTIFY_LEFT|JUSTIFY_TOP)
        FXButton(buttons,"&Simple List\tMake Switcher go to list",None,switcher,FXSwitcher.ID_OPEN_FIRST+0,FRAME_THICK|FRAME_RAISED)
        FXButton(buttons,"&File List\tMake Switcher go to files",None,switcher,FXSwitcher.ID_OPEN_FIRST+1,FRAME_THICK|FRAME_RAISED)
        FXButton(buttons,"&Tree List\tMake Switcher go to tree",None,switcher,FXSwitcher.ID_OPEN_FIRST+2,FRAME_THICK|FRAME_RAISED)

        # File Menu
        filemenu = FXMenuPane(self)
        FXMenuCommand(filemenu,"&Simple List",None,switcher,FXSwitcher.ID_OPEN_FIRST+0)
        FXMenuCommand(filemenu,"&File List",None,switcher,FXSwitcher.ID_OPEN_FIRST+1)
        FXMenuCommand(filemenu,"&Tree List",None,switcher,FXSwitcher.ID_OPEN_FIRST+2)
        FXMenuCommand(filemenu,"Dump widgets",None,app,FXApp.ID_DUMP)
        FXMenuCommand(filemenu,"&Quit\tCtl-Q",None,app,FXApp.ID_QUIT,0)
        FXMenuTitle(menubar,"&File",None,filemenu)


# Start the whole thing

# Make application
application = FXApp("Switcher","FoxTest")

# Open display
#application.init(argc,argv)

win = SwitcherTest(application)

# Create app
application.create()

win.show()

# Run
application.run()
