Ejemplo n.º 1
0
        void LoadDocks(Ambertation.Windows.Forms.DockContainer dc, LoadedPackage lp)
        {
            foreach (SimPe.Interfaces.IDockableTool idt in FileTable.ToolRegistry.Docks)
            {
                Ambertation.Windows.Forms.DockPanel dctrl = idt.GetDockableControl();


                if (dctrl != null)
                {
                    dctrl.Name    = "dc." + idt.GetType().Namespace + "." + idt.GetType().Name;
                    dctrl.Manager = dc.Manager;
                    dc.Controls.Add(dctrl);
                    //dctrl.DockNextTo(dc);

                    ChangedGuiResourceEvent += new SimPe.Events.ChangedResourceEvent(idt.RefreshDock);
                    dctrl.Tag = idt.Shortcut;
                    idt.RefreshDock(this, new SimPe.Events.ResourceEventArgs(lp));
                }
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Load all available Action Tools
        /// </summary>
        void LoadActionTools(
            SteepValley.Windows.Forms.ThemedControls.XPTaskBox taskbox,
            ToolStrip tb,
            ContextMenuStrip mi,
            SimPe.Interfaces.IToolAction[] tools)
        {
            if (tools == null)
            {
                tools = FileTable.ToolRegistry.Actions;
            }

            int top = 4 + taskbox.DockPadding.Top;

            if (taskbox.Tag != null)
            {
                top = (int)taskbox.Tag;
            }

            bool tfirst = true;
            bool mfirst = true;

            foreach (SimPe.Interfaces.IToolAction tool in tools)
            {
                ActionToolDescriptor atd = new ActionToolDescriptor(tool);
                ChangedGuiResourceEvent += new SimPe.Events.ChangedResourceEvent(atd.ChangeEnabledStateEventHandler);

                if (taskbox != null)
                {
                    atd.LinkLabel.Top  = top;
                    atd.LinkLabel.Left = 12;
                    top += atd.LinkLabel.Height;
                    atd.LinkLabel.Parent   = taskbox;
                    atd.LinkLabel.Visible  = taskbox.IsExpanded;
                    atd.LinkLabel.AutoSize = true;
                }

                if (mi != null)
                {
                    bool beggrp = (mfirst && mi.Items.Count != 0);
                    if (beggrp)
                    {
                        mi.Items.Add("-");
                    }
                    mi.Items.Add(atd.MenuButton);


                    mfirst = false;
                }

                if (tb != null && atd.ToolBarButton != null)
                {
                    ////RECHECK
                    //atd.ToolBarButton.BeginGroup = (tfirst && tb.Items.Count!=0);


                    if (tfirst && tb.Items.Count != 0)
                    {
                        tb.Items.Add(new ToolStripSeparator());
                    }
                    tb.Items.Add(atd.ToolBarButton);

                    tfirst = false;
                }
            }
            taskbox.Height = top + 4;
            taskbox.Tag    = top;
        }