note description: "[ Top container class of the classes that decompose the numourous VITP widgets into more managable groups. This class keeps track of widgets, allowing a {VITP_WIDGET} to add/remove a widget to/from its world. ]" author: "Jimmy J. Johnson" date: "5/15/24" copyright: "Copyright (c) 2024, Jimmy J. Johnson" license: "Eiffel Forum v2 (http://www.eiffel.com/licensing/forum.txt)" class WIDGET_FACTORY create make feature {NONE} -- Initialization make (a_game: like game) -- Create an instance do print ("WIDGET_FACTORY.make %N") game := a_game make_widgets extend_widgets pair_widgets fill_widgets print ("%T end WIDGET_FACTORY.make %N") end make_widgets -- Create widgets for the corresponding game item do create widgets.make (100) end feature -- Access game: VITP_GAME -- The game for which the widgets are created widgets: VITP_WIDGET_TABLE [VITP_WIDGET, VITP_ITEM] -- Container to keep track of all widgets feature -- Element change set_game (a_game: like game) -- Associate `a_game' with Current. do game := a_game -- Add widgets to the table only once, because -- the widgets don't change if widgets.is_empty then extend_widgets end pair_widgets fill_widgets end feature -- Basic operations extend_widgets -- Put each widget into a list. do end pair_widgets -- Associate each widget with a unit do end fill_widgets -- Called by `set_target' to place each item into -- its associated widget. do end end