1 /* Clutter -  An OpenGL based 'interactive canvas' library.
2  * OSX backend - integration with NSWindow and NSView
3  *
4  * Copyright (C) 2007  Tommi Komulainen <tommi.komulainen@iki.fi>
5  * Copyright (C) 2007  OpenedHand Ltd.
6  *
7  * This library is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public
9  * License as published by the Free Software Foundation; either
10  * version 2 of the License, or (at your option) any later version.
11  *
12  * This library is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15  * Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public
18  * License along with this library. If not, see <http://www.gnu.org/licenses/>.
19  *
20  *
21  */
22 #ifndef __CLUTTER_STAGE_OSX_H__
23 #define __CLUTTER_STAGE_OSX_H__
24 
25 #include <clutter/clutter-backend.h>
26 #include <clutter/clutter-stage.h>
27 #include <clutter/clutter-stage-window.h>
28 
29 #import <Foundation/Foundation.h>
30 #import <AppKit/AppKit.h>
31 
32 G_BEGIN_DECLS
33 
34 /* convenience macros */
35 #define CLUTTER_TYPE_STAGE_OSX             (_clutter_stage_osx_get_type())
36 #define CLUTTER_STAGE_OSX(obj)             (G_TYPE_CHECK_INSTANCE_CAST((obj),CLUTTER_TYPE_STAGE_OSX,ClutterStageOSX))
37 #define CLUTTER_STAGE_OSX_CLASS(klass)     (G_TYPE_CHECK_CLASS_CAST((klass),CLUTTER_TYPE_STAGE_OSX,ClutterStage))
38 #define CLUTTER_IS_STAGE_OSX(obj)          (G_TYPE_CHECK_INSTANCE_TYPE((obj),CLUTTER_TYPE_STAGE_OSX))
39 #define CLUTTER_IS_STAGE_OSX_CLASS(klass)  (G_TYPE_CHECK_CLASS_TYPE((klass),CLUTTER_TYPE_STAGE_OSX))
40 #define CLUTTER_STAGE_OSX_GET_CLASS(obj)   (G_TYPE_INSTANCE_GET_CLASS((obj),CLUTTER_TYPE_STAGE_OSX,ClutterStageOSXClass))
41 
42 typedef struct _ClutterStageOSX      ClutterStageOSX;
43 typedef struct _ClutterStageOSXClass ClutterStageOSXClass;
44 
45 @interface ClutterGLWindow : NSWindow <NSWindowDelegate>
46 {
47 @public
48   ClutterStageOSX *stage_osx;
49 }
50 @end
51 
52 struct _ClutterStageOSX
53 {
54   GObject parent;
55 
56   ClutterBackend *backend;
57   ClutterStage   *wrapper;
58 
59   NSWindow *window;
60   NSOpenGLView *view;
61 
62   gboolean haveNormalFrame;
63   NSRect normalFrame;
64 
65   gint requisition_width;
66   gint requisition_height;
67 
68   gboolean acceptFocus;
69   gboolean isHiding;
70   gboolean haveRealized;
71 
72   gfloat scroll_pos_x;
73   gfloat scroll_pos_y;
74 };
75 
76 struct _ClutterStageOSXClass
77 {
78   GObjectClass parent_class;
79 };
80 
81 GType _clutter_stage_osx_get_type (void) G_GNUC_CONST;
82 
83 G_END_DECLS
84 
85 #endif /* __CLUTTER_STAGE_OSX_H__ */
86