Example #1
0
gui_control_class GUIGetControlClassFromHWND( HWND cntl )
{
    gui_control_class   control_class;
    char                classname[15];
    DWORD               style;
    int                 index;

    if( !_wpi_getclassname( cntl, classname, sizeof( classname ) ) ) {
        return( GUI_BAD_CLASS );
    }

    style = _wpi_getwindowlong( cntl, GWL_STYLE );
    control_class = GUI_BAD_CLASS;

    for( index=0; ( index < MAP_SIZE ) && ( control_class == GUI_BAD_CLASS ); index++ ) {
        if(( Map[index].classname != NULL ) && !stricmp( Map[index].classname, classname ) ) {
            if( Map[index].mask == 0xffff ) {
                control_class = Map[index].control_class;
            } else {
                if( ( style & Map[index].mask ) == Map[index].style ) {
                    control_class = Map[index].control_class;
                }
            }
        }
    }
    return( control_class );
}
Example #2
0
/*
 * doRestore - handle restoring an edit window
 */
static void doRestore( HWND hwnd )
{
    DWORD       style;
    mdi_data    *md;
    WPI_RECTDIM left;
    WPI_RECTDIM top;
    WPI_RECTDIM right;
    WPI_RECTDIM bottom;

    md = MDI_DATA_FROM_HWND( hwnd );

    if( md->curr_state == STATE_NORMAL ) {
        return;
    }

    if( mdiInfo.start_max_restore != NULL ) {
        mdiInfo.start_max_restore( hwnd );
    }

    md->curr_state = md->orig_state = STATE_NORMAL;

    if( mdiInfo.set_style != NULL ) {
        (mdiInfo.set_style)( hwnd, FALSE );
    } else {
        style = _wpi_getwindowlong( hwnd, GWL_STYLE );
        style &= ~mdiInfo.max_style;
        style |= mdiInfo.reg_style;
        _wpi_setwindowlong( hwnd, GWL_STYLE, style );
    }

    _wpi_setscrollrange( hwnd, SB_VERT, 1, 1, TRUE );
    _wpi_setscrollrange( hwnd, SB_HORZ, 1, 1, TRUE );
    _wpi_updatewindow( hwnd );
    _wpi_getrectvalues( md->orig_size, &left, &top, &right, &bottom );
    _wpi_movewindow( hwnd, left, top, right - left, bottom - top, TRUE );
    if( mdiInfo.end_max_restore != NULL ) {
        mdiInfo.end_max_restore( hwnd );
    }

} /* doRestore */
Example #3
0
gui_control_styles GUIGetControlStylesFromHWND( HWND cntl,
                                                gui_control_class control_class )
{
    gui_control_styles  styles;
    DWORD               style;

    styles = GUI_NOSTYLE;
    style = _wpi_getwindowlong( cntl, GWL_STYLE );

    if( style & WS_TABSTOP ) {
        styles |= GUI_TAB_GROUP;
    }

    switch( control_class ) {
        case GUI_CHECK_BOX:
            if( ( style & BS_3STATE ) == BS_3STATE ) {
                styles |= GUI_CONTROL_3STATE;
            }
            break;
        case GUI_LISTBOX:
            if( style & LBS_NOINTEGRALHEIGHT ) {
                styles |= GUI_CONTROL_NOINTEGRALHEIGHT;
            }
            if( style & LBS_SORT ) {
                styles |= GUI_CONTROL_SORTED;
            }
            break;
        case GUI_STATIC:
            if( style & SS_NOPREFIX ) {
                styles |= GUI_CONTROL_NOPREFIX;
            }
            if( ( style & SS_CENTER ) == SS_CENTER ) {
                styles |= GUI_CONTROL_CENTRE;
            }
            if( ( style & SS_LEFTNOWORDWRAP ) == SS_LEFTNOWORDWRAP ) {
                styles |= GUI_CONTROL_LEFTNOWORDWRAP;
            }
            break;
        case GUI_EDIT_COMBOBOX:
        case GUI_COMBOBOX:
            if( style & CBS_NOINTEGRALHEIGHT ) {
                styles |= GUI_CONTROL_NOINTEGRALHEIGHT;
            }
            if( style & CBS_SORT ) {
                styles |= GUI_CONTROL_SORTED;
            }
            break;
        case GUI_EDIT:
        case GUI_EDIT_MLE:
            if( style & ES_MULTILINE ) {
                styles |= GUI_CONTROL_MULTILINE;
            }
            if( style & ES_WANTRETURN ) {
                styles |= GUI_CONTROL_WANTRETURN;
            }
            if( style & ES_READONLY ) {
                styles |= GUI_CONTROL_READONLY;
            }
#ifdef __OS2_PM__
            if( style & MLS_READONLY ) {
                styles |= GUI_CONTROL_READONLY;
            }
#endif
            break;
    }

    return( styles );
}
Example #4
0
{
    SetBkColor( hdc, back_colour );
    SetTextColor( hdc, colour );
} /* _wpi_preparemono */

void _wpi_setpoint( WPI_POINT *pt, int x, int y )
/**********************************************************************/
{
    pt->x = (LONG)x;
    pt->y = (LONG)y;
} /* _wpi_setpoint */

WPI_PROC _wpi_subclasswindow( HWND hwnd, WPI_PROC new )
{
    WPI_PROC    old;
    old = ( WPI_PROC ) _wpi_getwindowlong( hwnd, GWL_WNDPROC );
    _wpi_setwindowlong( hwnd, GWL_WNDPROC, (LONG)new );
    return( old );
}

BOOL _wpi_insertmenu( HMENU hmenu, unsigned pos, unsigned menu_flags,
                      unsigned attr_flags, unsigned id,
                      HMENU popup, const char *text, BOOL by_position )
{
    if( !hmenu ) {
        return( FALSE );
    }

    menu_flags |= ( by_position ? MF_BYPOSITION : MF_BYCOMMAND );

    return( InsertMenu( hmenu, pos, menu_flags | attr_flags,
Example #5
0
/*
 * doMaximize - handle maximizing an edit window
 */
static void doMaximize( HWND hwnd )
{
    DWORD               style;
    mdi_data            *md;
    WPI_RECT            r;
    bool                iconic;
    WPI_RECTDIM         left;
    WPI_RECTDIM         top;
    WPI_RECTDIM         right;
    WPI_RECTDIM         bottom;

    setMaximizedMenuConfig( hwnd );

    md = MDI_DATA_FROM_HWND( hwnd );

    if( mdiInfo.start_max_restore != NULL ) {
        mdiInfo.start_max_restore( hwnd );
    }

    iconic = _wpi_isiconic( hwnd );
    if( iconic ) {
        _wpi_getrestoredrect( hwnd, &md->orig_size );
    } else {
        _wpi_getwindowrect( hwnd, &md->orig_size );
    }
    md->orig_state = md->curr_state;
    md->curr_state = STATE_MAX;

    if( mdiInfo.set_style != NULL ) {
        (mdiInfo.set_style)( hwnd, TRUE );
    } else {
        style = _wpi_getwindowlong( hwnd, GWL_STYLE );
        style &= ~mdiInfo.reg_style;
        style |= mdiInfo.max_style;
        _wpi_setwindowlong( hwnd, GWL_STYLE, style );
    }
    _wpi_setscrollrange( hwnd, SB_VERT, 1, 1, TRUE );
    _wpi_setscrollrange( hwnd, SB_HORZ, 1, 1, TRUE );
    _wpi_getwindowrect( mdiInfo.container, &r );

    _wpi_getrectvalues( r, &left, &top, &right, &bottom );

    if( !iconic ) {
        _wpi_offsetrect( mdiInfo.hinstance, &md->orig_size, -left, -top );
    }

    _wpi_setrectvalues( &r, 0, 0, right-left+1, bottom-top+1 );

    if( iconic ) {
        _wpi_setrestoredrect( hwnd, &r );
    } else {
        _wpi_getrectvalues( r, &left, &top, &right, &bottom );
        _wpi_movewindow( hwnd, left, top, right, bottom, TRUE );
    }

    if( mdiInfo.end_max_restore != NULL ) {
        mdiInfo.end_max_restore( hwnd );
    }

    _wpi_invalidaterect( hwnd, NULL, FALSE );

} /* doMaximize */