#!/usr/bin/perl -w
# $Id: menu,v 1.3 2013/07/14 22:47:35 tom Exp $

#
# Purpose:
#	To demonstrate the Perl5 Cdk Menu Widget

use strict;

#
# Initialize Cdk.
#
use Cdk;
Cdk::init();

# Create the menu list items.
my @fMenu = ( "File", "Save", "Open", "Delete", "Exit" );
my @eMenu = ( "Edit", "Cut",  "Copy", "Delete", "Paste" );
my @hMenu = ( "Help", "Help", "About..." );
my @menulist = ( \@fMenu, \@eMenu, \@hMenu );
my @menuloc = ( "LEFT", "LEFT", "RIGHT" );

# Create the menu object.
my $menu = new Cdk::Menu(
    'Menulist' => \@menulist,
    'Menuloc'  => \@menuloc
);

# Activate the object.
my ( $menuItem, $submenuItem ) = $menu->activate();

# Check the results.
if ( !defined $menuItem ) {
    popupLabel( ["<C>Escape hit. No menu item selected."] );
}
else {
    popupLabel( ["<C>Item Selected </R>$menulist[$menuItem]->[$submenuItem]"] );
}

# End Cdk.
Cdk::end();
