Cinder  0.8.6
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
AppImplCocoaScreenSaver.h
Go to the documentation of this file.
1 /*
2  Copyright (c) 2012, The Cinder Project, All rights reserved.
3 
4  This code is intended for use with the Cinder C++ library: http://libcinder.org
5 
6  Redistribution and use in source and binary forms, with or without modification, are permitted provided that
7  the following conditions are met:
8 
9  * Redistributions of source code must retain the above copyright notice, this list of conditions and
10  the following disclaimer.
11  * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
12  the following disclaimer in the documentation and/or other materials provided with the distribution.
13 
14  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
15  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
16  PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
17  ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
18  TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
19  HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
20  NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
21  POSSIBILITY OF SUCH DAMAGE.
22 */
23 
24 #include "cinder/gl/gl.h" // necessary to give GLee the jump on Cocoa.h
25 
26 #import <Cocoa/Cocoa.h>
27 #import <ScreenSaver/ScreenSaver.h>
28 
31 #import "cinder/app/Window.h"
32 
33 #include <string>
34 
36 
37 @interface AppImplCocoaScreenSaver : NSObject {
38  @public
40  std::list<WindowImplCocoaScreenSaver*> mWindows;
42  float mFrameRate;
43 
45 }
46 
48 - (void)addWindow:(WindowImplCocoaScreenSaver*)windowImpl;
49 - (BOOL)isPreview;
50 
51 - (size_t)getNumWindows;
52 - (cinder::app::WindowRef)getWindowIndex:(size_t)index;
53 - (cinder::app::WindowRef)getWindow;
54 - (void)setActiveWindow:(WindowImplCocoaScreenSaver*)activeWindow;
55 
56 - (void)animateOneFrame:(WindowImplCocoaScreenSaver*)callee;
57 
58 - (float)getFrameRate;
59 - (void)setFrameRate:(float)frameRate;
60 - (cinder::fs::path)getAppPath;
61 - (void)removeCinderView:(WindowImplCocoaScreenSaver*)win;
62 - (void)finalCleanup;
63 
64 @end
65 
66 @interface WindowImplCocoaScreenSaver : ScreenSaverView<WindowImplCocoa,CinderViewDelegate> {
67  @public
71 
72  BOOL mPreview;
76 }
77 
78 // ScreenSaverView methods
79 - (void)drawRect:(NSRect)rect;
80 - (void)instantiateView:(NSRect)rect;
81 
82 // WindowImplCocoa methods
83 - (BOOL)isFullScreen;
84 - (void)setFullScreen:(BOOL)fullScreen options:(const cinder::app::FullScreenOptions *)options;
85 - (cinder::Vec2i)getSize;
86 - (void)setSize:(cinder::Vec2i)size;
87 - (cinder::Vec2i)getPos;
88 - (void)setPos:(cinder::Vec2i)pos;
89 - (float)getContentScale;
90 - (void)close;
91 - (std::string)getTitle;
92 - (void)setTitle:(std::string)title;
93 - (BOOL)isBorderless;
94 - (void)setBorderless:(BOOL)borderless;
95 - (BOOL)isAlwaysOnTop;
96 - (void)setAlwaysOnTop:(BOOL)alwaysOnTop;
97 - (cinder::DisplayRef)getDisplay;
98 - (cinder::app::RendererRef)getRenderer;
99 - (const std::vector<cinder::app::TouchEvent::Touch>&)getActiveTouches;
100 - (void*)getNative;
101 - (void)hide;
102 - (void)show;
103 
104 // CinderViewDelegate methods
105 - (void)draw;
106 - (cinder::app::WindowRef)getWindowRef;
107 
108 @end
WindowImplCocoaScreenSaver * mActiveWindow
Definition: AppImplCocoaScreenSaver.h:41
void hide()
Definition: AppCocoaTouch.mm:1028
void * getNative()
Definition: AppCocoaTouch.mm:1051
cinder::app::AppScreenSaver * mApp
Definition: AppImplCocoaScreenSaver.h:39
BOOL isAlwaysOnTop()
Definition: AppCocoaTouch.mm:1019
void close()
Definition: AppCocoaTouch.mm:1001
BOOL mPreview
Definition: AppImplCocoaScreenSaver.h:72
BOOL mResizeCalled
Definition: AppImplCocoaScreenSaver.h:73
float getContentScale()
Definition: AppCocoaTouch.mm:996
typedef void(APIENTRYP GLEEPFNGLBLENDCOLORPROC)(GLclampf red
Definition: AppImplCocoaScreenSaver.h:37
float mFrameRate
Definition: AppImplCocoaScreenSaver.h:42
BOOL isFullScreen()
Definition: AppCocoaTouch.mm:969
BOOL mHasDrawnSinceLastUpdate
Definition: AppImplCocoaScreenSaver.h:75
std::shared_ptr< Window > WindowRef
Definition: Event.h:49
BOOL mIsMainView
Definition: AppImplCocoaScreenSaver.h:74
BOOL isBorderless()
Definition: AppCocoaTouch.mm:1010
cinder::app::WindowRef mWindowRef
Definition: AppImplCocoaScreenSaver.h:69
BOOL mSetupCalled
Definition: AppImplCocoaScreenSaver.h:44
void setFrameRate(float frameRate)
Sets the maximum frame-rate the active App will attempt to maintain.
Definition: App.h:603
void show()
Definition: AppCocoaTouch.mm:1032
cinder::DisplayRef mDisplay
Definition: AppImplCocoaScreenSaver.h:70
std::shared_ptr< class Display > DisplayRef
Definition: Display.h:53
GLXDrawable draw
Definition: GLee.h:16766
size_t getNumWindows()
Returns the number of Windows the app has open.
Definition: App.h:572
CinderView * mCinderView
Definition: AppImplCocoaScreenSaver.h:68
Definition: AppImplCocoaScreenSaver.h:66
Definition: AppScreenSaver.h:49
Definition: CinderView.h:36
float getFrameRate()
Returns the maximum frame-rate the active App will attempt to maintain.
Definition: App.h:601
Definition: CinderView.h:54
std::list< WindowImplCocoaScreenSaver * > mWindows
Definition: AppImplCocoaScreenSaver.h:40
Vec2< int > Vec2i
Definition: Vector.h:1313
void setFullScreen(bool fullScreen=true)
Sets whether the active App is in full-screen mode based on fullScreen.
Definition: App.h:607