2003-09-02 05:51:35 -04:00
|
|
|
;; row-column.d
|
|
|
|
;;
|
|
|
|
;; $Id$
|
|
|
|
;;
|
|
|
|
;; Copyright 1990, 1991, 1992, 1993, 1994, 1995, Oliver Laumann, Berlin
|
2009-12-19 07:28:26 -05:00
|
|
|
;; Copyright 2002, 2003 Sam Hocevar <sam@hocevar.net>, Paris
|
2003-09-02 05:51:35 -04:00
|
|
|
;;
|
|
|
|
;; This software was derived from Elk 1.2, which was Copyright 1987, 1988,
|
|
|
|
;; 1989, Nixdorf Computer AG and TELES GmbH, Berlin (Elk 1.2 has been written
|
|
|
|
;; by Oliver Laumann for TELES Telematic Services, Berlin, in a joint project
|
|
|
|
;; between TELES and Nixdorf Microprocessor Engineering, Berlin).
|
|
|
|
;;
|
|
|
|
;; Oliver Laumann, TELES GmbH, Nixdorf Computer AG and Sam Hocevar, as co-
|
|
|
|
;; owners or individual owners of copyright in this software, grant to any
|
|
|
|
;; person or company a worldwide, royalty free, license to
|
|
|
|
;;
|
|
|
|
;; i) copy this software,
|
|
|
|
;; ii) prepare derivative works based on this software,
|
|
|
|
;; iii) distribute copies of this software or derivative works,
|
|
|
|
;; iv) perform this software, or
|
|
|
|
;; v) display this software,
|
|
|
|
;;
|
|
|
|
;; provided that this notice is not removed and that neither Oliver Laumann
|
|
|
|
;; nor Teles nor Nixdorf are deemed to have made any representations as to
|
|
|
|
;; the suitability of this software for any purpose nor are held responsible
|
|
|
|
;; for any defects of this software.
|
|
|
|
;;
|
|
|
|
;; THERE IS ABSOLUTELY NO WARRANTY FOR THIS SOFTWARE.
|
2003-08-19 15:19:38 -04:00
|
|
|
|
|
|
|
(define-widget-type 'rowcolumn "RowColumn.h")
|
|
|
|
|
|
|
|
(prolog
|
|
|
|
|
|
|
|
"static SYMDESCR Type_Syms[] = {
|
|
|
|
{ \"work-area\", XmWORK_AREA },
|
|
|
|
{ \"menu-bar\", XmMENU_BAR },
|
|
|
|
{ \"menu-pulldown\", XmMENU_PULLDOWN },
|
|
|
|
{ \"menu-popup\", XmMENU_POPUP },
|
|
|
|
{ \"menu-option\", XmMENU_OPTION },
|
|
|
|
{ 0, 0}
|
|
|
|
};")
|
|
|
|
|
|
|
|
(define-widget-class 'row-column 'xmRowColumnWidgetClass)
|
|
|
|
|
|
|
|
(prolog
|
|
|
|
|
2003-09-04 11:30:04 -04:00
|
|
|
"static void Post_Handler (Widget w, XtPointer client_data, XEvent *event,
|
|
|
|
Boolean *unused) {
|
2003-08-19 15:19:38 -04:00
|
|
|
unsigned int b;
|
|
|
|
Arg a;
|
|
|
|
XButtonPressedEvent *ep = (XButtonPressedEvent *)event;
|
|
|
|
Widget popup = (Widget)client_data;
|
|
|
|
|
|
|
|
XtSetArg (a, XmNwhichButton, &b);
|
|
|
|
XtGetValues (popup, &a, 1);
|
|
|
|
if (ep->button != b)
|
2006-09-18 12:59:55 -04:00
|
|
|
return;
|
2003-08-19 15:19:38 -04:00
|
|
|
XmMenuPosition (popup, ep);
|
|
|
|
XtManageChild (popup);
|
|
|
|
}")
|
|
|
|
|
|
|
|
(prolog
|
|
|
|
|
2003-09-04 11:30:04 -04:00
|
|
|
"static Object Get_Row_Column_CB (XmRowColumnCallbackStruct *p) {
|
2003-08-19 15:19:38 -04:00
|
|
|
Object ret, s;
|
|
|
|
GC_Node2;
|
|
|
|
|
|
|
|
ret = s = Make_Widget_Foreign (p->widget);
|
|
|
|
GC_Link2 (ret, s);
|
|
|
|
ret = Cons (ret, Null);
|
|
|
|
s = Get_Any_CB ((XmAnyCallbackStruct *)p);
|
|
|
|
ret = Cons (Cdr (s), ret);
|
|
|
|
ret = Cons (Car (s), ret);
|
|
|
|
GC_Unlink;
|
|
|
|
return ret;
|
|
|
|
}")
|
|
|
|
|
|
|
|
(define-primitive 'popup-menu-attach-to! '(m w)
|
|
|
|
" XtPointer client_data;
|
|
|
|
Arg a;
|
|
|
|
Check_Widget_Class (m, xmRowColumnWidgetClass);
|
|
|
|
Check_Widget (w);
|
|
|
|
XtSetArg (a, XmNuserData, &client_data);
|
|
|
|
XtGetValues (WIDGET(w)->widget, &a, 1);
|
|
|
|
if (client_data)
|
2006-09-18 12:59:55 -04:00
|
|
|
XtRemoveEventHandler (WIDGET(w)->widget, ButtonPressMask, 0,
|
|
|
|
Post_Handler, client_data);
|
2003-08-19 15:19:38 -04:00
|
|
|
client_data = (XtPointer)WIDGET(m)->widget;
|
|
|
|
XtAddEventHandler (WIDGET(w)->widget, ButtonPressMask, 0,
|
2006-09-18 12:59:55 -04:00
|
|
|
Post_Handler, client_data);
|
2003-08-19 15:19:38 -04:00
|
|
|
client_data = (XtPointer)WIDGET(m)->widget;
|
|
|
|
XtSetValues (WIDGET(w)->widget, &a, 1);
|
|
|
|
return Void;")
|
|
|
|
|
|
|
|
(define-callback 'row-column 'entryCallback #t)
|
|
|
|
|
|
|
|
(define row-column-callback->scheme
|
|
|
|
" return Get_Row_Column_CB ((XmRowColumnCallbackStruct *)x);")
|
|
|
|
|
|
|
|
(c->scheme 'callback:row-column-entryCallback row-column-callback->scheme)
|
|
|
|
|
|
|
|
(define scheme->row-column-type
|
|
|
|
" return (XtArgVal)Symbols_To_Bits (x, 0, Type_Syms);")
|
|
|
|
|
|
|
|
;;; whichButton resource is declared with a type of XtRWhichButton
|
|
|
|
;;; instead of XtRUnsignedInt. Argh!
|
|
|
|
|
|
|
|
(define scheme->which-button
|
|
|
|
" return (XtArgVal)Get_Integer (x);")
|
|
|
|
|
|
|
|
(define which-button->scheme
|
|
|
|
" return Make_Integer (x);")
|
|
|
|
|
|
|
|
;;; entryClass is declared as int! Bletch!
|
|
|
|
|
|
|
|
(define scheme->entry-class
|
|
|
|
" Check_Type (x, T_Class); return (XtArgVal)CLASS(x)->wclass;")
|
|
|
|
|
|
|
|
(define entry-class->scheme
|
|
|
|
" return Make_Widget_Class ((WidgetClass)x);")
|
|
|
|
|
|
|
|
(scheme->c 'row-column-rowColumnType scheme->row-column-type)
|
|
|
|
|
|
|
|
(scheme->c 'row-column-whichButton scheme->which-button)
|
|
|
|
(c->scheme 'row-column-whichButton which-button->scheme)
|
|
|
|
|
|
|
|
(scheme->c 'row-column-entryClass scheme->entry-class)
|
|
|
|
(c->scheme 'row-column-entryClass entry-class->scheme)
|