Xforms4Perl

 view release on metacpan or  search on metacpan

DEMOS/clipboard.pl  view on Meta::CPAN

#!/usr/bin/perl -w
#-*-perl-*-
# Autogenerated by fd2pl from fdesign file /root/clipboard.c
#
use X11::Xforms;
#

$clipboard = undef;
$TextBox = undef;
$SelectButton = undef;
$PasteButton = undef;
$DoneButton = undef;

$form_frozen = 0;

fl_initialize("ClipBoard");
create_the_forms();

fl_show_form($clipboard, FL_PLACE_FREE, FL_FULLBORDER, "Clipboard");

fl_do_forms();

exit(0);

sub create_form_clipboard {
  $obj = undef;
  $clipboard = fl_bgn_form(FL_NO_BOX, 280, 140);
  $obj = fl_add_box(FL_UP_BOX, 0, 0, 280, 140, "");
  $obj = fl_add_text(FL_NORMAL_TEXT, 10, 10, 260, 80, "This Text can be selected using the 'Select' button,\nor overwritten with the primary X selection\nusing the 'Paste' button");
  $TextBox = $obj;
  fl_set_object_boxtype($obj, FL_DOWN_BOX);
  fl_set_object_lalign($obj, FL_ALIGN_CENTER|FL_ALIGN_INSIDE);
  $obj = fl_add_button(FL_NORMAL_BUTTON, 10, 100, 80, 30, "Select");
  $SelectButton = $obj;
  fl_set_object_callback($obj, "process_select", 0);
  $obj = fl_add_button(FL_NORMAL_BUTTON, 100, 100, 80, 30, "Paste");
  $PasteButton = $obj;
  fl_set_object_callback($obj, "process_paste", 0);
  $obj = fl_add_button(FL_NORMAL_BUTTON, 190, 100, 80, 30, "Done");
  $DoneButton = $obj;
  fl_set_object_callback($obj, "process_done", 0);
  fl_end_form();
}

sub create_the_forms {
  create_form_clipboard();
}
 
sub process_select {

	my($obj, $val) = @_;
	fl_set_object_color($TextBox, FL_BLACK, FL_WHITE);
	fl_set_object_lcolor($TextBox, FL_WHITE);
    fl_stuff_clipboard($obj, $TextBox->label, "selection_lost");
}

sub process_paste {

	my($obj, $val) = @_;
	if (fl_request_clipboard($obj, "selection_obtained") == 0)
	{
		$form_frozen = 1;
		fl_freeze_form($clipboard);
	}
}

sub process_done {
	exit(0);
}

sub selection_lost {

	my($obj, $type) = @_;

DEMOS/clipboard.pl  view on Meta::CPAN


	my($obj, $type, $data, $size) = @_;

	$data = "There is no selection" if ($size == 0);
	fl_set_object_color($TextBox, FL_TEXT_COL1, FL_TEXT_COL2);
	fl_set_object_lcolor($TextBox, FL_TEXT_LCOL);
	fl_set_object_label($TextBox, $data);

	if ($form_frozen)
	{
		fl_unfreeze_form($clipboard);
		$form_frozen = 0;
	}
	return 0;
}

X11/Xforms/Xforms.pm.skel  view on Meta::CPAN

fl_remove_io_callback
fl_remove_selected_xevent
fl_remove_signal_callback
fl_remove_timeout
fl_replace_browser_line
fl_replace_chart_value
fl_replace_choice
fl_replace_folder_bynumber 
fl_replace_menu_item
fl_replace_xyplot_point
fl_request_clipboard
fl_reset_cursor
fl_reset_focus_object
fl_reset_vertex
fl_reset_winconstraints
fl_resume_timer
fl_ringbell
fl_root
fl_roundrect
fl_roundrectangle
fl_roundrectf

X11/Xforms/Xforms.pm.skel  view on Meta::CPAN

fl_show_menu_symbol
fl_show_message
fl_show_messages
fl_show_object
fl_show_oneliner
fl_show_question
fl_show_simple_input
fl_showpup
fl_signal_caught
fl_simple_line
fl_stuff_clipboard
fl_suspend_timer
fl_textcolor
fl_textgc
fl_transient
fl_trigger_object
fl_ul_magic_char
fl_unfreeze_all_forms
fl_unfreeze_form
fl_unset_clipping
fl_unset_gc_clipping

X11/Xforms/Xforms.xs  view on Meta::CPAN

				  event,parm);
		return retint;
}

static int
process_lose_sel_cb(object, type)
FLObject *	object;
long		type;
{
	/*
	 * Generic lose clipboard selection callback
	 */

	int		retint;

	call_perl_callback((get_object_data(object))->od_losesel, 
		"Lose Selection",
		CB_RET_INT, (void *)&retint,
		"Ol",
		object,type);
		return retint;
}

static int
process_gain_sel_cb(object, type, data, size)
FLObject *	object;
long		type;
const void *data;
long		size;
{
	/*
	 * Generic gain clipboard selection data callback.
	 */
	int		retint;

	call_perl_callback((get_object_data(object))->od_gainsel, 
		"Gain Selection Data",
		CB_RET_INT, (void *)&retint,
		"Olsl",
		object,type,data,size);
		return retint;
}

X11/Xforms/Xforms.xs  view on Meta::CPAN

	SV *		callback
	long		parm
	ALIAS:
		fl_set_browser_dblclick_callback = 1
		fl_set_object_posthandler = 2
		fl_set_object_prehandler = 3
		fl_set_input_filter = 4
		fl_set_counter_filter = 5
		fl_set_slider_filter = 6
		fl_set_timer_filter = 7
		fl_request_clipboard = 100
	CODE:
	{
		int i;

		if (ix < 100)
			return_save_sv(&(ST(0)), 
			   &(((od_array *)get_object_data(object))->cb_ptr[ix]), 
			   callback);

		switch (ix) {

X11/Xforms/Xforms.xs  view on Meta::CPAN

			parm);
			break;
		case 1:
			fl_set_browser_dblclick_callback(object, 
			(SvNULL(callback) ? NULL : process_brdbl_callback), 
			parm);
			break;
#if FL_INCLUDE_VERSION >= 87
		case 100:
			savesv(&((get_object_data(object))->od_gainsel), callback);
			i = fl_request_clipboard(object, FL_STRING,
			(SvNULL(callback) ? NULL : process_gain_sel_cb));
			ST(0) = sv_newmortal();
			sv_setiv(ST(0), (IV)i);
			break;
#endif
		default:
			(cb_FLO_cb_funcs[ix-2])(object, 
			(SvNULL(callback) ? NULL : cb_FLO_cb_handlers[ix-2]));
			break;
		}

X11/Xforms/Xforms.xs  view on Meta::CPAN

			ST(0) = bless_object(RETVAL);
	}		

void 
fl_point(x,y,c)
	FL_Coord		x
	FL_Coord		y 
	FL_COLOR		c

int
fl_stuff_clipboard(object,string,callback)
	FLObject *      object
	char *			string
	SV *			callback
	CODE:
	{
		int size = strlen(string);
		savesv(&((get_object_data(object))->od_losesel), callback);
		RETVAL = fl_stuff_clipboard(object, FL_STRING, 
			string, (long)strlen(string),
			(SvNULL(callback) ? NULL : process_lose_sel_cb));
	}
	OUTPUT:
	RETVAL

void
fl_get_xyplot_data(object,id=0)
	FLObject *      object
	int				id

doc/Xforms.functions  view on Meta::CPAN

    fl_add_selected_xevent
    fl_addto_selected_xevent
    fl_last_event
    fl_print_xevent_name
    fl_remove_event_callback
    fl_remove_selected_xevent
    fl_set_event_callback

CLIPBOARD

    fl_request_clipboard
        fl_request_clipboard($object, $callback);
        NOTE: No type argument is passed - the type is always 
              FL_STRING.

    fl_stuff_clipboard
        fl_stuff_clipboard($object, $data_string, $callback)
        NOTE: No type argument is passed - the type is always 
              FL_STRING. Similarly no length argument is passed. 
              The length of the string is determined automatically.

DRAWING

    fl_add_float_vertex
    fl_add_vertex
    fl_arc
    fl_arcf



( run in 1.327 second using v1.01-cache-2.11-cpan-81fc1098f69 )