private void InitialiseToolbars()
        {
            // Main toolbar
            var tbRenderer = new UIThemeToolbarRenderer();

            tbRenderer.SetUITheme(new UITheme());
            tbRenderer.EnableDrawRowSeparators(true);

            this.Toolbar.Renderer  = tbRenderer;
            this.Toolbar.BackColor = BackColor;

            if (DPIScaling.WantScaling())
            {
                int imageSize = DPIScaling.Scale(16);
                this.Toolbar.ImageScalingSize = new System.Drawing.Size(imageSize, imageSize);
            }

            // Place this at the end to ensure the toolbar has finished its resize
            Toolbars.FixupButtonSizes(this.Toolbar);

            UpdateToolbar();

            // Page toolbars
            var theme = new UITheme();

            theme.SetAppDrawingColor(UITheme.AppColor.AppBackLight, headerPage.BackColor);
            theme.SetAppDrawingColor(UITheme.AppColor.ToolbarLight, headerPage.BackColor);
            theme.SetAppDrawingColor(UITheme.AppColor.ToolbarDark, headerPage.BackColor);

            this.htmlReportHeaderControl.SetUITheme(theme);
            this.htmlReportTitleControl.SetUITheme(theme);
            this.htmlReportTasksControl.SetUITheme(theme);
            this.htmlReportFooterControl.SetUITheme(theme);
        }
Esempio n. 2
0
		private void InitializeComponentEx()
		{
			InitialiseFeatures();

			if (DPIScaling.WantScaling())
			{
				int imageSize = DPIScaling.Scale(16);

				this.ToolBar.ImageScalingSize = new System.Drawing.Size(imageSize, imageSize);
				this.ContextMenu.ImageScalingSize = new System.Drawing.Size(imageSize, imageSize);
			}

			this.ToolbarDock = DockStyle.Top;
			this.Anchor = AnchorStyles.Left | AnchorStyles.Top | AnchorStyles.Right | AnchorStyles.Bottom;
			this.InnerText = "";
			this.TabIndex = 26;
			this.BorderSize = 0;
			this.ContentMargin = 5;

			this.BrowserPanel.Anchor = AnchorStyles.None; // we handle positioning ourselves

			this.WebBrowser.Document.AttachEventHandler("onfocusout", OnLostFocus);
			this.WebBrowser.Document.AttachEventHandler("onfocusin", OnGotFocus);

			// Place this at the end to ensure the toolbar has finished its resize
			Toolbars.FixupButtonSizes(this.ToolBar);
		}
        private void PrepareToolbar()
        {
            // Add preferences and help buttons to the toolbar
            m_HtmlEditControl.ToolBar.Items.Add(new ToolStripSeparator());

            var prefsBtn = new System.Windows.Forms.ToolStripButton();

            m_HtmlEditControl.ToolBar.Items.Add(prefsBtn);

            prefsBtn.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
            prefsBtn.Name         = "toolstripShowPrefs";
            prefsBtn.Tag          = "ShowPrefs";
            prefsBtn.ToolTipText  = m_Trans.Translate("Preferences");
            prefsBtn.Click       += new System.EventHandler(OnShowPreferences);
            prefsBtn.Size         = m_HtmlEditControl.ToolBar.Items[0].Size;
            prefsBtn.Image        = Properties.Resources.prefs.ToBitmap();

            m_HtmlEditControl.ToolBar.Items.Add(new ToolStripSeparator());

            var helpBtn = new System.Windows.Forms.ToolStripButton();

            m_HtmlEditControl.ToolBar.Items.Add(helpBtn);

            helpBtn.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
            helpBtn.Name         = "toolstripShowHelp";
            helpBtn.Tag          = "ShowHelp";
            helpBtn.ToolTipText  = m_Trans.Translate("Online Help");
            helpBtn.Click       += new System.EventHandler(OnShowHelp);
            helpBtn.Size         = prefsBtn.Size;
            helpBtn.Image        = Properties.Resources.help.ToBitmap();

            Toolbars.FixupButtonSizes(m_HtmlEditControl.ToolBar);
        }
        public OutlookUIManager(RlOutlook.Application application, OutlookAddin addin, string progid) : base(progid)
        {
            this.addin       = addin;
            this.application = application;
            explorers        = application.Explorers;
            inspectors       = application.Inspectors;

            inspectorCache = new ArrayList();
            explorerCache  = new ArrayList();

            inspectorToolbars = new Toolbars(this);
            explorerToolbars  = new Toolbars(this);

            BindEvents();

            foreach (RlOutlook.Inspector inspector in inspectors)
            {
                OnInspectorOpen(new OutlookInspector(inspector));
            }

            foreach (RlOutlook.Explorer explorer in explorers)
            {
                OnExplorerOpen(new OutlookExplorer(explorer));
            }
        }
Esempio n. 5
0
 private void ManagerPluginUnloaded(object sender, PluginEventArgs e)
 {
     Toolbars.RemoveItemsForPlugin(e.Identity);
     Menu.RemoveItemsForPlugin(e.Identity);
     DockPanels.RemoveItemsForPlugin(e.Identity);
     Toolbox.RemoveItemsForPlugin(e.Identity);
     StatusBar.RemoveItemsForPlugin(e.Identity);
 }
Esempio n. 6
0
		public new void SetControlFont(Font font)
		{
			base.SetControlFont(font);

			this.ToolBar.Font = m_ControlsFont;

			Toolbars.FixupButtonSizes(this.ToolBar);
		}
        private void InitialiseToolbars()
        {
            this.MenuBar.Renderer           = m_toolbarRenderer;
            this.RowContextMenu.Renderer    = m_toolbarRenderer;
            this.CellContextMenu.Renderer   = m_toolbarRenderer;
            this.HeaderContextMenu.Renderer = m_toolbarRenderer;
            this.ColumnContextMenu.Renderer = m_toolbarRenderer;

            this.ToolBar.Renderer   = m_toolbarRenderer;
            this.FontBar.Renderer   = m_toolbarRenderer;
            this.StatusBar.Renderer = m_toolbarRenderer;

            Toolbars.FixupButtonSizes(this.ToolBar);
            Toolbars.FixupButtonSizes(this.FontBar);

            if (m_ControlsFont != null)
            {
                this.MenuBar.Font   = m_ControlsFont;
                this.ToolBar.Font   = m_ControlsFont;
                this.StatusBar.Font = m_ControlsFont;
                this.FontBar.Font   = m_ControlsFont;

                this.FontBar.Items["fontToolStripComboBox"].Font     = m_ControlsFont;
                this.FontBar.Items["fontSizeToolStripComboBox"].Font = m_ControlsFont;

                this.RowContextMenu.Font    = m_ControlsFont;
                this.CellContextMenu.Font   = m_ControlsFont;
                this.HeaderContextMenu.Font = m_ControlsFont;
                this.ColumnContextMenu.Font = m_ControlsFont;
            }

            if (DPIScaling.WantScaling())
            {
                int imageSize   = DPIScaling.Scale(16);
                var scalingSize = new Size(imageSize, imageSize);

                this.MenuBar.ImageScalingSize = scalingSize;
                this.FontBar.ImageScalingSize = scalingSize;
                this.ToolBar.ImageScalingSize = scalingSize;

                this.RowContextMenu.ImageScalingSize    = scalingSize;
                this.CellContextMenu.ImageScalingSize   = scalingSize;
                this.HeaderContextMenu.ImageScalingSize = scalingSize;
                this.ColumnContextMenu.ImageScalingSize = scalingSize;
            }

            this.ToolBar.GripStyle    = ToolStripGripStyle.Hidden;
            this.FontBar.GripStyle    = ToolStripGripStyle.Hidden;
            this.StatusBar.SizingGrip = false;

            // After all resizing has occurred, set menu bar height to
            // match application and make its top-level items full height
            this.MenuBar.AutoSize = false;
            this.MenuBar.Height   = Win32.GetSystemMetric(15); // SM_CYMENU
            this.MenuBar.Padding  = new Padding(0);
        }
 private void SaveToolbarPositions(Window window)
 {
     this.Toolbars = new List <ToolbarSettingItem>();
     for (int i = 0; i < _toolTray.Children.Count; i++)
     {
         DefaultToolbar tb = _toolTray.Children[i] as DefaultToolbar;
         Toolbars.Add(new ToolbarSettingItem(tb));
     }
     Save();
 }
		public new void SetTranslator(Translator trans)
		{
			base.SetTranslator(trans);

			m_Trans.Translate(ContextMenu.Items);
			m_Trans.Translate(m_ToolStripAttributeMenu.DropDownItems);

			Toolbars.Sort(m_ToolStripAttributeMenu.DropDownItems);

			// Toolbar translation handled by parent
		}
Esempio n. 10
0
        private void CreateToolbar()
        {
            var assembly = Assembly.GetExecutingAssembly();
            var images   = new Bitmap(assembly.GetManifestResourceStream("DayViewUIExtension.toolbar_std.bmp"));

            m_TBImageList                  = new ImageList();
            m_TBImageList.ImageSize        = new System.Drawing.Size(16, 16);
            m_TBImageList.TransparentColor = Color.Magenta;
            m_TBImageList.Images.AddStrip(images);

            m_Toolbar           = new ToolStrip();
            m_Toolbar.Anchor    = AnchorStyles.None;
            m_Toolbar.GripStyle = ToolStripGripStyle.Hidden;
            m_Toolbar.ImageList = m_TBImageList;

            if (DPIScaling.WantScaling())
            {
                int imageSize = DPIScaling.Scale(16);

                m_Toolbar.ImageScalingSize = new Size(imageSize, imageSize);
                m_Toolbar.AutoSize         = false;
                m_Toolbar.Height           = (imageSize + 10);
            }

            m_TBRenderer       = new UIThemeToolbarRenderer();
            m_Toolbar.Renderer = m_TBRenderer;

            var btn1 = new ToolStripButton();

            btn1.ImageIndex  = 0;
            btn1.Click      += new EventHandler(OnGoToToday);
            btn1.ToolTipText = m_Trans.Translate("Go to Today");
            m_Toolbar.Items.Add(btn1);

            var btn2 = new ToolStripButton();

            btn2.ImageIndex  = 1;
            btn2.Click      += new EventHandler(OnPreferences);
            btn2.ToolTipText = m_Trans.Translate("Preferences");
            m_Toolbar.Items.Add(btn2);

            var btn3 = new ToolStripButton();

            btn3.ImageIndex  = 2;
            btn3.Click      += new EventHandler(OnHelp);
            btn3.ToolTipText = m_Trans.Translate("Online Help");
            m_Toolbar.Items.Add(btn3);

            Toolbars.FixupButtonSizes(m_Toolbar);

            Controls.Add(m_Toolbar);
        }
Esempio n. 11
0
 private void ManagerPluginUnloaded(object sender, PluginEventArgs e)
 {
     if (Toolbars != null)
     {
         Toolbars.RemoveItemsForPlugin(e.Identity);
     }
     if (ViewType == MainViewType.Normal)
     {
         Menu.RemoveItemsForPlugin(e.Identity);
     }
     else
     {
     }
     DockPanels.RemoveItemsForPlugin(e.Identity);
     StatusBar.RemoveItemsForPlugin(e.Identity);
 }
        private void InitialiseToolbar()
        {
            m_TBRenderer = new UIThemeToolbarRenderer();
            m_TBRenderer.SetUITheme(new UITheme());
            m_TBRenderer.EnableDrawRowDividers(true);

            this.Toolbar.Renderer = m_TBRenderer;

            if (DPIScaling.WantScaling())
            {
                int imageSize = DPIScaling.Scale(16);
                this.Toolbar.ImageScalingSize = new System.Drawing.Size(imageSize, imageSize);
            }

            // Place this at the end to ensure the toolbar has finished its resize
            Toolbars.FixupButtonSizes(this.Toolbar);
        }
Esempio n. 13
0
        bool IPostBackDataHandler.LoadPostData(string postDataKey, NameValueCollection postCollection)
        {
            Page.Trace.Write(this.ID, "LoadPostData...");

            Toolbars.Clear();
            string[] toolbarsID = postCollection[UniqueID + "_toolbars"].Split(',');
            foreach (string toolbarID in toolbarsID)
            {
                if (toolbarID != string.Empty)
                {
                    //Toolbars.Add((Toolbar)Page.FindControl(toolbarID));

                    Control tool = Page.FindControl(toolbarID);
                    if (tool != null)
                    {
                        Toolbars.Add((Toolbar)tool);
                    }
                }
            }

            _toolbarsRenderedByOther = "";
            string containers = postCollection["Containers"];

            if (containers != null)
            {
                string[] containersID = containers.Split(',');
                foreach (string containerID in containersID)
                {
                    if (containerID != null && containerID != string.Empty && containerID != ID)
                    {
                        string toolbars = postCollection[containerID + "_toolbars"];
                        if (toolbars != null && toolbars != string.Empty)
                        {
                            toolbars = toolbars.TrimStart(',');
                            toolbars = toolbars.TrimEnd(',');

                            _toolbarsRenderedByOther += toolbars;
                            _toolbarsRenderedByOther += ",";
                        }
                    }
                }
            }
            _toolbarsRenderedByOther = _toolbarsRenderedByOther.TrimEnd(',');

            return(true);
        }
Esempio n. 14
0
        private void InitializeComponent()
        {
            InitialiseFeatures();

            this.ToolBar.Renderer = m_toolbarRenderer;
            this.ToolBar.Font     = m_ControlsFont;

            if (DPIScaling.WantScaling())
            {
                int imageSize = DPIScaling.Scale(16);

                this.ToolBar.ImageScalingSize     = new System.Drawing.Size(imageSize, imageSize);
                this.ContextMenu.ImageScalingSize = new System.Drawing.Size(imageSize, imageSize);
            }

            this.ToolbarDock    = DockStyle.Top;
            this.Anchor         = AnchorStyles.Left | AnchorStyles.Top | AnchorStyles.Right | AnchorStyles.Bottom;
            this.InnerText      = "";
            this.TabIndex       = 26;
            this.BorderStyle    = System.Windows.Forms.BorderStyle.None;
            this.BorderSize     = 0;
            this.NavigateAction = MSDN.Html.Editor.NavigateActionOption.NewWindow;
            this.ContentMargin  = 8;

            this.BrowserPanel.Anchor = AnchorStyles.None;             // we handle positioning ourselves

            m_Trans.Translate(ToolBar.Items);
            m_Trans.Translate(ContextMenu.Items);

            m_TextChangeTimer.Tick    += new EventHandler(OnTextChangeTimer);
            m_TextChangeTimer.Interval = 200;
            m_TextChangeTimer.Start();

            // Dynamic tooltip handling
            this.WebBrowser.Document.MouseOver += new HtmlElementEventHandler(OnDocumentMouseOver);

            // Place this at the end to ensure the toolbar has finished its resize
            Toolbars.FixupButtonSizes(this.ToolBar);
        }
Esempio n. 15
0
        private void CreateToolbar()
        {
            var assembly = Assembly.GetExecutingAssembly();
            var images   = new Bitmap(assembly.GetManifestResourceStream("DayViewUIExtension.toolbar_std.bmp"));

            m_TBImageList                  = new ImageList();
            m_TBImageList.ColorDepth       = ColorDepth.Depth32Bit;
            m_TBImageList.ImageSize        = new System.Drawing.Size(16, 16);
            m_TBImageList.TransparentColor = Color.Magenta;
            m_TBImageList.Images.AddStrip(images);

            m_Toolbar           = new IIControls.ToolStripEx();
            m_Toolbar.Anchor    = AnchorStyles.None;
            m_Toolbar.GripStyle = ToolStripGripStyle.Hidden;
            m_Toolbar.ImageList = m_TBImageList;

            int imageSize = DPIScaling.Scale(16);

            m_Toolbar.ImageScalingSize = new Size(imageSize, imageSize);
            m_Toolbar.Height           = (imageSize + 7); // MFC

            m_TBRenderer       = new UIThemeToolbarRenderer();
            m_Toolbar.Renderer = m_TBRenderer;

            var btn1 = new ToolStripButton();

            btn1.ImageIndex  = 0;
            btn1.Click      += new EventHandler(OnGoToToday);
            btn1.ToolTipText = m_Trans.Translate("Go to Today");
            m_Toolbar.Items.Add(btn1);

            m_Toolbar.Items.Add(new ToolStripSeparator());

            var btn2 = new ToolStripButton();

            btn2.Name        = "Show1DayView";
            btn2.ImageIndex  = 1;
            btn2.Click      += new EventHandler(OnShow1DayView);
            btn2.ToolTipText = m_Trans.Translate("1 Day View");
            m_Toolbar.Items.Add(btn2);

            var btn3 = new ToolStripButton();

            btn3.Name        = "Show3DayView";
            btn3.ImageIndex  = 2;
            btn3.Click      += new EventHandler(OnShow3DayView);
            btn3.ToolTipText = m_Trans.Translate("3 Day View");
            m_Toolbar.Items.Add(btn3);

            var btn4 = new ToolStripButton();

            btn4.Name        = "Show7DayView";
            btn4.ImageIndex  = 3;
            btn4.Click      += new EventHandler(OnShow7DayView);
            btn4.ToolTipText = m_Trans.Translate("7 Day View");
            m_Toolbar.Items.Add(btn4);

            var btn5 = new ToolStripButton();

            btn5.Name        = "Show14DayView";
            btn5.ImageIndex  = 4;
            btn5.Click      += new EventHandler(OnShow14DayView);
            btn5.ToolTipText = m_Trans.Translate("14 Day View");
            m_Toolbar.Items.Add(btn5);

            var btn6 = new ToolStripButton();

            btn6.Name        = "Show28DayView";
            btn6.ImageIndex  = 5;
            btn6.Click      += new EventHandler(OnShow28DayView);
            btn6.ToolTipText = m_Trans.Translate("28 Day View");
            m_Toolbar.Items.Add(btn6);

            m_Toolbar.Items.Add(new ToolStripSeparator());

            var btn9 = new ToolStripButton();

            btn9.ImageIndex  = 6;
            btn9.Click      += new EventHandler(OnPreferences);
            btn9.ToolTipText = m_Trans.Translate("Preferences");
            m_Toolbar.Items.Add(btn9);

            var btn10 = new ToolStripButton();

            btn10.ImageIndex  = 7;
            btn10.Click      += new EventHandler(OnHelp);
            btn10.ToolTipText = m_Trans.Translate("Online Help");
            m_Toolbar.Items.Add(btn10);

            Toolbars.FixupButtonSizes(m_Toolbar);

            Controls.Add(m_Toolbar);
        }
Esempio n. 16
0
        /// <summary>
        /// Opens XML file and creates toolbars/menus/submenus from XML tags.
        /// </summary>
        /// <param name="xmlFile">XML file containing menus/toolbars without user customizations.</param>
        /// <param name="xmlFileCustom">XML file containing user customizations. It will be created or updated when saving customizations.</param>
        /// <param name="tsRenderer"></param>
        public void BuildAll(string xmlFile, string xmlFileCustom, ToolStripRenderer tsRenderer = null)
        {
            Debug.Assert(_xStrips == null); if (_xStrips != null)
            {
                throw new InvalidOperationException();
            }

            _xmlFileDefault = xmlFile;
            _xmlFileCustom  = xmlFileCustom;
            try { _xStrips = AExtXml.LoadElem(xmlFile); }
            catch (Exception ex) { ADialog.ShowError("Failed to load file", ex.ToString()); throw; }
            XElement xCustom = null;

            if (AFile.ExistsAsFile(_xmlFileCustom))
            {
                try { xCustom = AExtXml.LoadElem(_xmlFileCustom); }
                catch (Exception e) { AOutput.Write("Failed to load file", _xmlFileCustom, e.Message); }
            }

            Size imageScalingSize = Au.Util.ADpi.SmallIconSize_;             //if high DPI, auto scale images

            //create top-level toolstrips (menu bar and toolbars), and call _AddChildItems to add items and create drop-down menus and submenus
            _inBuildAll = true;
            bool isMenu = true;

            foreach (var xe in _xStrips.Elements().ToArray())              //info: ToArray() because _MergeCustom replaces XML elements of custom toolbars
            {
                string name = xe.Name.LocalName;
                var    x    = xe;
                if (xCustom != null)
                {
                    _MergeCustom(xCustom, ref x, name, isMenu);
                }

                ToolStrip t;
                if (isMenu)
                {
                    t = MenuBar = new Util.AMenuStrip();
                }
                else
                {
                    var cts = new Util.AToolStrip();
                    Toolbars.Add(name, cts);
                    t = cts;
                    switch (name)
                    {
                    case "Custom1": _tsCustom1 = cts; break;

                    case "Custom2": _tsCustom2 = cts; break;
                    }
                }

                t.SuspendLayout();

                t.Tag  = x;
                t.Text = t.Name = name;
                //t.AllowItemReorder = true; //don't use, it's has bugs etc, we know better how to do it
                if (tsRenderer != null)
                {
                    t.Renderer = tsRenderer;
                }
                if (isMenu)
                {
                    t.Padding = new Padding();                     //remove menu bar paddings
                }
                else
                {
                }
                if (imageScalingSize.Height != 16)
                {
                    t.ImageScalingSize = imageScalingSize;                                               //info: all submenus will inherit it from menubar
                }
                _AddChildItems(x, t, isMenu);

                t.ResumeLayout(false);
                isMenu = false;
            }
            _inBuildAll = false;
        }