71 lines
1.3 KiB
Plaintext
71 lines
1.3 KiB
Plaintext
note
|
|
description: "[
|
|
Root class for all "windows" in VITP.
|
|
A scrollable drawing area (i.e. an {EV_MODEL_WORLD_CELL} that is
|
|
also a {VIEW} through inheritance from {JJ_MODEL_WORLD_CELL_VIEW}.
|
|
]"
|
|
author: "Jimmy J. Johnson"
|
|
|
|
class
|
|
VITP_CELL_VIEW
|
|
|
|
inherit
|
|
|
|
JJ_MODEL_WORLD_CELL_VIEW
|
|
rename
|
|
target as game
|
|
redefine
|
|
draw,
|
|
target_imp
|
|
end
|
|
|
|
--create
|
|
-- default_create
|
|
|
|
--create {VITP_CELL_VIEW}
|
|
|
|
feature -- Basic operations
|
|
|
|
draw
|
|
-- Redraw the window
|
|
do
|
|
-- world.wipe_out
|
|
world.full_redraw
|
|
Precursor {JJ_MODEL_WORLD_CELL_VIEW}
|
|
end
|
|
|
|
scale_up
|
|
-- Increase to the next largest size
|
|
do
|
|
world.scale (scale_factor)
|
|
resize_if_necessary
|
|
end
|
|
|
|
scale_down
|
|
-- Decrease to the next smallest size
|
|
do
|
|
world.scale (1 / scale_factor)
|
|
if world.bounding_box.width < client_width or
|
|
world.bounding_box.height < client_height then
|
|
fit_to_screen
|
|
end
|
|
-- fix the scrollbars
|
|
resize_if_necessary
|
|
crop
|
|
end
|
|
|
|
feature {NONE} -- Implementation
|
|
|
|
target_imp: detachable VITP_GAME
|
|
-- Detachable implementation of `target' for void safety
|
|
|
|
scale_factor: DOUBLE = 1.5
|
|
-- The amount to grow (or swrink by reciprocal)
|
|
|
|
Default_width: INTEGER = 200
|
|
-- The default width of `border'
|
|
|
|
Default_height: INTEGER = 300
|
|
-- the default width of `border'
|
|
end
|