indexing description: "[ Delegates of a theme. All widgets call their corresponding factory to create a delegate. Use EM_SHARED_THEME to access the instance used by widgets. ]" date: "$Date$" revision: "$Revision$" class EM_THEME_DELEGATES create make feature {NONE} -- Initialisation make is -- Initialise default values. do load_default_delegates end feature -- Access window_delegate_factory: FUNCTION [ANY, TUPLE [], EM_WIDGET_DELEGATE] -- Factory function to create new delegate for EM_WINDOW dialog_delegate_factory: FUNCTION [ANY, TUPLE [], EM_WIDGET_DELEGATE] -- Factory function to create new delegate for EM_DIALOG message_dialog_delegate_factory: FUNCTION [ANY, TUPLE [], EM_WIDGET_DELEGATE] -- Factory function to create new delegate for EM_MESSAGE_DIALOG panel_delegate_factory: FUNCTION [ANY, TUPLE [], EM_WIDGET_DELEGATE] -- Factory function to create new delegate for EM_PANEL imagepanel_delegate_factory: FUNCTION [ANY, TUPLE [], EM_WIDGET_DELEGATE] -- Factory function to create new delegate for EM_IMAGEPANEL drawable_panel_delegate_factory: FUNCTION [ANY, TUPLE [], EM_WIDGET_DELEGATE] -- Factory function to create new delegate for EM_DRAWABLE_PANEL label_delegate_factory: FUNCTION [ANY, TUPLE [], EM_WIDGET_DELEGATE] -- Factory function to create new delegate for EM_LABEL textbox_delegate_factory: FUNCTION [ANY, TUPLE [], EM_TEXTBOX_DELEGATE] -- Factory function to create new delegate for EM_TEXTBOX textarea_delegate_factory: FUNCTION [ANY, TUPLE [], EM_TEXTBOX_DELEGATE] -- Factory function to create new delegate for EM_TEXTAREA textlist_delegate_factory: FUNCTION [ANY, TUPLE [], EM_LIST_DELEGATE] -- Factory function to create new delegate for EM_TEXTLIST combobox_delegate_factory: FUNCTION [ANY, TUPLE [], EM_LIST_DELEGATE] -- Factory function to create new delegate for EM_COMBOBOX button_delegate_factory: FUNCTION [ANY, TUPLE [], EM_WIDGET_DELEGATE] -- Factory function to create new delegate for EM_BUTTON checkbox_delegate_factory: FUNCTION [ANY, TUPLE [], EM_WIDGET_DELEGATE] -- Factory function to create new delegate for EM_CHECKBOX slider_delegate_factory: FUNCTION [ANY, TUPLE [], EM_SLIDER_DELEGATE] -- Factory function to create new delegate for EM_SLIDER progress_bar_delegate_factory: FUNCTION [ANY, TUPLE [], EM_WIDGET_DELEGATE] -- Factory function to create new delegate for EM_PROGRESS_BAR scrollpanel_delegate_factory: FUNCTION [ANY, TUPLE [], EM_WIDGET_DELEGATE] -- Factory function to create new delegate for EM_SCROLLPANEL scrollbar_delegate_factory: FUNCTION [ANY, TUPLE [], EM_SLIDER_DELEGATE] -- Factory function to create new delegate for EM_SCROLLBAR context_menu_delegate_factory: FUNCTION [ANY, TUPLE [], EM_LIST_DELEGATE] -- Factory function to create new delegate for EM_CONTEXT_MENU feature -- Element change set_window_delegate_factory (a_factory: like window_delegate_factory) is -- Set `window_delegate_factory' to `a_factory'. require a_factory_not_void: a_factory /= Void do window_delegate_factory := a_factory ensure window_delegate_factory_set: window_delegate_factory = a_factory end set_dialog_delegate_factory (a_factory: like dialog_delegate_factory) is -- Set `dialog_delegate_factory' to `a_factory'. require a_factory_not_void: a_factory /= Void do dialog_delegate_factory := a_factory ensure dialog_delegate_factory_set: dialog_delegate_factory = a_factory end set_message_dialog_delegate_factory (a_factory: like dialog_delegate_factory) is -- Set `message_dialog_delegate_factory' to `a_factory'. require a_factory_not_void: a_factory /= Void do message_dialog_delegate_factory := a_factory ensure message_dialog_delegate_factory_set: message_dialog_delegate_factory = a_factory end set_panel_delegate_factory (a_factory: like panel_delegate_factory) is -- Set `panel_delegate_factory' to `a_factory'. require a_factory_not_void: a_factory /= Void do panel_delegate_factory := a_factory ensure panel_delegate_factory_set: panel_delegate_factory = a_factory end set_imagepanel_delegate_factory (a_factory: like imagepanel_delegate_factory) is -- Set `imagepanel_delegate_factory' to `a_factory'. require a_factory_not_void: a_factory /= Void do imagepanel_delegate_factory := a_factory ensure imagepanel_delegate_factory_set: imagepanel_delegate_factory = a_factory end set_drawable_panel_delegate_factory (a_factory: like drawable_panel_delegate_factory) is -- Set `drawable_panel_delegate_factory' to `a_factory'. require a_factory_not_void: a_factory /= Void do drawable_panel_delegate_factory := a_factory ensure drawable_panel_delegate_factory_set: drawable_panel_delegate_factory = a_factory end set_label_delegate_factory (a_factory: like label_delegate_factory) is -- Set `label_delegate_factory' to `a_factory'. require a_factory_not_void: a_factory /= Void do label_delegate_factory := a_factory ensure label_delegate_factory_set: label_delegate_factory = a_factory end set_textbox_delegate_factory (a_factory: like textbox_delegate_factory) is -- Set `textbox_delegate_factory' to `a_factory'. require a_factory_not_void: a_factory /= Void do textbox_delegate_factory := a_factory ensure textbox_delegate_factory_set: textbox_delegate_factory = a_factory end set_textarea_delegate_factory (a_factory: like textarea_delegate_factory) is -- Set `textarea_delegate_factory' to `a_factory'. require a_factory_not_void: a_factory /= Void do textarea_delegate_factory := a_factory ensure textarea_delegate_factory_set: textarea_delegate_factory = a_factory end set_textlist_delegate_factory (a_factory: like textlist_delegate_factory) is -- Set `textlist_delegate_factory' to `a_factory'. require a_factory_not_void: a_factory /= Void do textlist_delegate_factory := a_factory ensure textlist_delegate_factory_set: textlist_delegate_factory = a_factory end set_combobox_delegate_factory (a_factory: like combobox_delegate_factory) is -- Set `combobox_delegate_factory' to `a_factory'. require a_factory_not_void: a_factory /= Void do combobox_delegate_factory := a_factory ensure combobox_delegate_factory_set: combobox_delegate_factory = a_factory end set_button_delegate_factory (a_factory: like button_delegate_factory) is -- Set `button_delegate_factory' to `a_factory'. require a_factory_not_void: a_factory /= Void do button_delegate_factory := a_factory ensure button_delegate_factory_set: button_delegate_factory = a_factory end set_checkbox_delegate_factory (a_factory: like checkbox_delegate_factory) is -- Set `checkbox_delegate_factory' to `a_factory'. require a_factory_not_void: a_factory /= Void do checkbox_delegate_factory := a_factory ensure checkbox_delegate_factory_set: checkbox_delegate_factory = a_factory end set_slider_delegate_factory (a_factory: like slider_delegate_factory) is -- Set `slider_delegate_factory' to `a_factory'. require a_factory_not_void: a_factory /= Void do slider_delegate_factory := a_factory ensure slider_delegate_factory_set: slider_delegate_factory = a_factory end set_progress_bar_delegate_factory (a_factory: like progress_bar_delegate_factory) is -- Set `progress_bar_delegate_factory' to `a_factory'. require a_factory_not_void: a_factory /= Void do progress_bar_delegate_factory := a_factory ensure progress_bar_delegate_factory_set: progress_bar_delegate_factory = a_factory end set_scrollpanel_delegate_factory (a_factory: like scrollpanel_delegate_factory) is -- Set `scrollpanel_delegate_factory' to `a_factory'. require a_factory_not_void: a_factory /= Void do scrollpanel_delegate_factory := a_factory ensure scrollpanel_delegate_factory_set: scrollpanel_delegate_factory = a_factory end set_scrollbar_delegate_factory (a_factory: like scrollbar_delegate_factory) is -- Set `scrollbar_delegate_factory' to `a_factory'. require a_factory_not_void: a_factory /= Void do scrollbar_delegate_factory := a_factory ensure scrollbar_delegate_factory_set: scrollbar_delegate_factory = a_factory end set_context_menu_delegate_factory (a_factory: like context_menu_delegate_factory) is -- Set `context_menu_delegate_factory' to `a_factory'. require a_factory_not_void: a_factory /= Void do context_menu_delegate_factory := a_factory ensure context_menu_delegate_factory_set: context_menu_delegate_factory = a_factory end feature -- Themes load_default_delegates is -- Load default delegates. do window_delegate_factory := agent singleton_delegate_factory (create {EM_BASIC_WINDOW_DELEGATE}, ?) dialog_delegate_factory := agent singleton_delegate_factory (create {EM_BASIC_DIALOG_DELEGATE}, ?) message_dialog_delegate_factory := agent singleton_delegate_factory (create {EM_BASIC_MESSAGE_DIALOG_DELEGATE}, ?) panel_delegate_factory := agent singleton_delegate_factory (create {EM_BASIC_PANEL_DELEGATE}, ?) imagepanel_delegate_factory := agent singleton_delegate_factory (create {EM_BASIC_IMAGEPANEL_DELEGATE}, ?) drawable_panel_delegate_factory := agent singleton_delegate_factory (create {EM_BASIC_DRAWABLE_PANEL_DELEGATE}, ?) label_delegate_factory := agent singleton_delegate_factory (create {EM_BASIC_LABEL_DELEGATE}, ?) textbox_delegate_factory := agent singleton_delegate_factory_textbox (create {EM_BASIC_TEXTBOX_DELEGATE}, ?) textarea_delegate_factory := agent singleton_delegate_factory_textbox (create {EM_BASIC_TEXTAREA_DELEGATE}, ?) textlist_delegate_factory := agent singleton_delegate_factory_list (create {EM_BASIC_TEXTLIST_DELEGATE}, ?) combobox_delegate_factory := agent singleton_delegate_factory_list (create {EM_BASIC_COMBOBOX_DELEGATE}, ?) button_delegate_factory := agent singleton_delegate_factory (create {EM_BASIC_BUTTON_DELEGATE}, ?) checkbox_delegate_factory := agent singleton_delegate_factory (create {EM_BASIC_CHECKBOX_DELEGATE}, ?) slider_delegate_factory := agent singleton_delegate_factory_slider (create {EM_BASIC_SLIDER_DELEGATE}, ?) progress_bar_delegate_factory := agent singleton_delegate_factory (create {EM_BASIC_PROGRESS_BAR_DELEGATE}, ?) scrollpanel_delegate_factory := agent singleton_delegate_factory (create {EM_BASIC_SCROLLPANEL_DELEGATE}, ?) scrollbar_delegate_factory := agent singleton_delegate_factory_slider (create {EM_BASIC_SCROLLBAR_DELEGATE}, ?) context_menu_delegate_factory := agent singleton_delegate_factory_list (create {EM_BASIC_CONTEXT_MENU_DELEGATE}, ?) end load_eclipse_delegates is -- Load eclipse delegate. do load_default_delegates textbox_delegate_factory := agent singleton_delegate_factory_textbox (create {EM_ECLIPSE_TEXTBOX_DELEGATE}, ?) textarea_delegate_factory := agent singleton_delegate_factory_textbox (create {EM_ECLIPSE_TEXTAREA_DELEGATE}, ?) textlist_delegate_factory := agent singleton_delegate_factory_list (create {EM_ECLIPSE_TEXTLIST_DELEGATE}, ?) combobox_delegate_factory := agent singleton_delegate_factory_list (create {EM_ECLIPSE_COMBOBOX_DELEGATE}, ?) button_delegate_factory := agent singleton_delegate_factory (create {EM_ECLIPSE_BUTTON_DELEGATE}, ?) checkbox_delegate_factory := agent singleton_delegate_factory (create {EM_ECLIPSE_CHECKBOX_DELEGATE}, ?) slider_delegate_factory := agent singleton_delegate_factory_slider (create {EM_ECLIPSE_SLIDER_DELEGATE}, ?) progress_bar_delegate_factory := agent singleton_delegate_factory (create {EM_ECLIPSE_PROGRESS_BAR_DELEGATE}, ?) scrollpanel_delegate_factory := agent singleton_delegate_factory (create {EM_ECLIPSE_SCROLLPANEL_DELEGATE}, ?) scrollbar_delegate_factory := agent singleton_delegate_factory_slider (create {EM_ECLIPSE_SCROLLBAR_DELEGATE}, ?) end feature {NONE} -- Implementation singleton_delegate_factory (delegate: EM_WIDGET_DELEGATE; widget: EM_WIDGET): like delegate is -- Return 'delegate' for every 'widget'. require delegate_not_void: delegate /= Void do Result := delegate ensure singleton_delegate_factory_not_void: Result /= Void end singleton_delegate_factory_slider (delegate: EM_SLIDER_DELEGATE; widget: EM_WIDGET): like delegate is -- Return 'delegate' for every 'widget'. require delegate_not_void: delegate /= Void do Result := delegate ensure singleton_delegate_factory_slider_not_void: Result /= Void end singleton_delegate_factory_textbox (delegate: EM_TEXTBOX_DELEGATE; widget: EM_WIDGET): like delegate is -- Return 'delegate' for every 'widget'. require delegate_not_void: delegate /= Void do Result := delegate ensure singleton_delegate_factory_textbox_not_void: Result /= Void end singleton_delegate_factory_list (delegate: EM_LIST_DELEGATE; widget: EM_WIDGET): like delegate is -- Return 'delegate' for every 'widget'. require delegate_not_void: delegate /= Void do Result := delegate ensure singleton_delegate_factory_list_not_void: Result /= Void end invariant window_delegate_factory_not_void: window_delegate_factory /= Void dialog_delegate_factory_not_void: dialog_delegate_factory /= Void panel_delegate_factory_not_void: panel_delegate_factory /= Void imagepanel_delegate_factory_not_void: imagepanel_delegate_factory /= Void label_delegate_factory_not_void: label_delegate_factory /= Void textbox_delegate_factory_not_void: textbox_delegate_factory /= Void textarea_delegate_factory_not_void: textarea_delegate_factory /= Void textlist_delegate_factory_not_void: textlist_delegate_factory /= Void combobox_delegate_factory_not_void: combobox_delegate_factory /= Void button_delegate_factory_not_void: button_delegate_factory /= Void checkbox_delegate_factory_not_void: checkbox_delegate_factory /= Void slider_delegate_factory_not_void: slider_delegate_factory /= Void progress_bar_delegate_factory_not_void: progress_bar_delegate_factory /= Void scrollpanel_delegate_factory_not_void: scrollpanel_delegate_factory /= Void scrollbar_delegate_factory_not_void: scrollbar_delegate_factory /= Void context_menu_delegate_factory_not_void: context_menu_delegate_factory /= Void end