示例#1
0
bool WdeCreateRibbon( HWND parent )
{
    if( WdeRibbon != NULL || WdeRibbonInfo == NULL || parent == (HWND)NULL ) {
        return( FALSE );
    }

    GetClientRect( parent, &WdeRibbonInfo->dinfo.area );

    WdeRibbonHeight = 2 * WdeRibbonInfo->dinfo.border_size.y +
                      WdeRibbonInfo->dinfo.button_size.y +
                      2 * GetSystemMetrics( SM_CYBORDER );
    WdeRibbonInfo->dinfo.area.bottom = WdeRibbonHeight;

    WdeRibbon = WdeCreateToolBar( WdeRibbonInfo, parent );

    WdeResizeWindows();

    return( WdeRibbon != NULL );
}
示例#2
0
bool WdeCreateControlsToolBar( void )
{
    RECT        t, r, screen;
    HWND        parent;
    int         id;
    char        *text;

    if( WdeControls != NULL ) {
        return ( true );
    }

    WdeSetStatusText( NULL, "", false );
    WdeSetStatusByID( WDE_CREATINGTOOLBOX, 0 );

    parent = WdeGetMainWindowHandle();

    WdeGetCntlTBarPosOption( &t );

    if( t.left == t.right && t.top == t.bottom ) {
        GetWindowRect( parent, &r );
#ifdef __NT__
        if( GetModuleHandle( "COMCTL32.DLL" ) == NULL ) {
#endif
            t.left = r.right - CONTROLS_DEFX;
            t.top = r.top + CONTROLS_INSET;
            t.right = r.right;
            t.bottom = t.top + CONTROLS_DEFY;
#ifdef __NT__
        } else {
            t.left = r.right - CONTROLS_DEFXCC;
            t.top = r.top + CONTROLS_INSET;
            t.right = r.right;
            t.bottom = t.top + CONTROLS_DEFYCC;
        }
#endif
    }

    GetWindowRect( GetDesktopWindow(), &screen );
    if( !IntersectRect( &r, &screen, &t ) ) {
        r.right = t.right - t.left;
        r.bottom = t.bottom - t.top;
        r.left = 0;
        if( screen.right > r.right )
            r.left = ( screen.right - r.right ) / 2;
        r.top = 0;
        if( screen.bottom - screen.top - r.bottom  > 0 )
            r.top = ( screen.bottom - screen.top - r.bottom ) / 2;
        r.right += r.left;
        r.bottom += r.top;
        t = r;
    }

    WdeControlsInfo->dinfo.area = t;

    WdeControls = WdeCreateToolBar( WdeControlsInfo, parent );

    if( WdeControls == NULL ) {
        return( false );
    }

    text = WdeAllocRCString( WDE_TOOLBOXCAPTION );
    SendMessage( WdeControls->win, WM_SETTEXT, 0, (LPARAM)(LPCSTR)text );
    if( text != NULL ) {
        WdeFreeRCString( text );
    }

    text = WdeAllocRCString( WDE_HIDETOOLBOX );
    ModifyMenu ( WdeGetInitialMenuHandle(), IDM_SHOW_TOOLS,
                 MF_BYCOMMAND | MF_STRING, IDM_SHOW_TOOLS, text );
    ModifyMenu ( WdeGetResMenuHandle(), IDM_SHOW_TOOLS,
                 MF_BYCOMMAND | MF_STRING, IDM_SHOW_TOOLS, text );
    if( text != NULL ) {
        WdeFreeRCString( text );
    }

    if( WdeGetNumRes() ) {
        id = WdeGetMenuFromOBJID( GetBaseObjType() );
        if( id != -1 ) {
            WdeSetToolBarItemState( WdeControls, id, BUTTON_DOWN );
        }
        WdeSetStickyMode( WdeStickyMode );
    }

    WdeSetStatusReadyText();

    return( true );
}