Changeset 53


Ignore:
Timestamp:
Jan 15, 2006, 11:06:23 PM (20 years ago)
Author:
dmik
Message:

Fixed: QWidget::create() didn't set default WStyle_NormalBorder | WStyle_Title | WStyle_MinMax | WStyle_SysMenu flags; as a result, MDI windows had incorrect appearance.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/kernel/qwidget_pm.cpp

    r8 r53  
    5151#include "qcursor.h"
    5252#include <private/qapplication_p.h>
    53 //@@TODO (dmik): remove
     53//@@TODO (dmik): remove?
    5454//#include <private/qinputcontext_p.h>
    55 
    56 //@@TODO (dmik): need this?
    57 //#if defined(QT_NON_COMMERCIAL)
    58 //#include "qnc_win.h"
    59 //#endif
    60 
    61 //@@TODO (dmik): remove
    62 //#if !defined(WS_EX_TOOLWINDOW)
    63 //#define WS_EX_TOOLWINDOW 0x00000080
    64 //#endif
    65 //
    66 //#if !defined(GWLP_WNDPROC)
    67 //#define GWLP_WNDPROC GWL_WNDPROC
    68 //#endif
    6955
    7056const QString qt_reg_winclass( int );           // defined in qapplication_pm.cpp
     
    155141//#define QT_DEBUGWINCREATEDESTROY
    156142
    157 void QWidget::create( WId window, bool initializeWindow, bool destroyOldWindow)
    158 {
     143void QWidget::create( WId window, bool initializeWindow, bool destroyOldWindow )
     144{
     145    // When window is not zero, it represents an existing (external) window
     146    // handle we should create a QWidget "wrapper" for to incorporate it to the
     147    // Qt widget hierarchy. But so far I have never seen this method called
     148    // with window != 0, so we ignore this argument (as well as the other two
     149    // that make sense only together with it) for now and will not implement
     150    // this functionality until there's a real need.
     151   
     152    Q_ASSERT( window == 0 );
     153    Q_UNUSED( initializeWindow );
     154    Q_UNUSED( destroyOldWindow );
     155   
    159156    if ( testWState(WState_Created) && window == 0 )
    160157        return;
     
    170167    bool dialog = testWFlags(WType_Dialog);
    171168    bool desktop  = testWFlags(WType_Desktop);
    172 //@@TODO (dmik): guess this is for embedded windows. remove?
    173 //    HWND destroyw = 0;
    174169    WId  id = 0;
    175170
    176     if ( !window )                              // always initialize
    177         initializeWindow = TRUE;
    178 
    179171    if ( popup ) {
    180 //@@TODO (dmik): ignored for now?
     172        /// @todo (dmik) WStyle_StaysOnTop is ignored for now (does nothing)
    181173        setWFlags(WStyle_StaysOnTop); // a popup stays on top
    182174    }
     
    187179    }
    188180
    189 //@@TODO (dmik): guess this is for embedded windows. remove?
    190 //    if ( window ) {
    191 //      // There's no way we can know the background color of the
    192 //      // other window because it could be cleared using the WM_ERASEBKND
    193 //      // message.  Therefore we assume white.
    194 //      bg_col = white;
    195 //    }
    196 
    197181    if ( dialog || popup || desktop ) {         // these are top-level, too
    198182        topLevel = TRUE;
     
    202186    if ( desktop ) {                            // desktop widget
    203187        popup = FALSE;                          // force this flags off
    204         //@@TODO (dmik): use WinGetMaxPosition () to take into account such
    205         //  things as XCenter?
     188        /// @todo (dmik)
     189        //  use WinGetMaxPosition () to take into account such things as XCenter?
    206190        crect.setRect( 0, 0, sw, sh );
    207191    }
     
    211195    ULONG fId = 0, fStyle = 0, fcFlags = 0;
    212196
    213 //@@TODO (dmik): guess this is for embedded windows. remove?
    214 //    if ( window ) {
    215 //      style = GetWindowLongA( window, GWL_STYLE );
    216 //#ifndef QT_NO_DEBUG
    217 //      if ( !style )
    218 //          qSystemWarning( "QWidget: GetWindowLong failed" );
    219 //#endif
    220 //      topLevel = FALSE; // #### needed for some IE plugins??
    221 //    } else if ( popup ) {
    222197    if ( popup ) {
    223198        style |= WS_SAVEBITS;
    224199    } else if ( !topLevel ) {
    225 //@@TODO (dmik): why should we set these flags for non-toplevel (child) windows?
    226 //      if ( !testWFlags(WStyle_Customize) )
    227 //          setWFlags( WStyle_NormalBorder | WStyle_Title | WStyle_MinMax | WStyle_SysMenu  );
    228200        if ( !testWFlags(WStyle_Customize) )
    229             setWFlags( WStyle_Title );
     201            setWFlags( WStyle_NormalBorder | WStyle_Title | WStyle_MinMax | WStyle_SysMenu );
    230202    } else if (!desktop ) {
    231203        if ( !testWFlags(WStyle_Customize) ) {
     
    244216    }
    245217    if ( !desktop ) {
    246 //@@TODO (dmik): this is temporarily commented out because QSplitter sets
    247 //  WPaintUnclipped which causes terrible flicker in QFileDialog's list
    248 //  box and list view. this needs to be investigated. Qt/Win32 does also
    249 //  comment this out...
    250 //      if ( !testWFlags( WPaintUnclipped ) )
     218        /// @todo (dmik)
     219        //  this is temporarily commented out because QSplitter sets
     220        //  WPaintUnclipped which causes terrible flicker in QFileDialog's list
     221        //  box and list view. This needs to be investigated. Qt/Win32 does also
     222        //  comment this out...
     223        /* if ( !testWFlags( WPaintUnclipped ) ) */
    251224            style |= WS_CLIPSIBLINGS | WS_CLIPCHILDREN;
    252225        // for all top-level windows except popups we create a WC_FRAME
     
    286259    PCSZ pszClassName = className.latin1();
    287260
    288 //@@TODO (dmik): guess this is for embedded windows. remove?
    289 //    if ( window ) {                           // override the old window
    290 //      if ( destroyOldWindow )
    291 //          destroyw = winid;
    292 //      id = window;
    293 //      setWinId( window );
    294 //      LONG res = SetWindowLongA( window, GWL_STYLE, style );
    295 //#ifndef QT_NO_DEBUG
    296 //      if ( !res )
    297 //          qSystemWarning( "QWidget: Failed to set window style" );
    298 //#endif
    299 //      res = SetWindowLongA( window, GWLP_WNDPROC, (LONG)QtWndProc );
    300 //#ifndef QT_NO_DEBUG
    301 //      if ( !res )
    302 //          qSystemWarning( "QWidget: Failed to set window procedure" );
    303 //#endif
    304 //    } else if ( desktop ) {                   // desktop widget
    305     if ( desktop ) {                            // desktop widget
     261    if ( desktop ) {                    // desktop widget
    306262        id = WinQueryDesktopWindow( 0, 0 );
    307263        QWidget *otherDesktop = find( id );     // is there another desktop?
     
    397353#endif
    398354        setWinId( id );
    399 //@@TODO (dmik): remove?
    400 //      if ( testWFlags( WStyle_StaysOnTop) )
    401 //          SetWindowPos( id, HWND_TOPMOST, 0, 0, 100, 100, SWP_NOACTIVATE );
     355        /// @todo (dmik) WStyle_StaysOnTop is ignored for now (does nothing)
     356/*       
     357        if ( testWFlags( WStyle_StaysOnTop) )
     358            SetWindowPos( id, HWND_TOPMOST, 0, 0, 100, 100, SWP_NOACTIVATE );
     359*/
    402360
    403361        // When the FS_SHELLPOSITION flag is specified during WC_FRAME window
     
    439397        setWState( WState_Visible );
    440398    } else {
    441 //@@TODO (dmik): remove. probably this is done for embedded windows?
    442 //      RECT  fr, cr;
    443 //      GetWindowRect( id, &fr );               // update rects
    444 //      GetClientRect( id, &cr );
    445 //      if ( cr.top == cr.bottom && cr.left == cr.right ) {
    446 //          if ( initializeWindow ) {
    447 //              int x, y, w, h;
    448 //              if ( topLevel ) {
    449 //                  x = sw/4;
    450 //                  y = 3*sh/10;
    451 //                  w = sw/2;
    452 //                  h = 4*sh/10;
    453 //              } else {
    454 //                  x = y = 0;
    455 //                  w = 100;
    456 //                  h = 30;
    457 //              }
    458 //
    459 //              MoveWindow( winId(), x, y, w, h, TRUE );
    460 //          }
    461 //          GetWindowRect( id, &fr );           // update rects
    462 //          GetClientRect( id, &cr );
    463 //      }
    464399        SWP cswp;
    465400        WinQueryWindowPos( id, &cswp );
     
    493428            cswp.y = cy - (cswp.y + cswp.cy);
    494429            crect.setRect( cswp.x, cswp.y, cswp.cx, cswp.cy );
    495             // in case extra data already exists (eg. reparent()).  Set it.
    496             //@@TODO (dmik): what's this? ~~~^
    497430        }
    498431    }
     
    501434    hps = 0;                                    // no presentation space
    502435
    503 //@@TODO (dmik): guess this is for embedded windows. remove?
    504 //    if ( window ) {                           // got window from outside
    505 //      if ( IsWindowVisible(window) )
    506 //          setWState( WState_Visible );
    507 //      else
    508 //          clearWState( WState_Visible );
    509 //    }
    510 
    511 //@@TODO (dmik): need?
    512 //#if defined(QT_NON_COMMERCIAL)
    513 //    QT_NC_WIDGET_CREATE
    514 //#endif
    515 
    516 //@@TODO (dmik): guess this is for embedded windows. remove?
    517 //    if ( destroyw ) {
    518 //      WinDestroyWindow( destroyw );
    519 //    }
    520 
    521436    setFontSys();
    522 //@@TODO (dmik): remove?
     437
     438/// @todo (dmik) remove?
    523439//    QInputContext::enable( this, im_enabled & !((bool)testWState(WState_Disabled)) );
    524440}
     
    837753    topData()->caption = caption;
    838754
    839 //@@TODO (dmik): need?
    840 //#if defined(QT_NON_COMMERCIAL)
    841 //    QT_NC_CAPTION
    842 //#else
    843 //    QString cap = caption;
    844 //#endif
    845 
    846755    QCString cap = caption.local8Bit();
    847756    WinSetWindowText( winFId(), cap );
     
    12551164void QWidget::showWindow()
    12561165{
    1257 //@@TODO (dmik): need?
    1258 //#if defined(QT_NON_COMMERCIAL)
    1259 //    QT_NC_SHOW_WINDOW
    1260 //#endif
    12611166    WinShowWindow( winFId(), TRUE );
    12621167    ULONG fl = 0;
Note: See TracChangeset for help on using the changeset viewer.