moved wizard under tools/estudio_wizard
This commit is contained in:
@@ -0,0 +1,383 @@
|
||||
note
|
||||
description : "Objects that ..."
|
||||
author : "$Author$"
|
||||
date : "$Date$"
|
||||
revision : "$Revision$"
|
||||
|
||||
deferred class
|
||||
GRAPHICAL_WIZARD_APPLICATION
|
||||
|
||||
inherit
|
||||
WIZARD_APPLICATION
|
||||
redefine
|
||||
initialize, on_generate, set_page
|
||||
end
|
||||
|
||||
GRAPHICAL_WIZARD_STYLER
|
||||
|
||||
EV_SHARED_APPLICATION
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
initialize
|
||||
do
|
||||
Precursor
|
||||
create main
|
||||
end
|
||||
|
||||
build_interface (a_container: EV_CONTAINER)
|
||||
do
|
||||
set_title (wizard.title)
|
||||
set_size (default_width, default_height)
|
||||
|
||||
main.put (create {EV_LABEL}.make_with_text ("Loading ..."))
|
||||
a_container.extend (main)
|
||||
|
||||
on_start
|
||||
end
|
||||
|
||||
feature -- UI change
|
||||
|
||||
set_title (a_title: READABLE_STRING_GENERAL)
|
||||
deferred
|
||||
end
|
||||
|
||||
set_size (w,h: INTEGER)
|
||||
deferred
|
||||
end
|
||||
|
||||
feature {NONE} -- Widget
|
||||
|
||||
main: EV_CELL
|
||||
|
||||
feature -- Factory
|
||||
|
||||
new_page (a_page_id: READABLE_STRING_8): GRAPHICAL_WIZARD_PAGE
|
||||
local
|
||||
lab: EV_LABEL
|
||||
do
|
||||
create Result.make (a_page_id)
|
||||
end
|
||||
|
||||
side_bar_items (a_page: WIZARD_PAGE): ARRAYED_LIST [WIZARD_PAGE_ITEM]
|
||||
-- Items to put on side bar for page `a_page'.
|
||||
-- None by default.
|
||||
do
|
||||
create Result.make (0)
|
||||
end
|
||||
|
||||
feature -- Change
|
||||
|
||||
set_page (a_page: WIZARD_PAGE)
|
||||
local
|
||||
b: EV_VERTICAL_BOX
|
||||
do
|
||||
Precursor (a_page)
|
||||
create b
|
||||
append_page_to (a_page, b)
|
||||
b.set_data (a_page)
|
||||
main.replace (b)
|
||||
end
|
||||
|
||||
feature {NONE} -- Implementation: UI
|
||||
|
||||
append_page_to (a_page: WIZARD_PAGE; a_container: EV_CONTAINER)
|
||||
require
|
||||
a_container.extendible
|
||||
local
|
||||
box: EV_VERTICAL_BOX
|
||||
hb,hb2: EV_HORIZONTAL_BOX
|
||||
mb, vb, headerb: EV_VERTICAL_BOX
|
||||
lab: EV_LABEL
|
||||
but: EV_BUTTON
|
||||
cl: EV_CELL
|
||||
fr: detachable EV_FRAME
|
||||
do
|
||||
a_page.apply_data
|
||||
|
||||
create box
|
||||
|
||||
-- Main
|
||||
create hb
|
||||
box.extend (hb)
|
||||
|
||||
if attached side_bar_items (a_page) as lst and then not lst.is_empty then
|
||||
-- ./Left sidebar
|
||||
create vb
|
||||
vb.set_background_color (create {EV_COLOR}.make_with_8_bit_rgb (0, 0, 180))
|
||||
vb.set_minimum_width (150)
|
||||
vb.set_border_width (10)
|
||||
vb.set_padding_width (5)
|
||||
across
|
||||
lst as ic
|
||||
loop
|
||||
if not vb.is_empty then
|
||||
vb.disable_item_expand (vb.last)
|
||||
end
|
||||
if attached {GRAPHICAL_WIZARD_PAGE_ITEM} ic.item as gpi then
|
||||
vb.extend (gpi.widget)
|
||||
end
|
||||
end
|
||||
vb.propagate_background_color
|
||||
hb.extend (vb)
|
||||
hb.disable_item_expand (vb)
|
||||
end
|
||||
|
||||
-- Main part
|
||||
create mb
|
||||
hb.extend (mb)
|
||||
|
||||
mb.set_background_color (colors.white)
|
||||
|
||||
if a_page.has_header then
|
||||
create fr
|
||||
fr.set_background_color (colors.white)
|
||||
create headerb
|
||||
fr.extend (headerb)
|
||||
|
||||
create vb
|
||||
headerb.extend (vb)
|
||||
vb.set_border_width (10)
|
||||
|
||||
if attached a_page.title as l_title then
|
||||
create lab.make_with_text (l_title)
|
||||
apply_title_style (lab)
|
||||
vb.extend (lab)
|
||||
vb.disable_item_expand (lab)
|
||||
if attached a_page.subtitle as l_subtitle then
|
||||
create hb2
|
||||
create lab.make_with_text (l_subtitle)
|
||||
apply_subtitle_style (lab)
|
||||
create cl
|
||||
cl.set_minimum_width (vb.border_width)
|
||||
hb2.extend (cl)
|
||||
hb2.disable_item_expand (cl)
|
||||
hb2.extend (lab)
|
||||
vb.extend (hb2)
|
||||
vb.disable_item_expand (hb2)
|
||||
end
|
||||
end
|
||||
fr.propagate_background_color
|
||||
|
||||
if attached a_page.reports as lst and then not lst.is_empty then
|
||||
create vb
|
||||
headerb.extend (vb)
|
||||
across
|
||||
lst as ic
|
||||
loop
|
||||
create lab.make_with_text (" - " + ic.item.message)
|
||||
if ic.item.type = {WIZARD_PAGE}.error_report_type then
|
||||
lab.set_background_color (color_light_red)
|
||||
lab.set_foreground_color (colors.red)
|
||||
elseif ic.item.type = {WIZARD_PAGE}.warning_report_type then
|
||||
lab.set_background_color (color_light_orange)
|
||||
else
|
||||
lab.set_background_color (color_light_green)
|
||||
end
|
||||
apply_report_style (lab)
|
||||
vb.extend (lab)
|
||||
vb.disable_item_expand (lab)
|
||||
end
|
||||
end
|
||||
|
||||
mb.extend (fr)
|
||||
mb.disable_item_expand (fr)
|
||||
fr := Void
|
||||
end
|
||||
|
||||
-- ./Text part
|
||||
create vb
|
||||
mb.extend (vb)
|
||||
vb.set_background_color (colors.default_background_color)
|
||||
vb.set_border_width (10)
|
||||
vb.set_padding (5)
|
||||
|
||||
|
||||
across
|
||||
a_page.items as ic
|
||||
loop
|
||||
if not vb.is_empty then
|
||||
vb.disable_item_expand (vb.last)
|
||||
end
|
||||
if attached page_item_to_widget (ic.item) as w then
|
||||
vb.extend (w)
|
||||
end
|
||||
end
|
||||
if a_page = wizard.first_page then
|
||||
create lab.make_with_text ("To continue, click [Next].")
|
||||
apply_text_style (lab)
|
||||
vb.extend (lab)
|
||||
end
|
||||
if a_page = wizard.final_page then
|
||||
create lab.make_with_text ("Click [Finish] to generate the project.")
|
||||
apply_text_style (lab)
|
||||
vb.extend (lab)
|
||||
end
|
||||
|
||||
-- Buttons bar
|
||||
create fr
|
||||
box.extend (fr)
|
||||
box.disable_item_expand (fr)
|
||||
create hb
|
||||
fr.extend (hb)
|
||||
|
||||
hb.set_border_width (10)
|
||||
hb.set_background_color (colors.default_background_color)
|
||||
hb.extend (create {EV_CELL})
|
||||
|
||||
if a_page.previous_page /= Void then
|
||||
add_button_action_to ("< Back", agent on_back, hb)
|
||||
end
|
||||
if a_page = wizard.final_page then
|
||||
add_button_action_to ("Finish", agent on_finish, hb)
|
||||
else
|
||||
add_button_action_to ("Next >", agent on_next, hb)
|
||||
end
|
||||
|
||||
|
||||
create cl
|
||||
cl.set_minimum_width (hb.border_width)
|
||||
hb.extend (cl)
|
||||
hb.disable_item_expand (cl)
|
||||
|
||||
add_button_action_to ("Cancel", agent on_cancel, hb)
|
||||
|
||||
hb.propagate_background_color
|
||||
|
||||
a_container.extend (box)
|
||||
|
||||
a_page.reset_reports
|
||||
end
|
||||
|
||||
page_item_to_widget (a_item: WIZARD_PAGE_ITEM): detachable EV_WIDGET
|
||||
local
|
||||
lab: EV_LABEL
|
||||
do
|
||||
if attached {GRAPHICAL_WIZARD_PAGE_ITEM} a_item as gpi then
|
||||
Result := gpi.widget
|
||||
elseif attached {WIZARD_PAGE_TEXT_ITEM} a_item as txt then
|
||||
create lab.make_with_text (txt.text)
|
||||
if txt.is_fixed_size then
|
||||
apply_fixed_size_text_style (lab)
|
||||
else
|
||||
apply_text_style (lab)
|
||||
end
|
||||
Result := lab
|
||||
elseif attached {WIZARD_PAGE_SECTION_ITEM} a_item as sect then
|
||||
create lab.make_with_text (sect.text)
|
||||
apply_section_style (lab)
|
||||
Result := lab
|
||||
end
|
||||
end
|
||||
|
||||
add_button_actions_to (a_text: READABLE_STRING_GENERAL; a_sequence: ACTION_SEQUENCE [TUPLE]; a_box: EV_BOX)
|
||||
do
|
||||
if a_sequence.is_empty then
|
||||
add_button_action_to (a_text, Void, a_box)
|
||||
else
|
||||
add_button_action_to (a_text, agent a_sequence.call (Void), a_box)
|
||||
end
|
||||
end
|
||||
|
||||
add_button_action_to (a_text: READABLE_STRING_GENERAL; a_action: detachable PROCEDURE [ANY, TUPLE]; a_box: EV_BOX)
|
||||
local
|
||||
but: EV_BUTTON
|
||||
do
|
||||
create but.make_with_text (a_text)
|
||||
apply_button_style (but)
|
||||
a_box.extend (but)
|
||||
a_box.disable_item_expand (but)
|
||||
if a_action = Void then
|
||||
but.disable_sensitive
|
||||
else
|
||||
but.select_actions.extend (a_action)
|
||||
end
|
||||
end
|
||||
|
||||
--feature -- State
|
||||
|
||||
-- current_page: detachable WIZARD_PAGE
|
||||
-- do
|
||||
-- if not page_history.is_empty then
|
||||
-- Result := page_history.item
|
||||
-- end
|
||||
-- end
|
||||
|
||||
-- next_page (a_current_page: detachable WIZARD_PAGE): detachable WIZARD_PAGE
|
||||
-- deferred
|
||||
-- end
|
||||
|
||||
-- page_history: ARRAYED_STACK [WIZARD_PAGE]
|
||||
|
||||
feature -- Events
|
||||
|
||||
-- on_refresh
|
||||
-- do
|
||||
-- if attached current_page as pg then
|
||||
-- pg.validate
|
||||
-- data.record_page_data (pg.data, pg.page_id)
|
||||
-- set_page (pg)
|
||||
-- else
|
||||
-- check refresh_expected: False end
|
||||
-- end
|
||||
-- end
|
||||
|
||||
-- on_back
|
||||
-- do
|
||||
-- if
|
||||
-- attached current_page as pg and then
|
||||
-- attached pg.previous_page as l_prev
|
||||
-- then
|
||||
-- pg.validate
|
||||
-- data.record_page_data (pg.data, pg.page_id)
|
||||
-- page_history.remove
|
||||
-- page_history.remove
|
||||
-- set_page (l_prev)
|
||||
-- end
|
||||
-- end
|
||||
|
||||
-- on_next
|
||||
-- do
|
||||
-- if attached current_page as pg then
|
||||
-- pg.validate
|
||||
-- if pg.has_error then
|
||||
-- on_refresh
|
||||
-- else
|
||||
-- data.record_page_data (pg.data, pg.page_id)
|
||||
-- if attached next_page (pg) as l_next_page then
|
||||
-- set_page (l_next_page)
|
||||
-- else
|
||||
-- set_page (notfound_page)
|
||||
-- end
|
||||
-- end
|
||||
-- else
|
||||
-- set_page (notfound_page)
|
||||
-- end
|
||||
-- end
|
||||
|
||||
-- on_cancel
|
||||
-- do
|
||||
-- quit (Void) --"Cancelled")
|
||||
-- end
|
||||
|
||||
on_generate
|
||||
do
|
||||
Precursor
|
||||
ev_application.destroy
|
||||
end
|
||||
|
||||
-- on_finish
|
||||
-- do
|
||||
-- if attached current_page as pg then
|
||||
-- if pg.has_error then
|
||||
-- on_refresh
|
||||
-- else
|
||||
-- on_generate
|
||||
---- ev_application.destroy
|
||||
-- end
|
||||
-- else
|
||||
-- on_refresh
|
||||
-- end
|
||||
-- end
|
||||
|
||||
end
|
||||
105
tools/estudio_wizard/lib/wizard/gui/graphical_wizard_page.e
Normal file
105
tools/estudio_wizard/lib/wizard/gui/graphical_wizard_page.e
Normal file
@@ -0,0 +1,105 @@
|
||||
note
|
||||
description: "Summary description for {GRAPHICAL_WIZARD_PAGE}."
|
||||
author: ""
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
GRAPHICAL_WIZARD_PAGE
|
||||
|
||||
inherit
|
||||
WIZARD_PAGE
|
||||
-- redefine
|
||||
-- add_section_text,
|
||||
-- add_text,
|
||||
-- add_fixed_size_text
|
||||
-- end
|
||||
|
||||
GRAPHICAL_WIZARD_STYLER
|
||||
|
||||
create
|
||||
make
|
||||
|
||||
feature {WIZARD, WIZARD_ENGINE, WIZARD_PAGE} -- Implementation
|
||||
|
||||
reuse
|
||||
do
|
||||
across
|
||||
items as ic
|
||||
loop
|
||||
unparent (ic.item)
|
||||
end
|
||||
end
|
||||
|
||||
feature -- UI building
|
||||
|
||||
-- add_widget (w: EV_WIDGET; a_opt_id: detachable READABLE_STRING_8)
|
||||
-- local
|
||||
-- pw: GRAPHICAL_WIZARD_PAGE_WIDGET
|
||||
-- do
|
||||
-- create pw.make_with_widget (w)
|
||||
-- pw.set_item_id (a_opt_id)
|
||||
-- items.extend (pw)
|
||||
-- end
|
||||
|
||||
-- add_section_text (a_text: READABLE_STRING_GENERAL; a_opt_id: detachable READABLE_STRING_8)
|
||||
-- local
|
||||
-- txt: EV_LABEL
|
||||
-- do
|
||||
-- create txt.make_with_text (a_text)
|
||||
-- apply_section_style (txt)
|
||||
-- add_widget (txt, a_opt_id)
|
||||
-- end
|
||||
|
||||
-- add_text (a_text: READABLE_STRING_GENERAL; a_opt_id: detachable READABLE_STRING_8)
|
||||
-- local
|
||||
-- txt: EV_LABEL
|
||||
-- do
|
||||
-- create txt.make_with_text (a_text)
|
||||
-- apply_text_style (txt)
|
||||
-- add_widget (txt, a_opt_id)
|
||||
-- end
|
||||
|
||||
-- add_fixed_size_text (a_text: READABLE_STRING_GENERAL; a_opt_id: detachable READABLE_STRING_8)
|
||||
-- local
|
||||
-- txt: EV_LABEL
|
||||
-- do
|
||||
-- create txt.make_with_text (a_text)
|
||||
-- apply_fixed_size_text_style (txt)
|
||||
-- add_widget (txt, a_opt_id)
|
||||
-- end
|
||||
|
||||
feature -- Helpers
|
||||
|
||||
new_string_question (a_prompt: READABLE_STRING_GENERAL; a_field_id: READABLE_STRING_8; a_description: detachable READABLE_STRING_GENERAL): GRAPHICAL_WIZARD_STRING_QUESTION
|
||||
do
|
||||
create Result.make (a_field_id, a_prompt, a_description)
|
||||
end
|
||||
|
||||
new_directory_question (a_prompt: READABLE_STRING_GENERAL; a_field_id: READABLE_STRING_8; a_description: detachable READABLE_STRING_GENERAL): GRAPHICAL_WIZARD_DIRECTORY_QUESTION
|
||||
do
|
||||
create Result.make (a_field_id, a_prompt, a_description)
|
||||
end
|
||||
|
||||
new_boolean_question (a_prompt: READABLE_STRING_GENERAL; a_field_id: READABLE_STRING_8; a_description: detachable READABLE_STRING_GENERAL): GRAPHICAL_WIZARD_BOOLEAN_QUESTION
|
||||
do
|
||||
create Result.make (a_field_id, a_prompt, a_description)
|
||||
end
|
||||
|
||||
new_integer_question (a_prompt: READABLE_STRING_GENERAL; a_field_id: READABLE_STRING_8; a_description: detachable READABLE_STRING_GENERAL): GRAPHICAL_WIZARD_INTEGER_QUESTION
|
||||
do
|
||||
create Result.make (a_field_id, a_prompt, a_description)
|
||||
end
|
||||
|
||||
feature {NONE} -- Implementation
|
||||
|
||||
unparent (i: WIZARD_PAGE_ITEM)
|
||||
do
|
||||
if attached {GRAPHICAL_WIZARD_PAGE_ITEM} i as gpi then
|
||||
if attached gpi.widget.parent as l_parent then
|
||||
l_parent.prune (gpi.widget)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
@@ -0,0 +1,19 @@
|
||||
note
|
||||
description: "Summary description for {GRAPHICAL_WIZARD_PAGE_ITEM}."
|
||||
author: ""
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
deferred class
|
||||
GRAPHICAL_WIZARD_PAGE_ITEM
|
||||
|
||||
inherit
|
||||
WIZARD_PAGE_ITEM
|
||||
|
||||
feature -- Conversion
|
||||
|
||||
widget: EV_WIDGET
|
||||
deferred
|
||||
end
|
||||
|
||||
end
|
||||
185
tools/estudio_wizard/lib/wizard/gui/graphical_wizard_styler.e
Normal file
185
tools/estudio_wizard/lib/wizard/gui/graphical_wizard_styler.e
Normal file
@@ -0,0 +1,185 @@
|
||||
note
|
||||
description: "Summary description for {GRAPHICAL_WIZARD_STYLER}."
|
||||
author: ""
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
deferred class
|
||||
GRAPHICAL_WIZARD_STYLER
|
||||
|
||||
inherit
|
||||
EV_LAYOUT_CONSTANTS
|
||||
|
||||
feature -- Access: layout
|
||||
|
||||
default_width: INTEGER = 400
|
||||
|
||||
default_height: INTEGER = 350
|
||||
|
||||
feature -- Style
|
||||
|
||||
apply_title_style (lab: EV_LABEL)
|
||||
do
|
||||
lab.align_text_left
|
||||
lab.align_text_vertical_center
|
||||
lab.set_foreground_color (colors.black)
|
||||
lab.set_font (title_font)
|
||||
end
|
||||
|
||||
apply_subtitle_style (lab: EV_LABEL)
|
||||
do
|
||||
lab.align_text_left
|
||||
lab.align_text_vertical_center
|
||||
lab.set_foreground_color (colors.black)
|
||||
lab.set_font (subtitle_font)
|
||||
end
|
||||
|
||||
apply_text_style (w: EV_WIDGET)
|
||||
do
|
||||
if attached {EV_TEXT_ALIGNABLE} w as l_alignable then
|
||||
l_alignable.align_text_left
|
||||
if attached {EV_LABEL} w as lab then
|
||||
lab.align_text_top
|
||||
end
|
||||
end
|
||||
if attached {EV_COLORIZABLE} w as l_colorizable then
|
||||
l_colorizable.set_foreground_color (colors.black)
|
||||
end
|
||||
if attached {EV_FONTABLE} w as l_fontable then
|
||||
l_fontable.set_font (text_font)
|
||||
end
|
||||
end
|
||||
|
||||
apply_fixed_size_text_style (w: EV_WIDGET)
|
||||
do
|
||||
apply_text_style (w)
|
||||
if attached {EV_FONTABLE} w as l_fontable then
|
||||
l_fontable.set_font (fixed_size_text_font)
|
||||
end
|
||||
end
|
||||
|
||||
apply_section_style (w: EV_WIDGET)
|
||||
do
|
||||
apply_text_style (w)
|
||||
if attached {EV_FONTABLE} w as l_fontable then
|
||||
l_fontable.set_font (section_font)
|
||||
end
|
||||
end
|
||||
|
||||
apply_report_style (w: EV_WIDGET)
|
||||
do
|
||||
if attached {EV_TEXT_ALIGNABLE} w as l_alignable then
|
||||
l_alignable.align_text_left
|
||||
if attached {EV_LABEL} w as lab then
|
||||
lab.align_text_top
|
||||
end
|
||||
end
|
||||
if attached {EV_FONTABLE} w as l_fontable then
|
||||
l_fontable.set_font (report_font)
|
||||
end
|
||||
end
|
||||
|
||||
apply_field_description_style (w: EV_WIDGET)
|
||||
do
|
||||
apply_text_style (w)
|
||||
if attached {EV_COLORIZABLE} w as l_colorizable then
|
||||
l_colorizable.set_foreground_color (colors.dark_gray)
|
||||
end
|
||||
if attached {EV_FONTABLE} w as l_fontable then
|
||||
l_fontable.set_font (field_description_font)
|
||||
end
|
||||
end
|
||||
|
||||
apply_button_style (but: EV_BUTTON)
|
||||
do
|
||||
but.set_minimum_width (default_button_width)
|
||||
but.set_minimum_height (default_button_height)
|
||||
end
|
||||
|
||||
feature -- Access: colors
|
||||
|
||||
colors: EV_STOCK_COLORS
|
||||
once
|
||||
create Result
|
||||
end
|
||||
|
||||
color_light_yellow: EV_COLOR
|
||||
once
|
||||
create Result.make_with_8_bit_rgb (255, 210, 210)
|
||||
end
|
||||
|
||||
color_light_green: EV_COLOR
|
||||
once
|
||||
create Result.make_with_8_bit_rgb (150, 255, 150)
|
||||
end
|
||||
|
||||
color_light_orange: EV_COLOR
|
||||
once
|
||||
create Result.make_with_8_bit_rgb (255, 210, 50)
|
||||
end
|
||||
|
||||
color_light_red: EV_COLOR
|
||||
once
|
||||
create Result.make_with_8_bit_rgb (255, 210, 210)
|
||||
end
|
||||
|
||||
feature -- Access: pixmaps
|
||||
|
||||
pixmaps: EV_STOCK_PIXMAPS
|
||||
once
|
||||
create Result
|
||||
end
|
||||
|
||||
feature -- Access: fonts
|
||||
|
||||
title_font: EV_FONT
|
||||
once
|
||||
create Result
|
||||
Result.set_family ({EV_FONT_CONSTANTS}.family_sans)
|
||||
Result.set_height_in_points (10)
|
||||
Result.set_weight ({EV_FONT_CONSTANTS}.weight_bold)
|
||||
end
|
||||
|
||||
subtitle_font: EV_FONT
|
||||
once
|
||||
create Result
|
||||
-- Result.set_family ({EV_FONT_CONSTANTS}.family_sans)
|
||||
Result.set_height_in_points (9)
|
||||
-- Result.set_weight ({EV_FONT_CONSTANTS}.weight_thin)
|
||||
end
|
||||
|
||||
section_font: EV_FONT
|
||||
once
|
||||
create Result
|
||||
Result.set_family ({EV_FONT_CONSTANTS}.family_sans)
|
||||
Result.set_height_in_points (12)
|
||||
Result.set_weight ({EV_FONT_CONSTANTS}.weight_bold)
|
||||
end
|
||||
|
||||
text_font: EV_FONT
|
||||
once
|
||||
create Result
|
||||
Result.set_height_in_points (9)
|
||||
end
|
||||
|
||||
fixed_size_text_font: EV_FONT
|
||||
once
|
||||
create Result
|
||||
Result.set_height_in_points (9)
|
||||
Result.set_family ({EV_FONT_CONSTANTS}.family_typewriter)
|
||||
end
|
||||
|
||||
field_description_font: EV_FONT
|
||||
once
|
||||
create Result
|
||||
Result.set_shape ({EV_FONT_CONSTANTS}.shape_italic)
|
||||
Result.set_height_in_points (9)
|
||||
end
|
||||
|
||||
report_font: EV_FONT
|
||||
once
|
||||
create Result
|
||||
Result.set_height_in_points (9)
|
||||
end
|
||||
|
||||
end
|
||||
@@ -0,0 +1,39 @@
|
||||
note
|
||||
description: "Summary description for {GRAPHICAL_WIZARD_WINDOW}."
|
||||
author: ""
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
deferred class
|
||||
GRAPHICAL_WIZARD_WINDOW
|
||||
|
||||
inherit
|
||||
EV_TITLED_WINDOW
|
||||
rename
|
||||
data as widget_data
|
||||
redefine
|
||||
create_interface_objects,
|
||||
initialize
|
||||
end
|
||||
|
||||
GRAPHICAL_WIZARD_APPLICATION
|
||||
rename
|
||||
initialize as initialize_wizard
|
||||
undefine
|
||||
default_create, copy
|
||||
end
|
||||
|
||||
feature {NONE} -- Initialize
|
||||
|
||||
create_interface_objects
|
||||
do
|
||||
initialize_wizard
|
||||
end
|
||||
|
||||
initialize
|
||||
do
|
||||
Precursor
|
||||
build_interface (Current)
|
||||
end
|
||||
|
||||
end
|
||||
@@ -0,0 +1,100 @@
|
||||
note
|
||||
description: "Summary description for {GRAPHICAL_WIZARD_BOOLEAN_QUESTION}."
|
||||
author: ""
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
GRAPHICAL_WIZARD_BOOLEAN_QUESTION
|
||||
|
||||
inherit
|
||||
WIZARD_BOOLEAN_QUESTION
|
||||
undefine
|
||||
make
|
||||
end
|
||||
|
||||
GRAPHICAL_WIZARD_QUESTION
|
||||
|
||||
create
|
||||
make
|
||||
|
||||
convert
|
||||
text: {STRING_32},
|
||||
widget: {EV_WIDGET}
|
||||
|
||||
feature {NONE} -- Implementation
|
||||
|
||||
initialize
|
||||
local
|
||||
b: EV_VERTICAL_BOX
|
||||
l_field: like input_widget
|
||||
lab: EV_LABEL
|
||||
do
|
||||
create b
|
||||
b.set_padding_width (5)
|
||||
create l_field.make_with_text (title)
|
||||
b.extend (l_field)
|
||||
b.disable_item_expand (l_field)
|
||||
|
||||
if attached description as desc then
|
||||
create lab.make_with_text (desc)
|
||||
apply_field_description_style (lab)
|
||||
|
||||
append_indented_widget (lab, b)
|
||||
end
|
||||
|
||||
|
||||
input_widget := l_field
|
||||
widget := b
|
||||
end
|
||||
|
||||
feature -- Access: UI
|
||||
|
||||
widget: EV_VERTICAL_BOX
|
||||
|
||||
input_widget: EV_CHECK_BUTTON
|
||||
|
||||
feature -- Conversion
|
||||
|
||||
text: STRING_32
|
||||
do
|
||||
if input_widget.is_selected then
|
||||
Result := "yes"
|
||||
else
|
||||
Result := "no"
|
||||
end
|
||||
end
|
||||
|
||||
value: BOOLEAN
|
||||
do
|
||||
Result := input_widget.is_selected
|
||||
end
|
||||
|
||||
feature -- Element change
|
||||
|
||||
set_title (t: READABLE_STRING_GENERAL)
|
||||
do
|
||||
create title.make_from_string_general (t)
|
||||
input_widget.set_text (t)
|
||||
end
|
||||
|
||||
set_text (t: detachable READABLE_STRING_GENERAL)
|
||||
do
|
||||
if t = Void then
|
||||
set_value (False)
|
||||
else
|
||||
set_value (t.is_case_insensitive_equal ("yes"))
|
||||
end
|
||||
end
|
||||
|
||||
set_value (b: BOOLEAN)
|
||||
do
|
||||
if b then
|
||||
input_widget.enable_select
|
||||
else
|
||||
input_widget.disable_select
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
@@ -0,0 +1,102 @@
|
||||
note
|
||||
description: "Summary description for {GRAPHICAL_WIZARD_DIRECTORY_QUESTION}."
|
||||
author: ""
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
GRAPHICAL_WIZARD_DIRECTORY_QUESTION
|
||||
|
||||
inherit
|
||||
WIZARD_DIRECTORY_QUESTION
|
||||
undefine
|
||||
make
|
||||
end
|
||||
|
||||
GRAPHICAL_WIZARD_QUESTION
|
||||
|
||||
create
|
||||
make
|
||||
|
||||
convert
|
||||
text: {STRING_32},
|
||||
widget: {EV_WIDGET}
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
initialize
|
||||
local
|
||||
b: EV_VERTICAL_BOX
|
||||
lab: EV_LABEL
|
||||
l_field: like input_widget
|
||||
do
|
||||
create b
|
||||
b.set_padding_width (5)
|
||||
create lab.make_with_text (title)
|
||||
title_widget := lab
|
||||
apply_text_style (lab)
|
||||
b.extend (lab)
|
||||
b.disable_item_expand (lab)
|
||||
|
||||
create l_field.make
|
||||
l_field.set_browse_for_directory
|
||||
input_widget := l_field
|
||||
b.extend (l_field)
|
||||
b.disable_item_expand (l_field)
|
||||
|
||||
if attached description as desc then
|
||||
create lab.make_with_text (desc)
|
||||
apply_field_description_style (lab)
|
||||
|
||||
append_indented_widget (lab, b)
|
||||
end
|
||||
|
||||
widget := b
|
||||
end
|
||||
|
||||
feature -- Access: UI
|
||||
|
||||
widget: EV_VERTICAL_BOX
|
||||
|
||||
input_widget: EV_PATH_FIELD
|
||||
|
||||
title_widget: detachable EV_LABEL
|
||||
|
||||
feature -- Conversion
|
||||
|
||||
text: STRING_32
|
||||
do
|
||||
Result := input_widget.text
|
||||
end
|
||||
|
||||
value: detachable PATH
|
||||
do
|
||||
Result := input_widget.file_path
|
||||
end
|
||||
|
||||
feature -- Element change
|
||||
|
||||
set_text (t: detachable READABLE_STRING_GENERAL)
|
||||
do
|
||||
if t = Void then
|
||||
set_value (Void)
|
||||
else
|
||||
set_value (create {PATH}.make_from_string (t))
|
||||
end
|
||||
end
|
||||
|
||||
set_default_start_path (p: PATH)
|
||||
do
|
||||
input_widget.set_default_start_path (p)
|
||||
end
|
||||
|
||||
set_value (p: like value)
|
||||
do
|
||||
if p = Void then
|
||||
input_widget.set_text ("")
|
||||
else
|
||||
input_widget.set_text (p.name)
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
@@ -0,0 +1,55 @@
|
||||
note
|
||||
description: "Summary description for {GRAPHICAL_WIZARD_INPUT_FIELD}."
|
||||
author: ""
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
deferred class
|
||||
GRAPHICAL_WIZARD_INPUT_FIELD
|
||||
|
||||
inherit
|
||||
WIZARD_INPUT_FIELD
|
||||
|
||||
GRAPHICAL_WIZARD_STYLER
|
||||
|
||||
GRAPHICAL_WIZARD_PAGE_ITEM
|
||||
|
||||
feature -- Access
|
||||
|
||||
item_id: detachable READABLE_STRING_8
|
||||
-- Optional id to identify related page item.
|
||||
do
|
||||
Result := id
|
||||
end
|
||||
|
||||
feature -- Conversion
|
||||
|
||||
data: detachable ANY
|
||||
do
|
||||
Result := widget.data
|
||||
end
|
||||
|
||||
feature -- Element change
|
||||
|
||||
set_data (d: like data)
|
||||
do
|
||||
widget.set_data (d)
|
||||
end
|
||||
|
||||
feature {NONE} -- Implementation
|
||||
|
||||
append_cell_to (a_size: INTEGER; a_container: EV_BOX)
|
||||
local
|
||||
cl: EV_CELL
|
||||
do
|
||||
create cl
|
||||
if attached {EV_HORIZONTAL_BOX} a_container then
|
||||
cl.set_minimum_width (a_size)
|
||||
else
|
||||
cl.set_minimum_height (a_size)
|
||||
end
|
||||
a_container.extend (cl)
|
||||
a_container.disable_item_expand (cl)
|
||||
end
|
||||
|
||||
end
|
||||
@@ -0,0 +1,107 @@
|
||||
note
|
||||
description: "Summary description for {GRAPHICAL_WIZARD_INTEGER_QUESTION}."
|
||||
author: ""
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
GRAPHICAL_WIZARD_INTEGER_QUESTION
|
||||
|
||||
inherit
|
||||
WIZARD_INTEGER_QUESTION
|
||||
undefine
|
||||
make
|
||||
end
|
||||
|
||||
GRAPHICAL_WIZARD_QUESTION
|
||||
|
||||
create
|
||||
make
|
||||
|
||||
convert
|
||||
text: {STRING_32},
|
||||
widget: {EV_WIDGET}
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
initialize
|
||||
local
|
||||
b: EV_VERTICAL_BOX
|
||||
lab: EV_LABEL
|
||||
l_field: like input_widget
|
||||
do
|
||||
create b
|
||||
b.set_padding_width (5)
|
||||
create lab.make_with_text (title)
|
||||
title_widget := lab
|
||||
apply_text_style (lab)
|
||||
b.extend (lab)
|
||||
b.disable_item_expand (lab)
|
||||
|
||||
create l_field
|
||||
input_widget := l_field
|
||||
b.extend (l_field)
|
||||
b.disable_item_expand (l_field)
|
||||
|
||||
if attached description as desc then
|
||||
create lab.make_with_text (desc)
|
||||
apply_field_description_style (lab)
|
||||
|
||||
append_indented_widget (lab, b)
|
||||
end
|
||||
|
||||
set_validation (agent (pg: WIZARD_PAGE)
|
||||
do
|
||||
if not text.is_integer then
|
||||
pg.report_error ("Invalid value for field ["+ id +"]: must be an integer!")
|
||||
end
|
||||
end
|
||||
)
|
||||
|
||||
widget := b
|
||||
end
|
||||
|
||||
feature -- Access: UI
|
||||
|
||||
widget: EV_VERTICAL_BOX
|
||||
|
||||
input_widget: EV_TEXT_FIELD
|
||||
|
||||
title_widget: detachable EV_LABEL
|
||||
|
||||
feature -- Conversion
|
||||
|
||||
text: STRING_32
|
||||
do
|
||||
Result := input_widget.text
|
||||
end
|
||||
|
||||
value: INTEGER
|
||||
do
|
||||
if
|
||||
attached text as l_text and then
|
||||
l_text.is_integer
|
||||
then
|
||||
Result := l_text.to_integer
|
||||
end
|
||||
end
|
||||
|
||||
feature -- Element change
|
||||
|
||||
set_text (t: detachable READABLE_STRING_GENERAL)
|
||||
do
|
||||
if t = Void then
|
||||
set_value (0)
|
||||
elseif t.is_integer then
|
||||
set_value (t.to_integer)
|
||||
else
|
||||
-- ignore !
|
||||
end
|
||||
end
|
||||
|
||||
set_value (v: INTEGER)
|
||||
do
|
||||
input_widget.set_text (v.out)
|
||||
end
|
||||
|
||||
end
|
||||
@@ -0,0 +1,40 @@
|
||||
note
|
||||
description: "Summary description for {GRAPHICAL_WIZARD_PAGE_WIDGET}."
|
||||
author: ""
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
GRAPHICAL_WIZARD_PAGE_WIDGET
|
||||
|
||||
inherit
|
||||
GRAPHICAL_WIZARD_PAGE_ITEM
|
||||
|
||||
create
|
||||
make_with_widget
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
make_with_widget (w: like widget)
|
||||
do
|
||||
widget := w
|
||||
end
|
||||
|
||||
feature -- Access
|
||||
|
||||
item_id: detachable READABLE_STRING_8
|
||||
-- Optional id to identify related page item.
|
||||
|
||||
feature -- Element change
|
||||
|
||||
set_item_id (a_id: like item_id)
|
||||
-- Set `item_id' to `a_id'.
|
||||
do
|
||||
item_id := a_id
|
||||
end
|
||||
|
||||
feature -- Conversion
|
||||
|
||||
widget: EV_WIDGET
|
||||
|
||||
end
|
||||
@@ -0,0 +1,57 @@
|
||||
note
|
||||
description: "Summary description for {GRAPHICAL_WIZARD_QUESTION}."
|
||||
author: ""
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
deferred class
|
||||
GRAPHICAL_WIZARD_QUESTION
|
||||
|
||||
inherit
|
||||
WIZARD_QUESTION
|
||||
redefine
|
||||
make
|
||||
end
|
||||
|
||||
GRAPHICAL_WIZARD_INPUT_FIELD
|
||||
rename
|
||||
make as make_field
|
||||
undefine
|
||||
make_field
|
||||
end
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
make (a_id: like id; a_title: READABLE_STRING_GENERAL; a_optional_description: detachable READABLE_STRING_GENERAL)
|
||||
-- Create field identified by `a_id', with title `a_title'
|
||||
-- and optional description `a_optional_description'.
|
||||
do
|
||||
Precursor (a_id, a_title, a_optional_description)
|
||||
|
||||
initialize
|
||||
end
|
||||
|
||||
initialize
|
||||
deferred
|
||||
ensure
|
||||
widget_created: widget /= Void
|
||||
end
|
||||
|
||||
feature {NONE} -- Implementation
|
||||
|
||||
append_indented_widget (w: EV_WIDGET; a_container: EV_BOX)
|
||||
local
|
||||
lab: EV_LABEL
|
||||
hb: EV_HORIZONTAL_BOX
|
||||
do
|
||||
create hb
|
||||
append_cell_to (20, hb)
|
||||
|
||||
hb.extend (w)
|
||||
hb.disable_item_expand (w)
|
||||
|
||||
a_container.extend (hb)
|
||||
a_container.disable_item_expand (hb)
|
||||
end
|
||||
|
||||
end
|
||||
@@ -0,0 +1,92 @@
|
||||
note
|
||||
description: "Summary description for {GWIZARD_STRING_QUESTION}."
|
||||
author: ""
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
GRAPHICAL_WIZARD_STRING_QUESTION
|
||||
|
||||
inherit
|
||||
WIZARD_STRING_QUESTION
|
||||
undefine
|
||||
make
|
||||
end
|
||||
|
||||
GRAPHICAL_WIZARD_QUESTION
|
||||
|
||||
create
|
||||
make
|
||||
|
||||
convert
|
||||
text: {STRING_32},
|
||||
widget: {EV_WIDGET}
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
initialize
|
||||
local
|
||||
b: EV_VERTICAL_BOX
|
||||
lab: EV_LABEL
|
||||
l_field: like input_widget
|
||||
do
|
||||
create b
|
||||
b.set_padding_width (5)
|
||||
create lab.make_with_text (title)
|
||||
title_widget := lab
|
||||
apply_text_style (lab)
|
||||
b.extend (lab)
|
||||
b.disable_item_expand (lab)
|
||||
|
||||
create l_field
|
||||
input_widget := l_field
|
||||
b.extend (l_field)
|
||||
b.disable_item_expand (l_field)
|
||||
|
||||
if attached description as desc then
|
||||
create lab.make_with_text (desc)
|
||||
apply_field_description_style (lab)
|
||||
|
||||
append_indented_widget (lab, b)
|
||||
end
|
||||
|
||||
widget := b
|
||||
end
|
||||
|
||||
feature -- Access: UI
|
||||
|
||||
widget: EV_VERTICAL_BOX
|
||||
|
||||
input_widget: EV_TEXT_FIELD
|
||||
|
||||
title_widget: detachable EV_LABEL
|
||||
|
||||
feature -- Conversion
|
||||
|
||||
text: STRING_32
|
||||
do
|
||||
Result := input_widget.text
|
||||
end
|
||||
|
||||
value: detachable STRING_32
|
||||
do
|
||||
Result := text
|
||||
end
|
||||
|
||||
feature -- Element change
|
||||
|
||||
set_text (t: detachable READABLE_STRING_GENERAL)
|
||||
do
|
||||
set_value (t)
|
||||
end
|
||||
|
||||
set_value (v: detachable READABLE_STRING_GENERAL)
|
||||
do
|
||||
if v = Void then
|
||||
input_widget.set_text ("")
|
||||
else
|
||||
input_widget.set_text (v)
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
Reference in New Issue
Block a user