void wxTopLevelWindowMSW::Maximize(bool maximize) { if ( IsShown() ) { // just maximize it directly DoShowWindow(maximize ? SW_MAXIMIZE : SW_RESTORE); } else // hidden { // we can't maximize the hidden frame because it shows it as well, // so just remember that we should do it later in this case m_maximizeOnShow = maximize; #if wxUSE_DEFERRED_SIZING // after calling Maximize() the client code expects to get the frame // "real" size and doesn't want to know that, because of implementation // details, the frame isn't really maximized yet but will be only once // it's shown, so return our size as it will be then in this case if ( maximize ) { // we must only change pending size here, and not call SetSize() // because otherwise Windows would think that this (full screen) // size is the natural size for the frame and so would use it when // the user clicks on "restore" title bar button instead of the // correct initial frame size // // NB: unfortunately we don't know which display we're on yet so we // have to use the default one m_pendingSize = wxGetClientDisplayRect().GetSize(); } //else: can't do anything in this case, we don't have the old size #endif // wxUSE_DEFERRED_SIZING } }
void wxTopLevelWindowMSW::ShowWithoutActivating() { if ( !wxWindowBase::Show(true) ) return; DoShowWindow(SW_SHOWNA); }
void wxTopLevelWindowMSW::Iconize(bool iconize) { if ( iconize == m_iconized ) { // Do nothing, in particular don't restore non-iconized windows when // Iconize(false) is called as this would wrongly un-maximize them. return; } if ( IsShown() ) { // change the window state immediately DoShowWindow(iconize ? SW_MINIMIZE : SW_RESTORE); } else // hidden { // iconizing the window shouldn't show it so just update the internal // state (otherwise it's done by DoShowWindow() itself) m_iconized = iconize; } }
void wxTopLevelWindowMSW::Restore() { DoShowWindow(SW_RESTORE); }
bool wxTopLevelWindowMSW::Show(bool show) { // don't use wxWindow version as we want to call DoShowWindow() ourselves if ( !wxWindowBase::Show(show) ) return false; int nShowCmd; if ( show ) { if ( m_maximizeOnShow ) { // show and maximize nShowCmd = SW_MAXIMIZE; // This is necessary, or no window appears #if defined( __WINCE_STANDARDSDK__) || defined(__SMARTPHONE__) DoShowWindow(SW_SHOW); #endif m_maximizeOnShow = false; } else if ( m_iconized ) { // We were iconized while we were hidden, so now we need to show // the window in iconized state. nShowCmd = SW_MINIMIZE; } else if ( ::IsIconic(GetHwnd()) ) { // We were restored while we were hidden, so now we need to show // the window in its normal state. // // As below, don't activate some kinds of windows. if ( HasFlag(wxFRAME_TOOL_WINDOW) || !IsEnabled() ) nShowCmd = SW_SHOWNOACTIVATE; else nShowCmd = SW_RESTORE; } else // just show { // we shouldn't use SW_SHOW which also activates the window for // tool frames (as they shouldn't steal focus from the main window) // nor for the currently disabled windows as they would be enabled // as a side effect if ( HasFlag(wxFRAME_TOOL_WINDOW) || !IsEnabled() ) nShowCmd = SW_SHOWNA; else nShowCmd = SW_SHOW; } } else // hide { nShowCmd = SW_HIDE; } #if wxUSE_DEFERRED_SIZING // we only set pending size if we're maximized before being shown, now that // we're shown we don't need it any more (it is reset in size event handler // for child windows but we have to do it ourselves for this parent window) // // make sure to reset it before actually showing the window as this will // generate WM_SIZE events and we want to use the correct client size from // them, not the size returned by WM_NCCALCSIZE in DoGetClientSize() which // turns out to be wrong for maximized windows (see #11762) m_pendingSize = wxDefaultSize; #endif // wxUSE_DEFERRED_SIZING DoShowWindow(nShowCmd); #if defined(__WXWINCE__) && (_WIN32_WCE >= 400 && !defined(__POCKETPC__) && !defined(__SMARTPHONE__)) // Addornments have to be added when the frame is the correct size wxFrame* frame = wxDynamicCast(this, wxFrame); if (frame && frame->GetMenuBar()) frame->GetMenuBar()->AddAdornments(GetWindowStyleFlag()); #endif return true; }
// // OnReceiveMessage // // This is the derived class window message handler methods // LRESULT CVideoText::OnReceiveMessage(HWND hwnd, // Window handle UINT uMsg, // Message ID WPARAM wParam, // First parameter LPARAM lParam) // Other parameter { IBaseFilter *pFilter = NULL; RECT ClientRect; // Blank out the window background if (uMsg == WM_ERASEBKGND) { EXECUTE_ASSERT(GetClientRect(m_hwnd,&ClientRect)); HBRUSH hBrush = CreateSolidBrush(RGB(0,0,0)); EXECUTE_ASSERT(FillRect(m_hdc,&ClientRect,hBrush)); EXECUTE_ASSERT(DeleteObject(hBrush)); return (LRESULT) 0; } // Handle WM_CLOSE by aborting the playback if (uMsg == WM_CLOSE) { m_pRenderer->NotifyEvent(EC_USERABORT,0,0); DoShowWindow(SW_HIDE); return CBaseWindow::OnClose(); } // We pass on WM_ACTIVATEAPP messages to the filtergraph so that the // IVideoWindow plug in distributor can switch us out of fullscreen // mode where appropriate. These messages may also be used by the // resource manager to keep track of which renderer has the focus if (uMsg == WM_ACTIVATEAPP) { NOTE1("Notification of EC_ACTIVATE (%d)",(BOOL) wParam); m_pRenderer->QueryInterface(IID_IBaseFilter,(void **) &pFilter); if (pFilter) { m_pRenderer->NotifyEvent(EC_ACTIVATE, wParam, (LPARAM) pFilter); pFilter->Release(); } return (LRESULT) 0; } // Treat clicks on text as requests to move window if (uMsg == WM_NCHITTEST) { LRESULT Result = DefWindowProc(hwnd,uMsg,wParam,lParam); if (Result == HTCLIENT) Result = HTCAPTION; return Result; } // The base class that implements IVideoWindow looks after a flag // that says whether or not the cursor should be hidden. If so we // hide the cursor and return (LRESULT) 1. Otherwise we pass to // the DefWindowProc to show the cursor as normal. This is used // when our window is made fullscreen to imitate the Modex filter if (uMsg == WM_SETCURSOR) { if (IsCursorHidden() == TRUE) { SetCursor(NULL); return (LRESULT) 1; } } // When we detect a display change we send an EC_DISPLAY_CHANGED // message along with our input pin. The filtergraph will stop // everyone and reconnect our input pin. When being reconnected // we can then accept the media type that matches the new display // mode since we may no longer be able to draw the current format if (uMsg == WM_DISPLAYCHANGE) { m_pRenderer->m_Display.RefreshDisplayType(NULL); m_pRenderer->OnDisplayChange(); NOTE("Sent EC_DISPLAY_CHANGED event"); return (LRESULT) 0; } return CBaseWindow::OnReceiveMessage(hwnd,uMsg,wParam,lParam); } // OnReceiveMessage
bool wxTopLevelWindowMSW::Show(bool show) { // don't use wxWindow version as we want to call DoShowWindow() ourselves if ( !wxWindowBase::Show(show) ) return false; int nShowCmd; if ( show ) { if ( m_maximizeOnShow ) { // show and maximize nShowCmd = SW_MAXIMIZE; m_maximizeOnShow = false; } else if ( m_iconized ) { // We were iconized while we were hidden, so now we need to show // the window in iconized state. nShowCmd = SW_MINIMIZE; } else if ( ::IsIconic(GetHwnd()) ) { // We were restored while we were hidden, so now we need to show // the window in its normal state. // // As below, don't activate some kinds of windows. if ( HasFlag(wxFRAME_TOOL_WINDOW) || !IsEnabled() ) nShowCmd = SW_SHOWNOACTIVATE; else nShowCmd = SW_RESTORE; } else // just show { // we shouldn't use SW_SHOW which also activates the window for // tool frames (as they shouldn't steal focus from the main window) // nor for the currently disabled windows as they would be enabled // as a side effect if ( HasFlag(wxFRAME_TOOL_WINDOW) || !IsEnabled() ) nShowCmd = SW_SHOWNA; else nShowCmd = SW_SHOW; } } else // hide { nShowCmd = SW_HIDE; } #if wxUSE_DEFERRED_SIZING // we only set pending size if we're maximized before being shown, now that // we're shown we don't need it any more (it is reset in size event handler // for child windows but we have to do it ourselves for this parent window) // // make sure to reset it before actually showing the window as this will // generate WM_SIZE events and we want to use the correct client size from // them, not the size returned by WM_NCCALCSIZE in DoGetClientSize() which // turns out to be wrong for maximized windows (see #11762) m_pendingSize = wxDefaultSize; #endif // wxUSE_DEFERRED_SIZING DoShowWindow(nShowCmd); return true; }