Initialize() public method

public Initialize ( ToolkitEngineBackend toolit ) : void
toolit ToolkitEngineBackend
return void
Esempio n. 1
0
        public override void InitializeBackends()
        {
            RegisterBackend <ICustomWidgetBackend, CustomWidgetBackend> ();
            RegisterBackend <IWindowBackend, WindowBackend> ();
            RegisterBackend <ILabelBackend, LabelBackend> ();
            RegisterBackend <IBoxBackend, BoxBackend> ();
            RegisterBackend <IButtonBackend, ButtonBackend> ();
            RegisterBackend <INotebookBackend, NotebookBackend> ();
            RegisterBackend <ITreeViewBackend, TreeViewBackend> ();
            RegisterBackend <ITreeStoreBackend, TreeStoreBackend> ();
            RegisterBackend <IListViewBackend, ListViewBackend> ();
            RegisterBackend <IListStoreBackend, ListStoreBackend> ();
            RegisterBackend <ICanvasBackend, CanvasBackend> ();
            RegisterBackend <ImageBackendHandler, ImageHandler> ();
            RegisterBackend <Xwt.Backends.ContextBackendHandler, CairoContextBackendHandler> ();
            RegisterBackend <TextLayoutBackendHandler, GtkTextLayoutBackendHandler> ();
            RegisterBackend <DrawingPathBackendHandler, CairoContextBackendHandler> ();
            RegisterBackend <GradientBackendHandler, CairoGradientBackendHandler> ();
            RegisterBackend <FontBackendHandler, GtkFontBackendHandler> ();
            RegisterBackend <IMenuBackend, MenuBackend> ();
            RegisterBackend <IMenuItemBackend, MenuItemBackend> ();
            RegisterBackend <ICheckBoxMenuItemBackend, CheckBoxMenuItemBackend> ();
            RegisterBackend <IRadioButtonMenuItemBackend, RadioButtonMenuItemBackend> ();
            RegisterBackend <ISeparatorMenuItemBackend, SeparatorMenuItemBackend> ();
            RegisterBackend <IScrollViewBackend, ScrollViewBackend> ();
            RegisterBackend <IComboBoxBackend, ComboBoxBackend> ();
            RegisterBackend <IDesignerSurfaceBackend, DesignerSurfaceBackend> ();
            RegisterBackend <IMenuButtonBackend, MenuButtonBackend> ();
            RegisterBackend <ITextEntryBackend, TextEntryBackend> ();
            RegisterBackend <IToggleButtonBackend, ToggleButtonBackend> ();
            RegisterBackend <IImageViewBackend, ImageViewBackend> ();
            RegisterBackend <IAlertDialogBackend, AlertDialogBackend> ();
            RegisterBackend <ICheckBoxBackend, CheckBoxBackend> ();
            RegisterBackend <IFrameBackend, FrameBackend> ();
            RegisterBackend <ISeparatorBackend, SeparatorBackend> ();
            RegisterBackend <IDialogBackend, DialogBackend> ();
            RegisterBackend <IComboBoxEntryBackend, ComboBoxEntryBackend> ();
            RegisterBackend <ClipboardBackend, GtkClipboardBackend> ();
            RegisterBackend <ImagePatternBackendHandler, GtkImagePatternBackendHandler> ();
            RegisterBackend <ImageBuilderBackendHandler, ImageBuilderBackend> ();
            RegisterBackend <IScrollAdjustmentBackend, ScrollAdjustmentBackend> ();
            RegisterBackend <IOpenFileDialogBackend, OpenFileDialogBackend> ();
            RegisterBackend <ISaveFileDialogBackend, SaveFileDialogBackend> ();
            RegisterBackend <ISelectFolderDialogBackend, SelectFolderDialogBackend> ();
            RegisterBackend <IPanedBackend, PanedBackend> ();
            RegisterBackend <ISelectColorDialogBackend, SelectColorDialogBackend> ();
            RegisterBackend <IListBoxBackend, ListBoxBackend> ();
            RegisterBackend <IStatusIconBackend, StatusIconBackend> ();
            RegisterBackend <IProgressBarBackend, ProgressBarBackend> ();
            RegisterBackend <IPopoverBackend, PopoverBackend> ();
            RegisterBackend <ISpinButtonBackend, SpinButtonBackend> ();
            RegisterBackend <IDatePickerBackend, DatePickerBackend> ();
            RegisterBackend <ILinkLabelBackend, LinkLabelBackend> ();
            RegisterBackend <ISpinnerBackend, SpinnerBackend> ();
            RegisterBackend <IRichTextViewBackend, RichTextViewBackend> ();
            RegisterBackend <IExpanderBackend, ExpanderBackend> ();
            RegisterBackend <DesktopBackend, GtkDesktopBackend> ();
            RegisterBackend <IEmbeddedWidgetBackend, EmbeddedWidgetBackend> ();
            RegisterBackend <ISegmentedButtonBackend, SegmentedButtonBackend> ();
            RegisterBackend <ISliderBackend, SliderBackend> ();
            RegisterBackend <IRadioButtonBackend, RadioButtonBackend> ();
            RegisterBackend <IScrollbarBackend, ScrollbarBackend> ();
            RegisterBackend <IPasswordEntryBackend, PasswordEntryBackend> ();
            RegisterBackend <KeyboardHandler, GtkKeyboardHandler> ();
            RegisterBackend <ISearchTextEntryBackend, SearchTextEntryBackend> ();
            RegisterBackend <IWebViewBackend, WebViewBackend> ();
            RegisterBackend <IColorSelectorBackend, ColorSelectorBackend> ();
            RegisterBackend <IColorPickerBackend, ColorPickerBackend> ();
            RegisterBackend <ICalendarBackend, CalendarBackend> ();
            RegisterBackend <IFontSelectorBackend, FontSelectorBackend> ();
            RegisterBackend <ISelectFontDialogBackend, SelectFontDialogBackend> ();
            RegisterBackend <IAccessibleBackend, AccessibleBackend> ();
            RegisterBackend <IPopupWindowBackend, PopupWindowBackend> ();
            RegisterBackend <IUtilityWindowBackend, UtilityWindowBackend> ();

            string typeName = null;
            string asmName  = null;

            if (Platform.IsMac)
            {
                typeName = "Xwt.Gtk.Mac.MacPlatformBackend";
                asmName  = "Xwt.Gtk.Mac";
            }
            else if (Platform.IsWindows)
            {
                typeName = "Xwt.Gtk.Windows.WindowsPlatformBackend";
                asmName  = "Xwt.Gtk.Windows";
            }

            if (typeName != null)
            {
                var loc = Path.GetDirectoryName(GetType().Assembly.Location);
                loc = Path.Combine(loc, asmName + ".dll");

                Assembly asm = null;
                try {
                    if (File.Exists(loc))
                    {
                        asm = Assembly.LoadFrom(loc);
                    }
                    else
                    {
                        asm = Assembly.Load(asmName);
                    }
                } catch {
                    // Not found
                }

                Type platformType = asm != null?asm.GetType(typeName) : null;

                if (platformType != null)
                {
                    platformBackend = (GtkPlatformBackend)Activator.CreateInstance(platformType);
                    platformBackend.Initialize(this);
                }
            }
        }
Esempio n. 2
0
		public override void InitializeBackends ()
		{
			RegisterBackend<ICustomWidgetBackend, CustomWidgetBackend> ();
			RegisterBackend<IWindowBackend, WindowBackend> ();
			RegisterBackend<ILabelBackend, LabelBackend> ();
			RegisterBackend<IBoxBackend, BoxBackend> ();
			RegisterBackend<IButtonBackend, ButtonBackend> ();
			RegisterBackend<INotebookBackend, NotebookBackend> ();
			RegisterBackend<ITreeViewBackend, TreeViewBackend> ();
			RegisterBackend<ITreeStoreBackend, TreeStoreBackend> ();
			RegisterBackend<IListViewBackend, ListViewBackend> ();
			RegisterBackend<IListStoreBackend, ListStoreBackend> ();
			RegisterBackend<ICanvasBackend, CanvasBackend> ();
			RegisterBackend<ImageBackendHandler, ImageHandler> ();
			RegisterBackend<Xwt.Backends.ContextBackendHandler, CairoContextBackendHandler> ();
			RegisterBackend<TextLayoutBackendHandler, GtkTextLayoutBackendHandler> ();
			RegisterBackend<DrawingPathBackendHandler, CairoContextBackendHandler> ();
			RegisterBackend<GradientBackendHandler, CairoGradientBackendHandler> ();
			RegisterBackend<FontBackendHandler, GtkFontBackendHandler> ();
			RegisterBackend<IMenuBackend, MenuBackend> ();
			RegisterBackend<IMenuItemBackend, MenuItemBackend> ();
			RegisterBackend<ICheckBoxMenuItemBackend, CheckBoxMenuItemBackend> ();
			RegisterBackend<IRadioButtonMenuItemBackend, RadioButtonMenuItemBackend> ();
			RegisterBackend<ISeparatorMenuItemBackend, SeparatorMenuItemBackend> ();
			RegisterBackend<IScrollViewBackend, ScrollViewBackend> ();
			RegisterBackend<IComboBoxBackend, ComboBoxBackend> ();
			RegisterBackend<IDesignerSurfaceBackend, DesignerSurfaceBackend> ();
			RegisterBackend<IMenuButtonBackend, MenuButtonBackend> ();
			RegisterBackend<ITextEntryBackend, TextEntryBackend> ();
			RegisterBackend<IToggleButtonBackend, ToggleButtonBackend> ();
			RegisterBackend<IImageViewBackend, ImageViewBackend> ();
			RegisterBackend<IAlertDialogBackend, AlertDialogBackend> ();
			RegisterBackend<ICheckBoxBackend, CheckBoxBackend> ();
			RegisterBackend<IFrameBackend, FrameBackend> ();
			RegisterBackend<ISeparatorBackend, SeparatorBackend> ();
			RegisterBackend<IDialogBackend, DialogBackend> ();
			RegisterBackend<IComboBoxEntryBackend, ComboBoxEntryBackend> ();
			RegisterBackend<ClipboardBackend, GtkClipboardBackend> ();
			RegisterBackend<ImagePatternBackendHandler, GtkImagePatternBackendHandler> ();
			RegisterBackend<ImageBuilderBackendHandler, ImageBuilderBackend> ();
			RegisterBackend<IScrollAdjustmentBackend, ScrollAdjustmentBackend> ();
			RegisterBackend<IOpenFileDialogBackend, OpenFileDialogBackend> ();
			RegisterBackend<ISaveFileDialogBackend, SaveFileDialogBackend> ();
			RegisterBackend<ISelectFolderDialogBackend, SelectFolderDialogBackend> ();
			RegisterBackend<IPanedBackend, PanedBackend> ();
			RegisterBackend<ISelectColorDialogBackend, SelectColorDialogBackend> ();
			RegisterBackend<IListBoxBackend, ListBoxBackend> ();
			RegisterBackend<IStatusIconBackend, StatusIconBackend> ();
			RegisterBackend<IProgressBarBackend, ProgressBarBackend> ();
			RegisterBackend<IPopoverBackend, PopoverBackend> ();
			RegisterBackend<ISpinButtonBackend, SpinButtonBackend> ();
			RegisterBackend<IDatePickerBackend, DatePickerBackend> ();
			RegisterBackend<ILinkLabelBackend, LinkLabelBackend> ();
			RegisterBackend<ISpinnerBackend, SpinnerBackend> ();
			RegisterBackend<IRichTextViewBackend, RichTextViewBackend> ();
			RegisterBackend<IExpanderBackend, ExpanderBackend> ();
			RegisterBackend<DesktopBackend, GtkDesktopBackend> ();
			RegisterBackend<IEmbeddedWidgetBackend, EmbeddedWidgetBackend> ();
			RegisterBackend<ISegmentedButtonBackend, SegmentedButtonBackend> ();
			RegisterBackend<ISliderBackend, SliderBackend> ();
			RegisterBackend<IRadioButtonBackend, RadioButtonBackend> ();
			RegisterBackend<IScrollbarBackend, ScrollbarBackend> ();
			RegisterBackend<IPasswordEntryBackend, PasswordEntryBackend> ();
			RegisterBackend<KeyboardHandler, GtkKeyboardHandler> ();
			RegisterBackend<ISearchTextEntryBackend, SearchTextEntryBackend> ();
			RegisterBackend<IWebViewBackend, WebViewBackend> ();

			string typeName = null;
			string asmName = null;
			if (Platform.IsMac) {
				typeName = "Xwt.Gtk.Mac.MacPlatformBackend";
				asmName = "Xwt.Gtk.Mac";
			}
			else if (Platform.IsWindows) {
				typeName = "Xwt.Gtk.Windows.WindowsPlatformBackend";
				asmName = "Xwt.Gtk.Windows";
			}

			if (typeName != null) {
				var loc = Path.GetDirectoryName (GetType ().Assembly.Location);
				loc = Path.Combine (loc, asmName + ".dll");

				Assembly asm = null;
				try {
					if (File.Exists (loc)) {
						asm = Assembly.LoadFrom (loc);
					} else {
						asm = Assembly.Load (asmName);
					}
				} catch {
					// Not found
				}

				Type platformType = asm != null ? asm.GetType (typeName) : null;

				if (platformType != null) {
					platformBackend = (GtkPlatformBackend)Activator.CreateInstance (platformType);
					platformBackend.Initialize (this);
				}
			}
		}