summaryrefslogtreecommitdiffstats
path: root/Mac
diff options
context:
space:
mode:
Diffstat (limited to 'Mac')
-rw-r--r--Mac/Modules/win/Winmodule.c125
-rw-r--r--Mac/Modules/win/winedit.py124
-rw-r--r--Mac/Modules/win/winsupport.py7
3 files changed, 163 insertions, 93 deletions
diff --git a/Mac/Modules/win/Winmodule.c b/Mac/Modules/win/Winmodule.c
index 4dce0e8..7984293 100644
--- a/Mac/Modules/win/Winmodule.c
+++ b/Mac/Modules/win/Winmodule.c
@@ -11,10 +11,17 @@
#include <Windows.h>
#if !ACCESSOR_CALLS_ARE_FUNCTIONS
+/* Carbon calls that we emulate in classic mode */
#define GetWindowSpareFlag(win) (((CWindowPeek)(win))->spareFlag)
#define GetWindowFromPort(port) ((WindowRef)(port))
#define GetWindowPortBounds(win, rectp) (*(rectp) = ((CWindowPeek)(win))->port.portRect)
#endif
+#if ACCESSOR_CALLS_ARE_FUNCTIONS
+/* Classic calls that we emulate in carbon mode */
+#define GetWindowUpdateRgn(win, rgn) GetWindowRegion((win), kWindowUpdateRgn, (rgn))
+#define GetWindowStructureRgn(win, rgn) GetWindowRegion((win), kWindowStructureRgn, (rgn))
+#define GetWindowContentRgn(win, rgn) GetWindowRegion((win), kWindowContentRgn, (rgn))
+#endif
/* Function to dispose a window, with a "normal" calling sequence */
static void
@@ -1851,6 +1858,110 @@ static PyObject *WinObj_GetWindowPortBounds(_self, _args)
return _res;
}
+static PyObject *WinObj_IsWindowVisible(_self, _args)
+ WindowObject *_self;
+ PyObject *_args;
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = IsWindowVisible(_self->ob_itself);
+ _res = Py_BuildValue("b",
+ _rv);
+ return _res;
+}
+
+static PyObject *WinObj_GetWindowZoomFlag(_self, _args)
+ WindowObject *_self;
+ PyObject *_args;
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetWindowZoomFlag(_self->ob_itself);
+ _res = Py_BuildValue("b",
+ _rv);
+ return _res;
+}
+
+static PyObject *WinObj_GetWindowStructureRgn(_self, _args)
+ WindowObject *_self;
+ PyObject *_args;
+{
+ PyObject *_res = NULL;
+ RgnHandle r;
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &r))
+ return NULL;
+ GetWindowStructureRgn(_self->ob_itself,
+ r);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *WinObj_GetWindowContentRgn(_self, _args)
+ WindowObject *_self;
+ PyObject *_args;
+{
+ PyObject *_res = NULL;
+ RgnHandle r;
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &r))
+ return NULL;
+ GetWindowContentRgn(_self->ob_itself,
+ r);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *WinObj_GetWindowUpdateRgn(_self, _args)
+ WindowObject *_self;
+ PyObject *_args;
+{
+ PyObject *_res = NULL;
+ RgnHandle r;
+ if (!PyArg_ParseTuple(_args, "O&",
+ ResObj_Convert, &r))
+ return NULL;
+ GetWindowUpdateRgn(_self->ob_itself,
+ r);
+ Py_INCREF(Py_None);
+ _res = Py_None;
+ return _res;
+}
+
+static PyObject *WinObj_GetWindowTitleWidth(_self, _args)
+ WindowObject *_self;
+ PyObject *_args;
+{
+ PyObject *_res = NULL;
+ short _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetWindowTitleWidth(_self->ob_itself);
+ _res = Py_BuildValue("h",
+ _rv);
+ return _res;
+}
+
+static PyObject *WinObj_GetNextWindow(_self, _args)
+ WindowObject *_self;
+ PyObject *_args;
+{
+ PyObject *_res = NULL;
+ WindowPtr _rv;
+ if (!PyArg_ParseTuple(_args, ""))
+ return NULL;
+ _rv = GetNextWindow(_self->ob_itself);
+ _res = Py_BuildValue("O&",
+ WinObj_WhichWindow, _rv);
+ return _res;
+}
+
#if !TARGET_API_MAC_CARBON
static PyObject *WinObj_CloseWindow(_self, _args)
@@ -2142,6 +2253,20 @@ static PyMethodDef WinObj_methods[] = {
"() -> None"},
{"GetWindowPortBounds", (PyCFunction)WinObj_GetWindowPortBounds, 1,
"() -> (Rect bounds)"},
+ {"IsWindowVisible", (PyCFunction)WinObj_IsWindowVisible, 1,
+ "() -> (Boolean _rv)"},
+ {"GetWindowZoomFlag", (PyCFunction)WinObj_GetWindowZoomFlag, 1,
+ "() -> (Boolean _rv)"},
+ {"GetWindowStructureRgn", (PyCFunction)WinObj_GetWindowStructureRgn, 1,
+ "(RgnHandle r) -> None"},
+ {"GetWindowContentRgn", (PyCFunction)WinObj_GetWindowContentRgn, 1,
+ "(RgnHandle r) -> None"},
+ {"GetWindowUpdateRgn", (PyCFunction)WinObj_GetWindowUpdateRgn, 1,
+ "(RgnHandle r) -> None"},
+ {"GetWindowTitleWidth", (PyCFunction)WinObj_GetWindowTitleWidth, 1,
+ "() -> (short _rv)"},
+ {"GetNextWindow", (PyCFunction)WinObj_GetNextWindow, 1,
+ "() -> (WindowPtr _rv)"},
#if !TARGET_API_MAC_CARBON
{"CloseWindow", (PyCFunction)WinObj_CloseWindow, 1,
diff --git a/Mac/Modules/win/winedit.py b/Mac/Modules/win/winedit.py
index 42fbcf8..09fd300 100644
--- a/Mac/Modules/win/winedit.py
+++ b/Mac/Modules/win/winedit.py
@@ -1,105 +1,43 @@
# These are inline-routines/defines, so we do them "by hand"
#
-if 0:
- f = Method(CGrafPtr, 'GetWindowPort',
- (WindowRef, 'theWindow', InMode),
- )
- methods.append(f)
- f = Method(void, 'SetPortWindowPort',
- (WindowRef, 'theWindow', InMode),
- )
- methods.append(f)
-
- f = Method(short, 'GetWindowKind',
- (WindowRef, 'theWindow', InMode),
- )
- methods.append(f)
-
- f = Method(void, 'SetWindowKind',
- (WindowRef, 'theWindow', InMode),
- (short, 'wKind', InMode),
- )
- methods.append(f)
-
-
- f = Method(Boolean, 'IsWindowVisible',
- (WindowRef, 'theWindow', InMode),
- )
- methods.append(f)
-
- f = Method(Boolean, 'IsWindowHilited',
- (WindowRef, 'theWindow', InMode),
- )
- methods.append(f)
-
- f = Method(Boolean, 'GetWindowGoAwayFlag',
- (WindowRef, 'theWindow', InMode),
- )
- methods.append(f)
-
- f = Method(Boolean, 'GetWindowZoomFlag',
- (WindowRef, 'theWindow', InMode),
- condition='#if !TARGET_API_MAC_CARBON'
- )
- methods.append(f)
-
- f = Method(void, 'GetWindowStructureRgn',
- (WindowRef, 'theWindow', InMode),
- (RgnHandle, 'r', InMode),
- condition='#if !TARGET_API_MAC_CARBON'
- )
- methods.append(f)
-
- f = Method(void, 'GetWindowContentRgn',
- (WindowRef, 'theWindow', InMode),
- (RgnHandle, 'r', InMode),
- condition='#if !TARGET_API_MAC_CARBON'
- )
- methods.append(f)
-
- f = Method(void, 'GetWindowUpdateRgn',
- (WindowRef, 'theWindow', InMode),
- (RgnHandle, 'r', InMode),
- condition='#if !TARGET_API_MAC_CARBON'
- )
- methods.append(f)
-
- f = Method(short, 'GetWindowTitleWidth',
- (WindowRef, 'theWindow', InMode),
- condition='#if !TARGET_API_MAC_CARBON'
- )
- methods.append(f)
+f = Method(Boolean, 'IsWindowVisible',
+ (WindowRef, 'theWindow', InMode),
+)
+methods.append(f)
- f = Method(ExistingWindowPtr, 'GetNextWindow',
- (WindowRef, 'theWindow', InMode),
- )
- methods.append(f)
+f = Method(Boolean, 'GetWindowZoomFlag',
+ (WindowRef, 'theWindow', InMode),
+)
+methods.append(f)
- f = Method(void, 'GetWindowStandardState',
- (WindowRef, 'theWindow', InMode),
- (Rect, 'r', OutMode),
- )
- methods.append(f)
+f = Method(void, 'GetWindowStructureRgn',
+ (WindowRef, 'theWindow', InMode),
+ (RgnHandle, 'r', InMode),
+)
+methods.append(f)
- f = Method(void, 'GetWindowUserState',
- (WindowRef, 'theWindow', InMode),
- (Rect, 'r', OutMode),
- )
- methods.append(f)
+f = Method(void, 'GetWindowContentRgn',
+ (WindowRef, 'theWindow', InMode),
+ (RgnHandle, 'r', InMode),
+)
+methods.append(f)
+f = Method(void, 'GetWindowUpdateRgn',
+ (WindowRef, 'theWindow', InMode),
+ (RgnHandle, 'r', InMode),
+)
+methods.append(f)
- f = Method(void, 'SetWindowStandardState',
- (WindowRef, 'theWindow', InMode),
- (Rect, 'r', InMode),
- )
- methods.append(f)
+f = Method(short, 'GetWindowTitleWidth',
+ (WindowRef, 'theWindow', InMode),
+)
+methods.append(f)
- f = Method(void, 'SetWindowUserState',
- (WindowRef, 'theWindow', InMode),
- (Rect, 'r', InMode),
- )
- methods.append(f)
+f = Method(ExistingWindowPtr, 'GetNextWindow',
+ (WindowRef, 'theWindow', InMode),
+)
+methods.append(f)
# These have Mac prefixed to their name in the 3.1 universal headers,
# so we add the old/real names by hand.
diff --git a/Mac/Modules/win/winsupport.py b/Mac/Modules/win/winsupport.py
index 74b3bfd..6b67db1 100644
--- a/Mac/Modules/win/winsupport.py
+++ b/Mac/Modules/win/winsupport.py
@@ -57,10 +57,17 @@ includestuff = includestuff + """
#include <%s>""" % MACHEADERFILE + """
#if !ACCESSOR_CALLS_ARE_FUNCTIONS
+/* Carbon calls that we emulate in classic mode */
#define GetWindowSpareFlag(win) (((CWindowPeek)(win))->spareFlag)
#define GetWindowFromPort(port) ((WindowRef)(port))
#define GetWindowPortBounds(win, rectp) (*(rectp) = ((CWindowPeek)(win))->port.portRect)
#endif
+#if ACCESSOR_CALLS_ARE_FUNCTIONS
+/* Classic calls that we emulate in carbon mode */
+#define GetWindowUpdateRgn(win, rgn) GetWindowRegion((win), kWindowUpdateRgn, (rgn))
+#define GetWindowStructureRgn(win, rgn) GetWindowRegion((win), kWindowStructureRgn, (rgn))
+#define GetWindowContentRgn(win, rgn) GetWindowRegion((win), kWindowContentRgn, (rgn))
+#endif
/* Function to dispose a window, with a "normal" calling sequence */
static void