/***********************************************************************
 *
 *	This file is used in conjunction with suntool.st to provide an example
 *	interface to the SunTool/SunView windowing system.  You link this
 *	file into the GNU Smalltalk image, and uncomment a #define in mstcint.c
 *	called SUN_WIN_HACKS.  You then load in suntools.st into and you're
 *	ready to go (assuming that you're using the CFuncs.st in this
 *	directory). 
 *
 ***********************************************************************/

/***********************************************************************
 *
 * Copyright (C) 1990, 1991, 1992, 1994 Free Software Foundation, Inc.
 * Written by Steve Byrne.
 *
 * This file is part of GNU Smalltalk.
 *
 * GNU Smalltalk is free software; you can redistribute it and/or modify it
 * under the terms of the GNU General Public License as published by the Free
 * Software Foundation; either version 1, or (at your option) any later 
 * version.
 * 
 * GNU Smalltalk is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
 * more details.
 * 
 * You should have received a copy of the GNU General Public License along with
 * GNU Smalltalk; see the file COPYING.  If not, write to the Free Software
 * Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  
 *
 ***********************************************************************/




#include <stdio.h>
#include <ctype.h>
#include <suntool/sunview.h>
#include <suntool/panel.h>
#include <suntool/canvas.h>
#include <suntool/window.h>
#include <suntool/textsw.h>
#include <suntool/panel.h>
#include <suntool/walkmenu.h>
#include <suntool/icon.h>

#if defined(__STDC__)
#define ATTR_TAB(attr_name)  #attr_name, (caddr_t)(attr_name)
#else
#define ATTR_TAB(attr_name)  "attr_name", (caddr_t)(attr_name)
#endif

int		windowLoop(), my_panel_set_value();
caddr_t		my_panel_get_value(), lookupCAddr();

typedef struct addrEntryStruct {
  char		*name;
  caddr_t	addr;
} *addrEntry;

struct addrEntryStruct cAddrs[] = {
  ATTR_TAB(FRAME),

  ATTR_TAB(PANEL),
  ATTR_TAB(PANEL_MESSAGE),
  ATTR_TAB(PANEL_BUTTON),
  ATTR_TAB(PANEL_CHOICE),
  ATTR_TAB(PANEL_SLIDER),
  ATTR_TAB(PANEL_TEXT),
/*  ATTR_TAB(PANEL_TOGGLE), */
  ATTR_TAB(PANEL_LINE),

  ATTR_TAB(PANEL_ITEM_X),
  ATTR_TAB(PANEL_ITEM_X_GAP),
  ATTR_TAB(PANEL_LABEL_X),
  ATTR_TAB(PANEL_VALUE_X),
  ATTR_TAB(PANEL_SLIDER_WIDTH),
  ATTR_TAB(PANEL_WIDTH),
  ATTR_TAB(PANEL_CHOICE_X),
  ATTR_TAB(PANEL_MARK_X),
  ATTR_TAB(PANEL_CHOICE_XS),
  ATTR_TAB(PANEL_MARK_XS),
  ATTR_TAB(PANEL_ITEM_Y),
  ATTR_TAB(PANEL_ITEM_Y_GAP),
  ATTR_TAB(PANEL_LABEL_Y),
  ATTR_TAB(PANEL_VALUE_Y),
  ATTR_TAB(PANEL_HEIGHT),
  ATTR_TAB(PANEL_CHOICE_Y),
  ATTR_TAB(PANEL_MARK_Y),
  ATTR_TAB(PANEL_CHOICE_YS),
  ATTR_TAB(PANEL_MARK_YS),
  ATTR_TAB(PANEL_VALUE),
  ATTR_TAB(PANEL_LABEL_DISPLAY_LENGTH),
  ATTR_TAB(PANEL_VALUE_DISPLAY_LENGTH),
  ATTR_TAB(PANEL_VALUE_STORED_LENGTH),
  ATTR_TAB(PANEL_MIN_VALUE),
  ATTR_TAB(PANEL_MAX_VALUE),
  ATTR_TAB(PANEL_CHOICE_OFFSET),
  ATTR_TAB(PANEL_TIMER_SECS),
  ATTR_TAB(PANEL_TIMER_USECS),
  ATTR_TAB(PANEL_MENU_CHOICE_VALUES),
  ATTR_TAB(PANEL_VALUE_UNDERLINED),
  ATTR_TAB(PANEL_ITEM_BOXED),
  ATTR_TAB(PANEL_LABEL_BOLD),
  ATTR_TAB(PANEL_CHOICES_BOLD),
  ATTR_TAB(PANEL_SHOW_ITEM),
  ATTR_TAB(PANEL_SHOW_VALUE),
  ATTR_TAB(PANEL_SHOW_RANGE),
  ATTR_TAB(PANEL_SHOW_MENU),
  ATTR_TAB(PANEL_SHOW_MENU_MARK),
  ATTR_TAB(PANEL_CHOOSE_ONE),
  ATTR_TAB(PANEL_ADJUSTABLE),
  ATTR_TAB(PANEL_BLINK_CARET),
  ATTR_TAB(PANEL_ACCEPT_KEYSTROKE),
  ATTR_TAB(PANEL_LABEL_SHADED),
  ATTR_TAB(PANEL_TOGGLE_VALUE),
  ATTR_TAB(PANEL_NOTIFY_LEVEL),
  ATTR_TAB(PANEL_DISPLAY_LEVEL),
  ATTR_TAB(PANEL_LAYOUT),
  ATTR_TAB(PANEL_FEEDBACK),
  ATTR_TAB(PANEL_PAINT),
  ATTR_TAB(PANEL_MOUSE_STATE),
  ATTR_TAB(PANEL_MASK_CHAR),
  ATTR_TAB(PANEL_LABEL_STRING),
  ATTR_TAB(PANEL_VALUE_STRING),
  ATTR_TAB(PANEL_NOTIFY_STRING),
  ATTR_TAB(PANEL_MENU_TITLE_STRING),
  ATTR_TAB(PANEL_NAME),
  ATTR_TAB(PANEL_CHOICE_STRINGS),
  ATTR_TAB(PANEL_MENU_CHOICE_STRINGS),
  ATTR_TAB(PANEL_CHOICE_STRING),
  ATTR_TAB(PANEL_LABEL_IMAGE),
  ATTR_TAB(PANEL_MENU_TITLE_IMAGE),
  ATTR_TAB(PANEL_MENU_MARK_IMAGE),
  ATTR_TAB(PANEL_MENU_NOMARK_IMAGE),
  ATTR_TAB(PANEL_TYPE_IMAGE),
  ATTR_TAB(PANEL_CHOICE_IMAGES),
  ATTR_TAB(PANEL_MENU_CHOICE_IMAGES),
  ATTR_TAB(PANEL_MARK_IMAGES),
  ATTR_TAB(PANEL_NOMARK_IMAGES),
  ATTR_TAB(PANEL_CHOICE_IMAGE),
  ATTR_TAB(PANEL_MARK_IMAGE),
  ATTR_TAB(PANEL_NOMARK_IMAGE),
  ATTR_TAB(PANEL_LABEL_FONT),
  ATTR_TAB(PANEL_VALUE_FONT),
  ATTR_TAB(PANEL_MENU_TITLE_FONT),
  ATTR_TAB(PANEL_FONT),
  ATTR_TAB(PANEL_CHOICE_FONTS),
  ATTR_TAB(PANEL_MENU_CHOICE_FONTS),
  ATTR_TAB(PANEL_NOTIFY_PROC),
  ATTR_TAB(PANEL_TIMER_PROC),
  ATTR_TAB(PANEL_EVENT_PROC),
  ATTR_TAB(PANEL_BACKGROUND_PROC),
  ATTR_TAB(PANEL_ITEM_RECT),
  ATTR_TAB(PANEL_PIXWIN),
  ATTR_TAB(PANEL_CLIENT_DATA),
  ATTR_TAB(PANEL_VERTICAL_SCROLLBAR),
  ATTR_TAB(PANEL_HORIZONTAL_SCROLLBAR),
  ATTR_TAB(PANEL_CURSOR),
  ATTR_TAB(PANEL_CARET_ITEM),
  ATTR_TAB(PANEL_FIRST_ITEM),
  ATTR_TAB(PANEL_NEXT_ITEM),
  ATTR_TAB(PANEL_PARENT_PANEL),

  ATTR_TAB(FRAME_CLOSED),
  ATTR_TAB(FRAME_INHERIT_COLORS),
  ATTR_TAB(FRAME_SHOW_LABEL),
  ATTR_TAB(FRAME_SUBWINDOWS_ADJUSTABLE),
  ATTR_TAB(FRAME_LABEL),
  ATTR_TAB(FRAME_FOREGROUND_COLOR),
  ATTR_TAB(FRAME_BACKGROUND_COLOR),
  ATTR_TAB(FRAME_ICON),
  ATTR_TAB(FRAME_CLOSED_X),
  ATTR_TAB(FRAME_CLOSED_Y),
  ATTR_TAB(FRAME_CLOSED_RECT),
  ATTR_TAB(FRAME_CURRENT_RECT),
  ATTR_TAB(FRAME_OPEN_RECT),
  ATTR_TAB(FRAME_ARGS),
  ATTR_TAB(FRAME_ARGC_PTR_ARGV),
  ATTR_TAB(FRAME_CMDLINE_HELP_PROC),
  ATTR_TAB(FRAME_BORDER_STYLE),
  ATTR_TAB(FRAME_EMBOLDEN_LABEL),
  ATTR_TAB(FRAME_NTH_WINDOW),
  ATTR_TAB(FRAME_NTH_SUBWINDOW),
  ATTR_TAB(FRAME_NTH_SUBFRAME),
  ATTR_TAB(FRAME_DONE_PROC),
  ATTR_TAB(FRAME_DEFAULT_DONE_PROC),
  ATTR_TAB(FRAME_NO_CONFIRM),
  ATTR_TAB(FRAME_NULL_ATTR),

  ATTR_TAB(CANVAS_PIXWIN),
  ATTR_TAB(CANVAS_LEFT),
  ATTR_TAB(CANVAS_TOP),
  ATTR_TAB(CANVAS_WIDTH),
  ATTR_TAB(CANVAS_HEIGHT),
  ATTR_TAB(CANVAS_DEPTH),
  ATTR_TAB(CANVAS_MARGIN),
  ATTR_TAB(CANVAS_RETAINED),
  ATTR_TAB(CANVAS_FIXED_IMAGE),
  ATTR_TAB(CANVAS_REPAINT_PROC),
  ATTR_TAB(CANVAS_RESIZE_PROC),
  ATTR_TAB(CANVAS_AUTO_CLEAR),
  ATTR_TAB(CANVAS_AUTO_EXPAND),
  ATTR_TAB(CANVAS_AUTO_SHRINK),
  ATTR_TAB(CANVAS_FAST_MONO),

  ATTR_TAB(WIN_ERROR_MSG),
  ATTR_TAB(WIN_X),
  ATTR_TAB(WIN_Y),
  ATTR_TAB(WIN_RIGHT_OF),
  ATTR_TAB(WIN_BELOW),
  ATTR_TAB(WIN_WIDTH),
  ATTR_TAB(WIN_HEIGHT),
  ATTR_TAB(WIN_PERCENT_WIDTH),
  ATTR_TAB(WIN_PERCENT_HEIGHT),
  ATTR_TAB(WIN_COLUMNS),
  ATTR_TAB(WIN_ROWS),
  ATTR_TAB(WIN_RECT),
  ATTR_TAB(WIN_SCREEN_RECT),
  ATTR_TAB(WIN_FIT_HEIGHT),
  ATTR_TAB(WIN_FIT_WIDTH),
  ATTR_TAB(WIN_SHOW),
  ATTR_TAB(WIN_MENU),
  ATTR_TAB(WIN_CURSOR),
  ATTR_TAB(WIN_HORIZONTAL_SCROLLBAR),
  ATTR_TAB(WIN_VERTICAL_SCROLLBAR),
  ATTR_TAB(WIN_EVENT_PROC),
  ATTR_TAB(WIN_INPUT_DESIGNEE),
  ATTR_TAB(WIN_GRAB_ALL_INPUT),
  ATTR_TAB(WIN_KBD_INPUT_MASK),
  ATTR_TAB(WIN_CONSUME_KBD_EVENT),
  ATTR_TAB(WIN_IGNORE_KBD_EVENT),
  ATTR_TAB(WIN_CONSUME_KBD_EVENTS),
  ATTR_TAB(WIN_IGNORE_KBD_EVENTS),
  ATTR_TAB(WIN_PICK_INPUT_MASK),
  ATTR_TAB(WIN_CONSUME_PICK_EVENT),
  ATTR_TAB(WIN_IGNORE_PICK_EVENT),
  ATTR_TAB(WIN_CONSUME_PICK_EVENTS),
  ATTR_TAB(WIN_IGNORE_PICK_EVENTS),
  ATTR_TAB(WIN_FONT),
  ATTR_TAB(WIN_TOP_MARGIN),
  ATTR_TAB(WIN_BOTTOM_MARGIN),
  ATTR_TAB(WIN_LEFT_MARGIN),
  ATTR_TAB(WIN_RIGHT_MARGIN),
  ATTR_TAB(WIN_ROW_HEIGHT),
  ATTR_TAB(WIN_COLUMN_WIDTH),
  ATTR_TAB(WIN_ROW_GAP),
  ATTR_TAB(WIN_COLUMN_GAP),
  ATTR_TAB(WIN_TYPE),
  ATTR_TAB(WIN_OWNER),
  ATTR_TAB(WIN_NAME),
  ATTR_TAB(WIN_CLIENT_DATA),
  ATTR_TAB(WIN_IMPL_DATA),
  ATTR_TAB(WIN_FD),
  ATTR_TAB(WIN_DEVICE_NAME),
  ATTR_TAB(WIN_DEVICE_NUMBER),
  ATTR_TAB(WIN_PIXWIN),
  ATTR_TAB(WIN_MOUSE_XY),
  ATTR_TAB(WIN_SHOW_UPDATES),
  ATTR_TAB(WIN_OBJECT),
  ATTR_TAB(WIN_GET_PROC),
  ATTR_TAB(WIN_SET_PROC),
  ATTR_TAB(WIN_PRESET_PROC),
  ATTR_TAB(WIN_POSTSET_PROC),
  ATTR_TAB(WIN_LAYOUT_PROC),
  ATTR_TAB(WIN_NOTIFY_DESTROY_PROC),
  ATTR_TAB(WIN_NOTIFY_EVENT_PROC),
  ATTR_TAB(WIN_DEFAULT_EVENT_PROC),
  ATTR_TAB(WIN_CREATED),
  ATTR_TAB(WIN_COMPATIBILITY),
  ATTR_TAB(WIN_COMPATIBILITY_INFO),
  ATTR_TAB(WIN_REGISTER),
  ATTR_TAB(WIN_NOTIFY_INFO),
  ATTR_TAB(WIN_NULL_ATTR),
  ATTR_TAB(WIN_KBD_FOCUS),
  ATTR_TAB(WIN_EVENT_STATE),

  ATTR_TAB(TEXTSW_ADJUST_IS_PENDING_DELETE),
  ATTR_TAB(TEXTSW_AGAIN_LIMIT),
  ATTR_TAB(TEXTSW_AGAIN_RECORDING),
  ATTR_TAB(TEXTSW_AUTO_INDENT),
  ATTR_TAB(TEXTSW_AUTO_SCROLL_BY),
  ATTR_TAB(TEXTSW_BLINK_CARET),
  ATTR_TAB(TEXTSW_BROWSING),
  ATTR_TAB(TEXTSW_CHECKPOINT_FREQUENCY),
  ATTR_TAB(TEXTSW_CLIENT_DATA),
  ATTR_TAB(TEXTSW_CONFIRM_OVERWRITE),
  ATTR_TAB(TEXTSW_CONTENTS),
  ATTR_TAB(TEXTSW_CONTROL_CHARS_USE_FONT),
  ATTR_TAB(TEXTSW_DESTROY_ALL_VIEWS),
  ATTR_TAB(TEXTSW_DISABLE_CD),
  ATTR_TAB(TEXTSW_DISABLE_LOAD),
  ATTR_TAB(TEXTSW_EDIT_BACK_CHAR),
  ATTR_TAB(TEXTSW_EDIT_BACK_LINE),
  ATTR_TAB(TEXTSW_EDIT_BACK_WORD),
  ATTR_TAB(TEXTSW_EDIT_COUNT),
  ATTR_TAB(TEXTSW_ERROR_MSG),
  ATTR_TAB(TEXTSW_ES_CREATE_PROC),
  ATTR_TAB(TEXTSW_FILE),
  ATTR_TAB(TEXTSW_FONT),
  ATTR_TAB(TEXTSW_HEIGHT),
  ATTR_TAB(TEXTSW_HISTORY_LIMIT),
  ATTR_TAB(TEXTSW_IGNORE_LIMIT),
  ATTR_TAB(TEXTSW_INSERT_MAKES_VISIBLE),
  ATTR_TAB(TEXTSW_INSERT_ONLY),
  ATTR_TAB(TEXTSW_INSERTION_POINT),
  ATTR_TAB(TEXTSW_LENGTH),
  ATTR_TAB(TEXTSW_LOAD_DIR_IS_CD),
  ATTR_TAB(TEXTSW_LOWER_CONTEXT),
  ATTR_TAB(TEXTSW_MEMORY_MAXIMUM),
  ATTR_TAB(TEXTSW_MENU),
  ATTR_TAB(TEXTSW_MODIFIED),
  ATTR_TAB(TEXTSW_MULTI_CLICK_SPACE),
  ATTR_TAB(TEXTSW_MULTI_CLICK_TIMEOUT),
  ATTR_TAB(TEXTSW_MUST_SHOW_CARET),
  ATTR_TAB(TEXTSW_NAME),
  ATTR_TAB(TEXTSW_NAME_TO_USE),
/*  ATTR_TAB(TEXTSW_NO_PIECE_INSERT), */
  ATTR_TAB(TEXTSW_NO_RESET_TO_SCRATCH),
  ATTR_TAB(TEXTSW_NO_SELECTION_SERVICE),
  ATTR_TAB(TEXTSW_NOTIFY_LEVEL),
  ATTR_TAB(TEXTSW_NOTIFY_PROC),
  ATTR_TAB(TEXTSW_PIXWIN),
  ATTR_TAB(TEXTSW_READ_ONLY),
  ATTR_TAB(TEXTSW_RESET_MODE),
  ATTR_TAB(TEXTSW_STATUS),
  ATTR_TAB(TEXTSW_STORE_CHANGES_FILE),
  ATTR_TAB(TEXTSW_STORE_SELF_IS_SAVE),
  ATTR_TAB(TEXTSW_TAB_WIDTH),
  ATTR_TAB(TEXTSW_TOOL),
  ATTR_TAB(TEXTSW_UPPER_CONTEXT),
  ATTR_TAB(TEXTSW_WIDTH),
  ATTR_TAB(TEXTSW_COALESCE_WITH),
  ATTR_TAB(TEXTSW_END_ALL_VIEWS),
  ATTR_TAB(TEXTSW_FOR_ALL_VIEWS),
  ATTR_TAB(TEXTSW_FIRST),
  ATTR_TAB(TEXTSW_FIRST_LINE),
  ATTR_TAB(TEXTSW_LEFT_MARGIN),
  ATTR_TAB(TEXTSW_LINE_BREAK_ACTION),
  ATTR_TAB(TEXTSW_RIGHT_MARGIN),
  ATTR_TAB(TEXTSW_SCROLLBAR),
  ATTR_TAB(TEXTSW_UPDATE_SCROLLBAR),
  ATTR_TAB(TEXTSW_SPARE_1),
  ATTR_TAB(TEXTSW_SPARE_2),

  ATTR_TAB(MENU_ACTION_PROC),
  ATTR_TAB(MENU_ACTION),
  ATTR_TAB(MENU_ACTION_IMAGE),
  ATTR_TAB(MENU_ACTION_ITEM),
  ATTR_TAB(MENU_APPEND_ITEM),
  ATTR_TAB(MENU_APPEND),
  ATTR_TAB(MENU_BOXED),
  ATTR_TAB(MENU_CENTER),
  ATTR_TAB(MENU_CLIENT_DATA),
  ATTR_TAB(MENU_COLUMN_MAJOR),
  ATTR_TAB(MENU_DEFAULT),
  ATTR_TAB(MENU_DEFAULT_ITEM),
  ATTR_TAB(MENU_DEFAULT_IMAGE),
  ATTR_TAB(MENU_DISABLE_ITEM),
  ATTR_TAB(MENU_DEFAULT_SELECTION),
  ATTR_TAB(MENU_DESCEND_FIRST),
  ATTR_TAB(MENU_FEEDBACK),
  ATTR_TAB(MENU_FIRST_EVENT),
  ATTR_TAB(MENU_FONT),
  ATTR_TAB(MENU_GEN_PULLRIGHT),
  ATTR_TAB(MENU_GEN_PULLRIGHT_IMAGE),
  ATTR_TAB(MENU_GEN_PULLRIGHT_ITEM),
  ATTR_TAB(MENU_GEN_PROC),
  ATTR_TAB(MENU_GEN_PROC_IMAGE),
  ATTR_TAB(MENU_GEN_PROC_ITEM),
  ATTR_TAB(MENU_HEIGHT),
  ATTR_TAB(MENU_IMAGE),
  ATTR_TAB(MENU_IMAGE_ITEM),
  ATTR_TAB(MENU_IMAGES),
  ATTR_TAB(MENU_INITIAL_SELECTION),
  ATTR_TAB(MENU_INITIAL_SELECTION_SELECTED),
  ATTR_TAB(MENU_INITIAL_SELECTION_EXPANDED),
  ATTR_TAB(MENU_INACTIVE),
  ATTR_TAB(MENU_INSERT),
  ATTR_TAB(MENU_INSERT_ITEM),
  ATTR_TAB(MENU_ITEM),
  ATTR_TAB(MENU_INVERT),
  ATTR_TAB(MENU_JUMP_AFTER_SELECTION),
  ATTR_TAB(MENU_JUMP_AFTER_NO_SELECTION),
  ATTR_TAB(MENU_LAST_EVENT),
  ATTR_TAB(MENU_LEFT_MARGIN),
  ATTR_TAB(MENU_LIKE),
  ATTR_TAB(MENU_MARGIN),
  ATTR_TAB(MENU_MENU),
  ATTR_TAB(MENU_NITEMS),
  ATTR_TAB(MENU_NOTIFY_PROC),
  ATTR_TAB(MENU_NTH_ITEM),
  ATTR_TAB(MENU_NCOLS),
  ATTR_TAB(MENU_NROWS),
  ATTR_TAB(MENU_PARENT),
  ATTR_TAB(MENU_PULLRIGHT),
  ATTR_TAB(MENU_PULLRIGHT_DELTA),
  ATTR_TAB(MENU_PULLRIGHT_IMAGE),
  ATTR_TAB(MENU_PULLRIGHT_ITEM),
  ATTR_TAB(MENU_RELEASE),
  ATTR_TAB(MENU_RELEASE_IMAGE),
  ATTR_TAB(MENU_REMOVE),
  ATTR_TAB(MENU_REMOVE_ITEM),
  ATTR_TAB(MENU_REPLACE),
  ATTR_TAB(MENU_REPLACE_ITEM),
  ATTR_TAB(MENU_RIGHT_MARGIN),
  ATTR_TAB(MENU_SELECTED),
  ATTR_TAB(MENU_SELECTED_ITEM),
  ATTR_TAB(MENU_SHADOW),
  ATTR_TAB(MENU_STAY_UP),
  ATTR_TAB(MENU_STRING),
  ATTR_TAB(MENU_STRING_ITEM),
  ATTR_TAB(MENU_STRINGS),
  ATTR_TAB(MENU_TITLE_ITEM),
  ATTR_TAB(MENU_TITLE_IMAGE),
  ATTR_TAB(MENU_TYPE),
  ATTR_TAB(MENU_VALID_RESULT),
  ATTR_TAB(MENU_VALUE),
  ATTR_TAB(MENU_WIDTH),
  ATTR_TAB(MENU_NOP),
  ATTR_TAB(MENU_BUTTON),
  ATTR_TAB(MENU_FD),
  ATTR_TAB(MENU_IE),
  ATTR_TAB(MENU_POS),

  ATTR_TAB(ICON_X),
  ATTR_TAB(ICON_Y),
  ATTR_TAB(ICON_WIDTH),
  ATTR_TAB(ICON_HEIGHT),
  ATTR_TAB(ICON_IMAGE_RECT),
  ATTR_TAB(ICON_LABEL_RECT),
  ATTR_TAB(ICON_IMAGE),
  ATTR_TAB(ICON_LABEL),
  ATTR_TAB(ICON_FONT),

  ATTR_TAB(PANEL_CLEAR),
  ATTR_TAB(PANEL_NO_CLEAR),
  ATTR_TAB(PANEL_NONE),
  ATTR_TAB(PANEL_ALL),
  ATTR_TAB(PANEL_NON_PRINTABLE),
  ATTR_TAB(PANEL_SPECIFIED),
  ATTR_TAB(PANEL_CURRENT),
  ATTR_TAB(PANEL_DONE),
  ATTR_TAB(PANEL_MARKED),
  ATTR_TAB(PANEL_VERTICAL),
  ATTR_TAB(PANEL_HORIZONTAL),
  ATTR_TAB(PANEL_INVERTED),
  ATTR_TAB(PANEL_INSERT),
  ATTR_TAB(PANEL_NEXT),
  ATTR_TAB(PANEL_PREVIOUS),
  ATTR_TAB(PANEL_NONE_DOWN),
  ATTR_TAB(PANEL_LEFT_DOWN),
  ATTR_TAB(PANEL_MIDDLE_DOWN),
  ATTR_TAB(PANEL_RIGHT_DOWN),
  ATTR_TAB(PANEL_CHORD_DOWN),
  NULL, NULL
};

defineWindowFuncs()
{
  defineCFunc("lookupCAddr", lookupCAddr);

  defineCFunc("windowLoop", windowLoop);
  defineCFunc("windowGet", window_get);
  defineCFunc("windowSet", window_set);
  defineCFunc("windowCreate", window_create);

  defineCFunc("panelGet", panel_get);
  defineCFunc("panelSet", panel_set);
  defineCFunc("panelCreateItem", panel_create_item);
  defineCFunc("panelGetValue", my_panel_get_value);
  defineCFunc("panelSetValue", my_panel_set_value);
}

caddr_t lookupCAddr(str)
char	*str;
{
  addrEntry	ap;

  for (ap = cAddrs; ap->name; ap++) {
    if (strcmp(str, ap->name) == 0) {
      return (ap->addr);
    }
  }

  return (NULL);
}


windowLoop(frame)
Frame frame;
{
  window_main_loop(frame);
}

caddr_t my_panel_get_value(item)
Panel_item item;
{
  return (panel_get_value(item));
}

my_panel_set_value(item, value)
Panel_item item;
caddr_t value;
{
  panel_set_value(item, value);
}



#ifdef old_code /* Sat Sep 30 22:20:10 1989 */
/**/void *jeff(width, height)
/**/{
/**/  Frame frame;
/**/  Panel panel;
/**/  Canvas canvas;
/**/  
/**/  frame = window_create(0, FRAME, FRAME_LABEL, "Go",
/**/			WIN_WIDTH, width,
/**/			WIN_HEIGHT, height,
/**/			0);
/**/
/**/  panel = window_create(frame, PANEL, 0);
/**/
/**/  panel_create_item(panel, PANEL_BUTTON,
/**/		    PANEL_LABEL_IMAGE, panel_button_image(panel, "Start", 0, 0),
/**/		    0);
/**/
/**/  panel_create_item(panel, PANEL_BUTTON,
/**/		    PANEL_LABEL_IMAGE, panel_button_image(panel, "Quit", 0, 0),
/**/		    0);
/**/
/**/  window_fit_height(panel);
/**/
/**/  canvas = window_create(frame, CANVAS,
/**/			 CANVAS_HEIGHT, window_get(frame, WIN_HEIGHT) -
/**/			                window_get(panel, WIN_HEIGHT),
/**/			 0);
/**/
/**/printf("returning %x\n", frame);
/**/  return (frame);
/**/}
#endif /* old_code Sat Sep 30 22:20:10 1989 */

#ifdef old_code /* Sat Sep 30 22:19:39 1989 */
/**/void *getAttrValue(index)
/**/int	index;
/**/{
/**/  return ((void *)attrs[index].value);
/**/}
/**/
/**/char *getAttrName(index)
/**/int	index;
/**/{
/**/  static char lb[50], *sp, *dp;
/**/  int upper;
/**/
/**/  if (attrs[index].name == 0) {
/**/    return ("");
/**/  }
/**/
/**/  sp = attrs[index].name;
/**/  dp = lb;
/**/
/**/  upper = 1;
/**/
/**/  for (; *sp; sp++) {
/**/    if (*sp == '_') {
/**/      upper = 1;
/**/      continue;
/**/    }
/**/
/**/    if (upper) {
/**/      *dp++ = *sp;
/**/      upper = 0;
/**/    } else {
/**/      if (isupper(*sp)) {
/**/	*dp++ = tolower(*sp);
/**/      } else {
/**/	*dp++ = *sp;
/**/      }
/**/    }
/**/    
/**/  }
/**/
/**/  *dp = '\0';
/**/  return (lb);
/**/}
/**/
/**/
#endif /* old_code Sat Sep 30 22:19:39 1989 */
