Example #1
0
bool GUICreateStatusWindow( gui_window *wnd, gui_ord x, gui_ord height,
                            gui_colour_set *colour )
{
    WPI_RECT            status_rect;

    colour = colour;
    if( wnd->root == NULLHANDLE ) {
        return( false );
    }
    GUISetResizeStatus( &ResizeStatus );
    GUISetFreeStatus( &FreeStatus );
    if( !StatusWndInit( GUIMainHInst, NULL, 0, NULLHANDLE ) ) {
        return( false );
    }
    GUIStatusWnd = StatusWndStart();
    CalcStatusRect( wnd, x, height, &status_rect );
    wnd->status = StatusWndCreate( GUIStatusWnd, wnd->root, &status_rect,
                                   GUIMainHInst, NULL );
    if( wnd->status == NULLHANDLE ) {
        return( false );
    }
    ResizeStatus( wnd );
    GUIResizeBackground( wnd, true );
    return( true );
}
Example #2
0
/*
 * HintWndCreate - create a hint status bar
 */
statwnd *HintWndCreate( HWND parent, RECT *size, HINSTANCE hinstance, LPVOID lpvParam )
{
    statwnd             *wnd;
    HintWndInfo         *info;
    HLOCAL              hinfo;

    wnd = StatusWndStart();
    StatusWndCreate( wnd, parent, size, hinstance, lpvParam );
    hinfo = LocalAlloc( LHND, sizeof( HintWndInfo ) );
    info = LocalLock( hinfo );
    info->curmsg = HINT_EMPTY;
    info->hints = NULL;
    info->hint_num_items = 0;
    info->parent = parent;
    LocalUnlock( hinfo );

    SetProp( GetHintHwnd( wnd ), HINT_PROP_ID, hinfo );
    return( wnd );

} /* HintWndCreate */
Example #3
0
WStatBar *WCreateStatusLine( HWND parent, HINSTANCE inst )
{
    WStatBar            *wsb;
    RECT                rect;
    status_block_desc   sbd;

    wsb = (WStatBar *)WMemAlloc( sizeof( WStatBar ) );
    if( wsb != NULL ) {
        wsb->stat = StatusWndStart();
        if( wsb->stat == NULL ) {
            return( NULL );
        }
    } else {
        return( NULL );
    }

    GetClientRect( parent, &rect );

    rect.top = rect.bottom - WStatusDepth;

    sbd.separator_width = STATUS_LINE_PAD;
    sbd.width = STATUS1_WIDTH;
    sbd.width_is_percent = FALSE;
    sbd.width_is_pixels = TRUE;

    StatusWndSetSeparators( wsb->stat, 1, &sbd );

    if( (wsb->win = StatusWndCreate( wsb->stat, parent, &rect, inst, NULL )) == NULL ) {
        WDisplayErrorMsg( W_STATUSNOTCREATED );
        WDestroyStatusLine( wsb );
        return( NULL );
    }

    WSetStatusReadyText( wsb );

    GetWindowRect( wsb->win, &rect );
    WStatusDepth = rect.bottom - rect.top;

    return( wsb );
}
Example #4
0
Bool WdeCreateStatusLine( HWND main, HINSTANCE inst )
{
    RECT                rect;
    LOGFONT             lf;
    TEXTMETRIC          tm;
    HFONT               old_font;
    HDC                 dc;
    status_block_desc   sbd;
    char                *status_font;
    char                *cp;
    int                 point_size;
    Bool                use_default;

    memset( &lf, 0, sizeof( LOGFONT ) );
    dc = GetDC( main );
    lf.lfWeight = FW_BOLD;
    use_default = TRUE;

    status_font = WdeAllocRCString( WDE_STATUSFONT );
    if( status_font != NULL ) {
        cp = (char *)_mbschr( (unsigned char *)status_font, '.' );
        if( cp != NULL ) {
            *cp = '\0';
            strcpy( lf.lfFaceName, status_font );
            cp++;
            point_size = atoi( cp );
            use_default = FALSE;
        }
        WdeFreeRCString( status_font );
    }

    if( use_default ) {
        strcpy( lf.lfFaceName, STATUS_FONTNAME );
        point_size = STATUS_POINTSIZE;
    }

    lf.lfHeight = -MulDiv( point_size, GetDeviceCaps( dc, LOGPIXELSY ), 72 );
    WdeStatusFont = CreateFontIndirect( &lf );
    old_font = SelectObject( dc, WdeStatusFont );
    GetTextMetrics( dc, &tm );
    SelectObject( dc, old_font );
    ReleaseDC( main, dc );

    GetClientRect( main, &rect );

    WdeStatusDepth = tm.tmHeight + STATUS_LINE_PAD + VERT_BORDER * 2;
    rect.top = rect.bottom - WdeStatusDepth;

    if( !StatusWndInit( inst, WdeStatusHookProc, 0, (HCURSOR)NULL ) ) {
        return( FALSE );
    }
    WdeStatusBar = StatusWndStart();

    sbd.separator_width = STATUS_LINE_PAD;
    sbd.width = STATUS1_WIDTH;
    sbd.width_is_percent = FALSE;
    sbd.width_is_pixels = TRUE;

    StatusWndSetSeparators( WdeStatusBar, 1, &sbd );

    WdeStatusWindow = StatusWndCreate( WdeStatusBar, main, &rect, inst, NULL );

    if( WdeStatusWindow == NULL ) {
        WdeDisplayErrorMsg( WDE_NOCREATESTATUS );
        return( FALSE );
    }

    /* set the text in the status window */
    WdeSetStatusReadyText();

    GetWindowRect( WdeStatusWindow, &rect );
    WdeStatusDepth = rect.bottom - rect.top;

    return( TRUE );
}
Example #5
0
/*
 * InitStatusLine - initializes the status line ...
 */
BOOL InitStatusLine( HWND parent )
{
    WPI_RECT            client;
    WPI_RECT            rcsize;
    status_block_desc   sbd[4];
    WPI_PRES            pres;
    char                *text;
    char                next_block[3];
    int                 len;

    CreateStatusFont();

    sprintf( leftBlock, "%c%c", STATUS_ESC_CHAR, STATUS_FORMAT_LEFT );
    sprintf( next_block, "%c%c", STATUS_ESC_CHAR, STATUS_NEXT_BLOCK );
    strcpy( nextBlock, next_block );
    strcat( nextBlock, leftBlock );

    strcpy( hotspotPosition, next_block );
    strcat( hotspotPosition, next_block );
    strcat( hotspotPosition, leftBlock );

    PosText = IEAllocRCString( WIE_STATUSPOSTEXT );
    SizeText = IEAllocRCString( WIE_STATUSSIZETEXT );
    SetPosText = IEAllocRCString( WIE_STATUSPOSINFO );

    if( SetPosText != NULL ) {
        PositionText = (char *)MemAlloc( strlen( leftBlock ) +
                                         strlen( SetPosText ) + 20 + 1 );
        text = IEAllocRCString( WIE_STATUSSIZEINFO );
        if( text != NULL ) {
            SetSizeText = (char *)MemAlloc( strlen( SetPosText ) + strlen( text ) + 1 );
            if( SetSizeText != NULL ) {
                strcpy( SetSizeText, SetPosText );
                strcat( SetSizeText, text );
                PositionSizeText = (char *)MemAlloc( strlen( leftBlock ) +
                    strlen( SetSizeText ) + strlen( nextBlock ) + 40 + 1 );
            }
            IEFreeRCString( text );
        }
    }

    SetHotSpotText = IEAllocRCString( WIE_STATUSHOTSPOTINFO );
    if( SetHotSpotText != NULL ) {
        HotSpotText = (char *)MemAlloc( strlen( hotspotPosition ) +
                                        strlen( SetHotSpotText ) + 20 + 1 );
    }

    SetBitmapText = IEAllocRCString( WIE_BITMAPIMAGETEXT );
    SetCursorText = IEAllocRCString( WIE_CURSORIMAGETEXT );
    SetIconText = IEAllocRCString( WIE_ICONIMAGETEXT );
    if( SetBitmapText != NULL && SetCursorText != NULL && SetIconText != NULL ) {
        len = max( strlen( SetBitmapText ), strlen( SetCursorText ) );
        len = max( len, strlen( SetIconText ) );
        len += strlen( imgSizePosition ) + 30 + 1;
        ImageText = (char *)MemAlloc( len );
    }

    StatusWndInit( Instance, (statushook)NULL, sizeof( LPVOID ), NULL );
    statusBar = StatusWndStart();

    GetClientRect( parent, &client );

#ifdef __OS2_PM__
    rcsize.xLeft = -1;
    rcsize.xRight = client.xRight + 1;
    rcsize.yBottom = -1;
    rcsize.yTop = INIT_STATUS_WIDTH - 1;
#else
    rcsize.left = -1;
    rcsize.right = client.right + 1;
    rcsize.bottom = client.bottom + 1;
    rcsize.top = client.bottom - INIT_STATUS_WIDTH + 1;
#endif

    sbd[0].separator_width = 5;
    sbd[0].width = 82;
    sbd[0].width_is_percent = 0;
    sbd[0].width_is_pixels = 1;

    sbd[1].separator_width = 5;
    sbd[1].width = 168;
    sbd[1].width_is_percent = 0;
    sbd[1].width_is_pixels = 1;

    sbd[2].separator_width = 5;
    sbd[2].width = 255;
    sbd[2].width_is_percent = 0;
    sbd[2].width_is_pixels = 1;

    sbd[3].separator_width = 5;
    sbd[3].width = 400;
    sbd[3].width_is_percent = 0;
    sbd[3].width_is_pixels = 1;

    StatusWndSetSeparators( statusBar, 4, &sbd );

    strcpy( imgSizePosition, next_block );
    strcat( imgSizePosition, next_block );
    strcat( imgSizePosition, next_block );
    strcat( imgSizePosition, leftBlock );

    strcpy( hintTextPosition, next_block );
    strcat( hintTextPosition, next_block );
    strcat( hintTextPosition, next_block );
    strcat( hintTextPosition, next_block );
    strcat( hintTextPosition, leftBlock );

    statusBarWnd = StatusWndCreate( statusBar, parent, &rcsize, Instance, (LPVOID)NULL );

    text = NULL;
    if( PosText != NULL && SizeText != NULL ) {
        text = (char *)MemAlloc( strlen( PosText ) + strlen( SizeText ) +
                                 strlen( leftBlock ) + strlen( nextBlock ) + 1 );
    }

    if( text != NULL ) {
        sprintf( text, "%s%s%s%s", leftBlock, PosText, nextBlock, SizeText );
        pres = _wpi_getpres( statusBarWnd );
        StatusWndDrawLine( statusBar, pres, SmallFont, text, -1 );
        _wpi_releasepres( statusBarWnd, pres );
        MemFree( text );
    }

    GetWindowRect( statusBarWnd, &rcsize );
    StatusWidth = rcsize.bottom - rcsize.top;

    return( TRUE );

} /* InitStatusLine */