14#ifndef COCOAGRAPHICSWINDOW_H
15#define COCOAGRAPHICSWINDOW_H
22#import <AppKit/NSEvent.h>
23#import <AppKit/NSView.h>
24#import <AppKit/NSWindow.h>
26#import <CoreVideo/CoreVideo.h>
35 const std::string &name,
51 void handle_move_event();
52 void handle_resize_event();
53 void handle_minimize_event(
bool minimized);
54 void handle_foreground_event(
bool foreground);
55 bool handle_close_request();
56 void handle_close_event();
57 void handle_key_event(NSEvent *event);
58 void handle_mouse_button_event(
int button,
bool down);
59 void handle_mouse_moved_event(
bool in_window,
double x,
double y,
bool absolute);
60 void handle_wheel_event(
double x,
double y);
67 virtual void close_window();
68 virtual bool open_window();
70#if __MAC_OS_X_VERSION_MAX_ALLOWED >= 1060
71 CFMutableArrayRef find_display_modes(
int width,
int height);
72 bool do_switch_fullscreen(CGDisplayModeRef mode);
74 CFDictionaryRef find_display_mode(
int width,
int height);
75 bool do_switch_fullscreen(CFDictionaryRef mode);
78 virtual void mouse_mode_absolute();
79 virtual void mouse_mode_relative();
82 NSData *load_image_data(
const Filename &filename);
83 NSImage *load_image(
const Filename &filename);
85 NSCursor *load_cursor(
const Filename &filename);
87 void handle_modifier(NSUInteger modifierFlags, NSUInteger mask,
ButtonHandle button);
94 NSUInteger _modifier_keys;
95 UInt32 _dead_key_state;
96 CGDirectDisplayID _display;
99 bool _context_needs_update;
100 bool _vsync_enabled =
false;
102#if __MAC_OS_X_VERSION_MAX_ALLOWED >= 1060
103 CGDisplayModeRef _fullscreen_mode;
104 CGDisplayModeRef _windowed_mode;
106 CFDictionaryRef _fullscreen_mode;
107 CFDictionaryRef _windowed_mode;
121 static void init_type() {
122 GraphicsWindow::init_type();
124 GraphicsWindow::get_class_type());
127 return get_class_type();
129 virtual TypeHandle force_init_type() {init_type();
return get_class_type();}
An interface to the Cocoa system for managing OpenGL windows under Mac OS X.
virtual void end_flip()
This function will be called within the draw thread after begin_flip() has been called on all windows...
NSView * get_nsview() const
Returns a pointer to the underlying NSView.
virtual bool move_pointer(int device, int x, int y)
Forces the pointer to the indicated position within the window, if possible.
virtual void end_frame(FrameMode mode, Thread *current_thread)
This function will be called within the draw thread after rendering is completed for a given frame.
virtual bool begin_frame(FrameMode mode, Thread *current_thread)
This function will be called within the draw thread before beginning rendering for a given frame.
virtual void set_properties_now(WindowProperties &properties)
Applies the requested set of properties to the window, if possible, for instance to request a change ...
NSWindow * get_nswindow() const
Returns a pointer to the underlying NSWindow.
virtual ButtonMap * get_keyboard_map() const
Returns a ButtonMap containing the association between raw buttons and virtual buttons.
virtual void process_events()
Do whatever processing is necessary to ensure that the window responds to user events.
The name of a file, such as a texture file or an Egg file.
A container for the various kinds of properties we might ask to have on a graphics frameBuffer before...
This class is the main interface to controlling the render process.
This is a base class for the various different classes that represent the result of a frame of render...
An object to create GraphicsOutputs that share a particular 3-D API.
Encapsulates all the communication with a particular instance of a given rendering backend.
A window, fullscreen or on a desktop, into which a graphics device sends its output for interactive d...
A thread; that is, a lightweight process.
TypeHandle is the identifier used to differentiate C++ class types.
A container for the various kinds of properties we might ask to have on a graphics window before we o...
This is our own Panda specialization on the default STL map.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
void register_type(TypeHandle &type_handle, const std::string &name)
This inline function is just a convenient way to call TypeRegistry::register_type(),...