void GUImain( void ) { char buff[256]; char *p; WndMaxDirtyRects = 20; getcmd( buff ); p = buff; while( *p == ' ' ) ++p; if( p[0] == '-' && p[1] == 'n' ) { WndStyle &= ~GUI_GMOUSE; p += 2; } while( *p == ' ' ) ++p; if( p[0] == '-' && p[1] == '1' ) { #ifdef __DOS__ BIOSSetPage( 1 ); // just make sure it works for the debugger #endif p += 2; } WndGadgetInit(); WndInit( "Sample Application" ); WndCreateStatusWindow( &WndColours[GUI_MENU_STANDOUT] ); GUIGetDialogColours( WndDlgColours ); WndStatusText( "Hello World!" ); WndSetIcon( WndMain, &MainIcon ); WndMainMenuProc( WndMain, MENU_OPEN1 ); } // returning starts the events rolling
bool WndProcMacro( a_window wnd, gui_key key ) /********************************************/ { #if 0 int menu; menu=menu; #endif switch( key ) { case GUI_KEY_F3: WPFindDoPopUp( wnd, MENU_SAMP_ZOOM_IN ); return( true ); case GUI_KEY_F4: case GUI_KEY_BACKSPACE: WPFindDoPopUp( wnd, MENU_SAMP_BACK_OUT ); return( true ); case GUI_KEY_PERIOD: WPDoPopUp( wnd, NULL ); return( true ); #ifndef NDEBUG case GUI_KEY_CTRL_R: ReportSampleInfo(); return( true ); #endif default: return( false ); } /* for codes not handled by the pop-up */ #if 0 WndMainMenuProc( wnd, menu ); return( true ); #endif }
extern void WndClick( a_window *wnd, unsigned id ) { if( !WndMainMenuProc( wnd, id ) ) { wnd = WndFindActive(); if( wnd != NULL ) { WndMenuItem( wnd, id, WndMenuRow, WndMenuPiece ); } } }
void AccelMenuItem( gui_menu_struct *menu, bool is_main ) { a_window *wnd = WndFindActive(); if( is_main ) { WndMainMenuProc( wnd, menu->id ); } else { WndKeyPopUp( wnd, menu ); WndNoSelect( wnd ); } }
bool WndProcMacro( a_window wnd, gui_key key ) { gui_ctl_id menu; int i; WndStatusText( "" ); for( i = 0; i < ArraySize( Key ); ++i ) { if( Key[i].key == key ) { WndStatusText( Key[i].name ); break; } } switch( key ) { case GUI_KEY_PERIOD: WndKeyPopUp( wnd, NULL ); return( true ); case GUI_KEY_EQUAL: menu = MENU_MATCH; break; case GUI_KEY_n: menu = MENU_NEXT; break; case GUI_KEY_p: menu = MENU_PREV; break; case GUI_KEY_q: menu = MENU_QUIT; break; case GUI_KEY_1: menu = MENU_OPEN1; break; case GUI_KEY_a: menu = MENU_OPEN1A; break; case GUI_KEY_2: menu = MENU_OPEN2; break; case GUI_KEY_3: menu = MENU_OPEN3; break; case GUI_KEY_4: menu = MENU_OPEN4; break; case GUI_KEY_b: menu = MENU_OPEN4B; break; case GUI_KEY_5: menu = MENU_OPEN5; break; case GUI_KEY_6: menu = MENU_OPEN6; break; case GUI_KEY_7: menu = MENU_OPEN7; break; case GUI_KEY_8: menu = MENU_OPEN8; break; case GUI_KEY_w: menu = MENU_W1_NEWWORD; break; case GUI_KEY_c: menu = MENU_COMMAND; break; case GUI_KEY_SLASH: menu = MENU_SEARCH; break; case GUI_KEY_x: WndPopUp( wnd, NULL ); break; case GUI_KEY_CTRL_X: { static gui_ctl_id last_menu_pos = 0; WndCreateFloatingPopup( wnd, NULL, &menu_PopTart, &last_menu_pos ); } default: return( false ); } WndMainMenuProc( wnd, menu ); return( true ); }