示例#1
0
		internal Pad (DefaultWorkbench workbench, PadCodon content)
		{
			this.window    = workbench.GetPadWindow (content);
			this.window.PadHidden += delegate {
				IsOpenedAutomatically = false;
			};
			this.content   = content;
			this.workbench = workbench;
		}
 public bool IsVisible(PadCodon padContent)
 {
     DockItem item = GetDockItem (padContent);
     if (item != null)
         return item.Visible;
     return false;
 }
 public bool IsSticky(PadCodon padContent)
 {
     DockItem item = GetDockItem (padContent);
     return item != null && (item.Behavior & DockItemBehavior.Sticky) != 0;
 }
 public void HidePad(PadCodon padContent)
 {
     DockItem item = GetDockItem (padContent);
     if (item != null)
         item.Visible = false;
 }
 public IPadWindow GetPadWindow(PadCodon content)
 {
     IPadWindow w;
     padWindows.TryGetValue (content, out w);
     return w;
 }
        void AddPad(PadCodon content, bool show)
        {
            DockItem item = GetDockItem (content);
            if (padContentCollection.Contains (content)) {
                if (show && item != null)
                    item.Visible = true;
                return;
            }

            if (item != null) {
                if (show)
                    item.Visible = true;
            } else {
                AddPad (content, content.DefaultPlacement, content.DefaultStatus);
            }
        }
        public void ActivatePad(PadCodon padContent, bool giveFocus)
        {
            WelcomePage.WelcomePageService.HideWelcomePage ();

            DockItem item = GetDockItem (padContent);
            if (item != null)
                item.Present (giveFocus);
        }
 public void ShowPad(PadCodon content)
 {
     AddPad (content, true);
 }
 void RegisterPad(PadCodon content)
 {
     if (content.HasId) {
         string lab = content.Label.Length > 0 ? GettextCatalog.GetString (content.Label) : "";
         ActionCommand cmd = new ActionCommand ("Pad|" + content.PadId, lab, null);
         cmd.DefaultHandler = new PadActivationHandler (this, content);
         cmd.Category = GettextCatalog.GetString ("View");
         cmd.Description = GettextCatalog.GetString ("Show {0}", cmd.Text);
         IdeApp.CommandService.RegisterCommand (cmd);
     }
     padContentCollection.Add (content);
 }
示例#10
0
 public PadActivationHandler(DefaultWorkbench wb, PadCodon pad)
 {
     this.pad = pad;
     this.wb = wb;
 }
示例#11
0
        void CreatePadContent(bool force, PadCodon padCodon, PadWindow window, DockItem item)
        {
            if (force || item.Content == null) {
                IPadContent newContent = padCodon.InitializePadContent (window);

                Gtk.Widget pcontent;
                if (newContent is Widget) {
                    pcontent = newContent.Control;
                } else {
                    PadCommandRouterContainer crc = new PadCommandRouterContainer (window, newContent.Control, newContent, true);
                    crc.Show ();
                    pcontent = crc;
                }

                PadCommandRouterContainer router = new PadCommandRouterContainer (window, pcontent, toolbarFrame, false);
                router.Show ();
                item.Content = router;
            }
        }
		public void ActivatePad (PadCodon padContent, bool giveFocus)
		{
			DockItem item = GetDockItem (padContent);
			if (item != null)
				item.Present (giveFocus);
		}
示例#13
0
		void CreatePadContent (bool force, PadCodon padCodon, PadWindow window, DockItem item)
		{
			if (force || item.Content == null) {
				PadContent newContent = padCodon.InitializePadContent (window);

				Gtk.Widget crc = new PadCommandRouterContainer (window, newContent.Control, newContent, true);
				crc.Show ();

				Gtk.Widget router = new PadCommandRouterContainer (window, crc, toolbarFrame, false);
				router.Show ();
				item.Content = router;
			}
		}
示例#14
0
 public void RemovePad(PadCodon codon)
 {
     if (codon.HasId) {
         Command cmd = IdeApp.CommandService.GetCommand (codon.Id);
         if (cmd != null)
             IdeApp.CommandService.UnregisterCommand (cmd);
     }
     DockItem item = GetDockItem (codon);
     padContentCollection.Remove (codon);
     PadWindow win = (PadWindow) GetPadWindow (codon);
     if (win != null) {
         win.NotifyDestroyed ();
         Counters.PadsLoaded--;
         padCodons.Remove (win);
     }
     if (item != null)
         dock.RemoveItem (item);
     padWindows.Remove (codon);
 }
示例#15
0
 public void AddPad(PadCodon content)
 {
     AddPad (content, false);
 }
示例#16
0
 public void SetSticky(PadCodon padContent, bool sticky)
 {
     DockItem item = GetDockItem (padContent);
     if (item != null) {
         if (sticky)
             item.Behavior |= DockItemBehavior.Sticky;
         else
             item.Behavior &= ~DockItemBehavior.Sticky;
     }
 }
示例#17
0
 public void BringToFront(PadCodon content)
 {
     BringToFront (content, false);
 }
示例#18
0
 internal DockItem GetDockItem(PadCodon content)
 {
     if (padContentCollection.Contains (content)) {
         DockItem item = dock.GetItem (content.PadId);
         return item;
     }
     return null;
 }
示例#19
0
        public virtual void BringToFront(PadCodon content, bool giveFocus)
        {
            if (!IsVisible (content))
                ShowPad (content);

            ActivatePad (content, giveFocus);
        }
示例#20
0
        void AddPad(PadCodon padCodon, string placement, DockItemStatus defaultStatus)
        {
            RegisterPad (padCodon);

            PadWindow window = new PadWindow (this, padCodon);
            window.Icon = padCodon.Icon;
            padWindows [padCodon] = window;
            padCodons [window] = padCodon;

            window.StatusChanged += new EventHandler (UpdatePad);

            string location = ToDockLocation (placement);

            DockItem item = dock.AddItem (padCodon.PadId);
            item.Label = GettextCatalog.GetString (padCodon.Label);
            item.Icon = ImageService.GetIcon (padCodon.Icon).WithSize (IconSize.Menu);
            item.DefaultLocation = location;
            item.DefaultVisible = false;
            item.DefaultStatus = defaultStatus;
            item.DockLabelProvider = padCodon;
            window.Item = item;

            if (padCodon.Initialized) {
                CreatePadContent (true, padCodon, window, item);
            } else {
                item.ContentRequired += delegate {
                    CreatePadContent (false, padCodon, window, item);
                };
            }

            item.VisibleChanged += delegate {
                if (item.Visible)
                    window.NotifyShown ();
                else
                    window.NotifyHidden ();
            };

            item.ContentVisibleChanged += delegate {
                if (item.ContentVisible)
                    window.NotifyContentShown ();
                else
                    window.NotifyContentHidden ();
            };
        }
		internal PadWindow (DefaultWorkbench workbench, PadCodon codon)
		{
			this.workbench = workbench;
			this.codon = codon;
			this.title = GettextCatalog.GetString (codon.Label);
			this.icon = codon.Icon;
		}