Пример #1
0
 private void SelectFirstTab()
 {
     if (notebook1.NPages > 0)
     {
         notebook1.Page = 0;
         UITabPage firstTab = GetCurrentTabPage();
         firstTab.InitDropEvent();
     }
 }
Пример #2
0
        public static UITabPage CreateUICanvasTab(Gtk.Notebook parentNotebook, GameConfigDB gameConfigDB, bool isInitializing = false)
        {
            Gtk.ScrolledWindow scrolledWindow = new Gtk.ScrolledWindow();
            scrolledWindow.Name       = "_scrolledWindow" + nextGeneratedTabIndex;
            scrolledWindow.ShadowType = ((Gtk.ShadowType)(1));
            scrolledWindow.ShowAll();

            Gtk.Viewport viewport = new Gtk.Viewport();
            viewport.ShadowType = ((Gtk.ShadowType)(0));

            Gtk.Fixed canvas = new Gtk.Fixed();
            canvas.WidthRequest  = 800;
            canvas.HeightRequest = 600;
            canvas.Name          = "_gameCanvas" + nextGeneratedTabIndex;
            canvas.HasWindow     = false;
            canvas.ShowAll();
            viewport.Add(canvas);
            viewport.ShowAll();
            scrolledWindow.Add(viewport);

            Gtk.Viewport viewportLabel = new Gtk.Viewport();
            viewportLabel.ShadowType    = ((Gtk.ShadowType)(0));
            viewportLabel.WidthRequest  = 80;
            viewportLabel.HeightRequest = 30;

            Gtk.Label label = new Gtk.Label();
            label.Name      = "label1";
            label.LabelProp = global::Mono.Unix.Catalog.GetString(gameConfigDB.GetName());
            label.ShowAll();
            viewportLabel.Add(label);

            if (parentNotebook.NPages <= 0 || isInitializing)
            {
                parentNotebook.Add(scrolledWindow);
                parentNotebook.SetTabLabel(scrolledWindow, viewportLabel);
            }
            else
            {
                parentNotebook.InsertPage(scrolledWindow, viewportLabel, parentNotebook.NPages - 1);
                parentNotebook.Page = parentNotebook.NPages - 2;
            }

            UITabPage tabPage = new UITabPage(gameConfigDB, scrolledWindow, viewport, label, canvas);

            tabPage.InitDropEvent();
            scrolledWindow.Data.Add("UITabPage", tabPage);

            return(tabPage);
        }