;================================================================================= ; Xt/Athena Widgets button example. ; ; The LSCR Project. ;================================================================================= format ELF include '../../../macros.inc' include '../../../../include/symbols.inc' include '../../../../include/x.inc' include '../../../../include/x_res.inc' public _start section '.text' executable _start: mov eax, esp mov edx, esp add edx, 4 ; initialize the toolkit ccall XtVaAppInitialize, app_context, class_name, 0, 0, eax, edx, 0, 0, 0 mov [top_level], eax ; create main window ccall XtVaCreateManagedWidget, box_name, [boxWidgetClass], [top_level], 0 mov [box], eax ; create text label ccall XtVaCreateManagedWidget, label_s, [labelWidgetClass], [box], XtNborderWidth, 0, 0 ; create button ccall XtVaCreateManagedWidget, button_s, [commandWidgetClass], [box], XtNheight, 25, XtNwidth, 150, 0 mov [button], eax ; add a callback for the button ccall XtAddCallback, [button], XtNcallback, but_callback, 0 ccall XtRealizeWidget, [top_level] ; 'realize' the widget ccall XtAppMainLoop, [app_context] ; event processing function, it ; never returns. but_callback:;--------------------------------------------------------------------------; ccall XtDestroyApplicationContext, [app_context] ; destroy the application context mov eax, SYS_EXIT xor ebx, ebx int 0x80 section '.data' writeable class_name db "my_class",0 box_name db "mybox",0 label_s db "Hello World!", 0 button_s db "Exit", 0 top_level rd 1 box rd 1 app_context rd 1 button rd 1