mirror of
https://github.com/panda3d/panda3d.git
synced 2025-09-28 15:53:55 -04:00
display: Add convenient shorthand for win.request_properties()
Now instead of this: win.request_properties(WindowProperties(title="Test")) You can directly do this: win.request_properties(title="Test")
This commit is contained in:
parent
f79ef139ba
commit
650b958217
@ -55,7 +55,9 @@ PUBLISHED:
|
|||||||
const WindowProperties get_requested_properties() const;
|
const WindowProperties get_requested_properties() const;
|
||||||
void clear_rejected_properties();
|
void clear_rejected_properties();
|
||||||
WindowProperties get_rejected_properties() const;
|
WindowProperties get_rejected_properties() const;
|
||||||
void request_properties(const WindowProperties &requested_properties);
|
|
||||||
|
EXTENSION(void request_properties(PyObject *args, PyObject *kwds));
|
||||||
|
|
||||||
INLINE bool is_closed() const;
|
INLINE bool is_closed() const;
|
||||||
virtual bool is_active() const;
|
virtual bool is_active() const;
|
||||||
INLINE bool is_fullscreen() const;
|
INLINE bool is_fullscreen() const;
|
||||||
@ -100,6 +102,8 @@ PUBLISHED:
|
|||||||
virtual void close_ime();
|
virtual void close_ime();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
void request_properties(const WindowProperties &requested_properties);
|
||||||
|
|
||||||
virtual void add_window_proc( const GraphicsWindowProc* wnd_proc_object ){};
|
virtual void add_window_proc( const GraphicsWindowProc* wnd_proc_object ){};
|
||||||
virtual void remove_window_proc( const GraphicsWindowProc* wnd_proc_object ){};
|
virtual void remove_window_proc( const GraphicsWindowProc* wnd_proc_object ){};
|
||||||
virtual void clear_window_procs(){};
|
virtual void clear_window_procs(){};
|
||||||
|
@ -12,9 +12,26 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "graphicsWindow_ext.h"
|
#include "graphicsWindow_ext.h"
|
||||||
|
#include "windowProperties_ext.h"
|
||||||
|
|
||||||
#ifdef HAVE_PYTHON
|
#ifdef HAVE_PYTHON
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Convenient shorthand for requesting properties.
|
||||||
|
*/
|
||||||
|
void Extension<GraphicsWindow>::
|
||||||
|
request_properties(PyObject *args, PyObject *kwds) {
|
||||||
|
extern struct Dtool_PyTypedObject Dtool_WindowProperties;
|
||||||
|
|
||||||
|
WindowProperties props;
|
||||||
|
PyObject *py_props = DTool_CreatePyInstance((void *)&props, Dtool_WindowProperties, false, false);
|
||||||
|
|
||||||
|
invoke_extension(&props).__init__(py_props, args, kwds);
|
||||||
|
|
||||||
|
_this->request_properties(props);
|
||||||
|
Py_DECREF(py_props);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds a python event handler to be called when a window event occurs.
|
* Adds a python event handler to be called when a window event occurs.
|
||||||
*/
|
*/
|
||||||
|
@ -30,6 +30,8 @@
|
|||||||
template<>
|
template<>
|
||||||
class Extension<GraphicsWindow> : public ExtensionBase<GraphicsWindow> {
|
class Extension<GraphicsWindow> : public ExtensionBase<GraphicsWindow> {
|
||||||
public:
|
public:
|
||||||
|
void request_properties(PyObject *args, PyObject *kwds);
|
||||||
|
|
||||||
void add_python_event_handler(PyObject* handler, PyObject* name);
|
void add_python_event_handler(PyObject* handler, PyObject* name);
|
||||||
void remove_python_event_handler(PyObject* name);
|
void remove_python_event_handler(PyObject* name);
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user