VirtualBox

Changeset 17147 in vbox for trunk


Ignore:
Timestamp:
Feb 26, 2009 9:33:38 AM (16 years ago)
Author:
vboxsync
Message:

FE/Qt4-OSX: Enabled the settings animation in Cocoa again.

Location:
trunk/src/VBox/Frontends/VirtualBox
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/include/VBoxUtils-darwin.h

    r17126 r17147  
    4444class QToolBar;
    4545class QPixmap;
     46class QRect;
    4647
    4748# ifdef QT_MAC_USE_COCOA
     
    7374void darwinSetMouseCoalescingEnabled (bool aEnabled);
    7475
     76/********************************************************************************
     77 *
     78 * Simple helper methods (OS System native)
     79 *
     80 ********************************************************************************/
     81void darwinWindowAnimateResizeImpl (NativeWindowRef aWindow, int x, int y, int width, int height);
     82
    7583__END_DECLS
    7684
     
    124132QString darwinSystemLanguage (void);
    125133QPixmap darwinCreateDragPixmap (const QPixmap& aPixmap, const QString &aText);
     134void darwinWindowAnimateResize (QWidget *aWidget, const QRect &aTarget);
    126135
    127136
  • trunk/src/VBox/Frontends/VirtualBox/src/VBoxSettingsDialog.cpp

    r17126 r17147  
    276276    mStack->setCurrentIndex (mStack->indexOf (rootPage));
    277277#else /* Q_WS_MAC */
    278 # ifndef QT_MAC_USE_COCOA
    279278    QSize cs = size();
    280279    /* First make all fully resizeable */
     
    300299        setFixedSize (ss);
    301300    }
    302 # else /* QT_MAC_USE_COCOA */
    303     for (int i = 0; i < mStack->count(); ++i)
    304         mStack->widget (i)->setSizePolicy (QSizePolicy::Preferred, QSizePolicy::Preferred);
    305     mStack->setCurrentIndex (mStack->indexOf (rootPage));
    306 # endif /* QT_MAC_USE_COCOA */
    307301#endif /* !Q_WS_MAC */
    308302# ifdef VBOX_GUI_WITH_TOOLBAR_SETTINGS
     
    420414    int minWidth = mSelector->minWidth();
    421415#ifdef Q_WS_MAC
    422 # ifndef QT_MAC_USE_COCOA
    423416    /* Set all size policies to ignored */
    424417    for (int i = 0; i < mStack->count(); ++i)
     
    438431
    439432    categoryChanged (mSelector->currentId());
    440 # else /* QT_MAC_USE_COCOA */
    441     categoryChanged (mSelector->currentId());
    442 # endif /* QT_MAC_USE_COCOA */
    443433#else /* Q_WS_MAC */
    444434    /* Resize to the minimum possible size */
  • trunk/src/VBox/Frontends/VirtualBox/src/darwin/VBoxUtils-darwin-carbon.cpp

    r17126 r17147  
    4545}
    4646
    47 
     47void darwinWindowAnimateResizeImpl (NativeWindowRef aWidget, int x, int y, int width, int height)
     48{
     49    HIRect r = CGRectMake (x, y, width, height);
     50    TransitionWindowWithOptions (aWidget, kWindowSlideTransitionEffect, kWindowResizeTransitionAction, &r, false, NULL);
     51}
    4852
    4953
     
    118122    Assert (!qpm.isNull());
    119123    return ::darwinToCGImageRef (&qpm);
    120 }
    121 
    122 void darwinWindowAnimateResize (QWidget *aWidget, const QRect &aTarget)
    123 {
    124     HIRect r = ::darwinToHIRect (aTarget);
    125     TransitionWindowWithOptions (::darwinToNativeWindow (aWidget), kWindowSlideTransitionEffect, kWindowResizeTransitionAction, &r, false, NULL);
    126124}
    127125
  • trunk/src/VBox/Frontends/VirtualBox/src/darwin/VBoxUtils-darwin-cocoa.m

    r17126 r17147  
    2727#import <AppKit/NSView.h>
    2828#import <AppKit/NSEvent.h>
     29#import <AppKit/NSToolbar.h>
    2930
    3031NativeWindowRef darwinToNativeWindowImpl (NativeViewRef aView)
     
    5051}
    5152
     53void darwinWindowAnimateResizeImpl (NativeWindowRef aWindow, int x, int y, int width, int height)
     54{
     55    /* It seems that Qt doesn't return the height of the window with the
     56     * toolbar height included. So add this size manually. Could easily be that
     57     * the Trolls fix this in the final release. */
     58    NSToolbar *toolbar = [aWindow toolbar];
     59    NSRect windowFrame = [aWindow frame];
     60    int toolbarHeight = 0;
     61    if(toolbar && [toolbar isVisible])
     62        toolbarHeight = NSHeight (windowFrame) - NSHeight ([[aWindow contentView] frame]);
     63    int h = height + toolbarHeight;
     64    int h1 = h - NSHeight (windowFrame);
     65    windowFrame.size.height = h;
     66    windowFrame.origin.y -= h1;
     67
     68    [aWindow setFrame:windowFrame display:YES animate:YES];
     69}
  • trunk/src/VBox/Frontends/VirtualBox/src/darwin/VBoxUtils-darwin.cpp

    r17126 r17147  
    4545
    4646NativeWindowRef darwinToNativeWindow (NativeViewRef aView)
    47 { 
     47{
    4848    return darwinToNativeWindowImpl (aView);
    4949}
     
    5454    if (parent)
    5555        darwinSetShowsToolbarButtonImpl (::darwinToNativeWindow (parent), aEnabled);
     56}
     57
     58void darwinWindowAnimateResize (QWidget *aWidget, const QRect &aTarget)
     59{
     60    darwinWindowAnimateResizeImpl (::darwinToNativeWindow (aWidget), aTarget.x(), aTarget.y(), aTarget.width(), aTarget.height());
    5661}
    5762
     
    107112    return dragPixmap;
    108113}
    109 
    110114
    111115/********************************************************************************
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette