include/cinder/app/AppImplMswScreenSaver.h
Go to the documentation of this file.
00001 /*
00002  Copyright (c) 2012, The Cinder Project, All rights reserved.
00003 
00004  This code is intended for use with the Cinder C++ library: http://libcinder.org
00005 
00006  Redistribution and use in source and binary forms, with or without modification, are permitted provided that
00007  the following conditions are met:
00008 
00009     * Redistributions of source code must retain the above copyright notice, this list of conditions and
00010     the following disclaimer.
00011     * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
00012     the following disclaimer in the documentation and/or other materials provided with the distribution.
00013 
00014  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
00015  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
00016  PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
00017  ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
00018  TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
00019  HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
00020  NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
00021  POSSIBILITY OF SUCH DAMAGE.
00022 */
00023 
00024 #pragma once
00025 
00026 #include "cinder/app/AppScreenSaver.h"
00027 #include "cinder/app/AppImplMsw.h"
00028 #include "cinder/app/AppImplMswRenderer.h"
00029 #include <windows.h>
00030 #undef min
00031 #undef max
00032 
00033 namespace cinder { namespace app {
00034 
00035 class WindowImplMswScreenSaver;
00036 
00037 class AppImplMswScreenSaver : public AppImplMsw {
00038  public:
00039     AppImplMswScreenSaver( class AppScreenSaver *aApp );
00040     virtual ~AppImplMswScreenSaver() {}
00041     
00042     void        init( HWND aWnd );
00043     void        run();
00044     void        quit() {} // we can't really force a quit
00045         
00046     LRESULT eventHandler( HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam );
00047     
00048     virtual WindowRef   getWindow() const;
00050     virtual size_t      getNumWindows() const;
00052     virtual WindowRef   getWindowIndex( size_t index ) const;
00053 
00054     bool                isPreview() const;
00055 
00056     // ignore
00057     virtual void            closeWindow( class WindowImplMsw *windowImpl ) {}
00058     // ignore
00059     virtual void            setForegroundWindow( WindowRef window ) {}
00060 
00061  protected:
00062     class AppScreenSaver                        *mApp;
00063     bool                                        mPreview;
00064     bool                                        mDebugMode;
00065     std::list<WindowImplMswScreenSaver*>        mWindows;
00066     std::list<BlankingWindowRef>                mBlankingWindows;
00067 };
00068 
00069 class WindowImplMswScreenSaver : public WindowImplMsw {
00070   public:
00071     WindowImplMswScreenSaver( HWND hwnd, RendererRef renderer, RendererRef sharedRenderer, AppImplMswScreenSaver *appImpl )
00072         : WindowImplMsw( hwnd, renderer, sharedRenderer, appImpl ) {}
00073 
00074     // no-op
00075     virtual void        setFullScreen( bool fullScreen, const app::FullScreenOptions &options );
00076 
00077   protected:
00078     friend AppImplMswScreenSaver;
00079 };
00080 
00081 
00082 } } // namespace cinder::app