Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
cpython
Commits
e353215b
Kaydet (Commit)
e353215b
authored
Nis 12, 1996
tarafından
Jack Jansen
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Added ScrolledWindow (a window with one or two scrollbars)
üst
7853647d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
172 additions
and
2 deletions
+172
-2
FrameWork.py
Mac/Lib/FrameWork.py
+86
-2
tscrollwin.py
Mac/Lib/test/tscrollwin.py
+86
-0
No files found.
Mac/Lib/FrameWork.py
Dosyayı görüntüle @
e353215b
...
@@ -27,6 +27,7 @@ from Windows import *
...
@@ -27,6 +27,7 @@ from Windows import *
import
EasyDialogs
import
EasyDialogs
kHighLevelEvent
=
23
# Don't know what header file this should come from
kHighLevelEvent
=
23
# Don't know what header file this should come from
SCROLLBARWIDTH
=
16
# Again, not a clue...
# Map event 'what' field to strings
# Map event 'what' field to strings
...
@@ -358,14 +359,14 @@ class MenuBar:
...
@@ -358,14 +359,14 @@ class MenuBar:
def
addmenu
(
self
,
title
,
after
=
0
):
def
addmenu
(
self
,
title
,
after
=
0
):
id
=
self
.
getnextid
()
id
=
self
.
getnextid
()
print
'Newmenu'
,
title
,
id
# XXXX
if
DEBUG
:
print
'Newmenu'
,
title
,
id
# XXXX
m
=
NewMenu
(
id
,
title
)
m
=
NewMenu
(
id
,
title
)
m
.
InsertMenu
(
after
)
m
.
InsertMenu
(
after
)
DrawMenuBar
()
DrawMenuBar
()
return
id
,
m
return
id
,
m
def
delmenu
(
self
,
id
):
def
delmenu
(
self
,
id
):
print
'Delmenu'
,
id
# XXXX
if
DEBUG
:
print
'Delmenu'
,
id
# XXXX
DeleteMenu
(
id
)
DeleteMenu
(
id
)
def
addpopup
(
self
,
title
=
''
):
def
addpopup
(
self
,
title
=
''
):
...
@@ -611,6 +612,89 @@ class ControlsWindow(Window):
...
@@ -611,6 +612,89 @@ class ControlsWindow(Window):
else
:
else
:
if
DEBUG
:
print
"FindControl(
%
s,
%
s) -> (
%
s,
%
s)"
%
\
if
DEBUG
:
print
"FindControl(
%
s,
%
s) -> (
%
s,
%
s)"
%
\
(
local
,
window
,
ctltype
,
control
)
(
local
,
window
,
ctltype
,
control
)
self
.
do_contentclick
(
local
,
modifiers
,
event
)
class
ScrolledWindow
(
ControlsWindow
):
def
__init__
(
self
,
parent
):
self
.
barx
=
self
.
bary
=
None
ControlsWindow
.
__init__
(
self
,
parent
)
def
scrollbars
(
self
,
wantx
=
1
,
wanty
=
1
):
SetPort
(
self
.
wid
)
self
.
barx
=
self
.
bary
=
None
x0
,
y0
,
x1
,
y1
=
self
.
wid
.
GetWindowPort
()
.
portRect
vx
,
vy
=
self
.
getscrollbarvalues
()
if
wantx
:
rect
=
x0
-
1
,
y1
-
(
SCROLLBARWIDTH
-
1
),
x1
-
(
SCROLLBARWIDTH
-
2
),
y1
+
1
self
.
barx
=
NewControl
(
self
.
wid
,
rect
,
""
,
1
,
vx
,
0
,
32767
,
16
,
0
)
if
wanty
:
rect
=
x1
-
(
SCROLLBARWIDTH
-
1
),
y0
-
1
,
x1
+
1
,
y1
-
(
SCROLLBARWIDTH
-
2
)
self
.
bary
=
NewControl
(
self
.
wid
,
rect
,
""
,
1
,
vy
,
0
,
32767
,
16
,
0
)
def
do_postclose
(
self
):
self
.
barx
=
self
.
bary
=
None
ControlsWindow
.
do_postclose
(
self
)
def
do_activate
(
self
,
onoff
,
event
):
if
onoff
:
onoff
=
0
else
:
onoff
=
255
if
self
.
barx
:
self
.
barx
.
HiliteControl
(
onoff
)
if
self
.
bary
:
self
.
bary
.
HiliteControl
(
onoff
)
def
do_postresize
(
self
,
width
,
height
,
window
):
l
,
t
,
r
,
b
=
self
.
wid
.
GetWindowPort
()
.
portRect
if
self
.
barx
:
self
.
barx
.
MoveControl
(
l
-
1
,
b
-
(
SCROLLBARWIDTH
-
1
))
self
.
barx
.
SizeControl
((
r
-
l
)
-
(
SCROLLBARWIDTH
-
2
),
SCROLLBARWIDTH
)
if
self
.
bary
:
self
.
bary
.
MoveControl
(
r
-
(
SCROLLBARWIDTH
-
1
),
t
-
1
)
self
.
bary
.
SizeControl
(
SCROLLBARWIDTH
,
(
b
-
t
)
-
(
SCROLLBARWIDTH
-
2
))
InvalRect
((
l
,
t
,
r
,
b
))
def
do_controlhit
(
self
,
window
,
control
,
pcode
,
event
):
if
control
==
self
.
barx
:
bar
=
self
.
barx
which
=
'x'
elif
control
==
self
.
bary
:
bar
=
self
.
bary
which
=
'y'
else
:
return
0
value
=
None
if
pcode
==
inUpButton
:
what
=
'-'
elif
pcode
==
inDownButton
:
what
=
'+'
elif
pcode
==
inPageUp
:
what
=
'--'
elif
pcode
==
inPageDown
:
what
=
'++'
else
:
what
=
'set'
value
=
bar
.
GetControlValue
()
self
.
scrollbar_callback
(
which
,
what
,
value
)
self
.
updatescrollbars
()
return
1
def
updatescrollbars
(
self
):
SetPort
(
self
.
wid
)
vx
,
vy
=
self
.
getscrollbarvalues
()
if
self
.
barx
:
self
.
barx
.
SetControlValue
(
vx
)
if
self
.
bary
:
self
.
bary
.
SetControlValue
(
vy
)
# To be overridden:
def
getscrollbarvalues
(
self
):
return
0
,
0
def
scrollbar_callback
(
self
,
which
,
what
,
value
):
print
'scroll'
,
which
,
what
,
value
class
DialogWindow
(
Window
):
class
DialogWindow
(
Window
):
"""A modeless dialog window"""
"""A modeless dialog window"""
...
...
Mac/Lib/test/tscrollwin.py
0 → 100644
Dosyayı görüntüle @
e353215b
# Test FrameWork scrollbars
# Draw a window in which the user can type.
#
# This test expects Win, Evt and FrameWork (and anything used by those)
# to work.
#
# Actually, it is more a test of FrameWork by now....
from
FrameWork
import
*
import
Win
import
Qd
import
TE
import
os
class
MyWindow
(
ScrolledWindow
):
def
open
(
self
,
name
):
r
=
(
40
,
40
,
400
,
300
)
w
=
Win
.
NewWindow
(
r
,
name
,
1
,
0
,
-
1
,
1
,
0x55555555
)
self
.
ourrect
=
0
,
0
,
360
-
SCROLLBARWIDTH
-
1
,
260
-
SCROLLBARWIDTH
-
1
Qd
.
SetPort
(
w
)
w
.
DrawGrowIcon
()
self
.
wid
=
w
self
.
do_postopen
()
self
.
vx
=
self
.
vy
=
0
self
.
scrollbars
()
def
getscrollbarvalues
(
self
):
return
self
.
vx
,
self
.
vy
def
scrollbar_callback
(
self
,
which
,
what
,
value
):
if
what
==
'-'
:
delta
=
-
1
elif
what
==
'--'
:
delta
=
-
100
elif
what
==
'+'
:
delta
=
1
elif
what
==
'++'
:
delta
=
100
if
which
==
'x'
:
if
value
:
self
.
vx
=
value
else
:
self
.
vx
=
self
.
vx
+
delta
else
:
if
value
:
self
.
vy
=
value
else
:
self
.
vy
=
self
.
vy
+
delta
Win
.
InvalRect
(
self
.
ourrect
)
def
do_update
(
self
,
wid
,
event
):
Qd
.
EraseRect
(
self
.
ourrect
)
Qd
.
MoveTo
(
40
,
40
)
Qd
.
DrawString
(
"x=
%
d, y=
%
d"
%
(
self
.
vx
,
self
.
vy
))
class
TestSW
(
Application
):
def
__init__
(
self
):
Application
.
__init__
(
self
)
self
.
num
=
0
self
.
listoflists
=
[]
def
makeusermenus
(
self
):
self
.
filemenu
=
m
=
Menu
(
self
.
menubar
,
"File"
)
self
.
newitem
=
MenuItem
(
m
,
"New window..."
,
"O"
,
self
.
open
)
self
.
quititem
=
MenuItem
(
m
,
"Quit"
,
"Q"
,
self
.
quit
)
def
open
(
self
,
*
args
):
w
=
MyWindow
(
self
)
w
.
open
(
'Window
%
d'
%
self
.
num
)
self
.
num
=
self
.
num
+
1
self
.
listoflists
.
append
(
w
)
def
quit
(
self
,
*
args
):
raise
self
def
do_about
(
self
,
id
,
item
,
window
,
event
):
EasyDialogs
.
Message
(
"""Test scrolling FrameWork windows"""
)
def
main
():
App
=
TestSW
()
App
.
mainloop
()
if
__name__
==
'__main__'
:
main
()
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