include/cinder/app/AppImplCocoaScreenSaver.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 #include "cinder/gl/gl.h" // necessary to give GLee the jump on Cocoa.h
00025 
00026 #import <Cocoa/Cocoa.h>
00027 #import <ScreenSaver/ScreenSaver.h>
00028 
00029 #include "cinder/app/AppScreenSaver.h"
00030 #import "cinder/app/CinderView.h"
00031 #import "cinder/app/Window.h"
00032 
00033 #include <string>
00034 
00035 @class WindowImplCocoaScreenSaver;
00036 
00037 @interface AppImplCocoaScreenSaver : NSObject {
00038   @public
00039     cinder::app::AppScreenSaver                 *mApp;
00040     std::list<WindowImplCocoaScreenSaver*>      mWindows;
00041     WindowImplCocoaScreenSaver                  *mActiveWindow;
00042     float                                       mFrameRate;
00043 
00044     BOOL                                        mSetupCalled;
00045 }
00046 
00047 - (AppImplCocoaScreenSaver*)init;
00048 - (void)addWindow:(WindowImplCocoaScreenSaver*)windowImpl;
00049 - (BOOL)isPreview;
00050 
00051 - (size_t)getNumWindows;
00052 - (cinder::app::WindowRef)getWindowIndex:(size_t)index;
00053 - (cinder::app::WindowRef)getWindow;
00054 - (void)setActiveWindow:(WindowImplCocoaScreenSaver*)activeWindow;
00055 
00056 - (void)animateOneFrame:(WindowImplCocoaScreenSaver*)callee;
00057 
00058 - (float)getFrameRate;
00059 - (void)setFrameRate:(float)frameRate;
00060 - (cinder::fs::path)getAppPath;
00061 - (void)removeCinderView:(WindowImplCocoaScreenSaver*)win;
00062 - (void)finalCleanup;
00063 
00064 @end
00065 
00066 @interface WindowImplCocoaScreenSaver : ScreenSaverView<WindowImplCocoa,CinderViewDelegate> {
00067   @public
00068     CinderView                          *mCinderView;   
00069     cinder::app::WindowRef              mWindowRef;
00070     cinder::DisplayRef                  mDisplay;
00071 
00072     BOOL                                mPreview;   
00073     BOOL                                mResizeCalled;
00074     BOOL                                mIsMainView;
00075     BOOL                                mHasDrawnSinceLastUpdate;
00076 }
00077 
00078 // ScreenSaverView methods
00079 - (void)drawRect:(NSRect)rect;
00080 - (void)instantiateView:(NSRect)rect;
00081 
00082 // WindowImplCocoa methods
00083 - (BOOL)isFullScreen;
00084 - (void)setFullScreen:(BOOL)fullScreen options:(const cinder::app::FullScreenOptions *)options;
00085 - (cinder::Vec2i)getSize;
00086 - (void)setSize:(cinder::Vec2i)size;
00087 - (cinder::Vec2i)getPos;
00088 - (void)setPos:(cinder::Vec2i)pos;
00089 - (float)getContentScale;
00090 - (void)close;
00091 - (std::string)getTitle;
00092 - (void)setTitle:(std::string)title;
00093 - (BOOL)isBorderless;
00094 - (void)setBorderless:(BOOL)borderless;
00095 - (BOOL)isAlwaysOnTop;
00096 - (void)setAlwaysOnTop:(BOOL)alwaysOnTop;
00097 - (cinder::DisplayRef)getDisplay;
00098 - (cinder::app::RendererRef)getRenderer;
00099 - (const std::vector<cinder::app::TouchEvent::Touch>&)getActiveTouches;
00100 - (void*)getNative;
00101 - (void)hide;
00102 - (void)show;
00103 
00104 // CinderViewDelegate methods
00105 - (void)draw;
00106 - (cinder::app::WindowRef)getWindowRef;
00107 
00108 @end