Ignore:
Timestamp:
Jun 2, 2006, 4:20:22 PM (15 years ago)
Author:
Eugene Romanenko
Message:

implemented fullscreen mode

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Lucide/SOURCE/gui/lucide.cpp

    r30 r34  
    3737void AboutBox( HWND hWndFrame );
    3838
    39 HAB   hab;
    40 HWND  hWndFrame;
    41 HWND  hWndMenu;
    42 HWND  hToolBar;
    43 HWND  hVertSplitter;
     39HAB   hab            = NULLHANDLE;
     40HWND  hWndFrame      = NULLHANDLE;
     41HWND  hWndMenu       = NULLHANDLE;
     42HWND  hToolBar       = NULLHANDLE;
     43HWND  hVertSplitter  = NULLHANDLE;
     44HWND  hFrameSysmenu  = NULLHANDLE;
     45HWND  hFrameTitlebar = NULLHANDLE;
     46HWND  hFrameMinMax   = NULLHANDLE;
    4447
    4548Environment    *ev        = somGetGlobalEnvironment();
     
    5154char           *title     = NULL;
    5255
     56
    5357bool  Lucide::dontSwitchPage = false;
    5458SHORT Lucide::splitterPos    = 100;
    5559bool  Lucide::showIndex      = true;
     60bool  Lucide::isFullscreen   = false;
     61LuWindowPos Lucide::winPos   = {0};
     62
    5663
    5764PFNWP pOldSplProc;
     
    421428}
    422429
     430
     431void Lucide::toggleFullscreen()
     432{
     433    ULONG ulFrameStyle = WinQueryWindowULong( hWndFrame, QWL_STYLE );
     434
     435    if ( isFullscreen )
     436    {
     437        WinSetParent( hFrameSysmenu,  hWndFrame, FALSE );
     438        WinSetParent( hFrameTitlebar, hWndFrame, FALSE );
     439        WinSetParent( hFrameMinMax,   hWndFrame, FALSE );
     440        ulFrameStyle |= FS_SIZEBORDER;
     441    }
     442    else
     443    {
     444        WinQueryWindowPos( hWndFrame, &winPos.Swp );
     445        winPos.XRestore  = WinQueryWindowUShort( hWndFrame, QWS_XRESTORE );
     446        winPos.YRestore  = WinQueryWindowUShort( hWndFrame, QWS_YRESTORE );
     447        winPos.CXRestore = WinQueryWindowUShort( hWndFrame, QWS_CXRESTORE );
     448        winPos.CYRestore = WinQueryWindowUShort( hWndFrame, QWS_CYRESTORE );
     449        winPos.XMinimize = WinQueryWindowUShort( hWndFrame, QWS_XMINIMIZE );
     450        winPos.YMinimize = WinQueryWindowUShort( hWndFrame, QWS_YMINIMIZE );
     451
     452        WinSetParent( hFrameSysmenu,  HWND_OBJECT, FALSE );
     453        WinSetParent( hFrameTitlebar, HWND_OBJECT, FALSE );
     454        WinSetParent( hFrameMinMax,   HWND_OBJECT, FALSE );
     455        ulFrameStyle &= ~FS_SIZEBORDER;
     456    }
     457
     458    WinSetWindowULong( hWndFrame, QWL_STYLE, ulFrameStyle );
     459    WinSendMsg( hWndFrame, WM_UPDATEFRAME,
     460                MPFROMLONG( FCF_TITLEBAR | FCF_SIZEBORDER | FCF_SYSMENU | FCF_MINMAX ),
     461                MPVOID );
     462
     463    if ( isFullscreen )
     464    {
     465        WinSetWindowUShort( hWndFrame, QWS_XRESTORE,  winPos.XRestore );
     466        WinSetWindowUShort( hWndFrame, QWS_YRESTORE,  winPos.YRestore );
     467        WinSetWindowUShort( hWndFrame, QWS_CXRESTORE, winPos.CXRestore );
     468        WinSetWindowUShort( hWndFrame, QWS_CYRESTORE, winPos.CYRestore );
     469        WinSetWindowUShort( hWndFrame, QWS_XMINIMIZE, winPos.XMinimize );
     470        WinSetWindowUShort( hWndFrame, QWS_YMINIMIZE, winPos.YMinimize );
     471        ULONG swpopt = SWP_MOVE | SWP_SIZE | SWP_SHOW;
     472        WinSetWindowPos( hWndFrame, NULLHANDLE,
     473                         winPos.Swp.x, winPos.Swp.y, winPos.Swp.cx, winPos.Swp.cy,
     474                         swpopt );
     475    }
     476    else
     477    {
     478        WinSetWindowPos( hWndFrame, HWND_TOP, 0, 0,
     479                         WinQuerySysValue( HWND_DESKTOP, SV_CXFULLSCREEN ) - 1,
     480                         WinQuerySysValue( HWND_DESKTOP, SV_CYFULLSCREEN ) +
     481                            WinQuerySysValue( HWND_DESKTOP, SV_CYTITLEBAR ),
     482                         SWP_SIZE | SWP_MOVE | SWP_ZORDER );
     483    }
     484
     485    isFullscreen = !isFullscreen;
     486}
     487
    423488static MRESULT EXPENTRY splProc( HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2 )
    424489{
    425 
    426490    switch ( msg )
    427491    {
     
    546610                    return (MRESULT)FALSE;
    547611
     612                case CM_FULLSCREEN:
     613                    Lucide::toggleFullscreen();
     614                    return (MRESULT)FALSE;
     615
    548616                case CM_PRODINFO:
    549617                    AboutBox( hWndFrame );
     
    587655    hWndFrame = WinCreateStdWindow( HWND_DESKTOP, 0, &ulFrameFlags, NULL, title,
    588656                                    WS_SYNCPAINT|WS_VISIBLE, NULLHANDLE, 100, NULL );
     657    hFrameSysmenu  = WinWindowFromID( hWndFrame, FID_SYSMENU );
     658    hFrameTitlebar = WinWindowFromID( hWndFrame, FID_TITLEBAR );
     659    hFrameMinMax   = WinWindowFromID( hWndFrame, FID_MINMAX );
    589660    WinSetAccelTable( hab, WinLoadAccelTable( hab, NULLHANDLE, IDA_MAINACCEL ), hWndFrame );
    590661    hWndMenu = WinLoadMenu( hWndFrame, NULLHANDLE, IDM_MAINMENU );
Note: See TracChangeset for help on using the changeset viewer.