예제 #1
0
        public DocumentTab(Gwen.Control.Base parent)
        {
            tabControl = new Gwen.Control.TabControl(parent)
                {
                    Dock = Gwen.Pos.Fill
                };

            tabButtons = new Dictionary<int, TabButton>();

            tabControl.TabSelected += OnTabSelected;
        }
예제 #2
0
	//public ref int testRef(ref int param) { return ref param; }
	protected void OnGlwidget1Initialized(object sender, EventArgs e)
	{
		Console.WriteLine("init");
		//if (GLinit)
		//return;
		GLinit = true;
		MainEditorView.editorBackendRenderer = new SharpSL.BackendRenderers.OpenGL.EditorOpenGLRenderer();
		SceneView.backendRenderer = new SharpSL.BackendRenderers.OpenGL.OpenGLRenderer();
		mainEditorView.Initialize();
		mainEditorView.OnResize(glwidget1.Allocation.Width, glwidget1.Allocation.Height);

		Sharp.InputHandler.input.Initialize(MainEditorView.canvas);


		var assets = new AssetsView();


		Sharp.InputHandler.OnMouseDown += (args) =>
		{
			Console.WriteLine("click: " + focusedView);
			if (focusedView == null)
				foreach (var view in View.views)
				{

					if (view.panel != null && view.panel.IsChild(Gwen.Input.InputHandler.HoveredControl, true))
					{
						view.OnMouseDown(args);
						break;
					}
				}
			else
				focusedView.OnMouseDown(args);
		};
		Sharp.InputHandler.OnMouseUp += (args) =>
		{
			if (focusedView == null)
				foreach (var view in View.views)
				{
					if (view.panel != null && view.panel.IsChild(Gwen.Input.InputHandler.HoveredControl, true))
					{
						view.OnMouseUp(args);
						break;
					}
				}
			else
				focusedView.OnMouseUp(args);
		};
		Sharp.InputHandler.OnMouseMove += (args) =>
		{
			if (focusedView == null)
				foreach (var view in View.views)
				{
					if (view.panel != null && view.panel.IsChild(Gwen.Input.InputHandler.HoveredControl, true))
					{
						view.OnMouseMove(args);
						break;
					}
				}
			else
				focusedView.OnMouseMove(args);
		};

		var scene = new SceneView();
		var structure = new SceneStructureView();
		var inspector = new InspectorView();

		var tab = new Gwen.Control.TabControl(mainEditorView.splitter);
		mainEditorView.splitter.OnSplitMoved += (o, args) =>
		{
			scene.OnResize(glwidget1.Allocation.Width, glwidget1.Allocation.Height);
			//assets.OnResize(glwidget1.Allocation.Width,glwidget1.Allocation.Height);
		};
		var btn = tab.AddPage("scene");
		var page = btn.Page;
		page.Margin = new Gwen.Margin(3, 3, 3, 3);
		scene.panel = btn.Page; //make GLControl for gwen

		var tab1 = new Gwen.Control.TabControl(mainEditorView.splitter);
		btn = tab1.AddPage("Assets");
		page = btn.Page;
		page.Margin = new Gwen.Margin(3, 3, 3, 3);
		page.HoverEnter += (item, args) => { Console.WriteLine("hover"); };
		assets.panel = page;

		var tab2 = new Gwen.Control.TabControl(mainEditorView.splitter);
		btn = tab2.AddPage("Structure");
		page = btn.Page;
		page.Margin = new Gwen.Margin(3, 3, 3, 3);
		structure.panel = btn.Page;

		var tab3 = new Gwen.Control.TabControl(mainEditorView.splitter);
		btn = tab3.AddPage("Inspector");
		page = btn.Page;
		page.Margin = new Gwen.Margin(3, 3, 3, 3);
		inspector.panel = btn.Page;

		scene.Initialize();
		structure.Initialize();

		inspector.Initialize();
		assets.Initialize();

		inspector.OnResize(glwidget1.Allocation.Width, glwidget1.Allocation.Height);
		scene.OnResize(glwidget1.Allocation.Width, glwidget1.Allocation.Height);
		structure.OnResize(glwidget1.Allocation.Width, glwidget1.Allocation.Height);
		assets.OnResize(glwidget1.Allocation.Width, glwidget1.Allocation.Height);

		mainEditorView.splitter.SetPanel(1, tab);
		mainEditorView.splitter.SetPanel(0, tab1);
		mainEditorView.splitter.SetPanel(2, tab2);
		mainEditorView.splitter.SetPanel(3, tab3);


		foreach (var view in View.views)
			view.OnContextCreated(glwidget1.Allocation.Width, glwidget1.Allocation.Height);
		QueueResize();
	}
예제 #3
0
    protected void OnGlwidget1Initialized(object sender, EventArgs e)
    {
        Console.WriteLine("init");
        //if (GLinit)
        //return;
        GLinit = true;
        MainEditorView.editorBackendRenderer = new SharpSL.BackendRenderers.OpenGL.EditorOpenGLRenderer();
        SceneView.backendRenderer            = new SharpSL.BackendRenderers.OpenGL.OpenGLRenderer();
        mainEditorView.Initialize();
        mainEditorView.OnResize(glwidget1.Allocation.Width, glwidget1.Allocation.Height);

        Sharp.InputHandler.input.Initialize(MainEditorView.canvas);


        var assets = new AssetsView();


        Sharp.InputHandler.OnMouseDown += (args) => {
            Console.WriteLine("click: " + focusedView);
            if (focusedView == null)
            {
                foreach (var view in View.views)
                {
                    if (view.panel != null && view.panel.IsChild(Gwen.Input.InputHandler.HoveredControl, true))
                    {
                        view.OnMouseDown(args);
                        break;
                    }
                }
            }
            else
            {
                focusedView.OnMouseDown(args);
            }
        };
        Sharp.InputHandler.OnMouseUp += (args) => {
            if (focusedView == null)
            {
                foreach (var view in View.views)
                {
                    if (view.panel != null && view.panel.IsChild(Gwen.Input.InputHandler.HoveredControl, true))
                    {
                        view.OnMouseUp(args);
                        break;
                    }
                }
            }
            else
            {
                focusedView.OnMouseUp(args);
            }
        };
        Sharp.InputHandler.OnMouseMove += (args) => {
            if (focusedView == null)
            {
                foreach (var view in View.views)
                {
                    if (view.panel != null && view.panel.IsChild(Gwen.Input.InputHandler.HoveredControl, true))
                    {
                        view.OnMouseMove(args);
                        break;
                    }
                }
            }
            else
            {
                focusedView.OnMouseMove(args);
            }
        };

        var scene     = new SceneView();
        var structure = new SceneStructureView();
        var inspector = new InspectorView();

        var tab = new Gwen.Control.TabControl(mainEditorView.splitter);

        mainEditorView.splitter.OnSplitMoved += (o, args) => {
            scene.OnResize(glwidget1.Allocation.Width, glwidget1.Allocation.Height);
            //assets.OnResize(glwidget1.Allocation.Width,glwidget1.Allocation.Height);
        };
        var btn  = tab.AddPage("scene");
        var page = btn.Page;

        page.Margin = new Gwen.Margin(3, 3, 3, 3);
        scene.panel = btn.Page;         //make GLControl for gwen

        var tab1 = new Gwen.Control.TabControl(mainEditorView.splitter);

        btn              = tab1.AddPage("Assets");
        page             = btn.Page;
        page.Margin      = new Gwen.Margin(3, 3, 3, 3);
        page.HoverEnter += (item, args) => { Console.WriteLine("hover"); };
        assets.panel     = page;

        var tab2 = new Gwen.Control.TabControl(mainEditorView.splitter);

        btn             = tab2.AddPage("Structure");
        page            = btn.Page;
        page.Margin     = new Gwen.Margin(3, 3, 3, 3);
        structure.panel = btn.Page;

        var tab3 = new Gwen.Control.TabControl(mainEditorView.splitter);

        btn             = tab3.AddPage("Inspector");
        page            = btn.Page;
        page.Margin     = new Gwen.Margin(3, 3, 3, 3);
        inspector.panel = btn.Page;

        scene.Initialize();
        structure.Initialize();

        inspector.Initialize();
        assets.Initialize();

        inspector.OnResize(glwidget1.Allocation.Width, glwidget1.Allocation.Height);
        scene.OnResize(glwidget1.Allocation.Width, glwidget1.Allocation.Height);
        structure.OnResize(glwidget1.Allocation.Width, glwidget1.Allocation.Height);
        assets.OnResize(glwidget1.Allocation.Width, glwidget1.Allocation.Height);

        mainEditorView.splitter.SetPanel(1, tab);
        mainEditorView.splitter.SetPanel(0, tab1);
        mainEditorView.splitter.SetPanel(2, tab2);
        mainEditorView.splitter.SetPanel(3, tab3);


        foreach (var view in View.views)
        {
            view.OnContextCreated(glwidget1.Allocation.Width, glwidget1.Allocation.Height);
        }
        QueueResize();
    }