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
static void ProcStatus( void ) { disp_optn optn; optn = GetOption(); if( optn == OPEN ) { WndCreateStatusWindow( &WndStatusColour ); } else if( optn == CLOSE ) { WndCloseStatusWindow(); } else { Error( ERR_LOC, LIT_ENG( ERR_BAD_OPTION ), GetCmdName( CMD_DISPLAY ) ); } }
void ProcPaint( void ) { wnd_class wndcls; gui_colour fore; gui_colour back; gui_colour_set *set; bool dialog; int attr; dialog = FALSE; wndcls = WND_NO_CLASS; if( ScanStatus() ) { attr = 0; } else if( ScanCmd( "DIalog\0" ) == 0 ) { dialog = TRUE; attr = ScanAttr( DlgAttrMap, ArraySize( DlgAttrMap ) ); } else { wndcls = ReqWndName(); attr = ScanAttr( AttrMap, ArraySize( AttrMap ) ); } fore = ScanColour(); ScanCmd( "On\0" ); back = ScanColour(); ReqEOC(); if( attr < 0 ) return; if( wndcls == WND_NO_CLASS ) { if( dialog ) { GUIGetDialogColours( WndDlgColours ); set_dlg_attr( (gui_dlg_attr)attr, fore, back ); GUISetDialogColours( WndDlgColours ); } else { WndStatusColour.fore = fore; WndStatusColour.back = back; if( WndHaveStatusWindow() ) { WndCloseStatusWindow(); WndCreateStatusWindow( &WndStatusColour ); } } } else { set = WndClassColour[wndcls]; if( set == NULL ) { set = WndAlloc( sizeof( WndColours ) ); memcpy( set, WndColours, sizeof( WndColours ) ); WndClassColour[wndcls] = set; } set_wndcls_attr( (wnd_attr)attr, set, fore, back, ( wndcls == WND_ALL ) ); _SwitchOn( SW_PENDING_REPAINT ); } }
void GUImain( void ) /******************/ { WPInit(); WndCreateStatusWindow( &WndColours[ WPA_STATUS_LINE ] ); WndStatusText( "" ); #if defined( __OS2_PM__ ) WndSetIcon( WndMain, &MainIcon ); #endif WPInitHelp(); AboutOpen(); WndShowAll(); WndShowWndMain(); if( !WPSampFound() ) { DlgOpenSample(); } else { OpenSample(); } }