static bool CreateFloatingToolbar( gui_window *wnd, gui_ord height ) { gui_text_metrics metrics; int i; int loc; gui_rect client; gui_rect size; toolbarinfo *tbar; gui_colour_set *plain; gui_colour_set *standout; tbar = wnd->tbinfo; tbar->fixed = false; GUIGetTextMetrics( wnd, &metrics ); if( height == 0 ) { height = 2 * metrics.avg.y; } height += 2 * metrics.avg.y; GUIGetClientRect( wnd, &size ); FloatingToolbar.parent = wnd; FloatingToolbar.title = LIT( Floating_Toolbar ); FloatingToolbar.menu->label = LIT( XFix_Toolbar ); FloatingToolbar.menu->hinttext = LIT( Fix_Toolbar_Hint ); FloatingToolbar.rect.height = height; FloatingToolbar.rect.width = size.width; FloatingToolbar.num_attrs = GUIGetNumWindowColours( wnd ); FloatingToolbar.colours = GUIGetWindowColours( wnd ); FloatingToolbar.colours[GUI_FRAME_INACTIVE] = FloatingToolbar.colours[GUI_FRAME_ACTIVE]; tbar->floattoolbar = GUICreateWindow( &FloatingToolbar ); GUIMemFree( FloatingToolbar.colours ); FloatingToolbar.colours = NULL; Button.parent = tbar->floattoolbar; loc = 0; if( tbar->has_colours ) { plain = &tbar->plain; standout = &tbar->standout; } else { plain = NULL; standout = NULL; } for( i = 0; i < tbar->num_items; i++ ) { Button.text = tbar->info[i].label; Button.id = tbar->info[i].id; Button.rect.x = loc; Button.rect.width = ( strlen( Button.text ) + 4 ) * metrics.avg.x; Button.rect.height = metrics.avg.y * 2; loc += Button.rect.width; if( !GUIAddControl( &Button, plain, standout ) ) { GUIDestroyWnd( tbar->floattoolbar ); return( false ); } } GUIGetClientRect( tbar->floattoolbar, &client ); GUIGetRect( tbar->floattoolbar, &size ); size.width += loc - client.width; GUIResizeWindow( tbar->floattoolbar, &size ); GUIShowWindow( tbar->floattoolbar ); return( true ); }
a_window W6Open( void ) { wnd_create_struct info; a_window wnd; WndInitCreateStruct( &info ); info.info = &W6Info; info.style |= GUI_INIT_INVISIBLE | GUI_POPUP; wnd = WndCreateWithStruct( &info ); WndSetFontInfo( wnd, "-13 0 0 0 700 0 0 0 0 1 2 1 18 \"MS Serif\"" ); WndForcePaint( wnd ); WndShrinkToMouse( wnd, &W6Metrics ); GUIShowWindow( WndGui( wnd ) ); return( wnd ); }
void StatusShow( bool show ) /**************************/ { if( StatusWnd == NULL && show ) { StatusInit(); } if( StatusWnd != NULL ) { if( show ) { GUIShowWindow( StatusWnd ); } else { GUIHideWindow( StatusWnd ); } GUIWndDirty( StatusWnd ); } }
void WndShowAll( void ) { gui_window *gui; gui_window **list; gui_window **pcurr; int count; // this is a kludge since UI brings windows to the front on show count = 0; for( gui = GUIGetFront(); gui != NULL; gui = GUIGetNextWindow( gui ) ) { ++count; } list = WndAlloc( count * sizeof( gui ) ); pcurr = list; for( gui = GUIGetFront(); gui != NULL; gui = GUIGetNextWindow( gui ) ) { if( WndMain != NULL && WndMain->gui == gui ) continue; *pcurr++ = gui; } while( pcurr > list ) { GUIShowWindow( *--pcurr ); } WndFree( list ); }
void WndShowWindow( a_window wnd ) { GUIShowWindow( wnd->gui ); }