Curses-UI-POE

 view release on metacpan or  search on metacpan

POE.pm  view on Meta::CPAN


        unless ($#modal_objects) {
            $self->do_one_event;
        }
        else {
            # dispatch the event to the top-most modal object, or the root.
            $self->do_one_event($modal_objects[TOP]);
        }
    }

    # Set the root cursor mode
    unless ($self->{-no_output}) {
        Curses::curs_set($self->{-cursor_mode});
    }
}

sub timer {
    my ($self) = @_;

    # dispatch the event to the top-most modal object, or the root.
    my $top_object = $modal_objects[TOP];

    $top_object->do_timer;

    # Set the root cursor mode.
    unless ($self->{-no_output}) {
        Curses::curs_set($self->{-cursor_mode});
    }

    set_read_timeout($top_object);
}

sub shutdown {
    my ($kernel) = $_[ KERNEL ];

    # Unselect stdin
    $kernel->select(\*STDIN);

examples/color_editor  view on Meta::CPAN

		-tfg           => "white",
	);

	if (defined $file) 
	{
		if (open F, "<$file") {
		    my $text = "";
		    while (<F>) { $text .= $_ }
		    close F;
		    $editor->text($text);
		    $editor->cursor_to_home;
	 	    $currentfile = $file;
		} else { 
		    $cui->error(-message => "Can't read file \"$file\":\n$!");
		}
	}
}

sub save_dialog()
{

examples/demo-widgets  view on Meta::CPAN

$w{8}->add(
    undef, 'Label',
    -text => "The calendar can be used to select a date, somewhere between\n"
           . "the years 0 and 9999. It honours the transition from the\n"
	   . "Julian- to the Gregorian calender in 1752."
);

$w{8}->add(
    undef, 'Label',
    -y => 5, -x => 27,
    -text => "Use your cursor keys (or <H>, <J>, <K> and <L>)\n"
           . "to walk through the calender. Press <ENTER>\n"
	   . "or <SPACE> to select a date. Press <SHIFT+J> to\n"
	   . "go one month forward and <SHIFT+K> to go one\n"
	   . "month backward. Press <SHIFT+L> or <N> to go one\n"
	   . "year forward and <SHIFT+H> or <P> to go one year\n"
	   . "backward. Press <T> to go to today's date. Press\n"
	   . "<C> to go to the currently selected date."
);

$w{8}->add(

examples/editor  view on Meta::CPAN

		-file         => $currentfile,
	);

	if (defined $file) 
	{
		if (open F, "<$file") {
		    my $text = "";
		    while (<F>) { $text .= $_ }
		    close F;
		    $editor->text($text);
		    $editor->cursor_to_home;
	 	    $currentfile = $file;
		} else { 
		    $cui->error(-message => "Can't read file \"$file\":\n$!");
		}
	}
}

sub save_dialog()
{

examples/irc_client  view on Meta::CPAN


sub PRINT { 
    our @Channel;

    my $object = shift;
    my ($viewer, $curses) = @$object{qw( -viewer -curses )};

    push @Channel, shift;

    $viewer->text(join "\n", @Channel);
    $viewer->cursor_down(undef, $viewer->canvasheight);
    $viewer->draw;

#    $viewer->{-ypos} = @Channel;
#    $viewer->layout_content;

    $curses->draw;
}

sub PRINTF {
    our @Channel;

examples/irc_client  view on Meta::CPAN

    my ($viewer, $curses) = @$object{qw( -viewer -curses )};

    # XXX Hack: Just ignore bunk requests for now...
    if (grep !defined $_, @_) {
        carp "Attempt to print undefined value";
    }

    push @Channel, sprintf shift, @_;

    $viewer->text(join "\n", @Channel);
    $viewer->cursor_down(undef, $viewer->canvasheight);
    $viewer->draw;

#    $viewer->{-ypos} = @Channel;
#    $viewer->layout_content;

    $curses->draw;
}

sub TIEHANDLE { 
    my $curses = $_[-1];

examples/irc_client  view on Meta::CPAN

            }
        }
    }, KEY_ENTER;

    set_binding $editor sub {
        # Do nothing...overload the lose-focus event.
    }, KEY_TAB, KEY_BTAB;

    # Why doesn't this work?
    set_binding $editor sub {
        warn "Calling \$viewer->cursor_pageup";
        $viewer->cursor_pageup;
        $viewer->draw;
    }, KEY_PPAGE;

    set_binding $editor sub {
        warn "Calling \$viewer->cursor_pagedown";
        $viewer->cursor_pagedown;
        $viewer->draw;
    }, KEY_NPAGE;

    set_binding $editor sub { shift->text($History[--$Current]) }, KEY_UP;
    set_binding $editor sub {
        $Current++;
        if ($Current > @History)    { shift->text("") }
        else                        { shift->text( $History[$Current] ) }
    }, KEY_DOWN;

examples/pop3_reader  view on Meta::CPAN

	my $buttons = shift;
	my $conwin  = $buttons->parent;
	my $cui     = $conwin->root;

	foreach my $key ('username','password','host','port') 
	{
		my $obj = $conwin->getobj($key);
		my $value = $obj->get;
		$connection->{$key} = $value;
		# TODO: focus back to entry does not seem to
		# move the cursor with it.
		if ($value =~ /^\s*$/) {
			$cui->error("Missing value for $key field");
			$obj->focus;
			return;
		}
	}

	return 1;
}



( run in 0.324 second using v1.01-cache-2.11-cpan-4d50c553e7e )