note description: "Main window for this application." author: "Generated by the Vision Application Wizard." date: "${FL_DATE}" revision: "1.0.1" class MAIN_WINDOW inherit EV_TITLED_WINDOW redefine create_interface_objects, initialize, is_in_default_state end INTERFACE_NAMES export {NONE} all undefine default_create, copy end create default_create feature {NONE} -- Initialization create_interface_objects -- do -- Create main container. create main_container ${FL_MENUBAR_CREATE}${FL_TOOLBAR_CREATE}${FL_STATUSBAR_CREATE} end initialize -- Build the interface for this window. do Precursor {EV_TITLED_WINDOW} ${FL_MENUBAR_ADD}${FL_TOOLBAR_ADD} build_main_container extend (main_container) ${FL_STATUSBAR_ADD} -- Execute `request_close_window' when the user clicks -- on the cross in the title bar. close_request_actions.extend (agent request_close_window) -- Set the title of the window. set_title (Window_title) -- Set the initial size of the window. set_size (Window_width, Window_height) end is_in_default_state: BOOLEAN -- Is the window in its default state? -- (as stated in `initialize') do Result := (width = Window_width) and then (height = Window_height) and then (title.is_equal (Window_title)) end ${FL_MENUBAR_INIT}${FL_TOOLBAR_INIT}${FL_STATUSBAR_INIT}${FL_ABOUTDIALOG_INIT} feature {NONE} -- Implementation, Close event request_close_window -- Process user request to close the window. local question_dialog: EV_CONFIRMATION_DIALOG do create question_dialog.make_with_text (Label_confirm_close_window) question_dialog.show_modal_to_window (Current) if question_dialog.selected_button ~ (create {EV_DIALOG_CONSTANTS}).ev_ok then -- Destroy the window. destroy -- End the application. --| TODO: Remove next instruction if you don't want the application --| to end when the first window is closed.. if attached (create {EV_ENVIRONMENT}).application as a then a.destroy end end end feature {NONE} -- Implementation main_container: EV_VERTICAL_BOX -- Main container (contains all widgets displayed in this window). build_main_container -- Populate `main_container'. do main_container.extend (create {EV_TEXT}) ensure main_container_created: main_container /= Void end feature {NONE} -- Implementation / Constants Window_title: STRING = "${FL_PROJECT_NAME}" -- Title of the window. Window_width: INTEGER = 400 -- Initial width for this window. Window_height: INTEGER = 400 -- Initial height for this window. end