Exemple #1
0
        /// <summary>
        /// Creates toolbar
        /// </summary>
        /// <param name="buttons">Buttons</param>
        /// <param name="tools">Tools</param>
        /// <param name="size">Size</param>
        /// <param name="resources">Resources</param>
        /// <param name="translate">The "translate" sign</param>
        /// <returns>Toolbar</returns>
        public static PaletteToolBar CreateToolBar(ButtonWrapper[] buttons, ToolsDiagram tools, Size size,
                                                   Dictionary <string, object>[] resources, bool translate)
        {
            List <ButtonWrapper> l = new List <ButtonWrapper>(buttons);

            return(CreateToolBar(l, tools, size, translate, resources));
        }
Exemple #2
0
        static private void Add(string key, ButtonWrapper[] buttons, TabControl tab, ToolsDiagram tools, Size size,
                                Dictionary <string, object>[] resources, bool translate)
        {
            TabPage tp  = new TabPage();
            string  tt  = key + "";
            bool    vis = true;

            if (tt[tt.Length - 1] == '@')
            {
                tt  = tt.Substring(0, tt.Length - 1);
                vis = false;
                return;
            }
            if (translate)
            {
                tt = Resources.GetControlResource(tt, resources);
            }
            tp.Text = tt;
            PaletteToolBar toolbar = CreateToolBar(buttons, tools, size, resources, translate);

            tp.Controls.Add(toolbar);
            tab.Controls.Add(tp);
            if (!vis)
            {
                tp.Visible      = false;
                toolbar.Visible = false;
            }
        }
Exemple #3
0
        /// <summary>
        /// Creates toolbar
        /// </summary>
        /// <param name="buttons">Buttons</param>
        /// <param name="tools">Tools</param>
        /// <param name="size">Size</param>
        /// <param name="translate">The "translate" sign</param>
        /// <param name="resources">Resources</param>
        /// <returns>Toolbar</returns>
        public static PaletteToolBar CreateToolBar(IList <ButtonWrapper> buttons, ToolsDiagram tools, Size size, bool translate,
                                                   Dictionary <string, object>[] resources)
        {
            ImageList imageList = new ImageList();

            imageList.ImageSize = size;
            foreach (ButtonWrapper bw in buttons)
            {
                imageList.Images.Add(bw.buttonImage);
            }
            PaletteToolBar toolbar = new PaletteToolBar(tools);

            toolbar.ImageList = imageList;
            for (int i = 0; i < buttons.Count; i++)
            {
                ButtonWrapper b  = buttons[i];
                string        tt = b.toolTipText;
                if (translate)
                {
                    tt = Resources.GetControlResource(tt, resources);
                }
                PaletteButton pb = new PaletteButton(toolbar, b.type, b.stringKind, tt, b.buttonImage, i, b.isArrow);
                if (!b.isVisible)
                {
                    pb.Visible = false;
                }
            }
            return(toolbar);
        }
Exemple #4
0
        /// <summary>
        /// Adds buttons to Tab control
        /// </summary>
        /// <param name="tab">The tab</param>
        /// <param name="buttons">Buttons</param>
        /// <param name="tools">Tools</param>
        /// <param name="size">Size</param>
        /// <param name="resources">Resources</param>
        /// <param name="translate">The "translate" sign</param>
        public static void Add(LightDictionary <string, ButtonWrapper[]> buttons, TabControl tab,
                               ToolsDiagram tools, Size size, Dictionary <string, object>[] resources, bool translate)
        {
            IList <string> keys = buttons.Keys;

            foreach (string key in keys)
            {
                Add(key, buttons[key], tab, tools, size, resources, translate);
            }
        }
Exemple #5
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="toolbar">The toolbar</param>
 /// <param name="type">The type</param>
 /// <param name="objectType">The object type</param>
 /// <param name="kind">The string kind</param>
 /// <param name="toolTipText">The tip</param>
 /// <param name="buttonImage">The image</param>
 /// <param name="ImageIndex">The image index</param>
 /// <param name="IsArrow">The "is arrow" flag</param>
 internal PaletteButton(PaletteToolBar toolbar, string type, Type objectType, string kind, string toolTipText, Image buttonImage, int ImageIndex, bool IsArrow)
 {
     this.objectType = objectType;
     this.kind       = kind;
     this.isArrow    = IsArrow;
     if (objectType != null)
     {
         this.type = objectType.ToString();
     }
     this.ToolTipText = toolTipText;
     this.ImageIndex  = ImageIndex;
     this.buttonImage = buttonImage;
     toolbar.Buttons.Add(this);
     Style       = ToolBarButtonStyle.ToggleButton;
     diagram     = toolbar.ToolDiagram;
     imageNumber = diagram.Count;
     diagram.AddButton(this);
     int i = diagram.Count;
 }
Exemple #6
0
        /// <summary>
        /// Adds buttons
        /// </summary>
        /// <param name="keys">Keys</param>
        /// <param name="buttons">Buttons</param>
        /// <param name="tab">Tab control</param>
        /// <param name="tools">Tools</param>
        /// <param name="size">Size</param>
        /// <param name="resources">Resources</param>
        /// <param name="translate">Translate sign</param>
        public static void Add(string[] keys, ButtonWrapper[][] buttons, TabControl tab, ToolsDiagram tools, Size size,
                               Dictionary <string, object>[] resources, bool translate)
        {
            LightDictionary <string, ButtonWrapper[]> d = new LightDictionary <string, ButtonWrapper[]>();

            d.Add(keys, buttons);
            Add(d, tab, tools, size, resources, translate);
        }
Exemple #7
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="diagram">The tools diagram</param>
 public PaletteToolBar(ToolsDiagram diagram)
 {
     this.diagram      = diagram;
     this.ButtonClick += diagram.ClickEventHandler;
 }