Esempio n. 1
0
/*
 * SetHotSpot - set the text in the hot spot window
 */
void SetHotSpot( img_node *node )
{
    WPI_PRES    pres;

    if( HotSpotText == NULL || SetHotSpotText == NULL ) {
        return;
    }

#ifdef __OS2_PM__
    if( node->imgtype == CURSOR_IMG || node->imgtype == ICON_IMG ) {
#else
    if( node->imgtype == CURSOR_IMG ) {
#endif
        sprintf( HotSpotText, SetHotSpotText, hotspotPosition,
                 node->hotspot.x, node->hotspot.y );
    } else {
        sprintf( HotSpotText, "%s ", hotspotPosition );
    }

    pres = _wpi_getpres( statusBarWnd );
    StatusWndDrawLine( statusBar, pres, SmallFont, HotSpotText, -1 );
    _wpi_releasepres( statusBarWnd, pres );

} /* SetHotSpot */

/*
 * DisplayImageText - display the text in the status window giving the
 *                    image type size and color scheme
 */
void DisplayImageText( img_node *node )
{
    WPI_PRES    pres;

    switch( node->imgtype ) {
    case BITMAP_IMG:
        sprintf( ImageText, SetBitmapText, imgSizePosition,
                 node->width, node->height, 1 << node->bitcount );
        break;

    case ICON_IMG:
        sprintf( ImageText, SetIconText, imgSizePosition,
                 node->width, node->height, 1 << node->bitcount );
        break;

    case CURSOR_IMG:
        sprintf( ImageText, SetCursorText, imgSizePosition,
                 node->width, node->height, 1 << node->bitcount );
        break;

    default:
        return;
    }

    pres = _wpi_getpres( statusBarWnd );
    StatusWndDrawLine( statusBar, pres, SmallFont, ImageText, -1 );
    _wpi_releasepres( statusBarWnd, pres );

} /* DisplayImageText */
Esempio n. 2
0
/*
 * SetHintText - set the hint text
 */
void SetHintText( char *msg )
{
    char        *text;
    int         len;
    WPI_PRES    pres;

    len = strlen( hintTextPosition ) + 1;
    if( msg != NULL ) {
        len += strlen( msg );
    } else {
        len++;
    }

    text = (char *)MemAlloc( len );
    if( text != NULL ) {
        strcpy( text, hintTextPosition );
        if( msg != NULL ) {
            strcat( text, msg );
        } else {
            strcat( text, " " );
        }
        pres = _wpi_getpres( statusBarWnd );
        StatusWndDrawLine( statusBar, pres, SmallFont, text, -1 );
        _wpi_releasepres( statusBarWnd, pres );
        MemFree( text );
    }

} /* SetHintText */
Esempio n. 3
0
/*
 * SetSizeInStatus - set the size in the status line
 */
void SetSizeInStatus( HWND hwnd, WPI_POINT *startpt, WPI_POINT *endpt, WPI_POINT *pointsize )
{
    WPI_POINT   pt1;
    WPI_POINT   pt2;
    WPI_POINT   pos;
    int         width;
    int         height;
    WPI_PRES    pres;

    if( SetSizeText == NULL || PositionSizeText == NULL ) {
        return;
    }

    CheckBounds( hwnd, startpt );
    CheckBounds( hwnd, endpt );

    pt1.x = min( startpt->x, endpt->x ) / pointsize->x;
    pt1.y = min( startpt->y, endpt->y ) / pointsize->y;
    pt2.x = max( startpt->x, endpt->x ) / pointsize->x;
    pt2.y = max( startpt->y, endpt->y ) / pointsize->y;
    width = pt2.x - pt1.x + 1;
    height = pt2.y - pt1.y + 1;

    pos.x = endpt->x / pointsize->x;
    pos.y = endpt->y / pointsize->y;
    sprintf( PositionSizeText, SetSizeText, leftBlock, pos.x, pos.y,
             nextBlock, width, height );
    pres = _wpi_getpres( statusBarWnd );
    StatusWndDrawLine( statusBar, pres, SmallFont, PositionSizeText, -1 );
    _wpi_releasepres( statusBarWnd, pres );

} /* SetSizeInStatus */
Esempio n. 4
0
/*
 * SetPosInStatus - set the position in the status window
 */
void SetPosInStatus( WPI_POINT *pt, WPI_POINT *pointsize, HWND hwnd )
{
    WPI_PRES    pres;
    WPI_RECT    rcclient;
    int         x;
    int         y;

    GetClientRect( hwnd, &rcclient );

    if( _wpi_ptinrect( &rcclient, *pt ) && PositionText != NULL && SetPosText != NULL ) {
        if( pointsize->x == 0 ) {
            pointsize->x = 1;
        }
        if( pointsize->y == 0 ) {
            pointsize->y = 1;
        }
        x = pt->x / pointsize->x;
        y = pt->y / pointsize->y;

        sprintf( PositionText, SetPosText, leftBlock, x, y );
        pres = _wpi_getpres( statusBarWnd );
        StatusWndDrawLine( statusBar, pres, SmallFont, PositionText, -1 );
        _wpi_releasepres( statusBarWnd, pres );
    }

} /* SetPosInStatus */
Esempio n. 5
0
bool WREDisplayStatusText( char *str )
{
    HDC hdc;

    if( WREStatusWindow != NULL ) {
        hdc = GetDC( WREStatusWindow );
        if( hdc != (HDC)NULL ) {
            if( str != NULL ) {
                StatusWndDrawLine( WREStatusBar, hdc, WREStatusFont, str, DT_ESC_CONTROLLED );
            } else {
                StatusWndDrawLine( WREStatusBar, hdc, WREStatusFont, WREClearStatusText, DT_ESC_CONTROLLED );
            }
            ReleaseDC( WREStatusWindow, hdc );
        }
    }

    return( true );
}
Esempio n. 6
0
Bool WdeDisplayStatusText( char *str )
{
    HDC hdc;

    if( WdeStatusWindow != NULL ) {
        hdc = GetDC( WdeStatusWindow );
        if( hdc != (HDC)NULL ) {
            if( str != NULL ) {
                StatusWndDrawLine( WdeStatusBar, hdc, WdeStatusFont, str, -1 );
            } else {
                StatusWndDrawLine( WdeStatusBar, hdc, WdeStatusFont,
                                   WdeClearStatusText, -1 );
            }
            ReleaseDC( WdeStatusWindow, hdc );
        }
    }

    return( TRUE );
}
Esempio n. 7
0
Bool WDisplayStatusText( WStatBar *wsb )
{
    HDC hdc;

    hdc = GetDC( wsb->win );
    if( hdc != (HDC)NULL ) {
        StatusWndDrawLine( wsb->stat, hdc, WStatusFont, wsb->text, -1 );
        ReleaseDC( wsb->win, hdc );
    }

    return( TRUE );
}
Esempio n. 8
0
/*
 * ClearImageText - clear the text in the image size section
 */
void ClearImageText( void )
{
    WPI_PRES    pres;
    char        text[20];

    strcpy( text, imgSizePosition );
    strcat( text, "    " );

    pres = _wpi_getpres( statusBarWnd );
    StatusWndDrawLine( statusBar, pres, SmallFont, text, -1 );
    _wpi_releasepres( statusBarWnd, pres );

} /* ClearImageText */
Esempio n. 9
0
bool GUIDrawStatusText( gui_window *wnd, const char *text )
{
    WPI_PRES    pres;
    const char  *out_text;

    if( !GUIHasStatus( wnd) ) {
        return( false );
    }
    pres = _wpi_getpres( wnd->status );
    if( ( text == NULL ) || ( *text == '\0' ) ) {
        out_text = LIT( Blank );
    } else {
        out_text = text;
    }
    StatusWndDrawLine( GUIStatusWnd, pres, wnd->font, out_text, DT_SINGLELINE | DT_VCENTER | DT_LEFT );
    _wpi_releasepres( wnd->status, pres );
    if( ( text == NULL ) || ( *text == '\0' ) ) {
        GUIEVENTWND( wnd, GUI_STATUS_CLEARED, NULL );
    }
    return( true );
}
Esempio n. 10
0
/*
 * updateHintText - updated the text shown when a menu item is selected
 */
static void updateHintText( statwnd *wnd, msg_id msgid )
{
    HDC         dc;
    HFONT       font;
    char        *str;
    HWND        hint;
    HLOCAL      hinfo;
    HintWndInfo *info;

    hint = GetHintHwnd( wnd );
    dc = GetDC( hint );
    font = GetMonoFont();
    str = AllocRCString( msgid );
    StatusWndDrawLine( wnd, dc, font, str, DT_LEFT | DT_SINGLELINE | DT_VCENTER  );
    ReleaseDC( hint, dc );
    FreeRCString( str );
    hinfo = GetProp( hint, HINT_PROP_ID );
    info = LocalLock( hinfo );
    info->curmsg = msgid;
    LocalUnlock( hinfo );

} /* updateHintText */
Esempio n. 11
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 */