Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
1534104d
Commit
1534104d
authored
Jan 05, 2002
by
Just van Rossum
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Q&D support for ThemeDrawingState objects.
parent
f7628f47
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
142 additions
and
9 deletions
+142
-9
Mac/Modules/app/_Appmodule.c
Mac/Modules/app/_Appmodule.c
+128
-0
Mac/Modules/app/appscan.py
Mac/Modules/app/appscan.py
+2
-2
Mac/Modules/app/appsupport.py
Mac/Modules/app/appsupport.py
+12
-7
No files found.
Mac/Modules/app/_Appmodule.c
View file @
1534104d
...
...
@@ -29,6 +29,114 @@
static
PyObject
*
App_Error
;
/* ----------------- Object type ThemeDrawingState ------------------ */
PyTypeObject
ThemeDrawingState_Type
;
#define ThemeDrawingState_Check(x) ((x)->ob_type == &ThemeDrawingState_Type)
typedef
struct
ThemeDrawingStateObject
{
PyObject_HEAD
ThemeDrawingState
ob_itself
;
}
ThemeDrawingStateObject
;
PyObject
*
ThemeDrawingState_New
(
ThemeDrawingState
itself
)
{
ThemeDrawingStateObject
*
it
;
it
=
PyObject_NEW
(
ThemeDrawingStateObject
,
&
ThemeDrawingState_Type
);
if
(
it
==
NULL
)
return
NULL
;
it
->
ob_itself
=
itself
;
return
(
PyObject
*
)
it
;
}
int
ThemeDrawingState_Convert
(
PyObject
*
v
,
ThemeDrawingState
*
p_itself
)
{
if
(
!
ThemeDrawingState_Check
(
v
))
{
PyErr_SetString
(
PyExc_TypeError
,
"ThemeDrawingState required"
);
return
0
;
}
*
p_itself
=
((
ThemeDrawingStateObject
*
)
v
)
->
ob_itself
;
return
1
;
}
static
void
ThemeDrawingState_dealloc
(
ThemeDrawingStateObject
*
self
)
{
/* Cleanup of self->ob_itself goes here */
PyMem_DEL
(
self
);
}
static
PyObject
*
ThemeDrawingState_SetThemeDrawingState
(
ThemeDrawingStateObject
*
_self
,
PyObject
*
_args
)
{
PyObject
*
_res
=
NULL
;
OSStatus
_rv
;
Boolean
inDisposeNow
;
if
(
!
PyArg_ParseTuple
(
_args
,
"b"
,
&
inDisposeNow
))
return
NULL
;
_rv
=
SetThemeDrawingState
(
_self
->
ob_itself
,
inDisposeNow
);
_res
=
Py_BuildValue
(
"l"
,
_rv
);
return
_res
;
}
static
PyObject
*
ThemeDrawingState_DisposeThemeDrawingState
(
ThemeDrawingStateObject
*
_self
,
PyObject
*
_args
)
{
PyObject
*
_res
=
NULL
;
OSStatus
_rv
;
if
(
!
PyArg_ParseTuple
(
_args
,
""
))
return
NULL
;
_rv
=
DisposeThemeDrawingState
(
_self
->
ob_itself
);
_res
=
Py_BuildValue
(
"l"
,
_rv
);
return
_res
;
}
static
PyMethodDef
ThemeDrawingState_methods
[]
=
{
{
"SetThemeDrawingState"
,
(
PyCFunction
)
ThemeDrawingState_SetThemeDrawingState
,
1
,
"(Boolean inDisposeNow) -> (OSStatus _rv)"
},
{
"DisposeThemeDrawingState"
,
(
PyCFunction
)
ThemeDrawingState_DisposeThemeDrawingState
,
1
,
"() -> (OSStatus _rv)"
},
{
NULL
,
NULL
,
0
}
};
PyMethodChain
ThemeDrawingState_chain
=
{
ThemeDrawingState_methods
,
NULL
};
static
PyObject
*
ThemeDrawingState_getattr
(
ThemeDrawingStateObject
*
self
,
char
*
name
)
{
return
Py_FindMethodInChain
(
&
ThemeDrawingState_chain
,
(
PyObject
*
)
self
,
name
);
}
#define ThemeDrawingState_setattr NULL
#define ThemeDrawingState_compare NULL
#define ThemeDrawingState_repr NULL
#define ThemeDrawingState_hash NULL
PyTypeObject
ThemeDrawingState_Type
=
{
PyObject_HEAD_INIT
(
NULL
)
0
,
/*ob_size*/
"_App.ThemeDrawingState"
,
/*tp_name*/
sizeof
(
ThemeDrawingStateObject
),
/*tp_basicsize*/
0
,
/*tp_itemsize*/
/* methods */
(
destructor
)
ThemeDrawingState_dealloc
,
/*tp_dealloc*/
0
,
/*tp_print*/
(
getattrfunc
)
ThemeDrawingState_getattr
,
/*tp_getattr*/
(
setattrfunc
)
ThemeDrawingState_setattr
,
/*tp_setattr*/
(
cmpfunc
)
ThemeDrawingState_compare
,
/*tp_compare*/
(
reprfunc
)
ThemeDrawingState_repr
,
/*tp_repr*/
(
PyNumberMethods
*
)
0
,
/* tp_as_number */
(
PySequenceMethods
*
)
0
,
/* tp_as_sequence */
(
PyMappingMethods
*
)
0
,
/* tp_as_mapping */
(
hashfunc
)
ThemeDrawingState_hash
,
/*tp_hash*/
};
/* --------------- End object type ThemeDrawingState ---------------- */
static
PyObject
*
App_RegisterAppearanceClient
(
PyObject
*
_self
,
PyObject
*
_args
)
{
PyObject
*
_res
=
NULL
;
...
...
@@ -1033,6 +1141,20 @@ static PyObject *App_NormalizeThemeDrawingState(PyObject *_self, PyObject *_args
return
_res
;
}
static
PyObject
*
App_GetThemeDrawingState
(
PyObject
*
_self
,
PyObject
*
_args
)
{
PyObject
*
_res
=
NULL
;
OSStatus
_err
;
ThemeDrawingState
outState
;
if
(
!
PyArg_ParseTuple
(
_args
,
""
))
return
NULL
;
_err
=
GetThemeDrawingState
(
&
outState
);
if
(
_err
!=
noErr
)
return
PyMac_Error
(
_err
);
_res
=
Py_BuildValue
(
"O&"
,
ThemeDrawingState_New
,
outState
);
return
_res
;
}
static
PyObject
*
App_ApplyThemeBackground
(
PyObject
*
_self
,
PyObject
*
_args
)
{
PyObject
*
_res
=
NULL
;
...
...
@@ -1281,6 +1403,8 @@ static PyMethodDef App_methods[] = {
"(Point origin, ThemeGrowDirection growDirection, Boolean isSmall) -> (Rect bounds)"
},
{
"NormalizeThemeDrawingState"
,
(
PyCFunction
)
App_NormalizeThemeDrawingState
,
1
,
"() -> None"
},
{
"GetThemeDrawingState"
,
(
PyCFunction
)
App_GetThemeDrawingState
,
1
,
"() -> (ThemeDrawingState outState)"
},
{
"ApplyThemeBackground"
,
(
PyCFunction
)
App_ApplyThemeBackground
,
1
,
"(ThemeBackgroundKind inKind, Rect bounds, ThemeDrawState inState, SInt16 inDepth, Boolean inColorDev) -> None"
},
{
"SetThemeTextColorForWindow"
,
(
PyCFunction
)
App_SetThemeTextColorForWindow
,
1
,
...
...
@@ -1316,6 +1440,10 @@ void init_App(void)
if
(
App_Error
==
NULL
||
PyDict_SetItemString
(
d
,
"Error"
,
App_Error
)
!=
0
)
return
;
ThemeDrawingState_Type
.
ob_type
=
&
PyType_Type
;
Py_INCREF
(
&
ThemeDrawingState_Type
);
if
(
PyDict_SetItemString
(
d
,
"ThemeDrawingStateType"
,
(
PyObject
*
)
&
ThemeDrawingState_Type
)
!=
0
)
Py_FatalError
(
"can't initialize ThemeDrawingStateType"
);
}
/* ======================== End module _App ========================= */
...
...
Mac/Modules/app/appscan.py
View file @
1534104d
...
...
@@ -9,7 +9,7 @@ from bgenlocations import TOOLBOXDIR
LONG
=
"Appearance"
SHORT
=
"app"
OBJECT
=
"
NOTUSED
"
OBJECT
=
"
ThemeDrawingState
"
def
main
():
input
=
LONG
+
".h"
...
...
@@ -73,7 +73,7 @@ class MyScanner(Scanner):
"ThemeTrackDrawInfo_ptr"
,
# Too much work
"ThemeButtonDrawInfo_ptr"
,
# ditto
"ThemeWindowMetrics_ptr"
,
# ditto
"ThemeDrawingState"
,
# This is an opaque pointer, so it should be simple. Later.
#
"ThemeDrawingState", # This is an opaque pointer, so it should be simple. Later.
"Collection"
,
# No interface to collection mgr yet.
"BytePtr"
,
# Not yet.
]
...
...
Mac/Modules/app/appsupport.py
View file @
1534104d
...
...
@@ -8,8 +8,8 @@ import string
# Declarations that change for each manager
MACHEADERFILE
=
'Appearance.h'
# The Apple header file
MODNAME
=
'_App'
# The name of the module
OBJECTNAME
=
'
UNUSED
'
# The basic name of the objects used here
KIND
=
'
Record
'
# Usually 'Ptr' or 'Handle'
OBJECTNAME
=
'
ThemeDrawingState
'
# The basic name of the objects used here
KIND
=
''
# Usually 'Ptr' or 'Handle'
# The following is *usually* unchanged but may still require tuning
MODPREFIX
=
'App'
# The prefix for module-wide routines
...
...
@@ -82,7 +82,8 @@ includestuff = includestuff + """
"""
## class MyObjectDefinition(GlobalObjectDefinition):
class
MyObjectDefinition
(
GlobalObjectDefinition
):
pass
## def outputCheckNewArg(self):
## Output("if (itself == NULL) return PyMac_Error(resNotFound);")
## def outputCheckConvertArg(self):
...
...
@@ -99,8 +100,12 @@ includestuff = includestuff + """
# Create the generator groups and link them
module
=
MacModule
(
MODNAME
,
MODPREFIX
,
includestuff
,
finalstuff
,
initstuff
)
##object = MyObjectDefinition(OBJECTNAME, OBJECTPREFIX, OBJECTTYPE)
##module.addobject(object)
object
=
MyObjectDefinition
(
OBJECTNAME
,
OBJECTPREFIX
,
OBJECTTYPE
)
module
.
addobject
(
object
)
ThemeDrawingState
=
OpaqueByValueType
(
"ThemeDrawingState"
,
"ThemeDrawingStateObj"
)
Method
=
MethodGenerator
# Create the generator classes used to populate the lists
Function
=
OSErrFunctionGenerator
...
...
@@ -108,13 +113,13 @@ Function = OSErrFunctionGenerator
# Create and populate the lists
functions
=
[]
##
methods = []
methods
=
[]
execfile
(
INPUTFILE
)
# add the populated lists to the generator groups
# (in a different wordl the scan program would generate this)
for
f
in
functions
:
module
.
add
(
f
)
##
for f in methods: object.add(f)
for
f
in
methods
:
object
.
add
(
f
)
# generate output (open the output file as late as possible)
SetOutputFileName
(
OUTPUTFILE
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment