;================================================================================= ; Xt/Athena Widgets button with a dropdown menu 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 XtVaOpenApplication, app_context, class_name, 0, 0, eax, edx, 0, [applicationShellWidgetClass], 0 mov [top_level], eax ccall XtVaCreateManagedWidget, form_s, [formWidgetClass], [top_level], 0 ; create main form mov [form], eax ccall XtVaCreatePopupShell, menu_s, [simpleMenuWidgetClass], [form], 0 ; define the menu mov [menu], eax ; create menu items ccall XtVaCreateManagedWidget, menu_s0, [smeBSBObjectClass], [menu], XtNlabel, ml_s0, 0 mov [menu_popup], eax ccall XtVaCreateManagedWidget, menu_s1, [smeBSBObjectClass], [menu], XtNlabel, ml_s1, 0 ccall XtVaCreateManagedWidget, menu_s2, [smeLineObjectClass], [menu], 0 ccall XtVaCreateManagedWidget, menu_s3, [smeBSBObjectClass], [menu], XtNlabel, ml_s3, 0 mov [menu_quit], eax ; create the menu button ccall XtVaCreateManagedWidget, menu_button, [menuButtonWidgetClass], [form], XtNmenuName, menu_s, XtNlabel, \ clk_s, XtNheight, 30, XtNwidth, 200, 0 ccall XtAddCallback, [menu_quit], XtNcallback, quit, 0 ; setup callback for 'quit' item ccall XtRealizeWidget, [top_level] ; 'realize' the widget ccall XtAppMainLoop, [app_context] ; enter event processing function quit:;----------------------------------------------------------------------------------; 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 form_s db "form",0 menu_s0 db "menu_itm0",0 menu_s1 db "menu_itm1",0 menu_s2 db "menu_itm2",0 menu_s3 db "menu_itm3",0 menu_s db "menu",0 menu_button db "menu_button",0 popup_window db "popup_win",0 ml_s0 db "Item 1",0 ml_s1 db "Item 2",0 ml_s3 db "Quit",0 clk_s db "Click Me",0 top_level rd 1 app_context rd 1 form rd 1 menu rd 1 menu_popup rd 1 menu_quit rd 1