indexing description: "Objects that represent an EV_DIALOG.% %The original version of this class was generated by EiffelBuild." author: "" date: "$Date$" revision: "$Revision$" class GB_NAMING_DIALOG inherit GB_NAMING_DIALOG_IMP GB_SHARED_PIXMAPS export {NONE} all undefine copy, default_create end create make_with_values feature {NONE} -- Initialization user_initialization is -- called by `initialize'. -- Any custom user initialization that -- could not be performed in `initialize', -- (due to regeneration of implementation class) -- can be added here. do set_default_push_button (ok_button) set_default_cancel_button (cancel_button) ok_button.select_actions.extend (agent validate) cancel_button.select_actions.extend (agent cancelled_action) show_actions.extend (agent name_field.set_focus) -- We must never return a void, name. name := "" set_icon_pixmap (Icon_build_window @ 1) end make_with_values (initial_name, a_title, prompt, an_invalid_message: STRING; a_validation_agent: like validation_agent) is -- Create `Current' with `initial_name' displayed in `name_field', a title `a_title', `an_invalid_message' displayed -- when `a_validation_agent' returns False. require strings_not_void: initial_name /= Void and a_title /= Void and prompt /= Void and an_invalid_message /= Void validation_agent_not_void: a_validation_agent /= Void do default_create set_icon_pixmap ((create {GB_SHARED_PIXMAPS}).Icon_build_window @ 1) set_title (a_title) prompt_label.set_text (prompt) name_field.set_text (initial_name) invalid_message := an_invalid_message validation_agent := a_validation_agent end feature -- Basic operation set_name (a_name: STRING) is -- Assign `a_name' to `name'. do name := a_name name_field.set_text (name) end name: STRING -- The name currently represented by `Current'. cancelled: BOOLEAN -- Has `Current' been cancelled? feature {NONE} -- Implementation invalid_message: STRING -- Message displayed if `text' not valid. validation_agent: FUNCTION [ANY, TUPLE [STRING], BOOLEAN] -- Agent to validate entry in `initial_text'. validate is -- Validate entry in `text_field' using `validation_agent'. local warning_dialog: EV_WARNING_DIALOG do validation_agent.call ([name_field.text]) if validation_agent.last_result then name := name_field.text hide else create warning_dialog.make_with_text ("'" + name_field.text + "'" + invalid_message) warning_dialog.show_modal_to_window (Current) end end cancelled_action is -- Respond to a press of `cancel_button', by hiding -- `Current', and assigning `True' to `cancelled'. do cancelled := True hide ensure is_cancelled: cancelled = True end invariant name_not_void: name /= Void end -- class GB_NAMING_DIALOG