Beispiel #1
0
        protected override void OnInitialize()
        {
            m_generator = new UFormsCodeGenerator();

            title = "Control Designer";

            m_menu = new DesignerTopMenu();
            m_menu.SetSize(100.0f, CONTROL_DISPLAY_HEIGHT, Control.MetricsUnits.Percentage, Control.MetricsUnits.Pixel);
            m_menu.MenuOptionSelected += HandleMenuOptionSelected;

            AddChild(m_menu);

            m_inspectorFields = new Dictionary <object, PropertyInfo>();
            m_hierarchyItems  = new Dictionary <Control, HierarchyItem>();

            m_inspector = new Control();
            m_inspector.SetPosition(position.width - INSPECTOR_WIDTH, CONTROL_DISPLAY_HEIGHT + TOP_MENU_SPACING);
            m_inspector.SetWidth(INSPECTOR_WIDTH);
            m_inspector.SetMargin(0.0f, 0.0f, SIDE_MARGIN, 0.0f);
            m_inspector.AddDecorator(new StackContent(StackContent.StackMode.Vertical, StackContent.OverflowMode.Flow));
            AddChild(m_inspector);

            m_hierarchy = new Control();
            m_hierarchy.SetPosition(0.0f, CONTROL_DISPLAY_HEIGHT + TOP_MENU_SPACING);
            m_hierarchy.SetWidth(HIERARCHY_WIDTH);
            m_hierarchy.SetMargin(SIDE_MARGIN, 0.0f, 0.0f, 0.0f);
            m_hierarchy.AddDecorator(new StackContent(StackContent.StackMode.Vertical, StackContent.OverflowMode.Flow));
            AddChild(m_hierarchy);

            m_workarea = new Control();
            m_workarea.SetPosition(m_viewportOffset);
            m_workarea.AddDecorator(new ClipContent());

            AddChild(m_workarea);

            m_resizeHandle = new Control();
            m_resizeHandle.SetSize(RESIZE_HANDLE_SIZE, RESIZE_HANDLE_SIZE);
            m_resizeHandle.AddDecorator(new BackgroundColor(Color.blue));
            m_resizeHandle.Visibility = Control.VisibilityMode.Hidden;

            AddChild(m_resizeHandle);

            SetSelectedControl(null);
            SetInspectorTarget(null);

            ShowToolbox();
        }
Beispiel #2
0
        void HandleMenuOptionSelected( DesignerTopMenu.MenuOption option )
        {
            switch ( option )
            {
                case DesignerTopMenu.MenuOption.ShowToolbox:
                    ShowToolbox();
                break;

                case DesignerTopMenu.MenuOption.New:
                    NewControl();
                break;

                case DesignerTopMenu.MenuOption.Save:
                    SaveControl();
                break;
            }
        }
Beispiel #3
0
        protected override void OnInitialize()
        {
            m_generator = new UFormsCodeGenerator();

            title = "Control Designer";
            
            m_menu = new DesignerTopMenu();
            m_menu.SetSize( 100.0f, CONTROL_DISPLAY_HEIGHT, Control.MetricsUnits.Percentage, Control.MetricsUnits.Pixel );
            m_menu.MenuOptionSelected += HandleMenuOptionSelected;

            AddChild( m_menu );

            m_inspectorFields = new Dictionary<object, PropertyInfo>();
            m_hierarchyItems = new Dictionary<Control, HierarchyItem>();

            m_inspector = new Control();
            m_inspector.SetPosition( position.width - INSPECTOR_WIDTH , CONTROL_DISPLAY_HEIGHT + TOP_MENU_SPACING );
            m_inspector.SetWidth( INSPECTOR_WIDTH );
            m_inspector.SetMargin( 0.0f, 0.0f, SIDE_MARGIN, 0.0f );
            m_inspector.AddDecorator( new StackContent( StackContent.StackMode.Vertical, StackContent.OverflowMode.Flow ) );
            AddChild( m_inspector );

            m_hierarchy = new Control();
            m_hierarchy.SetPosition( 0.0f, CONTROL_DISPLAY_HEIGHT + TOP_MENU_SPACING );
            m_hierarchy.SetWidth( HIERARCHY_WIDTH );
            m_hierarchy.SetMargin( SIDE_MARGIN, 0.0f, 0.0f, 0.0f );
            m_hierarchy.AddDecorator( new StackContent( StackContent.StackMode.Vertical, StackContent.OverflowMode.Flow ) );
            AddChild( m_hierarchy );

            m_workarea = new Control();
            m_workarea.SetPosition( m_viewportOffset );
            m_workarea.AddDecorator( new ClipContent() );

            AddChild( m_workarea );

            m_resizeHandle = new Control();
            m_resizeHandle.SetSize( RESIZE_HANDLE_SIZE, RESIZE_HANDLE_SIZE );
            m_resizeHandle.AddDecorator( new BackgroundColor( Color.blue ) );
            m_resizeHandle.Visibility = Control.VisibilityMode.Hidden;

            AddChild( m_resizeHandle );

            SetSelectedControl( null );
            SetInspectorTarget( null );

            ShowToolbox();
        }