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
6253a114
Commit
6253a114
authored
Jan 06, 2002
by
Just van Rossum
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added support for DrawThemeButton() and friends.
parent
f853be98
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
186 additions
and
3 deletions
+186
-3
Mac/Modules/app/_Appmodule.c
Mac/Modules/app/_Appmodule.c
+169
-0
Mac/Modules/app/appscan.py
Mac/Modules/app/appscan.py
+3
-3
Mac/Modules/app/appsupport.py
Mac/Modules/app/appsupport.py
+14
-0
No files found.
Mac/Modules/app/_Appmodule.c
View file @
6253a114
...
...
@@ -27,6 +27,13 @@
#endif
int
ThemeButtonDrawInfo_Convert
(
PyObject
*
v
,
ThemeButtonDrawInfo
*
p_itself
)
{
return
PyArg_Parse
(
v
,
"(iHH)"
,
&
p_itself
->
state
,
&
p_itself
->
value
,
&
p_itself
->
adornment
);
}
static
PyObject
*
App_Error
;
/* ----------------- Object type ThemeDrawingState ------------------ */
...
...
@@ -996,6 +1003,103 @@ static PyObject *App_DrawThemeScrollBarDelimiters(PyObject *_self, PyObject *_ar
return
_res
;
}
static
PyObject
*
App_DrawThemeButton
(
PyObject
*
_self
,
PyObject
*
_args
)
{
PyObject
*
_res
=
NULL
;
OSStatus
_err
;
Rect
inBounds
;
UInt16
inKind
;
ThemeButtonDrawInfo
inNewInfo
;
ThemeButtonDrawInfo
inPrevInfo
;
UInt32
inUserData
;
if
(
!
PyArg_ParseTuple
(
_args
,
"O&HO&O&l"
,
PyMac_GetRect
,
&
inBounds
,
&
inKind
,
ThemeButtonDrawInfo_Convert
,
&
inNewInfo
,
ThemeButtonDrawInfo_Convert
,
&
inPrevInfo
,
&
inUserData
))
return
NULL
;
_err
=
DrawThemeButton
(
&
inBounds
,
inKind
,
&
inNewInfo
,
&
inPrevInfo
,
NULL
,
NULL
,
inUserData
);
if
(
_err
!=
noErr
)
return
PyMac_Error
(
_err
);
Py_INCREF
(
Py_None
);
_res
=
Py_None
;
return
_res
;
}
static
PyObject
*
App_GetThemeButtonRegion
(
PyObject
*
_self
,
PyObject
*
_args
)
{
PyObject
*
_res
=
NULL
;
OSStatus
_err
;
Rect
inBounds
;
UInt16
inKind
;
ThemeButtonDrawInfo
inNewInfo
;
if
(
!
PyArg_ParseTuple
(
_args
,
"O&HO&"
,
PyMac_GetRect
,
&
inBounds
,
&
inKind
,
ThemeButtonDrawInfo_Convert
,
&
inNewInfo
))
return
NULL
;
_err
=
GetThemeButtonRegion
(
&
inBounds
,
inKind
,
&
inNewInfo
,
(
RgnHandle
)
0
);
if
(
_err
!=
noErr
)
return
PyMac_Error
(
_err
);
Py_INCREF
(
Py_None
);
_res
=
Py_None
;
return
_res
;
}
static
PyObject
*
App_GetThemeButtonContentBounds
(
PyObject
*
_self
,
PyObject
*
_args
)
{
PyObject
*
_res
=
NULL
;
OSStatus
_err
;
Rect
inBounds
;
UInt16
inKind
;
ThemeButtonDrawInfo
inDrawInfo
;
Rect
outBounds
;
if
(
!
PyArg_ParseTuple
(
_args
,
"O&HO&"
,
PyMac_GetRect
,
&
inBounds
,
&
inKind
,
ThemeButtonDrawInfo_Convert
,
&
inDrawInfo
))
return
NULL
;
_err
=
GetThemeButtonContentBounds
(
&
inBounds
,
inKind
,
&
inDrawInfo
,
&
outBounds
);
if
(
_err
!=
noErr
)
return
PyMac_Error
(
_err
);
_res
=
Py_BuildValue
(
"O&"
,
PyMac_BuildRect
,
&
outBounds
);
return
_res
;
}
static
PyObject
*
App_GetThemeButtonBackgroundBounds
(
PyObject
*
_self
,
PyObject
*
_args
)
{
PyObject
*
_res
=
NULL
;
OSStatus
_err
;
Rect
inBounds
;
UInt16
inKind
;
ThemeButtonDrawInfo
inDrawInfo
;
Rect
outBounds
;
if
(
!
PyArg_ParseTuple
(
_args
,
"O&HO&"
,
PyMac_GetRect
,
&
inBounds
,
&
inKind
,
ThemeButtonDrawInfo_Convert
,
&
inDrawInfo
))
return
NULL
;
_err
=
GetThemeButtonBackgroundBounds
(
&
inBounds
,
inKind
,
&
inDrawInfo
,
&
outBounds
);
if
(
_err
!=
noErr
)
return
PyMac_Error
(
_err
);
_res
=
Py_BuildValue
(
"O&"
,
PyMac_BuildRect
,
&
outBounds
);
return
_res
;
}
static
PyObject
*
App_PlayThemeSound
(
PyObject
*
_self
,
PyObject
*
_args
)
{
PyObject
*
_res
=
NULL
;
...
...
@@ -1057,6 +1161,59 @@ static PyObject *App_DrawThemeTickMark(PyObject *_self, PyObject *_args)
return
_res
;
}
static
PyObject
*
App_DrawThemeChasingArrows
(
PyObject
*
_self
,
PyObject
*
_args
)
{
PyObject
*
_res
=
NULL
;
OSStatus
_err
;
Rect
bounds
;
UInt32
index
;
ThemeDrawState
state
;
UInt32
eraseData
;
if
(
!
PyArg_ParseTuple
(
_args
,
"O&lll"
,
PyMac_GetRect
,
&
bounds
,
&
index
,
&
state
,
&
eraseData
))
return
NULL
;
_err
=
DrawThemeChasingArrows
(
&
bounds
,
index
,
state
,
NULL
,
eraseData
);
if
(
_err
!=
noErr
)
return
PyMac_Error
(
_err
);
Py_INCREF
(
Py_None
);
_res
=
Py_None
;
return
_res
;
}
static
PyObject
*
App_DrawThemePopupArrow
(
PyObject
*
_self
,
PyObject
*
_args
)
{
PyObject
*
_res
=
NULL
;
OSStatus
_err
;
Rect
bounds
;
ThemeArrowOrientation
orientation
;
ThemePopupArrowSize
size
;
ThemeDrawState
state
;
UInt32
eraseData
;
if
(
!
PyArg_ParseTuple
(
_args
,
"O&HHll"
,
PyMac_GetRect
,
&
bounds
,
&
orientation
,
&
size
,
&
state
,
&
eraseData
))
return
NULL
;
_err
=
DrawThemePopupArrow
(
&
bounds
,
orientation
,
size
,
state
,
NULL
,
eraseData
);
if
(
_err
!=
noErr
)
return
PyMac_Error
(
_err
);
Py_INCREF
(
Py_None
);
_res
=
Py_None
;
return
_res
;
}
static
PyObject
*
App_DrawThemeStandaloneGrowBox
(
PyObject
*
_self
,
PyObject
*
_args
)
{
PyObject
*
_res
=
NULL
;
...
...
@@ -1387,6 +1544,14 @@ static PyMethodDef App_methods[] = {
"(Rect scrollBarBounds, ThemeTrackEnableState enableState, ThemeTrackPressState pressState, Boolean isHoriz, Point ptHit) -> (Boolean _rv, Rect trackBounds, ControlPartCode partcode)"
},
{
"DrawThemeScrollBarDelimiters"
,
(
PyCFunction
)
App_DrawThemeScrollBarDelimiters
,
1
,
"(ThemeWindowType flavor, Rect inContRect, ThemeDrawState state, ThemeWindowAttributes attributes) -> None"
},
{
"DrawThemeButton"
,
(
PyCFunction
)
App_DrawThemeButton
,
1
,
"(Rect inBounds, UInt16 inKind, ThemeButtonDrawInfo inNewInfo, ThemeButtonDrawInfo inPrevInfo, UInt32 inUserData) -> None"
},
{
"GetThemeButtonRegion"
,
(
PyCFunction
)
App_GetThemeButtonRegion
,
1
,
"(Rect inBounds, UInt16 inKind, ThemeButtonDrawInfo inNewInfo) -> None"
},
{
"GetThemeButtonContentBounds"
,
(
PyCFunction
)
App_GetThemeButtonContentBounds
,
1
,
"(Rect inBounds, UInt16 inKind, ThemeButtonDrawInfo inDrawInfo) -> (Rect outBounds)"
},
{
"GetThemeButtonBackgroundBounds"
,
(
PyCFunction
)
App_GetThemeButtonBackgroundBounds
,
1
,
"(Rect inBounds, UInt16 inKind, ThemeButtonDrawInfo inDrawInfo) -> (Rect outBounds)"
},
{
"PlayThemeSound"
,
(
PyCFunction
)
App_PlayThemeSound
,
1
,
"(ThemeSoundKind kind) -> None"
},
{
"BeginThemeDragSound"
,
(
PyCFunction
)
App_BeginThemeDragSound
,
1
,
...
...
@@ -1395,6 +1560,10 @@ static PyMethodDef App_methods[] = {
"() -> None"
},
{
"DrawThemeTickMark"
,
(
PyCFunction
)
App_DrawThemeTickMark
,
1
,
"(Rect bounds, ThemeDrawState state) -> None"
},
{
"DrawThemeChasingArrows"
,
(
PyCFunction
)
App_DrawThemeChasingArrows
,
1
,
"(Rect bounds, UInt32 index, ThemeDrawState state, UInt32 eraseData) -> None"
},
{
"DrawThemePopupArrow"
,
(
PyCFunction
)
App_DrawThemePopupArrow
,
1
,
"(Rect bounds, ThemeArrowOrientation orientation, ThemePopupArrowSize size, ThemeDrawState state, UInt32 eraseData) -> None"
},
{
"DrawThemeStandaloneGrowBox"
,
(
PyCFunction
)
App_DrawThemeStandaloneGrowBox
,
1
,
"(Point origin, ThemeGrowDirection growDirection, Boolean isSmall, ThemeDrawState state) -> None"
},
{
"DrawThemeStandaloneNoGrowBox"
,
(
PyCFunction
)
App_DrawThemeStandaloneNoGrowBox
,
1
,
...
...
Mac/Modules/app/appscan.py
View file @
6253a114
...
...
@@ -66,12 +66,12 @@ class MyScanner(Scanner):
"MenuItemDrawingUPP"
,
"ThemeIteratorUPP"
,
"ThemeTabTitleDrawUPP"
,
"ThemeEraseUPP"
,
"ThemeButtonDrawUPP"
,
#
"ThemeEraseUPP",
#
"ThemeButtonDrawUPP",
"WindowTitleDrawingUPP"
,
"ProcessSerialNumber_ptr"
,
# Too much work for now.
"ThemeTrackDrawInfo_ptr"
,
# Too much work
"ThemeButtonDrawInfo_ptr"
,
# ditto
#
"ThemeButtonDrawInfo_ptr", # ditto
"ThemeWindowMetrics_ptr"
,
# ditto
# "ThemeDrawingState", # This is an opaque pointer, so it should be simple. Later.
"Collection"
,
# No interface to collection mgr yet.
...
...
Mac/Modules/app/appsupport.py
View file @
6253a114
...
...
@@ -73,6 +73,13 @@ CFStringRef = OpaqueByValueType("CFStringRef", "CFStringRefObj")
CFMutableStringRef
=
OpaqueByValueType
(
"CFMutableStringRef"
,
"CFMutableStringRefObj"
)
TruncCode
=
Type
(
"TruncCode"
,
"h"
)
ThemeButtonKind
=
UInt16
ThemeButtonDrawInfo_ptr
=
OpaqueType
(
"ThemeButtonDrawInfo"
,
"ThemeButtonDrawInfo"
)
ThemeEraseUPP
=
FakeType
(
"NULL"
)
ThemeButtonDrawUPP
=
FakeType
(
"NULL"
)
includestuff
=
includestuff
+
"""
#ifdef WITHOUT_FRAMEWORKS
#include <Appearance.h>
...
...
@@ -80,6 +87,13 @@ includestuff = includestuff + """
#include <Carbon/Carbon.h>
#endif
int ThemeButtonDrawInfo_Convert(PyObject *v, ThemeButtonDrawInfo *p_itself)
{
return PyArg_Parse(v, "(iHH)", &p_itself->state, &p_itself->value, &p_itself->adornment);
}
"""
class
MyObjectDefinition
(
GlobalObjectDefinition
):
...
...
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