public bool windowMatches(Window window) { bool passesTitle = false, passesStyle = false; if (window.Title.Glob(_title) && window.ClassName.Glob(_class)) { passesTitle = true; } if ((window.Style & _style) == _style) { passesStyle = true; } if (!_negative) { return (passesStyle && passesTitle); } return !(passesStyle && passesTitle); }
public bool Equals(Window other) { if (ReferenceEquals(null, other)) { return false; } if (ReferenceEquals(this, other)) { return true; } return other._handle.Equals(_handle); }
public static void DisownWindow(Window window) { window.Visible = true; _windowList.Remove(window); _handles.Remove(window.handle); window.ShowCaption = true; }
public static void Setup() { Taskbar.Hidden = true; bool settingsReadOnly = !Convert.ToBoolean(userSettingsOverride.ReadSettingOrDefault("false", "General.Main.AutoSave")); settings = new Settings("_runtimesettings", settingsReadOnly); settings.OverwriteWith(userSettingsOverride); setupWindowRules(); setupHotkeys(); setupLayouts(); setupMonitors(); setupTimers(); logger = new StreamWriter("log.txt"); Switcher = new WindowSwitcher(); _windowSwitcherWindow = new Window("", Switcher.Handle, "", "", false); Application.ApplicationExit += Application_ApplicationExit; Microsoft.Win32.SystemEvents.DisplaySettingsChanged += SystemEvents_DisplaySettingsChanged; }
public static void ForceUnhandle(Window window) { _windowList.Remove(window); _handles.Remove(window.handle); }
private void forceLocation() { Window thisWindow = new Window("", this.Handle, "", "", true); Rectangle rect = thisWindow.Location; rect.Height = barHeight; rect.Y = Screen.FromHandle(this.Handle).Bounds.Y; rect.Width = thisWindow.Screen.WorkingArea.Width; thisWindow.Maximised = false; thisWindow.Location = rect; if (_parent.Bar != null) { Rectangle temp = _parent.Screen.WorkingArea; temp.Height = _parent.Screen.Bounds.Height - _parent.Bar.BarHeight; temp.Y = _parent.Screen.Bounds.Top + _parent.Bar.BarHeight; temp.Width = _parent.Bar.Width; _parent.Controlled = temp; } }
public Bar(Monitor monitor) { InternalClosing = false; InitializeComponent(); barHeight = Convert.ToInt32(Manager.settings.ReadSettingOrDefault(15, "General.Bar.Height")); titleFont = new Font(Manager.settings.ReadSettingOrDefault("Segoe UI", "General.Bar.Font"), barHeight * 0.6f); boldFont = new Font(titleFont, FontStyle.Bold); foregroundBrush = new SolidBrush( Color.FromName(Manager.settings.ReadSettingOrDefault("Black", "General.Bar.UnselectedForeground"))); foregroundBrush2 = new SolidBrush( Color.FromName(Manager.settings.ReadSettingOrDefault("LightGray", "General.Bar.SelectedForeground"))); backgroundBrush = new SolidBrush( Color.FromName(Manager.settings.ReadSettingOrDefault("DarkGray", "General.Bar.SelectedItemColour"))); backgroundBrush2 = new SolidBrush( Color.FromName(Manager.settings.ReadSettingOrDefault("Black", "General.Bar.UnselectedBackgroundColour"))); selectedBrush = new SolidBrush(Color.FromArgb(128, Color.FromName(Manager.settings.ReadSettingOrDefault("White", "General.Bar.SelectedTagColour")))); coverBrush = new SolidBrush(Color.FromArgb( int.Parse(Manager.settings.ReadSettingOrDefault("128", "General.Bar.Inactive.Opacity")), Color.FromName(Manager.settings.ReadSettingOrDefault("Black", "General.Bar.Inactive.Colour")) )); Color seperatorColour = Color.FromName(Manager.settings.ReadSettingOrDefault("Blue", "General.Bar.SeperatorColour")); int seperatorWidth = int.Parse(Manager.settings.ReadSettingOrDefault("3", "General.Bar.SeperatorWidth")); seperatorPen = new Pen(seperatorColour, seperatorWidth); _screen = monitor.Screen; _parent = monitor; tagStyle = Manager.settings.ReadSettingOrDefault("numbers", _parent.SafeName, "Bar", "TagStyle"); this.StartPosition = FormStartPosition.Manual; this.Location = _screen.Bounds.Location; this.Width = _screen.Bounds.Width; this.Height = 10; this.FormBorderStyle = FormBorderStyle.None; this.DesktopLocation = this.Location; Color bColor = Color.FromName(Manager.settings.ReadSettingOrDefault("DarkGray", "General.Bar.BackColour")); this.BackColor = bColor; this.ShowInTaskbar = false; BarWindow = new Window("", this.Handle, "", "", true); loadPluginItems(); loadAdditionalItems(); generateMenu(); SystemEvents.SessionEnding += SystemEvents_SessionEnding; }
private void Bar_Load(object sender, EventArgs e) { Window thisWindow = new Window(this.Text, this.Handle, "", "", true); Rectangle rect = thisWindow.Location; rect.Height = barHeight; thisWindow.AsyncResizing = false; thisWindow.Location = rect; BarWindow = thisWindow; Manager.WindowFocusChange += Manager_WindowFocusChange; Timer t = new Timer(); t.Tick += (parent, args) => this.Redraw(); t.Interval = int.Parse(Manager.settings.ReadSettingOrDefault("10000", "General.Bar.Refresh")); t.Start(); int winStyles = (int) Win32API.GetWindowLong(this.Handle, Win32API.GWL_EXSTYLE); winStyles |= Win32API.WS_EX_TOOLWINDOW; Win32API.SetWindowLong(this.Handle, Win32API.GWL_EXSTYLE, winStyles); }
public Window ThrowWindow(Window window) { _windowList.Remove(window); return window; }
public Image GetLayoutSymbol(Size size) { List<Window> tempWindowList = new List<Window>(); for (int i = 0; i < 5; i++) { //5 seems like a good number Window tempWindow = new Window("", (IntPtr) i, "", "", true); //The window object will never /do/ anything so it doesn't need a real handle, just a unique one. tempWindowList.Add(tempWindow); } layout.UpdateWindowList(tempWindowList); Image layoutSymbol = layout.StateImage(size); layout.UpdateWindowList(_windowList); return layoutSymbol; }
public void CatchWindow(Window window) { if ((from monitor in Manager.monitors select monitor.Bar.BarWindow).Contains(window)) { return; //Don't take control of the Bar windows, that would be bad. } int stackPosition = Convert.ToInt32(Manager.settings.ReadSettingOrDefault(0, _parent.SafeName, "DefaultStackPosition")); foreach (KeyValuePair<WindowMatch, WindowRule> kvPair in Manager.windowRules) { if (kvPair.Key.windowMatches(window)) { if (kvPair.Value.rule == WindowRules.stack) { stackPosition = kvPair.Value.data; } } } if (stackPosition < 0) { stackPosition = _windowList.Count - stackPosition; } if (stackPosition > _windowList.Count) { stackPosition = _windowList.Count - 1; } if (stackPosition < 0) { stackPosition = 0; } _windowList.Insert(stackPosition, window); if (_parent.IsTagEnabled(tag)) { window.Visible = true; } }
public void CatchWindow(Window window) { Rectangle location = window.Location; location.X = Controlled.X; location.Y = Controlled.Y; window.Location = location; GetActiveScreen().CatchWindow(window); Bar.Redraw(); }