~ubuntu-branches/ubuntu/trusty/blender/trusty

« back to all changes in this revision

Viewing changes to intern/ghost/intern/GHOST_WindowCocoa.h

  • Committer: Package Import Robot
  • Author(s): Jeremy Bicha
  • Date: 2013-03-06 12:08:47 UTC
  • mfrom: (1.5.1) (14.1.8 experimental)
  • Revision ID: package-import@ubuntu.com-20130306120847-frjfaryb2zrotwcg
Tags: 2.66a-1ubuntu1
* Resynchronize with Debian (LP: #1076930, #1089256, #1052743, #999024,
  #1122888, #1147084)
* debian/control:
  - Lower build-depends on libavcodec-dev since we're not
    doing the libav9 transition in Ubuntu yet

Show diffs side-by-side

added added

removed removed

Lines of Context:
53
53
 * which is called the gutter.
54
54
 * When OpenGL contexts are active, GHOST will use AGL_BUFFER_RECT to prevent
55
55
 * OpenGL drawing outside the reduced client rectangle.
56
 
 * @author      Maarten Gribnau
57
 
 * @date        May 23, 2001
 
56
 * \author      Maarten Gribnau
 
57
 * \date        May 23, 2001
58
58
 */
59
59
class GHOST_WindowCocoa : public GHOST_Window {
60
60
public:
62
62
         * Constructor.
63
63
         * Creates a new window and opens it.
64
64
         * To check if the window was created properly, use the getValid() method.
65
 
         * @param systemCocoa           The associated system class to forward events to
66
 
         * @param title                         The text shown in the title bar of the window.
67
 
         * @param left                          The coordinate of the left edge of the window.
68
 
         * @param top                           The coordinate of the top edge of the window.
69
 
         * @param width                         The width the window.
70
 
         * @param height                        The height the window.
71
 
         * @param state                         The state the window is initially opened with.
72
 
         * @param type                          The type of drawing context installed in this window.
73
 
         * @param stereoVisual          Stereo visual for quad buffered stereo.
74
 
         * @param numOfAASamples        Number of samples used for AA (zero if no AA)
 
65
         * \param systemCocoa           The associated system class to forward events to
 
66
         * \param title                         The text shown in the title bar of the window.
 
67
         * \param left                          The coordinate of the left edge of the window.
 
68
         * \param top                           The coordinate of the top edge of the window.
 
69
         * \param width                         The width the window.
 
70
         * \param height                        The height the window.
 
71
         * \param state                         The state the window is initially opened with.
 
72
         * \param type                          The type of drawing context installed in this window.
 
73
         * \param stereoVisual          Stereo visual for quad buffered stereo.
 
74
         * \param numOfAASamples        Number of samples used for AA (zero if no AA)
75
75
         */
76
76
        GHOST_WindowCocoa(
77
 
                GHOST_SystemCocoa *systemCocoa,
78
 
                const STR_String& title,
79
 
                GHOST_TInt32 left,
80
 
                GHOST_TInt32 bottom,
81
 
                GHOST_TUns32 width,
82
 
                GHOST_TUns32 height,
83
 
                GHOST_TWindowState state,
84
 
                GHOST_TDrawingContextType type = GHOST_kDrawingContextTypeNone,
85
 
                const bool stereoVisual = false,
86
 
                const GHOST_TUns16 numOfAASamples = 0
87
 
        );
 
77
            GHOST_SystemCocoa *systemCocoa,
 
78
            const STR_String& title,
 
79
            GHOST_TInt32 left,
 
80
            GHOST_TInt32 bottom,
 
81
            GHOST_TUns32 width,
 
82
            GHOST_TUns32 height,
 
83
            GHOST_TWindowState state,
 
84
            GHOST_TDrawingContextType type = GHOST_kDrawingContextTypeNone,
 
85
            const bool stereoVisual = false,
 
86
            const GHOST_TUns16 numOfAASamples = 0
 
87
            );
88
88
 
89
89
        /**
90
90
         * Destructor.
94
94
 
95
95
        /**
96
96
         * Returns indication as to whether the window is valid.
97
 
         * @return The validity of the window.
 
97
         * \return The validity of the window.
98
98
         */
99
 
        virtual bool getValid() const;
 
99
        virtual bool getValid() const;
100
100
        
101
101
        /**
102
102
         * Returns the associated NSWindow object
103
 
         * @return The associated NSWindow object
 
103
         * \return The associated NSWindow object
104
104
         */
105
 
        virtual void* getOSWindow() const;
 
105
        virtual void *getOSWindow() const;
106
106
 
107
107
        /**
108
108
         * Sets the title displayed in the title bar.
109
 
         * @param title The title to display in the title bar.
 
109
         * \param title The title to display in the title bar.
110
110
         */
111
111
        virtual void setTitle(const STR_String& title);
112
112
 
113
113
        /**
114
114
         * Returns the title displayed in the title bar.
115
 
         * @param title The title displayed in the title bar.
 
115
         * \param title The title displayed in the title bar.
116
116
         */
117
117
        virtual void getTitle(STR_String& title) const;
118
118
 
119
119
        /**
120
120
         * Returns the window rectangle dimensions.
121
121
         * The dimensions are given in screen coordinates that are relative to the upper-left corner of the screen. 
122
 
         * @param bounds The bounding rectangle of the window.
 
122
         * \param bounds The bounding rectangle of the window.
123
123
         */
124
 
        virtual void getWindowBounds(GHOST_Rect& bounds) const;
 
124
        virtual void getWindowBounds(GHOST_Rect& bounds) const;
125
125
        
126
126
        /**
127
127
         * Returns the client rectangle dimensions.
128
128
         * The left and top members of the rectangle are always zero.
129
 
         * @param bounds The bounding rectangle of the cleient area of the window.
 
129
         * \param bounds The bounding rectangle of the cleient area of the window.
130
130
         */
131
 
        virtual void getClientBounds(GHOST_Rect& bounds) const;
 
131
        virtual void getClientBounds(GHOST_Rect& bounds) const;
132
132
 
133
133
        /**
134
134
         * Resizes client rectangle width.
135
 
         * @param width The new width of the client area of the window.
 
135
         * \param width The new width of the client area of the window.
136
136
         */
137
 
        virtual GHOST_TSuccess setClientWidth(GHOST_TUns32 width);
 
137
        virtual GHOST_TSuccess setClientWidth(GHOST_TUns32 width);
138
138
 
139
139
        /**
140
140
         * Resizes client rectangle height.
141
 
         * @param height The new height of the client area of the window.
 
141
         * \param height The new height of the client area of the window.
142
142
         */
143
 
        virtual GHOST_TSuccess setClientHeight(GHOST_TUns32 height);
 
143
        virtual GHOST_TSuccess setClientHeight(GHOST_TUns32 height);
144
144
 
145
145
        /**
146
146
         * Resizes client rectangle.
147
 
         * @param width         The new width of the client area of the window.
148
 
         * @param height        The new height of the client area of the window.
 
147
         * \param width         The new width of the client area of the window.
 
148
         * \param height        The new height of the client area of the window.
149
149
         */
150
 
        virtual GHOST_TSuccess setClientSize(GHOST_TUns32 width, GHOST_TUns32 height);
 
150
        virtual GHOST_TSuccess setClientSize(GHOST_TUns32 width, GHOST_TUns32 height);
151
151
 
152
152
        /**
153
153
         * Returns the state of the window (normal, minimized, maximized).
154
 
         * @return The state of the window.
 
154
         * \return The state of the window.
155
155
         */
156
156
        virtual GHOST_TWindowState getState() const;
157
157
 
158
158
        /**
159
159
         * Sets the window "modified" status, indicating unsaved changes
160
 
         * @param isUnsavedChanges Unsaved changes or not
161
 
         * @return Indication of success.
 
160
         * \param isUnsavedChanges Unsaved changes or not
 
161
         * \return Indication of success.
162
162
         */
163
163
        virtual GHOST_TSuccess setModifiedState(bool isUnsavedChanges);
164
164
        
165
165
        /**
166
166
         * Converts a point in screen coordinates to client rectangle coordinates
167
 
         * @param inX   The x-coordinate on the screen.
168
 
         * @param inY   The y-coordinate on the screen.
169
 
         * @param outX  The x-coordinate in the client rectangle.
170
 
         * @param outY  The y-coordinate in the client rectangle.
 
167
         * \param inX   The x-coordinate on the screen.
 
168
         * \param inY   The y-coordinate on the screen.
 
169
         * \param outX  The x-coordinate in the client rectangle.
 
170
         * \param outY  The y-coordinate in the client rectangle.
171
171
         */
172
 
        virtual void screenToClient(GHOST_TInt32 inX, GHOST_TInt32 inY, GHOST_TInt32& outX, GHOST_TInt32& outY) const;
 
172
        virtual void screenToClient(GHOST_TInt32 inX, GHOST_TInt32 inY, GHOST_TInt32& outX, GHOST_TInt32& outY) const;
173
173
 
174
174
        /**
175
175
         * Converts a point in screen coordinates to client rectangle coordinates
176
 
         * @param inX   The x-coordinate in the client rectangle.
177
 
         * @param inY   The y-coordinate in the client rectangle.
178
 
         * @param outX  The x-coordinate on the screen.
179
 
         * @param outY  The y-coordinate on the screen.
 
176
         * \param inX   The x-coordinate in the client rectangle.
 
177
         * \param inY   The y-coordinate in the client rectangle.
 
178
         * \param outX  The x-coordinate on the screen.
 
179
         * \param outY  The y-coordinate on the screen.
180
180
         */
181
 
        virtual void clientToScreen(GHOST_TInt32 inX, GHOST_TInt32 inY, GHOST_TInt32& outX, GHOST_TInt32& outY) const;
 
181
        virtual void clientToScreen(GHOST_TInt32 inX, GHOST_TInt32 inY, GHOST_TInt32& outX, GHOST_TInt32& outY) const;
182
182
 
183
183
        /**
184
184
         * Converts a point in screen coordinates to client rectangle coordinates
185
185
         * but without the y coordinate conversion needed for ghost compatibility.
186
 
         * @param inX   The x-coordinate in the client rectangle.
187
 
         * @param inY   The y-coordinate in the client rectangle.
188
 
         * @param outX  The x-coordinate on the screen.
189
 
         * @param outY  The y-coordinate on the screen.
 
186
         * \param inX   The x-coordinate in the client rectangle.
 
187
         * \param inY   The y-coordinate in the client rectangle.
 
188
         * \param outX  The x-coordinate on the screen.
 
189
         * \param outY  The y-coordinate on the screen.
190
190
         */
191
191
        void clientToScreenIntern(GHOST_TInt32 inX, GHOST_TInt32 inY, GHOST_TInt32& outX, GHOST_TInt32& outY) const;
192
192
 
193
193
        /**
194
194
         * Converts a point in screen coordinates to client rectangle coordinates,
195
195
         * but without the y coordinate conversion needed for ghost compatibility.
196
 
         * @param inX   The x-coordinate in the client rectangle.
197
 
         * @param inY   The y-coordinate in the client rectangle.
198
 
         * @param outX  The x-coordinate on the screen.
199
 
         * @param outY  The y-coordinate on the screen.
 
196
         * \param inX   The x-coordinate in the client rectangle.
 
197
         * \param inY   The y-coordinate in the client rectangle.
 
198
         * \param outX  The x-coordinate on the screen.
 
199
         * \param outY  The y-coordinate on the screen.
200
200
         */
201
201
        void screenToClientIntern(GHOST_TInt32 inX, GHOST_TInt32 inY, GHOST_TInt32& outX, GHOST_TInt32& outY) const;
202
202
 
203
203
        /**
204
204
         * Gets the screen the window is displayed in
205
 
         * @return The NSScreen object
 
205
         * \return The NSScreen object
206
206
         */
207
 
        NSScreen* getScreen();
 
207
        NSScreen *getScreen();
208
208
        
209
209
        /**
210
210
         * Sets the state of the window (normal, minimized, maximized).
211
 
         * @param state The state of the window.
212
 
         * @return Indication of success.
 
211
         * \param state The state of the window.
 
212
         * \return Indication of success.
213
213
         */
214
214
        virtual GHOST_TSuccess setState(GHOST_TWindowState state);
215
215
 
216
216
        /**
217
217
         * Sets the order of the window (bottom, top).
218
 
         * @param order The order of the window.
219
 
         * @return Indication of success.
 
218
         * \param order The order of the window.
 
219
         * \return Indication of success.
220
220
         */
221
221
        virtual GHOST_TSuccess setOrder(GHOST_TWindowOrder order);
222
222
 
223
223
        /**
224
224
         * Swaps front and back buffers of a window.
225
 
         * @return      A boolean success indicator.
 
225
         * \return      A boolean success indicator.
226
226
         */
227
227
        virtual GHOST_TSuccess swapBuffers();
228
228
 
229
229
        /**
230
230
         * Updates the drawing context of this window. Needed
231
231
         * whenever the window is changed.
232
 
         * @return Indication of success.
 
232
         * \return Indication of success.
233
233
         */
234
234
        GHOST_TSuccess updateDrawingContext();
235
235
 
236
236
        /**
237
237
         * Activates the drawing context of this window.
238
 
         * @return      A boolean success indicator.
 
238
         * \return      A boolean success indicator.
239
239
         */
240
240
        virtual GHOST_TSuccess activateDrawingContext();
241
241
 
242
242
        virtual void loadCursor(bool visible, GHOST_TStandardCursor cursor) const;
243
243
    
244
244
 
245
 
        const GHOST_TabletData* GetTabletData()
246
 
        { return &m_tablet; }
 
245
        const GHOST_TabletData *GetTabletData()
 
246
        {
 
247
                return &m_tablet;
 
248
        }
247
249
 
248
250
        GHOST_TabletData& GetCocoaTabletData()
249
 
        { return m_tablet; }
 
251
        {
 
252
                return m_tablet;
 
253
        }
250
254
        
251
255
        /**
252
256
         * Sets the progress bar value displayed in the window/application icon
253
 
         * @param progress The progress % (0.0 to 1.0)
 
257
         * \param progress The progress % (0.0 to 1.0)
254
258
         */
255
259
        virtual GHOST_TSuccess setProgressBar(float progress);
256
260
        
258
262
         * Hides the progress bar icon
259
263
         */
260
264
        virtual GHOST_TSuccess endProgressBar();
 
265
        
 
266
        
 
267
        virtual void setNativePixelSize(void);
 
268
 
 
269
        
261
270
protected:
262
271
        /**
263
272
         * Tries to install a rendering context in this window.
264
 
         * @param type  The type of rendering context installed.
265
 
         * @return Indication as to whether installation has succeeded.
 
273
         * \param type  The type of rendering context installed.
 
274
         * \return Indication as to whether installation has succeeded.
266
275
         */
267
276
        virtual GHOST_TSuccess installDrawingContext(GHOST_TDrawingContextType type);
268
277
 
269
278
        /**
270
279
         * Removes the current drawing context.
271
 
         * @return Indication as to whether removal has succeeded.
 
280
         * \return Indication as to whether removal has succeeded.
272
281
         */
273
282
        virtual GHOST_TSuccess removeDrawingContext();
274
283
    
275
284
        /**
276
285
         * Invalidates the contents of this window.
277
 
         * @return Indication of success.
 
286
         * \return Indication of success.
278
287
         */
279
288
        virtual GHOST_TSuccess invalidate();
280
289
 
301
310
         * native window system calls.
302
311
         */
303
312
        virtual GHOST_TSuccess setWindowCustomCursorShape(GHOST_TUns8 *bitmap, GHOST_TUns8 *mask,
304
 
                                        int sizex, int sizey, int hotX, int hotY, int fg_color, int bg_color);
 
313
                                                          int sizex, int sizey, int hotX, int hotY, int fg_color, int bg_color);
305
314
                                        
306
315
        virtual GHOST_TSuccess setWindowCustomCursorShape(GHOST_TUns8 bitmap[16][2], GHOST_TUns8 mask[16][2], int hotX, int hotY);
307
316
 
320
329
        /** The first created OpenGL context (for sharing display lists) */
321
330
        static NSOpenGLContext *s_firstOpenGLcontext;
322
331
        
323
 
        NSCursor*       m_customCursor;
 
332
        NSCursor *m_customCursor;
324
333
 
325
334
        GHOST_TabletData m_tablet;
326
335
};