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
0c2290bd
Commit
0c2290bd
authored
Apr 03, 1991
by
Guido van Rossum
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added font, color and default scroll bars interfaces.
parent
71f477c7
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
141 additions
and
1 deletion
+141
-1
Modules/stdwinmodule.c
Modules/stdwinmodule.c
+141
-1
No files found.
Modules/stdwinmodule.c
View file @
0c2290bd
...
@@ -454,6 +454,66 @@ drawing_textbreak(dp, args)
...
@@ -454,6 +454,66 @@ drawing_textbreak(dp, args)
(
long
)
wtextbreak
(
getstringvalue
(
s
),
(
int
)
getstringsize
(
s
),
a
));
(
long
)
wtextbreak
(
getstringvalue
(
s
),
(
int
)
getstringsize
(
s
),
a
));
}
}
static
object
*
drawing_setfont
(
self
,
args
)
drawingobject
*
self
;
object
*
args
;
{
TEXTATTR
saveattr
,
winattr
;
object
*
str
;
if
(
!
getstrarg
(
args
,
&
str
))
return
NULL
;
wsetfont
(
getstringvalue
(
str
));
INCREF
(
None
);
return
None
;
}
static
object
*
drawing_getbgcolor
(
self
,
args
)
object
*
self
;
object
*
args
;
{
if
(
!
getnoarg
(
args
))
return
NULL
;
return
newintobject
((
long
)
wgetbgcolor
());
}
static
object
*
drawing_getfgcolor
(
self
,
args
)
object
*
self
;
object
*
args
;
{
if
(
!
getnoarg
(
args
))
return
NULL
;
return
newintobject
((
long
)
wgetfgcolor
());
}
static
object
*
drawing_setbgcolor
(
self
,
args
)
object
*
self
;
object
*
args
;
{
long
color
;
if
(
!
getlongarg
(
args
,
&
color
))
return
NULL
;
wsetbgcolor
((
COLOR
)
color
);
INCREF
(
None
);
return
None
;
}
static
object
*
drawing_setfgcolor
(
self
,
args
)
object
*
self
;
object
*
args
;
{
long
color
;
if
(
!
getlongarg
(
args
,
&
color
))
return
NULL
;
wsetfgcolor
((
COLOR
)
color
);
INCREF
(
None
);
return
None
;
}
static
struct
methodlist
drawing_methods
[]
=
{
static
struct
methodlist
drawing_methods
[]
=
{
{
"box"
,
drawing_box
},
{
"box"
,
drawing_box
},
{
"circle"
,
drawing_circle
},
{
"circle"
,
drawing_circle
},
...
@@ -473,6 +533,16 @@ static struct methodlist drawing_methods[] = {
...
@@ -473,6 +533,16 @@ static struct methodlist drawing_methods[] = {
{
"lineheight"
,
drawing_lineheight
},
{
"lineheight"
,
drawing_lineheight
},
{
"textbreak"
,
drawing_textbreak
},
{
"textbreak"
,
drawing_textbreak
},
{
"textwidth"
,
drawing_textwidth
},
{
"textwidth"
,
drawing_textwidth
},
/* Font setting methods: */
{
"setfont"
,
drawing_setfont
},
/* Color methods: */
{
"getbgcolor"
,
drawing_getbgcolor
},
{
"getfgcolor"
,
drawing_getfgcolor
},
{
"setbgcolor"
,
drawing_setbgcolor
},
{
"setfgcolor"
,
drawing_setfgcolor
},
{
NULL
,
NULL
}
/* sentinel */
{
NULL
,
NULL
}
/* sentinel */
};
};
...
@@ -569,7 +639,7 @@ text_draw(self, args)
...
@@ -569,7 +639,7 @@ text_draw(self, args)
if
(
!
getrectarg
(
args
,
a
))
if
(
!
getrectarg
(
args
,
a
))
return
NULL
;
return
NULL
;
if
(
Drawing
!=
NULL
)
{
if
(
Drawing
!=
NULL
)
{
err_setstr
(
RuntimeError
,
"
not
drawing"
);
err_setstr
(
RuntimeError
,
"
already
drawing"
);
return
NULL
;
return
NULL
;
}
}
/* Clip to text area and ignore if area is empty */
/* Clip to text area and ignore if area is empty */
...
@@ -1211,6 +1281,26 @@ window_setwincursor(self, args)
...
@@ -1211,6 +1281,26 @@ window_setwincursor(self, args)
return
None
;
return
None
;
}
}
static
object
*
window_setfont
(
self
,
args
)
windowobject
*
self
;
object
*
args
;
{
TEXTATTR
saveattr
,
winattr
;
object
*
str
;
if
(
!
getstrarg
(
args
,
&
str
))
return
NULL
;
wgettextattr
(
&
saveattr
);
wgetwintextattr
(
self
->
w_win
,
&
winattr
);
wsettextattr
(
&
winattr
);
wsetfont
(
getstringvalue
(
str
));
wgettextattr
(
&
winattr
);
wsetwintextattr
(
self
->
w_win
,
&
winattr
);
wsettextattr
(
&
saveattr
);
INCREF
(
None
);
return
None
;
}
static
struct
methodlist
window_methods
[]
=
{
static
struct
methodlist
window_methods
[]
=
{
{
"begindrawing"
,
window_begindrawing
},
{
"begindrawing"
,
window_begindrawing
},
{
"change"
,
window_change
},
{
"change"
,
window_change
},
...
@@ -1222,6 +1312,7 @@ static struct methodlist window_methods[] = {
...
@@ -1222,6 +1312,7 @@ static struct methodlist window_methods[] = {
{
"scroll"
,
window_scroll
},
{
"scroll"
,
window_scroll
},
{
"setwincursor"
,
window_setwincursor
},
{
"setwincursor"
,
window_setwincursor
},
{
"setdocsize"
,
window_setdocsize
},
{
"setdocsize"
,
window_setdocsize
},
{
"setfont"
,
window_setfont
},
{
"setorigin"
,
window_setorigin
},
{
"setorigin"
,
window_setorigin
},
{
"setselection"
,
window_setselection
},
{
"setselection"
,
window_setselection
},
{
"settimer"
,
window_settimer
},
{
"settimer"
,
window_settimer
},
...
@@ -1463,6 +1554,19 @@ stdwin_setdefwinsize(sw, args)
...
@@ -1463,6 +1554,19 @@ stdwin_setdefwinsize(sw, args)
return
None
;
return
None
;
}
}
static
object
*
stdwin_setdefscrollbars
(
sw
,
args
)
object
*
sw
;
object
*
args
;
{
int
a
[
2
];
if
(
!
getpointarg
(
args
,
a
))
return
NULL
;
wsetdefscrollbars
(
a
[
0
],
a
[
1
]);
INCREF
(
None
);
return
None
;
}
static
object
*
static
object
*
stdwin_getdefwinpos
(
wp
,
args
)
stdwin_getdefwinpos
(
wp
,
args
)
windowobject
*
wp
;
windowobject
*
wp
;
...
@@ -1487,6 +1591,18 @@ stdwin_getdefwinsize(wp, args)
...
@@ -1487,6 +1591,18 @@ stdwin_getdefwinsize(wp, args)
return
makepoint
(
width
,
height
);
return
makepoint
(
width
,
height
);
}
}
static
object
*
stdwin_getdefscrollbars
(
wp
,
args
)
windowobject
*
wp
;
object
*
args
;
{
int
h
,
v
;
if
(
!
getnoarg
(
args
))
return
NULL
;
wgetdefscrollbars
(
&
h
,
&
v
);
return
makepoint
(
h
,
v
);
}
static
object
*
static
object
*
stdwin_menucreate
(
self
,
args
)
stdwin_menucreate
(
self
,
args
)
object
*
self
;
object
*
self
;
...
@@ -1657,6 +1773,17 @@ stdwin_resetselection(self, args)
...
@@ -1657,6 +1773,17 @@ stdwin_resetselection(self, args)
return
None
;
return
None
;
}
}
static
object
*
stdwin_fetchcolor
(
self
,
args
)
object
*
self
;
object
*
args
;
{
object
*
colorname
;
if
(
!
getstrarg
(
args
,
&
colorname
))
return
NULL
;
return
newintobject
((
long
)
wfetchcolor
(
getstringvalue
(
colorname
)));
}
static
struct
methodlist
stdwin_methods
[]
=
{
static
struct
methodlist
stdwin_methods
[]
=
{
{
"askfile"
,
stdwin_askfile
},
{
"askfile"
,
stdwin_askfile
},
{
"askstr"
,
stdwin_askstr
},
{
"askstr"
,
stdwin_askstr
},
...
@@ -1664,9 +1791,11 @@ static struct methodlist stdwin_methods[] = {
...
@@ -1664,9 +1791,11 @@ static struct methodlist stdwin_methods[] = {
{
"fleep"
,
stdwin_fleep
},
{
"fleep"
,
stdwin_fleep
},
{
"getselection"
,
stdwin_getselection
},
{
"getselection"
,
stdwin_getselection
},
{
"getcutbuffer"
,
stdwin_getcutbuffer
},
{
"getcutbuffer"
,
stdwin_getcutbuffer
},
{
"getdefscrollbars"
,
stdwin_getdefscrollbars
},
{
"getdefwinpos"
,
stdwin_getdefwinpos
},
{
"getdefwinpos"
,
stdwin_getdefwinpos
},
{
"getdefwinsize"
,
stdwin_getdefwinsize
},
{
"getdefwinsize"
,
stdwin_getdefwinsize
},
{
"getevent"
,
stdwin_getevent
},
{
"getevent"
,
stdwin_getevent
},
{
"fetchcolor"
,
stdwin_fetchcolor
},
{
"menucreate"
,
stdwin_menucreate
},
{
"menucreate"
,
stdwin_menucreate
},
{
"message"
,
stdwin_message
},
{
"message"
,
stdwin_message
},
{
"open"
,
stdwin_open
},
{
"open"
,
stdwin_open
},
...
@@ -1674,6 +1803,7 @@ static struct methodlist stdwin_methods[] = {
...
@@ -1674,6 +1803,7 @@ static struct methodlist stdwin_methods[] = {
{
"resetselection"
,
stdwin_resetselection
},
{
"resetselection"
,
stdwin_resetselection
},
{
"rotatecutbuffers"
,
stdwin_rotatecutbuffers
},
{
"rotatecutbuffers"
,
stdwin_rotatecutbuffers
},
{
"setcutbuffer"
,
stdwin_setcutbuffer
},
{
"setcutbuffer"
,
stdwin_setcutbuffer
},
{
"setdefscrollbars"
,
stdwin_setdefscrollbars
},
{
"setdefwinpos"
,
stdwin_setdefwinpos
},
{
"setdefwinpos"
,
stdwin_setdefwinpos
},
{
"setdefwinsize"
,
stdwin_setdefwinsize
},
{
"setdefwinsize"
,
stdwin_setdefwinsize
},
...
@@ -1682,6 +1812,16 @@ static struct methodlist stdwin_methods[] = {
...
@@ -1682,6 +1812,16 @@ static struct methodlist stdwin_methods[] = {
{
"lineheight"
,
drawing_lineheight
},
{
"lineheight"
,
drawing_lineheight
},
{
"textbreak"
,
drawing_textbreak
},
{
"textbreak"
,
drawing_textbreak
},
{
"textwidth"
,
drawing_textwidth
},
{
"textwidth"
,
drawing_textwidth
},
/* Same for font setting methods: */
{
"setfont"
,
drawing_setfont
},
/* Same for color setting/getting methods: */
{
"getbgcolor"
,
drawing_getbgcolor
},
{
"getfgcolor"
,
drawing_getfgcolor
},
{
"setbgcolor"
,
drawing_setbgcolor
},
{
"setfgcolor"
,
drawing_setfgcolor
},
{
NULL
,
NULL
}
/* sentinel */
{
NULL
,
NULL
}
/* sentinel */
};
};
...
...
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