public DockPanel() { ShowAutoHideContentOnHover = true; m_focusManager = new FocusManagerImpl(this); m_panes = new DockPaneCollection(); m_floatWindows = new FloatWindowCollection(); Theme.Apply(this); SuspendLayout(); m_autoHideWindow = Theme.Extender.AutoHideWindowFactory.CreateAutoHideWindow(this); m_autoHideWindow.Visible = false; m_autoHideWindow.ActiveContentChanged += m_autoHideWindow_ActiveContentChanged; SetAutoHideWindowParent(); m_dummyControl = new DummyControl(); m_dummyControl.Bounds = new Rectangle(0, 0, 1, 1); Controls.Add(m_dummyControl); LoadDockWindows(); m_dummyContent = new DockContent(); ResumeLayout(); }
public override void OnInspectorGUI() { DrawDefaultInspector(); Theme theme = (Theme)target; if (GUILayout.Button("Apply Theme")) { theme.Apply(); } }
private void ExtensionsForm_Load(object sender, EventArgs e) { foreach (Extension extension in Program.Loader.Extensions) { var item = new ListViewItem(extension.Name); item.SubItems.AddRange(new[] { extension.Description, extension.Author }); listView.Items.Add(item); } Theme.Apply(this); }
/// <summary> /// Show the call tip. /// </summary> /// <param name="tip"></param> /// <param name="handlers"></param> /// <param name="position"></param> /// <param name="hint"></param> private void TipShow(ref CallTip tip, ShowTipEventHandler handlers, int position, object hint) { // create calltip class if (tip == null) { tip = new CallTip(); tip.Enter += new EventHandler(tip_MouseEnter); tip.SetChartIntervals(10, 0); Theme.Apply(tip); } // get screen position var rect = GetWordBounds(position); rect.Location = PointToScreen(rect.Location); rect.Inflate(3, 3); // Fore some reason PointToScreen can return // different positions. In this case the call // tip needs to be repositioned. if (!tip.Visible || tip.Location != rect.Location) { // invoke event hadlers var e = new ShowTipEventHandlerArgs(); e.TextPosition = position; e.Definition = hint; e.ScreenPosition = rect.Location; handlers?.Invoke(this, e); if (e.Cancle) { return; } // show calltip if (hint is string) { tip.Show(rect, (string)hint); } else if (hint is Array) { const int w = 500; var X = (Array)((Array)hint).GetValue(0); var Y = (Array)((Array)hint).GetValue(1); tip.Show(rect, X, Y, w, w * 0.6, ContentAlignment.TopLeft, 0.3, 0.3); } // make sure the calltip window // is in front of all others tip.BringToFront(); } }
private void ApplyTheme(FormSettings settings) { // load previous theme if (!Theme.Load(settings.ThemeXml)) { // save themes to xml Theme.LightTheme(); Theme.Save($"{Theme.Name}.xml", false); Theme.DarkTheme(); Theme.Save($"{Theme.Name}.xml", false); } Theme.Apply(this); }
public override bool FinishedLaunching(UIApplication application, NSDictionary launchOptions) { Window = new UIWindow(UIScreen.MainScreen.Bounds); new Setup(this, new MvxIosViewPresenter(this, Window)).Initialize(); Mvx.Resolve <IMvxAppStart>().Start(); Window.MakeKeyAndVisible(); Theme.Apply(); return(true); }
/// <summary> /// Update the theme depending on the current state of the control. /// </summary> public void UpdateTheme() { Theme theme = new Theme(); // Apply the applicable states, most important first. if (this.IsMouseDown) { theme.Apply(this.Theme.Active); } if (this.Control.IsMouseOver) { theme.Apply(this.Theme.Hover); } if (this.Control.IsKeyboardFocusWithin && this.FocusedByKeyboard) { theme.Apply(this.Theme.Focus); } if (this.IsChecked) { theme.Apply(this.Theme.Checked); } //this.ActiveTheme = theme.Apply(this.Theme); this.ActiveTheme = theme.Apply(this.Theme); this.ThemeStateChanged?.Invoke(this, new ThemeEventArgs(this.ActiveTheme)); // Update the brush used by a mono drawing image. if (this.DrawingBrush != null && this.ActiveTheme.Background.HasValue) { this.DrawingBrush.Color = this.ActiveTheme.Background.Value; } }
private void BackupsForm_Load(object sender, EventArgs e) { listView.Items.Clear(); foreach (Backup backup in Program.Backups) { var item = new ListViewItem(backup.Name) { Tag = backup }; item.SubItems.Add(backup.Date.ToShortDateString()); item.SubItems.Add($"{Math.Round(value: backup.Size / 1000, 2, MidpointRounding.ToEven)} KB"); listView.Items.Add(item); } Theme.Apply(this); }
public void Choose(Context context) { AlertDialog.Builder builder = new AlertDialog.Builder(context) .SetTitle("Select Theme") .SetPositiveButton(Android.Resource.String.Ok, delegate { Toast .MakeText(context, themes[selected], ToastLength.Short) .Show(); Theme tmpTheme = (Theme)Activator.CreateInstance(Theme.ChartThemes[selected]); tmpTheme.Apply(chart); }) .SetNegativeButton(Android.Resource.String.Cancel, CancelClicked); builder.SetSingleChoiceItems(themes, selected, (sender, args) => { selected = args.Which; }); builder.Create().Show(); }
/// <summary> /// This the main entry point for the app on iOS /// </summary> public override bool FinishedLaunching(UIApplication application, NSDictionary launchOptions) { //Create our window _window = new UIWindow(UIScreen.MainScreen.Bounds); //Register some services ServiceContainer.Register(_window); ServiceContainer.Register <ISynchronizeInvoke>(() => new SynchronizeInvoke()); ApplicationBehaviorDispatcher.PlatformSpecificProbingNamespace = typeof(NamespaceAnchor).Namespace; //Apply our UI theme Theme.Apply(_window); //Load our storyboard and setup our UIWindow and first view controller _storyboard = UIStoryboard.FromName("MainStoryboard", null); _window.RootViewController = (UIViewController)_storyboard.InstantiateInitialViewController(); _window.MakeKeyAndVisible(); Database.Initialize(); return(true); }
/// <summary> /// Add new tab. /// </summary> /// <param name="path"></param> private int AddTab(string path) { // load file var filename = path != null?Path.GetFileName(path) : "unnamed.tech"; var text = path != null?System.IO.File.ReadAllText(path) : "// Unnamed file"; // create new tab objects var tabSourcePage = new TabPage(); var editor = new CodeEditor(Properties.Resources.keywordsXML) { Filename = path }; editor.ShowCallTip += Editor_ShowCallTip; editor.CancleCallTip += Editor_CancleCallTip; editor.CustomMouseHover += Editor_MouseHover; editor.VScrollBar = false; editor.HScrollBar = false; // tabSourcePage Theme.Apply(tabSourcePage); tabSourcePage.Controls.Add(editor); tabSourcePage.Location = new Point(4, 31); tabSourcePage.TabIndex = 0; tabSourcePage.Text = filename; tabSourcePage.AllowDrop = true; // add tab tabSource.Controls.Add(tabSourcePage); tabSource.Refresh(); editor.PauseWatchChanges(); editor.Text = text; editor.ResumeWatchChanges(); editor.VScrollBar = true; editor.HScrollBar = true; return(tabSource.TabPages.Count - 1); }
public override bool FinishedLaunching(UIApplication application, NSDictionary launchOptions) { UISynchronizationContext.Current = SynchronizationContext.Current; _settings = AppSettingsUtil.LoadSettings(); InitializeVersion(); InitializeUserDefaults(); #if ADHOC || APPSTORE InitializeGAI(); #else AnalyticsService.IsOptOut = true; #endif AppSettingsUtil.HandleResetCache(_settings); Theme.Apply(); Window = new UIWindow(UIScreen.MainScreen.Bounds); var setup = new Setup(this, Window, _settings, _version); setup.Initialize(); var startup = Mvx.Resolve <IMvxAppStart>(); startup.Start(); NavBarManager.Instance.SetNativeHidden(true, false); NavBarManager.Instance.SetHidden(false, false); Window.MakeKeyAndVisible(); Mvx.Resolve <ICloudService>(); return(true); }
public static void Apply(string styleName) { theme.Apply(styleName); MessageBox.Show("hi"); }
private void Init(Icon icon, System.Drawing.Size minsize, System.Drawing.Size maxsize, System.Drawing.Point pos, string caption, string lname, Object callertag, bool closeicon, HorizontalAlignment?halign, ControlHelpersStaticFunc.VerticalAlignment?valign, AutoScaleMode asm) { this.logicalname = lname; // passed back to caller via trigger this.callertag = callertag; // passed back to caller via trigger this.halign = halign; this.valign = valign; this.minsize = minsize; // set min size window this.maxsize = maxsize; Theme theme = Theme.Current; System.Diagnostics.Debug.Assert(theme != null); FormBorderStyle = FormBorderStyle.FixedDialog; //outer = new ExtPanelScroll() { Dock = DockStyle.Fill, BorderStyle = BorderStyle.FixedSingle, Margin = new Padding(0), Padding = new Padding(0) }; outer = new ExtPanelScroll() { Name = "Outer", BorderStyle = PanelBorderStyle, Margin = new Padding(0), Padding = new Padding(0) }; outer.MouseDown += FormMouseDown; outer.MouseUp += FormMouseUp; Controls.Add(outer); ExtScrollBar scr = new ExtScrollBar(); scr.HideScrollBar = true; outer.Controls.Add(scr); this.Text = caption; int yoffset = 0; // adjustment to move controls up if windows frame present. if (theme.WindowsFrame && !ForceNoWindowsBorder) { yoffset = int.MaxValue; for (int i = 0; i < entries.Count; i++) // find minimum control Y { yoffset = Math.Min(yoffset, entries[i].pos.Y); } yoffset -= 8; // place X spaces below top } else { titlelabel = new Label() { Name = "title", Left = 4, Top = 8, Width = 10, Text = caption, AutoSize = true }; // autosize it, and set width small so it does not mess up the computation below titlelabel.MouseDown += FormMouseDown; titlelabel.MouseUp += FormMouseUp; titlelabel.Name = "title"; outer.Controls.Add(titlelabel); if (closeicon) { closebutton = new ExtButtonDrawn() { Name = "closebut", Size = new Size(18, 18), Location = new Point(0, 0) }; // purposely at top left to make it not contribute to overall size closebutton.ImageSelected = ExtButtonDrawn.ImageType.Close; closebutton.Click += (sender, f) => { if (!ProgClose) { Trigger?.Invoke(logicalname, "Close", callertag); } }; outer.Controls.Add(closebutton); // add now so it gets themed } } ToolTip tt = new ToolTip(components); tt.ShowAlways = true; for (int i = 0; i < entries.Count; i++) { Entry ent = entries[i]; Control c = ent.controltype != null ? (Control)Activator.CreateInstance(ent.controltype) : ent.control; ent.control = c; c.Size = ent.size; c.Location = new Point(ent.pos.X, ent.pos.Y - yoffset); c.Name = ent.controlname; if (!(ent.text == null || c is ExtendedControls.ExtComboBox || c is ExtendedControls.ExtDateTimePicker || c is ExtendedControls.NumberBoxDouble || c is ExtendedControls.NumberBoxLong)) // everything but get text { c.Text = ent.text; } c.Tag = ent; // point control tag at ent structure //System.Diagnostics.Debug.WriteLine("Control " + c.GetType().ToString() + " at " + c.Location + " " + c.Size + " " + c.Text); outer.Controls.Add(c); if (ent.tooltip != null) { tt.SetToolTip(c, ent.tooltip); } if (c is Label) { Label l = c as Label; if (ent.textalign.HasValue) { l.TextAlign = ent.textalign.Value; } l.MouseDown += (md1, md2) => { OnCaptionMouseDown((Control)md1, md2); }; // make em draggable l.MouseUp += (md1, md2) => { OnCaptionMouseUp((Control)md1, md2); }; } else if (c is ExtendedControls.ExtButton) { ExtendedControls.ExtButton b = c as ExtendedControls.ExtButton; if (ent.textalign.HasValue) { b.TextAlign = ent.textalign.Value; } b.Click += (sender, ev) => { if (!ProgClose) { Entry en = (Entry)(((Control)sender).Tag); Trigger?.Invoke(logicalname, en.controlname, this.callertag); // pass back the logical name of dialog, the name of the control, the caller tag } }; } else if (c is ExtendedControls.NumberBoxDouble) { ExtendedControls.NumberBoxDouble cb = c as ExtendedControls.NumberBoxDouble; cb.Minimum = ent.numberboxdoubleminimum; cb.Maximum = ent.numberboxdoublemaximum; double?v = ent.text.InvariantParseDoubleNull(); cb.Value = v.HasValue ? v.Value : cb.Minimum; if (ent.numberboxformat != null) { cb.Format = ent.numberboxformat; } cb.ReturnPressed += (box) => { SwallowReturn = false; if (!ProgClose) { Entry en = (Entry)(box.Tag); Trigger?.Invoke(logicalname, en.controlname + ":Return", this.callertag); // pass back the logical name of dialog, the name of the control, the caller tag } return(SwallowReturn); }; cb.ValidityChanged += (box, s) => { if (!ProgClose) { Entry en = (Entry)(box.Tag); Trigger?.Invoke(logicalname, en.controlname + ":Validity:" + s.ToString(), this.callertag); // pass back the logical name of dialog, the name of the control, the caller tag } }; } else if (c is ExtendedControls.NumberBoxLong) { ExtendedControls.NumberBoxLong cb = c as ExtendedControls.NumberBoxLong; cb.Minimum = ent.numberboxlongminimum; cb.Maximum = ent.numberboxlongmaximum; long?v = ent.text.InvariantParseLongNull(); cb.Value = v.HasValue ? v.Value : cb.Minimum; if (ent.numberboxformat != null) { cb.Format = ent.numberboxformat; } cb.ReturnPressed += (box) => { SwallowReturn = false; if (!ProgClose) { Entry en = (Entry)(box.Tag); Trigger?.Invoke(logicalname, en.controlname + ":Return", this.callertag); // pass back the logical name of dialog, the name of the control, the caller tag } return(SwallowReturn); }; cb.ValidityChanged += (box, s) => { if (!ProgClose) { Entry en = (Entry)(box.Tag); Trigger?.Invoke(logicalname, en.controlname + ":Validity:" + s.ToString(), this.callertag); // pass back the logical name of dialog, the name of the control, the caller tag } }; } else if (c is ExtendedControls.ExtTextBox) { ExtendedControls.ExtTextBox tb = c as ExtendedControls.ExtTextBox; tb.Multiline = tb.WordWrap = ent.textboxmultiline; tb.Size = ent.size; // restate size in case multiline is on tb.ClearOnFirstChar = ent.clearonfirstchar; tb.ReturnPressed += (box) => { SwallowReturn = false; if (!ProgClose) { Entry en = (Entry)(box.Tag); Trigger?.Invoke(logicalname, en.controlname + ":Return", this.callertag); // pass back the logical name of dialog, the name of the control, the caller tag } return(SwallowReturn); }; if (tb.ClearOnFirstChar) { tb.SelectEnd(); } } else if (c is ExtendedControls.ExtCheckBox) { ExtendedControls.ExtCheckBox cb = c as ExtendedControls.ExtCheckBox; cb.Checked = ent.checkboxchecked; cb.Click += (sender, ev) => { if (!ProgClose) { Entry en = (Entry)(((Control)sender).Tag); Trigger?.Invoke(logicalname, en.controlname, this.callertag); // pass back the logical name of dialog, the name of the control, the caller tag } }; } if (c is ExtendedControls.ExtDateTimePicker) { ExtendedControls.ExtDateTimePicker dt = c as ExtendedControls.ExtDateTimePicker; DateTime t; if (DateTime.TryParse(ent.text, System.Globalization.CultureInfo.InvariantCulture, System.Globalization.DateTimeStyles.AssumeLocal, out t)) // assume local, so no conversion { dt.Value = t; } switch (ent.customdateformat.ToLowerInvariant()) { case "short": dt.Format = DateTimePickerFormat.Short; break; case "long": dt.Format = DateTimePickerFormat.Long; break; case "time": dt.Format = DateTimePickerFormat.Time; break; default: dt.CustomFormat = ent.customdateformat; break; } } if (c is ExtendedControls.ExtComboBox) { ExtendedControls.ExtComboBox cb = c as ExtendedControls.ExtComboBox; cb.Items.AddRange(ent.comboboxitems.Split(',')); if (cb.Items.Contains(ent.text)) { cb.SelectedItem = ent.text; } cb.SelectedIndexChanged += (sender, ev) => { Control ctr = (Control)sender; if (ctr.Enabled && !ProgClose) { Entry en = (Entry)(ctr.Tag); Trigger?.Invoke(logicalname, en.controlname, this.callertag); // pass back the logical name of dialog, the name of the control, the caller tag } }; } } ShowInTaskbar = false; this.Icon = icon; this.AutoScaleMode = asm; // outer.FindMaxSubControlArea(0, 0,null,true); // debug //this.DumpTree(0); theme.Apply(this, theme.GetScaledFont(FontScale), ForceNoWindowsBorder); //theme.Apply(this, new Font("ms Sans Serif", 16f)); //this.DumpTree(0); if (Transparent) { TransparencyKey = BackColor; timer = new Timer(); // timer to monitor for entry into form when transparent.. only sane way in forms timer.Interval = 500; timer.Tick += CheckMouse; timer.Start(); } for (int i = 0; i < entries.Count; i++) // post scale any controls which ask for different font ratio sizes { if (entries[i].PostThemeFontScale != 1.0f) { entries[i].control.Font = new Font(entries[i].control.Font.Name, entries[i].control.Font.SizeInPoints * entries[i].PostThemeFontScale); } } // position StartPosition = FormStartPosition.Manual; this.Location = pos; //System.Diagnostics.Debug.WriteLine("Bounds " + Bounds + " ClientRect " + ClientRectangle); //System.Diagnostics.Debug.WriteLine("Outer Bounds " + outer.Bounds + " ClientRect " + outer.ClientRectangle); }
private void Accept(object sender, EventArgs e) { Theme.Apply(); Theme.Save(); }