NAME

Tk::MenuDialog - A Moo based object oriented interface for creating and display a dialog of buttons to be used as a menu using Tk

VERSION

Version 0.01

SYNOPSIS

use Tk::MenuDialog;
use File::Basename qw(dirname);

my $menu = Tk::MenuDialog->new;

## Add the script's directory to the icon path
## when searching for icon files
$menu->add_icon_path(dirname(__FILE__));

## Add menu items to the menu
$menu->add_item(
  label => qq{&Configure},
  icon  => qq{settings.png},
  );
$menu->add_item(
  label => qq{&Run Tests},
  icon  => qq{run.png},
  );
  
## Allow operator to cancel the menu
$menu->can_cancel(1);

## Display the menu and return hash reference of the selected item, 
## or UNDEF if canceled
my $selection = $menu->show;

ATTRIBUTES

title

    Title of the menu

    DEFAULT: ''

can_cancel

    Indicates if the operator can close the dialog without a selection

    DEFAULT: 1

cancel_on_escape

    Boolean value indicating if pressing the Escape key should simulate closing the window and canceling the dialog.

    DEFAULT: 1

items

    The items contained in this menu.

icon_path

    An array containing various paths to use when locating icon image files.

button_font

    Font to use for the buttons.

    DEFAULT: 'times 10'

min_width

    Minimum width of the dialog.

    DEFAULT: 300

min_height

    Minimum height of the dialog.

    DEFAULT: 80

METHODS

add_item($hash)

Description

Add a field to the form.

Parameters

A hash reference with the following key / value pairs: label - Required paramater with icon - Optional filename of the icon to display icon_location - Optional location relative to button text for the icon DEFAULT: "left"

Return

UNDEF on error, or the hash reference of the item created

show($parent)

Description

Show the dialog as a child of the given parent, or as a new MainWindow if a parent is not specified.

The function will return if the users cancels the dialog or clicks a button

Parameters

$parent - Parent window, if none is specified, a new MainWindow will be created

Return

UNDEF when canceled, or the hash reference associated with the button clicked.

add_icon_path()

Description

Description goes here

Parameters

NONE

Return

NONE

AUTHOR

Paul Durden <alabamapaul AT gmail.com>

COPYRIGHT & LICENSE

Copyright (C) 2015 by Paul Durden.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.