19928/jj_vitp/Interface/views/game_sequence_tool.e
Jocelyn Fiat 6dde6425c2 init
2024-06-17 09:09:33 +02:00

114 lines
2.0 KiB
Plaintext

note
description: "[
Tool to manipulate the sequence of the game play.
]"
author: "Jimmy J. Johnson"
class
GAME_SEQUENCE_TOOL
inherit
VITP_TOOL
redefine
create_interface_objects,
initialize,
build_tool_bar,
add_actions,
set_target,
draw
end
GAME_CONSTANTS
export
{NONE}
all
undefine
default_create,
copy
end
create
default_create,
make
feature {NONE} -- Initialization
create_interface_objects
-- Create objects to be used by `Current' in `initialize'
-- Implemented by descendants to create attached objects
-- in order to adhere to void-safety due to the implementation bridge pattern.
do
Precursor {VITP_TOOL}
create advance_button
advance_button.set_pixmap (create {EV_PIXMAP}.make_with_pixel_buffer (Icon_supplier_color_buffer))
advance_button.set_tooltip ("Advance")
create view.make (vitp)
end
initialize
-- Build the interface for this window
do
Precursor {VITP_TOOL}
split_manager.extend (view)
-- set_target (vitp)
end
add_actions
-- Add functionality to the buttons
do
Precursor {VITP_TOOL}
advance_button.select_actions.extend (agent on_advance)
end
build_tool_bar
-- Add buttons to `tool_bar' (from TOOL).
do
Precursor {VITP_TOOL}
-- tool_bar.extend (advance_button)
end
feature -- Access
view: GAME_SEQUENCE_VIEW
-- Handle to the view corresponding to the first view created by the
-- `view_manager' in `initialize'.
-- Convinience feature.
focused_view: VITP_CELL_VIEW
-- The view that currently has the focus
do
Result := view
end
feature -- Element change
set_target (a_game: like vitp)
-- Change the `target'
do
Precursor {VITP_TOOL} (a_game)
view.set_target (a_game)
end
draw
-- Redraw the view
do
view.draw
end
feature {NONE} -- Actions
on_advance
-- React to a press of the `advance_button'
do
-- sop.forth
draw_views (vitp)
end
feature {NONE} -- Implementation
advance_button: EV_TOOL_BAR_BUTTON
-- Button to advance to the next phase/step of the game
end