Curses-Devkit

 view release on metacpan or  search on metacpan

Cdk.pm  view on Meta::CPAN

use Cdk::Dialog;
use Cdk::Entry;
use Cdk::Fselect;
use Cdk::Graph;
use Cdk::Histogram;
use Cdk::Itemlist;
use Cdk::Label;
use Cdk::Marquee;
use Cdk::Matrix;
use Cdk::Mentry;
use Cdk::Menu;
use Cdk::Radio;
use Cdk::Scale;
use Cdk::Scroll;
use Cdk::Selection;
use Cdk::Slider;
use Cdk::Swindow;
use Cdk::Template;
use Cdk::Viewer;

1;

Cdk.xs  view on Meta::CPAN

	}

WINDOW *
GetWindow(object)
	CDKHISTOGRAM *	object
	CODE:
	{
	   RETVAL = object->win;
	}

MODULE	= Cdk	PACKAGE	= Cdk::Menu

CDKMENU *
New(menulist,menuloc,titleattr=A_REVERSE,subtitleattr=A_REVERSE,menuPos=TOP)
	SV *	menulist
	SV *	menuloc
	chtype	titleattr = sv2chtype ($arg);
	chtype	subtitleattr = sv2chtype ($arg);
	int	menuPos = sv2int ($arg);
	CODE:
	{

Cdk.xs  view on Meta::CPAN

	   int	x;

	   checkCdkInit();
	   
	   MAKE_CHAR_MATRIX(0,menulist,menuList,subSize,menulen);

	   MAKE_INT_ARRAY (0,menuloc,menuLoc,loclen);

	   if (menulen != loclen)
	   {
	      croak ("Cdk::Menu The menu list and menu location arrays are not the same size.");
	   }

	   RETVAL = newCDKMenu (GCDKSCREEN,menuList,menulen,subSize,menuLoc,menuPos,titleattr,subtitleattr);
	}
	OUTPUT:
	   RETVAL

int
Activate(object,...)
	CDKMENU *	object
	CODE:
	{
	   chtype Keys[300];
	   int arrayLen;
	   int value;

	   if (items > 1)
	   {
	      MAKE_CHTYPE_ARRAY(0,ST(1),Keys,arrayLen);

	      value = activateCDKMenu (object, Keys);
	   }
	   else
	   {
	      value = activateCDKMenu (object, NULL);
	   }

	   if (object->exitType == vEARLY_EXIT ||
	       object->exitType == vESCAPE_HIT)
	   {
              XSRETURN_UNDEF;
 	   }
	   RETVAL = value;
        }
	OUTPUT:
	   RETVAL

int
Inject(object,key)
	CDKMENU *	object
	chtype		key = sv2chtype ($arg);
	CODE:
	{
	   int selection = injectCDKMenu (object,key);
	   if (selection == -1)
	   {
	      XSRETURN_UNDEF;
	   }
	   RETVAL = selection;
	}
	OUTPUT:
	   RETVAL

void

Cdk.xs  view on Meta::CPAN

	   bindCDKObject (vMENU, object, key, PerlBindCB, function);
	}

int
PreProcess(object,functionRef)
	CDKMENU *	object
	SV *		functionRef
	CODE:
	{
	   SV *function = newSVsv (functionRef);
	   setCDKMenuPreProcess (object, PerlProcessCB, function);
	}

int
PostProcess(object,functionRef)
	CDKMENU *	object
	SV *		functionRef
	CODE:
	{
	   SV *function = newSVsv (functionRef);
	   setCDKMenuPostProcess (object, PerlProcessCB, function);
	}

void
Draw(object)
        CDKMENU *	object
        CODE:
        {
           drawCDKMenu (object);
        }

void
Erase(object)
	CDKMENU *	object
	CODE:
	{
	   eraseCDKMenu (object);
	}

void
SetCurrentItem(object,menuitem,submenuitem)
	CDKMENU *	object
	int		menuitem
	int		submenuitem
	CODE:
	{
	   setCDKMenuCurrentItem(object,menuitem,submenuitem);
	}

void
SetTitleHighlight(object,value)
	CDKMENU *	object
	chtype 		value
	CODE:
	{
	   setCDKMenuTitleHighlight (object,value);
	}

void
SetSubTitleHighlight(object,value)
	CDKMENU *	object
	chtype 		value
	CODE:
	{
	   setCDKMenuSubTitleHighlight (object,value);
	}

void
SetBackgroundColor(object,value)
	CDKMENU *	object
	char *		value
	CODE:
	{
	   setCDKMenuBackgroundColor (object,value);
	}

void
Register(object)
	CDKMENU *	object
	CODE:
	{
	   registerCDKObject (GCDKSCREEN, vMENU, object);
	}

Cdk.xs  view on Meta::CPAN

	{
	   destroyCDKHistogram (object);
	}

MODULE	= Cdk	PACKAGE	= CDKMENUPtr	PREFIX	= cdk_
void
cdk_DESTROY(object)
	CDKMENU *	object
	CODE:
	{
	   destroyCDKMenu (object);
	}

MODULE	= Cdk	PACKAGE	= CDKMENTRYPtr	PREFIX	= cdk_
void
cdk_DESTROY(object)
	CDKMENTRY *	object
	CODE:
	{
	   destroyCDKMentry (object);
	}

Cdk/Cdk/Menu.pm  view on Meta::CPAN

package Cdk::Menu;

@ISA	= qw (Cdk);

#
# This creates a new Menu object.
#
sub new
{
   my $type		= shift;
   my %params		= @_;
   my $self		= {};
   my $name		= "${type}::new";

   # Retain the type of the object.
   $self->{'Type'}	= $type;
   
   # Set up the parameters passed in.
   my $menuList		= Cdk::checkReq ($name, "Menulist", $params{'Menulist'});
   my $menuLoc		= Cdk::checkReq ($name, "Menuloc", $params{'Menuloc'});
   my $menuPos		= Cdk::checkDef ($name, "Menupos", $params{'Menupos'}, "TOP");
   my $titleAttr	= Cdk::checkDef ($name, "Tattrib", $params{'Tattrib'}, "A_REVERSE");
   my $subTitleAttr	= Cdk::checkDef ($name, "SubTattrib", $params{'SubTattrib'}, "A_REVERSE");

   # Create the thing.
   $self->{'Me'} = Cdk::Menu::New ($params{'Menulist'},
					$params{'Menuloc'},
					$titleAttr, $subTitleAttr, $menuPos);
   bless $self;
}

#
# This activates the object
#
sub activate
{
   my $self		= shift;
   my %params		= @_;
   my $name		= "$self->{'Type'}::activate";
   my $itemPicked;

   # Activatate the menu
   if (defined $params{'Input'})
   {
      $itemPicked = Cdk::Menu::Activate ($self->{'Me'}, $params{'Input'});
   }
   else
   {
      $itemPicked = Cdk::Menu::Activate ($self->{'Me'});
   }

   return if !defined $itemPicked;

   $self->{'Info'}	= $itemPicked;

   # Create the menu and submenu item values and return them.
   my $menuItem		= int($itemPicked / 100);
   my $submenuItem	= ($itemPicked % 100) + 1;
   

Cdk/Cdk/Menu.pm  view on Meta::CPAN

#
sub inject
{
   my $self	= shift;
   my %params	= @_;
   my $name	= "$self->{'Type'}::inject";

   # Set the values.
   my $character = Cdk::checkReq ($name, "Input", $params{'Input'});

   return (Cdk::Menu::Inject ($self->{'Me'}, $character));
}

#
# This sets several parameters of the widget.
#
sub set
{
   my $self	= shift;
   my %params	= @_;
   my $name	= "$self->{'Type'}::set";

   #
   # Check the parameters sent in.
   #
   if (defined $params{'CurrentItem'})
   {
      Cdk::Menu::SetCurrentItem ($self->{'Me'}, $params{'CurrentItem'});
   }
   if (defined $params{'TitleHighlight'})
   {
      Cdk::Menu::SetTitleHighlight ($self->{'Me'}, $params{'TitleHighlight'});
   }
   if (defined $params{'SubTitleHighlight'})
   {
      Cdk::Menu::SetSubTitleHighlight ($self->{'Me'}, $params{'SubTitleHighlight'});
   }
   if (defined $params{'BGColor'})
   {
      Cdk::Menu::SetBackgroundColor ($self->{'Me'}, $params{'BGColor'});
   }
}
#
# This draws the object.
#
sub draw
{
   my $self	= shift;
   my %params	= @_;
   my $name	= "$self->{'Type'}::draw";

   # Draw the object.
   Cdk::Menu::Draw ($self->{'Me'});
}

#
# This erases the object.
#
sub erase
{
   my $self	= shift;
   Cdk::Menu::Erase ($self->{'Me'});
}

#
# This allows us to bind a key to an action.
#
sub bind
{
   my $self	= shift;
   my %params	= @_;
   my $name	= "$self->{'Type'}::bind";

   # Set the values.
   my $key = Cdk::checkReq ($name, "Key", $params{'Key'});
   my $function	= Cdk::checkReq ($name, "Function", $params{'Function'});
   Cdk::Menu::Bind ($self->{'Me'}, $params{'Key'}, $params{'Function'});
}

#
# This allows us to set a pre-process function.
#
sub preProcess
{
   my $self	= shift;
   my %params	= @_;
   my $name	= "$self->{'Type'}::preProcess";
 
   # Set the values.
   my $function = Cdk::checkReq ($name, "Function", $params{'Function'});
   Cdk::Menu::PreProcess ($self->{'Me'}, $params{'Function'});
}

#
# This allows us to set a post-process function.
#
sub postProcess
{
   my $self	= shift;
   my %params	= @_;
   my $name	= "$self->{'Type'}::postProcess";
 
   # Set the values.
   my $function = Cdk::checkReq ($name, "Function", $params{'Function'});
   Cdk::Menu::PostProcess ($self->{'Me'}, $params{'Function'});
}

1;

Makefile.old  view on Meta::CPAN

	Cdk/Dialog.pm \
	Cdk/Entry.pm \
	Cdk/Fselect.pm \
	Cdk/Graph.pm \
	Cdk/Histogram.pm \
	Cdk/Itemlist.pm \
	Cdk/Label.pm \
	Cdk/Marquee.pm \
	Cdk/Matrix.pm \
	Cdk/Mentry.pm \
	Cdk/Menu.pm \
	Cdk/Radio.pm \
	Cdk/Scale.pm \
	Cdk/Scroll.pm \
	Cdk/Selection.pm \
	Cdk/Slider.pm \
	Cdk/Swindow.pm \
	Cdk/Template.pm \
	Cdk/Viewer.pm

PM_TO_BLIB = Cdk/Menu.pm \
	$(INST_LIBDIR)/Cdk/Menu.pm \
	Cdk/Matrix.pm \
	$(INST_LIBDIR)/Cdk/Matrix.pm \
	Cdk/Diag.pm \
	$(INST_LIBDIR)/Cdk/Diag.pm \
	Cdk/Calendar.pm \
	$(INST_LIBDIR)/Cdk/Calendar.pm \
	Cdk/Template.pm \
	$(INST_LIBDIR)/Cdk/Template.pm \
	Cdk/Mentry.pm \
	$(INST_LIBDIR)/Cdk/Mentry.pm \

Makefile.old  view on Meta::CPAN

	-mv Makefile Makefile.old 2>/dev/null


# --- MakeMaker realclean section:

# Delete temporary files (via clean) and also delete installed files
realclean purge ::  clean
	rm -rf $(INST_AUTODIR) $(INST_ARCHAUTODIR)
	rm -f $(INST_DYNAMIC) $(INST_BOOT)
	rm -f $(INST_STATIC)
	rm -f $(INST_LIBDIR)/Cdk/Menu.pm $(INST_LIBDIR)/Cdk/Matrix.pm $(INST_LIBDIR)/Cdk/Diag.pm $(INST_LIBDIR)/Cdk/Calendar.pm $(INST_LIBDIR)/Cdk/Template.pm $(INST_LIBDIR)/Cdk/Mentry.pm $(INST_LIBDIR)/Cdk/Label.pm $(INST_LIBDIR)/Cdk/Alphalist.pm $(INST_LI...
	rm -rf Makefile Makefile.old


# --- MakeMaker dist_basics section:

distclean :: realclean distcheck

distcheck :
	$(PERL) -I$(PERL_ARCHLIB) -I$(PERL_LIB) -e 'use ExtUtils::Manifest "&fullcheck";' \
		-e 'fullcheck();'

demos/rolodex  view on Meta::CPAN

use Cdk;
Cdk::init();

# Declare global variables.
$GGroupInfoChanged = 0;
@GLineType = ("Voice", "Cell", "Pager", 
			"First FAX", "Second FAX", "Third FAX",
			"First Data Line", "Second Data Line", "Third Data Line");

# Create the menu list items.
my $fMenu = ["</5/B>File", "</5/B>Open   ", "</5/B>Save   ", "</5/B>Save As", "</5/B>Quit   "];
my $eMenu = ["</5/B>Groups", "</5/B>New   ", "</5/B>Open  ", "</5/B>Delete"];
my $pMenu = ["</5/B>Print", "</5/B>Print Rolodex"];
my $hMenu = ["</5/B>Help", "</5/B>About Rolodex     ", "</5/B>Rolodex Statistics"];
my $menulist = [$fMenu, $eMenu, $pMenu, $hMenu];
my $menuloc = ["LEFT", "LEFT", "LEFT", "RIGHT"];

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

# Create the title.
my @title = ("<C></16/U>Cdk/Perl5 Rolodex", "<C></16>Written by Mike Glover");
my $rolodexTitle = new Cdk::Label ('Message' => \@title, 'Box' => "FALSE");
$rolodexTitle->draw("Box" => "FALSE");

# Load up the RC file.
my $filename = $ENV{"HOME"} . "/.rolorc";
my $dbmDir = $ENV{"HOME"} . "/.rolodex";

examples/menu  view on Meta::CPAN

#!../../../perl -w

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

#
# 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

fulldemo/cdkdemo  view on Meta::CPAN


# Create the title.
my $title = new Cdk::Label ('Message' => \@titleMessage, 'Box'  => "FALSE");

# Set some global vars
my $CONTINUE	= "</B/48>Press Any Key To Continue.<!B!48>";
my $HOME	= $ENV{'HOME'};

# Create the menu.
my $currentLoc	= 0;
my @mLoc	= ("Switch to Pull-Up Menu  ", "Switch to Pull-Down Menu");
my @fMenu	= ("</5>File<!5>", "</5>Quit<!5>");

my @iMenu	= ("</5>Info<!5>",
			"</5>Calendar        <!5>",
			"</5>Date            <!5>",
			"</5>Label           <!5>",
			"</5>Scrolling Window<!5>",
			"</5>Viewer          <!5>");

my @eMenu	= ("</5>Entry<!5>",
			"</5>Entry Field              <!5>",
			"</5>Item List                <!5>",
			"</5>Matrix                   <!5>",
			"</5>Multiple Line Entry Field<!5>",
			"</5>Scale                    <!5>",
			"</5>Slider                   <!5>",
			"</5>Template                 <!5>");

my @lMenu	= ("</5>Lists<!5>",
			"</5>Alpha List    <!5>",
			"</5>Dialog        <!5>",
			"</5>Radio List    <!5>",
			"</5>Scrolling List<!5>",
			"</5>Selection List<!5>");

my @mMenu	= ("</5>Misc<!5>",
			"</5>Histogram               <!5>",
			"</5>Graph                   <!5>",
			"</5>Marquee                 <!5>",
			"</5>Menu                    <!5>",
			"</5>$mLoc[$currentLoc]");

my @hMenu	= ("</5>Help<!5>",
			"</5>General Help<!5>",
			"</5>Widget Help <!5>",
			"</5>About...    <!5>");

# Create the pulldown menu menu lists.
my @menulist = (\@fMenu, \@iMenu, \@eMenu, \@lMenu, \@mMenu, \@hMenu);

# Set the location of the menus
my @menuloc = ("LEFT", "LEFT", "LEFT", "LEFT", "LEFT", "RIGHT");

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

# Create the callback for the menu.
$menu->bind ('Key' => '?', 'Function' => sub { main::menuCallback($menu); });

# Create the scrolling window.
my $swindow = new Cdk::Swindow ('Title' => "<C></U>Menu Selection History<!U>",
				'Lines' => 200,
				'Height' => 6,
				'Width' => 60,
				'Ypos' => "BOTTOM");
my $menuItemCount = 0;

# Let the user play.
for (;;)
{
   # Redraw the screen.

fulldemo/cdkdemo  view on Meta::CPAN

   {
      matrixDemo();
   }
   elsif ($menuSelection =~ "$mLoc[$currentLoc]")
   {
      # We are going to switch the menu type.
      if ($currentLoc == 0)
      {
         # Pull-Down to Pull-Up
         $currentLoc = 1;
         @mMenu = ("</5>Misc<!5>",
			"</5>Histogram               <!5>",
			"</5>Graph                   <!5>",
			"</5>Marquee                 <!5>",
			"</5>Menu                    <!5>",
			"</5>$mLoc[$currentLoc]");
         @menulist = (\@fMenu, \@iMenu, \@eMenu, \@lMenu, \@mMenu, \@hMenu);
         undef $menu;
         $menu = new Cdk::Menu ('Menulist' => \@menulist,
				'Menuloc' => \@menuloc,
				'Tattrib' => $highlight,
				'Menupos' => "BOTTOM",
				'SubTattrib' => $highlight);
      }
      elsif ($currentLoc == 1)
      {
         # Pull-Up to Pull-Down
         $currentLoc = 0;
         @mMenu = ("</5>Misc<!5>",
			"</5>Histogram               <!5>",
			"</5>Graph                   <!5>",
			"</5>Marquee                 <!5>",
			"</5>Menu                    <!5>",
			"</5>$mLoc[$currentLoc]");
         @menulist = (\@fMenu, \@iMenu, \@eMenu, \@lMenu, \@mMenu, \@hMenu);
         undef $menu;
         $menu = new Cdk::Menu ('Menulist' => \@menulist,
				'Menuloc' => \@menuloc,
				'Tattrib' => $highlight,
				'Menupos' => "TOP",
				'SubTattrib' => $highlight);
      }
   }
   elsif ($menuSelection =~ "Menu")
   {
      # Pop up a message stating what we got.
      my @mesg	= ("<C>The Cdk Menu widget is what",
			"is driving this application.", "",
			"<C>$CONTINUE");
      labelDemo (@mesg);
   }
   elsif ($menuSelection =~ "Dialog")
   {
      dialogDemo();
   }
   elsif ($menuSelection =~ "Scrolling List")
   {

fulldemo/cdkdemo  view on Meta::CPAN

			"</B/40>Calendar Widget             <!40>",
			"</B/40>Dialog Widget               <!40>",
			"</B/40>Entry Field Widget          <!40>",
			"</B/40>File Selector Widget        <!40>",
			"</B/40>Graph Widget                <!40>",
			"</B/40>Histogram Widget            <!40>",
			"</B/40>Item List Widget            <!40>",
			"</B/40>Label Widget                <!40>",
			"</B/40>Marquee Widget              <!40>",
			"</B/40>Matrix Widget               <!40>",
			"</B/40>Menu Widget                 <!40>",
			"</B/40>Multiple Line Entry Widget  <!40>",
			"</B/40>Radio List Widget           <!40>",
			"</B/40>Scale Widget                <!40>",
			"</B/40>Scrolling List Widget       <!40>",
			"</B/40>Scrolling Window Widget     <!40>",
			"</B/40>Selection List Widget       <!40>",
			"</B/40>Slider Widget               <!40>",
			"</B/40>Template Widget             <!40>",
			"</B/40>Viewer Widget               <!40>",
			"</B/40>Exit Help                   <!40>");

fulldemo/help/general.help  view on Meta::CPAN

<C><#VL></U>Graph         <#VL>Draws a graph.                                      <!U><#VL>
<C><#VL></U>Histogram     <#VL>Draws a histogram.                                  <!U><#VL>
<C><#VL>Item List     <#VL>Creates a pop up field which allows the user to     <#VL>
<C><#VL>              <#VL>select one of several choices in a small field. Very<#VL>
<C><#VL>              <#VL>useful for things like days of the week or month    <#VL>
<C><#VL></U>              <#VL>names.                                              <!U><#VL>
<C><#VL>Label         <#VL>Displays messages in a pop up box, or the label can <#VL>
<C><#VL></U>              <#VL>be considered part of the screen.                   <!U><#VL>
<C><#VL></U>Marquee       <#VL>Displays a message in a scrolling marquee.          <!U><#VL>
<C><#VL></U>Matrix        <#VL>Creates a complex matrix with lots of options.      <!U><#VL>
<C><#VL></U>Menu          <#VL>Creates a pull-down menu interface.                 <!U><#VL>
<C><#VL>Multiple Line <#VL>A multiple line entry field. Very useful for long   <#VL>
<C><#VL></U>Entry Field   <#VL>fields. (like a description field)                  <!U><#VL>
<C><#VL></U>Radio List    <#VL>Creates a radio button list.                        <!U><#VL>
<C><#VL>Scale         <#VL>Creates a numeric scale. Allows a user to pick a    <#VL>
<C><#VL>              <#VL>numeric value and restrict them to a range of       <#VL>
<C><#VL></U>              <#VL>values.                                             <!U><#VL>
<C><#VL></U>Scrolling List<#VL>Creates a scrolling list/menu list.                 <!U><#VL>
<C><#VL>Scrolling     <#VL>Creates a scrolling log file viewer. Can add        <#VL>
<C><#VL>Window        <#VL>information into the window while its running.      <#VL>
<C><#VL>              <#VL>A good widget for displaying the progress of        <#VL>

fulldemo/help/menu.help  view on Meta::CPAN

</R>Purpose<!R>
The menu widget allows the programmer to create a pull-down menu widget. 
Complete with sub-menu items.

</R>Construction Options<!R>
A menu widget is defined using the following syntax. The variable
</B>$menuObject<!B> contains a reference to the menu object.
<C></B>$menuObject = new Cdk::Menu ( options );
 
The options are defined in the following table.

</U>Option      Default Value       Type       Purpose<!U>
Menulist    Required            Array Ref  This is the menu title list.
Menuloc     Required            Array Ref  This is the menu title location list.
Tattrib     Reverse             Scalar     This is the attribute of the currently highlighted menu title.
SubTattrib  Reverse             Scalar     This is the attribute of the currently highlighted menu item.

</R>Available Methods<!R>
</B>activate<!B>
Activation of an object means to make the object available for use. The 
following example demonstrates how to activate a menu widget.
<C></B>$returnValue = $menuObject->activate ();

The variable </B>$returnValue<!B> is an integer value which represents the



( run in 1.823 second using v1.01-cache-2.11-cpan-49f99fa48dc )