示例#1
0
        public override void Initialize(IComponent component)
        {
            base.Initialize(component);

            tabHost = component as TabHost;
            InitializeServices();

            // initialize adorners
            adorner = new Adorner();
            BehaviorService.Adorners.Add(adorner);

            // add glyphs
            hostGlyph = new TabHostGlyph(BehaviorService, tabHost, adorner, selectionService);
            adorner.Glyphs.Add(hostGlyph);

            // add add/remove tab handlers
            changeService.ComponentRemoved += OnComponentRemoved;
        }
示例#2
0
        public override bool OnMouseDown(Glyph g, MouseButtons button, Point mouseLoc)
        {
            TabHostGlyph glyph = g as TabHostGlyph;

            if (glyph == null)
            {
                return(base.OnMouseDown(g, button, mouseLoc));
            }

            // add a new tab
            IDesignerHost host = glyph.TabHost.Site.GetService(typeof(IDesignerHost)) as IDesignerHost;
            TabItem       item = host.CreateComponent(typeof(TabItem)) as TabItem;

            // add the item to the tab host
            glyph.TabHost.Tabs.Add(item);

            // refresh the adorner
            glyph.ComputeBounds();
            glyph.Adorner.Invalidate();
            return(true);
        }
示例#3
0
        public override void Initialize(IComponent component)
        {
            base.Initialize(component);

            tabHost = component as TabHost;
            InitializeServices();

            // initialize adorners
            adorner = new Adorner();
            BehaviorService.Adorners.Add(adorner);

            // add glyphs
            hostGlyph = new TabHostGlyph(BehaviorService, tabHost, adorner, selectionService);
            adorner.Glyphs.Add(hostGlyph);

            // add add/remove tab handlers
            changeService.ComponentRemoved += OnComponentRemoved;
        }