/*
 * gfm_ui.c - User interface object initialization functions.
 * This file was generated by `gxv' from `gfm.G'.
 * DO NOT EDIT BY HAND.
 */

#include <stdio.h>
#include <sys/param.h>
#include <sys/types.h>
#include <xview/xview.h>
#include <xview/canvas.h>
#include <xview/panel.h>
#include <xview/scrollbar.h>
#include <xview/svrimage.h>
#include <xview/termsw.h>
#include <xview/text.h>
#include <xview/tty.h>
#include <xview/xv_xrect.h>
#include <group.h>
#include "gfm_ui.h"

/*
 * Initialize an instance of object `popup'.
 */
gfm_popup_objects *
gfm_popup_objects_initialize(ip, owner)
	gfm_popup_objects	*ip;
	Xv_opaque	owner;
{
	if (!ip && !(ip = (gfm_popup_objects *) calloc(1, sizeof (gfm_popup_objects))))
		return (gfm_popup_objects *) NULL;
	if (!ip->popup)
		ip->popup = gfm_popup_popup_create(ip, owner);
	if (!ip->controls)
		ip->controls = gfm_popup_controls_create(ip, ip->popup);
	if (!ip->directory)
		ip->directory = gfm_popup_directory_create(ip, ip->controls);
	if (!ip->list)
		ip->list = gfm_popup_list_create(ip, ip->controls);
	if (!ip->file)
		ip->file = gfm_popup_file_create(ip, ip->controls);
	if (!ip->file_list_group)
		ip->file_list_group = gfm_popup_file_list_group_create(ip, ip->controls);
	if (!ip->load)
		ip->load = gfm_popup_load_create(ip, ip->controls);
	if (!ip->props_group)
		ip->props_group = gfm_popup_props_group_create(ip, ip->controls);
	window_fit(ip->controls);
	
	window_fit(ip->popup);
	
	xv_set(ip->controls,
		XV_WIDTH, WIN_EXTEND_TO_EDGE,
		XV_HEIGHT, WIN_EXTEND_TO_EDGE,
		NULL);
	return ip;
}

/*
 * Create object `popup' in the specified instance.
 */
Xv_opaque
gfm_popup_popup_create(ip, owner)
	gfm_popup_objects	*ip;
	Xv_opaque		owner;
{
	extern Notify_value	gfm_resize();
	Xv_opaque	obj;
	
	obj = xv_create(owner, FRAME_CMD,
		XV_KEY_DATA, INSTANCE, ip,
		XV_WIDTH, 313,
		XV_HEIGHT, 306,
		XV_LABEL, "File Chooser",
		XV_SHOW, FALSE,
		FRAME_SHOW_FOOTER, TRUE,
		FRAME_SHOW_RESIZE_CORNER, TRUE,
		FRAME_CMD_PUSHPIN_IN, FALSE,
		NULL);
	xv_set(obj, WIN_CONSUME_EVENTS,
		WIN_MOUSE_BUTTONS,
		LOC_WINENTER,
		LOC_WINEXIT,
		WIN_ASCII_EVENTS,
		NULL, NULL);
	notify_interpose_event_func(obj,
		(Notify_func) gfm_resize, NOTIFY_SAFE);
	xv_set(xv_get(obj, FRAME_CMD_PANEL), WIN_SHOW, FALSE, NULL);
	return obj;
}

/*
 * Create object `controls' in the specified instance.
 */
Xv_opaque
gfm_popup_controls_create(ip, owner)
	gfm_popup_objects	*ip;
	Xv_opaque		owner;
{
	Xv_opaque	obj;
	
	obj = xv_create(owner, PANEL,
		XV_KEY_DATA, INSTANCE, ip,
		XV_HELP_DATA, "gfm:controls",
		XV_X, 0,
		XV_Y, 0,
		XV_WIDTH, WIN_EXTEND_TO_EDGE,
		XV_HEIGHT, WIN_EXTEND_TO_EDGE,
		WIN_BORDER, FALSE,
		NULL);
	return obj;
}

/*
 * Create object `directory' in the specified instance.
 */
Xv_opaque
gfm_popup_directory_create(ip, owner)
	gfm_popup_objects	*ip;
	Xv_opaque		owner;
{
	Xv_opaque	obj;
	
	obj = xv_create(owner, PANEL_TEXT,
		XV_KEY_DATA, INSTANCE, ip,
		XV_HELP_DATA, "gfm:directory",
		XV_X, 10,
		XV_Y, 10,
		PANEL_VALUE_DISPLAY_LENGTH, 28,
		PANEL_VALUE_STORED_LENGTH, 1024,
		PANEL_LABEL_STRING, "Directory:",
		PANEL_LAYOUT, PANEL_HORIZONTAL,
		PANEL_VALUE_UNDERLINED, FALSE,
		PANEL_READ_ONLY, TRUE,
		NULL);
	return obj;
}

/*
 * Create object `list' in the specified instance.
 */
Xv_opaque
gfm_popup_list_create(ip, owner)
	gfm_popup_objects	*ip;
	Xv_opaque		owner;
{
	extern int		gfm_list_proc();
	Xv_opaque	obj;
	
	obj = xv_create(owner, PANEL_LIST,
		XV_KEY_DATA, INSTANCE, ip,
		XV_HELP_DATA, "gfm:list",
		XV_X, 10,
		XV_Y, 35,
		PANEL_LIST_WIDTH, 275,
		PANEL_LIST_DISPLAY_ROWS, 10,
		PANEL_LAYOUT, PANEL_HORIZONTAL,
		PANEL_READ_ONLY, TRUE,
		PANEL_CHOOSE_ONE, TRUE,
		PANEL_CHOOSE_NONE, FALSE,
		PANEL_NOTIFY_PROC, gfm_list_proc,
		NULL);
	return obj;
}

/*
 * Create object `file' in the specified instance.
 */
Xv_opaque
gfm_popup_file_create(ip, owner)
	gfm_popup_objects	*ip;
	Xv_opaque		owner;
{
	extern Panel_setting	gfm_file_notify();
	Xv_opaque	obj;
	
	obj = xv_create(owner, PANEL_TEXT,
		XV_KEY_DATA, INSTANCE, ip,
		XV_HELP_DATA, "gfm:file",
		XV_X, 10,
		XV_Y, 245,
		PANEL_VALUE_DISPLAY_LENGTH, 30,
		PANEL_VALUE_STORED_LENGTH, 1024,
		PANEL_LABEL_STRING, "Name:",
		PANEL_LAYOUT, PANEL_HORIZONTAL,
		PANEL_READ_ONLY, FALSE,
		PANEL_NOTIFY_PROC, gfm_file_notify,
		NULL);
	return obj;
}

/*
 * Create object `file_list_group' in the specified instance.
 */
Xv_opaque
gfm_popup_file_list_group_create(ip, owner)
	gfm_popup_objects	*ip;
	Xv_opaque		owner;
{
	Xv_opaque	obj;
	
	obj = xv_create(owner, GROUP,
		XV_KEY_DATA, INSTANCE, ip,
		XV_X, 10,
		XV_Y, 10,
		GROUP_TYPE, GROUP_COLUMN,
		GROUP_MEMBERS,
			ip->directory,
			ip->list,
			ip->file,
			NULL,
		GROUP_COLUMN_ALIGNMENT, GROUP_LEFT_EDGES,
		GROUP_VERTICAL_SPACING, 10,
		NULL);
	return obj;
}

/*
 * Create object `load' in the specified instance.
 */
Xv_opaque
gfm_popup_load_create(ip, owner)
	gfm_popup_objects	*ip;
	Xv_opaque		owner;
{
	extern void		gfm_open();
	Xv_opaque	obj;
	
	obj = xv_create(owner, PANEL_BUTTON,
		XV_KEY_DATA, INSTANCE, ip,
		XV_HELP_DATA, "gfm:load",
		XV_X, 136,
		XV_Y, 280,
		PANEL_LABEL_STRING, "Load",
		PANEL_NOTIFY_PROC, gfm_open,
		NULL);
	return obj;
}

/*
 * Create object `props_group' in the specified instance.
 */
Xv_opaque
gfm_popup_props_group_create(ip, owner)
	gfm_popup_objects	*ip;
	Xv_opaque		owner;
{
	Xv_opaque	obj;
	
	obj = xv_create(owner, GROUP,
		XV_KEY_DATA, INSTANCE, ip,
		XV_X, 10,
		XV_Y, 10,
		GROUP_TYPE, GROUP_COLUMN,
		GROUP_MEMBERS,
			ip->file_list_group,
			ip->load,
			NULL,
		GROUP_COLUMN_ALIGNMENT, GROUP_VERTICAL_CENTERS,
		GROUP_VERTICAL_SPACING, 20,
		GROUP_ANCHOR_OBJ, ip->controls,
		GROUP_ANCHOR_POINT, GROUP_NORTHWEST,
		GROUP_REFERENCE_POINT, GROUP_NORTHWEST,
		GROUP_HORIZONTAL_OFFSET, 10,
		GROUP_VERTICAL_OFFSET, 10,
		NULL);
	return obj;
}

