From d40fed5ce2bc806a91245adb18039634eac13ed0 Mon Sep 17 00:00:00 2001 From: MichaelTheShifter Date: Wed, 20 Jul 2016 09:40:36 -0400 Subject: Move ShiftUI source code to ShiftOS This'll be a lot easier to work on. --- source/ShiftUI/Theming/Default/.gitattributes | 5 + source/ShiftUI/Theming/Default/ButtonPainter.cs | 189 + source/ShiftUI/Theming/Default/CheckBoxPainter.cs | 357 + source/ShiftUI/Theming/Default/LabelPainter.cs | 57 + source/ShiftUI/Theming/Default/LinkLabelPainter.cs | 120 + .../ShiftUI/Theming/Default/RadioButtonPainter.cs | 239 + .../ShiftUI/Theming/Default/TabControlPainter.cs | 507 ++ source/ShiftUI/Theming/Default/ToolStripPainter.cs | 189 + source/ShiftUI/Theming/Nice/.gitattributes | 1 + source/ShiftUI/Theming/Nice/TabControlPainter.cs | 38 + source/ShiftUI/Theming/ShiftOS.cs | 118 + source/ShiftUI/Theming/ThemeElements.cs | 223 + source/ShiftUI/Theming/ThemeElementsClearlooks.cs | 35 + source/ShiftUI/Theming/ThemeElementsDefault.cs | 95 + source/ShiftUI/Theming/ThemeElementsGtk.cs | 35 + source/ShiftUI/Theming/ThemeElementsMemphis.cs | 86 + source/ShiftUI/Theming/ThemeElementsNice.cs | 43 + .../ShiftUI/Theming/ThemeElementsVisualStyles.cs | 59 + source/ShiftUI/Theming/ThemeEngine.cs | 62 + source/ShiftUI/Theming/ThemeSkinnable.cs | 8351 ++++++++++++++++++++ source/ShiftUI/Theming/ThemeVisualStyles.cs | 2162 +++++ source/ShiftUI/Theming/ThemeWin32Classic.cs | 7815 ++++++++++++++++++ .../Theming/VisualStyles/CheckBoxPainter.cs | 104 + .../Theming/VisualStyles/RadioButtonPainter.cs | 56 + .../Theming/VisualStyles/TabControlPainter.cs | 267 + .../Theming/VisualStyles/ToolStripPainter.cs | 213 + 26 files changed, 21426 insertions(+) create mode 100644 source/ShiftUI/Theming/Default/.gitattributes create mode 100644 source/ShiftUI/Theming/Default/ButtonPainter.cs create mode 100644 source/ShiftUI/Theming/Default/CheckBoxPainter.cs create mode 100644 source/ShiftUI/Theming/Default/LabelPainter.cs create mode 100644 source/ShiftUI/Theming/Default/LinkLabelPainter.cs create mode 100644 source/ShiftUI/Theming/Default/RadioButtonPainter.cs create mode 100644 source/ShiftUI/Theming/Default/TabControlPainter.cs create mode 100644 source/ShiftUI/Theming/Default/ToolStripPainter.cs create mode 100644 source/ShiftUI/Theming/Nice/.gitattributes create mode 100644 source/ShiftUI/Theming/Nice/TabControlPainter.cs create mode 100644 source/ShiftUI/Theming/ShiftOS.cs create mode 100644 source/ShiftUI/Theming/ThemeElements.cs create mode 100644 source/ShiftUI/Theming/ThemeElementsClearlooks.cs create mode 100644 source/ShiftUI/Theming/ThemeElementsDefault.cs create mode 100644 source/ShiftUI/Theming/ThemeElementsGtk.cs create mode 100644 source/ShiftUI/Theming/ThemeElementsMemphis.cs create mode 100644 source/ShiftUI/Theming/ThemeElementsNice.cs create mode 100644 source/ShiftUI/Theming/ThemeElementsVisualStyles.cs create mode 100644 source/ShiftUI/Theming/ThemeEngine.cs create mode 100644 source/ShiftUI/Theming/ThemeSkinnable.cs create mode 100644 source/ShiftUI/Theming/ThemeVisualStyles.cs create mode 100644 source/ShiftUI/Theming/ThemeWin32Classic.cs create mode 100644 source/ShiftUI/Theming/VisualStyles/CheckBoxPainter.cs create mode 100644 source/ShiftUI/Theming/VisualStyles/RadioButtonPainter.cs create mode 100644 source/ShiftUI/Theming/VisualStyles/TabControlPainter.cs create mode 100644 source/ShiftUI/Theming/VisualStyles/ToolStripPainter.cs (limited to 'source/ShiftUI/Theming') diff --git a/source/ShiftUI/Theming/Default/.gitattributes b/source/ShiftUI/Theming/Default/.gitattributes new file mode 100644 index 0000000..fdf3545 --- /dev/null +++ b/source/ShiftUI/Theming/Default/.gitattributes @@ -0,0 +1,5 @@ +/ButtonPainter.cs -crlf +/CheckBoxPainter.cs -crlf +/RadioButtonPainter.cs -crlf +/TabWidgetPainter.cs -crlf +/ToolStripPainter.cs -crlf diff --git a/source/ShiftUI/Theming/Default/ButtonPainter.cs b/source/ShiftUI/Theming/Default/ButtonPainter.cs new file mode 100644 index 0000000..366b17d --- /dev/null +++ b/source/ShiftUI/Theming/Default/ButtonPainter.cs @@ -0,0 +1,189 @@ +// Permission is hereby granted, free of charge, to any person obtaining +// a copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to +// permit persons to whom the Software is furnished to do so, subject to +// the following conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// +// Copyright (c) 2007 Novell, Inc. +// +// Authors: +// Andreia Gaita (avidigal@novell.com) + +using System; +using System.Drawing; + +namespace ShiftUI.Theming.Default +{ + /// + /// Summary description for Button. + /// + internal class ButtonPainter + { + public ButtonPainter () + { + + } + + protected SystemResPool ResPool { get { return ThemeEngine.Current.ResPool; } } + + #region Buttons + #region Standard Button + public virtual void Draw (Graphics g, Rectangle bounds, ButtonThemeState state, Color backColor, Color foreColor) { + bool is_themecolor = backColor.ToArgb () == ThemeEngine.Current.ColorControl.ToArgb () || backColor == Color.Empty ? true : false; + CPColor cpcolor = is_themecolor ? CPColor.Empty : ResPool.GetCPColor (backColor); + Pen pen; + + switch (state) { + case ButtonThemeState.Normal: + case ButtonThemeState.Entered: + case ButtonThemeState.Disabled: + pen = is_themecolor ? SystemPens.ControlLightLight : ResPool.GetPen (cpcolor.LightLight); + g.DrawLine (pen, bounds.X, bounds.Y, bounds.X, bounds.Bottom - 2); + g.DrawLine (pen, bounds.X + 1, bounds.Y, bounds.Right - 2, bounds.Y); + + pen = is_themecolor ? SystemPens.Control : ResPool.GetPen (backColor); + g.DrawLine (pen, bounds.X + 1, bounds.Y + 1, bounds.X + 1, bounds.Bottom - 3); + g.DrawLine (pen, bounds.X + 2, bounds.Y + 1, bounds.Right - 3, bounds.Y + 1); + + pen = is_themecolor ? SystemPens.ControlDark : ResPool.GetPen (cpcolor.Dark); + g.DrawLine (pen, bounds.X + 1, bounds.Bottom - 2, bounds.Right - 2, bounds.Bottom - 2); + g.DrawLine (pen, bounds.Right - 2, bounds.Y + 1, bounds.Right - 2, bounds.Bottom - 3); + + pen = is_themecolor ? SystemPens.ControlDarkDark : ResPool.GetPen (cpcolor.DarkDark); + g.DrawLine (pen, bounds.X, bounds.Bottom - 1, bounds.Right - 1, bounds.Bottom - 1); + g.DrawLine (pen, bounds.Right - 1, bounds.Y, bounds.Right - 1, bounds.Bottom - 2); + break; + case ButtonThemeState.Pressed: + g.DrawRectangle (ResPool.GetPen (foreColor), bounds.X, bounds.Y, bounds.Width - 1, bounds.Height - 1); + + bounds.Inflate (-1, -1); + pen = is_themecolor ? SystemPens.ControlDark : ResPool.GetPen (cpcolor.Dark); + g.DrawRectangle (pen, bounds.X, bounds.Y, bounds.Width - 1, bounds.Height - 1); + break; + case ButtonThemeState.Default: + g.DrawRectangle (ResPool.GetPen (foreColor), bounds.X, bounds.Y, bounds.Width - 1, bounds.Height - 1); + + bounds.Inflate (-1, -1); + pen = is_themecolor ? SystemPens.ControlLightLight : ResPool.GetPen (cpcolor.LightLight); + g.DrawLine (pen, bounds.X, bounds.Y, bounds.X, bounds.Bottom - 2); + g.DrawLine (pen, bounds.X + 1, bounds.Y, bounds.Right - 2, bounds.Y); + + pen = is_themecolor ? SystemPens.Control : ResPool.GetPen (backColor); + g.DrawLine (pen, bounds.X + 1, bounds.Y + 1, bounds.X + 1, bounds.Bottom - 3); + g.DrawLine (pen, bounds.X + 2, bounds.Y + 1, bounds.Right - 3, bounds.Y + 1); + + pen = is_themecolor ? SystemPens.ControlDark : ResPool.GetPen (cpcolor.Dark); + g.DrawLine (pen, bounds.X + 1, bounds.Bottom - 2, bounds.Right - 2, bounds.Bottom - 2); + g.DrawLine (pen, bounds.Right - 2, bounds.Y + 1, bounds.Right - 2, bounds.Bottom - 3); + + pen = is_themecolor ? SystemPens.ControlDarkDark : ResPool.GetPen (cpcolor.DarkDark); + g.DrawLine (pen, bounds.X, bounds.Bottom - 1, bounds.Right - 1, bounds.Bottom - 1); + g.DrawLine (pen, bounds.Right - 1, bounds.Y, bounds.Right - 1, bounds.Bottom - 2); + break; + } + } + #endregion + + #region FlatStyle Button + public virtual void DrawFlat (Graphics g, Rectangle bounds, ButtonThemeState state, Color backColor, Color foreColor, FlatButtonAppearance appearance) { + bool is_themecolor = backColor.ToArgb () == ThemeEngine.Current.ColorControl.ToArgb () || backColor == Color.Empty ? true : false; + CPColor cpcolor = is_themecolor ? CPColor.Empty : ResPool.GetCPColor (backColor); + Pen pen; + + switch (state) { + case ButtonThemeState.Normal: + case ButtonThemeState.Disabled: + // This will just use the BackColor + break; + case ButtonThemeState.Entered: + case ButtonThemeState.Default | ButtonThemeState.Entered: + if (appearance.MouseOverBackColor != Color.Empty) + g.FillRectangle (ResPool.GetSolidBrush (appearance.MouseOverBackColor), bounds); + else + g.FillRectangle (ResPool.GetSolidBrush (ChangeIntensity (backColor, .9F)), bounds); + break; + case ButtonThemeState.Pressed: + if (appearance.MouseDownBackColor != Color.Empty) + g.FillRectangle (ResPool.GetSolidBrush (appearance.MouseDownBackColor), bounds); + else + g.FillRectangle (ResPool.GetSolidBrush (ChangeIntensity (backColor, .95F)), bounds); + break; + case ButtonThemeState.Default: + if (appearance.CheckedBackColor != Color.Empty) + g.FillRectangle (ResPool.GetSolidBrush (appearance.CheckedBackColor), bounds); + break; + } + + if (appearance.BorderColor == Color.Empty) + pen = is_themecolor ? SystemPens.ControlDarkDark : ResPool.GetSizedPen (cpcolor.DarkDark, appearance.BorderSize); + else + pen = ResPool.GetSizedPen (appearance.BorderColor, appearance.BorderSize); + + bounds.Width -= 1; + bounds.Height -= 1; + + if (appearance.BorderSize > 0) + g.DrawRectangle (pen, bounds); + } + #endregion + + #region Popup Button + public virtual void DrawPopup (Graphics g, Rectangle bounds, ButtonThemeState state, Color backColor, Color foreColor) { + bool is_themecolor = backColor.ToArgb () == ThemeEngine.Current.ColorControl.ToArgb () || backColor == Color.Empty ? true : false; + CPColor cpcolor = is_themecolor ? CPColor.Empty : ResPool.GetCPColor (backColor); + Pen pen; + + switch (state) { + case ButtonThemeState.Normal: + case ButtonThemeState.Disabled: + case ButtonThemeState.Pressed: + case ButtonThemeState.Default: + pen = is_themecolor ? SystemPens.ControlDarkDark : ResPool.GetPen (cpcolor.DarkDark); + + bounds.Width -= 1; + bounds.Height -= 1; + g.DrawRectangle (pen, bounds); + + if (state == ButtonThemeState.Default || state == ButtonThemeState.Pressed) { + bounds.Inflate (-1, -1); + g.DrawRectangle (pen, bounds); + } + break; + case ButtonThemeState.Entered: + pen = is_themecolor ? SystemPens.ControlLightLight : ResPool.GetPen (cpcolor.LightLight); + g.DrawLine (pen, bounds.X, bounds.Y, bounds.X, bounds.Bottom - 2); + g.DrawLine (pen, bounds.X + 1, bounds.Y, bounds.Right - 2, bounds.Y); + + pen = is_themecolor ? SystemPens.ControlDark : ResPool.GetPen (cpcolor.Dark); + g.DrawLine (pen, bounds.X, bounds.Bottom - 1, bounds.Right - 1, bounds.Bottom - 1); + g.DrawLine (pen, bounds.Right - 1, bounds.Y, bounds.Right - 1, bounds.Bottom - 2); + break; + } + } + #endregion + #endregion + + private static Color ChangeIntensity (Color baseColor, float percent) + { + int H, I, S; + + WidgetPaint.Color2HBS (baseColor, out H, out I, out S); + int NewIntensity = Math.Min (255, (int)(I * percent)); + + return WidgetPaint.HBS2Color (H, NewIntensity, S); + } + } +} diff --git a/source/ShiftUI/Theming/Default/CheckBoxPainter.cs b/source/ShiftUI/Theming/Default/CheckBoxPainter.cs new file mode 100644 index 0000000..a759fbf --- /dev/null +++ b/source/ShiftUI/Theming/Default/CheckBoxPainter.cs @@ -0,0 +1,357 @@ +// Permission is hereby granted, free of charge, to any person obtaining +// a copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to +// permit persons to whom the Software is furnished to do so, subject to +// the following conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// +// Copyright (c) 2007 Novell, Inc. +// +// Authors: +// Jonathan Pobst (monkey@jpobst.com) + +using System; +using System.Drawing; +using System.Drawing.Drawing2D; + +namespace ShiftUI.Theming.Default +{ + /// + /// Summary description for Button. + /// + internal class CheckBoxPainter + { + public CheckBoxPainter () + { + } + + protected SystemResPool ResPool { get { return ThemeEngine.Current.ResPool; } } + + public void PaintCheckBox (Graphics g, Rectangle bounds, Color backColor, Color foreColor, ElementState state, FlatStyle style, CheckState checkState) + { + switch (style) { + case FlatStyle.Standard: + case FlatStyle.System: + switch (state) { + case ElementState.Normal: + DrawNormalCheckBox (g, bounds, backColor, foreColor, checkState); + break; + case ElementState.Hot: + DrawHotCheckBox (g, bounds, backColor, foreColor, checkState); + break; + case ElementState.Pressed: + DrawPressedCheckBox (g, bounds, backColor, foreColor, checkState); + break; + case ElementState.Disabled: + DrawDisabledCheckBox (g, bounds, backColor, foreColor, checkState); + break; + } + break; + case FlatStyle.Flat: + switch (state) { + case ElementState.Normal: + DrawFlatNormalCheckBox (g, bounds, backColor, foreColor, checkState); + break; + case ElementState.Hot: + DrawFlatHotCheckBox (g, bounds, backColor, foreColor, checkState); + break; + case ElementState.Pressed: + DrawFlatPressedCheckBox (g, bounds, backColor, foreColor, checkState); + break; + case ElementState.Disabled: + DrawFlatDisabledCheckBox (g, bounds, backColor, foreColor, checkState); + break; + } + break; + case FlatStyle.Popup: + switch (state) { + case ElementState.Normal: + DrawPopupNormalCheckBox (g, bounds, backColor, foreColor, checkState); + break; + case ElementState.Hot: + DrawPopupHotCheckBox (g, bounds, backColor, foreColor, checkState); + break; + case ElementState.Pressed: + DrawPopupPressedCheckBox (g, bounds, backColor, foreColor, checkState); + break; + case ElementState.Disabled: + DrawPopupDisabledCheckBox (g, bounds, backColor, foreColor, checkState); + break; + } + break; + } + } + + #region Standard + public virtual void DrawNormalCheckBox (Graphics g, Rectangle bounds, Color backColor, Color foreColor, CheckState state) + { + int check_box_visible_size = (bounds.Height > bounds.Width) ? bounds.Width : bounds.Height; + int x_pos = Math.Max (0, bounds.X + (bounds.Width / 2) - check_box_visible_size / 2); + int y_pos = Math.Max (0, bounds.Y + (bounds.Height / 2) - check_box_visible_size / 2); + + Rectangle rect = new Rectangle (x_pos, y_pos, check_box_visible_size, check_box_visible_size); + + g.FillRectangle (SystemBrushes.ControlLightLight, rect.X + 2, rect.Y + 2, rect.Width - 3, rect.Height - 3); + + Pen pen = SystemPens.ControlDark; + g.DrawLine (pen, rect.X, rect.Y, rect.X, rect.Bottom - 2); + g.DrawLine (pen, rect.X + 1, rect.Y, rect.Right - 2, rect.Y); + + pen = SystemPens.ControlDarkDark; + g.DrawLine (pen, rect.X + 1, rect.Y + 1, rect.X + 1, rect.Bottom - 3); + g.DrawLine (pen, rect.X + 2, rect.Y + 1, rect.Right - 3, rect.Y + 1); + + pen = SystemPens.ControlLightLight; + g.DrawLine (pen, rect.Right - 1, rect.Y, rect.Right - 1, rect.Bottom - 1); + g.DrawLine (pen, rect.X, rect.Bottom - 1, rect.Right - 1, rect.Bottom - 1); + + // oh boy, matching ms is like fighting against windmills + using (Pen h_pen = new Pen (ResPool.GetHatchBrush (HatchStyle.Percent50, + Color.FromArgb (Clamp (ColorControl.R + 3, 0, 255), + ColorControl.G, ColorControl.B), ColorControl))) { + g.DrawLine (h_pen, rect.X + 1, rect.Bottom - 2, rect.Right - 2, rect.Bottom - 2); + g.DrawLine (h_pen, rect.Right - 2, rect.Y + 1, rect.Right - 2, rect.Bottom - 2); + } + + if (state == CheckState.Checked) + DrawCheck (g, bounds, Color.Black); + else if (state == CheckState.Indeterminate) + DrawCheck (g, bounds, SystemColors.ControlDark); + } + + public virtual void DrawHotCheckBox (Graphics g, Rectangle bounds, Color backColor, Color foreColor, CheckState state) + { + DrawNormalCheckBox (g, bounds, backColor, foreColor, state); + } + + public virtual void DrawPressedCheckBox (Graphics g, Rectangle bounds, Color backColor, Color foreColor, CheckState state) + { + int check_box_visible_size = (bounds.Height > bounds.Width) ? bounds.Width : bounds.Height; + int x_pos = Math.Max (0, bounds.X + (bounds.Width / 2) - check_box_visible_size / 2); + int y_pos = Math.Max (0, bounds.Y + (bounds.Height / 2) - check_box_visible_size / 2); + + Rectangle rect = new Rectangle (x_pos, y_pos, check_box_visible_size, check_box_visible_size); + + g.FillRectangle (ResPool.GetHatchBrush (HatchStyle.Percent50, + Color.FromArgb (Clamp (ColorControl.R + 3, 0, 255), + ColorControl.G, ColorControl.B), + ColorControl), rect.X + 2, rect.Y + 2, rect.Width - 3, rect.Height - 3); + + Pen pen = SystemPens.ControlDark; + g.DrawLine (pen, rect.X, rect.Y, rect.X, rect.Bottom - 2); + g.DrawLine (pen, rect.X + 1, rect.Y, rect.Right - 2, rect.Y); + + pen = SystemPens.ControlDarkDark; + g.DrawLine (pen, rect.X + 1, rect.Y + 1, rect.X + 1, rect.Bottom - 3); + g.DrawLine (pen, rect.X + 2, rect.Y + 1, rect.Right - 3, rect.Y + 1); + + pen = SystemPens.ControlLightLight; + g.DrawLine (pen, rect.Right - 1, rect.Y, rect.Right - 1, rect.Bottom - 1); + g.DrawLine (pen, rect.X, rect.Bottom - 1, rect.Right - 1, rect.Bottom - 1); + + // oh boy, matching ms is like fighting against windmills + using (Pen h_pen = new Pen (ResPool.GetHatchBrush (HatchStyle.Percent50, + Color.FromArgb (Clamp (ColorControl.R + 3, 0, 255), + ColorControl.G, ColorControl.B), ColorControl))) { + g.DrawLine (h_pen, rect.X + 1, rect.Bottom - 2, rect.Right - 2, rect.Bottom - 2); + g.DrawLine (h_pen, rect.Right - 2, rect.Y + 1, rect.Right - 2, rect.Bottom - 2); + } + + if (state == CheckState.Checked) + DrawCheck (g, bounds, Color.Black); + else if (state == CheckState.Indeterminate) + DrawCheck (g, bounds, SystemColors.ControlDarkDark); + } + + public virtual void DrawDisabledCheckBox (Graphics g, Rectangle bounds, Color backColor, Color foreColor, CheckState state) + { + DrawPressedCheckBox (g, bounds, backColor, foreColor, CheckState.Unchecked); + + if (state == CheckState.Checked || state == CheckState.Indeterminate) + DrawCheck (g, bounds, SystemColors.ControlDark); + } + #endregion + + #region FlatStyle + public virtual void DrawFlatNormalCheckBox (Graphics g, Rectangle bounds, Color backColor, Color foreColor, CheckState state) + { + Rectangle checkbox_rectangle; + Rectangle fill_rectangle; + + // set up our rectangles first + // clip two pixels from bottom right for non popup rendered checkboxes + checkbox_rectangle = new Rectangle (bounds.X, bounds.Y, Math.Max (bounds.Width - 2, 0), Math.Max (bounds.Height - 2, 0)); + fill_rectangle = new Rectangle (checkbox_rectangle.X + 1, checkbox_rectangle.Y + 1, Math.Max (checkbox_rectangle.Width - 2, 0), Math.Max (checkbox_rectangle.Height - 2, 0)); + + g.FillRectangle (ResPool.GetSolidBrush (WidgetPaint.LightLight (backColor)), fill_rectangle); + WidgetPaint.DrawBorder (g, checkbox_rectangle, foreColor, ButtonBorderStyle.Solid); + + bounds.Offset (-1, 0); + + if (state == CheckState.Checked) + DrawCheck (g, bounds, Color.Black); + else if (state == CheckState.Indeterminate) + DrawCheck (g, bounds, SystemColors.ControlDarkDark); + } + + public virtual void DrawFlatHotCheckBox (Graphics g, Rectangle bounds, Color backColor, Color foreColor, CheckState state) + { + Rectangle checkbox_rectangle; + Rectangle fill_rectangle; + + // set up our rectangles first + // clip two pixels from bottom right for non popup rendered checkboxes + checkbox_rectangle = new Rectangle (bounds.X, bounds.Y, Math.Max (bounds.Width - 2, 0), Math.Max (bounds.Height - 2, 0)); + fill_rectangle = new Rectangle (checkbox_rectangle.X + 1, checkbox_rectangle.Y + 1, Math.Max (checkbox_rectangle.Width - 2, 0), Math.Max (checkbox_rectangle.Height - 2, 0)); + + g.FillRectangle (ResPool.GetSolidBrush (backColor), fill_rectangle); + WidgetPaint.DrawBorder (g, checkbox_rectangle, foreColor, ButtonBorderStyle.Solid); + + bounds.Offset (-1, 0); + + if (state == CheckState.Checked) + DrawCheck (g, bounds, Color.Black); + else if (state == CheckState.Indeterminate) + DrawCheck (g, bounds, SystemColors.ControlDarkDark); + } + + public virtual void DrawFlatPressedCheckBox (Graphics g, Rectangle bounds, Color backColor, Color foreColor, CheckState state) + { + DrawFlatNormalCheckBox (g, bounds, backColor, foreColor, state); + } + + public virtual void DrawFlatDisabledCheckBox (Graphics g, Rectangle bounds, Color backColor, Color foreColor, CheckState state) + { + Rectangle checkbox_rectangle; + + checkbox_rectangle = new Rectangle (bounds.X, bounds.Y, Math.Max (bounds.Width - 2, 0), Math.Max (bounds.Height - 2, 0)); + + WidgetPaint.DrawBorder (g, checkbox_rectangle, foreColor, ButtonBorderStyle.Solid); + + bounds.Offset (-1, 0); + + if (state == CheckState.Checked || state == CheckState.Indeterminate) + DrawCheck (g, bounds, SystemColors.ControlDarkDark); + } + #endregion + + #region Popup + public virtual void DrawPopupNormalCheckBox (Graphics g, Rectangle bounds, Color backColor, Color foreColor, CheckState state) + { + DrawFlatNormalCheckBox (g, bounds, backColor, foreColor, state); + } + + public virtual void DrawPopupHotCheckBox (Graphics g, Rectangle bounds, Color backColor, Color foreColor, CheckState state) + { + Rectangle checkbox_rectangle; + Rectangle fill_rectangle; + + // clip one pixel from bottom right for non popup rendered checkboxes + checkbox_rectangle = new Rectangle (bounds.X, bounds.Y, Math.Max (bounds.Width - 1, 0), Math.Max (bounds.Height - 1, 0)); + fill_rectangle = new Rectangle (checkbox_rectangle.X + 1, checkbox_rectangle.Y + 1, Math.Max (checkbox_rectangle.Width - 3, 0), Math.Max (checkbox_rectangle.Height - 3, 0)); + + g.FillRectangle (ResPool.GetSolidBrush (WidgetPaint.LightLight (backColor)), fill_rectangle); + + // draw sunken effect + ThemeEngine.Current.CPDrawBorder3D (g, checkbox_rectangle, Border3DStyle.SunkenInner, Border3DSide.Left | Border3DSide.Right | Border3DSide.Top | Border3DSide.Bottom, backColor); + + bounds.Offset (-1, 0); + + if (state == CheckState.Checked) + DrawCheck (g, bounds, Color.Black); + else if (state == CheckState.Indeterminate) + DrawCheck (g, bounds, SystemColors.ControlDarkDark); + } + + public virtual void DrawPopupPressedCheckBox (Graphics g, Rectangle bounds, Color backColor, Color foreColor, CheckState state) + { + Rectangle checkbox_rectangle; + Rectangle fill_rectangle; + + // clip one pixel from bottom right for non popup rendered checkboxes + checkbox_rectangle = new Rectangle (bounds.X, bounds.Y, Math.Max (bounds.Width - 1, 0), Math.Max (bounds.Height - 1, 0)); + fill_rectangle = new Rectangle (checkbox_rectangle.X + 1, checkbox_rectangle.Y + 1, Math.Max (checkbox_rectangle.Width - 3, 0), Math.Max (checkbox_rectangle.Height - 3, 0)); + + g.FillRectangle (ResPool.GetSolidBrush (backColor), fill_rectangle); + + // draw sunken effect + ThemeEngine.Current.CPDrawBorder3D (g, checkbox_rectangle, Border3DStyle.SunkenInner, Border3DSide.Left | Border3DSide.Right | Border3DSide.Top | Border3DSide.Bottom, backColor); + + bounds.Offset (-1, 0); + + if (state == CheckState.Checked) + DrawCheck (g, bounds, Color.Black); + else if (state == CheckState.Indeterminate) + DrawCheck (g, bounds, SystemColors.ControlDarkDark); + } + + public virtual void DrawPopupDisabledCheckBox (Graphics g, Rectangle bounds, Color backColor, Color foreColor, CheckState state) + { + DrawFlatDisabledCheckBox (g, bounds, backColor, foreColor, state); + } + #endregion + + #region Check + public virtual void DrawCheck (Graphics g, Rectangle bounds, Color checkColor) + { + int check_size = (bounds.Height > bounds.Width) ? bounds.Width / 2 : bounds.Height / 2; + + Pen check_pen = ResPool.GetPen (checkColor); + + if (check_size < 7) { + int lineWidth = Math.Max (3, check_size / 3); + int Scale = Math.Max (1, check_size / 9); + + Rectangle rect = new Rectangle (bounds.X + (bounds.Width / 2) - (check_size / 2) - 1, bounds.Y + (bounds.Height / 2) - (check_size / 2) - 1, + check_size, check_size); + + for (int i = 0; i < lineWidth; i++) { + g.DrawLine (check_pen, rect.Left + lineWidth / 2, rect.Top + lineWidth + i, rect.Left + lineWidth / 2 + 2 * Scale, rect.Top + lineWidth + 2 * Scale + i); + g.DrawLine (check_pen, rect.Left + lineWidth / 2 + 2 * Scale, rect.Top + lineWidth + 2 * Scale + i, rect.Left + lineWidth / 2 + 6 * Scale, rect.Top + lineWidth - 2 * Scale + i); + } + } else { + int lineWidth = Math.Max (3, check_size / 3) + 1; + + int x_half = bounds.Width / 2; + int y_half = bounds.Height / 2; + + Rectangle rect = new Rectangle (bounds.X + x_half - (check_size / 2) - 1, bounds.Y + y_half - (check_size / 2), + check_size, check_size); + + int gradient_left = check_size / 3; + int gradient_right = check_size - gradient_left - 1; + + for (int i = 0; i < lineWidth; i++) { + g.DrawLine (check_pen, rect.X, rect.Bottom - 1 - gradient_left - i, rect.X + gradient_left, rect.Bottom - 1 - i); + g.DrawLine (check_pen, rect.X + gradient_left, rect.Bottom - 1 - i, rect.Right - 1, rect.Bottom - i - 1 - gradient_right); + } + } + } + #endregion + + #region Private Methods + private int Clamp (int value, int lower, int upper) + { + if (value < lower) return lower; + else if (value > upper) return upper; + else return value; + } + + private Color ColorControl { + get { return SystemColors.Control; } + } + #endregion + } +} diff --git a/source/ShiftUI/Theming/Default/LabelPainter.cs b/source/ShiftUI/Theming/Default/LabelPainter.cs new file mode 100644 index 0000000..15ca995 --- /dev/null +++ b/source/ShiftUI/Theming/Default/LabelPainter.cs @@ -0,0 +1,57 @@ +// Permission is hereby granted, free of charge, to any person obtaining +// a copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to +// permit persons to whom the Software is furnished to do so, subject to +// the following conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// +// Copyright (c) 2007 Novell, Inc. +// +// Authors: +// Everaldo Canuto (ecanuto@novell.com) + +using System; +using System.Drawing; +using System.Drawing.Drawing2D; + +namespace ShiftUI.Theming.Default +{ + internal class LabelPainter + { + public LabelPainter () + { + } + + public virtual void Draw (Graphics dc, Rectangle client_rectangle, Label label) + { + Rectangle rect = label.PaddingClientRectangle; + + label.DrawImage (dc, label.Image, rect, label.ImageAlign); + + if (label.Enabled) { + dc.DrawString (label.Text, label.Font, + ThemeEngine.Current.ResPool.GetSolidBrush (label.ForeColor), + rect, label.string_format); + } else { + WidgetPaint.DrawStringDisabled ( + dc, label.Text, label.Font, label.BackColor, rect, label.string_format); + } + } + + public virtual Size DefaultSize { + get { return new Size (100, 23); } + } + } +} \ No newline at end of file diff --git a/source/ShiftUI/Theming/Default/LinkLabelPainter.cs b/source/ShiftUI/Theming/Default/LinkLabelPainter.cs new file mode 100644 index 0000000..6ac39a0 --- /dev/null +++ b/source/ShiftUI/Theming/Default/LinkLabelPainter.cs @@ -0,0 +1,120 @@ +// Permission is hereby granted, free of charge, to any person obtaining +// a copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to +// permit persons to whom the Software is furnished to do so, subject to +// the following conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// +// Copyright (c) 2007 Novell, Inc. +// +// Authors: +// Everaldo Canuto (ecanuto@novell.com) + +using System; +using System.Drawing; +using System.Drawing.Drawing2D; + +namespace ShiftUI.Theming.Default +{ + internal class LinkLabelPainter + { + public LinkLabelPainter () + { + } + + private Color GetPieceColor (LinkLabel label, LinkLabel.Piece piece, int i) + { + if (!label.Enabled) + return label.DisabledLinkColor; + + if (piece.link == null) + return label.ForeColor; + + if (!piece.link.Enabled) + return label.DisabledLinkColor; + + if (piece.link.Active) + return label.ActiveLinkColor; + + if ((label.LinkVisited && i == 0) || piece.link.Visited) + return label.VisitedLinkColor; + + return label.LinkColor; + } + + public virtual void Draw (Graphics dc, Rectangle clip_rectangle, LinkLabel label) + { + Rectangle client_rect = label.PaddingClientRectangle; + + label.DrawImage (dc, label.Image, client_rect, label.ImageAlign); + + if (label.pieces == null) + return; + + // Paint all text as disabled. + if (!label.Enabled) { + dc.SetClip (clip_rectangle); + ThemeEngine.Current.CPDrawStringDisabled ( + dc, label.Text, label.Font, label.BackColor, client_rect, label.string_format); + return; + } + + Font font, link_font = ThemeEngine.Current.GetLinkFont (label); + + Region text_region = new Region (new Rectangle()); + + // Draw links. + for (int i = 0; i < label.pieces.Length; i ++) { + LinkLabel.Piece piece = label.pieces[i]; + + if (piece.link == null) { + text_region.Union (piece.region); + continue; + } + + Color color = GetPieceColor (label, piece, i); + + if ( (label.LinkBehavior == LinkBehavior.AlwaysUnderline) || + (label.LinkBehavior == LinkBehavior.SystemDefault) || + ((label.LinkBehavior == LinkBehavior.HoverUnderline) && piece.link.Hovered) ) + font = link_font; + else + font = label.Font; + + dc.Clip = piece.region; + dc.Clip.Intersect (clip_rectangle); + dc.DrawString (label.Text, font, + ThemeEngine.Current.ResPool.GetSolidBrush (color), + client_rect, label.string_format); + + // Draw focus rectangle + if ((piece.link != null) && piece.link.Focused) { + foreach (RectangleF rect in piece.region.GetRegionScans (dc.Transform)) + WidgetPaint.DrawFocusRectangle (dc, Rectangle.Round (rect), label.ForeColor, label.BackColor); + } + } + + // Draw normal text (without links). + if (!text_region.IsEmpty (dc)) { + dc.Clip = text_region; + dc.Clip.Intersect (clip_rectangle); + if (!dc.Clip.IsEmpty (dc)) + dc.DrawString(label.Text, label.Font, + ThemeEngine.Current.ResPool.GetSolidBrush(label.ForeColor), + client_rect, label.string_format); + } + } + } +} \ No newline at end of file diff --git a/source/ShiftUI/Theming/Default/RadioButtonPainter.cs b/source/ShiftUI/Theming/Default/RadioButtonPainter.cs new file mode 100644 index 0000000..83885ed --- /dev/null +++ b/source/ShiftUI/Theming/Default/RadioButtonPainter.cs @@ -0,0 +1,239 @@ +// Permission is hereby granted, free of charge, to any person obtaining +// a copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to +// permit persons to whom the Software is furnished to do so, subject to +// the following conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// +// Copyright (c) 2007 Novell, Inc. +// +// Authors: +// Jonathan Pobst (monkey@jpobst.com) + +using System; +using System.Drawing; +using System.Drawing.Drawing2D; + +namespace ShiftUI.Theming.Default +{ + /// + /// Summary description for Button. + /// + internal class RadioButtonPainter + { + public RadioButtonPainter () + { + } + + protected SystemResPool ResPool { get { return ThemeEngine.Current.ResPool; } } + + public void PaintRadioButton (Graphics g, Rectangle bounds, Color backColor, Color foreColor, ElementState state, FlatStyle style, bool isChecked) + { + switch (style) { + case FlatStyle.Standard: + case FlatStyle.System: + switch (state) { + case ElementState.Normal: + DrawNormalRadioButton (g, bounds, backColor, foreColor, isChecked); + break; + case ElementState.Hot: + DrawHotRadioButton (g, bounds, backColor, foreColor, isChecked); + break; + case ElementState.Pressed: + DrawPressedRadioButton (g, bounds, backColor, foreColor, isChecked); + break; + case ElementState.Disabled: + DrawDisabledRadioButton (g, bounds, backColor, foreColor, isChecked); + break; + } + break; + case FlatStyle.Flat: + switch (state) { + case ElementState.Normal: + DrawFlatNormalRadioButton (g, bounds, backColor, foreColor, isChecked); + break; + case ElementState.Hot: + DrawFlatHotRadioButton (g, bounds, backColor, foreColor, isChecked); + break; + case ElementState.Pressed: + DrawFlatPressedRadioButton (g, bounds, backColor, foreColor, isChecked); + break; + case ElementState.Disabled: + DrawFlatDisabledRadioButton (g, bounds, backColor, foreColor, isChecked); + break; + } + break; + case FlatStyle.Popup: + switch (state) { + case ElementState.Normal: + DrawPopupNormalRadioButton (g, bounds, backColor, foreColor, isChecked); + break; + case ElementState.Hot: + DrawPopupHotRadioButton (g, bounds, backColor, foreColor, isChecked); + break; + case ElementState.Pressed: + DrawPopupPressedRadioButton (g, bounds, backColor, foreColor, isChecked); + break; + case ElementState.Disabled: + DrawPopupDisabledRadioButton (g, bounds, backColor, foreColor, isChecked); + break; + } + break; + } + } + + #region Standard + public virtual void DrawNormalRadioButton (Graphics g, Rectangle bounds, Color backColor, Color foreColor, bool isChecked) + { + ButtonState bs = ButtonState.Normal; + + if (isChecked) + bs |= ButtonState.Checked; + + WidgetPaint.DrawRadioButton (g, bounds, bs); + } + + public virtual void DrawHotRadioButton (Graphics g, Rectangle bounds, Color backColor, Color foreColor, bool isChecked) + { + DrawNormalRadioButton (g, bounds, backColor, foreColor, isChecked); + } + + public virtual void DrawPressedRadioButton (Graphics g, Rectangle bounds, Color backColor, Color foreColor, bool isChecked) + { + ButtonState bs = ButtonState.Pushed; + + if (isChecked) + bs |= ButtonState.Checked; + + WidgetPaint.DrawRadioButton (g, bounds, bs); + } + + public virtual void DrawDisabledRadioButton (Graphics g, Rectangle bounds, Color backColor, Color foreColor, bool isChecked) + { + ButtonState bs = ButtonState.Inactive; + + if (isChecked) + bs |= ButtonState.Checked; + + WidgetPaint.DrawRadioButton (g, bounds, bs); + } + #endregion + + #region FlatStyle + public virtual void DrawFlatNormalRadioButton (Graphics g, Rectangle bounds, Color backColor, Color foreColor, bool isChecked) + { + g.DrawArc (SystemPens.ControlDarkDark, bounds, 0, 359); + g.FillPie (SystemBrushes.ControlLightLight, bounds.X + 1, bounds.Y + 1, bounds.Width - 2, bounds.Height - 2, 0, 359); + + if (isChecked) + DrawFlatRadioGlyphDot (g, bounds, SystemColors.ControlDarkDark); + } + + public virtual void DrawFlatHotRadioButton (Graphics g, Rectangle bounds, Color backColor, Color foreColor, bool isChecked) + { + g.DrawArc (SystemPens.ControlDarkDark, bounds, 0, 359); + g.FillPie (SystemBrushes.ControlLight, bounds.X + 1, bounds.Y + 1, bounds.Width - 2, bounds.Height - 2, 0, 359); + + if (isChecked) + DrawFlatRadioGlyphDot (g, bounds, SystemColors.ControlDarkDark); + } + + public virtual void DrawFlatPressedRadioButton (Graphics g, Rectangle bounds, Color backColor, Color foreColor, bool isChecked) + { + g.DrawArc (SystemPens.ControlDarkDark, bounds, 0, 359); + g.FillPie (SystemBrushes.ControlLightLight, bounds.X + 1, bounds.Y + 1, bounds.Width - 2, bounds.Height - 2, 0, 359); + + if (isChecked) + DrawFlatRadioGlyphDot (g, bounds, SystemColors.ControlDarkDark); + } + + public virtual void DrawFlatDisabledRadioButton (Graphics g, Rectangle bounds, Color backColor, Color foreColor, bool isChecked) + { + g.FillPie (SystemBrushes.Control, bounds.X + 1, bounds.Y + 1, bounds.Width - 2, bounds.Height - 2, 0, 359); + g.DrawArc (SystemPens.ControlDark, bounds, 0, 359); + + if (isChecked) + DrawFlatRadioGlyphDot (g, bounds, SystemColors.ControlDark); + } + #endregion + + #region Popup + public virtual void DrawPopupNormalRadioButton (Graphics g, Rectangle bounds, Color backColor, Color foreColor, bool isChecked) + { + g.FillPie (SystemBrushes.ControlLightLight, bounds, 0, 359); + g.DrawArc (SystemPens.ControlDark, bounds, 0, 359); + + if (isChecked) + DrawFlatRadioGlyphDot (g, bounds, SystemColors.ControlDarkDark); + } + + public virtual void DrawPopupHotRadioButton (Graphics g, Rectangle bounds, Color backColor, Color foreColor, bool isChecked) + { + g.FillPie (SystemBrushes.ControlLightLight, bounds, 0, 359); + g.DrawArc (SystemPens.ControlLight, bounds.X + 1, bounds.Y + 1, bounds.Width - 2, bounds.Height - 2, 0, 359); + + g.DrawArc (SystemPens.ControlDark, bounds, 135, 180); + g.DrawArc (SystemPens.ControlLightLight, bounds, 315, 180); + + if (isChecked) + DrawFlatRadioGlyphDot (g, bounds, SystemColors.ControlDarkDark); + } + + public virtual void DrawPopupPressedRadioButton (Graphics g, Rectangle bounds, Color backColor, Color foreColor, bool isChecked) + { + g.FillPie (SystemBrushes.ControlLightLight, bounds, 0, 359); + g.DrawArc (SystemPens.ControlLight, bounds.X + 1, bounds.Y + 1, bounds.Width - 2, bounds.Height - 2, 0, 359); + + g.DrawArc (SystemPens.ControlDark, bounds, 135, 180); + g.DrawArc (SystemPens.ControlLightLight, bounds, 315, 180); + + if (isChecked) + DrawFlatRadioGlyphDot (g, bounds, SystemColors.ControlDarkDark); + } + + public virtual void DrawPopupDisabledRadioButton (Graphics g, Rectangle bounds, Color backColor, Color foreColor, bool isChecked) + { + g.FillPie (SystemBrushes.Control, bounds.X + 1, bounds.Y + 1, bounds.Width - 2, bounds.Height - 2, 0, 359); + g.DrawArc (SystemPens.ControlDark, bounds, 0, 359); + + if (isChecked) + DrawFlatRadioGlyphDot (g, bounds, SystemColors.ControlDarkDark); + } + #endregion + + #region Glyph + protected void DrawFlatRadioGlyphDot (Graphics g, Rectangle bounds, Color dotColor) + { + int lineWidth = Math.Max (1, Math.Min (bounds.Width, bounds.Height) / 3); + + Pen dot_pen = ResPool.GetPen (dotColor); + Brush dot_brush = ResPool.GetSolidBrush (dotColor); + + if (bounds.Height > 13) { + g.FillPie (dot_brush, bounds.X + lineWidth, bounds.Y + lineWidth, bounds.Width - lineWidth * 2, bounds.Height - lineWidth * 2, 0, 359); + } else { + int x_half_pos = (bounds.Width / 2) + bounds.X; + int y_half_pos = (bounds.Height / 2) + bounds.Y; + + g.DrawLine (dot_pen, x_half_pos - 1, y_half_pos, x_half_pos + 2, y_half_pos); + g.DrawLine (dot_pen, x_half_pos - 1, y_half_pos + 1, x_half_pos + 2, y_half_pos + 1); + + g.DrawLine (dot_pen, x_half_pos, y_half_pos - 1, x_half_pos, y_half_pos + 2); + g.DrawLine (dot_pen, x_half_pos + 1, y_half_pos - 1, x_half_pos + 1, y_half_pos + 2); + } + } + #endregion + } +} diff --git a/source/ShiftUI/Theming/Default/TabControlPainter.cs b/source/ShiftUI/Theming/Default/TabControlPainter.cs new file mode 100644 index 0000000..2ecdacd --- /dev/null +++ b/source/ShiftUI/Theming/Default/TabControlPainter.cs @@ -0,0 +1,507 @@ +// Permission is hereby granted, free of charge, to any person obtaining +// a copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to +// permit persons to whom the Software is furnished to do so, subject to +// the following conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// +// Copyright (c) 2007 Novell, Inc. +// +// Authors: +// Andreia Gaita (avidigal@novell.com) + +using System; +using System.Drawing; +using System.Drawing.Text; +using ShiftUI; +using ShiftUI.VisualStyles; + +namespace ShiftUI.Theming.Default +{ + /// + /// Summary description for TabWidget. + /// + internal class TabWidgetPainter { + protected SystemResPool ResPool { get { return ThemeEngine.Current.ResPool; } } + + #region private + + private Size defaultItemSize; + private Point defaultPadding; + private int minimumTabWidth; + private Rectangle selectedTabDelta; + + private Point tabPanelOffset; + + private int selectedSpacing; + + private Size rowSpacingNormal; + private Size rowSpacingButtons; + private Size rowSpacingFlatButtons; + private int scrollerWidth; + private Point focusRectSpacing; + private Rectangle tabPageSpacing; + private int colSpacing; + private int flatButtonSpacing; + + private Point imagePadding; + + private StringFormat defaultFormatting; + + private Rectangle borderThickness; + + #endregion + + #region Properties + + public virtual Size DefaultItemSize { + get { return defaultItemSize; } + set { defaultItemSize = value; } + } + + public virtual Point DefaultPadding { + get { return defaultPadding; } + set { defaultPadding = value; } + } + + public virtual int MinimumTabWidth { + get { return minimumTabWidth; } + set { minimumTabWidth = value; } + } + + public virtual Rectangle SelectedTabDelta { + get { return selectedTabDelta; } + set { selectedTabDelta = value; } + } + + public virtual Point TabPanelOffset { + get { return tabPanelOffset; } + set { tabPanelOffset = value; } + } + + public virtual int SelectedSpacing { + get { return selectedSpacing; } + set { selectedSpacing = value; } + } + + public virtual Size RowSpacingNormal { + get { return rowSpacingNormal; } + set { rowSpacingNormal = value; } + } + + public virtual Size RowSpacingButtons { + get { return rowSpacingButtons; } + set { rowSpacingButtons = value; } + } + + public virtual Size RowSpacingFlatButtons { + get { return rowSpacingFlatButtons; } + set { rowSpacingFlatButtons = value; } + } + + public virtual Point FocusRectSpacing { + get { return focusRectSpacing; } + set { focusRectSpacing = value; } + } + + public virtual int ColSpacing { + get { return colSpacing; } + set { colSpacing = value; } + } + + public virtual int FlatButtonSpacing { + get { return flatButtonSpacing; } + set { flatButtonSpacing = value; } + } + + public virtual Rectangle TabPageSpacing { + get { return tabPageSpacing; } + set { tabPageSpacing = value; } + } + + public virtual Point ImagePadding { + get { return imagePadding; } + set { imagePadding = value; } + } + + public virtual StringFormat DefaultFormatting { + get { return defaultFormatting; } + set { defaultFormatting = value; } + } + + public virtual Rectangle BorderThickness { + get { return borderThickness; } + set { borderThickness = value; } + } + + public virtual int ScrollerWidth { + get { return scrollerWidth; } + set { scrollerWidth = value; } + } + + public virtual Size RowSpacing (ShiftUI.TabWidget tab) { + switch (tab.Appearance) { + case TabAppearance.Normal: + return rowSpacingNormal; + case TabAppearance.Buttons: + return rowSpacingButtons; + case TabAppearance.FlatButtons: + return rowSpacingFlatButtons; + default: + throw new Exception ("Invalid Appearance value: " + tab.Appearance); + } + } + #endregion + + public TabWidgetPainter () + { + defaultItemSize = new Size (42, 16); + defaultPadding = new Point (6, 3); + selectedTabDelta = new Rectangle (2, 2, 4, 3); + selectedSpacing = 0; + + rowSpacingNormal = new Size (0, 0); + rowSpacingButtons = new Size (3, 3); + rowSpacingFlatButtons = new Size (9, 3); + + colSpacing = 0; + + minimumTabWidth = 42; + scrollerWidth = 17; + focusRectSpacing = new Point (2, 2); + tabPanelOffset = new Point (4, 0); + flatButtonSpacing = 8; + tabPageSpacing = new Rectangle (4, 2, 3, 4); + + imagePadding = new Point (2, 3); + + defaultFormatting = new StringFormat(); + // Horizontal Alignment is handled in the Draw method + defaultFormatting.Alignment = StringAlignment.Near; + defaultFormatting.LineAlignment = StringAlignment.Center; + defaultFormatting.FormatFlags = StringFormatFlags.NoWrap | StringFormatFlags.NoClip; + defaultFormatting.HotkeyPrefix = HotkeyPrefix.Show; + + borderThickness = new Rectangle (1, 1, 2, 2); + } + + public virtual Rectangle GetLeftScrollRect (ShiftUI.TabWidget tab) + { + switch (tab.Alignment) { + case TabAlignment.Top: + return new Rectangle (tab.ClientRectangle.Right - (scrollerWidth * 2), tab.ClientRectangle.Top + 1, scrollerWidth, scrollerWidth); + default: + Rectangle panel_rect = GetTabPanelRect (tab); + return new Rectangle (tab.ClientRectangle.Right - (scrollerWidth * 2), panel_rect.Bottom + 2, scrollerWidth, scrollerWidth); + } + } + + public virtual Rectangle GetRightScrollRect (ShiftUI.TabWidget tab) + { + switch (tab.Alignment) { + case TabAlignment.Top: + return new Rectangle (tab.ClientRectangle.Right - (scrollerWidth), tab.ClientRectangle.Top + 1, scrollerWidth, scrollerWidth); + default: + Rectangle panel_rect = GetTabPanelRect (tab); + return new Rectangle (tab.ClientRectangle.Right - (scrollerWidth), panel_rect.Bottom + 2, scrollerWidth, scrollerWidth); + } + } + + public Rectangle GetDisplayRectangle (ShiftUI.TabWidget tab) + { + Rectangle ext = GetTabPanelRect (tab); + // Account for border size + return new Rectangle (ext.Left + tabPageSpacing.X, ext.Top + tabPageSpacing.Y, + ext.Width - tabPageSpacing.X - tabPageSpacing.Width, ext.Height - tabPageSpacing.Y - tabPageSpacing.Height); + } + + public Rectangle GetTabPanelRect (ShiftUI.TabWidget tab) + { + // Offset the tab page (panel) from the top corner + Rectangle res = tab.ClientRectangle; + + if (tab.TabCount == 0) + return res; + + int spacing = RowSpacing (tab).Height; + int tabOffset = (tab.ItemSize.Height + spacing - selectedTabDelta.Height) * tab.RowCount + selectedTabDelta.Y; + switch (tab.Alignment) { + case TabAlignment.Top: + res.Y += tabOffset; + res.Height -= tabOffset; + break; + case TabAlignment.Bottom: + res.Height -= tabOffset; + break; + case TabAlignment.Left: + res.X += tabOffset; + res.Width -= tabOffset; + break; + case TabAlignment.Right: + res.Width -= tabOffset; + break; + } + + return res; + } + + public virtual void Draw (Graphics dc, Rectangle area, TabWidget tab) + { + DrawBackground (dc, area, tab); + + int start = 0; + int end = tab.TabPages.Count; + int delta = 1; + + if (tab.Alignment == TabAlignment.Top) { + start = end; + end = 0; + delta = -1; + } + + if (tab.SizeMode == TabSizeMode.Fixed) + defaultFormatting.Alignment = StringAlignment.Center; + else + defaultFormatting.Alignment = StringAlignment.Near; + + int counter = start; + for (; counter != end; counter += delta) { + for (int i = tab.SliderPos; i < tab.TabPages.Count; i++) { + if (i == tab.SelectedIndex) + continue; + if (counter != tab.TabPages[i].Row) + continue; + Rectangle rect = tab.GetTabRect (i); + if (!rect.IntersectsWith (area)) + continue; + DrawTab (dc, tab.TabPages[i], tab, rect, false); + } + } + + if (tab.SelectedIndex != -1 && tab.SelectedIndex >= tab.SliderPos) { + Rectangle rect = tab.GetTabRect (tab.SelectedIndex); + if (rect.IntersectsWith (area)) + DrawTab (dc, tab.TabPages[tab.SelectedIndex], tab, rect, true); + } + + if (tab.ShowSlider) { + Rectangle right = GetRightScrollRect (tab); + Rectangle left = GetLeftScrollRect (tab); + DrawScrollButton (dc, right, area, ScrollButton.Right, tab.RightSliderState); + DrawScrollButton (dc, left, area, ScrollButton.Left, tab.LeftSliderState); + } + } + + protected virtual void DrawScrollButton (Graphics dc, Rectangle bounds, Rectangle clippingArea, ScrollButton button, PushButtonState state) + { + WidgetPaint.DrawScrollButton (dc, bounds, button, GetButtonState (state)); + } + + static ButtonState GetButtonState (PushButtonState state) + { + switch (state) { + case PushButtonState.Pressed: + return ButtonState.Pushed; + default: + return ButtonState.Normal; + } + } + + protected virtual void DrawBackground (Graphics dc, Rectangle area, TabWidget tab) + { + Brush brush = SystemBrushes.Control; + dc.FillRectangle (brush, area); + Rectangle panel_rect = GetTabPanelRect (tab); + + if (tab.Appearance == TabAppearance.Normal) { + WidgetPaint.DrawBorder3D (dc, panel_rect, Border3DStyle.RaisedInner, Border3DSide.Left | Border3DSide.Top); + WidgetPaint.DrawBorder3D (dc, panel_rect, Border3DStyle.Raised, Border3DSide.Right | Border3DSide.Bottom); + } + } + + protected virtual int DrawTab (Graphics dc, ShiftUI.TabPage page, ShiftUI.TabWidget tab, Rectangle bounds, bool is_selected) + { + Rectangle interior; + int res = bounds.Width; + + dc.FillRectangle (ResPool.GetSolidBrush (tab.BackColor), bounds); + + if (tab.Appearance == TabAppearance.Buttons || tab.Appearance == TabAppearance.FlatButtons) { + // Separators + if (tab.Appearance == TabAppearance.FlatButtons) { + int width = bounds.Width; + bounds.Width += (flatButtonSpacing - 2); + res = bounds.Width; + if (tab.Alignment == TabAlignment.Top || tab.Alignment == TabAlignment.Bottom) + ThemeEngine.Current.CPDrawBorder3D (dc, bounds, Border3DStyle.Etched, Border3DSide.Right); + else + ThemeEngine.Current.CPDrawBorder3D (dc, bounds, Border3DStyle.Etched, Border3DSide.Top); + bounds.Width = width; + } + + if (is_selected) { + ThemeEngine.Current.CPDrawBorder3D (dc, bounds, Border3DStyle.Sunken, Border3DSide.Left | Border3DSide.Right | Border3DSide.Top | Border3DSide.Bottom); + } else if (tab.Appearance != TabAppearance.FlatButtons) { + ThemeEngine.Current.CPDrawBorder3D (dc, bounds, Border3DStyle.Raised, Border3DSide.Left | Border3DSide.Right | Border3DSide.Top | Border3DSide.Bottom); + } + + + } else { + CPColor cpcolor = ResPool.GetCPColor (tab.BackColor); + + Pen light = ResPool.GetPen (cpcolor.LightLight); + + switch (tab.Alignment) { + + case TabAlignment.Top: + + dc.DrawLine (light, bounds.Left, bounds.Bottom - 1, bounds.Left, bounds.Top + 3); + dc.DrawLine (light, bounds.Left, bounds.Top + 3, bounds.Left + 2, bounds.Top); + dc.DrawLine (light, bounds.Left + 2, bounds.Top, bounds.Right - 3, bounds.Top); + + dc.DrawLine (SystemPens.ControlDark, bounds.Right - 2, bounds.Top + 1, bounds.Right - 2, bounds.Bottom - 1); + dc.DrawLine (SystemPens.ControlDarkDark, bounds.Right - 2, bounds.Top + 1, bounds.Right - 1, bounds.Top + 2); + dc.DrawLine (SystemPens.ControlDarkDark, bounds.Right - 1, bounds.Top + 2, bounds.Right - 1, bounds.Bottom - 1); + break; + + case TabAlignment.Bottom: + + dc.DrawLine (light, bounds.Left, bounds.Top, bounds.Left, bounds.Bottom - 2); + dc.DrawLine (light, bounds.Left, bounds.Bottom - 2, bounds.Left + 3, bounds.Bottom); + + dc.DrawLine (SystemPens.ControlDarkDark, bounds.Left + 3, bounds.Bottom, bounds.Right - 3, bounds.Bottom); + dc.DrawLine (SystemPens.ControlDark, bounds.Left + 3, bounds.Bottom - 1, bounds.Right - 3, bounds.Bottom - 1); + + dc.DrawLine (SystemPens.ControlDark, bounds.Right - 2, bounds.Bottom - 1, bounds.Right - 2, bounds.Top + 1); + dc.DrawLine (SystemPens.ControlDarkDark, bounds.Right - 2, bounds.Bottom - 1, bounds.Right - 1, bounds.Bottom - 2); + dc.DrawLine (SystemPens.ControlDarkDark, bounds.Right - 1, bounds.Bottom - 2, bounds.Right - 1, bounds.Top + 1); + + break; + + case TabAlignment.Left: + + dc.DrawLine (light, bounds.Left - 2, bounds.Top, bounds.Right, bounds.Top); + dc.DrawLine (light, bounds.Left, bounds.Top + 2, bounds.Left - 2, bounds.Top); + dc.DrawLine (light, bounds.Left, bounds.Top + 2, bounds.Left, bounds.Bottom - 2); + + dc.DrawLine (SystemPens.ControlDark, bounds.Left, bounds.Bottom - 2, bounds.Left + 2, bounds.Bottom - 1); + + dc.DrawLine (SystemPens.ControlDark, bounds.Left + 2, bounds.Bottom - 1, bounds.Right, bounds.Bottom - 1); + dc.DrawLine (SystemPens.ControlDarkDark, bounds.Left + 2, bounds.Bottom, bounds.Right, bounds.Bottom); + + break; + + default: // TabAlignment.Right + + dc.DrawLine (light, bounds.Left, bounds.Top, bounds.Right - 3, bounds.Top); + dc.DrawLine (light, bounds.Right - 3, bounds.Top, bounds.Right, bounds.Top + 3); + + dc.DrawLine (SystemPens.ControlDark, bounds.Right - 1, bounds.Top + 1, bounds.Right - 1, bounds.Bottom - 1); + dc.DrawLine (SystemPens.ControlDark, bounds.Left, bounds.Bottom - 1, bounds.Right - 2, bounds.Bottom - 1); + + dc.DrawLine (SystemPens.ControlDarkDark, bounds.Right, bounds.Top + 3, bounds.Right, bounds.Bottom - 3); + dc.DrawLine (SystemPens.ControlDarkDark, bounds.Left, bounds.Bottom, bounds.Right - 3, bounds.Bottom); + + break; + } + } + + Point padding = tab.Padding; + interior = new Rectangle (bounds.Left + padding.X - 1, // substract a little offset + bounds.Top + padding.Y, + bounds.Width - (padding.X * 2), + bounds.Height - (padding.Y * 2)); + + if (tab.DrawMode == TabDrawMode.Normal && page.Text != null) { + if (tab.Alignment == TabAlignment.Left) { + dc.TranslateTransform (bounds.Left, bounds.Bottom); + dc.RotateTransform (-90); + dc.DrawString (page.Text, tab.Font, + SystemBrushes.ControlText, + tab.Padding.X - 2, // drawstring adds some extra unwanted leading spaces, so trimming + tab.Padding.Y, + defaultFormatting); + dc.ResetTransform (); + } else if (tab.Alignment == TabAlignment.Right) { + dc.TranslateTransform (bounds.Right, bounds.Top); + dc.RotateTransform (90); + dc.DrawString (page.Text, tab.Font, + SystemBrushes.ControlText, + tab.Padding.X - 2, // drawstring adds some extra unwanted leading spaces, so trimming + tab.Padding.Y, + defaultFormatting); + dc.ResetTransform (); + } else { + Rectangle str_rect = interior; + + if (is_selected) { + // Reduce the interior size to match the inner size of non-selected tabs + str_rect.X += selectedTabDelta.X; + str_rect.Y += selectedTabDelta.Y; + str_rect.Width -= selectedTabDelta.Width; + str_rect.Height -= selectedTabDelta.Height; + + str_rect.Y -= selectedTabDelta.Y; // Move up the text / image of the selected tab + } + + if (tab.ImageList != null && page.ImageIndex >= 0 && page.ImageIndex < tab.ImageList.Images.Count) { + int image_x; + if (tab.SizeMode != TabSizeMode.Fixed) { + image_x = str_rect.X; + } + else { + image_x = str_rect.X + (str_rect.Width - tab.ImageList.ImageSize.Width) / 2; + if (page.Text != null) { + SizeF textSize = dc.MeasureString(page.Text, page.Font, str_rect.Size); + image_x -= (int)(textSize.Width / 2); + } + } + int image_y = str_rect.Y + (str_rect.Height - tab.ImageList.ImageSize.Height) / 2; + tab.ImageList.Draw (dc, new Point (image_x, image_y), page.ImageIndex); + str_rect.X += tab.ImageList.ImageSize.Width + 2; + str_rect.Width -= tab.ImageList.ImageSize.Width + 2; + } + dc.DrawString (page.Text, tab.Font, + SystemBrushes.ControlText, + str_rect, + defaultFormatting); + + } + } else if (page.Text != null) { + DrawItemState state = DrawItemState.None; + if (page == tab.SelectedTab) + state |= DrawItemState.Selected; + DrawItemEventArgs e = new DrawItemEventArgs (dc, + tab.Font, bounds, tab.IndexForTabPage (page), + state, page.ForeColor, page.BackColor); + tab.OnDrawItemInternal (e); + return res; + } + + // TabWidget ignores the value of ShowFocusCues + if (page.Parent.Focused && is_selected) { + Rectangle focus_rect = bounds; + focus_rect.Inflate (-2, -2); + ThemeEngine.Current.CPDrawFocusRectangle (dc, focus_rect, tab.BackColor, tab.ForeColor); + } + + return res; + } + + public virtual bool HasHotElementStyles (TabWidget tabWidget) { + return false; + } + } +} diff --git a/source/ShiftUI/Theming/Default/ToolStripPainter.cs b/source/ShiftUI/Theming/Default/ToolStripPainter.cs new file mode 100644 index 0000000..4876dd5 --- /dev/null +++ b/source/ShiftUI/Theming/Default/ToolStripPainter.cs @@ -0,0 +1,189 @@ +// Permission is hereby granted, free of charge, to any person obtaining +// a copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to +// permit persons to whom the Software is furnished to do so, subject to +// the following conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// +// Copyright (c) 2007 Novell, Inc. +// +// Authors: +// Jonathan Pobst (monkey@jpobst.com) + +using System; +using System.Drawing; + +namespace ShiftUI.Theming.Default +{ + internal class ToolStripPainter + { + public ToolStripPainter () + { + } + + protected SystemResPool ResPool { get { return ThemeEngine.Current.ResPool; } } + + #region Painting + public virtual void OnRenderButtonBackground (ToolStripItemRenderEventArgs e) + { + if (e.Item.Enabled == false) + return; + + Rectangle paint_here = new Rectangle (0, 0, e.Item.Width, e.Item.Height); + + ToolStripButton tsb = e.Item as ToolStripButton; + + if (e.Item.Pressed || (tsb != null && tsb.Checked)) + WidgetPaint.DrawBorder3D (e.Graphics, paint_here, Border3DStyle.SunkenOuter); + else if (e.Item.Selected) + WidgetPaint.DrawBorder3D (e.Graphics, paint_here, Border3DStyle.RaisedInner); + else if (e.Item.BackColor != Widget.DefaultBackColor && e.Item.BackColor != Color.Empty) + e.Graphics.FillRectangle (ResPool.GetSolidBrush (e.Item.BackColor), paint_here); + } + + public virtual void OnRenderDropDownButtonBackground (ToolStripItemRenderEventArgs e) + { + if (e.Item.Enabled == false) + return; + + Rectangle paint_here = new Rectangle (0, 0, e.Item.Width, e.Item.Height); + + if (e.Item.Pressed) + WidgetPaint.DrawBorder3D (e.Graphics, paint_here, Border3DStyle.SunkenOuter); + else if (e.Item.Selected) + WidgetPaint.DrawBorder3D (e.Graphics, paint_here, Border3DStyle.RaisedInner); + else if (e.Item.BackColor != Widget.DefaultBackColor && e.Item.BackColor != Color.Empty) + e.Graphics.FillRectangle (ResPool.GetSolidBrush (e.Item.BackColor), paint_here); + } + + public virtual void OnRenderGrip (ToolStripGripRenderEventArgs e) + { + if (e.GripStyle == ToolStripGripStyle.Hidden) + return; + + if (e.GripDisplayStyle == ToolStripGripDisplayStyle.Vertical) { + e.Graphics.DrawLine (Pens.White, 0, 2, 1, 2); + e.Graphics.DrawLine (Pens.White, 0, 2, 0, e.GripBounds.Height - 3); + e.Graphics.DrawLine (SystemPens.ControlDark, 2, 2, 2, e.GripBounds.Height - 3); + e.Graphics.DrawLine (SystemPens.ControlDark, 2, e.GripBounds.Height - 3, 0, e.GripBounds.Height - 3); + } + else { + e.Graphics.DrawLine (Pens.White, 2, 0, e.GripBounds.Width - 3, 0); + e.Graphics.DrawLine (Pens.White, 2, 0, 2, 1); + e.Graphics.DrawLine (SystemPens.ControlDark, e.GripBounds.Width - 3, 0, e.GripBounds.Width - 3, 2); + e.Graphics.DrawLine (SystemPens.ControlDark, 2, 2, e.GripBounds.Width - 3, 2); + } + } + + public virtual void OnRenderMenuItemBackground (ToolStripItemRenderEventArgs e) + { + ToolStripMenuItem tsmi = (ToolStripMenuItem)e.Item; + Rectangle paint_here = new Rectangle (Point.Empty, tsmi.Size); + + if (tsmi.IsOnDropDown) { + // Drop down menu item + if (e.Item.Selected || e.Item.Pressed) + e.Graphics.FillRectangle (SystemBrushes.Highlight, paint_here); + } else { + // Top level menu item + if (e.Item.Pressed) + WidgetPaint.DrawBorder3D (e.Graphics, paint_here, Border3DStyle.SunkenOuter); + else if (e.Item.Selected) + WidgetPaint.DrawBorder3D (e.Graphics, paint_here, Border3DStyle.RaisedInner); + else if (e.Item.BackColor != Widget.DefaultBackColor && e.Item.BackColor != Color.Empty) + e.Graphics.FillRectangle (ResPool.GetSolidBrush (e.Item.BackColor), paint_here); + } + } + + public virtual void OnRenderOverflowButtonBackground (ToolStripItemRenderEventArgs e) + { + Rectangle paint_here = new Rectangle (Point.Empty, e.Item.Size); + + if (e.Item.Pressed) + WidgetPaint.DrawBorder3D (e.Graphics, paint_here, Border3DStyle.SunkenOuter); + else if (e.Item.Selected) + WidgetPaint.DrawBorder3D (e.Graphics, paint_here, Border3DStyle.RaisedInner); + else if (e.Item.BackColor != Widget.DefaultBackColor && e.Item.BackColor != Color.Empty) + e.Graphics.FillRectangle (ResPool.GetSolidBrush (e.Item.BackColor), paint_here); + + // Paint the arrow + ToolStripRenderer.DrawDownArrow (e.Graphics, SystemPens.ControlText, e.Item.Width / 2 - 3, e.Item.Height / 2 - 1); + } + + public virtual void OnRenderSeparator (ToolStripSeparatorRenderEventArgs e) + { + if (e.Vertical) { + e.Graphics.DrawLine (Pens.White, 4, 3, 4, e.Item.Height - 1); + e.Graphics.DrawLine (SystemPens.ControlDark, 3, 3, 3, e.Item.Height - 1); + } else { + if (!e.Item.IsOnDropDown) { + e.Graphics.DrawLine (Pens.White, 2, 4, e.Item.Right - 1, 4); + e.Graphics.DrawLine (SystemPens.ControlDark, 2, 3, e.Item.Right - 1, 3); + } else { + e.Graphics.DrawLine (Pens.White, 3, 4, e.Item.Right - 4, 4); + e.Graphics.DrawLine (SystemPens.ControlDark, 3, 3, e.Item.Right - 4, 3); + } + } + } + + public virtual void OnRenderSplitButtonBackground (ToolStripItemRenderEventArgs e) + { + ToolStripSplitButton tssb = (ToolStripSplitButton)e.Item; + + Rectangle button_part = new Rectangle (Point.Empty, tssb.ButtonBounds.Size); + Point drop_start = new Point (tssb.Width - tssb.DropDownButtonBounds.Width, 0); + Rectangle drop_part = new Rectangle (drop_start, tssb.DropDownButtonBounds.Size); + + // Regular button part + if (tssb.ButtonPressed) + WidgetPaint.DrawBorder3D (e.Graphics, button_part, Border3DStyle.SunkenOuter); + else if (tssb.ButtonSelected) + WidgetPaint.DrawBorder3D (e.Graphics, button_part, Border3DStyle.RaisedInner); + else if (e.Item.BackColor != Widget.DefaultBackColor && e.Item.BackColor != Color.Empty) + e.Graphics.FillRectangle (ResPool.GetSolidBrush (e.Item.BackColor), button_part); + + // Drop down button part + if (tssb.DropDownButtonPressed || tssb.ButtonPressed) + WidgetPaint.DrawBorder3D (e.Graphics, drop_part, Border3DStyle.SunkenOuter); + else if (tssb.DropDownButtonSelected || tssb.ButtonSelected) + WidgetPaint.DrawBorder3D (e.Graphics, drop_part, Border3DStyle.RaisedInner); + else if (e.Item.BackColor != Widget.DefaultBackColor && e.Item.BackColor != Color.Empty) + e.Graphics.FillRectangle (ResPool.GetSolidBrush (e.Item.BackColor), drop_part); + } + + public virtual void OnRenderToolStripBackground (ToolStripRenderEventArgs e) + { + if (e.ToolStrip.BackgroundImage == null) + e.Graphics.Clear (e.BackColor); + + if (e.ToolStrip is StatusStrip) + e.Graphics.DrawLine (Pens.White, e.AffectedBounds.Left, e.AffectedBounds.Top, e.AffectedBounds.Right, e.AffectedBounds.Top); + } + + public virtual void OnRenderToolStripBorder (ToolStripRenderEventArgs e) + { + if (e.ToolStrip is StatusStrip) + return; + + if (e.ToolStrip is ToolStripDropDown) + WidgetPaint.DrawBorder3D (e.Graphics, e.AffectedBounds, Border3DStyle.Raised); + else { + e.Graphics.DrawLine (SystemPens.ControlDark, new Point (e.ToolStrip.Left, e.ToolStrip.Height - 2), new Point (e.ToolStrip.Right, e.ToolStrip.Height - 2)); + e.Graphics.DrawLine (Pens.White, new Point (e.ToolStrip.Left, e.ToolStrip.Height - 1), new Point (e.ToolStrip.Right, e.ToolStrip.Height - 1)); + } + } + #endregion + } +} diff --git a/source/ShiftUI/Theming/Nice/.gitattributes b/source/ShiftUI/Theming/Nice/.gitattributes new file mode 100644 index 0000000..2ea73f7 --- /dev/null +++ b/source/ShiftUI/Theming/Nice/.gitattributes @@ -0,0 +1 @@ +/TabWidgetPainter.cs -crlf diff --git a/source/ShiftUI/Theming/Nice/TabControlPainter.cs b/source/ShiftUI/Theming/Nice/TabControlPainter.cs new file mode 100644 index 0000000..17b71db --- /dev/null +++ b/source/ShiftUI/Theming/Nice/TabControlPainter.cs @@ -0,0 +1,38 @@ +// Permission is hereby granted, free of charge, to any person obtaining +// a copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to +// permit persons to whom the Software is furnished to do so, subject to +// the following conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// +// Copyright (c) 2007 Novell, Inc. +// +// Authors: +// Andreia Gaita (avidigal@novell.com) + +using System; +using System.Drawing; +using ShiftUI; + +namespace ShiftUI.Theming.Nice +{ + /// + /// Summary description for TabWidget. + /// + internal class TabWidgetPainter: Default.TabWidgetPainter + { + + } +} diff --git a/source/ShiftUI/Theming/ShiftOS.cs b/source/ShiftUI/Theming/ShiftOS.cs new file mode 100644 index 0000000..1cc00e1 --- /dev/null +++ b/source/ShiftUI/Theming/ShiftOS.cs @@ -0,0 +1,118 @@ +using System; +using System.Collections.Generic; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ShiftUI.ShiftOS +{ + public abstract class Skin + { + #region Button + public int ButtonBorderWidth = 2; + public Color ButtonBorderColor = Color.Black; + public Color ButtonBackColor = Color.White; + public Color ButtonBackColor_Pressed = Color.Gray; + #endregion + + #region Global + public string DefaultFont = "Microsoft Sans Serif"; + public int DefaultFontSize = 9; + public FontStyle DefaultFontStyle = FontStyle.Regular; + public Color WindowBackColor = Color.Gray; + public Color DefaultForeColor = Color.Black; + #endregion + + #region ScrollBar + public int ScrollbarWidth = 24; + #endregion + + #region 3D borders + public Color Border3DTopLeftInner = Color.LightGray; + public Color Border3DBottomRight = Color.DarkGray; + public Color Border3DBottomRightInner = Color.Gray; + #endregion + + #region MessageBox + public Color MessageBox_BottomPanel = Color.Gray; + #endregion + + #region ProgressBar + + public Color ProgressBar_BackgroundColor = Color.Gray; + public Color ProgressBar_BlockColor = Color.Black; + + #endregion + + // No reason to have ShiftOS deal with window borders itself + // when I can do it inside ShiftUI. + #region Form + public int titlebarlayout = 3; + public int borderleftlayout = 3; + public int borderrightlayout = 3; + public int borderbottomlayout = 3; + public int closebtnlayout = 3; + public int rollbtnlayout = 3; + public int minbtnlayout = 3; + public int rightcornerlayout = 3; + public int leftcornerlayout = 3; + // Late entry: need to fix window code to include this + public int bottomleftcornerlayout = 3; + public int bottomrightcornerlayout = 3; + public Color bottomleftcornercolour = Color.Gray; + + public Color bottomrightcornercolour = Color.Gray; + + public bool enablebordercorners = false; + // settings + public Size closebtnsize = new Size(22, 22); + public Size rollbtnsize = new Size(22, 22); + public Size minbtnsize = new Size(22, 22); + public int titlebarheight = 30; + public int titlebariconsize = 16; + public int closebtnfromtop = 5; + public int closebtnfromside = 2; + public int rollbtnfromtop = 5; + public int rollbtnfromside = 26; + public int minbtnfromtop = 5; + public int minbtnfromside = 52; + public int borderwidth = 2; + public bool enablecorners = false; + public int titlebarcornerwidth = 5; + public int titleiconfromside = 4; + public int titleiconfromtop = 4; + //colours + public Color titlebarcolour = Color.Gray; + public Color borderleftcolour = Color.Gray; + public Color borderrightcolour = Color.Gray; + public Color borderbottomcolour = Color.Gray; + public Color closebtncolour = Color.Black; + public Color closebtnhovercolour = Color.Black; + public Color closebtnclickcolour = Color.Black; + public Color rollbtncolour = Color.Black; + public Color rollbtnhovercolour = Color.Black; + public Color rollbtnclickcolour = Color.Black; + public Color minbtncolour = Color.Black; + public Color minbtnhovercolour = Color.Black; + public Color minbtnclickcolour = Color.Black; + public Color rightcornercolour = Color.Gray; + public Color leftcornercolour = Color.Gray; + // Text + public string titletextfontfamily = "Microsoft Sans Serif"; + public int titletextfontsize = 10; + public FontStyle titletextfontstyle = FontStyle.Bold; + public string titletextpos = "Left"; + public int titletextfromtop = 3; + public int titletextfromside = 24; + + public Color titletextcolour = Color.White; + + #endregion + } + + public class DefaultSkin : Skin + { + + } +} diff --git a/source/ShiftUI/Theming/ThemeElements.cs b/source/ShiftUI/Theming/ThemeElements.cs new file mode 100644 index 0000000..e1bd740 --- /dev/null +++ b/source/ShiftUI/Theming/ThemeElements.cs @@ -0,0 +1,223 @@ +// Permission is hereby granted, free of charge, to any person obtaining +// a copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to +// permit persons to whom the Software is furnished to do so, subject to +// the following conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// +// Copyright (c) 2007 Novell, Inc. +// +// Authors: +// Jonathan Pobst (monkey@jpobst.com) +// Everaldo Canuto + +using System; +using System.Drawing; +using System.Reflection; + +namespace ShiftUI.Theming +{ + internal class MemphisThemeElements + { + private static ThemeElementsDefault theme; + public static ThemeElementsDefault CurrentTheme + { + get { return theme; } + } + + static MemphisThemeElements() + { + Init(); + } + + public static void Init() + { + theme = LoadTheme("memphis"); + } + + private static ThemeElementsDefault LoadTheme(string themeName) + { + return new ThemeElementsMemphis(); + } + + #region Buttons + public static void DrawButton(Graphics g, Rectangle bounds, ButtonThemeState state, Color backColor, Color foreColor) + { + theme.ButtonPainter.Draw(g, bounds, state, backColor, foreColor); + } + + public static void DrawFlatButton(Graphics g, Rectangle bounds, ButtonThemeState state, Color backColor, Color foreColor, FlatButtonAppearance appearance) + { + theme.ButtonPainter.DrawFlat(g, bounds, state, backColor, foreColor, appearance); + } + + public static void DrawPopupButton(Graphics g, Rectangle bounds, ButtonThemeState state, Color backColor, Color foreColor) + { + theme.ButtonPainter.DrawPopup(g, bounds, state, backColor, foreColor); + } + #endregion + + #region Painters + + public virtual Default.ButtonPainter ButtonPainter + { + get { return theme.ButtonPainter; } + } + + public static Default.LabelPainter LabelPainter + { + get { return theme.LabelPainter; } + } + + public static Default.LinkLabelPainter LinkLabelPainter + { + get { return theme.LinkLabelPainter; } + } + + public virtual Default.TabWidgetPainter TabWidgetPainter + { + get { return theme.TabWidgetPainter; } + } + + public virtual Default.CheckBoxPainter CheckBoxPainter + { + get { return theme.CheckBoxPainter; } + } + + public virtual Default.RadioButtonPainter RadioButtonPainter + { + get { return theme.RadioButtonPainter; } + } + + public virtual Default.ToolStripPainter ToolStripPainter + { + get { return theme.ToolStripPainter; } + } + + #endregion + } + + + internal class ThemeElements + { + private static ThemeElementsDefault theme; + public static ThemeElementsDefault CurrentTheme { + get { return theme; } + } + + static ThemeElements () + { + string theme_var; + + theme_var = Environment.GetEnvironmentVariable ("MONO_THEME"); + + if (theme_var == null) + theme_var = "win32"; + else + theme_var = theme_var.ToLower (); + + theme = LoadTheme (theme_var); + + } + + private static ThemeElementsDefault LoadTheme (string themeName) + { + if (themeName == "visualstyles") + if (Application.VisualStylesEnabled) + return new ThemeElementsVisualStyles (); + else + return new ThemeElementsDefault (); + Assembly ass = Assembly.GetExecutingAssembly (); + string iname = typeof(ThemeElements).FullName; + string assemblyname = iname + themeName; + Type type = ass.GetType (assemblyname, false, true); + if (type != null) { + object o = ass.CreateInstance (type.FullName); + if (o != null) + return (ThemeElementsDefault) o; + } + return new ThemeElementsDefault (); + } + + #region Buttons + public static void DrawButton (Graphics g, Rectangle bounds, ButtonThemeState state, Color backColor, Color foreColor) + { + theme.ButtonPainter.Draw (g, bounds, state, backColor, foreColor); + } + + public static void DrawFlatButton (Graphics g, Rectangle bounds, ButtonThemeState state, Color backColor, Color foreColor, FlatButtonAppearance appearance) + { + theme.ButtonPainter.DrawFlat (g, bounds, state, backColor, foreColor, appearance); + } + + public static void DrawPopupButton (Graphics g, Rectangle bounds, ButtonThemeState state, Color backColor, Color foreColor) + { + theme.ButtonPainter.DrawPopup (g, bounds, state, backColor, foreColor); + } + #endregion + + #region Painters + + public virtual Default.ButtonPainter ButtonPainter { + get { return theme.ButtonPainter; } + } + + public static Default.LabelPainter LabelPainter { + get { return theme.LabelPainter; } + } + + public static Default.LinkLabelPainter LinkLabelPainter { + get { return theme.LinkLabelPainter; } + } + + public virtual Default.TabWidgetPainter TabWidgetPainter { + get { return theme.TabWidgetPainter; } + } + + public virtual Default.CheckBoxPainter CheckBoxPainter { + get { return theme.CheckBoxPainter; } + } + + public virtual Default.RadioButtonPainter RadioButtonPainter { + get { return theme.RadioButtonPainter; } + } + + public virtual Default.ToolStripPainter ToolStripPainter { + get { return theme.ToolStripPainter; } + } + + #endregion + } + + #region Internal Enums + [Flags] + internal enum ButtonThemeState + { + Normal = 1, + Entered = 2, + Pressed = 4, + Disabled = 8, + Default = 16 + } + + internal enum ElementState + { + Normal = 1, + Hot = 2, + Pressed = 3, + Disabled = 4 + } + #endregion +} \ No newline at end of file diff --git a/source/ShiftUI/Theming/ThemeElementsClearlooks.cs b/source/ShiftUI/Theming/ThemeElementsClearlooks.cs new file mode 100644 index 0000000..8a1375e --- /dev/null +++ b/source/ShiftUI/Theming/ThemeElementsClearlooks.cs @@ -0,0 +1,35 @@ +// Permission is hereby granted, free of charge, to any person obtaining +// a copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to +// permit persons to whom the Software is furnished to do so, subject to +// the following conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// +// Copyright (c) 2007 Novell, Inc. +// +// Authors: +// Andreia Gaita (avidigal@novell.com) + +using System; + +namespace ShiftUI.Theming +{ + /// + /// Summary description for ThemeElementsClearlooks. + /// + internal class ThemeElementsClearlooks: ThemeElementsDefault + { + } +} diff --git a/source/ShiftUI/Theming/ThemeElementsDefault.cs b/source/ShiftUI/Theming/ThemeElementsDefault.cs new file mode 100644 index 0000000..02126d6 --- /dev/null +++ b/source/ShiftUI/Theming/ThemeElementsDefault.cs @@ -0,0 +1,95 @@ +// Permission is hereby granted, free of charge, to any person obtaining +// a copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to +// permit persons to whom the Software is furnished to do so, subject to +// the following conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// +// Copyright (c) 2007 Novell, Inc. +// +// Authors: +// Jonathan Pobst (monkey@jpobst.com) +// Andreia Gaita (avidigal@novell.com) + +using System; + +namespace ShiftUI.Theming +{ + internal class ThemeElementsDefault + { + protected Default.TabWidgetPainter tabWidgetPainter; + public virtual Default.TabWidgetPainter TabWidgetPainter { + get { + if (tabWidgetPainter == null) + tabWidgetPainter = new Default.TabWidgetPainter (); + return tabWidgetPainter; + } + } + + protected Default.ButtonPainter buttonPainter; + public virtual Default.ButtonPainter ButtonPainter { + get { + if (buttonPainter == null) + buttonPainter = new Default.ButtonPainter (); + return buttonPainter; + } + } + + protected Default.LabelPainter labelPainter; + public virtual Default.LabelPainter LabelPainter { + get { + if (labelPainter == null) + labelPainter = new Default.LabelPainter (); + return labelPainter; + } + } + + protected Default.LinkLabelPainter linklabelPainter; + public virtual Default.LinkLabelPainter LinkLabelPainter { + get { + if (linklabelPainter == null) + linklabelPainter = new Default.LinkLabelPainter (); + return linklabelPainter; + } + } + + protected Default.ToolStripPainter toolStripPainter; + public virtual Default.ToolStripPainter ToolStripPainter { + get { + if (toolStripPainter == null) + toolStripPainter = new Default.ToolStripPainter (); + return toolStripPainter; + } + } + + protected Default.CheckBoxPainter checkBoxPainter; + public virtual Default.CheckBoxPainter CheckBoxPainter { + get { + if (checkBoxPainter == null) + checkBoxPainter = new Default.CheckBoxPainter (); + return checkBoxPainter; + } + } + + protected Default.RadioButtonPainter radioButtonPainter; + public virtual Default.RadioButtonPainter RadioButtonPainter { + get { + if (radioButtonPainter == null) + radioButtonPainter = new Default.RadioButtonPainter (); + return radioButtonPainter; + } + } + } +} diff --git a/source/ShiftUI/Theming/ThemeElementsGtk.cs b/source/ShiftUI/Theming/ThemeElementsGtk.cs new file mode 100644 index 0000000..97582d3 --- /dev/null +++ b/source/ShiftUI/Theming/ThemeElementsGtk.cs @@ -0,0 +1,35 @@ +// Permission is hereby granted, free of charge, to any person obtaining +// a copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to +// permit persons to whom the Software is furnished to do so, subject to +// the following conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// +// Copyright (c) 2007 Novell, Inc. +// +// Authors: +// Andreia Gaita (avidigal@novell.com) + +using System; + +namespace ShiftUI.Theming +{ + /// + /// Summary description for ThemeElementsGtk. + /// + internal class ThemeElementsGtk: ThemeElementsDefault + { + } +} diff --git a/source/ShiftUI/Theming/ThemeElementsMemphis.cs b/source/ShiftUI/Theming/ThemeElementsMemphis.cs new file mode 100644 index 0000000..1a2e892 --- /dev/null +++ b/source/ShiftUI/Theming/ThemeElementsMemphis.cs @@ -0,0 +1,86 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using ShiftUI.Theming.Default; +using System.Drawing; +using ShiftUI.ShiftOS; + +namespace ShiftUI.Theming +{ + class ThemeElementsMemphis : ThemeElementsDefault + { + + public ThemeElementsMemphis() + { + } + + public override ButtonPainter ButtonPainter + { + get + { + return new Memphis.ButtonPainter(); + } + } + } + + namespace Memphis + { + internal class ButtonPainter : Default.ButtonPainter + { + + #region Buttons + #region Standard Button + public override void Draw(Graphics g, Rectangle bounds, ButtonThemeState state, Color backColor, Color foreColor) + { + bool is_themecolor = backColor.ToArgb() == ThemeEngine.Current.ColorControl.ToArgb() || backColor == Color.Empty ? true : false; + CPColor cpcolor = is_themecolor ? CPColor.Empty : ResPool.GetCPColor(backColor); + Pen pen; + + switch (state) + { + case ButtonThemeState.Disabled: + case ButtonThemeState.Normal: + case ButtonThemeState.Entered: + case ButtonThemeState.Default: + pen = new Pen(foreColor, Application.CurrentSkin.ButtonBorderWidth); + g.DrawRectangle(pen, bounds); + break; + case ButtonThemeState.Pressed: + g.FillRectangle(new SolidBrush(backColor), bounds); + pen = new Pen(foreColor, Application.CurrentSkin.ButtonBorderWidth); + g.DrawRectangle(pen, bounds); + break; + } + } + #endregion + + #region FlatStyle Button + public override void DrawFlat(Graphics g, Rectangle bounds, ButtonThemeState state, Color backColor, Color foreColor, FlatButtonAppearance appearance) + { + Draw(g, bounds, state, backColor, foreColor); + } + #endregion + + #region Popup Button + public override void DrawPopup(Graphics g, Rectangle bounds, ButtonThemeState state, Color backColor, Color foreColor) + { + Draw(g, bounds, state, backColor, foreColor); + } + #endregion + #endregion + + private static Color ChangeIntensity(Color baseColor, float percent) + { + int H, I, S; + + WidgetPaint.Color2HBS(baseColor, out H, out I, out S); + int NewIntensity = Math.Min(255, (int)(I * percent)); + + return WidgetPaint.HBS2Color(H, NewIntensity, S); + } + + } + } +} diff --git a/source/ShiftUI/Theming/ThemeElementsNice.cs b/source/ShiftUI/Theming/ThemeElementsNice.cs new file mode 100644 index 0000000..ff2ff45 --- /dev/null +++ b/source/ShiftUI/Theming/ThemeElementsNice.cs @@ -0,0 +1,43 @@ +// Permission is hereby granted, free of charge, to any person obtaining +// a copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to +// permit persons to whom the Software is furnished to do so, subject to +// the following conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// +// Copyright (c) 2007 Novell, Inc. +// +// Authors: +// Andreia Gaita (avidigal@novell.com) + +using System; + +namespace ShiftUI.Theming +{ + internal class ThemeElementsNice: ThemeElementsDefault + { + /* If we want to add a custom-themed Widget, add an override here + * like this: + + public override Default.TabWidgetPainter TabWidgetPainter { + get { + if (tabWidgetPainter == null) + tabWidgetPainter = (Default.TabWidgetPainter) new Nice.TabWidgetPainter (); + return tabWidgetPainter; + } + } + */ + } +} diff --git a/source/ShiftUI/Theming/ThemeElementsVisualStyles.cs b/source/ShiftUI/Theming/ThemeElementsVisualStyles.cs new file mode 100644 index 0000000..1e5bf1c --- /dev/null +++ b/source/ShiftUI/Theming/ThemeElementsVisualStyles.cs @@ -0,0 +1,59 @@ +// Permission is hereby granted, free of charge, to any person obtaining +// a copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to +// permit persons to whom the Software is furnished to do so, subject to +// the following conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// +// Copyright (c) 2008 George Giolfan +// +// Authors: +// George Giolfan (georgegiolfan@yahoo.com) +using ShiftUI.Theming.Default; + +namespace ShiftUI.Theming +{ + class ThemeElementsVisualStyles : ThemeElementsDefault + { + public override CheckBoxPainter CheckBoxPainter { + get { + if (checkBoxPainter == null) + checkBoxPainter = new VisualStyles.CheckBoxPainter (); + return checkBoxPainter; + } + } + public override RadioButtonPainter RadioButtonPainter { + get { + if (radioButtonPainter == null) + radioButtonPainter = new VisualStyles.RadioButtonPainter (); + return radioButtonPainter; + } + } + public override ToolStripPainter ToolStripPainter { + get { + if (toolStripPainter == null) + toolStripPainter = new VisualStyles.ToolStripPainter (); + return toolStripPainter; + } + } + public override TabWidgetPainter TabWidgetPainter { + get { + if (tabWidgetPainter == null) + tabWidgetPainter = new VisualStyles.TabWidgetPainter (); + return tabWidgetPainter; + } + } + } +} diff --git a/source/ShiftUI/Theming/ThemeEngine.cs b/source/ShiftUI/Theming/ThemeEngine.cs new file mode 100644 index 0000000..89d2804 --- /dev/null +++ b/source/ShiftUI/Theming/ThemeEngine.cs @@ -0,0 +1,62 @@ +// Permission is hereby granted, free of charge, to any person obtaining +// a copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to +// permit persons to whom the Software is furnished to do so, subject to +// the following conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// +// Copyright (c) 2004-2006 Novell, Inc. +// +// Authors: +// Jordi Mas i Hernandez, jordi@ximian.com +// +// + + +using ShiftUI.Theming; +using System; + +namespace ShiftUI +{ + internal class ThemeEngine + { + static private Theme theme = null; + + static ThemeEngine () + { + string theme_var; + + theme_var = Environment.GetEnvironmentVariable("MONO_THEME"); + + if (theme_var == null) { + theme_var = "memphis"; //Screw win32. Memphis all the way! + } else { + theme_var = theme_var.ToLower (); + } + + if (Application.VisualStylesEnabled) { + theme = new ThemeSkinnable(); //ShiftOS skin engine will be moved into here, possibly. + } else { + theme = new ThemeWin32Classic (); + } + } + + + public static Theme Current { + get { return theme; } + } + + } +} diff --git a/source/ShiftUI/Theming/ThemeSkinnable.cs b/source/ShiftUI/Theming/ThemeSkinnable.cs new file mode 100644 index 0000000..bf8b56f --- /dev/null +++ b/source/ShiftUI/Theming/ThemeSkinnable.cs @@ -0,0 +1,8351 @@ +// Permission is hereby granted, free of charge, to any person obtaining +// a copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to +// permit persons to whom the Software is furnished to do so, subject to +// the following conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// +// Copyright (c) 2004-2006 Novell, Inc. +// +// Authors: +// Jordi Mas i Hernandez, jordi@ximian.com +// Peter Bartok, pbartok@novell.com +// John BouAntoun, jba-mono@optusnet.com.au +// Marek Safar, marek.safar@seznam.cz +// Alexander Olk, alex.olk@googlemail.com +// + +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Drawing.Drawing2D; +using System.Drawing.Imaging; +using System.Drawing.Printing; +using System.Drawing.Text; +using System.Text; +using ShiftUI.Theming; +using System; + +namespace ShiftUI +{ + + internal class ThemeSkinnable : Theme + { + public void LoadSkin(ShiftOS.Skin skin) + { + Application.LoadSkin(skin); + MemphisThemeElements.Init(); + } + + public override Version Version + { + get + { + return new Version("0.0.1.alpha1"); + } + } + + /* Hardcoded colour values not exposed in the API constants in all configurations */ + protected static readonly Color arrow_color = Color.Black; + protected static readonly Color pen_ticks_color = Color.Black; + protected static StringFormat string_format_menu_text; + protected static StringFormat string_format_menu_shortcut; + protected static StringFormat string_format_menu_menubar_text; + static ImageAttributes imagedisabled_attributes; + Font window_border_font; + const int SEPARATOR_HEIGHT = 6; + const int SEPARATOR_MIN_WIDTH = 20; + const int SM_CXBORDER = 1; + const int SM_CYBORDER = 1; + const int MENU_TAB_SPACE = 8; // Pixels added to the width of an item because of a tabd + const int MENU_BAR_ITEMS_SPACE = 8; // Space between menu bar items + const int CheckSize = 13; + + #region Principal Theme Methods + public ThemeSkinnable() + { + if (Application.CurrentSkin == null) + Application.LoadSkin(new ShiftOS.DefaultSkin()); + ResetDefaults(); + } + + public override void ResetDefaults() + { + defaultWindowBackColor = Application.CurrentSkin.WindowBackColor; + defaultWindowForeColor = Application.CurrentSkin.DefaultForeColor; + window_border_font = new Font("Microsoft Sans Serif", 9, FontStyle.Bold); + + /* Menu string formats */ + string_format_menu_text = new StringFormat(); + string_format_menu_text.LineAlignment = StringAlignment.Center; + string_format_menu_text.Alignment = StringAlignment.Near; + string_format_menu_text.HotkeyPrefix = HotkeyPrefix.Show; + string_format_menu_text.SetTabStops(0f, new float[] { 50f }); + string_format_menu_text.FormatFlags |= StringFormatFlags.NoWrap; + + string_format_menu_shortcut = new StringFormat(); + string_format_menu_shortcut.LineAlignment = StringAlignment.Center; + string_format_menu_shortcut.Alignment = StringAlignment.Far; + + string_format_menu_menubar_text = new StringFormat(); + string_format_menu_menubar_text.LineAlignment = StringAlignment.Center; + string_format_menu_menubar_text.Alignment = StringAlignment.Center; + string_format_menu_menubar_text.HotkeyPrefix = HotkeyPrefix.Show; + } + + public override bool DoubleBufferingSupported + { + get { return true; } + } + + public override int HorizontalScrollBarHeight + { + get + { + return Application.CurrentSkin.ScrollbarWidth; + } + } + + public override int VerticalScrollBarWidth + { + get + { + return Application.CurrentSkin.ScrollbarWidth; + } + } + + public override Font WindowBorderFont + { + get + { + return window_border_font ?? (window_border_font = new Font(FontFamily.GenericSansSerif, 8.25f, FontStyle.Bold)); + } + } + + #endregion // Principal Theme Methods + + #region Internal Methods + protected Brush GetControlBackBrush(Color c) + { + if (c.ToArgb() == DefaultControlBackColor.ToArgb()) + return SystemBrushes.Control; + return ResPool.GetSolidBrush(c); + } + + protected Brush GetControlForeBrush(Color c) + { + if (c.ToArgb() == DefaultControlForeColor.ToArgb()) + return SystemBrushes.ControlText; + return ResPool.GetSolidBrush(c); + } + #endregion // Internal Methods + + #region Widget + public override Font GetLinkFont(Widget control) + { + return new Font(control.Font.FontFamily, control.Font.Size, control.Font.Style | FontStyle.Underline, control.Font.Unit); + } + #endregion // Widget + + #region OwnerDraw Support + public override void DrawOwnerDrawBackground(DrawItemEventArgs e) + { + if ((e.State & DrawItemState.Selected) == DrawItemState.Selected) + { + e.Graphics.FillRectangle(SystemBrushes.Highlight, e.Bounds); + return; + } + + e.Graphics.FillRectangle(ResPool.GetSolidBrush(e.BackColor), e.Bounds); + } + + public override void DrawOwnerDrawFocusRectangle(DrawItemEventArgs e) + { + if (e.State == DrawItemState.Focus) + CPDrawFocusRectangle(e.Graphics, e.Bounds, e.ForeColor, e.BackColor); + } + #endregion // OwnerDraw Support + + #region Button + #region Standard Button Style + public override void DrawButton(Graphics g, Button b, Rectangle textBounds, Rectangle imageBounds, Rectangle clipRectangle) + { + // Draw Button Background + DrawButtonBackground(g, b, clipRectangle); + + // If we have an image, draw it + if (imageBounds.Size != Size.Empty) + DrawButtonImage(g, b, imageBounds); + + // If we're focused, draw a focus rectangle + if (b.Focused && b.Enabled && b.ShowFocusCues) + DrawButtonFocus(g, b); + + // If we have text, draw it + if (textBounds != Rectangle.Empty) + DrawButtonText(g, b, textBounds); + } + + public virtual void DrawButtonBackground(Graphics g, Button button, Rectangle clipArea) + { + var fc = button.ForeColor; + if (fc == null) + fc = Application.CurrentSkin.DefaultForeColor; + + if (button.Pressed) + MemphisThemeElements.DrawButton(g, button.ClientRectangle, ButtonThemeState.Pressed, Application.CurrentSkin.ButtonBackColor_Pressed, fc); + else if (button.InternalSelected) + MemphisThemeElements.DrawButton(g, button.ClientRectangle, ButtonThemeState.Default, Application.CurrentSkin.ButtonBackColor, fc); + else if (button.Entered) + MemphisThemeElements.DrawButton(g, button.ClientRectangle, ButtonThemeState.Entered, Application.CurrentSkin.ButtonBackColor, fc); + else if (!button.Enabled) + MemphisThemeElements.DrawButton(g, button.ClientRectangle, ButtonThemeState.Disabled, Application.CurrentSkin.ButtonBackColor, fc); + else + MemphisThemeElements.DrawButton(g, button.ClientRectangle, ButtonThemeState.Normal, Application.CurrentSkin.ButtonBackColor, fc); + } + + public virtual void DrawButtonFocus(Graphics g, Button button) + { + WidgetPaint.DrawFocusRectangle(g, Rectangle.Inflate(button.ClientRectangle, -4, -4)); + } + + public virtual void DrawButtonImage(Graphics g, ButtonBase button, Rectangle imageBounds) + { + if (button.Enabled) + g.DrawImage(button.Image, imageBounds); + else + CPDrawImageDisabled(g, button.Image, imageBounds.Left, imageBounds.Top, ColorControl); + } + + public virtual void DrawButtonText(Graphics g, ButtonBase button, Rectangle textBounds) + { + // Ensure that at least one line is going to get displayed. + // Line limit does not ensure that despite its description. + if (button.Font != null && button.Font.Height > 0) + textBounds.Height = Math.Max(textBounds.Height, button.Font.Height); + + if (button.Enabled) + TextRenderer.DrawTextInternal(g, button.Text, button.Font, textBounds, button.ForeColor, button.TextFormatFlags, button.UseCompatibleTextRendering); + else + DrawStringDisabled20(g, button.Text, button.Font, textBounds, button.BackColor, button.TextFormatFlags, button.UseCompatibleTextRendering); + } + #endregion + + #region FlatStyle Button Style + public override void DrawFlatButton(Graphics g, ButtonBase b, Rectangle textBounds, Rectangle imageBounds, Rectangle clipRectangle) + { + // Draw Button Background + if (b.BackgroundImage == null) + DrawFlatButtonBackground(g, b, clipRectangle); + + // If we have an image, draw it + if (imageBounds.Size != Size.Empty) + DrawFlatButtonImage(g, b, imageBounds); + + // If we're focused, draw a focus rectangle + if (b.Focused && b.Enabled && b.ShowFocusCues) + DrawFlatButtonFocus(g, b); + + // If we have text, draw it + if (textBounds != Rectangle.Empty) + DrawFlatButtonText(g, b, textBounds); + } + + public virtual void DrawFlatButtonBackground(Graphics g, ButtonBase button, Rectangle clipArea) + { + if (button.Pressed) + MemphisThemeElements.DrawFlatButton(g, button.ClientRectangle, ButtonThemeState.Pressed, button.BackColor, button.ForeColor, button.FlatAppearance); + else if (button.InternalSelected) + { + if (button.Entered) + MemphisThemeElements.DrawFlatButton(g, button.ClientRectangle, ButtonThemeState.Default | ButtonThemeState.Entered, button.BackColor, button.ForeColor, button.FlatAppearance); + else + MemphisThemeElements.DrawFlatButton(g, button.ClientRectangle, ButtonThemeState.Default, button.BackColor, button.ForeColor, button.FlatAppearance); + } + else if (button.Entered) + MemphisThemeElements.DrawFlatButton(g, button.ClientRectangle, ButtonThemeState.Entered, button.BackColor, button.ForeColor, button.FlatAppearance); + else if (!button.Enabled) + MemphisThemeElements.DrawFlatButton(g, button.ClientRectangle, ButtonThemeState.Disabled, button.BackColor, button.ForeColor, button.FlatAppearance); + else + MemphisThemeElements.DrawFlatButton(g, button.ClientRectangle, ButtonThemeState.Normal, button.BackColor, button.ForeColor, button.FlatAppearance); + } + + public virtual void DrawFlatButtonFocus(Graphics g, ButtonBase button) + { + if (!button.Pressed) + { + Color focus_color = WidgetPaint.Dark(button.BackColor); + g.DrawRectangle(ResPool.GetPen(focus_color), new Rectangle(button.ClientRectangle.Left + 4, button.ClientRectangle.Top + 4, button.ClientRectangle.Width - 9, button.ClientRectangle.Height - 9)); + } + } + + public virtual void DrawFlatButtonImage(Graphics g, ButtonBase button, Rectangle imageBounds) + { + // No changes from Standard for image for this theme + DrawButtonImage(g, button, imageBounds); + } + + public virtual void DrawFlatButtonText(Graphics g, ButtonBase button, Rectangle textBounds) + { + // No changes from Standard for text for this theme + DrawButtonText(g, button, textBounds); + } + #endregion + + #region Popup Button Style + public override void DrawPopupButton(Graphics g, Button b, Rectangle textBounds, Rectangle imageBounds, Rectangle clipRectangle) + { + // Draw Button Background + DrawPopupButtonBackground(g, b, clipRectangle); + + // If we have an image, draw it + if (imageBounds.Size != Size.Empty) + DrawPopupButtonImage(g, b, imageBounds); + + // If we're focused, draw a focus rectangle + if (b.Focused && b.Enabled && b.ShowFocusCues) + DrawPopupButtonFocus(g, b); + + // If we have text, draw it + if (textBounds != Rectangle.Empty) + DrawPopupButtonText(g, b, textBounds); + } + + public virtual void DrawPopupButtonBackground(Graphics g, Button button, Rectangle clipArea) + { + if (button.Pressed) + MemphisThemeElements.DrawPopupButton(g, button.ClientRectangle, ButtonThemeState.Pressed, button.BackColor, button.ForeColor); + else if (button.Entered) + MemphisThemeElements.DrawPopupButton(g, button.ClientRectangle, ButtonThemeState.Entered, button.BackColor, button.ForeColor); + else if (button.InternalSelected) + MemphisThemeElements.DrawPopupButton(g, button.ClientRectangle, ButtonThemeState.Default, button.BackColor, button.ForeColor); + else if (!button.Enabled) + MemphisThemeElements.DrawPopupButton(g, button.ClientRectangle, ButtonThemeState.Disabled, button.BackColor, button.ForeColor); + else + MemphisThemeElements.DrawPopupButton(g, button.ClientRectangle, ButtonThemeState.Normal, button.BackColor, button.ForeColor); + } + + public virtual void DrawPopupButtonFocus(Graphics g, Button button) + { + // No changes from Standard for image for this theme + DrawButtonFocus(g, button); + } + + public virtual void DrawPopupButtonImage(Graphics g, Button button, Rectangle imageBounds) + { + // No changes from Standard for image for this theme + DrawButtonImage(g, button, imageBounds); + } + + public virtual void DrawPopupButtonText(Graphics g, Button button, Rectangle textBounds) + { + // No changes from Standard for image for this theme + DrawButtonText(g, button, textBounds); + } + #endregion + + #region Button Layout Calculations + public override Size CalculateButtonAutoSize(Button button) + { + Size ret_size = Size.Empty; + Size text_size = TextRenderer.MeasureTextInternal(button.Text, button.Font, button.UseCompatibleTextRendering); + Size image_size = button.Image == null ? Size.Empty : button.Image.Size; + + // Pad the text size + if (button.Text.Length != 0) + { + text_size.Height += 4; + text_size.Width += 4; + } + + switch (button.TextImageRelation) + { + case TextImageRelation.Overlay: + ret_size.Height = Math.Max(button.Text.Length == 0 ? 0 : text_size.Height, image_size.Height); + ret_size.Width = Math.Max(text_size.Width, image_size.Width); + break; + case TextImageRelation.ImageAboveText: + case TextImageRelation.TextAboveImage: + ret_size.Height = text_size.Height + image_size.Height; + ret_size.Width = Math.Max(text_size.Width, image_size.Width); + break; + case TextImageRelation.ImageBeforeText: + case TextImageRelation.TextBeforeImage: + ret_size.Height = Math.Max(text_size.Height, image_size.Height); + ret_size.Width = text_size.Width + image_size.Width; + break; + } + + // Pad the result + ret_size.Height += (button.Padding.Vertical + 6); + ret_size.Width += (button.Padding.Horizontal + 6); + + return ret_size; + } + + public override void CalculateButtonTextAndImageLayout(Graphics g, ButtonBase button, out Rectangle textRectangle, out Rectangle imageRectangle) + { + Image image = button.Image; + string text = button.Text; + Rectangle content_rect = button.PaddingClientRectangle; + Size text_size = TextRenderer.MeasureTextInternal(g, text, button.Font, content_rect.Size, button.TextFormatFlags, button.UseCompatibleTextRendering); + Size image_size = image == null ? Size.Empty : image.Size; + + textRectangle = Rectangle.Inflate(content_rect, -4, -4); + imageRectangle = Rectangle.Empty; + + bool displayEllipsis = (button.TextFormatFlags & (TextFormatFlags.EndEllipsis | TextFormatFlags.PathEllipsis | TextFormatFlags.WordEllipsis)) != 0; + + switch (button.TextImageRelation) + { + case TextImageRelation.Overlay: + // Overlay is easy, text always goes here + + // Image is dependent on ImageAlign + if (image == null) + { + if (button.Pressed) + textRectangle.Offset(1, 1); + return; + } + + int image_x = 0; + int image_y = 0; + int image_height = image.Height; + int image_width = image.Width; + + switch (button.ImageAlign) + { + case System.Drawing.ContentAlignment.TopLeft: + image_x = 5; + image_y = 5; + break; + case System.Drawing.ContentAlignment.TopCenter: + image_x = (content_rect.Width - image_width) / 2; + image_y = 5; + break; + case System.Drawing.ContentAlignment.TopRight: + image_x = content_rect.Width - image_width - 5; + image_y = 5; + break; + case System.Drawing.ContentAlignment.MiddleLeft: + image_x = 5; + image_y = (content_rect.Height - image_height) / 2; + break; + case System.Drawing.ContentAlignment.MiddleCenter: + image_x = (content_rect.Width - image_width) / 2; + image_y = (content_rect.Height - image_height) / 2; + break; + case System.Drawing.ContentAlignment.MiddleRight: + image_x = content_rect.Width - image_width - 4; + image_y = (content_rect.Height - image_height) / 2; + break; + case System.Drawing.ContentAlignment.BottomLeft: + image_x = 5; + image_y = content_rect.Height - image_height - 4; + break; + case System.Drawing.ContentAlignment.BottomCenter: + image_x = (content_rect.Width - image_width) / 2; + image_y = content_rect.Height - image_height - 4; + break; + case System.Drawing.ContentAlignment.BottomRight: + image_x = content_rect.Width - image_width - 4; + image_y = content_rect.Height - image_height - 4; + break; + default: + image_x = 5; + image_y = 5; + break; + } + + imageRectangle = new Rectangle(image_x, image_y, image_width, image_height); + break; + case TextImageRelation.ImageAboveText: + LayoutTextAboveOrBelowImage(textRectangle, false, text_size, image_size, button.TextAlign, button.ImageAlign, displayEllipsis, out textRectangle, out imageRectangle); + break; + case TextImageRelation.TextAboveImage: + LayoutTextAboveOrBelowImage(textRectangle, true, text_size, image_size, button.TextAlign, button.ImageAlign, displayEllipsis, out textRectangle, out imageRectangle); + break; + case TextImageRelation.ImageBeforeText: + LayoutTextBeforeOrAfterImage(textRectangle, false, text_size, image_size, button.TextAlign, button.ImageAlign, out textRectangle, out imageRectangle); + break; + case TextImageRelation.TextBeforeImage: + LayoutTextBeforeOrAfterImage(textRectangle, true, text_size, image_size, button.TextAlign, button.ImageAlign, out textRectangle, out imageRectangle); + break; + } + if (button.Pressed) + textRectangle.Offset(1, 1); + } + + private void LayoutTextBeforeOrAfterImage(Rectangle totalArea, bool textFirst, Size textSize, Size imageSize, System.Drawing.ContentAlignment textAlign, System.Drawing.ContentAlignment imageAlign, out Rectangle textRect, out Rectangle imageRect) + { + int element_spacing = 0; // Spacing between the Text and the Image + int total_width = textSize.Width + element_spacing + imageSize.Width; + + if (!textFirst) + element_spacing += 2; + + // If the text is too big, chop it down to the size we have available to it + if (total_width > totalArea.Width) + { + textSize.Width = totalArea.Width - element_spacing - imageSize.Width; + total_width = totalArea.Width; + } + + int excess_width = totalArea.Width - total_width; + int offset = 0; + + Rectangle final_text_rect; + Rectangle final_image_rect; + + HorizontalAlignment h_text = GetHorizontalAlignment(textAlign); + HorizontalAlignment h_image = GetHorizontalAlignment(imageAlign); + + if (h_image == HorizontalAlignment.Left) + offset = 0; + else if (h_image == HorizontalAlignment.Right && h_text == HorizontalAlignment.Right) + offset = excess_width; + else if (h_image == HorizontalAlignment.Center && (h_text == HorizontalAlignment.Left || h_text == HorizontalAlignment.Center)) + offset += (int)(excess_width / 3); + else + offset += (int)(2 * (excess_width / 3)); + + if (textFirst) + { + final_text_rect = new Rectangle(totalArea.Left + offset, AlignInRectangle(totalArea, textSize, textAlign).Top, textSize.Width, textSize.Height); + final_image_rect = new Rectangle(final_text_rect.Right + element_spacing, AlignInRectangle(totalArea, imageSize, imageAlign).Top, imageSize.Width, imageSize.Height); + } + else + { + final_image_rect = new Rectangle(totalArea.Left + offset, AlignInRectangle(totalArea, imageSize, imageAlign).Top, imageSize.Width, imageSize.Height); + final_text_rect = new Rectangle(final_image_rect.Right + element_spacing, AlignInRectangle(totalArea, textSize, textAlign).Top, textSize.Width, textSize.Height); + } + + textRect = final_text_rect; + imageRect = final_image_rect; + } + + private void LayoutTextAboveOrBelowImage(Rectangle totalArea, bool textFirst, Size textSize, Size imageSize, System.Drawing.ContentAlignment textAlign, System.Drawing.ContentAlignment imageAlign, bool displayEllipsis, out Rectangle textRect, out Rectangle imageRect) + { + int element_spacing = 0; // Spacing between the Text and the Image + int total_height = textSize.Height + element_spacing + imageSize.Height; + + if (textFirst) + element_spacing += 2; + + if (textSize.Width > totalArea.Width) + textSize.Width = totalArea.Width; + + // If the there isn't enough room and we're text first, cut out the image + if (total_height > totalArea.Height && textFirst) + { + imageSize = Size.Empty; + total_height = totalArea.Height; + } + + int excess_height = totalArea.Height - total_height; + int offset = 0; + + Rectangle final_text_rect; + Rectangle final_image_rect; + + VerticalAlignment v_text = GetVerticalAlignment(textAlign); + VerticalAlignment v_image = GetVerticalAlignment(imageAlign); + + if (v_image == VerticalAlignment.Top) + offset = 0; + else if (v_image == VerticalAlignment.Bottom && v_text == VerticalAlignment.Bottom) + offset = excess_height; + else if (v_image == VerticalAlignment.Center && (v_text == VerticalAlignment.Top || v_text == VerticalAlignment.Center)) + offset += (int)(excess_height / 3); + else + offset += (int)(2 * (excess_height / 3)); + + if (textFirst) + { + var textHeight = excess_height >= 0 ? totalArea.Height - imageSize.Height - element_spacing : textSize.Height; + final_text_rect = new Rectangle(AlignInRectangle(totalArea, textSize, textAlign).Left, totalArea.Top + offset, textSize.Width, textHeight); + final_image_rect = new Rectangle(AlignInRectangle(totalArea, imageSize, imageAlign).Left, final_text_rect.Bottom + element_spacing, imageSize.Width, imageSize.Height); + } + else + { + final_image_rect = new Rectangle(AlignInRectangle(totalArea, imageSize, imageAlign).Left, totalArea.Top + offset, imageSize.Width, imageSize.Height); + var textHeight = excess_height >= 0 ? totalArea.Height - final_image_rect.Height : textSize.Height; + final_text_rect = new Rectangle(AlignInRectangle(totalArea, textSize, textAlign).Left, final_image_rect.Bottom + element_spacing, textSize.Width, textHeight); + + if (final_text_rect.Bottom > totalArea.Bottom) + { + final_text_rect.Y -= (final_text_rect.Bottom - totalArea.Bottom); + if (final_text_rect.Y < totalArea.Top) + final_text_rect.Y = totalArea.Top; + } + } + + if (displayEllipsis) + { + // Don't use more space than is available otherwise ellipsis won't show + if (final_text_rect.Height > totalArea.Bottom) + final_text_rect.Height = totalArea.Bottom - final_text_rect.Top; + } + + textRect = final_text_rect; + imageRect = final_image_rect; + } + + private HorizontalAlignment GetHorizontalAlignment(System.Drawing.ContentAlignment align) + { + switch (align) + { + case System.Drawing.ContentAlignment.BottomLeft: + case System.Drawing.ContentAlignment.MiddleLeft: + case System.Drawing.ContentAlignment.TopLeft: + return HorizontalAlignment.Left; + case System.Drawing.ContentAlignment.BottomCenter: + case System.Drawing.ContentAlignment.MiddleCenter: + case System.Drawing.ContentAlignment.TopCenter: + return HorizontalAlignment.Center; + case System.Drawing.ContentAlignment.BottomRight: + case System.Drawing.ContentAlignment.MiddleRight: + case System.Drawing.ContentAlignment.TopRight: + return HorizontalAlignment.Right; + } + + return HorizontalAlignment.Left; + } + + private enum VerticalAlignment + { + Top = 0, + Center = 1, + Bottom = 2 + } + + private VerticalAlignment GetVerticalAlignment(System.Drawing.ContentAlignment align) + { + switch (align) + { + case System.Drawing.ContentAlignment.TopLeft: + case System.Drawing.ContentAlignment.TopCenter: + case System.Drawing.ContentAlignment.TopRight: + return VerticalAlignment.Top; + case System.Drawing.ContentAlignment.MiddleLeft: + case System.Drawing.ContentAlignment.MiddleCenter: + case System.Drawing.ContentAlignment.MiddleRight: + return VerticalAlignment.Center; + case System.Drawing.ContentAlignment.BottomLeft: + case System.Drawing.ContentAlignment.BottomCenter: + case System.Drawing.ContentAlignment.BottomRight: + return VerticalAlignment.Bottom; + } + + return VerticalAlignment.Top; + } + + internal Rectangle AlignInRectangle(Rectangle outer, Size inner, System.Drawing.ContentAlignment align) + { + int x = 0; + int y = 0; + + if (align == System.Drawing.ContentAlignment.BottomLeft || align == System.Drawing.ContentAlignment.MiddleLeft || align == System.Drawing.ContentAlignment.TopLeft) + x = outer.X; + else if (align == System.Drawing.ContentAlignment.BottomCenter || align == System.Drawing.ContentAlignment.MiddleCenter || align == System.Drawing.ContentAlignment.TopCenter) + x = Math.Max(outer.X + ((outer.Width - inner.Width) / 2), outer.Left); + else if (align == System.Drawing.ContentAlignment.BottomRight || align == System.Drawing.ContentAlignment.MiddleRight || align == System.Drawing.ContentAlignment.TopRight) + x = outer.Right - inner.Width; + if (align == System.Drawing.ContentAlignment.TopCenter || align == System.Drawing.ContentAlignment.TopLeft || align == System.Drawing.ContentAlignment.TopRight) + y = outer.Y; + else if (align == System.Drawing.ContentAlignment.MiddleCenter || align == System.Drawing.ContentAlignment.MiddleLeft || align == System.Drawing.ContentAlignment.MiddleRight) + y = outer.Y + (outer.Height - inner.Height) / 2; + else if (align == System.Drawing.ContentAlignment.BottomCenter || align == System.Drawing.ContentAlignment.BottomRight || align == System.Drawing.ContentAlignment.BottomLeft) + y = outer.Bottom - inner.Height; + + return new Rectangle(x, y, Math.Min(inner.Width, outer.Width), Math.Min(inner.Height, outer.Height)); + } + #endregion + #endregion + + #region ButtonBase + public override void DrawButtonBase(Graphics dc, Rectangle clip_area, ButtonBase button) + { + // Draw the button: Draw border, etc. + ButtonBase_DrawButton(button, dc); + + // Draw the image + if (button.FlatStyle != FlatStyle.System && ((button.image != null) || (button.image_list != null))) + ButtonBase_DrawImage(button, dc); + + // Draw the focus rectangle + if (ShouldPaintFocusRectagle(button)) + ButtonBase_DrawFocus(button, dc); + + // Now the text + if (button.Text != null && button.Text != String.Empty) + ButtonBase_DrawText(button, dc); + } + + protected static bool ShouldPaintFocusRectagle(ButtonBase button) + { + return (button.Focused || button.paint_as_acceptbutton) && button.Enabled && button.ShowFocusCues; + } + + protected virtual void ButtonBase_DrawButton(ButtonBase button, Graphics dc) + { + Rectangle borderRectangle; + bool check_or_radio = false; + bool check_or_radio_checked = false; + + bool is_ColorControl = button.BackColor.ToArgb() == ColorControl.ToArgb() ? true : false; + + CPColor cpcolor = is_ColorControl ? CPColor.Empty : ResPool.GetCPColor(button.BackColor); + + if (button is CheckBox) + { + check_or_radio = true; + check_or_radio_checked = ((CheckBox)button).Checked; + } + else if (button is RadioButton) + { + check_or_radio = true; + check_or_radio_checked = ((RadioButton)button).Checked; + } + + if (button.Focused && button.Enabled && !check_or_radio) + { + // shrink the rectangle for the normal button drawing inside the focus rectangle + borderRectangle = Rectangle.Inflate(button.ClientRectangle, -1, -1); + } + else + { + borderRectangle = button.ClientRectangle; + } + + if (button.FlatStyle == FlatStyle.Popup) + { + if (!button.is_pressed && !button.is_entered && !check_or_radio_checked) + Internal_DrawButton(dc, borderRectangle, 1, cpcolor, is_ColorControl, button.BackColor); + else if (!button.is_pressed && button.is_entered && !check_or_radio_checked) + Internal_DrawButton(dc, borderRectangle, 2, cpcolor, is_ColorControl, button.BackColor); + else if (button.is_pressed || check_or_radio_checked) + Internal_DrawButton(dc, borderRectangle, 1, cpcolor, is_ColorControl, button.BackColor); + } + else if (button.FlatStyle == FlatStyle.Flat) + { + if (button.is_entered && !button.is_pressed && !check_or_radio_checked) + { + if ((button.image == null) && (button.image_list == null)) + { + Brush brush = is_ColorControl ? SystemBrushes.ControlDark : ResPool.GetSolidBrush(cpcolor.Dark); + dc.FillRectangle(brush, borderRectangle); + } + } + else if (button.is_pressed || check_or_radio_checked) + { + if ((button.image == null) && (button.image_list == null)) + { + Brush brush = is_ColorControl ? SystemBrushes.ControlLightLight : ResPool.GetSolidBrush(cpcolor.LightLight); + dc.FillRectangle(brush, borderRectangle); + } + + Pen pen = is_ColorControl ? SystemPens.ControlDark : ResPool.GetPen(cpcolor.Dark); + dc.DrawRectangle(pen, borderRectangle.X + 4, borderRectangle.Y + 4, + borderRectangle.Width - 9, borderRectangle.Height - 9); + } + + Internal_DrawButton(dc, borderRectangle, 3, cpcolor, is_ColorControl, button.BackColor); + } + else + { + if ((!button.is_pressed || !button.Enabled) && !check_or_radio_checked) + Internal_DrawButton(dc, borderRectangle, 0, cpcolor, is_ColorControl, button.BackColor); + else + Internal_DrawButton(dc, borderRectangle, 1, cpcolor, is_ColorControl, button.BackColor); + } + } + + private void Internal_DrawButton(Graphics dc, Rectangle rect, int state, CPColor cpcolor, bool is_ColorControl, Color backcolor) + { + switch (state) + { + case 0: // normal or normal disabled button + Pen pen = is_ColorControl ? SystemPens.ControlLightLight : ResPool.GetPen(cpcolor.LightLight); + dc.DrawLine(pen, rect.X, rect.Y, rect.X, rect.Bottom - 2); + dc.DrawLine(pen, rect.X + 1, rect.Y, rect.Right - 2, rect.Y); + + pen = is_ColorControl ? SystemPens.Control : ResPool.GetPen(backcolor); + dc.DrawLine(pen, rect.X + 1, rect.Y + 1, rect.X + 1, rect.Bottom - 3); + dc.DrawLine(pen, rect.X + 2, rect.Y + 1, rect.Right - 3, rect.Y + 1); + + pen = is_ColorControl ? SystemPens.ControlDark : ResPool.GetPen(cpcolor.Dark); + dc.DrawLine(pen, rect.X + 1, rect.Bottom - 2, rect.Right - 2, rect.Bottom - 2); + dc.DrawLine(pen, rect.Right - 2, rect.Y + 1, rect.Right - 2, rect.Bottom - 3); + + pen = is_ColorControl ? SystemPens.ControlDarkDark : ResPool.GetPen(cpcolor.DarkDark); + dc.DrawLine(pen, rect.X, rect.Bottom - 1, rect.Right - 1, rect.Bottom - 1); + dc.DrawLine(pen, rect.Right - 1, rect.Y, rect.Right - 1, rect.Bottom - 2); + break; + case 1: // popup button normal (or pressed normal or popup button) + pen = is_ColorControl ? SystemPens.ControlDark : ResPool.GetPen(cpcolor.Dark); + dc.DrawRectangle(pen, rect.X, rect.Y, rect.Width - 1, rect.Height - 1); + break; + case 2: // popup button poped up + pen = is_ColorControl ? SystemPens.ControlLightLight : ResPool.GetPen(cpcolor.LightLight); + dc.DrawLine(pen, rect.X, rect.Y, rect.X, rect.Bottom - 2); + dc.DrawLine(pen, rect.X + 1, rect.Y, rect.Right - 2, rect.Y); + + pen = is_ColorControl ? SystemPens.ControlDark : ResPool.GetPen(cpcolor.Dark); + dc.DrawLine(pen, rect.X, rect.Bottom - 1, rect.Right - 1, rect.Bottom - 1); + dc.DrawLine(pen, rect.Right - 1, rect.Y, rect.Right - 1, rect.Bottom - 2); + break; + case 3: // flat button not entered + pen = is_ColorControl ? SystemPens.ControlDarkDark : ResPool.GetPen(cpcolor.DarkDark); + dc.DrawRectangle(pen, rect.X, rect.Y, rect.Width - 1, rect.Height - 1); + break; + default: + break; + } + } + + protected virtual void ButtonBase_DrawImage(ButtonBase button, Graphics dc) + { + // Need to draw a picture + Image i; + int image_x; + int image_y; + int image_width; + int image_height; + + int width = button.ClientSize.Width; + int height = button.ClientSize.Height; + + if (button.ImageIndex != -1) + { // We use ImageIndex instead of image_index since it will return -1 if image_list is null + i = button.image_list.Images[button.ImageIndex]; + } + else + { + i = button.image; + } + + image_width = i.Width; + image_height = i.Height; + + switch (button.ImageAlign) + { + case ContentAlignment.TopLeft: + { + image_x = 5; + image_y = 5; + break; + } + + case ContentAlignment.TopCenter: + { + image_x = (width - image_width) / 2; + image_y = 5; + break; + } + + case ContentAlignment.TopRight: + { + image_x = width - image_width - 5; + image_y = 5; + break; + } + + case ContentAlignment.MiddleLeft: + { + image_x = 5; + image_y = (height - image_height) / 2; + break; + } + + case ContentAlignment.MiddleCenter: + { + image_x = (width - image_width) / 2; + image_y = (height - image_height) / 2; + break; + } + + case ContentAlignment.MiddleRight: + { + image_x = width - image_width - 4; + image_y = (height - image_height) / 2; + break; + } + + case ContentAlignment.BottomLeft: + { + image_x = 5; + image_y = height - image_height - 4; + break; + } + + case ContentAlignment.BottomCenter: + { + image_x = (width - image_width) / 2; + image_y = height - image_height - 4; + break; + } + + case ContentAlignment.BottomRight: + { + image_x = width - image_width - 4; + image_y = height - image_height - 4; + break; + } + + default: + { + image_x = 5; + image_y = 5; + break; + } + } + + dc.SetClip(new Rectangle(3, 3, width - 5, height - 5)); + + if (button.Enabled) + dc.DrawImage(i, image_x, image_y, image_width, image_height); + else + CPDrawImageDisabled(dc, i, image_x, image_y, ColorControl); + + dc.ResetClip(); + } + + protected virtual void ButtonBase_DrawFocus(ButtonBase button, Graphics dc) + { + Color focus_color = button.ForeColor; + + int inflate_value = -3; + + if (!(button is CheckBox) && !(button is RadioButton)) + { + inflate_value = -4; + + if (button.FlatStyle == FlatStyle.Popup && !button.is_pressed) + focus_color = WidgetPaint.Dark(button.BackColor); + + dc.DrawRectangle(ResPool.GetPen(focus_color), button.ClientRectangle.X, button.ClientRectangle.Y, + button.ClientRectangle.Width - 1, button.ClientRectangle.Height - 1); + } + + if (button.Focused) + { + Rectangle rect = Rectangle.Inflate(button.ClientRectangle, inflate_value, inflate_value); + WidgetPaint.DrawFocusRectangle(dc, rect); + } + } + + protected virtual void ButtonBase_DrawText(ButtonBase button, Graphics dc) + { + Rectangle buttonRectangle = button.ClientRectangle; + Rectangle text_rect = Rectangle.Inflate(buttonRectangle, -4, -4); + + if (button.is_pressed) + { + text_rect.X++; + text_rect.Y++; + } + + // Ensure that at least one line is going to get displayed. + // Line limit does not ensure that despite its description. + text_rect.Height = Math.Max(button.Font.Height, text_rect.Height); + + if (button.Enabled) + { + dc.DrawString(button.Text, button.Font, ResPool.GetSolidBrush(button.ForeColor), text_rect, button.text_format); + } + else + { + if (button.FlatStyle == FlatStyle.Flat || button.FlatStyle == FlatStyle.Popup) + { + dc.DrawString(button.Text, button.Font, ResPool.GetSolidBrush(ColorGrayText), text_rect, button.text_format); + } + else + { + CPDrawStringDisabled(dc, button.Text, button.Font, button.BackColor, text_rect, button.text_format); + } + } + } + + public override Size ButtonBaseDefaultSize + { + get + { + return new Size(75, 23); + } + } + #endregion // ButtonBase + + #region CheckBox + public override void DrawCheckBox(Graphics g, CheckBox cb, Rectangle glyphArea, Rectangle textBounds, Rectangle imageBounds, Rectangle clipRectangle) + { + // Draw Button Background + if (cb.Appearance == Appearance.Button && cb.FlatStyle != FlatStyle.Flat) + ButtonBase_DrawButton(cb, g); + else if (cb.Appearance != Appearance.Button) + DrawCheckBoxGlyph(g, cb, glyphArea); + + // Draw the borders and such for a Flat CheckBox Button + if (cb.Appearance == Appearance.Button && cb.FlatStyle == FlatStyle.Flat) + DrawFlatButton(g, cb, textBounds, imageBounds, clipRectangle); + + // If we have an image, draw it + if (imageBounds.Size != Size.Empty) + DrawCheckBoxImage(g, cb, imageBounds); + + if (cb.Focused && cb.Enabled && cb.ShowFocusCues && textBounds != Rectangle.Empty) + DrawCheckBoxFocus(g, cb, textBounds); + + // If we have text, draw it + if (textBounds != Rectangle.Empty) + DrawCheckBoxText(g, cb, textBounds); + } + + public virtual void DrawCheckBoxGlyph(Graphics g, CheckBox cb, Rectangle glyphArea) + { + if (cb.Pressed) + MemphisThemeElements.CurrentTheme.CheckBoxPainter.PaintCheckBox(g, glyphArea, cb.BackColor, cb.ForeColor, ElementState.Pressed, cb.FlatStyle, cb.CheckState); + else if (cb.InternalSelected) + MemphisThemeElements.CurrentTheme.CheckBoxPainter.PaintCheckBox(g, glyphArea, cb.BackColor, cb.ForeColor, ElementState.Normal, cb.FlatStyle, cb.CheckState); + else if (cb.Entered) + MemphisThemeElements.CurrentTheme.CheckBoxPainter.PaintCheckBox(g, glyphArea, cb.BackColor, cb.ForeColor, ElementState.Hot, cb.FlatStyle, cb.CheckState); + else if (!cb.Enabled) + MemphisThemeElements.CurrentTheme.CheckBoxPainter.PaintCheckBox(g, glyphArea, cb.BackColor, cb.ForeColor, ElementState.Disabled, cb.FlatStyle, cb.CheckState); + else + MemphisThemeElements.CurrentTheme.CheckBoxPainter.PaintCheckBox(g, glyphArea, cb.BackColor, cb.ForeColor, ElementState.Normal, cb.FlatStyle, cb.CheckState); + } + + public virtual void DrawCheckBoxFocus(Graphics g, CheckBox cb, Rectangle focusArea) + { + WidgetPaint.DrawFocusRectangle(g, focusArea); + } + + public virtual void DrawCheckBoxImage(Graphics g, CheckBox cb, Rectangle imageBounds) + { + if (cb.Enabled) + g.DrawImage(cb.Image, imageBounds); + else + CPDrawImageDisabled(g, cb.Image, imageBounds.Left, imageBounds.Top, ColorControl); + } + + public virtual void DrawCheckBoxText(Graphics g, CheckBox cb, Rectangle textBounds) + { + if (cb.Enabled) + TextRenderer.DrawTextInternal(g, cb.Text, cb.Font, textBounds, cb.ForeColor, cb.TextFormatFlags, cb.UseCompatibleTextRendering); + else + DrawStringDisabled20(g, cb.Text, cb.Font, textBounds, cb.BackColor, cb.TextFormatFlags, cb.UseCompatibleTextRendering); + } + + public override void CalculateCheckBoxTextAndImageLayout(ButtonBase button, Point p, out Rectangle glyphArea, out Rectangle textRectangle, out Rectangle imageRectangle) + { + int check_size = CheckSize; + + if (button is CheckBox) + check_size = (button as CheckBox).Appearance == Appearance.Normal ? check_size : 0; + + glyphArea = new Rectangle(button.Padding.Left, button.Padding.Top, check_size, check_size); + + Rectangle content_rect = button.PaddingClientRectangle; + ContentAlignment align = ContentAlignment.TopLeft; + + if (button is CheckBox) + align = (button as CheckBox).CheckAlign; + else if (button is RadioButton) + align = (button as RadioButton).CheckAlign; + + switch (align) + { + case ContentAlignment.BottomCenter: + glyphArea.Y += content_rect.Height - check_size - 2; + glyphArea.X += (content_rect.Width - check_size) / 2; + break; + case ContentAlignment.BottomLeft: + glyphArea.Y += content_rect.Height - check_size - 2; + content_rect.Width -= check_size; + content_rect.Offset(check_size, 0); + break; + case ContentAlignment.BottomRight: + glyphArea.Y += content_rect.Height - check_size - 2; + glyphArea.X += content_rect.Width - check_size; + content_rect.Width -= check_size; + break; + case ContentAlignment.MiddleCenter: + glyphArea.Y += (content_rect.Height - check_size) / 2; + glyphArea.X += (content_rect.Width - check_size) / 2; + break; + case ContentAlignment.MiddleLeft: + glyphArea.Y += (content_rect.Height - check_size) / 2; + content_rect.Width -= check_size; + content_rect.Offset(check_size, 0); + break; + case ContentAlignment.MiddleRight: + glyphArea.Y += (content_rect.Height - check_size) / 2; + glyphArea.X += content_rect.Width - check_size; + content_rect.Width -= check_size; + break; + case ContentAlignment.TopCenter: + glyphArea.X += (content_rect.Width - check_size) / 2; + break; + case ContentAlignment.TopLeft: + content_rect.Width -= check_size; + content_rect.Offset(check_size, 0); + break; + case ContentAlignment.TopRight: + glyphArea.X += content_rect.Width - check_size; + content_rect.Width -= check_size; + break; + } + + Image image = button.Image; + string text = button.Text; + + Size proposed = Size.Empty; + + // Force wrapping if we aren't AutoSize and our text is too long + if (!button.AutoSize) + proposed.Width = button.PaddingClientRectangle.Width - glyphArea.Width - 2; + + Size text_size = TextRenderer.MeasureTextInternal(text, button.Font, proposed, button.TextFormatFlags, button.UseCompatibleTextRendering); + + // Text can't be bigger than the content rectangle + text_size.Height = Math.Min(text_size.Height, content_rect.Height); + text_size.Width = Math.Min(text_size.Width, content_rect.Width); + + Size image_size = image == null ? Size.Empty : image.Size; + + textRectangle = Rectangle.Empty; + imageRectangle = Rectangle.Empty; + + switch (button.TextImageRelation) + { + case TextImageRelation.Overlay: + // Text is centered vertically, and 2 pixels to the right + textRectangle.X = content_rect.Left + 2; + textRectangle.Y = button.PaddingClientRectangle.Top + ((content_rect.Height - text_size.Height) / 2) - 1; + textRectangle.Size = text_size; + + // Image is dependent on ImageAlign + if (image == null) + return; + + int image_x = button.PaddingClientRectangle.Left; + int image_y = button.PaddingClientRectangle.Top; + int image_height = image.Height; + int image_width = image.Width; + + switch (button.ImageAlign) + { + case System.Drawing.ContentAlignment.TopLeft: + image_x += 5; + image_y += 5; + break; + case System.Drawing.ContentAlignment.TopCenter: + image_x += (content_rect.Width - image_width) / 2; + image_y += 5; + break; + case System.Drawing.ContentAlignment.TopRight: + image_x += content_rect.Width - image_width - 5; + image_y += 5; + break; + case System.Drawing.ContentAlignment.MiddleLeft: + image_x += 5; + image_y += (content_rect.Height - image_height) / 2; + break; + case System.Drawing.ContentAlignment.MiddleCenter: + image_x += (content_rect.Width - image_width) / 2; + image_y += (content_rect.Height - image_height) / 2; + break; + case System.Drawing.ContentAlignment.MiddleRight: + image_x += content_rect.Width - image_width - 4; + image_y += (content_rect.Height - image_height) / 2; + break; + case System.Drawing.ContentAlignment.BottomLeft: + image_x += 5; + image_y += content_rect.Height - image_height - 4; + break; + case System.Drawing.ContentAlignment.BottomCenter: + image_x += (content_rect.Width - image_width) / 2; + image_y += content_rect.Height - image_height - 4; + break; + case System.Drawing.ContentAlignment.BottomRight: + image_x += content_rect.Width - image_width - 4; + image_y += content_rect.Height - image_height - 4; + break; + default: + image_x += 5; + image_y += 5; + break; + } + + imageRectangle = new Rectangle(image_x + check_size, image_y, image_width, image_height); + break; + case TextImageRelation.ImageAboveText: + content_rect.Inflate(-4, -4); + LayoutTextAboveOrBelowImage(content_rect, false, text_size, image_size, button.TextAlign, button.ImageAlign, false, out textRectangle, out imageRectangle); + break; + case TextImageRelation.TextAboveImage: + content_rect.Inflate(-4, -4); + LayoutTextAboveOrBelowImage(content_rect, true, text_size, image_size, button.TextAlign, button.ImageAlign, false, out textRectangle, out imageRectangle); + break; + case TextImageRelation.ImageBeforeText: + content_rect.Inflate(-4, -4); + LayoutTextBeforeOrAfterImage(content_rect, false, text_size, image_size, button.TextAlign, button.ImageAlign, out textRectangle, out imageRectangle); + break; + case TextImageRelation.TextBeforeImage: + content_rect.Inflate(-4, -4); + LayoutTextBeforeOrAfterImage(content_rect, true, text_size, image_size, button.TextAlign, button.ImageAlign, out textRectangle, out imageRectangle); + break; + } + } + + public override Size CalculateCheckBoxAutoSize(CheckBox checkBox) + { + Size ret_size = Size.Empty; + Size text_size = TextRenderer.MeasureTextInternal(checkBox.Text, checkBox.Font, checkBox.UseCompatibleTextRendering); + Size image_size = checkBox.Image == null ? Size.Empty : checkBox.Image.Size; + + // Pad the text size + if (checkBox.Text.Length != 0) + { + text_size.Height += 4; + text_size.Width += 4; + } + + switch (checkBox.TextImageRelation) + { + case TextImageRelation.Overlay: + ret_size.Height = Math.Max(checkBox.Text.Length == 0 ? 0 : text_size.Height, image_size.Height); + ret_size.Width = Math.Max(text_size.Width, image_size.Width); + break; + case TextImageRelation.ImageAboveText: + case TextImageRelation.TextAboveImage: + ret_size.Height = text_size.Height + image_size.Height; + ret_size.Width = Math.Max(text_size.Width, image_size.Width); + break; + case TextImageRelation.ImageBeforeText: + case TextImageRelation.TextBeforeImage: + ret_size.Height = Math.Max(text_size.Height, image_size.Height); + ret_size.Width = text_size.Width + image_size.Width; + break; + } + + // Pad the result + ret_size.Height += (checkBox.Padding.Vertical); + ret_size.Width += (checkBox.Padding.Horizontal) + 15; + + // There seems to be a minimum height + if (ret_size.Height == checkBox.Padding.Vertical) + ret_size.Height += 14; + + return ret_size; + } + + public override void DrawCheckBox(Graphics dc, Rectangle clip_area, CheckBox checkbox) + { + StringFormat text_format; + Rectangle client_rectangle; + Rectangle text_rectangle; + Rectangle checkbox_rectangle; + int checkmark_size = CheckSize; + int checkmark_space = 4; + + client_rectangle = checkbox.ClientRectangle; + text_rectangle = client_rectangle; + checkbox_rectangle = new Rectangle(text_rectangle.X, text_rectangle.Y, checkmark_size, checkmark_size); + + text_format = new StringFormat(); + text_format.Alignment = StringAlignment.Near; + text_format.LineAlignment = StringAlignment.Center; + if (checkbox.ShowKeyboardCuesInternal) + text_format.HotkeyPrefix = HotkeyPrefix.Show; + else + text_format.HotkeyPrefix = HotkeyPrefix.Hide; + + /* Calculate the position of text and checkbox rectangle */ + if (checkbox.appearance != Appearance.Button) + { + switch (checkbox.check_alignment) + { + case ContentAlignment.BottomCenter: + { + checkbox_rectangle.X = (client_rectangle.Right - client_rectangle.Left) / 2 - checkmark_size / 2; + checkbox_rectangle.Y = client_rectangle.Bottom - checkmark_size; + text_rectangle.X = client_rectangle.X; + text_rectangle.Width = client_rectangle.Width; + text_rectangle.Height = client_rectangle.Height - checkbox_rectangle.Y - checkmark_space; + break; + } + + case ContentAlignment.BottomLeft: + { + checkbox_rectangle.X = client_rectangle.Left; + checkbox_rectangle.Y = client_rectangle.Bottom - checkmark_size; + text_rectangle.X = client_rectangle.X + checkmark_size + checkmark_space; + text_rectangle.Width = client_rectangle.Width - checkmark_size - checkmark_space; + break; + } + + case ContentAlignment.BottomRight: + { + checkbox_rectangle.X = client_rectangle.Right - checkmark_size; + checkbox_rectangle.Y = client_rectangle.Bottom - checkmark_size; + text_rectangle.X = client_rectangle.X; + text_rectangle.Width = client_rectangle.Width - checkmark_size - checkmark_space; + break; + } + + case ContentAlignment.MiddleCenter: + { + checkbox_rectangle.X = (client_rectangle.Right - client_rectangle.Left) / 2 - checkmark_size / 2; + checkbox_rectangle.Y = (client_rectangle.Bottom - client_rectangle.Top) / 2 - checkmark_size / 2; + text_rectangle.X = client_rectangle.X; + text_rectangle.Width = client_rectangle.Width; + break; + } + + default: + case ContentAlignment.MiddleLeft: + { + checkbox_rectangle.X = client_rectangle.Left; + checkbox_rectangle.Y = (client_rectangle.Bottom - client_rectangle.Top) / 2 - checkmark_size / 2; + text_rectangle.X = client_rectangle.X + checkmark_size + checkmark_space; + text_rectangle.Width = client_rectangle.Width - checkmark_size - checkmark_space; + break; + } + + case ContentAlignment.MiddleRight: + { + checkbox_rectangle.X = client_rectangle.Right - checkmark_size; + checkbox_rectangle.Y = (client_rectangle.Bottom - client_rectangle.Top) / 2 - checkmark_size / 2; + text_rectangle.X = client_rectangle.X; + text_rectangle.Width = client_rectangle.Width - checkmark_size - checkmark_space; + break; + } + + case ContentAlignment.TopCenter: + { + checkbox_rectangle.X = (client_rectangle.Right - client_rectangle.Left) / 2 - checkmark_size / 2; + checkbox_rectangle.Y = client_rectangle.Top; + text_rectangle.X = client_rectangle.X; + text_rectangle.Width = client_rectangle.Width; + text_rectangle.Y = checkmark_size + checkmark_space; + text_rectangle.Height = client_rectangle.Height - checkmark_size - checkmark_space; + break; + } + + case ContentAlignment.TopLeft: + { + checkbox_rectangle.X = client_rectangle.Left; + text_rectangle.X = client_rectangle.X + checkmark_size + checkmark_space; + text_rectangle.Width = client_rectangle.Width - checkmark_size - checkmark_space; + break; + } + + case ContentAlignment.TopRight: + { + checkbox_rectangle.X = client_rectangle.Right - checkmark_size; + text_rectangle.X = client_rectangle.X; + text_rectangle.Width = client_rectangle.Width - checkmark_size - checkmark_space; + break; + } + } + } + else + { + text_rectangle.X = client_rectangle.X; + text_rectangle.Width = client_rectangle.Width; + } + + /* Set the horizontal alignment of our text */ + switch (checkbox.text_alignment) + { + case ContentAlignment.BottomLeft: + case ContentAlignment.MiddleLeft: + case ContentAlignment.TopLeft: + { + text_format.Alignment = StringAlignment.Near; + break; + } + + case ContentAlignment.BottomCenter: + case ContentAlignment.MiddleCenter: + case ContentAlignment.TopCenter: + { + text_format.Alignment = StringAlignment.Center; + break; + } + + case ContentAlignment.BottomRight: + case ContentAlignment.MiddleRight: + case ContentAlignment.TopRight: + { + text_format.Alignment = StringAlignment.Far; + break; + } + } + + /* Set the vertical alignment of our text */ + switch (checkbox.text_alignment) + { + case ContentAlignment.TopLeft: + case ContentAlignment.TopCenter: + case ContentAlignment.TopRight: + { + text_format.LineAlignment = StringAlignment.Near; + break; + } + + case ContentAlignment.BottomLeft: + case ContentAlignment.BottomCenter: + case ContentAlignment.BottomRight: + { + text_format.LineAlignment = StringAlignment.Far; + break; + } + + case ContentAlignment.MiddleLeft: + case ContentAlignment.MiddleCenter: + case ContentAlignment.MiddleRight: + { + text_format.LineAlignment = StringAlignment.Center; + break; + } + } + + ButtonState state = ButtonState.Normal; + if (checkbox.FlatStyle == FlatStyle.Flat) + { + state |= ButtonState.Flat; + } + + if (checkbox.Checked) + { + state |= ButtonState.Checked; + } + + if (checkbox.ThreeState && (checkbox.CheckState == CheckState.Indeterminate)) + { + state |= ButtonState.Checked; + state |= ButtonState.Pushed; + } + + // finally make sure the pushed and inavtive states are rendered + if (!checkbox.Enabled) + { + state |= ButtonState.Inactive; + } + else if (checkbox.is_pressed) + { + state |= ButtonState.Pushed; + } + + // Start drawing + + CheckBox_DrawCheckBox(dc, checkbox, state, checkbox_rectangle); + + if ((checkbox.image != null) || (checkbox.image_list != null)) + ButtonBase_DrawImage(checkbox, dc); + + CheckBox_DrawText(checkbox, text_rectangle, dc, text_format); + + if (checkbox.Focused && checkbox.Enabled && checkbox.appearance != Appearance.Button && checkbox.Text != String.Empty && checkbox.ShowFocusCues) + { + SizeF text_size = dc.MeasureString(checkbox.Text, checkbox.Font); + + Rectangle focus_rect = Rectangle.Empty; + focus_rect.X = text_rectangle.X; + focus_rect.Y = (int)((text_rectangle.Height - text_size.Height) / 2); + focus_rect.Size = text_size.ToSize(); + CheckBox_DrawFocus(checkbox, dc, focus_rect); + } + + text_format.Dispose(); + } + + protected virtual void CheckBox_DrawCheckBox(Graphics dc, CheckBox checkbox, ButtonState state, Rectangle checkbox_rectangle) + { + Brush brush = checkbox.BackColor.ToArgb() == ColorControl.ToArgb() ? SystemBrushes.Control : ResPool.GetSolidBrush(checkbox.BackColor); + dc.FillRectangle(brush, checkbox.ClientRectangle); + // render as per normal button + if (checkbox.appearance == Appearance.Button) + { + ButtonBase_DrawButton(checkbox, dc); + + if ((checkbox.Focused) && checkbox.Enabled) + ButtonBase_DrawFocus(checkbox, dc); + } + else + { + // establish if we are rendering a flat style of some sort + if (checkbox.FlatStyle == FlatStyle.Flat || checkbox.FlatStyle == FlatStyle.Popup) + { + DrawFlatStyleCheckBox(dc, checkbox_rectangle, checkbox); + } + else + { + CPDrawCheckBox(dc, checkbox_rectangle, state); + } + } + } + + protected virtual void CheckBox_DrawText(CheckBox checkbox, Rectangle text_rectangle, Graphics dc, StringFormat text_format) + { + DrawCheckBox_and_RadioButtonText(checkbox, text_rectangle, dc, + text_format, checkbox.Appearance, checkbox.Checked); + } + + protected virtual void CheckBox_DrawFocus(CheckBox checkbox, Graphics dc, Rectangle text_rectangle) + { + DrawInnerFocusRectangle(dc, text_rectangle, checkbox.BackColor); + } + + // renders a checkBox with the Flat and Popup FlatStyle + protected virtual void DrawFlatStyleCheckBox(Graphics graphics, Rectangle rectangle, CheckBox checkbox) + { + Pen pen; + Rectangle rect; + Rectangle checkbox_rectangle; + Rectangle fill_rectangle; + int lineWidth; + int Scale; + + // set up our rectangles first + if (checkbox.FlatStyle == FlatStyle.Popup && checkbox.is_entered) + { + // clip one pixel from bottom right for non popup rendered checkboxes + checkbox_rectangle = new Rectangle(rectangle.X, rectangle.Y, Math.Max(rectangle.Width - 1, 0), Math.Max(rectangle.Height - 1, 0)); + fill_rectangle = new Rectangle(checkbox_rectangle.X + 1, checkbox_rectangle.Y + 1, Math.Max(checkbox_rectangle.Width - 3, 0), Math.Max(checkbox_rectangle.Height - 3, 0)); + } + else + { + // clip two pixels from bottom right for non popup rendered checkboxes + checkbox_rectangle = new Rectangle(rectangle.X, rectangle.Y, Math.Max(rectangle.Width - 2, 0), Math.Max(rectangle.Height - 2, 0)); + fill_rectangle = new Rectangle(checkbox_rectangle.X + 1, checkbox_rectangle.Y + 1, Math.Max(checkbox_rectangle.Width - 2, 0), Math.Max(checkbox_rectangle.Height - 2, 0)); + } + + + // if disabled render in disabled state + if (checkbox.Enabled) + { + // process the state of the checkbox + if (checkbox.is_entered || checkbox.Capture) + { + // decide on which background color to use + if (checkbox.FlatStyle == FlatStyle.Popup && checkbox.is_entered && checkbox.Capture) + { + graphics.FillRectangle(ResPool.GetSolidBrush(checkbox.BackColor), fill_rectangle); + } + else if (checkbox.FlatStyle == FlatStyle.Flat) + { + if (!checkbox.is_pressed) + { + graphics.FillRectangle(ResPool.GetSolidBrush(checkbox.BackColor), fill_rectangle); + } + else + graphics.FillRectangle(ResPool.GetSolidBrush(WidgetPaint.LightLight(checkbox.BackColor)), fill_rectangle); + } + else + { + // use regular window background color + graphics.FillRectangle(ResPool.GetSolidBrush(WidgetPaint.LightLight(checkbox.BackColor)), fill_rectangle); + } + + // render the outer border + if (checkbox.FlatStyle == FlatStyle.Flat) + { + WidgetPaint.DrawBorder(graphics, checkbox_rectangle, checkbox.ForeColor, ButtonBorderStyle.Solid); + } + else + { + // draw sunken effect + CPDrawBorder3D(graphics, checkbox_rectangle, Border3DStyle.SunkenInner, Border3DSide.Left | Border3DSide.Right | Border3DSide.Top | Border3DSide.Bottom, checkbox.BackColor); + } + } + else + { + graphics.FillRectangle(ResPool.GetSolidBrush(WidgetPaint.LightLight(checkbox.BackColor)), fill_rectangle); + + if (checkbox.FlatStyle == FlatStyle.Flat) + { + WidgetPaint.DrawBorder(graphics, checkbox_rectangle, checkbox.ForeColor, ButtonBorderStyle.Solid); + } + else + { + // draw the outer border + WidgetPaint.DrawBorder(graphics, checkbox_rectangle, WidgetPaint.DarkDark(checkbox.BackColor), ButtonBorderStyle.Solid); + } + } + } + else + { + if (checkbox.FlatStyle == FlatStyle.Popup) + { + graphics.FillRectangle(SystemBrushes.Control, fill_rectangle); + } + + // draw disabled state, + WidgetPaint.DrawBorder(graphics, checkbox_rectangle, ColorControlDark, ButtonBorderStyle.Solid); + } + + if (checkbox.Checked) + { + /* Need to draw a check-mark */ + + /* Make sure we've got at least a line width of 1 */ + lineWidth = Math.Max(3, fill_rectangle.Width / 3); + Scale = Math.Max(1, fill_rectangle.Width / 9); + + // flat style check box is rendered inside a rectangle shifted down by one + rect = new Rectangle(fill_rectangle.X, fill_rectangle.Y + 1, fill_rectangle.Width, fill_rectangle.Height); + if (checkbox.Enabled) + { + pen = ResPool.GetPen(checkbox.ForeColor); + } + else + { + pen = SystemPens.ControlDark; + } + + for (int i = 0; i < lineWidth; i++) + { + graphics.DrawLine(pen, rect.Left + lineWidth / 2, rect.Top + lineWidth + i, rect.Left + lineWidth / 2 + 2 * Scale, rect.Top + lineWidth + 2 * Scale + i); + graphics.DrawLine(pen, rect.Left + lineWidth / 2 + 2 * Scale, rect.Top + lineWidth + 2 * Scale + i, rect.Left + lineWidth / 2 + 6 * Scale, rect.Top + lineWidth - 2 * Scale + i); + } + } + } + + private void DrawCheckBox_and_RadioButtonText(ButtonBase button_base, Rectangle text_rectangle, Graphics dc, + StringFormat text_format, Appearance appearance, bool ischecked) + { + // offset the text if it's pressed and a button + if (appearance == Appearance.Button) + { + if (ischecked || (button_base.Capture && button_base.FlatStyle != FlatStyle.Flat)) + { + text_rectangle.X++; + text_rectangle.Y++; + } + + text_rectangle.Inflate(-4, -4); + } + + /* Place the text; to be compatible with Windows place it after the checkbox has been drawn */ + + // Windows seems to not wrap text in certain situations, this matches as close as I could get it + if ((float)(button_base.Font.Height * 1.5f) > text_rectangle.Height) + { + text_format.FormatFlags |= StringFormatFlags.NoWrap; + } + if (button_base.Enabled) + { + dc.DrawString(button_base.Text, button_base.Font, ResPool.GetSolidBrush(button_base.ForeColor), text_rectangle, text_format); + } + else if (button_base.FlatStyle == FlatStyle.Flat || button_base.FlatStyle == FlatStyle.Popup) + { + dc.DrawString(button_base.Text, button_base.Font, SystemBrushes.ControlDarkDark, text_rectangle, text_format); + } + else + { + CPDrawStringDisabled(dc, button_base.Text, button_base.Font, button_base.BackColor, text_rectangle, text_format); + } + } + #endregion // CheckBox + + #region CheckedListBox + + public override void DrawCheckedListBoxItem(CheckedListBox ctrl, DrawItemEventArgs e) + { + Color back_color, fore_color; + Rectangle item_rect = e.Bounds; + ButtonState state; + + /* Draw checkbox */ + + if ((e.State & DrawItemState.Checked) == DrawItemState.Checked) + { + state = ButtonState.Checked; + if ((e.State & DrawItemState.Inactive) == DrawItemState.Inactive) + state |= ButtonState.Inactive; + } + else + state = ButtonState.Normal; + + if (ctrl.ThreeDCheckBoxes == false) + state |= ButtonState.Flat; + + Rectangle checkbox_rect = new Rectangle(2, (item_rect.Height - 11) / 2, CheckSize, CheckSize); + WidgetPaint.DrawCheckBox(e.Graphics, + item_rect.X + checkbox_rect.X, item_rect.Y + checkbox_rect.Y, + checkbox_rect.Width, checkbox_rect.Height, + state); + + item_rect.X += checkbox_rect.Right; + item_rect.Width -= checkbox_rect.Right; + + /* Draw text*/ + if ((e.State & DrawItemState.Selected) == DrawItemState.Selected) + { + back_color = ColorHighlight; + fore_color = ColorHighlightText; + } + else + { + back_color = e.BackColor; + fore_color = e.ForeColor; + } + + e.Graphics.FillRectangle(ResPool.GetSolidBrush + (back_color), item_rect); + + e.Graphics.DrawString(ctrl.GetItemText(ctrl.Items[e.Index]), e.Font, + ResPool.GetSolidBrush(fore_color), + item_rect, ctrl.StringFormat); + + if ((e.State & DrawItemState.Focus) == DrawItemState.Focus) + { + CPDrawFocusRectangle(e.Graphics, item_rect, + fore_color, back_color); + } + } + + #endregion // CheckedListBox + + #region ComboBox + public override void DrawComboBoxItem(ComboBox ctrl, DrawItemEventArgs e) + { + Color back_color, fore_color; + Rectangle text_draw = e.Bounds; + StringFormat string_format = new StringFormat(); + string_format.FormatFlags = StringFormatFlags.LineLimit; + + if ((e.State & DrawItemState.Selected) == DrawItemState.Selected) + { + back_color = ColorHighlight; + fore_color = ColorHighlightText; + } + else + { + back_color = e.BackColor; + fore_color = e.ForeColor; + } + + if (!ctrl.Enabled) + fore_color = ColorInactiveCaptionText; + + e.Graphics.FillRectangle(ResPool.GetSolidBrush(back_color), e.Bounds); + + if (e.Index != -1) + { + e.Graphics.DrawString(ctrl.GetItemText(ctrl.Items[e.Index]), e.Font, + ResPool.GetSolidBrush(fore_color), + text_draw, string_format); + } + + if ((e.State & DrawItemState.Focus) == DrawItemState.Focus) + { + CPDrawFocusRectangle(e.Graphics, e.Bounds, fore_color, back_color); + } + + string_format.Dispose(); + } + + public override void DrawFlatStyleComboButton(Graphics graphics, Rectangle rectangle, ButtonState state) + { + Point[] arrow = new Point[3]; + Point P1; + Point P2; + Point P3; + int centerX; + int centerY; + int shiftX; + int shiftY; + Rectangle rect; + + rect = new Rectangle(rectangle.X + rectangle.Width / 4, rectangle.Y + rectangle.Height / 4, rectangle.Width / 2, rectangle.Height / 2); + centerX = rect.Left + rect.Width / 2; + centerY = rect.Top + rect.Height / 2; + shiftX = Math.Max(1, rect.Width / 8); + shiftY = Math.Max(1, rect.Height / 8); + + if ((state & ButtonState.Pushed) != 0) + { + shiftX++; + shiftY++; + } + + rect.Y -= shiftY; + centerY -= shiftY; + P1 = new Point(rect.Left + 1, centerY); + P2 = new Point(rect.Right - 1, centerY); + P3 = new Point(centerX, rect.Bottom - 1); + + arrow[0] = P1; + arrow[1] = P2; + arrow[2] = P3; + + /* Draw the arrow */ + if ((state & ButtonState.Inactive) != 0) + { + /* Move away from the shadow */ + arrow[0].X += 1; arrow[0].Y += 1; + arrow[1].X += 1; arrow[1].Y += 1; + arrow[2].X += 1; arrow[2].Y += 1; + + graphics.FillPolygon(SystemBrushes.ControlLightLight, arrow, FillMode.Winding); + + arrow[0] = P1; + arrow[1] = P2; + arrow[2] = P3; + + graphics.FillPolygon(SystemBrushes.ControlDark, arrow, FillMode.Winding); + } + else + { + graphics.FillPolygon(SystemBrushes.ControlText, arrow, FillMode.Winding); + } + } + public override void ComboBoxDrawNormalDropDownButton(ComboBox comboBox, Graphics g, Rectangle clippingArea, Rectangle area, ButtonState state) + { + CPDrawComboButton(g, area, state); + } + public override bool ComboBoxNormalDropDownButtonHasTransparentBackground(ComboBox comboBox, ButtonState state) + { + return true; + } + public override bool ComboBoxDropDownButtonHasHotElementStyle(ComboBox comboBox) + { + return false; + } + public override void ComboBoxDrawBackground(ComboBox comboBox, Graphics g, Rectangle clippingArea, FlatStyle style) + { + if (!comboBox.Enabled) + g.FillRectangle(ResPool.GetSolidBrush(ColorControl), comboBox.ClientRectangle); + + if (comboBox.DropDownStyle == ComboBoxStyle.Simple) + g.FillRectangle(ResPool.GetSolidBrush(comboBox.Parent.BackColor), comboBox.ClientRectangle); + + if (style == FlatStyle.Popup && (comboBox.Entered || comboBox.Focused)) + { + Rectangle area = comboBox.TextArea; + area.Height -= 1; + area.Width -= 1; + g.DrawRectangle(ResPool.GetPen(SystemColors.ControlDark), area); + g.DrawLine(ResPool.GetPen(SystemColors.ControlDark), comboBox.ButtonArea.X - 1, comboBox.ButtonArea.Top, comboBox.ButtonArea.X - 1, comboBox.ButtonArea.Bottom); + } + bool is_flat = style == FlatStyle.Flat || style == FlatStyle.Popup; + if (!is_flat && clippingArea.IntersectsWith(comboBox.TextArea)) + WidgetPaint.DrawBorder3D(g, comboBox.TextArea, Border3DStyle.Sunken); + } + public override bool CombBoxBackgroundHasHotElementStyle(ComboBox comboBox) + { + return false; + } + #endregion ComboBox + + /* FIXME: NEIN. I will NOT port DataGrids over. + #region Datagrid + public override int DataGridPreferredColumnWidth { get { return 75;} } + public override int DataGridMinimumColumnCheckBoxHeight { get { return 16;} } + public override int DataGridMinimumColumnCheckBoxWidth { get { return 16;} } + public override Color DataGridAlternatingBackColor { get { return ColorWindow;} } + public override Color DataGridBackColor { get { return ColorWindow;} } + public override Color DataGridBackgroundColor { get { return ColorAppWorkspace;} } + public override Color DataGridCaptionBackColor { get { return ColorActiveCaption;} } + public override Color DataGridCaptionForeColor { get { return ColorActiveCaptionText;} } + public override Color DataGridGridLineColor { get { return ColorControl;} } + public override Color DataGridHeaderBackColor { get { return ColorControl;} } + public override Color DataGridHeaderForeColor { get { return ColorControlText;} } + public override Color DataGridLinkColor { get { return ColorHotTrack;} } + public override Color DataGridLinkHoverColor { get { return ColorHotTrack;} } + public override Color DataGridParentRowsBackColor { get { return ColorControl;} } + public override Color DataGridParentRowsForeColor { get { return ColorWindowText;} } + public override Color DataGridSelectionBackColor { get { return ColorActiveCaption;} } + public override Color DataGridSelectionForeColor { get { return ColorActiveCaptionText;} } + + public override void DataGridPaint (PaintEventArgs pe, DataGrid grid) + { + DataGridPaintCaption (pe.Graphics, pe.ClipRectangle, grid); + DataGridPaintParentRows (pe.Graphics, pe.ClipRectangle, grid); + DataGridPaintColumnHeaders (pe.Graphics, pe.ClipRectangle, grid); + DataGridPaintRows (pe.Graphics, grid.cells_area, pe.ClipRectangle, grid); + + // Paint scrollBar corner + if (grid.VScrollBar.Visible && grid.HScrollBar.Visible) { + + Rectangle corner = new Rectangle (grid.ClientRectangle.X + grid.ClientRectangle.Width - grid.VScrollBar.Width, + grid.ClientRectangle.Y + grid.ClientRectangle.Height - grid.HScrollBar.Height, + grid.VScrollBar.Width, grid.HScrollBar.Height); + + if (pe.ClipRectangle.IntersectsWith (corner)) { + pe.Graphics.FillRectangle (ResPool.GetSolidBrush (grid.ParentRowsBackColor), + corner); + } + } + } + + public override void DataGridPaintCaption (Graphics g, Rectangle clip, DataGrid grid) + { + Rectangle bounds = clip; + bounds.Intersect (grid.caption_area); + + // Background + g.FillRectangle (ResPool.GetSolidBrush (grid.CaptionBackColor), bounds); + + // Bottom line + g.DrawLine (ResPool.GetPen (grid.CurrentTableStyle.CurrentHeaderForeColor), + bounds.X, bounds.Y + bounds.Height -1, + bounds.X + bounds.Width, bounds.Y + bounds.Height -1); + + // Caption text + if (grid.CaptionText != String.Empty) { + Rectangle text_rect = grid.caption_area; + text_rect.Y += text_rect.Height / 2 - grid.CaptionFont.Height / 2; + text_rect.Height = grid.CaptionFont.Height; + + g.DrawString (grid.CaptionText, grid.CaptionFont, + ResPool.GetSolidBrush (grid.CaptionForeColor), + text_rect); + } + + // Back button + if (bounds.IntersectsWith (grid.back_button_rect)) { + g.DrawImage (grid.back_button_image, grid.back_button_rect); + if (grid.back_button_mouseover) { + CPDrawBorder3D (g, grid.back_button_rect, grid.back_button_active ? Border3DStyle.Sunken : Border3DStyle.Raised, all_sides); + } + } + + // Rows button + if (bounds.IntersectsWith (grid.parent_rows_button_rect)) { + g.DrawImage (grid.parent_rows_button_image, grid.parent_rows_button_rect); + if (grid.parent_rows_button_mouseover) { + CPDrawBorder3D (g, grid.parent_rows_button_rect, grid.parent_rows_button_active ? Border3DStyle.Sunken : Border3DStyle.Raised, all_sides); + } + } + } + + public override void DataGridPaintColumnHeaders (Graphics g, Rectangle clip, DataGrid grid) + { + if (!grid.CurrentTableStyle.ColumnHeadersVisible) + return; + + Rectangle columns_area = grid.column_headers_area; + + // Paint corner shared between row and column header + if (grid.CurrentTableStyle.CurrentRowHeadersVisible) { + Rectangle rect_bloc = grid.column_headers_area; + rect_bloc.Width = grid.RowHeaderWidth; + if (clip.IntersectsWith (rect_bloc)) { + if (grid.FlatMode) + g.FillRectangle (ResPool.GetSolidBrush (grid.CurrentTableStyle.CurrentHeaderBackColor), rect_bloc); + else + CPDrawBorder3D (g, rect_bloc, Border3DStyle.RaisedInner, + Border3DSide.Left | Border3DSide.Right | + Border3DSide.Top | Border3DSide.Bottom | Border3DSide.Middle, + grid.CurrentTableStyle.CurrentHeaderBackColor); + } + + columns_area.X += grid.RowHeaderWidth; + columns_area.Width -= grid.RowHeaderWidth; + } + + // Set column painting + Rectangle rect_columnhdr = new Rectangle (); + int col_pixel; + Region current_clip; + Region prev_clip = g.Clip; + rect_columnhdr.Y = columns_area.Y; + rect_columnhdr.Height = columns_area.Height; + + int column_cnt = grid.FirstVisibleColumn + grid.VisibleColumnCount; + for (int column = grid.FirstVisibleColumn; column < column_cnt; column++) { + if (grid.CurrentTableStyle.GridColumnStyles[column].bound == false) + continue; + + col_pixel = grid.GetColumnStartingPixel (column); + rect_columnhdr.X = columns_area.X + col_pixel - grid.HorizPixelOffset; + rect_columnhdr.Width = grid.CurrentTableStyle.GridColumnStyles[column].Width; + + if (clip.IntersectsWith (rect_columnhdr) == false) + continue; + + current_clip = new Region (rect_columnhdr); + current_clip.Intersect (columns_area); + current_clip.Intersect (prev_clip); + g.Clip = current_clip; + + DataGridPaintColumnHeader (g, rect_columnhdr, grid, column); + + current_clip.Dispose (); + } + + g.Clip = prev_clip; + + Rectangle not_usedarea = grid.column_headers_area; + not_usedarea.X = (column_cnt == 0) ? grid.RowHeaderWidth : rect_columnhdr.X + rect_columnhdr.Width; + not_usedarea.Width = grid.ClientRectangle.X + grid.ClientRectangle.Width - not_usedarea.X; + g.FillRectangle (ResPool.GetSolidBrush (grid.BackgroundColor), not_usedarea); + } + + public override void DataGridPaintColumnHeader (Graphics g, Rectangle bounds, DataGrid grid, int col) + { + // Background + g.FillRectangle (ResPool.GetSolidBrush (grid.CurrentTableStyle.HeaderBackColor), bounds); + + // Paint Borders + if (!grid.FlatMode) { + g.DrawLine (ResPool.GetPen (ColorControlLightLight), + bounds.X, bounds.Y, bounds.X + bounds.Width, bounds.Y); + + if (col == 0) { + g.DrawLine (ResPool.GetPen (ColorControlLightLight), + bounds.X, bounds.Y, bounds.X, bounds.Y + bounds.Height); + } else { + g.DrawLine (ResPool.GetPen (ColorControlLightLight), + bounds.X, bounds.Y + 2, bounds.X, bounds.Y + bounds.Height - 3); + } + + if (col == (grid.VisibleColumnCount -1)) { + g.DrawLine (ResPool.GetPen (ColorControlDark), + bounds.X + bounds.Width - 1, bounds.Y, + bounds.X + bounds.Width - 1, bounds.Y + bounds.Height); + } else { + g.DrawLine (ResPool.GetPen (ColorControlDark), + bounds.X + bounds.Width - 1, bounds.Y + 2, + bounds.X + bounds.Width - 1, bounds.Y + bounds.Height - 3); + } + + g.DrawLine (ResPool.GetPen (ColorControlDark), + bounds.X, bounds.Y + bounds.Height - 1, + bounds.X + bounds.Width, bounds.Y + bounds.Height - 1); + } + + bounds.X += 2; + bounds.Width -= 2; + + DataGridColumnStyle style = grid.CurrentTableStyle.GridColumnStyles[col]; + + if (style.ArrowDrawingMode != DataGridColumnStyle.ArrowDrawing.No) + bounds.Width -= 16; + + // Caption + StringFormat format = new StringFormat (); + format.FormatFlags |= StringFormatFlags.NoWrap; + format.LineAlignment = StringAlignment.Center; + format.Trimming = StringTrimming.Character; + + g.DrawString (style.HeaderText, grid.CurrentTableStyle.HeaderFont, + ResPool.GetSolidBrush (grid.CurrentTableStyle.CurrentHeaderForeColor), + bounds, format); + + // Arrow (6 x 6) + if (style.ArrowDrawingMode != DataGridColumnStyle.ArrowDrawing.No) { + Point pnt = new Point (bounds.X + bounds.Width + 4, bounds.Y + ((bounds.Height - 6)/2)); + + if (style.ArrowDrawingMode == DataGridColumnStyle.ArrowDrawing.Ascending) { + g.DrawLine (SystemPens.ControlLightLight, pnt.X + 6, pnt.Y + 6, pnt.X + 3, pnt.Y); + g.DrawLine (SystemPens.ControlDark, pnt.X, pnt.Y + 6, pnt.X + 6, pnt.Y + 6); + g.DrawLine (SystemPens.ControlDark, pnt.X, pnt.Y + 6, pnt.X + 3, pnt.Y); + } else { + g.DrawLine (SystemPens.ControlLightLight, pnt.X + 6, pnt.Y, pnt.X + 3, pnt.Y + 6); + g.DrawLine (SystemPens.ControlDark, pnt.X, pnt.Y, pnt.X + 6, pnt.Y); + g.DrawLine (SystemPens.ControlDark, pnt.X, pnt.Y, pnt.X + 3, pnt.Y + 6); + } + } + } + + public override void DataGridPaintParentRows (Graphics g, Rectangle clip, DataGrid grid) + { + Rectangle rect_row = new Rectangle (); + + rect_row.X = grid.ParentRowsArea.X; + rect_row.Width = grid.ParentRowsArea.Width; + rect_row.Height = (grid.CaptionFont.Height + 3); + + object[] parentRows = grid.data_source_stack.ToArray(); + + Region current_clip; + Region prev_clip = g.Clip; + for (int row = 0; row < parentRows.Length; row++) { + rect_row.Y = grid.ParentRowsArea.Y + row * rect_row.Height; + + if (clip.IntersectsWith (rect_row) == false) + continue; + + current_clip = new Region (rect_row); + current_clip.Intersect (prev_clip); + g.Clip = current_clip; + + DataGridPaintParentRow (g, rect_row, (DataGridDataSource)parentRows[parentRows.Length - row - 1], grid); + + current_clip.Dispose (); + } + + g.Clip = prev_clip; + } + + public override void DataGridPaintParentRow (Graphics g, Rectangle bounds, DataGridDataSource row, DataGrid grid) + { + // Background + g.FillRectangle (ResPool.GetSolidBrush (grid.ParentRowsBackColor), + bounds); + + Font bold_font = new Font (grid.Font.FontFamily, grid.Font.Size, grid.Font.Style | FontStyle.Bold); + // set up some standard string formating variables + StringFormat text_format = new StringFormat(); + text_format.LineAlignment = StringAlignment.Center; + text_format.Alignment = StringAlignment.Near; + + string table_name = ""; + if (row.view is DataRowView) + table_name = ((ITypedList)((DataRowView)row.view).DataView).GetListName (null) + ": "; + // XXX else? + + Rectangle text_rect; + Size text_size; + + text_size = g.MeasureString (table_name, bold_font).ToSize(); + text_rect = new Rectangle(new Point(bounds.X + 3, bounds.Y + bounds.Height - text_size.Height), text_size); + + g.DrawString (table_name, + bold_font, ResPool.GetSolidBrush (grid.ParentRowsForeColor), text_rect, text_format); + + foreach (PropertyDescriptor pd in ((ICustomTypeDescriptor)row.view).GetProperties()) { + if (typeof(IBindingList).IsAssignableFrom (pd.PropertyType)) + continue; + + text_rect.X += text_rect.Size.Width + 5; + + string text = String.Format ("{0}: {1}", + pd.Name, + pd.GetValue (row.view)); + + text_rect.Size = g.MeasureString (text, grid.Font).ToSize(); + text_rect.Y = bounds.Y + bounds.Height - text_rect.Height; // XXX + + g.DrawString (text, + grid.Font, ResPool.GetSolidBrush (grid.ParentRowsForeColor), text_rect, text_format); + } + + // Paint Borders + if (!grid.FlatMode) { + CPDrawBorder3D (g, bounds, Border3DStyle.RaisedInner, + Border3DSide.Left | Border3DSide.Right | + Border3DSide.Top | Border3DSide.Bottom); + } + } + + public override void DataGridPaintRowHeaderArrow (Graphics g, Rectangle bounds, DataGrid grid) + { + Point[] arrow = new Point[3]; + Point P1, P2, P3; + int centerX, centerY, shiftX; + Rectangle rect; + + rect = new Rectangle (bounds.X + bounds.Width /4, + bounds.Y + bounds.Height/4, bounds.Width / 2, bounds.Height / 2); + + centerX = rect.Left + rect.Width / 2; + centerY = rect.Top + rect.Height / 2; + shiftX = Math.Max (1, rect.Width / 8); + rect.X -= shiftX; + centerX -= shiftX; + P1 = new Point (centerX, rect.Top - 1); + P2 = new Point (centerX, rect.Bottom); + P3 = new Point (rect.Right, centerY); + arrow[0] = P1; + arrow[1] = P2; + arrow[2] = P3; + + g.FillPolygon (ResPool.GetSolidBrush + (grid.CurrentTableStyle.CurrentHeaderForeColor), arrow, FillMode.Winding); + } + + public override void DataGridPaintRowHeaderStar (Graphics g, Rectangle bounds, DataGrid grid) + { + int x = bounds.X + 4; + int y = bounds.Y + 3; + Pen pen = ResPool.GetPen (grid.CurrentTableStyle.CurrentHeaderForeColor); + + g.DrawLine (pen, x + 4, y, x + 4, y + 8); + g.DrawLine (pen, x, y + 4, x + 8, y + 4); + g.DrawLine (pen, x + 1, y + 1, x + 7, y + 7); + g.DrawLine (pen, x + 7, y + 1, x + 1, y + 7); + } + + public override void DataGridPaintRowHeader (Graphics g, Rectangle bounds, int row, DataGrid grid) + { + bool is_add_row = grid.ShowEditRow && row == grid.DataGridRows.Length - 1; + bool is_current_row = row == grid.CurrentCell.RowNumber; + + // Background + g.FillRectangle (ResPool.GetSolidBrush (grid.CurrentTableStyle.CurrentHeaderBackColor), bounds); + + // Draw arrow + if (is_current_row) { + if (grid.IsChanging) { + g.DrawString ("..", grid.Font, + ResPool.GetSolidBrush (grid.CurrentTableStyle.CurrentHeaderForeColor), + bounds); + } else { + Rectangle rect = new Rectangle (bounds.X - 2, bounds.Y, 18, 18); + DataGridPaintRowHeaderArrow (g, rect, grid); + } + } + else if (is_add_row) { + DataGridPaintRowHeaderStar (g, bounds, grid); + } + + if (!grid.FlatMode && !is_add_row) { + CPDrawBorder3D (g, bounds, Border3DStyle.RaisedInner, + Border3DSide.Left | Border3DSide.Right | + Border3DSide.Top | Border3DSide.Bottom); + } + } + + public override void DataGridPaintRows (Graphics g, Rectangle cells, Rectangle clip, DataGrid grid) + { + Rectangle rect_row = new Rectangle (); + Rectangle not_usedarea = new Rectangle (); + + int rowcnt = grid.VisibleRowCount; + + bool showing_add_row = false; + + if (grid.RowsCount < grid.DataGridRows.Length) { + /* the table has an add row + + if (grid.FirstVisibleRow + grid.VisibleRowCount >= grid.DataGridRows.Length) { + showing_add_row = true; + } + } + + rect_row.Width = cells.Width + grid.RowHeadersArea.Width; + for (int r = 0; r < rowcnt; r++) { + int row = grid.FirstVisibleRow + r; + if (row == grid.DataGridRows.Length - 1) + rect_row.Height = grid.DataGridRows[row].Height; + else + rect_row.Height = grid.DataGridRows[row + 1].VerticalOffset - grid.DataGridRows[row].VerticalOffset; + rect_row.Y = cells.Y + grid.DataGridRows[row].VerticalOffset - grid.DataGridRows[grid.FirstVisibleRow].VerticalOffset; + if (clip.IntersectsWith (rect_row)) { + if (grid.CurrentTableStyle.HasRelations + && !(showing_add_row && row == grid.DataGridRows.Length - 1)) + DataGridPaintRelationRow (g, row, rect_row, false, clip, grid); + else + DataGridPaintRow (g, row, rect_row, showing_add_row && row == grid.DataGridRows.Length - 1, clip, grid); + } + } + + not_usedarea.X = 0; + // the rowcnt == 0 check is needed because + // otherwise we'd draw over the caption on + // empty datasources (since rect_row would be + // Empty) + if (rowcnt == 0) + not_usedarea.Y = cells.Y; + else + not_usedarea.Y = rect_row.Y + rect_row.Height; + not_usedarea.Height = cells.Y + cells.Height - rect_row.Y - rect_row.Height; + not_usedarea.Width = cells.Width + grid.RowHeadersArea.Width; + + g.FillRectangle (ResPool.GetSolidBrush (grid.BackgroundColor), not_usedarea); + } + + public override void DataGridPaintRelationRow (Graphics g, int row, Rectangle row_rect, bool is_newrow, + Rectangle clip, DataGrid grid) + { + Rectangle rect_header; + Rectangle icon_bounds = new Rectangle (); + Pen pen = ThemeEngine.Current.ResPool.GetPen (grid.CurrentTableStyle.ForeColor); + + /* paint the header if it's visible and intersects the clip + if (grid.CurrentTableStyle.CurrentRowHeadersVisible) { + rect_header = row_rect; + rect_header.Width = grid.RowHeaderWidth; + row_rect.X += grid.RowHeaderWidth; + if (clip.IntersectsWith (rect_header)) { + DataGridPaintRowHeader (g, rect_header, row, grid); + } + + icon_bounds = rect_header; + icon_bounds.X += icon_bounds.Width / 2; + icon_bounds.Y += 3; + icon_bounds.Width = 8; + icon_bounds.Height = 8; + + g.DrawRectangle (pen, icon_bounds); + + /* the - part of the icon + g.DrawLine (pen, + icon_bounds.X + 2, icon_bounds.Y + icon_bounds.Height / 2, + icon_bounds.X + icon_bounds.Width - 2, icon_bounds.Y + icon_bounds.Height / 2); + + if (!grid.IsExpanded (row)) { + /* the | part of the icon + g.DrawLine (pen, + icon_bounds.X + icon_bounds.Width / 2, icon_bounds.Y + 2, + icon_bounds.X + icon_bounds.Width / 2, icon_bounds.Y + icon_bounds.Height - 2); + } + } + + Rectangle nested_rect = row_rect; + + if (grid.DataGridRows[row].IsExpanded) + nested_rect.Height -= grid.DataGridRows[row].RelationHeight; + + DataGridPaintRowContents (g, row, nested_rect, is_newrow, clip, grid); + + if (grid.DataGridRows[row].IsExpanded) { + // XXX we should create this in the + // datagrid and cache it for use by + // the theme instead of doing it each + // time through here + string[] relations = grid.CurrentTableStyle.Relations; + StringBuilder relation_builder = new StringBuilder (""); + + for (int i = 0; i < relations.Length; i ++) { + if (i > 0) + relation_builder.Append ("\n"); + + relation_builder.Append (relations[i]); + } + string relation_text = relation_builder.ToString (); + + StringFormat string_format = new StringFormat (); + string_format.FormatFlags |= StringFormatFlags.NoWrap; + + + //Region prev_clip = g.Clip; + //Region current_clip; + Rectangle rect_cell = row_rect; + + rect_cell.X = nested_rect.X + grid.GetColumnStartingPixel (grid.FirstVisibleColumn) - grid.HorizPixelOffset; + rect_cell.Y += nested_rect.Height; + rect_cell.Height = grid.DataGridRows[row].RelationHeight; + + rect_cell.Width = 0; + int column_cnt = grid.FirstVisibleColumn + grid.VisibleColumnCount; + for (int column = grid.FirstVisibleColumn; column < column_cnt; column++) { + if (grid.CurrentTableStyle.GridColumnStyles[column].bound == false) + continue; + rect_cell.Width += grid.CurrentTableStyle.GridColumnStyles[column].Width; + } + rect_cell.Width = Math.Max (rect_cell.Width, grid.DataGridRows[row].relation_area.Width); + + g.FillRectangle (ThemeEngine.Current.ResPool.GetSolidBrush (grid.CurrentTableStyle.BackColor), + rect_cell); + + + /* draw the line leading from the +/- to the relation area + Rectangle outline = grid.DataGridRows[row].relation_area; + outline.Y = rect_cell.Y; + outline.Height --; + + g.DrawLine (pen, + icon_bounds.X + icon_bounds.Width / 2, icon_bounds.Y + icon_bounds.Height, + icon_bounds.X + icon_bounds.Width / 2, outline.Y + outline.Height / 2); + + g.DrawLine (pen, + icon_bounds.X + icon_bounds.Width / 2, outline.Y + outline.Height / 2, + outline.X, outline.Y + outline.Height / 2); + + g.DrawRectangle (pen, outline); + + g.DrawString (relation_text, grid.LinkFont, ResPool.GetSolidBrush (grid.LinkColor), + outline, string_format); + + if (row_rect.X + row_rect.Width > rect_cell.X + rect_cell.Width) { + Rectangle not_usedarea = new Rectangle (); + not_usedarea.X = rect_cell.X + rect_cell.Width; + not_usedarea.Width = row_rect.X + row_rect.Width - rect_cell.X - rect_cell.Width; + not_usedarea.Y = row_rect.Y; + not_usedarea.Height = row_rect.Height; + if (clip.IntersectsWith (not_usedarea)) + g.FillRectangle (ResPool.GetSolidBrush (grid.BackgroundColor), + not_usedarea); + } + } + } + + public override void DataGridPaintRowContents (Graphics g, int row, Rectangle row_rect, bool is_newrow, + Rectangle clip, DataGrid grid) + { + Rectangle rect_cell = new Rectangle (); + int col_pixel; + Color backcolor, forecolor; + Brush backBrush, foreBrush; + Rectangle not_usedarea = Rectangle.Empty; + + rect_cell.Y = row_rect.Y; + rect_cell.Height = row_rect.Height; + + if (grid.IsSelected (row)) { + backcolor = grid.SelectionBackColor; + forecolor = grid.SelectionForeColor; + } else { + if (row % 2 == 0) { + backcolor = grid.BackColor; + } else { + backcolor = grid.AlternatingBackColor; + } + + forecolor = grid.ForeColor; + } + + + backBrush = ResPool.GetSolidBrush (backcolor); + foreBrush = ResPool.GetSolidBrush (forecolor); + + // PaintCells at row, column + int column_cnt = grid.FirstVisibleColumn + grid.VisibleColumnCount; + DataGridCell current_cell = grid.CurrentCell; + + if (column_cnt > 0) { + Region prev_clip = g.Clip; + Region current_clip; + + for (int column = grid.FirstVisibleColumn; column < column_cnt; column++) { + if (grid.CurrentTableStyle.GridColumnStyles[column].bound == false) + continue; + + col_pixel = grid.GetColumnStartingPixel (column); + + rect_cell.X = row_rect.X + col_pixel - grid.HorizPixelOffset; + rect_cell.Width = grid.CurrentTableStyle.GridColumnStyles[column].Width; + + if (clip.IntersectsWith (rect_cell)) { + current_clip = new Region (rect_cell); + current_clip.Intersect (row_rect); + current_clip.Intersect (prev_clip); + g.Clip = current_clip; + + Brush colBackBrush = backBrush; + Brush colForeBrush = foreBrush; + + // If we are in the precise cell we are editing, then use the normal colors + // even if we are selected. + if (grid.is_editing && column == current_cell.ColumnNumber && row == current_cell.RowNumber) { + colBackBrush = ResPool.GetSolidBrush (grid.BackColor); + colForeBrush = ResPool.GetSolidBrush (grid.ForeColor); + } + + if (is_newrow) { + grid.CurrentTableStyle.GridColumnStyles[column].PaintNewRow (g, rect_cell, + colBackBrush, + colForeBrush); + } else { + grid.CurrentTableStyle.GridColumnStyles[column].Paint (g, rect_cell, grid.ListManager, row, + colBackBrush, + colForeBrush, + grid.RightToLeft == RightToLeft.Yes); + } + + current_clip.Dispose (); + } + } + + g.Clip = prev_clip; + + if (row_rect.X + row_rect.Width > rect_cell.X + rect_cell.Width) { + not_usedarea.X = rect_cell.X + rect_cell.Width; + not_usedarea.Width = row_rect.X + row_rect.Width - rect_cell.X - rect_cell.Width; + not_usedarea.Y = row_rect.Y; + not_usedarea.Height = row_rect.Height; + } + } + else { + not_usedarea = row_rect; + } + + if (!not_usedarea.IsEmpty && clip.IntersectsWith (not_usedarea)) + g.FillRectangle (ResPool.GetSolidBrush (grid.BackgroundColor), + not_usedarea); + } + + public override void DataGridPaintRow (Graphics g, int row, Rectangle row_rect, bool is_newrow, + Rectangle clip, DataGrid grid) + { + /* paint the header if it's visible and intersects the clip + if (grid.CurrentTableStyle.CurrentRowHeadersVisible) { + Rectangle rect_header = row_rect; + rect_header.Width = grid.RowHeaderWidth; + row_rect.X += grid.RowHeaderWidth; + if (clip.IntersectsWith (rect_header)) { + DataGridPaintRowHeader (g, rect_header, row, grid); + } + } + + DataGridPaintRowContents (g, row, row_rect, is_newrow, clip, grid); + } + + #endregion // Datagrid + + #region DataGridView + #region DataGridViewHeaderCell + #region DataGridViewRowHeaderCell + public override bool DataGridViewRowHeaderCellDrawBackground (DataGridViewRowHeaderCell cell, Graphics g, Rectangle bounds) + { + return false; + } + + public override bool DataGridViewRowHeaderCellDrawSelectionBackground (DataGridViewRowHeaderCell cell) + { + return false; + } + + public override bool DataGridViewRowHeaderCellDrawBorder (DataGridViewRowHeaderCell cell, Graphics g, Rectangle bounds) + { + return false; + } + #endregion + + #region DataGridViewColumnHeaderCell + public override bool DataGridViewColumnHeaderCellDrawBackground (DataGridViewColumnHeaderCell cell, Graphics g, Rectangle bounds) + { + return false; + } + + public override bool DataGridViewColumnHeaderCellDrawBorder (DataGridViewColumnHeaderCell cell, Graphics g, Rectangle bounds) + { + return false; + } + #endregion + + public override bool DataGridViewHeaderCellHasPressedStyle (DataGridView dataGridView) + { + return false; + } + + public override bool DataGridViewHeaderCellHasHotStyle (DataGridView dataGridView) + { + return false; + } + #endregion + #endregion +*/ + + #region DateTimePicker + protected virtual void DateTimePickerDrawBorder(DateTimePicker dateTimePicker, Graphics g, Rectangle clippingArea) + { + this.CPDrawBorder3D(g, dateTimePicker.ClientRectangle, Border3DStyle.Sunken, Border3DSide.Left | Border3DSide.Right | Border3DSide.Top | Border3DSide.Bottom, dateTimePicker.BackColor); + } + + protected virtual void DateTimePickerDrawDropDownButton(DateTimePicker dateTimePicker, Graphics g, Rectangle clippingArea) + { + ButtonState state = dateTimePicker.is_drop_down_visible ? ButtonState.Pushed : ButtonState.Normal; + g.FillRectangle(ResPool.GetSolidBrush(ColorControl), dateTimePicker.drop_down_arrow_rect); + this.CPDrawComboButton( + g, + dateTimePicker.drop_down_arrow_rect, + state); + } + + public override void DrawDateTimePicker(Graphics dc, Rectangle clip_rectangle, DateTimePicker dtp) + { + + if (!clip_rectangle.IntersectsWith(dtp.ClientRectangle)) + return; + + // draw the outer border + Rectangle button_bounds = dtp.ClientRectangle; + DateTimePickerDrawBorder(dtp, dc, clip_rectangle); + + // deflate by the border width + if (clip_rectangle.IntersectsWith(dtp.drop_down_arrow_rect)) + { + button_bounds.Inflate(-2, -2); + if (!dtp.ShowUpDown) + { + DateTimePickerDrawDropDownButton(dtp, dc, clip_rectangle); + } + else + { + ButtonState up_state = dtp.is_up_pressed ? ButtonState.Pushed : ButtonState.Normal; + ButtonState down_state = dtp.is_down_pressed ? ButtonState.Pushed : ButtonState.Normal; + Rectangle up_bounds = dtp.drop_down_arrow_rect; + Rectangle down_bounds = dtp.drop_down_arrow_rect; + + up_bounds.Height = up_bounds.Height / 2; + down_bounds.Y = up_bounds.Height; + down_bounds.Height = dtp.Height - up_bounds.Height; + if (down_bounds.Height > up_bounds.Height) + { + down_bounds.Y += 1; + down_bounds.Height -= 1; + } + + up_bounds.Inflate(-1, -1); + down_bounds.Inflate(-1, -1); + + WidgetPaint.DrawScrollButton(dc, up_bounds, ScrollButton.Up, up_state); + WidgetPaint.DrawScrollButton(dc, down_bounds, ScrollButton.Down, down_state); + } + } + + // render the date part + if (!clip_rectangle.IntersectsWith(dtp.date_area_rect)) + return; + + // fill the background + dc.FillRectangle(SystemBrushes.Window, dtp.date_area_rect); + + // Update date_area_rect if we are drawing the checkbox + Rectangle date_area_rect = dtp.date_area_rect; + if (dtp.ShowCheckBox) + { + Rectangle check_box_rect = dtp.CheckBoxRect; + date_area_rect.X = date_area_rect.X + check_box_rect.Width + DateTimePicker.check_box_space * 2; + date_area_rect.Width = date_area_rect.Width - check_box_rect.Width - DateTimePicker.check_box_space * 2; + + ButtonState bs = dtp.Checked ? ButtonState.Checked : ButtonState.Normal; + CPDrawCheckBox(dc, check_box_rect, bs); + + if (dtp.is_checkbox_selected) + CPDrawFocusRectangle(dc, check_box_rect, dtp.foreground_color, dtp.background_color); + } + + // render each text part + using (StringFormat text_format = StringFormat.GenericTypographic) + { + text_format.LineAlignment = StringAlignment.Near; + text_format.Alignment = StringAlignment.Near; + text_format.FormatFlags = text_format.FormatFlags | StringFormatFlags.MeasureTrailingSpaces | StringFormatFlags.NoWrap | StringFormatFlags.FitBlackBox; + text_format.FormatFlags &= ~StringFormatFlags.NoClip; + + // Calculate the rectangles for each part + if (dtp.part_data.Length > 0 && dtp.part_data[0].drawing_rectangle.IsEmpty) + { + Graphics gr = dc; + for (int i = 0; i < dtp.part_data.Length; i++) + { + DateTimePicker.PartData fd = dtp.part_data[i]; + RectangleF text_rect = new RectangleF(); + string text = fd.GetText(dtp.Value); + text_rect.Size = gr.MeasureString(text, dtp.Font, 250, text_format); + if (!fd.is_literal) + text_rect.Width = Math.Max(dtp.CalculateMaxWidth(fd.value, gr, text_format), text_rect.Width); + + if (i > 0) + { + text_rect.X = dtp.part_data[i - 1].drawing_rectangle.Right; + } + else + { + text_rect.X = date_area_rect.X; + } + text_rect.Y = 2; + text_rect.Inflate(1, 0); + fd.drawing_rectangle = text_rect; + } + } + + // draw the text part + Brush text_brush = ResPool.GetSolidBrush(dtp.ShowCheckBox && dtp.Checked == false ? + SystemColors.GrayText : dtp.ForeColor); // Use GrayText if Checked is false + RectangleF clip_rectangleF = clip_rectangle; + + for (int i = 0; i < dtp.part_data.Length; i++) + { + DateTimePicker.PartData fd = dtp.part_data[i]; + string text; + + if (!clip_rectangleF.IntersectsWith(fd.drawing_rectangle)) + continue; + + text = dtp.editing_part_index == i ? dtp.editing_text : fd.GetText(dtp.Value); + + PointF text_position = new PointF(); + SizeF text_size; + RectangleF text_rect; + + text_size = dc.MeasureString(text, dtp.Font, 250, text_format); + text_position.X = (fd.drawing_rectangle.Left + fd.drawing_rectangle.Width / 2) - text_size.Width / 2; + text_position.Y = (fd.drawing_rectangle.Top + fd.drawing_rectangle.Height / 2) - text_size.Height / 2; + text_rect = new RectangleF(text_position, text_size); + text_rect = RectangleF.Intersect(text_rect, date_area_rect); + + if (text_rect.IsEmpty) + break; + + if (text_rect.Right >= date_area_rect.Right) + text_format.FormatFlags &= ~StringFormatFlags.NoClip; + else + text_format.FormatFlags |= StringFormatFlags.NoClip; + + if (fd.Selected) + { + dc.FillRectangle(SystemBrushes.Highlight, text_rect); + dc.DrawString(text, dtp.Font, SystemBrushes.HighlightText, text_rect, text_format); + + } + else + { + dc.DrawString(text, dtp.Font, text_brush, text_rect, text_format); + } + + if (fd.drawing_rectangle.Right > date_area_rect.Right) + break; // the next part would be not be visible, so don't draw anything more. + } + } + } + + public override bool DateTimePickerBorderHasHotElementStyle + { + get + { + return false; + } + } + + public override Rectangle DateTimePickerGetDropDownButtonArea(DateTimePicker dateTimePicker) + { + Rectangle rect = dateTimePicker.ClientRectangle; + rect.X = rect.Right - SystemInformation.VerticalScrollBarWidth - 2; + if (rect.Width > (SystemInformation.VerticalScrollBarWidth + 2)) + { + rect.Width = SystemInformation.VerticalScrollBarWidth; + } + else + { + rect.Width = Math.Max(rect.Width - 2, 0); + } + + rect.Inflate(0, -2); + return rect; + } + + public override Rectangle DateTimePickerGetDateArea(DateTimePicker dateTimePicker) + { + Rectangle rect = dateTimePicker.ClientRectangle; + if (dateTimePicker.ShowUpDown) + { + // set the space to the left of the up/down button + if (rect.Width > (DateTimePicker.up_down_width + 4)) + { + rect.Width -= (DateTimePicker.up_down_width + 4); + } + else + { + rect.Width = 0; + } + } + else + { + // set the space to the left of the up/down button + // TODO make this use up down button + if (rect.Width > (SystemInformation.VerticalScrollBarWidth + 4)) + { + rect.Width -= SystemInformation.VerticalScrollBarWidth; + } + else + { + rect.Width = 0; + } + } + + rect.Inflate(-2, -2); + return rect; + } + public override bool DateTimePickerDropDownButtonHasHotElementStyle + { + get + { + return false; + } + } + #endregion // DateTimePicker + + #region GroupBox + public override void DrawGroupBox(Graphics dc, Rectangle area, GroupBox box) + { + StringFormat text_format; + SizeF size; + int width; + int y; + + dc.FillRectangle(GetControlBackBrush(box.BackColor), box.ClientRectangle); + + text_format = new StringFormat(); + text_format.HotkeyPrefix = HotkeyPrefix.Show; + + size = dc.MeasureString(box.Text, box.Font); + width = 0; + + if (size.Width > 0) + { + width = ((int)size.Width) + 7; + + if (width > box.Width - 16) + width = box.Width - 16; + } + + y = box.Font.Height / 2; + + // Clip the are that the text will be in + Region prev_clip = dc.Clip; + dc.SetClip(new Rectangle(10, 0, width, box.Font.Height), CombineMode.Exclude); + /* Draw group box*/ + CPDrawBorder3D(dc, new Rectangle(0, y, box.Width, box.Height - y), Border3DStyle.Etched, Border3DSide.Left | Border3DSide.Right | Border3DSide.Top | Border3DSide.Bottom, box.BackColor); + dc.Clip = prev_clip; + + /* Text */ + if (box.Text.Length != 0) + { + if (box.Enabled) + { + dc.DrawString(box.Text, box.Font, ResPool.GetSolidBrush(box.ForeColor), 10, 0, text_format); + } + else + { + CPDrawStringDisabled(dc, box.Text, box.Font, box.BackColor, + new RectangleF(10, 0, width, box.Font.Height), text_format); + } + } + + text_format.Dispose(); + } + + public override Size GroupBoxDefaultSize + { + get + { + return new Size(200, 100); + } + } + #endregion + + #region HScrollBar + public override Size HScrollBarDefaultSize + { + get + { + return new Size(80, this.ScrollBarButtonSize); + } + } + + #endregion // HScrollBar + + #region ListBox + + public override void DrawListBoxItem(ListBox ctrl, DrawItemEventArgs e) + { + Color back_color, fore_color; + + if ((e.State & DrawItemState.Selected) == DrawItemState.Selected) + { + back_color = ColorHighlight; + fore_color = ColorHighlightText; + } + else + { + back_color = e.BackColor; + fore_color = e.ForeColor; + } + + e.Graphics.FillRectangle(ResPool.GetSolidBrush(back_color), e.Bounds); + + e.Graphics.DrawString(ctrl.GetItemText(ctrl.Items[e.Index]), e.Font, + ResPool.GetSolidBrush(fore_color), + e.Bounds, ctrl.StringFormat); + + if ((e.State & DrawItemState.Focus) == DrawItemState.Focus) + CPDrawFocusRectangle(e.Graphics, e.Bounds, fore_color, back_color); + } + + #endregion ListBox + + #region ListView + // Drawing + public override void DrawListViewItems(Graphics dc, Rectangle clip, ListView control) + { + bool details = control.View == View.Details; + int first = control.FirstVisibleIndex; + int lastvisibleindex = control.LastVisibleIndex; + + if (control.VirtualMode) + control.OnCacheVirtualItems(new CacheVirtualItemsEventArgs(first, lastvisibleindex)); + + for (int i = first; i <= lastvisibleindex; i++) + { + ListViewItem item = control.GetItemAtDisplayIndex(i); + if (clip.IntersectsWith(item.Bounds)) + { + bool owner_draw = false; + if (control.OwnerDraw) + owner_draw = DrawListViewItemOwnerDraw(dc, item, i); + if (!owner_draw) + { + DrawListViewItem(dc, control, item); + if (control.View == View.Details) + DrawListViewSubItems(dc, control, item); + } + } + } + + if (control.UsingGroups) + { + // Use InternalCount instead of Count to take into account Default Group as needed + for (int i = 0; i < control.Groups.InternalCount; i++) + { + ListViewGroup group = control.Groups.GetInternalGroup(i); + if (group.ItemCount > 0 && clip.IntersectsWith(group.HeaderBounds)) + DrawListViewGroupHeader(dc, control, group); + } + } + + ListViewInsertionMark insertion_mark = control.InsertionMark; + int insertion_mark_index = insertion_mark.Index; + if (Application.VisualStylesEnabled && insertion_mark.Bounds != Rectangle.Empty && + (control.View != View.Details && control.View != View.List) && + insertion_mark_index > -1 && insertion_mark_index < control.Items.Count) + { + + Brush brush = ResPool.GetSolidBrush(insertion_mark.Color); + dc.FillRectangle(brush, insertion_mark.Line); + dc.FillPolygon(brush, insertion_mark.TopTriangle); + dc.FillPolygon(brush, insertion_mark.BottomTriangle); + } + + // draw the gridlines + if (details && control.GridLines && !control.UsingGroups) + { + Size control_size = control.ClientSize; + int top = (control.HeaderStyle == ColumnHeaderStyle.None) ? + 0 : control.header_control.Height; + + // draw vertical gridlines + foreach (ColumnHeader col in control.Columns) + { + int column_right = col.Rect.Right - control.h_marker; + dc.DrawLine(SystemPens.Control, + column_right, top, + column_right, control_size.Height); + } + + // draw horizontal gridlines + int item_height = control.ItemSize.Height; + if (item_height == 0) + item_height = control.Font.Height + 2; + + int y = top + item_height - (control.v_marker % item_height); // scroll bar offset + while (y < control_size.Height) + { + dc.DrawLine(SystemPens.Control, 0, y, control_size.Width, y); + y += item_height; + } + } + + // Draw corner between the two scrollbars + if (control.h_scroll.Visible == true && control.v_scroll.Visible == true) + { + Rectangle rect = new Rectangle(); + rect.X = control.h_scroll.Location.X + control.h_scroll.Width; + rect.Width = control.v_scroll.Width; + rect.Y = control.v_scroll.Location.Y + control.v_scroll.Height; + rect.Height = control.h_scroll.Height; + dc.FillRectangle(SystemBrushes.Control, rect); + } + + Rectangle box_select_rect = control.item_control.BoxSelectRectangle; + if (!box_select_rect.Size.IsEmpty) + dc.DrawRectangle(ResPool.GetDashPen(ColorControlText, DashStyle.Dot), box_select_rect); + + } + + public override void DrawListViewHeader(Graphics dc, Rectangle clip, ListView control) + { + bool details = (control.View == View.Details); + + // border is drawn directly in the Paint method + if (details && control.HeaderStyle != ColumnHeaderStyle.None) + { + dc.FillRectangle(SystemBrushes.Control, + 0, 0, control.TotalWidth, control.Font.Height + 5); + if (control.Columns.Count > 0) + { + foreach (ColumnHeader col in control.Columns) + { + Rectangle rect = col.Rect; + rect.X -= control.h_marker; + + bool owner_draw = false; + if (control.OwnerDraw) + owner_draw = DrawListViewColumnHeaderOwnerDraw(dc, control, col, rect); + if (owner_draw) + continue; + + ListViewDrawColumnHeaderBackground(control, col, dc, rect, clip); + rect.X += 5; + rect.Width -= 10; + if (rect.Width <= 0) + continue; + + int image_index; + if (control.SmallImageList == null) + image_index = -1; + else + image_index = col.ImageKey == String.Empty ? col.ImageIndex : control.SmallImageList.Images.IndexOfKey(col.ImageKey); + + if (image_index > -1 && image_index < control.SmallImageList.Images.Count) + { + int image_width = control.SmallImageList.ImageSize.Width + 5; + int text_width = (int)dc.MeasureString(col.Text, control.Font).Width; + int x_origin = rect.X; + int y_origin = rect.Y + ((rect.Height - control.SmallImageList.ImageSize.Height) / 2); + + switch (col.TextAlign) + { + case HorizontalAlignment.Left: + break; + case HorizontalAlignment.Right: + x_origin = rect.Right - (text_width + image_width); + break; + case HorizontalAlignment.Center: + x_origin = (rect.Width - (text_width + image_width)) / 2 + rect.X; + break; + } + + if (x_origin < rect.X) + x_origin = rect.X; + + control.SmallImageList.Draw(dc, new Point(x_origin, y_origin), image_index); + rect.X += image_width; + rect.Width -= image_width; + } + + dc.DrawString(col.Text, control.Font, SystemBrushes.ControlText, rect, col.Format); + } + int right = control.GetReorderedColumn(control.Columns.Count - 1).Rect.Right - control.h_marker; + if (right < control.Right) + { + Rectangle rect = control.Columns[0].Rect; + rect.X = right; + rect.Width = control.Right - right; + ListViewDrawUnusedHeaderBackground(control, dc, rect, clip); + } + } + } + } + + protected virtual void ListViewDrawColumnHeaderBackground(ListView listView, ColumnHeader columnHeader, Graphics g, Rectangle area, Rectangle clippingArea) + { + ButtonState state; + if (listView.HeaderStyle == ColumnHeaderStyle.Clickable) + state = columnHeader.Pressed ? ButtonState.Pushed : ButtonState.Normal; + else + state = ButtonState.Flat; + CPDrawButton(g, area, state); + } + + protected virtual void ListViewDrawUnusedHeaderBackground(ListView listView, Graphics g, Rectangle area, Rectangle clippingArea) + { + ButtonState state; + if (listView.HeaderStyle == ColumnHeaderStyle.Clickable) + state = ButtonState.Normal; + else + state = ButtonState.Flat; + CPDrawButton(g, area, state); + } + + public override void DrawListViewHeaderDragDetails(Graphics dc, ListView view, ColumnHeader col, int target_x) + { + Rectangle rect = col.Rect; + rect.X -= view.h_marker; + Color color = Color.FromArgb(0x7f, ColorControlDark.R, ColorControlDark.G, ColorControlDark.B); + dc.FillRectangle(ResPool.GetSolidBrush(color), rect); + rect.X += 3; + rect.Width -= 8; + if (rect.Width <= 0) + return; + color = Color.FromArgb(0x7f, ColorControlText.R, ColorControlText.G, ColorControlText.B); + dc.DrawString(col.Text, view.Font, ResPool.GetSolidBrush(color), rect, col.Format); + dc.DrawLine(ResPool.GetSizedPen(ColorHighlight, 2), target_x, 0, target_x, col.Rect.Height); + } + + protected virtual bool DrawListViewColumnHeaderOwnerDraw(Graphics dc, ListView control, ColumnHeader column, Rectangle bounds) + { + ListViewItemStates state = ListViewItemStates.ShowKeyboardCues; + if (column.Pressed) + state |= ListViewItemStates.Selected; + + DrawListViewColumnHeaderEventArgs args = new DrawListViewColumnHeaderEventArgs(dc, + bounds, column.Index, column, state, SystemColors.ControlText, ThemeEngine.Current.ColorControl, DefaultFont); + control.OnDrawColumnHeader(args); + + return !args.DrawDefault; + } + + protected virtual bool DrawListViewItemOwnerDraw(Graphics dc, ListViewItem item, int index) + { + ListViewItemStates item_state = ListViewItemStates.ShowKeyboardCues; + if (item.Selected) + item_state |= ListViewItemStates.Selected; + if (item.Focused) + item_state |= ListViewItemStates.Focused; + + DrawListViewItemEventArgs args = new DrawListViewItemEventArgs(dc, + item, item.Bounds, index, item_state); + item.ListView.OnDrawItem(args); + + if (args.DrawDefault) + return false; + + if (item.ListView.View == View.Details) + { + int count = Math.Min(item.ListView.Columns.Count, item.SubItems.Count); + + // Do system drawing for subitems if no owner draw is done + for (int j = 0; j < count; j++) + { + if (!DrawListViewSubItemOwnerDraw(dc, item, item_state, j)) + { + if (j == 0) // The first sub item contains the main item semantics + DrawListViewItem(dc, item.ListView, item); + else + DrawListViewSubItem(dc, item.ListView, item, j); + } + } + } + + return true; + } + + protected virtual void DrawListViewItem(Graphics dc, ListView control, ListViewItem item) + { + Rectangle rect_checkrect = item.CheckRectReal; + Rectangle icon_rect = item.GetBounds(ItemBoundsPortion.Icon); + Rectangle full_rect = item.GetBounds(ItemBoundsPortion.Entire); + Rectangle text_rect = item.GetBounds(ItemBoundsPortion.Label); + + // Tile view doesn't support CheckBoxes + if (control.CheckBoxes && control.View != View.Tile) + { + if (control.StateImageList == null) + { + // Make sure we've got at least a line width of 1 + int check_wd = Math.Max(3, rect_checkrect.Width / 6); + int scale = Math.Max(1, rect_checkrect.Width / 12); + + // set the checkbox background + dc.FillRectangle(SystemBrushes.Window, + rect_checkrect); + // define a rectangle inside the border area + Rectangle rect = new Rectangle(rect_checkrect.X + 2, + rect_checkrect.Y + 2, + rect_checkrect.Width - 4, + rect_checkrect.Height - 4); + Pen pen = ResPool.GetSizedPen(this.ColorWindowText, 2); + dc.DrawRectangle(pen, rect); + + // Need to draw a check-mark + if (item.Checked) + { + Pen check_pen = ResPool.GetSizedPen(this.ColorWindowText, 1); + // adjustments to get the check-mark at the right place + rect.X++; rect.Y++; + // following logic is taken from DrawFrameControl method + int x_offset = rect.Width / 5; + int y_offset = rect.Height / 3; + for (int i = 0; i < check_wd; i++) + { + dc.DrawLine(check_pen, rect.Left + x_offset, + rect.Top + y_offset + i, + rect.Left + x_offset + 2 * scale, + rect.Top + y_offset + 2 * scale + i); + dc.DrawLine(check_pen, + rect.Left + x_offset + 2 * scale, + rect.Top + y_offset + 2 * scale + i, + rect.Left + x_offset + 6 * scale, + rect.Top + y_offset - 2 * scale + i); + } + } + } + else + { + int simage_idx; + if (item.Checked) + simage_idx = control.StateImageList.Images.Count > 1 ? 1 : -1; + else + simage_idx = control.StateImageList.Images.Count > 0 ? 0 : -1; + + if (simage_idx > -1) + control.StateImageList.Draw(dc, rect_checkrect.Location, simage_idx); + } + } + + ImageList image_list = control.View == View.LargeIcon || control.View == View.Tile ? control.LargeImageList : control.SmallImageList; + if (image_list != null) + { + int idx; + + if (item.ImageKey != String.Empty) + idx = image_list.Images.IndexOfKey(item.ImageKey); + else + idx = item.ImageIndex; + + if (idx > -1 && idx < image_list.Images.Count) + { + // Draw a thumbnail image if it exists for a FileViewListViewItem, otherwise draw + // the standard icon. See https://bugzilla.xamarin.com/show_bug.cgi?id=28025. + image_list.Draw(dc, icon_rect.Location, idx); + } + } + + // draw the item text + // format for the item text + StringFormat format = new StringFormat(); + if (control.View == View.SmallIcon || control.View == View.LargeIcon) + format.LineAlignment = StringAlignment.Near; + else + format.LineAlignment = StringAlignment.Center; + if (control.View == View.LargeIcon) + format.Alignment = StringAlignment.Center; + else + format.Alignment = StringAlignment.Near; + + if (control.LabelWrap && control.View != View.Details && control.View != View.Tile) + format.FormatFlags = StringFormatFlags.LineLimit; + else + format.FormatFlags = StringFormatFlags.NoWrap; + + if ((control.View == View.LargeIcon && !item.Focused) || control.View == View.Details || control.View == View.Tile) + format.Trimming = StringTrimming.EllipsisCharacter; + + Rectangle highlight_rect = text_rect; + if (control.View == View.Details) + { // Adjustments for Details view + Size text_size = Size.Ceiling(dc.MeasureString(item.Text, item.Font)); + + if (!control.FullRowSelect) // Selection shouldn't be outside the item bounds + highlight_rect.Width = Math.Min(text_size.Width + 4, text_rect.Width); + } + + if (item.Selected && control.Focused) + dc.FillRectangle(SystemBrushes.Highlight, highlight_rect); + else if (item.Selected && !control.HideSelection) + dc.FillRectangle(SystemBrushes.Control, highlight_rect); + else + dc.FillRectangle(ResPool.GetSolidBrush(item.BackColor), text_rect); + + Brush textBrush = + !control.Enabled ? SystemBrushes.ControlLight : + (item.Selected && control.Focused) ? SystemBrushes.HighlightText : + this.ResPool.GetSolidBrush(item.ForeColor); + + // Tile view renders its Text in a different fashion + if (control.View == View.Tile && Application.VisualStylesEnabled) + { + // Item.Text is drawn using its first subitem's bounds + dc.DrawString(item.Text, item.Font, textBrush, item.SubItems[0].Bounds, format); + + int count = Math.Min(control.Columns.Count, item.SubItems.Count); + for (int i = 1; i < count; i++) + { + ListViewItem.ListViewSubItem sub_item = item.SubItems[i]; + if (sub_item.Text == null || sub_item.Text.Length == 0) + continue; + + Brush itemBrush = item.Selected && control.Focused ? + SystemBrushes.HighlightText : GetControlForeBrush(sub_item.ForeColor); + dc.DrawString(sub_item.Text, sub_item.Font, itemBrush, sub_item.Bounds, format); + } + } + else + + if (item.Text != null && item.Text.Length > 0) + { + Font font = item.Font; + + if (control.HotTracking && item.Hot) + font = item.HotFont; + + if (item.Selected && control.Focused) + dc.DrawString(item.Text, font, textBrush, highlight_rect, format); + else + dc.DrawString(item.Text, font, textBrush, text_rect, format); + } + + if (item.Focused && control.Focused) + { + Rectangle focus_rect = highlight_rect; + if (control.FullRowSelect && control.View == View.Details) + { + int width = 0; + foreach (ColumnHeader col in control.Columns) + width += col.Width; + focus_rect = new Rectangle(0, full_rect.Y, width, full_rect.Height); + } + if (control.ShowFocusCues) + { + if (item.Selected) + CPDrawFocusRectangle(dc, focus_rect, ColorHighlightText, ColorHighlight); + else + CPDrawFocusRectangle(dc, focus_rect, control.ForeColor, control.BackColor); + } + } + + format.Dispose(); + } + + protected virtual void DrawListViewSubItems(Graphics dc, ListView control, ListViewItem item) + { + int columns_count = control.Columns.Count; + int count = Math.Min(item.SubItems.Count, columns_count); + // 0th item already done (in this case) + for (int i = 1; i < count; i++) + DrawListViewSubItem(dc, control, item, i); + + // Fill in selection for remaining columns if Column.Count > SubItems.Count + Rectangle sub_item_rect = item.GetBounds(ItemBoundsPortion.Label); + if (item.Selected && (control.Focused || !control.HideSelection) && control.FullRowSelect) + { + for (int index = count; index < columns_count; index++) + { + ColumnHeader col = control.Columns[index]; + sub_item_rect.X = col.Rect.X - control.h_marker; + sub_item_rect.Width = col.Wd; + dc.FillRectangle(control.Focused ? SystemBrushes.Highlight : SystemBrushes.Control, + sub_item_rect); + } + } + } + + protected virtual void DrawListViewSubItem(Graphics dc, ListView control, ListViewItem item, int index) + { + ListViewItem.ListViewSubItem subItem = item.SubItems[index]; + ColumnHeader col = control.Columns[index]; + StringFormat format = new StringFormat(); + format.Alignment = col.Format.Alignment; + format.LineAlignment = StringAlignment.Center; + format.FormatFlags = StringFormatFlags.NoWrap; + format.Trimming = StringTrimming.EllipsisCharacter; + + Rectangle sub_item_rect = subItem.Bounds; + Rectangle sub_item_text_rect = sub_item_rect; + sub_item_text_rect.X += 3; + sub_item_text_rect.Width -= ListViewItemPaddingWidth; + + SolidBrush sub_item_back_br = null; + SolidBrush sub_item_fore_br = null; + Font sub_item_font = null; + + if (item.UseItemStyleForSubItems) + { + sub_item_back_br = ResPool.GetSolidBrush(item.BackColor); + sub_item_fore_br = ResPool.GetSolidBrush(item.ForeColor); + + // Hot tracking for subitems only applies when UseStyle is true + if (control.HotTracking && item.Hot) + sub_item_font = item.HotFont; + else + sub_item_font = item.Font; + } + else + { + sub_item_back_br = ResPool.GetSolidBrush(subItem.BackColor); + sub_item_fore_br = ResPool.GetSolidBrush(subItem.ForeColor); + sub_item_font = subItem.Font; + } + + if (item.Selected && (control.Focused || !control.HideSelection) && control.FullRowSelect) + { + Brush bg, text; + if (control.Focused) + { + bg = SystemBrushes.Highlight; + text = SystemBrushes.HighlightText; + } + else + { + bg = SystemBrushes.Control; + text = sub_item_fore_br; + + } + + dc.FillRectangle(bg, sub_item_rect); + if (subItem.Text != null && subItem.Text.Length > 0) + dc.DrawString(subItem.Text, sub_item_font, + text, sub_item_text_rect, format); + } + else + { + dc.FillRectangle(sub_item_back_br, sub_item_rect); + if (subItem.Text != null && subItem.Text.Length > 0) + dc.DrawString(subItem.Text, sub_item_font, + sub_item_fore_br, + sub_item_text_rect, format); + } + + format.Dispose(); + } + + protected virtual bool DrawListViewSubItemOwnerDraw(Graphics dc, ListViewItem item, ListViewItemStates state, int index) + { + ListView control = item.ListView; + ListViewItem.ListViewSubItem subitem = item.SubItems[index]; + + DrawListViewSubItemEventArgs args = new DrawListViewSubItemEventArgs(dc, subitem.Bounds, item, + subitem, item.Index, index, control.Columns[index], state); + control.OnDrawSubItem(args); + + return !args.DrawDefault; + } + + protected virtual void DrawListViewGroupHeader(Graphics dc, ListView control, ListViewGroup group) + { + Rectangle text_bounds = group.HeaderBounds; + Rectangle header_bounds = group.HeaderBounds; + text_bounds.Offset(8, 0); + text_bounds.Inflate(-8, 0); + int text_height = control.Font.Height + 2; // add a tiny padding between the text and the group line + + Font font = new Font(control.Font, control.Font.Style | FontStyle.Bold); + Brush brush = new LinearGradientBrush(new Point(header_bounds.Left, 0), new Point(header_bounds.Left + ListViewGroupLineWidth, 0), + SystemColors.Desktop, Color.White); + Pen pen = new Pen(brush); + + StringFormat sformat = new StringFormat(); + switch (group.HeaderAlignment) + { + case HorizontalAlignment.Left: + sformat.Alignment = StringAlignment.Near; + break; + case HorizontalAlignment.Center: + sformat.Alignment = StringAlignment.Center; + break; + case HorizontalAlignment.Right: + sformat.Alignment = StringAlignment.Far; + break; + } + + sformat.LineAlignment = StringAlignment.Near; + dc.DrawString(group.Header, font, SystemBrushes.ControlText, text_bounds, sformat); + dc.DrawLine(pen, header_bounds.Left, header_bounds.Top + text_height, header_bounds.Left + ListViewGroupLineWidth, + header_bounds.Top + text_height); + + sformat.Dispose(); + font.Dispose(); + pen.Dispose(); + brush.Dispose(); + } + + public override bool ListViewHasHotHeaderStyle + { + get + { + return false; + } + } + + // Sizing + public override int ListViewGetHeaderHeight(ListView listView, Font font) + { + return ListViewGetHeaderHeight(font); + } + + static int ListViewGetHeaderHeight(Font font) + { + return font.Height + 5; + } + + public static int ListViewGetHeaderHeight() + { + return ListViewGetHeaderHeight(ThemeEngine.Current.DefaultFont); + } + + public override Size ListViewCheckBoxSize + { + get { return new Size(16, 16); } + } + + public override int ListViewColumnHeaderHeight + { + get { return 16; } + } + + public override int ListViewDefaultColumnWidth + { + get { return 60; } + } + + public override int ListViewVerticalSpacing + { + get { return 22; } + } + + public override int ListViewEmptyColumnWidth + { + get { return 10; } + } + + public override int ListViewHorizontalSpacing + { + get { return 4; } + } + + public override int ListViewItemPaddingWidth + { + get { return 6; } + } + + public override Size ListViewDefaultSize + { + get { return new Size(121, 97); } + } + + public override int ListViewGroupHeight + { + get { return 20; } + } + + public int ListViewGroupLineWidth + { + get { return 200; } + } + + public override int ListViewTileWidthFactor + { + get { return 22; } + } + + public override int ListViewTileHeightFactor + { + get { return 3; } + } + #endregion // ListView + + #region Menus + + public override void CalcItemSize(Graphics dc, MenuItem item, int y, int x, bool menuBar) + { + item.X = x; + item.Y = y; + + if (item.Visible == false) + { + item.Width = 0; + item.Height = 0; + return; + } + + if (item.Separator == true) + { + item.Height = SEPARATOR_HEIGHT; + item.Width = SEPARATOR_MIN_WIDTH; + return; + } + + if (item.MeasureEventDefined) + { + MeasureItemEventArgs mi = new MeasureItemEventArgs(dc, item.Index); + item.PerformMeasureItem(mi); + item.Height = mi.ItemHeight; + item.Width = mi.ItemWidth; + return; + } + else + { + SizeF size; + size = dc.MeasureString(item.Text, MenuFont, int.MaxValue, string_format_menu_text); + item.Width = (int)size.Width; + item.Height = (int)size.Height; + + if (!menuBar) + { + if (item.Shortcut != Shortcut.None && item.ShowShortcut) + { + item.XTab = MenuCheckSize.Width + MENU_TAB_SPACE + (int)size.Width; + size = dc.MeasureString(" " + item.GetShortCutText(), MenuFont); + item.Width += MENU_TAB_SPACE + (int)size.Width; + } + + item.Width += 4 + (MenuCheckSize.Width * 2); + } + else + { + item.Width += MENU_BAR_ITEMS_SPACE; + x += item.Width; + } + + if (item.Height < MenuHeight) + item.Height = MenuHeight; + } + } + + // Updates the menu rect and returns the height + public override int CalcMenuBarSize(Graphics dc, Menu menu, int width) + { + int x = 0; + int y = 0; + menu.Height = 0; + + foreach (MenuItem item in menu.MenuItems) + { + + CalcItemSize(dc, item, y, x, true); + + if (x + item.Width > width) + { + item.X = 0; + y += item.Height; + item.Y = y; + x = 0; + } + + x += item.Width; + item.MenuBar = true; + + if (y + item.Height > menu.Height) + menu.Height = item.Height + y; + } + + menu.Width = width; + return menu.Height; + } + + public override void CalcPopupMenuSize(Graphics dc, Menu menu) + { + int x = 3; + int start = 0; + int i, n, y, max; + + menu.Height = 0; + + while (start < menu.MenuItems.Count) + { + y = 3; + max = 0; + for (i = start; i < menu.MenuItems.Count; i++) + { + MenuItem item = menu.MenuItems[i]; + + if ((i != start) && (item.Break || item.BarBreak)) + break; + + CalcItemSize(dc, item, y, x, false); + y += item.Height; + + if (item.Width > max) + max = item.Width; + } + + // Replace the -1 by the menu width (separators) + for (n = start; n < i; n++, start++) + menu.MenuItems[n].Width = max; + + if (y > menu.Height) + menu.Height = y; + + x += max; + } + + menu.Width = x; + + //space for border + menu.Width += 2; + menu.Height += 2; + + menu.Width += SM_CXBORDER; + menu.Height += SM_CYBORDER; + } + + // Draws a menu bar in a window + public override void DrawMenuBar(Graphics dc, Menu menu, Rectangle rect) + { + if (menu.Height == 0) + CalcMenuBarSize(dc, menu, rect.Width); + + bool keynav = (menu as MainMenu).tracker.hotkey_active; + HotkeyPrefix hp = MenuAccessKeysUnderlined || keynav ? HotkeyPrefix.Show : HotkeyPrefix.Hide; + string_format_menu_menubar_text.HotkeyPrefix = hp; + string_format_menu_text.HotkeyPrefix = hp; + + rect.Height = menu.Height; + dc.FillRectangle(SystemBrushes.Menu, rect); + + for (int i = 0; i < menu.MenuItems.Count; i++) + { + MenuItem item = menu.MenuItems[i]; + Rectangle item_rect = item.bounds; + item_rect.X += rect.X; + item_rect.Y += rect.Y; + item.MenuHeight = menu.Height; + item.PerformDrawItem(new DrawItemEventArgs(dc, MenuFont, item_rect, i, item.Status)); + } + } + + protected Bitmap CreateGlyphBitmap(Size size, MenuGlyph glyph, Color color) + { + Color bg_color; + if (color.R == 0 && color.G == 0 && color.B == 0) + bg_color = Color.White; + else + bg_color = Color.Black; + + Bitmap bmp = new Bitmap(size.Width, size.Height); + Graphics gr = Graphics.FromImage(bmp); + Rectangle rect = new Rectangle(Point.Empty, size); + gr.FillRectangle(ResPool.GetSolidBrush(bg_color), rect); + CPDrawMenuGlyph(gr, rect, glyph, color, Color.Empty); + bmp.MakeTransparent(bg_color); + gr.Dispose(); + + return bmp; + } + + public override void DrawMenuItem(MenuItem item, DrawItemEventArgs e) + { + StringFormat string_format; + Rectangle rect_text = e.Bounds; + + if (item.Visible == false) + return; + + if (item.MenuBar) + string_format = string_format_menu_menubar_text; + else + string_format = string_format_menu_text; + + if (item.Separator == true) + { + int liney = e.Bounds.Y + (e.Bounds.Height / 2); + + e.Graphics.DrawLine(SystemPens.ControlDark, + e.Bounds.X, liney, e.Bounds.X + e.Bounds.Width, liney); + + e.Graphics.DrawLine(SystemPens.ControlLight, + e.Bounds.X, liney + 1, e.Bounds.X + e.Bounds.Width, liney + 1); + + return; + } + + if (!item.MenuBar) + rect_text.X += MenuCheckSize.Width; + + if (item.BarBreak) + { /* Draw vertical break bar*/ + Rectangle rect = e.Bounds; + rect.Y++; + rect.Width = 3; + rect.Height = item.MenuHeight - 6; + + e.Graphics.DrawLine(SystemPens.ControlDark, + rect.X, rect.Y, rect.X, rect.Y + rect.Height); + + e.Graphics.DrawLine(SystemPens.ControlLight, + rect.X + 1, rect.Y, rect.X + 1, rect.Y + rect.Height); + } + + Color color_text; + Color color_back; + Brush brush_text = null; + Brush brush_back = null; + + if ((e.State & DrawItemState.Selected) == DrawItemState.Selected && !item.MenuBar) + { + color_text = ColorHighlightText; + color_back = ColorHighlight; + brush_text = SystemBrushes.HighlightText; + brush_back = SystemBrushes.Highlight; + } + else + { + color_text = ColorMenuText; + color_back = ColorMenu; + brush_text = ResPool.GetSolidBrush(ColorMenuText); + brush_back = SystemBrushes.Menu; + } + + /* Draw background */ + if (!item.MenuBar) + e.Graphics.FillRectangle(brush_back, e.Bounds); + + if (item.Enabled) + { + e.Graphics.DrawString(item.Text, e.Font, + brush_text, + rect_text, string_format); + + if (item.MenuBar) + { + Border3DStyle border_style = Border3DStyle.Adjust; + if ((item.Status & DrawItemState.HotLight) != 0) + border_style = Border3DStyle.RaisedInner; + else if ((item.Status & DrawItemState.Selected) != 0) + border_style = Border3DStyle.SunkenOuter; + + if (border_style != Border3DStyle.Adjust) + CPDrawBorder3D(e.Graphics, e.Bounds, border_style, Border3DSide.Left | Border3DSide.Right | Border3DSide.Top | Border3DSide.Bottom, ColorMenu); + } + } + else + { + if ((item.Status & DrawItemState.Selected) != DrawItemState.Selected) + { + e.Graphics.DrawString(item.Text, e.Font, Brushes.White, + new RectangleF(rect_text.X + 1, rect_text.Y + 1, rect_text.Width, rect_text.Height), + string_format); + + } + + e.Graphics.DrawString(item.Text, e.Font, ResPool.GetSolidBrush(ColorGrayText), rect_text, string_format); + } + + if (!item.MenuBar && item.Shortcut != Shortcut.None && item.ShowShortcut) + { + string str = item.GetShortCutText(); + Rectangle rect = rect_text; + rect.X = item.XTab; + rect.Width -= item.XTab; + + if (item.Enabled) + { + e.Graphics.DrawString(str, e.Font, brush_text, rect, string_format_menu_shortcut); + } + else + { + if ((item.Status & DrawItemState.Selected) != DrawItemState.Selected) + { + e.Graphics.DrawString(str, e.Font, Brushes.White, + new RectangleF(rect.X + 1, rect.Y + 1, rect.Width, rect_text.Height), + string_format_menu_shortcut); + + } + e.Graphics.DrawString(str, e.Font, ResPool.GetSolidBrush(ColorGrayText), rect, string_format_menu_shortcut); + } + } + + /* Draw arrow */ + if (item.MenuBar == false && (item.IsPopup || item.MdiList)) + { + + int cx = MenuCheckSize.Width; + int cy = MenuCheckSize.Height; + Bitmap bmp = CreateGlyphBitmap(new Size(cx, cy), MenuGlyph.Arrow, color_text); + + if (item.Enabled) + { + e.Graphics.DrawImage(bmp, e.Bounds.X + e.Bounds.Width - cx, + e.Bounds.Y + ((e.Bounds.Height - cy) / 2)); + } + else + { + WidgetPaint.DrawImageDisabled(e.Graphics, bmp, e.Bounds.X + e.Bounds.Width - cx, + e.Bounds.Y + ((e.Bounds.Height - cy) / 2), color_back); + } + + bmp.Dispose(); + } + + /* Draw checked or radio */ + if (item.MenuBar == false && item.Checked) + { + + Rectangle area = e.Bounds; + int cx = MenuCheckSize.Width; + int cy = MenuCheckSize.Height; + Bitmap bmp = CreateGlyphBitmap(new Size(cx, cy), item.RadioCheck ? MenuGlyph.Bullet : MenuGlyph.Checkmark, color_text); + + e.Graphics.DrawImage(bmp, area.X, e.Bounds.Y + ((e.Bounds.Height - cy) / 2)); + + bmp.Dispose(); + } + } + + public override void DrawPopupMenu(Graphics dc, Menu menu, Rectangle cliparea, Rectangle rect) + { + // Fill rectangle area + dc.FillRectangle(SystemBrushes.Menu, cliparea); + + + // Draw menu items + for (int i = 0; i < menu.MenuItems.Count; i++) + { + if (cliparea.IntersectsWith(menu.MenuItems[i].bounds)) + { + MenuItem item = menu.MenuItems[i]; + item.MenuHeight = menu.Height; + item.PerformDrawItem(new DrawItemEventArgs(dc, MenuFont, item.bounds, i, item.Status)); + } + } + } + + #endregion // Menus + + #region MonthCalendar + + // draw the month calendar + public override void DrawMonthCalendar(Graphics dc, Rectangle clip_rectangle, MonthCalendar mc) + { + Rectangle client_rectangle = mc.ClientRectangle; + Size month_size = mc.SingleMonthSize; + // cache local copies of Marshal-by-ref internal members (gets around error CS0197) + Size calendar_spacing = (Size)((object)mc.calendar_spacing); + Size date_cell_size = (Size)((object)mc.date_cell_size); + + // draw the singlecalendars + int x_offset = 1; + int y_offset = 1; + // adjust for the position of the specific month + for (int i = 0; i < mc.CalendarDimensions.Height; i++) + { + if (i > 0) + { + y_offset += month_size.Height + calendar_spacing.Height; + } + // now adjust for x position + for (int j = 0; j < mc.CalendarDimensions.Width; j++) + { + if (j > 0) + { + x_offset += month_size.Width + calendar_spacing.Width; + } + else + { + x_offset = 1; + } + + Rectangle month_rect = new Rectangle(x_offset, y_offset, month_size.Width, month_size.Height); + if (month_rect.IntersectsWith(clip_rectangle)) + { + DrawSingleMonth( + dc, + clip_rectangle, + month_rect, + mc, + i, + j); + } + } + } + + Rectangle bottom_rect = new Rectangle( + client_rectangle.X, + Math.Max(client_rectangle.Bottom - date_cell_size.Height - 3, 0), + client_rectangle.Width, + date_cell_size.Height + 2); + // draw the today date if it's set + if (mc.ShowToday && bottom_rect.IntersectsWith(clip_rectangle)) + { + dc.FillRectangle(GetControlBackBrush(mc.BackColor), bottom_rect); + if (mc.ShowToday) + { + int today_offset = 5; + if (mc.ShowTodayCircle) + { + Rectangle today_circle_rect = new Rectangle( + client_rectangle.X + 5, + Math.Max(client_rectangle.Bottom - date_cell_size.Height - 2, 0), + date_cell_size.Width, + date_cell_size.Height); + DrawTodayCircle(dc, today_circle_rect); + today_offset += date_cell_size.Width + 5; + } + // draw today's date + StringFormat text_format = new StringFormat(); + text_format.LineAlignment = StringAlignment.Center; + text_format.Alignment = StringAlignment.Near; + Rectangle today_rect = new Rectangle( + today_offset + client_rectangle.X, + Math.Max(client_rectangle.Bottom - date_cell_size.Height, 0), + Math.Max(client_rectangle.Width - today_offset, 0), + date_cell_size.Height); + dc.DrawString("Today: " + DateTime.Now.ToShortDateString(), mc.bold_font, GetControlForeBrush(mc.ForeColor), today_rect, text_format); + text_format.Dispose(); + } + } + + Brush border_brush; + + if (mc.owner == null) + border_brush = GetControlBackBrush(mc.BackColor); + else + border_brush = SystemBrushes.ControlDarkDark; + + // finally paint the borders of the calendars as required + for (int i = 0; i <= mc.CalendarDimensions.Width; i++) + { + if (i == 0 && clip_rectangle.X == client_rectangle.X) + { + dc.FillRectangle(border_brush, client_rectangle.X, client_rectangle.Y, 1, client_rectangle.Height); + } + else if (i == mc.CalendarDimensions.Width && clip_rectangle.Right == client_rectangle.Right) + { + dc.FillRectangle(border_brush, client_rectangle.Right - 1, client_rectangle.Y, 1, client_rectangle.Height); + } + else + { + Rectangle rect = new Rectangle( + client_rectangle.X + (month_size.Width * i) + (calendar_spacing.Width * (i - 1)) + 1, + client_rectangle.Y, + calendar_spacing.Width, + client_rectangle.Height); + if (i < mc.CalendarDimensions.Width && i > 0 && clip_rectangle.IntersectsWith(rect)) + { + dc.FillRectangle(border_brush, rect); + } + } + } + for (int i = 0; i <= mc.CalendarDimensions.Height; i++) + { + if (i == 0 && clip_rectangle.Y == client_rectangle.Y) + { + dc.FillRectangle(border_brush, client_rectangle.X, client_rectangle.Y, client_rectangle.Width, 1); + } + else if (i == mc.CalendarDimensions.Height && clip_rectangle.Bottom == client_rectangle.Bottom) + { + dc.FillRectangle(border_brush, client_rectangle.X, client_rectangle.Bottom - 1, client_rectangle.Width, 1); + } + else + { + Rectangle rect = new Rectangle( + client_rectangle.X, + client_rectangle.Y + (month_size.Height * i) + (calendar_spacing.Height * (i - 1)) + 1, + client_rectangle.Width, + calendar_spacing.Height); + if (i < mc.CalendarDimensions.Height && i > 0 && clip_rectangle.IntersectsWith(rect)) + { + dc.FillRectangle(border_brush, rect); + } + } + } + + // draw the drop down border if need + if (mc.owner != null) + { + Rectangle bounds = mc.ClientRectangle; + if (clip_rectangle.Contains(mc.Location)) + { + // find out if top or left line to draw + if (clip_rectangle.Contains(new Point(bounds.Left, bounds.Bottom))) + { + + dc.DrawLine(SystemPens.ControlText, bounds.X, bounds.Y, bounds.X, bounds.Bottom - 1); + } + if (clip_rectangle.Contains(new Point(bounds.Right, bounds.Y))) + { + dc.DrawLine(SystemPens.ControlText, bounds.X, bounds.Y, bounds.Right - 1, bounds.Y); + } + } + if (clip_rectangle.Contains(new Point(bounds.Right, bounds.Bottom))) + { + // find out if bottom or right line to draw + if (clip_rectangle.Contains(new Point(bounds.Left, bounds.Bottom))) + { + dc.DrawLine(SystemPens.ControlText, bounds.X, bounds.Bottom - 1, bounds.Right - 1, bounds.Bottom - 1); + } + if (clip_rectangle.Contains(new Point(bounds.Right, bounds.Y))) + { + dc.DrawLine(SystemPens.ControlText, bounds.Right - 1, bounds.Y, bounds.Right - 1, bounds.Bottom - 1); + } + } + } + } + + // darws a single part of the month calendar (with one month) + private void DrawSingleMonth(Graphics dc, Rectangle clip_rectangle, Rectangle rectangle, MonthCalendar mc, int row, int col) + { + // cache local copies of Marshal-by-ref internal members (gets around error CS0197) + Size title_size = (Size)((object)mc.title_size); + Size date_cell_size = (Size)((object)mc.date_cell_size); + DateTime current_month = (DateTime)((object)mc.current_month); + DateTime sunday = new DateTime(2006, 10, 1); + + // draw the title back ground + DateTime this_month = current_month.AddMonths(row * mc.CalendarDimensions.Width + col); + Rectangle title_rect = new Rectangle(rectangle.X, rectangle.Y, title_size.Width, title_size.Height); + if (title_rect.IntersectsWith(clip_rectangle)) + { + dc.FillRectangle(ResPool.GetSolidBrush(mc.TitleBackColor), title_rect); + // draw the title + string title_text = this_month.ToString("MMMM yyyy"); + dc.DrawString(title_text, mc.bold_font, ResPool.GetSolidBrush(mc.TitleForeColor), title_rect, mc.centered_format); + + if (mc.ShowYearUpDown) + { + Rectangle year_rect; + Rectangle upRect, downRect; + ButtonState upState, downState; + + mc.GetYearNameRectangles(title_rect, row * mc.CalendarDimensions.Width + col, out year_rect, out upRect, out downRect); + dc.FillRectangle(ResPool.GetSolidBrush(SystemColors.Control), year_rect); + dc.DrawString(this_month.ToString("yyyy"), mc.bold_font, ResPool.GetSolidBrush(Color.Black), year_rect, mc.centered_format); + + upState = mc.IsYearGoingUp ? ButtonState.Pushed : ButtonState.Normal; + downState = mc.IsYearGoingDown ? ButtonState.Pushed : ButtonState.Normal; + + WidgetPaint.DrawScrollButton(dc, upRect, ScrollButton.Up, upState); + WidgetPaint.DrawScrollButton(dc, downRect, ScrollButton.Down, downState); + } + + // draw previous and next buttons if it's time + if (row == 0 && col == 0) + { + // draw previous button + DrawMonthCalendarButton( + dc, + rectangle, + mc, + title_size, + mc.button_x_offset, + (System.Drawing.Size)((object)mc.button_size), + true); + } + if (row == 0 && col == mc.CalendarDimensions.Width - 1) + { + // draw next button + DrawMonthCalendarButton( + dc, + rectangle, + mc, + title_size, + mc.button_x_offset, + (System.Drawing.Size)((object)mc.button_size), + false); + } + } + + // set the week offset and draw week nums if needed + int col_offset = (mc.ShowWeekNumbers) ? 1 : 0; + Rectangle day_name_rect = new Rectangle( + rectangle.X, + rectangle.Y + title_size.Height, + (7 + col_offset) * date_cell_size.Width, + date_cell_size.Height); + if (day_name_rect.IntersectsWith(clip_rectangle)) + { + dc.FillRectangle(GetControlBackBrush(mc.BackColor), day_name_rect); + // draw the day names + DayOfWeek first_day_of_week = mc.GetDayOfWeek(mc.FirstDayOfWeek); + for (int i = 0; i < 7; i++) + { + int position = i - (int)first_day_of_week; + if (position < 0) + { + position = 7 + position; + } + // draw it + Rectangle day_rect = new Rectangle( + day_name_rect.X + ((i + col_offset) * date_cell_size.Width), + day_name_rect.Y, + date_cell_size.Width, + date_cell_size.Height); + dc.DrawString(sunday.AddDays(i + (int)first_day_of_week).ToString("ddd"), mc.Font, ResPool.GetSolidBrush(mc.TitleBackColor), day_rect, mc.centered_format); + } + + // draw the vertical divider + int vert_divider_y = Math.Max(title_size.Height + date_cell_size.Height - 1, 0); + dc.DrawLine( + ResPool.GetPen(mc.ForeColor), + rectangle.X + (col_offset * date_cell_size.Width) + mc.divider_line_offset, + rectangle.Y + vert_divider_y, + rectangle.Right - mc.divider_line_offset, + rectangle.Y + vert_divider_y); + } + + + // draw the actual date items in the grid (including the week numbers) + Rectangle date_rect = new Rectangle( + rectangle.X, + rectangle.Y + title_size.Height + date_cell_size.Height, + date_cell_size.Width, + date_cell_size.Height); + int month_row_count = 0; + bool draw_week_num_divider = false; + DateTime current_date = mc.GetFirstDateInMonthGrid(new DateTime(this_month.Year, this_month.Month, 1)); + for (int i = 0; i < 6; i++) + { + // establish if this row is in our clip_area + Rectangle row_rect = new Rectangle( + rectangle.X, + rectangle.Y + title_size.Height + (date_cell_size.Height * (i + 1)), + date_cell_size.Width * 7, + date_cell_size.Height); + if (mc.ShowWeekNumbers) + { + row_rect.Width += date_cell_size.Width; + } + + bool draw_row = row_rect.IntersectsWith(clip_rectangle); + if (draw_row) + { + dc.FillRectangle(GetControlBackBrush(mc.BackColor), row_rect); + } + // establish if this is a valid week to draw + if (mc.IsValidWeekToDraw(this_month, current_date, row, col)) + { + month_row_count = i; + } + + // draw the week number if required + if (mc.ShowWeekNumbers && month_row_count == i) + { + if (!draw_week_num_divider) + { + draw_week_num_divider = draw_row; + } + // get the week for this row + int week = mc.GetWeekOfYear(current_date); + + if (draw_row) + { + dc.DrawString( + week.ToString(), + mc.Font, + ResPool.GetSolidBrush(mc.TitleBackColor), + date_rect, + mc.centered_format); + } + date_rect.Offset(date_cell_size.Width, 0); + } + + // only draw the days if we have to + if (month_row_count == i) + { + for (int j = 0; j < 7; j++) + { + if (draw_row) + { + DrawMonthCalendarDate( + dc, + date_rect, + mc, + current_date, + this_month, + row, + col); + } + + // move the day on + current_date = current_date.AddDays(1); + date_rect.Offset(date_cell_size.Width, 0); + } + + // shift the rectangle down one row + int offset = (mc.ShowWeekNumbers) ? -8 : -7; + date_rect.Offset(offset * date_cell_size.Width, date_cell_size.Height); + } + } + + // month_row_count is zero based, so add one + month_row_count++; + + // draw week numbers if required + if (draw_week_num_divider) + { + col_offset = 1; + dc.DrawLine( + ResPool.GetPen(mc.ForeColor), + rectangle.X + date_cell_size.Width - 1, + rectangle.Y + title_size.Height + date_cell_size.Height + mc.divider_line_offset, + rectangle.X + date_cell_size.Width - 1, + rectangle.Y + title_size.Height + date_cell_size.Height + (month_row_count * date_cell_size.Height) - mc.divider_line_offset); + } + } + + // draws the pervious or next button + private void DrawMonthCalendarButton(Graphics dc, Rectangle rectangle, MonthCalendar mc, Size title_size, int x_offset, Size button_size, bool is_previous) + { + const int arrow_width = 4; + const int arrow_height = 7; + + bool is_clicked = false; + Rectangle button_rect; + PointF arrow_center; + PointF[] arrow_path = new PointF[3]; + + // prepare the button + if (is_previous) + { + is_clicked = mc.is_previous_clicked; + + button_rect = new Rectangle( + rectangle.X + 1 + x_offset, + rectangle.Y + 1 + ((title_size.Height - button_size.Height) / 2), + Math.Max(button_size.Width - 1, 0), + Math.Max(button_size.Height - 1, 0)); + + arrow_center = new PointF(button_rect.X + ((button_rect.Width + arrow_width) / 2.0f), + rectangle.Y + ((button_rect.Height + arrow_height) / 2) + 1); + if (is_clicked) + { + arrow_center.X += 1; + arrow_center.Y += 1; + } + + arrow_path[0].X = arrow_center.X; + arrow_path[0].Y = arrow_center.Y - arrow_height / 2.0f + 0.5f; + arrow_path[1].X = arrow_center.X; + arrow_path[1].Y = arrow_center.Y + arrow_height / 2.0f + 0.5f; + arrow_path[2].X = arrow_center.X - arrow_width; + arrow_path[2].Y = arrow_center.Y + 0.5f; + } + else + { + is_clicked = mc.is_next_clicked; + + button_rect = new Rectangle( + rectangle.Right - 1 - x_offset - button_size.Width, + rectangle.Y + 1 + ((title_size.Height - button_size.Height) / 2), + Math.Max(button_size.Width - 1, 0), + Math.Max(button_size.Height - 1, 0)); + + arrow_center = new PointF(button_rect.X + ((button_rect.Width + arrow_width) / 2.0f), + rectangle.Y + ((button_rect.Height + arrow_height) / 2) + 1); + if (is_clicked) + { + arrow_center.X += 1; + arrow_center.Y += 1; + } + + arrow_path[0].X = arrow_center.X - arrow_width; + arrow_path[0].Y = arrow_center.Y - arrow_height / 2.0f + 0.5f; + arrow_path[1].X = arrow_center.X - arrow_width; + arrow_path[1].Y = arrow_center.Y + arrow_height / 2.0f + 0.5f; + arrow_path[2].X = arrow_center.X; + arrow_path[2].Y = arrow_center.Y + 0.5f; + } + + // fill the background + dc.FillRectangle(SystemBrushes.Control, button_rect); + // draw the border + if (is_clicked) + { + dc.DrawRectangle(SystemPens.ControlDark, button_rect); + } + else + { + CPDrawBorder3D(dc, button_rect, Border3DStyle.Raised, Border3DSide.Left | Border3DSide.Right | Border3DSide.Top | Border3DSide.Bottom); + } + // draw the arrow + dc.FillPolygon(SystemBrushes.ControlText, arrow_path); + //dc.FillPolygon (SystemBrushes.ControlText, arrow_path, FillMode.Winding); + } + + + // draws one day in the calendar grid + private void DrawMonthCalendarDate(Graphics dc, Rectangle rectangle, MonthCalendar mc, DateTime date, DateTime month, int row, int col) + { + Color date_color = mc.ForeColor; + Rectangle interior = new Rectangle(rectangle.X, rectangle.Y, Math.Max(rectangle.Width - 1, 0), Math.Max(rectangle.Height - 1, 0)); + + // find out if we are the lead of the first calendar or the trail of the last calendar + if (date.Year != month.Year || date.Month != month.Month) + { + DateTime check_date = month.AddMonths(-1); + // check if it's the month before + if (check_date.Year == date.Year && check_date.Month == date.Month && row == 0 && col == 0) + { + date_color = mc.TrailingForeColor; + } + else + { + // check if it's the month after + check_date = month.AddMonths(1); + if (check_date.Year == date.Year && check_date.Month == date.Month && row == mc.CalendarDimensions.Height - 1 && col == mc.CalendarDimensions.Width - 1) + { + date_color = mc.TrailingForeColor; + } + else + { + return; + } + } + } + else + { + date_color = mc.ForeColor; + } + + const int inflate = -1; + + if (date == mc.SelectionStart.Date && date == mc.SelectionEnd.Date) + { + // see if the date is in the start of selection + date_color = mc.BackColor; + // draw the left hand of the back ground + Rectangle selection_rect = Rectangle.Inflate(rectangle, inflate, inflate); + dc.FillPie(ResPool.GetSolidBrush(mc.TitleBackColor), selection_rect, 0, 360); + } + else if (date == mc.SelectionStart.Date) + { + // see if the date is in the start of selection + date_color = mc.BackColor; + // draw the left hand of the back ground + Rectangle selection_rect = Rectangle.Inflate(rectangle, inflate, inflate); + dc.FillPie(ResPool.GetSolidBrush(mc.TitleBackColor), selection_rect, 90, 180); + // fill the other side as a straight rect + if (date < mc.SelectionEnd.Date) + { + // use rectangle instead of rectangle to go all the way to edge of rect + selection_rect.X = (int)Math.Floor((double)(rectangle.X + rectangle.Width / 2)); + selection_rect.Width = Math.Max(rectangle.Right - selection_rect.X, 0); + dc.FillRectangle(ResPool.GetSolidBrush(mc.TitleBackColor), selection_rect); + } + } + else if (date == mc.SelectionEnd.Date) + { + // see if it is the end of selection + date_color = mc.BackColor; + // draw the left hand of the back ground + Rectangle selection_rect = Rectangle.Inflate(rectangle, inflate, inflate); + dc.FillPie(ResPool.GetSolidBrush(mc.TitleBackColor), selection_rect, 270, 180); + // fill the other side as a straight rect + if (date > mc.SelectionStart.Date) + { + selection_rect.X = rectangle.X; + selection_rect.Width = rectangle.Width - (rectangle.Width / 2); + dc.FillRectangle(ResPool.GetSolidBrush(mc.TitleBackColor), selection_rect); + } + } + else if (date > mc.SelectionStart.Date && date < mc.SelectionEnd.Date) + { + // now see if it's in the middle + date_color = mc.BackColor; + // draw the left hand of the back ground + Rectangle selection_rect = Rectangle.Inflate(rectangle, 0, inflate); + dc.FillRectangle(ResPool.GetSolidBrush(mc.TitleBackColor), selection_rect); + } + + // establish if it's a bolded font + Font font = mc.IsBoldedDate(date) ? mc.bold_font : mc.Font; + + // just draw the date now + dc.DrawString(date.Day.ToString(), font, ResPool.GetSolidBrush(date_color), rectangle, mc.centered_format); + + // today circle if needed + if (mc.ShowTodayCircle && date == DateTime.Now.Date) + { + DrawTodayCircle(dc, interior); + } + + // draw the selection grid + if (mc.is_date_clicked && mc.clicked_date == date) + { + Pen pen = ResPool.GetDashPen(Color.Black, DashStyle.Dot); + dc.DrawRectangle(pen, interior); + } + } + + private void DrawTodayCircle(Graphics dc, Rectangle rectangle) + { + Color circle_color = Color.FromArgb(248, 0, 0); + // draw the left hand of the circle + Rectangle lhs_circle_rect = new Rectangle(rectangle.X + 1, rectangle.Y + 4, Math.Max(rectangle.Width - 2, 0), Math.Max(rectangle.Height - 5, 0)); + Rectangle rhs_circle_rect = new Rectangle(rectangle.X + 1, rectangle.Y + 1, Math.Max(rectangle.Width - 2, 0), Math.Max(rectangle.Height - 2, 0)); + Point[] curve_points = new Point[3]; + curve_points[0] = new Point(lhs_circle_rect.X, rhs_circle_rect.Y + rhs_circle_rect.Height / 12); + curve_points[1] = new Point(lhs_circle_rect.X + lhs_circle_rect.Width / 9, rhs_circle_rect.Y); + curve_points[2] = new Point(lhs_circle_rect.X + lhs_circle_rect.Width / 2 + 1, rhs_circle_rect.Y); + + Pen pen = ResPool.GetSizedPen(circle_color, 2); + dc.DrawArc(pen, lhs_circle_rect, 90, 180); + dc.DrawArc(pen, rhs_circle_rect, 270, 180); + dc.DrawCurve(pen, curve_points); + dc.DrawLine(ResPool.GetPen(circle_color), curve_points[2], new Point(curve_points[2].X, lhs_circle_rect.Y)); + } + + #endregion // MonthCalendar + + #region Panel + public override Size PanelDefaultSize + { + get + { + return new Size(200, 100); + } + } + #endregion // Panel + + #region PictureBox + public override void DrawPictureBox(Graphics dc, Rectangle clip, PictureBox pb) + { + Rectangle client = pb.ClientRectangle; + + client = new Rectangle(client.Left + pb.Padding.Left, client.Top + pb.Padding.Top, client.Width - pb.Padding.Horizontal, client.Height - pb.Padding.Vertical); + + // FIXME - instead of drawing the whole picturebox every time + // intersect the clip rectangle with the drawn picture and only draw what's needed, + // Also, we only need a background fill where no image goes + if (pb.Image != null) + { + switch (pb.SizeMode) + { + case PictureBoxSizeMode.StretchImage: + dc.DrawImage(pb.Image, client.Left, client.Top, client.Width, client.Height); + break; + + case PictureBoxSizeMode.CenterImage: + dc.DrawImage(pb.Image, (client.Width / 2) - (pb.Image.Width / 2), (client.Height / 2) - (pb.Image.Height / 2)); + break; + + case PictureBoxSizeMode.Zoom: + Size image_size; + + if (((float)pb.Image.Width / (float)pb.Image.Height) >= ((float)client.Width / (float)client.Height)) + image_size = new Size(client.Width, (pb.Image.Height * client.Width) / pb.Image.Width); + else + image_size = new Size((pb.Image.Width * client.Height) / pb.Image.Height, client.Height); + + dc.DrawImage(pb.Image, (client.Width / 2) - (image_size.Width / 2), (client.Height / 2) - (image_size.Height / 2), image_size.Width, image_size.Height); + break; + + default: + // Normal, AutoSize + dc.DrawImage(pb.Image, client.Left, client.Top, pb.Image.Width, pb.Image.Height); + break; + } + + return; + } + } + + public override Size PictureBoxDefaultSize + { + get + { + return new Size(100, 50); + } + } + #endregion // PictureBox + + /* + #region PrintPreviewControl + public override int PrintPreviewControlPadding { + get { return 8; } + } + + public override Size PrintPreviewControlGetPageSize (PrintPreviewControl preview) + { + int page_width, page_height; + int padding = PrintPreviewControlPadding; + PreviewPageInfo[] pis = preview.page_infos; + + if (preview.AutoZoom) { + int height_available = preview.ClientRectangle.Height - (preview.Rows) * padding - 2 * padding; + int width_available = preview.ClientRectangle.Width - (preview.Columns - 1) * padding - 2 * padding; + + float image_ratio = (float)pis[0].Image.Width / pis[0].Image.Height; + + /* try to lay things out using the width to determine the size + page_width = width_available / preview.Columns; + page_height = (int)(page_width / image_ratio); + + /* does the height fit? + if (page_height * (preview.Rows + 1) > height_available) { + /* no, lay things out via the height + page_height = height_available / (preview.Rows + 1); + page_width = (int)(page_height * image_ratio); + } + } + else { + page_width = (int)(pis[0].Image.Width * preview.Zoom); + page_height = (int)(pis[0].Image.Height * preview.Zoom); + } + + return new Size (page_width, page_height); + } + + public override void PrintPreviewWidgetPaint (PaintEventArgs pe, PrintPreviewControl preview, Size page_size) + { + int padding = 8; + PreviewPageInfo[] pis = preview.page_infos; + if (pis == null) + return; + + int page_x, page_y; + + int width = page_size.Width * preview.Columns + padding * (preview.Columns - 1) + 2 * padding; + int height = page_size.Height * (preview.Rows + 1) + padding * preview.Rows + 2 * padding; + + Rectangle viewport = preview.ViewPort; + + pe.Graphics.Clip = new Region (viewport); + + /* center things if we can + int off_x = viewport.Width / 2 - width / 2; + if (off_x < 0) off_x = 0; + int off_y = viewport.Height / 2 - height / 2; + if (off_y < 0) off_y = 0; + + page_y = off_y + padding - preview.vbar_value; + + if (preview.StartPage > 0) { + int p = preview.StartPage - 1; + for (int py = 0; py < preview.Rows + 1; py ++) { + page_x = off_x + padding - preview.hbar_value; + for (int px = 0; px < preview.Columns; px ++) { + if (p >= pis.Length) + continue; + Image image = preview.image_cache[p]; + if (image == null) + image = pis[p].Image; + Rectangle dest = new Rectangle (new Point (page_x, page_y), page_size); + + pe.Graphics.DrawImage (image, dest, 0, 0, image.Width, image.Height, GraphicsUnit.Pixel); + + page_x += padding + page_size.Width; + p++; + } + page_y += padding + page_size.Height; + } + } + } + #endregion // PrintPreviewControl*/ + + #region ProgressBar + public override void DrawProgressBar(Graphics dc, Rectangle clip_rect, ProgressBar ctrl) + { + Rectangle client_area = ctrl.client_area; + + /* Draw border */ + CPDrawBorder3D(dc, ctrl.ClientRectangle, Border3DStyle.SunkenOuter, Border3DSide.Left | Border3DSide.Right | Border3DSide.Top | Border3DSide.Bottom & ~Border3DSide.Middle, ColorControl); + + /* Draw Blocks */ + int draw_mode = 0; + int max_blocks = int.MaxValue; + int start_pixel = client_area.X; + draw_mode = (int)ctrl.Style; + + switch (draw_mode) + { + case 1: + { // Continuous + int pixels_to_draw; + pixels_to_draw = (int)(client_area.Width * ((double)(ctrl.Value - ctrl.Minimum) / (double)(Math.Max(ctrl.Maximum - ctrl.Minimum, 1)))); + dc.FillRectangle(new SolidBrush(Application.CurrentSkin.ProgressBar_BackgroundColor), new Rectangle(client_area.X, client_area.Y, pixels_to_draw, client_area.Height)); + break; + } + case 2: // Marquee + if (XplatUI.ThemesEnabled) + { + int ms_diff = (int)(DateTime.Now - ctrl.start).TotalMilliseconds; + double percent_done = (double)ms_diff / ProgressBarMarqueeSpeedScaling + % (double)ctrl.MarqueeAnimationSpeed / (double)ctrl.MarqueeAnimationSpeed; + max_blocks = 5; + start_pixel = client_area.X + (int)(client_area.Width * percent_done); + } + + goto case 0; + case 0: + default: // Blocks + Rectangle block_rect; + int space_betweenblocks = ProgressBarChunkSpacing; + int block_width; + int increment; + int barpos_pixels; + int block_count = 0; + + block_width = ProgressBarGetChunkSize(client_area.Height); + block_width = Math.Max(block_width, 0); // block_width is used to break out the loop below, it must be >= 0! + barpos_pixels = (int)(((double)(ctrl.Value - ctrl.Minimum) * client_area.Width) / (Math.Max(ctrl.Maximum - ctrl.Minimum, 1))); + increment = block_width + space_betweenblocks; + + block_rect = new Rectangle(start_pixel, client_area.Y, block_width, client_area.Height); + while (true) + { + if (max_blocks != int.MaxValue) + { + if (block_count >= max_blocks) + break; + if (block_rect.X > client_area.Width) + block_rect.X -= client_area.Width; + } + else + { + if ((block_rect.X - client_area.X) >= barpos_pixels) + break; + } + + if (clip_rect.IntersectsWith(block_rect) == true) + { + dc.FillRectangle(new SolidBrush(Application.CurrentSkin.ProgressBar_BlockColor), block_rect); + } + + block_rect.X += increment; + block_count++; + } + break; + + } + } + + public const int ProgressBarChunkSpacing = 2; + + public static int ProgressBarGetChunkSize() + { + return ProgressBarGetChunkSize(ProgressBarDefaultHeight); + } + + static int ProgressBarGetChunkSize(int progressBarClientAreaHeight) + { + int size = (progressBarClientAreaHeight * 2) / 3; + return size; + } + + const int ProgressBarDefaultHeight = 23; + + public override Size ProgressBarDefaultSize + { + get + { + return new Size(100, ProgressBarDefaultHeight); + } + } + + public const double ProgressBarMarqueeSpeedScaling = 15; + + #endregion // ProgressBar + + #region RadioButton + public override void DrawRadioButton(Graphics dc, Rectangle clip_rectangle, RadioButton radio_button) + { + StringFormat text_format; + Rectangle client_rectangle; + Rectangle text_rectangle; + Rectangle radiobutton_rectangle; + int radiobutton_size = 13; + int radiobutton_space = 4; + + client_rectangle = radio_button.ClientRectangle; + text_rectangle = client_rectangle; + radiobutton_rectangle = new Rectangle(text_rectangle.X, text_rectangle.Y, radiobutton_size, radiobutton_size); + + text_format = new StringFormat(); + text_format.Alignment = StringAlignment.Near; + text_format.LineAlignment = StringAlignment.Center; + text_format.HotkeyPrefix = HotkeyPrefix.Show; + + /* Calculate the position of text and checkbox rectangle */ + if (radio_button.appearance != Appearance.Button) + { + switch (radio_button.radiobutton_alignment) + { + case ContentAlignment.BottomCenter: + { + radiobutton_rectangle.X = (client_rectangle.Right - client_rectangle.Left) / 2 - radiobutton_size / 2; + radiobutton_rectangle.Y = client_rectangle.Bottom - radiobutton_size; + text_rectangle.X = client_rectangle.X; + text_rectangle.Width = client_rectangle.Width; + text_rectangle.Height = client_rectangle.Height - radiobutton_size - radiobutton_space; + break; + } + + case ContentAlignment.BottomLeft: + { + radiobutton_rectangle.X = client_rectangle.Left; + radiobutton_rectangle.Y = client_rectangle.Bottom - radiobutton_size; + text_rectangle.X = client_rectangle.X + radiobutton_size + radiobutton_space; + text_rectangle.Width = client_rectangle.Width - radiobutton_size - radiobutton_space; + break; + } + + case ContentAlignment.BottomRight: + { + radiobutton_rectangle.X = client_rectangle.Right - radiobutton_size; + radiobutton_rectangle.Y = client_rectangle.Bottom - radiobutton_size; + text_rectangle.X = client_rectangle.X; + text_rectangle.Width = client_rectangle.Width - radiobutton_size - radiobutton_space; + break; + } + + case ContentAlignment.MiddleCenter: + { + radiobutton_rectangle.X = (client_rectangle.Right - client_rectangle.Left) / 2 - radiobutton_size / 2; + radiobutton_rectangle.Y = (client_rectangle.Bottom - client_rectangle.Top) / 2 - radiobutton_size / 2; + text_rectangle.X = client_rectangle.X; + text_rectangle.Width = client_rectangle.Width; + break; + } + + default: + case ContentAlignment.MiddleLeft: + { + radiobutton_rectangle.X = client_rectangle.Left; + radiobutton_rectangle.Y = (client_rectangle.Bottom - client_rectangle.Top) / 2 - radiobutton_size / 2; + text_rectangle.X = client_rectangle.X + radiobutton_size + radiobutton_space; + text_rectangle.Width = client_rectangle.Width - radiobutton_size - radiobutton_space; + break; + } + + case ContentAlignment.MiddleRight: + { + radiobutton_rectangle.X = client_rectangle.Right - radiobutton_size; + radiobutton_rectangle.Y = (client_rectangle.Bottom - client_rectangle.Top) / 2 - radiobutton_size / 2; + text_rectangle.X = client_rectangle.X; + text_rectangle.Width = client_rectangle.Width - radiobutton_size - radiobutton_space; + break; + } + + case ContentAlignment.TopCenter: + { + radiobutton_rectangle.X = (client_rectangle.Right - client_rectangle.Left) / 2 - radiobutton_size / 2; + radiobutton_rectangle.Y = client_rectangle.Top; + text_rectangle.X = client_rectangle.X; + text_rectangle.Y = radiobutton_size + radiobutton_space; + text_rectangle.Width = client_rectangle.Width; + text_rectangle.Height = client_rectangle.Height - radiobutton_size - radiobutton_space; + break; + } + + case ContentAlignment.TopLeft: + { + radiobutton_rectangle.X = client_rectangle.Left; + radiobutton_rectangle.Y = client_rectangle.Top; + text_rectangle.X = client_rectangle.X + radiobutton_size + radiobutton_space; + text_rectangle.Width = client_rectangle.Width - radiobutton_size - radiobutton_space; + break; + } + + case ContentAlignment.TopRight: + { + radiobutton_rectangle.X = client_rectangle.Right - radiobutton_size; + radiobutton_rectangle.Y = client_rectangle.Top; + text_rectangle.X = client_rectangle.X; + text_rectangle.Width = client_rectangle.Width - radiobutton_size - radiobutton_space; + break; + } + } + } + else + { + text_rectangle.X = client_rectangle.X; + text_rectangle.Width = client_rectangle.Width; + } + + /* Set the horizontal alignment of our text */ + switch (radio_button.text_alignment) + { + case ContentAlignment.BottomLeft: + case ContentAlignment.MiddleLeft: + case ContentAlignment.TopLeft: + { + text_format.Alignment = StringAlignment.Near; + break; + } + + case ContentAlignment.BottomCenter: + case ContentAlignment.MiddleCenter: + case ContentAlignment.TopCenter: + { + text_format.Alignment = StringAlignment.Center; + break; + } + + case ContentAlignment.BottomRight: + case ContentAlignment.MiddleRight: + case ContentAlignment.TopRight: + { + text_format.Alignment = StringAlignment.Far; + break; + } + } + + /* Set the vertical alignment of our text */ + switch (radio_button.text_alignment) + { + case ContentAlignment.TopLeft: + case ContentAlignment.TopCenter: + case ContentAlignment.TopRight: + { + text_format.LineAlignment = StringAlignment.Near; + break; + } + + case ContentAlignment.BottomLeft: + case ContentAlignment.BottomCenter: + case ContentAlignment.BottomRight: + { + text_format.LineAlignment = StringAlignment.Far; + break; + } + + case ContentAlignment.MiddleLeft: + case ContentAlignment.MiddleCenter: + case ContentAlignment.MiddleRight: + { + text_format.LineAlignment = StringAlignment.Center; + break; + } + } + + ButtonState state = ButtonState.Normal; + if (radio_button.FlatStyle == FlatStyle.Flat) + { + state |= ButtonState.Flat; + } + + if (radio_button.Checked) + { + state |= ButtonState.Checked; + } + + if (!radio_button.Enabled) + { + state |= ButtonState.Inactive; + } + + // Start drawing + RadioButton_DrawButton(radio_button, dc, state, radiobutton_rectangle); + + if ((radio_button.image != null) || (radio_button.image_list != null)) + ButtonBase_DrawImage(radio_button, dc); + + RadioButton_DrawText(radio_button, text_rectangle, dc, text_format); + + if (radio_button.Focused && radio_button.Enabled && radio_button.appearance != Appearance.Button && radio_button.Text != String.Empty && radio_button.ShowFocusCues) + { + SizeF text_size = dc.MeasureString(radio_button.Text, radio_button.Font); + + Rectangle focus_rect = Rectangle.Empty; + focus_rect.X = text_rectangle.X; + focus_rect.Y = (int)((text_rectangle.Height - text_size.Height) / 2); + focus_rect.Size = text_size.ToSize(); + + RadioButton_DrawFocus(radio_button, dc, focus_rect); + } + + text_format.Dispose(); + } + + protected virtual void RadioButton_DrawButton(RadioButton radio_button, Graphics dc, ButtonState state, Rectangle radiobutton_rectangle) + { + dc.FillRectangle(GetControlBackBrush(radio_button.BackColor), radio_button.ClientRectangle); + + if (radio_button.appearance == Appearance.Button) + { + ButtonBase_DrawButton(radio_button, dc); + + if ((radio_button.Focused) && radio_button.Enabled) + ButtonBase_DrawFocus(radio_button, dc); + } + else + { + // establish if we are rendering a flat style of some sort + if (radio_button.FlatStyle == FlatStyle.Flat || radio_button.FlatStyle == FlatStyle.Popup) + { + DrawFlatStyleRadioButton(dc, radiobutton_rectangle, radio_button); + } + else + { + CPDrawRadioButton(dc, radiobutton_rectangle, state); + } + } + } + + protected virtual void RadioButton_DrawText(RadioButton radio_button, Rectangle text_rectangle, Graphics dc, StringFormat text_format) + { + DrawCheckBox_and_RadioButtonText(radio_button, text_rectangle, dc, + text_format, radio_button.Appearance, radio_button.Checked); + } + + protected virtual void RadioButton_DrawFocus(RadioButton radio_button, Graphics dc, Rectangle text_rectangle) + { + DrawInnerFocusRectangle(dc, text_rectangle, radio_button.BackColor); + } + + + // renders a radio button with the Flat and Popup FlatStyle + protected virtual void DrawFlatStyleRadioButton(Graphics graphics, Rectangle rectangle, RadioButton radio_button) + { + int lineWidth; + + if (radio_button.Enabled) + { + + // draw the outer flatstyle arcs + if (radio_button.FlatStyle == FlatStyle.Flat) + { + graphics.DrawArc(SystemPens.ControlDarkDark, rectangle, 0, 359); + + // fill in the area depending on whether or not the mouse is hovering + if ((radio_button.is_entered || radio_button.Capture) && !radio_button.is_pressed) + { + graphics.FillPie(SystemBrushes.ControlLight, rectangle.X + 1, rectangle.Y + 1, rectangle.Width - 2, rectangle.Height - 2, 0, 359); + } + else + { + graphics.FillPie(SystemBrushes.ControlLightLight, rectangle.X + 1, rectangle.Y + 1, rectangle.Width - 2, rectangle.Height - 2, 0, 359); + } + } + else + { + // must be a popup radio button + // fill the control + graphics.FillPie(SystemBrushes.ControlLightLight, rectangle, 0, 359); + + if (radio_button.is_entered || radio_button.Capture) + { + // draw the popup 3d button knob + graphics.DrawArc(SystemPens.ControlLight, rectangle.X + 1, rectangle.Y + 1, rectangle.Width - 2, rectangle.Height - 2, 0, 359); + + graphics.DrawArc(SystemPens.ControlDark, rectangle, 135, 180); + graphics.DrawArc(SystemPens.ControlLightLight, rectangle, 315, 180); + + } + else + { + // just draw lighter flatstyle outer circle + graphics.DrawArc(SystemPens.ControlDark, rectangle, 0, 359); + } + } + } + else + { + // disabled + // fill control background color regardless of actual backcolor + graphics.FillPie(SystemBrushes.Control, rectangle.X + 1, rectangle.Y + 1, rectangle.Width - 2, rectangle.Height - 2, 0, 359); + // draw the ark as control dark + graphics.DrawArc(SystemPens.ControlDark, rectangle, 0, 359); + } + + // draw the check + if (radio_button.Checked) + { + lineWidth = Math.Max(1, Math.Min(rectangle.Width, rectangle.Height) / 3); + + Pen dot_pen = SystemPens.ControlDarkDark; + Brush dot_brush = SystemBrushes.ControlDarkDark; + + if (!radio_button.Enabled || ((radio_button.FlatStyle == FlatStyle.Popup) && radio_button.is_pressed)) + { + dot_pen = SystemPens.ControlDark; + dot_brush = SystemBrushes.ControlDark; + } + + if (rectangle.Height > 13) + { + graphics.FillPie(dot_brush, rectangle.X + lineWidth, rectangle.Y + lineWidth, rectangle.Width - lineWidth * 2, rectangle.Height - lineWidth * 2, 0, 359); + } + else + { + int x_half_pos = (rectangle.Width / 2) + rectangle.X; + int y_half_pos = (rectangle.Height / 2) + rectangle.Y; + + graphics.DrawLine(dot_pen, x_half_pos - 1, y_half_pos, x_half_pos + 2, y_half_pos); + graphics.DrawLine(dot_pen, x_half_pos - 1, y_half_pos + 1, x_half_pos + 2, y_half_pos + 1); + + graphics.DrawLine(dot_pen, x_half_pos, y_half_pos - 1, x_half_pos, y_half_pos + 2); + graphics.DrawLine(dot_pen, x_half_pos + 1, y_half_pos - 1, x_half_pos + 1, y_half_pos + 2); + } + } + } + + public override Size RadioButtonDefaultSize + { + get + { + return new Size(104, 24); + } + } + + public override void DrawRadioButton(Graphics g, RadioButton rb, Rectangle glyphArea, Rectangle textBounds, Rectangle imageBounds, Rectangle clipRectangle) + { + // Draw Button Background + if (rb.FlatStyle == FlatStyle.Flat || rb.FlatStyle == FlatStyle.Popup) + { + glyphArea.Height -= 2; + glyphArea.Width -= 2; + } + + DrawRadioButtonGlyph(g, rb, glyphArea); + + // If we have an image, draw it + if (imageBounds.Size != Size.Empty) + DrawRadioButtonImage(g, rb, imageBounds); + + if (rb.Focused && rb.Enabled && rb.ShowFocusCues && textBounds.Size != Size.Empty) + DrawRadioButtonFocus(g, rb, textBounds); + + // If we have text, draw it + if (textBounds != Rectangle.Empty) + DrawRadioButtonText(g, rb, textBounds); + } + + public virtual void DrawRadioButtonGlyph(Graphics g, RadioButton rb, Rectangle glyphArea) + { + if (rb.Pressed) + MemphisThemeElements.CurrentTheme.RadioButtonPainter.PaintRadioButton(g, glyphArea, rb.BackColor, rb.ForeColor, ElementState.Pressed, rb.FlatStyle, rb.Checked); + else if (rb.InternalSelected) + MemphisThemeElements.CurrentTheme.RadioButtonPainter.PaintRadioButton(g, glyphArea, rb.BackColor, rb.ForeColor, ElementState.Normal, rb.FlatStyle, rb.Checked); + else if (rb.Entered) + MemphisThemeElements.CurrentTheme.RadioButtonPainter.PaintRadioButton(g, glyphArea, rb.BackColor, rb.ForeColor, ElementState.Hot, rb.FlatStyle, rb.Checked); + else if (!rb.Enabled) + MemphisThemeElements.CurrentTheme.RadioButtonPainter.PaintRadioButton(g, glyphArea, rb.BackColor, rb.ForeColor, ElementState.Disabled, rb.FlatStyle, rb.Checked); + else + MemphisThemeElements.CurrentTheme.RadioButtonPainter.PaintRadioButton(g, glyphArea, rb.BackColor, rb.ForeColor, ElementState.Normal, rb.FlatStyle, rb.Checked); + } + + public virtual void DrawRadioButtonFocus(Graphics g, RadioButton rb, Rectangle focusArea) + { + WidgetPaint.DrawFocusRectangle(g, focusArea); + } + + public virtual void DrawRadioButtonImage(Graphics g, RadioButton rb, Rectangle imageBounds) + { + if (rb.Enabled) + g.DrawImage(rb.Image, imageBounds); + else + CPDrawImageDisabled(g, rb.Image, imageBounds.Left, imageBounds.Top, ColorControl); + } + + public virtual void DrawRadioButtonText(Graphics g, RadioButton rb, Rectangle textBounds) + { + if (rb.Enabled) + TextRenderer.DrawTextInternal(g, rb.Text, rb.Font, textBounds, rb.ForeColor, rb.TextFormatFlags, rb.UseCompatibleTextRendering); + else + DrawStringDisabled20(g, rb.Text, rb.Font, textBounds, rb.BackColor, rb.TextFormatFlags, rb.UseCompatibleTextRendering); + } + + public override Size CalculateRadioButtonAutoSize(RadioButton rb) + { + Size ret_size = Size.Empty; + Size text_size = TextRenderer.MeasureTextInternal(rb.Text, rb.Font, rb.UseCompatibleTextRendering); + Size image_size = rb.Image == null ? Size.Empty : rb.Image.Size; + + // Pad the text size + if (rb.Text.Length != 0) + { + text_size.Height += 4; + text_size.Width += 4; + } + + switch (rb.TextImageRelation) + { + case TextImageRelation.Overlay: + ret_size.Height = Math.Max(rb.Text.Length == 0 ? 0 : text_size.Height, image_size.Height); + ret_size.Width = Math.Max(text_size.Width, image_size.Width); + break; + case TextImageRelation.ImageAboveText: + case TextImageRelation.TextAboveImage: + ret_size.Height = text_size.Height + image_size.Height; + ret_size.Width = Math.Max(text_size.Width, image_size.Width); + break; + case TextImageRelation.ImageBeforeText: + case TextImageRelation.TextBeforeImage: + ret_size.Height = Math.Max(text_size.Height, image_size.Height); + ret_size.Width = text_size.Width + image_size.Width; + break; + } + + // Pad the result + ret_size.Height += (rb.Padding.Vertical); + ret_size.Width += (rb.Padding.Horizontal) + 15; + + // There seems to be a minimum height + if (ret_size.Height == rb.Padding.Vertical) + ret_size.Height += 14; + + return ret_size; + } + + public override void CalculateRadioButtonTextAndImageLayout(ButtonBase b, Point offset, out Rectangle glyphArea, out Rectangle textRectangle, out Rectangle imageRectangle) + { + CalculateCheckBoxTextAndImageLayout(b, offset, out glyphArea, out textRectangle, out imageRectangle); + } + #endregion // RadioButton + + #region ScrollBar + public override void DrawScrollBar(Graphics dc, Rectangle clip, ScrollBar bar) + { + int scrollbutton_width = bar.scrollbutton_width; + int scrollbutton_height = bar.scrollbutton_height; + Rectangle first_arrow_area; + Rectangle second_arrow_area; + Rectangle thumb_pos; + + thumb_pos = bar.ThumbPos; + + if (bar.vert) + { + first_arrow_area = new Rectangle(0, 0, bar.Width, scrollbutton_height); + bar.FirstArrowArea = first_arrow_area; + + second_arrow_area = new Rectangle(0, bar.ClientRectangle.Height - scrollbutton_height, bar.Width, scrollbutton_height); + bar.SecondArrowArea = second_arrow_area; + + thumb_pos.Width = bar.Width; + bar.ThumbPos = thumb_pos; + + Brush VerticalBrush; + /* Background, upper track */ + if (bar.thumb_moving == ScrollBar.ThumbMoving.Backwards) + VerticalBrush = ResPool.GetHatchBrush(HatchStyle.Percent50, Color.FromArgb(255, 63, 63, 63), Color.Black); + else + VerticalBrush = ResPool.GetHatchBrush(HatchStyle.Percent50, ColorScrollBar, Color.White); + Rectangle UpperTrack = new Rectangle(0, 0, bar.ClientRectangle.Width, bar.ThumbPos.Bottom); + if (clip.IntersectsWith(UpperTrack)) + dc.FillRectangle(VerticalBrush, UpperTrack); + + /* Background, lower track */ + if (bar.thumb_moving == ScrollBar.ThumbMoving.Forward) + VerticalBrush = ResPool.GetHatchBrush(HatchStyle.Percent50, Color.FromArgb(255, 63, 63, 63), Color.Black); + else + VerticalBrush = ResPool.GetHatchBrush(HatchStyle.Percent50, ColorScrollBar, Color.White); + Rectangle LowerTrack = new Rectangle(0, bar.ThumbPos.Bottom, bar.ClientRectangle.Width, bar.ClientRectangle.Height - bar.ThumbPos.Bottom); + if (clip.IntersectsWith(LowerTrack)) + dc.FillRectangle(VerticalBrush, LowerTrack); + + /* Buttons */ + if (clip.IntersectsWith(first_arrow_area)) + CPDrawScrollButton(dc, first_arrow_area, ScrollButton.Up, bar.firstbutton_state); + if (clip.IntersectsWith(second_arrow_area)) + CPDrawScrollButton(dc, second_arrow_area, ScrollButton.Down, bar.secondbutton_state); + } + else + { + first_arrow_area = new Rectangle(0, 0, scrollbutton_width, bar.Height); + bar.FirstArrowArea = first_arrow_area; + + second_arrow_area = new Rectangle(bar.ClientRectangle.Width - scrollbutton_width, 0, scrollbutton_width, bar.Height); + bar.SecondArrowArea = second_arrow_area; + + thumb_pos.Height = bar.Height; + bar.ThumbPos = thumb_pos; + + Brush HorizontalBrush; + //Background, left track + if (bar.thumb_moving == ScrollBar.ThumbMoving.Backwards) + HorizontalBrush = ResPool.GetHatchBrush(HatchStyle.Percent50, Color.FromArgb(255, 63, 63, 63), Color.Black); + else + HorizontalBrush = ResPool.GetHatchBrush(HatchStyle.Percent50, ColorScrollBar, Color.White); + Rectangle LeftTrack = new Rectangle(0, 0, bar.ThumbPos.Right, bar.ClientRectangle.Height); + if (clip.IntersectsWith(LeftTrack)) + dc.FillRectangle(HorizontalBrush, LeftTrack); + + //Background, right track + if (bar.thumb_moving == ScrollBar.ThumbMoving.Forward) + HorizontalBrush = ResPool.GetHatchBrush(HatchStyle.Percent50, Color.FromArgb(255, 63, 63, 63), Color.Black); + else + HorizontalBrush = ResPool.GetHatchBrush(HatchStyle.Percent50, ColorScrollBar, Color.White); + Rectangle RightTrack = new Rectangle(bar.ThumbPos.Right, 0, bar.ClientRectangle.Width - bar.ThumbPos.Right, bar.ClientRectangle.Height); + if (clip.IntersectsWith(RightTrack)) + dc.FillRectangle(HorizontalBrush, RightTrack); + + /* Buttons */ + if (clip.IntersectsWith(first_arrow_area)) + CPDrawScrollButton(dc, first_arrow_area, ScrollButton.Left, bar.firstbutton_state); + if (clip.IntersectsWith(second_arrow_area)) + CPDrawScrollButton(dc, second_arrow_area, ScrollButton.Right, bar.secondbutton_state); + } + + /* Thumb */ + ScrollBar_DrawThumb(bar, thumb_pos, clip, dc); + } + + protected virtual void ScrollBar_DrawThumb(ScrollBar bar, Rectangle thumb_pos, Rectangle clip, Graphics dc) + { + if (bar.Enabled && thumb_pos.Width > 0 && thumb_pos.Height > 0 && clip.IntersectsWith(thumb_pos)) + DrawScrollButtonPrimitive(dc, thumb_pos, ButtonState.Normal); + } + + public override int ScrollBarButtonSize + { + get { return 16; } + } + + public override bool ScrollBarHasHotElementStyles + { + get + { + return false; + } + } + + public override bool ScrollBarHasPressedThumbStyle + { + get + { + return false; + } + } + + public override bool ScrollBarHasHoverArrowButtonStyle + { + get + { + return false; + } + } + #endregion // ScrollBar + + #region StatusBar + public override void DrawStatusBar(Graphics real_dc, Rectangle clip, StatusBar sb) + { + Rectangle area = sb.ClientRectangle; + int horz_border = 2; + int vert_border = 2; + + Image backbuffer = new Bitmap(sb.ClientSize.Width, sb.ClientSize.Height, real_dc); + Graphics dc = Graphics.FromImage(backbuffer); + + DrawStatusBarBackground(dc, clip, sb); + + if (!sb.ShowPanels && sb.Text != String.Empty) + { + string text = sb.Text; + StringFormat string_format = new StringFormat(); + string_format.Trimming = StringTrimming.Character; + string_format.FormatFlags = StringFormatFlags.NoWrap; + + if (text.Length > 127) + text = text.Substring(0, 127); + + if (text[0] == '\t') + { + string_format.Alignment = StringAlignment.Center; + text = text.Substring(1); + if (text[0] == '\t') + { + string_format.Alignment = StringAlignment.Far; + text = text.Substring(1); + } + } + + dc.DrawString(text, sb.Font, ResPool.GetSolidBrush(sb.ForeColor), + new Rectangle(area.X + 2, area.Y + 2, area.Width - 4, area.Height - 4), string_format); + string_format.Dispose(); + } + else if (sb.ShowPanels) + { + Brush br_forecolor = GetControlForeBrush(sb.ForeColor); + int prev_x = area.X + horz_border; + int y = area.Y + vert_border; + for (int i = 0; i < sb.Panels.Count; i++) + { + Rectangle pr = new Rectangle(prev_x, y, + sb.Panels[i].Width, area.Height); + prev_x += pr.Width + StatusBarHorzGapWidth; + if (pr.IntersectsWith(clip)) + DrawStatusBarPanel(dc, pr, i, br_forecolor, sb.Panels[i]); + } + } + + if (sb.SizingGrip) + DrawStatusBarSizingGrip(dc, clip, sb, area); + + real_dc.DrawImage(backbuffer, 0, 0); + dc.Dispose(); + backbuffer.Dispose(); + + } + + protected virtual void DrawStatusBarBackground(Graphics dc, Rectangle clip, StatusBar sb) + { + bool is_color_control = sb.BackColor.ToArgb() == ColorControl.ToArgb(); + + Brush brush = is_color_control ? SystemBrushes.Control : ResPool.GetSolidBrush(sb.BackColor); + dc.FillRectangle(brush, clip); + } + + protected virtual void DrawStatusBarSizingGrip(Graphics dc, Rectangle clip, StatusBar sb, Rectangle area) + { + area = new Rectangle(area.Right - 16 - 2, area.Bottom - 12 - 1, 16, 16); + CPDrawSizeGrip(dc, ColorControl, area); + } + + protected virtual void DrawStatusBarPanel(Graphics dc, Rectangle area, int index, + Brush br_forecolor, StatusBarPanel panel) + { + int border_size = 3; // this is actually const, even if the border style is none + int icon_width = 16; + + area.Height -= border_size; + + DrawStatusBarPanelBackground(dc, area, panel); + + if (panel.Style == StatusBarPanelStyle.OwnerDraw) + { + StatusBarDrawItemEventArgs e = new StatusBarDrawItemEventArgs( + dc, panel.Parent.Font, area, index, DrawItemState.Default, + panel, panel.Parent.ForeColor, panel.Parent.BackColor); + panel.Parent.OnDrawItemInternal(e); + return; + } + + string text = panel.Text; + StringFormat string_format = new StringFormat(); + string_format.Trimming = StringTrimming.Character; + string_format.FormatFlags = StringFormatFlags.NoWrap; + + + if (text != null && text.Length > 0 && text[0] == '\t') + { + string_format.Alignment = StringAlignment.Center; + text = text.Substring(1); + if (text[0] == '\t') + { + string_format.Alignment = StringAlignment.Far; + text = text.Substring(1); + } + } + + Rectangle string_rect = Rectangle.Empty; + int x; + int len; + int icon_x = 0; + int y = (area.Height / 2 - (int)panel.Parent.Font.Size / 2) - 1; + + switch (panel.Alignment) + { + case HorizontalAlignment.Right: + len = (int)dc.MeasureString(text, panel.Parent.Font).Width; + x = area.Right - len - 4; + string_rect = new Rectangle(x, y, + area.Right - x - border_size, + area.Bottom - y - border_size); + if (panel.Icon != null) + { + icon_x = x - icon_width - 2; + } + break; + case HorizontalAlignment.Center: + len = (int)dc.MeasureString(text, panel.Parent.Font).Width; + x = area.Left + ((panel.Width - len) / 2); + + string_rect = new Rectangle(x, y, + area.Right - x - border_size, + area.Bottom - y - border_size); + + if (panel.Icon != null) + { + icon_x = x - icon_width - 2; + } + break; + + + default: + int left = area.Left + border_size; ; + if (panel.Icon != null) + { + icon_x = area.Left + 2; + left = icon_x + icon_width + 2; + } + + x = left; + string_rect = new Rectangle(x, y, + area.Right - x - border_size, + area.Bottom - y - border_size); + break; + } + + RectangleF clip_bounds = dc.ClipBounds; + dc.SetClip(area); + dc.DrawString(text, panel.Parent.Font, br_forecolor, string_rect, string_format); + dc.SetClip(clip_bounds); + + if (panel.Icon != null) + { + dc.DrawIcon(panel.Icon, new Rectangle(icon_x, y, icon_width, icon_width)); + } + } + + protected virtual void DrawStatusBarPanelBackground(Graphics dc, Rectangle area, StatusBarPanel panel) + { + if (panel.BorderStyle != StatusBarPanelBorderStyle.None) + { + Border3DStyle border_style = Border3DStyle.SunkenOuter; + if (panel.BorderStyle == StatusBarPanelBorderStyle.Raised) + border_style = Border3DStyle.RaisedInner; + + CPDrawBorder3D(dc, area, border_style, Border3DSide.Left | Border3DSide.Right | Border3DSide.Top | Border3DSide.Bottom, panel.Parent.BackColor); + } + } + + public override int StatusBarSizeGripWidth + { + get { return 15; } + } + + public override int StatusBarHorzGapWidth + { + get { return 3; } + } + + public override Size StatusBarDefaultSize + { + get + { + return new Size(100, 22); + } + } + #endregion // StatusBar + + #region TabControl + + #region TabControl settings + + public override Size TabControlDefaultItemSize + { + get { return MemphisThemeElements.CurrentTheme.TabWidgetPainter.DefaultItemSize; } + } + + public override Point TabControlDefaultPadding + { + get { return MemphisThemeElements.CurrentTheme.TabWidgetPainter.DefaultPadding; } + } + + public override int TabControlMinimumTabWidth + { + get { return MemphisThemeElements.CurrentTheme.TabWidgetPainter.MinimumTabWidth; } + } + + public override Rectangle TabWidgetselectedDelta + { + get { return MemphisThemeElements.CurrentTheme.TabWidgetPainter.SelectedTabDelta; } + } + + public override int TabWidgetselectedSpacing + { + get { return MemphisThemeElements.CurrentTheme.TabWidgetPainter.SelectedSpacing; } + } + + public override int TabPanelOffsetX + { + get { return MemphisThemeElements.CurrentTheme.TabWidgetPainter.TabPanelOffset.X; } + } + + public override int TabPanelOffsetY + { + get { return MemphisThemeElements.CurrentTheme.TabWidgetPainter.TabPanelOffset.Y; } + } + + public override int TabControlColSpacing + { + get { return MemphisThemeElements.CurrentTheme.TabWidgetPainter.ColSpacing; } + } + + public override Point TabControlImagePadding + { + get { return MemphisThemeElements.CurrentTheme.TabWidgetPainter.ImagePadding; } + } + + public override int TabWidgetscrollerWidth + { + get { return MemphisThemeElements.CurrentTheme.TabWidgetPainter.ScrollerWidth; } + } + + + public override Size TabControlGetSpacing(TabWidget tab) + { + try + { + return MemphisThemeElements.CurrentTheme.TabWidgetPainter.RowSpacing(tab); + } + catch + { + throw new Exception("Invalid Appearance value: " + tab.Appearance); + } + } + #endregion + + public override void DrawTabControl(Graphics dc, Rectangle area, TabWidget tab) + { + MemphisThemeElements.CurrentTheme.TabWidgetPainter.Draw(dc, area, tab); + } + + public override Rectangle TabControlGetDisplayRectangle(TabWidget tab) + { + return MemphisThemeElements.CurrentTheme.TabWidgetPainter.GetDisplayRectangle(tab); + } + + public override Rectangle TabControlGetPanelRect(TabWidget tab) + { + return MemphisThemeElements.CurrentTheme.TabWidgetPainter.GetTabPanelRect(tab); + } + + #endregion + + #region TextBox + public override void TextBoxBaseFillBackground(TextBoxBase textBoxBase, Graphics g, Rectangle clippingArea) + { + if (textBoxBase.backcolor_set || (textBoxBase.Enabled && !textBoxBase.read_only)) + { + g.FillRectangle(ResPool.GetSolidBrush(textBoxBase.BackColor), clippingArea); + } + else + { + g.FillRectangle(ResPool.GetSolidBrush(ColorControl), clippingArea); + } + } + + public override bool TextBoxBaseHandleWmNcPaint(TextBoxBase textBoxBase, ref Message m) + { + return false; + } + + public override bool TextBoxBaseShouldPaintBackground(TextBoxBase textBoxBase) + { + return true; + } + #endregion + + + #region ToolTip + public override void DrawToolTip(Graphics dc, Rectangle clip_rectangle, ToolTip.ToolTipWindow control) + { + ToolTipDrawBackground(dc, clip_rectangle, control); + + TextFormatFlags flags = TextFormatFlags.HidePrefix; + + Color foreground = control.ForeColor; + if (control.title.Length > 0) + { + Font bold_font = new Font(control.Font, control.Font.Style | FontStyle.Bold); + TextRenderer.DrawTextInternal(dc, control.title, bold_font, control.title_rect, + foreground, flags, false); + bold_font.Dispose(); + } + + if (control.icon != null) + dc.DrawIcon(control.icon, control.icon_rect); + + TextRenderer.DrawTextInternal(dc, control.Text, control.Font, control.text_rect, foreground, flags, false); + } + + protected virtual void ToolTipDrawBackground(Graphics dc, Rectangle clip_rectangle, ToolTip.ToolTipWindow control) + { + Brush back_brush = ResPool.GetSolidBrush(control.BackColor); + dc.FillRectangle(back_brush, control.ClientRectangle); + dc.DrawRectangle(SystemPens.WindowFrame, 0, 0, control.Width - 1, control.Height - 1); + } + + public override Size ToolTipSize(ToolTip.ToolTipWindow tt, string text) + { + Size size = TextRenderer.MeasureTextInternal(text, tt.Font, false); + size.Width += 4; + size.Height += 3; + Rectangle text_rect = new Rectangle(Point.Empty, size); + text_rect.Inflate(-2, -1); + tt.text_rect = text_rect; + tt.icon_rect = tt.title_rect = Rectangle.Empty; + + Size title_size = Size.Empty; + if (tt.title.Length > 0) + { + Font bold_font = new Font(tt.Font, tt.Font.Style | FontStyle.Bold); + title_size = TextRenderer.MeasureTextInternal(tt.title, bold_font, false); + bold_font.Dispose(); + } + + Size icon_size = Size.Empty; + if (tt.icon != null) + icon_size = new Size(size.Height, size.Height); + + if (icon_size != Size.Empty || title_size != Size.Empty) + { + int padding = 8; + int top_area_width = 0; + int top_area_height = icon_size.Height > title_size.Height ? icon_size.Height : title_size.Height; + Size text_size = size; + Point location = new Point(padding, padding); + + if (icon_size != Size.Empty) + { + tt.icon_rect = new Rectangle(location, icon_size); + top_area_width = icon_size.Width + padding; + } + + if (title_size != Size.Empty) + { + Rectangle title_rect = new Rectangle(location, new Size(title_size.Width, top_area_height)); + if (icon_size != Size.Empty) + title_rect.X += icon_size.Width + padding; + + tt.title_rect = title_rect; + top_area_width += title_size.Width; + } + + tt.text_rect = new Rectangle(new Point(location.X, location.Y + top_area_height + padding), + text_size); + + size.Height += padding + top_area_height; + if (top_area_width > size.Width) + size.Width = top_area_width; + + // margins + size.Width += padding * 2; + size.Height += padding * 2; + } + + return size; + } + + public override bool ToolTipTransparentBackground + { + get + { + return false; + } + } + #endregion // ToolTip + + #region BalloonWindow + NotifyIcon.BalloonWindow balloon_window; + + public override void ShowBalloonWindow(IntPtr handle, int timeout, string title, string text, ToolTipIcon icon) + { + Widget control = Widget.FromHandle(handle); + + if (control == null) + return; + + if (balloon_window != null) + { + balloon_window.Close(); + balloon_window.Dispose(); + } + + balloon_window = new NotifyIcon.BalloonWindow(handle); + balloon_window.Title = title; + balloon_window.Text = text; + balloon_window.Icon = icon; + balloon_window.Timeout = timeout; + balloon_window.Show(); + } + + public override void HideBalloonWindow(IntPtr handle) + { + if (balloon_window == null || balloon_window.OwnerHandle != handle) + return; + + balloon_window.Close(); + balloon_window.Dispose(); + balloon_window = null; + } + + private const int balloon_iconsize = 16; + private const int balloon_bordersize = 8; + + public override void DrawBalloonWindow(Graphics dc, Rectangle clip, NotifyIcon.BalloonWindow control) + { + Brush solidbrush = ResPool.GetSolidBrush(this.ColorInfoText); + Rectangle rect = control.ClientRectangle; + int iconsize = (control.Icon == ToolTipIcon.None) ? 0 : balloon_iconsize; + + // Rectangle borders and background. + dc.FillRectangle(ResPool.GetSolidBrush(ColorInfo), rect); + dc.DrawRectangle(ResPool.GetPen(ColorWindowFrame), 0, 0, rect.Width - 1, rect.Height - 1); + + // Icon + Image image; + switch (control.Icon) + { + case ToolTipIcon.Info: + { + image = ThemeEngine.Current.Images(UIIcon.MessageBoxInfo, balloon_iconsize); + break; + } + + case ToolTipIcon.Warning: + { + image = ThemeEngine.Current.Images(UIIcon.MessageBoxError, balloon_iconsize); + break; + } + + case ToolTipIcon.Error: + { + image = ThemeEngine.Current.Images(UIIcon.MessageBoxWarning, balloon_iconsize); + break; + } + + default: + { + image = null; + break; + } + } + + if (control.Icon != ToolTipIcon.None) + dc.DrawImage(image, new Rectangle(balloon_bordersize, balloon_bordersize, iconsize, iconsize)); + + // Title + Rectangle titlerect = new Rectangle(rect.X + balloon_bordersize + iconsize + (iconsize > 0 ? balloon_bordersize : 0), + rect.Y + balloon_bordersize, + rect.Width - ((3 * balloon_bordersize) + iconsize), + rect.Height - (2 * balloon_bordersize)); + + Font titlefont = new Font(control.Font.FontFamily, control.Font.Size, control.Font.Style | FontStyle.Bold, control.Font.Unit); + dc.DrawString(control.Title, titlefont, solidbrush, titlerect, control.Format); + + // Text + Rectangle textrect = new Rectangle(rect.X + balloon_bordersize, + rect.Y + balloon_bordersize, + rect.Width - (2 * balloon_bordersize), + rect.Height - (2 * balloon_bordersize)); + + StringFormat textformat = control.Format; + textformat.LineAlignment = StringAlignment.Far; + dc.DrawString(control.Text, control.Font, solidbrush, textrect, textformat); + } + + public override Rectangle BalloonWindowRect(NotifyIcon.BalloonWindow control) + { + Rectangle deskrect = Screen.GetWorkingArea(control); + SizeF maxsize = new SizeF(250, 200); + + SizeF titlesize = TextRenderer.MeasureString(control.Title, control.Font, maxsize, control.Format); + SizeF textsize = TextRenderer.MeasureString(control.Text, control.Font, maxsize, control.Format); + + if (titlesize.Height < balloon_iconsize) + titlesize.Height = balloon_iconsize; + + Rectangle rect = new Rectangle(); + rect.Height = (int)(titlesize.Height + textsize.Height + (3 * balloon_bordersize)); + rect.Width = (int)((titlesize.Width > textsize.Width) ? titlesize.Width : textsize.Width) + (2 * balloon_bordersize); + rect.X = deskrect.Width - rect.Width - 2; + rect.Y = deskrect.Height - rect.Height - 2; + + return rect; + } + #endregion // BalloonWindow + + #region TrackBar + public override int TrackBarValueFromMousePosition(int x, int y, TrackBar tb) + { + int result = tb.Value; + int value_pos = tb.Value; + float pixels_betweenticks; + Rectangle thumb_pos = Rectangle.Empty, thumb_area = Rectangle.Empty; + Point channel_startpoint = Point.Empty, na_point = Point.Empty; + + GetTrackBarDrawingInfo(tb, out pixels_betweenticks, out thumb_area, out thumb_pos, out channel_startpoint, out na_point, out na_point); + + /* Convert thumb position from mouse position to value*/ + if (tb.Orientation == Orientation.Vertical) + { + value_pos = (int)Math.Round(((thumb_area.Bottom - y - (float)thumb_pos.Height / 2) / (float)pixels_betweenticks), 0); + + if (value_pos + tb.Minimum > tb.Maximum) + value_pos = tb.Maximum - tb.Minimum; + else if (value_pos + tb.Minimum < tb.Minimum) + value_pos = 0; + + result = value_pos + tb.Minimum; + } + else + { + value_pos = (int)Math.Round(((x - channel_startpoint.X - (float)thumb_pos.Width / 2) / (float)pixels_betweenticks), 0); + + if (value_pos + tb.Minimum > tb.Maximum) + value_pos = tb.Maximum - tb.Minimum; + else if (value_pos + tb.Minimum < tb.Minimum) + value_pos = 0; + + result = value_pos + tb.Minimum; + } + + return result; + } + + private void GetTrackBarDrawingInfo(TrackBar tb, out float pixels_betweenticks, out Rectangle thumb_area, out Rectangle thumb_pos, out Point channel_startpoint, out Point bottomtick_startpoint, out Point toptick_startpoint) + { + thumb_area = Rectangle.Empty; + thumb_pos = Rectangle.Empty; + + if (tb.Orientation == Orientation.Vertical) + { + toptick_startpoint = new Point(); + bottomtick_startpoint = new Point(); + channel_startpoint = new Point(); + float pixel_len; + const int space_from_right = 8; + const int space_from_left = 8; + const int space_from_bottom = 11; + Rectangle area = tb.ClientRectangle; + + switch (tb.TickStyle) + { + case TickStyle.BottomRight: + case TickStyle.None: + channel_startpoint.Y = 8; + channel_startpoint.X = 9; + bottomtick_startpoint.Y = 13; + bottomtick_startpoint.X = 24; + break; + case TickStyle.TopLeft: + channel_startpoint.Y = 8; + channel_startpoint.X = 19; + toptick_startpoint.Y = 13; + toptick_startpoint.X = 8; + break; + case TickStyle.Both: + channel_startpoint.Y = 8; + channel_startpoint.X = 18; + bottomtick_startpoint.Y = 13; + bottomtick_startpoint.X = 32; + toptick_startpoint.Y = 13; + toptick_startpoint.X = 8; + break; + default: + break; + } + + thumb_area.X = area.X + channel_startpoint.X; + thumb_area.Y = area.Y + channel_startpoint.Y; + thumb_area.Height = area.Height - space_from_right - space_from_left; + thumb_area.Width = TrackBarVerticalTrackWidth; + + pixel_len = thumb_area.Height - 11; + if (tb.Maximum == tb.Minimum) + { + pixels_betweenticks = 0; + } + else + { + pixels_betweenticks = pixel_len / (tb.Maximum - tb.Minimum); + } + + thumb_pos.Y = thumb_area.Bottom - space_from_bottom - (int)(pixels_betweenticks * (float)(tb.Value - tb.Minimum)); + } + else + { + toptick_startpoint = new Point(); + bottomtick_startpoint = new Point(); + channel_startpoint = new Point(); + float pixel_len; + const int space_from_right = 8; + const int space_from_left = 8; + Rectangle area = tb.ClientRectangle; + + switch (tb.TickStyle) + { + case TickStyle.BottomRight: + case TickStyle.None: + channel_startpoint.X = 8; + channel_startpoint.Y = 9; + bottomtick_startpoint.X = 13; + bottomtick_startpoint.Y = 24; + break; + case TickStyle.TopLeft: + channel_startpoint.X = 8; + channel_startpoint.Y = 19; + toptick_startpoint.X = 13; + toptick_startpoint.Y = 8; + break; + case TickStyle.Both: + channel_startpoint.X = 8; + channel_startpoint.Y = 18; + bottomtick_startpoint.X = 13; + bottomtick_startpoint.Y = 32; + toptick_startpoint.X = 13; + toptick_startpoint.Y = 8; + break; + default: + break; + } + + thumb_area.X = area.X + channel_startpoint.X; + thumb_area.Y = area.Y + channel_startpoint.Y; + thumb_area.Width = area.Width - space_from_right - space_from_left; + thumb_area.Height = TrackBarHorizontalTrackHeight; + + pixel_len = thumb_area.Width - 11; + if (tb.Maximum == tb.Minimum) + { + pixels_betweenticks = 0; + } + else + { + pixels_betweenticks = pixel_len / (tb.Maximum - tb.Minimum); + } + + thumb_pos.X = channel_startpoint.X + (int)(pixels_betweenticks * (float)(tb.Value - tb.Minimum)); + } + + thumb_pos.Size = TrackBarGetThumbSize(tb); + } + + protected virtual Size TrackBarGetThumbSize(TrackBar trackBar) + { + return TrackBarGetThumbSize(); + } + + public static Size TrackBarGetThumbSize() + { + /* Draw thumb fixed 10x22 size */ + return new Size(10, 22); + } + + public const int TrackBarVerticalTrackWidth = 4; + + public const int TrackBarHorizontalTrackHeight = 4; + + #region Ticks + protected interface ITrackBarTickPainter + { + void Paint(float x1, float y1, float x2, float y2); + } + + class TrackBarTickPainter : ITrackBarTickPainter + { + readonly Graphics g; + readonly Pen pen; + public TrackBarTickPainter(Graphics g, Pen pen) + { + this.g = g; + this.pen = pen; + } + public void Paint(float x1, float y1, float x2, float y2) + { + g.DrawLine(pen, x1, y1, x2, y2); + } + } + protected virtual ITrackBarTickPainter GetTrackBarTickPainter(Graphics g) + { + return new TrackBarTickPainter(g, ResPool.GetPen(pen_ticks_color)); + } + #endregion + + #region DrawTrackBar_Vertical + private void DrawTrackBar_Vertical(Graphics dc, Rectangle clip_rectangle, TrackBar tb, + ref Rectangle thumb_pos, ref Rectangle thumb_area, Brush br_thumb, + float ticks, int value_pos, bool mouse_value) + { + + Point toptick_startpoint = new Point(); + Point bottomtick_startpoint = new Point(); + Point channel_startpoint = new Point(); + float pixel_len; + float pixels_betweenticks; + Rectangle area = tb.ClientRectangle; + + GetTrackBarDrawingInfo(tb, out pixels_betweenticks, out thumb_area, out thumb_pos, out channel_startpoint, out bottomtick_startpoint, out toptick_startpoint); + + #region Track + TrackBarDrawVerticalTrack(dc, thumb_area, channel_startpoint, clip_rectangle); + #endregion + + #region Thumb + switch (tb.TickStyle) + { + case TickStyle.BottomRight: + case TickStyle.None: + thumb_pos.X = channel_startpoint.X - 8; + TrackBarDrawVerticalThumbRight(dc, thumb_pos, br_thumb, clip_rectangle, tb); + break; + case TickStyle.TopLeft: + thumb_pos.X = channel_startpoint.X - 10; + TrackBarDrawVerticalThumbLeft(dc, thumb_pos, br_thumb, clip_rectangle, tb); + break; + default: + thumb_pos.X = area.X + 10; + TrackBarDrawVerticalThumb(dc, thumb_pos, br_thumb, clip_rectangle, tb); + break; + } + #endregion + + pixel_len = thumb_area.Height - 11; + pixels_betweenticks = pixel_len / ticks; + + thumb_area.X = thumb_pos.X; + thumb_area.Y = channel_startpoint.Y; + thumb_area.Width = thumb_pos.Height; + + #region Ticks + if (pixels_betweenticks <= 0) + return; + if (tb.TickStyle == TickStyle.None) + return; + Region outside = new Region(area); + outside.Exclude(thumb_area); + + if (outside.IsVisible(clip_rectangle)) + { + ITrackBarTickPainter tick_painter = TrackBarGetVerticalTickPainter(dc); + + if ((tb.TickStyle & TickStyle.BottomRight) == TickStyle.BottomRight) + { + float x = area.X + bottomtick_startpoint.X; + for (float inc = 0; inc < pixel_len + 1; inc += pixels_betweenticks) + { + float y = area.Y + bottomtick_startpoint.Y + inc; + tick_painter.Paint( + x, y, + x + (inc == 0 || inc + pixels_betweenticks >= pixel_len + 1 ? 3 : 2), y); + } + } + + if ((tb.TickStyle & TickStyle.TopLeft) == TickStyle.TopLeft) + { + float x = area.X + toptick_startpoint.X; + for (float inc = 0; inc < (pixel_len + 1); inc += pixels_betweenticks) + { + float y = area.Y + toptick_startpoint.Y + inc; + tick_painter.Paint( + x - (inc == 0 || inc + pixels_betweenticks >= pixel_len + 1 ? 3 : 2), y, + x, y); + } + } + } + + outside.Dispose(); + #endregion + } + + #region Track + protected virtual void TrackBarDrawVerticalTrack(Graphics dc, Rectangle thumb_area, Point channel_startpoint, Rectangle clippingArea) + { + dc.FillRectangle(SystemBrushes.ControlDark, channel_startpoint.X, channel_startpoint.Y, + 1, thumb_area.Height); + + dc.FillRectangle(SystemBrushes.ControlDarkDark, channel_startpoint.X + 1, channel_startpoint.Y, + 1, thumb_area.Height); + + dc.FillRectangle(SystemBrushes.ControlLight, channel_startpoint.X + 3, channel_startpoint.Y, + 1, thumb_area.Height); + } + #endregion + + #region Thumb + protected virtual void TrackBarDrawVerticalThumbRight(Graphics dc, Rectangle thumb_pos, Brush br_thumb, Rectangle clippingArea, TrackBar trackBar) + { + Pen pen = SystemPens.ControlLightLight; + dc.DrawLine(pen, thumb_pos.X, thumb_pos.Y, thumb_pos.X, thumb_pos.Y + 10); + dc.DrawLine(pen, thumb_pos.X, thumb_pos.Y, thumb_pos.X + 16, thumb_pos.Y); + dc.DrawLine(pen, thumb_pos.X + 16, thumb_pos.Y, thumb_pos.X + 16 + 4, thumb_pos.Y + 4); + + pen = SystemPens.ControlDark; + dc.DrawLine(pen, thumb_pos.X + 1, thumb_pos.Y + 9, thumb_pos.X + 15, thumb_pos.Y + 9); + dc.DrawLine(pen, thumb_pos.X + 16, thumb_pos.Y + 9, thumb_pos.X + 16 + 4, thumb_pos.Y + 9 - 4); + + pen = SystemPens.ControlDarkDark; + dc.DrawLine(pen, thumb_pos.X, thumb_pos.Y + 10, thumb_pos.X + 16, thumb_pos.Y + 10); + dc.DrawLine(pen, thumb_pos.X + 16, thumb_pos.Y + 10, thumb_pos.X + 16 + 5, thumb_pos.Y + 10 - 5); + + dc.FillRectangle(br_thumb, thumb_pos.X + 1, thumb_pos.Y + 1, 16, 8); + dc.FillRectangle(br_thumb, thumb_pos.X + 17, thumb_pos.Y + 2, 1, 6); + dc.FillRectangle(br_thumb, thumb_pos.X + 18, thumb_pos.Y + 3, 1, 4); + dc.FillRectangle(br_thumb, thumb_pos.X + 19, thumb_pos.Y + 4, 1, 2); + } + + protected virtual void TrackBarDrawVerticalThumbLeft(Graphics dc, Rectangle thumb_pos, Brush br_thumb, Rectangle clippingArea, TrackBar trackBar) + { + Pen pen = SystemPens.ControlLightLight; + dc.DrawLine(pen, thumb_pos.X + 4, thumb_pos.Y, thumb_pos.X + 4 + 16, thumb_pos.Y); + dc.DrawLine(pen, thumb_pos.X + 4, thumb_pos.Y, thumb_pos.X, thumb_pos.Y + 4); + + pen = SystemPens.ControlDark; + dc.DrawLine(pen, thumb_pos.X + 4, thumb_pos.Y + 9, thumb_pos.X + 4 + 16, thumb_pos.Y + 9); + dc.DrawLine(pen, thumb_pos.X + 4, thumb_pos.Y + 9, thumb_pos.X, thumb_pos.Y + 5); + dc.DrawLine(pen, thumb_pos.X + 19, thumb_pos.Y + 9, thumb_pos.X + 19, thumb_pos.Y + 1); + + pen = SystemPens.ControlDarkDark; + dc.DrawLine(pen, thumb_pos.X + 4, thumb_pos.Y + 10, thumb_pos.X + 4 + 16, thumb_pos.Y + 10); + dc.DrawLine(pen, thumb_pos.X + 4, thumb_pos.Y + 10, thumb_pos.X - 1, thumb_pos.Y + 5); + dc.DrawLine(pen, thumb_pos.X + 20, thumb_pos.Y, thumb_pos.X + 20, thumb_pos.Y + 10); + + dc.FillRectangle(br_thumb, thumb_pos.X + 4, thumb_pos.Y + 1, 15, 8); + dc.FillRectangle(br_thumb, thumb_pos.X + 3, thumb_pos.Y + 2, 1, 6); + dc.FillRectangle(br_thumb, thumb_pos.X + 2, thumb_pos.Y + 3, 1, 4); + dc.FillRectangle(br_thumb, thumb_pos.X + 1, thumb_pos.Y + 4, 1, 2); + } + + protected virtual void TrackBarDrawVerticalThumb(Graphics dc, Rectangle thumb_pos, Brush br_thumb, Rectangle clippingArea, TrackBar trackBar) + { + Pen pen = SystemPens.ControlLightLight; + dc.DrawLine(pen, thumb_pos.X, thumb_pos.Y, thumb_pos.X, thumb_pos.Y + 9); + dc.DrawLine(pen, thumb_pos.X, thumb_pos.Y, thumb_pos.X + 19, thumb_pos.Y); + + pen = SystemPens.ControlDark; + dc.DrawLine(pen, thumb_pos.X + 1, thumb_pos.Y + 9, thumb_pos.X + 19, thumb_pos.Y + 9); + dc.DrawLine(pen, thumb_pos.X + 10, thumb_pos.Y + 1, thumb_pos.X + 19, thumb_pos.Y + 8); + + pen = SystemPens.ControlDarkDark; + dc.DrawLine(pen, thumb_pos.X, thumb_pos.Y + 10, thumb_pos.X + 20, thumb_pos.Y + 10); + dc.DrawLine(pen, thumb_pos.X + 20, thumb_pos.Y, thumb_pos.X + 20, thumb_pos.Y + 9); + + dc.FillRectangle(br_thumb, thumb_pos.X + 1, thumb_pos.Y + 1, 18, 8); + } + #endregion + + #region Ticks + protected virtual ITrackBarTickPainter TrackBarGetVerticalTickPainter(Graphics g) + { + return GetTrackBarTickPainter(g); + } + #endregion + #endregion + + #region DrawTrackBar_Horizontal + /* + Horizontal trackbar + + Does not matter the size of the control, Win32 always draws: + - Ticks starting from pixel 13, 8 + - Channel starting at pos 8, 19 and ends at Width - 8 + - Autosize makes always the control 45 pixels high + - Ticks are draw at (channel.Witdh - 10) / (Maximum - Minimum) + + */ + private void DrawTrackBar_Horizontal(Graphics dc, Rectangle clip_rectangle, TrackBar tb, + ref Rectangle thumb_pos, ref Rectangle thumb_area, Brush br_thumb, + float ticks, int value_pos, bool mouse_value) + { + Point toptick_startpoint = new Point(); + Point bottomtick_startpoint = new Point(); + Point channel_startpoint = new Point(); + float pixel_len; + float pixels_betweenticks; + Rectangle area = tb.ClientRectangle; + + GetTrackBarDrawingInfo(tb, out pixels_betweenticks, out thumb_area, out thumb_pos, out channel_startpoint, out bottomtick_startpoint, out toptick_startpoint); + + #region Track + TrackBarDrawHorizontalTrack(dc, thumb_area, channel_startpoint, clip_rectangle); + #endregion + + #region Thumb + switch (tb.TickStyle) + { + case TickStyle.BottomRight: + case TickStyle.None: + thumb_pos.Y = channel_startpoint.Y - 8; + TrackBarDrawHorizontalThumbBottom(dc, thumb_pos, br_thumb, clip_rectangle, tb); + break; + case TickStyle.TopLeft: + thumb_pos.Y = channel_startpoint.Y - 10; + TrackBarDrawHorizontalThumbTop(dc, thumb_pos, br_thumb, clip_rectangle, tb); + break; + default: + thumb_pos.Y = area.Y + 10; + TrackBarDrawHorizontalThumb(dc, thumb_pos, br_thumb, clip_rectangle, tb); + break; + } + #endregion + + pixel_len = thumb_area.Width - 11; + pixels_betweenticks = pixel_len / ticks; + + thumb_area.Y = thumb_pos.Y; + thumb_area.X = channel_startpoint.X; + thumb_area.Height = thumb_pos.Height; + #region Ticks + if (pixels_betweenticks <= 0) + return; + if (tb.TickStyle == TickStyle.None) + return; + Region outside = new Region(area); + outside.Exclude(thumb_area); + + if (outside.IsVisible(clip_rectangle)) + { + ITrackBarTickPainter tick_painter = TrackBarGetHorizontalTickPainter(dc); + + if ((tb.TickStyle & TickStyle.BottomRight) == TickStyle.BottomRight) + { + float y = area.Y + bottomtick_startpoint.Y; + for (float inc = 0; inc < pixel_len + 1; inc += pixels_betweenticks) + { + float x = area.X + bottomtick_startpoint.X + inc; + tick_painter.Paint( + x, y, + x, y + (inc == 0 || inc + pixels_betweenticks >= pixel_len + 1 ? 3 : 2)); + } + } + + if ((tb.TickStyle & TickStyle.TopLeft) == TickStyle.TopLeft) + { + float y = area.Y + toptick_startpoint.Y; + for (float inc = 0; inc < pixel_len + 1; inc += pixels_betweenticks) + { + float x = area.X + toptick_startpoint.X + inc; + tick_painter.Paint( + x, y - (inc == 0 || (inc + pixels_betweenticks) >= pixel_len + 1 ? 3 : 2), + x, y); + } + } + } + + outside.Dispose(); + #endregion + } + + #region Track + protected virtual void TrackBarDrawHorizontalTrack(Graphics dc, Rectangle thumb_area, Point channel_startpoint, Rectangle clippingArea) + { + dc.FillRectangle(SystemBrushes.ControlDark, channel_startpoint.X, channel_startpoint.Y, + thumb_area.Width, 1); + + dc.FillRectangle(SystemBrushes.ControlDarkDark, channel_startpoint.X, channel_startpoint.Y + 1, + thumb_area.Width, 1); + + dc.FillRectangle(SystemBrushes.ControlLight, channel_startpoint.X, channel_startpoint.Y + 3, + thumb_area.Width, 1); + } + #endregion + + #region Thumb + protected virtual void TrackBarDrawHorizontalThumbBottom(Graphics dc, Rectangle thumb_pos, Brush br_thumb, Rectangle clippingArea, TrackBar trackBar) + { + Pen pen = SystemPens.ControlLightLight; + dc.DrawLine(pen, thumb_pos.X, thumb_pos.Y, thumb_pos.X + 10, thumb_pos.Y); + dc.DrawLine(pen, thumb_pos.X, thumb_pos.Y, thumb_pos.X, thumb_pos.Y + 16); + dc.DrawLine(pen, thumb_pos.X, thumb_pos.Y + 16, thumb_pos.X + 4, thumb_pos.Y + 16 + 4); + + pen = SystemPens.ControlDark; + dc.DrawLine(pen, thumb_pos.X + 9, thumb_pos.Y + 1, thumb_pos.X + 9, thumb_pos.Y + 15); + dc.DrawLine(pen, thumb_pos.X + 9, thumb_pos.Y + 16, thumb_pos.X + 9 - 4, thumb_pos.Y + 16 + 4); + + pen = SystemPens.ControlDarkDark; + dc.DrawLine(pen, thumb_pos.X + 10, thumb_pos.Y, thumb_pos.X + 10, thumb_pos.Y + 16); + dc.DrawLine(pen, thumb_pos.X + 10, thumb_pos.Y + 16, thumb_pos.X + 10 - 5, thumb_pos.Y + 16 + 5); + + dc.FillRectangle(br_thumb, thumb_pos.X + 1, thumb_pos.Y + 1, 8, 16); + dc.FillRectangle(br_thumb, thumb_pos.X + 2, thumb_pos.Y + 17, 6, 1); + dc.FillRectangle(br_thumb, thumb_pos.X + 3, thumb_pos.Y + 18, 4, 1); + dc.FillRectangle(br_thumb, thumb_pos.X + 4, thumb_pos.Y + 19, 2, 1); + } + + protected virtual void TrackBarDrawHorizontalThumbTop(Graphics dc, Rectangle thumb_pos, Brush br_thumb, Rectangle clippingArea, TrackBar trackBar) + { + Pen pen = SystemPens.ControlLightLight; + dc.DrawLine(pen, thumb_pos.X, thumb_pos.Y + 4, thumb_pos.X, thumb_pos.Y + 4 + 16); + dc.DrawLine(pen, thumb_pos.X, thumb_pos.Y + 4, thumb_pos.X + 4, thumb_pos.Y); + + pen = SystemPens.ControlDark; + dc.DrawLine(pen, thumb_pos.X + 9, thumb_pos.Y + 4, thumb_pos.X + 9, thumb_pos.Y + 4 + 16); + dc.DrawLine(pen, thumb_pos.X + 9, thumb_pos.Y + 4, thumb_pos.X + 5, thumb_pos.Y); + dc.DrawLine(pen, thumb_pos.X + 9, thumb_pos.Y + 19, thumb_pos.X + 1, thumb_pos.Y + 19); + + pen = SystemPens.ControlDarkDark; + dc.DrawLine(pen, thumb_pos.X + 10, thumb_pos.Y + 4, thumb_pos.X + 10, thumb_pos.Y + 4 + 16); + dc.DrawLine(pen, thumb_pos.X + 10, thumb_pos.Y + 4, thumb_pos.X + 5, thumb_pos.Y - 1); + dc.DrawLine(pen, thumb_pos.X, thumb_pos.Y + 20, thumb_pos.X + 10, thumb_pos.Y + 20); + + dc.FillRectangle(br_thumb, thumb_pos.X + 1, thumb_pos.Y + 4, 8, 15); + dc.FillRectangle(br_thumb, thumb_pos.X + 2, thumb_pos.Y + 3, 6, 1); + dc.FillRectangle(br_thumb, thumb_pos.X + 3, thumb_pos.Y + 2, 4, 1); + dc.FillRectangle(br_thumb, thumb_pos.X + 4, thumb_pos.Y + 1, 2, 1); + } + + protected virtual void TrackBarDrawHorizontalThumb(Graphics dc, Rectangle thumb_pos, Brush br_thumb, Rectangle clippingArea, TrackBar trackBar) + { + Pen pen = SystemPens.ControlLightLight; + dc.DrawLine(pen, thumb_pos.X, thumb_pos.Y, thumb_pos.X + 9, thumb_pos.Y); + dc.DrawLine(pen, thumb_pos.X, thumb_pos.Y, thumb_pos.X, thumb_pos.Y + 19); + + pen = SystemPens.ControlDark; + dc.DrawLine(pen, thumb_pos.X + 9, thumb_pos.Y + 1, thumb_pos.X + 9, thumb_pos.Y + 19); + dc.DrawLine(pen, thumb_pos.X + 1, thumb_pos.Y + 10, thumb_pos.X + 8, thumb_pos.Y + 19); + + pen = SystemPens.ControlDarkDark; + dc.DrawLine(pen, thumb_pos.X + 10, thumb_pos.Y, thumb_pos.X + 10, thumb_pos.Y + 20); + dc.DrawLine(pen, thumb_pos.X, thumb_pos.Y + 20, thumb_pos.X + 9, thumb_pos.Y + 20); + + dc.FillRectangle(br_thumb, thumb_pos.X + 1, thumb_pos.Y + 1, 8, 18); + } + #endregion + + #region Ticks + protected virtual ITrackBarTickPainter TrackBarGetHorizontalTickPainter(Graphics g) + { + return GetTrackBarTickPainter(g); + } + #endregion + #endregion + + public override void DrawTrackBar(Graphics dc, Rectangle clip_rectangle, TrackBar tb) + { + Brush br_thumb; + int value_pos; + bool mouse_value; + float ticks = (tb.Maximum - tb.Minimum) / tb.tickFrequency; /* N of ticks draw*/ + Rectangle area; + Rectangle thumb_pos = tb.ThumbPos; + Rectangle thumb_area = tb.ThumbArea; + + if (tb.thumb_pressed) + { + value_pos = tb.thumb_mouseclick; + mouse_value = true; + } + else + { + value_pos = tb.Value - tb.Minimum; + mouse_value = false; + } + + area = tb.ClientRectangle; + + if (!tb.Enabled) + { + br_thumb = (Brush)ResPool.GetHatchBrush(HatchStyle.Percent50, ColorControlLightLight, ColorControlLight); + } + else if (tb.thumb_pressed == true) + { + br_thumb = (Brush)ResPool.GetHatchBrush(HatchStyle.Percent50, ColorControlLight, ColorControl); + } + else + { + br_thumb = SystemBrushes.Control; + } + + + /* Widget Background */ + if (tb.BackColor.ToArgb() == DefaultControlBackColor.ToArgb()) + { + dc.FillRectangle(SystemBrushes.Control, clip_rectangle); + } + else + { + dc.FillRectangle(ResPool.GetSolidBrush(tb.BackColor), clip_rectangle); + } + + if (tb.Focused) + { + CPDrawFocusRectangle(dc, area, tb.ForeColor, tb.BackColor); + } + + if (tb.Orientation == Orientation.Vertical) + { + DrawTrackBar_Vertical(dc, clip_rectangle, tb, ref thumb_pos, ref thumb_area, + br_thumb, ticks, value_pos, mouse_value); + + } + else + { + DrawTrackBar_Horizontal(dc, clip_rectangle, tb, ref thumb_pos, ref thumb_area, + br_thumb, ticks, value_pos, mouse_value); + } + + tb.ThumbPos = thumb_pos; + tb.ThumbArea = thumb_area; + } + + public override Size TrackBarDefaultSize + { + get + { + return new Size(104, 42); + } + } + + public override bool TrackBarHasHotThumbStyle + { + get + { + return false; + } + } + #endregion // TrackBar + + #region UpDownBase + public override void UpDownBaseDrawButton(Graphics g, Rectangle bounds, bool top, VisualStyles.PushButtonState state) + { + WidgetPaint.DrawScrollButton(g, bounds, top ? ScrollButton.Up : ScrollButton.Down, state == VisualStyles.PushButtonState.Pressed ? ButtonState.Pushed : ButtonState.Normal); + } + + public override bool UpDownBaseHasHotButtonStyle + { + get + { + return false; + } + } + #endregion + + #region VScrollBar + public override Size VScrollBarDefaultSize + { + get + { + return new Size(this.ScrollBarButtonSize, 80); + } + } + #endregion // VScrollBar + + #region TreeView + public override Size TreeViewDefaultSize + { + get + { + return new Size(121, 97); + } + } + + public override void TreeViewDrawNodePlusMinus(TreeView treeView, TreeNode node, Graphics dc, int x, int middle) + { + int height = treeView.ActualItemHeight - 2; + dc.FillRectangle(ResPool.GetSolidBrush(treeView.BackColor), (x + 4) - (height / 2), node.GetY() + 1, height, height); + + dc.DrawRectangle(SystemPens.ControlDarkDark, x, middle - 4, 8, 8); + + if (node.IsExpanded) + { + dc.DrawLine(SystemPens.ControlDarkDark, x + 2, middle, x + 6, middle); + } + else + { + dc.DrawLine(SystemPens.ControlDarkDark, x + 2, middle, x + 6, middle); + dc.DrawLine(SystemPens.ControlDarkDark, x + 4, middle - 2, x + 4, middle + 2); + } + } + #endregion + + #region Managed window + public override int ManagedWindowTitleBarHeight(InternalWindowManager wm) + { + if (wm.IsToolWindow && !wm.IsMinimized) + return SystemInformation.ToolWindowCaptionHeight; + if (wm.Form.FormBorderStyle == FormBorderStyle.None) + return 0; + return SystemInformation.CaptionHeight; + } + + public override int ManagedWindowBorderWidth(InternalWindowManager wm) + { + if ((wm.IsToolWindow && wm.form.FormBorderStyle == FormBorderStyle.FixedToolWindow) || + wm.IsMinimized) + return 3; + else + return 4; + } + + public override int ManagedWindowIconWidth(InternalWindowManager wm) + { + return ManagedWindowTitleBarHeight(wm) - 5; + } + + public override void ManagedWindowSetButtonLocations(InternalWindowManager wm) + { + TitleButtons buttons = wm.TitleButtons; + Form form = wm.form; + + buttons.HelpButton.Visible = form.HelpButton; + + foreach (TitleButton button in buttons) + { + button.Visible = false; + } + + switch (form.FormBorderStyle) + { + case FormBorderStyle.None: + if (form.WindowState != FormWindowState.Normal) + goto case FormBorderStyle.Sizable; + break; + case FormBorderStyle.FixedToolWindow: + case FormBorderStyle.SizableToolWindow: + buttons.CloseButton.Visible = true; + if (form.WindowState != FormWindowState.Normal) + goto case FormBorderStyle.Sizable; + break; + case FormBorderStyle.FixedSingle: + case FormBorderStyle.Fixed3D: + case FormBorderStyle.FixedDialog: + case FormBorderStyle.Sizable: + switch (form.WindowState) + { + case FormWindowState.Normal: + buttons.MinimizeButton.Visible = true; + buttons.MaximizeButton.Visible = true; + buttons.RestoreButton.Visible = false; + break; + case FormWindowState.Maximized: + buttons.MinimizeButton.Visible = true; + buttons.MaximizeButton.Visible = false; + buttons.RestoreButton.Visible = true; + break; + case FormWindowState.Minimized: + buttons.MinimizeButton.Visible = false; + buttons.MaximizeButton.Visible = true; + buttons.RestoreButton.Visible = true; + break; + } + buttons.CloseButton.Visible = true; + break; + } + + // Respect MinimizeBox/MaximizeBox + if (form.MinimizeBox == false && form.MaximizeBox == false) + { + buttons.MinimizeButton.Visible = false; + buttons.MaximizeButton.Visible = false; + } + else if (form.MinimizeBox == false) + buttons.MinimizeButton.State = ButtonState.Inactive; + else if (form.MaximizeBox == false) + buttons.MaximizeButton.State = ButtonState.Inactive; + + int bw = ManagedWindowBorderWidth(wm); + Size btsize = ManagedWindowButtonSize(wm); + int btw = btsize.Width; + int bth = btsize.Height; + int top = bw + 2; + int left = form.Width - bw - btw - ManagedWindowSpacingAfterLastTitleButton; + + if ((!wm.IsToolWindow || wm.IsMinimized) && wm.HasBorders) + { + buttons.CloseButton.Rectangle = new Rectangle(left, top, btw, bth); + left -= 2 + btw; + + if (buttons.MaximizeButton.Visible) + { + buttons.MaximizeButton.Rectangle = new Rectangle(left, top, btw, bth); + left -= 2 + btw; + } + if (buttons.RestoreButton.Visible) + { + buttons.RestoreButton.Rectangle = new Rectangle(left, top, btw, bth); + left -= 2 + btw; + } + + buttons.MinimizeButton.Rectangle = new Rectangle(left, top, btw, bth); + left -= 2 + btw; + } + else if (wm.IsToolWindow) + { + buttons.CloseButton.Rectangle = new Rectangle(left, top, btw, bth); + left -= 2 + btw; + } + } + + protected virtual Rectangle ManagedWindowDrawTitleBarAndBorders(Graphics dc, Rectangle clip, InternalWindowManager wm) + { + Form form = wm.Form; + int tbheight = ManagedWindowTitleBarHeight(wm); + int bdwidth = ManagedWindowBorderWidth(wm); + Color titlebar_color = Color.FromArgb(255, 10, 36, 106); + Color titlebar_color2 = Color.FromArgb(255, 166, 202, 240); + Color color = ThemeEngine.Current.ColorControlDark; + Color color2 = Color.FromArgb(255, 192, 192, 192); + + Pen pen = ResPool.GetPen(ColorControl); + Rectangle borders = new Rectangle(0, 0, form.Width, form.Height); + WidgetPaint.DrawBorder3D(dc, borders, Border3DStyle.Raised); + // The 3d border is only 2 pixels wide, so we draw the innermost pixels ourselves + borders = new Rectangle(2, 2, form.Width - 5, form.Height - 5); + for (int i = 2; i < bdwidth; i++) + { + dc.DrawRectangle(pen, borders); + borders.Inflate(-1, -1); + } + + + bool draw_titlebar_enabled = false; + if (wm.Form.Parent != null && wm.Form.Parent is Form) + { + draw_titlebar_enabled = false; + } + else if (wm.IsActive && !wm.IsMaximized) + { + draw_titlebar_enabled = true; + } + if (draw_titlebar_enabled) + { + color = titlebar_color; + color2 = titlebar_color2; + } + + Rectangle tb = new Rectangle(bdwidth, bdwidth, form.Width - (bdwidth * 2), tbheight - 1); + + // HACK: For now always draw the titlebar until we get updates better + if (tb.Width > 0 && tb.Height > 0) + { + using (System.Drawing.Drawing2D.LinearGradientBrush gradient = new LinearGradientBrush(tb, color, color2, LinearGradientMode.Horizontal)) + { + dc.FillRectangle(gradient, tb); + } + } + + if (!wm.IsMinimized) + // Draw the line just beneath the title bar + dc.DrawLine(ResPool.GetPen(SystemColors.Control), bdwidth, + tbheight + bdwidth - 1, form.Width - bdwidth - 1, + tbheight + bdwidth - 1); + return tb; + } + + public override void DrawManagedWindowDecorations(Graphics dc, Rectangle clip, InternalWindowManager wm) + { +#if debug + Console.WriteLine (DateTime.Now.ToLongTimeString () + " DrawManagedWindowDecorations"); + dc.FillRectangle (Brushes.Black, clip); +#endif + Rectangle tb = ManagedWindowDrawTitleBarAndBorders(dc, clip, wm); + + Form form = wm.Form; + if (wm.ShowIcon) + { + Rectangle icon = ManagedWindowGetTitleBarIconArea(wm); + if (icon.IntersectsWith(clip)) + dc.DrawIcon(form.Icon, icon); + const int SpacingBetweenIconAndCaption = 2; + tb.Width -= icon.Right + SpacingBetweenIconAndCaption - tb.X; + tb.X = icon.Right + SpacingBetweenIconAndCaption; + } + + foreach (TitleButton button in wm.TitleButtons.AllButtons) + { + tb.Width -= Math.Max(0, tb.Right - DrawTitleButton(dc, button, clip, form)); + } + const int SpacingBetweenCaptionAndLeftMostButton = 3; + tb.Width -= SpacingBetweenCaptionAndLeftMostButton; + + string window_caption = form.Text; + window_caption = window_caption.Replace(Environment.NewLine, string.Empty); + + if (window_caption != null && window_caption != string.Empty) + { + StringFormat format = new StringFormat(); + format.FormatFlags = StringFormatFlags.NoWrap; + format.Trimming = StringTrimming.EllipsisCharacter; + format.LineAlignment = StringAlignment.Center; + + if (tb.IntersectsWith(clip)) + dc.DrawString(window_caption, WindowBorderFont, + ThemeEngine.Current.ResPool.GetSolidBrush(Color.White), + tb, format); + } + } + + public override Size ManagedWindowButtonSize(InternalWindowManager wm) + { + int height = ManagedWindowTitleBarHeight(wm); + if (!wm.IsMaximized && !wm.IsMinimized) + { + if (wm.IsToolWindow) + return new Size(SystemInformation.ToolWindowCaptionButtonSize.Width - 2, + height - 5); + if (wm.Form.FormBorderStyle == FormBorderStyle.None) + return Size.Empty; + } + else + height = SystemInformation.CaptionHeight; + + return new Size(SystemInformation.CaptionButtonSize.Width - 2, + height - 5); + } + + private int DrawTitleButton(Graphics dc, TitleButton button, Rectangle clip, Form form) + { + if (!button.Visible) + { + return int.MaxValue; + } + + if (button.Rectangle.IntersectsWith(clip)) + { + ManagedWindowDrawTitleButton(dc, button, clip, form); + } + return button.Rectangle.Left; + } + + protected virtual void ManagedWindowDrawTitleButton(Graphics dc, TitleButton button, Rectangle clip, Form form) + { + dc.FillRectangle(SystemBrushes.Control, button.Rectangle); + + WidgetPaint.DrawCaptionButton(dc, button.Rectangle, + button.Caption, button.State); + } + + public override Rectangle ManagedWindowGetTitleBarIconArea(InternalWindowManager wm) + { + int bw = ManagedWindowBorderWidth(wm); + return new Rectangle(bw + 3, bw + 2, wm.IconWidth, wm.IconWidth); + } + + public override Size ManagedWindowGetMenuButtonSize(InternalWindowManager wm) + { + Size result = SystemInformation.MenuButtonSize; + result.Width -= 2; + result.Height -= 4; + return result; + } + + public override bool ManagedWindowTitleButtonHasHotElementStyle(TitleButton button, Form form) + { + return false; + } + + public override void ManagedWindowDrawMenuButton(Graphics dc, TitleButton button, Rectangle clip, InternalWindowManager wm) + { + dc.FillRectangle(SystemBrushes.Control, button.Rectangle); + WidgetPaint.DrawCaptionButton(dc, button.Rectangle, + button.Caption, button.State); + } + + public override void ManagedWindowOnSizeInitializedOrChanged(Form form) + { + } + #endregion + + #region WidgetPaint + public override void CPDrawBorder(Graphics graphics, Rectangle bounds, Color leftColor, int leftWidth, + ButtonBorderStyle leftStyle, Color topColor, int topWidth, ButtonBorderStyle topStyle, + Color rightColor, int rightWidth, ButtonBorderStyle rightStyle, Color bottomColor, + int bottomWidth, ButtonBorderStyle bottomStyle) + { + DrawBorderInternal(graphics, bounds.Left, bounds.Top, bounds.Left, bounds.Bottom - 1, leftWidth, leftColor, leftStyle, Border3DSide.Left); + DrawBorderInternal(graphics, bounds.Left, bounds.Top, bounds.Right - 1, bounds.Top, topWidth, topColor, topStyle, Border3DSide.Top); + DrawBorderInternal(graphics, bounds.Right - 1, bounds.Top, bounds.Right - 1, bounds.Bottom - 1, rightWidth, rightColor, rightStyle, Border3DSide.Right); + DrawBorderInternal(graphics, bounds.Left, bounds.Bottom - 1, bounds.Right - 1, bounds.Bottom - 1, bottomWidth, bottomColor, bottomStyle, Border3DSide.Bottom); + } + + public override void CPDrawBorder(Graphics graphics, RectangleF bounds, Color leftColor, int leftWidth, + ButtonBorderStyle leftStyle, Color topColor, int topWidth, ButtonBorderStyle topStyle, + Color rightColor, int rightWidth, ButtonBorderStyle rightStyle, Color bottomColor, + int bottomWidth, ButtonBorderStyle bottomStyle) + { + DrawBorderInternal(graphics, bounds.Left, bounds.Top, bounds.Left, bounds.Bottom - 1, leftWidth, leftColor, leftStyle, Border3DSide.Left); + DrawBorderInternal(graphics, bounds.Left, bounds.Top, bounds.Right - 1, bounds.Top, topWidth, topColor, topStyle, Border3DSide.Top); + DrawBorderInternal(graphics, bounds.Right - 1, bounds.Top, bounds.Right - 1, bounds.Bottom - 1, rightWidth, rightColor, rightStyle, Border3DSide.Right); + DrawBorderInternal(graphics, bounds.Left, bounds.Bottom - 1, bounds.Right - 1, bounds.Bottom - 1, bottomWidth, bottomColor, bottomStyle, Border3DSide.Bottom); + } + + public override void CPDrawBorder3D(Graphics graphics, Rectangle rectangle, Border3DStyle style, Border3DSide sides) + { + CPDrawBorder3D(graphics, rectangle, style, sides, ColorControl); + } + + public override void CPDrawBorder3D(Graphics graphics, Rectangle rectangle, Border3DStyle style, Border3DSide sides, Color control_color) + { + var skin = Application.CurrentSkin; + Pen penTopLeft; + Pen penTopLeftInner; + Pen penBottomRight; + Pen penBottomRightInner; + Rectangle rect = new Rectangle(rectangle.X, rectangle.Y, rectangle.Width, rectangle.Height); + bool is_ColorControl = control_color.ToArgb() == ColorControl.ToArgb() ? true : false; + + if ((style & Border3DStyle.Adjust) != 0) + { + rect.Y -= 2; + rect.X -= 2; + rect.Width += 4; + rect.Height += 4; + } + + penTopLeft = penTopLeftInner = penBottomRight = penBottomRightInner = is_ColorControl ? SystemPens.Control : ResPool.GetPen(control_color); + + CPColor cpcolor = CPColor.Empty; + + if (!is_ColorControl) + cpcolor = ResPool.GetCPColor(control_color); + + switch (style) + { + case Border3DStyle.Raised: + penTopLeftInner = new Pen(skin.Border3DTopLeftInner); + penBottomRight = new Pen(skin.Border3DBottomRight); + penBottomRightInner = new Pen(skin.Border3DBottomRightInner); + break; + case Border3DStyle.Sunken: + penTopLeft = new Pen(skin.Border3DBottomRightInner); + penTopLeftInner = new Pen(skin.Border3DBottomRight); + penBottomRight = new Pen(skin.Border3DTopLeftInner); + break; + case Border3DStyle.Etched: + penTopLeft = new Pen(skin.Border3DBottomRightInner); + penTopLeftInner = new Pen(skin.Border3DTopLeftInner); + break; + case Border3DStyle.RaisedOuter: + penBottomRight = new Pen(skin.Border3DBottomRight); + break; + case Border3DStyle.SunkenOuter: + penTopLeft = new Pen(skin.Border3DBottomRightInner); + penBottomRight = new Pen(skin.Border3DTopLeftInner); + break; + case Border3DStyle.RaisedInner: + penTopLeft = new Pen(skin.Border3DTopLeftInner); + penBottomRight = new Pen(skin.Border3DBottomRightInner); + break; + case Border3DStyle.SunkenInner: + penTopLeft = new Pen(skin.Border3DBottomRight); + break; + case Border3DStyle.Flat: + penTopLeft = penBottomRight = new Pen(skin.DefaultForeColor); + break; + case Border3DStyle.Bump: + penTopLeftInner = penBottomRight = new Pen(skin.Border3DBottomRight); + break; + default: + break; + } + + bool inner = ((style != Border3DStyle.RaisedOuter) && (style != Border3DStyle.SunkenOuter)); + + if ((sides & Border3DSide.Middle) != 0) + { + Brush brush = is_ColorControl ? SystemBrushes.Control : ResPool.GetSolidBrush(control_color); + graphics.FillRectangle(brush, rect); + } + + if ((sides & Border3DSide.Left) != 0) + { + graphics.DrawLine(penTopLeft, rect.Left, rect.Bottom - 2, rect.Left, rect.Top); + if ((rect.Width > 2) && inner) + graphics.DrawLine(penTopLeftInner, rect.Left + 1, rect.Bottom - 2, rect.Left + 1, rect.Top); + } + + if ((sides & Border3DSide.Top) != 0) + { + graphics.DrawLine(penTopLeft, rect.Left, rect.Top, rect.Right - 2, rect.Top); + if ((rect.Height > 2) && inner) + graphics.DrawLine(penTopLeftInner, rect.Left + 1, rect.Top + 1, rect.Right - 3, rect.Top + 1); + } + + if ((sides & Border3DSide.Right) != 0) + { + graphics.DrawLine(penBottomRight, rect.Right - 1, rect.Top, rect.Right - 1, rect.Bottom - 1); + if ((rect.Width > 3) && inner) + graphics.DrawLine(penBottomRightInner, rect.Right - 2, rect.Top + 1, rect.Right - 2, rect.Bottom - 2); + } + + if ((sides & Border3DSide.Bottom) != 0) + { + graphics.DrawLine(penBottomRight, rect.Left, rect.Bottom - 1, rect.Right - 1, rect.Bottom - 1); + if ((rect.Height > 3) && inner) + graphics.DrawLine(penBottomRightInner, rect.Left + 1, rect.Bottom - 2, rect.Right - 2, rect.Bottom - 2); + } + } + + public override void CPDrawButton(Graphics dc, Rectangle rectangle, ButtonState state) + { + CPDrawButtonInternal(dc, rectangle, state, SystemPens.ControlDarkDark, SystemPens.ControlDark, SystemPens.ControlLight); + } + + private void CPDrawButtonInternal(Graphics dc, Rectangle rectangle, ButtonState state, Pen DarkPen, Pen NormalPen, Pen LightPen) + { + // sadly enough, the rectangle gets always filled with a hatchbrush + dc.FillRectangle(ResPool.GetHatchBrush(HatchStyle.Percent50, + Color.FromArgb(Clamp(ColorControl.R + 3, 0, 255), + ColorControl.G, ColorControl.B), + ColorControl), + rectangle.X + 1, rectangle.Y + 1, rectangle.Width - 2, rectangle.Height - 2); + + if ((state & ButtonState.All) == ButtonState.All || ((state & ButtonState.Checked) == ButtonState.Checked && (state & ButtonState.Flat) == ButtonState.Flat)) + { + dc.FillRectangle(ResPool.GetHatchBrush(HatchStyle.Percent50, ColorControlLight, ColorControl), rectangle.X + 2, rectangle.Y + 2, rectangle.Width - 4, rectangle.Height - 4); + + dc.DrawRectangle(SystemPens.ControlDark, rectangle.X, rectangle.Y, rectangle.Width - 1, rectangle.Height - 1); + } + else + if ((state & ButtonState.Flat) == ButtonState.Flat) + { + dc.DrawRectangle(SystemPens.ControlDark, rectangle.X, rectangle.Y, rectangle.Width - 1, rectangle.Height - 1); + } + else + if ((state & ButtonState.Checked) == ButtonState.Checked) + { + dc.FillRectangle(ResPool.GetHatchBrush(HatchStyle.Percent50, ColorControlLight, ColorControl), rectangle.X + 2, rectangle.Y + 2, rectangle.Width - 4, rectangle.Height - 4); + + Pen pen = DarkPen; + dc.DrawLine(pen, rectangle.X, rectangle.Y, rectangle.X, rectangle.Bottom - 2); + dc.DrawLine(pen, rectangle.X + 1, rectangle.Y, rectangle.Right - 2, rectangle.Y); + + pen = NormalPen; + dc.DrawLine(pen, rectangle.X + 1, rectangle.Y + 1, rectangle.X + 1, rectangle.Bottom - 3); + dc.DrawLine(pen, rectangle.X + 2, rectangle.Y + 1, rectangle.Right - 3, rectangle.Y + 1); + + pen = LightPen; + dc.DrawLine(pen, rectangle.X, rectangle.Bottom - 1, rectangle.Right - 2, rectangle.Bottom - 1); + dc.DrawLine(pen, rectangle.Right - 1, rectangle.Y, rectangle.Right - 1, rectangle.Bottom - 1); + } + else + if (((state & ButtonState.Pushed) == ButtonState.Pushed) && ((state & ButtonState.Normal) == ButtonState.Normal)) + { + Pen pen = DarkPen; + dc.DrawLine(pen, rectangle.X, rectangle.Y, rectangle.X, rectangle.Bottom - 2); + dc.DrawLine(pen, rectangle.X + 1, rectangle.Y, rectangle.Right - 2, rectangle.Y); + + pen = NormalPen; + dc.DrawLine(pen, rectangle.X + 1, rectangle.Y + 1, rectangle.X + 1, rectangle.Bottom - 3); + dc.DrawLine(pen, rectangle.X + 2, rectangle.Y + 1, rectangle.Right - 3, rectangle.Y + 1); + + pen = LightPen; + dc.DrawLine(pen, rectangle.X, rectangle.Bottom - 1, rectangle.Right - 2, rectangle.Bottom - 1); + dc.DrawLine(pen, rectangle.Right - 1, rectangle.Y, rectangle.Right - 1, rectangle.Bottom - 1); + } + else + if (((state & ButtonState.Inactive) == ButtonState.Inactive) || ((state & ButtonState.Normal) == ButtonState.Normal)) + { + Pen pen = LightPen; + dc.DrawLine(pen, rectangle.X, rectangle.Y, rectangle.Right - 2, rectangle.Y); + dc.DrawLine(pen, rectangle.X, rectangle.Y, rectangle.X, rectangle.Bottom - 2); + + pen = NormalPen; + dc.DrawLine(pen, rectangle.X + 1, rectangle.Bottom - 2, rectangle.Right - 2, rectangle.Bottom - 2); + dc.DrawLine(pen, rectangle.Right - 2, rectangle.Y + 1, rectangle.Right - 2, rectangle.Bottom - 3); + + pen = DarkPen; + dc.DrawLine(pen, rectangle.X, rectangle.Bottom - 1, rectangle.Right - 1, rectangle.Bottom - 1); + dc.DrawLine(pen, rectangle.Right - 1, rectangle.Y, rectangle.Right - 1, rectangle.Bottom - 2); + } + } + + + public override void CPDrawCaptionButton(Graphics graphics, Rectangle rectangle, CaptionButton button, ButtonState state) + { + Rectangle captionRect; + int lineWidth; + + CPDrawButtonInternal(graphics, rectangle, state, SystemPens.ControlDarkDark, SystemPens.ControlDark, SystemPens.ControlLightLight); + + if (rectangle.Width < rectangle.Height) + { + captionRect = new Rectangle(rectangle.X + 1, rectangle.Y + rectangle.Height / 2 - rectangle.Width / 2 + 1, rectangle.Width - 4, rectangle.Width - 4); + } + else + { + captionRect = new Rectangle(rectangle.X + rectangle.Width / 2 - rectangle.Height / 2 + 1, rectangle.Y + 1, rectangle.Height - 4, rectangle.Height - 4); + } + + if ((state & ButtonState.Pushed) != 0) + { + captionRect = new Rectangle(rectangle.X + 2, rectangle.Y + 2, rectangle.Width - 3, rectangle.Height - 3); + } + + /* Make sure we've got at least a line width of 1 */ + lineWidth = Math.Max(1, captionRect.Width / 7); + + switch (button) + { + case CaptionButton.Close: + { + Pen pen; + + if ((state & ButtonState.Inactive) != 0) + { + pen = ResPool.GetSizedPen(ColorControlLight, lineWidth); + DrawCaptionHelper(graphics, ColorControlLight, pen, lineWidth, 1, captionRect, button); + + pen = ResPool.GetSizedPen(ColorControlDark, lineWidth); + DrawCaptionHelper(graphics, ColorControlDark, pen, lineWidth, 0, captionRect, button); + return; + } + else + { + pen = ResPool.GetSizedPen(ColorControlText, lineWidth); + DrawCaptionHelper(graphics, ColorControlText, pen, lineWidth, 0, captionRect, button); + return; + } + } + + case CaptionButton.Help: + case CaptionButton.Maximize: + case CaptionButton.Minimize: + case CaptionButton.Restore: + { + if ((state & ButtonState.Inactive) != 0) + { + DrawCaptionHelper(graphics, ColorControlLight, SystemPens.ControlLightLight, lineWidth, 1, captionRect, button); + + DrawCaptionHelper(graphics, ColorControlDark, SystemPens.ControlDark, lineWidth, 0, captionRect, button); + return; + } + else + { + DrawCaptionHelper(graphics, ColorControlText, SystemPens.ControlText, lineWidth, 0, captionRect, button); + return; + } + } + } + } + + public override void CPDrawCheckBox(Graphics dc, Rectangle rectangle, ButtonState state) + { + CPDrawCheckBoxInternal(dc, rectangle, state, false /* mixed */); + } + + private void CPDrawCheckBoxInternal(Graphics dc, Rectangle rectangle, ButtonState state, bool mixed) + { + Pen check_pen = (mixed) ? Pens.Gray : Pens.Black; + + Rectangle cb_rect = new Rectangle(rectangle.X, rectangle.Y, rectangle.Width, rectangle.Height); + + if ((state & ButtonState.All) == ButtonState.All) + { + cb_rect.Width -= 2; + cb_rect.Height -= 2; + + dc.FillRectangle(SystemBrushes.Control, cb_rect.X, cb_rect.Y, cb_rect.Width - 1, cb_rect.Height - 1); + dc.DrawRectangle(SystemPens.ControlDark, cb_rect.X, cb_rect.Y, cb_rect.Width - 1, cb_rect.Height - 1); + + check_pen = SystemPens.ControlDark; + } + else + if ((state & ButtonState.Flat) == ButtonState.Flat) + { + cb_rect.Width -= 2; + cb_rect.Height -= 2; + + if ((state & ButtonState.Inactive) == ButtonState.Inactive) + dc.FillRectangle(SystemBrushes.ControlLight, cb_rect.X, cb_rect.Y, cb_rect.Width - 1, cb_rect.Height - 1); + else + dc.FillRectangle(Brushes.White, cb_rect.X, cb_rect.Y, cb_rect.Width - 1, cb_rect.Height - 1); + dc.DrawRectangle(SystemPens.ControlDark, cb_rect.X, cb_rect.Y, cb_rect.Width - 1, cb_rect.Height - 1); + } + else + { + cb_rect.Width -= 1; + cb_rect.Height -= 1; + + int check_box_visible_size = (cb_rect.Height > cb_rect.Width) ? cb_rect.Width : cb_rect.Height; + + int x_pos = Math.Max(0, cb_rect.X + (cb_rect.Width / 2) - check_box_visible_size / 2); + int y_pos = Math.Max(0, cb_rect.Y + (cb_rect.Height / 2) - check_box_visible_size / 2); + + Rectangle rect = new Rectangle(x_pos, y_pos, check_box_visible_size, check_box_visible_size); + + if (((state & ButtonState.Pushed) == ButtonState.Pushed) || ((state & ButtonState.Inactive) == ButtonState.Inactive)) + { + dc.FillRectangle(ResPool.GetHatchBrush(HatchStyle.Percent50, + Color.FromArgb(Clamp(ColorControl.R + 3, 0, 255), + ColorControl.G, ColorControl.B), + ColorControl), rect.X + 2, rect.Y + 2, rect.Width - 3, rect.Height - 3); + } + else + dc.FillRectangle(SystemBrushes.ControlLightLight, rect.X + 2, rect.Y + 2, rect.Width - 3, rect.Height - 3); + + Pen pen = SystemPens.ControlDark; + dc.DrawLine(pen, rect.X, rect.Y, rect.X, rect.Bottom - 1); + dc.DrawLine(pen, rect.X + 1, rect.Y, rect.Right - 1, rect.Y); + + pen = SystemPens.ControlDarkDark; + dc.DrawLine(pen, rect.X + 1, rect.Y + 1, rect.X + 1, rect.Bottom - 2); + dc.DrawLine(pen, rect.X + 2, rect.Y + 1, rect.Right - 2, rect.Y + 1); + + pen = SystemPens.ControlLightLight; + dc.DrawLine(pen, rect.Right, rect.Y, rect.Right, rect.Bottom); + dc.DrawLine(pen, rect.X, rect.Bottom, rect.Right, rect.Bottom); + + // oh boy, matching ms is like fighting against windmills + using (Pen h_pen = new Pen(ResPool.GetHatchBrush(HatchStyle.Percent50, + Color.FromArgb(Clamp(ColorControl.R + 3, 0, 255), + ColorControl.G, ColorControl.B), ColorControl))) + { + dc.DrawLine(h_pen, rect.X + 1, rect.Bottom - 1, rect.Right - 1, rect.Bottom - 1); + dc.DrawLine(h_pen, rect.Right - 1, rect.Y + 1, rect.Right - 1, rect.Bottom - 1); + } + + if ((state & ButtonState.Inactive) == ButtonState.Inactive) + check_pen = SystemPens.ControlDark; + } + + if ((state & ButtonState.Checked) == ButtonState.Checked) + { + int check_size = (cb_rect.Height > cb_rect.Width) ? cb_rect.Width / 2 : cb_rect.Height / 2; + + if (check_size < 7) + { + int lineWidth = Math.Max(3, check_size / 3); + int Scale = Math.Max(1, check_size / 9); + + Rectangle rect = new Rectangle(cb_rect.X + (cb_rect.Width / 2) - (int)Math.Ceiling((float)check_size / 2) - 1, cb_rect.Y + (cb_rect.Height / 2) - (check_size / 2) - 1, + check_size, check_size); + + for (int i = 0; i < lineWidth; i++) + { + dc.DrawLine(check_pen, rect.Left + lineWidth / 2, rect.Top + lineWidth + i, rect.Left + lineWidth / 2 + 2 * Scale, rect.Top + lineWidth + 2 * Scale + i); + dc.DrawLine(check_pen, rect.Left + lineWidth / 2 + 2 * Scale, rect.Top + lineWidth + 2 * Scale + i, rect.Left + lineWidth / 2 + 6 * Scale, rect.Top + lineWidth - 2 * Scale + i); + } + } + else + { + int lineWidth = Math.Max(3, check_size / 3) + 1; + + int x_half = cb_rect.Width / 2; + int y_half = cb_rect.Height / 2; + + Rectangle rect = new Rectangle(cb_rect.X + x_half - (check_size / 2) - 1, cb_rect.Y + y_half - (check_size / 2), + check_size, check_size); + + int gradient_left = check_size / 3; + int gradient_right = check_size - gradient_left - 1; + + + for (int i = 0; i < lineWidth; i++) + { + dc.DrawLine(check_pen, rect.X, rect.Bottom - 1 - gradient_left - i, rect.X + gradient_left, rect.Bottom - 1 - i); + dc.DrawLine(check_pen, rect.X + gradient_left, rect.Bottom - 1 - i, rect.Right - 1, rect.Bottom - i - 1 - gradient_right); + } + } + } + } + + public override void CPDrawComboButton(Graphics graphics, Rectangle rectangle, ButtonState state) + { + Point[] arrow = new Point[3]; + Point P1; + Point P2; + Point P3; + int centerX; + int centerY; + int shiftX; + int shiftY; + Rectangle rect; + + if ((state & ButtonState.Checked) != 0) + { + graphics.FillRectangle(ResPool.GetHatchBrush(HatchStyle.Percent50, ColorControlLightLight, ColorControlLight), rectangle); + } + + if ((state & ButtonState.Flat) != 0) + { + WidgetPaint.DrawBorder(graphics, rectangle, ColorControlDark, ButtonBorderStyle.Solid); + } + else + { + if ((state & (ButtonState.Pushed | ButtonState.Checked)) != 0) + { + // this needs to render like a pushed button - jba + // CPDrawBorder3D(graphics, rectangle, Border3DStyle.Sunken, Border3DSide.Left | Border3DSide.Top | Border3DSide.Right | Border3DSide.Bottom, ColorControl); + Rectangle trace_rectangle = new Rectangle(rectangle.X, rectangle.Y, Math.Max(rectangle.Width - 1, 0), Math.Max(rectangle.Height - 1, 0)); + graphics.DrawRectangle(SystemPens.ControlDark, trace_rectangle); + } + else + { + CPDrawBorder3D(graphics, rectangle, Border3DStyle.Raised, Border3DSide.Left | Border3DSide.Top | Border3DSide.Right | Border3DSide.Bottom, ColorControl); + } + } + + rect = new Rectangle(rectangle.X + rectangle.Width / 4, rectangle.Y + rectangle.Height / 4, rectangle.Width / 2, rectangle.Height / 2); + centerX = rect.Left + rect.Width / 2; + centerY = rect.Top + rect.Height / 2; + shiftX = Math.Max(1, rect.Width / 8); + shiftY = Math.Max(1, rect.Height / 8); + + if ((state & ButtonState.Pushed) != 0) + { + shiftX++; + shiftY++; + } + + rect.Y -= shiftY; + centerY -= shiftY; + P1 = new Point(rect.Left, centerY); + P2 = new Point(rect.Right, centerY); + P3 = new Point(centerX, rect.Bottom); + + arrow[0] = P1; + arrow[1] = P2; + arrow[2] = P3; + + /* Draw the arrow */ + if ((state & ButtonState.Inactive) != 0) + { + /* Move away from the shadow */ + arrow[0].X += 1; arrow[0].Y += 1; + arrow[1].X += 1; arrow[1].Y += 1; + arrow[2].X += 1; arrow[2].Y += 1; + + graphics.FillPolygon(SystemBrushes.ControlLightLight, arrow, FillMode.Winding); + + arrow[0] = P1; + arrow[1] = P2; + arrow[2] = P3; + + graphics.FillPolygon(SystemBrushes.ControlDark, arrow, FillMode.Winding); + } + else + { + graphics.FillPolygon(SystemBrushes.ControlText, arrow, FillMode.Winding); + } + } + + public override void CPDrawContainerGrabHandle(Graphics graphics, Rectangle bounds) + { + Pen pen = Pens.Black; + Rectangle rect = new Rectangle(bounds.X, bounds.Y, bounds.Width - 1, bounds.Height - 1); // Dunno why, but MS does it that way, too + int X; + int Y; + + graphics.FillRectangle(SystemBrushes.ControlLightLight, rect); + graphics.DrawRectangle(pen, rect); + + X = rect.X + rect.Width / 2; + Y = rect.Y + rect.Height / 2; + + /* Draw the cross */ + graphics.DrawLine(pen, X, rect.Y + 2, X, rect.Bottom - 2); + graphics.DrawLine(pen, rect.X + 2, Y, rect.Right - 2, Y); + + /* Draw 'arrows' for vertical lines */ + graphics.DrawLine(pen, X - 1, rect.Y + 3, X + 1, rect.Y + 3); + graphics.DrawLine(pen, X - 1, rect.Bottom - 3, X + 1, rect.Bottom - 3); + + /* Draw 'arrows' for horizontal lines */ + graphics.DrawLine(pen, rect.X + 3, Y - 1, rect.X + 3, Y + 1); + graphics.DrawLine(pen, rect.Right - 3, Y - 1, rect.Right - 3, Y + 1); + } + + public virtual void DrawFlatStyleFocusRectangle(Graphics graphics, Rectangle rectangle, ButtonBase button, Color foreColor, Color backColor) + { + // make a rectange to trace around border of the button + Rectangle trace_rectangle = new Rectangle(rectangle.X, rectangle.Y, Math.Max(rectangle.Width - 1, 0), Math.Max(rectangle.Height - 1, 0)); + + Color outerColor = foreColor; + // adjust focus color according to the flatstyle + if (button.FlatStyle == FlatStyle.Popup && !button.is_pressed) + { + outerColor = (backColor.ToArgb() == ColorControl.ToArgb()) ? WidgetPaint.Dark(ColorControl) : ColorControlText; + } + + // draw the outer rectangle + graphics.DrawRectangle(ResPool.GetPen(outerColor), trace_rectangle); + + // draw the inner rectangle + if (button.FlatStyle == FlatStyle.Popup) + { + DrawInnerFocusRectangle(graphics, Rectangle.Inflate(rectangle, -4, -4), backColor); + } + else + { + // draw a flat inner rectangle + Pen pen = ResPool.GetPen(WidgetPaint.LightLight(backColor)); + graphics.DrawRectangle(pen, Rectangle.Inflate(trace_rectangle, -4, -4)); + } + } + + public virtual void DrawInnerFocusRectangle(Graphics graphics, Rectangle rectangle, Color backColor) + { + // make a rectange to trace around border of the button + Rectangle trace_rectangle = new Rectangle(rectangle.X, rectangle.Y, Math.Max(rectangle.Width - 1, 0), Math.Max(rectangle.Height - 1, 0)); + +#if NotUntilCairoIsFixed + Color colorBackInverted = Color.FromArgb (Math.Abs (backColor.R-255), Math.Abs (backColor.G-255), Math.Abs (backColor.B-255)); + DashStyle oldStyle; // used for caching old penstyle + Pen pen = ResPool.GetPen (colorBackInverted); + + oldStyle = pen.DashStyle; + pen.DashStyle = DashStyle.Dot; + + graphics.DrawRectangle (pen, trace_rectangle); + pen.DashStyle = oldStyle; +#else + CPDrawFocusRectangle(graphics, trace_rectangle, Color.Wheat, backColor); +#endif + } + + + public override void CPDrawFocusRectangle(Graphics graphics, Rectangle rectangle, Color foreColor, Color backColor) + { + Rectangle rect = rectangle; + Pen pen; + HatchBrush brush; + + if (backColor.GetBrightness() >= 0.5) + { + foreColor = Color.Transparent; + backColor = Color.Black; + + } + else + { + backColor = Color.FromArgb(Math.Abs(backColor.R - 255), Math.Abs(backColor.G - 255), Math.Abs(backColor.B - 255)); + foreColor = Color.Black; + } + + brush = ResPool.GetHatchBrush(HatchStyle.Percent50, backColor, foreColor); + pen = new Pen(brush, 1); + + rect.Width--; + rect.Height--; + + graphics.DrawRectangle(pen, rect); + pen.Dispose(); + } + + public override void CPDrawGrabHandle(Graphics graphics, Rectangle rectangle, bool primary, bool enabled) + { + Brush sb; + Pen pen; + + if (primary == true) + { + pen = Pens.Black; + if (enabled == true) + { + sb = Brushes.White; + } + else + { + sb = SystemBrushes.Control; + } + } + else + { + pen = Pens.White; + if (enabled == true) + { + sb = Brushes.Black; + } + else + { + sb = SystemBrushes.Control; + } + } + graphics.FillRectangle(sb, rectangle); + graphics.DrawRectangle(pen, rectangle); + } + + + public override void CPDrawGrid(Graphics graphics, Rectangle area, Size pixelsBetweenDots, Color backColor) + { + Color foreColor; + int h; + int b; + int s; + + WidgetPaint.Color2HBS(backColor, out h, out b, out s); + + if (b > 127) + { + foreColor = Color.Black; + } + else + { + foreColor = Color.White; + } + + // still not perfect. it seems that ms calculates the position of the first dot or line + + using (Pen pen = new Pen(foreColor)) + { + pen.DashPattern = new float[] { 1.0f, pixelsBetweenDots.Width - 1 }; + + for (int y = area.Top; y < area.Bottom; y += pixelsBetweenDots.Height) + graphics.DrawLine(pen, area.X, y, area.Right - 1, y); + } + } + + public override void CPDrawImageDisabled(Graphics graphics, Image image, int x, int y, Color background) + { + /* + Microsoft seems to ignore the background and simply make + the image grayscale. At least when having > 256 colors on + the display. + */ + + if (imagedisabled_attributes == null) + { + imagedisabled_attributes = new ImageAttributes(); + ColorMatrix colorMatrix = new ColorMatrix(new float[][] { + // This table would create a perfect grayscale image, based on luminance + // new float[]{0.3f,0.3f,0.3f,0,0}, + // new float[]{0.59f,0.59f,0.59f,0,0}, + // new float[]{0.11f,0.11f,0.11f,0,0}, + // new float[]{0,0,0,1,0,0}, + // new float[]{0,0,0,0,1,0}, + // new float[]{0,0,0,0,0,1} + + // This table generates a image that is grayscaled and then + // brightened up. Seems to match MS close enough. + new float[]{0.2f,0.2f,0.2f,0,0}, + new float[]{0.41f,0.41f,0.41f,0,0}, + new float[]{0.11f,0.11f,0.11f,0,0}, + new float[]{0.15f,0.15f,0.15f,1,0,0}, + new float[]{0.15f,0.15f,0.15f,0,1,0}, + new float[]{0.15f,0.15f,0.15f,0,0,1} + }); + + imagedisabled_attributes.SetColorMatrix(colorMatrix); + } + + graphics.DrawImage(image, new Rectangle(x, y, image.Width, image.Height), 0, 0, image.Width, image.Height, GraphicsUnit.Pixel, imagedisabled_attributes); + + } + + + public override void CPDrawLockedFrame(Graphics graphics, Rectangle rectangle, bool primary) + { + Pen penBorder; + Pen penInside; + + if (primary) + { + penBorder = ResPool.GetSizedPen(Color.White, 2); + penInside = ResPool.GetPen(Color.Black); + } + else + { + penBorder = ResPool.GetSizedPen(Color.Black, 2); + penInside = ResPool.GetPen(Color.White); + } + penBorder.Alignment = PenAlignment.Inset; + penInside.Alignment = PenAlignment.Inset; + + graphics.DrawRectangle(penBorder, rectangle); + graphics.DrawRectangle(penInside, rectangle.X + 2, rectangle.Y + 2, rectangle.Width - 5, rectangle.Height - 5); + } + + + public override void CPDrawMenuGlyph(Graphics graphics, Rectangle rectangle, MenuGlyph glyph, Color color, Color backColor) + { + Rectangle rect; + int lineWidth; + + if (backColor != Color.Empty) + graphics.FillRectangle(ResPool.GetSolidBrush(backColor), rectangle); + + Brush brush = ResPool.GetSolidBrush(color); + + switch (glyph) + { + case MenuGlyph.Arrow: + { + float height = rectangle.Height * 0.7f; + float width = height / 2.0f; + + PointF ddCenter = new PointF(rectangle.X + ((rectangle.Width - width) / 2.0f), rectangle.Y + (rectangle.Height / 2.0f)); + + PointF[] vertices = new PointF[3]; + vertices[0].X = ddCenter.X; + vertices[0].Y = ddCenter.Y - (height / 2.0f); + vertices[1].X = ddCenter.X; + vertices[1].Y = ddCenter.Y + (height / 2.0f); + vertices[2].X = ddCenter.X + width + 0.1f; + vertices[2].Y = ddCenter.Y; + + graphics.FillPolygon(brush, vertices); + + return; + } + + case MenuGlyph.Bullet: + { + + lineWidth = Math.Max(2, rectangle.Width / 3); + rect = new Rectangle(rectangle.X + lineWidth, rectangle.Y + lineWidth, rectangle.Width - lineWidth * 2, rectangle.Height - lineWidth * 2); + + graphics.FillEllipse(brush, rect); + + return; + } + + case MenuGlyph.Checkmark: + { + + Pen pen = ResPool.GetPen(color); + lineWidth = Math.Max(2, rectangle.Width / 6); + rect = new Rectangle(rectangle.X + lineWidth, rectangle.Y + lineWidth, rectangle.Width - lineWidth * 2, rectangle.Height - lineWidth * 2); + + int Scale = Math.Max(1, rectangle.Width / 12); + int top = (rect.Y + lineWidth + ((rect.Height - ((2 * Scale) + lineWidth)) / 2)); + + for (int i = 0; i < lineWidth; i++) + { + graphics.DrawLine(pen, rect.Left + lineWidth / 2, top + i, rect.Left + lineWidth / 2 + 2 * Scale, top + 2 * Scale + i); + graphics.DrawLine(pen, rect.Left + lineWidth / 2 + 2 * Scale, top + 2 * Scale + i, rect.Left + lineWidth / 2 + 6 * Scale, top - 2 * Scale + i); + } + return; + } + } + + } + + public override void CPDrawMixedCheckBox(Graphics graphics, Rectangle rectangle, ButtonState state) + { + CPDrawCheckBoxInternal(graphics, rectangle, state, true /* mixed */); + } + + public override void CPDrawRadioButton(Graphics dc, Rectangle rectangle, ButtonState state) + { + CPColor cpcolor = ResPool.GetCPColor(ColorControl); + + Color dot_color = Color.Black; + + Color top_left_outer = Color.Black; + Color top_left_inner = Color.Black; + Color bottom_right_outer = Color.Black; + Color bottom_right_inner = Color.Black; + + int ellipse_diameter = (rectangle.Width > rectangle.Height) ? (int)(rectangle.Height * 0.9f) : (int)(rectangle.Width * 0.9f); + int radius = ellipse_diameter / 2; + + Rectangle rb_rect = new Rectangle(rectangle.X + (rectangle.Width / 2) - radius, rectangle.Y + (rectangle.Height / 2) - radius, ellipse_diameter, ellipse_diameter); + + Brush brush = null; + + if ((state & ButtonState.All) == ButtonState.All) + { + brush = ResPool.GetHatchBrush(HatchStyle.Percent50, Color.FromArgb(Clamp(ColorControl.R + 3, 0, 255), + ColorControl.G, ColorControl.B), ColorControl); + dot_color = cpcolor.Dark; + } + else + if ((state & ButtonState.Flat) == ButtonState.Flat) + { + if (((state & ButtonState.Inactive) == ButtonState.Inactive) || ((state & ButtonState.Pushed) == ButtonState.Pushed)) + brush = ResPool.GetHatchBrush(HatchStyle.Percent50, Color.FromArgb(Clamp(ColorControl.R + 3, 0, 255), ColorControl.G, ColorControl.B), ColorControl); + else + brush = SystemBrushes.ControlLightLight; + } + else + { + if (((state & ButtonState.Inactive) == ButtonState.Inactive) || ((state & ButtonState.Pushed) == ButtonState.Pushed)) + brush = ResPool.GetHatchBrush(HatchStyle.Percent50, Color.FromArgb(Clamp(ColorControl.R + 3, 0, 255), ColorControl.G, ColorControl.B), ColorControl); + else + brush = SystemBrushes.ControlLightLight; + + top_left_outer = cpcolor.Dark; + top_left_inner = cpcolor.DarkDark; + bottom_right_outer = cpcolor.Light; + bottom_right_inner = Color.Transparent; + + if ((state & ButtonState.Inactive) == ButtonState.Inactive) + dot_color = cpcolor.Dark; + } + + dc.FillEllipse(brush, rb_rect.X + 1, rb_rect.Y + 1, ellipse_diameter - 1, ellipse_diameter - 1); + + int line_width = Math.Max(1, (int)(ellipse_diameter * 0.08f)); + + dc.DrawArc(ResPool.GetSizedPen(top_left_outer, line_width), rb_rect, 135.0f, 180.0f); + dc.DrawArc(ResPool.GetSizedPen(top_left_inner, line_width), Rectangle.Inflate(rb_rect, -line_width, -line_width), 135.0f, 180.0f); + dc.DrawArc(ResPool.GetSizedPen(bottom_right_outer, line_width), rb_rect, 315.0f, 180.0f); + + if (bottom_right_inner != Color.Transparent) + dc.DrawArc(ResPool.GetSizedPen(bottom_right_inner, line_width), Rectangle.Inflate(rb_rect, -line_width, -line_width), 315.0f, 180.0f); + else + using (Pen h_pen = new Pen(ResPool.GetHatchBrush(HatchStyle.Percent50, Color.FromArgb(Clamp(ColorControl.R + 3, 0, 255), ColorControl.G, ColorControl.B), ColorControl), line_width)) + { + dc.DrawArc(h_pen, Rectangle.Inflate(rb_rect, -line_width, -line_width), 315.0f, 180.0f); + } + + if ((state & ButtonState.Checked) == ButtonState.Checked) + { + int inflate = line_width * 4; + Rectangle tmp = Rectangle.Inflate(rb_rect, -inflate, -inflate); + if (rectangle.Height > 13) + { + tmp.X += 1; + tmp.Y += 1; + tmp.Height -= 1; + dc.FillEllipse(ResPool.GetSolidBrush(dot_color), tmp); + } + else + { + Pen pen = ResPool.GetPen(dot_color); + dc.DrawLine(pen, tmp.X, tmp.Y + (tmp.Height / 2), tmp.Right, tmp.Y + (tmp.Height / 2)); + dc.DrawLine(pen, tmp.X, tmp.Y + (tmp.Height / 2) + 1, tmp.Right, tmp.Y + (tmp.Height / 2) + 1); + + dc.DrawLine(pen, tmp.X + (tmp.Width / 2), tmp.Y, tmp.X + (tmp.Width / 2), tmp.Bottom); + dc.DrawLine(pen, tmp.X + (tmp.Width / 2) + 1, tmp.Y, tmp.X + (tmp.Width / 2) + 1, tmp.Bottom); + } + } + } + + public override void CPDrawReversibleFrame(Rectangle rectangle, Color backColor, FrameStyle style) + { + + } + + + public override void CPDrawReversibleLine(Point start, Point end, Color backColor) + { + + } + + + /* Scroll button: regular button + direction arrow */ + public override void CPDrawScrollButton(Graphics dc, Rectangle area, ScrollButton type, ButtonState state) + { + DrawScrollButtonPrimitive(dc, area, state); + + bool fill_rect = true; + int offset = 0; + + if ((state & ButtonState.Pushed) != 0) + offset = 1; + + // skip the border + Rectangle rect = new Rectangle(area.X + 2 + offset, area.Y + 2 + offset, area.Width - 4, area.Height - 4); + + Point[] arrow = new Point[3]; + for (int i = 0; i < 3; i++) + arrow[i] = new Point(); + + Pen pen = SystemPens.ControlText; + + if ((state & ButtonState.Inactive) != 0) + { + pen = SystemPens.ControlDark; + } + + switch (type) + { + default: + case ScrollButton.Down: + int x_middle = (int)Math.Round(rect.Width / 2.0f) - 1; + int y_middle = (int)Math.Round(rect.Height / 2.0f) - 1; + if (x_middle == 1) + x_middle = 2; + + int triangle_height; + + if (rect.Height < 8) + { + triangle_height = 2; + fill_rect = false; + } + else if (rect.Height == 11) + { + triangle_height = 3; + } + else + { + triangle_height = (int)Math.Round(rect.Height / 3.0f); + } + + arrow[0].X = rect.X + x_middle; + arrow[0].Y = rect.Y + y_middle + triangle_height / 2; + + arrow[1].X = arrow[0].X + triangle_height - 1; + arrow[1].Y = arrow[0].Y - triangle_height + 1; + arrow[2].X = arrow[0].X - triangle_height + 1; + arrow[2].Y = arrow[1].Y; + + dc.DrawPolygon(pen, arrow); + + if ((state & ButtonState.Inactive) != 0) + { + dc.DrawLine(SystemPens.ControlLightLight, arrow[1].X + 1, arrow[1].Y + 1, arrow[0].X + 1, arrow[0].Y + 1); + dc.DrawLine(SystemPens.ControlLightLight, arrow[1].X, arrow[1].Y + 1, arrow[0].X + 1, arrow[0].Y); + } + + if (fill_rect) + { + for (int i = 0; i < arrow[0].Y - arrow[1].Y; i++) + { + dc.DrawLine(pen, arrow[1].X, arrow[1].Y + i, arrow[2].X, arrow[1].Y + i); + arrow[1].X -= 1; + arrow[2].X += 1; + } + } + break; + + case ScrollButton.Up: + x_middle = (int)Math.Round(rect.Width / 2.0f) - 1; + y_middle = (int)Math.Round(rect.Height / 2.0f); + if (x_middle == 1) + x_middle = 2; + + if (y_middle == 1) + y_middle = 2; + + if (rect.Height < 8) + { + triangle_height = 2; + fill_rect = false; + } + else if (rect.Height == 11) + { + triangle_height = 3; + } + else + { + triangle_height = (int)Math.Round(rect.Height / 3.0f); + } + + arrow[0].X = rect.X + x_middle; + arrow[0].Y = rect.Y + y_middle - triangle_height / 2; + + arrow[1].X = arrow[0].X + triangle_height - 1; + arrow[1].Y = arrow[0].Y + triangle_height - 1; + arrow[2].X = arrow[0].X - triangle_height + 1; + arrow[2].Y = arrow[1].Y; + + dc.DrawPolygon(pen, arrow); + + if ((state & ButtonState.Inactive) != 0) + { + dc.DrawLine(SystemPens.ControlLightLight, arrow[1].X + 1, arrow[1].Y + 1, arrow[2].X + 1, arrow[1].Y + 1); + } + + if (fill_rect) + { + for (int i = 0; i < arrow[1].Y - arrow[0].Y; i++) + { + dc.DrawLine(pen, arrow[2].X, arrow[1].Y - i, arrow[1].X, arrow[1].Y - i); + arrow[1].X -= 1; + arrow[2].X += 1; + } + } + break; + + case ScrollButton.Left: + y_middle = (int)Math.Round(rect.Height / 2.0f) - 1; + if (y_middle == 1) + y_middle = 2; + + int triangle_width; + + if (rect.Width < 8) + { + triangle_width = 2; + fill_rect = false; + } + else if (rect.Width == 11) + { + triangle_width = 3; + } + else + { + triangle_width = (int)Math.Round(rect.Width / 3.0f); + } + + arrow[0].X = rect.Left + triangle_width - 1; + arrow[0].Y = rect.Y + y_middle; + + if (arrow[0].X - 1 == rect.X) + arrow[0].X += 1; + + arrow[1].X = arrow[0].X + triangle_width - 1; + arrow[1].Y = arrow[0].Y - triangle_width + 1; + arrow[2].X = arrow[1].X; + arrow[2].Y = arrow[0].Y + triangle_width - 1; + + dc.DrawPolygon(pen, arrow); + + if ((state & ButtonState.Inactive) != 0) + { + dc.DrawLine(SystemPens.ControlLightLight, arrow[1].X + 1, arrow[1].Y + 1, arrow[2].X + 1, arrow[2].Y + 1); + } + + if (fill_rect) + { + for (int i = 0; i < arrow[2].X - arrow[0].X; i++) + { + dc.DrawLine(pen, arrow[2].X - i, arrow[1].Y, arrow[2].X - i, arrow[2].Y); + arrow[1].Y += 1; + arrow[2].Y -= 1; + } + } + break; + + case ScrollButton.Right: + y_middle = (int)Math.Round(rect.Height / 2.0f) - 1; + if (y_middle == 1) + y_middle = 2; + + if (rect.Width < 8) + { + triangle_width = 2; + fill_rect = false; + } + else if (rect.Width == 11) + { + triangle_width = 3; + } + else + { + triangle_width = (int)Math.Round(rect.Width / 3.0f); + } + + arrow[0].X = rect.Right - triangle_width - 1; + arrow[0].Y = rect.Y + y_middle; + + if (arrow[0].X - 1 == rect.X) + arrow[0].X += 1; + + arrow[1].X = arrow[0].X - triangle_width + 1; + arrow[1].Y = arrow[0].Y - triangle_width + 1; + arrow[2].X = arrow[1].X; + arrow[2].Y = arrow[0].Y + triangle_width - 1; + + dc.DrawPolygon(pen, arrow); + + if ((state & ButtonState.Inactive) != 0) + { + dc.DrawLine(SystemPens.ControlLightLight, arrow[0].X + 1, arrow[0].Y + 1, arrow[2].X + 1, arrow[2].Y + 1); + dc.DrawLine(SystemPens.ControlLightLight, arrow[0].X, arrow[0].Y + 1, arrow[2].X + 1, arrow[2].Y); + } + + if (fill_rect) + { + for (int i = 0; i < arrow[0].X - arrow[1].X; i++) + { + dc.DrawLine(pen, arrow[2].X + i, arrow[1].Y, arrow[2].X + i, arrow[2].Y); + arrow[1].Y += 1; + arrow[2].Y -= 1; + } + } + break; + } + } + + public override void CPDrawSelectionFrame(Graphics graphics, bool active, Rectangle outsideRect, Rectangle insideRect, + Color backColor) + { + + } + + + public override void CPDrawSizeGrip(Graphics dc, Color backColor, Rectangle bounds) + { + Pen pen_dark = ResPool.GetPen(WidgetPaint.Dark(backColor)); + Pen pen_light_light = ResPool.GetPen(WidgetPaint.LightLight(backColor)); + + for (int i = 2; i < bounds.Width - 2; i += 4) + { + dc.DrawLine(pen_light_light, bounds.X + i, bounds.Bottom - 2, bounds.Right - 1, bounds.Y + i - 1); + dc.DrawLine(pen_dark, bounds.X + i + 1, bounds.Bottom - 2, bounds.Right - 1, bounds.Y + i); + dc.DrawLine(pen_dark, bounds.X + i + 2, bounds.Bottom - 2, bounds.Right - 1, bounds.Y + i + 1); + } + } + + private void DrawStringDisabled20(Graphics g, string s, Font font, Rectangle layoutRectangle, Color color, TextFormatFlags flags, bool useDrawString) + { + CPColor cpcolor = ResPool.GetCPColor(color); + + layoutRectangle.Offset(1, 1); + TextRenderer.DrawTextInternal(g, s, font, layoutRectangle, cpcolor.LightLight, flags, useDrawString); + + layoutRectangle.Offset(-1, -1); + TextRenderer.DrawTextInternal(g, s, font, layoutRectangle, cpcolor.Dark, flags, useDrawString); + } + + public override void CPDrawStringDisabled(Graphics dc, string s, Font font, Color color, RectangleF layoutRectangle, StringFormat format) + { + CPColor cpcolor = ResPool.GetCPColor(color); + + dc.DrawString(s, font, ResPool.GetSolidBrush(cpcolor.LightLight), + new RectangleF(layoutRectangle.X + 1, layoutRectangle.Y + 1, layoutRectangle.Width, layoutRectangle.Height), + format); + dc.DrawString(s, font, ResPool.GetSolidBrush(cpcolor.Dark), layoutRectangle, format); + } + + public override void CPDrawStringDisabled(IDeviceContext dc, string s, Font font, Color color, Rectangle layoutRectangle, TextFormatFlags format) + { + CPColor cpcolor = ResPool.GetCPColor(color); + + layoutRectangle.Offset(1, 1); + TextRenderer.DrawText(dc, s, font, layoutRectangle, cpcolor.LightLight, format); + + layoutRectangle.Offset(-1, -1); + TextRenderer.DrawText(dc, s, font, layoutRectangle, cpcolor.Dark, format); + } + + public override void CPDrawVisualStyleBorder(Graphics graphics, Rectangle bounds) + { + graphics.DrawRectangle(SystemPens.ControlDarkDark, bounds); + } + + private static void DrawBorderInternal(Graphics graphics, int startX, int startY, int endX, int endY, + int width, Color color, ButtonBorderStyle style, Border3DSide side) + { + DrawBorderInternal(graphics, (float)startX, (float)startY, (float)endX, (float)endY, + width, color, style, side); + } + + private static void DrawBorderInternal(Graphics graphics, float startX, float startY, float endX, float endY, + int width, Color color, ButtonBorderStyle style, Border3DSide side) + { + + Pen pen = null; + + switch (style) + { + case ButtonBorderStyle.Solid: + case ButtonBorderStyle.Inset: + case ButtonBorderStyle.Outset: + pen = ThemeEngine.Current.ResPool.GetDashPen(color, DashStyle.Solid); + break; + case ButtonBorderStyle.Dashed: + pen = ThemeEngine.Current.ResPool.GetDashPen(color, DashStyle.Dash); + break; + case ButtonBorderStyle.Dotted: + pen = ThemeEngine.Current.ResPool.GetDashPen(color, DashStyle.Dot); + break; + default: + case ButtonBorderStyle.None: + return; + } + + switch (style) + { + case ButtonBorderStyle.Outset: + { + Color colorGrade; + int hue, brightness, saturation; + int brightnessSteps; + int brightnessDownSteps; + + WidgetPaint.Color2HBS(color, out hue, out brightness, out saturation); + + brightnessDownSteps = brightness / width; + if (brightness > 127) + { + brightnessSteps = Math.Max(6, (160 - brightness) / width); + } + else + { + brightnessSteps = (127 - brightness) / width; + } + + for (int i = 0; i < width; i++) + { + switch (side) + { + case Border3DSide.Left: + { + colorGrade = WidgetPaint.HBS2Color(hue, Math.Min(255, brightness + brightnessSteps * (width - i)), saturation); + pen = ThemeEngine.Current.ResPool.GetPen(colorGrade); + graphics.DrawLine(pen, startX + i, startY + i, endX + i, endY - i); + break; + } + + case Border3DSide.Right: + { + colorGrade = WidgetPaint.HBS2Color(hue, Math.Max(0, brightness - brightnessDownSteps * (width - i)), saturation); + pen = ThemeEngine.Current.ResPool.GetPen(colorGrade); + graphics.DrawLine(pen, startX - i, startY + i, endX - i, endY - i); + break; + } + + case Border3DSide.Top: + { + colorGrade = WidgetPaint.HBS2Color(hue, Math.Min(255, brightness + brightnessSteps * (width - i)), saturation); + pen = ThemeEngine.Current.ResPool.GetPen(colorGrade); + graphics.DrawLine(pen, startX + i, startY + i, endX - i, endY + i); + break; + } + + case Border3DSide.Bottom: + { + colorGrade = WidgetPaint.HBS2Color(hue, Math.Max(0, brightness - brightnessDownSteps * (width - i)), saturation); + pen = ThemeEngine.Current.ResPool.GetPen(colorGrade); + graphics.DrawLine(pen, startX + i, startY - i, endX - i, endY - i); + break; + } + } + } + break; + } + + case ButtonBorderStyle.Inset: + { + Color colorGrade; + int hue, brightness, saturation; + int brightnessSteps; + int brightnessDownSteps; + + WidgetPaint.Color2HBS(color, out hue, out brightness, out saturation); + + brightnessDownSteps = brightness / width; + if (brightness > 127) + { + brightnessSteps = Math.Max(6, (160 - brightness) / width); + } + else + { + brightnessSteps = (127 - brightness) / width; + } + + for (int i = 0; i < width; i++) + { + switch (side) + { + case Border3DSide.Left: + { + colorGrade = WidgetPaint.HBS2Color(hue, Math.Max(0, brightness - brightnessDownSteps * (width - i)), saturation); + pen = ThemeEngine.Current.ResPool.GetPen(colorGrade); + graphics.DrawLine(pen, startX + i, startY + i, endX + i, endY - i); + break; + } + + case Border3DSide.Right: + { + colorGrade = WidgetPaint.HBS2Color(hue, Math.Min(255, brightness + brightnessSteps * (width - i)), saturation); + pen = ThemeEngine.Current.ResPool.GetPen(colorGrade); + graphics.DrawLine(pen, startX - i, startY + i, endX - i, endY - i); + break; + } + + case Border3DSide.Top: + { + colorGrade = WidgetPaint.HBS2Color(hue, Math.Max(0, brightness - brightnessDownSteps * (width - i)), saturation); + pen = ThemeEngine.Current.ResPool.GetPen(colorGrade); + graphics.DrawLine(pen, startX + i, startY + i, endX - i, endY + i); + break; + } + + case Border3DSide.Bottom: + { + colorGrade = WidgetPaint.HBS2Color(hue, Math.Min(255, brightness + brightnessSteps * (width - i)), saturation); + pen = ThemeEngine.Current.ResPool.GetPen(colorGrade); + graphics.DrawLine(pen, startX + i, startY - i, endX - i, endY - i); + break; + } + } + } + break; + } + + /* + I decided to have the for-loop duplicated for speed reasons; + that way we only have to switch once (as opposed to have the + for-loop around the switch) + */ + default: + { + switch (side) + { + case Border3DSide.Left: + { + for (int i = 0; i < width; i++) + { + graphics.DrawLine(pen, startX + i, startY + i, endX + i, endY - i); + } + break; + } + + case Border3DSide.Right: + { + for (int i = 0; i < width; i++) + { + graphics.DrawLine(pen, startX - i, startY + i, endX - i, endY - i); + } + break; + } + + case Border3DSide.Top: + { + for (int i = 0; i < width; i++) + { + graphics.DrawLine(pen, startX + i, startY + i, endX - i, endY + i); + } + break; + } + + case Border3DSide.Bottom: + { + for (int i = 0; i < width; i++) + { + graphics.DrawLine(pen, startX + i, startY - i, endX - i, endY - i); + } + break; + } + } + break; + } + } + } + + /* + This function actually draws the various caption elements. + This way we can scale them nicely, no matter what size, and they + still look like MS's scaled caption buttons. (as opposed to scaling a bitmap) + */ + + private void DrawCaptionHelper(Graphics graphics, Color color, Pen pen, int lineWidth, int shift, Rectangle captionRect, CaptionButton button) + { + switch (button) + { + case CaptionButton.Close: + { + if (lineWidth < 2) + { + graphics.DrawLine(pen, captionRect.Left + 2 * lineWidth + 1 + shift, captionRect.Top + 2 * lineWidth + shift, captionRect.Right - 2 * lineWidth + 1 + shift, captionRect.Bottom - 2 * lineWidth + shift); + graphics.DrawLine(pen, captionRect.Right - 2 * lineWidth + 1 + shift, captionRect.Top + 2 * lineWidth + shift, captionRect.Left + 2 * lineWidth + 1 + shift, captionRect.Bottom - 2 * lineWidth + shift); + } + + graphics.DrawLine(pen, captionRect.Left + 2 * lineWidth + shift, captionRect.Top + 2 * lineWidth + shift, captionRect.Right - 2 * lineWidth + shift, captionRect.Bottom - 2 * lineWidth + shift); + graphics.DrawLine(pen, captionRect.Right - 2 * lineWidth + shift, captionRect.Top + 2 * lineWidth + shift, captionRect.Left + 2 * lineWidth + shift, captionRect.Bottom - 2 * lineWidth + shift); + return; + } + + case CaptionButton.Help: + { + StringFormat sf = new StringFormat(); + Font font = new Font("Microsoft Sans Serif", captionRect.Height, FontStyle.Bold, GraphicsUnit.Pixel); + + sf.Alignment = StringAlignment.Center; + sf.LineAlignment = StringAlignment.Center; + + + graphics.DrawString("?", font, ResPool.GetSolidBrush(color), captionRect.X + captionRect.Width / 2 + shift, captionRect.Y + captionRect.Height / 2 + shift + lineWidth / 2, sf); + + sf.Dispose(); + font.Dispose(); + + return; + } + + case CaptionButton.Maximize: + { + /* Top 'caption bar' line */ + for (int i = 0; i < Math.Max(2, lineWidth); i++) + { + graphics.DrawLine(pen, captionRect.Left + lineWidth + shift, captionRect.Top + 2 * lineWidth + shift + i, captionRect.Right - lineWidth - lineWidth / 2 + shift, captionRect.Top + 2 * lineWidth + shift + i); + } + + /* Left side line */ + for (int i = 0; i < Math.Max(1, lineWidth / 2); i++) + { + graphics.DrawLine(pen, captionRect.Left + lineWidth + shift + i, captionRect.Top + 2 * lineWidth + shift, captionRect.Left + lineWidth + shift + i, captionRect.Bottom - lineWidth + shift); + } + + /* Right side line */ + for (int i = 0; i < Math.Max(1, lineWidth / 2); i++) + { + graphics.DrawLine(pen, captionRect.Right - lineWidth - lineWidth / 2 + shift + i, captionRect.Top + 2 * lineWidth + shift, captionRect.Right - lineWidth - lineWidth / 2 + shift + i, captionRect.Bottom - lineWidth + shift); + } + + /* Bottom line */ + for (int i = 0; i < Math.Max(1, lineWidth / 2); i++) + { + graphics.DrawLine(pen, captionRect.Left + lineWidth + shift, captionRect.Bottom - lineWidth + shift - i, captionRect.Right - lineWidth - lineWidth / 2 + shift, captionRect.Bottom - lineWidth + shift - i); + } + return; + } + + case CaptionButton.Minimize: + { + /* Bottom line */ + for (int i = 0; i < Math.Max(2, lineWidth); i++) + { + graphics.DrawLine(pen, captionRect.Left + lineWidth + shift, captionRect.Bottom - lineWidth + shift - i, captionRect.Right - 3 * lineWidth + shift, captionRect.Bottom - lineWidth + shift - i); + } + return; + } + + case CaptionButton.Restore: + { + /** First 'window' **/ + /* Top 'caption bar' line */ + for (int i = 0; i < Math.Max(2, lineWidth); i++) + { + graphics.DrawLine(pen, captionRect.Left + 3 * lineWidth + shift, captionRect.Top + 2 * lineWidth + shift - i, captionRect.Right - lineWidth - lineWidth / 2 + shift, captionRect.Top + 2 * lineWidth + shift - i); + } + + /* Left side line */ + for (int i = 0; i < Math.Max(1, lineWidth / 2); i++) + { + graphics.DrawLine(pen, captionRect.Left + 3 * lineWidth + shift + i, captionRect.Top + 2 * lineWidth + shift, captionRect.Left + 3 * lineWidth + shift + i, captionRect.Top + 4 * lineWidth + shift); + } + + /* Right side line */ + for (int i = 0; i < Math.Max(1, lineWidth / 2); i++) + { + graphics.DrawLine(pen, captionRect.Right - lineWidth - lineWidth / 2 + shift - i, captionRect.Top + 2 * lineWidth + shift, captionRect.Right - lineWidth - lineWidth / 2 + shift - i, captionRect.Top + 5 * lineWidth - lineWidth / 2 + shift); + } + + /* Bottom line */ + for (int i = 0; i < Math.Max(1, lineWidth / 2); i++) + { + graphics.DrawLine(pen, captionRect.Right - 3 * lineWidth - lineWidth / 2 + shift, captionRect.Top + 5 * lineWidth - lineWidth / 2 + shift + 1 + i, captionRect.Right - lineWidth - lineWidth / 2 + shift, captionRect.Top + 5 * lineWidth - lineWidth / 2 + shift + 1 + i); + } + + /** Second 'window' **/ + /* Top 'caption bar' line */ + for (int i = 0; i < Math.Max(2, lineWidth); i++) + { + graphics.DrawLine(pen, captionRect.Left + lineWidth + shift, captionRect.Top + 4 * lineWidth + shift + 1 - i, captionRect.Right - 3 * lineWidth - lineWidth / 2 + shift, captionRect.Top + 4 * lineWidth + shift + 1 - i); + } + + /* Left side line */ + for (int i = 0; i < Math.Max(1, lineWidth / 2); i++) + { + graphics.DrawLine(pen, captionRect.Left + lineWidth + shift + i, captionRect.Top + 4 * lineWidth + shift + 1, captionRect.Left + lineWidth + shift + i, captionRect.Bottom - lineWidth + shift); + } + + /* Right side line */ + for (int i = 0; i < Math.Max(1, lineWidth / 2); i++) + { + graphics.DrawLine(pen, captionRect.Right - 3 * lineWidth - lineWidth / 2 + shift - i, captionRect.Top + 4 * lineWidth + shift + 1, captionRect.Right - 3 * lineWidth - lineWidth / 2 + shift - i, captionRect.Bottom - lineWidth + shift); + } + + /* Bottom line */ + for (int i = 0; i < Math.Max(1, lineWidth / 2); i++) + { + graphics.DrawLine(pen, captionRect.Left + lineWidth + shift, captionRect.Bottom - lineWidth + shift - i, captionRect.Right - 3 * lineWidth - lineWidth / 2 + shift, captionRect.Bottom - lineWidth + shift - i); + } + + return; + } + + } + } + + /* Generic scroll button */ + public void DrawScrollButtonPrimitive(Graphics dc, Rectangle area, ButtonState state) + { + if ((state & ButtonState.Pushed) == ButtonState.Pushed) + { + dc.FillRectangle(SystemBrushes.Control, area.X + 1, + area.Y + 1, area.Width - 2, area.Height - 2); + + dc.DrawRectangle(SystemPens.ControlDark, area.X, + area.Y, area.Width, area.Height); + + return; + } + + Brush sb_control = SystemBrushes.Control; + Brush sb_lightlight = SystemBrushes.ControlLightLight; + Brush sb_dark = SystemBrushes.ControlDark; + Brush sb_darkdark = SystemBrushes.ControlDarkDark; + + dc.FillRectangle(sb_control, area.X, area.Y, area.Width, 1); + dc.FillRectangle(sb_control, area.X, area.Y, 1, area.Height); + + dc.FillRectangle(sb_lightlight, area.X + 1, area.Y + 1, area.Width - 1, 1); + dc.FillRectangle(sb_lightlight, area.X + 1, area.Y + 2, 1, + area.Height - 4); + + dc.FillRectangle(sb_dark, area.X + 1, area.Y + area.Height - 2, + area.Width - 2, 1); + + dc.FillRectangle(sb_darkdark, area.X, area.Y + area.Height - 1, + area.Width, 1); + + dc.FillRectangle(sb_dark, area.X + area.Width - 2, + area.Y + 1, 1, area.Height - 3); + + dc.FillRectangle(sb_darkdark, area.X + area.Width - 1, + area.Y, 1, area.Height - 1); + + dc.FillRectangle(sb_control, area.X + 2, + area.Y + 2, area.Width - 4, area.Height - 4); + + } + + public override void CPDrawBorderStyle(Graphics dc, Rectangle area, BorderStyle border_style) + { + switch (border_style) + { + case BorderStyle.Fixed3D: + dc.DrawLine(ResPool.GetPen(ColorControlDark), area.X, area.Y, area.X + area.Width, area.Y); + dc.DrawLine(ResPool.GetPen(ColorControlDark), area.X, area.Y, area.X, area.Y + area.Height); + dc.DrawLine(ResPool.GetPen(ColorControlLight), area.X, area.Y + area.Height - 1, area.X + area.Width, + area.Y + area.Height - 1); + dc.DrawLine(ResPool.GetPen(ColorControlLight), area.X + area.Width - 1, area.Y, area.X + area.Width - 1, + area.Y + area.Height); + + dc.DrawLine(ResPool.GetPen(ColorActiveBorder), area.X + 1, area.Bottom - 2, area.Right - 2, area.Bottom - 2); + dc.DrawLine(ResPool.GetPen(ColorActiveBorder), area.Right - 2, area.Top + 1, area.Right - 2, area.Bottom - 2); + dc.DrawLine(ResPool.GetPen(ColorControlDarkDark), area.X + 1, area.Top + 1, area.X + 1, area.Bottom - 3); + dc.DrawLine(ResPool.GetPen(ColorControlDarkDark), area.X + 1, area.Top + 1, area.Right - 3, area.Top + 1); + break; + case BorderStyle.FixedSingle: + dc.DrawRectangle(ResPool.GetPen(ColorWindowFrame), area.X, area.Y, area.Width - 1, area.Height - 1); + break; + case BorderStyle.None: + default: + break; + } + + } + #endregion // WidgetPaint + + + } //class +} diff --git a/source/ShiftUI/Theming/ThemeVisualStyles.cs b/source/ShiftUI/Theming/ThemeVisualStyles.cs new file mode 100644 index 0000000..d0bd4ea --- /dev/null +++ b/source/ShiftUI/Theming/ThemeVisualStyles.cs @@ -0,0 +1,2162 @@ +// Permission is hereby granted, free of charge, to any person obtaining +// a copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to +// permit persons to whom the Software is furnished to do so, subject to +// the following conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// +// Copyright (c) 2008 George Giolfan +// Copyright (c) 2004-2006 Novell, Inc. +// +// Authors: +// George Giolfan, georgegiolfan@yahoo.com +// Ernesto Carrea, equistango@gmail.com + +using System.Drawing; +using System.Drawing.Drawing2D; +using ShiftUI.VisualStyles; +using System; + +namespace ShiftUI +{ + /// + /// VisualStyles theme. + /// + /// + /// This theme uses only the managed VisualStyles API. + /// To select it, set MONO_THEME to VisualStyles and call . + /// + class ThemeVisualStyles : ThemeWin32Classic + { + static bool render_client_areas; + static bool render_non_client_areas; + + public ThemeVisualStyles () + { + Update (); + } + + public override void ResetDefaults () + { + base.ResetDefaults (); + Update (); + } + + static void Update () + { + bool visual_styles_is_enabled_by_user = VisualStyleInformation.IsEnabledByUser; + render_client_areas = + visual_styles_is_enabled_by_user && + (Application.VisualStyleState == VisualStyleState.ClientAndNonClientAreasEnabled || + Application.VisualStyleState == VisualStyleState.ClientAreaEnabled); + render_non_client_areas = + visual_styles_is_enabled_by_user && + (Application.VisualStyleState == VisualStyleState.ClientAndNonClientAreasEnabled/* || + Application.VisualStyleState == VisualStyleState.NonClientAreaEnabled*/); + } + + public static bool RenderClientAreas { + get { return render_client_areas; } + } + + #region Widgets + #region ButtonBase + public override void DrawButtonBase (Graphics dc, Rectangle clip_area, ButtonBase button) + { + if (button.FlatStyle == FlatStyle.System) { + ButtonRenderer.DrawButton ( + dc, + new Rectangle (Point.Empty, button.Size), + button.Text, + button.Font, + button.TextFormatFlags, + null, + Rectangle.Empty, + ShouldPaintFocusRectagle (button), + GetPushButtonState (button) + ); + return; + } + base.DrawButtonBase (dc, clip_area, button); + } + static PushButtonState GetPushButtonState (ButtonBase button) + { + if (!button.Enabled) + return PushButtonState.Disabled; + if (button.Pressed) + return PushButtonState.Pressed; + if (button.Entered) + return PushButtonState.Hot; + if (button.IsDefault || button.Focused || button.paint_as_acceptbutton) + return PushButtonState.Default; + return PushButtonState.Normal; + } + #endregion + + #region Button 2.0 + public override void DrawButtonBackground (Graphics g, Button button, Rectangle clipArea) + { + if (!RenderClientAreas || + !button.UseVisualStyleBackColor) { + base.DrawButtonBackground (g, button, clipArea); + return; + } + ButtonRenderer.GetPushButtonRenderer (GetPushButtonState (button)).DrawBackground (g, new Rectangle (Point.Empty, button.Size)); + } + #endregion + + #region CheckBox + protected override void CheckBox_DrawCheckBox (Graphics dc, CheckBox checkbox, ButtonState state, Rectangle checkbox_rectangle) + { + if (checkbox.Appearance == Appearance.Normal && checkbox.FlatStyle == FlatStyle.System) { + CheckBoxRenderer.DrawCheckBox ( + dc, + new Point (checkbox_rectangle.Left, checkbox_rectangle.Top), + GetCheckBoxState (checkbox) + ); + return; + } + base.CheckBox_DrawCheckBox(dc, checkbox, state, checkbox_rectangle); + } + static CheckBoxState GetCheckBoxState (CheckBox checkBox) + { + switch (checkBox.CheckState) { + case CheckState.Checked: + if (!checkBox.Enabled) + return CheckBoxState.CheckedDisabled; + else if (checkBox.Pressed) + return CheckBoxState.CheckedPressed; + else if (checkBox.Entered) + return CheckBoxState.CheckedHot; + return CheckBoxState.CheckedNormal; + case CheckState.Indeterminate: + if (!checkBox.Enabled) + return CheckBoxState.MixedDisabled; + else if (checkBox.Pressed) + return CheckBoxState.MixedPressed; + else if (checkBox.Entered) + return CheckBoxState.MixedHot; + return CheckBoxState.MixedNormal; + default: + if (!checkBox.Enabled) + return CheckBoxState.UncheckedDisabled; + else if (checkBox.Pressed) + return CheckBoxState.UncheckedPressed; + else if (checkBox.Entered) + return CheckBoxState.UncheckedHot; + return CheckBoxState.UncheckedNormal; + } + } + #endregion + #region ComboBox + static VisualStyleElement ComboBoxGetVisualStyleElement (ComboBox comboBox, ButtonState state) + { + if (state == ButtonState.Inactive) + return VisualStyleElement.ComboBox.DropDownButton.Disabled; + if (state == ButtonState.Pushed) + return VisualStyleElement.ComboBox.DropDownButton.Pressed; + if (comboBox.DropDownButtonEntered) + return VisualStyleElement.ComboBox.DropDownButton.Hot; + return VisualStyleElement.ComboBox.DropDownButton.Normal; + } + public override void ComboBoxDrawNormalDropDownButton (ComboBox comboBox, Graphics g, Rectangle clippingArea, Rectangle area, ButtonState state) + { + if (!RenderClientAreas) { + base.ComboBoxDrawNormalDropDownButton (comboBox, g, clippingArea, area, state); + return; + } + VisualStyleElement element = ComboBoxGetVisualStyleElement (comboBox, state); + if (!VisualStyleRenderer.IsElementDefined (element)) { + base.ComboBoxDrawNormalDropDownButton (comboBox, g, clippingArea, area, state); + return; + } + new VisualStyleRenderer (element).DrawBackground (g, area, clippingArea); + } + public override bool ComboBoxNormalDropDownButtonHasTransparentBackground (ComboBox comboBox, ButtonState state) + { + if (!RenderClientAreas) + return base.ComboBoxNormalDropDownButtonHasTransparentBackground (comboBox, state); + VisualStyleElement element = ComboBoxGetVisualStyleElement (comboBox, state); + if (!VisualStyleRenderer.IsElementDefined (element)) + return base.ComboBoxNormalDropDownButtonHasTransparentBackground (comboBox, state); + return new VisualStyleRenderer (element).IsBackgroundPartiallyTransparent (); + } + public override bool ComboBoxDropDownButtonHasHotElementStyle (ComboBox comboBox) + { + if (!RenderClientAreas) + return base.ComboBoxDropDownButtonHasHotElementStyle (comboBox); + switch (comboBox.FlatStyle) { + case FlatStyle.Flat: + case FlatStyle.Popup: + return base.ComboBoxDropDownButtonHasHotElementStyle (comboBox); + } + return true; + } + static bool ComboBoxShouldPaintBackground (ComboBox comboBox) + { + if (comboBox.DropDownStyle == ComboBoxStyle.Simple) + return false; + switch (comboBox.FlatStyle) { + case FlatStyle.Flat: + case FlatStyle.Popup: + return false; + } + return true; + } + public override void ComboBoxDrawBackground (ComboBox comboBox, Graphics g, Rectangle clippingArea, FlatStyle style) + { + if (!RenderClientAreas || !ComboBoxShouldPaintBackground (comboBox)) { + base.ComboBoxDrawBackground (comboBox, g, clippingArea, style); + return; + } + VisualStyleElement element; + if (!comboBox.Enabled) + element = VisualStyleElement.ComboBox.Border.Disabled; + else if (comboBox.Entered) + element = VisualStyleElement.ComboBox.Border.Hot; + else if (comboBox.Focused) + element = VisualStyleElement.ComboBox.Border.Focused; + else + element = VisualStyleElement.ComboBox.Border.Normal; + if (!VisualStyleRenderer.IsElementDefined (element)) { + base.ComboBoxDrawBackground (comboBox, g, clippingArea, style); + return; + } + new VisualStyleRenderer (element).DrawBackground (g, new Rectangle (Point.Empty, comboBox.Size), clippingArea); + } + public override bool CombBoxBackgroundHasHotElementStyle (ComboBox comboBox) + { + if (RenderClientAreas && + ComboBoxShouldPaintBackground (comboBox) && + comboBox.Enabled && + VisualStyleRenderer.IsElementDefined (VisualStyleElement.ComboBox.Border.Hot)) + return true; + return base.CombBoxBackgroundHasHotElementStyle (comboBox); + } + #endregion + #region WidgetPaint + #region DrawButton + public override void CPDrawButton (Graphics dc, Rectangle rectangle, ButtonState state) + { + if (!RenderClientAreas || + (state & ButtonState.Flat) == ButtonState.Flat || + (state & ButtonState.Checked) == ButtonState.Checked) { + base.CPDrawButton (dc, rectangle, state); + return; + } + VisualStyleElement element; + if ((state & ButtonState.Inactive) == ButtonState.Inactive) + element = VisualStyleElement.Button.PushButton.Disabled; + else if ((state & ButtonState.Pushed) == ButtonState.Pushed) + element = VisualStyleElement.Button.PushButton.Pressed; + else + element = VisualStyleElement.Button.PushButton.Normal; + if (!VisualStyleRenderer.IsElementDefined (element)) { + base.CPDrawButton (dc, rectangle, state); + return; + } + new VisualStyleRenderer (element).DrawBackground (dc, rectangle); + } + #endregion + #region DrawCaptionButton + public override void CPDrawCaptionButton (Graphics graphics, Rectangle rectangle, CaptionButton button, ButtonState state) + { + if (!RenderClientAreas || + (state & ButtonState.Flat) == ButtonState.Flat || + (state & ButtonState.Checked) == ButtonState.Checked) { + base.CPDrawCaptionButton (graphics, rectangle, button, state); + return; + } + VisualStyleElement element = GetCaptionButtonVisualStyleElement (button, state); + if (!VisualStyleRenderer.IsElementDefined (element)) { + base.CPDrawCaptionButton (graphics, rectangle, button, state); + return; + } + new VisualStyleRenderer (element).DrawBackground (graphics, rectangle); + } + static VisualStyleElement GetCaptionButtonVisualStyleElement (CaptionButton button, ButtonState state) + { + switch (button) { + case CaptionButton.Minimize: + if ((state & ButtonState.Inactive) == ButtonState.Inactive) + return VisualStyleElement.Window.MinButton.Disabled; + else if ((state & ButtonState.Pushed) == ButtonState.Pushed) + return VisualStyleElement.Window.MinButton.Pressed; + else + return VisualStyleElement.Window.MinButton.Normal; + case CaptionButton.Maximize: + if ((state & ButtonState.Inactive) == ButtonState.Inactive) + return VisualStyleElement.Window.MaxButton.Disabled; + else if ((state & ButtonState.Pushed) == ButtonState.Pushed) + return VisualStyleElement.Window.MaxButton.Pressed; + else + return VisualStyleElement.Window.MaxButton.Normal; + case CaptionButton.Close: + if ((state & ButtonState.Inactive) == ButtonState.Inactive) + return VisualStyleElement.Window.CloseButton.Disabled; + else if ((state & ButtonState.Pushed) == ButtonState.Pushed) + return VisualStyleElement.Window.CloseButton.Pressed; + else + return VisualStyleElement.Window.CloseButton.Normal; + case CaptionButton.Restore: + if ((state & ButtonState.Inactive) == ButtonState.Inactive) + return VisualStyleElement.Window.RestoreButton.Disabled; + else if ((state & ButtonState.Pushed) == ButtonState.Pushed) + return VisualStyleElement.Window.RestoreButton.Pressed; + else + return VisualStyleElement.Window.RestoreButton.Normal; + default: + if ((state & ButtonState.Inactive) == ButtonState.Inactive) + return VisualStyleElement.Window.HelpButton.Disabled; + else if ((state & ButtonState.Pushed) == ButtonState.Pushed) + return VisualStyleElement.Window.HelpButton.Pressed; + else + return VisualStyleElement.Window.HelpButton.Normal; + } + } + #endregion + #region DrawCheckBox + public override void CPDrawCheckBox (Graphics dc, Rectangle rectangle, ButtonState state) + { + if (!RenderClientAreas || + (state & ButtonState.Flat) == ButtonState.Flat) { + base.CPDrawCheckBox (dc, rectangle, state); + return; + } + VisualStyleElement element; + if ((state & ButtonState.Checked) == ButtonState.Checked) + if ((state & ButtonState.Inactive) == ButtonState.Inactive) + element = VisualStyleElement.Button.CheckBox.CheckedDisabled; + else if ((state & ButtonState.Pushed) == ButtonState.Pushed) + element = VisualStyleElement.Button.CheckBox.CheckedPressed; + else + element = VisualStyleElement.Button.CheckBox.CheckedNormal; + else + if ((state & ButtonState.Inactive) == ButtonState.Inactive) + element = VisualStyleElement.Button.CheckBox.UncheckedDisabled; + else if ((state & ButtonState.Pushed) == ButtonState.Pushed) + element = VisualStyleElement.Button.CheckBox.UncheckedPressed; + else + element = VisualStyleElement.Button.CheckBox.UncheckedNormal; + if (!VisualStyleRenderer.IsElementDefined (element)) { + base.CPDrawCheckBox (dc, rectangle, state); + return; + } + new VisualStyleRenderer (element).DrawBackground (dc, rectangle); + } + #endregion + #region DrawComboButton + public override void CPDrawComboButton (Graphics graphics, Rectangle rectangle, ButtonState state) + { + if (!RenderClientAreas || + (state & ButtonState.Flat) == ButtonState.Flat || + (state & ButtonState.Checked) == ButtonState.Checked) { + base.CPDrawComboButton (graphics, rectangle, state); + return; + } + VisualStyleElement element; + if ((state & ButtonState.Inactive) == ButtonState.Inactive) + element = VisualStyleElement.ComboBox.DropDownButton.Disabled; + else if ((state & ButtonState.Pushed) == ButtonState.Pushed) + element = VisualStyleElement.ComboBox.DropDownButton.Pressed; + else + element = VisualStyleElement.ComboBox.DropDownButton.Normal; + if (!VisualStyleRenderer.IsElementDefined (element)) { + base.CPDrawComboButton (graphics, rectangle, state); + return; + } + new VisualStyleRenderer (element).DrawBackground (graphics, rectangle); + } + #endregion + #region DrawMixedCheckBox + public override void CPDrawMixedCheckBox (Graphics dc, Rectangle rectangle, ButtonState state) + { + if (!RenderClientAreas || + (state & ButtonState.Flat) == ButtonState.Flat) { + base.CPDrawMixedCheckBox (dc, rectangle, state); + return; + } + VisualStyleElement element; + if ((state & ButtonState.Checked) == ButtonState.Checked) + if ((state & ButtonState.Inactive) == ButtonState.Inactive) + element = VisualStyleElement.Button.CheckBox.MixedDisabled; + else if ((state & ButtonState.Pushed) == ButtonState.Pushed) + element = VisualStyleElement.Button.CheckBox.MixedPressed; + else + element = VisualStyleElement.Button.CheckBox.MixedNormal; + else + if ((state & ButtonState.Inactive) == ButtonState.Inactive) + element = VisualStyleElement.Button.CheckBox.UncheckedDisabled; + else if ((state & ButtonState.Pushed) == ButtonState.Pushed) + element = VisualStyleElement.Button.CheckBox.UncheckedPressed; + else + element = VisualStyleElement.Button.CheckBox.UncheckedNormal; + if (!VisualStyleRenderer.IsElementDefined (element)) { + base.CPDrawMixedCheckBox (dc, rectangle, state); + return; + } + new VisualStyleRenderer (element).DrawBackground (dc, rectangle); + } + #endregion + #region DrawRadioButton + public override void CPDrawRadioButton (Graphics dc, Rectangle rectangle, ButtonState state) + { + if (!RenderClientAreas || + (state & ButtonState.Flat) == ButtonState.Flat) { + base.CPDrawRadioButton (dc, rectangle, state); + return; + } + VisualStyleElement element; + if ((state & ButtonState.Checked) == ButtonState.Checked) + if ((state & ButtonState.Inactive) == ButtonState.Inactive) + element = VisualStyleElement.Button.RadioButton.CheckedDisabled; + else if ((state & ButtonState.Pushed) == ButtonState.Pushed) + element = VisualStyleElement.Button.RadioButton.CheckedPressed; + else + element = VisualStyleElement.Button.RadioButton.CheckedNormal; + else + if ((state & ButtonState.Inactive) == ButtonState.Inactive) + element = VisualStyleElement.Button.RadioButton.UncheckedDisabled; + else if ((state & ButtonState.Pushed) == ButtonState.Pushed) + element = VisualStyleElement.Button.RadioButton.UncheckedPressed; + else + element = VisualStyleElement.Button.RadioButton.UncheckedNormal; + if (!VisualStyleRenderer.IsElementDefined (element)) { + base.CPDrawRadioButton (dc, rectangle, state); + return; + } + new VisualStyleRenderer (element).DrawBackground (dc, rectangle); + } + #endregion + #region DrawScrollButton + public override void CPDrawScrollButton (Graphics dc, Rectangle area, ScrollButton type, ButtonState state) + { + if (!RenderClientAreas || + (state & ButtonState.Flat) == ButtonState.Flat || + (state & ButtonState.Checked) == ButtonState.Checked) { + base.CPDrawScrollButton (dc, area, type, state); + return; + } + VisualStyleElement element = GetScrollButtonVisualStyleElement (type, state); + if (!VisualStyleRenderer.IsElementDefined (element)) { + base.CPDrawScrollButton (dc, area, type, state); + return; + } + new VisualStyleRenderer (element).DrawBackground (dc, area); + } + static VisualStyleElement GetScrollButtonVisualStyleElement (ScrollButton type, ButtonState state) + { + switch (type) { + case ScrollButton.Left: + if (IsDisabled (state)) + return VisualStyleElement.ScrollBar.ArrowButton.LeftDisabled; + else if (IsPressed (state)) + return VisualStyleElement.ScrollBar.ArrowButton.LeftPressed; + else + return VisualStyleElement.ScrollBar.ArrowButton.LeftNormal; + case ScrollButton.Right: + if (IsDisabled (state)) + return VisualStyleElement.ScrollBar.ArrowButton.RightDisabled; + else if (IsPressed (state)) + return VisualStyleElement.ScrollBar.ArrowButton.RightPressed; + else + return VisualStyleElement.ScrollBar.ArrowButton.RightNormal; + case ScrollButton.Up: + if (IsDisabled (state)) + return VisualStyleElement.ScrollBar.ArrowButton.UpDisabled; + else if (IsPressed (state)) + return VisualStyleElement.ScrollBar.ArrowButton.UpPressed; + else + return VisualStyleElement.ScrollBar.ArrowButton.UpNormal; + default: + if (IsDisabled (state)) + return VisualStyleElement.ScrollBar.ArrowButton.DownDisabled; + else if (IsPressed (state)) + return VisualStyleElement.ScrollBar.ArrowButton.DownPressed; + else + return VisualStyleElement.ScrollBar.ArrowButton.DownNormal; + } + } + static bool IsDisabled (ButtonState state) + { + return (state & ButtonState.Inactive) == ButtonState.Inactive; + } + static bool IsPressed (ButtonState state) + { + return (state & ButtonState.Pushed) == ButtonState.Pushed; + } + #endregion + #endregion + /* FIXME: I SAID NO. + #region DataGridView + #region DataGridViewHeaderCell + #region DataGridViewRowHeaderCell + public override bool DataGridViewRowHeaderCellDrawBackground (DataGridViewRowHeaderCell cell, Graphics g, Rectangle bounds) + { + if (!RenderClientAreas || + !cell.DataGridView.EnableHeadersVisualStyles) + return base.DataGridViewRowHeaderCellDrawBackground (cell, g, bounds); + VisualStyleElement element = DataGridViewRowHeaderCellGetVisualStyleElement (cell); + if (!VisualStyleRenderer.IsElementDefined (element)) + return base.DataGridViewRowHeaderCellDrawBackground (cell, g, bounds); + bounds.Width--; + Bitmap bitmap = new Bitmap (bounds.Height, bounds.Width); + Graphics bitmap_g = Graphics.FromImage (bitmap); + Rectangle bitmap_rectangle = new Rectangle (Point.Empty, bitmap.Size); + VisualStyleRenderer renderer = new VisualStyleRenderer (element); + if (!AreEqual (element, VisualStyleElement.Header.Item.Normal) && renderer.IsBackgroundPartiallyTransparent ()) + new VisualStyleRenderer (VisualStyleElement.Header.Item.Normal).DrawBackground (bitmap_g, bitmap_rectangle); + renderer.DrawBackground (bitmap_g, bitmap_rectangle); + bitmap_g.Dispose (); + g.Transform = new Matrix(0, 1, 1, 0, 0, 0); + g.DrawImage (bitmap, bounds.Y, bounds.X); + bitmap.Dispose (); + g.ResetTransform (); + return true; + } + public override bool DataGridViewRowHeaderCellDrawSelectionBackground (DataGridViewRowHeaderCell cell) + { + if (!RenderClientAreas || + !cell.DataGridView.EnableHeadersVisualStyles || !VisualStyleRenderer.IsElementDefined (DataGridViewRowHeaderCellGetVisualStyleElement (cell))) + return base.DataGridViewRowHeaderCellDrawSelectionBackground (cell); + return true; + } + public override bool DataGridViewRowHeaderCellDrawBorder (DataGridViewRowHeaderCell cell, Graphics g, Rectangle bounds) + { + if (!RenderClientAreas || + !cell.DataGridView.EnableHeadersVisualStyles || !VisualStyleRenderer.IsElementDefined (DataGridViewRowHeaderCellGetVisualStyleElement (cell))) + return base.DataGridViewRowHeaderCellDrawBorder (cell, g, bounds); + g.DrawLine (cell.GetBorderPen (), bounds.Right - 1, bounds.Top, bounds.Right - 1, bounds.Bottom - 1); + return true; + } + static VisualStyleElement DataGridViewRowHeaderCellGetVisualStyleElement (DataGridViewRowHeaderCell cell) + { + if (cell.DataGridView.PressedHeaderCell == cell) + return VisualStyleElement.Header.Item.Pressed; + if (cell.DataGridView.EnteredHeaderCell == cell) + return VisualStyleElement.Header.Item.Hot; + if (cell.OwningRow.SelectedInternal) + return VisualStyleElement.Header.Item.Pressed; + return VisualStyleElement.Header.Item.Normal; + } + #endregion + #region DataGridViewColumnHeaderCell + public override bool DataGridViewColumnHeaderCellDrawBackground (DataGridViewColumnHeaderCell cell, Graphics g, Rectangle bounds) + { + if (!RenderClientAreas || + !cell.DataGridView.EnableHeadersVisualStyles || cell is DataGridViewTopLeftHeaderCell) + return base.DataGridViewColumnHeaderCellDrawBackground (cell, g, bounds); + VisualStyleElement element = DataGridViewColumnHeaderCellGetVisualStyleElement (cell); + if (!VisualStyleRenderer.IsElementDefined (element)) + return base.DataGridViewColumnHeaderCellDrawBackground (cell, g, bounds); + bounds.Height--; + VisualStyleRenderer renderer = new VisualStyleRenderer (element); + if (!AreEqual (element, VisualStyleElement.Header.Item.Normal) && renderer.IsBackgroundPartiallyTransparent ()) + new VisualStyleRenderer (VisualStyleElement.Header.Item.Normal).DrawBackground (g, bounds); + renderer.DrawBackground (g, bounds); + return true; + } + public override bool DataGridViewColumnHeaderCellDrawBorder (DataGridViewColumnHeaderCell cell, Graphics g, Rectangle bounds) + { + if (!RenderClientAreas || + !cell.DataGridView.EnableHeadersVisualStyles || + cell is DataGridViewTopLeftHeaderCell || + !VisualStyleRenderer.IsElementDefined (VisualStyleElement.Header.Item.Normal)) + return base.DataGridViewColumnHeaderCellDrawBorder (cell, g, bounds); + g.DrawLine (cell.GetBorderPen (), bounds.Left, bounds.Bottom - 1, bounds.Right - 1, bounds.Bottom - 1); + return true; + } + static VisualStyleElement DataGridViewColumnHeaderCellGetVisualStyleElement (DataGridViewColumnHeaderCell cell) + { + if (cell.DataGridView.PressedHeaderCell == cell) + return VisualStyleElement.Header.Item.Pressed; + if (cell.DataGridView.EnteredHeaderCell == cell) + return VisualStyleElement.Header.Item.Hot; + return VisualStyleElement.Header.Item.Normal; + } + #endregion + public override bool DataGridViewHeaderCellHasPressedStyle (DataGridView dataGridView) + { + if (!RenderClientAreas || + !dataGridView.EnableHeadersVisualStyles || + !VisualStyleRenderer.IsElementDefined (VisualStyleElement.Header.Item.Pressed)) + return base.DataGridViewHeaderCellHasPressedStyle (dataGridView); + return true; + } + public override bool DataGridViewHeaderCellHasHotStyle (DataGridView dataGridView) + { + if (!RenderClientAreas || + !dataGridView.EnableHeadersVisualStyles || + !VisualStyleRenderer.IsElementDefined (VisualStyleElement.Header.Item.Hot)) + return base.DataGridViewHeaderCellHasHotStyle (dataGridView); + return true; + } + #endregion + #endregion*/ + + #region DateTimePicker + #region Border + protected override void DateTimePickerDrawBorder (DateTimePicker dateTimePicker, Graphics g, Rectangle clippingArea) + { + if (!RenderClientAreas) { + base.DateTimePickerDrawBorder (dateTimePicker, g, clippingArea); + return; + } + VisualStyleElement element; + if (!dateTimePicker.Enabled) + element = VisualStyleElement.DatePicker.DateBorder.Disabled; + else if (dateTimePicker.Entered) + element = VisualStyleElement.DatePicker.DateBorder.Hot; + else if (dateTimePicker.Focused) + element = VisualStyleElement.DatePicker.DateBorder.Focused; + else + element = VisualStyleElement.DatePicker.DateBorder.Normal; + if (!VisualStyleRenderer.IsElementDefined (element)) { + base.DateTimePickerDrawBorder (dateTimePicker, g, clippingArea); + return; + } + new VisualStyleRenderer (element).DrawBackground (g, new Rectangle (Point.Empty, dateTimePicker.Size), clippingArea); + } + public override bool DateTimePickerBorderHasHotElementStyle { + get { + if (RenderClientAreas && + VisualStyleRenderer.IsElementDefined (VisualStyleElement.DatePicker.DateBorder.Hot)) + return true; + return base.DateTimePickerBorderHasHotElementStyle; + } + } + #endregion + #region Drop down button + protected override void DateTimePickerDrawDropDownButton (DateTimePicker dateTimePicker, Graphics g, Rectangle clippingArea) + { + if (!RenderClientAreas) { + base.DateTimePickerDrawDropDownButton (dateTimePicker, g, clippingArea); + return; + } + VisualStyleElement element; + if (!dateTimePicker.Enabled) + element = VisualStyleElement.DatePicker.ShowCalendarButtonRight.Disabled; + else if (dateTimePicker.is_drop_down_visible) + element = VisualStyleElement.DatePicker.ShowCalendarButtonRight.Pressed; + else if (dateTimePicker.DropDownButtonEntered) + element = VisualStyleElement.DatePicker.ShowCalendarButtonRight.Hot; + else + element = VisualStyleElement.DatePicker.ShowCalendarButtonRight.Normal; + if (!VisualStyleRenderer.IsElementDefined (element)) { + base.DateTimePickerDrawDropDownButton (dateTimePicker, g, clippingArea); + return; + } + new VisualStyleRenderer (element).DrawBackground (g, dateTimePicker.drop_down_arrow_rect, clippingArea); + } + //TODO: Until somebody figures out how to obtain the proper width this will need to be updated when new Windows versions/themes are released. + const int DateTimePickerDropDownWidthOnWindowsVista = 34; + const int DateTimePickerDropDownHeightOnWindowsVista = 20; + public override Rectangle DateTimePickerGetDropDownButtonArea (DateTimePicker dateTimePicker) + { + if (!RenderClientAreas) + return base.DateTimePickerGetDropDownButtonArea (dateTimePicker); + VisualStyleElement element = VisualStyleElement.DatePicker.ShowCalendarButtonRight.Pressed; + if (!VisualStyleRenderer.IsElementDefined (element)) + return base.DateTimePickerGetDropDownButtonArea (dateTimePicker); + Size size = new Size (DateTimePickerDropDownWidthOnWindowsVista, DateTimePickerDropDownHeightOnWindowsVista); + return new Rectangle (dateTimePicker.Width - size.Width, 0, size.Width, size.Height); + } + public override Rectangle DateTimePickerGetDateArea (DateTimePicker dateTimePicker) + { + if (!RenderClientAreas || + dateTimePicker.ShowUpDown) + return base.DateTimePickerGetDateArea (dateTimePicker); + VisualStyleElement element = VisualStyleElement.DatePicker.DateBorder.Normal; + if (!VisualStyleRenderer.IsElementDefined (element)) + return base.DateTimePickerGetDateArea (dateTimePicker); + Graphics g = dateTimePicker.CreateGraphics (); + Rectangle result = new VisualStyleRenderer (element).GetBackgroundContentRectangle (g, dateTimePicker.ClientRectangle); + g.Dispose (); + result.Width -= DateTimePickerDropDownWidthOnWindowsVista; + return result; + } + public override bool DateTimePickerDropDownButtonHasHotElementStyle { + get { + if (RenderClientAreas && + VisualStyleRenderer.IsElementDefined (VisualStyleElement.DatePicker.ShowCalendarButtonRight.Hot)) + return true; + return base.DateTimePickerDropDownButtonHasHotElementStyle; + } + } + #endregion + #endregion + #region ListView + protected override void ListViewDrawColumnHeaderBackground (ListView listView, ColumnHeader columnHeader, Graphics g, Rectangle area, Rectangle clippingArea) + { + if (!RenderClientAreas) { + base.ListViewDrawColumnHeaderBackground (listView, columnHeader, g, area, clippingArea); + return; + } + VisualStyleElement element; + if (listView.HeaderStyle == ColumnHeaderStyle.Clickable) + if (columnHeader.Pressed) + element = VisualStyleElement.Header.Item.Pressed; + else if (columnHeader == listView.EnteredColumnHeader) + element = VisualStyleElement.Header.Item.Hot; + else + element = VisualStyleElement.Header.Item.Normal; + else + element = VisualStyleElement.Header.Item.Normal; + if (!VisualStyleRenderer.IsElementDefined (element)) { + base.ListViewDrawColumnHeaderBackground (listView, columnHeader, g, area, clippingArea); + return; + } + new VisualStyleRenderer (element).DrawBackground (g, area, clippingArea); + } + protected override void ListViewDrawUnusedHeaderBackground (ListView listView, Graphics g, Rectangle area, Rectangle clippingArea) + { + if (!RenderClientAreas) { + base.ListViewDrawUnusedHeaderBackground (listView, g, area, clippingArea); + return; + } + VisualStyleElement element = VisualStyleElement.Header.Item.Normal; + if (!VisualStyleRenderer.IsElementDefined (element)) { + base.ListViewDrawUnusedHeaderBackground (listView, g, area, clippingArea); + return; + } + new VisualStyleRenderer (element).DrawBackground (g, area, clippingArea); + } + public override bool ListViewHasHotHeaderStyle { + get { + if (!RenderClientAreas || + !VisualStyleRenderer.IsElementDefined (VisualStyleElement.Header.Item.Hot)) + return base.ListViewHasHotHeaderStyle; + return true; + } + } + public override int ListViewGetHeaderHeight (ListView listView, Font font) + { + if (!RenderClientAreas) + return base.ListViewGetHeaderHeight (listView, font); + VisualStyleElement element = VisualStyleElement.Header.Item.Normal; + if (!VisualStyleRenderer.IsElementDefined (element)) + return base.ListViewGetHeaderHeight (listView, font); + Widget control = null; + Graphics g; + if (listView == null) { + control = new Widget (); + g = control.CreateGraphics (); + } else + g = listView.CreateGraphics (); + int result = new VisualStyleRenderer (element).GetPartSize (g, ThemeSizeType.True).Height; + g.Dispose (); + if (listView == null) + control.Dispose (); + return result; + } + #endregion + #region GroupBox + public override void DrawGroupBox (Graphics dc, Rectangle area, GroupBox box) + { + GroupBoxRenderer.DrawGroupBox ( + dc, + new Rectangle (Point.Empty, box.Size), + box.Text, + box.Font, + box.ForeColor == GroupBox.DefaultForeColor ? Color.Empty : box.ForeColor, + box.Enabled ? GroupBoxState.Normal : GroupBoxState.Disabled); + } + #endregion + #region Managed window + Rectangle ManagedWindowGetTitleBarRectangle (InternalWindowManager wm) + { + return new Rectangle (0, 0, wm.Form.Width, ManagedWindowTitleBarHeight (wm) + ManagedWindowBorderWidth (wm) * (wm.IsMinimized ? 2 : 1)); + } + Region ManagedWindowGetWindowRegion (Form form) + { + if (form.WindowManager is MdiWindowManager && form.WindowManager.IsMaximized) + return null; + VisualStyleElement title_bar_element = ManagedWindowGetTitleBarVisualStyleElement (form.WindowManager); + if (!VisualStyleRenderer.IsElementDefined (title_bar_element)) + return null; + VisualStyleRenderer renderer = new VisualStyleRenderer (title_bar_element); + if (!renderer.IsBackgroundPartiallyTransparent ()) + return null; + IDeviceContext dc = GetMeasurementDeviceContext (); + Rectangle title_bar_rectangle = ManagedWindowGetTitleBarRectangle (form.WindowManager); + Region region = renderer.GetBackgroundRegion (dc, title_bar_rectangle); + ReleaseMeasurementDeviceContext (dc); + region.Union (new Rectangle (0, title_bar_rectangle.Bottom, form.Width, form.Height)); + return region; + } + public override void ManagedWindowOnSizeInitializedOrChanged (Form form) + { + base.ManagedWindowOnSizeInitializedOrChanged (form); + if (!render_non_client_areas) + return; + form.Region = ManagedWindowGetWindowRegion (form); + } + protected override Rectangle ManagedWindowDrawTitleBarAndBorders (Graphics dc, Rectangle clip, InternalWindowManager wm) + { + if (!render_non_client_areas) + return base.ManagedWindowDrawTitleBarAndBorders (dc, clip, wm); + VisualStyleElement title_bar_element = ManagedWindowGetTitleBarVisualStyleElement (wm); + VisualStyleElement left_border_element; + VisualStyleElement right_border_element; + VisualStyleElement bottom_border_element; + ManagedWindowGetBorderVisualStyleElements (wm, out left_border_element, out right_border_element, out bottom_border_element); + if (!VisualStyleRenderer.IsElementDefined (title_bar_element) || + (!wm.IsMinimized && ( + !VisualStyleRenderer.IsElementDefined (left_border_element) || + !VisualStyleRenderer.IsElementDefined (right_border_element) || + !VisualStyleRenderer.IsElementDefined (bottom_border_element)))) + return base.ManagedWindowDrawTitleBarAndBorders (dc, clip, wm); + VisualStyleRenderer renderer = new VisualStyleRenderer (title_bar_element); + Rectangle title_bar_rectangle = ManagedWindowGetTitleBarRectangle (wm); + renderer.DrawBackground (dc, title_bar_rectangle, clip); + if (!wm.IsMinimized) { + int border_width = ManagedWindowBorderWidth (wm); + renderer.SetParameters (left_border_element); + renderer.DrawBackground (dc, new Rectangle ( + 0, + title_bar_rectangle.Bottom, + border_width, + wm.Form.Height - title_bar_rectangle.Bottom + ), clip); + renderer.SetParameters (right_border_element); + renderer.DrawBackground (dc, new Rectangle ( + wm.Form.Width - border_width, + title_bar_rectangle.Bottom, + border_width, + wm.Form.Height - title_bar_rectangle.Bottom + ), clip); + renderer.SetParameters (bottom_border_element); + renderer.DrawBackground (dc, new Rectangle ( + 0, + wm.Form.Height - border_width, + wm.Form.Width, + border_width + ), clip); + } + return title_bar_rectangle; + } + static FormWindowState ManagedWindowGetWindowState (InternalWindowManager wm) + { + return wm.GetWindowState (); + } + static bool ManagedWindowIsDisabled (InternalWindowManager wm) + { + return !wm.Form.Enabled; + } + static bool ManagedWindowIsActive (InternalWindowManager wm) + { + return wm.IsActive; + } + static VisualStyleElement ManagedWindowGetTitleBarVisualStyleElement (InternalWindowManager wm) + { + if (wm.IsToolWindow) + #region Small window + switch (ManagedWindowGetWindowState (wm)) { + case FormWindowState.Minimized: + if (ManagedWindowIsDisabled (wm)) + return VisualStyleElement.Window.SmallMinCaption.Disabled; + else if (ManagedWindowIsActive (wm)) + return VisualStyleElement.Window.SmallMinCaption.Active; + return VisualStyleElement.Window.SmallMinCaption.Inactive; + case FormWindowState.Maximized: + if (ManagedWindowIsDisabled (wm)) + return VisualStyleElement.Window.SmallMaxCaption.Disabled; + else if (ManagedWindowIsActive (wm)) + return VisualStyleElement.Window.SmallMaxCaption.Active; + return VisualStyleElement.Window.SmallMaxCaption.Inactive; + default: + if (ManagedWindowIsDisabled (wm)) + return VisualStyleElement.Window.SmallCaption.Disabled; + else if (ManagedWindowIsActive (wm)) + return VisualStyleElement.Window.SmallCaption.Active; + return VisualStyleElement.Window.SmallCaption.Inactive; + } + #endregion + else + #region Normal window + switch (ManagedWindowGetWindowState (wm)) { + case FormWindowState.Minimized: + if (ManagedWindowIsDisabled (wm)) + return VisualStyleElement.Window.MinCaption.Disabled; + else if (ManagedWindowIsActive (wm)) + return VisualStyleElement.Window.MinCaption.Active; + return VisualStyleElement.Window.MinCaption.Inactive; + case FormWindowState.Maximized: + if (ManagedWindowIsDisabled (wm)) + return VisualStyleElement.Window.MaxCaption.Disabled; + else if (ManagedWindowIsActive (wm)) + return VisualStyleElement.Window.MaxCaption.Active; + return VisualStyleElement.Window.MaxCaption.Inactive; + default: + if (ManagedWindowIsDisabled (wm)) + return VisualStyleElement.Window.Caption.Disabled; + else if (ManagedWindowIsActive (wm)) + return VisualStyleElement.Window.Caption.Active; + return VisualStyleElement.Window.Caption.Inactive; + } + #endregion + } + static void ManagedWindowGetBorderVisualStyleElements (InternalWindowManager wm, out VisualStyleElement left, out VisualStyleElement right, out VisualStyleElement bottom) + { + bool active = !ManagedWindowIsDisabled (wm) && ManagedWindowIsActive (wm); + if (wm.IsToolWindow) { + if (active) { + left = VisualStyleElement.Window.SmallFrameLeft.Active; + right = VisualStyleElement.Window.SmallFrameRight.Active; + bottom = VisualStyleElement.Window.SmallFrameBottom.Active; + } else { + left = VisualStyleElement.Window.SmallFrameLeft.Inactive; + right = VisualStyleElement.Window.SmallFrameRight.Inactive; + bottom = VisualStyleElement.Window.SmallFrameBottom.Inactive; + } + } else { + if (active) { + left = VisualStyleElement.Window.FrameLeft.Active; + right = VisualStyleElement.Window.FrameRight.Active; + bottom = VisualStyleElement.Window.FrameBottom.Active; + } else { + left = VisualStyleElement.Window.FrameLeft.Inactive; + right = VisualStyleElement.Window.FrameRight.Inactive; + bottom = VisualStyleElement.Window.FrameBottom.Inactive; + } + } + } + public override bool ManagedWindowTitleButtonHasHotElementStyle (TitleButton button, Form form) + { + if (render_non_client_areas && (button.State & ButtonState.Inactive) != ButtonState.Inactive) { + VisualStyleElement element; + if (ManagedWindowIsMaximizedMdiChild (form)) + switch (button.Caption) { + case CaptionButton.Close: + element = VisualStyleElement.Window.MdiCloseButton.Hot; + break; + case CaptionButton.Help: + element = VisualStyleElement.Window.MdiHelpButton.Hot; + break; + case CaptionButton.Minimize: + element = VisualStyleElement.Window.MdiMinButton.Hot; + break; + default: + element = VisualStyleElement.Window.MdiRestoreButton.Hot; + break; + } + else if (form.WindowManager.IsToolWindow) + element = VisualStyleElement.Window.SmallCloseButton.Hot; + else + switch (button.Caption) { + case CaptionButton.Close: + element = VisualStyleElement.Window.CloseButton.Hot; + break; + case CaptionButton.Help: + element = VisualStyleElement.Window.HelpButton.Hot; + break; + case CaptionButton.Maximize: + element = VisualStyleElement.Window.MaxButton.Hot; + break; + case CaptionButton.Minimize: + element = VisualStyleElement.Window.MinButton.Hot; + break; + default: + element = VisualStyleElement.Window.RestoreButton.Hot; + break; + } + if (VisualStyleRenderer.IsElementDefined (element)) + return true; + } + return base.ManagedWindowTitleButtonHasHotElementStyle (button, form); + } + static bool ManagedWindowIsMaximizedMdiChild (Form form) + { + return form.WindowManager is MdiWindowManager && + ManagedWindowGetWindowState (form.WindowManager) == FormWindowState.Maximized; + } + static bool ManagedWindowTitleButtonIsDisabled (TitleButton button, InternalWindowManager wm) + { + return (button.State & ButtonState.Inactive) == ButtonState.Inactive; + } + static bool ManagedWindowTitleButtonIsPressed (TitleButton button) + { + return (button.State & ButtonState.Pushed) == ButtonState.Pushed; + } + static VisualStyleElement ManagedWindowGetTitleButtonVisualStyleElement (TitleButton button, Form form) + { + if (form.WindowManager.IsToolWindow) { + if (ManagedWindowTitleButtonIsDisabled (button, form.WindowManager)) + return VisualStyleElement.Window.SmallCloseButton.Disabled; + if (ManagedWindowTitleButtonIsPressed (button)) + return VisualStyleElement.Window.SmallCloseButton.Pressed; + if (button.Entered) + return VisualStyleElement.Window.SmallCloseButton.Hot; + return VisualStyleElement.Window.SmallCloseButton.Normal; + } + switch (button.Caption) { + case CaptionButton.Close: + if (ManagedWindowTitleButtonIsDisabled (button, form.WindowManager)) + return VisualStyleElement.Window.CloseButton.Disabled; + if (ManagedWindowTitleButtonIsPressed (button)) + return VisualStyleElement.Window.CloseButton.Pressed; + if (button.Entered) + return VisualStyleElement.Window.CloseButton.Hot; + return VisualStyleElement.Window.CloseButton.Normal; + case CaptionButton.Help: + if (ManagedWindowTitleButtonIsDisabled (button, form.WindowManager)) + return VisualStyleElement.Window.HelpButton.Disabled; + if (ManagedWindowTitleButtonIsPressed (button)) + return VisualStyleElement.Window.HelpButton.Pressed; + if (button.Entered) + return VisualStyleElement.Window.HelpButton.Hot; + return VisualStyleElement.Window.HelpButton.Normal; + case CaptionButton.Maximize: + if (ManagedWindowTitleButtonIsDisabled (button, form.WindowManager)) + return VisualStyleElement.Window.MaxButton.Disabled; + if (ManagedWindowTitleButtonIsPressed (button)) + return VisualStyleElement.Window.MaxButton.Pressed; + if (button.Entered) + return VisualStyleElement.Window.MaxButton.Hot; + return VisualStyleElement.Window.MaxButton.Normal; + case CaptionButton.Minimize: + if (ManagedWindowTitleButtonIsDisabled (button, form.WindowManager)) + return VisualStyleElement.Window.MinButton.Disabled; + if (ManagedWindowTitleButtonIsPressed (button)) + return VisualStyleElement.Window.MinButton.Pressed; + if (button.Entered) + return VisualStyleElement.Window.MinButton.Hot; + return VisualStyleElement.Window.MinButton.Normal; + default: + if (ManagedWindowTitleButtonIsDisabled (button, form.WindowManager)) + return VisualStyleElement.Window.RestoreButton.Disabled; + if (ManagedWindowTitleButtonIsPressed (button)) + return VisualStyleElement.Window.RestoreButton.Pressed; + if (button.Entered) + return VisualStyleElement.Window.RestoreButton.Hot; + return VisualStyleElement.Window.RestoreButton.Normal; + } + } + protected override void ManagedWindowDrawTitleButton (Graphics dc, TitleButton button, Rectangle clip, Form form) + { + if (!render_non_client_areas) { + base.ManagedWindowDrawTitleButton (dc, button, clip, form); + return; + } + VisualStyleElement element = ManagedWindowGetTitleButtonVisualStyleElement (button, form); + if (!VisualStyleRenderer.IsElementDefined (element)) { + base.ManagedWindowDrawTitleButton (dc, button, clip, form); + return; + } + new VisualStyleRenderer (element).DrawBackground (dc, button.Rectangle, clip); + } + public override Size ManagedWindowButtonSize (InternalWindowManager wm) + { + if (!render_non_client_areas) + return base.ManagedWindowButtonSize (wm); + VisualStyleElement element = wm.IsToolWindow && !wm.IsMinimized ? + VisualStyleElement.Window.SmallCloseButton.Normal : + VisualStyleElement.Window.CloseButton.Normal; + if (!VisualStyleRenderer.IsElementDefined (element)) + return base.ManagedWindowButtonSize (wm); + IDeviceContext dc = GetMeasurementDeviceContext (); + Size result = new VisualStyleRenderer (element).GetPartSize (dc, ThemeSizeType.True); + ReleaseMeasurementDeviceContext (dc); + return result; + } + public override void ManagedWindowDrawMenuButton (Graphics dc, TitleButton button, Rectangle clip, InternalWindowManager wm) + { + if (!render_non_client_areas) { + base.ManagedWindowDrawMenuButton (dc, button, clip, wm); + return; + } + VisualStyleElement element = ManagedWindowGetMenuButtonVisualStyleElement (button, wm); + if (!VisualStyleRenderer.IsElementDefined (element)) { + base.ManagedWindowDrawMenuButton (dc, button, clip, wm); + return; + } + new VisualStyleRenderer (element).DrawBackground (dc, button.Rectangle, clip); + } + static VisualStyleElement ManagedWindowGetMenuButtonVisualStyleElement (TitleButton button, InternalWindowManager wm) + { + switch (button.Caption) { + case CaptionButton.Close: + if (ManagedWindowTitleButtonIsDisabled (button, wm)) + return VisualStyleElement.Window.MdiCloseButton.Disabled; + if (ManagedWindowTitleButtonIsPressed (button)) + return VisualStyleElement.Window.MdiCloseButton.Pressed; + if (button.Entered) + return VisualStyleElement.Window.MdiCloseButton.Hot; + return VisualStyleElement.Window.MdiCloseButton.Normal; + case CaptionButton.Help: + if (ManagedWindowTitleButtonIsDisabled (button, wm)) + return VisualStyleElement.Window.MdiHelpButton.Disabled; + if (ManagedWindowTitleButtonIsPressed (button)) + return VisualStyleElement.Window.MdiHelpButton.Pressed; + if (button.Entered) + return VisualStyleElement.Window.MdiHelpButton.Hot; + return VisualStyleElement.Window.MdiHelpButton.Normal; + case CaptionButton.Minimize: + if (ManagedWindowTitleButtonIsDisabled (button, wm)) + return VisualStyleElement.Window.MdiMinButton.Disabled; + if (ManagedWindowTitleButtonIsPressed (button)) + return VisualStyleElement.Window.MdiMinButton.Pressed; + if (button.Entered) + return VisualStyleElement.Window.MdiMinButton.Hot; + return VisualStyleElement.Window.MdiMinButton.Normal; + default: + if (ManagedWindowTitleButtonIsDisabled (button, wm)) + return VisualStyleElement.Window.MdiRestoreButton.Disabled; + if (ManagedWindowTitleButtonIsPressed (button)) + return VisualStyleElement.Window.MdiRestoreButton.Pressed; + if (button.Entered) + return VisualStyleElement.Window.MdiRestoreButton.Hot; + return VisualStyleElement.Window.MdiRestoreButton.Normal; + } + } + #endregion + #region ProgressBar + public override void DrawProgressBar (Graphics dc, Rectangle clip_rect, ProgressBar ctrl) + { + if (!RenderClientAreas || + !VisualStyleRenderer.IsElementDefined (VisualStyleElement.ProgressBar.Bar.Normal) || + !VisualStyleRenderer.IsElementDefined (VisualStyleElement.ProgressBar.Chunk.Normal)) { + base.DrawProgressBar (dc, clip_rect, ctrl); + return; + } + VisualStyleRenderer renderer = new VisualStyleRenderer (VisualStyleElement.ProgressBar.Bar.Normal); + renderer.DrawBackground (dc, ctrl.ClientRectangle, clip_rect); + Rectangle client_area = renderer.GetBackgroundContentRectangle (dc, new Rectangle (Point.Empty, ctrl.Size)); + renderer = new VisualStyleRenderer (VisualStyleElement.ProgressBar.Chunk.Normal); + /* Draw Blocks */ + int draw_mode = 0; + int max_blocks = int.MaxValue; + int start_pixel = client_area.X; + draw_mode = (int)ctrl.Style; + switch (draw_mode) { + case 1: // Continuous + client_area.Width = (int)(client_area.Width * ((double)(ctrl.Value - ctrl.Minimum) / (double)(Math.Max (ctrl.Maximum - ctrl.Minimum, 1)))); + renderer.DrawBackground (dc, client_area, clip_rect); + break; + case 2: // Marquee + int ms_diff = (int)(DateTime.Now - ctrl.start).TotalMilliseconds; + double percent_done = (double) ms_diff / ProgressBarMarqueeSpeedScaling + % (double)ctrl.MarqueeAnimationSpeed / (double)ctrl.MarqueeAnimationSpeed; + max_blocks = 5; + start_pixel = client_area.X + (int)(client_area.Width * percent_done); + goto default; + default: // Blocks + int block_width = renderer.GetInteger (IntegerProperty.ProgressChunkSize); + block_width = Math.Max (block_width, 0); // block_width is used to break out the loop below, it must be >= 0! + int first_pixel_outside_filled_area = (int)(((double)(ctrl.Value - ctrl.Minimum) * client_area.Width) / (Math.Max (ctrl.Maximum - ctrl.Minimum, 1))) + client_area.X; + int block_count = 0; + int increment = block_width + renderer.GetInteger (IntegerProperty.ProgressSpaceSize); + Rectangle block_rect = new Rectangle (start_pixel, client_area.Y, block_width, client_area.Height); + while (true) { + if (max_blocks != int.MaxValue) { + if (block_count == max_blocks) + break; + if (block_rect.Right >= client_area.Width) + block_rect.X -= client_area.Width; + } else { + if (block_rect.X >= first_pixel_outside_filled_area) + break; + if (block_rect.Right >= first_pixel_outside_filled_area) + if (first_pixel_outside_filled_area == client_area.Right) + block_rect.Width = first_pixel_outside_filled_area - block_rect.X; + else + break; + } + if (clip_rect.IntersectsWith (block_rect)) + renderer.DrawBackground (dc, block_rect, clip_rect); + block_rect.X += increment; + block_count++; + } + break; + } + } + #endregion + #region RadioButton + protected override void RadioButton_DrawButton (RadioButton radio_button, Graphics dc, ButtonState state, Rectangle radiobutton_rectangle) { + if (radio_button.Appearance == Appearance.Normal && radio_button.FlatStyle == FlatStyle.System) { + RadioButtonRenderer.DrawRadioButton ( + dc, + new Point (radiobutton_rectangle.Left, radiobutton_rectangle.Top), + GetRadioButtonState (radio_button) + ); + return; + } + base.RadioButton_DrawButton(radio_button, dc, state, radiobutton_rectangle); + } + static RadioButtonState GetRadioButtonState (RadioButton checkBox) + { + if (checkBox.Checked) { + if (!checkBox.Enabled) + return RadioButtonState.CheckedDisabled; + else if (checkBox.Pressed) + return RadioButtonState.CheckedPressed; + else if (checkBox.Entered) + return RadioButtonState.CheckedHot; + return RadioButtonState.CheckedNormal; + } else { + if (!checkBox.Enabled) + return RadioButtonState.UncheckedDisabled; + else if (checkBox.Pressed) + return RadioButtonState.UncheckedPressed; + else if (checkBox.Entered) + return RadioButtonState.UncheckedHot; + return RadioButtonState.UncheckedNormal; + } + } + #endregion + #region ScrollBar + public override void DrawScrollBar (Graphics dc, Rectangle clip, ScrollBar bar) + { + if (!RenderClientAreas || + !ScrollBarAreElementsDefined) { + base.DrawScrollBar (dc, clip, bar); + return; + } + VisualStyleElement element; + VisualStyleRenderer renderer; + int scroll_button_width = bar.scrollbutton_width; + int scroll_button_height = bar.scrollbutton_height; + if (bar.vert) { + bar.FirstArrowArea = new Rectangle (0, 0, bar.Width, scroll_button_height); + bar.SecondArrowArea = new Rectangle ( + 0, + bar.ClientRectangle.Height - scroll_button_height, + bar.Width, + scroll_button_height); + Rectangle thumb_pos = bar.ThumbPos; + thumb_pos.Width = bar.Width; + bar.ThumbPos = thumb_pos; + #region Background, upper track + if (bar.thumb_moving == ScrollBar.ThumbMoving.Backwards) + element = VisualStyleElement.ScrollBar.LowerTrackVertical.Pressed; + else + element = bar.Enabled ? + VisualStyleElement.ScrollBar.LowerTrackVertical.Normal : + VisualStyleElement.ScrollBar.LowerTrackVertical.Disabled; + renderer = new VisualStyleRenderer (element); + Rectangle upper_track_rect = new Rectangle ( + 0, + 0, + bar.ClientRectangle.Width, + bar.ThumbPos.Top); + if (clip.IntersectsWith (upper_track_rect)) + renderer.DrawBackground (dc, upper_track_rect, clip); + #endregion + #region Background, lower track + if (bar.thumb_moving == ScrollBar.ThumbMoving.Forward) + element = VisualStyles.VisualStyleElement.ScrollBar.LowerTrackVertical.Pressed; + else + element = bar.Enabled ? + VisualStyleElement.ScrollBar.LowerTrackVertical.Normal : + VisualStyleElement.ScrollBar.LowerTrackVertical.Disabled; + renderer = new VisualStyleRenderer (element); + Rectangle lower_track_rect = new Rectangle ( + 0, + bar.ThumbPos.Bottom, + bar.ClientRectangle.Width, + bar.ClientRectangle.Height - bar.ThumbPos.Bottom); + if (clip.IntersectsWith (lower_track_rect)) + renderer.DrawBackground (dc, lower_track_rect, clip); + #endregion + #region Buttons + if (clip.IntersectsWith (bar.FirstArrowArea)) { + if (!bar.Enabled) + element = VisualStyleElement.ScrollBar.ArrowButton.UpDisabled; + else if (bar.firstbutton_state == ButtonState.Pushed) + element = VisualStyleElement.ScrollBar.ArrowButton.UpPressed; + else if (bar.FirstButtonEntered) + element = VisualStyleElement.ScrollBar.ArrowButton.UpHot; + else if (ScrollBarHasHoverArrowButtonStyleVisualStyles && bar.Entered) + element = VisualStyleElement.ScrollBar.ArrowButton.UpHover; + else + element = VisualStyleElement.ScrollBar.ArrowButton.UpNormal; + renderer = new VisualStyleRenderer (element); + renderer.DrawBackground (dc, bar.FirstArrowArea); + } + if (clip.IntersectsWith (bar.SecondArrowArea)) { + if (!bar.Enabled) + element = VisualStyleElement.ScrollBar.ArrowButton.DownDisabled; + else if (bar.secondbutton_state == ButtonState.Pushed) + element = VisualStyleElement.ScrollBar.ArrowButton.DownPressed; + else if (bar.SecondButtonEntered) + element = VisualStyleElement.ScrollBar.ArrowButton.DownHot; + else if (ScrollBarHasHoverArrowButtonStyleVisualStyles && bar.Entered) + element = VisualStyleElement.ScrollBar.ArrowButton.DownHover; + else + element = VisualStyleElement.ScrollBar.ArrowButton.DownNormal; + renderer = new VisualStyleRenderer (element); + renderer.DrawBackground (dc, bar.SecondArrowArea); + } + #endregion + #region Thumb and grip + if (!bar.Enabled) + element = VisualStyleElement.ScrollBar.LowerTrackVertical.Disabled; + else if (bar.ThumbPressed) + element = VisualStyleElement.ScrollBar.ThumbButtonVertical.Pressed; + else if (bar.ThumbEntered) + element = VisualStyleElement.ScrollBar.ThumbButtonVertical.Hot; + else + element = VisualStyleElement.ScrollBar.ThumbButtonVertical.Normal; + renderer = new VisualStyleRenderer (element); + renderer.DrawBackground (dc, bar.ThumbPos, clip); + + if (bar.Enabled && bar.ThumbPos.Height >= 20) { + element = VisualStyleElement.ScrollBar.GripperVertical.Normal; + if (VisualStyleRenderer.IsElementDefined (element)) { + renderer = new VisualStyleRenderer (element); + renderer.DrawBackground (dc, bar.ThumbPos, clip); + } + } + #endregion + } else { + bar.FirstArrowArea = new Rectangle (0, 0, scroll_button_width, bar.Height); + bar.SecondArrowArea = new Rectangle ( + bar.ClientRectangle.Width - scroll_button_width, + 0, + scroll_button_width, + bar.Height); + Rectangle thumb_pos = bar.ThumbPos; + thumb_pos.Height = bar.Height; + bar.ThumbPos = thumb_pos; + #region Background, left track + if (bar.thumb_moving == ScrollBar.ThumbMoving.Backwards) + element = VisualStyleElement.ScrollBar.LeftTrackHorizontal.Pressed; + else + element = bar.Enabled ? + VisualStyleElement.ScrollBar.LeftTrackHorizontal.Normal : + VisualStyleElement.ScrollBar.LeftTrackHorizontal.Disabled; + renderer = new VisualStyleRenderer (element); + Rectangle left_track_rect = new Rectangle ( + 0, + 0, + bar.ThumbPos.Left, + bar.ClientRectangle.Height); + if (clip.IntersectsWith (left_track_rect)) + renderer.DrawBackground (dc, left_track_rect, clip); + #endregion + #region Background, right track + if (bar.thumb_moving == ScrollBar.ThumbMoving.Forward) + element = VisualStyleElement.ScrollBar.RightTrackHorizontal.Pressed; + else + element = bar.Enabled ? + VisualStyleElement.ScrollBar.RightTrackHorizontal.Normal : + VisualStyleElement.ScrollBar.RightTrackHorizontal.Disabled; + renderer = new VisualStyleRenderer (element); + Rectangle right_track_rect = new Rectangle ( + bar.ThumbPos.Right, + 0, + bar.ClientRectangle.Width - bar.ThumbPos.Right, + bar.ClientRectangle.Height); + if (clip.IntersectsWith (right_track_rect)) + renderer.DrawBackground (dc, right_track_rect, clip); + #endregion + #region Buttons + if (clip.IntersectsWith (bar.FirstArrowArea)) { + if (!bar.Enabled) + element = VisualStyleElement.ScrollBar.ArrowButton.LeftDisabled; + else if (bar.firstbutton_state == ButtonState.Pushed) + element = VisualStyleElement.ScrollBar.ArrowButton.LeftPressed; + else if (bar.FirstButtonEntered) + element = VisualStyleElement.ScrollBar.ArrowButton.LeftHot; + else if (ScrollBarHasHoverArrowButtonStyleVisualStyles && bar.Entered) + element = VisualStyleElement.ScrollBar.ArrowButton.LeftHover; + else + element = VisualStyleElement.ScrollBar.ArrowButton.LeftNormal; + renderer = new VisualStyleRenderer (element); + renderer.DrawBackground (dc, bar.FirstArrowArea); + } + if (clip.IntersectsWith (bar.SecondArrowArea)) { + if (!bar.Enabled) + element = VisualStyleElement.ScrollBar.ArrowButton.RightDisabled; + else if (bar.secondbutton_state == ButtonState.Pushed) + element = VisualStyleElement.ScrollBar.ArrowButton.RightPressed; + else if (bar.SecondButtonEntered) + element = VisualStyleElement.ScrollBar.ArrowButton.RightHot; + else if (ScrollBarHasHoverArrowButtonStyleVisualStyles && bar.Entered) + element = VisualStyleElement.ScrollBar.ArrowButton.RightHover; + else + element = VisualStyleElement.ScrollBar.ArrowButton.RightNormal; + renderer = new VisualStyleRenderer (element); + renderer.DrawBackground (dc, bar.SecondArrowArea); + } + #endregion + #region Thumb and grip + if (!bar.Enabled) + element = VisualStyleElement.ScrollBar.RightTrackHorizontal.Disabled; + else if (bar.ThumbPressed) + element = VisualStyleElement.ScrollBar.ThumbButtonHorizontal.Pressed; + else if (bar.ThumbEntered) + element = VisualStyleElement.ScrollBar.ThumbButtonHorizontal.Hot; + else + element = VisualStyleElement.ScrollBar.ThumbButtonHorizontal.Normal; + renderer = new VisualStyleRenderer (element); + renderer.DrawBackground (dc, bar.ThumbPos, clip); + + if (bar.Enabled && bar.ThumbPos.Height >= 20) { + element = VisualStyleElement.ScrollBar.GripperHorizontal.Normal; + if (VisualStyleRenderer.IsElementDefined (element)) { + renderer = new VisualStyleRenderer (element); + renderer.DrawBackground (dc, bar.ThumbPos, clip); + } + } + #endregion + } + } + public override bool ScrollBarHasHotElementStyles { + get { + if (!RenderClientAreas) + return base.ScrollBarHasHotElementStyles; + return ScrollBarAreElementsDefined; + } + } + public override bool ScrollBarHasPressedThumbStyle { + get { + if (!RenderClientAreas) + return base.ScrollBarHasPressedThumbStyle; + return ScrollBarAreElementsDefined; + } + } + const int WindowsVistaMajorVersion = 6; + static bool ScrollBarHasHoverArrowButtonStyleVisualStyles = + Environment.OSVersion.Version.Major >= WindowsVistaMajorVersion; + public override bool ScrollBarHasHoverArrowButtonStyle { + get { + if (RenderClientAreas && + ScrollBarHasHoverArrowButtonStyleVisualStyles) + return ScrollBarAreElementsDefined; + return base.ScrollBarHasHoverArrowButtonStyle; + } + } + static bool ScrollBarAreElementsDefined { + get { + return + VisualStyleRenderer.IsElementDefined (VisualStyleElement.ScrollBar.ArrowButton.DownDisabled) && + VisualStyleRenderer.IsElementDefined (VisualStyleElement.ScrollBar.LeftTrackHorizontal.Disabled) && + VisualStyleRenderer.IsElementDefined (VisualStyleElement.ScrollBar.LowerTrackVertical.Disabled) && + VisualStyleRenderer.IsElementDefined (VisualStyleElement.ScrollBar.RightTrackHorizontal.Disabled) && + VisualStyleRenderer.IsElementDefined (VisualStyleElement.ScrollBar.ThumbButtonHorizontal.Disabled) && + VisualStyleRenderer.IsElementDefined (VisualStyleElement.ScrollBar.ThumbButtonVertical.Disabled) && + VisualStyleRenderer.IsElementDefined (VisualStyleElement.ScrollBar.UpperTrackVertical.Disabled); + } + } + #endregion + #region StatusBar + protected override void DrawStatusBarBackground(Graphics dc, Rectangle clip, StatusBar sb) { + if (!RenderClientAreas) { + base.DrawStatusBarBackground (dc, clip, sb); + return; + } + VisualStyleElement element = VisualStyleElement.Status.Bar.Normal; + if (!VisualStyleRenderer.IsElementDefined (element)) { + base.DrawStatusBarBackground (dc, clip, sb); + return; + } + new VisualStyleRenderer (element).DrawBackground (dc, sb.ClientRectangle, clip); + } + protected override void DrawStatusBarSizingGrip (Graphics dc, Rectangle clip, StatusBar sb, Rectangle area) + { + if (!RenderClientAreas) { + base.DrawStatusBarSizingGrip (dc, clip, sb, area); + return; + } + VisualStyleElement element = VisualStyleElement.Status.Gripper.Normal; + if (!VisualStyleRenderer.IsElementDefined (element)) { + base.DrawStatusBarSizingGrip (dc, clip, sb, area); + return; + } + VisualStyleRenderer renderer = new VisualStyleRenderer (element); + Rectangle sizing_grip_rectangle = new Rectangle (Point.Empty, renderer.GetPartSize (dc, ThemeSizeType.True)); + sizing_grip_rectangle.X = sb.Width - sizing_grip_rectangle.Width; + sizing_grip_rectangle.Y = sb.Height - sizing_grip_rectangle.Height; + renderer.DrawBackground (dc, sizing_grip_rectangle, clip); + } + protected override void DrawStatusBarPanelBackground (Graphics dc, Rectangle area, StatusBarPanel panel) + { + if (!RenderClientAreas) { + base.DrawStatusBarPanelBackground (dc, area, panel); + return; + } + VisualStyleElement element = VisualStyleElement.Status.Pane.Normal; + if (!VisualStyleRenderer.IsElementDefined (element)) { + base.DrawStatusBarPanelBackground (dc, area, panel); + return; + } + new VisualStyleRenderer (element).DrawBackground (dc, area); + } + #endregion + #region TextBoxBase + static bool TextBoxBaseShouldPaint (TextBoxBase textBoxBase) + { + return textBoxBase.BorderStyle == BorderStyle.Fixed3D; + } + static VisualStyleElement TextBoxBaseGetVisualStyleElement (TextBoxBase textBoxBase) + { + if (!textBoxBase.Enabled) + return VisualStyleElement.TextBox.TextEdit.Disabled; + if (textBoxBase.ReadOnly) + return VisualStyleElement.TextBox.TextEdit.ReadOnly; + if (textBoxBase.Entered) + return VisualStyleElement.TextBox.TextEdit.Hot; + if (textBoxBase.Focused) + return VisualStyleElement.TextBox.TextEdit.Focused; + return VisualStyleElement.TextBox.TextEdit.Normal; + } + public override void TextBoxBaseFillBackground (TextBoxBase textBoxBase, Graphics g, Rectangle clippingArea) + { + if (!RenderClientAreas || + !TextBoxBaseShouldPaint (textBoxBase)) { + base.TextBoxBaseFillBackground (textBoxBase, g, clippingArea); + return; + } + VisualStyleElement element = TextBoxBaseGetVisualStyleElement (textBoxBase); + if (!VisualStyleRenderer.IsElementDefined (element)) { + base.TextBoxBaseFillBackground (textBoxBase, g, clippingArea); + return; + } + Rectangle bounds = new Rectangle(Point.Empty, textBoxBase.Size); + bounds.X -= (bounds.Width - textBoxBase.ClientSize.Width) / 2; + bounds.Y -= (bounds.Height - textBoxBase.ClientSize.Height) / 2; + new VisualStyleRenderer (element).DrawBackground (g, bounds, clippingArea); + } + public override bool TextBoxBaseHandleWmNcPaint (TextBoxBase textBoxBase, ref Message m) + { + if (!RenderClientAreas || + !TextBoxBaseShouldPaint (textBoxBase)) + return base.TextBoxBaseHandleWmNcPaint (textBoxBase, ref m); + VisualStyleElement element = TextBoxBaseGetVisualStyleElement (textBoxBase); + if (!VisualStyleRenderer.IsElementDefined (element)) + return base.TextBoxBaseHandleWmNcPaint (textBoxBase, ref m); + PaintEventArgs e = XplatUI.PaintEventStart (ref m, textBoxBase.Handle, false); + new VisualStyleRenderer (element).DrawBackgroundExcludingArea ( + e.Graphics, + new Rectangle (Point.Empty, textBoxBase.Size), + new Rectangle (new Point ((textBoxBase.Width - textBoxBase.ClientSize.Width) / 2, + (textBoxBase.Height - textBoxBase.ClientSize.Height) / 2), + textBoxBase.ClientSize)); + XplatUI.PaintEventEnd (ref m, textBoxBase.Handle, false); + return true; + } + public override bool TextBoxBaseShouldPaintBackground (TextBoxBase textBoxBase) + { + if (!RenderClientAreas || + !TextBoxBaseShouldPaint (textBoxBase)) + return base.TextBoxBaseShouldPaintBackground (textBoxBase); + VisualStyleElement element = TextBoxBaseGetVisualStyleElement (textBoxBase); + if (!VisualStyleRenderer.IsElementDefined (element)) + return base.TextBoxBaseShouldPaintBackground (textBoxBase); + return new VisualStyleRenderer (element).IsBackgroundPartiallyTransparent (); + } + #endregion + /* FIXME: I SAID NO. + #region ToolBar + static bool ToolBarIsDisabled (ToolBarItem item) + { + return !item.Button.Enabled; + } + static bool ToolBarIsPressed (ToolBarItem item) + { + return item.Pressed; + } + static bool ToolBarIsChecked (ToolBarItem item) + { + return item.Button.Pushed; + } + static bool ToolBarIsHot (ToolBarItem item) + { + return item.Hilight; + } + #region Border + protected override void DrawToolBarButtonBorder (Graphics dc, ToolBarItem item, bool is_flat) + { + if (!RenderClientAreas) { + base.DrawToolBarButtonBorder (dc, item, is_flat); + return; + } + if (item.Button.Style == ToolBarButtonStyle.Separator) + return; + VisualStyleElement element; + if (item.Button.Style == ToolBarButtonStyle.DropDownButton) + element = ToolBarGetDropDownButtonVisualStyleElement (item); + else + element = ToolBarGetButtonVisualStyleElement (item); + if (!VisualStyleRenderer.IsElementDefined (element)) { + base.DrawToolBarButtonBorder (dc, item, is_flat); + return; + } + Rectangle rectangle = item.Rectangle; + if (item.Button.Style == ToolBarButtonStyle.DropDownButton && item.Button.Parent.DropDownArrows) + rectangle.Width -= ToolBarDropDownWidth; + new VisualStyleRenderer (element).DrawBackground (dc, rectangle); + } + private static VisualStyleElement ToolBarGetDropDownButtonVisualStyleElement (ToolBarItem item) + { + if (item.Button.Parent.DropDownArrows) { + if (ToolBarIsDisabled (item)) + return VisualStyleElement.ToolBar.SplitButton.Disabled; + if (ToolBarIsPressed (item)) + return VisualStyleElement.ToolBar.SplitButton.Pressed; + if (ToolBarIsChecked (item)) + if (ToolBarIsHot (item)) + return VisualStyleElement.ToolBar.SplitButton.HotChecked; + else + return VisualStyleElement.ToolBar.SplitButton.Checked; + if (ToolBarIsHot (item)) + return VisualStyleElement.ToolBar.SplitButton.Hot; + return VisualStyleElement.ToolBar.SplitButton.Normal; + } else { + if (ToolBarIsDisabled (item)) + return VisualStyleElement.ToolBar.DropDownButton.Disabled; + if (ToolBarIsPressed (item)) + return VisualStyleElement.ToolBar.DropDownButton.Pressed; + if (ToolBarIsChecked (item)) + if (ToolBarIsHot (item)) + return VisualStyleElement.ToolBar.DropDownButton.HotChecked; + else + return VisualStyleElement.ToolBar.DropDownButton.Checked; + if (ToolBarIsHot (item)) + return VisualStyleElement.ToolBar.DropDownButton.Hot; + return VisualStyleElement.ToolBar.DropDownButton.Normal; + } + } + private static VisualStyleElement ToolBarGetButtonVisualStyleElement (ToolBarItem item) + { + if (ToolBarIsDisabled (item)) + return VisualStyleElement.ToolBar.Button.Disabled; + if (ToolBarIsPressed (item)) + return VisualStyleElement.ToolBar.Button.Pressed; + if (ToolBarIsChecked (item)) + if (ToolBarIsHot (item)) + return VisualStyleElement.ToolBar.Button.HotChecked; + else + return VisualStyleElement.ToolBar.Button.Checked; + if (ToolBarIsHot (item)) + return VisualStyleElement.ToolBar.Button.Hot; + return VisualStyleElement.ToolBar.Button.Normal; + } + #endregion + #region Separator + protected override void DrawToolBarSeparator (Graphics dc, ToolBarItem item) + { + if (!RenderClientAreas) { + base.DrawToolBarSeparator (dc, item); + return; + } + VisualStyleElement element = ToolBarGetSeparatorVisualStyleElement (item); + if (!VisualStyleRenderer.IsElementDefined (element)) { + base.DrawToolBarSeparator (dc, item); + return; + } + new VisualStyleRenderer (element).DrawBackground (dc, item.Rectangle); + } + static VisualStyleElement ToolBarGetSeparatorVisualStyleElement (ToolBarItem toolBarItem) + { + return toolBarItem.Button.Parent.Vertical ? + VisualStyleElement.ToolBar.SeparatorVertical.Normal : + VisualStyleElement.ToolBar.SeparatorHorizontal.Normal; + } + #endregion + #region Toggle button background + protected override void DrawToolBarToggleButtonBackground (Graphics dc, ToolBarItem item) + { + if (!RenderClientAreas || + !VisualStyleRenderer.IsElementDefined (ToolBarGetButtonVisualStyleElement (item))) + base.DrawToolBarToggleButtonBackground (dc, item); + } + #endregion + #region Drop down arrow + protected override void DrawToolBarDropDownArrow (Graphics dc, ToolBarItem item, bool is_flat) + { + if (!RenderClientAreas) { + base.DrawToolBarDropDownArrow (dc, item, is_flat); + return; + } + VisualStyleElement element = ToolBarGetDropDownArrowVisualStyleElement (item); + if (!VisualStyleRenderer.IsElementDefined (element)) { + base.DrawToolBarDropDownArrow (dc, item, is_flat); + return; + } + Rectangle rect = item.Rectangle; + rect.X = item.Rectangle.Right - ToolBarDropDownWidth; + rect.Width = ToolBarDropDownWidth; + new VisualStyleRenderer (element).DrawBackground (dc, rect); + } + private static VisualStyleElement ToolBarGetDropDownArrowVisualStyleElement (ToolBarItem item) + { + if (ToolBarIsDisabled (item)) + return VisualStyleElement.ToolBar.SplitButtonDropDown.Disabled; + if (ToolBarIsPressed (item)) + return VisualStyleElement.ToolBar.SplitButtonDropDown.Pressed; + if (ToolBarIsChecked (item)) + if (ToolBarIsHot (item)) + return VisualStyleElement.ToolBar.SplitButtonDropDown.HotChecked; + else + return VisualStyleElement.ToolBar.SplitButtonDropDown.Checked; + if (ToolBarIsHot (item)) + return VisualStyleElement.ToolBar.SplitButtonDropDown.Hot; + return VisualStyleElement.ToolBar.SplitButtonDropDown.Normal; + } + #endregion + public override bool ToolBarHasHotElementStyles (ToolBar toolBar) + { + if (!RenderClientAreas) + return base.ToolBarHasHotElementStyles (toolBar); + return true; + } + public override bool ToolBarHasHotCheckedElementStyles { + get { + if (!RenderClientAreas) + return base.ToolBarHasHotCheckedElementStyles; + return true; + } + } + #endregion*/ + #region ToolTip + protected override void ToolTipDrawBackground (Graphics dc, Rectangle clip_rectangle, ToolTip.ToolTipWindow control) + { + if (!RenderClientAreas) { + base.ToolTipDrawBackground (dc, clip_rectangle, control); + return; + } + VisualStyleElement element = VisualStyleElement.ToolTip.Standard.Normal; + if (!VisualStyleRenderer.IsElementDefined (element)) { + base.ToolTipDrawBackground (dc, clip_rectangle, control); + return; + } + new VisualStyleRenderer (element).DrawBackground (dc, control.ClientRectangle); + } + public override bool ToolTipTransparentBackground { + get { + if (!RenderClientAreas) + return base.ToolTipTransparentBackground; + VisualStyleElement element = VisualStyleElement.ToolTip.Standard.Normal; + if (!VisualStyleRenderer.IsElementDefined (element)) + return base.ToolTipTransparentBackground; + return new VisualStyleRenderer (element).IsBackgroundPartiallyTransparent (); + } + } + #endregion + #region TrackBar + protected override Size TrackBarGetThumbSize (TrackBar trackBar) + { + if (!RenderClientAreas) + return base.TrackBarGetThumbSize (trackBar); + VisualStyleElement element = TrackBarGetThumbVisualStyleElement (trackBar); + if (!VisualStyleRenderer.IsElementDefined (element)) + return base.TrackBarGetThumbSize (trackBar); + Graphics g = trackBar.CreateGraphics (); + Size result = new VisualStyleRenderer (element).GetPartSize (g, ThemeSizeType.True); + g.Dispose (); + return trackBar.Orientation == Orientation.Horizontal ? result : TrackBarRotateVerticalThumbSize (result); + } + static VisualStyleElement TrackBarGetThumbVisualStyleElement (TrackBar trackBar) + { + if (trackBar.Orientation == Orientation.Horizontal) + switch (trackBar.TickStyle) { + case TickStyle.BottomRight: + case TickStyle.None: + return TrackBarGetHorizontalThumbBottomVisualStyleElement (trackBar); + case TickStyle.TopLeft: + return TrackBarGetHorizontalThumbTopVisualStyleElement (trackBar); + default: + return TrackBarGetHorizontalThumbVisualStyleElement (trackBar); + } + else + switch (trackBar.TickStyle) { + case TickStyle.BottomRight: + case TickStyle.None: + return TrackBarGetVerticalThumbRightVisualStyleElement (trackBar); + case TickStyle.TopLeft: + return TrackBarGetVerticalThumbLeftVisualStyleElement (trackBar); + default: + return TrackBarGetVerticalThumbVisualStyleElement (trackBar); + } + } + static Size TrackBarRotateVerticalThumbSize (Size value) + { + int temporary = value.Width; + value.Width = value.Height; + value.Height = temporary; + return value; + } + #region Track + protected override void TrackBarDrawHorizontalTrack (Graphics dc, Rectangle thumb_area, Point channel_startpoint, Rectangle clippingArea) + { + if (!RenderClientAreas) { + base.TrackBarDrawHorizontalTrack (dc, thumb_area, channel_startpoint, clippingArea); + return; + } + VisualStyleElement element = VisualStyleElement.TrackBar.Track.Normal; + if (!VisualStyleRenderer.IsElementDefined (element)) { + base.TrackBarDrawHorizontalTrack (dc, thumb_area, channel_startpoint, clippingArea); + return; + } + VisualStyleRenderer renderer = new VisualStyleRenderer (element); + renderer.DrawBackground (dc, new Rectangle (channel_startpoint, new Size (thumb_area.Width, renderer.GetPartSize (dc, ThemeSizeType.True).Height)), clippingArea); + } + protected override void TrackBarDrawVerticalTrack (Graphics dc, Rectangle thumb_area, Point channel_startpoint, Rectangle clippingArea) + { + if (!RenderClientAreas) { + base.TrackBarDrawVerticalTrack (dc, thumb_area, channel_startpoint, clippingArea); + return; + } + VisualStyleElement element = VisualStyleElement.TrackBar.TrackVertical.Normal; + if (!VisualStyleRenderer.IsElementDefined (element)) { + base.TrackBarDrawVerticalTrack (dc, thumb_area, channel_startpoint, clippingArea); + return; + } + VisualStyleRenderer renderer = new VisualStyleRenderer (element); + renderer.DrawBackground (dc, new Rectangle (channel_startpoint, new Size (renderer.GetPartSize (dc, ThemeSizeType.True).Width, thumb_area.Height)), clippingArea); + } + #endregion + #region Thumb + static bool TrackBarIsDisabled (TrackBar trackBar) + { + return !trackBar.Enabled; + } + static bool TrackBarIsHot (TrackBar trackBar) + { + return trackBar.ThumbEntered; + } + static bool TrackBarIsPressed (TrackBar trackBar) + { + return trackBar.thumb_pressed; + } + static bool TrackBarIsFocused (TrackBar trackBar) + { + return trackBar.Focused; + } + #region Horizontal + protected override void TrackBarDrawHorizontalThumbBottom (Graphics dc, Rectangle thumb_pos, Brush br_thumb, Rectangle clippingArea, TrackBar trackBar) + { + if (!RenderClientAreas) { + base.TrackBarDrawHorizontalThumbBottom (dc, thumb_pos, br_thumb, clippingArea, trackBar); + return; + } + VisualStyleElement element = TrackBarGetHorizontalThumbBottomVisualStyleElement (trackBar); + if (!VisualStyleRenderer.IsElementDefined (element)) { + base.TrackBarDrawHorizontalThumbBottom (dc, thumb_pos, br_thumb, clippingArea, trackBar); + return; + } + new VisualStyleRenderer (element).DrawBackground (dc, thumb_pos, clippingArea); + } + static VisualStyleElement TrackBarGetHorizontalThumbBottomVisualStyleElement (TrackBar trackBar) + { + if (TrackBarIsDisabled (trackBar)) + return VisualStyleElement.TrackBar.ThumbBottom.Disabled; + else if (TrackBarIsPressed (trackBar)) + return VisualStyleElement.TrackBar.ThumbBottom.Pressed; + else if (TrackBarIsHot (trackBar)) + return VisualStyleElement.TrackBar.ThumbBottom.Hot; + else if (TrackBarIsFocused (trackBar)) + return VisualStyleElement.TrackBar.ThumbBottom.Focused; + return VisualStyleElement.TrackBar.ThumbBottom.Normal; + } + protected override void TrackBarDrawHorizontalThumbTop (Graphics dc, Rectangle thumb_pos, Brush br_thumb, Rectangle clippingArea, TrackBar trackBar) + { + if (!RenderClientAreas) { + base.TrackBarDrawHorizontalThumbTop (dc, thumb_pos, br_thumb, clippingArea, trackBar); + return; + } + VisualStyleElement element = TrackBarGetHorizontalThumbTopVisualStyleElement (trackBar); + if (!VisualStyleRenderer.IsElementDefined (element)) { + base.TrackBarDrawHorizontalThumbTop (dc, thumb_pos, br_thumb, clippingArea, trackBar); + return; + } + new VisualStyleRenderer (element).DrawBackground (dc, thumb_pos, clippingArea); + } + static VisualStyleElement TrackBarGetHorizontalThumbTopVisualStyleElement (TrackBar trackBar) + { + if (TrackBarIsDisabled (trackBar)) + return VisualStyleElement.TrackBar.ThumbTop.Disabled; + else if (TrackBarIsPressed (trackBar)) + return VisualStyleElement.TrackBar.ThumbTop.Pressed; + else if (TrackBarIsHot (trackBar)) + return VisualStyleElement.TrackBar.ThumbTop.Hot; + else if (TrackBarIsFocused (trackBar)) + return VisualStyleElement.TrackBar.ThumbTop.Focused; + return VisualStyleElement.TrackBar.ThumbTop.Normal; + } + protected override void TrackBarDrawHorizontalThumb (Graphics dc, Rectangle thumb_pos, Brush br_thumb, Rectangle clippingArea, TrackBar trackBar) + { + if (!RenderClientAreas) { + base.TrackBarDrawHorizontalThumb (dc, thumb_pos, br_thumb, clippingArea, trackBar); + return; + } + VisualStyleElement element = TrackBarGetHorizontalThumbVisualStyleElement (trackBar); + if (!VisualStyleRenderer.IsElementDefined (element)) { + base.TrackBarDrawHorizontalThumb (dc, thumb_pos, br_thumb, clippingArea, trackBar); + return; + } + new VisualStyleRenderer (element).DrawBackground (dc, thumb_pos, clippingArea); + } + static VisualStyleElement TrackBarGetHorizontalThumbVisualStyleElement (TrackBar trackBar) + { + if (TrackBarIsDisabled (trackBar)) + return VisualStyleElement.TrackBar.Thumb.Disabled; + else if (TrackBarIsPressed (trackBar)) + return VisualStyleElement.TrackBar.Thumb.Pressed; + else if (TrackBarIsHot (trackBar)) + return VisualStyleElement.TrackBar.Thumb.Hot; + else if (TrackBarIsFocused (trackBar)) + return VisualStyleElement.TrackBar.Thumb.Focused; + return VisualStyleElement.TrackBar.Thumb.Normal; + } + #endregion + #region Vertical + static Rectangle TrackBarRotateVerticalThumbSize (Rectangle value) + { + int temporary = value.Width; + value.Width = value.Height; + value.Height = temporary; + return value; + } + protected override void TrackBarDrawVerticalThumbRight (Graphics dc, Rectangle thumb_pos, Brush br_thumb, Rectangle clippingArea, TrackBar trackBar) + { + if (!RenderClientAreas) { + base.TrackBarDrawVerticalThumbRight (dc, thumb_pos, br_thumb, clippingArea, trackBar); + return; + } + VisualStyleElement element = TrackBarGetVerticalThumbRightVisualStyleElement (trackBar); + if (!VisualStyleRenderer.IsElementDefined (element)) { + base.TrackBarDrawVerticalThumbRight (dc, thumb_pos, br_thumb, clippingArea, trackBar); + return; + } + new VisualStyleRenderer (element).DrawBackground (dc, TrackBarRotateVerticalThumbSize (thumb_pos), clippingArea); + } + static VisualStyleElement TrackBarGetVerticalThumbRightVisualStyleElement (TrackBar trackBar) + { + if (TrackBarIsDisabled (trackBar)) + return VisualStyleElement.TrackBar.ThumbRight.Disabled; + else if (TrackBarIsPressed (trackBar)) + return VisualStyleElement.TrackBar.ThumbRight.Pressed; + else if (TrackBarIsHot (trackBar)) + return VisualStyleElement.TrackBar.ThumbRight.Hot; + else if (TrackBarIsFocused (trackBar)) + return VisualStyleElement.TrackBar.ThumbRight.Focused; + return VisualStyleElement.TrackBar.ThumbRight.Normal; + } + protected override void TrackBarDrawVerticalThumbLeft (Graphics dc, Rectangle thumb_pos, Brush br_thumb, Rectangle clippingArea, TrackBar trackBar) + { + if (!RenderClientAreas) { + base.TrackBarDrawVerticalThumbLeft (dc, thumb_pos, br_thumb, clippingArea, trackBar); + return; + } + VisualStyleElement element = TrackBarGetVerticalThumbLeftVisualStyleElement (trackBar); + if (!VisualStyleRenderer.IsElementDefined (element)) { + base.TrackBarDrawVerticalThumbLeft (dc, thumb_pos, br_thumb, clippingArea, trackBar); + return; + } + new VisualStyleRenderer (element).DrawBackground (dc, TrackBarRotateVerticalThumbSize (thumb_pos), clippingArea); + } + static VisualStyleElement TrackBarGetVerticalThumbLeftVisualStyleElement (TrackBar trackBar) + { + if (TrackBarIsDisabled (trackBar)) + return VisualStyleElement.TrackBar.ThumbLeft.Disabled; + else if (TrackBarIsPressed (trackBar)) + return VisualStyleElement.TrackBar.ThumbLeft.Pressed; + else if (TrackBarIsHot (trackBar)) + return VisualStyleElement.TrackBar.ThumbLeft.Hot; + else if (TrackBarIsFocused (trackBar)) + return VisualStyleElement.TrackBar.ThumbLeft.Focused; + return VisualStyleElement.TrackBar.ThumbLeft.Normal; + } + protected override void TrackBarDrawVerticalThumb (Graphics dc, Rectangle thumb_pos, Brush br_thumb, Rectangle clippingArea, TrackBar trackBar) + { + if (!RenderClientAreas) { + base.TrackBarDrawVerticalThumb (dc, thumb_pos, br_thumb, clippingArea, trackBar); + return; + } + VisualStyleElement element = TrackBarGetVerticalThumbVisualStyleElement (trackBar); + if (!VisualStyleRenderer.IsElementDefined (element)) { + base.TrackBarDrawVerticalThumb (dc, thumb_pos, br_thumb, clippingArea, trackBar); + return; + } + new VisualStyleRenderer (element).DrawBackground (dc, TrackBarRotateVerticalThumbSize (thumb_pos), clippingArea); + } + static VisualStyleElement TrackBarGetVerticalThumbVisualStyleElement (TrackBar trackBar) + { + if (TrackBarIsDisabled (trackBar)) + return VisualStyleElement.TrackBar.ThumbVertical.Disabled; + else if (TrackBarIsPressed (trackBar)) + return VisualStyleElement.TrackBar.ThumbVertical.Pressed; + else if (TrackBarIsHot (trackBar)) + return VisualStyleElement.TrackBar.ThumbVertical.Hot; + else if (TrackBarIsFocused (trackBar)) + return VisualStyleElement.TrackBar.ThumbVertical.Focused; + return VisualStyleElement.TrackBar.ThumbVertical.Normal; + } + #endregion + #endregion + #region Ticks + const EdgeStyle TrackBarTickEdgeStyle = EdgeStyle.Bump; + const EdgeEffects TrackBarTickEdgeEffects = EdgeEffects.None; + #region Horizontal + protected override ITrackBarTickPainter TrackBarGetHorizontalTickPainter (Graphics g) + { + if (!RenderClientAreas || + !VisualStyleRenderer.IsElementDefined (VisualStyleElement.TrackBar.Ticks.Normal)) + return base.TrackBarGetHorizontalTickPainter (g); + return new TrackBarHorizontalTickPainter (g); + } + class TrackBarHorizontalTickPainter : ITrackBarTickPainter + { + readonly Graphics g; + readonly VisualStyleRenderer renderer; + public TrackBarHorizontalTickPainter (Graphics g) + { + this.g = g; + renderer = new VisualStyleRenderer (VisualStyleElement.TrackBar.Ticks.Normal); + } + public void Paint (float x1, float y1, float x2, float y2) + { + renderer.DrawEdge (g, new Rectangle ( + (int)Math.Round (x1), + (int)Math.Round (y1), + 1, + (int)Math.Round (y2 - y1) + 1), Edges.Left, TrackBarTickEdgeStyle, TrackBarTickEdgeEffects); + } + } + #endregion + #region Vertical + protected override ITrackBarTickPainter TrackBarGetVerticalTickPainter (Graphics g) + { + if (!RenderClientAreas || + !VisualStyleRenderer.IsElementDefined (VisualStyleElement.TrackBar.TicksVertical.Normal)) + return base.TrackBarGetVerticalTickPainter (g); + return new TrackBarVerticalTickPainter (g); + } + class TrackBarVerticalTickPainter : ITrackBarTickPainter + { + readonly Graphics g; + readonly VisualStyleRenderer renderer; + public TrackBarVerticalTickPainter (Graphics g) + { + this.g = g; + renderer = new VisualStyleRenderer (VisualStyleElement.TrackBar.TicksVertical.Normal); + } + public void Paint (float x1, float y1, float x2, float y2) + { + renderer.DrawEdge (g, new Rectangle ( + (int)Math.Round (x1), + (int)Math.Round (y1), + (int)Math.Round (x2 - x1) + 1, + 1), Edges.Top, TrackBarTickEdgeStyle, TrackBarTickEdgeEffects); + } + } + #endregion + #endregion + public override bool TrackBarHasHotThumbStyle { + get { + if (!RenderClientAreas) + return base.TrackBarHasHotThumbStyle; + return true; + } + } + #endregion + #region TreeView + [MonoInternalNote ("Use the sizing information provided by the VisualStyles API.")] + public override void TreeViewDrawNodePlusMinus (TreeView treeView, TreeNode node, Graphics dc, int x, int middle) + { + if (!RenderClientAreas) { + base.TreeViewDrawNodePlusMinus (treeView, node, dc, x, middle); + return; + } + VisualStyleElement element = node.IsExpanded ? + VisualStyleElement.TreeView.Glyph.Opened : + VisualStyleElement.TreeView.Glyph.Closed; + if (!VisualStyleRenderer.IsElementDefined (element)) { + base.TreeViewDrawNodePlusMinus (treeView, node, dc, x, middle); + return; + } + new VisualStyleRenderer (element).DrawBackground (dc, new Rectangle (x, middle - 4, 9, 9)); + } + #endregion + #region UpDownBase + public override void UpDownBaseDrawButton (Graphics g, Rectangle bounds, bool top, PushButtonState state) + { + if (!RenderClientAreas) { + base.UpDownBaseDrawButton (g, bounds, top, state); + return; + } + VisualStyleElement element; + if (top) + switch (state) { + case PushButtonState.Disabled: + element = VisualStyleElement.Spin.Up.Disabled; + break; + case PushButtonState.Pressed: + element = VisualStyleElement.Spin.Up.Pressed; + break; + case PushButtonState.Hot: + element = VisualStyleElement.Spin.Up.Hot; + break; + default: + element = VisualStyleElement.Spin.Up.Normal; + break; + } + else + switch (state) { + case PushButtonState.Disabled: + element = VisualStyleElement.Spin.Down.Disabled; + break; + case PushButtonState.Pressed: + element = VisualStyleElement.Spin.Down.Pressed; + break; + case PushButtonState.Hot: + element = VisualStyleElement.Spin.Down.Hot; + break; + default: + element = VisualStyleElement.Spin.Down.Normal; + break; + } + if (!VisualStyleRenderer.IsElementDefined (element)) { + base.UpDownBaseDrawButton (g, bounds, top, state); + return; + } + new VisualStyleRenderer (element).DrawBackground (g, bounds); + } + public override bool UpDownBaseHasHotButtonStyle { + get { + if (!RenderClientAreas) + return base.UpDownBaseHasHotButtonStyle; + return true; + } + } + #endregion + #endregion + + static bool AreEqual (VisualStyleElement value1, VisualStyleElement value2) + { + return + value1.ClassName == value1.ClassName && + value1.Part == value2.Part && + value1.State == value2.State; + } + + #region Measurement device context + static Widget control; + static IDeviceContext GetMeasurementDeviceContext () + { + if (control == null) + control = new Widget (); + return control.CreateGraphics (); + } + static void ReleaseMeasurementDeviceContext (IDeviceContext dc) + { + dc.Dispose (); + } + #endregion + } +} diff --git a/source/ShiftUI/Theming/ThemeWin32Classic.cs b/source/ShiftUI/Theming/ThemeWin32Classic.cs new file mode 100644 index 0000000..8c89066 --- /dev/null +++ b/source/ShiftUI/Theming/ThemeWin32Classic.cs @@ -0,0 +1,7815 @@ +// Permission is hereby granted, free of charge, to any person obtaining +// a copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to +// permit persons to whom the Software is furnished to do so, subject to +// the following conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// +// Copyright (c) 2004-2006 Novell, Inc. +// +// Authors: +// Jordi Mas i Hernandez, jordi@ximian.com +// Peter Bartok, pbartok@novell.com +// John BouAntoun, jba-mono@optusnet.com.au +// Marek Safar, marek.safar@seznam.cz +// Alexander Olk, alex.olk@googlemail.com +// + +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Drawing.Drawing2D; +using System.Drawing.Imaging; +using System.Drawing.Printing; +using System.Drawing.Text; +using System.Text; +using ShiftUI.Theming; +using System; + +namespace ShiftUI +{ + + internal class ThemeWin32Classic : Theme + { + public override Version Version { + get { + return new Version(0, 1, 0, 0); + } + } + + /* Hardcoded colour values not exposed in the API constants in all configurations */ + protected static readonly Color arrow_color = Color.Black; + protected static readonly Color pen_ticks_color = Color.Black; + protected static StringFormat string_format_menu_text; + protected static StringFormat string_format_menu_shortcut; + protected static StringFormat string_format_menu_menubar_text; + static ImageAttributes imagedisabled_attributes; + Font window_border_font; + const int SEPARATOR_HEIGHT = 6; + const int SEPARATOR_MIN_WIDTH = 20; + const int SM_CXBORDER = 1; + const int SM_CYBORDER = 1; + const int MENU_TAB_SPACE = 8; // Pixels added to the width of an item because of a tabd + const int MENU_BAR_ITEMS_SPACE = 8; // Space between menu bar items + const int CheckSize = 13; + + #region Principal Theme Methods + public ThemeWin32Classic () + { + ResetDefaults (); + } + + public override void ResetDefaults() { + defaultWindowBackColor = this.ColorWindow; + defaultWindowForeColor = this.ColorControlText; + window_border_font = null; + + /* Menu string formats */ + string_format_menu_text = new StringFormat (); + string_format_menu_text.LineAlignment = StringAlignment.Center; + string_format_menu_text.Alignment = StringAlignment.Near; + string_format_menu_text.HotkeyPrefix = HotkeyPrefix.Show; + string_format_menu_text.SetTabStops (0f, new float [] { 50f }); + string_format_menu_text.FormatFlags |= StringFormatFlags.NoWrap; + + string_format_menu_shortcut = new StringFormat (); + string_format_menu_shortcut.LineAlignment = StringAlignment.Center; + string_format_menu_shortcut.Alignment = StringAlignment.Far; + + string_format_menu_menubar_text = new StringFormat (); + string_format_menu_menubar_text.LineAlignment = StringAlignment.Center; + string_format_menu_menubar_text.Alignment = StringAlignment.Center; + string_format_menu_menubar_text.HotkeyPrefix = HotkeyPrefix.Show; + } + + public override bool DoubleBufferingSupported { + get {return true; } + } + + public override int HorizontalScrollBarHeight { + get { + return XplatUI.HorizontalScrollBarHeight; + } + } + + public override int VerticalScrollBarWidth { + get { + return XplatUI.VerticalScrollBarWidth; + } + } + + public override Font WindowBorderFont { + get { + return window_border_font ?? (window_border_font = new Font(FontFamily.GenericSansSerif, 8.25f, FontStyle.Bold)); + } + } + + #endregion // Principal Theme Methods + + #region Internal Methods + protected Brush GetControlBackBrush (Color c) { + if (c.ToArgb () == DefaultControlBackColor.ToArgb ()) + return SystemBrushes.Control; + return ResPool.GetSolidBrush (c); + } + + protected Brush GetControlForeBrush (Color c) { + if (c.ToArgb () == DefaultControlForeColor.ToArgb ()) + return SystemBrushes.ControlText; + return ResPool.GetSolidBrush (c); + } + #endregion // Internal Methods + + #region Widget + public override Font GetLinkFont (Widget control) + { + return new Font (control.Font.FontFamily, control.Font.Size, control.Font.Style | FontStyle.Underline, control.Font.Unit); + } + #endregion // Widget + + #region OwnerDraw Support + public override void DrawOwnerDrawBackground (DrawItemEventArgs e) + { + if ((e.State & DrawItemState.Selected) == DrawItemState.Selected) { + e.Graphics.FillRectangle (SystemBrushes.Highlight, e.Bounds); + return; + } + + e.Graphics.FillRectangle (ResPool.GetSolidBrush(e.BackColor), e.Bounds); + } + + public override void DrawOwnerDrawFocusRectangle (DrawItemEventArgs e) + { + if (e.State == DrawItemState.Focus) + CPDrawFocusRectangle (e.Graphics, e.Bounds, e.ForeColor, e.BackColor); + } + #endregion // OwnerDraw Support + + #region Button + #region Standard Button Style + public override void DrawButton (Graphics g, Button b, Rectangle textBounds, Rectangle imageBounds, Rectangle clipRectangle) + { + // Draw Button Background + DrawButtonBackground (g, b, clipRectangle); + + // If we have an image, draw it + if (imageBounds.Size != Size.Empty) + DrawButtonImage (g, b, imageBounds); + + // If we're focused, draw a focus rectangle + if (b.Focused && b.Enabled && b.ShowFocusCues) + DrawButtonFocus (g, b); + + // If we have text, draw it + if (textBounds != Rectangle.Empty) + DrawButtonText (g, b, textBounds); + } + + public virtual void DrawButtonBackground (Graphics g, Button button, Rectangle clipArea) + { + if (button.Pressed) + ThemeElements.DrawButton (g, button.ClientRectangle, ButtonThemeState.Pressed, button.BackColor, button.ForeColor); + else if (button.InternalSelected) + ThemeElements.DrawButton (g, button.ClientRectangle, ButtonThemeState.Default, button.BackColor, button.ForeColor); + else if (button.Entered) + ThemeElements.DrawButton (g, button.ClientRectangle, ButtonThemeState.Entered, button.BackColor, button.ForeColor); + else if (!button.Enabled) + ThemeElements.DrawButton (g, button.ClientRectangle, ButtonThemeState.Disabled, button.BackColor, button.ForeColor); + else + ThemeElements.DrawButton (g, button.ClientRectangle, ButtonThemeState.Normal, button.BackColor, button.ForeColor); + } + + public virtual void DrawButtonFocus (Graphics g, Button button) + { + WidgetPaint.DrawFocusRectangle (g, Rectangle.Inflate (button.ClientRectangle, -4, -4)); + } + + public virtual void DrawButtonImage (Graphics g, ButtonBase button, Rectangle imageBounds) + { + if (button.Enabled) + g.DrawImage (button.Image, imageBounds); + else + CPDrawImageDisabled (g, button.Image, imageBounds.Left, imageBounds.Top, ColorControl); + } + + public virtual void DrawButtonText (Graphics g, ButtonBase button, Rectangle textBounds) + { + // Ensure that at least one line is going to get displayed. + // Line limit does not ensure that despite its description. + if (button.Font != null && button.Font.Height > 0) + textBounds.Height = Math.Max (textBounds.Height, button.Font.Height); + + if (button.Enabled) + TextRenderer.DrawTextInternal (g, button.Text, button.Font, textBounds, button.ForeColor, button.TextFormatFlags, button.UseCompatibleTextRendering); + else + DrawStringDisabled20 (g, button.Text, button.Font, textBounds, button.BackColor, button.TextFormatFlags, button.UseCompatibleTextRendering); + } + #endregion + + #region FlatStyle Button Style + public override void DrawFlatButton (Graphics g, ButtonBase b, Rectangle textBounds, Rectangle imageBounds, Rectangle clipRectangle) + { + // Draw Button Background + if (b.BackgroundImage == null) + DrawFlatButtonBackground (g, b, clipRectangle); + + // If we have an image, draw it + if (imageBounds.Size != Size.Empty) + DrawFlatButtonImage (g, b, imageBounds); + + // If we're focused, draw a focus rectangle + if (b.Focused && b.Enabled && b.ShowFocusCues) + DrawFlatButtonFocus (g, b); + + // If we have text, draw it + if (textBounds != Rectangle.Empty) + DrawFlatButtonText (g, b, textBounds); + } + + public virtual void DrawFlatButtonBackground (Graphics g, ButtonBase button, Rectangle clipArea) + { + if (button.Pressed) + ThemeElements.DrawFlatButton (g, button.ClientRectangle, ButtonThemeState.Pressed, button.BackColor, button.ForeColor, button.FlatAppearance); + else if (button.InternalSelected) { + if (button.Entered) + ThemeElements.DrawFlatButton (g, button.ClientRectangle, ButtonThemeState.Default | ButtonThemeState.Entered, button.BackColor, button.ForeColor, button.FlatAppearance); + else + ThemeElements.DrawFlatButton (g, button.ClientRectangle, ButtonThemeState.Default, button.BackColor, button.ForeColor, button.FlatAppearance); + } + else if (button.Entered) + ThemeElements.DrawFlatButton (g, button.ClientRectangle, ButtonThemeState.Entered, button.BackColor, button.ForeColor, button.FlatAppearance); + else if (!button.Enabled) + ThemeElements.DrawFlatButton (g, button.ClientRectangle, ButtonThemeState.Disabled, button.BackColor, button.ForeColor, button.FlatAppearance); + else + ThemeElements.DrawFlatButton (g, button.ClientRectangle, ButtonThemeState.Normal, button.BackColor, button.ForeColor, button.FlatAppearance); + } + + public virtual void DrawFlatButtonFocus (Graphics g, ButtonBase button) + { + if (!button.Pressed) { + Color focus_color = WidgetPaint.Dark (button.BackColor); + g.DrawRectangle (ResPool.GetPen (focus_color), new Rectangle (button.ClientRectangle.Left + 4, button.ClientRectangle.Top + 4, button.ClientRectangle.Width - 9, button.ClientRectangle.Height - 9)); + } + } + + public virtual void DrawFlatButtonImage (Graphics g, ButtonBase button, Rectangle imageBounds) + { + // No changes from Standard for image for this theme + DrawButtonImage (g, button, imageBounds); + } + + public virtual void DrawFlatButtonText (Graphics g, ButtonBase button, Rectangle textBounds) + { + // No changes from Standard for text for this theme + DrawButtonText (g, button, textBounds); + } + #endregion + + #region Popup Button Style + public override void DrawPopupButton (Graphics g, Button b, Rectangle textBounds, Rectangle imageBounds, Rectangle clipRectangle) + { + // Draw Button Background + DrawPopupButtonBackground (g, b, clipRectangle); + + // If we have an image, draw it + if (imageBounds.Size != Size.Empty) + DrawPopupButtonImage (g, b, imageBounds); + + // If we're focused, draw a focus rectangle + if (b.Focused && b.Enabled && b.ShowFocusCues) + DrawPopupButtonFocus (g, b); + + // If we have text, draw it + if (textBounds != Rectangle.Empty) + DrawPopupButtonText (g, b, textBounds); + } + + public virtual void DrawPopupButtonBackground (Graphics g, Button button, Rectangle clipArea) + { + if (button.Pressed) + ThemeElements.DrawPopupButton (g, button.ClientRectangle, ButtonThemeState.Pressed, button.BackColor, button.ForeColor); + else if (button.Entered) + ThemeElements.DrawPopupButton (g, button.ClientRectangle, ButtonThemeState.Entered, button.BackColor, button.ForeColor); + else if (button.InternalSelected) + ThemeElements.DrawPopupButton (g, button.ClientRectangle, ButtonThemeState.Default, button.BackColor, button.ForeColor); + else if (!button.Enabled) + ThemeElements.DrawPopupButton (g, button.ClientRectangle, ButtonThemeState.Disabled, button.BackColor, button.ForeColor); + else + ThemeElements.DrawPopupButton (g, button.ClientRectangle, ButtonThemeState.Normal, button.BackColor, button.ForeColor); + } + + public virtual void DrawPopupButtonFocus (Graphics g, Button button) + { + // No changes from Standard for image for this theme + DrawButtonFocus (g, button); + } + + public virtual void DrawPopupButtonImage (Graphics g, Button button, Rectangle imageBounds) + { + // No changes from Standard for image for this theme + DrawButtonImage (g, button, imageBounds); + } + + public virtual void DrawPopupButtonText (Graphics g, Button button, Rectangle textBounds) + { + // No changes from Standard for image for this theme + DrawButtonText (g, button, textBounds); + } + #endregion + + #region Button Layout Calculations + public override Size CalculateButtonAutoSize (Button button) + { + Size ret_size = Size.Empty; + Size text_size = TextRenderer.MeasureTextInternal (button.Text, button.Font, button.UseCompatibleTextRendering); + Size image_size = button.Image == null ? Size.Empty : button.Image.Size; + + // Pad the text size + if (button.Text.Length != 0) { + text_size.Height += 4; + text_size.Width += 4; + } + + switch (button.TextImageRelation) { + case TextImageRelation.Overlay: + ret_size.Height = Math.Max (button.Text.Length == 0 ? 0 : text_size.Height, image_size.Height); + ret_size.Width = Math.Max (text_size.Width, image_size.Width); + break; + case TextImageRelation.ImageAboveText: + case TextImageRelation.TextAboveImage: + ret_size.Height = text_size.Height + image_size.Height; + ret_size.Width = Math.Max (text_size.Width, image_size.Width); + break; + case TextImageRelation.ImageBeforeText: + case TextImageRelation.TextBeforeImage: + ret_size.Height = Math.Max (text_size.Height, image_size.Height); + ret_size.Width = text_size.Width + image_size.Width; + break; + } + + // Pad the result + ret_size.Height += (button.Padding.Vertical + 6); + ret_size.Width += (button.Padding.Horizontal + 6); + + return ret_size; + } + + public override void CalculateButtonTextAndImageLayout (Graphics g, ButtonBase button, out Rectangle textRectangle, out Rectangle imageRectangle) + { + Image image = button.Image; + string text = button.Text; + Rectangle content_rect = button.PaddingClientRectangle; + Size text_size = TextRenderer.MeasureTextInternal (g, text, button.Font, content_rect.Size, button.TextFormatFlags, button.UseCompatibleTextRendering); + Size image_size = image == null ? Size.Empty : image.Size; + + textRectangle = Rectangle.Inflate (content_rect, -4, -4); + imageRectangle = Rectangle.Empty; + + bool displayEllipsis = (button.TextFormatFlags & (TextFormatFlags.EndEllipsis | TextFormatFlags.PathEllipsis | TextFormatFlags.WordEllipsis)) != 0; + + switch (button.TextImageRelation) { + case TextImageRelation.Overlay: + // Overlay is easy, text always goes here + + // Image is dependent on ImageAlign + if (image == null) { + if (button.Pressed) + textRectangle.Offset (1, 1); + return; + } + + int image_x = 0; + int image_y = 0; + int image_height = image.Height; + int image_width = image.Width; + + switch (button.ImageAlign) { + case System.Drawing.ContentAlignment.TopLeft: + image_x = 5; + image_y = 5; + break; + case System.Drawing.ContentAlignment.TopCenter: + image_x = (content_rect.Width - image_width) / 2; + image_y = 5; + break; + case System.Drawing.ContentAlignment.TopRight: + image_x = content_rect.Width - image_width - 5; + image_y = 5; + break; + case System.Drawing.ContentAlignment.MiddleLeft: + image_x = 5; + image_y = (content_rect.Height - image_height) / 2; + break; + case System.Drawing.ContentAlignment.MiddleCenter: + image_x = (content_rect.Width - image_width) / 2; + image_y = (content_rect.Height - image_height) / 2; + break; + case System.Drawing.ContentAlignment.MiddleRight: + image_x = content_rect.Width - image_width - 4; + image_y = (content_rect.Height - image_height) / 2; + break; + case System.Drawing.ContentAlignment.BottomLeft: + image_x = 5; + image_y = content_rect.Height - image_height - 4; + break; + case System.Drawing.ContentAlignment.BottomCenter: + image_x = (content_rect.Width - image_width) / 2; + image_y = content_rect.Height - image_height - 4; + break; + case System.Drawing.ContentAlignment.BottomRight: + image_x = content_rect.Width - image_width - 4; + image_y = content_rect.Height - image_height - 4; + break; + default: + image_x = 5; + image_y = 5; + break; + } + + imageRectangle = new Rectangle (image_x, image_y, image_width, image_height); + break; + case TextImageRelation.ImageAboveText: + LayoutTextAboveOrBelowImage (textRectangle, false, text_size, image_size, button.TextAlign, button.ImageAlign, displayEllipsis, out textRectangle, out imageRectangle); + break; + case TextImageRelation.TextAboveImage: + LayoutTextAboveOrBelowImage (textRectangle, true, text_size, image_size, button.TextAlign, button.ImageAlign, displayEllipsis, out textRectangle, out imageRectangle); + break; + case TextImageRelation.ImageBeforeText: + LayoutTextBeforeOrAfterImage (textRectangle, false, text_size, image_size, button.TextAlign, button.ImageAlign, out textRectangle, out imageRectangle); + break; + case TextImageRelation.TextBeforeImage: + LayoutTextBeforeOrAfterImage (textRectangle, true, text_size, image_size, button.TextAlign, button.ImageAlign, out textRectangle, out imageRectangle); + break; + } + if (button.Pressed) + textRectangle.Offset (1, 1); + } + + private void LayoutTextBeforeOrAfterImage (Rectangle totalArea, bool textFirst, Size textSize, Size imageSize, System.Drawing.ContentAlignment textAlign, System.Drawing.ContentAlignment imageAlign, out Rectangle textRect, out Rectangle imageRect) + { + int element_spacing = 0; // Spacing between the Text and the Image + int total_width = textSize.Width + element_spacing + imageSize.Width; + + if (!textFirst) + element_spacing += 2; + + // If the text is too big, chop it down to the size we have available to it + if (total_width > totalArea.Width) { + textSize.Width = totalArea.Width - element_spacing - imageSize.Width; + total_width = totalArea.Width; + } + + int excess_width = totalArea.Width - total_width; + int offset = 0; + + Rectangle final_text_rect; + Rectangle final_image_rect; + + HorizontalAlignment h_text = GetHorizontalAlignment (textAlign); + HorizontalAlignment h_image = GetHorizontalAlignment (imageAlign); + + if (h_image == HorizontalAlignment.Left) + offset = 0; + else if (h_image == HorizontalAlignment.Right && h_text == HorizontalAlignment.Right) + offset = excess_width; + else if (h_image == HorizontalAlignment.Center && (h_text == HorizontalAlignment.Left || h_text == HorizontalAlignment.Center)) + offset += (int)(excess_width / 3); + else + offset += (int)(2 * (excess_width / 3)); + + if (textFirst) { + final_text_rect = new Rectangle (totalArea.Left + offset, AlignInRectangle (totalArea, textSize, textAlign).Top, textSize.Width, textSize.Height); + final_image_rect = new Rectangle (final_text_rect.Right + element_spacing, AlignInRectangle (totalArea, imageSize, imageAlign).Top, imageSize.Width, imageSize.Height); + } + else { + final_image_rect = new Rectangle (totalArea.Left + offset, AlignInRectangle (totalArea, imageSize, imageAlign).Top, imageSize.Width, imageSize.Height); + final_text_rect = new Rectangle (final_image_rect.Right + element_spacing, AlignInRectangle (totalArea, textSize, textAlign).Top, textSize.Width, textSize.Height); + } + + textRect = final_text_rect; + imageRect = final_image_rect; + } + + private void LayoutTextAboveOrBelowImage (Rectangle totalArea, bool textFirst, Size textSize, Size imageSize, System.Drawing.ContentAlignment textAlign, System.Drawing.ContentAlignment imageAlign, bool displayEllipsis, out Rectangle textRect, out Rectangle imageRect) + { + int element_spacing = 0; // Spacing between the Text and the Image + int total_height = textSize.Height + element_spacing + imageSize.Height; + + if (textFirst) + element_spacing += 2; + + if (textSize.Width > totalArea.Width) + textSize.Width = totalArea.Width; + + // If the there isn't enough room and we're text first, cut out the image + if (total_height > totalArea.Height && textFirst) { + imageSize = Size.Empty; + total_height = totalArea.Height; + } + + int excess_height = totalArea.Height - total_height; + int offset = 0; + + Rectangle final_text_rect; + Rectangle final_image_rect; + + VerticalAlignment v_text = GetVerticalAlignment (textAlign); + VerticalAlignment v_image = GetVerticalAlignment (imageAlign); + + if (v_image == VerticalAlignment.Top) + offset = 0; + else if (v_image == VerticalAlignment.Bottom && v_text == VerticalAlignment.Bottom) + offset = excess_height; + else if (v_image == VerticalAlignment.Center && (v_text == VerticalAlignment.Top || v_text == VerticalAlignment.Center)) + offset += (int)(excess_height / 3); + else + offset += (int)(2 * (excess_height / 3)); + + if (textFirst) { + var textHeight = excess_height >= 0 ? totalArea.Height - imageSize.Height - element_spacing: textSize.Height; + final_text_rect = new Rectangle (AlignInRectangle (totalArea, textSize, textAlign).Left, totalArea.Top + offset, textSize.Width, textHeight); + final_image_rect = new Rectangle (AlignInRectangle (totalArea, imageSize, imageAlign).Left, final_text_rect.Bottom + element_spacing, imageSize.Width, imageSize.Height); + } + else { + final_image_rect = new Rectangle (AlignInRectangle (totalArea, imageSize, imageAlign).Left, totalArea.Top + offset, imageSize.Width, imageSize.Height); + var textHeight = excess_height >= 0 ? totalArea.Height - final_image_rect.Height : textSize.Height; + final_text_rect = new Rectangle (AlignInRectangle (totalArea, textSize, textAlign).Left, final_image_rect.Bottom + element_spacing, textSize.Width, textHeight); + + if (final_text_rect.Bottom > totalArea.Bottom) { + final_text_rect.Y -= (final_text_rect.Bottom - totalArea.Bottom); + if (final_text_rect.Y < totalArea.Top) + final_text_rect.Y = totalArea.Top; + } + } + + if (displayEllipsis) { + // Don't use more space than is available otherwise ellipsis won't show + if (final_text_rect.Height > totalArea.Bottom) + final_text_rect.Height = totalArea.Bottom - final_text_rect.Top; + } + + textRect = final_text_rect; + imageRect = final_image_rect; + } + + private HorizontalAlignment GetHorizontalAlignment (System.Drawing.ContentAlignment align) + { + switch (align) { + case System.Drawing.ContentAlignment.BottomLeft: + case System.Drawing.ContentAlignment.MiddleLeft: + case System.Drawing.ContentAlignment.TopLeft: + return HorizontalAlignment.Left; + case System.Drawing.ContentAlignment.BottomCenter: + case System.Drawing.ContentAlignment.MiddleCenter: + case System.Drawing.ContentAlignment.TopCenter: + return HorizontalAlignment.Center; + case System.Drawing.ContentAlignment.BottomRight: + case System.Drawing.ContentAlignment.MiddleRight: + case System.Drawing.ContentAlignment.TopRight: + return HorizontalAlignment.Right; + } + + return HorizontalAlignment.Left; + } + + private enum VerticalAlignment + { + Top = 0, + Center = 1, + Bottom = 2 + } + + private VerticalAlignment GetVerticalAlignment (System.Drawing.ContentAlignment align) + { + switch (align) { + case System.Drawing.ContentAlignment.TopLeft: + case System.Drawing.ContentAlignment.TopCenter: + case System.Drawing.ContentAlignment.TopRight: + return VerticalAlignment.Top; + case System.Drawing.ContentAlignment.MiddleLeft: + case System.Drawing.ContentAlignment.MiddleCenter: + case System.Drawing.ContentAlignment.MiddleRight: + return VerticalAlignment.Center; + case System.Drawing.ContentAlignment.BottomLeft: + case System.Drawing.ContentAlignment.BottomCenter: + case System.Drawing.ContentAlignment.BottomRight: + return VerticalAlignment.Bottom; + } + + return VerticalAlignment.Top; + } + + internal Rectangle AlignInRectangle (Rectangle outer, Size inner, System.Drawing.ContentAlignment align) + { + int x = 0; + int y = 0; + + if (align == System.Drawing.ContentAlignment.BottomLeft || align == System.Drawing.ContentAlignment.MiddleLeft || align == System.Drawing.ContentAlignment.TopLeft) + x = outer.X; + else if (align == System.Drawing.ContentAlignment.BottomCenter || align == System.Drawing.ContentAlignment.MiddleCenter || align == System.Drawing.ContentAlignment.TopCenter) + x = Math.Max (outer.X + ((outer.Width - inner.Width) / 2), outer.Left); + else if (align == System.Drawing.ContentAlignment.BottomRight || align == System.Drawing.ContentAlignment.MiddleRight || align == System.Drawing.ContentAlignment.TopRight) + x = outer.Right - inner.Width; + if (align == System.Drawing.ContentAlignment.TopCenter || align == System.Drawing.ContentAlignment.TopLeft || align == System.Drawing.ContentAlignment.TopRight) + y = outer.Y; + else if (align == System.Drawing.ContentAlignment.MiddleCenter || align == System.Drawing.ContentAlignment.MiddleLeft || align == System.Drawing.ContentAlignment.MiddleRight) + y = outer.Y + (outer.Height - inner.Height) / 2; + else if (align == System.Drawing.ContentAlignment.BottomCenter || align == System.Drawing.ContentAlignment.BottomRight || align == System.Drawing.ContentAlignment.BottomLeft) + y = outer.Bottom - inner.Height; + + return new Rectangle (x, y, Math.Min (inner.Width, outer.Width), Math.Min (inner.Height, outer.Height)); + } + #endregion + #endregion + + #region ButtonBase + public override void DrawButtonBase(Graphics dc, Rectangle clip_area, ButtonBase button) + { + // Draw the button: Draw border, etc. + ButtonBase_DrawButton(button, dc); + + // Draw the image + if (button.FlatStyle != FlatStyle.System && ((button.image != null) || (button.image_list != null))) + ButtonBase_DrawImage(button, dc); + + // Draw the focus rectangle + if (ShouldPaintFocusRectagle (button)) + ButtonBase_DrawFocus(button, dc); + + // Now the text + if (button.Text != null && button.Text != String.Empty) + ButtonBase_DrawText(button, dc); + } + + protected static bool ShouldPaintFocusRectagle (ButtonBase button) + { + return (button.Focused || button.paint_as_acceptbutton) && button.Enabled && button.ShowFocusCues; + } + + protected virtual void ButtonBase_DrawButton (ButtonBase button, Graphics dc) + { + Rectangle borderRectangle; + bool check_or_radio = false; + bool check_or_radio_checked = false; + + bool is_ColorControl = button.BackColor.ToArgb () == ColorControl.ToArgb () ? true : false; + + CPColor cpcolor = is_ColorControl ? CPColor.Empty : ResPool.GetCPColor (button.BackColor); + + if (button is CheckBox) { + check_or_radio = true; + check_or_radio_checked = ((CheckBox)button).Checked; + } else if (button is RadioButton) { + check_or_radio = true; + check_or_radio_checked = ((RadioButton)button).Checked; + } + + if (button.Focused && button.Enabled && !check_or_radio) { + // shrink the rectangle for the normal button drawing inside the focus rectangle + borderRectangle = Rectangle.Inflate (button.ClientRectangle, -1, -1); + } else { + borderRectangle = button.ClientRectangle; + } + + if (button.FlatStyle == FlatStyle.Popup) { + if (!button.is_pressed && !button.is_entered && !check_or_radio_checked) + Internal_DrawButton (dc, borderRectangle, 1, cpcolor, is_ColorControl, button.BackColor); + else if (!button.is_pressed && button.is_entered &&!check_or_radio_checked) + Internal_DrawButton (dc, borderRectangle, 2, cpcolor, is_ColorControl, button.BackColor); + else if (button.is_pressed || check_or_radio_checked) + Internal_DrawButton (dc, borderRectangle, 1, cpcolor, is_ColorControl, button.BackColor); + } else if (button.FlatStyle == FlatStyle.Flat) { + if (button.is_entered && !button.is_pressed && !check_or_radio_checked) { + if ((button.image == null) && (button.image_list == null)) { + Brush brush = is_ColorControl ? SystemBrushes.ControlDark : ResPool.GetSolidBrush (cpcolor.Dark); + dc.FillRectangle (brush, borderRectangle); + } + } else if (button.is_pressed || check_or_radio_checked) { + if ((button.image == null) && (button.image_list == null)) { + Brush brush = is_ColorControl ? SystemBrushes.ControlLightLight : ResPool.GetSolidBrush (cpcolor.LightLight); + dc.FillRectangle (brush, borderRectangle); + } + + Pen pen = is_ColorControl ? SystemPens.ControlDark : ResPool.GetPen (cpcolor.Dark); + dc.DrawRectangle (pen, borderRectangle.X + 4, borderRectangle.Y + 4, + borderRectangle.Width - 9, borderRectangle.Height - 9); + } + + Internal_DrawButton (dc, borderRectangle, 3, cpcolor, is_ColorControl, button.BackColor); + } else { + if ((!button.is_pressed || !button.Enabled) && !check_or_radio_checked) + Internal_DrawButton (dc, borderRectangle, 0, cpcolor, is_ColorControl, button.BackColor); + else + Internal_DrawButton (dc, borderRectangle, 1, cpcolor, is_ColorControl, button.BackColor); + } + } + + private void Internal_DrawButton (Graphics dc, Rectangle rect, int state, CPColor cpcolor, bool is_ColorControl, Color backcolor) + { + switch (state) { + case 0: // normal or normal disabled button + Pen pen = is_ColorControl ? SystemPens.ControlLightLight : ResPool.GetPen (cpcolor.LightLight); + dc.DrawLine (pen, rect.X, rect.Y, rect.X, rect.Bottom - 2); + dc.DrawLine (pen, rect.X + 1, rect.Y, rect.Right - 2, rect.Y); + + pen = is_ColorControl ? SystemPens.Control : ResPool.GetPen (backcolor); + dc.DrawLine (pen, rect.X + 1, rect.Y + 1, rect.X + 1, rect.Bottom - 3); + dc.DrawLine (pen, rect.X + 2, rect.Y + 1, rect.Right - 3, rect.Y + 1); + + pen = is_ColorControl ? SystemPens.ControlDark : ResPool.GetPen (cpcolor.Dark); + dc.DrawLine (pen, rect.X + 1, rect.Bottom - 2, rect.Right - 2, rect.Bottom - 2); + dc.DrawLine (pen, rect.Right - 2, rect.Y + 1, rect.Right - 2, rect.Bottom - 3); + + pen = is_ColorControl ? SystemPens.ControlDarkDark : ResPool.GetPen (cpcolor.DarkDark); + dc.DrawLine (pen, rect.X, rect.Bottom - 1, rect.Right - 1, rect.Bottom - 1); + dc.DrawLine (pen, rect.Right - 1, rect.Y, rect.Right - 1, rect.Bottom - 2); + break; + case 1: // popup button normal (or pressed normal or popup button) + pen = is_ColorControl ? SystemPens.ControlDark : ResPool.GetPen (cpcolor.Dark); + dc.DrawRectangle (pen, rect.X, rect.Y, rect.Width - 1, rect.Height - 1); + break; + case 2: // popup button poped up + pen = is_ColorControl ? SystemPens.ControlLightLight : ResPool.GetPen (cpcolor.LightLight); + dc.DrawLine (pen, rect.X, rect.Y, rect.X, rect.Bottom - 2); + dc.DrawLine (pen, rect.X + 1, rect.Y, rect.Right - 2, rect.Y); + + pen = is_ColorControl ? SystemPens.ControlDark : ResPool.GetPen (cpcolor.Dark); + dc.DrawLine (pen, rect.X, rect.Bottom - 1, rect.Right - 1, rect.Bottom - 1); + dc.DrawLine (pen, rect.Right - 1, rect.Y, rect.Right - 1, rect.Bottom - 2); + break; + case 3: // flat button not entered + pen = is_ColorControl ? SystemPens.ControlDarkDark : ResPool.GetPen (cpcolor.DarkDark); + dc.DrawRectangle (pen, rect.X, rect.Y, rect.Width - 1, rect.Height - 1); + break; + default: + break; + } + } + + protected virtual void ButtonBase_DrawImage(ButtonBase button, Graphics dc) + { + // Need to draw a picture + Image i; + int image_x; + int image_y; + int image_width; + int image_height; + + int width = button.ClientSize.Width; + int height = button.ClientSize.Height; + + if (button.ImageIndex != -1) { // We use ImageIndex instead of image_index since it will return -1 if image_list is null + i = button.image_list.Images[button.ImageIndex]; + } else { + i = button.image; + } + + image_width = i.Width; + image_height = i.Height; + + switch (button.ImageAlign) { + case ContentAlignment.TopLeft: { + image_x = 5; + image_y = 5; + break; + } + + case ContentAlignment.TopCenter: { + image_x = (width - image_width) / 2; + image_y = 5; + break; + } + + case ContentAlignment.TopRight: { + image_x = width - image_width - 5; + image_y = 5; + break; + } + + case ContentAlignment.MiddleLeft: { + image_x = 5; + image_y = (height - image_height) / 2; + break; + } + + case ContentAlignment.MiddleCenter: { + image_x = (width - image_width) / 2; + image_y = (height - image_height) / 2; + break; + } + + case ContentAlignment.MiddleRight: { + image_x = width - image_width - 4; + image_y = (height - image_height) / 2; + break; + } + + case ContentAlignment.BottomLeft: { + image_x = 5; + image_y = height - image_height - 4; + break; + } + + case ContentAlignment.BottomCenter: { + image_x = (width - image_width) / 2; + image_y = height - image_height - 4; + break; + } + + case ContentAlignment.BottomRight: { + image_x = width - image_width - 4; + image_y = height - image_height - 4; + break; + } + + default: { + image_x = 5; + image_y = 5; + break; + } + } + + dc.SetClip (new Rectangle(3, 3, width - 5, height - 5)); + + if (button.Enabled) + dc.DrawImage (i, image_x, image_y, image_width, image_height); + else + CPDrawImageDisabled (dc, i, image_x, image_y, ColorControl); + + dc.ResetClip (); + } + + protected virtual void ButtonBase_DrawFocus(ButtonBase button, Graphics dc) + { + Color focus_color = button.ForeColor; + + int inflate_value = -3; + + if (!(button is CheckBox) && !(button is RadioButton)) { + inflate_value = -4; + + if (button.FlatStyle == FlatStyle.Popup && !button.is_pressed) + focus_color = WidgetPaint.Dark(button.BackColor); + + dc.DrawRectangle (ResPool.GetPen (focus_color), button.ClientRectangle.X, button.ClientRectangle.Y, + button.ClientRectangle.Width - 1, button.ClientRectangle.Height - 1); + } + + if (button.Focused) { + Rectangle rect = Rectangle.Inflate (button.ClientRectangle, inflate_value, inflate_value); + WidgetPaint.DrawFocusRectangle (dc, rect); + } + } + + protected virtual void ButtonBase_DrawText(ButtonBase button, Graphics dc) + { + Rectangle buttonRectangle = button.ClientRectangle; + Rectangle text_rect = Rectangle.Inflate(buttonRectangle, -4, -4); + + if (button.is_pressed) { + text_rect.X++; + text_rect.Y++; + } + + // Ensure that at least one line is going to get displayed. + // Line limit does not ensure that despite its description. + text_rect.Height = Math.Max (button.Font.Height, text_rect.Height); + + if (button.Enabled) { + dc.DrawString(button.Text, button.Font, ResPool.GetSolidBrush (button.ForeColor), text_rect, button.text_format); + } else { + if (button.FlatStyle == FlatStyle.Flat || button.FlatStyle == FlatStyle.Popup) { + dc.DrawString(button.Text, button.Font, ResPool.GetSolidBrush (ColorGrayText), text_rect, button.text_format); + } else { + CPDrawStringDisabled (dc, button.Text, button.Font, button.BackColor, text_rect, button.text_format); + } + } + } + + public override Size ButtonBaseDefaultSize { + get { + return new Size (75, 23); + } + } + #endregion // ButtonBase + + #region CheckBox + public override void DrawCheckBox (Graphics g, CheckBox cb, Rectangle glyphArea, Rectangle textBounds, Rectangle imageBounds, Rectangle clipRectangle) + { + // Draw Button Background + if (cb.Appearance == Appearance.Button && cb.FlatStyle != FlatStyle.Flat) + ButtonBase_DrawButton (cb, g); + else if (cb.Appearance != Appearance.Button) + DrawCheckBoxGlyph (g, cb, glyphArea); + + // Draw the borders and such for a Flat CheckBox Button + if (cb.Appearance == Appearance.Button && cb.FlatStyle == FlatStyle.Flat) + DrawFlatButton (g, cb, textBounds, imageBounds, clipRectangle); + + // If we have an image, draw it + if (imageBounds.Size != Size.Empty) + DrawCheckBoxImage (g, cb, imageBounds); + + if (cb.Focused && cb.Enabled && cb.ShowFocusCues && textBounds != Rectangle.Empty) + DrawCheckBoxFocus (g, cb, textBounds); + + // If we have text, draw it + if (textBounds != Rectangle.Empty) + DrawCheckBoxText (g, cb, textBounds); + } + + public virtual void DrawCheckBoxGlyph (Graphics g, CheckBox cb, Rectangle glyphArea) + { + if (cb.Pressed) + ThemeElements.CurrentTheme.CheckBoxPainter.PaintCheckBox (g, glyphArea, cb.BackColor, cb.ForeColor, ElementState.Pressed, cb.FlatStyle, cb.CheckState); + else if (cb.InternalSelected) + ThemeElements.CurrentTheme.CheckBoxPainter.PaintCheckBox (g, glyphArea, cb.BackColor, cb.ForeColor, ElementState.Normal, cb.FlatStyle, cb.CheckState); + else if (cb.Entered) + ThemeElements.CurrentTheme.CheckBoxPainter.PaintCheckBox (g, glyphArea, cb.BackColor, cb.ForeColor, ElementState.Hot, cb.FlatStyle, cb.CheckState); + else if (!cb.Enabled) + ThemeElements.CurrentTheme.CheckBoxPainter.PaintCheckBox (g, glyphArea, cb.BackColor, cb.ForeColor, ElementState.Disabled, cb.FlatStyle, cb.CheckState); + else + ThemeElements.CurrentTheme.CheckBoxPainter.PaintCheckBox (g, glyphArea, cb.BackColor, cb.ForeColor, ElementState.Normal, cb.FlatStyle, cb.CheckState); + } + + public virtual void DrawCheckBoxFocus (Graphics g, CheckBox cb, Rectangle focusArea) + { + WidgetPaint.DrawFocusRectangle (g, focusArea); + } + + public virtual void DrawCheckBoxImage (Graphics g, CheckBox cb, Rectangle imageBounds) + { + if (cb.Enabled) + g.DrawImage (cb.Image, imageBounds); + else + CPDrawImageDisabled (g, cb.Image, imageBounds.Left, imageBounds.Top, ColorControl); + } + + public virtual void DrawCheckBoxText (Graphics g, CheckBox cb, Rectangle textBounds) + { + if (cb.Enabled) + TextRenderer.DrawTextInternal (g, cb.Text, cb.Font, textBounds, cb.ForeColor, cb.TextFormatFlags, cb.UseCompatibleTextRendering); + else + DrawStringDisabled20 (g, cb.Text, cb.Font, textBounds, cb.BackColor, cb.TextFormatFlags, cb.UseCompatibleTextRendering); + } + + public override void CalculateCheckBoxTextAndImageLayout (ButtonBase button, Point p, out Rectangle glyphArea, out Rectangle textRectangle, out Rectangle imageRectangle) + { + int check_size = CheckSize; + + if (button is CheckBox) + check_size = (button as CheckBox).Appearance == Appearance.Normal ? check_size : 0; + + glyphArea = new Rectangle (button.Padding.Left, button.Padding.Top, check_size, check_size); + + Rectangle content_rect = button.PaddingClientRectangle; + ContentAlignment align = ContentAlignment.TopLeft; + + if (button is CheckBox) + align = (button as CheckBox).CheckAlign; + else if (button is RadioButton) + align = (button as RadioButton).CheckAlign; + + switch (align) { + case ContentAlignment.BottomCenter: + glyphArea.Y += content_rect.Height - check_size - 2; + glyphArea.X += (content_rect.Width - check_size) / 2; + break; + case ContentAlignment.BottomLeft: + glyphArea.Y += content_rect.Height - check_size - 2; + content_rect.Width -= check_size; + content_rect.Offset (check_size, 0); + break; + case ContentAlignment.BottomRight: + glyphArea.Y += content_rect.Height - check_size - 2; + glyphArea.X += content_rect.Width - check_size; + content_rect.Width -= check_size; + break; + case ContentAlignment.MiddleCenter: + glyphArea.Y += (content_rect.Height - check_size) / 2; + glyphArea.X += (content_rect.Width - check_size) / 2; + break; + case ContentAlignment.MiddleLeft: + glyphArea.Y += (content_rect.Height - check_size) / 2; + content_rect.Width -= check_size; + content_rect.Offset (check_size, 0); + break; + case ContentAlignment.MiddleRight: + glyphArea.Y += (content_rect.Height - check_size) / 2; + glyphArea.X += content_rect.Width - check_size; + content_rect.Width -= check_size; + break; + case ContentAlignment.TopCenter: + glyphArea.X += (content_rect.Width - check_size) / 2; + break; + case ContentAlignment.TopLeft: + content_rect.Width -= check_size; + content_rect.Offset (check_size, 0); + break; + case ContentAlignment.TopRight: + glyphArea.X += content_rect.Width - check_size; + content_rect.Width -= check_size; + break; + } + + Image image = button.Image; + string text = button.Text; + + Size proposed = Size.Empty; + + // Force wrapping if we aren't AutoSize and our text is too long + if (!button.AutoSize) + proposed.Width = button.PaddingClientRectangle.Width - glyphArea.Width - 2; + + Size text_size = TextRenderer.MeasureTextInternal (text, button.Font, proposed, button.TextFormatFlags, button.UseCompatibleTextRendering); + + // Text can't be bigger than the content rectangle + text_size.Height = Math.Min (text_size.Height, content_rect.Height); + text_size.Width = Math.Min (text_size.Width, content_rect.Width); + + Size image_size = image == null ? Size.Empty : image.Size; + + textRectangle = Rectangle.Empty; + imageRectangle = Rectangle.Empty; + + switch (button.TextImageRelation) { + case TextImageRelation.Overlay: + // Text is centered vertically, and 2 pixels to the right + textRectangle.X = content_rect.Left + 2; + textRectangle.Y = button.PaddingClientRectangle.Top + ((content_rect.Height - text_size.Height) / 2) - 1; + textRectangle.Size = text_size; + + // Image is dependent on ImageAlign + if (image == null) + return; + + int image_x = button.PaddingClientRectangle.Left; + int image_y = button.PaddingClientRectangle.Top; + int image_height = image.Height; + int image_width = image.Width; + + switch (button.ImageAlign) { + case System.Drawing.ContentAlignment.TopLeft: + image_x += 5; + image_y += 5; + break; + case System.Drawing.ContentAlignment.TopCenter: + image_x += (content_rect.Width - image_width) / 2; + image_y += 5; + break; + case System.Drawing.ContentAlignment.TopRight: + image_x += content_rect.Width - image_width - 5; + image_y += 5; + break; + case System.Drawing.ContentAlignment.MiddleLeft: + image_x += 5; + image_y += (content_rect.Height - image_height) / 2; + break; + case System.Drawing.ContentAlignment.MiddleCenter: + image_x += (content_rect.Width - image_width) / 2; + image_y += (content_rect.Height - image_height) / 2; + break; + case System.Drawing.ContentAlignment.MiddleRight: + image_x += content_rect.Width - image_width - 4; + image_y += (content_rect.Height - image_height) / 2; + break; + case System.Drawing.ContentAlignment.BottomLeft: + image_x += 5; + image_y += content_rect.Height - image_height - 4; + break; + case System.Drawing.ContentAlignment.BottomCenter: + image_x += (content_rect.Width - image_width) / 2; + image_y += content_rect.Height - image_height - 4; + break; + case System.Drawing.ContentAlignment.BottomRight: + image_x += content_rect.Width - image_width - 4; + image_y += content_rect.Height - image_height - 4; + break; + default: + image_x += 5; + image_y += 5; + break; + } + + imageRectangle = new Rectangle (image_x + check_size, image_y, image_width, image_height); + break; + case TextImageRelation.ImageAboveText: + content_rect.Inflate (-4, -4); + LayoutTextAboveOrBelowImage (content_rect, false, text_size, image_size, button.TextAlign, button.ImageAlign, false, out textRectangle, out imageRectangle); + break; + case TextImageRelation.TextAboveImage: + content_rect.Inflate (-4, -4); + LayoutTextAboveOrBelowImage (content_rect, true, text_size, image_size, button.TextAlign, button.ImageAlign, false, out textRectangle, out imageRectangle); + break; + case TextImageRelation.ImageBeforeText: + content_rect.Inflate (-4, -4); + LayoutTextBeforeOrAfterImage (content_rect, false, text_size, image_size, button.TextAlign, button.ImageAlign, out textRectangle, out imageRectangle); + break; + case TextImageRelation.TextBeforeImage: + content_rect.Inflate (-4, -4); + LayoutTextBeforeOrAfterImage (content_rect, true, text_size, image_size, button.TextAlign, button.ImageAlign, out textRectangle, out imageRectangle); + break; + } + } + + public override Size CalculateCheckBoxAutoSize (CheckBox checkBox) + { + Size ret_size = Size.Empty; + Size text_size = TextRenderer.MeasureTextInternal (checkBox.Text, checkBox.Font, checkBox.UseCompatibleTextRendering); + Size image_size = checkBox.Image == null ? Size.Empty : checkBox.Image.Size; + + // Pad the text size + if (checkBox.Text.Length != 0) { + text_size.Height += 4; + text_size.Width += 4; + } + + switch (checkBox.TextImageRelation) { + case TextImageRelation.Overlay: + ret_size.Height = Math.Max (checkBox.Text.Length == 0 ? 0 : text_size.Height, image_size.Height); + ret_size.Width = Math.Max (text_size.Width, image_size.Width); + break; + case TextImageRelation.ImageAboveText: + case TextImageRelation.TextAboveImage: + ret_size.Height = text_size.Height + image_size.Height; + ret_size.Width = Math.Max (text_size.Width, image_size.Width); + break; + case TextImageRelation.ImageBeforeText: + case TextImageRelation.TextBeforeImage: + ret_size.Height = Math.Max (text_size.Height, image_size.Height); + ret_size.Width = text_size.Width + image_size.Width; + break; + } + + // Pad the result + ret_size.Height += (checkBox.Padding.Vertical); + ret_size.Width += (checkBox.Padding.Horizontal) + 15; + + // There seems to be a minimum height + if (ret_size.Height == checkBox.Padding.Vertical) + ret_size.Height += 14; + + return ret_size; + } + + public override void DrawCheckBox(Graphics dc, Rectangle clip_area, CheckBox checkbox) { + StringFormat text_format; + Rectangle client_rectangle; + Rectangle text_rectangle; + Rectangle checkbox_rectangle; + int checkmark_size = CheckSize; + int checkmark_space = 4; + + client_rectangle = checkbox.ClientRectangle; + text_rectangle = client_rectangle; + checkbox_rectangle = new Rectangle(text_rectangle.X, text_rectangle.Y, checkmark_size, checkmark_size); + + text_format = new StringFormat(); + text_format.Alignment = StringAlignment.Near; + text_format.LineAlignment = StringAlignment.Center; + if (checkbox.ShowKeyboardCuesInternal) + text_format.HotkeyPrefix = HotkeyPrefix.Show; + else + text_format.HotkeyPrefix = HotkeyPrefix.Hide; + + /* Calculate the position of text and checkbox rectangle */ + if (checkbox.appearance!=Appearance.Button) { + switch(checkbox.check_alignment) { + case ContentAlignment.BottomCenter: { + checkbox_rectangle.X=(client_rectangle.Right-client_rectangle.Left)/2-checkmark_size/2; + checkbox_rectangle.Y=client_rectangle.Bottom-checkmark_size; + text_rectangle.X=client_rectangle.X; + text_rectangle.Width=client_rectangle.Width; + text_rectangle.Height=client_rectangle.Height-checkbox_rectangle.Y-checkmark_space; + break; + } + + case ContentAlignment.BottomLeft: { + checkbox_rectangle.X=client_rectangle.Left; + checkbox_rectangle.Y=client_rectangle.Bottom-checkmark_size; + text_rectangle.X=client_rectangle.X+checkmark_size+checkmark_space; + text_rectangle.Width=client_rectangle.Width-checkmark_size-checkmark_space; + break; + } + + case ContentAlignment.BottomRight: { + checkbox_rectangle.X=client_rectangle.Right-checkmark_size; + checkbox_rectangle.Y=client_rectangle.Bottom-checkmark_size; + text_rectangle.X=client_rectangle.X; + text_rectangle.Width=client_rectangle.Width-checkmark_size-checkmark_space; + break; + } + + case ContentAlignment.MiddleCenter: { + checkbox_rectangle.X=(client_rectangle.Right-client_rectangle.Left)/2-checkmark_size/2; + checkbox_rectangle.Y=(client_rectangle.Bottom-client_rectangle.Top)/2-checkmark_size/2; + text_rectangle.X=client_rectangle.X; + text_rectangle.Width=client_rectangle.Width; + break; + } + + default: + case ContentAlignment.MiddleLeft: { + checkbox_rectangle.X=client_rectangle.Left; + checkbox_rectangle.Y=(client_rectangle.Bottom-client_rectangle.Top)/2-checkmark_size/2; + text_rectangle.X=client_rectangle.X+checkmark_size+checkmark_space; + text_rectangle.Width=client_rectangle.Width-checkmark_size-checkmark_space; + break; + } + + case ContentAlignment.MiddleRight: { + checkbox_rectangle.X=client_rectangle.Right-checkmark_size; + checkbox_rectangle.Y=(client_rectangle.Bottom-client_rectangle.Top)/2-checkmark_size/2; + text_rectangle.X=client_rectangle.X; + text_rectangle.Width=client_rectangle.Width-checkmark_size-checkmark_space; + break; + } + + case ContentAlignment.TopCenter: { + checkbox_rectangle.X=(client_rectangle.Right-client_rectangle.Left)/2-checkmark_size/2; + checkbox_rectangle.Y=client_rectangle.Top; + text_rectangle.X=client_rectangle.X; + text_rectangle.Width=client_rectangle.Width; + text_rectangle.Y=checkmark_size+checkmark_space; + text_rectangle.Height=client_rectangle.Height-checkmark_size-checkmark_space; + break; + } + + case ContentAlignment.TopLeft: { + checkbox_rectangle.X=client_rectangle.Left; + text_rectangle.X=client_rectangle.X+checkmark_size+checkmark_space; + text_rectangle.Width=client_rectangle.Width-checkmark_size-checkmark_space; + break; + } + + case ContentAlignment.TopRight: { + checkbox_rectangle.X=client_rectangle.Right-checkmark_size; + text_rectangle.X=client_rectangle.X; + text_rectangle.Width=client_rectangle.Width-checkmark_size-checkmark_space; + break; + } + } + } else { + text_rectangle.X=client_rectangle.X; + text_rectangle.Width=client_rectangle.Width; + } + + /* Set the horizontal alignment of our text */ + switch(checkbox.text_alignment) { + case ContentAlignment.BottomLeft: + case ContentAlignment.MiddleLeft: + case ContentAlignment.TopLeft: { + text_format.Alignment=StringAlignment.Near; + break; + } + + case ContentAlignment.BottomCenter: + case ContentAlignment.MiddleCenter: + case ContentAlignment.TopCenter: { + text_format.Alignment=StringAlignment.Center; + break; + } + + case ContentAlignment.BottomRight: + case ContentAlignment.MiddleRight: + case ContentAlignment.TopRight: { + text_format.Alignment=StringAlignment.Far; + break; + } + } + + /* Set the vertical alignment of our text */ + switch(checkbox.text_alignment) { + case ContentAlignment.TopLeft: + case ContentAlignment.TopCenter: + case ContentAlignment.TopRight: { + text_format.LineAlignment=StringAlignment.Near; + break; + } + + case ContentAlignment.BottomLeft: + case ContentAlignment.BottomCenter: + case ContentAlignment.BottomRight: { + text_format.LineAlignment=StringAlignment.Far; + break; + } + + case ContentAlignment.MiddleLeft: + case ContentAlignment.MiddleCenter: + case ContentAlignment.MiddleRight: { + text_format.LineAlignment=StringAlignment.Center; + break; + } + } + + ButtonState state = ButtonState.Normal; + if (checkbox.FlatStyle == FlatStyle.Flat) { + state |= ButtonState.Flat; + } + + if (checkbox.Checked) { + state |= ButtonState.Checked; + } + + if (checkbox.ThreeState && (checkbox.CheckState == CheckState.Indeterminate)) { + state |= ButtonState.Checked; + state |= ButtonState.Pushed; + } + + // finally make sure the pushed and inavtive states are rendered + if (!checkbox.Enabled) { + state |= ButtonState.Inactive; + } + else if (checkbox.is_pressed) { + state |= ButtonState.Pushed; + } + + // Start drawing + + CheckBox_DrawCheckBox(dc, checkbox, state, checkbox_rectangle); + + if ((checkbox.image != null) || (checkbox.image_list != null)) + ButtonBase_DrawImage(checkbox, dc); + + CheckBox_DrawText(checkbox, text_rectangle, dc, text_format); + + if (checkbox.Focused && checkbox.Enabled && checkbox.appearance != Appearance.Button && checkbox.Text != String.Empty && checkbox.ShowFocusCues) { + SizeF text_size = dc.MeasureString (checkbox.Text, checkbox.Font); + + Rectangle focus_rect = Rectangle.Empty; + focus_rect.X = text_rectangle.X; + focus_rect.Y = (int)((text_rectangle.Height - text_size.Height) / 2); + focus_rect.Size = text_size.ToSize (); + CheckBox_DrawFocus (checkbox, dc, focus_rect); + } + + text_format.Dispose (); + } + + protected virtual void CheckBox_DrawCheckBox( Graphics dc, CheckBox checkbox, ButtonState state, Rectangle checkbox_rectangle ) + { + Brush brush = checkbox.BackColor.ToArgb () == ColorControl.ToArgb () ? SystemBrushes.Control : ResPool.GetSolidBrush (checkbox.BackColor); + dc.FillRectangle (brush, checkbox.ClientRectangle); + // render as per normal button + if (checkbox.appearance==Appearance.Button) { + ButtonBase_DrawButton (checkbox, dc); + + if ((checkbox.Focused) && checkbox.Enabled) + ButtonBase_DrawFocus(checkbox, dc); + } else { + // establish if we are rendering a flat style of some sort + if (checkbox.FlatStyle == FlatStyle.Flat || checkbox.FlatStyle == FlatStyle.Popup) { + DrawFlatStyleCheckBox (dc, checkbox_rectangle, checkbox); + } else { + CPDrawCheckBox (dc, checkbox_rectangle, state); + } + } + } + + protected virtual void CheckBox_DrawText( CheckBox checkbox, Rectangle text_rectangle, Graphics dc, StringFormat text_format ) + { + DrawCheckBox_and_RadioButtonText (checkbox, text_rectangle, dc, + text_format, checkbox.Appearance, checkbox.Checked); + } + + protected virtual void CheckBox_DrawFocus( CheckBox checkbox, Graphics dc, Rectangle text_rectangle ) + { + DrawInnerFocusRectangle (dc, text_rectangle, checkbox.BackColor); + } + + // renders a checkBox with the Flat and Popup FlatStyle + protected virtual void DrawFlatStyleCheckBox (Graphics graphics, Rectangle rectangle, CheckBox checkbox) + { + Pen pen; + Rectangle rect; + Rectangle checkbox_rectangle; + Rectangle fill_rectangle; + int lineWidth; + int Scale; + + // set up our rectangles first + if (checkbox.FlatStyle == FlatStyle.Popup && checkbox.is_entered) { + // clip one pixel from bottom right for non popup rendered checkboxes + checkbox_rectangle = new Rectangle(rectangle.X, rectangle.Y, Math.Max(rectangle.Width-1, 0), Math.Max(rectangle.Height-1,0)); + fill_rectangle = new Rectangle(checkbox_rectangle.X+1, checkbox_rectangle.Y+1, Math.Max(checkbox_rectangle.Width-3, 0), Math.Max(checkbox_rectangle.Height-3,0)); + } else { + // clip two pixels from bottom right for non popup rendered checkboxes + checkbox_rectangle = new Rectangle(rectangle.X, rectangle.Y, Math.Max(rectangle.Width-2, 0), Math.Max(rectangle.Height-2,0)); + fill_rectangle = new Rectangle(checkbox_rectangle.X+1, checkbox_rectangle.Y+1, Math.Max(checkbox_rectangle.Width-2, 0), Math.Max(checkbox_rectangle.Height-2,0)); + } + + + // if disabled render in disabled state + if (checkbox.Enabled) { + // process the state of the checkbox + if (checkbox.is_entered || checkbox.Capture) { + // decide on which background color to use + if (checkbox.FlatStyle == FlatStyle.Popup && checkbox.is_entered && checkbox.Capture) { + graphics.FillRectangle(ResPool.GetSolidBrush (checkbox.BackColor), fill_rectangle); + } else if (checkbox.FlatStyle == FlatStyle.Flat) { + if (!checkbox.is_pressed) { + graphics.FillRectangle(ResPool.GetSolidBrush (checkbox.BackColor), fill_rectangle); + } else + graphics.FillRectangle(ResPool.GetSolidBrush (WidgetPaint.LightLight (checkbox.BackColor)), fill_rectangle); + } else { + // use regular window background color + graphics.FillRectangle(ResPool.GetSolidBrush (WidgetPaint.LightLight (checkbox.BackColor)), fill_rectangle); + } + + // render the outer border + if (checkbox.FlatStyle == FlatStyle.Flat) { + WidgetPaint.DrawBorder(graphics, checkbox_rectangle, checkbox.ForeColor, ButtonBorderStyle.Solid); + } else { + // draw sunken effect + CPDrawBorder3D (graphics, checkbox_rectangle, Border3DStyle.SunkenInner, Border3DSide.Left | Border3DSide.Right | Border3DSide.Top | Border3DSide.Bottom, checkbox.BackColor); + } + } else { + graphics.FillRectangle(ResPool.GetSolidBrush (WidgetPaint.LightLight (checkbox.BackColor)), fill_rectangle); + + if (checkbox.FlatStyle == FlatStyle.Flat) { + WidgetPaint.DrawBorder(graphics, checkbox_rectangle, checkbox.ForeColor, ButtonBorderStyle.Solid); + } else { + // draw the outer border + WidgetPaint.DrawBorder(graphics, checkbox_rectangle, WidgetPaint.DarkDark (checkbox.BackColor), ButtonBorderStyle.Solid); + } + } + } else { + if (checkbox.FlatStyle == FlatStyle.Popup) { + graphics.FillRectangle(SystemBrushes.Control, fill_rectangle); + } + + // draw disabled state, + WidgetPaint.DrawBorder(graphics, checkbox_rectangle, ColorControlDark, ButtonBorderStyle.Solid); + } + + if (checkbox.Checked) { + /* Need to draw a check-mark */ + + /* Make sure we've got at least a line width of 1 */ + lineWidth = Math.Max(3, fill_rectangle.Width/3); + Scale=Math.Max(1, fill_rectangle.Width/9); + + // flat style check box is rendered inside a rectangle shifted down by one + rect=new Rectangle(fill_rectangle.X, fill_rectangle.Y+1, fill_rectangle.Width, fill_rectangle.Height); + if (checkbox.Enabled) { + pen=ResPool.GetPen(checkbox.ForeColor); + } else { + pen=SystemPens.ControlDark; + } + + for (int i=0; i text_rectangle.Height) { + text_format.FormatFlags |= StringFormatFlags.NoWrap; + } + if (button_base.Enabled) { + dc.DrawString (button_base.Text, button_base.Font, ResPool.GetSolidBrush (button_base.ForeColor), text_rectangle, text_format); + } else if (button_base.FlatStyle == FlatStyle.Flat || button_base.FlatStyle == FlatStyle.Popup) { + dc.DrawString (button_base.Text, button_base.Font, SystemBrushes.ControlDarkDark, text_rectangle, text_format); + } else { + CPDrawStringDisabled (dc, button_base.Text, button_base.Font, button_base.BackColor, text_rectangle, text_format); + } + } + #endregion // CheckBox + + #region CheckedListBox + + public override void DrawCheckedListBoxItem (CheckedListBox ctrl, DrawItemEventArgs e) + { + Color back_color, fore_color; + Rectangle item_rect = e.Bounds; + ButtonState state; + + /* Draw checkbox */ + + if ((e.State & DrawItemState.Checked) == DrawItemState.Checked) { + state = ButtonState.Checked; + if ((e.State & DrawItemState.Inactive) == DrawItemState.Inactive) + state |= ButtonState.Inactive; + } else + state = ButtonState.Normal; + + if (ctrl.ThreeDCheckBoxes == false) + state |= ButtonState.Flat; + + Rectangle checkbox_rect = new Rectangle (2, (item_rect.Height - 11) / 2, CheckSize, CheckSize); + WidgetPaint.DrawCheckBox (e.Graphics, + item_rect.X + checkbox_rect.X, item_rect.Y + checkbox_rect.Y, + checkbox_rect.Width, checkbox_rect.Height, + state); + + item_rect.X += checkbox_rect.Right; + item_rect.Width -= checkbox_rect.Right; + + /* Draw text*/ + if ((e.State & DrawItemState.Selected) == DrawItemState.Selected) { + back_color = ColorHighlight; + fore_color = ColorHighlightText; + } + else { + back_color = e.BackColor; + fore_color = e.ForeColor; + } + + e.Graphics.FillRectangle (ResPool.GetSolidBrush + (back_color), item_rect); + + e.Graphics.DrawString (ctrl.GetItemText (ctrl.Items[e.Index]), e.Font, + ResPool.GetSolidBrush (fore_color), + item_rect, ctrl.StringFormat); + + if ((e.State & DrawItemState.Focus) == DrawItemState.Focus) { + CPDrawFocusRectangle (e.Graphics, item_rect, + fore_color, back_color); + } + } + + #endregion // CheckedListBox + + #region ComboBox + public override void DrawComboBoxItem (ComboBox ctrl, DrawItemEventArgs e) + { + Color back_color, fore_color; + Rectangle text_draw = e.Bounds; + StringFormat string_format = new StringFormat (); + string_format.FormatFlags = StringFormatFlags.LineLimit; + + if ((e.State & DrawItemState.Selected) == DrawItemState.Selected) { + back_color = ColorHighlight; + fore_color = ColorHighlightText; + } + else { + back_color = e.BackColor; + fore_color = e.ForeColor; + } + + if (!ctrl.Enabled) + fore_color = ColorInactiveCaptionText; + + e.Graphics.FillRectangle (ResPool.GetSolidBrush (back_color), e.Bounds); + + if (e.Index != -1) { + e.Graphics.DrawString (ctrl.GetItemText (ctrl.Items[e.Index]), e.Font, + ResPool.GetSolidBrush (fore_color), + text_draw, string_format); + } + + if ((e.State & DrawItemState.Focus) == DrawItemState.Focus) { + CPDrawFocusRectangle (e.Graphics, e.Bounds, fore_color, back_color); + } + + string_format.Dispose (); + } + + public override void DrawFlatStyleComboButton (Graphics graphics, Rectangle rectangle, ButtonState state) + { + Point[] arrow = new Point[3]; + Point P1; + Point P2; + Point P3; + int centerX; + int centerY; + int shiftX; + int shiftY; + Rectangle rect; + + rect=new Rectangle(rectangle.X+rectangle.Width/4, rectangle.Y+rectangle.Height/4, rectangle.Width/2, rectangle.Height/2); + centerX=rect.Left+rect.Width/2; + centerY=rect.Top+rect.Height/2; + shiftX=Math.Max(1, rect.Width/8); + shiftY=Math.Max(1, rect.Height/8); + + if ((state & ButtonState.Pushed)!=0) { + shiftX++; + shiftY++; + } + + rect.Y-=shiftY; + centerY-=shiftY; + P1=new Point(rect.Left + 1, centerY); + P2=new Point(rect.Right - 1, centerY); + P3=new Point(centerX, rect.Bottom - 1); + + arrow[0]=P1; + arrow[1]=P2; + arrow[2]=P3; + + /* Draw the arrow */ + if ((state & ButtonState.Inactive)!=0) { + /* Move away from the shadow */ + arrow[0].X += 1; arrow[0].Y += 1; + arrow[1].X += 1; arrow[1].Y += 1; + arrow[2].X += 1; arrow[2].Y += 1; + + graphics.FillPolygon(SystemBrushes.ControlLightLight, arrow, FillMode.Winding); + + arrow[0]=P1; + arrow[1]=P2; + arrow[2]=P3; + + graphics.FillPolygon(SystemBrushes.ControlDark, arrow, FillMode.Winding); + } else { + graphics.FillPolygon(SystemBrushes.ControlText, arrow, FillMode.Winding); + } + } + public override void ComboBoxDrawNormalDropDownButton (ComboBox comboBox, Graphics g, Rectangle clippingArea, Rectangle area, ButtonState state) + { + CPDrawComboButton (g, area, state); + } + public override bool ComboBoxNormalDropDownButtonHasTransparentBackground (ComboBox comboBox, ButtonState state) + { + return true; + } + public override bool ComboBoxDropDownButtonHasHotElementStyle (ComboBox comboBox) + { + return false; + } + public override void ComboBoxDrawBackground (ComboBox comboBox, Graphics g, Rectangle clippingArea, FlatStyle style) + { + if (!comboBox.Enabled) + g.FillRectangle (ResPool.GetSolidBrush (ColorControl), comboBox.ClientRectangle); + + if (comboBox.DropDownStyle == ComboBoxStyle.Simple) + g.FillRectangle (ResPool.GetSolidBrush (comboBox.Parent.BackColor), comboBox.ClientRectangle); + + if (style == FlatStyle.Popup && (comboBox.Entered || comboBox.Focused)) { + Rectangle area = comboBox.TextArea; + area.Height -= 1; + area.Width -= 1; + g.DrawRectangle (ResPool.GetPen (SystemColors.ControlDark), area); + g.DrawLine (ResPool.GetPen (SystemColors.ControlDark), comboBox.ButtonArea.X - 1, comboBox.ButtonArea.Top, comboBox.ButtonArea.X - 1, comboBox.ButtonArea.Bottom); + } + bool is_flat = style == FlatStyle.Flat || style == FlatStyle.Popup; + if (!is_flat && clippingArea.IntersectsWith (comboBox.TextArea)) + WidgetPaint.DrawBorder3D (g, comboBox.TextArea, Border3DStyle.Sunken); + } + public override bool CombBoxBackgroundHasHotElementStyle (ComboBox comboBox) + { + return false; + } + #endregion ComboBox + + /* FIXME: NEIN. I will NOT port DataGrids over. + #region Datagrid + public override int DataGridPreferredColumnWidth { get { return 75;} } + public override int DataGridMinimumColumnCheckBoxHeight { get { return 16;} } + public override int DataGridMinimumColumnCheckBoxWidth { get { return 16;} } + public override Color DataGridAlternatingBackColor { get { return ColorWindow;} } + public override Color DataGridBackColor { get { return ColorWindow;} } + public override Color DataGridBackgroundColor { get { return ColorAppWorkspace;} } + public override Color DataGridCaptionBackColor { get { return ColorActiveCaption;} } + public override Color DataGridCaptionForeColor { get { return ColorActiveCaptionText;} } + public override Color DataGridGridLineColor { get { return ColorControl;} } + public override Color DataGridHeaderBackColor { get { return ColorControl;} } + public override Color DataGridHeaderForeColor { get { return ColorControlText;} } + public override Color DataGridLinkColor { get { return ColorHotTrack;} } + public override Color DataGridLinkHoverColor { get { return ColorHotTrack;} } + public override Color DataGridParentRowsBackColor { get { return ColorControl;} } + public override Color DataGridParentRowsForeColor { get { return ColorWindowText;} } + public override Color DataGridSelectionBackColor { get { return ColorActiveCaption;} } + public override Color DataGridSelectionForeColor { get { return ColorActiveCaptionText;} } + + public override void DataGridPaint (PaintEventArgs pe, DataGrid grid) + { + DataGridPaintCaption (pe.Graphics, pe.ClipRectangle, grid); + DataGridPaintParentRows (pe.Graphics, pe.ClipRectangle, grid); + DataGridPaintColumnHeaders (pe.Graphics, pe.ClipRectangle, grid); + DataGridPaintRows (pe.Graphics, grid.cells_area, pe.ClipRectangle, grid); + + // Paint scrollBar corner + if (grid.VScrollBar.Visible && grid.HScrollBar.Visible) { + + Rectangle corner = new Rectangle (grid.ClientRectangle.X + grid.ClientRectangle.Width - grid.VScrollBar.Width, + grid.ClientRectangle.Y + grid.ClientRectangle.Height - grid.HScrollBar.Height, + grid.VScrollBar.Width, grid.HScrollBar.Height); + + if (pe.ClipRectangle.IntersectsWith (corner)) { + pe.Graphics.FillRectangle (ResPool.GetSolidBrush (grid.ParentRowsBackColor), + corner); + } + } + } + + public override void DataGridPaintCaption (Graphics g, Rectangle clip, DataGrid grid) + { + Rectangle bounds = clip; + bounds.Intersect (grid.caption_area); + + // Background + g.FillRectangle (ResPool.GetSolidBrush (grid.CaptionBackColor), bounds); + + // Bottom line + g.DrawLine (ResPool.GetPen (grid.CurrentTableStyle.CurrentHeaderForeColor), + bounds.X, bounds.Y + bounds.Height -1, + bounds.X + bounds.Width, bounds.Y + bounds.Height -1); + + // Caption text + if (grid.CaptionText != String.Empty) { + Rectangle text_rect = grid.caption_area; + text_rect.Y += text_rect.Height / 2 - grid.CaptionFont.Height / 2; + text_rect.Height = grid.CaptionFont.Height; + + g.DrawString (grid.CaptionText, grid.CaptionFont, + ResPool.GetSolidBrush (grid.CaptionForeColor), + text_rect); + } + + // Back button + if (bounds.IntersectsWith (grid.back_button_rect)) { + g.DrawImage (grid.back_button_image, grid.back_button_rect); + if (grid.back_button_mouseover) { + CPDrawBorder3D (g, grid.back_button_rect, grid.back_button_active ? Border3DStyle.Sunken : Border3DStyle.Raised, all_sides); + } + } + + // Rows button + if (bounds.IntersectsWith (grid.parent_rows_button_rect)) { + g.DrawImage (grid.parent_rows_button_image, grid.parent_rows_button_rect); + if (grid.parent_rows_button_mouseover) { + CPDrawBorder3D (g, grid.parent_rows_button_rect, grid.parent_rows_button_active ? Border3DStyle.Sunken : Border3DStyle.Raised, all_sides); + } + } + } + + public override void DataGridPaintColumnHeaders (Graphics g, Rectangle clip, DataGrid grid) + { + if (!grid.CurrentTableStyle.ColumnHeadersVisible) + return; + + Rectangle columns_area = grid.column_headers_area; + + // Paint corner shared between row and column header + if (grid.CurrentTableStyle.CurrentRowHeadersVisible) { + Rectangle rect_bloc = grid.column_headers_area; + rect_bloc.Width = grid.RowHeaderWidth; + if (clip.IntersectsWith (rect_bloc)) { + if (grid.FlatMode) + g.FillRectangle (ResPool.GetSolidBrush (grid.CurrentTableStyle.CurrentHeaderBackColor), rect_bloc); + else + CPDrawBorder3D (g, rect_bloc, Border3DStyle.RaisedInner, + Border3DSide.Left | Border3DSide.Right | + Border3DSide.Top | Border3DSide.Bottom | Border3DSide.Middle, + grid.CurrentTableStyle.CurrentHeaderBackColor); + } + + columns_area.X += grid.RowHeaderWidth; + columns_area.Width -= grid.RowHeaderWidth; + } + + // Set column painting + Rectangle rect_columnhdr = new Rectangle (); + int col_pixel; + Region current_clip; + Region prev_clip = g.Clip; + rect_columnhdr.Y = columns_area.Y; + rect_columnhdr.Height = columns_area.Height; + + int column_cnt = grid.FirstVisibleColumn + grid.VisibleColumnCount; + for (int column = grid.FirstVisibleColumn; column < column_cnt; column++) { + if (grid.CurrentTableStyle.GridColumnStyles[column].bound == false) + continue; + + col_pixel = grid.GetColumnStartingPixel (column); + rect_columnhdr.X = columns_area.X + col_pixel - grid.HorizPixelOffset; + rect_columnhdr.Width = grid.CurrentTableStyle.GridColumnStyles[column].Width; + + if (clip.IntersectsWith (rect_columnhdr) == false) + continue; + + current_clip = new Region (rect_columnhdr); + current_clip.Intersect (columns_area); + current_clip.Intersect (prev_clip); + g.Clip = current_clip; + + DataGridPaintColumnHeader (g, rect_columnhdr, grid, column); + + current_clip.Dispose (); + } + + g.Clip = prev_clip; + + Rectangle not_usedarea = grid.column_headers_area; + not_usedarea.X = (column_cnt == 0) ? grid.RowHeaderWidth : rect_columnhdr.X + rect_columnhdr.Width; + not_usedarea.Width = grid.ClientRectangle.X + grid.ClientRectangle.Width - not_usedarea.X; + g.FillRectangle (ResPool.GetSolidBrush (grid.BackgroundColor), not_usedarea); + } + + public override void DataGridPaintColumnHeader (Graphics g, Rectangle bounds, DataGrid grid, int col) + { + // Background + g.FillRectangle (ResPool.GetSolidBrush (grid.CurrentTableStyle.HeaderBackColor), bounds); + + // Paint Borders + if (!grid.FlatMode) { + g.DrawLine (ResPool.GetPen (ColorControlLightLight), + bounds.X, bounds.Y, bounds.X + bounds.Width, bounds.Y); + + if (col == 0) { + g.DrawLine (ResPool.GetPen (ColorControlLightLight), + bounds.X, bounds.Y, bounds.X, bounds.Y + bounds.Height); + } else { + g.DrawLine (ResPool.GetPen (ColorControlLightLight), + bounds.X, bounds.Y + 2, bounds.X, bounds.Y + bounds.Height - 3); + } + + if (col == (grid.VisibleColumnCount -1)) { + g.DrawLine (ResPool.GetPen (ColorControlDark), + bounds.X + bounds.Width - 1, bounds.Y, + bounds.X + bounds.Width - 1, bounds.Y + bounds.Height); + } else { + g.DrawLine (ResPool.GetPen (ColorControlDark), + bounds.X + bounds.Width - 1, bounds.Y + 2, + bounds.X + bounds.Width - 1, bounds.Y + bounds.Height - 3); + } + + g.DrawLine (ResPool.GetPen (ColorControlDark), + bounds.X, bounds.Y + bounds.Height - 1, + bounds.X + bounds.Width, bounds.Y + bounds.Height - 1); + } + + bounds.X += 2; + bounds.Width -= 2; + + DataGridColumnStyle style = grid.CurrentTableStyle.GridColumnStyles[col]; + + if (style.ArrowDrawingMode != DataGridColumnStyle.ArrowDrawing.No) + bounds.Width -= 16; + + // Caption + StringFormat format = new StringFormat (); + format.FormatFlags |= StringFormatFlags.NoWrap; + format.LineAlignment = StringAlignment.Center; + format.Trimming = StringTrimming.Character; + + g.DrawString (style.HeaderText, grid.CurrentTableStyle.HeaderFont, + ResPool.GetSolidBrush (grid.CurrentTableStyle.CurrentHeaderForeColor), + bounds, format); + + // Arrow (6 x 6) + if (style.ArrowDrawingMode != DataGridColumnStyle.ArrowDrawing.No) { + Point pnt = new Point (bounds.X + bounds.Width + 4, bounds.Y + ((bounds.Height - 6)/2)); + + if (style.ArrowDrawingMode == DataGridColumnStyle.ArrowDrawing.Ascending) { + g.DrawLine (SystemPens.ControlLightLight, pnt.X + 6, pnt.Y + 6, pnt.X + 3, pnt.Y); + g.DrawLine (SystemPens.ControlDark, pnt.X, pnt.Y + 6, pnt.X + 6, pnt.Y + 6); + g.DrawLine (SystemPens.ControlDark, pnt.X, pnt.Y + 6, pnt.X + 3, pnt.Y); + } else { + g.DrawLine (SystemPens.ControlLightLight, pnt.X + 6, pnt.Y, pnt.X + 3, pnt.Y + 6); + g.DrawLine (SystemPens.ControlDark, pnt.X, pnt.Y, pnt.X + 6, pnt.Y); + g.DrawLine (SystemPens.ControlDark, pnt.X, pnt.Y, pnt.X + 3, pnt.Y + 6); + } + } + } + + public override void DataGridPaintParentRows (Graphics g, Rectangle clip, DataGrid grid) + { + Rectangle rect_row = new Rectangle (); + + rect_row.X = grid.ParentRowsArea.X; + rect_row.Width = grid.ParentRowsArea.Width; + rect_row.Height = (grid.CaptionFont.Height + 3); + + object[] parentRows = grid.data_source_stack.ToArray(); + + Region current_clip; + Region prev_clip = g.Clip; + for (int row = 0; row < parentRows.Length; row++) { + rect_row.Y = grid.ParentRowsArea.Y + row * rect_row.Height; + + if (clip.IntersectsWith (rect_row) == false) + continue; + + current_clip = new Region (rect_row); + current_clip.Intersect (prev_clip); + g.Clip = current_clip; + + DataGridPaintParentRow (g, rect_row, (DataGridDataSource)parentRows[parentRows.Length - row - 1], grid); + + current_clip.Dispose (); + } + + g.Clip = prev_clip; + } + + public override void DataGridPaintParentRow (Graphics g, Rectangle bounds, DataGridDataSource row, DataGrid grid) + { + // Background + g.FillRectangle (ResPool.GetSolidBrush (grid.ParentRowsBackColor), + bounds); + + Font bold_font = new Font (grid.Font.FontFamily, grid.Font.Size, grid.Font.Style | FontStyle.Bold); + // set up some standard string formating variables + StringFormat text_format = new StringFormat(); + text_format.LineAlignment = StringAlignment.Center; + text_format.Alignment = StringAlignment.Near; + + string table_name = ""; + if (row.view is DataRowView) + table_name = ((ITypedList)((DataRowView)row.view).DataView).GetListName (null) + ": "; + // XXX else? + + Rectangle text_rect; + Size text_size; + + text_size = g.MeasureString (table_name, bold_font).ToSize(); + text_rect = new Rectangle(new Point(bounds.X + 3, bounds.Y + bounds.Height - text_size.Height), text_size); + + g.DrawString (table_name, + bold_font, ResPool.GetSolidBrush (grid.ParentRowsForeColor), text_rect, text_format); + + foreach (PropertyDescriptor pd in ((ICustomTypeDescriptor)row.view).GetProperties()) { + if (typeof(IBindingList).IsAssignableFrom (pd.PropertyType)) + continue; + + text_rect.X += text_rect.Size.Width + 5; + + string text = String.Format ("{0}: {1}", + pd.Name, + pd.GetValue (row.view)); + + text_rect.Size = g.MeasureString (text, grid.Font).ToSize(); + text_rect.Y = bounds.Y + bounds.Height - text_rect.Height; // XXX + + g.DrawString (text, + grid.Font, ResPool.GetSolidBrush (grid.ParentRowsForeColor), text_rect, text_format); + } + + // Paint Borders + if (!grid.FlatMode) { + CPDrawBorder3D (g, bounds, Border3DStyle.RaisedInner, + Border3DSide.Left | Border3DSide.Right | + Border3DSide.Top | Border3DSide.Bottom); + } + } + + public override void DataGridPaintRowHeaderArrow (Graphics g, Rectangle bounds, DataGrid grid) + { + Point[] arrow = new Point[3]; + Point P1, P2, P3; + int centerX, centerY, shiftX; + Rectangle rect; + + rect = new Rectangle (bounds.X + bounds.Width /4, + bounds.Y + bounds.Height/4, bounds.Width / 2, bounds.Height / 2); + + centerX = rect.Left + rect.Width / 2; + centerY = rect.Top + rect.Height / 2; + shiftX = Math.Max (1, rect.Width / 8); + rect.X -= shiftX; + centerX -= shiftX; + P1 = new Point (centerX, rect.Top - 1); + P2 = new Point (centerX, rect.Bottom); + P3 = new Point (rect.Right, centerY); + arrow[0] = P1; + arrow[1] = P2; + arrow[2] = P3; + + g.FillPolygon (ResPool.GetSolidBrush + (grid.CurrentTableStyle.CurrentHeaderForeColor), arrow, FillMode.Winding); + } + + public override void DataGridPaintRowHeaderStar (Graphics g, Rectangle bounds, DataGrid grid) + { + int x = bounds.X + 4; + int y = bounds.Y + 3; + Pen pen = ResPool.GetPen (grid.CurrentTableStyle.CurrentHeaderForeColor); + + g.DrawLine (pen, x + 4, y, x + 4, y + 8); + g.DrawLine (pen, x, y + 4, x + 8, y + 4); + g.DrawLine (pen, x + 1, y + 1, x + 7, y + 7); + g.DrawLine (pen, x + 7, y + 1, x + 1, y + 7); + } + + public override void DataGridPaintRowHeader (Graphics g, Rectangle bounds, int row, DataGrid grid) + { + bool is_add_row = grid.ShowEditRow && row == grid.DataGridRows.Length - 1; + bool is_current_row = row == grid.CurrentCell.RowNumber; + + // Background + g.FillRectangle (ResPool.GetSolidBrush (grid.CurrentTableStyle.CurrentHeaderBackColor), bounds); + + // Draw arrow + if (is_current_row) { + if (grid.IsChanging) { + g.DrawString ("...", grid.Font, + ResPool.GetSolidBrush (grid.CurrentTableStyle.CurrentHeaderForeColor), + bounds); + } else { + Rectangle rect = new Rectangle (bounds.X - 2, bounds.Y, 18, 18); + DataGridPaintRowHeaderArrow (g, rect, grid); + } + } + else if (is_add_row) { + DataGridPaintRowHeaderStar (g, bounds, grid); + } + + if (!grid.FlatMode && !is_add_row) { + CPDrawBorder3D (g, bounds, Border3DStyle.RaisedInner, + Border3DSide.Left | Border3DSide.Right | + Border3DSide.Top | Border3DSide.Bottom); + } + } + + public override void DataGridPaintRows (Graphics g, Rectangle cells, Rectangle clip, DataGrid grid) + { + Rectangle rect_row = new Rectangle (); + Rectangle not_usedarea = new Rectangle (); + + int rowcnt = grid.VisibleRowCount; + + bool showing_add_row = false; + + if (grid.RowsCount < grid.DataGridRows.Length) { + /* the table has an add row + + if (grid.FirstVisibleRow + grid.VisibleRowCount >= grid.DataGridRows.Length) { + showing_add_row = true; + } + } + + rect_row.Width = cells.Width + grid.RowHeadersArea.Width; + for (int r = 0; r < rowcnt; r++) { + int row = grid.FirstVisibleRow + r; + if (row == grid.DataGridRows.Length - 1) + rect_row.Height = grid.DataGridRows[row].Height; + else + rect_row.Height = grid.DataGridRows[row + 1].VerticalOffset - grid.DataGridRows[row].VerticalOffset; + rect_row.Y = cells.Y + grid.DataGridRows[row].VerticalOffset - grid.DataGridRows[grid.FirstVisibleRow].VerticalOffset; + if (clip.IntersectsWith (rect_row)) { + if (grid.CurrentTableStyle.HasRelations + && !(showing_add_row && row == grid.DataGridRows.Length - 1)) + DataGridPaintRelationRow (g, row, rect_row, false, clip, grid); + else + DataGridPaintRow (g, row, rect_row, showing_add_row && row == grid.DataGridRows.Length - 1, clip, grid); + } + } + + not_usedarea.X = 0; + // the rowcnt == 0 check is needed because + // otherwise we'd draw over the caption on + // empty datasources (since rect_row would be + // Empty) + if (rowcnt == 0) + not_usedarea.Y = cells.Y; + else + not_usedarea.Y = rect_row.Y + rect_row.Height; + not_usedarea.Height = cells.Y + cells.Height - rect_row.Y - rect_row.Height; + not_usedarea.Width = cells.Width + grid.RowHeadersArea.Width; + + g.FillRectangle (ResPool.GetSolidBrush (grid.BackgroundColor), not_usedarea); + } + + public override void DataGridPaintRelationRow (Graphics g, int row, Rectangle row_rect, bool is_newrow, + Rectangle clip, DataGrid grid) + { + Rectangle rect_header; + Rectangle icon_bounds = new Rectangle (); + Pen pen = ThemeEngine.Current.ResPool.GetPen (grid.CurrentTableStyle.ForeColor); + + /* paint the header if it's visible and intersects the clip + if (grid.CurrentTableStyle.CurrentRowHeadersVisible) { + rect_header = row_rect; + rect_header.Width = grid.RowHeaderWidth; + row_rect.X += grid.RowHeaderWidth; + if (clip.IntersectsWith (rect_header)) { + DataGridPaintRowHeader (g, rect_header, row, grid); + } + + icon_bounds = rect_header; + icon_bounds.X += icon_bounds.Width / 2; + icon_bounds.Y += 3; + icon_bounds.Width = 8; + icon_bounds.Height = 8; + + g.DrawRectangle (pen, icon_bounds); + + /* the - part of the icon + g.DrawLine (pen, + icon_bounds.X + 2, icon_bounds.Y + icon_bounds.Height / 2, + icon_bounds.X + icon_bounds.Width - 2, icon_bounds.Y + icon_bounds.Height / 2); + + if (!grid.IsExpanded (row)) { + /* the | part of the icon + g.DrawLine (pen, + icon_bounds.X + icon_bounds.Width / 2, icon_bounds.Y + 2, + icon_bounds.X + icon_bounds.Width / 2, icon_bounds.Y + icon_bounds.Height - 2); + } + } + + Rectangle nested_rect = row_rect; + + if (grid.DataGridRows[row].IsExpanded) + nested_rect.Height -= grid.DataGridRows[row].RelationHeight; + + DataGridPaintRowContents (g, row, nested_rect, is_newrow, clip, grid); + + if (grid.DataGridRows[row].IsExpanded) { + // XXX we should create this in the + // datagrid and cache it for use by + // the theme instead of doing it each + // time through here + string[] relations = grid.CurrentTableStyle.Relations; + StringBuilder relation_builder = new StringBuilder (""); + + for (int i = 0; i < relations.Length; i ++) { + if (i > 0) + relation_builder.Append ("\n"); + + relation_builder.Append (relations[i]); + } + string relation_text = relation_builder.ToString (); + + StringFormat string_format = new StringFormat (); + string_format.FormatFlags |= StringFormatFlags.NoWrap; + + + //Region prev_clip = g.Clip; + //Region current_clip; + Rectangle rect_cell = row_rect; + + rect_cell.X = nested_rect.X + grid.GetColumnStartingPixel (grid.FirstVisibleColumn) - grid.HorizPixelOffset; + rect_cell.Y += nested_rect.Height; + rect_cell.Height = grid.DataGridRows[row].RelationHeight; + + rect_cell.Width = 0; + int column_cnt = grid.FirstVisibleColumn + grid.VisibleColumnCount; + for (int column = grid.FirstVisibleColumn; column < column_cnt; column++) { + if (grid.CurrentTableStyle.GridColumnStyles[column].bound == false) + continue; + rect_cell.Width += grid.CurrentTableStyle.GridColumnStyles[column].Width; + } + rect_cell.Width = Math.Max (rect_cell.Width, grid.DataGridRows[row].relation_area.Width); + + g.FillRectangle (ThemeEngine.Current.ResPool.GetSolidBrush (grid.CurrentTableStyle.BackColor), + rect_cell); + + + /* draw the line leading from the +/- to the relation area + Rectangle outline = grid.DataGridRows[row].relation_area; + outline.Y = rect_cell.Y; + outline.Height --; + + g.DrawLine (pen, + icon_bounds.X + icon_bounds.Width / 2, icon_bounds.Y + icon_bounds.Height, + icon_bounds.X + icon_bounds.Width / 2, outline.Y + outline.Height / 2); + + g.DrawLine (pen, + icon_bounds.X + icon_bounds.Width / 2, outline.Y + outline.Height / 2, + outline.X, outline.Y + outline.Height / 2); + + g.DrawRectangle (pen, outline); + + g.DrawString (relation_text, grid.LinkFont, ResPool.GetSolidBrush (grid.LinkColor), + outline, string_format); + + if (row_rect.X + row_rect.Width > rect_cell.X + rect_cell.Width) { + Rectangle not_usedarea = new Rectangle (); + not_usedarea.X = rect_cell.X + rect_cell.Width; + not_usedarea.Width = row_rect.X + row_rect.Width - rect_cell.X - rect_cell.Width; + not_usedarea.Y = row_rect.Y; + not_usedarea.Height = row_rect.Height; + if (clip.IntersectsWith (not_usedarea)) + g.FillRectangle (ResPool.GetSolidBrush (grid.BackgroundColor), + not_usedarea); + } + } + } + + public override void DataGridPaintRowContents (Graphics g, int row, Rectangle row_rect, bool is_newrow, + Rectangle clip, DataGrid grid) + { + Rectangle rect_cell = new Rectangle (); + int col_pixel; + Color backcolor, forecolor; + Brush backBrush, foreBrush; + Rectangle not_usedarea = Rectangle.Empty; + + rect_cell.Y = row_rect.Y; + rect_cell.Height = row_rect.Height; + + if (grid.IsSelected (row)) { + backcolor = grid.SelectionBackColor; + forecolor = grid.SelectionForeColor; + } else { + if (row % 2 == 0) { + backcolor = grid.BackColor; + } else { + backcolor = grid.AlternatingBackColor; + } + + forecolor = grid.ForeColor; + } + + + backBrush = ResPool.GetSolidBrush (backcolor); + foreBrush = ResPool.GetSolidBrush (forecolor); + + // PaintCells at row, column + int column_cnt = grid.FirstVisibleColumn + grid.VisibleColumnCount; + DataGridCell current_cell = grid.CurrentCell; + + if (column_cnt > 0) { + Region prev_clip = g.Clip; + Region current_clip; + + for (int column = grid.FirstVisibleColumn; column < column_cnt; column++) { + if (grid.CurrentTableStyle.GridColumnStyles[column].bound == false) + continue; + + col_pixel = grid.GetColumnStartingPixel (column); + + rect_cell.X = row_rect.X + col_pixel - grid.HorizPixelOffset; + rect_cell.Width = grid.CurrentTableStyle.GridColumnStyles[column].Width; + + if (clip.IntersectsWith (rect_cell)) { + current_clip = new Region (rect_cell); + current_clip.Intersect (row_rect); + current_clip.Intersect (prev_clip); + g.Clip = current_clip; + + Brush colBackBrush = backBrush; + Brush colForeBrush = foreBrush; + + // If we are in the precise cell we are editing, then use the normal colors + // even if we are selected. + if (grid.is_editing && column == current_cell.ColumnNumber && row == current_cell.RowNumber) { + colBackBrush = ResPool.GetSolidBrush (grid.BackColor); + colForeBrush = ResPool.GetSolidBrush (grid.ForeColor); + } + + if (is_newrow) { + grid.CurrentTableStyle.GridColumnStyles[column].PaintNewRow (g, rect_cell, + colBackBrush, + colForeBrush); + } else { + grid.CurrentTableStyle.GridColumnStyles[column].Paint (g, rect_cell, grid.ListManager, row, + colBackBrush, + colForeBrush, + grid.RightToLeft == RightToLeft.Yes); + } + + current_clip.Dispose (); + } + } + + g.Clip = prev_clip; + + if (row_rect.X + row_rect.Width > rect_cell.X + rect_cell.Width) { + not_usedarea.X = rect_cell.X + rect_cell.Width; + not_usedarea.Width = row_rect.X + row_rect.Width - rect_cell.X - rect_cell.Width; + not_usedarea.Y = row_rect.Y; + not_usedarea.Height = row_rect.Height; + } + } + else { + not_usedarea = row_rect; + } + + if (!not_usedarea.IsEmpty && clip.IntersectsWith (not_usedarea)) + g.FillRectangle (ResPool.GetSolidBrush (grid.BackgroundColor), + not_usedarea); + } + + public override void DataGridPaintRow (Graphics g, int row, Rectangle row_rect, bool is_newrow, + Rectangle clip, DataGrid grid) + { + /* paint the header if it's visible and intersects the clip + if (grid.CurrentTableStyle.CurrentRowHeadersVisible) { + Rectangle rect_header = row_rect; + rect_header.Width = grid.RowHeaderWidth; + row_rect.X += grid.RowHeaderWidth; + if (clip.IntersectsWith (rect_header)) { + DataGridPaintRowHeader (g, rect_header, row, grid); + } + } + + DataGridPaintRowContents (g, row, row_rect, is_newrow, clip, grid); + } + + #endregion // Datagrid + + #region DataGridView + #region DataGridViewHeaderCell + #region DataGridViewRowHeaderCell + public override bool DataGridViewRowHeaderCellDrawBackground (DataGridViewRowHeaderCell cell, Graphics g, Rectangle bounds) + { + return false; + } + + public override bool DataGridViewRowHeaderCellDrawSelectionBackground (DataGridViewRowHeaderCell cell) + { + return false; + } + + public override bool DataGridViewRowHeaderCellDrawBorder (DataGridViewRowHeaderCell cell, Graphics g, Rectangle bounds) + { + return false; + } + #endregion + + #region DataGridViewColumnHeaderCell + public override bool DataGridViewColumnHeaderCellDrawBackground (DataGridViewColumnHeaderCell cell, Graphics g, Rectangle bounds) + { + return false; + } + + public override bool DataGridViewColumnHeaderCellDrawBorder (DataGridViewColumnHeaderCell cell, Graphics g, Rectangle bounds) + { + return false; + } + #endregion + + public override bool DataGridViewHeaderCellHasPressedStyle (DataGridView dataGridView) + { + return false; + } + + public override bool DataGridViewHeaderCellHasHotStyle (DataGridView dataGridView) + { + return false; + } + #endregion + #endregion +*/ + + #region DateTimePicker + protected virtual void DateTimePickerDrawBorder (DateTimePicker dateTimePicker, Graphics g, Rectangle clippingArea) + { + this.CPDrawBorder3D (g, dateTimePicker.ClientRectangle, Border3DStyle.Sunken, Border3DSide.Left | Border3DSide.Right | Border3DSide.Top | Border3DSide.Bottom, dateTimePicker.BackColor); + } + + protected virtual void DateTimePickerDrawDropDownButton (DateTimePicker dateTimePicker, Graphics g, Rectangle clippingArea) + { + ButtonState state = dateTimePicker.is_drop_down_visible ? ButtonState.Pushed : ButtonState.Normal; + g.FillRectangle (ResPool.GetSolidBrush (ColorControl), dateTimePicker.drop_down_arrow_rect); + this.CPDrawComboButton ( + g, + dateTimePicker.drop_down_arrow_rect, + state); + } + + public override void DrawDateTimePicker(Graphics dc, Rectangle clip_rectangle, DateTimePicker dtp) + { + + if (!clip_rectangle.IntersectsWith (dtp.ClientRectangle)) + return; + + // draw the outer border + Rectangle button_bounds = dtp.ClientRectangle; + DateTimePickerDrawBorder (dtp, dc, clip_rectangle); + + // deflate by the border width + if (clip_rectangle.IntersectsWith (dtp.drop_down_arrow_rect)) { + button_bounds.Inflate (-2,-2); + if (!dtp.ShowUpDown) { + DateTimePickerDrawDropDownButton (dtp, dc, clip_rectangle); + } else { + ButtonState up_state = dtp.is_up_pressed ? ButtonState.Pushed : ButtonState.Normal; + ButtonState down_state = dtp.is_down_pressed ? ButtonState.Pushed : ButtonState.Normal; + Rectangle up_bounds = dtp.drop_down_arrow_rect; + Rectangle down_bounds = dtp.drop_down_arrow_rect; + + up_bounds.Height = up_bounds.Height / 2; + down_bounds.Y = up_bounds.Height; + down_bounds.Height = dtp.Height - up_bounds.Height; + if (down_bounds.Height > up_bounds.Height) + { + down_bounds.Y += 1; + down_bounds.Height -= 1; + } + + up_bounds.Inflate (-1, -1); + down_bounds.Inflate (-1, -1); + + WidgetPaint.DrawScrollButton (dc, up_bounds, ScrollButton.Up, up_state); + WidgetPaint.DrawScrollButton (dc, down_bounds, ScrollButton.Down, down_state); + } + } + + // render the date part + if (!clip_rectangle.IntersectsWith (dtp.date_area_rect)) + return; + + // fill the background + dc.FillRectangle (SystemBrushes.Window, dtp.date_area_rect); + + // Update date_area_rect if we are drawing the checkbox + Rectangle date_area_rect = dtp.date_area_rect; + if (dtp.ShowCheckBox) { + Rectangle check_box_rect = dtp.CheckBoxRect; + date_area_rect.X = date_area_rect.X + check_box_rect.Width + DateTimePicker.check_box_space * 2; + date_area_rect.Width = date_area_rect.Width - check_box_rect.Width - DateTimePicker.check_box_space * 2; + + ButtonState bs = dtp.Checked ? ButtonState.Checked : ButtonState.Normal; + CPDrawCheckBox(dc, check_box_rect, bs); + + if (dtp.is_checkbox_selected) + CPDrawFocusRectangle (dc, check_box_rect, dtp.foreground_color, dtp.background_color); + } + + // render each text part + using (StringFormat text_format = StringFormat.GenericTypographic) + { + text_format.LineAlignment = StringAlignment.Near; + text_format.Alignment = StringAlignment.Near; + text_format.FormatFlags = text_format.FormatFlags | StringFormatFlags.MeasureTrailingSpaces | StringFormatFlags.NoWrap | StringFormatFlags.FitBlackBox; + text_format.FormatFlags &= ~StringFormatFlags.NoClip; + + // Calculate the rectangles for each part + if (dtp.part_data.Length > 0 && dtp.part_data[0].drawing_rectangle.IsEmpty) + { + Graphics gr = dc; + for (int i = 0; i < dtp.part_data.Length; i++) + { + DateTimePicker.PartData fd = dtp.part_data[i]; + RectangleF text_rect = new RectangleF(); + string text = fd.GetText(dtp.Value); + text_rect.Size = gr.MeasureString (text, dtp.Font, 250, text_format); + if (!fd.is_literal) + text_rect.Width = Math.Max (dtp.CalculateMaxWidth(fd.value, gr, text_format), text_rect.Width); + + if (i > 0) { + text_rect.X = dtp.part_data[i - 1].drawing_rectangle.Right; + } else { + text_rect.X = date_area_rect.X; + } + text_rect.Y = 2; + text_rect.Inflate (1, 0); + fd.drawing_rectangle = text_rect; + } + } + + // draw the text part + Brush text_brush = ResPool.GetSolidBrush (dtp.ShowCheckBox && dtp.Checked == false ? + SystemColors.GrayText : dtp.ForeColor); // Use GrayText if Checked is false + RectangleF clip_rectangleF = clip_rectangle; + + for (int i = 0; i < dtp.part_data.Length; i++) + { + DateTimePicker.PartData fd = dtp.part_data [i]; + string text; + + if (!clip_rectangleF.IntersectsWith (fd.drawing_rectangle)) + continue; + + text = dtp.editing_part_index == i ? dtp.editing_text : fd.GetText (dtp.Value); + + PointF text_position = new PointF (); + SizeF text_size; + RectangleF text_rect; + + text_size = dc.MeasureString (text, dtp.Font, 250, text_format); + text_position.X = (fd.drawing_rectangle.Left + fd.drawing_rectangle.Width / 2) - text_size.Width / 2; + text_position.Y = (fd.drawing_rectangle.Top + fd.drawing_rectangle.Height / 2) - text_size.Height / 2; + text_rect = new RectangleF (text_position, text_size); + text_rect = RectangleF.Intersect (text_rect, date_area_rect); + + if (text_rect.IsEmpty) + break; + + if (text_rect.Right >= date_area_rect.Right) + text_format.FormatFlags &= ~StringFormatFlags.NoClip; + else + text_format.FormatFlags |= StringFormatFlags.NoClip; + + if (fd.Selected) { + dc.FillRectangle (SystemBrushes.Highlight, text_rect); + dc.DrawString (text, dtp.Font, SystemBrushes.HighlightText, text_rect, text_format); + + } else { + dc.DrawString (text, dtp.Font, text_brush, text_rect, text_format); + } + + if (fd.drawing_rectangle.Right > date_area_rect.Right) + break; // the next part would be not be visible, so don't draw anything more. + } + } + } + + public override bool DateTimePickerBorderHasHotElementStyle { + get { + return false; + } + } + + public override Rectangle DateTimePickerGetDropDownButtonArea (DateTimePicker dateTimePicker) + { + Rectangle rect = dateTimePicker.ClientRectangle; + rect.X = rect.Right - SystemInformation.VerticalScrollBarWidth - 2; + if (rect.Width > (SystemInformation.VerticalScrollBarWidth + 2)) { + rect.Width = SystemInformation.VerticalScrollBarWidth; + } else { + rect.Width = Math.Max (rect.Width - 2, 0); + } + + rect.Inflate (0, -2); + return rect; + } + + public override Rectangle DateTimePickerGetDateArea (DateTimePicker dateTimePicker) + { + Rectangle rect = dateTimePicker.ClientRectangle; + if (dateTimePicker.ShowUpDown) { + // set the space to the left of the up/down button + if (rect.Width > (DateTimePicker.up_down_width + 4)) { + rect.Width -= (DateTimePicker.up_down_width + 4); + } else { + rect.Width = 0; + } + } else { + // set the space to the left of the up/down button + // TODO make this use up down button + if (rect.Width > (SystemInformation.VerticalScrollBarWidth + 4)) { + rect.Width -= SystemInformation.VerticalScrollBarWidth; + } else { + rect.Width = 0; + } + } + + rect.Inflate (-2, -2); + return rect; + } + public override bool DateTimePickerDropDownButtonHasHotElementStyle { + get { + return false; + } + } + #endregion // DateTimePicker + + #region GroupBox + public override void DrawGroupBox (Graphics dc, Rectangle area, GroupBox box) { + StringFormat text_format; + SizeF size; + int width; + int y; + + dc.FillRectangle (GetControlBackBrush (box.BackColor), box.ClientRectangle); + + text_format = new StringFormat(); + text_format.HotkeyPrefix = HotkeyPrefix.Show; + + size = dc.MeasureString (box.Text, box.Font); + width = 0; + + if (size.Width > 0) { + width = ((int) size.Width) + 7; + + if (width > box.Width - 16) + width = box.Width - 16; + } + + y = box.Font.Height / 2; + + // Clip the are that the text will be in + Region prev_clip = dc.Clip; + dc.SetClip (new Rectangle (10, 0, width, box.Font.Height), CombineMode.Exclude); + /* Draw group box*/ + CPDrawBorder3D (dc, new Rectangle (0, y, box.Width, box.Height - y), Border3DStyle.Etched, Border3DSide.Left | Border3DSide.Right | Border3DSide.Top | Border3DSide.Bottom, box.BackColor); + dc.Clip = prev_clip; + + /* Text */ + if (box.Text.Length != 0) { + if (box.Enabled) { + dc.DrawString (box.Text, box.Font, ResPool.GetSolidBrush (box.ForeColor), 10, 0, text_format); + } else { + CPDrawStringDisabled (dc, box.Text, box.Font, box.BackColor, + new RectangleF (10, 0, width, box.Font.Height), text_format); + } + } + + text_format.Dispose (); + } + + public override Size GroupBoxDefaultSize { + get { + return new Size (200,100); + } + } + #endregion + + #region HScrollBar + public override Size HScrollBarDefaultSize { + get { + return new Size (80, this.ScrollBarButtonSize); + } + } + + #endregion // HScrollBar + + #region ListBox + + public override void DrawListBoxItem (ListBox ctrl, DrawItemEventArgs e) + { + Color back_color, fore_color; + + if ((e.State & DrawItemState.Selected) == DrawItemState.Selected) { + back_color = ColorHighlight; + fore_color = ColorHighlightText; + } else { + back_color = e.BackColor; + fore_color = e.ForeColor; + } + + e.Graphics.FillRectangle (ResPool.GetSolidBrush (back_color), e.Bounds); + + e.Graphics.DrawString (ctrl.GetItemText (ctrl.Items[e.Index]), e.Font, + ResPool.GetSolidBrush (fore_color), + e.Bounds, ctrl.StringFormat); + + if ((e.State & DrawItemState.Focus) == DrawItemState.Focus) + CPDrawFocusRectangle (e.Graphics, e.Bounds, fore_color, back_color); + } + + #endregion ListBox + + #region ListView + // Drawing + public override void DrawListViewItems (Graphics dc, Rectangle clip, ListView control) + { + bool details = control.View == View.Details; + int first = control.FirstVisibleIndex; + int lastvisibleindex = control.LastVisibleIndex; + + if (control.VirtualMode) + control.OnCacheVirtualItems (new CacheVirtualItemsEventArgs (first, lastvisibleindex)); + + for (int i = first; i <= lastvisibleindex; i++) { + ListViewItem item = control.GetItemAtDisplayIndex (i); + if (clip.IntersectsWith (item.Bounds)) { + bool owner_draw = false; + if (control.OwnerDraw) + owner_draw = DrawListViewItemOwnerDraw (dc, item, i); + if (!owner_draw) + { + DrawListViewItem (dc, control, item); + if (control.View == View.Details) + DrawListViewSubItems (dc, control, item); + } + } + } + + if (control.UsingGroups) { + // Use InternalCount instead of Count to take into account Default Group as needed + for (int i = 0; i < control.Groups.InternalCount; i++) { + ListViewGroup group = control.Groups.GetInternalGroup (i); + if (group.ItemCount > 0 && clip.IntersectsWith (group.HeaderBounds)) + DrawListViewGroupHeader (dc, control, group); + } + } + + ListViewInsertionMark insertion_mark = control.InsertionMark; + int insertion_mark_index = insertion_mark.Index; + if (Application.VisualStylesEnabled && insertion_mark.Bounds != Rectangle.Empty && + (control.View != View.Details && control.View != View.List) && + insertion_mark_index > -1 && insertion_mark_index < control.Items.Count) { + + Brush brush = ResPool.GetSolidBrush (insertion_mark.Color); + dc.FillRectangle (brush, insertion_mark.Line); + dc.FillPolygon (brush, insertion_mark.TopTriangle); + dc.FillPolygon (brush, insertion_mark.BottomTriangle); + } + + // draw the gridlines + if (details && control.GridLines && !control.UsingGroups) { + Size control_size = control.ClientSize; + int top = (control.HeaderStyle == ColumnHeaderStyle.None) ? + 0 : control.header_control.Height; + + // draw vertical gridlines + foreach (ColumnHeader col in control.Columns) { + int column_right = col.Rect.Right - control.h_marker; + dc.DrawLine (SystemPens.Control, + column_right, top, + column_right, control_size.Height); + } + + // draw horizontal gridlines + int item_height = control.ItemSize.Height; + if (item_height == 0) + item_height = control.Font.Height + 2; + + int y = top + item_height - (control.v_marker % item_height); // scroll bar offset + while (y < control_size.Height) { + dc.DrawLine (SystemPens.Control, 0, y, control_size.Width, y); + y += item_height; + } + } + + // Draw corner between the two scrollbars + if (control.h_scroll.Visible == true && control.v_scroll.Visible == true) { + Rectangle rect = new Rectangle (); + rect.X = control.h_scroll.Location.X + control.h_scroll.Width; + rect.Width = control.v_scroll.Width; + rect.Y = control.v_scroll.Location.Y + control.v_scroll.Height; + rect.Height = control.h_scroll.Height; + dc.FillRectangle (SystemBrushes.Control, rect); + } + + Rectangle box_select_rect = control.item_control.BoxSelectRectangle; + if (!box_select_rect.Size.IsEmpty) + dc.DrawRectangle (ResPool.GetDashPen (ColorControlText, DashStyle.Dot), box_select_rect); + + } + + public override void DrawListViewHeader (Graphics dc, Rectangle clip, ListView control) + { + bool details = (control.View == View.Details); + + // border is drawn directly in the Paint method + if (details && control.HeaderStyle != ColumnHeaderStyle.None) { + dc.FillRectangle (SystemBrushes.Control, + 0, 0, control.TotalWidth, control.Font.Height + 5); + if (control.Columns.Count > 0) { + foreach (ColumnHeader col in control.Columns) { + Rectangle rect = col.Rect; + rect.X -= control.h_marker; + + bool owner_draw = false; + if (control.OwnerDraw) + owner_draw = DrawListViewColumnHeaderOwnerDraw (dc, control, col, rect); + if (owner_draw) + continue; + + ListViewDrawColumnHeaderBackground (control, col, dc, rect, clip); + rect.X += 5; + rect.Width -= 10; + if (rect.Width <= 0) + continue; + + int image_index; + if (control.SmallImageList == null) + image_index = -1; + else + image_index = col.ImageKey == String.Empty ? col.ImageIndex : control.SmallImageList.Images.IndexOfKey (col.ImageKey); + + if (image_index > -1 && image_index < control.SmallImageList.Images.Count) { + int image_width = control.SmallImageList.ImageSize.Width + 5; + int text_width = (int)dc.MeasureString (col.Text, control.Font).Width; + int x_origin = rect.X; + int y_origin = rect.Y + ((rect.Height - control.SmallImageList.ImageSize.Height) / 2); + + switch (col.TextAlign) { + case HorizontalAlignment.Left: + break; + case HorizontalAlignment.Right: + x_origin = rect.Right - (text_width + image_width); + break; + case HorizontalAlignment.Center: + x_origin = (rect.Width - (text_width + image_width)) / 2 + rect.X; + break; + } + + if (x_origin < rect.X) + x_origin = rect.X; + + control.SmallImageList.Draw (dc, new Point (x_origin, y_origin), image_index); + rect.X += image_width; + rect.Width -= image_width; + } + + dc.DrawString (col.Text, control.Font, SystemBrushes.ControlText, rect, col.Format); + } + int right = control.GetReorderedColumn (control.Columns.Count - 1).Rect.Right - control.h_marker; + if (right < control.Right) { + Rectangle rect = control.Columns [0].Rect; + rect.X = right; + rect.Width = control.Right - right; + ListViewDrawUnusedHeaderBackground (control, dc, rect, clip); + } + } + } + } + + protected virtual void ListViewDrawColumnHeaderBackground (ListView listView, ColumnHeader columnHeader, Graphics g, Rectangle area, Rectangle clippingArea) + { + ButtonState state; + if (listView.HeaderStyle == ColumnHeaderStyle.Clickable) + state = columnHeader.Pressed ? ButtonState.Pushed : ButtonState.Normal; + else + state = ButtonState.Flat; + CPDrawButton (g, area, state); + } + + protected virtual void ListViewDrawUnusedHeaderBackground (ListView listView, Graphics g, Rectangle area, Rectangle clippingArea) + { + ButtonState state; + if (listView.HeaderStyle == ColumnHeaderStyle.Clickable) + state = ButtonState.Normal; + else + state = ButtonState.Flat; + CPDrawButton (g, area, state); + } + + public override void DrawListViewHeaderDragDetails (Graphics dc, ListView view, ColumnHeader col, int target_x) + { + Rectangle rect = col.Rect; + rect.X -= view.h_marker; + Color color = Color.FromArgb (0x7f, ColorControlDark.R, ColorControlDark.G, ColorControlDark.B); + dc.FillRectangle (ResPool.GetSolidBrush (color), rect); + rect.X += 3; + rect.Width -= 8; + if (rect.Width <= 0) + return; + color = Color.FromArgb (0x7f, ColorControlText.R, ColorControlText.G, ColorControlText.B); + dc.DrawString (col.Text, view.Font, ResPool.GetSolidBrush (color), rect, col.Format); + dc.DrawLine (ResPool.GetSizedPen (ColorHighlight, 2), target_x, 0, target_x, col.Rect.Height); + } + + protected virtual bool DrawListViewColumnHeaderOwnerDraw (Graphics dc, ListView control, ColumnHeader column, Rectangle bounds) + { + ListViewItemStates state = ListViewItemStates.ShowKeyboardCues; + if (column.Pressed) + state |= ListViewItemStates.Selected; + + DrawListViewColumnHeaderEventArgs args = new DrawListViewColumnHeaderEventArgs (dc, + bounds, column.Index, column, state, SystemColors.ControlText, ThemeEngine.Current.ColorControl, DefaultFont); + control.OnDrawColumnHeader (args); + + return !args.DrawDefault; + } + + protected virtual bool DrawListViewItemOwnerDraw (Graphics dc, ListViewItem item, int index) + { + ListViewItemStates item_state = ListViewItemStates.ShowKeyboardCues; + if (item.Selected) + item_state |= ListViewItemStates.Selected; + if (item.Focused) + item_state |= ListViewItemStates.Focused; + + DrawListViewItemEventArgs args = new DrawListViewItemEventArgs (dc, + item, item.Bounds, index, item_state); + item.ListView.OnDrawItem (args); + + if (args.DrawDefault) + return false; + + if (item.ListView.View == View.Details) { + int count = Math.Min (item.ListView.Columns.Count, item.SubItems.Count); + + // Do system drawing for subitems if no owner draw is done + for (int j = 0; j < count; j++) { + if (!DrawListViewSubItemOwnerDraw (dc, item, item_state, j)) { + if (j == 0) // The first sub item contains the main item semantics + DrawListViewItem (dc, item.ListView, item); + else + DrawListViewSubItem (dc, item.ListView, item, j); + } + } + } + + return true; + } + + protected virtual void DrawListViewItem (Graphics dc, ListView control, ListViewItem item) + { + Rectangle rect_checkrect = item.CheckRectReal; + Rectangle icon_rect = item.GetBounds (ItemBoundsPortion.Icon); + Rectangle full_rect = item.GetBounds (ItemBoundsPortion.Entire); + Rectangle text_rect = item.GetBounds (ItemBoundsPortion.Label); + + // Tile view doesn't support CheckBoxes + if (control.CheckBoxes && control.View != View.Tile) { + if (control.StateImageList == null) { + // Make sure we've got at least a line width of 1 + int check_wd = Math.Max (3, rect_checkrect.Width / 6); + int scale = Math.Max (1, rect_checkrect.Width / 12); + + // set the checkbox background + dc.FillRectangle (SystemBrushes.Window, + rect_checkrect); + // define a rectangle inside the border area + Rectangle rect = new Rectangle (rect_checkrect.X + 2, + rect_checkrect.Y + 2, + rect_checkrect.Width - 4, + rect_checkrect.Height - 4); + Pen pen = ResPool.GetSizedPen (this.ColorWindowText, 2); + dc.DrawRectangle (pen, rect); + + // Need to draw a check-mark + if (item.Checked) { + Pen check_pen = ResPool.GetSizedPen (this.ColorWindowText, 1); + // adjustments to get the check-mark at the right place + rect.X ++; rect.Y ++; + // following logic is taken from DrawFrameControl method + int x_offset = rect.Width / 5; + int y_offset = rect.Height / 3; + for (int i = 0; i < check_wd; i++) { + dc.DrawLine (check_pen, rect.Left + x_offset, + rect.Top + y_offset + i, + rect.Left + x_offset + 2 * scale, + rect.Top + y_offset + 2 * scale + i); + dc.DrawLine (check_pen, + rect.Left + x_offset + 2 * scale, + rect.Top + y_offset + 2 * scale + i, + rect.Left + x_offset + 6 * scale, + rect.Top + y_offset - 2 * scale + i); + } + } + } + else { + int simage_idx; + if (item.Checked) + simage_idx = control.StateImageList.Images.Count > 1 ? 1 : -1; + else + simage_idx = control.StateImageList.Images.Count > 0 ? 0 : -1; + + if (simage_idx > -1) + control.StateImageList.Draw (dc, rect_checkrect.Location, simage_idx); + } + } + + ImageList image_list = control.View == View.LargeIcon || control.View == View.Tile ? control.LargeImageList : control.SmallImageList; + if (image_list != null) { + int idx; + + if (item.ImageKey != String.Empty) + idx = image_list.Images.IndexOfKey (item.ImageKey); + else + idx = item.ImageIndex; + + if (idx > -1 && idx < image_list.Images.Count) { + // Draw a thumbnail image if it exists for a FileViewListViewItem, otherwise draw + // the standard icon. See https://bugzilla.xamarin.com/show_bug.cgi?id=28025. + image_list.Draw(dc, icon_rect.Location, idx); + } + } + + // draw the item text + // format for the item text + StringFormat format = new StringFormat (); + if (control.View == View.SmallIcon || control.View == View.LargeIcon) + format.LineAlignment = StringAlignment.Near; + else + format.LineAlignment = StringAlignment.Center; + if (control.View == View.LargeIcon) + format.Alignment = StringAlignment.Center; + else + format.Alignment = StringAlignment.Near; + + if (control.LabelWrap && control.View != View.Details && control.View != View.Tile) + format.FormatFlags = StringFormatFlags.LineLimit; + else + format.FormatFlags = StringFormatFlags.NoWrap; + + if ((control.View == View.LargeIcon && !item.Focused) || control.View == View.Details || control.View == View.Tile) + format.Trimming = StringTrimming.EllipsisCharacter; + + Rectangle highlight_rect = text_rect; + if (control.View == View.Details) { // Adjustments for Details view + Size text_size = Size.Ceiling (dc.MeasureString (item.Text, item.Font)); + + if (!control.FullRowSelect) // Selection shouldn't be outside the item bounds + highlight_rect.Width = Math.Min (text_size.Width + 4, text_rect.Width); + } + + if (item.Selected && control.Focused) + dc.FillRectangle (SystemBrushes.Highlight, highlight_rect); + else if (item.Selected && !control.HideSelection) + dc.FillRectangle (SystemBrushes.Control, highlight_rect); + else + dc.FillRectangle (ResPool.GetSolidBrush (item.BackColor), text_rect); + + Brush textBrush = + !control.Enabled ? SystemBrushes.ControlLight : + (item.Selected && control.Focused) ? SystemBrushes.HighlightText : + this.ResPool.GetSolidBrush (item.ForeColor); + + // Tile view renders its Text in a different fashion + if (control.View == View.Tile && Application.VisualStylesEnabled) { + // Item.Text is drawn using its first subitem's bounds + dc.DrawString (item.Text, item.Font, textBrush, item.SubItems [0].Bounds, format); + + int count = Math.Min (control.Columns.Count, item.SubItems.Count); + for (int i = 1; i < count; i++) { + ListViewItem.ListViewSubItem sub_item = item.SubItems [i]; + if (sub_item.Text == null || sub_item.Text.Length == 0) + continue; + + Brush itemBrush = item.Selected && control.Focused ? + SystemBrushes.HighlightText : GetControlForeBrush (sub_item.ForeColor); + dc.DrawString (sub_item.Text, sub_item.Font, itemBrush, sub_item.Bounds, format); + } + } else + + if (item.Text != null && item.Text.Length > 0) { + Font font = item.Font; + + if (control.HotTracking && item.Hot) + font = item.HotFont; + + if (item.Selected && control.Focused) + dc.DrawString (item.Text, font, textBrush, highlight_rect, format); + else + dc.DrawString (item.Text, font, textBrush, text_rect, format); + } + + if (item.Focused && control.Focused) { + Rectangle focus_rect = highlight_rect; + if (control.FullRowSelect && control.View == View.Details) { + int width = 0; + foreach (ColumnHeader col in control.Columns) + width += col.Width; + focus_rect = new Rectangle (0, full_rect.Y, width, full_rect.Height); + } + if (control.ShowFocusCues) { + if (item.Selected) + CPDrawFocusRectangle (dc, focus_rect, ColorHighlightText, ColorHighlight); + else + CPDrawFocusRectangle (dc, focus_rect, control.ForeColor, control.BackColor); + } + } + + format.Dispose (); + } + + protected virtual void DrawListViewSubItems (Graphics dc, ListView control, ListViewItem item) + { + int columns_count = control.Columns.Count; + int count = Math.Min (item.SubItems.Count, columns_count); + // 0th item already done (in this case) + for (int i = 1; i < count; i++) + DrawListViewSubItem (dc, control, item, i); + + // Fill in selection for remaining columns if Column.Count > SubItems.Count + Rectangle sub_item_rect = item.GetBounds (ItemBoundsPortion.Label); + if (item.Selected && (control.Focused || !control.HideSelection) && control.FullRowSelect) { + for (int index = count; index < columns_count; index++) { + ColumnHeader col = control.Columns [index]; + sub_item_rect.X = col.Rect.X - control.h_marker; + sub_item_rect.Width = col.Wd; + dc.FillRectangle (control.Focused ? SystemBrushes.Highlight : SystemBrushes.Control, + sub_item_rect); + } + } + } + + protected virtual void DrawListViewSubItem (Graphics dc, ListView control, ListViewItem item, int index) + { + ListViewItem.ListViewSubItem subItem = item.SubItems [index]; + ColumnHeader col = control.Columns [index]; + StringFormat format = new StringFormat (); + format.Alignment = col.Format.Alignment; + format.LineAlignment = StringAlignment.Center; + format.FormatFlags = StringFormatFlags.NoWrap; + format.Trimming = StringTrimming.EllipsisCharacter; + + Rectangle sub_item_rect = subItem.Bounds; + Rectangle sub_item_text_rect = sub_item_rect; + sub_item_text_rect.X += 3; + sub_item_text_rect.Width -= ListViewItemPaddingWidth; + + SolidBrush sub_item_back_br = null; + SolidBrush sub_item_fore_br = null; + Font sub_item_font = null; + + if (item.UseItemStyleForSubItems) { + sub_item_back_br = ResPool.GetSolidBrush (item.BackColor); + sub_item_fore_br = ResPool.GetSolidBrush (item.ForeColor); + + // Hot tracking for subitems only applies when UseStyle is true + if (control.HotTracking && item.Hot) + sub_item_font = item.HotFont; + else + sub_item_font = item.Font; + } else { + sub_item_back_br = ResPool.GetSolidBrush (subItem.BackColor); + sub_item_fore_br = ResPool.GetSolidBrush (subItem.ForeColor); + sub_item_font = subItem.Font; + } + + if (item.Selected && (control.Focused || !control.HideSelection) && control.FullRowSelect) { + Brush bg, text; + if (control.Focused) { + bg = SystemBrushes.Highlight; + text = SystemBrushes.HighlightText; + } else { + bg = SystemBrushes.Control; + text = sub_item_fore_br; + + } + + dc.FillRectangle (bg, sub_item_rect); + if (subItem.Text != null && subItem.Text.Length > 0) + dc.DrawString (subItem.Text, sub_item_font, + text, sub_item_text_rect, format); + } else { + dc.FillRectangle (sub_item_back_br, sub_item_rect); + if (subItem.Text != null && subItem.Text.Length > 0) + dc.DrawString (subItem.Text, sub_item_font, + sub_item_fore_br, + sub_item_text_rect, format); + } + + format.Dispose (); + } + + protected virtual bool DrawListViewSubItemOwnerDraw (Graphics dc, ListViewItem item, ListViewItemStates state, int index) + { + ListView control = item.ListView; + ListViewItem.ListViewSubItem subitem = item.SubItems [index]; + + DrawListViewSubItemEventArgs args = new DrawListViewSubItemEventArgs (dc, subitem.Bounds, item, + subitem, item.Index, index, control.Columns [index], state); + control.OnDrawSubItem (args); + + return !args.DrawDefault; + } + + protected virtual void DrawListViewGroupHeader (Graphics dc, ListView control, ListViewGroup group) + { + Rectangle text_bounds = group.HeaderBounds; + Rectangle header_bounds = group.HeaderBounds; + text_bounds.Offset (8, 0); + text_bounds.Inflate (-8, 0); + int text_height = control.Font.Height + 2; // add a tiny padding between the text and the group line + + Font font = new Font (control.Font, control.Font.Style | FontStyle.Bold); + Brush brush = new LinearGradientBrush (new Point (header_bounds.Left, 0), new Point (header_bounds.Left + ListViewGroupLineWidth, 0), + SystemColors.Desktop, Color.White); + Pen pen = new Pen (brush); + + StringFormat sformat = new StringFormat (); + switch (group.HeaderAlignment) { + case HorizontalAlignment.Left: + sformat.Alignment = StringAlignment.Near; + break; + case HorizontalAlignment.Center: + sformat.Alignment = StringAlignment.Center; + break; + case HorizontalAlignment.Right: + sformat.Alignment = StringAlignment.Far; + break; + } + + sformat.LineAlignment = StringAlignment.Near; + dc.DrawString (group.Header, font, SystemBrushes.ControlText, text_bounds, sformat); + dc.DrawLine (pen, header_bounds.Left, header_bounds.Top + text_height, header_bounds.Left + ListViewGroupLineWidth, + header_bounds.Top + text_height); + + sformat.Dispose (); + font.Dispose (); + pen.Dispose (); + brush.Dispose (); + } + + public override bool ListViewHasHotHeaderStyle { + get { + return false; + } + } + + // Sizing + public override int ListViewGetHeaderHeight (ListView listView, Font font) + { + return ListViewGetHeaderHeight (font); + } + + static int ListViewGetHeaderHeight (Font font) + { + return font.Height + 5; + } + + public static int ListViewGetHeaderHeight () + { + return ListViewGetHeaderHeight (ThemeEngine.Current.DefaultFont); + } + + public override Size ListViewCheckBoxSize { + get { return new Size (16, 16); } + } + + public override int ListViewColumnHeaderHeight { + get { return 16; } + } + + public override int ListViewDefaultColumnWidth { + get { return 60; } + } + + public override int ListViewVerticalSpacing { + get { return 22; } + } + + public override int ListViewEmptyColumnWidth { + get { return 10; } + } + + public override int ListViewHorizontalSpacing { + get { return 4; } + } + + public override int ListViewItemPaddingWidth { + get { return 6; } + } + + public override Size ListViewDefaultSize { + get { return new Size (121, 97); } + } + + public override int ListViewGroupHeight { + get { return 20; } + } + + public int ListViewGroupLineWidth { + get { return 200; } + } + + public override int ListViewTileWidthFactor { + get { return 22; } + } + + public override int ListViewTileHeightFactor { + get { return 3; } + } + #endregion // ListView + + #region Menus + + public override void CalcItemSize (Graphics dc, MenuItem item, int y, int x, bool menuBar) + { + item.X = x; + item.Y = y; + + if (item.Visible == false) { + item.Width = 0; + item.Height = 0; + return; + } + + if (item.Separator == true) { + item.Height = SEPARATOR_HEIGHT; + item.Width = SEPARATOR_MIN_WIDTH; + return; + } + + if (item.MeasureEventDefined) { + MeasureItemEventArgs mi = new MeasureItemEventArgs (dc, item.Index); + item.PerformMeasureItem (mi); + item.Height = mi.ItemHeight; + item.Width = mi.ItemWidth; + return; + } else { + SizeF size; + size = dc.MeasureString (item.Text, MenuFont, int.MaxValue, string_format_menu_text); + item.Width = (int) size.Width; + item.Height = (int) size.Height; + + if (!menuBar) { + if (item.Shortcut != Shortcut.None && item.ShowShortcut) { + item.XTab = MenuCheckSize.Width + MENU_TAB_SPACE + (int) size.Width; + size = dc.MeasureString (" " + item.GetShortCutText (), MenuFont); + item.Width += MENU_TAB_SPACE + (int) size.Width; + } + + item.Width += 4 + (MenuCheckSize.Width * 2); + } else { + item.Width += MENU_BAR_ITEMS_SPACE; + x += item.Width; + } + + if (item.Height < MenuHeight) + item.Height = MenuHeight; + } + } + + // Updates the menu rect and returns the height + public override int CalcMenuBarSize (Graphics dc, Menu menu, int width) + { + int x = 0; + int y = 0; + menu.Height = 0; + + foreach (MenuItem item in menu.MenuItems) { + + CalcItemSize (dc, item, y, x, true); + + if (x + item.Width > width) { + item.X = 0; + y += item.Height; + item.Y = y; + x = 0; + } + + x += item.Width; + item.MenuBar = true; + + if (y + item.Height > menu.Height) + menu.Height = item.Height + y; + } + + menu.Width = width; + return menu.Height; + } + + public override void CalcPopupMenuSize (Graphics dc, Menu menu) + { + int x = 3; + int start = 0; + int i, n, y, max; + + menu.Height = 0; + + while (start < menu.MenuItems.Count) { + y = 3; + max = 0; + for (i = start; i < menu.MenuItems.Count; i++) { + MenuItem item = menu.MenuItems [i]; + + if ((i != start) && (item.Break || item.BarBreak)) + break; + + CalcItemSize (dc, item, y, x, false); + y += item.Height; + + if (item.Width > max) + max = item.Width; + } + + // Replace the -1 by the menu width (separators) + for (n = start; n < i; n++, start++) + menu.MenuItems [n].Width = max; + + if (y > menu.Height) + menu.Height = y; + + x+= max; + } + + menu.Width = x; + + //space for border + menu.Width += 2; + menu.Height += 2; + + menu.Width += SM_CXBORDER; + menu.Height += SM_CYBORDER; + } + + // Draws a menu bar in a window + public override void DrawMenuBar (Graphics dc, Menu menu, Rectangle rect) + { + if (menu.Height == 0) + CalcMenuBarSize (dc, menu, rect.Width); + + bool keynav = (menu as MainMenu).tracker.hotkey_active; + HotkeyPrefix hp = MenuAccessKeysUnderlined || keynav ? HotkeyPrefix.Show : HotkeyPrefix.Hide; + string_format_menu_menubar_text.HotkeyPrefix = hp; + string_format_menu_text.HotkeyPrefix = hp; + + rect.Height = menu.Height; + dc.FillRectangle (SystemBrushes.Menu, rect); + + for (int i = 0; i < menu.MenuItems.Count; i++) { + MenuItem item = menu.MenuItems [i]; + Rectangle item_rect = item.bounds; + item_rect.X += rect.X; + item_rect.Y += rect.Y; + item.MenuHeight = menu.Height; + item.PerformDrawItem (new DrawItemEventArgs (dc, MenuFont, item_rect, i, item.Status)); + } + } + + protected Bitmap CreateGlyphBitmap (Size size, MenuGlyph glyph, Color color) + { + Color bg_color; + if (color.R == 0 && color.G == 0 && color.B == 0) + bg_color = Color.White; + else + bg_color = Color.Black; + + Bitmap bmp = new Bitmap (size.Width, size.Height); + Graphics gr = Graphics.FromImage (bmp); + Rectangle rect = new Rectangle (Point.Empty, size); + gr.FillRectangle (ResPool.GetSolidBrush (bg_color), rect); + CPDrawMenuGlyph (gr, rect, glyph, color, Color.Empty); + bmp.MakeTransparent (bg_color); + gr.Dispose (); + + return bmp; + } + + public override void DrawMenuItem (MenuItem item, DrawItemEventArgs e) + { + StringFormat string_format; + Rectangle rect_text = e.Bounds; + + if (item.Visible == false) + return; + + if (item.MenuBar) + string_format = string_format_menu_menubar_text; + else + string_format = string_format_menu_text; + + if (item.Separator == true) { + int liney = e.Bounds.Y + (e.Bounds.Height / 2); + + e.Graphics.DrawLine (SystemPens.ControlDark, + e.Bounds.X, liney, e.Bounds.X + e.Bounds.Width, liney); + + e.Graphics.DrawLine (SystemPens.ControlLight, + e.Bounds.X, liney + 1, e.Bounds.X + e.Bounds.Width, liney + 1); + + return; + } + + if (!item.MenuBar) + rect_text.X += MenuCheckSize.Width; + + if (item.BarBreak) { /* Draw vertical break bar*/ + Rectangle rect = e.Bounds; + rect.Y++; + rect.Width = 3; + rect.Height = item.MenuHeight - 6; + + e.Graphics.DrawLine (SystemPens.ControlDark, + rect.X, rect.Y , rect.X, rect.Y + rect.Height); + + e.Graphics.DrawLine (SystemPens.ControlLight, + rect.X + 1, rect.Y , rect.X +1, rect.Y + rect.Height); + } + + Color color_text; + Color color_back; + Brush brush_text = null; + Brush brush_back = null; + + if ((e.State & DrawItemState.Selected) == DrawItemState.Selected && !item.MenuBar) { + color_text = ColorHighlightText; + color_back = ColorHighlight; + brush_text = SystemBrushes.HighlightText; + brush_back = SystemBrushes.Highlight; + } else { + color_text = ColorMenuText; + color_back = ColorMenu; + brush_text = ResPool.GetSolidBrush (ColorMenuText); + brush_back = SystemBrushes.Menu; + } + + /* Draw background */ + if (!item.MenuBar) + e.Graphics.FillRectangle (brush_back, e.Bounds); + + if (item.Enabled) { + e.Graphics.DrawString (item.Text, e.Font, + brush_text, + rect_text, string_format); + + if (item.MenuBar) { + Border3DStyle border_style = Border3DStyle.Adjust; + if ((item.Status & DrawItemState.HotLight) != 0) + border_style = Border3DStyle.RaisedInner; + else if ((item.Status & DrawItemState.Selected) != 0) + border_style = Border3DStyle.SunkenOuter; + + if (border_style != Border3DStyle.Adjust) + CPDrawBorder3D(e.Graphics, e.Bounds, border_style, Border3DSide.Left | Border3DSide.Right | Border3DSide.Top | Border3DSide.Bottom, ColorMenu); + } + } else { + if ((item.Status & DrawItemState.Selected) != DrawItemState.Selected) { + e.Graphics.DrawString (item.Text, e.Font, Brushes.White, + new RectangleF(rect_text.X + 1, rect_text.Y + 1, rect_text.Width, rect_text.Height), + string_format); + + } + + e.Graphics.DrawString (item.Text, e.Font, ResPool.GetSolidBrush(ColorGrayText), rect_text, string_format); + } + + if (!item.MenuBar && item.Shortcut != Shortcut.None && item.ShowShortcut) { + string str = item.GetShortCutText (); + Rectangle rect = rect_text; + rect.X = item.XTab; + rect.Width -= item.XTab; + + if (item.Enabled) { + e.Graphics.DrawString (str, e.Font, brush_text, rect, string_format_menu_shortcut); + } else { + if ((item.Status & DrawItemState.Selected) != DrawItemState.Selected) { + e.Graphics.DrawString (str, e.Font, Brushes.White, + new RectangleF(rect.X + 1, rect.Y + 1, rect.Width, rect_text.Height), + string_format_menu_shortcut); + + } + e.Graphics.DrawString (str, e.Font, ResPool.GetSolidBrush(ColorGrayText), rect, string_format_menu_shortcut); + } + } + + /* Draw arrow */ + if (item.MenuBar == false && (item.IsPopup || item.MdiList)) { + + int cx = MenuCheckSize.Width; + int cy = MenuCheckSize.Height; + Bitmap bmp = CreateGlyphBitmap (new Size (cx, cy), MenuGlyph.Arrow, color_text); + + if (item.Enabled) { + e.Graphics.DrawImage (bmp, e.Bounds.X + e.Bounds.Width - cx, + e.Bounds.Y + ((e.Bounds.Height - cy) /2)); + } else { + WidgetPaint.DrawImageDisabled (e.Graphics, bmp, e.Bounds.X + e.Bounds.Width - cx, + e.Bounds.Y + ((e.Bounds.Height - cy) /2), color_back); + } + + bmp.Dispose (); + } + + /* Draw checked or radio */ + if (item.MenuBar == false && item.Checked) { + + Rectangle area = e.Bounds; + int cx = MenuCheckSize.Width; + int cy = MenuCheckSize.Height; + Bitmap bmp = CreateGlyphBitmap (new Size (cx, cy), item.RadioCheck ? MenuGlyph.Bullet : MenuGlyph.Checkmark, color_text); + + e.Graphics.DrawImage (bmp, area.X, e.Bounds.Y + ((e.Bounds.Height - cy) / 2)); + + bmp.Dispose (); + } + } + + public override void DrawPopupMenu (Graphics dc, Menu menu, Rectangle cliparea, Rectangle rect) + { + // Fill rectangle area + dc.FillRectangle (SystemBrushes.Menu, cliparea); + + + // Draw menu items + for (int i = 0; i < menu.MenuItems.Count; i++) { + if (cliparea.IntersectsWith (menu.MenuItems [i].bounds)) { + MenuItem item = menu.MenuItems [i]; + item.MenuHeight = menu.Height; + item.PerformDrawItem (new DrawItemEventArgs (dc, MenuFont, item.bounds, i, item.Status)); + } + } + } + + #endregion // Menus + + #region MonthCalendar + + // draw the month calendar + public override void DrawMonthCalendar(Graphics dc, Rectangle clip_rectangle, MonthCalendar mc) + { + Rectangle client_rectangle = mc.ClientRectangle; + Size month_size = mc.SingleMonthSize; + // cache local copies of Marshal-by-ref internal members (gets around error CS0197) + Size calendar_spacing = (Size)((object)mc.calendar_spacing); + Size date_cell_size = (Size)((object)mc.date_cell_size); + + // draw the singlecalendars + int x_offset = 1; + int y_offset = 1; + // adjust for the position of the specific month + for (int i=0; i < mc.CalendarDimensions.Height; i++) + { + if (i > 0) + { + y_offset += month_size.Height + calendar_spacing.Height; + } + // now adjust for x position + for (int j=0; j < mc.CalendarDimensions.Width; j++) + { + if (j > 0) + { + x_offset += month_size.Width + calendar_spacing.Width; + } + else + { + x_offset = 1; + } + + Rectangle month_rect = new Rectangle (x_offset, y_offset, month_size.Width, month_size.Height); + if (month_rect.IntersectsWith (clip_rectangle)) { + DrawSingleMonth ( + dc, + clip_rectangle, + month_rect, + mc, + i, + j); + } + } + } + + Rectangle bottom_rect = new Rectangle ( + client_rectangle.X, + Math.Max(client_rectangle.Bottom - date_cell_size.Height - 3, 0), + client_rectangle.Width, + date_cell_size.Height + 2); + // draw the today date if it's set + if (mc.ShowToday && bottom_rect.IntersectsWith (clip_rectangle)) + { + dc.FillRectangle (GetControlBackBrush (mc.BackColor), bottom_rect); + if (mc.ShowToday) { + int today_offset = 5; + if (mc.ShowTodayCircle) + { + Rectangle today_circle_rect = new Rectangle ( + client_rectangle.X + 5, + Math.Max(client_rectangle.Bottom - date_cell_size.Height - 2, 0), + date_cell_size.Width, + date_cell_size.Height); + DrawTodayCircle (dc, today_circle_rect); + today_offset += date_cell_size.Width + 5; + } + // draw today's date + StringFormat text_format = new StringFormat(); + text_format.LineAlignment = StringAlignment.Center; + text_format.Alignment = StringAlignment.Near; + Rectangle today_rect = new Rectangle ( + today_offset + client_rectangle.X, + Math.Max(client_rectangle.Bottom - date_cell_size.Height, 0), + Math.Max(client_rectangle.Width - today_offset, 0), + date_cell_size.Height); + dc.DrawString ("Today: " + DateTime.Now.ToShortDateString(), mc.bold_font, GetControlForeBrush (mc.ForeColor), today_rect, text_format); + text_format.Dispose (); + } + } + + Brush border_brush; + + if (mc.owner == null) + border_brush = GetControlBackBrush (mc.BackColor); + else + border_brush = SystemBrushes.ControlDarkDark; + + // finally paint the borders of the calendars as required + for (int i = 0; i <= mc.CalendarDimensions.Width; i++) { + if (i == 0 && clip_rectangle.X == client_rectangle.X) { + dc.FillRectangle (border_brush, client_rectangle.X, client_rectangle.Y, 1, client_rectangle.Height); + } else if (i == mc.CalendarDimensions.Width && clip_rectangle.Right == client_rectangle.Right) { + dc.FillRectangle (border_brush, client_rectangle.Right - 1, client_rectangle.Y, 1, client_rectangle.Height); + } else { + Rectangle rect = new Rectangle ( + client_rectangle.X + (month_size.Width*i) + (calendar_spacing.Width * (i-1)) + 1, + client_rectangle.Y, + calendar_spacing.Width, + client_rectangle.Height); + if (i < mc.CalendarDimensions.Width && i > 0 && clip_rectangle.IntersectsWith (rect)) { + dc.FillRectangle (border_brush, rect); + } + } + } + for (int i = 0; i <= mc.CalendarDimensions.Height; i++) { + if (i == 0 && clip_rectangle.Y == client_rectangle.Y) { + dc.FillRectangle (border_brush, client_rectangle.X, client_rectangle.Y, client_rectangle.Width, 1); + } else if (i == mc.CalendarDimensions.Height && clip_rectangle.Bottom == client_rectangle.Bottom) { + dc.FillRectangle (border_brush, client_rectangle.X, client_rectangle.Bottom - 1, client_rectangle.Width, 1); + } else { + Rectangle rect = new Rectangle ( + client_rectangle.X, + client_rectangle.Y + (month_size.Height*i) + (calendar_spacing.Height*(i-1)) + 1, + client_rectangle.Width, + calendar_spacing.Height); + if (i < mc.CalendarDimensions.Height && i > 0 && clip_rectangle.IntersectsWith (rect)) { + dc.FillRectangle (border_brush, rect); + } + } + } + + // draw the drop down border if need + if (mc.owner != null) { + Rectangle bounds = mc.ClientRectangle; + if (clip_rectangle.Contains (mc.Location)) { + // find out if top or left line to draw + if(clip_rectangle.Contains (new Point (bounds.Left, bounds.Bottom))) { + + dc.DrawLine (SystemPens.ControlText, bounds.X, bounds.Y, bounds.X, bounds.Bottom-1); + } + if(clip_rectangle.Contains (new Point (bounds.Right, bounds.Y))) { + dc.DrawLine (SystemPens.ControlText, bounds.X, bounds.Y, bounds.Right-1, bounds.Y); + } + } + if (clip_rectangle.Contains (new Point(bounds.Right, bounds.Bottom))) { + // find out if bottom or right line to draw + if(clip_rectangle.Contains (new Point (bounds.Left, bounds.Bottom))) { + dc.DrawLine (SystemPens.ControlText, bounds.X, bounds.Bottom-1, bounds.Right-1, bounds.Bottom-1); + } + if(clip_rectangle.Contains (new Point (bounds.Right, bounds.Y))) { + dc.DrawLine (SystemPens.ControlText, bounds.Right-1, bounds.Y, bounds.Right-1, bounds.Bottom-1); + } + } + } + } + + // darws a single part of the month calendar (with one month) + private void DrawSingleMonth(Graphics dc, Rectangle clip_rectangle, Rectangle rectangle, MonthCalendar mc, int row, int col) + { + // cache local copies of Marshal-by-ref internal members (gets around error CS0197) + Size title_size = (Size)((object)mc.title_size); + Size date_cell_size = (Size)((object)mc.date_cell_size); + DateTime current_month = (DateTime)((object)mc.current_month); + DateTime sunday = new DateTime(2006, 10, 1); + + // draw the title back ground + DateTime this_month = current_month.AddMonths (row*mc.CalendarDimensions.Width+col); + Rectangle title_rect = new Rectangle(rectangle.X, rectangle.Y, title_size.Width, title_size.Height); + if (title_rect.IntersectsWith (clip_rectangle)) { + dc.FillRectangle (ResPool.GetSolidBrush (mc.TitleBackColor), title_rect); + // draw the title + string title_text = this_month.ToString ("MMMM yyyy"); + dc.DrawString (title_text, mc.bold_font, ResPool.GetSolidBrush (mc.TitleForeColor), title_rect, mc.centered_format); + + if (mc.ShowYearUpDown) { + Rectangle year_rect; + Rectangle upRect, downRect; + ButtonState upState, downState; + + mc.GetYearNameRectangles (title_rect, row * mc.CalendarDimensions.Width + col, out year_rect, out upRect, out downRect); + dc.FillRectangle (ResPool.GetSolidBrush (SystemColors.Control), year_rect); + dc.DrawString (this_month.ToString ("yyyy"), mc.bold_font, ResPool.GetSolidBrush (Color.Black), year_rect, mc.centered_format); + + upState = mc.IsYearGoingUp ? ButtonState.Pushed : ButtonState.Normal; + downState = mc.IsYearGoingDown ? ButtonState.Pushed : ButtonState.Normal; + + WidgetPaint.DrawScrollButton (dc, upRect, ScrollButton.Up, upState); + WidgetPaint.DrawScrollButton (dc, downRect, ScrollButton.Down, downState); + } + + // draw previous and next buttons if it's time + if (row == 0 && col == 0) + { + // draw previous button + DrawMonthCalendarButton ( + dc, + rectangle, + mc, + title_size, + mc.button_x_offset, + (System.Drawing.Size)((object)mc.button_size), + true); + } + if (row == 0 && col == mc.CalendarDimensions.Width-1) + { + // draw next button + DrawMonthCalendarButton ( + dc, + rectangle, + mc, + title_size, + mc.button_x_offset, + (System.Drawing.Size)((object)mc.button_size), + false); + } + } + + // set the week offset and draw week nums if needed + int col_offset = (mc.ShowWeekNumbers) ? 1 : 0; + Rectangle day_name_rect = new Rectangle( + rectangle.X, + rectangle.Y + title_size.Height, + (7 + col_offset) * date_cell_size.Width, + date_cell_size.Height); + if (day_name_rect.IntersectsWith (clip_rectangle)) { + dc.FillRectangle (GetControlBackBrush (mc.BackColor), day_name_rect); + // draw the day names + DayOfWeek first_day_of_week = mc.GetDayOfWeek(mc.FirstDayOfWeek); + for (int i=0; i < 7; i++) + { + int position = i - (int) first_day_of_week; + if (position < 0) + { + position = 7 + position; + } + // draw it + Rectangle day_rect = new Rectangle( + day_name_rect.X + ((i + col_offset)* date_cell_size.Width), + day_name_rect.Y, + date_cell_size.Width, + date_cell_size.Height); + dc.DrawString (sunday.AddDays (i + (int) first_day_of_week).ToString ("ddd"), mc.Font, ResPool.GetSolidBrush (mc.TitleBackColor), day_rect, mc.centered_format); + } + + // draw the vertical divider + int vert_divider_y = Math.Max(title_size.Height+ date_cell_size.Height-1, 0); + dc.DrawLine ( + ResPool.GetPen (mc.ForeColor), + rectangle.X + (col_offset * date_cell_size.Width) + mc.divider_line_offset, + rectangle.Y + vert_divider_y, + rectangle.Right - mc.divider_line_offset, + rectangle.Y + vert_divider_y); + } + + + // draw the actual date items in the grid (including the week numbers) + Rectangle date_rect = new Rectangle ( + rectangle.X, + rectangle.Y + title_size.Height + date_cell_size.Height, + date_cell_size.Width, + date_cell_size.Height); + int month_row_count = 0; + bool draw_week_num_divider = false; + DateTime current_date = mc.GetFirstDateInMonthGrid ( new DateTime (this_month.Year, this_month.Month, 1)); + for (int i=0; i < 6; i++) + { + // establish if this row is in our clip_area + Rectangle row_rect = new Rectangle ( + rectangle.X, + rectangle.Y + title_size.Height + (date_cell_size.Height * (i+1)), + date_cell_size.Width * 7, + date_cell_size.Height); + if (mc.ShowWeekNumbers) { + row_rect.Width += date_cell_size.Width; + } + + bool draw_row = row_rect.IntersectsWith (clip_rectangle); + if (draw_row) { + dc.FillRectangle (GetControlBackBrush (mc.BackColor), row_rect); + } + // establish if this is a valid week to draw + if (mc.IsValidWeekToDraw (this_month, current_date, row, col)) { + month_row_count = i; + } + + // draw the week number if required + if (mc.ShowWeekNumbers && month_row_count == i) { + if (!draw_week_num_divider) { + draw_week_num_divider = draw_row; + } + // get the week for this row + int week = mc.GetWeekOfYear (current_date); + + if (draw_row) { + dc.DrawString ( + week.ToString(), + mc.Font, + ResPool.GetSolidBrush (mc.TitleBackColor), + date_rect, + mc.centered_format); + } + date_rect.Offset(date_cell_size.Width, 0); + } + + // only draw the days if we have to + if(month_row_count == i) { + for (int j=0; j < 7; j++) + { + if (draw_row) { + DrawMonthCalendarDate ( + dc, + date_rect, + mc, + current_date, + this_month, + row, + col); + } + + // move the day on + current_date = current_date.AddDays(1); + date_rect.Offset(date_cell_size.Width, 0); + } + + // shift the rectangle down one row + int offset = (mc.ShowWeekNumbers) ? -8 : -7; + date_rect.Offset(offset*date_cell_size.Width, date_cell_size.Height); + } + } + + // month_row_count is zero based, so add one + month_row_count++; + + // draw week numbers if required + if (draw_week_num_divider) { + col_offset = 1; + dc.DrawLine ( + ResPool.GetPen (mc.ForeColor), + rectangle.X + date_cell_size.Width - 1, + rectangle.Y + title_size.Height + date_cell_size.Height + mc.divider_line_offset, + rectangle.X + date_cell_size.Width - 1, + rectangle.Y + title_size.Height + date_cell_size.Height + (month_row_count * date_cell_size.Height) - mc.divider_line_offset); + } + } + + // draws the pervious or next button + private void DrawMonthCalendarButton (Graphics dc, Rectangle rectangle, MonthCalendar mc, Size title_size, int x_offset, Size button_size, bool is_previous) + { + const int arrow_width = 4; + const int arrow_height = 7; + + bool is_clicked = false; + Rectangle button_rect; + PointF arrow_center; + PointF [] arrow_path = new PointF [3]; + + // prepare the button + if (is_previous) + { + is_clicked = mc.is_previous_clicked; + + button_rect = new Rectangle ( + rectangle.X + 1 + x_offset, + rectangle.Y + 1 + ((title_size.Height - button_size.Height)/2), + Math.Max(button_size.Width - 1, 0), + Math.Max(button_size.Height - 1, 0)); + + arrow_center = new PointF (button_rect.X + ((button_rect.Width + arrow_width) / 2.0f), + rectangle.Y + ((button_rect.Height + arrow_height) / 2) + 1); + if (is_clicked) { + arrow_center.X += 1; + arrow_center.Y += 1; + } + + arrow_path [0].X = arrow_center.X; + arrow_path [0].Y = arrow_center.Y - arrow_height / 2.0f + 0.5f; + arrow_path [1].X = arrow_center.X; + arrow_path [1].Y = arrow_center.Y + arrow_height / 2.0f + 0.5f; + arrow_path [2].X = arrow_center.X - arrow_width; + arrow_path [2].Y = arrow_center.Y + 0.5f; + } + else + { + is_clicked = mc.is_next_clicked; + + button_rect = new Rectangle ( + rectangle.Right - 1 - x_offset - button_size.Width, + rectangle.Y + 1 + ((title_size.Height - button_size.Height)/2), + Math.Max(button_size.Width - 1, 0), + Math.Max(button_size.Height - 1, 0)); + + arrow_center = new PointF (button_rect.X + ((button_rect.Width + arrow_width) / 2.0f), + rectangle.Y + ((button_rect.Height + arrow_height) / 2) + 1); + if (is_clicked) { + arrow_center.X += 1; + arrow_center.Y += 1; + } + + arrow_path [0].X = arrow_center.X - arrow_width; + arrow_path [0].Y = arrow_center.Y - arrow_height / 2.0f + 0.5f; + arrow_path [1].X = arrow_center.X - arrow_width; + arrow_path [1].Y = arrow_center.Y + arrow_height / 2.0f + 0.5f; + arrow_path [2].X = arrow_center.X; + arrow_path [2].Y = arrow_center.Y + 0.5f; + } + + // fill the background + dc.FillRectangle (SystemBrushes.Control, button_rect); + // draw the border + if (is_clicked) { + dc.DrawRectangle (SystemPens.ControlDark, button_rect); + } + else { + CPDrawBorder3D (dc, button_rect, Border3DStyle.Raised, Border3DSide.Left | Border3DSide.Right | Border3DSide.Top | Border3DSide.Bottom); + } + // draw the arrow + dc.FillPolygon (SystemBrushes.ControlText, arrow_path); + //dc.FillPolygon (SystemBrushes.ControlText, arrow_path, FillMode.Winding); + } + + + // draws one day in the calendar grid + private void DrawMonthCalendarDate (Graphics dc, Rectangle rectangle, MonthCalendar mc, DateTime date, DateTime month, int row, int col) { + Color date_color = mc.ForeColor; + Rectangle interior = new Rectangle (rectangle.X, rectangle.Y, Math.Max(rectangle.Width - 1, 0), Math.Max(rectangle.Height - 1, 0)); + + // find out if we are the lead of the first calendar or the trail of the last calendar + if (date.Year != month.Year || date.Month != month.Month) { + DateTime check_date = month.AddMonths (-1); + // check if it's the month before + if (check_date.Year == date.Year && check_date.Month == date.Month && row == 0 && col == 0) { + date_color = mc.TrailingForeColor; + } else { + // check if it's the month after + check_date = month.AddMonths (1); + if (check_date.Year == date.Year && check_date.Month == date.Month && row == mc.CalendarDimensions.Height-1 && col == mc.CalendarDimensions.Width-1) { + date_color = mc.TrailingForeColor; + } else { + return; + } + } + } else { + date_color = mc.ForeColor; + } + + const int inflate = -1; + + if (date == mc.SelectionStart.Date && date == mc.SelectionEnd.Date) { + // see if the date is in the start of selection + date_color = mc.BackColor; + // draw the left hand of the back ground + Rectangle selection_rect = Rectangle.Inflate (rectangle, inflate, inflate); + dc.FillPie (ResPool.GetSolidBrush (mc.TitleBackColor), selection_rect, 0, 360); + } else if (date == mc.SelectionStart.Date) { + // see if the date is in the start of selection + date_color = mc.BackColor; + // draw the left hand of the back ground + Rectangle selection_rect = Rectangle.Inflate (rectangle, inflate, inflate); + dc.FillPie (ResPool.GetSolidBrush (mc.TitleBackColor), selection_rect, 90, 180); + // fill the other side as a straight rect + if (date < mc.SelectionEnd.Date) + { + // use rectangle instead of rectangle to go all the way to edge of rect + selection_rect.X = (int) Math.Floor((double)(rectangle.X + rectangle.Width / 2)); + selection_rect.Width = Math.Max(rectangle.Right - selection_rect.X, 0); + dc.FillRectangle (ResPool.GetSolidBrush (mc.TitleBackColor), selection_rect); + } + } else if (date == mc.SelectionEnd.Date) { + // see if it is the end of selection + date_color = mc.BackColor; + // draw the left hand of the back ground + Rectangle selection_rect = Rectangle.Inflate (rectangle, inflate, inflate); + dc.FillPie (ResPool.GetSolidBrush (mc.TitleBackColor), selection_rect, 270, 180); + // fill the other side as a straight rect + if (date > mc.SelectionStart.Date) { + selection_rect.X = rectangle.X; + selection_rect.Width = rectangle.Width - (rectangle.Width / 2); + dc.FillRectangle (ResPool.GetSolidBrush (mc.TitleBackColor), selection_rect); + } + } else if (date > mc.SelectionStart.Date && date < mc.SelectionEnd.Date) { + // now see if it's in the middle + date_color = mc.BackColor; + // draw the left hand of the back ground + Rectangle selection_rect = Rectangle.Inflate (rectangle, 0, inflate); + dc.FillRectangle (ResPool.GetSolidBrush (mc.TitleBackColor), selection_rect); + } + + // establish if it's a bolded font + Font font = mc.IsBoldedDate (date) ? mc.bold_font : mc.Font; + + // just draw the date now + dc.DrawString (date.Day.ToString(), font, ResPool.GetSolidBrush (date_color), rectangle, mc.centered_format); + + // today circle if needed + if (mc.ShowTodayCircle && date == DateTime.Now.Date) { + DrawTodayCircle (dc, interior); + } + + // draw the selection grid + if (mc.is_date_clicked && mc.clicked_date == date) { + Pen pen = ResPool.GetDashPen (Color.Black, DashStyle.Dot); + dc.DrawRectangle (pen, interior); + } + } + + private void DrawTodayCircle (Graphics dc, Rectangle rectangle) { + Color circle_color = Color.FromArgb (248, 0, 0); + // draw the left hand of the circle + Rectangle lhs_circle_rect = new Rectangle (rectangle.X + 1, rectangle.Y + 4, Math.Max(rectangle.Width - 2, 0), Math.Max(rectangle.Height - 5, 0)); + Rectangle rhs_circle_rect = new Rectangle (rectangle.X + 1, rectangle.Y + 1, Math.Max(rectangle.Width - 2, 0), Math.Max(rectangle.Height - 2, 0)); + Point [] curve_points = new Point [3]; + curve_points [0] = new Point (lhs_circle_rect.X, rhs_circle_rect.Y + rhs_circle_rect.Height/12); + curve_points [1] = new Point (lhs_circle_rect.X + lhs_circle_rect.Width/9, rhs_circle_rect.Y); + curve_points [2] = new Point (lhs_circle_rect.X + lhs_circle_rect.Width/2 + 1, rhs_circle_rect.Y); + + Pen pen = ResPool.GetSizedPen(circle_color, 2); + dc.DrawArc (pen, lhs_circle_rect, 90, 180); + dc.DrawArc (pen, rhs_circle_rect, 270, 180); + dc.DrawCurve (pen, curve_points); + dc.DrawLine (ResPool.GetPen (circle_color), curve_points [2], new Point (curve_points [2].X, lhs_circle_rect.Y)); + } + + #endregion // MonthCalendar + + #region Panel + public override Size PanelDefaultSize { + get { + return new Size (200, 100); + } + } + #endregion // Panel + + #region PictureBox + public override void DrawPictureBox (Graphics dc, Rectangle clip, PictureBox pb) { + Rectangle client = pb.ClientRectangle; + + client = new Rectangle (client.Left + pb.Padding.Left, client.Top + pb.Padding.Top, client.Width - pb.Padding.Horizontal, client.Height - pb.Padding.Vertical); + + // FIXME - instead of drawing the whole picturebox every time + // intersect the clip rectangle with the drawn picture and only draw what's needed, + // Also, we only need a background fill where no image goes + if (pb.Image != null) { + switch (pb.SizeMode) { + case PictureBoxSizeMode.StretchImage: + dc.DrawImage (pb.Image, client.Left, client.Top, client.Width, client.Height); + break; + + case PictureBoxSizeMode.CenterImage: + dc.DrawImage (pb.Image, (client.Width / 2) - (pb.Image.Width / 2), (client.Height / 2) - (pb.Image.Height / 2)); + break; + + case PictureBoxSizeMode.Zoom: + Size image_size; + + if (((float)pb.Image.Width / (float)pb.Image.Height) >= ((float)client.Width / (float)client.Height)) + image_size = new Size (client.Width, (pb.Image.Height * client.Width) / pb.Image.Width); + else + image_size = new Size ((pb.Image.Width * client.Height) / pb.Image.Height, client.Height); + + dc.DrawImage (pb.Image, (client.Width / 2) - (image_size.Width / 2), (client.Height / 2) - (image_size.Height / 2), image_size.Width, image_size.Height); + break; + + default: + // Normal, AutoSize + dc.DrawImage (pb.Image, client.Left, client.Top, pb.Image.Width, pb.Image.Height); + break; + } + + return; + } + } + + public override Size PictureBoxDefaultSize { + get { + return new Size (100, 50); + } + } + #endregion // PictureBox + + /* + #region PrintPreviewControl + public override int PrintPreviewControlPadding { + get { return 8; } + } + + public override Size PrintPreviewControlGetPageSize (PrintPreviewControl preview) + { + int page_width, page_height; + int padding = PrintPreviewControlPadding; + PreviewPageInfo[] pis = preview.page_infos; + + if (preview.AutoZoom) { + int height_available = preview.ClientRectangle.Height - (preview.Rows) * padding - 2 * padding; + int width_available = preview.ClientRectangle.Width - (preview.Columns - 1) * padding - 2 * padding; + + float image_ratio = (float)pis[0].Image.Width / pis[0].Image.Height; + + /* try to lay things out using the width to determine the size + page_width = width_available / preview.Columns; + page_height = (int)(page_width / image_ratio); + + /* does the height fit? + if (page_height * (preview.Rows + 1) > height_available) { + /* no, lay things out via the height + page_height = height_available / (preview.Rows + 1); + page_width = (int)(page_height * image_ratio); + } + } + else { + page_width = (int)(pis[0].Image.Width * preview.Zoom); + page_height = (int)(pis[0].Image.Height * preview.Zoom); + } + + return new Size (page_width, page_height); + } + + public override void PrintPreviewWidgetPaint (PaintEventArgs pe, PrintPreviewControl preview, Size page_size) + { + int padding = 8; + PreviewPageInfo[] pis = preview.page_infos; + if (pis == null) + return; + + int page_x, page_y; + + int width = page_size.Width * preview.Columns + padding * (preview.Columns - 1) + 2 * padding; + int height = page_size.Height * (preview.Rows + 1) + padding * preview.Rows + 2 * padding; + + Rectangle viewport = preview.ViewPort; + + pe.Graphics.Clip = new Region (viewport); + + /* center things if we can + int off_x = viewport.Width / 2 - width / 2; + if (off_x < 0) off_x = 0; + int off_y = viewport.Height / 2 - height / 2; + if (off_y < 0) off_y = 0; + + page_y = off_y + padding - preview.vbar_value; + + if (preview.StartPage > 0) { + int p = preview.StartPage - 1; + for (int py = 0; py < preview.Rows + 1; py ++) { + page_x = off_x + padding - preview.hbar_value; + for (int px = 0; px < preview.Columns; px ++) { + if (p >= pis.Length) + continue; + Image image = preview.image_cache[p]; + if (image == null) + image = pis[p].Image; + Rectangle dest = new Rectangle (new Point (page_x, page_y), page_size); + + pe.Graphics.DrawImage (image, dest, 0, 0, image.Width, image.Height, GraphicsUnit.Pixel); + + page_x += padding + page_size.Width; + p++; + } + page_y += padding + page_size.Height; + } + } + } + #endregion // PrintPreviewControl*/ + + #region ProgressBar + public override void DrawProgressBar (Graphics dc, Rectangle clip_rect, ProgressBar ctrl) + { + Rectangle client_area = ctrl.client_area; + + /* Draw border */ + CPDrawBorder3D (dc, ctrl.ClientRectangle, Border3DStyle.SunkenOuter, Border3DSide.Left | Border3DSide.Right | Border3DSide.Top | Border3DSide.Bottom & ~Border3DSide.Middle, ColorControl); + + /* Draw Blocks */ + int draw_mode = 0; + int max_blocks = int.MaxValue; + int start_pixel = client_area.X; + draw_mode = (int) ctrl.Style; + + switch (draw_mode) { + case 1: { // Continuous + int pixels_to_draw; + pixels_to_draw = (int)(client_area.Width * ((double)(ctrl.Value - ctrl.Minimum) / (double)(Math.Max(ctrl.Maximum - ctrl.Minimum, 1)))); + dc.FillRectangle (ResPool.GetSolidBrush (ctrl.ForeColor), new Rectangle (client_area.X, client_area.Y, pixels_to_draw, client_area.Height)); + break; + } + case 2: // Marquee + if (XplatUI.ThemesEnabled) { + int ms_diff = (int) (DateTime.Now - ctrl.start).TotalMilliseconds; + double percent_done = (double) ms_diff / ProgressBarMarqueeSpeedScaling + % (double)ctrl.MarqueeAnimationSpeed / (double)ctrl.MarqueeAnimationSpeed; + max_blocks = 5; + start_pixel = client_area.X + (int) (client_area.Width * percent_done); + } + + goto case 0; + case 0: + default: // Blocks + Rectangle block_rect; + int space_betweenblocks = ProgressBarChunkSpacing; + int block_width; + int increment; + int barpos_pixels; + int block_count = 0; + + block_width = ProgressBarGetChunkSize (client_area.Height); + block_width = Math.Max (block_width, 0); // block_width is used to break out the loop below, it must be >= 0! + barpos_pixels = (int)(((double)(ctrl.Value - ctrl.Minimum) * client_area.Width) / (Math.Max (ctrl.Maximum - ctrl.Minimum, 1))); + increment = block_width + space_betweenblocks; + + block_rect = new Rectangle (start_pixel, client_area.Y, block_width, client_area.Height); + while (true) { + if (max_blocks != int.MaxValue) { + if (block_count >= max_blocks) + break; + if (block_rect.X > client_area.Width) + block_rect.X -= client_area.Width; + } else { + if ((block_rect.X - client_area.X) >= barpos_pixels) + break; + } + + if (clip_rect.IntersectsWith (block_rect) == true) { + dc.FillRectangle (ResPool.GetSolidBrush (ctrl.ForeColor), block_rect); + } + + block_rect.X += increment; + block_count++; + } + break; + + } + } + + public const int ProgressBarChunkSpacing = 2; + + public static int ProgressBarGetChunkSize () + { + return ProgressBarGetChunkSize (ProgressBarDefaultHeight); + } + + static int ProgressBarGetChunkSize (int progressBarClientAreaHeight) + { + int size = (progressBarClientAreaHeight * 2) / 3; + return size; + } + + const int ProgressBarDefaultHeight = 23; + + public override Size ProgressBarDefaultSize { + get { + return new Size (100, ProgressBarDefaultHeight); + } + } + + public const double ProgressBarMarqueeSpeedScaling = 15; + + #endregion // ProgressBar + + #region RadioButton + public override void DrawRadioButton (Graphics dc, Rectangle clip_rectangle, RadioButton radio_button) { + StringFormat text_format; + Rectangle client_rectangle; + Rectangle text_rectangle; + Rectangle radiobutton_rectangle; + int radiobutton_size = 13; + int radiobutton_space = 4; + + client_rectangle = radio_button.ClientRectangle; + text_rectangle = client_rectangle; + radiobutton_rectangle = new Rectangle(text_rectangle.X, text_rectangle.Y, radiobutton_size, radiobutton_size); + + text_format = new StringFormat(); + text_format.Alignment = StringAlignment.Near; + text_format.LineAlignment = StringAlignment.Center; + text_format.HotkeyPrefix = HotkeyPrefix.Show; + + /* Calculate the position of text and checkbox rectangle */ + if (radio_button.appearance!=Appearance.Button) { + switch(radio_button.radiobutton_alignment) { + case ContentAlignment.BottomCenter: { + radiobutton_rectangle.X=(client_rectangle.Right-client_rectangle.Left)/2-radiobutton_size/2; + radiobutton_rectangle.Y=client_rectangle.Bottom-radiobutton_size; + text_rectangle.X=client_rectangle.X; + text_rectangle.Width=client_rectangle.Width; + text_rectangle.Height=client_rectangle.Height-radiobutton_size-radiobutton_space; + break; + } + + case ContentAlignment.BottomLeft: { + radiobutton_rectangle.X=client_rectangle.Left; + radiobutton_rectangle.Y=client_rectangle.Bottom-radiobutton_size; + text_rectangle.X=client_rectangle.X+radiobutton_size+radiobutton_space; + text_rectangle.Width=client_rectangle.Width-radiobutton_size-radiobutton_space; + break; + } + + case ContentAlignment.BottomRight: { + radiobutton_rectangle.X=client_rectangle.Right-radiobutton_size; + radiobutton_rectangle.Y=client_rectangle.Bottom-radiobutton_size; + text_rectangle.X=client_rectangle.X; + text_rectangle.Width=client_rectangle.Width-radiobutton_size-radiobutton_space; + break; + } + + case ContentAlignment.MiddleCenter: { + radiobutton_rectangle.X=(client_rectangle.Right-client_rectangle.Left)/2-radiobutton_size/2; + radiobutton_rectangle.Y=(client_rectangle.Bottom-client_rectangle.Top)/2-radiobutton_size/2; + text_rectangle.X=client_rectangle.X; + text_rectangle.Width=client_rectangle.Width; + break; + } + + default: + case ContentAlignment.MiddleLeft: { + radiobutton_rectangle.X=client_rectangle.Left; + radiobutton_rectangle.Y=(client_rectangle.Bottom-client_rectangle.Top)/2-radiobutton_size/2; + text_rectangle.X=client_rectangle.X+radiobutton_size+radiobutton_space; + text_rectangle.Width=client_rectangle.Width-radiobutton_size-radiobutton_space; + break; + } + + case ContentAlignment.MiddleRight: { + radiobutton_rectangle.X=client_rectangle.Right-radiobutton_size; + radiobutton_rectangle.Y=(client_rectangle.Bottom-client_rectangle.Top)/2-radiobutton_size/2; + text_rectangle.X=client_rectangle.X; + text_rectangle.Width=client_rectangle.Width-radiobutton_size-radiobutton_space; + break; + } + + case ContentAlignment.TopCenter: { + radiobutton_rectangle.X=(client_rectangle.Right-client_rectangle.Left)/2-radiobutton_size/2; + radiobutton_rectangle.Y=client_rectangle.Top; + text_rectangle.X=client_rectangle.X; + text_rectangle.Y=radiobutton_size+radiobutton_space; + text_rectangle.Width=client_rectangle.Width; + text_rectangle.Height=client_rectangle.Height-radiobutton_size-radiobutton_space; + break; + } + + case ContentAlignment.TopLeft: { + radiobutton_rectangle.X=client_rectangle.Left; + radiobutton_rectangle.Y=client_rectangle.Top; + text_rectangle.X=client_rectangle.X+radiobutton_size+radiobutton_space; + text_rectangle.Width=client_rectangle.Width-radiobutton_size-radiobutton_space; + break; + } + + case ContentAlignment.TopRight: { + radiobutton_rectangle.X=client_rectangle.Right-radiobutton_size; + radiobutton_rectangle.Y=client_rectangle.Top; + text_rectangle.X=client_rectangle.X; + text_rectangle.Width=client_rectangle.Width-radiobutton_size-radiobutton_space; + break; + } + } + } else { + text_rectangle.X=client_rectangle.X; + text_rectangle.Width=client_rectangle.Width; + } + + /* Set the horizontal alignment of our text */ + switch(radio_button.text_alignment) { + case ContentAlignment.BottomLeft: + case ContentAlignment.MiddleLeft: + case ContentAlignment.TopLeft: { + text_format.Alignment=StringAlignment.Near; + break; + } + + case ContentAlignment.BottomCenter: + case ContentAlignment.MiddleCenter: + case ContentAlignment.TopCenter: { + text_format.Alignment=StringAlignment.Center; + break; + } + + case ContentAlignment.BottomRight: + case ContentAlignment.MiddleRight: + case ContentAlignment.TopRight: { + text_format.Alignment=StringAlignment.Far; + break; + } + } + + /* Set the vertical alignment of our text */ + switch(radio_button.text_alignment) { + case ContentAlignment.TopLeft: + case ContentAlignment.TopCenter: + case ContentAlignment.TopRight: { + text_format.LineAlignment=StringAlignment.Near; + break; + } + + case ContentAlignment.BottomLeft: + case ContentAlignment.BottomCenter: + case ContentAlignment.BottomRight: { + text_format.LineAlignment=StringAlignment.Far; + break; + } + + case ContentAlignment.MiddleLeft: + case ContentAlignment.MiddleCenter: + case ContentAlignment.MiddleRight: { + text_format.LineAlignment=StringAlignment.Center; + break; + } + } + + ButtonState state = ButtonState.Normal; + if (radio_button.FlatStyle == FlatStyle.Flat) { + state |= ButtonState.Flat; + } + + if (radio_button.Checked) { + state |= ButtonState.Checked; + } + + if (!radio_button.Enabled) { + state |= ButtonState.Inactive; + } + + // Start drawing + RadioButton_DrawButton(radio_button, dc, state, radiobutton_rectangle); + + if ((radio_button.image != null) || (radio_button.image_list != null)) + ButtonBase_DrawImage(radio_button, dc); + + RadioButton_DrawText(radio_button, text_rectangle, dc, text_format); + + if (radio_button.Focused && radio_button.Enabled && radio_button.appearance != Appearance.Button && radio_button.Text != String.Empty && radio_button.ShowFocusCues) { + SizeF text_size = dc.MeasureString (radio_button.Text, radio_button.Font); + + Rectangle focus_rect = Rectangle.Empty; + focus_rect.X = text_rectangle.X; + focus_rect.Y = (int)((text_rectangle.Height - text_size.Height) / 2); + focus_rect.Size = text_size.ToSize (); + + RadioButton_DrawFocus (radio_button, dc, focus_rect); + } + + text_format.Dispose (); + } + + protected virtual void RadioButton_DrawButton(RadioButton radio_button, Graphics dc, ButtonState state, Rectangle radiobutton_rectangle) + { + dc.FillRectangle(GetControlBackBrush (radio_button.BackColor), radio_button.ClientRectangle); + + if (radio_button.appearance==Appearance.Button) { + ButtonBase_DrawButton (radio_button, dc); + + if ((radio_button.Focused) && radio_button.Enabled) + ButtonBase_DrawFocus(radio_button, dc); + } else { + // establish if we are rendering a flat style of some sort + if (radio_button.FlatStyle == FlatStyle.Flat || radio_button.FlatStyle == FlatStyle.Popup) { + DrawFlatStyleRadioButton (dc, radiobutton_rectangle, radio_button); + } else { + CPDrawRadioButton(dc, radiobutton_rectangle, state); + } + } + } + + protected virtual void RadioButton_DrawText(RadioButton radio_button, Rectangle text_rectangle, Graphics dc, StringFormat text_format) + { + DrawCheckBox_and_RadioButtonText (radio_button, text_rectangle, dc, + text_format, radio_button.Appearance, radio_button.Checked); + } + + protected virtual void RadioButton_DrawFocus(RadioButton radio_button, Graphics dc, Rectangle text_rectangle) + { + DrawInnerFocusRectangle (dc, text_rectangle, radio_button.BackColor); + } + + + // renders a radio button with the Flat and Popup FlatStyle + protected virtual void DrawFlatStyleRadioButton (Graphics graphics, Rectangle rectangle, RadioButton radio_button) + { + int lineWidth; + + if (radio_button.Enabled) { + + // draw the outer flatstyle arcs + if (radio_button.FlatStyle == FlatStyle.Flat) { + graphics.DrawArc (SystemPens.ControlDarkDark, rectangle, 0, 359); + + // fill in the area depending on whether or not the mouse is hovering + if ((radio_button.is_entered || radio_button.Capture) && !radio_button.is_pressed) { + graphics.FillPie (SystemBrushes.ControlLight, rectangle.X + 1, rectangle.Y + 1, rectangle.Width - 2, rectangle.Height - 2, 0, 359); + } else { + graphics.FillPie (SystemBrushes.ControlLightLight, rectangle.X + 1, rectangle.Y + 1, rectangle.Width - 2, rectangle.Height - 2, 0, 359); + } + } else { + // must be a popup radio button + // fill the control + graphics.FillPie (SystemBrushes.ControlLightLight, rectangle, 0, 359); + + if (radio_button.is_entered || radio_button.Capture) { + // draw the popup 3d button knob + graphics.DrawArc (SystemPens.ControlLight, rectangle.X+1, rectangle.Y+1, rectangle.Width-2, rectangle.Height-2, 0, 359); + + graphics.DrawArc (SystemPens.ControlDark, rectangle, 135, 180); + graphics.DrawArc (SystemPens.ControlLightLight, rectangle, 315, 180); + + } else { + // just draw lighter flatstyle outer circle + graphics.DrawArc (SystemPens.ControlDark, rectangle, 0, 359); + } + } + } else { + // disabled + // fill control background color regardless of actual backcolor + graphics.FillPie (SystemBrushes.Control, rectangle.X + 1, rectangle.Y + 1, rectangle.Width - 2, rectangle.Height - 2, 0, 359); + // draw the ark as control dark + graphics.DrawArc (SystemPens.ControlDark, rectangle, 0, 359); + } + + // draw the check + if (radio_button.Checked) { + lineWidth = Math.Max (1, Math.Min(rectangle.Width, rectangle.Height)/3); + + Pen dot_pen = SystemPens.ControlDarkDark; + Brush dot_brush = SystemBrushes.ControlDarkDark; + + if (!radio_button.Enabled || ((radio_button.FlatStyle == FlatStyle.Popup) && radio_button.is_pressed)) { + dot_pen = SystemPens.ControlDark; + dot_brush = SystemBrushes.ControlDark; + } + + if (rectangle.Height > 13) { + graphics.FillPie (dot_brush, rectangle.X + lineWidth, rectangle.Y + lineWidth, rectangle.Width - lineWidth * 2, rectangle.Height - lineWidth * 2, 0, 359); + } else { + int x_half_pos = (rectangle.Width / 2) + rectangle.X; + int y_half_pos = (rectangle.Height / 2) + rectangle.Y; + + graphics.DrawLine (dot_pen, x_half_pos - 1, y_half_pos, x_half_pos + 2, y_half_pos); + graphics.DrawLine (dot_pen, x_half_pos - 1, y_half_pos + 1, x_half_pos + 2, y_half_pos + 1); + + graphics.DrawLine (dot_pen, x_half_pos, y_half_pos - 1, x_half_pos, y_half_pos + 2); + graphics.DrawLine (dot_pen, x_half_pos + 1, y_half_pos - 1, x_half_pos + 1, y_half_pos + 2); + } + } + } + + public override Size RadioButtonDefaultSize { + get { + return new Size (104,24); + } + } + + public override void DrawRadioButton (Graphics g, RadioButton rb, Rectangle glyphArea, Rectangle textBounds, Rectangle imageBounds, Rectangle clipRectangle) + { + // Draw Button Background + if (rb.FlatStyle == FlatStyle.Flat || rb.FlatStyle == FlatStyle.Popup) { + glyphArea.Height -= 2; + glyphArea.Width -= 2; + } + + DrawRadioButtonGlyph (g, rb, glyphArea); + + // If we have an image, draw it + if (imageBounds.Size != Size.Empty) + DrawRadioButtonImage (g, rb, imageBounds); + + if (rb.Focused && rb.Enabled && rb.ShowFocusCues && textBounds.Size != Size.Empty) + DrawRadioButtonFocus (g, rb, textBounds); + + // If we have text, draw it + if (textBounds != Rectangle.Empty) + DrawRadioButtonText (g, rb, textBounds); + } + + public virtual void DrawRadioButtonGlyph (Graphics g, RadioButton rb, Rectangle glyphArea) + { + if (rb.Pressed) + ThemeElements.CurrentTheme.RadioButtonPainter.PaintRadioButton (g, glyphArea, rb.BackColor, rb.ForeColor, ElementState.Pressed, rb.FlatStyle, rb.Checked); + else if (rb.InternalSelected) + ThemeElements.CurrentTheme.RadioButtonPainter.PaintRadioButton (g, glyphArea, rb.BackColor, rb.ForeColor, ElementState.Normal, rb.FlatStyle, rb.Checked); + else if (rb.Entered) + ThemeElements.CurrentTheme.RadioButtonPainter.PaintRadioButton (g, glyphArea, rb.BackColor, rb.ForeColor, ElementState.Hot, rb.FlatStyle, rb.Checked); + else if (!rb.Enabled) + ThemeElements.CurrentTheme.RadioButtonPainter.PaintRadioButton (g, glyphArea, rb.BackColor, rb.ForeColor, ElementState.Disabled, rb.FlatStyle, rb.Checked); + else + ThemeElements.CurrentTheme.RadioButtonPainter.PaintRadioButton (g, glyphArea, rb.BackColor, rb.ForeColor, ElementState.Normal, rb.FlatStyle, rb.Checked); + } + + public virtual void DrawRadioButtonFocus (Graphics g, RadioButton rb, Rectangle focusArea) + { + WidgetPaint.DrawFocusRectangle (g, focusArea); + } + + public virtual void DrawRadioButtonImage (Graphics g, RadioButton rb, Rectangle imageBounds) + { + if (rb.Enabled) + g.DrawImage (rb.Image, imageBounds); + else + CPDrawImageDisabled (g, rb.Image, imageBounds.Left, imageBounds.Top, ColorControl); + } + + public virtual void DrawRadioButtonText (Graphics g, RadioButton rb, Rectangle textBounds) + { + if (rb.Enabled) + TextRenderer.DrawTextInternal (g, rb.Text, rb.Font, textBounds, rb.ForeColor, rb.TextFormatFlags, rb.UseCompatibleTextRendering); + else + DrawStringDisabled20 (g, rb.Text, rb.Font, textBounds, rb.BackColor, rb.TextFormatFlags, rb.UseCompatibleTextRendering); + } + + public override Size CalculateRadioButtonAutoSize (RadioButton rb) + { + Size ret_size = Size.Empty; + Size text_size = TextRenderer.MeasureTextInternal (rb.Text, rb.Font, rb.UseCompatibleTextRendering); + Size image_size = rb.Image == null ? Size.Empty : rb.Image.Size; + + // Pad the text size + if (rb.Text.Length != 0) { + text_size.Height += 4; + text_size.Width += 4; + } + + switch (rb.TextImageRelation) { + case TextImageRelation.Overlay: + ret_size.Height = Math.Max (rb.Text.Length == 0 ? 0 : text_size.Height, image_size.Height); + ret_size.Width = Math.Max (text_size.Width, image_size.Width); + break; + case TextImageRelation.ImageAboveText: + case TextImageRelation.TextAboveImage: + ret_size.Height = text_size.Height + image_size.Height; + ret_size.Width = Math.Max (text_size.Width, image_size.Width); + break; + case TextImageRelation.ImageBeforeText: + case TextImageRelation.TextBeforeImage: + ret_size.Height = Math.Max (text_size.Height, image_size.Height); + ret_size.Width = text_size.Width + image_size.Width; + break; + } + + // Pad the result + ret_size.Height += (rb.Padding.Vertical); + ret_size.Width += (rb.Padding.Horizontal) + 15; + + // There seems to be a minimum height + if (ret_size.Height == rb.Padding.Vertical) + ret_size.Height += 14; + + return ret_size; + } + + public override void CalculateRadioButtonTextAndImageLayout (ButtonBase b, Point offset, out Rectangle glyphArea, out Rectangle textRectangle, out Rectangle imageRectangle) + { + CalculateCheckBoxTextAndImageLayout (b, offset, out glyphArea, out textRectangle, out imageRectangle); + } + #endregion // RadioButton + + #region ScrollBar + public override void DrawScrollBar (Graphics dc, Rectangle clip, ScrollBar bar) + { + int scrollbutton_width = bar.scrollbutton_width; + int scrollbutton_height = bar.scrollbutton_height; + Rectangle first_arrow_area; + Rectangle second_arrow_area; + Rectangle thumb_pos; + + thumb_pos = bar.ThumbPos; + + if (bar.vert) { + first_arrow_area = new Rectangle(0, 0, bar.Width, scrollbutton_height); + bar.FirstArrowArea = first_arrow_area; + + second_arrow_area = new Rectangle(0, bar.ClientRectangle.Height - scrollbutton_height, bar.Width, scrollbutton_height); + bar.SecondArrowArea = second_arrow_area; + + thumb_pos.Width = bar.Width; + bar.ThumbPos = thumb_pos; + + Brush VerticalBrush; + /* Background, upper track */ + if (bar.thumb_moving == ScrollBar.ThumbMoving.Backwards) + VerticalBrush = ResPool.GetHatchBrush (HatchStyle.Percent50, Color.FromArgb (255, 63, 63, 63), Color.Black); + else + VerticalBrush = ResPool.GetHatchBrush (HatchStyle.Percent50, ColorScrollBar, Color.White); + Rectangle UpperTrack = new Rectangle (0, 0, bar.ClientRectangle.Width, bar.ThumbPos.Bottom); + if (clip.IntersectsWith (UpperTrack)) + dc.FillRectangle (VerticalBrush, UpperTrack); + + /* Background, lower track */ + if (bar.thumb_moving == ScrollBar.ThumbMoving.Forward) + VerticalBrush = ResPool.GetHatchBrush (HatchStyle.Percent50, Color.FromArgb (255, 63, 63, 63), Color.Black); + else + VerticalBrush = ResPool.GetHatchBrush (HatchStyle.Percent50, ColorScrollBar, Color.White); + Rectangle LowerTrack = new Rectangle (0, bar.ThumbPos.Bottom, bar.ClientRectangle.Width, bar.ClientRectangle.Height - bar.ThumbPos.Bottom); + if (clip.IntersectsWith (LowerTrack)) + dc.FillRectangle (VerticalBrush, LowerTrack); + + /* Buttons */ + if (clip.IntersectsWith (first_arrow_area)) + CPDrawScrollButton (dc, first_arrow_area, ScrollButton.Up, bar.firstbutton_state); + if (clip.IntersectsWith (second_arrow_area)) + CPDrawScrollButton (dc, second_arrow_area, ScrollButton.Down, bar.secondbutton_state); + } else { + first_arrow_area = new Rectangle(0, 0, scrollbutton_width, bar.Height); + bar.FirstArrowArea = first_arrow_area; + + second_arrow_area = new Rectangle (bar.ClientRectangle.Width - scrollbutton_width, 0, scrollbutton_width, bar.Height); + bar.SecondArrowArea = second_arrow_area; + + thumb_pos.Height = bar.Height; + bar.ThumbPos = thumb_pos; + + Brush HorizontalBrush; + //Background, left track + if (bar.thumb_moving == ScrollBar.ThumbMoving.Backwards) + HorizontalBrush = ResPool.GetHatchBrush (HatchStyle.Percent50, Color.FromArgb (255, 63, 63, 63), Color.Black); + else + HorizontalBrush = ResPool.GetHatchBrush (HatchStyle.Percent50, ColorScrollBar, Color.White); + Rectangle LeftTrack = new Rectangle (0, 0, bar.ThumbPos.Right, bar.ClientRectangle.Height); + if (clip.IntersectsWith (LeftTrack)) + dc.FillRectangle (HorizontalBrush, LeftTrack); + + //Background, right track + if (bar.thumb_moving == ScrollBar.ThumbMoving.Forward) + HorizontalBrush = ResPool.GetHatchBrush (HatchStyle.Percent50, Color.FromArgb (255, 63, 63, 63), Color.Black); + else + HorizontalBrush = ResPool.GetHatchBrush (HatchStyle.Percent50, ColorScrollBar, Color.White); + Rectangle RightTrack = new Rectangle (bar.ThumbPos.Right, 0, bar.ClientRectangle.Width - bar.ThumbPos.Right, bar.ClientRectangle.Height); + if (clip.IntersectsWith (RightTrack)) + dc.FillRectangle (HorizontalBrush, RightTrack); + + /* Buttons */ + if (clip.IntersectsWith (first_arrow_area)) + CPDrawScrollButton (dc, first_arrow_area, ScrollButton.Left, bar.firstbutton_state); + if (clip.IntersectsWith (second_arrow_area)) + CPDrawScrollButton (dc, second_arrow_area, ScrollButton.Right, bar.secondbutton_state); + } + + /* Thumb */ + ScrollBar_DrawThumb(bar, thumb_pos, clip, dc); + } + + protected virtual void ScrollBar_DrawThumb(ScrollBar bar, Rectangle thumb_pos, Rectangle clip, Graphics dc) + { + if (bar.Enabled && thumb_pos.Width > 0 && thumb_pos.Height > 0 && clip.IntersectsWith(thumb_pos)) + DrawScrollButtonPrimitive(dc, thumb_pos, ButtonState.Normal); + } + + public override int ScrollBarButtonSize { + get { return 16; } + } + + public override bool ScrollBarHasHotElementStyles { + get { + return false; + } + } + + public override bool ScrollBarHasPressedThumbStyle { + get { + return false; + } + } + + public override bool ScrollBarHasHoverArrowButtonStyle { + get { + return false; + } + } + #endregion // ScrollBar + + #region StatusBar + public override void DrawStatusBar (Graphics real_dc, Rectangle clip, StatusBar sb) { + Rectangle area = sb.ClientRectangle; + int horz_border = 2; + int vert_border = 2; + + Image backbuffer = new Bitmap (sb.ClientSize.Width, sb.ClientSize.Height, real_dc); + Graphics dc = Graphics.FromImage (backbuffer); + + DrawStatusBarBackground (dc, clip, sb); + + if (!sb.ShowPanels && sb.Text != String.Empty) { + string text = sb.Text; + StringFormat string_format = new StringFormat (); + string_format.Trimming = StringTrimming.Character; + string_format.FormatFlags = StringFormatFlags.NoWrap; + + if (text.Length > 127) + text = text.Substring (0, 127); + + if (text [0] == '\t') { + string_format.Alignment = StringAlignment.Center; + text = text.Substring (1); + if (text [0] == '\t') { + string_format.Alignment = StringAlignment.Far; + text = text.Substring (1); + } + } + + dc.DrawString (text, sb.Font, ResPool.GetSolidBrush (sb.ForeColor), + new Rectangle(area.X + 2, area.Y + 2, area.Width - 4, area.Height - 4), string_format); + string_format.Dispose (); + } else if (sb.ShowPanels) { + Brush br_forecolor = GetControlForeBrush (sb.ForeColor); + int prev_x = area.X + horz_border; + int y = area.Y + vert_border; + for (int i = 0; i < sb.Panels.Count; i++) { + Rectangle pr = new Rectangle (prev_x, y, + sb.Panels [i].Width, area.Height); + prev_x += pr.Width + StatusBarHorzGapWidth; + if (pr.IntersectsWith (clip)) + DrawStatusBarPanel (dc, pr, i, br_forecolor, sb.Panels [i]); + } + } + + if (sb.SizingGrip) + DrawStatusBarSizingGrip (dc, clip, sb, area); + + real_dc.DrawImage (backbuffer, 0, 0); + dc.Dispose (); + backbuffer.Dispose (); + + } + + protected virtual void DrawStatusBarBackground (Graphics dc, Rectangle clip, StatusBar sb) + { + bool is_color_control = sb.BackColor.ToArgb () == ColorControl.ToArgb (); + + Brush brush = is_color_control ? SystemBrushes.Control : ResPool.GetSolidBrush (sb.BackColor); + dc.FillRectangle (brush, clip); + } + + protected virtual void DrawStatusBarSizingGrip (Graphics dc, Rectangle clip, StatusBar sb, Rectangle area) + { + area = new Rectangle (area.Right - 16 - 2, area.Bottom - 12 - 1, 16, 16); + CPDrawSizeGrip (dc, ColorControl, area); + } + + protected virtual void DrawStatusBarPanel (Graphics dc, Rectangle area, int index, + Brush br_forecolor, StatusBarPanel panel) { + int border_size = 3; // this is actually const, even if the border style is none + int icon_width = 16; + + area.Height -= border_size; + + DrawStatusBarPanelBackground (dc, area, panel); + + if (panel.Style == StatusBarPanelStyle.OwnerDraw) { + StatusBarDrawItemEventArgs e = new StatusBarDrawItemEventArgs ( + dc, panel.Parent.Font, area, index, DrawItemState.Default, + panel, panel.Parent.ForeColor, panel.Parent.BackColor); + panel.Parent.OnDrawItemInternal (e); + return; + } + + string text = panel.Text; + StringFormat string_format = new StringFormat (); + string_format.Trimming = StringTrimming.Character; + string_format.FormatFlags = StringFormatFlags.NoWrap; + + + if (text != null && text.Length > 0 && text [0] == '\t') { + string_format.Alignment = StringAlignment.Center; + text = text.Substring (1); + if (text [0] == '\t') { + string_format.Alignment = StringAlignment.Far; + text = text.Substring (1); + } + } + + Rectangle string_rect = Rectangle.Empty; + int x; + int len; + int icon_x = 0; + int y = (area.Height / 2 - (int) panel.Parent.Font.Size / 2) - 1; + + switch (panel.Alignment) { + case HorizontalAlignment.Right: + len = (int) dc.MeasureString (text, panel.Parent.Font).Width; + x = area.Right - len - 4; + string_rect = new Rectangle (x, y, + area.Right - x - border_size, + area.Bottom - y - border_size); + if (panel.Icon != null) { + icon_x = x - icon_width - 2; + } + break; + case HorizontalAlignment.Center: + len = (int) dc.MeasureString (text, panel.Parent.Font).Width; + x = area.Left + ((panel.Width - len) / 2); + + string_rect = new Rectangle (x, y, + area.Right - x - border_size, + area.Bottom - y - border_size); + + if (panel.Icon != null) { + icon_x = x - icon_width - 2; + } + break; + + + default: + int left = area.Left + border_size;; + if (panel.Icon != null) { + icon_x = area.Left + 2; + left = icon_x + icon_width + 2; + } + + x = left; + string_rect = new Rectangle (x, y, + area.Right - x - border_size, + area.Bottom - y - border_size); + break; + } + + RectangleF clip_bounds = dc.ClipBounds; + dc.SetClip (area); + dc.DrawString (text, panel.Parent.Font, br_forecolor, string_rect, string_format); + dc.SetClip (clip_bounds); + + if (panel.Icon != null) { + dc.DrawIcon (panel.Icon, new Rectangle (icon_x, y, icon_width, icon_width)); + } + } + + protected virtual void DrawStatusBarPanelBackground (Graphics dc, Rectangle area, StatusBarPanel panel) + { + if (panel.BorderStyle != StatusBarPanelBorderStyle.None) { + Border3DStyle border_style = Border3DStyle.SunkenOuter; + if (panel.BorderStyle == StatusBarPanelBorderStyle.Raised) + border_style = Border3DStyle.RaisedInner; + + CPDrawBorder3D(dc, area, border_style, Border3DSide.Left | Border3DSide.Right | Border3DSide.Top | Border3DSide.Bottom, panel.Parent.BackColor); + } + } + + public override int StatusBarSizeGripWidth { + get { return 15; } + } + + public override int StatusBarHorzGapWidth { + get { return 3; } + } + + public override Size StatusBarDefaultSize { + get { + return new Size (100, 22); + } + } + #endregion // StatusBar + + #region TabControl + + #region TabControl settings + + public override Size TabControlDefaultItemSize { + get { return ThemeElements.CurrentTheme.TabWidgetPainter.DefaultItemSize; } + } + + public override Point TabControlDefaultPadding { + get { return ThemeElements.CurrentTheme.TabWidgetPainter.DefaultPadding; } + } + + public override int TabControlMinimumTabWidth { + get { return ThemeElements.CurrentTheme.TabWidgetPainter.MinimumTabWidth; } + } + + public override Rectangle TabWidgetselectedDelta { + get { return ThemeElements.CurrentTheme.TabWidgetPainter.SelectedTabDelta; } + } + + public override int TabWidgetselectedSpacing { + get { return ThemeElements.CurrentTheme.TabWidgetPainter.SelectedSpacing; } + } + + public override int TabPanelOffsetX { + get { return ThemeElements.CurrentTheme.TabWidgetPainter.TabPanelOffset.X; } + } + + public override int TabPanelOffsetY { + get { return ThemeElements.CurrentTheme.TabWidgetPainter.TabPanelOffset.Y; } + } + + public override int TabControlColSpacing { + get { return ThemeElements.CurrentTheme.TabWidgetPainter.ColSpacing; } + } + + public override Point TabControlImagePadding { + get { return ThemeElements.CurrentTheme.TabWidgetPainter.ImagePadding; } + } + + public override int TabWidgetscrollerWidth { + get {return ThemeElements.CurrentTheme.TabWidgetPainter.ScrollerWidth; } + } + + + public override Size TabControlGetSpacing (TabWidget tab) + { + try { + return ThemeElements.CurrentTheme.TabWidgetPainter.RowSpacing (tab); + } catch { + throw new Exception ("Invalid Appearance value: " + tab.Appearance); + } + } + #endregion + + public override void DrawTabControl (Graphics dc, Rectangle area, TabWidget tab) + { + ThemeElements.CurrentTheme.TabWidgetPainter.Draw (dc, area, tab); + } + + public override Rectangle TabControlGetDisplayRectangle (TabWidget tab) + { + return ThemeElements.CurrentTheme.TabWidgetPainter.GetDisplayRectangle (tab); + } + + public override Rectangle TabControlGetPanelRect (TabWidget tab) + { + return ThemeElements.CurrentTheme.TabWidgetPainter.GetTabPanelRect (tab); + } + + #endregion + + #region TextBox + public override void TextBoxBaseFillBackground (TextBoxBase textBoxBase, Graphics g, Rectangle clippingArea) + { + if (textBoxBase.backcolor_set || (textBoxBase.Enabled && !textBoxBase.read_only)) { + g.FillRectangle(ResPool.GetSolidBrush(textBoxBase.BackColor), clippingArea); + } else { + g.FillRectangle(ResPool.GetSolidBrush(ColorControl), clippingArea); + } + } + + public override bool TextBoxBaseHandleWmNcPaint (TextBoxBase textBoxBase, ref Message m) + { + return false; + } + + public override bool TextBoxBaseShouldPaintBackground (TextBoxBase textBoxBase) + { + return true; + } + #endregion + + /* FIXME: I don't ever remember porting over this. + #region ToolBar + public override void DrawToolBar (Graphics dc, Rectangle clip_rectangle, ToolBar control) + { + StringFormat format = new StringFormat (); + format.Trimming = StringTrimming.EllipsisCharacter; + format.LineAlignment = StringAlignment.Center; + if (control.ShowKeyboardCuesInternal) + format.HotkeyPrefix = HotkeyPrefix.Show; + else + format.HotkeyPrefix = HotkeyPrefix.Hide; + + if (control.TextAlign == ToolBarTextAlign.Underneath) + format.Alignment = StringAlignment.Center; + else + format.Alignment = StringAlignment.Near; + + if (control.Appearance != ToolBarAppearance.Flat || control.Parent == null) { + dc.FillRectangle (SystemBrushes.Control, clip_rectangle); + } + + if (control.Divider && clip_rectangle.Y < 2) { + if (clip_rectangle.Y < 1) { + dc.DrawLine (SystemPens.ControlDark, clip_rectangle.X, 0, clip_rectangle.Right, 0); + } + dc.DrawLine (SystemPens.ControlLightLight, clip_rectangle.X, 1, clip_rectangle.Right, 1); + } + + foreach (ToolBarItem item in control.items) + if (item.Button.Visible && clip_rectangle.IntersectsWith (item.Rectangle)) + DrawToolBarButton (dc, control, item, format); + + format.Dispose (); + } + + protected virtual void DrawToolBarButton (Graphics dc, ToolBar control, ToolBarItem item, StringFormat format) + { + bool is_flat = (control.Appearance == ToolBarAppearance.Flat); + + DrawToolBarButtonBorder (dc, item, is_flat); + + switch (item.Button.Style) { + case ToolBarButtonStyle.DropDownButton: + if (control.DropDownArrows) + DrawToolBarDropDownArrow (dc, item, is_flat); + DrawToolBarButtonContents (dc, control, item, format); + break; + + case ToolBarButtonStyle.Separator: + if (is_flat) + DrawToolBarSeparator (dc, item); + break; + + case ToolBarButtonStyle.ToggleButton: + DrawToolBarToggleButtonBackground (dc, item); + DrawToolBarButtonContents (dc, control, item, format); + break; + + default: + DrawToolBarButtonContents (dc, control, item, format); + break; + } + } + + const Border3DSide all_sides = Border3DSide.Left | Border3DSide.Top | Border3DSide.Right | Border3DSide.Bottom; + + protected virtual void DrawToolBarButtonBorder (Graphics dc, ToolBarItem item, bool is_flat) + { + if (item.Button.Style == ToolBarButtonStyle.Separator) + return; + + Border3DStyle style; + + if (is_flat) { + if (item.Button.Pushed || item.Pressed) + style = Border3DStyle.SunkenOuter; + else if (item.Hilight) + style = Border3DStyle.RaisedInner; + else + return; + + } else { + if (item.Button.Pushed || item.Pressed) + style = Border3DStyle.Sunken; + else + style = Border3DStyle.Raised; + } + + Rectangle rect = item.Rectangle; + if ((item.Button.Style == ToolBarButtonStyle.DropDownButton) && (item.Button.Parent.DropDownArrows) && is_flat) + rect.Width -= ToolBarDropDownWidth; + + CPDrawBorder3D (dc, rect, style, all_sides); + } + + protected virtual void DrawToolBarSeparator (Graphics dc, ToolBarItem item) + { + Rectangle area = item.Rectangle; + int offset = (int) SystemPens.Widget.Width + 1; + dc.DrawLine (SystemPens.ControlDark, area.X + 1, area.Y, area.X + 1, area.Bottom); + dc.DrawLine (SystemPens.ControlLight, area.X + offset, area.Y, area.X + offset, area.Bottom); + } + + protected virtual void DrawToolBarToggleButtonBackground (Graphics dc, ToolBarItem item) + { + Brush brush; + Rectangle area = item.Rectangle; + area.X += ToolBarImageGripWidth; + area.Y += ToolBarImageGripWidth; + area.Width -= 2 * ToolBarImageGripWidth; + area.Height -= 2 * ToolBarImageGripWidth; + + if (item.Button.Pushed) + brush = (Brush) ResPool.GetHatchBrush (HatchStyle.Percent50, ColorScrollBar, ColorControlLightLight); + else if (item.Button.PartialPush) + brush = SystemBrushes.ControlLight; + else + brush = SystemBrushes.Control; + + dc.FillRectangle (brush, area); + } + + protected virtual void DrawToolBarDropDownArrow (Graphics dc, ToolBarItem item, bool is_flat) + { + Rectangle rect = item.Rectangle; + rect.X = item.Rectangle.Right - ToolBarDropDownWidth; + rect.Width = ToolBarDropDownWidth; + + if (is_flat) { + if (item.DDPressed) + CPDrawBorder3D (dc, rect, Border3DStyle.SunkenOuter, all_sides); + else if (item.Button.Pushed || item.Pressed) + CPDrawBorder3D (dc, rect, Border3DStyle.SunkenOuter, all_sides); + else if (item.Hilight) + CPDrawBorder3D (dc, rect, Border3DStyle.RaisedInner, all_sides); + } else { + if (item.DDPressed) + CPDrawBorder3D (dc, rect, Border3DStyle.Flat, all_sides); + else if (item.Button.Pushed || item.Pressed) + CPDrawBorder3D (dc, Rectangle.Inflate(rect, -1, -1), Border3DStyle.SunkenOuter, all_sides); + else + CPDrawBorder3D (dc, rect, Border3DStyle.Raised, all_sides); + } + + PointF [] vertices = new PointF [3]; + PointF ddCenter = new PointF (rect.X + (rect.Width/2.0f), rect.Y + (rect.Height / 2)); + + // Increase vertical and horizontal position by 1 when button is pressed + if (item.Pressed || item.Button.Pushed || item.DDPressed) { + ddCenter.X += 1; + ddCenter.Y += 1; + } + + vertices [0].X = ddCenter.X - ToolBarDropDownArrowWidth / 2.0f + 0.5f; + vertices [0].Y = ddCenter.Y; + vertices [1].X = ddCenter.X + ToolBarDropDownArrowWidth / 2.0f + 0.5f; + vertices [1].Y = ddCenter.Y; + vertices [2].X = ddCenter.X + 0.5f; // 0.5 is added for adjustment + vertices [2].Y = ddCenter.Y + ToolBarDropDownArrowHeight; + dc.FillPolygon (SystemBrushes.ControlText, vertices); + } + + protected virtual void DrawToolBarButtonContents (Graphics dc, ToolBar control, ToolBarItem item, StringFormat format) + { + if (item.Button.Image != null) { + int x = item.ImageRectangle.X + ToolBarImageGripWidth; + int y = item.ImageRectangle.Y + ToolBarImageGripWidth; + + // Increase vertical and horizontal position by 1 when button is pressed + if (item.Pressed || item.Button.Pushed) { + x += 1; + y += 1; + } + + if (item.Button.Enabled) + dc.DrawImage (item.Button.Image, x, y); + else + CPDrawImageDisabled (dc, item.Button.Image, x, y, ColorControl); + } + + Rectangle text_rect = item.TextRectangle; + if (text_rect.Width <= 0 || text_rect.Height <= 0) + return; + + if (item.Pressed || item.Button.Pushed) { + text_rect.X += 1; + text_rect.Y += 1; + } + + if (item.Button.Enabled) + dc.DrawString (item.Button.Text, control.Font, SystemBrushes.ControlText, text_rect, format); + else + CPDrawStringDisabled (dc, item.Button.Text, control.Font, control.BackColor, text_rect, format); + } + + // Grip width for the ToolBar + public override int ToolBarGripWidth { + get { return 2;} + } + + // Grip width for the Image on the ToolBarButton + public override int ToolBarImageGripWidth { + get { return 2;} + } + + // width of the separator + public override int ToolBarSeparatorWidth { + get { return 4; } + } + + // width of the dropdown arrow rect + public override int ToolBarDropDownWidth { + get { return 13; } + } + + // width for the dropdown arrow on the ToolBarButton + public override int ToolBarDropDownArrowWidth { + get { return 5;} + } + + // height for the dropdown arrow on the ToolBarButton + public override int ToolBarDropDownArrowHeight { + get { return 3;} + } + + public override Size ToolBarDefaultSize { + get { + return new Size (100, 42); + } + } + + public override bool ToolBarHasHotElementStyles (ToolBar toolBar) + { + return toolBar.Appearance == ToolBarAppearance.Flat; + } + + public override bool ToolBarHasHotCheckedElementStyles { + get { + return false; + } + } + #endregion // ToolBar*/ + + #region ToolTip + public override void DrawToolTip(Graphics dc, Rectangle clip_rectangle, ToolTip.ToolTipWindow control) + { + ToolTipDrawBackground (dc, clip_rectangle, control); + + TextFormatFlags flags = TextFormatFlags.HidePrefix; + + Color foreground = control.ForeColor; + if (control.title.Length > 0) { + Font bold_font = new Font (control.Font, control.Font.Style | FontStyle.Bold); + TextRenderer.DrawTextInternal (dc, control.title, bold_font, control.title_rect, + foreground, flags, false); + bold_font.Dispose (); + } + + if (control.icon != null) + dc.DrawIcon (control.icon, control.icon_rect); + + TextRenderer.DrawTextInternal (dc, control.Text, control.Font, control.text_rect, foreground, flags, false); + } + + protected virtual void ToolTipDrawBackground (Graphics dc, Rectangle clip_rectangle, ToolTip.ToolTipWindow control) + { + Brush back_brush = ResPool.GetSolidBrush (control.BackColor); + dc.FillRectangle (back_brush, control.ClientRectangle); + dc.DrawRectangle (SystemPens.WindowFrame, 0, 0, control.Width - 1, control.Height - 1); + } + + public override Size ToolTipSize(ToolTip.ToolTipWindow tt, string text) + { + Size size = TextRenderer.MeasureTextInternal (text, tt.Font, false); + size.Width += 4; + size.Height += 3; + Rectangle text_rect = new Rectangle (Point.Empty, size); + text_rect.Inflate (-2, -1); + tt.text_rect = text_rect; + tt.icon_rect = tt.title_rect = Rectangle.Empty; + + Size title_size = Size.Empty; + if (tt.title.Length > 0) { + Font bold_font = new Font (tt.Font, tt.Font.Style | FontStyle.Bold); + title_size = TextRenderer.MeasureTextInternal (tt.title, bold_font, false); + bold_font.Dispose (); + } + + Size icon_size = Size.Empty; + if (tt.icon != null) + icon_size = new Size (size.Height, size.Height); + + if (icon_size != Size.Empty || title_size != Size.Empty) { + int padding = 8; + int top_area_width = 0; + int top_area_height = icon_size.Height > title_size.Height ? icon_size.Height : title_size.Height; + Size text_size = size; + Point location = new Point (padding, padding); + + if (icon_size != Size.Empty) { + tt.icon_rect = new Rectangle (location, icon_size); + top_area_width = icon_size.Width + padding; + } + + if (title_size != Size.Empty) { + Rectangle title_rect = new Rectangle (location, new Size (title_size.Width, top_area_height)); + if (icon_size != Size.Empty) + title_rect.X += icon_size.Width + padding; + + tt.title_rect = title_rect; + top_area_width += title_size.Width; + } + + tt.text_rect = new Rectangle (new Point (location.X, location.Y + top_area_height + padding), + text_size); + + size.Height += padding + top_area_height; + if (top_area_width > size.Width) + size.Width = top_area_width; + + // margins + size.Width += padding * 2; + size.Height += padding * 2; + } + + return size; + } + + public override bool ToolTipTransparentBackground { + get { + return false; + } + } + #endregion // ToolTip + + #region BalloonWindow + NotifyIcon.BalloonWindow balloon_window; + + public override void ShowBalloonWindow (IntPtr handle, int timeout, string title, string text, ToolTipIcon icon) + { + Widget control = Widget.FromHandle(handle); + + if (control == null) + return; + + if (balloon_window != null) { + balloon_window.Close (); + balloon_window.Dispose (); + } + + balloon_window = new NotifyIcon.BalloonWindow (handle); + balloon_window.Title = title; + balloon_window.Text = text; + balloon_window.Icon = icon; + balloon_window.Timeout = timeout; + balloon_window.Show (); + } + + public override void HideBalloonWindow (IntPtr handle) + { + if (balloon_window == null || balloon_window.OwnerHandle != handle) + return; + + balloon_window.Close (); + balloon_window.Dispose (); + balloon_window = null; + } + + private const int balloon_iconsize = 16; + private const int balloon_bordersize = 8; + + public override void DrawBalloonWindow (Graphics dc, Rectangle clip, NotifyIcon.BalloonWindow control) + { + Brush solidbrush = ResPool.GetSolidBrush (this.ColorInfoText); + Rectangle rect = control.ClientRectangle; + int iconsize = (control.Icon == ToolTipIcon.None) ? 0 : balloon_iconsize; + + // Rectangle borders and background. + dc.FillRectangle (ResPool.GetSolidBrush (ColorInfo), rect); + dc.DrawRectangle (ResPool.GetPen (ColorWindowFrame), 0, 0, rect.Width - 1, rect.Height - 1); + + // Icon + Image image; + switch (control.Icon) { + case ToolTipIcon.Info: { + image = ThemeEngine.Current.Images(UIIcon.MessageBoxInfo, balloon_iconsize); + break; + } + + case ToolTipIcon.Warning: { + image = ThemeEngine.Current.Images(UIIcon.MessageBoxError, balloon_iconsize); + break; + } + + case ToolTipIcon.Error: { + image = ThemeEngine.Current.Images(UIIcon.MessageBoxWarning, balloon_iconsize); + break; + } + + default: { + image = null; + break; + } + } + + if (control.Icon != ToolTipIcon.None) + dc.DrawImage (image, new Rectangle (balloon_bordersize, balloon_bordersize, iconsize, iconsize)); + + // Title + Rectangle titlerect = new Rectangle (rect.X + balloon_bordersize + iconsize + (iconsize > 0 ? balloon_bordersize : 0), + rect.Y + balloon_bordersize, + rect.Width - ((3 * balloon_bordersize) + iconsize), + rect.Height - (2 * balloon_bordersize)); + + Font titlefont = new Font (control.Font.FontFamily, control.Font.Size, control.Font.Style | FontStyle.Bold, control.Font.Unit); + dc.DrawString (control.Title, titlefont, solidbrush, titlerect, control.Format); + + // Text + Rectangle textrect = new Rectangle (rect.X + balloon_bordersize, + rect.Y + balloon_bordersize, + rect.Width - (2 * balloon_bordersize), + rect.Height - (2 * balloon_bordersize)); + + StringFormat textformat = control.Format; + textformat.LineAlignment = StringAlignment.Far; + dc.DrawString (control.Text, control.Font, solidbrush, textrect, textformat); + } + + public override Rectangle BalloonWindowRect (NotifyIcon.BalloonWindow control) + { + Rectangle deskrect = Screen.GetWorkingArea (control); + SizeF maxsize = new SizeF (250, 200); + + SizeF titlesize = TextRenderer.MeasureString (control.Title, control.Font, maxsize, control.Format); + SizeF textsize = TextRenderer.MeasureString (control.Text, control.Font, maxsize, control.Format); + + if (titlesize.Height < balloon_iconsize) + titlesize.Height = balloon_iconsize; + + Rectangle rect = new Rectangle (); + rect.Height = (int) (titlesize.Height + textsize.Height + (3 * balloon_bordersize)); + rect.Width = (int) ((titlesize.Width > textsize.Width) ? titlesize.Width : textsize.Width) + (2 * balloon_bordersize); + rect.X = deskrect.Width - rect.Width - 2; + rect.Y = deskrect.Height - rect.Height - 2; + + return rect; + } + #endregion // BalloonWindow + + #region TrackBar + public override int TrackBarValueFromMousePosition (int x, int y, TrackBar tb) + { + int result = tb.Value; + int value_pos = tb.Value; + float pixels_betweenticks; + Rectangle thumb_pos = Rectangle.Empty, thumb_area = Rectangle.Empty; + Point channel_startpoint = Point.Empty, na_point = Point.Empty; + + GetTrackBarDrawingInfo (tb, out pixels_betweenticks, out thumb_area, out thumb_pos, out channel_startpoint, out na_point, out na_point); + + /* Convert thumb position from mouse position to value*/ + if (tb.Orientation == Orientation.Vertical) { + value_pos = (int)Math.Round (((thumb_area.Bottom - y - (float)thumb_pos.Height / 2) / (float)pixels_betweenticks), 0); + + if (value_pos + tb.Minimum > tb.Maximum) + value_pos = tb.Maximum - tb.Minimum; + else if (value_pos + tb.Minimum < tb.Minimum) + value_pos = 0; + + result = value_pos + tb.Minimum; + } else { + value_pos = (int)Math.Round (((x - channel_startpoint.X - (float)thumb_pos.Width / 2) / (float) pixels_betweenticks), 0); + + if (value_pos + tb.Minimum > tb.Maximum) + value_pos = tb.Maximum - tb.Minimum; + else if (value_pos + tb.Minimum < tb.Minimum) + value_pos = 0; + + result = value_pos + tb.Minimum; + } + + return result; + } + + private void GetTrackBarDrawingInfo (TrackBar tb, out float pixels_betweenticks, out Rectangle thumb_area, out Rectangle thumb_pos, out Point channel_startpoint, out Point bottomtick_startpoint, out Point toptick_startpoint) + { + thumb_area = Rectangle.Empty; + thumb_pos = Rectangle.Empty; + + if (tb.Orientation == Orientation.Vertical) { + toptick_startpoint = new Point (); + bottomtick_startpoint = new Point (); + channel_startpoint = new Point (); + float pixel_len; + const int space_from_right = 8; + const int space_from_left = 8; + const int space_from_bottom = 11; + Rectangle area = tb.ClientRectangle; + + switch (tb.TickStyle) { + case TickStyle.BottomRight: + case TickStyle.None: + channel_startpoint.Y = 8; + channel_startpoint.X = 9; + bottomtick_startpoint.Y = 13; + bottomtick_startpoint.X = 24; + break; + case TickStyle.TopLeft: + channel_startpoint.Y = 8; + channel_startpoint.X = 19; + toptick_startpoint.Y = 13; + toptick_startpoint.X = 8; + break; + case TickStyle.Both: + channel_startpoint.Y = 8; + channel_startpoint.X = 18; + bottomtick_startpoint.Y = 13; + bottomtick_startpoint.X = 32; + toptick_startpoint.Y = 13; + toptick_startpoint.X = 8; + break; + default: + break; + } + + thumb_area.X = area.X + channel_startpoint.X; + thumb_area.Y = area.Y + channel_startpoint.Y; + thumb_area.Height = area.Height - space_from_right - space_from_left; + thumb_area.Width = TrackBarVerticalTrackWidth; + + pixel_len = thumb_area.Height - 11; + if (tb.Maximum == tb.Minimum) { + pixels_betweenticks = 0; + } else { + pixels_betweenticks = pixel_len / (tb.Maximum - tb.Minimum); + } + + thumb_pos.Y = thumb_area.Bottom - space_from_bottom - (int)(pixels_betweenticks * (float)(tb.Value - tb.Minimum)); + } else { + toptick_startpoint = new Point (); + bottomtick_startpoint = new Point (); + channel_startpoint = new Point (); + float pixel_len; + const int space_from_right = 8; + const int space_from_left = 8; + Rectangle area = tb.ClientRectangle; + + switch (tb.TickStyle) { + case TickStyle.BottomRight: + case TickStyle.None: + channel_startpoint.X = 8; + channel_startpoint.Y = 9; + bottomtick_startpoint.X = 13; + bottomtick_startpoint.Y = 24; + break; + case TickStyle.TopLeft: + channel_startpoint.X = 8; + channel_startpoint.Y = 19; + toptick_startpoint.X = 13; + toptick_startpoint.Y = 8; + break; + case TickStyle.Both: + channel_startpoint.X = 8; + channel_startpoint.Y = 18; + bottomtick_startpoint.X = 13; + bottomtick_startpoint.Y = 32; + toptick_startpoint.X = 13; + toptick_startpoint.Y = 8; + break; + default: + break; + } + + thumb_area.X = area.X + channel_startpoint.X; + thumb_area.Y = area.Y + channel_startpoint.Y; + thumb_area.Width = area.Width - space_from_right - space_from_left; + thumb_area.Height = TrackBarHorizontalTrackHeight; + + pixel_len = thumb_area.Width - 11; + if (tb.Maximum == tb.Minimum) { + pixels_betweenticks = 0; + } else { + pixels_betweenticks = pixel_len / (tb.Maximum - tb.Minimum); + } + + thumb_pos.X = channel_startpoint.X + (int)(pixels_betweenticks * (float) (tb.Value - tb.Minimum)); + } + + thumb_pos.Size = TrackBarGetThumbSize (tb); + } + + protected virtual Size TrackBarGetThumbSize (TrackBar trackBar) + { + return TrackBarGetThumbSize (); + } + + public static Size TrackBarGetThumbSize () + { + /* Draw thumb fixed 10x22 size */ + return new Size (10, 22); + } + + public const int TrackBarVerticalTrackWidth = 4; + + public const int TrackBarHorizontalTrackHeight = 4; + + #region Ticks + protected interface ITrackBarTickPainter + { + void Paint (float x1, float y1, float x2, float y2); + } + + class TrackBarTickPainter : ITrackBarTickPainter + { + readonly Graphics g; + readonly Pen pen; + public TrackBarTickPainter (Graphics g, Pen pen) + { + this.g = g; + this.pen = pen; + } + public void Paint (float x1, float y1, float x2, float y2) + { + g.DrawLine (pen, x1, y1, x2, y2); + } + } + protected virtual ITrackBarTickPainter GetTrackBarTickPainter (Graphics g) + { + return new TrackBarTickPainter (g, ResPool.GetPen (pen_ticks_color)); + } + #endregion + + #region DrawTrackBar_Vertical + private void DrawTrackBar_Vertical (Graphics dc, Rectangle clip_rectangle, TrackBar tb, + ref Rectangle thumb_pos, ref Rectangle thumb_area, Brush br_thumb, + float ticks, int value_pos, bool mouse_value) { + + Point toptick_startpoint = new Point (); + Point bottomtick_startpoint = new Point (); + Point channel_startpoint = new Point (); + float pixel_len; + float pixels_betweenticks; + Rectangle area = tb.ClientRectangle; + + GetTrackBarDrawingInfo (tb, out pixels_betweenticks, out thumb_area, out thumb_pos, out channel_startpoint, out bottomtick_startpoint, out toptick_startpoint); + + #region Track + TrackBarDrawVerticalTrack (dc, thumb_area, channel_startpoint, clip_rectangle); + #endregion + + #region Thumb + switch (tb.TickStyle) { + case TickStyle.BottomRight: + case TickStyle.None: + thumb_pos.X = channel_startpoint.X - 8; + TrackBarDrawVerticalThumbRight (dc, thumb_pos, br_thumb, clip_rectangle, tb); + break; + case TickStyle.TopLeft: + thumb_pos.X = channel_startpoint.X - 10; + TrackBarDrawVerticalThumbLeft (dc, thumb_pos, br_thumb, clip_rectangle, tb); + break; + default: + thumb_pos.X = area.X + 10; + TrackBarDrawVerticalThumb (dc, thumb_pos, br_thumb, clip_rectangle, tb); + break; + } + #endregion + + pixel_len = thumb_area.Height - 11; + pixels_betweenticks = pixel_len / ticks; + + thumb_area.X = thumb_pos.X; + thumb_area.Y = channel_startpoint.Y; + thumb_area.Width = thumb_pos.Height; + + #region Ticks + if (pixels_betweenticks <= 0) + return; + if (tb.TickStyle == TickStyle.None) + return; + Region outside = new Region (area); + outside.Exclude (thumb_area); + + if (outside.IsVisible (clip_rectangle)) { + ITrackBarTickPainter tick_painter = TrackBarGetVerticalTickPainter (dc); + + if ((tb.TickStyle & TickStyle.BottomRight) == TickStyle.BottomRight) { + float x = area.X + bottomtick_startpoint.X; + for (float inc = 0; inc < pixel_len + 1; inc += pixels_betweenticks) { + float y = area.Y + bottomtick_startpoint.Y + inc; + tick_painter.Paint ( + x, y, + x + (inc == 0 || inc + pixels_betweenticks >= pixel_len + 1 ? 3 : 2), y); + } + } + + if ((tb.TickStyle & TickStyle.TopLeft) == TickStyle.TopLeft) { + float x = area.X + toptick_startpoint.X; + for (float inc = 0; inc < (pixel_len + 1); inc += pixels_betweenticks) { + float y = area.Y + toptick_startpoint.Y + inc; + tick_painter.Paint ( + x - (inc == 0 || inc + pixels_betweenticks >= pixel_len + 1 ? 3 : 2), y, + x, y); + } + } + } + + outside.Dispose (); + #endregion + } + + #region Track + protected virtual void TrackBarDrawVerticalTrack (Graphics dc, Rectangle thumb_area, Point channel_startpoint, Rectangle clippingArea) + { + dc.FillRectangle (SystemBrushes.ControlDark, channel_startpoint.X, channel_startpoint.Y, + 1, thumb_area.Height); + + dc.FillRectangle (SystemBrushes.ControlDarkDark, channel_startpoint.X + 1, channel_startpoint.Y, + 1, thumb_area.Height); + + dc.FillRectangle (SystemBrushes.ControlLight, channel_startpoint.X + 3, channel_startpoint.Y, + 1, thumb_area.Height); + } + #endregion + + #region Thumb + protected virtual void TrackBarDrawVerticalThumbRight (Graphics dc, Rectangle thumb_pos, Brush br_thumb, Rectangle clippingArea, TrackBar trackBar) + { + Pen pen = SystemPens.ControlLightLight; + dc.DrawLine (pen, thumb_pos.X, thumb_pos.Y, thumb_pos.X, thumb_pos.Y + 10); + dc.DrawLine (pen, thumb_pos.X, thumb_pos.Y, thumb_pos.X + 16, thumb_pos.Y); + dc.DrawLine (pen, thumb_pos.X + 16, thumb_pos.Y, thumb_pos.X + 16 + 4, thumb_pos.Y + 4); + + pen = SystemPens.ControlDark; + dc.DrawLine (pen, thumb_pos.X + 1, thumb_pos.Y + 9, thumb_pos.X + 15, thumb_pos.Y + 9); + dc.DrawLine (pen, thumb_pos.X + 16, thumb_pos.Y + 9, thumb_pos.X + 16 + 4, thumb_pos.Y + 9 - 4); + + pen = SystemPens.ControlDarkDark; + dc.DrawLine (pen, thumb_pos.X, thumb_pos.Y + 10, thumb_pos.X + 16, thumb_pos.Y + 10); + dc.DrawLine (pen, thumb_pos.X + 16, thumb_pos.Y + 10, thumb_pos.X + 16 + 5, thumb_pos.Y + 10 - 5); + + dc.FillRectangle (br_thumb, thumb_pos.X + 1, thumb_pos.Y + 1, 16, 8); + dc.FillRectangle (br_thumb, thumb_pos.X + 17, thumb_pos.Y + 2, 1, 6); + dc.FillRectangle (br_thumb, thumb_pos.X + 18, thumb_pos.Y + 3, 1, 4); + dc.FillRectangle (br_thumb, thumb_pos.X + 19, thumb_pos.Y + 4, 1, 2); + } + + protected virtual void TrackBarDrawVerticalThumbLeft (Graphics dc, Rectangle thumb_pos, Brush br_thumb, Rectangle clippingArea, TrackBar trackBar) + { + Pen pen = SystemPens.ControlLightLight; + dc.DrawLine (pen, thumb_pos.X + 4, thumb_pos.Y, thumb_pos.X + 4 + 16, thumb_pos.Y); + dc.DrawLine (pen, thumb_pos.X + 4, thumb_pos.Y, thumb_pos.X, thumb_pos.Y + 4); + + pen = SystemPens.ControlDark; + dc.DrawLine (pen, thumb_pos.X + 4, thumb_pos.Y + 9, thumb_pos.X + 4 + 16, thumb_pos.Y + 9); + dc.DrawLine (pen, thumb_pos.X + 4, thumb_pos.Y + 9, thumb_pos.X, thumb_pos.Y + 5); + dc.DrawLine (pen, thumb_pos.X + 19, thumb_pos.Y + 9, thumb_pos.X + 19, thumb_pos.Y + 1); + + pen = SystemPens.ControlDarkDark; + dc.DrawLine (pen, thumb_pos.X + 4, thumb_pos.Y + 10, thumb_pos.X + 4 + 16, thumb_pos.Y + 10); + dc.DrawLine (pen, thumb_pos.X + 4, thumb_pos.Y + 10, thumb_pos.X - 1, thumb_pos.Y + 5); + dc.DrawLine (pen, thumb_pos.X + 20, thumb_pos.Y, thumb_pos.X + 20, thumb_pos.Y + 10); + + dc.FillRectangle (br_thumb, thumb_pos.X + 4, thumb_pos.Y + 1, 15, 8); + dc.FillRectangle (br_thumb, thumb_pos.X + 3, thumb_pos.Y + 2, 1, 6); + dc.FillRectangle (br_thumb, thumb_pos.X + 2, thumb_pos.Y + 3, 1, 4); + dc.FillRectangle (br_thumb, thumb_pos.X + 1, thumb_pos.Y + 4, 1, 2); + } + + protected virtual void TrackBarDrawVerticalThumb (Graphics dc, Rectangle thumb_pos, Brush br_thumb, Rectangle clippingArea, TrackBar trackBar) + { + Pen pen = SystemPens.ControlLightLight; + dc.DrawLine (pen, thumb_pos.X, thumb_pos.Y, thumb_pos.X, thumb_pos.Y + 9); + dc.DrawLine (pen, thumb_pos.X, thumb_pos.Y, thumb_pos.X + 19, thumb_pos.Y); + + pen = SystemPens.ControlDark; + dc.DrawLine (pen, thumb_pos.X + 1, thumb_pos.Y + 9, thumb_pos.X + 19, thumb_pos.Y + 9); + dc.DrawLine (pen, thumb_pos.X + 10, thumb_pos.Y + 1, thumb_pos.X + 19, thumb_pos.Y + 8); + + pen = SystemPens.ControlDarkDark; + dc.DrawLine (pen, thumb_pos.X, thumb_pos.Y + 10, thumb_pos.X + 20, thumb_pos.Y + 10); + dc.DrawLine (pen, thumb_pos.X + 20, thumb_pos.Y, thumb_pos.X + 20, thumb_pos.Y + 9); + + dc.FillRectangle (br_thumb, thumb_pos.X + 1, thumb_pos.Y + 1, 18, 8); + } + #endregion + + #region Ticks + protected virtual ITrackBarTickPainter TrackBarGetVerticalTickPainter (Graphics g) + { + return GetTrackBarTickPainter (g); + } + #endregion + #endregion + + #region DrawTrackBar_Horizontal + /* + Horizontal trackbar + + Does not matter the size of the control, Win32 always draws: + - Ticks starting from pixel 13, 8 + - Channel starting at pos 8, 19 and ends at Width - 8 + - Autosize makes always the control 45 pixels high + - Ticks are draw at (channel.Witdh - 10) / (Maximum - Minimum) + + */ + private void DrawTrackBar_Horizontal (Graphics dc, Rectangle clip_rectangle, TrackBar tb, + ref Rectangle thumb_pos, ref Rectangle thumb_area, Brush br_thumb, + float ticks, int value_pos, bool mouse_value) { + Point toptick_startpoint = new Point (); + Point bottomtick_startpoint = new Point (); + Point channel_startpoint = new Point (); + float pixel_len; + float pixels_betweenticks; + Rectangle area = tb.ClientRectangle; + + GetTrackBarDrawingInfo (tb , out pixels_betweenticks, out thumb_area, out thumb_pos, out channel_startpoint, out bottomtick_startpoint, out toptick_startpoint); + + #region Track + TrackBarDrawHorizontalTrack (dc, thumb_area, channel_startpoint, clip_rectangle); + #endregion + + #region Thumb + switch (tb.TickStyle) { + case TickStyle.BottomRight: + case TickStyle.None: + thumb_pos.Y = channel_startpoint.Y - 8; + TrackBarDrawHorizontalThumbBottom (dc, thumb_pos, br_thumb, clip_rectangle, tb); + break; + case TickStyle.TopLeft: + thumb_pos.Y = channel_startpoint.Y - 10; + TrackBarDrawHorizontalThumbTop (dc, thumb_pos, br_thumb, clip_rectangle, tb); + break; + default: + thumb_pos.Y = area.Y + 10; + TrackBarDrawHorizontalThumb (dc, thumb_pos, br_thumb, clip_rectangle, tb); + break; + } + #endregion + + pixel_len = thumb_area.Width - 11; + pixels_betweenticks = pixel_len / ticks; + + thumb_area.Y = thumb_pos.Y; + thumb_area.X = channel_startpoint.X; + thumb_area.Height = thumb_pos.Height; + #region Ticks + if (pixels_betweenticks <= 0) + return; + if (tb.TickStyle == TickStyle.None) + return; + Region outside = new Region (area); + outside.Exclude (thumb_area); + + if (outside.IsVisible (clip_rectangle)) { + ITrackBarTickPainter tick_painter = TrackBarGetHorizontalTickPainter (dc); + + if ((tb.TickStyle & TickStyle.BottomRight) == TickStyle.BottomRight) { + float y = area.Y + bottomtick_startpoint.Y; + for (float inc = 0; inc < pixel_len + 1; inc += pixels_betweenticks) { + float x = area.X + bottomtick_startpoint.X + inc; + tick_painter.Paint ( + x, y, + x, y + (inc == 0 || inc + pixels_betweenticks >= pixel_len + 1 ? 3 : 2)); + } + } + + if ((tb.TickStyle & TickStyle.TopLeft) == TickStyle.TopLeft) { + float y = area.Y + toptick_startpoint.Y; + for (float inc = 0; inc < pixel_len + 1; inc += pixels_betweenticks) { + float x = area.X + toptick_startpoint.X + inc; + tick_painter.Paint ( + x, y - (inc == 0 || (inc + pixels_betweenticks) >= pixel_len + 1 ? 3 : 2), + x, y); + } + } + } + + outside.Dispose (); + #endregion + } + + #region Track + protected virtual void TrackBarDrawHorizontalTrack (Graphics dc, Rectangle thumb_area, Point channel_startpoint, Rectangle clippingArea) + { + dc.FillRectangle (SystemBrushes.ControlDark, channel_startpoint.X, channel_startpoint.Y, + thumb_area.Width, 1); + + dc.FillRectangle (SystemBrushes.ControlDarkDark, channel_startpoint.X, channel_startpoint.Y + 1, + thumb_area.Width, 1); + + dc.FillRectangle (SystemBrushes.ControlLight, channel_startpoint.X, channel_startpoint.Y + 3, + thumb_area.Width, 1); + } + #endregion + + #region Thumb + protected virtual void TrackBarDrawHorizontalThumbBottom (Graphics dc, Rectangle thumb_pos, Brush br_thumb, Rectangle clippingArea, TrackBar trackBar) + { + Pen pen = SystemPens.ControlLightLight; + dc.DrawLine (pen, thumb_pos.X, thumb_pos.Y, thumb_pos.X + 10, thumb_pos.Y); + dc.DrawLine (pen, thumb_pos.X, thumb_pos.Y, thumb_pos.X, thumb_pos.Y + 16); + dc.DrawLine (pen, thumb_pos.X, thumb_pos.Y + 16, thumb_pos.X + 4, thumb_pos.Y + 16 + 4); + + pen = SystemPens.ControlDark; + dc.DrawLine (pen, thumb_pos.X + 9, thumb_pos.Y + 1, thumb_pos.X + 9, thumb_pos.Y + 15); + dc.DrawLine (pen, thumb_pos.X + 9, thumb_pos.Y + 16, thumb_pos.X + 9 - 4, thumb_pos.Y + 16 + 4); + + pen = SystemPens.ControlDarkDark; + dc.DrawLine (pen, thumb_pos.X + 10, thumb_pos.Y, thumb_pos.X + 10, thumb_pos.Y + 16); + dc.DrawLine (pen, thumb_pos.X + 10, thumb_pos.Y + 16, thumb_pos.X + 10 - 5, thumb_pos.Y + 16 + 5); + + dc.FillRectangle (br_thumb, thumb_pos.X + 1, thumb_pos.Y + 1, 8, 16); + dc.FillRectangle (br_thumb, thumb_pos.X + 2, thumb_pos.Y + 17, 6, 1); + dc.FillRectangle (br_thumb, thumb_pos.X + 3, thumb_pos.Y + 18, 4, 1); + dc.FillRectangle (br_thumb, thumb_pos.X + 4, thumb_pos.Y + 19, 2, 1); + } + + protected virtual void TrackBarDrawHorizontalThumbTop (Graphics dc, Rectangle thumb_pos, Brush br_thumb, Rectangle clippingArea, TrackBar trackBar) + { + Pen pen = SystemPens.ControlLightLight; + dc.DrawLine (pen, thumb_pos.X, thumb_pos.Y + 4, thumb_pos.X, thumb_pos.Y + 4 + 16); + dc.DrawLine (pen, thumb_pos.X, thumb_pos.Y + 4, thumb_pos.X + 4, thumb_pos.Y); + + pen = SystemPens.ControlDark; + dc.DrawLine (pen, thumb_pos.X + 9, thumb_pos.Y + 4, thumb_pos.X + 9, thumb_pos.Y + 4 + 16); + dc.DrawLine (pen, thumb_pos.X + 9, thumb_pos.Y + 4, thumb_pos.X + 5, thumb_pos.Y); + dc.DrawLine (pen, thumb_pos.X + 9, thumb_pos.Y + 19, thumb_pos.X + 1, thumb_pos.Y + 19); + + pen = SystemPens.ControlDarkDark; + dc.DrawLine (pen, thumb_pos.X + 10, thumb_pos.Y + 4, thumb_pos.X + 10, thumb_pos.Y + 4 + 16); + dc.DrawLine (pen, thumb_pos.X + 10, thumb_pos.Y + 4, thumb_pos.X + 5, thumb_pos.Y - 1); + dc.DrawLine (pen, thumb_pos.X, thumb_pos.Y + 20, thumb_pos.X + 10, thumb_pos.Y + 20); + + dc.FillRectangle (br_thumb, thumb_pos.X + 1, thumb_pos.Y + 4, 8, 15); + dc.FillRectangle (br_thumb, thumb_pos.X + 2, thumb_pos.Y + 3, 6, 1); + dc.FillRectangle (br_thumb, thumb_pos.X + 3, thumb_pos.Y + 2, 4, 1); + dc.FillRectangle (br_thumb, thumb_pos.X + 4, thumb_pos.Y + 1, 2, 1); + } + + protected virtual void TrackBarDrawHorizontalThumb (Graphics dc, Rectangle thumb_pos, Brush br_thumb, Rectangle clippingArea, TrackBar trackBar) + { + Pen pen = SystemPens.ControlLightLight; + dc.DrawLine (pen, thumb_pos.X, thumb_pos.Y, thumb_pos.X + 9, thumb_pos.Y); + dc.DrawLine (pen, thumb_pos.X, thumb_pos.Y, thumb_pos.X, thumb_pos.Y + 19); + + pen = SystemPens.ControlDark; + dc.DrawLine (pen, thumb_pos.X + 9, thumb_pos.Y + 1, thumb_pos.X + 9, thumb_pos.Y + 19); + dc.DrawLine (pen, thumb_pos.X + 1, thumb_pos.Y + 10, thumb_pos.X + 8, thumb_pos.Y + 19); + + pen = SystemPens.ControlDarkDark; + dc.DrawLine (pen, thumb_pos.X + 10, thumb_pos.Y, thumb_pos.X + 10, thumb_pos.Y + 20); + dc.DrawLine (pen, thumb_pos.X, thumb_pos.Y + 20, thumb_pos.X + 9, thumb_pos.Y + 20); + + dc.FillRectangle (br_thumb, thumb_pos.X + 1, thumb_pos.Y + 1, 8, 18); + } + #endregion + + #region Ticks + protected virtual ITrackBarTickPainter TrackBarGetHorizontalTickPainter (Graphics g) + { + return GetTrackBarTickPainter (g); + } + #endregion + #endregion + + public override void DrawTrackBar (Graphics dc, Rectangle clip_rectangle, TrackBar tb) + { + Brush br_thumb; + int value_pos; + bool mouse_value; + float ticks = (tb.Maximum - tb.Minimum) / tb.tickFrequency; /* N of ticks draw*/ + Rectangle area; + Rectangle thumb_pos = tb.ThumbPos; + Rectangle thumb_area = tb.ThumbArea; + + if (tb.thumb_pressed) { + value_pos = tb.thumb_mouseclick; + mouse_value = true; + } else { + value_pos = tb.Value - tb.Minimum; + mouse_value = false; + } + + area = tb.ClientRectangle; + + if (!tb.Enabled) { + br_thumb = (Brush) ResPool.GetHatchBrush (HatchStyle.Percent50, ColorControlLightLight, ColorControlLight); + } else if (tb.thumb_pressed == true) { + br_thumb = (Brush) ResPool.GetHatchBrush (HatchStyle.Percent50, ColorControlLight, ColorControl); + } else { + br_thumb = SystemBrushes.Control; + } + + + /* Widget Background */ + if (tb.BackColor.ToArgb () == DefaultControlBackColor.ToArgb ()) { + dc.FillRectangle (SystemBrushes.Control, clip_rectangle); + } else { + dc.FillRectangle (ResPool.GetSolidBrush (tb.BackColor), clip_rectangle); + } + + if (tb.Focused) { + CPDrawFocusRectangle(dc, area, tb.ForeColor, tb.BackColor); + } + + if (tb.Orientation == Orientation.Vertical) { + DrawTrackBar_Vertical (dc, clip_rectangle, tb, ref thumb_pos, ref thumb_area, + br_thumb, ticks, value_pos, mouse_value); + + } else { + DrawTrackBar_Horizontal (dc, clip_rectangle, tb, ref thumb_pos, ref thumb_area, + br_thumb, ticks, value_pos, mouse_value); + } + + tb.ThumbPos = thumb_pos; + tb.ThumbArea = thumb_area; + } + + public override Size TrackBarDefaultSize { + get { + return new Size (104, 42); + } + } + + public override bool TrackBarHasHotThumbStyle { + get { + return false; + } + } + #endregion // TrackBar + + #region UpDownBase + public override void UpDownBaseDrawButton (Graphics g, Rectangle bounds, bool top, VisualStyles.PushButtonState state) + { + WidgetPaint.DrawScrollButton (g, bounds, top ? ScrollButton.Up : ScrollButton.Down, state == VisualStyles.PushButtonState.Pressed ? ButtonState.Pushed : ButtonState.Normal); + } + + public override bool UpDownBaseHasHotButtonStyle { + get { + return false; + } + } + #endregion + + #region VScrollBar + public override Size VScrollBarDefaultSize { + get { + return new Size (this.ScrollBarButtonSize, 80); + } + } + #endregion // VScrollBar + + #region TreeView + public override Size TreeViewDefaultSize { + get { + return new Size (121, 97); + } + } + + public override void TreeViewDrawNodePlusMinus (TreeView treeView, TreeNode node, Graphics dc, int x, int middle) + { + int height = treeView.ActualItemHeight - 2; + dc.FillRectangle (ResPool.GetSolidBrush (treeView.BackColor), (x + 4) - (height / 2), node.GetY() + 1, height, height); + + dc.DrawRectangle (SystemPens.ControlDarkDark, x, middle - 4, 8, 8); + + if (node.IsExpanded) { + dc.DrawLine (SystemPens.ControlDarkDark, x + 2, middle, x + 6, middle); + } else { + dc.DrawLine (SystemPens.ControlDarkDark, x + 2, middle, x + 6, middle); + dc.DrawLine (SystemPens.ControlDarkDark, x + 4, middle - 2, x + 4, middle + 2); + } + } + #endregion + + #region Managed window + public override int ManagedWindowTitleBarHeight (InternalWindowManager wm) + { + if (wm.IsToolWindow && !wm.IsMinimized) + return SystemInformation.ToolWindowCaptionHeight; + if (wm.Form.FormBorderStyle == FormBorderStyle.None) + return 0; + return SystemInformation.CaptionHeight; + } + + public override int ManagedWindowBorderWidth (InternalWindowManager wm) + { + if ((wm.IsToolWindow && wm.form.FormBorderStyle == FormBorderStyle.FixedToolWindow) || + wm.IsMinimized) + return 3; + else + return 4; + } + + public override int ManagedWindowIconWidth (InternalWindowManager wm) + { + return ManagedWindowTitleBarHeight (wm) - 5; + } + + public override void ManagedWindowSetButtonLocations (InternalWindowManager wm) + { + TitleButtons buttons = wm.TitleButtons; + Form form = wm.form; + + buttons.HelpButton.Visible = form.HelpButton; + + foreach (TitleButton button in buttons) { + button.Visible = false; + } + + switch (form.FormBorderStyle) { + case FormBorderStyle.None: + if (form.WindowState != FormWindowState.Normal) + goto case FormBorderStyle.Sizable; + break; + case FormBorderStyle.FixedToolWindow: + case FormBorderStyle.SizableToolWindow: + buttons.CloseButton.Visible = true; + if (form.WindowState != FormWindowState.Normal) + goto case FormBorderStyle.Sizable; + break; + case FormBorderStyle.FixedSingle: + case FormBorderStyle.Fixed3D: + case FormBorderStyle.FixedDialog: + case FormBorderStyle.Sizable: + switch (form.WindowState) { + case FormWindowState.Normal: + buttons.MinimizeButton.Visible = true; + buttons.MaximizeButton.Visible = true; + buttons.RestoreButton.Visible = false; + break; + case FormWindowState.Maximized: + buttons.MinimizeButton.Visible = true; + buttons.MaximizeButton.Visible = false; + buttons.RestoreButton.Visible = true; + break; + case FormWindowState.Minimized: + buttons.MinimizeButton.Visible = false; + buttons.MaximizeButton.Visible = true; + buttons.RestoreButton.Visible = true; + break; + } + buttons.CloseButton.Visible = true; + break; + } + + // Respect MinimizeBox/MaximizeBox + if (form.MinimizeBox == false && form.MaximizeBox == false) { + buttons.MinimizeButton.Visible = false; + buttons.MaximizeButton.Visible = false; + } else if (form.MinimizeBox == false) + buttons.MinimizeButton.State = ButtonState.Inactive; + else if (form.MaximizeBox == false) + buttons.MaximizeButton.State = ButtonState.Inactive; + + int bw = ManagedWindowBorderWidth (wm); + Size btsize = ManagedWindowButtonSize (wm); + int btw = btsize.Width; + int bth = btsize.Height; + int top = bw + 2; + int left = form.Width - bw - btw - ManagedWindowSpacingAfterLastTitleButton; + + if ((!wm.IsToolWindow || wm.IsMinimized) && wm.HasBorders) { + buttons.CloseButton.Rectangle = new Rectangle (left, top, btw, bth); + left -= 2 + btw; + + if (buttons.MaximizeButton.Visible) { + buttons.MaximizeButton.Rectangle = new Rectangle (left, top, btw, bth); + left -= 2 + btw; + } + if (buttons.RestoreButton.Visible) { + buttons.RestoreButton.Rectangle = new Rectangle (left, top, btw, bth); + left -= 2 + btw; + } + + buttons.MinimizeButton.Rectangle = new Rectangle (left, top, btw, bth); + left -= 2 + btw; + } else if (wm.IsToolWindow) { + buttons.CloseButton.Rectangle = new Rectangle (left, top, btw, bth); + left -= 2 + btw; + } + } + + protected virtual Rectangle ManagedWindowDrawTitleBarAndBorders (Graphics dc, Rectangle clip, InternalWindowManager wm) + { + Form form = wm.Form; + int tbheight = ManagedWindowTitleBarHeight (wm); + int bdwidth = ManagedWindowBorderWidth (wm); + Color titlebar_color = Color.FromArgb (255, 10, 36, 106); + Color titlebar_color2 = Color.FromArgb (255, 166, 202, 240); + Color color = ThemeEngine.Current.ColorControlDark; + Color color2 = Color.FromArgb (255, 192, 192, 192); + + Pen pen = ResPool.GetPen (ColorControl); + Rectangle borders = new Rectangle (0, 0, form.Width, form.Height); + WidgetPaint.DrawBorder3D (dc, borders, Border3DStyle.Raised); + // The 3d border is only 2 pixels wide, so we draw the innermost pixels ourselves + borders = new Rectangle (2, 2, form.Width - 5, form.Height - 5); + for (int i = 2; i < bdwidth; i++) { + dc.DrawRectangle (pen, borders); + borders.Inflate (-1, -1); + } + + + bool draw_titlebar_enabled = false; + if (wm.Form.Parent != null && wm.Form.Parent is Form) { + draw_titlebar_enabled = false; + } else if (wm.IsActive && !wm.IsMaximized) { + draw_titlebar_enabled = true; + } + if (draw_titlebar_enabled) { + color = titlebar_color; + color2 = titlebar_color2; + } + + Rectangle tb = new Rectangle (bdwidth, bdwidth, form.Width - (bdwidth * 2), tbheight - 1); + + // HACK: For now always draw the titlebar until we get updates better + if (tb.Width > 0 && tb.Height > 0) { + using (System.Drawing.Drawing2D.LinearGradientBrush gradient = new LinearGradientBrush (tb, color, color2, LinearGradientMode.Horizontal)) + { + dc.FillRectangle (gradient, tb); + } + } + + if (!wm.IsMinimized) + // Draw the line just beneath the title bar + dc.DrawLine (ResPool.GetPen (SystemColors.Control), bdwidth, + tbheight + bdwidth - 1, form.Width - bdwidth - 1, + tbheight + bdwidth - 1); + return tb; + } + + public override void DrawManagedWindowDecorations (Graphics dc, Rectangle clip, InternalWindowManager wm) + { +#if debug + Console.WriteLine (DateTime.Now.ToLongTimeString () + " DrawManagedWindowDecorations"); + dc.FillRectangle (Brushes.Black, clip); +#endif + Rectangle tb = ManagedWindowDrawTitleBarAndBorders (dc, clip, wm); + + Form form = wm.Form; + if (wm.ShowIcon) { + Rectangle icon = ManagedWindowGetTitleBarIconArea (wm); + if (icon.IntersectsWith (clip)) + dc.DrawIcon (form.Icon, icon); + const int SpacingBetweenIconAndCaption = 2; + tb.Width -= icon.Right + SpacingBetweenIconAndCaption - tb.X ; + tb.X = icon.Right + SpacingBetweenIconAndCaption; + } + + foreach (TitleButton button in wm.TitleButtons.AllButtons) { + tb.Width -= Math.Max (0, tb.Right - DrawTitleButton (dc, button, clip, form)); + } + const int SpacingBetweenCaptionAndLeftMostButton = 3; + tb.Width -= SpacingBetweenCaptionAndLeftMostButton; + + string window_caption = form.Text; + window_caption = window_caption.Replace (Environment.NewLine, string.Empty); + + if (window_caption != null && window_caption != string.Empty) { + StringFormat format = new StringFormat (); + format.FormatFlags = StringFormatFlags.NoWrap; + format.Trimming = StringTrimming.EllipsisCharacter; + format.LineAlignment = StringAlignment.Center; + + if (tb.IntersectsWith (clip)) + dc.DrawString (window_caption, WindowBorderFont, + ThemeEngine.Current.ResPool.GetSolidBrush (Color.White), + tb, format); + } + } + + public override Size ManagedWindowButtonSize (InternalWindowManager wm) + { + int height = ManagedWindowTitleBarHeight (wm); + if (!wm.IsMaximized && !wm.IsMinimized) { + if (wm.IsToolWindow) + return new Size (SystemInformation.ToolWindowCaptionButtonSize.Width - 2, + height - 5); + if (wm.Form.FormBorderStyle == FormBorderStyle.None) + return Size.Empty; + } else + height = SystemInformation.CaptionHeight; + + return new Size (SystemInformation.CaptionButtonSize.Width - 2, + height - 5); + } + + private int DrawTitleButton (Graphics dc, TitleButton button, Rectangle clip, Form form) + { + if (!button.Visible) { + return int.MaxValue; + } + + if (button.Rectangle.IntersectsWith (clip)) { + ManagedWindowDrawTitleButton (dc, button, clip, form); + } + return button.Rectangle.Left; + } + + protected virtual void ManagedWindowDrawTitleButton (Graphics dc, TitleButton button, Rectangle clip, Form form) + { + dc.FillRectangle (SystemBrushes.Control, button.Rectangle); + + WidgetPaint.DrawCaptionButton (dc, button.Rectangle, + button.Caption, button.State); + } + + public override Rectangle ManagedWindowGetTitleBarIconArea (InternalWindowManager wm) + { + int bw = ManagedWindowBorderWidth (wm); + return new Rectangle (bw + 3, bw + 2, wm.IconWidth, wm.IconWidth); + } + + public override Size ManagedWindowGetMenuButtonSize (InternalWindowManager wm) + { + Size result = SystemInformation.MenuButtonSize; + result.Width -= 2; + result.Height -= 4; + return result; + } + + public override bool ManagedWindowTitleButtonHasHotElementStyle (TitleButton button, Form form) + { + return false; + } + + public override void ManagedWindowDrawMenuButton (Graphics dc, TitleButton button, Rectangle clip, InternalWindowManager wm) + { + dc.FillRectangle (SystemBrushes.Control, button.Rectangle); + WidgetPaint.DrawCaptionButton (dc, button.Rectangle, + button.Caption, button.State); + } + + public override void ManagedWindowOnSizeInitializedOrChanged (Form form) + { + } + #endregion + + #region WidgetPaint + public override void CPDrawBorder (Graphics graphics, Rectangle bounds, Color leftColor, int leftWidth, + ButtonBorderStyle leftStyle, Color topColor, int topWidth, ButtonBorderStyle topStyle, + Color rightColor, int rightWidth, ButtonBorderStyle rightStyle, Color bottomColor, + int bottomWidth, ButtonBorderStyle bottomStyle) { + DrawBorderInternal(graphics, bounds.Left, bounds.Top, bounds.Left, bounds.Bottom-1, leftWidth, leftColor, leftStyle, Border3DSide.Left); + DrawBorderInternal(graphics, bounds.Left, bounds.Top, bounds.Right-1, bounds.Top, topWidth, topColor, topStyle, Border3DSide.Top); + DrawBorderInternal(graphics, bounds.Right-1, bounds.Top, bounds.Right-1, bounds.Bottom-1, rightWidth, rightColor, rightStyle, Border3DSide.Right); + DrawBorderInternal(graphics, bounds.Left, bounds.Bottom-1, bounds.Right-1, bounds.Bottom-1, bottomWidth, bottomColor, bottomStyle, Border3DSide.Bottom); + } + + public override void CPDrawBorder (Graphics graphics, RectangleF bounds, Color leftColor, int leftWidth, + ButtonBorderStyle leftStyle, Color topColor, int topWidth, ButtonBorderStyle topStyle, + Color rightColor, int rightWidth, ButtonBorderStyle rightStyle, Color bottomColor, + int bottomWidth, ButtonBorderStyle bottomStyle) { + DrawBorderInternal(graphics, bounds.Left, bounds.Top, bounds.Left, bounds.Bottom-1, leftWidth, leftColor, leftStyle, Border3DSide.Left); + DrawBorderInternal(graphics, bounds.Left, bounds.Top, bounds.Right-1, bounds.Top, topWidth, topColor, topStyle, Border3DSide.Top); + DrawBorderInternal(graphics, bounds.Right-1, bounds.Top, bounds.Right-1, bounds.Bottom-1, rightWidth, rightColor, rightStyle, Border3DSide.Right); + DrawBorderInternal(graphics, bounds.Left, bounds.Bottom-1, bounds.Right-1, bounds.Bottom-1, bottomWidth, bottomColor, bottomStyle, Border3DSide.Bottom); + } + + public override void CPDrawBorder3D (Graphics graphics, Rectangle rectangle, Border3DStyle style, Border3DSide sides) { + CPDrawBorder3D(graphics, rectangle, style, sides, ColorControl); + } + + public override void CPDrawBorder3D (Graphics graphics, Rectangle rectangle, Border3DStyle style, Border3DSide sides, Color control_color) + { + Pen penTopLeft; + Pen penTopLeftInner; + Pen penBottomRight; + Pen penBottomRightInner; + Rectangle rect= new Rectangle (rectangle.X, rectangle.Y, rectangle.Width, rectangle.Height); + bool is_ColorControl = control_color.ToArgb () == ColorControl.ToArgb () ? true : false; + + if ((style & Border3DStyle.Adjust) != 0) { + rect.Y -= 2; + rect.X -= 2; + rect.Width += 4; + rect.Height += 4; + } + + penTopLeft = penTopLeftInner = penBottomRight = penBottomRightInner = is_ColorControl ? SystemPens.Control : ResPool.GetPen (control_color); + + CPColor cpcolor = CPColor.Empty; + + if (!is_ColorControl) + cpcolor = ResPool.GetCPColor (control_color); + + switch (style) { + case Border3DStyle.Raised: + penTopLeftInner = is_ColorControl ? SystemPens.ControlLightLight : ResPool.GetPen (cpcolor.LightLight); + penBottomRight = is_ColorControl ? SystemPens.ControlDarkDark : ResPool.GetPen (cpcolor.DarkDark); + penBottomRightInner = is_ColorControl ? SystemPens.ControlDark : ResPool.GetPen (cpcolor.Dark); + break; + case Border3DStyle.Sunken: + penTopLeft = is_ColorControl ? SystemPens.ControlDark : ResPool.GetPen (cpcolor.Dark); + penTopLeftInner = is_ColorControl ? SystemPens.ControlDarkDark : ResPool.GetPen (cpcolor.DarkDark); + penBottomRight = is_ColorControl ? SystemPens.ControlLightLight : ResPool.GetPen (cpcolor.LightLight); + break; + case Border3DStyle.Etched: + penTopLeft = penBottomRightInner = is_ColorControl ? SystemPens.ControlDark : ResPool.GetPen (cpcolor.Dark); + penTopLeftInner = penBottomRight = is_ColorControl ? SystemPens.ControlLightLight : ResPool.GetPen (cpcolor.LightLight); + break; + case Border3DStyle.RaisedOuter: + penBottomRight = is_ColorControl ? SystemPens.ControlDarkDark : ResPool.GetPen (cpcolor.DarkDark); + break; + case Border3DStyle.SunkenOuter: + penTopLeft = is_ColorControl ? SystemPens.ControlDark : ResPool.GetPen (cpcolor.Dark); + penBottomRight = is_ColorControl ? SystemPens.ControlLightLight : ResPool.GetPen (cpcolor.LightLight); + break; + case Border3DStyle.RaisedInner: + penTopLeft = is_ColorControl ? SystemPens.ControlLightLight : ResPool.GetPen (cpcolor.LightLight); + penBottomRight = is_ColorControl ? SystemPens.ControlDark : ResPool.GetPen (cpcolor.Dark); + break; + case Border3DStyle.SunkenInner: + penTopLeft = is_ColorControl ? SystemPens.ControlDarkDark : ResPool.GetPen (cpcolor.DarkDark); + break; + case Border3DStyle.Flat: + penTopLeft = penBottomRight = is_ColorControl ? SystemPens.ControlDark : ResPool.GetPen (cpcolor.Dark); + break; + case Border3DStyle.Bump: + penTopLeftInner = penBottomRight = is_ColorControl ? SystemPens.ControlDarkDark : ResPool.GetPen (cpcolor.DarkDark); + break; + default: + break; + } + + bool inner = ((style != Border3DStyle.RaisedOuter) && (style != Border3DStyle.SunkenOuter)); + + if ((sides & Border3DSide.Middle) != 0) { + Brush brush = is_ColorControl ? SystemBrushes.Control : ResPool.GetSolidBrush (control_color); + graphics.FillRectangle (brush, rect); + } + + if ((sides & Border3DSide.Left) != 0) { + graphics.DrawLine (penTopLeft, rect.Left, rect.Bottom - 2, rect.Left, rect.Top); + if ((rect.Width > 2) && inner) + graphics.DrawLine (penTopLeftInner, rect.Left + 1, rect.Bottom - 2, rect.Left + 1, rect.Top); + } + + if ((sides & Border3DSide.Top) != 0) { + graphics.DrawLine (penTopLeft, rect.Left, rect.Top, rect.Right - 2, rect.Top); + if ((rect.Height > 2) && inner) + graphics.DrawLine (penTopLeftInner, rect.Left + 1, rect.Top + 1, rect.Right - 3, rect.Top + 1); + } + + if ((sides & Border3DSide.Right) != 0) { + graphics.DrawLine (penBottomRight, rect.Right - 1, rect.Top, rect.Right - 1, rect.Bottom - 1); + if ((rect.Width > 3) && inner) + graphics.DrawLine (penBottomRightInner, rect.Right - 2, rect.Top + 1, rect.Right - 2, rect.Bottom - 2); + } + + if ((sides & Border3DSide.Bottom) != 0) { + graphics.DrawLine (penBottomRight, rect.Left, rect.Bottom - 1, rect.Right - 1, rect.Bottom - 1); + if ((rect.Height > 3) && inner) + graphics.DrawLine (penBottomRightInner, rect.Left + 1, rect.Bottom - 2, rect.Right - 2, rect.Bottom - 2); + } + } + + public override void CPDrawButton (Graphics dc, Rectangle rectangle, ButtonState state) + { + CPDrawButtonInternal (dc, rectangle, state, SystemPens.ControlDarkDark, SystemPens.ControlDark, SystemPens.ControlLight); + } + + private void CPDrawButtonInternal (Graphics dc, Rectangle rectangle, ButtonState state, Pen DarkPen, Pen NormalPen, Pen LightPen) + { + // sadly enough, the rectangle gets always filled with a hatchbrush + dc.FillRectangle (ResPool.GetHatchBrush (HatchStyle.Percent50, + Color.FromArgb (Clamp (ColorControl.R + 3, 0, 255), + ColorControl.G, ColorControl.B), + ColorControl), + rectangle.X + 1, rectangle.Y + 1, rectangle.Width - 2, rectangle.Height - 2); + + if ((state & ButtonState.All) == ButtonState.All || ((state & ButtonState.Checked) == ButtonState.Checked && (state & ButtonState.Flat) == ButtonState.Flat)) { + dc.FillRectangle (ResPool.GetHatchBrush (HatchStyle.Percent50, ColorControlLight, ColorControl), rectangle.X + 2, rectangle.Y + 2, rectangle.Width - 4, rectangle.Height - 4); + + dc.DrawRectangle (SystemPens.ControlDark, rectangle.X, rectangle.Y, rectangle.Width - 1, rectangle.Height - 1); + } else + if ((state & ButtonState.Flat) == ButtonState.Flat) { + dc.DrawRectangle (SystemPens.ControlDark, rectangle.X, rectangle.Y, rectangle.Width - 1, rectangle.Height - 1); + } else + if ((state & ButtonState.Checked) == ButtonState.Checked) { + dc.FillRectangle (ResPool.GetHatchBrush (HatchStyle.Percent50, ColorControlLight, ColorControl), rectangle.X + 2, rectangle.Y + 2, rectangle.Width - 4, rectangle.Height - 4); + + Pen pen = DarkPen; + dc.DrawLine (pen, rectangle.X, rectangle.Y, rectangle.X, rectangle.Bottom - 2); + dc.DrawLine (pen, rectangle.X + 1, rectangle.Y, rectangle.Right - 2, rectangle.Y); + + pen = NormalPen; + dc.DrawLine (pen, rectangle.X + 1, rectangle.Y + 1, rectangle.X + 1, rectangle.Bottom - 3); + dc.DrawLine (pen, rectangle.X + 2, rectangle.Y + 1, rectangle.Right - 3, rectangle.Y + 1); + + pen = LightPen; + dc.DrawLine (pen, rectangle.X, rectangle.Bottom - 1, rectangle.Right - 2, rectangle.Bottom - 1); + dc.DrawLine (pen, rectangle.Right - 1, rectangle.Y, rectangle.Right - 1, rectangle.Bottom - 1); + } else + if (((state & ButtonState.Pushed) == ButtonState.Pushed) && ((state & ButtonState.Normal) == ButtonState.Normal)) { + Pen pen = DarkPen; + dc.DrawLine (pen, rectangle.X, rectangle.Y, rectangle.X, rectangle.Bottom - 2); + dc.DrawLine (pen, rectangle.X + 1, rectangle.Y, rectangle.Right - 2, rectangle.Y); + + pen = NormalPen; + dc.DrawLine (pen, rectangle.X + 1, rectangle.Y + 1, rectangle.X + 1, rectangle.Bottom - 3); + dc.DrawLine (pen, rectangle.X + 2, rectangle.Y + 1, rectangle.Right - 3, rectangle.Y + 1); + + pen = LightPen; + dc.DrawLine (pen, rectangle.X, rectangle.Bottom - 1, rectangle.Right - 2, rectangle.Bottom - 1); + dc.DrawLine (pen, rectangle.Right - 1, rectangle.Y, rectangle.Right - 1, rectangle.Bottom - 1); + } else + if (((state & ButtonState.Inactive) == ButtonState.Inactive) || ((state & ButtonState.Normal) == ButtonState.Normal)) { + Pen pen = LightPen; + dc.DrawLine (pen, rectangle.X, rectangle.Y, rectangle.Right - 2, rectangle.Y); + dc.DrawLine (pen, rectangle.X, rectangle.Y, rectangle.X, rectangle.Bottom - 2); + + pen = NormalPen; + dc.DrawLine (pen, rectangle.X + 1, rectangle.Bottom - 2, rectangle.Right - 2, rectangle.Bottom - 2); + dc.DrawLine (pen, rectangle.Right - 2, rectangle.Y + 1, rectangle.Right - 2, rectangle.Bottom - 3); + + pen = DarkPen; + dc.DrawLine (pen, rectangle.X, rectangle.Bottom - 1, rectangle.Right - 1, rectangle.Bottom - 1); + dc.DrawLine (pen, rectangle.Right - 1, rectangle.Y, rectangle.Right - 1, rectangle.Bottom - 2); + } + } + + + public override void CPDrawCaptionButton (Graphics graphics, Rectangle rectangle, CaptionButton button, ButtonState state) { + Rectangle captionRect; + int lineWidth; + + CPDrawButtonInternal (graphics, rectangle, state, SystemPens.ControlDarkDark, SystemPens.ControlDark, SystemPens.ControlLightLight); + + if (rectangle.Width cb_rect.Width) ? cb_rect.Width : cb_rect.Height; + + int x_pos = Math.Max (0, cb_rect.X + (cb_rect.Width / 2) - check_box_visible_size / 2); + int y_pos = Math.Max (0, cb_rect.Y + (cb_rect.Height / 2) - check_box_visible_size / 2); + + Rectangle rect = new Rectangle (x_pos, y_pos, check_box_visible_size, check_box_visible_size); + + if (((state & ButtonState.Pushed) == ButtonState.Pushed) || ((state & ButtonState.Inactive) == ButtonState.Inactive)) { + dc.FillRectangle (ResPool.GetHatchBrush (HatchStyle.Percent50, + Color.FromArgb (Clamp (ColorControl.R + 3, 0, 255), + ColorControl.G, ColorControl.B), + ColorControl), rect.X + 2, rect.Y + 2, rect.Width - 3, rect.Height - 3); + } else + dc.FillRectangle (SystemBrushes.ControlLightLight, rect.X + 2, rect.Y + 2, rect.Width - 3, rect.Height - 3); + + Pen pen = SystemPens.ControlDark; + dc.DrawLine (pen, rect.X, rect.Y, rect.X, rect.Bottom - 1); + dc.DrawLine (pen, rect.X + 1, rect.Y, rect.Right - 1, rect.Y); + + pen = SystemPens.ControlDarkDark; + dc.DrawLine (pen, rect.X + 1, rect.Y + 1, rect.X + 1, rect.Bottom - 2); + dc.DrawLine (pen, rect.X + 2, rect.Y + 1, rect.Right - 2, rect.Y + 1); + + pen = SystemPens.ControlLightLight; + dc.DrawLine (pen, rect.Right, rect.Y, rect.Right, rect.Bottom); + dc.DrawLine (pen, rect.X, rect.Bottom, rect.Right, rect.Bottom); + + // oh boy, matching ms is like fighting against windmills + using (Pen h_pen = new Pen (ResPool.GetHatchBrush (HatchStyle.Percent50, + Color.FromArgb (Clamp (ColorControl.R + 3, 0, 255), + ColorControl.G, ColorControl.B), ColorControl))) { + dc.DrawLine (h_pen, rect.X + 1, rect.Bottom - 1, rect.Right - 1, rect.Bottom - 1); + dc.DrawLine (h_pen, rect.Right - 1, rect.Y + 1, rect.Right - 1, rect.Bottom - 1); + } + + if ((state & ButtonState.Inactive) == ButtonState.Inactive) + check_pen = SystemPens.ControlDark; + } + + if ((state & ButtonState.Checked) == ButtonState.Checked) { + int check_size = (cb_rect.Height > cb_rect.Width) ? cb_rect.Width / 2: cb_rect.Height / 2; + + if (check_size < 7) { + int lineWidth = Math.Max (3, check_size / 3); + int Scale = Math.Max (1, check_size / 9); + + Rectangle rect = new Rectangle (cb_rect.X + (cb_rect.Width / 2) - (int)Math.Ceiling ((float)check_size / 2) - 1, cb_rect.Y + (cb_rect.Height / 2) - (check_size / 2) - 1, + check_size, check_size); + + for (int i = 0; i < lineWidth; i++) { + dc.DrawLine (check_pen, rect.Left + lineWidth / 2, rect.Top + lineWidth + i, rect.Left + lineWidth / 2 + 2 * Scale, rect.Top + lineWidth + 2 * Scale + i); + dc.DrawLine (check_pen, rect.Left + lineWidth / 2 + 2 * Scale, rect.Top + lineWidth + 2 * Scale + i, rect.Left + lineWidth / 2 + 6 * Scale, rect.Top + lineWidth - 2 * Scale + i); + } + } else { + int lineWidth = Math.Max (3, check_size / 3) + 1; + + int x_half = cb_rect.Width / 2; + int y_half = cb_rect.Height / 2; + + Rectangle rect = new Rectangle (cb_rect.X + x_half - (check_size / 2) - 1, cb_rect.Y + y_half - (check_size / 2), + check_size, check_size); + + int gradient_left = check_size / 3; + int gradient_right = check_size - gradient_left - 1; + + + for (int i = 0; i < lineWidth; i++) { + dc.DrawLine (check_pen, rect.X, rect.Bottom - 1 - gradient_left - i, rect.X + gradient_left, rect.Bottom - 1 - i); + dc.DrawLine (check_pen, rect.X + gradient_left, rect.Bottom - 1 - i, rect.Right - 1, rect.Bottom - i - 1 - gradient_right); + } + } + } + } + + public override void CPDrawComboButton (Graphics graphics, Rectangle rectangle, ButtonState state) { + Point[] arrow = new Point[3]; + Point P1; + Point P2; + Point P3; + int centerX; + int centerY; + int shiftX; + int shiftY; + Rectangle rect; + + if ((state & ButtonState.Checked)!=0) { + graphics.FillRectangle(ResPool.GetHatchBrush (HatchStyle.Percent50, ColorControlLightLight, ColorControlLight),rectangle); + } + + if ((state & ButtonState.Flat)!=0) { + WidgetPaint.DrawBorder(graphics, rectangle, ColorControlDark, ButtonBorderStyle.Solid); + } else { + if ((state & (ButtonState.Pushed | ButtonState.Checked))!=0) { + // this needs to render like a pushed button - jba + // CPDrawBorder3D(graphics, rectangle, Border3DStyle.Sunken, Border3DSide.Left | Border3DSide.Top | Border3DSide.Right | Border3DSide.Bottom, ColorControl); + Rectangle trace_rectangle = new Rectangle(rectangle.X, rectangle.Y, Math.Max (rectangle.Width-1, 0), Math.Max (rectangle.Height-1, 0)); + graphics.DrawRectangle (SystemPens.ControlDark, trace_rectangle); + } else { + CPDrawBorder3D(graphics, rectangle, Border3DStyle.Raised, Border3DSide.Left | Border3DSide.Top | Border3DSide.Right | Border3DSide.Bottom, ColorControl); + } + } + + rect=new Rectangle(rectangle.X+rectangle.Width/4, rectangle.Y+rectangle.Height/4, rectangle.Width/2, rectangle.Height/2); + centerX=rect.Left+rect.Width/2; + centerY=rect.Top+rect.Height/2; + shiftX=Math.Max(1, rect.Width/8); + shiftY=Math.Max(1, rect.Height/8); + + if ((state & ButtonState.Pushed)!=0) { + shiftX++; + shiftY++; + } + + rect.Y-=shiftY; + centerY-=shiftY; + P1=new Point(rect.Left, centerY); + P2=new Point(rect.Right, centerY); + P3=new Point(centerX, rect.Bottom); + + arrow[0]=P1; + arrow[1]=P2; + arrow[2]=P3; + + /* Draw the arrow */ + if ((state & ButtonState.Inactive)!=0) { + /* Move away from the shadow */ + arrow[0].X += 1; arrow[0].Y += 1; + arrow[1].X += 1; arrow[1].Y += 1; + arrow[2].X += 1; arrow[2].Y += 1; + + graphics.FillPolygon(SystemBrushes.ControlLightLight, arrow, FillMode.Winding); + + arrow[0]=P1; + arrow[1]=P2; + arrow[2]=P3; + + graphics.FillPolygon(SystemBrushes.ControlDark, arrow, FillMode.Winding); + } else { + graphics.FillPolygon(SystemBrushes.ControlText, arrow, FillMode.Winding); + } + } + + public override void CPDrawContainerGrabHandle (Graphics graphics, Rectangle bounds) + { + Pen pen = Pens.Black; + Rectangle rect = new Rectangle (bounds.X, bounds.Y, bounds.Width - 1, bounds.Height - 1); // Dunno why, but MS does it that way, too + int X; + int Y; + + graphics.FillRectangle (SystemBrushes.ControlLightLight, rect); + graphics.DrawRectangle (pen, rect); + + X = rect.X + rect.Width / 2; + Y = rect.Y + rect.Height / 2; + + /* Draw the cross */ + graphics.DrawLine (pen, X, rect.Y + 2, X, rect.Bottom - 2); + graphics.DrawLine (pen, rect.X + 2, Y, rect.Right - 2, Y); + + /* Draw 'arrows' for vertical lines */ + graphics.DrawLine (pen, X - 1, rect.Y + 3, X + 1, rect.Y + 3); + graphics.DrawLine (pen, X - 1, rect.Bottom - 3, X + 1, rect.Bottom - 3); + + /* Draw 'arrows' for horizontal lines */ + graphics.DrawLine (pen, rect.X + 3, Y - 1, rect.X + 3, Y + 1); + graphics.DrawLine (pen, rect.Right - 3, Y - 1, rect.Right - 3, Y + 1); + } + + public virtual void DrawFlatStyleFocusRectangle (Graphics graphics, Rectangle rectangle, ButtonBase button, Color foreColor, Color backColor) { + // make a rectange to trace around border of the button + Rectangle trace_rectangle = new Rectangle(rectangle.X, rectangle.Y, Math.Max (rectangle.Width-1, 0), Math.Max (rectangle.Height-1, 0)); + + Color outerColor = foreColor; + // adjust focus color according to the flatstyle + if (button.FlatStyle == FlatStyle.Popup && !button.is_pressed) { + outerColor = (backColor.ToArgb () == ColorControl.ToArgb ()) ? WidgetPaint.Dark(ColorControl) : ColorControlText; + } + + // draw the outer rectangle + graphics.DrawRectangle (ResPool.GetPen (outerColor), trace_rectangle); + + // draw the inner rectangle + if (button.FlatStyle == FlatStyle.Popup) { + DrawInnerFocusRectangle (graphics, Rectangle.Inflate (rectangle, -4, -4), backColor); + } else { + // draw a flat inner rectangle + Pen pen = ResPool.GetPen (WidgetPaint.LightLight (backColor)); + graphics.DrawRectangle(pen, Rectangle.Inflate (trace_rectangle, -4, -4)); + } + } + + public virtual void DrawInnerFocusRectangle(Graphics graphics, Rectangle rectangle, Color backColor) + { + // make a rectange to trace around border of the button + Rectangle trace_rectangle = new Rectangle(rectangle.X, rectangle.Y, Math.Max (rectangle.Width-1, 0), Math.Max (rectangle.Height-1, 0)); + +#if NotUntilCairoIsFixed + Color colorBackInverted = Color.FromArgb (Math.Abs (backColor.R-255), Math.Abs (backColor.G-255), Math.Abs (backColor.B-255)); + DashStyle oldStyle; // used for caching old penstyle + Pen pen = ResPool.GetPen (colorBackInverted); + + oldStyle = pen.DashStyle; + pen.DashStyle = DashStyle.Dot; + + graphics.DrawRectangle (pen, trace_rectangle); + pen.DashStyle = oldStyle; +#else + CPDrawFocusRectangle(graphics, trace_rectangle, Color.Wheat, backColor); +#endif + } + + + public override void CPDrawFocusRectangle (Graphics graphics, Rectangle rectangle, Color foreColor, Color backColor) + { + Rectangle rect = rectangle; + Pen pen; + HatchBrush brush; + + if (backColor.GetBrightness () >= 0.5) { + foreColor = Color.Transparent; + backColor = Color.Black; + + } else { + backColor = Color.FromArgb (Math.Abs (backColor.R-255), Math.Abs (backColor.G-255), Math.Abs (backColor.B-255)); + foreColor = Color.Black; + } + + brush = ResPool.GetHatchBrush (HatchStyle.Percent50, backColor, foreColor); + pen = new Pen (brush, 1); + + rect.Width--; + rect.Height--; + + graphics.DrawRectangle (pen, rect); + pen.Dispose (); + } + + public override void CPDrawGrabHandle (Graphics graphics, Rectangle rectangle, bool primary, bool enabled) + { + Brush sb; + Pen pen; + + if (primary == true) { + pen = Pens.Black; + if (enabled == true) { + sb = Brushes.White; + } else { + sb = SystemBrushes.Control; + } + } else { + pen = Pens.White; + if (enabled == true) { + sb = Brushes.Black; + } else { + sb = SystemBrushes.Control; + } + } + graphics.FillRectangle (sb, rectangle); + graphics.DrawRectangle (pen, rectangle); + } + + + public override void CPDrawGrid (Graphics graphics, Rectangle area, Size pixelsBetweenDots, Color backColor) { + Color foreColor; + int h; + int b; + int s; + + WidgetPaint.Color2HBS(backColor, out h, out b, out s); + + if (b>127) { + foreColor=Color.Black; + } else { + foreColor=Color.White; + } + + // still not perfect. it seems that ms calculates the position of the first dot or line + + using (Pen pen = new Pen (foreColor)) { + pen.DashPattern = new float [] {1.0f, pixelsBetweenDots.Width - 1}; + + for (int y = area.Top; y < area.Bottom; y += pixelsBetweenDots.Height) + graphics.DrawLine (pen, area.X, y, area.Right - 1, y); + } + } + + public override void CPDrawImageDisabled (Graphics graphics, Image image, int x, int y, Color background) { + /* + Microsoft seems to ignore the background and simply make + the image grayscale. At least when having > 256 colors on + the display. + */ + + if (imagedisabled_attributes == null) { + imagedisabled_attributes = new ImageAttributes (); + ColorMatrix colorMatrix=new ColorMatrix(new float[][] { + // This table would create a perfect grayscale image, based on luminance + // new float[]{0.3f,0.3f,0.3f,0,0}, + // new float[]{0.59f,0.59f,0.59f,0,0}, + // new float[]{0.11f,0.11f,0.11f,0,0}, + // new float[]{0,0,0,1,0,0}, + // new float[]{0,0,0,0,1,0}, + // new float[]{0,0,0,0,0,1} + + // This table generates a image that is grayscaled and then + // brightened up. Seems to match MS close enough. + new float[]{0.2f,0.2f,0.2f,0,0}, + new float[]{0.41f,0.41f,0.41f,0,0}, + new float[]{0.11f,0.11f,0.11f,0,0}, + new float[]{0.15f,0.15f,0.15f,1,0,0}, + new float[]{0.15f,0.15f,0.15f,0,1,0}, + new float[]{0.15f,0.15f,0.15f,0,0,1} + }); + + imagedisabled_attributes.SetColorMatrix (colorMatrix); + } + + graphics.DrawImage(image, new Rectangle(x, y, image.Width, image.Height), 0, 0, image.Width, image.Height, GraphicsUnit.Pixel, imagedisabled_attributes); + + } + + + public override void CPDrawLockedFrame (Graphics graphics, Rectangle rectangle, bool primary) { + Pen penBorder; + Pen penInside; + + if (primary) { + penBorder = ResPool.GetSizedPen (Color.White, 2); + penInside = ResPool.GetPen (Color.Black); + } else { + penBorder = ResPool.GetSizedPen (Color.Black, 2); + penInside = ResPool.GetPen (Color.White); + } + penBorder.Alignment=PenAlignment.Inset; + penInside.Alignment=PenAlignment.Inset; + + graphics.DrawRectangle(penBorder, rectangle); + graphics.DrawRectangle(penInside, rectangle.X+2, rectangle.Y+2, rectangle.Width-5, rectangle.Height-5); + } + + + public override void CPDrawMenuGlyph (Graphics graphics, Rectangle rectangle, MenuGlyph glyph, Color color, Color backColor) { + Rectangle rect; + int lineWidth; + + if (backColor != Color.Empty) + graphics.FillRectangle (ResPool.GetSolidBrush (backColor), rectangle); + + Brush brush = ResPool.GetSolidBrush (color); + + switch(glyph) { + case MenuGlyph.Arrow: { + float height = rectangle.Height * 0.7f; + float width = height / 2.0f; + + PointF ddCenter = new PointF (rectangle.X + ((rectangle.Width-width) / 2.0f), rectangle.Y + (rectangle.Height / 2.0f)); + + PointF [] vertices = new PointF [3]; + vertices [0].X = ddCenter.X; + vertices [0].Y = ddCenter.Y - (height / 2.0f); + vertices [1].X = ddCenter.X; + vertices [1].Y = ddCenter.Y + (height / 2.0f); + vertices [2].X = ddCenter.X + width + 0.1f; + vertices [2].Y = ddCenter.Y; + + graphics.FillPolygon (brush, vertices); + + return; + } + + case MenuGlyph.Bullet: { + + lineWidth=Math.Max(2, rectangle.Width/3); + rect=new Rectangle(rectangle.X+lineWidth, rectangle.Y+lineWidth, rectangle.Width-lineWidth*2, rectangle.Height-lineWidth*2); + + graphics.FillEllipse(brush, rect); + + return; + } + + case MenuGlyph.Checkmark: { + + Pen pen = ResPool.GetPen (color); + lineWidth = Math.Max (2, rectangle.Width / 6); + rect = new Rectangle(rectangle.X + lineWidth, rectangle.Y + lineWidth, rectangle.Width - lineWidth * 2, rectangle.Height- lineWidth * 2); + + int Scale = Math.Max (1, rectangle.Width / 12); + int top = (rect.Y + lineWidth + ((rect.Height - ((2 * Scale) + lineWidth)) / 2)); + + for (int i=0; i rectangle.Height) ? (int)(rectangle.Height * 0.9f) : (int)(rectangle.Width * 0.9f); + int radius = ellipse_diameter / 2; + + Rectangle rb_rect = new Rectangle (rectangle.X + (rectangle.Width / 2) - radius, rectangle.Y + (rectangle.Height / 2) - radius, ellipse_diameter, ellipse_diameter); + + Brush brush = null; + + if ((state & ButtonState.All) == ButtonState.All) { + brush = ResPool.GetHatchBrush (HatchStyle.Percent50, Color.FromArgb (Clamp (ColorControl.R + 3, 0, 255), + ColorControl.G, ColorControl.B), ColorControl); + dot_color = cpcolor.Dark; + } else + if ((state & ButtonState.Flat) == ButtonState.Flat) { + if (((state & ButtonState.Inactive) == ButtonState.Inactive) || ((state & ButtonState.Pushed) == ButtonState.Pushed)) + brush = ResPool.GetHatchBrush (HatchStyle.Percent50, Color.FromArgb (Clamp (ColorControl.R + 3, 0, 255), ColorControl.G, ColorControl.B), ColorControl); + else + brush = SystemBrushes.ControlLightLight; + } else { + if (((state & ButtonState.Inactive) == ButtonState.Inactive) || ((state & ButtonState.Pushed) == ButtonState.Pushed)) + brush = ResPool.GetHatchBrush (HatchStyle.Percent50, Color.FromArgb (Clamp (ColorControl.R + 3, 0, 255), ColorControl.G, ColorControl.B), ColorControl); + else + brush = SystemBrushes.ControlLightLight; + + top_left_outer = cpcolor.Dark; + top_left_inner = cpcolor.DarkDark; + bottom_right_outer = cpcolor.Light; + bottom_right_inner = Color.Transparent; + + if ((state & ButtonState.Inactive) == ButtonState.Inactive) + dot_color = cpcolor.Dark; + } + + dc.FillEllipse (brush, rb_rect.X + 1, rb_rect.Y + 1, ellipse_diameter - 1, ellipse_diameter - 1); + + int line_width = Math.Max (1, (int)(ellipse_diameter * 0.08f)); + + dc.DrawArc (ResPool.GetSizedPen (top_left_outer, line_width), rb_rect, 135.0f, 180.0f); + dc.DrawArc (ResPool.GetSizedPen (top_left_inner, line_width), Rectangle.Inflate (rb_rect, -line_width, -line_width), 135.0f, 180.0f); + dc.DrawArc (ResPool.GetSizedPen (bottom_right_outer, line_width), rb_rect, 315.0f, 180.0f); + + if (bottom_right_inner != Color.Transparent) + dc.DrawArc (ResPool.GetSizedPen (bottom_right_inner, line_width), Rectangle.Inflate (rb_rect, -line_width, -line_width), 315.0f, 180.0f); + else + using (Pen h_pen = new Pen (ResPool.GetHatchBrush (HatchStyle.Percent50, Color.FromArgb (Clamp (ColorControl.R + 3, 0, 255), ColorControl.G, ColorControl.B), ColorControl), line_width)) { + dc.DrawArc (h_pen, Rectangle.Inflate (rb_rect, -line_width, -line_width), 315.0f, 180.0f); + } + + if ((state & ButtonState.Checked) == ButtonState.Checked) { + int inflate = line_width * 4; + Rectangle tmp = Rectangle.Inflate (rb_rect, -inflate, -inflate); + if (rectangle.Height > 13) { + tmp.X += 1; + tmp.Y += 1; + tmp.Height -= 1; + dc.FillEllipse (ResPool.GetSolidBrush (dot_color), tmp); + } else { + Pen pen = ResPool.GetPen (dot_color); + dc.DrawLine (pen, tmp.X, tmp.Y + (tmp.Height / 2), tmp.Right, tmp.Y + (tmp.Height / 2)); + dc.DrawLine (pen, tmp.X, tmp.Y + (tmp.Height / 2) + 1, tmp.Right, tmp.Y + (tmp.Height / 2) + 1); + + dc.DrawLine (pen, tmp.X + (tmp.Width / 2), tmp.Y, tmp.X + (tmp.Width / 2), tmp.Bottom); + dc.DrawLine (pen, tmp.X + (tmp.Width / 2) + 1, tmp.Y, tmp.X + (tmp.Width / 2) + 1, tmp.Bottom); + } + } + } + + public override void CPDrawReversibleFrame (Rectangle rectangle, Color backColor, FrameStyle style) { + + } + + + public override void CPDrawReversibleLine (Point start, Point end, Color backColor) { + + } + + + /* Scroll button: regular button + direction arrow */ + public override void CPDrawScrollButton (Graphics dc, Rectangle area, ScrollButton type, ButtonState state) + { + DrawScrollButtonPrimitive (dc, area, state); + + bool fill_rect = true; + int offset = 0; + + if ((state & ButtonState.Pushed) != 0) + offset = 1; + + // skip the border + Rectangle rect = new Rectangle (area.X + 2 + offset, area.Y + 2 + offset, area.Width - 4, area.Height - 4); + + Point [] arrow = new Point [3]; + for (int i = 0; i < 3; i++) + arrow [i] = new Point (); + + Pen pen = SystemPens.ControlText; + + if ((state & ButtonState.Inactive) != 0) { + pen = SystemPens.ControlDark; + } + + switch (type) { + default: + case ScrollButton.Down: + int x_middle = (int)Math.Round (rect.Width / 2.0f) - 1; + int y_middle = (int)Math.Round (rect.Height / 2.0f) - 1; + if (x_middle == 1) + x_middle = 2; + + int triangle_height; + + if (rect.Height < 8) { + triangle_height = 2; + fill_rect = false; + } else if (rect.Height == 11) { + triangle_height = 3; + } else { + triangle_height = (int)Math.Round (rect.Height / 3.0f); + } + + arrow [0].X = rect.X + x_middle; + arrow [0].Y = rect.Y + y_middle + triangle_height / 2; + + arrow [1].X = arrow [0].X + triangle_height - 1; + arrow [1].Y = arrow [0].Y - triangle_height + 1; + arrow [2].X = arrow [0].X - triangle_height + 1; + arrow [2].Y = arrow [1].Y; + + dc.DrawPolygon (pen, arrow); + + if ((state & ButtonState.Inactive) != 0) { + dc.DrawLine (SystemPens.ControlLightLight, arrow [1].X + 1, arrow [1].Y + 1, arrow [0].X + 1, arrow [0].Y + 1); + dc.DrawLine (SystemPens.ControlLightLight, arrow [1].X, arrow [1].Y + 1, arrow [0].X + 1, arrow [0].Y); + } + + if (fill_rect) { + for (int i = 0; i < arrow [0].Y - arrow [1].Y; i++) { + dc.DrawLine (pen, arrow [1].X, arrow [1].Y + i, arrow [2].X, arrow [1].Y + i); + arrow [1].X -= 1; + arrow [2].X += 1; + } + } + break; + + case ScrollButton.Up: + x_middle = (int)Math.Round (rect.Width / 2.0f) - 1; + y_middle = (int)Math.Round (rect.Height / 2.0f); + if (x_middle == 1) + x_middle = 2; + + if (y_middle == 1) + y_middle = 2; + + if (rect.Height < 8) { + triangle_height = 2; + fill_rect = false; + } else if (rect.Height == 11) { + triangle_height = 3; + } else { + triangle_height = (int)Math.Round (rect.Height / 3.0f); + } + + arrow [0].X = rect.X + x_middle; + arrow [0].Y = rect.Y + y_middle - triangle_height / 2; + + arrow [1].X = arrow [0].X + triangle_height - 1; + arrow [1].Y = arrow [0].Y + triangle_height - 1; + arrow [2].X = arrow [0].X - triangle_height + 1; + arrow [2].Y = arrow [1].Y; + + dc.DrawPolygon (pen, arrow); + + if ((state & ButtonState.Inactive) != 0) { + dc.DrawLine (SystemPens.ControlLightLight, arrow [1].X + 1, arrow [1].Y + 1, arrow [2].X + 1, arrow [1].Y + 1); + } + + if (fill_rect) { + for (int i = 0; i < arrow [1].Y - arrow [0].Y; i++) { + dc.DrawLine (pen, arrow [2].X, arrow [1].Y - i, arrow [1].X, arrow [1].Y - i); + arrow [1].X -= 1; + arrow [2].X += 1; + } + } + break; + + case ScrollButton.Left: + y_middle = (int)Math.Round (rect.Height / 2.0f) - 1; + if (y_middle == 1) + y_middle = 2; + + int triangle_width; + + if (rect.Width < 8) { + triangle_width = 2; + fill_rect = false; + } else if (rect.Width == 11) { + triangle_width = 3; + } else { + triangle_width = (int)Math.Round (rect.Width / 3.0f); + } + + arrow [0].X = rect.Left + triangle_width - 1; + arrow [0].Y = rect.Y + y_middle; + + if (arrow [0].X - 1 == rect.X) + arrow [0].X += 1; + + arrow [1].X = arrow [0].X + triangle_width - 1; + arrow [1].Y = arrow [0].Y - triangle_width + 1; + arrow [2].X = arrow [1].X; + arrow [2].Y = arrow [0].Y + triangle_width - 1; + + dc.DrawPolygon (pen, arrow); + + if ((state & ButtonState.Inactive) != 0) { + dc.DrawLine (SystemPens.ControlLightLight, arrow [1].X + 1, arrow [1].Y + 1, arrow [2].X + 1, arrow [2].Y + 1); + } + + if (fill_rect) { + for (int i = 0; i < arrow [2].X - arrow [0].X; i++) { + dc.DrawLine (pen, arrow [2].X - i, arrow [1].Y, arrow [2].X - i, arrow [2].Y); + arrow [1].Y += 1; + arrow [2].Y -= 1; + } + } + break; + + case ScrollButton.Right: + y_middle = (int)Math.Round (rect.Height / 2.0f) - 1; + if (y_middle == 1) + y_middle = 2; + + if (rect.Width < 8) { + triangle_width = 2; + fill_rect = false; + } else if (rect.Width == 11) { + triangle_width = 3; + } else { + triangle_width = (int)Math.Round (rect.Width / 3.0f); + } + + arrow [0].X = rect.Right - triangle_width - 1; + arrow [0].Y = rect.Y + y_middle; + + if (arrow [0].X - 1 == rect.X) + arrow [0].X += 1; + + arrow [1].X = arrow [0].X - triangle_width + 1; + arrow [1].Y = arrow [0].Y - triangle_width + 1; + arrow [2].X = arrow [1].X; + arrow [2].Y = arrow [0].Y + triangle_width - 1; + + dc.DrawPolygon (pen, arrow); + + if ((state & ButtonState.Inactive) != 0) { + dc.DrawLine (SystemPens.ControlLightLight, arrow [0].X + 1, arrow [0].Y + 1, arrow [2].X + 1, arrow [2].Y + 1); + dc.DrawLine (SystemPens.ControlLightLight, arrow [0].X, arrow [0].Y + 1, arrow [2].X + 1, arrow [2].Y); + } + + if (fill_rect) { + for (int i = 0; i < arrow [0].X - arrow [1].X; i++) { + dc.DrawLine (pen, arrow [2].X + i, arrow [1].Y, arrow [2].X + i, arrow [2].Y); + arrow [1].Y += 1; + arrow [2].Y -= 1; + } + } + break; + } + } + + public override void CPDrawSelectionFrame (Graphics graphics, bool active, Rectangle outsideRect, Rectangle insideRect, + Color backColor) { + + } + + + public override void CPDrawSizeGrip (Graphics dc, Color backColor, Rectangle bounds) + { + Pen pen_dark = ResPool.GetPen(WidgetPaint.Dark(backColor)); + Pen pen_light_light = ResPool.GetPen(WidgetPaint.LightLight(backColor)); + + for (int i = 2; i < bounds.Width - 2; i += 4) { + dc.DrawLine (pen_light_light, bounds.X + i, bounds.Bottom - 2, bounds.Right - 1, bounds.Y + i - 1); + dc.DrawLine (pen_dark, bounds.X + i + 1, bounds.Bottom - 2, bounds.Right - 1, bounds.Y + i); + dc.DrawLine (pen_dark, bounds.X + i + 2, bounds.Bottom - 2, bounds.Right - 1, bounds.Y + i + 1); + } + } + + private void DrawStringDisabled20 (Graphics g, string s, Font font, Rectangle layoutRectangle, Color color, TextFormatFlags flags, bool useDrawString) + { + CPColor cpcolor = ResPool.GetCPColor (color); + + layoutRectangle.Offset (1, 1); + TextRenderer.DrawTextInternal (g, s, font, layoutRectangle, cpcolor.LightLight, flags, useDrawString); + + layoutRectangle.Offset (-1, -1); + TextRenderer.DrawTextInternal (g, s, font, layoutRectangle, cpcolor.Dark, flags, useDrawString); + } + + public override void CPDrawStringDisabled (Graphics dc, string s, Font font, Color color, RectangleF layoutRectangle, StringFormat format) + { + CPColor cpcolor = ResPool.GetCPColor (color); + + dc.DrawString (s, font, ResPool.GetSolidBrush(cpcolor.LightLight), + new RectangleF(layoutRectangle.X + 1, layoutRectangle.Y + 1, layoutRectangle.Width, layoutRectangle.Height), + format); + dc.DrawString (s, font, ResPool.GetSolidBrush (cpcolor.Dark), layoutRectangle, format); + } + + public override void CPDrawStringDisabled (IDeviceContext dc, string s, Font font, Color color, Rectangle layoutRectangle, TextFormatFlags format) + { + CPColor cpcolor = ResPool.GetCPColor (color); + + layoutRectangle.Offset (1, 1); + TextRenderer.DrawText (dc, s, font, layoutRectangle, cpcolor.LightLight, format); + + layoutRectangle.Offset (-1, -1); + TextRenderer.DrawText (dc, s, font, layoutRectangle, cpcolor.Dark, format); + } + + public override void CPDrawVisualStyleBorder (Graphics graphics, Rectangle bounds) + { + graphics.DrawRectangle (SystemPens.ControlDarkDark, bounds); + } + + private static void DrawBorderInternal (Graphics graphics, int startX, int startY, int endX, int endY, + int width, Color color, ButtonBorderStyle style, Border3DSide side) + { + DrawBorderInternal (graphics, (float) startX, (float) startY, (float) endX, (float) endY, + width, color, style, side); + } + + private static void DrawBorderInternal (Graphics graphics, float startX, float startY, float endX, float endY, + int width, Color color, ButtonBorderStyle style, Border3DSide side) { + + Pen pen = null; + + switch (style) { + case ButtonBorderStyle.Solid: + case ButtonBorderStyle.Inset: + case ButtonBorderStyle.Outset: + pen = ThemeEngine.Current.ResPool.GetDashPen (color, DashStyle.Solid); + break; + case ButtonBorderStyle.Dashed: + pen = ThemeEngine.Current.ResPool.GetDashPen (color, DashStyle.Dash); + break; + case ButtonBorderStyle.Dotted: + pen = ThemeEngine.Current.ResPool.GetDashPen (color, DashStyle.Dot); + break; + default: + case ButtonBorderStyle.None: + return; + } + + switch(style) { + case ButtonBorderStyle.Outset: { + Color colorGrade; + int hue, brightness, saturation; + int brightnessSteps; + int brightnessDownSteps; + + WidgetPaint.Color2HBS(color, out hue, out brightness, out saturation); + + brightnessDownSteps=brightness/width; + if (brightness>127) { + brightnessSteps=Math.Max(6, (160-brightness)/width); + } else { + brightnessSteps=(127-brightness)/width; + } + + for (int i=0; i127) { + brightnessSteps=Math.Max(6, (160-brightness)/width); + } else { + brightnessSteps=(127-brightness)/width; + } + + for (int i=0; i= 0 && page.ImageIndex < tab.ImageList.Images.Count) { + int image_y = bounds.Y + (bounds.Height - tab.ImageList.ImageSize.Height) / 2; + tab.ImageList.Draw (dc, new Point (bounds.X, image_y), page.ImageIndex); + int image_occupied_space = tab.ImageList.ImageSize.Width + 2; + text_area.X += image_occupied_space; + text_area.Width -= image_occupied_space; + } + if (page.Text != null) + dc.DrawString (page.Text, tab.Font, SystemBrushes.ControlText, text_area, DefaultFormatting); + if (tab.Focused && is_selected && tab.ShowFocusCues) + WidgetPaint.DrawFocusRectangle (dc, bounds); + return 0; + } + static VisualStyleElement GetVisualStyleElement (TabWidget tabControl, TabPage tabPage, bool selected) + { + bool top_edge = tabPage.Row == tabControl.RowCount; + int tab_page_index = tabControl.TabPages.IndexOf (tabPage); + bool left_edge = true; + int index; + for (index = tabControl.SliderPos; index < tab_page_index; index++) + if (tabControl.TabPages [index].Row == tabPage.Row) { + left_edge = false; + break; + } + bool right_edge = true; + for (index = tab_page_index; index < tabControl.TabCount; index++) + if (tabControl.TabPages [index].Row == tabPage.Row) { + right_edge = false; + break; + } + if (!tabPage.Enabled) + #region Disabled + if (top_edge) + if (left_edge) + if (right_edge) + return VisualStyleElement.Tab.TopTabItem.Disabled; + else + return VisualStyleElement.Tab.TopTabItemLeftEdge.Disabled; + else + if (right_edge) + return VisualStyleElement.Tab.TopTabItemRightEdge.Disabled; + else + return VisualStyleElement.Tab.TopTabItem.Disabled; + else + if (left_edge) + if (right_edge) + return VisualStyleElement.Tab.TabItem.Disabled; + else + return VisualStyleElement.Tab.TabItemLeftEdge.Disabled; + else + if (right_edge) + return VisualStyleElement.Tab.TabItemRightEdge.Disabled; + else + return VisualStyleElement.Tab.TabItem.Disabled; + #endregion + else if (selected) + #region Pressed + if (top_edge) + if (left_edge) + if (right_edge) + return VisualStyleElement.Tab.TopTabItem.Pressed; + else + return VisualStyleElement.Tab.TopTabItemLeftEdge.Pressed; + else + if (right_edge) + return VisualStyleElement.Tab.TopTabItemRightEdge.Pressed; + else + return VisualStyleElement.Tab.TopTabItem.Pressed; + else + if (left_edge) + if (right_edge) + return VisualStyleElement.Tab.TabItem.Pressed; + else + return VisualStyleElement.Tab.TabItemLeftEdge.Pressed; + else + if (right_edge) + return VisualStyleElement.Tab.TabItemRightEdge.Pressed; + else + return VisualStyleElement.Tab.TabItem.Pressed; + #endregion + else if (tabControl.EnteredTabPage == tabPage) + #region Hot + if (top_edge) + if (left_edge) + if (right_edge) + return VisualStyleElement.Tab.TopTabItem.Hot; + else + return VisualStyleElement.Tab.TopTabItemLeftEdge.Hot; + else + if (right_edge) + return VisualStyleElement.Tab.TopTabItemRightEdge.Hot; + else + return VisualStyleElement.Tab.TopTabItem.Hot; + else + if (left_edge) + if (right_edge) + return VisualStyleElement.Tab.TabItem.Hot; + else + return VisualStyleElement.Tab.TabItemLeftEdge.Hot; + else + if (right_edge) + return VisualStyleElement.Tab.TabItemRightEdge.Hot; + else + return VisualStyleElement.Tab.TabItem.Hot; + #endregion + else + #region Normal + if (top_edge) + if (left_edge) + if (right_edge) + return VisualStyleElement.Tab.TopTabItemBothEdges.Normal; + else + return VisualStyleElement.Tab.TopTabItemLeftEdge.Normal; + else + if (right_edge) + return VisualStyleElement.Tab.TopTabItemRightEdge.Normal; + else + return VisualStyleElement.Tab.TopTabItem.Normal; + else + if (left_edge) + if (right_edge) + return VisualStyleElement.Tab.TabItemBothEdges.Normal; + else + return VisualStyleElement.Tab.TabItemLeftEdge.Normal; + else + if (right_edge) + return VisualStyleElement.Tab.TabItemRightEdge.Normal; + else + return VisualStyleElement.Tab.TabItem.Normal; + #endregion + } + public override bool HasHotElementStyles (TabWidget tabControl) + { + if (!ShouldPaint (tabControl)) + return base.HasHotElementStyles (tabControl); + return true; + } + protected override void DrawScrollButton (Graphics dc, Rectangle bounds, Rectangle clippingArea, ScrollButton button, PushButtonState state) + { + if (!ThemeVisualStyles.RenderClientAreas) { + base.DrawScrollButton (dc, bounds, clippingArea, button, state); + return; + } + VisualStyleElement element; + if (button == ScrollButton.Left) + switch (state) { + case PushButtonState.Hot: + element = VisualStyleElement.Spin.DownHorizontal.Hot; + break; + case PushButtonState.Pressed: + element = VisualStyleElement.Spin.DownHorizontal.Pressed; + break; + default: + element = VisualStyleElement.Spin.DownHorizontal.Normal; + break; + } + else + switch (state) { + case PushButtonState.Hot: + element = VisualStyleElement.Spin.UpHorizontal.Hot; + break; + case PushButtonState.Pressed: + element = VisualStyleElement.Spin.UpHorizontal.Pressed; + break; + default: + element = VisualStyleElement.Spin.UpHorizontal.Normal; + break; + } + if (!VisualStyleRenderer.IsElementDefined (element)) { + if (button == ScrollButton.Left) + switch (state) { + case PushButtonState.Hot: + element = VisualStyleElement.ScrollBar.ArrowButton.LeftHot; + break; + case PushButtonState.Pressed: + element = VisualStyleElement.ScrollBar.ArrowButton.LeftPressed; + break; + default: + element = VisualStyleElement.ScrollBar.ArrowButton.LeftNormal; + break; + } + else + switch (state) { + case PushButtonState.Hot: + element = VisualStyleElement.ScrollBar.ArrowButton.RightHot; + break; + case PushButtonState.Pressed: + element = VisualStyleElement.ScrollBar.ArrowButton.RightPressed; + break; + default: + element = VisualStyleElement.ScrollBar.ArrowButton.RightNormal; + break; + } + if (!VisualStyleRenderer.IsElementDefined (element)) { + base.DrawScrollButton (dc, bounds, clippingArea, button, state); + return; + } + } + new VisualStyleRenderer (element).DrawBackground (dc, bounds, clippingArea); + } + } +} diff --git a/source/ShiftUI/Theming/VisualStyles/ToolStripPainter.cs b/source/ShiftUI/Theming/VisualStyles/ToolStripPainter.cs new file mode 100644 index 0000000..3ee1c1a --- /dev/null +++ b/source/ShiftUI/Theming/VisualStyles/ToolStripPainter.cs @@ -0,0 +1,213 @@ +// Permission is hereby granted, free of charge, to any person obtaining +// a copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to +// permit persons to whom the Software is furnished to do so, subject to +// the following conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// +// Copyright (c) 2008 George Giolfan +// +// Authors: +// George Giolfan (georgegiolfan@yahoo.com) + +using System.Drawing; +using ShiftUI.VisualStyles; +namespace ShiftUI.Theming.VisualStyles +{ + class ToolStripPainter : Default.ToolStripPainter + { + static bool IsDisabled (ToolStripItem toolStripItem) + { + return !toolStripItem.Enabled; + } + static bool IsPressed (ToolStripItem toolStripItem) + { + return toolStripItem.Pressed; + } + static bool IsChecked (ToolStripItem toolStripItem) + { + ToolStripButton tool_strip_button = toolStripItem as ToolStripButton; + if (tool_strip_button == null) + return false; + return tool_strip_button.Checked; + } + static bool IsHot (ToolStripItem toolStripItem) + { + return toolStripItem.Selected; + } + public override void OnRenderButtonBackground (ToolStripItemRenderEventArgs e) + { + if (!ThemeVisualStyles.RenderClientAreas) { + base.OnRenderButtonBackground (e); + return; + } + VisualStyleElement element; + if (IsDisabled (e.Item)) + element = VisualStyleElement.ToolBar.Button.Disabled; + else if (IsPressed (e.Item)) + element = VisualStyleElement.ToolBar.Button.Pressed; + else if (IsChecked (e.Item)) + if (IsHot (e.Item)) + element = VisualStyleElement.ToolBar.Button.HotChecked; + else + element = VisualStyleElement.ToolBar.Button.Checked; + else if (IsHot (e.Item)) + element = VisualStyleElement.ToolBar.Button.Hot; + else + element = VisualStyleElement.ToolBar.Button.Normal; + if (!VisualStyleRenderer.IsElementDefined (element)) { + base.OnRenderButtonBackground (e); + return; + } + new VisualStyleRenderer (element).DrawBackground (e.Graphics, e.Item.Bounds); + } + public override void OnRenderDropDownButtonBackground (ToolStripItemRenderEventArgs e) + { + if (!ThemeVisualStyles.RenderClientAreas) { + base.OnRenderDropDownButtonBackground (e); + return; + } + VisualStyleElement element; + if (IsDisabled (e.Item)) + element = VisualStyleElement.ToolBar.DropDownButton.Disabled; + else if (IsPressed (e.Item)) + element = VisualStyleElement.ToolBar.DropDownButton.Pressed; + else if (IsChecked (e.Item)) + if (IsHot (e.Item)) + element = VisualStyleElement.ToolBar.DropDownButton.HotChecked; + else + element = VisualStyleElement.ToolBar.DropDownButton.Checked; + else if (IsHot (e.Item)) + element = VisualStyleElement.ToolBar.DropDownButton.Hot; + else + element = VisualStyleElement.ToolBar.DropDownButton.Normal; + if (!VisualStyleRenderer.IsElementDefined (element)) { + base.OnRenderDropDownButtonBackground (e); + return; + } + new VisualStyleRenderer (element).DrawBackground (e.Graphics, e.Item.Bounds); + } + public override void OnRenderGrip (ToolStripGripRenderEventArgs e) + { + if (!ThemeVisualStyles.RenderClientAreas) { + base.OnRenderGrip (e); + return; + } + if (e.GripStyle == ToolStripGripStyle.Hidden) + return; + VisualStyleElement element = e.GripDisplayStyle == ToolStripGripDisplayStyle.Vertical ? + VisualStyleElement.Rebar.Gripper.Normal : + VisualStyleElement.Rebar.GripperVertical.Normal; + if (!VisualStyleRenderer.IsElementDefined (element)) { + base.OnRenderGrip (e); + return; + } + new VisualStyleRenderer (element).DrawBackground (e.Graphics, e.GripDisplayStyle == ToolStripGripDisplayStyle.Vertical ? + // GetPartSize seems to return useless values. + new Rectangle (2, 0, 5, 20) : + new Rectangle (0, 2, 20, 5)); + } + public override void OnRenderOverflowButtonBackground (ToolStripItemRenderEventArgs e) + { + if (!ThemeVisualStyles.RenderClientAreas) { + base.OnRenderOverflowButtonBackground (e); + return; + } + VisualStyleElement element = e.ToolStrip.Orientation == Orientation.Horizontal ? + VisualStyleElement.Rebar.Chevron.Normal : + VisualStyleElement.Rebar.ChevronVertical.Normal; + if (!VisualStyleRenderer.IsElementDefined (element)) { + base.OnRenderOverflowButtonBackground (e); + return; + } + OnRenderButtonBackground (e); + new VisualStyleRenderer (element).DrawBackground (e.Graphics, e.Item.Bounds); + } + public override void OnRenderSeparator (ToolStripSeparatorRenderEventArgs e) + { + if (!ThemeVisualStyles.RenderClientAreas) { + base.OnRenderSeparator (e); + return; + } + VisualStyleElement element = e.ToolStrip.Orientation == Orientation.Horizontal ? + VisualStyleElement.ToolBar.SeparatorHorizontal.Normal : + VisualStyleElement.ToolBar.SeparatorVertical.Normal; + if (!VisualStyleRenderer.IsElementDefined (element)) { + base.OnRenderSeparator (e); + return; + } + new VisualStyleRenderer (element).DrawBackground (e.Graphics, e.Item.Bounds); + } + public override void OnRenderSplitButtonBackground (ToolStripItemRenderEventArgs e) + { + if (!ThemeVisualStyles.RenderClientAreas) { + base.OnRenderSplitButtonBackground (e); + return; + } + VisualStyleElement element, drop_down_element; + if (IsDisabled (e.Item)) { + element = VisualStyleElement.ToolBar.SplitButton.Disabled; + drop_down_element = VisualStyleElement.ToolBar.SplitButtonDropDown.Disabled;; + } else if (IsPressed (e.Item)) { + element = VisualStyleElement.ToolBar.SplitButton.Pressed; + drop_down_element = VisualStyleElement.ToolBar.SplitButtonDropDown.Pressed; + } else if (IsChecked (e.Item)) + if (IsHot (e.Item)) { + element = VisualStyleElement.ToolBar.SplitButton.HotChecked; + drop_down_element = VisualStyleElement.ToolBar.SplitButtonDropDown.HotChecked; + } else { + element = VisualStyleElement.ToolBar.Button.Checked; + drop_down_element = VisualStyleElement.ToolBar.SplitButtonDropDown.Checked; + } + else if (IsHot (e.Item)) { + element = VisualStyleElement.ToolBar.SplitButton.Hot; + drop_down_element = VisualStyleElement.ToolBar.SplitButtonDropDown.Hot; + } else { + element = VisualStyleElement.ToolBar.SplitButton.Normal; + drop_down_element = VisualStyleElement.ToolBar.SplitButtonDropDown.Normal; + } + if (!VisualStyleRenderer.IsElementDefined (element) || + !VisualStyleRenderer.IsElementDefined (drop_down_element)) { + base.OnRenderSplitButtonBackground (e); + return; + } + ToolStripSplitButton tool_strip_split_button = (ToolStripSplitButton)e.Item; + VisualStyleRenderer renderer = new VisualStyleRenderer (element); + renderer.DrawBackground (e.Graphics, tool_strip_split_button.ButtonBounds); + renderer.SetParameters (drop_down_element); + renderer.DrawBackground (e.Graphics, tool_strip_split_button.DropDownButtonBounds); + } + public override void OnRenderToolStripBackground (ToolStripRenderEventArgs e) + { + if (e.ToolStrip.BackgroundImage != null) + return; + + if (!ThemeVisualStyles.RenderClientAreas) { + base.OnRenderToolStripBackground (e); + return; + } + VisualStyleElement element; + if (e.ToolStrip is StatusStrip) + element = VisualStyleElement.Status.Bar.Normal; + else + element = VisualStyleElement.Rebar.Band.Normal; + if (!VisualStyleRenderer.IsElementDefined (element)) { + base.OnRenderToolStripBackground (e); + return; + } + new VisualStyleRenderer (element).DrawBackground (e.Graphics, e.ToolStrip.Bounds, e.AffectedBounds); + } + } +} -- cgit v1.2.3 From 995b1404e0966950f53447383da4c5f91bd2cdb0 Mon Sep 17 00:00:00 2001 From: MichaelTheShifter Date: Wed, 20 Jul 2016 10:04:18 -0400 Subject: Fix window border bug, add skinnable VisualStyleBorders --- source/ShiftUI/Theming/ShiftOS.cs | 2 ++ source/ShiftUI/Theming/ThemeSkinnable.cs | 2 +- source/WindowsFormsApplication1/API.cs | 1 + source/WindowsFormsApplication1/Apps/File Skimmer.Designer.cs | 1 + 4 files changed, 5 insertions(+), 1 deletion(-) (limited to 'source/ShiftUI/Theming') diff --git a/source/ShiftUI/Theming/ShiftOS.cs b/source/ShiftUI/Theming/ShiftOS.cs index 1cc00e1..1004a45 100644 --- a/source/ShiftUI/Theming/ShiftOS.cs +++ b/source/ShiftUI/Theming/ShiftOS.cs @@ -18,6 +18,8 @@ namespace ShiftUI.ShiftOS #region Global public string DefaultFont = "Microsoft Sans Serif"; + public Color VisualStyleBorderColor = Color.Black; + public int VisualStyleBorderWidth = 2; public int DefaultFontSize = 9; public FontStyle DefaultFontStyle = FontStyle.Regular; public Color WindowBackColor = Color.Gray; diff --git a/source/ShiftUI/Theming/ThemeSkinnable.cs b/source/ShiftUI/Theming/ThemeSkinnable.cs index bf8b56f..ede3aa9 100644 --- a/source/ShiftUI/Theming/ThemeSkinnable.cs +++ b/source/ShiftUI/Theming/ThemeSkinnable.cs @@ -7935,7 +7935,7 @@ namespace ShiftUI public override void CPDrawVisualStyleBorder(Graphics graphics, Rectangle bounds) { - graphics.DrawRectangle(SystemPens.ControlDarkDark, bounds); + graphics.DrawRectangle(new System.Drawing.Pen(new SolidBrush(Application.CurrentSkin.VisualStyleBorderColor), Application.CurrentSkin.VisualStyleBorderWidth), bounds); } private static void DrawBorderInternal(Graphics graphics, int startX, int startY, int endX, int endY, diff --git a/source/WindowsFormsApplication1/API.cs b/source/WindowsFormsApplication1/API.cs index 6ce59f3..4434fc7 100644 --- a/source/WindowsFormsApplication1/API.cs +++ b/source/WindowsFormsApplication1/API.cs @@ -1089,6 +1089,7 @@ namespace ShiftOS brdr.Dock = DockStyle.Fill; formToCreate.Body.BorderStyle = BorderStyle.None; brdr.setupall(); + formToCreate.FormBorderStyle = FormBorderStyle.None; } /// diff --git a/source/WindowsFormsApplication1/Apps/File Skimmer.Designer.cs b/source/WindowsFormsApplication1/Apps/File Skimmer.Designer.cs index 3484096..f22811f 100644 --- a/source/WindowsFormsApplication1/Apps/File Skimmer.Designer.cs +++ b/source/WindowsFormsApplication1/Apps/File Skimmer.Designer.cs @@ -192,6 +192,7 @@ // imgtypes // this.imgtypes.TransparentColor = System.Drawing.Color.Transparent; + this.imgtypes.ImageSize = new System.Drawing.Size(48, 48); //this.imgtypes.Images.SetKeyName(0, "application"); //this.imgtypes.Images.SetKeyName(1, "package"); //this.imgtypes.Images.SetKeyName(2, "none"); -- cgit v1.2.3 From c5576314e278c33129b3ed4c967120b541974ac0 Mon Sep 17 00:00:00 2001 From: MichaelTheShifter Date: Wed, 20 Jul 2016 10:36:27 -0400 Subject: Fix appveyor builds (hopefully) --- source/ShiftUI/Theming/ShiftOS.cs | 8 ++++++++ source/ShiftUI/Theming/ThemeSkinnable.cs | 8 ++++---- source/WindowsFormsApplication1/ShiftOS.csproj | 2 +- 3 files changed, 13 insertions(+), 5 deletions(-) (limited to 'source/ShiftUI/Theming') diff --git a/source/ShiftUI/Theming/ShiftOS.cs b/source/ShiftUI/Theming/ShiftOS.cs index 1004a45..00e9b1a 100644 --- a/source/ShiftUI/Theming/ShiftOS.cs +++ b/source/ShiftUI/Theming/ShiftOS.cs @@ -17,6 +17,7 @@ namespace ShiftUI.ShiftOS #endregion #region Global + public Color SelectionHighlight = Color.Black; public string DefaultFont = "Microsoft Sans Serif"; public Color VisualStyleBorderColor = Color.Black; public int VisualStyleBorderWidth = 2; @@ -36,6 +37,13 @@ namespace ShiftUI.ShiftOS public Color Border3DBottomRightInner = Color.Gray; #endregion + #region CheckBox + public Color CheckBoxCheckColor = Color.Black; + public Color CheckBoxBorderColor = Color.Black; + public Color CheckBoxBackgroundColor = Color.White; + public int CheckBoxBorderWidth = 2; + #endregion + #region MessageBox public Color MessageBox_BottomPanel = Color.Gray; #endregion diff --git a/source/ShiftUI/Theming/ThemeSkinnable.cs b/source/ShiftUI/Theming/ThemeSkinnable.cs index ede3aa9..6772251 100644 --- a/source/ShiftUI/Theming/ThemeSkinnable.cs +++ b/source/ShiftUI/Theming/ThemeSkinnable.cs @@ -3141,20 +3141,20 @@ namespace ShiftUI int scale = Math.Max(1, rect_checkrect.Width / 12); // set the checkbox background - dc.FillRectangle(SystemBrushes.Window, + dc.FillRectangle(new SolidBrush(Application.CurrentSkin.CheckBoxBackgroundColor), rect_checkrect); // define a rectangle inside the border area Rectangle rect = new Rectangle(rect_checkrect.X + 2, rect_checkrect.Y + 2, rect_checkrect.Width - 4, rect_checkrect.Height - 4); - Pen pen = ResPool.GetSizedPen(this.ColorWindowText, 2); + Pen pen = new Pen(new SolidBrush(Application.CurrentSkin.CheckBoxBorderColor), Application.CurrentSkin.CheckBoxBorderWidth); dc.DrawRectangle(pen, rect); // Need to draw a check-mark if (item.Checked) { - Pen check_pen = ResPool.GetSizedPen(this.ColorWindowText, 1); + Pen check_pen = new Pen(new SolidBrush(Application.CurrentSkin.CheckBoxCheckColor), 1); // adjustments to get the check-mark at the right place rect.X++; rect.Y++; // following logic is taken from DrawFrameControl method @@ -3235,7 +3235,7 @@ namespace ShiftUI } if (item.Selected && control.Focused) - dc.FillRectangle(SystemBrushes.Highlight, highlight_rect); + dc.FillRectangle(new SolidBrush(Application.CurrentSkin.SelectionHighlight), highlight_rect); else if (item.Selected && !control.HideSelection) dc.FillRectangle(SystemBrushes.Control, highlight_rect); else diff --git a/source/WindowsFormsApplication1/ShiftOS.csproj b/source/WindowsFormsApplication1/ShiftOS.csproj index 3e2d172..f794b02 100644 --- a/source/WindowsFormsApplication1/ShiftOS.csproj +++ b/source/WindowsFormsApplication1/ShiftOS.csproj @@ -63,7 +63,7 @@ True - ..\..\..\Project-Circle\ShiftUI\bin\Debug\ShiftUI.dll + ..\ShiftUI\bin\Debug\ShiftUI.dll ..\packages\Svg.2.1.0\lib\Svg.dll -- cgit v1.2.3 From b52090021ff0ae61db652e8a486cbff6732f5ec5 Mon Sep 17 00:00:00 2001 From: MichaelTheShifter Date: Wed, 20 Jul 2016 13:52:12 -0400 Subject: Move ShiftUI designer to ShiftOS and add prober for ShiftOS to allow ShiftUI designer to design ShiftOS forms. --- source/ShiftOS.sln | 6 ++ source/ShiftUI/Theming/ShiftOS.cs | 5 ++ source/ShiftUI/Theming/ThemeSkinnable.cs | 33 +++++----- source/WindowsFormsApplication1/API.cs | 1 + .../WindowsFormsApplication1/Apps/BitnoteWallet.cs | 15 +++-- .../Apps/Shifter.Designer.cs | 9 +-- .../Controls/ProgressBarEX.cs | 8 +-- .../WindowsFormsApplication1/Engine/Lua_Interp.cs | 4 +- source/WindowsFormsApplication1/Program.cs | 72 ++++++++++++---------- 9 files changed, 80 insertions(+), 73 deletions(-) (limited to 'source/ShiftUI/Theming') diff --git a/source/ShiftOS.sln b/source/ShiftOS.sln index ccf69a3..ef829cd 100644 --- a/source/ShiftOS.sln +++ b/source/ShiftOS.sln @@ -12,6 +12,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ShiftUI", "ShiftUI\ShiftUI.csproj", "{C56E34D0-4749-4A73-9469-BCCD063569CD}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ShiftUI Designer", "..\..\Project-Circle\ShiftUI Designer\ShiftUI Designer.csproj", "{20C1A600-B5C2-4226-B5B6-3F17716D2669}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -26,6 +28,10 @@ Global {C56E34D0-4749-4A73-9469-BCCD063569CD}.Debug|Any CPU.Build.0 = Debug|Any CPU {C56E34D0-4749-4A73-9469-BCCD063569CD}.Release|Any CPU.ActiveCfg = Release|Any CPU {C56E34D0-4749-4A73-9469-BCCD063569CD}.Release|Any CPU.Build.0 = Release|Any CPU + {20C1A600-B5C2-4226-B5B6-3F17716D2669}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {20C1A600-B5C2-4226-B5B6-3F17716D2669}.Debug|Any CPU.Build.0 = Debug|Any CPU + {20C1A600-B5C2-4226-B5B6-3F17716D2669}.Release|Any CPU.ActiveCfg = Release|Any CPU + {20C1A600-B5C2-4226-B5B6-3F17716D2669}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/source/ShiftUI/Theming/ShiftOS.cs b/source/ShiftUI/Theming/ShiftOS.cs index 00e9b1a..7950c18 100644 --- a/source/ShiftUI/Theming/ShiftOS.cs +++ b/source/ShiftUI/Theming/ShiftOS.cs @@ -14,6 +14,7 @@ namespace ShiftUI.ShiftOS public Color ButtonBorderColor = Color.Black; public Color ButtonBackColor = Color.White; public Color ButtonBackColor_Pressed = Color.Gray; + public Color ButtonBackColor_Checked = Color.Black; #endregion #region Global @@ -55,6 +56,10 @@ namespace ShiftUI.ShiftOS #endregion + #region ListView + public Color ListViewBackground = Color.White; + #endregion + // No reason to have ShiftOS deal with window borders itself // when I can do it inside ShiftUI. #region Form diff --git a/source/ShiftUI/Theming/ThemeSkinnable.cs b/source/ShiftUI/Theming/ThemeSkinnable.cs index 6772251..5ea8a4d 100644 --- a/source/ShiftUI/Theming/ThemeSkinnable.cs +++ b/source/ShiftUI/Theming/ThemeSkinnable.cs @@ -2973,7 +2973,7 @@ namespace ShiftUI // border is drawn directly in the Paint method if (details && control.HeaderStyle != ColumnHeaderStyle.None) { - dc.FillRectangle(SystemBrushes.Control, + dc.FillRectangle(new SolidBrush(Application.CurrentSkin.ListViewBackground), 0, 0, control.TotalWidth, control.Font.Height + 5); if (control.Columns.Count > 0) { @@ -6923,67 +6923,64 @@ namespace ShiftUI private void CPDrawButtonInternal(Graphics dc, Rectangle rectangle, ButtonState state, Pen DarkPen, Pen NormalPen, Pen LightPen) { // sadly enough, the rectangle gets always filled with a hatchbrush - dc.FillRectangle(ResPool.GetHatchBrush(HatchStyle.Percent50, - Color.FromArgb(Clamp(ColorControl.R + 3, 0, 255), - ColorControl.G, ColorControl.B), - ColorControl), + dc.FillRectangle(new SolidBrush(Application.CurrentSkin.ButtonBackColor), rectangle.X + 1, rectangle.Y + 1, rectangle.Width - 2, rectangle.Height - 2); if ((state & ButtonState.All) == ButtonState.All || ((state & ButtonState.Checked) == ButtonState.Checked && (state & ButtonState.Flat) == ButtonState.Flat)) { - dc.FillRectangle(ResPool.GetHatchBrush(HatchStyle.Percent50, ColorControlLight, ColorControl), rectangle.X + 2, rectangle.Y + 2, rectangle.Width - 4, rectangle.Height - 4); + dc.FillRectangle(new SolidBrush(Application.CurrentSkin.ButtonBackColor_Checked), rectangle.X + 2, rectangle.Y + 2, rectangle.Width - 4, rectangle.Height - 4); - dc.DrawRectangle(SystemPens.ControlDark, rectangle.X, rectangle.Y, rectangle.Width - 1, rectangle.Height - 1); + dc.DrawRectangle(new Pen(new SolidBrush(Application.CurrentSkin.ButtonBorderColor), Application.CurrentSkin.ButtonBorderWidth), rectangle.X, rectangle.Y, rectangle.Width - 1, rectangle.Height - 1); } else if ((state & ButtonState.Flat) == ButtonState.Flat) { - dc.DrawRectangle(SystemPens.ControlDark, rectangle.X, rectangle.Y, rectangle.Width - 1, rectangle.Height - 1); + dc.DrawRectangle(new Pen(new SolidBrush(Application.CurrentSkin.ButtonBorderColor), Application.CurrentSkin.ButtonBorderWidth), rectangle.X, rectangle.Y, rectangle.Width - 1, rectangle.Height - 1); } else if ((state & ButtonState.Checked) == ButtonState.Checked) { - dc.FillRectangle(ResPool.GetHatchBrush(HatchStyle.Percent50, ColorControlLight, ColorControl), rectangle.X + 2, rectangle.Y + 2, rectangle.Width - 4, rectangle.Height - 4); + dc.FillRectangle(new SolidBrush(Application.CurrentSkin.ButtonBackColor_Checked), rectangle.X + 2, rectangle.Y + 2, rectangle.Width - 4, rectangle.Height - 4); - Pen pen = DarkPen; + Pen pen = new Pen(new SolidBrush(Application.CurrentSkin.Border3DTopLeftInner)); dc.DrawLine(pen, rectangle.X, rectangle.Y, rectangle.X, rectangle.Bottom - 2); dc.DrawLine(pen, rectangle.X + 1, rectangle.Y, rectangle.Right - 2, rectangle.Y); - pen = NormalPen; + pen = new Pen(new SolidBrush(Application.CurrentSkin.Border3DBottomRight)); dc.DrawLine(pen, rectangle.X + 1, rectangle.Y + 1, rectangle.X + 1, rectangle.Bottom - 3); dc.DrawLine(pen, rectangle.X + 2, rectangle.Y + 1, rectangle.Right - 3, rectangle.Y + 1); - pen = LightPen; + pen = new Pen(new SolidBrush(Application.CurrentSkin.Border3DBottomRightInner)); dc.DrawLine(pen, rectangle.X, rectangle.Bottom - 1, rectangle.Right - 2, rectangle.Bottom - 1); dc.DrawLine(pen, rectangle.Right - 1, rectangle.Y, rectangle.Right - 1, rectangle.Bottom - 1); } else if (((state & ButtonState.Pushed) == ButtonState.Pushed) && ((state & ButtonState.Normal) == ButtonState.Normal)) { - Pen pen = DarkPen; + Pen pen = new Pen(new SolidBrush(Application.CurrentSkin.Border3DTopLeftInner)); dc.DrawLine(pen, rectangle.X, rectangle.Y, rectangle.X, rectangle.Bottom - 2); dc.DrawLine(pen, rectangle.X + 1, rectangle.Y, rectangle.Right - 2, rectangle.Y); - pen = NormalPen; + pen = new Pen(new SolidBrush(Application.CurrentSkin.Border3DBottomRight)); dc.DrawLine(pen, rectangle.X + 1, rectangle.Y + 1, rectangle.X + 1, rectangle.Bottom - 3); dc.DrawLine(pen, rectangle.X + 2, rectangle.Y + 1, rectangle.Right - 3, rectangle.Y + 1); - pen = LightPen; + pen = new Pen(new SolidBrush(Application.CurrentSkin.Border3DBottomRightInner)); dc.DrawLine(pen, rectangle.X, rectangle.Bottom - 1, rectangle.Right - 2, rectangle.Bottom - 1); dc.DrawLine(pen, rectangle.Right - 1, rectangle.Y, rectangle.Right - 1, rectangle.Bottom - 1); } else if (((state & ButtonState.Inactive) == ButtonState.Inactive) || ((state & ButtonState.Normal) == ButtonState.Normal)) { - Pen pen = LightPen; + Pen pen = new Pen(new SolidBrush(Application.CurrentSkin.Border3DTopLeftInner)); dc.DrawLine(pen, rectangle.X, rectangle.Y, rectangle.Right - 2, rectangle.Y); dc.DrawLine(pen, rectangle.X, rectangle.Y, rectangle.X, rectangle.Bottom - 2); - pen = NormalPen; + pen = new Pen(new SolidBrush(Application.CurrentSkin.Border3DBottomRight)); dc.DrawLine(pen, rectangle.X + 1, rectangle.Bottom - 2, rectangle.Right - 2, rectangle.Bottom - 2); dc.DrawLine(pen, rectangle.Right - 2, rectangle.Y + 1, rectangle.Right - 2, rectangle.Bottom - 3); - pen = DarkPen; + pen = new Pen(new SolidBrush(Application.CurrentSkin.Border3DBottomRightInner)); dc.DrawLine(pen, rectangle.X, rectangle.Bottom - 1, rectangle.Right - 1, rectangle.Bottom - 1); dc.DrawLine(pen, rectangle.Right - 1, rectangle.Y, rectangle.Right - 1, rectangle.Bottom - 2); } diff --git a/source/WindowsFormsApplication1/API.cs b/source/WindowsFormsApplication1/API.cs index 4434fc7..ce0ad8c 100644 --- a/source/WindowsFormsApplication1/API.cs +++ b/source/WindowsFormsApplication1/API.cs @@ -1926,6 +1926,7 @@ namespace ShiftOS public static Color[] yellowmemory = new Color[16]; public static Color[] pinkmemory = new Color[16]; internal static Dictionary> LuaShifterRegistry = null; + public static bool ShouldLoadEngine = true; #endregion } diff --git a/source/WindowsFormsApplication1/Apps/BitnoteWallet.cs b/source/WindowsFormsApplication1/Apps/BitnoteWallet.cs index 7b19c70..3a7164e 100644 --- a/source/WindowsFormsApplication1/Apps/BitnoteWallet.cs +++ b/source/WindowsFormsApplication1/Apps/BitnoteWallet.cs @@ -22,14 +22,17 @@ namespace ShiftOS public BitnoteWallet() { InitializeComponent(); - Clients = new List(); - foreach(var c in Package_Grabber.clients) + if (API.ShouldLoadEngine) { - if(c.Value.IsConnected) + Clients = new List(); + foreach (var c in Package_Grabber.clients) { - var client = new BitnoteClient(c.Key); - client.GetBank(); - Clients.Add(client); + if (c.Value.IsConnected) + { + var client = new BitnoteClient(c.Key); + client.GetBank(); + Clients.Add(client); + } } } } diff --git a/source/WindowsFormsApplication1/Apps/Shifter.Designer.cs b/source/WindowsFormsApplication1/Apps/Shifter.Designer.cs index 04a61d3..568822e 100644 --- a/source/WindowsFormsApplication1/Apps/Shifter.Designer.cs +++ b/source/WindowsFormsApplication1/Apps/Shifter.Designer.cs @@ -443,7 +443,6 @@ namespace ShiftOS this.pnlshifterintro.SuspendLayout(); this.pnldesktopoptions.SuspendLayout(); this.pnldesktoppaneloptions.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)(this.txtdesktoppanelheight)).BeginInit(); this.pnlapplauncheroptions.SuspendLayout(); this.pnldesktopintro.SuspendLayout(); this.pnlpanelbuttonsoptions.SuspendLayout(); @@ -453,7 +452,6 @@ namespace ShiftOS this.predesktoppanel.SuspendLayout(); this.prepnlpanelbuttonholder.SuspendLayout(); this.prepnlpanelbutton.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)(this.pretbicon)).BeginInit(); this.pretimepanel.SuspendLayout(); this.preapplaunchermenuholder.SuspendLayout(); this.predesktopappmenu.SuspendLayout(); @@ -472,7 +470,6 @@ namespace ShiftOS this.prepgleft.SuspendLayout(); this.prepgright.SuspendLayout(); this.pretitlebar.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)(this.prepnlicon)).BeginInit(); this.pnlreset.SuspendLayout(); this.pgcontents.SuspendLayout(); this.pnldesktopcomposition.SuspendLayout(); @@ -5123,7 +5120,7 @@ namespace ShiftOS this.pnldesktopoptions.ResumeLayout(false); this.pnldesktoppaneloptions.ResumeLayout(false); this.pnldesktoppaneloptions.PerformLayout(); - ((System.ComponentModel.ISupportInitialize)(this.txtdesktoppanelheight)).EndInit(); + //((System.ComponentModel.ISupportInitialize)(this.txtdesktoppanelheight)).EndInit(); this.pnlapplauncheroptions.ResumeLayout(false); this.pnlapplauncheroptions.PerformLayout(); this.pnldesktopintro.ResumeLayout(false); @@ -5139,7 +5136,7 @@ namespace ShiftOS this.prepnlpanelbuttonholder.ResumeLayout(false); this.prepnlpanelbutton.ResumeLayout(false); this.prepnlpanelbutton.PerformLayout(); - ((System.ComponentModel.ISupportInitialize)(this.pretbicon)).EndInit(); + //((System.ComponentModel.ISupportInitialize)(this.pretbicon)).EndInit(); this.pretimepanel.ResumeLayout(false); this.pretimepanel.PerformLayout(); this.preapplaunchermenuholder.ResumeLayout(false); @@ -5169,7 +5166,7 @@ namespace ShiftOS this.prepgright.ResumeLayout(false); this.pretitlebar.ResumeLayout(false); this.pretitlebar.PerformLayout(); - ((System.ComponentModel.ISupportInitialize)(this.prepnlicon)).EndInit(); + //((System.ComponentModel.ISupportInitialize)(this.prepnlicon)).EndInit(); this.pnlreset.ResumeLayout(false); this.pgcontents.ResumeLayout(false); this.pgcontents.PerformLayout(); diff --git a/source/WindowsFormsApplication1/Controls/ProgressBarEX.cs b/source/WindowsFormsApplication1/Controls/ProgressBarEX.cs index d89969e..8febdcd 100644 --- a/source/WindowsFormsApplication1/Controls/ProgressBarEX.cs +++ b/source/WindowsFormsApplication1/Controls/ProgressBarEX.cs @@ -102,13 +102,7 @@ namespace ShiftOS get { return _MaxValue; } set { - if (value > this.MinValue) - { - _MaxValue = value; - } - else { - throw new ArgumentOutOfRangeException("The maximum value must be more than the minimum value."); - } + _MaxValue = value; } } diff --git a/source/WindowsFormsApplication1/Engine/Lua_Interp.cs b/source/WindowsFormsApplication1/Engine/Lua_Interp.cs index fabc1be..d36b4d9 100644 --- a/source/WindowsFormsApplication1/Engine/Lua_Interp.cs +++ b/source/WindowsFormsApplication1/Engine/Lua_Interp.cs @@ -1466,9 +1466,7 @@ end"); /// The converted widget. public static Widget ToWidget(this System.Windows.Forms.Control ctrl) { - string json = JsonConvert.SerializeObject(ctrl); - json = json.Replace("Control", "Widget"); - return JsonConvert.DeserializeObject(json); + return new Controls.WinFormsHost(ctrl); } } } diff --git a/source/WindowsFormsApplication1/Program.cs b/source/WindowsFormsApplication1/Program.cs index 5f3f1ad..af294db 100644 --- a/source/WindowsFormsApplication1/Program.cs +++ b/source/WindowsFormsApplication1/Program.cs @@ -12,24 +12,24 @@ using Newtonsoft.Json; namespace ShiftOS { - static class Program + public static class Program { /// /// The main entry point for the application. /// [STAThread] - static void Main(string[] args) + public static void Main(string[] args) { - Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); //Extract all dependencies before starting the engine. ExtractDependencies(); - var poolThread = new Thread(new ThreadStart(new Action(() => { + var poolThread = new Thread(new ThreadStart(new Action(() => + { try { - //Download ShiftOS server startup-pool - string pool = new WebClient().DownloadString("http://playshiftos.ml/server/startup_pool"); + //Download ShiftOS server startup-pool + string pool = new WebClient().DownloadString("http://playshiftos.ml/server/startup_pool"); string[] splitter = pool.Split(';'); foreach (string address in splitter) { @@ -55,13 +55,14 @@ namespace ShiftOS //Start the Windows Forms backend Paths.RegisterPaths(); //Sets ShiftOS path variables based on the current OS. SaveSystem.Utilities.CheckForOlderSaves(); //Backs up C:\ShiftOS on Windows systems if it exists and doesn't contain a _engineInfo.txt file telling ShiftOS what engine created it. - //If there isn't a save folder at the directory specified by ShiftOS.Paths.SaveRoot, create a new save. - //If not, load that save. + //If there isn't a save folder at the directory specified by ShiftOS.Paths.SaveRoot, create a new save. + //If not, load that save. if (Directory.Exists(Paths.SaveRoot)) { API.Log("Loading ShiftOS save..."); SaveSystem.Utilities.loadGame(); - } else + } + else { SaveSystem.Utilities.NewGame(); } @@ -80,44 +81,48 @@ namespace ShiftOS Skinning.Utilities.loadskin(); SaveSystem.ShiftoriumRegistry.UpdateShiftorium(); //Lua bootscreen. - if(File.Exists(Paths.SaveRoot + "BOOT")) + if (File.Exists(Paths.SaveRoot + "BOOT")) { string lua = File.ReadAllText(Paths.SaveRoot + "BOOT"); var l = new LuaInterpreter(); l.mod(lua); } //Start recieving calls from the Modding API... - Application.Run(new ShiftOSDesktop()); - //By now, the API receiver has been loaded, - //and the desktop is shown. So, let's check - //for auto-start mods. - if(Directory.Exists(Paths.AutoStart)) + if (!args.Contains("nodisplay")) { - foreach(string file in Directory.GetFiles(Paths.AutoStart)) + Application.Run(new ShiftOSDesktop()); + //By now, the API receiver has been loaded, + //and the desktop is shown. So, let's check + //for auto-start mods. + if (Directory.Exists(Paths.AutoStart)) { - var inf = new FileInfo(file); - switch(inf.Extension) + foreach (string file in Directory.GetFiles(Paths.AutoStart)) { - case ".saa": - if (API.Upgrades["shiftnet"] == true) - { - API.Log("Starting start-up mod \"" + inf.FullName + "\"..."); - API.LaunchMod(inf.FullName); - } - break; - case ".trm": - var t = new Terminal(); - t.runterminalfile(inf.FullName); - API.Log("Started terminal file \"" + inf.FullName + "\"..."); - break; - } } + var inf = new FileInfo(file); + switch (inf.Extension) + { + case ".saa": + if (API.Upgrades["shiftnet"] == true) + { + API.Log("Starting start-up mod \"" + inf.FullName + "\"..."); + API.LaunchMod(inf.FullName); + } + break; + case ".trm": + var t = new Terminal(); + t.runterminalfile(inf.FullName); + API.Log("Started terminal file \"" + inf.FullName + "\"..."); + break; + } + } + } } //Now, for some ShiftOS launcher integration. try { - if(args[0] != null) + if (args[0] != null) { - if(args[0] != "") + if (args[0] != "") { API.CurrentSave.username = args[0]; //Username set. @@ -130,6 +135,7 @@ namespace ShiftOS } } + static void ExtractDependencies() { //Wow. This'll make it easy for people... -- cgit v1.2.3 From fe4121c5411f39b4ccf702700d7681184adb538f Mon Sep 17 00:00:00 2001 From: MichaelTheShifter Date: Fri, 22 Jul 2016 12:23:28 -0400 Subject: Shifter UI rewrite, fix shiftnet and spkg paths. --- source/ShiftUI/Theming/ThemeElementsMemphis.cs | 193 + .../Apps/Shifter.Designer.cs | 5903 ++------------------ source/WindowsFormsApplication1/Apps/Shifter.cs | 5 +- source/WindowsFormsApplication1/Apps/Shiftnet.cs | 2 +- source/WindowsFormsApplication1/Apps/Terminal.cs | 1625 +++--- .../Online/Package_Grabber.cs | 2 +- 6 files changed, 1396 insertions(+), 6334 deletions(-) (limited to 'source/ShiftUI/Theming') diff --git a/source/ShiftUI/Theming/ThemeElementsMemphis.cs b/source/ShiftUI/Theming/ThemeElementsMemphis.cs index 1a2e892..b91bd8b 100644 --- a/source/ShiftUI/Theming/ThemeElementsMemphis.cs +++ b/source/ShiftUI/Theming/ThemeElementsMemphis.cs @@ -6,6 +6,7 @@ using System.Threading.Tasks; using ShiftUI.Theming.Default; using System.Drawing; using ShiftUI.ShiftOS; +using System.Drawing.Drawing2D; namespace ShiftUI.Theming { @@ -23,10 +24,202 @@ namespace ShiftUI.Theming return new Memphis.ButtonPainter(); } } + + public override CheckBoxPainter CheckBoxPainter + { + get + { + return new Memphis.CheckBoxPainter(); + } + } } namespace Memphis { + internal class CheckBoxPainter : Default.CheckBoxPainter + { + #region Standard + public override void DrawNormalCheckBox(Graphics g, Rectangle bounds, Color backColor, Color foreColor, CheckState state) + { + int check_box_visible_size = (bounds.Height > bounds.Width) ? bounds.Width : bounds.Height; + int x_pos = Math.Max(0, bounds.X + (bounds.Width / 2) - check_box_visible_size / 2); + int y_pos = Math.Max(0, bounds.Y + (bounds.Height / 2) - check_box_visible_size / 2); + + Rectangle rect = new Rectangle(x_pos, y_pos, check_box_visible_size, check_box_visible_size); + + g.FillRectangle(new SolidBrush(Application.CurrentSkin.CheckBoxBackgroundColor), rect.X + 2, rect.Y + 2, rect.Width - 3, rect.Height - 3); + + Pen pen = new Pen(Application.CurrentSkin.Border3DTopLeftInner, 1); + g.DrawLine(pen, rect.X, rect.Y, rect.X, rect.Bottom - 2); + g.DrawLine(pen, rect.X + 1, rect.Y, rect.Right - 2, rect.Y); + + pen = new Pen(Application.CurrentSkin.Border3DBottomRight, 1); + g.DrawLine(pen, rect.X + 1, rect.Y + 1, rect.X + 1, rect.Bottom - 3); + g.DrawLine(pen, rect.X + 2, rect.Y + 1, rect.Right - 3, rect.Y + 1); + + pen = new Pen(Application.CurrentSkin.Border3DTopLeftInner, 1); + g.DrawLine(pen, rect.Right - 1, rect.Y, rect.Right - 1, rect.Bottom - 1); + g.DrawLine(pen, rect.X, rect.Bottom - 1, rect.Right - 1, rect.Bottom - 1); + + // oh boy, matching ms is like fighting against windmills + using (Pen h_pen = new Pen(Application.CurrentSkin.CheckBoxCheckColor)) + { + g.DrawLine(h_pen, rect.X + 1, rect.Bottom - 2, rect.Right - 2, rect.Bottom - 2); + g.DrawLine(h_pen, rect.Right - 2, rect.Y + 1, rect.Right - 2, rect.Bottom - 2); + } + + if (state == CheckState.Checked) + DrawCheck(g, bounds, Application.CurrentSkin.CheckBoxCheckColor); + else if (state == CheckState.Indeterminate) + DrawCheck(g, bounds, Application.CurrentSkin.CheckBoxCheckColor); + } + + public override void DrawHotCheckBox(Graphics g, Rectangle bounds, Color backColor, Color foreColor, CheckState state) + { + DrawNormalCheckBox(g, bounds, backColor, foreColor, state); + } + + public override void DrawPressedCheckBox(Graphics g, Rectangle bounds, Color backColor, Color foreColor, CheckState state) + { + int check_box_visible_size = (bounds.Height > bounds.Width) ? bounds.Width : bounds.Height; + int x_pos = Math.Max(0, bounds.X + (bounds.Width / 2) - check_box_visible_size / 2); + int y_pos = Math.Max(0, bounds.Y + (bounds.Height / 2) - check_box_visible_size / 2); + + Rectangle rect = new Rectangle(x_pos, y_pos, check_box_visible_size, check_box_visible_size); + + g.FillRectangle(new SolidBrush(Application.CurrentSkin.CheckBoxCheckColor), rect.X + 2, rect.Y + 2, rect.Width - 3, rect.Height - 3); + + Pen pen = new Pen(Application.CurrentSkin.Border3DBottomRightInner, 1); + g.DrawLine(pen, rect.X, rect.Y, rect.X, rect.Bottom - 2); + g.DrawLine(pen, rect.X + 1, rect.Y, rect.Right - 2, rect.Y); + + pen = new Pen(Application.CurrentSkin.Border3DBottomRight, 1); + g.DrawLine(pen, rect.X + 1, rect.Y + 1, rect.X + 1, rect.Bottom - 3); + g.DrawLine(pen, rect.X + 2, rect.Y + 1, rect.Right - 3, rect.Y + 1); + + pen = new Pen(Application.CurrentSkin.Border3DTopLeftInner, 1); + g.DrawLine(pen, rect.Right - 1, rect.Y, rect.Right - 1, rect.Bottom - 1); + g.DrawLine(pen, rect.X, rect.Bottom - 1, rect.Right - 1, rect.Bottom - 1); + + // oh boy, matching ms is like fighting against windmills + using (Pen h_pen = new Pen(Application.CurrentSkin.CheckBoxCheckColor)) + { + g.DrawLine(h_pen, rect.X + 1, rect.Bottom - 2, rect.Right - 2, rect.Bottom - 2); + g.DrawLine(h_pen, rect.Right - 2, rect.Y + 1, rect.Right - 2, rect.Bottom - 2); + } + + if (state == CheckState.Checked) + DrawCheck(g, bounds, Application.CurrentSkin.CheckBoxCheckColor); + else if (state == CheckState.Indeterminate) + DrawCheck(g, bounds, Application.CurrentSkin.CheckBoxCheckColor); + } + + public override void DrawDisabledCheckBox(Graphics g, Rectangle bounds, Color backColor, Color foreColor, CheckState state) + { + DrawPressedCheckBox(g, bounds, backColor, foreColor, CheckState.Unchecked); + + if (state == CheckState.Checked || state == CheckState.Indeterminate) + DrawCheck(g, bounds, SystemColors.ControlDark); + } + #endregion + + #region FlatStyle + public override void DrawFlatNormalCheckBox(Graphics g, Rectangle bounds, Color backColor, Color foreColor, CheckState state) + { + DrawNormalCheckBox(g, bounds, backColor, foreColor, state); + } + + public override void DrawFlatHotCheckBox(Graphics g, Rectangle bounds, Color backColor, Color foreColor, CheckState state) + { + DrawFlatNormalCheckBox(g, bounds, backColor, foreColor, state); + } + + public override void DrawFlatPressedCheckBox(Graphics g, Rectangle bounds, Color backColor, Color foreColor, CheckState state) + { + DrawPressedCheckBox(g, bounds, backColor, foreColor, state); + } + +/* public override void DrawFlatDisabledCheckBox(Graphics g, Rectangle bounds, Color backColor, Color foreColor, CheckState state) + { + Rectangle checkbox_rectangle; + + checkbox_rectangle = new Rectangle(bounds.X, bounds.Y, Math.Max(bounds.Width - 2, 0), Math.Max(bounds.Height - 2, 0)); + + WidgetPaint.DrawBorder(g, checkbox_rectangle, foreColor, ButtonBorderStyle.Solid); + + bounds.Offset(-1, 0); + + if (state == CheckState.Checked || state == CheckState.Indeterminate) + DrawCheck(g, bounds, SystemColors.ControlDarkDark); + }*/ + #endregion + + #region Popup + public override void DrawPopupNormalCheckBox(Graphics g, Rectangle bounds, Color backColor, Color foreColor, CheckState state) + { + DrawFlatNormalCheckBox(g, bounds, backColor, foreColor, state); + } + + public override void DrawPopupHotCheckBox(Graphics g, Rectangle bounds, Color backColor, Color foreColor, CheckState state) + { + DrawFlatNormalCheckBox(g, bounds, backColor, foreColor, state); + } + + public override void DrawPopupPressedCheckBox(Graphics g, Rectangle bounds, Color backColor, Color foreColor, CheckState state) + { + DrawFlatPressedCheckBox(g, bounds, backColor, foreColor, state); + } + + public override void DrawPopupDisabledCheckBox(Graphics g, Rectangle bounds, Color backColor, Color foreColor, CheckState state) + { + } + #endregion + + #region Check + public override void DrawCheck(Graphics g, Rectangle bounds, Color checkColor) + { + int check_size = (bounds.Height > bounds.Width) ? bounds.Width / 2 : bounds.Height / 2; + + Pen check_pen = ResPool.GetPen(checkColor); + + if (check_size < 7) + { + int lineWidth = Math.Max(3, check_size / 3); + int Scale = Math.Max(1, check_size / 9); + + Rectangle rect = new Rectangle(bounds.X + (bounds.Width / 2) - (check_size / 2) - 1, bounds.Y + (bounds.Height / 2) - (check_size / 2) - 1, + check_size, check_size); + + for (int i = 0; i < lineWidth; i++) + { + g.DrawLine(check_pen, rect.Left + lineWidth / 2, rect.Top + lineWidth + i, rect.Left + lineWidth / 2 + 2 * Scale, rect.Top + lineWidth + 2 * Scale + i); + g.DrawLine(check_pen, rect.Left + lineWidth / 2 + 2 * Scale, rect.Top + lineWidth + 2 * Scale + i, rect.Left + lineWidth / 2 + 6 * Scale, rect.Top + lineWidth - 2 * Scale + i); + } + } + else + { + int lineWidth = Math.Max(3, check_size / 3) + 1; + + int x_half = bounds.Width / 2; + int y_half = bounds.Height / 2; + + Rectangle rect = new Rectangle(bounds.X + x_half - (check_size / 2) - 1, bounds.Y + y_half - (check_size / 2), + check_size, check_size); + + int gradient_left = check_size / 3; + int gradient_right = check_size - gradient_left - 1; + + for (int i = 0; i < lineWidth; i++) + { + g.DrawLine(check_pen, rect.X, rect.Bottom - 1 - gradient_left - i, rect.X + gradient_left, rect.Bottom - 1 - i); + g.DrawLine(check_pen, rect.X + gradient_left, rect.Bottom - 1 - i, rect.Right - 1, rect.Bottom - i - 1 - gradient_right); + } + } + } + #endregion + + } + internal class ButtonPainter : Default.ButtonPainter { diff --git a/source/WindowsFormsApplication1/Apps/Shifter.Designer.cs b/source/WindowsFormsApplication1/Apps/Shifter.Designer.cs index 568822e..e149215 100644 --- a/source/WindowsFormsApplication1/Apps/Shifter.Designer.cs +++ b/source/WindowsFormsApplication1/Apps/Shifter.Designer.cs @@ -1,5 +1,6 @@ using System; using ShiftUI; +using System.Drawing; namespace ShiftOS { @@ -22,5593 +23,327 @@ namespace ShiftOS base.Dispose(disposing); } - private void InitializeComponent() + public void InitializeComponent() { - this.components = new System.ComponentModel.Container(); - System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Shifter)); - this.clocktick = new ShiftUI.Timer(this.components); - this.customizationtime = new ShiftUI.Timer(this.components); - this.timerearned = new ShiftUI.Timer(this.components); - this.Label1 = new ShiftUI.Label(); - this.btnapply = new ShiftUI.Button(); - this.catholder = new ShiftUI.Panel(); - this.btnmore = new ShiftUI.Button(); - this.btnreset = new ShiftUI.Button(); - this.btnwindowcomposition = new ShiftUI.Button(); - this.btndesktopicons = new ShiftUI.Button(); - this.btnmenus = new ShiftUI.Button(); - this.btnwindows = new ShiftUI.Button(); - this.btndesktop = new ShiftUI.Button(); - this.pnlshifterintro = new ShiftUI.Panel(); - this.Label66 = new ShiftUI.Label(); - this.Label65 = new ShiftUI.Label(); - this.Label64 = new ShiftUI.Label(); - this.Label63 = new ShiftUI.Label(); - this.pnldesktopoptions = new ShiftUI.Panel(); - this.pnldesktoppaneloptions = new ShiftUI.Panel(); - this.btnpanelbuttons = new ShiftUI.Button(); - this.lbwarning = new ShiftUI.Label(); - this.combodesktoppanelposition = new ShiftUI.ComboBox(); - this.lbposition = new ShiftUI.Label(); - this.Label47 = new ShiftUI.Label(); - this.txtdesktoppanelheight = new ShiftUI.TextBox(); - this.lbheight = new ShiftUI.Label(); - this.pnldesktoppanelcolour = new ShiftUI.Panel(); - this.lbpanelcolor = new ShiftUI.Label(); - this.pnlapplauncheroptions = new ShiftUI.Panel(); - this.pnlalhover = new ShiftUI.Panel(); - this.label119 = new ShiftUI.Label(); - this.Label71 = new ShiftUI.Label(); - this.txtapplauncherwidth = new ShiftUI.TextBox(); - this.Label72 = new ShiftUI.Label(); - this.txtappbuttonlabel = new ShiftUI.TextBox(); - this.Label51 = new ShiftUI.Label(); - this.Label50 = new ShiftUI.Label(); - this.pnlmaintextcolour = new ShiftUI.Panel(); - this.comboappbuttontextstyle = new ShiftUI.ComboBox(); - this.comboappbuttontextfont = new ShiftUI.ComboBox(); - this.Label37 = new ShiftUI.Label(); - this.Label38 = new ShiftUI.Label(); - this.txtappbuttontextsize = new ShiftUI.TextBox(); - this.Label39 = new ShiftUI.Label(); - this.Label40 = new ShiftUI.Label(); - this.pnlmainbuttonactivated = new ShiftUI.Panel(); - this.Label28 = new ShiftUI.Label(); - this.Label35 = new ShiftUI.Label(); - this.txtapplicationsbuttonheight = new ShiftUI.TextBox(); - this.Label36 = new ShiftUI.Label(); - this.pnlmainbuttoncolour = new ShiftUI.Panel(); - this.Label43 = new ShiftUI.Label(); - this.pnldesktopintro = new ShiftUI.Panel(); - this.Label69 = new ShiftUI.Label(); - this.Label70 = new ShiftUI.Label(); - this.pnlpanelbuttonsoptions = new ShiftUI.Panel(); - this.pnlpanelbuttontextcolour = new ShiftUI.Panel(); - this.Label101 = new ShiftUI.Label(); - this.txtpanelbuttontexttop = new ShiftUI.TextBox(); - this.Label104 = new ShiftUI.Label(); - this.txtpanelbuttontextside = new ShiftUI.TextBox(); - this.Label106 = new ShiftUI.Label(); - this.Label93 = new ShiftUI.Label(); - this.txtpanelbuttontop = new ShiftUI.TextBox(); - this.Label94 = new ShiftUI.Label(); - this.txtpanelbuttoninitalgap = new ShiftUI.TextBox(); - this.Label108 = new ShiftUI.Label(); - this.txtpanelbuttonicontop = new ShiftUI.TextBox(); - this.Label110 = new ShiftUI.Label(); - this.txtpanelbuttoniconside = new ShiftUI.TextBox(); - this.Label112 = new ShiftUI.Label(); - this.txtpanelbuttoniconsize = new ShiftUI.TextBox(); - this.Label105 = new ShiftUI.Label(); - this.cbpanelbuttontextstyle = new ShiftUI.ComboBox(); - this.cbpanelbuttonfont = new ShiftUI.ComboBox(); - this.Label100 = new ShiftUI.Label(); - this.txtpaneltextbuttonsize = new ShiftUI.TextBox(); - this.Label102 = new ShiftUI.Label(); - this.Label103 = new ShiftUI.Label(); - this.Label98 = new ShiftUI.Label(); - this.txtpanelbuttongap = new ShiftUI.TextBox(); - this.Label99 = new ShiftUI.Label(); - this.Label96 = new ShiftUI.Label(); - this.txtpanelbuttonheight = new ShiftUI.TextBox(); - this.Label97 = new ShiftUI.Label(); - this.Label92 = new ShiftUI.Label(); - this.txtpanelbuttonwidth = new ShiftUI.TextBox(); - this.Label91 = new ShiftUI.Label(); - this.pnlpanelbuttoncolour = new ShiftUI.Panel(); - this.Label95 = new ShiftUI.Label(); - this.pnldesktopbackgroundoptions = new ShiftUI.Panel(); - this.pnldesktopcolour = new ShiftUI.Panel(); - this.Label45 = new ShiftUI.Label(); - this.pnlpanelclockoptions = new ShiftUI.Panel(); - this.pnlclockbackgroundcolour = new ShiftUI.Panel(); - this.Label44 = new ShiftUI.Label(); - this.comboclocktextstyle = new ShiftUI.ComboBox(); - this.comboclocktextfont = new ShiftUI.ComboBox(); - this.Label26 = new ShiftUI.Label(); - this.Label29 = new ShiftUI.Label(); - this.txtclocktextfromtop = new ShiftUI.TextBox(); - this.Label30 = new ShiftUI.Label(); - this.Label31 = new ShiftUI.Label(); - this.txtclocktextsize = new ShiftUI.TextBox(); - this.Label32 = new ShiftUI.Label(); - this.Label33 = new ShiftUI.Label(); - this.pnlpanelclocktextcolour = new ShiftUI.Panel(); - this.Label34 = new ShiftUI.Label(); - this.pnldesktoppreview = new ShiftUI.Panel(); - this.predesktoppanel = new ShiftUI.Panel(); - this.prepnlpanelbuttonholder = new ShiftUI.FlowLayoutPanel(); - this.prepnlpanelbutton = new ShiftUI.Panel(); - this.pretbicon = new ShiftUI.PictureBox(); - this.pretbctext = new ShiftUI.Label(); - this.pretimepanel = new ShiftUI.Panel(); - this.prepaneltimetext = new ShiftUI.Label(); - this.preapplaunchermenuholder = new ShiftUI.Panel(); - this.predesktopappmenu = new ShiftUI.MenuStrip(); - this.ApplicationsToolStripMenuItem = new ShiftUI.ToolStripMenuItem(); - this.KnowledgeInputToolStripMenuItem = new ShiftUI.ToolStripMenuItem(); - this.ShiftoriumToolStripMenuItem = new ShiftUI.ToolStripMenuItem(); - this.ClockToolStripMenuItem = new ShiftUI.ToolStripMenuItem(); - this.TerminalToolStripMenuItem = new ShiftUI.ToolStripMenuItem(); - this.ShifterToolStripMenuItem = new ShiftUI.ToolStripMenuItem(); - this.ToolStripSeparator1 = new ShiftUI.ToolStripSeparator(); - this.ShutdownToolStripMenuItem = new ShiftUI.ToolStripMenuItem(); - this.Panel10 = new ShiftUI.Panel(); - this.btndesktopitself = new ShiftUI.Button(); - this.btnpanelclock = new ShiftUI.Button(); - this.btnapplauncher = new ShiftUI.Button(); - this.btndesktoppanel = new ShiftUI.Button(); - this.txtpanelbuttoniconheight = new ShiftUI.TextBox(); - this.pnlwindowsoptions = new ShiftUI.Panel(); - this.pnlwindowsintro = new ShiftUI.Panel(); - this.Label68 = new ShiftUI.Label(); - this.Label67 = new ShiftUI.Label(); - this.pnlbuttonoptions = new ShiftUI.Panel(); - this.pnlclosebuttonoptions = new ShiftUI.Panel(); - this.Label8 = new ShiftUI.Label(); - this.Label11 = new ShiftUI.Label(); - this.pnlclosebuttoncolour = new ShiftUI.Panel(); - this.txtclosebuttonfromside = new ShiftUI.TextBox(); - this.Label7 = new ShiftUI.Label(); - this.Label12 = new ShiftUI.Label(); - this.txtclosebuttonheight = new ShiftUI.TextBox(); - this.Label13 = new ShiftUI.Label(); - this.Label6 = new ShiftUI.Label(); - this.txtclosebuttonfromtop = new ShiftUI.TextBox(); - this.Label10 = new ShiftUI.Label(); - this.Label14 = new ShiftUI.Label(); - this.txtclosebuttonwidth = new ShiftUI.TextBox(); - this.Label9 = new ShiftUI.Label(); - this.pnlrollupbuttonoptions = new ShiftUI.Panel(); - this.Label54 = new ShiftUI.Label(); - this.Label55 = new ShiftUI.Label(); - this.pnlrollupbuttoncolour = new ShiftUI.Panel(); - this.txtrollupbuttonside = new ShiftUI.TextBox(); - this.Label56 = new ShiftUI.Label(); - this.Label57 = new ShiftUI.Label(); - this.txtrollupbuttonheight = new ShiftUI.TextBox(); - this.Label58 = new ShiftUI.Label(); - this.Label59 = new ShiftUI.Label(); - this.txtrollupbuttontop = new ShiftUI.TextBox(); - this.Label60 = new ShiftUI.Label(); - this.Label61 = new ShiftUI.Label(); - this.txtrollupbuttonwidth = new ShiftUI.TextBox(); - this.Label62 = new ShiftUI.Label(); - this.pnlminimizebuttonoptions = new ShiftUI.Panel(); - this.Label82 = new ShiftUI.Label(); - this.Label83 = new ShiftUI.Label(); - this.pnlminimizebuttoncolour = new ShiftUI.Panel(); - this.txtminimizebuttonside = new ShiftUI.TextBox(); - this.Label84 = new ShiftUI.Label(); - this.Label85 = new ShiftUI.Label(); - this.txtminimizebuttonheight = new ShiftUI.TextBox(); - this.Label86 = new ShiftUI.Label(); - this.Label87 = new ShiftUI.Label(); - this.txtminimizebuttontop = new ShiftUI.TextBox(); - this.Label88 = new ShiftUI.Label(); - this.Label89 = new ShiftUI.Label(); - this.txtminimizebuttonwidth = new ShiftUI.TextBox(); - this.Label90 = new ShiftUI.Label(); - this.combobuttonoption = new ShiftUI.ComboBox(); - this.Label52 = new ShiftUI.Label(); - this.pnltitlebaroptions = new ShiftUI.Panel(); - this.Label80 = new ShiftUI.Label(); - this.txticonfromtop = new ShiftUI.TextBox(); - this.Label81 = new ShiftUI.Label(); - this.Label78 = new ShiftUI.Label(); - this.txticonfromside = new ShiftUI.TextBox(); - this.Label79 = new ShiftUI.Label(); - this.lbcornerwidthpx = new ShiftUI.Label(); - this.txttitlebarcornerwidth = new ShiftUI.TextBox(); - this.lbcornerwidth = new ShiftUI.Label(); - this.pnltitlebarrightcornercolour = new ShiftUI.Panel(); - this.pnltitlebarleftcornercolour = new ShiftUI.Panel(); - this.lbrightcornercolor = new ShiftUI.Label(); - this.lbleftcornercolor = new ShiftUI.Label(); - this.cboxtitlebarcorners = new ShiftUI.CheckBox(); - this.Label5 = new ShiftUI.Label(); - this.txttitlebarheight = new ShiftUI.TextBox(); - this.Label4 = new ShiftUI.Label(); - this.pnltitlebarcolour = new ShiftUI.Panel(); - this.Label2 = new ShiftUI.Label(); - this.pnlborderoptions = new ShiftUI.Panel(); - this.cbindividualbordercolours = new ShiftUI.CheckBox(); - this.pnlborderbottomrightcolour = new ShiftUI.Panel(); - this.lbbright = new ShiftUI.Label(); - this.pnlborderbottomcolour = new ShiftUI.Panel(); - this.lbbottom = new ShiftUI.Label(); - this.pnlborderbottomleftcolour = new ShiftUI.Panel(); - this.lbbleft = new ShiftUI.Label(); - this.pnlborderrightcolour = new ShiftUI.Panel(); - this.lbright = new ShiftUI.Label(); - this.pnlborderleftcolour = new ShiftUI.Panel(); - this.lbleft = new ShiftUI.Label(); - this.Label15 = new ShiftUI.Label(); - this.pnlbordercolour = new ShiftUI.Panel(); - this.txtbordersize = new ShiftUI.TextBox(); - this.Label3 = new ShiftUI.Label(); - this.Label16 = new ShiftUI.Label(); - this.pnltitletextoptions = new ShiftUI.Panel(); - this.combotitletextposition = new ShiftUI.ComboBox(); - this.Label53 = new ShiftUI.Label(); - this.combotitletextstyle = new ShiftUI.ComboBox(); - this.combotitletextfont = new ShiftUI.ComboBox(); - this.Label23 = new ShiftUI.Label(); - this.Label17 = new ShiftUI.Label(); - this.txttitletextside = new ShiftUI.TextBox(); - this.Label18 = new ShiftUI.Label(); - this.Label19 = new ShiftUI.Label(); - this.txttitletexttop = new ShiftUI.TextBox(); - this.Label20 = new ShiftUI.Label(); - this.Label21 = new ShiftUI.Label(); - this.txttitletextsize = new ShiftUI.TextBox(); - this.Label22 = new ShiftUI.Label(); - this.Label24 = new ShiftUI.Label(); - this.pnltitletextcolour = new ShiftUI.Panel(); - this.Label25 = new ShiftUI.Label(); - this.pnlwindowsobjects = new ShiftUI.Panel(); - this.btnborders = new ShiftUI.Button(); - this.btnbuttons = new ShiftUI.Button(); - this.btntitletext = new ShiftUI.Button(); - this.btntitlebar = new ShiftUI.Button(); - this.pnlwindowpreview = new ShiftUI.Panel(); - this.prepgcontent = new ShiftUI.Panel(); - this.prepgbottom = new ShiftUI.Panel(); - this.prepgleft = new ShiftUI.Panel(); - this.prepgbottomlcorner = new ShiftUI.Panel(); - this.prepgright = new ShiftUI.Panel(); - this.prepgbottomrcorner = new ShiftUI.Panel(); - this.pretitlebar = new ShiftUI.Panel(); - this.preminimizebutton = new ShiftUI.Panel(); - this.prepnlicon = new ShiftUI.PictureBox(); - this.prerollupbutton = new ShiftUI.Panel(); - this.preclosebutton = new ShiftUI.Panel(); - this.pretitletext = new ShiftUI.Label(); - this.prepgtoplcorner = new ShiftUI.Panel(); - this.prepgtoprcorner = new ShiftUI.Panel(); - this.pnlreset = new ShiftUI.Panel(); - this.Label113 = new ShiftUI.Label(); - this.btnresetallsettings = new ShiftUI.Button(); - this.Label109 = new ShiftUI.Label(); - this.Label111 = new ShiftUI.Label(); - this.pgcontents = new ShiftUI.Panel(); - this.pnldesktopcomposition = new ShiftUI.Panel(); - this.pnlfancywindows = new ShiftUI.Panel(); - this.txtwinfadedec = new ShiftUI.TextBox(); - this.label150 = new ShiftUI.Label(); - this.txtwinfadespeed = new ShiftUI.TextBox(); - this.label151 = new ShiftUI.Label(); - this.cbdrageffect = new ShiftUI.ComboBox(); - this.label141 = new ShiftUI.Label(); - this.cbcloseanim = new ShiftUI.ComboBox(); - this.label128 = new ShiftUI.Label(); - this.cbopenanim = new ShiftUI.ComboBox(); - this.label127 = new ShiftUI.Label(); - this.label149 = new ShiftUI.Label(); - this.pnlfancydragging = new ShiftUI.Panel(); - this.txtshakeminoffset = new ShiftUI.TextBox(); - this.label148 = new ShiftUI.Label(); - this.txtshakemax = new ShiftUI.TextBox(); - this.label146 = new ShiftUI.Label(); - this.txtdragopacitydec = new ShiftUI.TextBox(); - this.label144 = new ShiftUI.Label(); - this.txtdragfadedec = new ShiftUI.TextBox(); - this.label143 = new ShiftUI.Label(); - this.txtfadespeed = new ShiftUI.TextBox(); - this.label155 = new ShiftUI.Label(); - this.label156 = new ShiftUI.Label(); - this.pnlfancyintro = new ShiftUI.Panel(); - this.label174 = new ShiftUI.Label(); - this.label175 = new ShiftUI.Label(); - this.panel18 = new ShiftUI.Panel(); - this.panel19 = new ShiftUI.Panel(); - this.label157 = new ShiftUI.Label(); - this.panel20 = new ShiftUI.Panel(); - this.label158 = new ShiftUI.Label(); - this.panel21 = new ShiftUI.Panel(); - this.label159 = new ShiftUI.Label(); - this.panel22 = new ShiftUI.Panel(); - this.label160 = new ShiftUI.Label(); - this.panel23 = new ShiftUI.Panel(); - this.label161 = new ShiftUI.Label(); - this.panel24 = new ShiftUI.Panel(); - this.label162 = new ShiftUI.Label(); - this.label163 = new ShiftUI.Label(); - this.panel25 = new ShiftUI.Panel(); - this.panel26 = new ShiftUI.Panel(); - this.label164 = new ShiftUI.Label(); - this.panel27 = new ShiftUI.Panel(); - this.label165 = new ShiftUI.Label(); - this.panel28 = new ShiftUI.Panel(); - this.label166 = new ShiftUI.Label(); - this.panel29 = new ShiftUI.Panel(); - this.label167 = new ShiftUI.Label(); - this.panel30 = new ShiftUI.Panel(); - this.label168 = new ShiftUI.Label(); - this.panel31 = new ShiftUI.Panel(); - this.label169 = new ShiftUI.Label(); - this.panel32 = new ShiftUI.Panel(); - this.label170 = new ShiftUI.Label(); - this.panel33 = new ShiftUI.Panel(); - this.label171 = new ShiftUI.Label(); - this.panel34 = new ShiftUI.Panel(); - this.label172 = new ShiftUI.Label(); - this.label173 = new ShiftUI.Label(); - this.panel36 = new ShiftUI.Panel(); - this.btnfancydragging = new ShiftUI.Button(); - this.btnfancywindows = new ShiftUI.Button(); - this.label176 = new ShiftUI.Label(); - this.pnlmenus = new ShiftUI.Panel(); - this.pnladvanced = new ShiftUI.Panel(); - this.btnmorebuttons = new ShiftUI.Button(); - this.pnlbuttonchecked = new ShiftUI.Panel(); - this.label136 = new ShiftUI.Label(); - this.pnlitemselectedend = new ShiftUI.Panel(); - this.label129 = new ShiftUI.Label(); - this.pnlbuttonpressed = new ShiftUI.Panel(); - this.label130 = new ShiftUI.Label(); - this.pnlitemselectedbegin = new ShiftUI.Panel(); - this.label131 = new ShiftUI.Label(); - this.pnlitemselected = new ShiftUI.Panel(); - this.label132 = new ShiftUI.Label(); - this.pnlbuttonselected = new ShiftUI.Panel(); - this.label133 = new ShiftUI.Label(); - this.pnlcheckbg = new ShiftUI.Panel(); - this.label134 = new ShiftUI.Label(); - this.label135 = new ShiftUI.Label(); - this.pnlmore = new ShiftUI.Panel(); - this.pnlpressedbegin = new ShiftUI.Panel(); - this.btnback = new ShiftUI.Button(); - this.label138 = new ShiftUI.Label(); - this.pnlselectedbegin = new ShiftUI.Panel(); - this.pnlpressedend = new ShiftUI.Panel(); - this.label137 = new ShiftUI.Label(); - this.label139 = new ShiftUI.Label(); - this.pnlselectedend = new ShiftUI.Panel(); - this.pnlpressedmiddle = new ShiftUI.Panel(); - this.label140 = new ShiftUI.Label(); - this.label142 = new ShiftUI.Label(); - this.pnlselectedmiddle = new ShiftUI.Panel(); - this.label145 = new ShiftUI.Label(); - this.label147 = new ShiftUI.Label(); - this.pnldropdown = new ShiftUI.Panel(); - this.pnlddborder = new ShiftUI.Panel(); - this.label117 = new ShiftUI.Label(); - this.pnlmarginend = new ShiftUI.Panel(); - this.label120 = new ShiftUI.Label(); - this.pnlmarginmiddle = new ShiftUI.Panel(); - this.label121 = new ShiftUI.Label(); - this.pnlmarginbegin = new ShiftUI.Panel(); - this.label122 = new ShiftUI.Label(); - this.pnlhcolor = new ShiftUI.Panel(); - this.label123 = new ShiftUI.Label(); - this.pnlhborder = new ShiftUI.Panel(); - this.label125 = new ShiftUI.Label(); - this.label126 = new ShiftUI.Label(); - this.pnlbasic = new ShiftUI.Panel(); - this.pnlmenutextcolor = new ShiftUI.Panel(); - this.label118 = new ShiftUI.Label(); - this.pnldropdownbg = new ShiftUI.Panel(); - this.label115 = new ShiftUI.Label(); - this.pnlstatusend = new ShiftUI.Panel(); - this.label114 = new ShiftUI.Label(); - this.pnlstatusbegin = new ShiftUI.Panel(); - this.label107 = new ShiftUI.Label(); - this.pnltoolbarend = new ShiftUI.Panel(); - this.label77 = new ShiftUI.Label(); - this.pnltoolbarmiddle = new ShiftUI.Panel(); - this.label76 = new ShiftUI.Label(); - this.pnltoolbarbegin = new ShiftUI.Panel(); - this.label75 = new ShiftUI.Label(); - this.pnlmenubarend = new ShiftUI.Panel(); - this.label73 = new ShiftUI.Label(); - this.pnlmenubarbegin = new ShiftUI.Panel(); - this.label42 = new ShiftUI.Label(); - this.label41 = new ShiftUI.Label(); - this.pnlmenusintro = new ShiftUI.Panel(); - this.label116 = new ShiftUI.Label(); - this.label124 = new ShiftUI.Label(); - this.pnlmenucategories = new ShiftUI.Panel(); - this.btnmisc = new ShiftUI.Button(); - this.btnadvanced = new ShiftUI.Button(); - this.btndropdown = new ShiftUI.Button(); - this.btnbasic = new ShiftUI.Button(); - this.label74 = new ShiftUI.Label(); - this.tmrfix = new ShiftUI.Timer(this.components); - this.tmrdelay = new ShiftUI.Timer(this.components); - this.pnlluaoptions = new ShiftUI.Panel(); - this.flmorebuttons = new ShiftUI.FlowLayoutPanel(); - this.pnlluafield = new ShiftUI.Panel(); - this.catholder.SuspendLayout(); - this.pnlshifterintro.SuspendLayout(); - this.pnldesktopoptions.SuspendLayout(); - this.pnldesktoppaneloptions.SuspendLayout(); - this.pnlapplauncheroptions.SuspendLayout(); - this.pnldesktopintro.SuspendLayout(); - this.pnlpanelbuttonsoptions.SuspendLayout(); - this.pnldesktopbackgroundoptions.SuspendLayout(); - this.pnlpanelclockoptions.SuspendLayout(); - this.pnldesktoppreview.SuspendLayout(); - this.predesktoppanel.SuspendLayout(); - this.prepnlpanelbuttonholder.SuspendLayout(); - this.prepnlpanelbutton.SuspendLayout(); - this.pretimepanel.SuspendLayout(); - this.preapplaunchermenuholder.SuspendLayout(); - this.predesktopappmenu.SuspendLayout(); - this.Panel10.SuspendLayout(); - this.pnlwindowsoptions.SuspendLayout(); - this.pnlwindowsintro.SuspendLayout(); - this.pnlbuttonoptions.SuspendLayout(); - this.pnlclosebuttonoptions.SuspendLayout(); - this.pnlrollupbuttonoptions.SuspendLayout(); - this.pnlminimizebuttonoptions.SuspendLayout(); - this.pnltitlebaroptions.SuspendLayout(); - this.pnlborderoptions.SuspendLayout(); - this.pnltitletextoptions.SuspendLayout(); - this.pnlwindowsobjects.SuspendLayout(); - this.pnlwindowpreview.SuspendLayout(); - this.prepgleft.SuspendLayout(); - this.prepgright.SuspendLayout(); - this.pretitlebar.SuspendLayout(); - this.pnlreset.SuspendLayout(); - this.pgcontents.SuspendLayout(); - this.pnldesktopcomposition.SuspendLayout(); - this.pnlfancywindows.SuspendLayout(); - this.pnlfancydragging.SuspendLayout(); - this.pnlfancyintro.SuspendLayout(); - this.panel18.SuspendLayout(); - this.panel25.SuspendLayout(); - this.panel36.SuspendLayout(); - this.pnlmenus.SuspendLayout(); - this.pnladvanced.SuspendLayout(); - this.pnlmore.SuspendLayout(); - this.pnldropdown.SuspendLayout(); - this.pnlbasic.SuspendLayout(); - this.pnlmenusintro.SuspendLayout(); - this.pnlmenucategories.SuspendLayout(); - this.pnlluaoptions.SuspendLayout(); - this.SuspendLayout(); - // - // clocktick - // - this.clocktick.Enabled = true; - this.clocktick.Interval = 1000; - // - // customizationtime - // - this.customizationtime.Enabled = true; - this.customizationtime.Interval = 10000; - // - // timerearned - // - this.timerearned.Interval = 3000; - // - // Label1 - // - this.Label1.AutoSize = true; - this.Label1.ForeColor = System.Drawing.Color.White; - this.Label1.Location = new System.Drawing.Point(597, 3); - this.Label1.Name = "Label1"; - this.Label1.Size = new System.Drawing.Size(39, 13); - this.Label1.TabIndex = 1; - this.Label1.Text = "Label1"; - // - // btnapply - // - this.btnapply.Anchor = ((ShiftUI.AnchorStyles)((ShiftUI.AnchorStyles.Bottom | ShiftUI.AnchorStyles.Left))); - this.btnapply.FlatStyle = ShiftUI.FlatStyle.Standard; - this.btnapply.Font = new System.Drawing.Font("Cambria", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.btnapply.Location = new System.Drawing.Point(7, 286); - this.btnapply.Name = "btnapply"; - this.btnapply.Size = new System.Drawing.Size(119, 29); - this.btnapply.TabIndex = 3; - this.btnapply.TabStop = false; - this.btnapply.Text = "Apply Changes"; - this.btnapply.UseVisualStyleBackColor = true; - this.btnapply.Click += new System.EventHandler(this.btnapply_Click); - // - // catholder - // - this.catholder.Anchor = ((ShiftUI.AnchorStyles)(((ShiftUI.AnchorStyles.Top | ShiftUI.AnchorStyles.Bottom) - | ShiftUI.AnchorStyles.Left))); - this.catholder.BackColor = System.Drawing.Color.White; - this.catholder.Widgets.Add(this.btnmore); - this.catholder.Widgets.Add(this.btnreset); - this.catholder.Widgets.Add(this.btnwindowcomposition); - this.catholder.Widgets.Add(this.btndesktopicons); - this.catholder.Widgets.Add(this.btnmenus); - this.catholder.Widgets.Add(this.btnwindows); - this.catholder.Widgets.Add(this.btndesktop); - this.catholder.Location = new System.Drawing.Point(7, 9); - this.catholder.Name = "catholder"; - this.catholder.Size = new System.Drawing.Size(119, 271); - this.catholder.TabIndex = 5; - // - // btnmore - // - this.btnmore.BackColor = System.Drawing.Color.White; - this.btnmore.Dock = ShiftUI.DockStyle.Top; - this.btnmore.FlatStyle = ShiftUI.FlatStyle.Standard; - this.btnmore.Font = new System.Drawing.Font("Cambria", 12F, ((System.Drawing.FontStyle)((System.Drawing.FontStyle.Bold | System.Drawing.FontStyle.Italic))), System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.btnmore.Location = new System.Drawing.Point(0, 174); - this.btnmore.Name = "btnmore"; - this.btnmore.Size = new System.Drawing.Size(119, 29); - this.btnmore.TabIndex = 11; - this.btnmore.TabStop = false; - this.btnmore.Text = "More"; - this.btnmore.UseVisualStyleBackColor = false; - this.btnmore.Click += new System.EventHandler(this.btnmore_Click); - // - // btnreset - // - this.btnreset.BackColor = System.Drawing.Color.White; - this.btnreset.Dock = ShiftUI.DockStyle.Top; - this.btnreset.FlatStyle = ShiftUI.FlatStyle.Standard; - this.btnreset.Font = new System.Drawing.Font("Cambria", 12F, ((System.Drawing.FontStyle)((System.Drawing.FontStyle.Bold | System.Drawing.FontStyle.Italic))), System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.btnreset.Location = new System.Drawing.Point(0, 145); - this.btnreset.Name = "btnreset"; - this.btnreset.Size = new System.Drawing.Size(119, 29); - this.btnreset.TabIndex = 8; - this.btnreset.TabStop = false; - this.btnreset.Text = "Reset"; - this.btnreset.UseVisualStyleBackColor = false; - this.btnreset.Click += new System.EventHandler(this.btnreset_Click); - // - // btnwindowcomposition - // - this.btnwindowcomposition.BackColor = System.Drawing.Color.White; - this.btnwindowcomposition.Dock = ShiftUI.DockStyle.Top; - this.btnwindowcomposition.FlatStyle = ShiftUI.FlatStyle.Standard; - this.btnwindowcomposition.Font = new System.Drawing.Font("Cambria", 12F, ((System.Drawing.FontStyle)((System.Drawing.FontStyle.Bold | System.Drawing.FontStyle.Italic))), System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.btnwindowcomposition.Location = new System.Drawing.Point(0, 116); - this.btnwindowcomposition.Name = "btnwindowcomposition"; - this.btnwindowcomposition.Size = new System.Drawing.Size(119, 29); - this.btnwindowcomposition.TabIndex = 10; - this.btnwindowcomposition.TabStop = false; - this.btnwindowcomposition.Text = "Fancy Effects"; - this.btnwindowcomposition.UseVisualStyleBackColor = false; - this.btnwindowcomposition.Visible = false; - this.btnwindowcomposition.Click += new System.EventHandler(this.btnwindowcomposition_Click); - // - // btndesktopicons - // - this.btndesktopicons.BackColor = System.Drawing.Color.White; - this.btndesktopicons.Dock = ShiftUI.DockStyle.Top; - this.btndesktopicons.FlatStyle = ShiftUI.FlatStyle.Standard; - this.btndesktopicons.Font = new System.Drawing.Font("Cambria", 12F, ((System.Drawing.FontStyle)((System.Drawing.FontStyle.Bold | System.Drawing.FontStyle.Italic))), System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.btndesktopicons.Location = new System.Drawing.Point(0, 87); - this.btndesktopicons.Name = "btndesktopicons"; - this.btndesktopicons.Size = new System.Drawing.Size(119, 29); - this.btndesktopicons.TabIndex = 9; - this.btndesktopicons.TabStop = false; - this.btndesktopicons.Text = "Desktop Icons"; - this.btndesktopicons.UseVisualStyleBackColor = false; - this.btndesktopicons.Visible = false; - // - // btnmenus - // - this.btnmenus.BackColor = System.Drawing.Color.White; - this.btnmenus.Dock = ShiftUI.DockStyle.Top; - this.btnmenus.FlatStyle = ShiftUI.FlatStyle.Standard; - this.btnmenus.Font = new System.Drawing.Font("Cambria", 12F, ((System.Drawing.FontStyle)((System.Drawing.FontStyle.Bold | System.Drawing.FontStyle.Italic))), System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.btnmenus.Location = new System.Drawing.Point(0, 58); - this.btnmenus.Name = "btnmenus"; - this.btnmenus.Size = new System.Drawing.Size(119, 29); - this.btnmenus.TabIndex = 6; - this.btnmenus.TabStop = false; - this.btnmenus.Text = "Menus"; - this.btnmenus.UseVisualStyleBackColor = false; - this.btnmenus.Visible = false; - this.btnmenus.Click += new System.EventHandler(this.btnmenus_Click_1); - // - // btnwindows - // - this.btnwindows.BackColor = System.Drawing.Color.White; - this.btnwindows.Dock = ShiftUI.DockStyle.Top; - this.btnwindows.FlatStyle = ShiftUI.FlatStyle.Standard; - this.btnwindows.Font = new System.Drawing.Font("Cambria", 12F, ((System.Drawing.FontStyle)((System.Drawing.FontStyle.Bold | System.Drawing.FontStyle.Italic))), System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.btnwindows.Location = new System.Drawing.Point(0, 29); - this.btnwindows.Name = "btnwindows"; - this.btnwindows.Size = new System.Drawing.Size(119, 29); - this.btnwindows.TabIndex = 5; - this.btnwindows.TabStop = false; - this.btnwindows.Text = "Windows"; - this.btnwindows.UseVisualStyleBackColor = false; - this.btnwindows.Click += new System.EventHandler(this.btnwindows_Click); - // - // btndesktop - // - this.btndesktop.BackColor = System.Drawing.Color.White; - this.btndesktop.Dock = ShiftUI.DockStyle.Top; - this.btndesktop.FlatStyle = ShiftUI.FlatStyle.Standard; - this.btndesktop.Font = new System.Drawing.Font("Cambria", 12F, ((System.Drawing.FontStyle)((System.Drawing.FontStyle.Bold | System.Drawing.FontStyle.Italic))), System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.btndesktop.Location = new System.Drawing.Point(0, 0); - this.btndesktop.Name = "btndesktop"; - this.btndesktop.Size = new System.Drawing.Size(119, 29); - this.btndesktop.TabIndex = 4; - this.btndesktop.TabStop = false; - this.btndesktop.Text = "Desktop"; - this.btndesktop.UseVisualStyleBackColor = false; - this.btndesktop.Click += new System.EventHandler(this.btndesktop_Click); - // - // pnlshifterintro - // - this.pnlshifterintro.Anchor = ((ShiftUI.AnchorStyles)((((ShiftUI.AnchorStyles.Top | ShiftUI.AnchorStyles.Bottom) - | ShiftUI.AnchorStyles.Left) - | ShiftUI.AnchorStyles.Right))); - this.pnlshifterintro.BackColor = System.Drawing.Color.White; - this.pnlshifterintro.Widgets.Add(this.Label66); - this.pnlshifterintro.Widgets.Add(this.Label65); - this.pnlshifterintro.Widgets.Add(this.Label64); - this.pnlshifterintro.Widgets.Add(this.Label63); - this.pnlshifterintro.Location = new System.Drawing.Point(134, 9); - this.pnlshifterintro.Name = "pnlshifterintro"; - this.pnlshifterintro.Size = new System.Drawing.Size(457, 306); - this.pnlshifterintro.TabIndex = 17; - // - // Label66 - // - this.Label66.BackColor = System.Drawing.Color.Transparent; - this.Label66.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.Label66.Location = new System.Drawing.Point(3, 227); - this.Label66.Name = "Label66"; - this.Label66.Size = new System.Drawing.Size(451, 65); - this.Label66.TabIndex = 3; - this.Label66.Text = "That\'s right! As you make customizations to ShiftOS, you can earn Codepoints. The" + - " more you shift it, the more CP you earn. Just hit the \'Apply Changes\' button, a" + - "nd you\'ll recieve your codepoints."; - this.Label66.TextAlign = System.Drawing.ContentAlignment.TopCenter; - // - // Label65 - // - this.Label65.AutoSize = true; - this.Label65.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.Label65.Location = new System.Drawing.Point(53, 204); - this.Label65.Name = "Label65"; - this.Label65.Size = new System.Drawing.Size(352, 20); - this.Label65.TabIndex = 2; - this.Label65.Text = "You can earn codepoints using the Shifter!"; - // - // Label64 - // - this.Label64.BackColor = System.Drawing.Color.Transparent; - this.Label64.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.Label64.Location = new System.Drawing.Point(4, 32); - this.Label64.Name = "Label64"; - this.Label64.Size = new System.Drawing.Size(451, 167); - this.Label64.TabIndex = 1; - this.Label64.Text = resources.GetString("Label64.Text"); - this.Label64.TextAlign = System.Drawing.ContentAlignment.TopCenter; - // - // Label63 - // - this.Label63.Font = new System.Drawing.Font("Microsoft Sans Serif", 20.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.Label63.Location = new System.Drawing.Point(72, 0); - this.Label63.Name = "Label63"; - this.Label63.Size = new System.Drawing.Size(332, 29); - this.Label63.TabIndex = 0; - this.Label63.Text = "Welcome to the Shifter!"; - // - // pnldesktopoptions - // - this.pnldesktopoptions.Anchor = ((ShiftUI.AnchorStyles)((((ShiftUI.AnchorStyles.Top | ShiftUI.AnchorStyles.Bottom) - | ShiftUI.AnchorStyles.Left) - | ShiftUI.AnchorStyles.Right))); - this.pnldesktopoptions.BackColor = System.Drawing.Color.White; - this.pnldesktopoptions.Widgets.Add(this.pnlapplauncheroptions); - this.pnldesktopoptions.Widgets.Add(this.pnldesktoppaneloptions); - this.pnldesktopoptions.Widgets.Add(this.pnldesktopintro); - this.pnldesktopoptions.Widgets.Add(this.pnlpanelbuttonsoptions); - this.pnldesktopoptions.Widgets.Add(this.pnldesktopbackgroundoptions); - this.pnldesktopoptions.Widgets.Add(this.pnlpanelclockoptions); - this.pnldesktopoptions.Widgets.Add(this.pnldesktoppreview); - this.pnldesktopoptions.Widgets.Add(this.Panel10); - this.pnldesktopoptions.Location = new System.Drawing.Point(134, 9); - this.pnldesktopoptions.Name = "pnldesktopoptions"; - this.pnldesktopoptions.Size = new System.Drawing.Size(457, 306); - this.pnldesktopoptions.TabIndex = 16; - this.pnldesktopoptions.Visible = false; - // - // pnldesktoppaneloptions - // - this.pnldesktoppaneloptions.Anchor = ((ShiftUI.AnchorStyles)((ShiftUI.AnchorStyles.Bottom | ShiftUI.AnchorStyles.Right))); - this.pnldesktoppaneloptions.Widgets.Add(this.btnpanelbuttons); - this.pnldesktoppaneloptions.Widgets.Add(this.lbwarning); - this.pnldesktoppaneloptions.Widgets.Add(this.combodesktoppanelposition); - this.pnldesktoppaneloptions.Widgets.Add(this.lbposition); - this.pnldesktoppaneloptions.Widgets.Add(this.Label47); - this.pnldesktoppaneloptions.Widgets.Add(this.txtdesktoppanelheight); - this.pnldesktoppaneloptions.Widgets.Add(this.lbheight); - this.pnldesktoppaneloptions.Widgets.Add(this.pnldesktoppanelcolour); - this.pnldesktoppaneloptions.Widgets.Add(this.lbpanelcolor); - this.pnldesktoppaneloptions.Location = new System.Drawing.Point(135, 159); - this.pnldesktoppaneloptions.Name = "pnldesktoppaneloptions"; - this.pnldesktoppaneloptions.Size = new System.Drawing.Size(317, 140); - this.pnldesktoppaneloptions.TabIndex = 9; - this.pnldesktoppaneloptions.Visible = false; - // - // btnpanelbuttons - // - this.btnpanelbuttons.BackColor = System.Drawing.Color.White; - this.btnpanelbuttons.FlatStyle = ShiftUI.FlatStyle.Standard; - this.btnpanelbuttons.Font = new System.Drawing.Font("Cambria", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.btnpanelbuttons.Location = new System.Drawing.Point(193, 101); - this.btnpanelbuttons.Name = "btnpanelbuttons"; - this.btnpanelbuttons.Size = new System.Drawing.Size(119, 29); - this.btnpanelbuttons.TabIndex = 8; - this.btnpanelbuttons.Text = "Panel Buttons >"; - this.btnpanelbuttons.UseVisualStyleBackColor = false; - this.btnpanelbuttons.Click += new System.EventHandler(this.btnpanelbuttons_Click); - // - // lbwarning - // - this.lbwarning.Location = new System.Drawing.Point(3, 52); - this.lbwarning.Name = "lbwarning"; - this.lbwarning.Size = new System.Drawing.Size(290, 42); - this.lbwarning.TabIndex = 8; - this.lbwarning.Text = "Warning: If you set the panel position to the bottom you must hide your windows t" + - "askbar and restart ShiftOS on your host operating system to prevent a visual bug" + - "."; - // - // combodesktoppanelposition - // - this.combodesktoppanelposition.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.combodesktoppanelposition.FormattingEnabled = true; - this.combodesktoppanelposition.Items.AddRange(new object[] { - "Top", - "Bottom"}); - this.combodesktoppanelposition.Location = new System.Drawing.Point(103, 28); - this.combodesktoppanelposition.Name = "combodesktoppanelposition"; - this.combodesktoppanelposition.Size = new System.Drawing.Size(59, 24); - this.combodesktoppanelposition.TabIndex = 7; - this.combodesktoppanelposition.SelectedIndexChanged += new System.EventHandler(this.combodesktoppanelposition_SelectedIndexChanged); - // - // lbposition - // - this.lbposition.AutoSize = true; - this.lbposition.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.lbposition.Location = new System.Drawing.Point(3, 31); - this.lbposition.Name = "lbposition"; - this.lbposition.Size = new System.Drawing.Size(97, 16); - this.lbposition.TabIndex = 6; - this.lbposition.Text = "Panel Position:"; - // - // Label47 - // - this.Label47.AutoSize = true; - this.Label47.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.Label47.Location = new System.Drawing.Point(226, 8); - this.Label47.Name = "Label47"; - this.Label47.Size = new System.Drawing.Size(22, 16); - this.Label47.TabIndex = 5; - this.Label47.Text = "px"; - // - // txtdesktoppanelheight - // - this.txtdesktoppanelheight.BackColor = System.Drawing.Color.White; - this.txtdesktoppanelheight.BorderStyle = ShiftUI.BorderStyle.FixedSingle; - this.txtdesktoppanelheight.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.txtdesktoppanelheight.ForeColor = System.Drawing.Color.Black; - this.txtdesktoppanelheight.Location = new System.Drawing.Point(189, 5); - this.txtdesktoppanelheight.Name = "txtdesktoppanelheight"; - this.txtdesktoppanelheight.Size = new System.Drawing.Size(37, 22); - this.txtdesktoppanelheight.TabIndex = 4; - this.txtdesktoppanelheight.TextChanged += new System.EventHandler(this.txtdesktoppanelheight_ValueChanged); - // - // lbheight - // - this.lbheight.AutoSize = true; - this.lbheight.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.lbheight.Location = new System.Drawing.Point(138, 7); - this.lbheight.Name = "lbheight"; - this.lbheight.Size = new System.Drawing.Size(50, 16); - this.lbheight.TabIndex = 2; - this.lbheight.Text = "Height:"; - // - // pnldesktoppanelcolour - // - this.pnldesktoppanelcolour.Location = new System.Drawing.Point(92, 5); - this.pnldesktoppanelcolour.Name = "pnldesktoppanelcolour"; - this.pnldesktoppanelcolour.Size = new System.Drawing.Size(41, 20); - this.pnldesktoppanelcolour.TabIndex = 1; - this.pnldesktoppanelcolour.MouseDown += new ShiftUI.MouseEventHandler(this.ChangeDesktopPanelColor); - // - // lbpanelcolor - // - this.lbpanelcolor.AutoSize = true; - this.lbpanelcolor.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.lbpanelcolor.Location = new System.Drawing.Point(3, 7); - this.lbpanelcolor.Name = "lbpanelcolor"; - this.lbpanelcolor.Size = new System.Drawing.Size(88, 16); - this.lbpanelcolor.TabIndex = 0; - this.lbpanelcolor.Text = "Panel Colour:"; - // - // pnlapplauncheroptions - // - this.pnlapplauncheroptions.Anchor = ((ShiftUI.AnchorStyles)((ShiftUI.AnchorStyles.Bottom | ShiftUI.AnchorStyles.Right))); - this.pnlapplauncheroptions.Widgets.Add(this.pnlalhover); - this.pnlapplauncheroptions.Widgets.Add(this.label119); - this.pnlapplauncheroptions.Widgets.Add(this.Label71); - this.pnlapplauncheroptions.Widgets.Add(this.txtapplauncherwidth); - this.pnlapplauncheroptions.Widgets.Add(this.Label72); - this.pnlapplauncheroptions.Widgets.Add(this.txtappbuttonlabel); - this.pnlapplauncheroptions.Widgets.Add(this.Label51); - this.pnlapplauncheroptions.Widgets.Add(this.Label50); - this.pnlapplauncheroptions.Widgets.Add(this.pnlmaintextcolour); - this.pnlapplauncheroptions.Widgets.Add(this.comboappbuttontextstyle); - this.pnlapplauncheroptions.Widgets.Add(this.comboappbuttontextfont); - this.pnlapplauncheroptions.Widgets.Add(this.Label37); - this.pnlapplauncheroptions.Widgets.Add(this.Label38); - this.pnlapplauncheroptions.Widgets.Add(this.txtappbuttontextsize); - this.pnlapplauncheroptions.Widgets.Add(this.Label39); - this.pnlapplauncheroptions.Widgets.Add(this.Label40); - this.pnlapplauncheroptions.Widgets.Add(this.pnlmainbuttonactivated); - this.pnlapplauncheroptions.Widgets.Add(this.Label28); - this.pnlapplauncheroptions.Widgets.Add(this.Label35); - this.pnlapplauncheroptions.Widgets.Add(this.txtapplicationsbuttonheight); - this.pnlapplauncheroptions.Widgets.Add(this.Label36); - this.pnlapplauncheroptions.Widgets.Add(this.pnlmainbuttoncolour); - this.pnlapplauncheroptions.Widgets.Add(this.Label43); - this.pnlapplauncheroptions.Location = new System.Drawing.Point(135, 159); - this.pnlapplauncheroptions.Name = "pnlapplauncheroptions"; - this.pnlapplauncheroptions.Size = new System.Drawing.Size(317, 140); - this.pnlapplauncheroptions.TabIndex = 10; - this.pnlapplauncheroptions.Visible = false; - // - // pnlalhover - // - this.pnlalhover.BorderStyle = ShiftUI.BorderStyle.FixedSingle; - this.pnlalhover.Location = new System.Drawing.Point(90, 29); - this.pnlalhover.Name = "pnlalhover"; - this.pnlalhover.Size = new System.Drawing.Size(41, 20); - this.pnlalhover.TabIndex = 3; - this.pnlalhover.MouseDown += new ShiftUI.MouseEventHandler(this.SetALHoverColor); - // - // label119 - // - this.label119.AutoSize = true; - this.label119.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.label119.Location = new System.Drawing.Point(3, 31); - this.label119.Name = "label119"; - this.label119.Size = new System.Drawing.Size(84, 16); - this.label119.TabIndex = 2; - this.label119.Text = "Mouse Over:"; - // - // Label71 - // - this.Label71.AutoSize = true; - this.Label71.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.Label71.Location = new System.Drawing.Point(203, 103); - this.Label71.Name = "Label71"; - this.Label71.Size = new System.Drawing.Size(22, 16); - this.Label71.TabIndex = 33; - this.Label71.Text = "px"; - // - // txtapplauncherwidth - // - this.txtapplauncherwidth.BackColor = System.Drawing.Color.White; - this.txtapplauncherwidth.BorderStyle = ShiftUI.BorderStyle.FixedSingle; - this.txtapplauncherwidth.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.txtapplauncherwidth.ForeColor = System.Drawing.Color.Black; - this.txtapplauncherwidth.Location = new System.Drawing.Point(148, 101); - this.txtapplauncherwidth.Name = "txtapplauncherwidth"; - this.txtapplauncherwidth.Size = new System.Drawing.Size(54, 22); - this.txtapplauncherwidth.TabIndex = 32; - this.txtapplauncherwidth.TextChanged += new System.EventHandler(this.txtapplauncherwidth_TextChanged); - // - // Label72 - // - this.Label72.AutoSize = true; - this.Label72.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.Label72.Location = new System.Drawing.Point(103, 103); - this.Label72.Name = "Label72"; - this.Label72.Size = new System.Drawing.Size(45, 16); - this.Label72.TabIndex = 31; - this.Label72.Text = "Width:"; - // - // txtappbuttonlabel - // - this.txtappbuttonlabel.BackColor = System.Drawing.Color.White; - this.txtappbuttonlabel.BorderStyle = ShiftUI.BorderStyle.FixedSingle; - this.txtappbuttonlabel.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.txtappbuttonlabel.ForeColor = System.Drawing.Color.Black; - this.txtappbuttonlabel.Location = new System.Drawing.Point(53, 76); - this.txtappbuttonlabel.Name = "txtappbuttonlabel"; - this.txtappbuttonlabel.Size = new System.Drawing.Size(81, 22); - this.txtappbuttonlabel.TabIndex = 30; - this.txtappbuttonlabel.TextChanged += new System.EventHandler(this.txtappbuttonlabel_KeyDown); - // - // Label51 - // - this.Label51.AutoSize = true; - this.Label51.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.Label51.Location = new System.Drawing.Point(2, 79); - this.Label51.Name = "Label51"; - this.Label51.Size = new System.Drawing.Size(45, 16); - this.Label51.TabIndex = 29; - this.Label51.Text = "Label:"; - // - // Label50 - // - this.Label50.AutoSize = true; - this.Label50.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.Label50.Location = new System.Drawing.Point(140, 79); - this.Label50.Name = "Label50"; - this.Label50.Size = new System.Drawing.Size(37, 16); - this.Label50.TabIndex = 28; - this.Label50.Text = "Font:"; - // - // pnlmaintextcolour - // - this.pnlmaintextcolour.BorderStyle = ShiftUI.BorderStyle.FixedSingle; - this.pnlmaintextcolour.Location = new System.Drawing.Point(155, 51); - this.pnlmaintextcolour.Name = "pnlmaintextcolour"; - this.pnlmaintextcolour.Size = new System.Drawing.Size(41, 20); - this.pnlmaintextcolour.TabIndex = 19; - this.pnlmaintextcolour.MouseDown += new ShiftUI.MouseEventHandler(this.SetAppLauncherTextColor); - // - // comboappbuttontextstyle - // - this.comboappbuttontextstyle.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.comboappbuttontextstyle.FormattingEnabled = true; - this.comboappbuttontextstyle.Items.AddRange(new object[] { - "Bold", - "Italic", - "Regular", - "Strikeout", - "Underline"}); - this.comboappbuttontextstyle.Location = new System.Drawing.Point(243, 49); - this.comboappbuttontextstyle.Name = "comboappbuttontextstyle"; - this.comboappbuttontextstyle.Size = new System.Drawing.Size(64, 24); - this.comboappbuttontextstyle.TabIndex = 27; - this.comboappbuttontextstyle.SelectedIndexChanged += new System.EventHandler(this.comboappbuttontextstyle_SelectedIndexChanged); - // - // comboappbuttontextfont - // - this.comboappbuttontextfont.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.comboappbuttontextfont.FormattingEnabled = true; - this.comboappbuttontextfont.Location = new System.Drawing.Point(181, 75); - this.comboappbuttontextfont.Name = "comboappbuttontextfont"; - this.comboappbuttontextfont.Size = new System.Drawing.Size(125, 24); - this.comboappbuttontextfont.TabIndex = 26; - this.comboappbuttontextfont.SelectedIndexChanged += new System.EventHandler(this.comboappbuttontextfont_SelectedIndexChanged); - // - // Label37 - // - this.Label37.AutoSize = true; - this.Label37.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.Label37.Location = new System.Drawing.Point(200, 52); - this.Label37.Name = "Label37"; - this.Label37.Size = new System.Drawing.Size(41, 16); - this.Label37.TabIndex = 25; - this.Label37.Text = "Style:"; - // - // Label38 - // - this.Label38.AutoSize = true; - this.Label38.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.Label38.Location = new System.Drawing.Point(75, 52); - this.Label38.Name = "Label38"; - this.Label38.Size = new System.Drawing.Size(22, 16); - this.Label38.TabIndex = 24; - this.Label38.Text = "px"; - // - // txtappbuttontextsize - // - this.txtappbuttontextsize.BackColor = System.Drawing.Color.White; - this.txtappbuttontextsize.BorderStyle = ShiftUI.BorderStyle.FixedSingle; - this.txtappbuttontextsize.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.txtappbuttontextsize.ForeColor = System.Drawing.Color.Black; - this.txtappbuttontextsize.Location = new System.Drawing.Point(51, 50); - this.txtappbuttontextsize.Name = "txtappbuttontextsize"; - this.txtappbuttontextsize.Size = new System.Drawing.Size(23, 22); - this.txtappbuttontextsize.TabIndex = 23; - this.txtappbuttontextsize.TextChanged += new System.EventHandler(this.txtappbuttontextsize_TextChanged); - // - // Label39 - // - this.Label39.AutoSize = true; - this.Label39.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.Label39.Location = new System.Drawing.Point(1, 52); - this.Label39.Name = "Label39"; - this.Label39.Size = new System.Drawing.Size(49, 16); - this.Label39.TabIndex = 22; - this.Label39.Text = "T Size:"; - // - // Label40 - // - this.Label40.AutoSize = true; - this.Label40.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.Label40.Location = new System.Drawing.Point(101, 53); - this.Label40.Name = "Label40"; - this.Label40.Size = new System.Drawing.Size(50, 16); - this.Label40.TabIndex = 21; - this.Label40.Text = "Colour:"; - // - // pnlmainbuttonactivated - // - this.pnlmainbuttonactivated.BorderStyle = ShiftUI.BorderStyle.FixedSingle; - this.pnlmainbuttonactivated.Location = new System.Drawing.Point(267, 6); - this.pnlmainbuttonactivated.Name = "pnlmainbuttonactivated"; - this.pnlmainbuttonactivated.Size = new System.Drawing.Size(41, 20); - this.pnlmainbuttonactivated.TabIndex = 16; - this.pnlmainbuttonactivated.MouseClick += new ShiftUI.MouseEventHandler(this.SetALButtonClickedColor); - // - // Label28 - // - this.Label28.AutoSize = true; - this.Label28.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.Label28.Location = new System.Drawing.Point(177, 7); - this.Label28.Name = "Label28"; - this.Label28.Size = new System.Drawing.Size(67, 16); - this.Label28.TabIndex = 15; - this.Label28.Text = "Activated:"; - // - // Label35 - // - this.Label35.AutoSize = true; - this.Label35.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.Label35.Location = new System.Drawing.Point(77, 103); - this.Label35.Name = "Label35"; - this.Label35.Size = new System.Drawing.Size(22, 16); - this.Label35.TabIndex = 14; - this.Label35.Text = "px"; - // - // txtapplicationsbuttonheight - // - this.txtapplicationsbuttonheight.BackColor = System.Drawing.Color.White; - this.txtapplicationsbuttonheight.BorderStyle = ShiftUI.BorderStyle.FixedSingle; - this.txtapplicationsbuttonheight.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.txtapplicationsbuttonheight.ForeColor = System.Drawing.Color.Black; - this.txtapplicationsbuttonheight.Location = new System.Drawing.Point(53, 101); - this.txtapplicationsbuttonheight.Name = "txtapplicationsbuttonheight"; - this.txtapplicationsbuttonheight.Size = new System.Drawing.Size(23, 22); - this.txtapplicationsbuttonheight.TabIndex = 13; - this.txtapplicationsbuttonheight.TextChanged += new System.EventHandler(this.txtapplicationsbuttonheight_TextChanged); - // - // Label36 - // - this.Label36.AutoSize = true; - this.Label36.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.Label36.Location = new System.Drawing.Point(2, 103); - this.Label36.Name = "Label36"; - this.Label36.Size = new System.Drawing.Size(50, 16); - this.Label36.TabIndex = 12; - this.Label36.Text = "Height:"; - // - // pnlmainbuttoncolour - // - this.pnlmainbuttoncolour.BorderStyle = ShiftUI.BorderStyle.FixedSingle; - this.pnlmainbuttoncolour.Location = new System.Drawing.Point(128, 4); - this.pnlmainbuttoncolour.Name = "pnlmainbuttoncolour"; - this.pnlmainbuttoncolour.Size = new System.Drawing.Size(41, 20); - this.pnlmainbuttoncolour.TabIndex = 1; - this.pnlmainbuttoncolour.MouseDown += new ShiftUI.MouseEventHandler(this.SetALButtonColor); - // - // Label43 - // - this.Label43.AutoSize = true; - this.Label43.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.Label43.Location = new System.Drawing.Point(3, 7); - this.Label43.Name = "Label43"; - this.Label43.Size = new System.Drawing.Size(122, 16); - this.Label43.TabIndex = 0; - this.Label43.Text = "Main Button Colour:"; - // - // pnldesktopintro - // - this.pnldesktopintro.Anchor = ((ShiftUI.AnchorStyles)((ShiftUI.AnchorStyles.Bottom | ShiftUI.AnchorStyles.Right))); - this.pnldesktopintro.Widgets.Add(this.Label69); - this.pnldesktopintro.Widgets.Add(this.Label70); - this.pnldesktopintro.Location = new System.Drawing.Point(135, 159); - this.pnldesktopintro.Name = "pnldesktopintro"; - this.pnldesktopintro.Size = new System.Drawing.Size(317, 140); - this.pnldesktopintro.TabIndex = 17; - // - // Label69 - // - this.Label69.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.Label69.Location = new System.Drawing.Point(3, 20); - this.Label69.Name = "Label69"; - this.Label69.Size = new System.Drawing.Size(312, 113); - this.Label69.TabIndex = 1; - this.Label69.Text = "The Desktop Settings allow you to customize various desktop-related settings such" + - " as the desktop background. Go ahead and explore!"; - this.Label69.TextAlign = System.Drawing.ContentAlignment.TopCenter; - // - // Label70 - // - this.Label70.AutoSize = true; - this.Label70.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.Label70.Location = new System.Drawing.Point(86, -2); - this.Label70.Name = "Label70"; - this.Label70.Size = new System.Drawing.Size(148, 20); - this.Label70.TabIndex = 0; - this.Label70.Text = "Desktop Settings"; - // - // pnlpanelbuttonsoptions - // - this.pnlpanelbuttonsoptions.Anchor = ((ShiftUI.AnchorStyles)((ShiftUI.AnchorStyles.Bottom | ShiftUI.AnchorStyles.Right))); - this.pnlpanelbuttonsoptions.Widgets.Add(this.pnlpanelbuttontextcolour); - this.pnlpanelbuttonsoptions.Widgets.Add(this.Label101); - this.pnlpanelbuttonsoptions.Widgets.Add(this.txtpanelbuttontexttop); - this.pnlpanelbuttonsoptions.Widgets.Add(this.Label104); - this.pnlpanelbuttonsoptions.Widgets.Add(this.txtpanelbuttontextside); - this.pnlpanelbuttonsoptions.Widgets.Add(this.Label106); - this.pnlpanelbuttonsoptions.Widgets.Add(this.Label93); - this.pnlpanelbuttonsoptions.Widgets.Add(this.txtpanelbuttontop); - this.pnlpanelbuttonsoptions.Widgets.Add(this.Label94); - this.pnlpanelbuttonsoptions.Widgets.Add(this.txtpanelbuttoninitalgap); - this.pnlpanelbuttonsoptions.Widgets.Add(this.Label108); - this.pnlpanelbuttonsoptions.Widgets.Add(this.txtpanelbuttonicontop); - this.pnlpanelbuttonsoptions.Widgets.Add(this.Label110); - this.pnlpanelbuttonsoptions.Widgets.Add(this.txtpanelbuttoniconside); - this.pnlpanelbuttonsoptions.Widgets.Add(this.Label112); - this.pnlpanelbuttonsoptions.Widgets.Add(this.txtpanelbuttoniconsize); - this.pnlpanelbuttonsoptions.Widgets.Add(this.Label105); - this.pnlpanelbuttonsoptions.Widgets.Add(this.cbpanelbuttontextstyle); - this.pnlpanelbuttonsoptions.Widgets.Add(this.cbpanelbuttonfont); - this.pnlpanelbuttonsoptions.Widgets.Add(this.Label100); - this.pnlpanelbuttonsoptions.Widgets.Add(this.txtpaneltextbuttonsize); - this.pnlpanelbuttonsoptions.Widgets.Add(this.Label102); - this.pnlpanelbuttonsoptions.Widgets.Add(this.Label103); - this.pnlpanelbuttonsoptions.Widgets.Add(this.Label98); - this.pnlpanelbuttonsoptions.Widgets.Add(this.txtpanelbuttongap); - this.pnlpanelbuttonsoptions.Widgets.Add(this.Label99); - this.pnlpanelbuttonsoptions.Widgets.Add(this.Label96); - this.pnlpanelbuttonsoptions.Widgets.Add(this.txtpanelbuttonheight); - this.pnlpanelbuttonsoptions.Widgets.Add(this.Label97); - this.pnlpanelbuttonsoptions.Widgets.Add(this.Label92); - this.pnlpanelbuttonsoptions.Widgets.Add(this.txtpanelbuttonwidth); - this.pnlpanelbuttonsoptions.Widgets.Add(this.Label91); - this.pnlpanelbuttonsoptions.Widgets.Add(this.pnlpanelbuttoncolour); - this.pnlpanelbuttonsoptions.Widgets.Add(this.Label95); - this.pnlpanelbuttonsoptions.Location = new System.Drawing.Point(135, 159); - this.pnlpanelbuttonsoptions.Name = "pnlpanelbuttonsoptions"; - this.pnlpanelbuttonsoptions.Size = new System.Drawing.Size(317, 140); - this.pnlpanelbuttonsoptions.TabIndex = 10; - this.pnlpanelbuttonsoptions.Visible = false; - // - // pnlpanelbuttontextcolour - // - this.pnlpanelbuttontextcolour.BorderStyle = ShiftUI.BorderStyle.FixedSingle; - this.pnlpanelbuttontextcolour.Location = new System.Drawing.Point(270, 57); - this.pnlpanelbuttontextcolour.Name = "pnlpanelbuttontextcolour"; - this.pnlpanelbuttontextcolour.Size = new System.Drawing.Size(41, 20); - this.pnlpanelbuttontextcolour.TabIndex = 50; - this.pnlpanelbuttontextcolour.MouseClick += new ShiftUI.MouseEventHandler(this.SetPanelButtonTextColor); - // - // Label101 - // - this.Label101.AutoSize = true; - this.Label101.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.Label101.Location = new System.Drawing.Point(219, 59); - this.Label101.Name = "Label101"; - this.Label101.Size = new System.Drawing.Size(50, 16); - this.Label101.TabIndex = 49; - this.Label101.Text = "Colour:"; - // - // txtpanelbuttontexttop - // - this.txtpanelbuttontexttop.BackColor = System.Drawing.Color.White; - this.txtpanelbuttontexttop.BorderStyle = ShiftUI.BorderStyle.FixedSingle; - this.txtpanelbuttontexttop.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.txtpanelbuttontexttop.ForeColor = System.Drawing.Color.Black; - this.txtpanelbuttontexttop.Location = new System.Drawing.Point(225, 82); - this.txtpanelbuttontexttop.Name = "txtpanelbuttontexttop"; - this.txtpanelbuttontexttop.Size = new System.Drawing.Size(23, 22); - this.txtpanelbuttontexttop.TabIndex = 48; - this.txtpanelbuttontexttop.TextChanged += new System.EventHandler(this.txtpanelbuttontexttop_TextChanged); - // - // Label104 - // - this.Label104.AutoSize = true; - this.Label104.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.Label104.Location = new System.Drawing.Point(191, 84); - this.Label104.Name = "Label104"; - this.Label104.Size = new System.Drawing.Size(36, 16); - this.Label104.TabIndex = 47; - this.Label104.Text = "Top:"; - // - // txtpanelbuttontextside - // - this.txtpanelbuttontextside.BackColor = System.Drawing.Color.White; - this.txtpanelbuttontextside.BorderStyle = ShiftUI.BorderStyle.FixedSingle; - this.txtpanelbuttontextside.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.txtpanelbuttontextside.ForeColor = System.Drawing.Color.Black; - this.txtpanelbuttontextside.Location = new System.Drawing.Point(165, 82); - this.txtpanelbuttontextside.Name = "txtpanelbuttontextside"; - this.txtpanelbuttontextside.Size = new System.Drawing.Size(23, 22); - this.txtpanelbuttontextside.TabIndex = 46; - this.txtpanelbuttontextside.TextChanged += new System.EventHandler(this.txtpanelbuttontextside_TextChanged); - // - // Label106 - // - this.Label106.AutoSize = true; - this.Label106.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.Label106.Location = new System.Drawing.Point(128, 84); - this.Label106.Name = "Label106"; - this.Label106.Size = new System.Drawing.Size(39, 16); - this.Label106.TabIndex = 45; - this.Label106.Text = "Side:"; - // - // Label93 - // - this.Label93.AutoSize = true; - this.Label93.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.Label93.Location = new System.Drawing.Point(292, 7); - this.Label93.Name = "Label93"; - this.Label93.Size = new System.Drawing.Size(22, 16); - this.Label93.TabIndex = 43; - this.Label93.Text = "px"; - // - // txtpanelbuttontop - // - this.txtpanelbuttontop.BackColor = System.Drawing.Color.White; - this.txtpanelbuttontop.BorderStyle = ShiftUI.BorderStyle.FixedSingle; - this.txtpanelbuttontop.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.txtpanelbuttontop.ForeColor = System.Drawing.Color.Black; - this.txtpanelbuttontop.Location = new System.Drawing.Point(268, 5); - this.txtpanelbuttontop.Name = "txtpanelbuttontop"; - this.txtpanelbuttontop.Size = new System.Drawing.Size(23, 22); - this.txtpanelbuttontop.TabIndex = 42; - this.txtpanelbuttontop.TextChanged += new System.EventHandler(this.txtpanelbuttontop_TextChanged); - // - // Label94 - // - this.Label94.AutoSize = true; - this.Label94.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.Label94.Location = new System.Drawing.Point(233, 7); - this.Label94.Name = "Label94"; - this.Label94.Size = new System.Drawing.Size(36, 16); - this.Label94.TabIndex = 41; - this.Label94.Text = "Top:"; - // - // txtpanelbuttoninitalgap - // - this.txtpanelbuttoninitalgap.BackColor = System.Drawing.Color.White; - this.txtpanelbuttoninitalgap.BorderStyle = ShiftUI.BorderStyle.FixedSingle; - this.txtpanelbuttoninitalgap.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.txtpanelbuttoninitalgap.ForeColor = System.Drawing.Color.Black; - this.txtpanelbuttoninitalgap.Location = new System.Drawing.Point(207, 5); - this.txtpanelbuttoninitalgap.Name = "txtpanelbuttoninitalgap"; - this.txtpanelbuttoninitalgap.Size = new System.Drawing.Size(23, 22); - this.txtpanelbuttoninitalgap.TabIndex = 40; - this.txtpanelbuttoninitalgap.TextChanged += new System.EventHandler(this.txtpanelbuttoninitalgap_TextChanged); - // - // Label108 - // - this.Label108.AutoSize = true; - this.Label108.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.Label108.Location = new System.Drawing.Point(137, 7); - this.Label108.Name = "Label108"; - this.Label108.Size = new System.Drawing.Size(70, 16); - this.Label108.TabIndex = 39; - this.Label108.Text = "Initial Gap:"; - // - // txtpanelbuttonicontop - // - this.txtpanelbuttonicontop.BackColor = System.Drawing.Color.White; - this.txtpanelbuttonicontop.BorderStyle = ShiftUI.BorderStyle.FixedSingle; - this.txtpanelbuttonicontop.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.txtpanelbuttonicontop.ForeColor = System.Drawing.Color.Black; - this.txtpanelbuttonicontop.Location = new System.Drawing.Point(287, 108); - this.txtpanelbuttonicontop.Name = "txtpanelbuttonicontop"; - this.txtpanelbuttonicontop.Size = new System.Drawing.Size(23, 22); - this.txtpanelbuttonicontop.TabIndex = 37; - this.txtpanelbuttonicontop.TextChanged += new System.EventHandler(this.txtpanelbuttonicontop_TextChanged); - // - // Label110 - // - this.Label110.AutoSize = true; - this.Label110.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.Label110.Location = new System.Drawing.Point(221, 110); - this.Label110.Name = "Label110"; - this.Label110.Size = new System.Drawing.Size(64, 16); - this.Label110.TabIndex = 36; - this.Label110.Text = "Icon Top:"; - // - // txtpanelbuttoniconside - // - this.txtpanelbuttoniconside.BackColor = System.Drawing.Color.White; - this.txtpanelbuttoniconside.BorderStyle = ShiftUI.BorderStyle.FixedSingle; - this.txtpanelbuttoniconside.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.txtpanelbuttoniconside.ForeColor = System.Drawing.Color.Black; - this.txtpanelbuttoniconside.Location = new System.Drawing.Point(180, 108); - this.txtpanelbuttoniconside.Name = "txtpanelbuttoniconside"; - this.txtpanelbuttoniconside.Size = new System.Drawing.Size(23, 22); - this.txtpanelbuttoniconside.TabIndex = 34; - this.txtpanelbuttoniconside.TextChanged += new System.EventHandler(this.txtpanelbuttoniconside_TextChanged); - // - // Label112 - // - this.Label112.AutoSize = true; - this.Label112.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.Label112.Location = new System.Drawing.Point(113, 110); - this.Label112.Name = "Label112"; - this.Label112.Size = new System.Drawing.Size(67, 16); - this.Label112.TabIndex = 33; - this.Label112.Text = "Icon Side:"; - // - // txtpanelbuttoniconsize - // - this.txtpanelbuttoniconsize.BackColor = System.Drawing.Color.White; - this.txtpanelbuttoniconsize.BorderStyle = ShiftUI.BorderStyle.FixedSingle; - this.txtpanelbuttoniconsize.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.txtpanelbuttoniconsize.ForeColor = System.Drawing.Color.Black; - this.txtpanelbuttoniconsize.Location = new System.Drawing.Point(70, 108); - this.txtpanelbuttoniconsize.Name = "txtpanelbuttoniconsize"; - this.txtpanelbuttoniconsize.Size = new System.Drawing.Size(23, 22); - this.txtpanelbuttoniconsize.TabIndex = 27; - this.txtpanelbuttoniconsize.TextChanged += new System.EventHandler(this.txtpanelbuttoniconsize_TextChanged); - // - // Label105 - // - this.Label105.AutoSize = true; - this.Label105.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.Label105.Location = new System.Drawing.Point(3, 110); - this.Label105.Name = "Label105"; - this.Label105.Size = new System.Drawing.Size(65, 16); - this.Label105.TabIndex = 26; - this.Label105.Text = "Icon Size:"; - // - // cbpanelbuttontextstyle - // - this.cbpanelbuttontextstyle.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.cbpanelbuttontextstyle.FormattingEnabled = true; - this.cbpanelbuttontextstyle.Items.AddRange(new object[] { - "Bold", - "Italic", - "Regular", - "Strikeout", - "Underline"}); - this.cbpanelbuttontextstyle.Location = new System.Drawing.Point(46, 83); - this.cbpanelbuttontextstyle.Name = "cbpanelbuttontextstyle"; - this.cbpanelbuttontextstyle.Size = new System.Drawing.Size(80, 24); - this.cbpanelbuttontextstyle.TabIndex = 25; - this.cbpanelbuttontextstyle.SelectedIndexChanged += new System.EventHandler(this.cbpanelbuttontextstyle_SelectedIndexChanged); - // - // cbpanelbuttonfont - // - this.cbpanelbuttonfont.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.cbpanelbuttonfont.FormattingEnabled = true; - this.cbpanelbuttonfont.Location = new System.Drawing.Point(70, 56); - this.cbpanelbuttonfont.Name = "cbpanelbuttonfont"; - this.cbpanelbuttonfont.Size = new System.Drawing.Size(147, 24); - this.cbpanelbuttonfont.TabIndex = 24; - this.cbpanelbuttonfont.SelectedIndexChanged += new System.EventHandler(this.cbpanelbuttonfont_SelectedIndexChanged); - // - // Label100 - // - this.Label100.AutoSize = true; - this.Label100.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.Label100.Location = new System.Drawing.Point(3, 86); - this.Label100.Name = "Label100"; - this.Label100.Size = new System.Drawing.Size(41, 16); - this.Label100.TabIndex = 23; - this.Label100.Text = "Style:"; - // - // txtpaneltextbuttonsize - // - this.txtpaneltextbuttonsize.BackColor = System.Drawing.Color.White; - this.txtpaneltextbuttonsize.BorderStyle = ShiftUI.BorderStyle.FixedSingle; - this.txtpaneltextbuttonsize.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.txtpaneltextbuttonsize.ForeColor = System.Drawing.Color.Black; - this.txtpaneltextbuttonsize.Location = new System.Drawing.Point(287, 82); - this.txtpaneltextbuttonsize.Name = "txtpaneltextbuttonsize"; - this.txtpaneltextbuttonsize.Size = new System.Drawing.Size(23, 22); - this.txtpaneltextbuttonsize.TabIndex = 21; - this.txtpaneltextbuttonsize.TextChanged += new System.EventHandler(this.txtpaneltextbuttonsize_TextChanged); - // - // Label102 - // - this.Label102.AutoSize = true; - this.Label102.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.Label102.Location = new System.Drawing.Point(252, 84); - this.Label102.Name = "Label102"; - this.Label102.Size = new System.Drawing.Size(37, 16); - this.Label102.TabIndex = 20; - this.Label102.Text = "Size:"; - // - // Label103 - // - this.Label103.AutoSize = true; - this.Label103.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.Label103.Location = new System.Drawing.Point(3, 60); - this.Label103.Name = "Label103"; - this.Label103.Size = new System.Drawing.Size(66, 16); - this.Label103.TabIndex = 19; - this.Label103.Text = "Text Font:"; - // - // Label98 - // - this.Label98.AutoSize = true; - this.Label98.BackColor = System.Drawing.Color.Transparent; - this.Label98.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.Label98.Location = new System.Drawing.Point(292, 33); - this.Label98.Name = "Label98"; - this.Label98.Size = new System.Drawing.Size(22, 16); - this.Label98.TabIndex = 14; - this.Label98.Text = "px"; - // - // txtpanelbuttongap - // - this.txtpanelbuttongap.BackColor = System.Drawing.Color.White; - this.txtpanelbuttongap.BorderStyle = ShiftUI.BorderStyle.FixedSingle; - this.txtpanelbuttongap.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.txtpanelbuttongap.ForeColor = System.Drawing.Color.Black; - this.txtpanelbuttongap.Location = new System.Drawing.Point(268, 31); - this.txtpanelbuttongap.Name = "txtpanelbuttongap"; - this.txtpanelbuttongap.Size = new System.Drawing.Size(23, 22); - this.txtpanelbuttongap.TabIndex = 13; - this.txtpanelbuttongap.TextChanged += new System.EventHandler(this.txtpanelbuttongap_TextChanged); - // - // Label99 - // - this.Label99.AutoSize = true; - this.Label99.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.Label99.Location = new System.Drawing.Point(232, 33); - this.Label99.Name = "Label99"; - this.Label99.Size = new System.Drawing.Size(37, 16); - this.Label99.TabIndex = 12; - this.Label99.Text = "Gap:"; - // - // Label96 - // - this.Label96.AutoSize = true; - this.Label96.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.Label96.Location = new System.Drawing.Point(209, 34); - this.Label96.Name = "Label96"; - this.Label96.Size = new System.Drawing.Size(22, 16); - this.Label96.TabIndex = 11; - this.Label96.Text = "px"; - // - // txtpanelbuttonheight - // - this.txtpanelbuttonheight.BackColor = System.Drawing.Color.White; - this.txtpanelbuttonheight.BorderStyle = ShiftUI.BorderStyle.FixedSingle; - this.txtpanelbuttonheight.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.txtpanelbuttonheight.ForeColor = System.Drawing.Color.Black; - this.txtpanelbuttonheight.Location = new System.Drawing.Point(185, 32); - this.txtpanelbuttonheight.Name = "txtpanelbuttonheight"; - this.txtpanelbuttonheight.Size = new System.Drawing.Size(23, 22); - this.txtpanelbuttonheight.TabIndex = 10; - this.txtpanelbuttonheight.TextChanged += new System.EventHandler(this.txtpanelbuttonheight_TextChanged); - // - // Label97 - // - this.Label97.AutoSize = true; - this.Label97.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.Label97.Location = new System.Drawing.Point(135, 34); - this.Label97.Name = "Label97"; - this.Label97.Size = new System.Drawing.Size(50, 16); - this.Label97.TabIndex = 9; - this.Label97.Text = "Height:"; - // - // Label92 - // - this.Label92.AutoSize = true; - this.Label92.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.Label92.Location = new System.Drawing.Point(114, 33); - this.Label92.Name = "Label92"; - this.Label92.Size = new System.Drawing.Size(22, 16); - this.Label92.TabIndex = 8; - this.Label92.Text = "px"; - // - // txtpanelbuttonwidth - // - this.txtpanelbuttonwidth.BackColor = System.Drawing.Color.White; - this.txtpanelbuttonwidth.BorderStyle = ShiftUI.BorderStyle.FixedSingle; - this.txtpanelbuttonwidth.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.txtpanelbuttonwidth.ForeColor = System.Drawing.Color.Black; - this.txtpanelbuttonwidth.Location = new System.Drawing.Point(88, 31); - this.txtpanelbuttonwidth.Name = "txtpanelbuttonwidth"; - this.txtpanelbuttonwidth.Size = new System.Drawing.Size(26, 22); - this.txtpanelbuttonwidth.TabIndex = 7; - this.txtpanelbuttonwidth.TextChanged += new System.EventHandler(this.txtpanelbuttonwidth_TextChanged); - // - // Label91 - // - this.Label91.AutoSize = true; - this.Label91.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.Label91.Location = new System.Drawing.Point(3, 33); - this.Label91.Name = "Label91"; - this.Label91.Size = new System.Drawing.Size(85, 16); - this.Label91.TabIndex = 6; - this.Label91.Text = "Button Width:"; - // - // pnlpanelbuttoncolour - // - this.pnlpanelbuttoncolour.BorderStyle = ShiftUI.BorderStyle.FixedSingle; - this.pnlpanelbuttoncolour.Location = new System.Drawing.Point(94, 5); - this.pnlpanelbuttoncolour.Name = "pnlpanelbuttoncolour"; - this.pnlpanelbuttoncolour.Size = new System.Drawing.Size(41, 20); - this.pnlpanelbuttoncolour.TabIndex = 1; - this.pnlpanelbuttoncolour.MouseClick += new ShiftUI.MouseEventHandler(this.SetPanelButtonColor); - // - // Label95 - // - this.Label95.AutoSize = true; - this.Label95.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.Label95.Location = new System.Drawing.Point(3, 7); - this.Label95.Name = "Label95"; - this.Label95.Size = new System.Drawing.Size(90, 16); - this.Label95.TabIndex = 0; - this.Label95.Text = "Button Colour:"; - // - // pnldesktopbackgroundoptions - // - this.pnldesktopbackgroundoptions.Anchor = ((ShiftUI.AnchorStyles)((ShiftUI.AnchorStyles.Bottom | ShiftUI.AnchorStyles.Right))); - this.pnldesktopbackgroundoptions.Widgets.Add(this.pnldesktopcolour); - this.pnldesktopbackgroundoptions.Widgets.Add(this.Label45); - this.pnldesktopbackgroundoptions.Location = new System.Drawing.Point(135, 159); - this.pnldesktopbackgroundoptions.Name = "pnldesktopbackgroundoptions"; - this.pnldesktopbackgroundoptions.Size = new System.Drawing.Size(317, 140); - this.pnldesktopbackgroundoptions.TabIndex = 10; - this.pnldesktopbackgroundoptions.Visible = false; - // - // pnldesktopcolour - // - this.pnldesktopcolour.BackgroundImageLayout = ShiftUI.ImageLayout.Stretch; - this.pnldesktopcolour.BorderStyle = ShiftUI.BorderStyle.FixedSingle; - this.pnldesktopcolour.Location = new System.Drawing.Point(112, 5); - this.pnldesktopcolour.Name = "pnldesktopcolour"; - this.pnldesktopcolour.Size = new System.Drawing.Size(41, 20); - this.pnldesktopcolour.TabIndex = 3; - this.pnldesktopcolour.MouseClick += new ShiftUI.MouseEventHandler(this.ChangeDesktopBackground); - // - // Label45 - // - this.Label45.AutoSize = true; - this.Label45.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.Label45.Location = new System.Drawing.Point(3, 7); - this.Label45.Name = "Label45"; - this.Label45.Size = new System.Drawing.Size(104, 16); - this.Label45.TabIndex = 2; - this.Label45.Text = "Desktop Colour:"; - // - // pnlpanelclockoptions - // - this.pnlpanelclockoptions.Anchor = ((ShiftUI.AnchorStyles)((ShiftUI.AnchorStyles.Bottom | ShiftUI.AnchorStyles.Right))); - this.pnlpanelclockoptions.Widgets.Add(this.pnlclockbackgroundcolour); - this.pnlpanelclockoptions.Widgets.Add(this.Label44); - this.pnlpanelclockoptions.Widgets.Add(this.comboclocktextstyle); - this.pnlpanelclockoptions.Widgets.Add(this.comboclocktextfont); - this.pnlpanelclockoptions.Widgets.Add(this.Label26); - this.pnlpanelclockoptions.Widgets.Add(this.Label29); - this.pnlpanelclockoptions.Widgets.Add(this.txtclocktextfromtop); - this.pnlpanelclockoptions.Widgets.Add(this.Label30); - this.pnlpanelclockoptions.Widgets.Add(this.Label31); - this.pnlpanelclockoptions.Widgets.Add(this.txtclocktextsize); - this.pnlpanelclockoptions.Widgets.Add(this.Label32); - this.pnlpanelclockoptions.Widgets.Add(this.Label33); - this.pnlpanelclockoptions.Widgets.Add(this.pnlpanelclocktextcolour); - this.pnlpanelclockoptions.Widgets.Add(this.Label34); - this.pnlpanelclockoptions.Location = new System.Drawing.Point(135, 159); - this.pnlpanelclockoptions.Name = "pnlpanelclockoptions"; - this.pnlpanelclockoptions.Size = new System.Drawing.Size(317, 140); - this.pnlpanelclockoptions.TabIndex = 15; - this.pnlpanelclockoptions.Visible = false; - // - // pnlclockbackgroundcolour - // - this.pnlclockbackgroundcolour.BorderStyle = ShiftUI.BorderStyle.FixedSingle; - this.pnlclockbackgroundcolour.Location = new System.Drawing.Point(261, 5); - this.pnlclockbackgroundcolour.Name = "pnlclockbackgroundcolour"; - this.pnlclockbackgroundcolour.Size = new System.Drawing.Size(41, 20); - this.pnlclockbackgroundcolour.TabIndex = 20; - this.pnlclockbackgroundcolour.MouseClick += new ShiftUI.MouseEventHandler(this.SetClockBG); - // - // Label44 - // - this.Label44.AutoSize = true; - this.Label44.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.Label44.Location = new System.Drawing.Point(173, 7); - this.Label44.Name = "Label44"; - this.Label44.Size = new System.Drawing.Size(84, 16); - this.Label44.TabIndex = 19; - this.Label44.Text = "Background:"; - // - // comboclocktextstyle - // - this.comboclocktextstyle.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.comboclocktextstyle.FormattingEnabled = true; - this.comboclocktextstyle.Items.AddRange(new object[] { - "Bold", - "Italic", - "Regular", - "Strikeout", - "Underline"}); - this.comboclocktextstyle.Location = new System.Drawing.Point(209, 54); - this.comboclocktextstyle.Name = "comboclocktextstyle"; - this.comboclocktextstyle.Size = new System.Drawing.Size(99, 24); - this.comboclocktextstyle.TabIndex = 18; - this.comboclocktextstyle.SelectedIndexChanged += new System.EventHandler(this.comboclocktextstyle_SelectedIndexChanged); - // - // comboclocktextfont - // - this.comboclocktextfont.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.comboclocktextfont.FormattingEnabled = true; - this.comboclocktextfont.Location = new System.Drawing.Point(114, 28); - this.comboclocktextfont.Name = "comboclocktextfont"; - this.comboclocktextfont.Size = new System.Drawing.Size(192, 24); - this.comboclocktextfont.TabIndex = 17; - this.comboclocktextfont.SelectedIndexChanged += new System.EventHandler(this.comboclocktextfont_SelectedIndexChanged); - // - // Label26 - // - this.Label26.AutoSize = true; - this.Label26.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.Label26.Location = new System.Drawing.Point(166, 57); - this.Label26.Name = "Label26"; - this.Label26.Size = new System.Drawing.Size(41, 16); - this.Label26.TabIndex = 15; - this.Label26.Text = "Style:"; - // - // Label29 - // - this.Label29.AutoSize = true; - this.Label29.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.Label29.Location = new System.Drawing.Point(163, 82); - this.Label29.Name = "Label29"; - this.Label29.Size = new System.Drawing.Size(22, 16); - this.Label29.TabIndex = 11; - this.Label29.Text = "px"; - // - // txtclocktextfromtop - // - this.txtclocktextfromtop.BackColor = System.Drawing.Color.White; - this.txtclocktextfromtop.BorderStyle = ShiftUI.BorderStyle.FixedSingle; - this.txtclocktextfromtop.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.txtclocktextfromtop.ForeColor = System.Drawing.Color.Black; - this.txtclocktextfromtop.Location = new System.Drawing.Point(139, 80); - this.txtclocktextfromtop.Name = "txtclocktextfromtop"; - this.txtclocktextfromtop.Size = new System.Drawing.Size(23, 22); - this.txtclocktextfromtop.TabIndex = 10; - this.txtclocktextfromtop.TextChanged += new System.EventHandler(this.txtclocktextfromtop_TextChanged); - // - // Label30 - // - this.Label30.AutoSize = true; - this.Label30.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.Label30.Location = new System.Drawing.Point(3, 82); - this.Label30.Name = "Label30"; - this.Label30.Size = new System.Drawing.Size(136, 16); - this.Label30.TabIndex = 9; - this.Label30.Text = "Clock Text From Top:"; - // - // Label31 - // - this.Label31.AutoSize = true; - this.Label31.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.Label31.Location = new System.Drawing.Point(138, 57); - this.Label31.Name = "Label31"; - this.Label31.Size = new System.Drawing.Size(22, 16); - this.Label31.TabIndex = 8; - this.Label31.Text = "px"; - // - // txtclocktextsize - // - this.txtclocktextsize.BackColor = System.Drawing.Color.White; - this.txtclocktextsize.BorderStyle = ShiftUI.BorderStyle.FixedSingle; - this.txtclocktextsize.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.txtclocktextsize.ForeColor = System.Drawing.Color.Black; - this.txtclocktextsize.Location = new System.Drawing.Point(114, 55); - this.txtclocktextsize.Name = "txtclocktextsize"; - this.txtclocktextsize.Size = new System.Drawing.Size(23, 22); - this.txtclocktextsize.TabIndex = 7; - this.txtclocktextsize.Validated += new System.EventHandler(this.txtclocktextsize_TextChanged); - // - // Label32 - // - this.Label32.AutoSize = true; - this.Label32.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.Label32.Location = new System.Drawing.Point(3, 57); - this.Label32.Name = "Label32"; - this.Label32.Size = new System.Drawing.Size(103, 16); - this.Label32.TabIndex = 6; - this.Label32.Text = "Clock Text Size:"; - // - // Label33 - // - this.Label33.AutoSize = true; - this.Label33.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.Label33.Location = new System.Drawing.Point(3, 32); - this.Label33.Name = "Label33"; - this.Label33.Size = new System.Drawing.Size(103, 16); - this.Label33.TabIndex = 2; - this.Label33.Text = "Clock Text Font:"; - // - // pnlpanelclocktextcolour - // - this.pnlpanelclocktextcolour.BorderStyle = ShiftUI.BorderStyle.FixedSingle; - this.pnlpanelclocktextcolour.Location = new System.Drawing.Point(121, 5); - this.pnlpanelclocktextcolour.Name = "pnlpanelclocktextcolour"; - this.pnlpanelclocktextcolour.Size = new System.Drawing.Size(41, 20); - this.pnlpanelclocktextcolour.TabIndex = 1; - this.pnlpanelclocktextcolour.MouseClick += new ShiftUI.MouseEventHandler(this.SetClockTextColor); - // - // Label34 - // - this.Label34.AutoSize = true; - this.Label34.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.Label34.Location = new System.Drawing.Point(3, 7); - this.Label34.Name = "Label34"; - this.Label34.Size = new System.Drawing.Size(116, 16); - this.Label34.TabIndex = 0; - this.Label34.Text = "Clock Text Colour:"; - // - // pnldesktoppreview - // - this.pnldesktoppreview.Anchor = ((ShiftUI.AnchorStyles)((((ShiftUI.AnchorStyles.Top | ShiftUI.AnchorStyles.Bottom) - | ShiftUI.AnchorStyles.Left) - | ShiftUI.AnchorStyles.Right))); - this.pnldesktoppreview.Widgets.Add(this.predesktoppanel); - this.pnldesktoppreview.Location = new System.Drawing.Point(5, 3); - this.pnldesktoppreview.Name = "pnldesktoppreview"; - this.pnldesktoppreview.Size = new System.Drawing.Size(448, 148); - this.pnldesktoppreview.TabIndex = 0; - // - // predesktoppanel - // - this.predesktoppanel.BackColor = System.Drawing.Color.Gray; - this.predesktoppanel.Widgets.Add(this.prepnlpanelbuttonholder); - this.predesktoppanel.Widgets.Add(this.pretimepanel); - this.predesktoppanel.Widgets.Add(this.preapplaunchermenuholder); - this.predesktoppanel.Dock = ShiftUI.DockStyle.Top; - this.predesktoppanel.Location = new System.Drawing.Point(0, 0); - this.predesktoppanel.Name = "predesktoppanel"; - this.predesktoppanel.Size = new System.Drawing.Size(448, 25); - this.predesktoppanel.TabIndex = 1; - // - // prepnlpanelbuttonholder - // - this.prepnlpanelbuttonholder.BackColor = System.Drawing.Color.Transparent; - this.prepnlpanelbuttonholder.Widgets.Add(this.prepnlpanelbutton); - this.prepnlpanelbuttonholder.Dock = ShiftUI.DockStyle.Fill; - this.prepnlpanelbuttonholder.Location = new System.Drawing.Point(116, 0); - this.prepnlpanelbuttonholder.Name = "prepnlpanelbuttonholder"; - this.prepnlpanelbuttonholder.Padding = new ShiftUI.Padding(2, 0, 0, 0); - this.prepnlpanelbuttonholder.Size = new System.Drawing.Size(235, 25); - this.prepnlpanelbuttonholder.TabIndex = 6; - // - // prepnlpanelbutton - // - this.prepnlpanelbutton.BackColor = System.Drawing.Color.Black; - this.prepnlpanelbutton.Widgets.Add(this.pretbicon); - this.prepnlpanelbutton.Widgets.Add(this.pretbctext); - this.prepnlpanelbutton.Location = new System.Drawing.Point(5, 3); - this.prepnlpanelbutton.Name = "prepnlpanelbutton"; - this.prepnlpanelbutton.Size = new System.Drawing.Size(126, 20); - this.prepnlpanelbutton.TabIndex = 18; - this.prepnlpanelbutton.Visible = false; - // - // pretbicon - // - this.pretbicon.BackColor = System.Drawing.Color.Transparent; - this.pretbicon.BackgroundImageLayout = ShiftUI.ImageLayout.Stretch; - this.pretbicon.Location = new System.Drawing.Point(4, 2); - this.pretbicon.Name = "pretbicon"; - this.pretbicon.Size = new System.Drawing.Size(16, 16); - this.pretbicon.TabIndex = 1; - this.pretbicon.TabStop = false; - // - // pretbctext - // - this.pretbctext.AutoSize = true; - this.pretbctext.BackColor = System.Drawing.Color.Transparent; - this.pretbctext.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.pretbctext.ForeColor = System.Drawing.Color.White; - this.pretbctext.Location = new System.Drawing.Point(24, 2); - this.pretbctext.Name = "pretbctext"; - this.pretbctext.Size = new System.Drawing.Size(45, 16); - this.pretbctext.TabIndex = 0; - this.pretbctext.Text = "Shifter"; - // - // pretimepanel - // - this.pretimepanel.Widgets.Add(this.prepaneltimetext); - this.pretimepanel.Dock = ShiftUI.DockStyle.Right; - this.pretimepanel.Location = new System.Drawing.Point(351, 0); - this.pretimepanel.Name = "pretimepanel"; - this.pretimepanel.Size = new System.Drawing.Size(97, 25); - this.pretimepanel.TabIndex = 5; - // - // prepaneltimetext - // - this.prepaneltimetext.AutoSize = true; - this.prepaneltimetext.BackColor = System.Drawing.Color.Transparent; - this.prepaneltimetext.Font = new System.Drawing.Font("Trebuchet MS", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.prepaneltimetext.Location = new System.Drawing.Point(5, 0); - this.prepaneltimetext.Name = "prepaneltimetext"; - this.prepaneltimetext.Size = new System.Drawing.Size(80, 24); - this.prepaneltimetext.TabIndex = 1; - this.prepaneltimetext.Text = "5000023"; - this.prepaneltimetext.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; - // - // preapplaunchermenuholder - // - this.preapplaunchermenuholder.Widgets.Add(this.predesktopappmenu); - this.preapplaunchermenuholder.Dock = ShiftUI.DockStyle.Left; - this.preapplaunchermenuholder.Location = new System.Drawing.Point(0, 0); - this.preapplaunchermenuholder.Name = "preapplaunchermenuholder"; - this.preapplaunchermenuholder.Size = new System.Drawing.Size(116, 25); - this.preapplaunchermenuholder.TabIndex = 4; - // - // predesktopappmenu - // - this.predesktopappmenu.AutoSize = false; - this.predesktopappmenu.Items.AddRange(new ShiftUI.ToolStripItem[] { - this.ApplicationsToolStripMenuItem}); - this.predesktopappmenu.LayoutStyle = ShiftUI.ToolStripLayoutStyle.HorizontalStackWithOverflow; - this.predesktopappmenu.Location = new System.Drawing.Point(0, 0); - this.predesktopappmenu.Name = "predesktopappmenu"; - this.predesktopappmenu.Padding = new ShiftUI.Padding(0); - this.predesktopappmenu.Size = new System.Drawing.Size(116, 24); - this.predesktopappmenu.TabIndex = 0; - this.predesktopappmenu.Text = "MenuStrip1"; - // - // ApplicationsToolStripMenuItem - // - this.ApplicationsToolStripMenuItem.AutoSize = false; - this.ApplicationsToolStripMenuItem.DropDownItems.AddRange(new ShiftUI.ToolStripItem[] { - this.KnowledgeInputToolStripMenuItem, - this.ShiftoriumToolStripMenuItem, - this.ClockToolStripMenuItem, - this.TerminalToolStripMenuItem, - this.ShifterToolStripMenuItem, - this.ToolStripSeparator1, - this.ShutdownToolStripMenuItem}); - this.ApplicationsToolStripMenuItem.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.749999F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.ApplicationsToolStripMenuItem.Name = "ApplicationsToolStripMenuItem"; - this.ApplicationsToolStripMenuItem.Padding = new ShiftUI.Padding(2, 0, 2, 0); - this.ApplicationsToolStripMenuItem.ShowShortcutKeys = false; - this.ApplicationsToolStripMenuItem.Size = new System.Drawing.Size(102, 24); - this.ApplicationsToolStripMenuItem.Text = "Applications"; - this.ApplicationsToolStripMenuItem.TextDirection = ShiftUI.ToolStripTextDirection.Horizontal; - this.ApplicationsToolStripMenuItem.TextImageRelation = ShiftUI.TextImageRelation.TextBeforeImage; - // - // KnowledgeInputToolStripMenuItem - // - this.KnowledgeInputToolStripMenuItem.BackColor = System.Drawing.Color.Transparent; - this.KnowledgeInputToolStripMenuItem.Name = "KnowledgeInputToolStripMenuItem"; - this.KnowledgeInputToolStripMenuItem.ShowShortcutKeys = false; - this.KnowledgeInputToolStripMenuItem.Size = new System.Drawing.Size(181, 22); - this.KnowledgeInputToolStripMenuItem.Text = "Knowledge Input"; - // - // ShiftoriumToolStripMenuItem - // - this.ShiftoriumToolStripMenuItem.BackColor = System.Drawing.Color.Transparent; - this.ShiftoriumToolStripMenuItem.Name = "ShiftoriumToolStripMenuItem"; - this.ShiftoriumToolStripMenuItem.ShowShortcutKeys = false; - this.ShiftoriumToolStripMenuItem.Size = new System.Drawing.Size(181, 22); - this.ShiftoriumToolStripMenuItem.Text = "Shiftorium"; - // - // ClockToolStripMenuItem - // - this.ClockToolStripMenuItem.BackColor = System.Drawing.Color.Transparent; - this.ClockToolStripMenuItem.Name = "ClockToolStripMenuItem"; - this.ClockToolStripMenuItem.ShowShortcutKeys = false; - this.ClockToolStripMenuItem.Size = new System.Drawing.Size(181, 22); - this.ClockToolStripMenuItem.Text = "Clock"; - // - // TerminalToolStripMenuItem - // - this.TerminalToolStripMenuItem.BackColor = System.Drawing.Color.Transparent; - this.TerminalToolStripMenuItem.Name = "TerminalToolStripMenuItem"; - this.TerminalToolStripMenuItem.ShowShortcutKeys = false; - this.TerminalToolStripMenuItem.Size = new System.Drawing.Size(181, 22); - this.TerminalToolStripMenuItem.Text = "Terminal"; - // - // ShifterToolStripMenuItem - // - this.ShifterToolStripMenuItem.BackColor = System.Drawing.Color.Transparent; - this.ShifterToolStripMenuItem.Name = "ShifterToolStripMenuItem"; - this.ShifterToolStripMenuItem.Size = new System.Drawing.Size(181, 22); - this.ShifterToolStripMenuItem.Text = "Shifter"; - // - // ToolStripSeparator1 - // - this.ToolStripSeparator1.BackColor = System.Drawing.Color.Transparent; - this.ToolStripSeparator1.ForeColor = System.Drawing.Color.White; - this.ToolStripSeparator1.Name = "ToolStripSeparator1"; - this.ToolStripSeparator1.Size = new System.Drawing.Size(178, 6); - // - // ShutdownToolStripMenuItem - // - this.ShutdownToolStripMenuItem.BackColor = System.Drawing.Color.Transparent; - this.ShutdownToolStripMenuItem.Name = "ShutdownToolStripMenuItem"; - this.ShutdownToolStripMenuItem.Size = new System.Drawing.Size(181, 22); - this.ShutdownToolStripMenuItem.Text = "Shut Down"; - // - // Panel10 - // - this.Panel10.Anchor = ((ShiftUI.AnchorStyles)((ShiftUI.AnchorStyles.Bottom | ShiftUI.AnchorStyles.Left))); - this.Panel10.Widgets.Add(this.btndesktopitself); - this.Panel10.Widgets.Add(this.btnpanelclock); - this.Panel10.Widgets.Add(this.btnapplauncher); - this.Panel10.Widgets.Add(this.btndesktoppanel); - this.Panel10.Location = new System.Drawing.Point(1, 168); - this.Panel10.Name = "Panel10"; - this.Panel10.Size = new System.Drawing.Size(128, 135); - this.Panel10.TabIndex = 8; - // - // btndesktopitself - // - this.btndesktopitself.BackColor = System.Drawing.Color.White; - this.btndesktopitself.FlatStyle = ShiftUI.FlatStyle.Standard; - this.btndesktopitself.Font = new System.Drawing.Font("Cambria", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.btndesktopitself.Location = new System.Drawing.Point(4, 105); - this.btndesktopitself.Name = "btndesktopitself"; - this.btndesktopitself.Size = new System.Drawing.Size(119, 29); - this.btndesktopitself.TabIndex = 7; - this.btndesktopitself.Text = "Desktop"; - this.btndesktopitself.UseVisualStyleBackColor = false; - this.btndesktopitself.Click += new System.EventHandler(this.btndesktopitself_Click); - // - // btnpanelclock - // - this.btnpanelclock.BackColor = System.Drawing.Color.White; - this.btnpanelclock.FlatStyle = ShiftUI.FlatStyle.Standard; - this.btnpanelclock.Font = new System.Drawing.Font("Cambria", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.btnpanelclock.Location = new System.Drawing.Point(4, 70); - this.btnpanelclock.Name = "btnpanelclock"; - this.btnpanelclock.Size = new System.Drawing.Size(119, 29); - this.btnpanelclock.TabIndex = 6; - this.btnpanelclock.Text = "Panel Clock"; - this.btnpanelclock.UseVisualStyleBackColor = false; - this.btnpanelclock.Click += new System.EventHandler(this.btnpanelclock_Click); - // - // btnapplauncher - // - this.btnapplauncher.BackColor = System.Drawing.Color.White; - this.btnapplauncher.FlatStyle = ShiftUI.FlatStyle.Standard; - this.btnapplauncher.Font = new System.Drawing.Font("Cambria", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.btnapplauncher.Location = new System.Drawing.Point(4, 35); - this.btnapplauncher.Name = "btnapplauncher"; - this.btnapplauncher.Size = new System.Drawing.Size(119, 29); - this.btnapplauncher.TabIndex = 5; - this.btnapplauncher.Text = "App Launcher"; - this.btnapplauncher.UseVisualStyleBackColor = false; - this.btnapplauncher.Click += new System.EventHandler(this.btnapplauncher_Click); - // - // btndesktoppanel - // - this.btndesktoppanel.BackColor = System.Drawing.Color.White; - this.btndesktoppanel.FlatStyle = ShiftUI.FlatStyle.Standard; - this.btndesktoppanel.Font = new System.Drawing.Font("Cambria", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.btndesktoppanel.Location = new System.Drawing.Point(4, 0); - this.btndesktoppanel.Name = "btndesktoppanel"; - this.btndesktoppanel.Size = new System.Drawing.Size(119, 29); - this.btndesktoppanel.TabIndex = 4; - this.btndesktoppanel.Text = "Desktop Panel"; - this.btndesktoppanel.UseVisualStyleBackColor = false; - this.btndesktoppanel.Click += new System.EventHandler(this.btndesktoppanel_Click); - // - // txtpanelbuttoniconheight - // - this.txtpanelbuttoniconheight.Location = new System.Drawing.Point(0, 0); - this.txtpanelbuttoniconheight.Name = "txtpanelbuttoniconheight"; - this.txtpanelbuttoniconheight.Size = new System.Drawing.Size(100, 20); - this.txtpanelbuttoniconheight.TabIndex = 0; - // - // pnlwindowsoptions - // - this.pnlwindowsoptions.Anchor = ((ShiftUI.AnchorStyles)((((ShiftUI.AnchorStyles.Top | ShiftUI.AnchorStyles.Bottom) - | ShiftUI.AnchorStyles.Left) - | ShiftUI.AnchorStyles.Right))); - this.pnlwindowsoptions.BackColor = System.Drawing.Color.White; - this.pnlwindowsoptions.Widgets.Add(this.pnlwindowsintro); - this.pnlwindowsoptions.Widgets.Add(this.pnlbuttonoptions); - this.pnlwindowsoptions.Widgets.Add(this.pnltitlebaroptions); - this.pnlwindowsoptions.Widgets.Add(this.pnlborderoptions); - this.pnlwindowsoptions.Widgets.Add(this.pnltitletextoptions); - this.pnlwindowsoptions.Widgets.Add(this.pnlwindowsobjects); - this.pnlwindowsoptions.Widgets.Add(this.pnlwindowpreview); - this.pnlwindowsoptions.Location = new System.Drawing.Point(134, 9); - this.pnlwindowsoptions.Name = "pnlwindowsoptions"; - this.pnlwindowsoptions.Size = new System.Drawing.Size(457, 306); - this.pnlwindowsoptions.TabIndex = 4; - // - // pnlwindowsintro - // - this.pnlwindowsintro.Anchor = ((ShiftUI.AnchorStyles)((ShiftUI.AnchorStyles.Bottom | ShiftUI.AnchorStyles.Right))); - this.pnlwindowsintro.Widgets.Add(this.Label68); - this.pnlwindowsintro.Widgets.Add(this.Label67); - this.pnlwindowsintro.Location = new System.Drawing.Point(135, 159); - this.pnlwindowsintro.Name = "pnlwindowsintro"; - this.pnlwindowsintro.Size = new System.Drawing.Size(325, 139); - this.pnlwindowsintro.TabIndex = 16; - // - // Label68 - // - this.Label68.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.Label68.Location = new System.Drawing.Point(3, 20); - this.Label68.Name = "Label68"; - this.Label68.Size = new System.Drawing.Size(312, 113); - this.Label68.TabIndex = 1; - this.Label68.Text = "Welcome to the Windows category. Here, you may skin various aspects of windows in" + - " ShiftOS."; - this.Label68.TextAlign = System.Drawing.ContentAlignment.TopCenter; - this.Label68.Click += new System.EventHandler(this.Label68_Click); - // - // Label67 - // - this.Label67.AutoSize = true; - this.Label67.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.Label67.Location = new System.Drawing.Point(89, -2); - this.Label67.Name = "Label67"; - this.Label67.Size = new System.Drawing.Size(143, 20); - this.Label67.TabIndex = 0; - this.Label67.Text = "Window Settings"; - // - // pnlbuttonoptions - // - this.pnlbuttonoptions.Anchor = ((ShiftUI.AnchorStyles)((ShiftUI.AnchorStyles.Bottom | ShiftUI.AnchorStyles.Right))); - this.pnlbuttonoptions.Widgets.Add(this.pnlclosebuttonoptions); - this.pnlbuttonoptions.Widgets.Add(this.pnlrollupbuttonoptions); - this.pnlbuttonoptions.Widgets.Add(this.pnlminimizebuttonoptions); - this.pnlbuttonoptions.Widgets.Add(this.combobuttonoption); - this.pnlbuttonoptions.Widgets.Add(this.Label52); - this.pnlbuttonoptions.Location = new System.Drawing.Point(135, 159); - this.pnlbuttonoptions.Name = "pnlbuttonoptions"; - this.pnlbuttonoptions.Size = new System.Drawing.Size(325, 139); - this.pnlbuttonoptions.TabIndex = 10; - this.pnlbuttonoptions.Visible = false; - // - // pnlclosebuttonoptions - // - this.pnlclosebuttonoptions.Anchor = ((ShiftUI.AnchorStyles)(((ShiftUI.AnchorStyles.Bottom | ShiftUI.AnchorStyles.Left) - | ShiftUI.AnchorStyles.Right))); - this.pnlclosebuttonoptions.Widgets.Add(this.Label8); - this.pnlclosebuttonoptions.Widgets.Add(this.Label11); - this.pnlclosebuttonoptions.Widgets.Add(this.pnlclosebuttoncolour); - this.pnlclosebuttonoptions.Widgets.Add(this.txtclosebuttonfromside); - this.pnlclosebuttonoptions.Widgets.Add(this.Label7); - this.pnlclosebuttonoptions.Widgets.Add(this.Label12); - this.pnlclosebuttonoptions.Widgets.Add(this.txtclosebuttonheight); - this.pnlclosebuttonoptions.Widgets.Add(this.Label13); - this.pnlclosebuttonoptions.Widgets.Add(this.Label6); - this.pnlclosebuttonoptions.Widgets.Add(this.txtclosebuttonfromtop); - this.pnlclosebuttonoptions.Widgets.Add(this.Label10); - this.pnlclosebuttonoptions.Widgets.Add(this.Label14); - this.pnlclosebuttonoptions.Widgets.Add(this.txtclosebuttonwidth); - this.pnlclosebuttonoptions.Widgets.Add(this.Label9); - this.pnlclosebuttonoptions.Location = new System.Drawing.Point(4, 29); - this.pnlclosebuttonoptions.Name = "pnlclosebuttonoptions"; - this.pnlclosebuttonoptions.Size = new System.Drawing.Size(311, 105); - this.pnlclosebuttonoptions.TabIndex = 15; - this.pnlclosebuttonoptions.Visible = false; - // - // Label8 - // - this.Label8.AutoSize = true; - this.Label8.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.Label8.Location = new System.Drawing.Point(3, 6); - this.Label8.Name = "Label8"; - this.Label8.Size = new System.Drawing.Size(128, 16); - this.Label8.TabIndex = 0; - this.Label8.Text = "Close Button Colour:"; - // - // Label11 - // - this.Label11.AutoSize = true; - this.Label11.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.Label11.Location = new System.Drawing.Point(177, 82); - this.Label11.Name = "Label11"; - this.Label11.Size = new System.Drawing.Size(22, 16); - this.Label11.TabIndex = 14; - this.Label11.Text = "px"; - // - // pnlclosebuttoncolour - // - this.pnlclosebuttoncolour.BackgroundImageLayout = ShiftUI.ImageLayout.Stretch; - this.pnlclosebuttoncolour.Location = new System.Drawing.Point(132, 4); - this.pnlclosebuttoncolour.Name = "pnlclosebuttoncolour"; - this.pnlclosebuttoncolour.Size = new System.Drawing.Size(41, 20); - this.pnlclosebuttoncolour.TabIndex = 1; - this.pnlclosebuttoncolour.MouseClick += new ShiftUI.MouseEventHandler(this.SetcloseColor); - // - // txtclosebuttonfromside - // - this.txtclosebuttonfromside.BackColor = System.Drawing.Color.White; - this.txtclosebuttonfromside.BorderStyle = ShiftUI.BorderStyle.FixedSingle; - this.txtclosebuttonfromside.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.txtclosebuttonfromside.ForeColor = System.Drawing.Color.Black; - this.txtclosebuttonfromside.Location = new System.Drawing.Point(153, 80); - this.txtclosebuttonfromside.Name = "txtclosebuttonfromside"; - this.txtclosebuttonfromside.Size = new System.Drawing.Size(23, 22); - this.txtclosebuttonfromside.TabIndex = 13; - this.txtclosebuttonfromside.TextChanged += new System.EventHandler(this.txtclosebuttonfromside_TextChanged); - // - // Label7 - // - this.Label7.AutoSize = true; - this.Label7.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.Label7.Location = new System.Drawing.Point(3, 32); - this.Label7.Name = "Label7"; - this.Label7.Size = new System.Drawing.Size(128, 16); - this.Label7.TabIndex = 2; - this.Label7.Text = "Close Button Height:"; - // - // Label12 - // - this.Label12.AutoSize = true; - this.Label12.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.Label12.Location = new System.Drawing.Point(3, 82); - this.Label12.Name = "Label12"; - this.Label12.Size = new System.Drawing.Size(151, 16); - this.Label12.TabIndex = 12; - this.Label12.Text = "Close Button From Side:"; - // - // txtclosebuttonheight - // - this.txtclosebuttonheight.BackColor = System.Drawing.Color.White; - this.txtclosebuttonheight.BorderStyle = ShiftUI.BorderStyle.FixedSingle; - this.txtclosebuttonheight.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.txtclosebuttonheight.ForeColor = System.Drawing.Color.Black; - this.txtclosebuttonheight.Location = new System.Drawing.Point(132, 30); - this.txtclosebuttonheight.Name = "txtclosebuttonheight"; - this.txtclosebuttonheight.Size = new System.Drawing.Size(23, 22); - this.txtclosebuttonheight.TabIndex = 4; - this.txtclosebuttonheight.TextChanged += new System.EventHandler(this.txtclosebuttonheight_TextChanged); - // - // Label13 - // - this.Label13.AutoSize = true; - this.Label13.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.Label13.Location = new System.Drawing.Point(177, 57); - this.Label13.Name = "Label13"; - this.Label13.Size = new System.Drawing.Size(22, 16); - this.Label13.TabIndex = 11; - this.Label13.Text = "px"; - // - // Label6 - // - this.Label6.AutoSize = true; - this.Label6.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.Label6.Location = new System.Drawing.Point(156, 32); - this.Label6.Name = "Label6"; - this.Label6.Size = new System.Drawing.Size(22, 16); - this.Label6.TabIndex = 5; - this.Label6.Text = "px"; - // - // txtclosebuttonfromtop - // - this.txtclosebuttonfromtop.BackColor = System.Drawing.Color.White; - this.txtclosebuttonfromtop.BorderStyle = ShiftUI.BorderStyle.FixedSingle; - this.txtclosebuttonfromtop.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.txtclosebuttonfromtop.ForeColor = System.Drawing.Color.Black; - this.txtclosebuttonfromtop.Location = new System.Drawing.Point(153, 55); - this.txtclosebuttonfromtop.Name = "txtclosebuttonfromtop"; - this.txtclosebuttonfromtop.Size = new System.Drawing.Size(23, 22); - this.txtclosebuttonfromtop.TabIndex = 10; - this.txtclosebuttonfromtop.TextChanged += new System.EventHandler(this.txtclosebuttonfromtop_TextChanged); - // - // Label10 - // - this.Label10.AutoSize = true; - this.Label10.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.Label10.Location = new System.Drawing.Point(184, 32); - this.Label10.Name = "Label10"; - this.Label10.Size = new System.Drawing.Size(45, 16); - this.Label10.TabIndex = 6; - this.Label10.Text = "Width:"; - // - // Label14 - // - this.Label14.AutoSize = true; - this.Label14.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.Label14.Location = new System.Drawing.Point(3, 57); - this.Label14.Name = "Label14"; - this.Label14.Size = new System.Drawing.Size(148, 16); - this.Label14.TabIndex = 9; - this.Label14.Text = "Close Button From Top:"; - // - // txtclosebuttonwidth - // - this.txtclosebuttonwidth.BackColor = System.Drawing.Color.White; - this.txtclosebuttonwidth.BorderStyle = ShiftUI.BorderStyle.FixedSingle; - this.txtclosebuttonwidth.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.txtclosebuttonwidth.ForeColor = System.Drawing.Color.Black; - this.txtclosebuttonwidth.Location = new System.Drawing.Point(234, 30); - this.txtclosebuttonwidth.Name = "txtclosebuttonwidth"; - this.txtclosebuttonwidth.Size = new System.Drawing.Size(23, 22); - this.txtclosebuttonwidth.TabIndex = 7; - this.txtclosebuttonwidth.TextChanged += new System.EventHandler(this.txtclosebuttonwidth_TextChanged); - // - // Label9 - // - this.Label9.AutoSize = true; - this.Label9.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.Label9.Location = new System.Drawing.Point(258, 32); - this.Label9.Name = "Label9"; - this.Label9.Size = new System.Drawing.Size(22, 16); - this.Label9.TabIndex = 8; - this.Label9.Text = "px"; - // - // pnlrollupbuttonoptions - // - this.pnlrollupbuttonoptions.Anchor = ((ShiftUI.AnchorStyles)(((ShiftUI.AnchorStyles.Bottom | ShiftUI.AnchorStyles.Left) - | ShiftUI.AnchorStyles.Right))); - this.pnlrollupbuttonoptions.Widgets.Add(this.Label54); - this.pnlrollupbuttonoptions.Widgets.Add(this.Label55); - this.pnlrollupbuttonoptions.Widgets.Add(this.pnlrollupbuttoncolour); - this.pnlrollupbuttonoptions.Widgets.Add(this.txtrollupbuttonside); - this.pnlrollupbuttonoptions.Widgets.Add(this.Label56); - this.pnlrollupbuttonoptions.Widgets.Add(this.Label57); - this.pnlrollupbuttonoptions.Widgets.Add(this.txtrollupbuttonheight); - this.pnlrollupbuttonoptions.Widgets.Add(this.Label58); - this.pnlrollupbuttonoptions.Widgets.Add(this.Label59); - this.pnlrollupbuttonoptions.Widgets.Add(this.txtrollupbuttontop); - this.pnlrollupbuttonoptions.Widgets.Add(this.Label60); - this.pnlrollupbuttonoptions.Widgets.Add(this.Label61); - this.pnlrollupbuttonoptions.Widgets.Add(this.txtrollupbuttonwidth); - this.pnlrollupbuttonoptions.Widgets.Add(this.Label62); - this.pnlrollupbuttonoptions.Location = new System.Drawing.Point(4, 29); - this.pnlrollupbuttonoptions.Name = "pnlrollupbuttonoptions"; - this.pnlrollupbuttonoptions.Size = new System.Drawing.Size(311, 105); - this.pnlrollupbuttonoptions.TabIndex = 16; - this.pnlrollupbuttonoptions.Visible = false; - // - // Label54 - // - this.Label54.AutoSize = true; - this.Label54.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.Label54.Location = new System.Drawing.Point(3, 6); - this.Label54.Name = "Label54"; - this.Label54.Size = new System.Drawing.Size(138, 16); - this.Label54.TabIndex = 0; - this.Label54.Text = "Roll Up Button Colour:"; - // - // Label55 - // - this.Label55.AutoSize = true; - this.Label55.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.Label55.Location = new System.Drawing.Point(188, 82); - this.Label55.Name = "Label55"; - this.Label55.Size = new System.Drawing.Size(22, 16); - this.Label55.TabIndex = 14; - this.Label55.Text = "px"; - // - // pnlrollupbuttoncolour - // - this.pnlrollupbuttoncolour.BackgroundImageLayout = ShiftUI.ImageLayout.Stretch; - this.pnlrollupbuttoncolour.BorderStyle = ShiftUI.BorderStyle.FixedSingle; - this.pnlrollupbuttoncolour.Location = new System.Drawing.Point(143, 4); - this.pnlrollupbuttoncolour.Name = "pnlrollupbuttoncolour"; - this.pnlrollupbuttoncolour.Size = new System.Drawing.Size(41, 20); - this.pnlrollupbuttoncolour.TabIndex = 1; - this.pnlrollupbuttoncolour.MouseClick += new ShiftUI.MouseEventHandler(this.SetrollupColor); - // - // txtrollupbuttonside - // - this.txtrollupbuttonside.BackColor = System.Drawing.Color.White; - this.txtrollupbuttonside.BorderStyle = ShiftUI.BorderStyle.FixedSingle; - this.txtrollupbuttonside.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.txtrollupbuttonside.ForeColor = System.Drawing.Color.Black; - this.txtrollupbuttonside.Location = new System.Drawing.Point(164, 80); - this.txtrollupbuttonside.Name = "txtrollupbuttonside"; - this.txtrollupbuttonside.Size = new System.Drawing.Size(23, 22); - this.txtrollupbuttonside.TabIndex = 13; - this.txtrollupbuttonside.TextChanged += new System.EventHandler(this.txtrollupbuttonside_TextChanged); - // - // Label56 - // - this.Label56.AutoSize = true; - this.Label56.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.Label56.Location = new System.Drawing.Point(3, 32); - this.Label56.Name = "Label56"; - this.Label56.Size = new System.Drawing.Size(138, 16); - this.Label56.TabIndex = 2; - this.Label56.Text = "Roll Up Button Height:"; - // - // Label57 - // - this.Label57.AutoSize = true; - this.Label57.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.Label57.Location = new System.Drawing.Point(3, 82); - this.Label57.Name = "Label57"; - this.Label57.Size = new System.Drawing.Size(161, 16); - this.Label57.TabIndex = 12; - this.Label57.Text = "Roll Up Button From Side:"; - // - // txtrollupbuttonheight - // - this.txtrollupbuttonheight.BackColor = System.Drawing.Color.White; - this.txtrollupbuttonheight.BorderStyle = ShiftUI.BorderStyle.FixedSingle; - this.txtrollupbuttonheight.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.txtrollupbuttonheight.ForeColor = System.Drawing.Color.Black; - this.txtrollupbuttonheight.Location = new System.Drawing.Point(143, 30); - this.txtrollupbuttonheight.Name = "txtrollupbuttonheight"; - this.txtrollupbuttonheight.Size = new System.Drawing.Size(23, 22); - this.txtrollupbuttonheight.TabIndex = 4; - this.txtrollupbuttonheight.TextChanged += new System.EventHandler(this.txtrollupbuttonheight_TextChanged); - // - // Label58 - // - this.Label58.AutoSize = true; - this.Label58.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.Label58.Location = new System.Drawing.Point(188, 57); - this.Label58.Name = "Label58"; - this.Label58.Size = new System.Drawing.Size(22, 16); - this.Label58.TabIndex = 11; - this.Label58.Text = "px"; - // - // Label59 - // - this.Label59.AutoSize = true; - this.Label59.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.Label59.Location = new System.Drawing.Point(167, 32); - this.Label59.Name = "Label59"; - this.Label59.Size = new System.Drawing.Size(22, 16); - this.Label59.TabIndex = 5; - this.Label59.Text = "px"; - // - // txtrollupbuttontop - // - this.txtrollupbuttontop.BackColor = System.Drawing.Color.White; - this.txtrollupbuttontop.BorderStyle = ShiftUI.BorderStyle.FixedSingle; - this.txtrollupbuttontop.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.txtrollupbuttontop.ForeColor = System.Drawing.Color.Black; - this.txtrollupbuttontop.Location = new System.Drawing.Point(164, 55); - this.txtrollupbuttontop.Name = "txtrollupbuttontop"; - this.txtrollupbuttontop.Size = new System.Drawing.Size(23, 22); - this.txtrollupbuttontop.TabIndex = 10; - this.txtrollupbuttontop.TextChanged += new System.EventHandler(this.txtrollupbuttontop_TextChanged); - // - // Label60 - // - this.Label60.AutoSize = true; - this.Label60.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.Label60.Location = new System.Drawing.Point(195, 32); - this.Label60.Name = "Label60"; - this.Label60.Size = new System.Drawing.Size(45, 16); - this.Label60.TabIndex = 6; - this.Label60.Text = "Width:"; - // - // Label61 - // - this.Label61.AutoSize = true; - this.Label61.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.Label61.Location = new System.Drawing.Point(3, 57); - this.Label61.Name = "Label61"; - this.Label61.Size = new System.Drawing.Size(158, 16); - this.Label61.TabIndex = 9; - this.Label61.Text = "Roll Up Button From Top:"; - // - // txtrollupbuttonwidth - // - this.txtrollupbuttonwidth.BackColor = System.Drawing.Color.White; - this.txtrollupbuttonwidth.BorderStyle = ShiftUI.BorderStyle.FixedSingle; - this.txtrollupbuttonwidth.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.txtrollupbuttonwidth.ForeColor = System.Drawing.Color.Black; - this.txtrollupbuttonwidth.Location = new System.Drawing.Point(245, 30); - this.txtrollupbuttonwidth.Name = "txtrollupbuttonwidth"; - this.txtrollupbuttonwidth.Size = new System.Drawing.Size(23, 22); - this.txtrollupbuttonwidth.TabIndex = 7; - this.txtrollupbuttonwidth.TextChanged += new System.EventHandler(this.txtrollupbuttonwidth_TextChanged); - // - // Label62 - // - this.Label62.AutoSize = true; - this.Label62.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.Label62.Location = new System.Drawing.Point(269, 32); - this.Label62.Name = "Label62"; - this.Label62.Size = new System.Drawing.Size(22, 16); - this.Label62.TabIndex = 8; - this.Label62.Text = "px"; - // - // pnlminimizebuttonoptions - // - this.pnlminimizebuttonoptions.Anchor = ((ShiftUI.AnchorStyles)(((ShiftUI.AnchorStyles.Bottom | ShiftUI.AnchorStyles.Left) - | ShiftUI.AnchorStyles.Right))); - this.pnlminimizebuttonoptions.Widgets.Add(this.Label82); - this.pnlminimizebuttonoptions.Widgets.Add(this.Label83); - this.pnlminimizebuttonoptions.Widgets.Add(this.pnlminimizebuttoncolour); - this.pnlminimizebuttonoptions.Widgets.Add(this.txtminimizebuttonside); - this.pnlminimizebuttonoptions.Widgets.Add(this.Label84); - this.pnlminimizebuttonoptions.Widgets.Add(this.Label85); - this.pnlminimizebuttonoptions.Widgets.Add(this.txtminimizebuttonheight); - this.pnlminimizebuttonoptions.Widgets.Add(this.Label86); - this.pnlminimizebuttonoptions.Widgets.Add(this.Label87); - this.pnlminimizebuttonoptions.Widgets.Add(this.txtminimizebuttontop); - this.pnlminimizebuttonoptions.Widgets.Add(this.Label88); - this.pnlminimizebuttonoptions.Widgets.Add(this.Label89); - this.pnlminimizebuttonoptions.Widgets.Add(this.txtminimizebuttonwidth); - this.pnlminimizebuttonoptions.Widgets.Add(this.Label90); - this.pnlminimizebuttonoptions.Location = new System.Drawing.Point(4, 29); - this.pnlminimizebuttonoptions.Name = "pnlminimizebuttonoptions"; - this.pnlminimizebuttonoptions.Size = new System.Drawing.Size(311, 105); - this.pnlminimizebuttonoptions.TabIndex = 18; - this.pnlminimizebuttonoptions.Visible = false; - // - // Label82 - // - this.Label82.AutoSize = true; - this.Label82.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.Label82.Location = new System.Drawing.Point(3, 6); - this.Label82.Name = "Label82"; - this.Label82.Size = new System.Drawing.Size(145, 16); - this.Label82.TabIndex = 0; - this.Label82.Text = "Minimize Button Colour:"; - // - // Label83 - // - this.Label83.AutoSize = true; - this.Label83.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.Label83.Location = new System.Drawing.Point(196, 82); - this.Label83.Name = "Label83"; - this.Label83.Size = new System.Drawing.Size(22, 16); - this.Label83.TabIndex = 14; - this.Label83.Text = "px"; - // - // pnlminimizebuttoncolour - // - this.pnlminimizebuttoncolour.BackgroundImageLayout = ShiftUI.ImageLayout.Stretch; - this.pnlminimizebuttoncolour.BorderStyle = ShiftUI.BorderStyle.FixedSingle; - this.pnlminimizebuttoncolour.Location = new System.Drawing.Point(149, 4); - this.pnlminimizebuttoncolour.Name = "pnlminimizebuttoncolour"; - this.pnlminimizebuttoncolour.Size = new System.Drawing.Size(41, 20); - this.pnlminimizebuttoncolour.TabIndex = 1; - this.pnlminimizebuttoncolour.MouseClick += new ShiftUI.MouseEventHandler(this.SetMinimizeColor); - // - // txtminimizebuttonside - // - this.txtminimizebuttonside.BackColor = System.Drawing.Color.White; - this.txtminimizebuttonside.BorderStyle = ShiftUI.BorderStyle.FixedSingle; - this.txtminimizebuttonside.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.txtminimizebuttonside.ForeColor = System.Drawing.Color.Black; - this.txtminimizebuttonside.Location = new System.Drawing.Point(172, 80); - this.txtminimizebuttonside.Name = "txtminimizebuttonside"; - this.txtminimizebuttonside.Size = new System.Drawing.Size(23, 22); - this.txtminimizebuttonside.TabIndex = 13; - this.txtminimizebuttonside.TextChanged += new System.EventHandler(this.txtminimizebuttonside_TextChanged); - // - // Label84 - // - this.Label84.AutoSize = true; - this.Label84.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.Label84.Location = new System.Drawing.Point(3, 32); - this.Label84.Name = "Label84"; - this.Label84.Size = new System.Drawing.Size(145, 16); - this.Label84.TabIndex = 2; - this.Label84.Text = "Minimize Button Height:"; - // - // Label85 - // - this.Label85.AutoSize = true; - this.Label85.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.Label85.Location = new System.Drawing.Point(3, 82); - this.Label85.Name = "Label85"; - this.Label85.Size = new System.Drawing.Size(168, 16); - this.Label85.TabIndex = 12; - this.Label85.Text = "Minimize Button From Side:"; - // - // txtminimizebuttonheight - // - this.txtminimizebuttonheight.BackColor = System.Drawing.Color.White; - this.txtminimizebuttonheight.BorderStyle = ShiftUI.BorderStyle.FixedSingle; - this.txtminimizebuttonheight.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.txtminimizebuttonheight.ForeColor = System.Drawing.Color.Black; - this.txtminimizebuttonheight.Location = new System.Drawing.Point(150, 30); - this.txtminimizebuttonheight.Name = "txtminimizebuttonheight"; - this.txtminimizebuttonheight.Size = new System.Drawing.Size(23, 22); - this.txtminimizebuttonheight.TabIndex = 4; - this.txtminimizebuttonheight.TextChanged += new System.EventHandler(this.txtminimizebuttonheight_TextChanged); - // - // Label86 - // - this.Label86.AutoSize = true; - this.Label86.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.Label86.Location = new System.Drawing.Point(196, 57); - this.Label86.Name = "Label86"; - this.Label86.Size = new System.Drawing.Size(22, 16); - this.Label86.TabIndex = 11; - this.Label86.Text = "px"; - // - // Label87 - // - this.Label87.AutoSize = true; - this.Label87.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.Label87.Location = new System.Drawing.Point(174, 32); - this.Label87.Name = "Label87"; - this.Label87.Size = new System.Drawing.Size(22, 16); - this.Label87.TabIndex = 5; - this.Label87.Text = "px"; - // - // txtminimizebuttontop - // - this.txtminimizebuttontop.BackColor = System.Drawing.Color.White; - this.txtminimizebuttontop.BorderStyle = ShiftUI.BorderStyle.FixedSingle; - this.txtminimizebuttontop.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.txtminimizebuttontop.ForeColor = System.Drawing.Color.Black; - this.txtminimizebuttontop.Location = new System.Drawing.Point(172, 55); - this.txtminimizebuttontop.Name = "txtminimizebuttontop"; - this.txtminimizebuttontop.Size = new System.Drawing.Size(23, 22); - this.txtminimizebuttontop.TabIndex = 10; - this.txtminimizebuttontop.TextChanged += new System.EventHandler(this.txtminimizebuttontop_TextChanged); - // - // Label88 - // - this.Label88.AutoSize = true; - this.Label88.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.Label88.Location = new System.Drawing.Point(198, 32); - this.Label88.Name = "Label88"; - this.Label88.Size = new System.Drawing.Size(45, 16); - this.Label88.TabIndex = 6; - this.Label88.Text = "Width:"; - // - // Label89 - // - this.Label89.AutoSize = true; - this.Label89.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.Label89.Location = new System.Drawing.Point(3, 57); - this.Label89.Name = "Label89"; - this.Label89.Size = new System.Drawing.Size(165, 16); - this.Label89.TabIndex = 9; - this.Label89.Text = "Minimize Button From Top:"; - // - // txtminimizebuttonwidth - // - this.txtminimizebuttonwidth.BackColor = System.Drawing.Color.White; - this.txtminimizebuttonwidth.BorderStyle = ShiftUI.BorderStyle.FixedSingle; - this.txtminimizebuttonwidth.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.txtminimizebuttonwidth.ForeColor = System.Drawing.Color.Black; - this.txtminimizebuttonwidth.Location = new System.Drawing.Point(247, 30); - this.txtminimizebuttonwidth.Name = "txtminimizebuttonwidth"; - this.txtminimizebuttonwidth.Size = new System.Drawing.Size(23, 22); - this.txtminimizebuttonwidth.TabIndex = 7; - this.txtminimizebuttonwidth.TextChanged += new System.EventHandler(this.txtminimizebuttonwidth_TextChanged); - // - // Label90 - // - this.Label90.AutoSize = true; - this.Label90.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.Label90.Location = new System.Drawing.Point(269, 32); - this.Label90.Name = "Label90"; - this.Label90.Size = new System.Drawing.Size(22, 16); - this.Label90.TabIndex = 8; - this.Label90.Text = "px"; - // - // combobuttonoption - // - this.combobuttonoption.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.combobuttonoption.FormattingEnabled = true; - this.combobuttonoption.Items.AddRange(new object[] { - "Close Button", - "Roll Up Button"}); - this.combobuttonoption.Location = new System.Drawing.Point(157, 4); - this.combobuttonoption.Name = "combobuttonoption"; - this.combobuttonoption.Size = new System.Drawing.Size(121, 24); - this.combobuttonoption.TabIndex = 17; - this.combobuttonoption.SelectedIndexChanged += new System.EventHandler(this.combobuttonoption_SelectedIndexChanged); - // - // Label52 - // - this.Label52.AutoSize = true; - this.Label52.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.Label52.Location = new System.Drawing.Point(40, 6); - this.Label52.Name = "Label52"; - this.Label52.Size = new System.Drawing.Size(111, 16); - this.Label52.TabIndex = 15; - this.Label52.Text = "Button To Modify:"; - // - // pnltitlebaroptions - // - this.pnltitlebaroptions.Anchor = ((ShiftUI.AnchorStyles)((ShiftUI.AnchorStyles.Bottom | ShiftUI.AnchorStyles.Right))); - this.pnltitlebaroptions.Widgets.Add(this.Label80); - this.pnltitlebaroptions.Widgets.Add(this.txticonfromtop); - this.pnltitlebaroptions.Widgets.Add(this.Label81); - this.pnltitlebaroptions.Widgets.Add(this.Label78); - this.pnltitlebaroptions.Widgets.Add(this.txticonfromside); - this.pnltitlebaroptions.Widgets.Add(this.Label79); - this.pnltitlebaroptions.Widgets.Add(this.lbcornerwidthpx); - this.pnltitlebaroptions.Widgets.Add(this.txttitlebarcornerwidth); - this.pnltitlebaroptions.Widgets.Add(this.lbcornerwidth); - this.pnltitlebaroptions.Widgets.Add(this.pnltitlebarrightcornercolour); - this.pnltitlebaroptions.Widgets.Add(this.pnltitlebarleftcornercolour); - this.pnltitlebaroptions.Widgets.Add(this.lbrightcornercolor); - this.pnltitlebaroptions.Widgets.Add(this.lbleftcornercolor); - this.pnltitlebaroptions.Widgets.Add(this.cboxtitlebarcorners); - this.pnltitlebaroptions.Widgets.Add(this.Label5); - this.pnltitlebaroptions.Widgets.Add(this.txttitlebarheight); - this.pnltitlebaroptions.Widgets.Add(this.Label4); - this.pnltitlebaroptions.Widgets.Add(this.pnltitlebarcolour); - this.pnltitlebaroptions.Widgets.Add(this.Label2); - this.pnltitlebaroptions.Location = new System.Drawing.Point(135, 159); - this.pnltitlebaroptions.Name = "pnltitlebaroptions"; - this.pnltitlebaroptions.Size = new System.Drawing.Size(325, 139); - this.pnltitlebaroptions.TabIndex = 9; - this.pnltitlebaroptions.Visible = false; - // - // Label80 - // - this.Label80.AutoSize = true; - this.Label80.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.Label80.Location = new System.Drawing.Point(277, 105); - this.Label80.Name = "Label80"; - this.Label80.Size = new System.Drawing.Size(22, 16); - this.Label80.TabIndex = 19; - this.Label80.Text = "px"; - // - // txticonfromtop - // - this.txticonfromtop.BackColor = System.Drawing.Color.White; - this.txticonfromtop.BorderStyle = ShiftUI.BorderStyle.FixedSingle; - this.txticonfromtop.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.txticonfromtop.ForeColor = System.Drawing.Color.Black; - this.txticonfromtop.Location = new System.Drawing.Point(253, 103); - this.txticonfromtop.Name = "txticonfromtop"; - this.txticonfromtop.Size = new System.Drawing.Size(23, 22); - this.txticonfromtop.TabIndex = 18; - this.txticonfromtop.TextChanged += new System.EventHandler(this.txticonfromtop_TextChanged); - // - // Label81 - // - this.Label81.AutoSize = true; - this.Label81.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.Label81.Location = new System.Drawing.Point(157, 105); - this.Label81.Name = "Label81"; - this.Label81.Size = new System.Drawing.Size(98, 16); - this.Label81.TabIndex = 17; - this.Label81.Text = "Icon From Top:"; - // - // Label78 - // - this.Label78.AutoSize = true; - this.Label78.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.Label78.Location = new System.Drawing.Point(128, 105); - this.Label78.Name = "Label78"; - this.Label78.Size = new System.Drawing.Size(22, 16); - this.Label78.TabIndex = 16; - this.Label78.Text = "px"; - // - // txticonfromside - // - this.txticonfromside.BackColor = System.Drawing.Color.White; - this.txticonfromside.BorderStyle = ShiftUI.BorderStyle.FixedSingle; - this.txticonfromside.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.txticonfromside.ForeColor = System.Drawing.Color.Black; - this.txticonfromside.Location = new System.Drawing.Point(104, 103); - this.txticonfromside.Name = "txticonfromside"; - this.txticonfromside.Size = new System.Drawing.Size(23, 22); - this.txticonfromside.TabIndex = 15; - this.txticonfromside.TextChanged += new System.EventHandler(this.txticonfromside_TextChanged); - // - // Label79 - // - this.Label79.AutoSize = true; - this.Label79.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.Label79.Location = new System.Drawing.Point(3, 105); - this.Label79.Name = "Label79"; - this.Label79.Size = new System.Drawing.Size(101, 16); - this.Label79.TabIndex = 14; - this.Label79.Text = "Icon From Side:"; - // - // lbcornerwidthpx - // - this.lbcornerwidthpx.AutoSize = true; - this.lbcornerwidthpx.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.lbcornerwidthpx.Location = new System.Drawing.Point(277, 32); - this.lbcornerwidthpx.Name = "lbcornerwidthpx"; - this.lbcornerwidthpx.Size = new System.Drawing.Size(22, 16); - this.lbcornerwidthpx.TabIndex = 13; - this.lbcornerwidthpx.Text = "px"; - // - // txttitlebarcornerwidth - // - this.txttitlebarcornerwidth.BackColor = System.Drawing.Color.White; - this.txttitlebarcornerwidth.BorderStyle = ShiftUI.BorderStyle.FixedSingle; - this.txttitlebarcornerwidth.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.txttitlebarcornerwidth.ForeColor = System.Drawing.Color.Black; - this.txttitlebarcornerwidth.Location = new System.Drawing.Point(253, 30); - this.txttitlebarcornerwidth.Name = "txttitlebarcornerwidth"; - this.txttitlebarcornerwidth.Size = new System.Drawing.Size(23, 22); - this.txttitlebarcornerwidth.TabIndex = 12; - this.txttitlebarcornerwidth.TextChanged += new System.EventHandler(this.txttitlebarcornerwidth_TextChanged); - // - // lbcornerwidth - // - this.lbcornerwidth.AutoSize = true; - this.lbcornerwidth.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.lbcornerwidth.Location = new System.Drawing.Point(163, 32); - this.lbcornerwidth.Name = "lbcornerwidth"; - this.lbcornerwidth.Size = new System.Drawing.Size(88, 16); - this.lbcornerwidth.TabIndex = 11; - this.lbcornerwidth.Text = "Corner Width:"; - // - // pnltitlebarrightcornercolour - // - this.pnltitlebarrightcornercolour.BackgroundImageLayout = ShiftUI.ImageLayout.Stretch; - this.pnltitlebarrightcornercolour.BorderStyle = ShiftUI.BorderStyle.FixedSingle; - this.pnltitlebarrightcornercolour.Location = new System.Drawing.Point(136, 80); - this.pnltitlebarrightcornercolour.Name = "pnltitlebarrightcornercolour"; - this.pnltitlebarrightcornercolour.Size = new System.Drawing.Size(41, 20); - this.pnltitlebarrightcornercolour.TabIndex = 10; - this.pnltitlebarrightcornercolour.MouseClick += new ShiftUI.MouseEventHandler(this.SetRightCornerColor); - // - // pnltitlebarleftcornercolour - // - this.pnltitlebarleftcornercolour.BackgroundImageLayout = ShiftUI.ImageLayout.Stretch; - this.pnltitlebarleftcornercolour.BorderStyle = ShiftUI.BorderStyle.FixedSingle; - this.pnltitlebarleftcornercolour.Location = new System.Drawing.Point(126, 56); - this.pnltitlebarleftcornercolour.Name = "pnltitlebarleftcornercolour"; - this.pnltitlebarleftcornercolour.Size = new System.Drawing.Size(41, 20); - this.pnltitlebarleftcornercolour.TabIndex = 8; - this.pnltitlebarleftcornercolour.MouseClick += new ShiftUI.MouseEventHandler(this.SetLeftCornerColor); - // - // lbrightcornercolor - // - this.lbrightcornercolor.AutoSize = true; - this.lbrightcornercolor.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.lbrightcornercolor.Location = new System.Drawing.Point(3, 81); - this.lbrightcornercolor.Name = "lbrightcornercolor"; - this.lbrightcornercolor.Size = new System.Drawing.Size(127, 16); - this.lbrightcornercolor.TabIndex = 9; - this.lbrightcornercolor.Text = "Right Corner Colour:"; - // - // lbleftcornercolor - // - this.lbleftcornercolor.AutoSize = true; - this.lbleftcornercolor.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.lbleftcornercolor.Location = new System.Drawing.Point(3, 57); - this.lbleftcornercolor.Name = "lbleftcornercolor"; - this.lbleftcornercolor.Size = new System.Drawing.Size(117, 16); - this.lbleftcornercolor.TabIndex = 7; - this.lbleftcornercolor.Text = "Left Corner Colour:"; - // - // cboxtitlebarcorners - // - this.cboxtitlebarcorners.AutoSize = true; - this.cboxtitlebarcorners.FlatAppearance.BorderColor = System.Drawing.Color.Black; - this.cboxtitlebarcorners.FlatAppearance.CheckedBackColor = System.Drawing.Color.Black; - this.cboxtitlebarcorners.FlatStyle = ShiftUI.FlatStyle.Standard; - this.cboxtitlebarcorners.Font = new System.Drawing.Font("Microsoft Sans Serif", 10.25F); - this.cboxtitlebarcorners.Location = new System.Drawing.Point(166, 4); - this.cboxtitlebarcorners.Name = "cboxtitlebarcorners"; - this.cboxtitlebarcorners.Size = new System.Drawing.Size(131, 21); - this.cboxtitlebarcorners.TabIndex = 6; - this.cboxtitlebarcorners.Text = "Title Bar Corners"; - this.cboxtitlebarcorners.UseVisualStyleBackColor = true; - this.cboxtitlebarcorners.CheckedChanged += new System.EventHandler(this.cboxtitlebarcorners_CheckedChanged); - // - // Label5 - // - this.Label5.AutoSize = true; - this.Label5.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.Label5.Location = new System.Drawing.Point(136, 32); - this.Label5.Name = "Label5"; - this.Label5.Size = new System.Drawing.Size(22, 16); - this.Label5.TabIndex = 5; - this.Label5.Text = "px"; - // - // txttitlebarheight - // - this.txttitlebarheight.BackColor = System.Drawing.Color.White; - this.txttitlebarheight.BorderStyle = ShiftUI.BorderStyle.FixedSingle; - this.txttitlebarheight.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.txttitlebarheight.ForeColor = System.Drawing.Color.Black; - this.txttitlebarheight.Location = new System.Drawing.Point(112, 30); - this.txttitlebarheight.Name = "txttitlebarheight"; - this.txttitlebarheight.Size = new System.Drawing.Size(23, 22); - this.txttitlebarheight.TabIndex = 4; - this.txttitlebarheight.TextChanged += new System.EventHandler(this.txttitlebarheight_TextChanged); - // - // Label4 - // - this.Label4.AutoSize = true; - this.Label4.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.Label4.Location = new System.Drawing.Point(3, 32); - this.Label4.Name = "Label4"; - this.Label4.Size = new System.Drawing.Size(103, 16); - this.Label4.TabIndex = 2; - this.Label4.Text = "Title Bar Height:"; - // - // pnltitlebarcolour - // - this.pnltitlebarcolour.BackgroundImageLayout = ShiftUI.ImageLayout.Stretch; - this.pnltitlebarcolour.BorderStyle = ShiftUI.BorderStyle.FixedSingle; - this.pnltitlebarcolour.Location = new System.Drawing.Point(112, 5); - this.pnltitlebarcolour.Name = "pnltitlebarcolour"; - this.pnltitlebarcolour.Size = new System.Drawing.Size(41, 20); - this.pnltitlebarcolour.TabIndex = 1; - this.pnltitlebarcolour.MouseClick += new ShiftUI.MouseEventHandler(this.SetTitlebarColor); - // - // Label2 - // - this.Label2.AutoSize = true; - this.Label2.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.Label2.Location = new System.Drawing.Point(3, 7); - this.Label2.Name = "Label2"; - this.Label2.Size = new System.Drawing.Size(103, 16); - this.Label2.TabIndex = 0; - this.Label2.Text = "Title Bar Colour:"; - // - // pnlborderoptions - // - this.pnlborderoptions.Anchor = ((ShiftUI.AnchorStyles)((ShiftUI.AnchorStyles.Bottom | ShiftUI.AnchorStyles.Right))); - this.pnlborderoptions.Widgets.Add(this.cbindividualbordercolours); - this.pnlborderoptions.Widgets.Add(this.pnlborderbottomrightcolour); - this.pnlborderoptions.Widgets.Add(this.lbbright); - this.pnlborderoptions.Widgets.Add(this.pnlborderbottomcolour); - this.pnlborderoptions.Widgets.Add(this.lbbottom); - this.pnlborderoptions.Widgets.Add(this.pnlborderbottomleftcolour); - this.pnlborderoptions.Widgets.Add(this.lbbleft); - this.pnlborderoptions.Widgets.Add(this.pnlborderrightcolour); - this.pnlborderoptions.Widgets.Add(this.lbright); - this.pnlborderoptions.Widgets.Add(this.pnlborderleftcolour); - this.pnlborderoptions.Widgets.Add(this.lbleft); - this.pnlborderoptions.Widgets.Add(this.Label15); - this.pnlborderoptions.Widgets.Add(this.pnlbordercolour); - this.pnlborderoptions.Widgets.Add(this.txtbordersize); - this.pnlborderoptions.Widgets.Add(this.Label3); - this.pnlborderoptions.Widgets.Add(this.Label16); - this.pnlborderoptions.Location = new System.Drawing.Point(135, 159); - this.pnlborderoptions.Name = "pnlborderoptions"; - this.pnlborderoptions.RightToLeft = ShiftUI.RightToLeft.Yes; - this.pnlborderoptions.Size = new System.Drawing.Size(325, 139); - this.pnlborderoptions.TabIndex = 10; - this.pnlborderoptions.Visible = false; - // - // cbindividualbordercolours - // - this.cbindividualbordercolours.AutoSize = true; - this.cbindividualbordercolours.FlatAppearance.BorderColor = System.Drawing.Color.Black; - this.cbindividualbordercolours.FlatAppearance.CheckedBackColor = System.Drawing.Color.Black; - this.cbindividualbordercolours.FlatStyle = ShiftUI.FlatStyle.Standard; - this.cbindividualbordercolours.Font = new System.Drawing.Font("Microsoft Sans Serif", 10.25F); - this.cbindividualbordercolours.Location = new System.Drawing.Point(161, 4); - this.cbindividualbordercolours.Name = "cbindividualbordercolours"; - this.cbindividualbordercolours.Size = new System.Drawing.Size(135, 21); - this.cbindividualbordercolours.TabIndex = 28; - this.cbindividualbordercolours.Text = "Individual Colours"; - this.cbindividualbordercolours.UseVisualStyleBackColor = true; - this.cbindividualbordercolours.CheckedChanged += new System.EventHandler(this.cbindividualbordercolours_CheckedChanged); - // - // pnlborderbottomrightcolour - // - this.pnlborderbottomrightcolour.BackgroundImageLayout = ShiftUI.ImageLayout.Stretch; - this.pnlborderbottomrightcolour.BorderStyle = ShiftUI.BorderStyle.FixedSingle; - this.pnlborderbottomrightcolour.Location = new System.Drawing.Point(132, 101); - this.pnlborderbottomrightcolour.Name = "pnlborderbottomrightcolour"; - this.pnlborderbottomrightcolour.Size = new System.Drawing.Size(41, 20); - this.pnlborderbottomrightcolour.TabIndex = 27; - this.pnlborderbottomrightcolour.MouseClick += new ShiftUI.MouseEventHandler(this.SetBottomRBorderColor); - // - // lbbright - // - this.lbbright.AutoSize = true; - this.lbbright.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.lbbright.Location = new System.Drawing.Point(3, 103); - this.lbbright.Name = "lbbright"; - this.lbbright.Size = new System.Drawing.Size(129, 16); - this.lbbright.TabIndex = 26; - this.lbbright.Text = "Bottom Right Colour:"; - // - // pnlborderbottomcolour - // - this.pnlborderbottomcolour.BackgroundImageLayout = ShiftUI.ImageLayout.Stretch; - this.pnlborderbottomcolour.BorderStyle = ShiftUI.BorderStyle.FixedSingle; - this.pnlborderbottomcolour.Location = new System.Drawing.Point(263, 31); - this.pnlborderbottomcolour.Name = "pnlborderbottomcolour"; - this.pnlborderbottomcolour.Size = new System.Drawing.Size(41, 20); - this.pnlborderbottomcolour.TabIndex = 25; - this.pnlborderbottomcolour.MouseClick += new ShiftUI.MouseEventHandler(this.SetBottomBorderColor); - // - // lbbottom - // - this.lbbottom.AutoSize = true; - this.lbbottom.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.lbbottom.Location = new System.Drawing.Point(158, 32); - this.lbbottom.Name = "lbbottom"; - this.lbbottom.Size = new System.Drawing.Size(95, 16); - this.lbbottom.TabIndex = 24; - this.lbbottom.Text = "Bottom Colour:"; - // - // pnlborderbottomleftcolour - // - this.pnlborderbottomleftcolour.BackgroundImageLayout = ShiftUI.ImageLayout.Stretch; - this.pnlborderbottomleftcolour.BorderStyle = ShiftUI.BorderStyle.FixedSingle; - this.pnlborderbottomleftcolour.Location = new System.Drawing.Point(124, 78); - this.pnlborderbottomleftcolour.Name = "pnlborderbottomleftcolour"; - this.pnlborderbottomleftcolour.Size = new System.Drawing.Size(41, 20); - this.pnlborderbottomleftcolour.TabIndex = 23; - this.pnlborderbottomleftcolour.MouseClick += new ShiftUI.MouseEventHandler(this.SetBottomLColor); - // - // lbbleft - // - this.lbbleft.AutoSize = true; - this.lbbleft.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.lbbleft.Location = new System.Drawing.Point(3, 80); - this.lbbleft.Name = "lbbleft"; - this.lbbleft.Size = new System.Drawing.Size(119, 16); - this.lbbleft.TabIndex = 22; - this.lbbleft.Text = "Bottom Left Colour:"; - // - // pnlborderrightcolour - // - this.pnlborderrightcolour.BackgroundImageLayout = ShiftUI.ImageLayout.Stretch; - this.pnlborderrightcolour.BorderStyle = ShiftUI.BorderStyle.FixedSingle; - this.pnlborderrightcolour.Location = new System.Drawing.Point(263, 54); - this.pnlborderrightcolour.Name = "pnlborderrightcolour"; - this.pnlborderrightcolour.Size = new System.Drawing.Size(41, 20); - this.pnlborderrightcolour.TabIndex = 21; - this.pnlborderrightcolour.MouseClick += new ShiftUI.MouseEventHandler(this.SetRightBorderColor); - // - // lbright - // - this.lbright.AutoSize = true; - this.lbright.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.lbright.Location = new System.Drawing.Point(157, 56); - this.lbright.Name = "lbright"; - this.lbright.Size = new System.Drawing.Size(84, 16); - this.lbright.TabIndex = 20; - this.lbright.Text = "Right Colour:"; - // - // pnlborderleftcolour - // - this.pnlborderleftcolour.BackgroundImageLayout = ShiftUI.ImageLayout.Stretch; - this.pnlborderleftcolour.BorderStyle = ShiftUI.BorderStyle.FixedSingle; - this.pnlborderleftcolour.Location = new System.Drawing.Point(102, 54); - this.pnlborderleftcolour.Name = "pnlborderleftcolour"; - this.pnlborderleftcolour.Size = new System.Drawing.Size(41, 20); - this.pnlborderleftcolour.TabIndex = 19; - this.pnlborderleftcolour.MouseClick += new ShiftUI.MouseEventHandler(this.SetLeftBorderColor); - // - // lbleft - // - this.lbleft.AutoSize = true; - this.lbleft.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.lbleft.Location = new System.Drawing.Point(3, 56); - this.lbleft.Name = "lbleft"; - this.lbleft.Size = new System.Drawing.Size(74, 16); - this.lbleft.TabIndex = 18; - this.lbleft.Text = "Left Colour:"; - // - // Label15 - // - this.Label15.AutoSize = true; - this.Label15.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.Label15.Location = new System.Drawing.Point(126, 31); - this.Label15.Name = "Label15"; - this.Label15.Size = new System.Drawing.Size(22, 16); - this.Label15.TabIndex = 17; - this.Label15.Text = "px"; - // - // pnlbordercolour - // - this.pnlbordercolour.BorderStyle = ShiftUI.BorderStyle.FixedSingle; - this.pnlbordercolour.Location = new System.Drawing.Point(102, 5); - this.pnlbordercolour.Name = "pnlbordercolour"; - this.pnlbordercolour.Size = new System.Drawing.Size(41, 20); - this.pnlbordercolour.TabIndex = 3; - this.pnlbordercolour.MouseClick += new ShiftUI.MouseEventHandler(this.SetMainBorderColor); - // - // txtbordersize - // - this.txtbordersize.BackColor = System.Drawing.Color.White; - this.txtbordersize.BorderStyle = ShiftUI.BorderStyle.FixedSingle; - this.txtbordersize.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.txtbordersize.ForeColor = System.Drawing.Color.Black; - this.txtbordersize.Location = new System.Drawing.Point(102, 29); - this.txtbordersize.Name = "txtbordersize"; - this.txtbordersize.Size = new System.Drawing.Size(23, 22); - this.txtbordersize.TabIndex = 16; - this.txtbordersize.TextChanged += new System.EventHandler(this.txtbordersize_TextChanged); - // - // Label3 - // - this.Label3.AutoSize = true; - this.Label3.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.Label3.Location = new System.Drawing.Point(3, 7); - this.Label3.Name = "Label3"; - this.Label3.Size = new System.Drawing.Size(94, 16); - this.Label3.TabIndex = 2; - this.Label3.Text = "Border Colour:"; - // - // Label16 - // - this.Label16.AutoSize = true; - this.Label16.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.Label16.Location = new System.Drawing.Point(3, 31); - this.Label16.Name = "Label16"; - this.Label16.Size = new System.Drawing.Size(81, 16); - this.Label16.TabIndex = 15; - this.Label16.Text = "Border Size:"; - // - // pnltitletextoptions - // - this.pnltitletextoptions.Anchor = ((ShiftUI.AnchorStyles)((ShiftUI.AnchorStyles.Bottom | ShiftUI.AnchorStyles.Right))); - this.pnltitletextoptions.Widgets.Add(this.combotitletextposition); - this.pnltitletextoptions.Widgets.Add(this.Label53); - this.pnltitletextoptions.Widgets.Add(this.combotitletextstyle); - this.pnltitletextoptions.Widgets.Add(this.combotitletextfont); - this.pnltitletextoptions.Widgets.Add(this.Label23); - this.pnltitletextoptions.Widgets.Add(this.Label17); - this.pnltitletextoptions.Widgets.Add(this.txttitletextside); - this.pnltitletextoptions.Widgets.Add(this.Label18); - this.pnltitletextoptions.Widgets.Add(this.Label19); - this.pnltitletextoptions.Widgets.Add(this.txttitletexttop); - this.pnltitletextoptions.Widgets.Add(this.Label20); - this.pnltitletextoptions.Widgets.Add(this.Label21); - this.pnltitletextoptions.Widgets.Add(this.txttitletextsize); - this.pnltitletextoptions.Widgets.Add(this.Label22); - this.pnltitletextoptions.Widgets.Add(this.Label24); - this.pnltitletextoptions.Widgets.Add(this.pnltitletextcolour); - this.pnltitletextoptions.Widgets.Add(this.Label25); - this.pnltitletextoptions.Location = new System.Drawing.Point(135, 159); - this.pnltitletextoptions.Name = "pnltitletextoptions"; - this.pnltitletextoptions.Size = new System.Drawing.Size(325, 139); - this.pnltitletextoptions.TabIndex = 15; - this.pnltitletextoptions.Visible = false; - // - // combotitletextposition - // - this.combotitletextposition.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.combotitletextposition.FormattingEnabled = true; - this.combotitletextposition.Items.AddRange(new object[] { - "Left", - "Centre"}); - this.combotitletextposition.Location = new System.Drawing.Point(211, 54); - this.combotitletextposition.Name = "combotitletextposition"; - this.combotitletextposition.Size = new System.Drawing.Size(95, 24); - this.combotitletextposition.TabIndex = 21; - this.combotitletextposition.SelectedIndexChanged += new System.EventHandler(this.combotitletextposition_SelectedIndexChanged); - // - // Label53 - // - this.Label53.AutoSize = true; - this.Label53.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.Label53.Location = new System.Drawing.Point(149, 57); - this.Label53.Name = "Label53"; - this.Label53.Size = new System.Drawing.Size(59, 16); - this.Label53.TabIndex = 20; - this.Label53.Text = "Position:"; - // - // combotitletextstyle - // - this.combotitletextstyle.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.combotitletextstyle.FormattingEnabled = true; - this.combotitletextstyle.Items.AddRange(new object[] { - "Bold", - "Italic", - "Regular", - "Strikeout", - "Underline"}); - this.combotitletextstyle.Location = new System.Drawing.Point(207, 3); - this.combotitletextstyle.Name = "combotitletextstyle"; - this.combotitletextstyle.Size = new System.Drawing.Size(99, 24); - this.combotitletextstyle.TabIndex = 18; - this.combotitletextstyle.SelectedIndexChanged += new System.EventHandler(this.combotitletextstyle_SelectedIndexChanged); - // - // combotitletextfont - // - this.combotitletextfont.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.combotitletextfont.FormattingEnabled = true; - this.combotitletextfont.Location = new System.Drawing.Point(100, 30); - this.combotitletextfont.Name = "combotitletextfont"; - this.combotitletextfont.Size = new System.Drawing.Size(202, 24); - this.combotitletextfont.TabIndex = 17; - this.combotitletextfont.SelectedIndexChanged += new System.EventHandler(this.combotitletextfont_SelectedIndexChanged); - // - // Label23 - // - this.Label23.AutoSize = true; - this.Label23.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.Label23.Location = new System.Drawing.Point(164, 7); - this.Label23.Name = "Label23"; - this.Label23.Size = new System.Drawing.Size(41, 16); - this.Label23.TabIndex = 15; - this.Label23.Text = "Style:"; - // - // Label17 - // - this.Label17.AutoSize = true; - this.Label17.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.Label17.Location = new System.Drawing.Point(159, 107); - this.Label17.Name = "Label17"; - this.Label17.Size = new System.Drawing.Size(22, 16); - this.Label17.TabIndex = 14; - this.Label17.Text = "px"; - // - // txttitletextside - // - this.txttitletextside.BackColor = System.Drawing.Color.White; - this.txttitletextside.BorderStyle = ShiftUI.BorderStyle.FixedSingle; - this.txttitletextside.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.txttitletextside.ForeColor = System.Drawing.Color.Black; - this.txttitletextside.Location = new System.Drawing.Point(135, 105); - this.txttitletextside.Name = "txttitletextside"; - this.txttitletextside.Size = new System.Drawing.Size(23, 22); - this.txttitletextside.TabIndex = 13; - this.txttitletextside.TextChanged += new System.EventHandler(this.txttitletextside_TextChanged); - // - // Label18 - // - this.Label18.AutoSize = true; - this.Label18.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.Label18.Location = new System.Drawing.Point(3, 107); - this.Label18.Name = "Label18"; - this.Label18.Size = new System.Drawing.Size(131, 16); - this.Label18.TabIndex = 12; - this.Label18.Text = "Title Text From Side:"; - // - // Label19 - // - this.Label19.AutoSize = true; - this.Label19.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.Label19.Location = new System.Drawing.Point(159, 82); - this.Label19.Name = "Label19"; - this.Label19.Size = new System.Drawing.Size(22, 16); - this.Label19.TabIndex = 11; - this.Label19.Text = "px"; - // - // txttitletexttop - // - this.txttitletexttop.BackColor = System.Drawing.Color.White; - this.txttitletexttop.BorderStyle = ShiftUI.BorderStyle.FixedSingle; - this.txttitletexttop.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.txttitletexttop.ForeColor = System.Drawing.Color.Black; - this.txttitletexttop.Location = new System.Drawing.Point(135, 80); - this.txttitletexttop.Name = "txttitletexttop"; - this.txttitletexttop.Size = new System.Drawing.Size(23, 22); - this.txttitletexttop.TabIndex = 10; - this.txttitletexttop.TextChanged += new System.EventHandler(this.txttitletexttop_TextChanged); - // - // Label20 - // - this.Label20.AutoSize = true; - this.Label20.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.Label20.Location = new System.Drawing.Point(3, 82); - this.Label20.Name = "Label20"; - this.Label20.Size = new System.Drawing.Size(128, 16); - this.Label20.TabIndex = 9; - this.Label20.Text = "Title Text From Top:"; - // - // Label21 - // - this.Label21.AutoSize = true; - this.Label21.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.Label21.Location = new System.Drawing.Point(124, 57); - this.Label21.Name = "Label21"; - this.Label21.Size = new System.Drawing.Size(22, 16); - this.Label21.TabIndex = 8; - this.Label21.Text = "px"; - // - // txttitletextsize - // - this.txttitletextsize.BackColor = System.Drawing.Color.White; - this.txttitletextsize.BorderStyle = ShiftUI.BorderStyle.FixedSingle; - this.txttitletextsize.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.txttitletextsize.ForeColor = System.Drawing.Color.Black; - this.txttitletextsize.Location = new System.Drawing.Point(100, 55); - this.txttitletextsize.Name = "txttitletextsize"; - this.txttitletextsize.Size = new System.Drawing.Size(23, 22); - this.txttitletextsize.TabIndex = 7; - this.txttitletextsize.TextChanged += new System.EventHandler(this.txttitletextsize_TextChanged); - // - // Label22 - // - this.Label22.AutoSize = true; - this.Label22.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.Label22.Location = new System.Drawing.Point(3, 57); - this.Label22.Name = "Label22"; - this.Label22.Size = new System.Drawing.Size(95, 16); - this.Label22.TabIndex = 6; - this.Label22.Text = "Title Text Size:"; - // - // Label24 - // - this.Label24.AutoSize = true; - this.Label24.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.Label24.Location = new System.Drawing.Point(3, 33); - this.Label24.Name = "Label24"; - this.Label24.Size = new System.Drawing.Size(95, 16); - this.Label24.TabIndex = 2; - this.Label24.Text = "Title Text Font:"; - // - // pnltitletextcolour - // - this.pnltitletextcolour.BorderStyle = ShiftUI.BorderStyle.FixedSingle; - this.pnltitletextcolour.Location = new System.Drawing.Point(114, 5); - this.pnltitletextcolour.Name = "pnltitletextcolour"; - this.pnltitletextcolour.Size = new System.Drawing.Size(41, 20); - this.pnltitletextcolour.TabIndex = 1; - this.pnltitletextcolour.MouseClick += new ShiftUI.MouseEventHandler(this.SetTitleTextColor); - // - // Label25 - // - this.Label25.AutoSize = true; - this.Label25.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.Label25.Location = new System.Drawing.Point(3, 7); - this.Label25.Name = "Label25"; - this.Label25.Size = new System.Drawing.Size(108, 16); - this.Label25.TabIndex = 0; - this.Label25.Text = "Title Text Colour:"; - // - // pnlwindowsobjects - // - this.pnlwindowsobjects.Anchor = ((ShiftUI.AnchorStyles)((ShiftUI.AnchorStyles.Bottom | ShiftUI.AnchorStyles.Left))); - this.pnlwindowsobjects.Widgets.Add(this.btnborders); - this.pnlwindowsobjects.Widgets.Add(this.btnbuttons); - this.pnlwindowsobjects.Widgets.Add(this.btntitletext); - this.pnlwindowsobjects.Widgets.Add(this.btntitlebar); - this.pnlwindowsobjects.Location = new System.Drawing.Point(1, 159); - this.pnlwindowsobjects.Name = "pnlwindowsobjects"; - this.pnlwindowsobjects.Size = new System.Drawing.Size(128, 135); - this.pnlwindowsobjects.TabIndex = 8; - // - // btnborders - // - this.btnborders.BackColor = System.Drawing.Color.White; - this.btnborders.FlatStyle = ShiftUI.FlatStyle.Standard; - this.btnborders.Font = new System.Drawing.Font("Cambria", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.btnborders.Location = new System.Drawing.Point(4, 105); - this.btnborders.Name = "btnborders"; - this.btnborders.Size = new System.Drawing.Size(119, 29); - this.btnborders.TabIndex = 7; - this.btnborders.TabStop = false; - this.btnborders.Text = "Borders"; - this.btnborders.UseVisualStyleBackColor = false; - this.btnborders.Click += new System.EventHandler(this.btnborders_Click); - // - // btnbuttons - // - this.btnbuttons.BackColor = System.Drawing.Color.White; - this.btnbuttons.FlatStyle = ShiftUI.FlatStyle.Standard; - this.btnbuttons.Font = new System.Drawing.Font("Cambria", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.btnbuttons.Location = new System.Drawing.Point(4, 70); - this.btnbuttons.Name = "btnbuttons"; - this.btnbuttons.Size = new System.Drawing.Size(119, 29); - this.btnbuttons.TabIndex = 6; - this.btnbuttons.TabStop = false; - this.btnbuttons.Text = "Buttons"; - this.btnbuttons.UseVisualStyleBackColor = false; - this.btnbuttons.Click += new System.EventHandler(this.btnbuttons_Click); - // - // btntitletext - // - this.btntitletext.BackColor = System.Drawing.Color.White; - this.btntitletext.FlatStyle = ShiftUI.FlatStyle.Standard; - this.btntitletext.Font = new System.Drawing.Font("Cambria", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.btntitletext.Location = new System.Drawing.Point(4, 35); - this.btntitletext.Name = "btntitletext"; - this.btntitletext.Size = new System.Drawing.Size(119, 29); - this.btntitletext.TabIndex = 5; - this.btntitletext.TabStop = false; - this.btntitletext.Text = "Title Text"; - this.btntitletext.UseVisualStyleBackColor = false; - this.btntitletext.Click += new System.EventHandler(this.btntitletext_Click_1); - // - // btntitlebar - // - this.btntitlebar.BackColor = System.Drawing.Color.White; - this.btntitlebar.FlatStyle = ShiftUI.FlatStyle.Standard; - this.btntitlebar.Font = new System.Drawing.Font("Cambria", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.btntitlebar.Location = new System.Drawing.Point(4, 0); - this.btntitlebar.Name = "btntitlebar"; - this.btntitlebar.Size = new System.Drawing.Size(119, 29); - this.btntitlebar.TabIndex = 4; - this.btntitlebar.TabStop = false; - this.btntitlebar.Text = "Title Bar"; - this.btntitlebar.UseVisualStyleBackColor = false; - this.btntitlebar.Click += new System.EventHandler(this.btntitlebar_Click); - // - // pnlwindowpreview - // - this.pnlwindowpreview.Anchor = ((ShiftUI.AnchorStyles)((((ShiftUI.AnchorStyles.Top | ShiftUI.AnchorStyles.Bottom) - | ShiftUI.AnchorStyles.Left) - | ShiftUI.AnchorStyles.Right))); - this.pnlwindowpreview.Widgets.Add(this.prepgcontent); - this.pnlwindowpreview.Widgets.Add(this.prepgbottom); - this.pnlwindowpreview.Widgets.Add(this.prepgleft); - this.pnlwindowpreview.Widgets.Add(this.prepgright); - this.pnlwindowpreview.Widgets.Add(this.pretitlebar); - this.pnlwindowpreview.Location = new System.Drawing.Point(5, 3); - this.pnlwindowpreview.Name = "pnlwindowpreview"; - this.pnlwindowpreview.Size = new System.Drawing.Size(448, 148); - this.pnlwindowpreview.TabIndex = 0; - // - // prepgcontent - // - this.prepgcontent.Dock = ShiftUI.DockStyle.Fill; - this.prepgcontent.Location = new System.Drawing.Point(2, 30); - this.prepgcontent.Name = "prepgcontent"; - this.prepgcontent.Size = new System.Drawing.Size(444, 116); - this.prepgcontent.TabIndex = 20; - // - // prepgbottom - // - this.prepgbottom.BackColor = System.Drawing.Color.Gray; - this.prepgbottom.Dock = ShiftUI.DockStyle.Bottom; - this.prepgbottom.Location = new System.Drawing.Point(2, 146); - this.prepgbottom.Name = "prepgbottom"; - this.prepgbottom.Size = new System.Drawing.Size(444, 2); - this.prepgbottom.TabIndex = 23; - // - // prepgleft - // - this.prepgleft.BackColor = System.Drawing.Color.Gray; - this.prepgleft.Widgets.Add(this.prepgbottomlcorner); - this.prepgleft.Dock = ShiftUI.DockStyle.Left; - this.prepgleft.Location = new System.Drawing.Point(0, 30); - this.prepgleft.Name = "prepgleft"; - this.prepgleft.Size = new System.Drawing.Size(2, 118); - this.prepgleft.TabIndex = 21; - // - // prepgbottomlcorner - // - this.prepgbottomlcorner.BackColor = System.Drawing.Color.Red; - this.prepgbottomlcorner.Dock = ShiftUI.DockStyle.Bottom; - this.prepgbottomlcorner.Location = new System.Drawing.Point(0, 116); - this.prepgbottomlcorner.Name = "prepgbottomlcorner"; - this.prepgbottomlcorner.Size = new System.Drawing.Size(2, 2); - this.prepgbottomlcorner.TabIndex = 14; - // - // prepgright - // - this.prepgright.BackColor = System.Drawing.Color.Gray; - this.prepgright.Widgets.Add(this.prepgbottomrcorner); - this.prepgright.Dock = ShiftUI.DockStyle.Right; - this.prepgright.Location = new System.Drawing.Point(446, 30); - this.prepgright.Name = "prepgright"; - this.prepgright.Size = new System.Drawing.Size(2, 118); - this.prepgright.TabIndex = 22; - // - // prepgbottomrcorner - // - this.prepgbottomrcorner.BackColor = System.Drawing.Color.Red; - this.prepgbottomrcorner.Dock = ShiftUI.DockStyle.Bottom; - this.prepgbottomrcorner.Location = new System.Drawing.Point(0, 116); - this.prepgbottomrcorner.Name = "prepgbottomrcorner"; - this.prepgbottomrcorner.Size = new System.Drawing.Size(2, 2); - this.prepgbottomrcorner.TabIndex = 15; - // - // pretitlebar - // - this.pretitlebar.BackColor = System.Drawing.Color.Gray; - this.pretitlebar.Widgets.Add(this.preminimizebutton); - this.pretitlebar.Widgets.Add(this.prepnlicon); - this.pretitlebar.Widgets.Add(this.prerollupbutton); - this.pretitlebar.Widgets.Add(this.preclosebutton); - this.pretitlebar.Widgets.Add(this.pretitletext); - this.pretitlebar.Widgets.Add(this.prepgtoplcorner); - this.pretitlebar.Widgets.Add(this.prepgtoprcorner); - this.pretitlebar.Dock = ShiftUI.DockStyle.Top; - this.pretitlebar.ForeColor = System.Drawing.Color.White; - this.pretitlebar.Location = new System.Drawing.Point(0, 0); - this.pretitlebar.Name = "pretitlebar"; - this.pretitlebar.Size = new System.Drawing.Size(448, 30); - this.pretitlebar.TabIndex = 19; - // - // preminimizebutton - // - this.preminimizebutton.BackColor = System.Drawing.Color.Black; - this.preminimizebutton.Location = new System.Drawing.Point(185, 5); - this.preminimizebutton.Name = "preminimizebutton"; - this.preminimizebutton.Size = new System.Drawing.Size(22, 22); - this.preminimizebutton.TabIndex = 31; - // - // prepnlicon - // - this.prepnlicon.BackColor = System.Drawing.Color.Transparent; - this.prepnlicon.Location = new System.Drawing.Point(8, 8); - this.prepnlicon.Name = "prepnlicon"; - this.prepnlicon.Size = new System.Drawing.Size(16, 16); - this.prepnlicon.TabIndex = 32; - this.prepnlicon.TabStop = false; - this.prepnlicon.Visible = false; - // - // prerollupbutton - // - this.prerollupbutton.BackColor = System.Drawing.Color.Black; - this.prerollupbutton.Location = new System.Drawing.Point(213, 5); - this.prerollupbutton.Name = "prerollupbutton"; - this.prerollupbutton.Size = new System.Drawing.Size(22, 22); - this.prerollupbutton.TabIndex = 31; - // - // preclosebutton - // - this.preclosebutton.BackColor = System.Drawing.Color.Black; - this.preclosebutton.Location = new System.Drawing.Point(251, 5); - this.preclosebutton.Name = "preclosebutton"; - this.preclosebutton.Size = new System.Drawing.Size(22, 22); - this.preclosebutton.TabIndex = 20; - // - // pretitletext - // - this.pretitletext.AutoSize = true; - this.pretitletext.BackColor = System.Drawing.Color.Transparent; - this.pretitletext.Font = new System.Drawing.Font("Microsoft Sans Serif", 11.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.pretitletext.Location = new System.Drawing.Point(29, 7); - this.pretitletext.Name = "pretitletext"; - this.pretitletext.Size = new System.Drawing.Size(77, 18); - this.pretitletext.TabIndex = 19; - this.pretitletext.Text = "Template"; - // - // prepgtoplcorner - // - this.prepgtoplcorner.BackColor = System.Drawing.Color.Red; - this.prepgtoplcorner.Dock = ShiftUI.DockStyle.Left; - this.prepgtoplcorner.Location = new System.Drawing.Point(0, 0); - this.prepgtoplcorner.Name = "prepgtoplcorner"; - this.prepgtoplcorner.Size = new System.Drawing.Size(2, 30); - this.prepgtoplcorner.TabIndex = 17; - // - // prepgtoprcorner - // - this.prepgtoprcorner.BackColor = System.Drawing.Color.Red; - this.prepgtoprcorner.Dock = ShiftUI.DockStyle.Right; - this.prepgtoprcorner.Location = new System.Drawing.Point(446, 0); - this.prepgtoprcorner.Name = "prepgtoprcorner"; - this.prepgtoprcorner.Size = new System.Drawing.Size(2, 30); - this.prepgtoprcorner.TabIndex = 16; - // - // pnlreset - // - this.pnlreset.Anchor = ((ShiftUI.AnchorStyles)((((ShiftUI.AnchorStyles.Top | ShiftUI.AnchorStyles.Bottom) - | ShiftUI.AnchorStyles.Left) - | ShiftUI.AnchorStyles.Right))); - this.pnlreset.Widgets.Add(this.Label113); - this.pnlreset.Widgets.Add(this.btnresetallsettings); - this.pnlreset.Widgets.Add(this.Label109); - this.pnlreset.Widgets.Add(this.Label111); - this.pnlreset.Location = new System.Drawing.Point(134, 9); - this.pnlreset.Name = "pnlreset"; - this.pnlreset.Size = new System.Drawing.Size(457, 306); - this.pnlreset.TabIndex = 18; - // - // Label113 - // - this.Label113.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.Label113.Location = new System.Drawing.Point(57, 231); - this.Label113.Name = "Label113"; - this.Label113.Size = new System.Drawing.Size(332, 33); - this.Label113.TabIndex = 5; - this.Label113.Text = "Warning! A Global Reset Is Irreversible!"; - this.Label113.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; - // - // btnresetallsettings - // - this.btnresetallsettings.FlatStyle = ShiftUI.FlatStyle.Standard; - this.btnresetallsettings.Font = new System.Drawing.Font("Cambria", 20.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.btnresetallsettings.Location = new System.Drawing.Point(101, 145); - this.btnresetallsettings.Name = "btnresetallsettings"; - this.btnresetallsettings.Size = new System.Drawing.Size(255, 83); - this.btnresetallsettings.TabIndex = 4; - this.btnresetallsettings.TabStop = false; - this.btnresetallsettings.Text = "Reset All Settings"; - this.btnresetallsettings.UseVisualStyleBackColor = true; - this.btnresetallsettings.Click += new System.EventHandler(this.btnresetallsettings_Click); - // - // Label109 - // - this.Label109.BackColor = System.Drawing.Color.Transparent; - this.Label109.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.Label109.Location = new System.Drawing.Point(4, 40); - this.Label109.Name = "Label109"; - this.Label109.Size = new System.Drawing.Size(451, 66); - this.Label109.TabIndex = 3; - this.Label109.Text = resources.GetString("Label109.Text"); - this.Label109.TextAlign = System.Drawing.ContentAlignment.TopCenter; - // - // Label111 - // - this.Label111.Font = new System.Drawing.Font("Microsoft Sans Serif", 20.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.Label111.Location = new System.Drawing.Point(68, 4); - this.Label111.Name = "Label111"; - this.Label111.Size = new System.Drawing.Size(332, 33); - this.Label111.TabIndex = 2; - this.Label111.Text = "Global Settings Reset!"; - this.Label111.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; - // - // pgcontents - // - this.pgcontents.BackColor = System.Drawing.Color.White; - this.pgcontents.Widgets.Add(this.pnldesktopoptions); - this.pgcontents.Widgets.Add(this.pnlluaoptions); - this.pgcontents.Widgets.Add(this.pnldesktopcomposition); - this.pgcontents.Widgets.Add(this.pnlreset); - this.pgcontents.Widgets.Add(this.pnlwindowsoptions); - this.pgcontents.Widgets.Add(this.pnlmenus); - this.pgcontents.Widgets.Add(this.pnlshifterintro); - this.pgcontents.Widgets.Add(this.catholder); - this.pgcontents.Widgets.Add(this.btnapply); - this.pgcontents.Widgets.Add(this.Label1); - this.pgcontents.Dock = ShiftUI.DockStyle.Fill; - this.pgcontents.Location = new System.Drawing.Point(0, 0); - this.pgcontents.Name = "pgcontents"; - this.pgcontents.Size = new System.Drawing.Size(600, 323); - this.pgcontents.TabIndex = 0; - // - // pnldesktopcomposition - // - this.pnldesktopcomposition.Anchor = ((ShiftUI.AnchorStyles)((((ShiftUI.AnchorStyles.Top | ShiftUI.AnchorStyles.Bottom) - | ShiftUI.AnchorStyles.Left) - | ShiftUI.AnchorStyles.Right))); - this.pnldesktopcomposition.BackColor = System.Drawing.Color.White; - this.pnldesktopcomposition.Widgets.Add(this.pnlfancywindows); - this.pnldesktopcomposition.Widgets.Add(this.pnlfancydragging); - this.pnldesktopcomposition.Widgets.Add(this.pnlfancyintro); - this.pnldesktopcomposition.Widgets.Add(this.panel18); - this.pnldesktopcomposition.Widgets.Add(this.panel25); - this.pnldesktopcomposition.Widgets.Add(this.panel36); - this.pnldesktopcomposition.Widgets.Add(this.label176); - this.pnldesktopcomposition.Location = new System.Drawing.Point(134, 9); - this.pnldesktopcomposition.Name = "pnldesktopcomposition"; - this.pnldesktopcomposition.Size = new System.Drawing.Size(457, 306); - this.pnldesktopcomposition.TabIndex = 20; - // - // pnlfancywindows - // - this.pnlfancywindows.Widgets.Add(this.txtwinfadedec); - this.pnlfancywindows.Widgets.Add(this.label150); - this.pnlfancywindows.Widgets.Add(this.txtwinfadespeed); - this.pnlfancywindows.Widgets.Add(this.label151); - this.pnlfancywindows.Widgets.Add(this.cbdrageffect); - this.pnlfancywindows.Widgets.Add(this.label141); - this.pnlfancywindows.Widgets.Add(this.cbcloseanim); - this.pnlfancywindows.Widgets.Add(this.label128); - this.pnlfancywindows.Widgets.Add(this.cbopenanim); - this.pnlfancywindows.Widgets.Add(this.label127); - this.pnlfancywindows.Widgets.Add(this.label149); - this.pnlfancywindows.Location = new System.Drawing.Point(139, 43); - this.pnlfancywindows.Name = "pnlfancywindows"; - this.pnlfancywindows.Size = new System.Drawing.Size(311, 256); - this.pnlfancywindows.TabIndex = 13; - // - // txtwinfadedec - // - this.txtwinfadedec.BorderStyle = ShiftUI.BorderStyle.FixedSingle; - this.txtwinfadedec.Font = new System.Drawing.Font("Microsoft Sans Serif", 10F); - this.txtwinfadedec.Location = new System.Drawing.Point(225, 189); - this.txtwinfadedec.Name = "txtwinfadedec"; - this.txtwinfadedec.Size = new System.Drawing.Size(35, 23); - this.txtwinfadedec.TabIndex = 26; - this.txtwinfadedec.TextChanged += new System.EventHandler(this.txtwinfadedec_TextChanged); - // - // label150 - // - this.label150.AutoSize = true; - this.label150.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.label150.Location = new System.Drawing.Point(153, 191); - this.label150.Name = "label150"; - this.label150.Size = new System.Drawing.Size(71, 16); - this.label150.TabIndex = 25; - this.label150.Text = "Fade Dec."; - // - // txtwinfadespeed - // - this.txtwinfadespeed.BorderStyle = ShiftUI.BorderStyle.FixedSingle; - this.txtwinfadespeed.Font = new System.Drawing.Font("Microsoft Sans Serif", 10F); - this.txtwinfadespeed.Location = new System.Drawing.Point(109, 185); - this.txtwinfadespeed.Name = "txtwinfadespeed"; - this.txtwinfadespeed.Size = new System.Drawing.Size(35, 23); - this.txtwinfadespeed.TabIndex = 24; - this.txtwinfadespeed.TextChanged += new System.EventHandler(this.txtwinfadespeed_TextChanged); - // - // label151 - // - this.label151.AutoSize = true; - this.label151.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.label151.Location = new System.Drawing.Point(13, 189); - this.label151.Name = "label151"; - this.label151.Size = new System.Drawing.Size(84, 16); - this.label151.TabIndex = 23; - this.label151.Text = "Fade Speed"; - // - // cbdrageffect - // - this.cbdrageffect.Anchor = ((ShiftUI.AnchorStyles)(((ShiftUI.AnchorStyles.Top | ShiftUI.AnchorStyles.Left) - | ShiftUI.AnchorStyles.Right))); - this.cbdrageffect.DropDownStyle = ShiftUI.ComboBoxStyle.DropDownList; - this.cbdrageffect.FormattingEnabled = true; - this.cbdrageffect.Location = new System.Drawing.Point(6, 153); - this.cbdrageffect.Name = "cbdrageffect"; - this.cbdrageffect.Size = new System.Drawing.Size(294, 21); - this.cbdrageffect.TabIndex = 22; - this.cbdrageffect.SelectedIndexChanged += new System.EventHandler(this.cbdrageffect_SelectedIndexChanged); - // - // label141 - // - this.label141.AutoSize = true; - this.label141.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.label141.Location = new System.Drawing.Point(7, 132); - this.label141.Name = "label141"; - this.label141.Size = new System.Drawing.Size(125, 16); - this.label141.TabIndex = 21; - this.label141.Text = "Window Drag Effect"; - // - // cbcloseanim - // - this.cbcloseanim.Anchor = ((ShiftUI.AnchorStyles)(((ShiftUI.AnchorStyles.Top | ShiftUI.AnchorStyles.Left) - | ShiftUI.AnchorStyles.Right))); - this.cbcloseanim.DropDownStyle = ShiftUI.ComboBoxStyle.DropDownList; - this.cbcloseanim.FormattingEnabled = true; - this.cbcloseanim.Location = new System.Drawing.Point(8, 102); - this.cbcloseanim.Name = "cbcloseanim"; - this.cbcloseanim.Size = new System.Drawing.Size(294, 21); - this.cbcloseanim.TabIndex = 20; - this.cbcloseanim.SelectedIndexChanged += new System.EventHandler(this.cbcloseanim_SelectedIndexChanged); - // - // label128 - // - this.label128.AutoSize = true; - this.label128.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.label128.Location = new System.Drawing.Point(9, 81); - this.label128.Name = "label128"; - this.label128.Size = new System.Drawing.Size(156, 16); - this.label128.TabIndex = 19; - this.label128.Text = "Window Close Animation"; - // - // cbopenanim - // - this.cbopenanim.Anchor = ((ShiftUI.AnchorStyles)(((ShiftUI.AnchorStyles.Top | ShiftUI.AnchorStyles.Left) - | ShiftUI.AnchorStyles.Right))); - this.cbopenanim.DropDownStyle = ShiftUI.ComboBoxStyle.DropDownList; - this.cbopenanim.FormattingEnabled = true; - this.cbopenanim.Location = new System.Drawing.Point(9, 50); - this.cbopenanim.Name = "cbopenanim"; - this.cbopenanim.Size = new System.Drawing.Size(294, 21); - this.cbopenanim.TabIndex = 18; - this.cbopenanim.SelectedIndexChanged += new System.EventHandler(this.cbopenanim_SelectedIndexChanged); - // - // label127 - // - this.label127.AutoSize = true; - this.label127.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.label127.Location = new System.Drawing.Point(10, 29); - this.label127.Name = "label127"; - this.label127.Size = new System.Drawing.Size(154, 16); - this.label127.TabIndex = 17; - this.label127.Text = "Window Open Animation"; - // - // label149 - // - this.label149.Anchor = ((ShiftUI.AnchorStyles)(((ShiftUI.AnchorStyles.Top | ShiftUI.AnchorStyles.Left) - | ShiftUI.AnchorStyles.Right))); - this.label149.Font = new System.Drawing.Font("Microsoft Sans Serif", 16F, System.Drawing.FontStyle.Bold); - this.label149.Location = new System.Drawing.Point(6, 0); - this.label149.Name = "label149"; - this.label149.Size = new System.Drawing.Size(301, 29); - this.label149.TabIndex = 1; - this.label149.Text = "Animations"; - this.label149.TextAlign = System.Drawing.ContentAlignment.TopCenter; - // - // pnlfancydragging - // - this.pnlfancydragging.Widgets.Add(this.txtshakeminoffset); - this.pnlfancydragging.Widgets.Add(this.label148); - this.pnlfancydragging.Widgets.Add(this.txtshakemax); - this.pnlfancydragging.Widgets.Add(this.label146); - this.pnlfancydragging.Widgets.Add(this.txtdragopacitydec); - this.pnlfancydragging.Widgets.Add(this.label144); - this.pnlfancydragging.Widgets.Add(this.txtdragfadedec); - this.pnlfancydragging.Widgets.Add(this.label143); - this.pnlfancydragging.Widgets.Add(this.txtfadespeed); - this.pnlfancydragging.Widgets.Add(this.label155); - this.pnlfancydragging.Widgets.Add(this.label156); - this.pnlfancydragging.Location = new System.Drawing.Point(139, 43); - this.pnlfancydragging.Name = "pnlfancydragging"; - this.pnlfancydragging.Size = new System.Drawing.Size(311, 256); - this.pnlfancydragging.TabIndex = 14; - // - // txtshakeminoffset - // - this.txtshakeminoffset.BorderStyle = ShiftUI.BorderStyle.FixedSingle; - this.txtshakeminoffset.Font = new System.Drawing.Font("Microsoft Sans Serif", 10F); - this.txtshakeminoffset.Location = new System.Drawing.Point(167, 189); - this.txtshakeminoffset.Name = "txtshakeminoffset"; - this.txtshakeminoffset.Size = new System.Drawing.Size(35, 23); - this.txtshakeminoffset.TabIndex = 13; - this.txtshakeminoffset.TextChanged += new System.EventHandler(this.txtshakeminoffset_TextChanged); - // - // label148 - // - this.label148.AutoSize = true; - this.label148.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.label148.Location = new System.Drawing.Point(17, 192); - this.label148.Name = "label148"; - this.label148.Size = new System.Drawing.Size(140, 16); - this.label148.TabIndex = 12; - this.label148.Text = "Shake Minimum Offset"; - // - // txtshakemax - // - this.txtshakemax.BorderStyle = ShiftUI.BorderStyle.FixedSingle; - this.txtshakemax.Font = new System.Drawing.Font("Microsoft Sans Serif", 10F); - this.txtshakemax.Location = new System.Drawing.Point(167, 159); - this.txtshakemax.Name = "txtshakemax"; - this.txtshakemax.Size = new System.Drawing.Size(35, 23); - this.txtshakemax.TabIndex = 11; - this.txtshakemax.TextChanged += new System.EventHandler(this.txtshakemax_TextChanged); - // - // label146 - // - this.label146.AutoSize = true; - this.label146.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.label146.Location = new System.Drawing.Point(17, 162); - this.label146.Name = "label146"; - this.label146.Size = new System.Drawing.Size(144, 16); - this.label146.TabIndex = 10; - this.label146.Text = "Shake Maximum Offset"; - // - // txtdragopacitydec - // - this.txtdragopacitydec.BorderStyle = ShiftUI.BorderStyle.FixedSingle; - this.txtdragopacitydec.Font = new System.Drawing.Font("Microsoft Sans Serif", 10F); - this.txtdragopacitydec.Location = new System.Drawing.Point(104, 116); - this.txtdragopacitydec.Name = "txtdragopacitydec"; - this.txtdragopacitydec.Size = new System.Drawing.Size(35, 23); - this.txtdragopacitydec.TabIndex = 9; - this.txtdragopacitydec.TextChanged += new System.EventHandler(this.txtdragopacitydec_TextChanged); - // - // label144 - // - this.label144.AutoSize = true; - this.label144.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.label144.Location = new System.Drawing.Point(18, 119); - this.label144.Name = "label144"; - this.label144.Size = new System.Drawing.Size(85, 16); - this.label144.TabIndex = 8; - this.label144.Text = "Opacity Dec."; - // - // txtdragfadedec - // - this.txtdragfadedec.BorderStyle = ShiftUI.BorderStyle.FixedSingle; - this.txtdragfadedec.Font = new System.Drawing.Font("Microsoft Sans Serif", 10F); - this.txtdragfadedec.Location = new System.Drawing.Point(89, 88); - this.txtdragfadedec.Name = "txtdragfadedec"; - this.txtdragfadedec.Size = new System.Drawing.Size(35, 23); - this.txtdragfadedec.TabIndex = 7; - this.txtdragfadedec.TextChanged += new System.EventHandler(this.txtdragfadedec_TextChanged); - // - // label143 - // - this.label143.AutoSize = true; - this.label143.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.label143.Location = new System.Drawing.Point(17, 90); - this.label143.Name = "label143"; - this.label143.Size = new System.Drawing.Size(71, 16); - this.label143.TabIndex = 6; - this.label143.Text = "Fade Dec."; - // - // txtfadespeed - // - this.txtfadespeed.BorderStyle = ShiftUI.BorderStyle.FixedSingle; - this.txtfadespeed.Font = new System.Drawing.Font("Microsoft Sans Serif", 10F); - this.txtfadespeed.Location = new System.Drawing.Point(114, 54); - this.txtfadespeed.Name = "txtfadespeed"; - this.txtfadespeed.Size = new System.Drawing.Size(35, 23); - this.txtfadespeed.TabIndex = 5; - this.txtfadespeed.TextChanged += new System.EventHandler(this.txtfadespeed_TextChanged); - // - // label155 - // - this.label155.AutoSize = true; - this.label155.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.label155.Location = new System.Drawing.Point(18, 58); - this.label155.Name = "label155"; - this.label155.Size = new System.Drawing.Size(84, 16); - this.label155.TabIndex = 4; - this.label155.Text = "Fade Speed"; - // - // label156 - // - this.label156.Anchor = ((ShiftUI.AnchorStyles)(((ShiftUI.AnchorStyles.Top | ShiftUI.AnchorStyles.Left) - | ShiftUI.AnchorStyles.Right))); - this.label156.Font = new System.Drawing.Font("Microsoft Sans Serif", 16F, System.Drawing.FontStyle.Bold); - this.label156.Location = new System.Drawing.Point(6, 0); - this.label156.Name = "label156"; - this.label156.Size = new System.Drawing.Size(301, 29); - this.label156.TabIndex = 1; - this.label156.Text = "Fancy Dragging"; - this.label156.TextAlign = System.Drawing.ContentAlignment.TopCenter; - // - // pnlfancyintro - // - this.pnlfancyintro.Widgets.Add(this.label174); - this.pnlfancyintro.Widgets.Add(this.label175); - this.pnlfancyintro.Location = new System.Drawing.Point(139, 43); - this.pnlfancyintro.Name = "pnlfancyintro"; - this.pnlfancyintro.Size = new System.Drawing.Size(311, 256); - this.pnlfancyintro.TabIndex = 11; - // - // label174 - // - this.label174.Anchor = ((ShiftUI.AnchorStyles)(((ShiftUI.AnchorStyles.Top | ShiftUI.AnchorStyles.Left) - | ShiftUI.AnchorStyles.Right))); - this.label174.BackColor = System.Drawing.Color.Transparent; - this.label174.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.label174.Location = new System.Drawing.Point(6, 29); - this.label174.Name = "label174"; - this.label174.Size = new System.Drawing.Size(300, 221); - this.label174.TabIndex = 4; - this.label174.Text = "This section allows you to customize various Fancy Effects throughout ShiftOS suc" + - "h as animations, speeds, etc.\r\n\r\nGo ahead and explore!"; - this.label174.TextAlign = System.Drawing.ContentAlignment.TopCenter; - // - // label175 - // - this.label175.Anchor = ((ShiftUI.AnchorStyles)(((ShiftUI.AnchorStyles.Top | ShiftUI.AnchorStyles.Left) - | ShiftUI.AnchorStyles.Right))); - this.label175.Font = new System.Drawing.Font("Microsoft Sans Serif", 16F, System.Drawing.FontStyle.Bold); - this.label175.Location = new System.Drawing.Point(6, 0); - this.label175.Name = "label175"; - this.label175.Size = new System.Drawing.Size(301, 29); - this.label175.TabIndex = 1; - this.label175.Text = "Fancy Effects - Intro"; - this.label175.TextAlign = System.Drawing.ContentAlignment.TopCenter; - // - // panel18 - // - this.panel18.Widgets.Add(this.panel19); - this.panel18.Widgets.Add(this.label157); - this.panel18.Widgets.Add(this.panel20); - this.panel18.Widgets.Add(this.label158); - this.panel18.Widgets.Add(this.panel21); - this.panel18.Widgets.Add(this.label159); - this.panel18.Widgets.Add(this.panel22); - this.panel18.Widgets.Add(this.label160); - this.panel18.Widgets.Add(this.panel23); - this.panel18.Widgets.Add(this.label161); - this.panel18.Widgets.Add(this.panel24); - this.panel18.Widgets.Add(this.label162); - this.panel18.Widgets.Add(this.label163); - this.panel18.Location = new System.Drawing.Point(139, 43); - this.panel18.Name = "panel18"; - this.panel18.Size = new System.Drawing.Size(311, 256); - this.panel18.TabIndex = 12; - // - // panel19 - // - this.panel19.BorderStyle = ShiftUI.BorderStyle.FixedSingle; - this.panel19.Location = new System.Drawing.Point(216, 80); - this.panel19.Name = "panel19"; - this.panel19.Size = new System.Drawing.Size(41, 20); - this.panel19.TabIndex = 11; - // - // label157 - // - this.label157.AutoSize = true; - this.label157.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.label157.Location = new System.Drawing.Point(167, 81); - this.label157.Name = "label157"; - this.label157.Size = new System.Drawing.Size(49, 16); - this.label157.TabIndex = 10; - this.label157.Text = "Border"; - // - // panel20 - // - this.panel20.BorderStyle = ShiftUI.BorderStyle.FixedSingle; - this.panel20.Location = new System.Drawing.Point(224, 55); - this.panel20.Name = "panel20"; - this.panel20.Size = new System.Drawing.Size(41, 20); - this.panel20.TabIndex = 9; - // - // label158 - // - this.label158.AutoSize = true; - this.label158.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.label158.Location = new System.Drawing.Point(148, 56); - this.label158.Name = "label158"; - this.label158.Size = new System.Drawing.Size(76, 16); - this.label158.TabIndex = 8; - this.label158.Text = "Margin End"; - // - // panel21 - // - this.panel21.BorderStyle = ShiftUI.BorderStyle.FixedSingle; - this.panel21.Location = new System.Drawing.Point(117, 80); - this.panel21.Name = "panel21"; - this.panel21.Size = new System.Drawing.Size(41, 20); - this.panel21.TabIndex = 7; - // - // label159 - // - this.label159.AutoSize = true; - this.label159.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.label159.Location = new System.Drawing.Point(12, 80); - this.label159.Name = "label159"; - this.label159.Size = new System.Drawing.Size(93, 16); - this.label159.TabIndex = 6; - this.label159.Text = "Margin Middle"; - // - // panel22 - // - this.panel22.BorderStyle = ShiftUI.BorderStyle.FixedSingle; - this.panel22.Location = new System.Drawing.Point(101, 55); - this.panel22.Name = "panel22"; - this.panel22.Size = new System.Drawing.Size(41, 20); - this.panel22.TabIndex = 5; - // - // label160 - // - this.label160.AutoSize = true; - this.label160.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.label160.Location = new System.Drawing.Point(12, 55); - this.label160.Name = "label160"; - this.label160.Size = new System.Drawing.Size(87, 16); - this.label160.TabIndex = 4; - this.label160.Text = "Margin Begin"; - // - // panel23 - // - this.panel23.BorderStyle = ShiftUI.BorderStyle.FixedSingle; - this.panel23.Location = new System.Drawing.Point(249, 29); - this.panel23.Name = "panel23"; - this.panel23.Size = new System.Drawing.Size(41, 20); - this.panel23.TabIndex = 5; - // - // label161 - // - this.label161.AutoSize = true; - this.label161.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.label161.Location = new System.Drawing.Point(156, 29); - this.label161.Name = "label161"; - this.label161.Size = new System.Drawing.Size(95, 16); - this.label161.TabIndex = 4; - this.label161.Text = "Highlight Color"; - // - // panel24 - // - this.panel24.BorderStyle = ShiftUI.BorderStyle.FixedSingle; - this.panel24.Location = new System.Drawing.Point(115, 29); - this.panel24.Name = "panel24"; - this.panel24.Size = new System.Drawing.Size(41, 20); - this.panel24.TabIndex = 3; - // - // label162 - // - this.label162.AutoSize = true; - this.label162.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.label162.Location = new System.Drawing.Point(10, 29); - this.label162.Name = "label162"; - this.label162.Size = new System.Drawing.Size(104, 16); - this.label162.TabIndex = 2; - this.label162.Text = "Highlight Border"; - // - // label163 - // - this.label163.Anchor = ((ShiftUI.AnchorStyles)(((ShiftUI.AnchorStyles.Top | ShiftUI.AnchorStyles.Left) - | ShiftUI.AnchorStyles.Right))); - this.label163.Font = new System.Drawing.Font("Microsoft Sans Serif", 16F, System.Drawing.FontStyle.Bold); - this.label163.Location = new System.Drawing.Point(6, 0); - this.label163.Name = "label163"; - this.label163.Size = new System.Drawing.Size(301, 29); - this.label163.TabIndex = 1; - this.label163.Text = "Drop-Down Menus"; - this.label163.TextAlign = System.Drawing.ContentAlignment.TopCenter; - // - // panel25 - // - this.panel25.Widgets.Add(this.panel26); - this.panel25.Widgets.Add(this.label164); - this.panel25.Widgets.Add(this.panel27); - this.panel25.Widgets.Add(this.label165); - this.panel25.Widgets.Add(this.panel28); - this.panel25.Widgets.Add(this.label166); - this.panel25.Widgets.Add(this.panel29); - this.panel25.Widgets.Add(this.label167); - this.panel25.Widgets.Add(this.panel30); - this.panel25.Widgets.Add(this.label168); - this.panel25.Widgets.Add(this.panel31); - this.panel25.Widgets.Add(this.label169); - this.panel25.Widgets.Add(this.panel32); - this.panel25.Widgets.Add(this.label170); - this.panel25.Widgets.Add(this.panel33); - this.panel25.Widgets.Add(this.label171); - this.panel25.Widgets.Add(this.panel34); - this.panel25.Widgets.Add(this.label172); - this.panel25.Widgets.Add(this.label173); - this.panel25.Location = new System.Drawing.Point(139, 43); - this.panel25.Name = "panel25"; - this.panel25.Size = new System.Drawing.Size(311, 256); - this.panel25.TabIndex = 10; - // - // panel26 - // - this.panel26.BorderStyle = ShiftUI.BorderStyle.FixedSingle; - this.panel26.Location = new System.Drawing.Point(85, 129); - this.panel26.Name = "panel26"; - this.panel26.Size = new System.Drawing.Size(41, 20); - this.panel26.TabIndex = 17; - // - // label164 - // - this.label164.AutoSize = true; - this.label164.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.label164.Location = new System.Drawing.Point(11, 131); - this.label164.Name = "label164"; - this.label164.Size = new System.Drawing.Size(69, 16); - this.label164.TabIndex = 16; - this.label164.Text = "Text Color"; - // - // panel27 - // - this.panel27.BorderStyle = ShiftUI.BorderStyle.FixedSingle; - this.panel27.Location = new System.Drawing.Point(228, 104); - this.panel27.Name = "panel27"; - this.panel27.Size = new System.Drawing.Size(41, 20); - this.panel27.TabIndex = 15; - // - // label165 - // - this.label165.AutoSize = true; - this.label165.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.label165.Location = new System.Drawing.Point(132, 106); - this.label165.Name = "label165"; - this.label165.Size = new System.Drawing.Size(92, 16); - this.label165.TabIndex = 14; - this.label165.Text = "Dropdown BG"; - // - // panel28 - // - this.panel28.BorderStyle = ShiftUI.BorderStyle.FixedSingle; - this.panel28.Location = new System.Drawing.Point(84, 104); - this.panel28.Name = "panel28"; - this.panel28.Size = new System.Drawing.Size(41, 20); - this.panel28.TabIndex = 13; - // - // label166 - // - this.label166.AutoSize = true; - this.label166.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.label166.Location = new System.Drawing.Point(10, 106); - this.label166.Name = "label166"; - this.label166.Size = new System.Drawing.Size(72, 16); - this.label166.TabIndex = 12; - this.label166.Text = "Status End"; - // - // panel29 - // - this.panel29.BorderStyle = ShiftUI.BorderStyle.FixedSingle; - this.panel29.Location = new System.Drawing.Point(254, 81); - this.panel29.Name = "panel29"; - this.panel29.Size = new System.Drawing.Size(41, 20); - this.panel29.TabIndex = 11; - // - // label167 - // - this.label167.AutoSize = true; - this.label167.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.label167.Location = new System.Drawing.Point(169, 81); - this.label167.Name = "label167"; - this.label167.Size = new System.Drawing.Size(83, 16); - this.label167.TabIndex = 10; - this.label167.Text = "Status Begin"; - // - // panel30 - // - this.panel30.BorderStyle = ShiftUI.BorderStyle.FixedSingle; - this.panel30.Location = new System.Drawing.Point(254, 55); - this.panel30.Name = "panel30"; - this.panel30.Size = new System.Drawing.Size(41, 20); - this.panel30.TabIndex = 9; - // - // label168 - // - this.label168.AutoSize = true; - this.label168.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.label168.Location = new System.Drawing.Point(161, 55); - this.label168.Name = "label168"; - this.label168.Size = new System.Drawing.Size(87, 16); - this.label168.TabIndex = 8; - this.label168.Text = "Tool Bar End"; - // - // panel31 - // - this.panel31.BorderStyle = ShiftUI.BorderStyle.FixedSingle; - this.panel31.Location = new System.Drawing.Point(117, 80); - this.panel31.Name = "panel31"; - this.panel31.Size = new System.Drawing.Size(41, 20); - this.panel31.TabIndex = 7; - // - // label169 - // - this.label169.AutoSize = true; - this.label169.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.label169.Location = new System.Drawing.Point(12, 80); - this.label169.Name = "label169"; - this.label169.Size = new System.Drawing.Size(104, 16); - this.label169.TabIndex = 6; - this.label169.Text = "Tool Bar Middle"; - // - // panel32 - // - this.panel32.BorderStyle = ShiftUI.BorderStyle.FixedSingle; - this.panel32.Location = new System.Drawing.Point(117, 55); - this.panel32.Name = "panel32"; - this.panel32.Size = new System.Drawing.Size(41, 20); - this.panel32.TabIndex = 5; - // - // label170 - // - this.label170.AutoSize = true; - this.label170.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.label170.Location = new System.Drawing.Point(12, 55); - this.label170.Name = "label170"; - this.label170.Size = new System.Drawing.Size(98, 16); - this.label170.TabIndex = 4; - this.label170.Text = "Tool Bar Begin"; - // - // panel33 - // - this.panel33.BorderStyle = ShiftUI.BorderStyle.FixedSingle; - this.panel33.Location = new System.Drawing.Point(249, 29); - this.panel33.Name = "panel33"; - this.panel33.Size = new System.Drawing.Size(41, 20); - this.panel33.TabIndex = 5; - // - // label171 - // - this.label171.AutoSize = true; - this.label171.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.label171.Location = new System.Drawing.Point(156, 29); - this.label171.Name = "label171"; - this.label171.Size = new System.Drawing.Size(92, 16); - this.label171.TabIndex = 4; - this.label171.Text = "Menu Bar End"; - // - // panel34 - // - this.panel34.BorderStyle = ShiftUI.BorderStyle.FixedSingle; - this.panel34.Location = new System.Drawing.Point(115, 29); - this.panel34.Name = "panel34"; - this.panel34.Size = new System.Drawing.Size(41, 20); - this.panel34.TabIndex = 3; - // - // label172 - // - this.label172.AutoSize = true; - this.label172.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.label172.Location = new System.Drawing.Point(10, 29); - this.label172.Name = "label172"; - this.label172.Size = new System.Drawing.Size(103, 16); - this.label172.TabIndex = 2; - this.label172.Text = "Menu Bar Begin"; - // - // label173 - // - this.label173.Anchor = ((ShiftUI.AnchorStyles)(((ShiftUI.AnchorStyles.Top | ShiftUI.AnchorStyles.Left) - | ShiftUI.AnchorStyles.Right))); - this.label173.Font = new System.Drawing.Font("Microsoft Sans Serif", 16F, System.Drawing.FontStyle.Bold); - this.label173.Location = new System.Drawing.Point(6, 0); - this.label173.Name = "label173"; - this.label173.Size = new System.Drawing.Size(301, 29); - this.label173.TabIndex = 1; - this.label173.Text = "The Basics"; - this.label173.TextAlign = System.Drawing.ContentAlignment.TopCenter; - // - // panel36 - // - this.panel36.Anchor = ((ShiftUI.AnchorStyles)(((ShiftUI.AnchorStyles.Top | ShiftUI.AnchorStyles.Bottom) - | ShiftUI.AnchorStyles.Left))); - this.panel36.Widgets.Add(this.btnfancydragging); - this.panel36.Widgets.Add(this.btnfancywindows); - this.panel36.Location = new System.Drawing.Point(6, 42); - this.panel36.Name = "panel36"; - this.panel36.Size = new System.Drawing.Size(128, 257); - this.panel36.TabIndex = 9; - // - // btnfancydragging - // - this.btnfancydragging.BackColor = System.Drawing.Color.White; - this.btnfancydragging.FlatStyle = ShiftUI.FlatStyle.Standard; - this.btnfancydragging.Font = new System.Drawing.Font("Cambria", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.btnfancydragging.Location = new System.Drawing.Point(4, 35); - this.btnfancydragging.Name = "btnfancydragging"; - this.btnfancydragging.Size = new System.Drawing.Size(119, 29); - this.btnfancydragging.TabIndex = 5; - this.btnfancydragging.Text = "Fancy Dragging"; - this.btnfancydragging.UseVisualStyleBackColor = false; - this.btnfancydragging.Click += new System.EventHandler(this.btnfancydragging_Click); - // - // btnfancywindows - // - this.btnfancywindows.BackColor = System.Drawing.Color.White; - this.btnfancywindows.FlatStyle = ShiftUI.FlatStyle.Standard; - this.btnfancywindows.Font = new System.Drawing.Font("Cambria", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.btnfancywindows.Location = new System.Drawing.Point(4, 0); - this.btnfancywindows.Name = "btnfancywindows"; - this.btnfancywindows.Size = new System.Drawing.Size(119, 29); - this.btnfancywindows.TabIndex = 4; - this.btnfancywindows.Text = "Animations"; - this.btnfancywindows.UseVisualStyleBackColor = false; - this.btnfancywindows.Click += new System.EventHandler(this.btnfancywindows_Click); - // - // label176 - // - this.label176.Font = new System.Drawing.Font("Microsoft Sans Serif", 20.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.label176.Location = new System.Drawing.Point(72, 0); - this.label176.Name = "label176"; - this.label176.Size = new System.Drawing.Size(332, 29); - this.label176.TabIndex = 0; - this.label176.Text = "Fancy Effects"; - // - // pnlmenus - // - this.pnlmenus.Anchor = ((ShiftUI.AnchorStyles)((((ShiftUI.AnchorStyles.Top | ShiftUI.AnchorStyles.Bottom) - | ShiftUI.AnchorStyles.Left) - | ShiftUI.AnchorStyles.Right))); - this.pnlmenus.BackColor = System.Drawing.Color.White; - this.pnlmenus.Widgets.Add(this.pnladvanced); - this.pnlmenus.Widgets.Add(this.pnlmore); - this.pnlmenus.Widgets.Add(this.pnldropdown); - this.pnlmenus.Widgets.Add(this.pnlbasic); - this.pnlmenus.Widgets.Add(this.pnlmenusintro); - this.pnlmenus.Widgets.Add(this.pnlmenucategories); - this.pnlmenus.Widgets.Add(this.label74); - this.pnlmenus.Location = new System.Drawing.Point(134, 9); - this.pnlmenus.Name = "pnlmenus"; - this.pnlmenus.Size = new System.Drawing.Size(457, 306); - this.pnlmenus.TabIndex = 19; - // - // pnladvanced - // - this.pnladvanced.Widgets.Add(this.btnmorebuttons); - this.pnladvanced.Widgets.Add(this.pnlbuttonchecked); - this.pnladvanced.Widgets.Add(this.label136); - this.pnladvanced.Widgets.Add(this.pnlitemselectedend); - this.pnladvanced.Widgets.Add(this.label129); - this.pnladvanced.Widgets.Add(this.pnlbuttonpressed); - this.pnladvanced.Widgets.Add(this.label130); - this.pnladvanced.Widgets.Add(this.pnlitemselectedbegin); - this.pnladvanced.Widgets.Add(this.label131); - this.pnladvanced.Widgets.Add(this.pnlitemselected); - this.pnladvanced.Widgets.Add(this.label132); - this.pnladvanced.Widgets.Add(this.pnlbuttonselected); - this.pnladvanced.Widgets.Add(this.label133); - this.pnladvanced.Widgets.Add(this.pnlcheckbg); - this.pnladvanced.Widgets.Add(this.label134); - this.pnladvanced.Widgets.Add(this.label135); - this.pnladvanced.Location = new System.Drawing.Point(139, 43); - this.pnladvanced.Name = "pnladvanced"; - this.pnladvanced.Size = new System.Drawing.Size(311, 256); - this.pnladvanced.TabIndex = 13; - // - // btnmorebuttons - // - this.btnmorebuttons.FlatStyle = ShiftUI.FlatStyle.Standard; - this.btnmorebuttons.Font = new System.Drawing.Font("Cambria", 11.25F); - this.btnmorebuttons.Location = new System.Drawing.Point(216, 195); - this.btnmorebuttons.Name = "btnmorebuttons"; - this.btnmorebuttons.Size = new System.Drawing.Size(90, 32); - this.btnmorebuttons.TabIndex = 18; - this.btnmorebuttons.Text = "More >>"; - this.btnmorebuttons.UseVisualStyleBackColor = true; - this.btnmorebuttons.Click += new System.EventHandler(this.btnmorebuttons_Click); - // - // pnlbuttonchecked - // - this.pnlbuttonchecked.BorderStyle = ShiftUI.BorderStyle.FixedSingle; - this.pnlbuttonchecked.Location = new System.Drawing.Point(115, 153); - this.pnlbuttonchecked.Name = "pnlbuttonchecked"; - this.pnlbuttonchecked.Size = new System.Drawing.Size(41, 20); - this.pnlbuttonchecked.TabIndex = 11; - this.pnlbuttonchecked.MouseDown += new ShiftUI.MouseEventHandler(this.SetButtonCheckBG); - // - // label136 - // - this.label136.AutoSize = true; - this.label136.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.label136.Location = new System.Drawing.Point(10, 153); - this.label136.Name = "label136"; - this.label136.Size = new System.Drawing.Size(102, 16); - this.label136.TabIndex = 10; - this.label136.Text = "Button Checked"; - // - // pnlitemselectedend - // - this.pnlitemselectedend.BorderStyle = ShiftUI.BorderStyle.FixedSingle; - this.pnlitemselectedend.Location = new System.Drawing.Point(134, 83); - this.pnlitemselectedend.Name = "pnlitemselectedend"; - this.pnlitemselectedend.Size = new System.Drawing.Size(41, 20); - this.pnlitemselectedend.TabIndex = 11; - this.pnlitemselectedend.MouseDown += new ShiftUI.MouseEventHandler(this.SetItemSelectedEnd); - // - // label129 - // - this.label129.AutoSize = true; - this.label129.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.label129.Location = new System.Drawing.Point(12, 85); - this.label129.Name = "label129"; - this.label129.Size = new System.Drawing.Size(117, 16); - this.label129.TabIndex = 10; - this.label129.Text = "Item Selected End"; - // - // pnlbuttonpressed - // - this.pnlbuttonpressed.BorderStyle = ShiftUI.BorderStyle.FixedSingle; - this.pnlbuttonpressed.Location = new System.Drawing.Point(117, 207); - this.pnlbuttonpressed.Name = "pnlbuttonpressed"; - this.pnlbuttonpressed.Size = new System.Drawing.Size(41, 20); - this.pnlbuttonpressed.TabIndex = 9; - this.pnlbuttonpressed.MouseDown += new ShiftUI.MouseEventHandler(this.SetButtonPressedBG); - // - // label130 - // - this.label130.AutoSize = true; - this.label130.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.label130.Location = new System.Drawing.Point(12, 207); - this.label130.Name = "label130"; - this.label130.Size = new System.Drawing.Size(99, 16); - this.label130.TabIndex = 8; - this.label130.Text = "Button Pressed"; - // - // pnlitemselectedbegin - // - this.pnlitemselectedbegin.BorderStyle = ShiftUI.BorderStyle.FixedSingle; - this.pnlitemselectedbegin.Location = new System.Drawing.Point(143, 56); - this.pnlitemselectedbegin.Name = "pnlitemselectedbegin"; - this.pnlitemselectedbegin.Size = new System.Drawing.Size(41, 20); - this.pnlitemselectedbegin.TabIndex = 7; - this.pnlitemselectedbegin.MouseDown += new ShiftUI.MouseEventHandler(this.SetItemSelectedBegin); - // - // label131 - // - this.label131.AutoSize = true; - this.label131.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.label131.Location = new System.Drawing.Point(10, 58); - this.label131.Name = "label131"; - this.label131.Size = new System.Drawing.Size(128, 16); - this.label131.TabIndex = 6; - this.label131.Text = "Item Selected Begin"; - // - // pnlitemselected - // - this.pnlitemselected.BorderStyle = ShiftUI.BorderStyle.FixedSingle; - this.pnlitemselected.Location = new System.Drawing.Point(240, 29); - this.pnlitemselected.Name = "pnlitemselected"; - this.pnlitemselected.Size = new System.Drawing.Size(41, 20); - this.pnlitemselected.TabIndex = 5; - this.pnlitemselected.MouseDown += new ShiftUI.MouseEventHandler(this.SetItemSelected); - // - // label132 - // - this.label132.AutoSize = true; - this.label132.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.label132.Location = new System.Drawing.Point(147, 32); - this.label132.Name = "label132"; - this.label132.Size = new System.Drawing.Size(90, 16); - this.label132.TabIndex = 4; - this.label132.Text = "Item Selected"; - // - // pnlbuttonselected - // - this.pnlbuttonselected.BorderStyle = ShiftUI.BorderStyle.FixedSingle; - this.pnlbuttonselected.Location = new System.Drawing.Point(110, 181); - this.pnlbuttonselected.Name = "pnlbuttonselected"; - this.pnlbuttonselected.Size = new System.Drawing.Size(41, 20); - this.pnlbuttonselected.TabIndex = 5; - this.pnlbuttonselected.MouseDown += new ShiftUI.MouseEventHandler(this.SetButtonSelectedBG); - // - // label133 - // - this.label133.AutoSize = true; - this.label133.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.label133.Location = new System.Drawing.Point(7, 181); - this.label133.Name = "label133"; - this.label133.Size = new System.Drawing.Size(102, 16); - this.label133.TabIndex = 4; - this.label133.Text = "Button Selected"; - // - // pnlcheckbg - // - this.pnlcheckbg.BorderStyle = ShiftUI.BorderStyle.FixedSingle; - this.pnlcheckbg.Location = new System.Drawing.Point(79, 29); - this.pnlcheckbg.Name = "pnlcheckbg"; - this.pnlcheckbg.Size = new System.Drawing.Size(41, 20); - this.pnlcheckbg.TabIndex = 3; - this.pnlcheckbg.MouseDown += new ShiftUI.MouseEventHandler(this.SetCheckBG); - // - // label134 - // - this.label134.AutoSize = true; - this.label134.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.label134.Location = new System.Drawing.Point(10, 29); - this.label134.Name = "label134"; - this.label134.Size = new System.Drawing.Size(68, 16); - this.label134.TabIndex = 2; - this.label134.Text = "Check BG"; - // - // label135 - // - this.label135.Anchor = ((ShiftUI.AnchorStyles)(((ShiftUI.AnchorStyles.Top | ShiftUI.AnchorStyles.Left) - | ShiftUI.AnchorStyles.Right))); - this.label135.Font = new System.Drawing.Font("Microsoft Sans Serif", 16F, System.Drawing.FontStyle.Bold); - this.label135.Location = new System.Drawing.Point(6, 0); - this.label135.Name = "label135"; - this.label135.Size = new System.Drawing.Size(301, 29); - this.label135.TabIndex = 1; - this.label135.Text = "Advanced"; - this.label135.TextAlign = System.Drawing.ContentAlignment.TopCenter; - // - // pnlmore - // - this.pnlmore.Widgets.Add(this.pnlpressedbegin); - this.pnlmore.Widgets.Add(this.btnback); - this.pnlmore.Widgets.Add(this.label138); - this.pnlmore.Widgets.Add(this.pnlselectedbegin); - this.pnlmore.Widgets.Add(this.pnlpressedend); - this.pnlmore.Widgets.Add(this.label137); - this.pnlmore.Widgets.Add(this.label139); - this.pnlmore.Widgets.Add(this.pnlselectedend); - this.pnlmore.Widgets.Add(this.pnlpressedmiddle); - this.pnlmore.Widgets.Add(this.label140); - this.pnlmore.Widgets.Add(this.label142); - this.pnlmore.Widgets.Add(this.pnlselectedmiddle); - this.pnlmore.Widgets.Add(this.label145); - this.pnlmore.Widgets.Add(this.label147); - this.pnlmore.Location = new System.Drawing.Point(139, 43); - this.pnlmore.Name = "pnlmore"; - this.pnlmore.Size = new System.Drawing.Size(311, 256); - this.pnlmore.TabIndex = 14; - // - // pnlpressedbegin - // - this.pnlpressedbegin.BorderStyle = ShiftUI.BorderStyle.FixedSingle; - this.pnlpressedbegin.Location = new System.Drawing.Point(170, 107); - this.pnlpressedbegin.Name = "pnlpressedbegin"; - this.pnlpressedbegin.Size = new System.Drawing.Size(41, 20); - this.pnlpressedbegin.TabIndex = 17; - this.pnlpressedbegin.MouseDown += new ShiftUI.MouseEventHandler(this.SetPressedBegin); - // - // btnback - // - this.btnback.Anchor = ((ShiftUI.AnchorStyles)((ShiftUI.AnchorStyles.Bottom | ShiftUI.AnchorStyles.Left))); - this.btnback.FlatStyle = ShiftUI.FlatStyle.Standard; - this.btnback.Font = new System.Drawing.Font("Cambria", 11.25F); - this.btnback.Location = new System.Drawing.Point(6, 184); - this.btnback.Name = "btnback"; - this.btnback.Size = new System.Drawing.Size(90, 32); - this.btnback.TabIndex = 18; - this.btnback.Text = "<< Back"; - this.btnback.UseVisualStyleBackColor = true; - this.btnback.Click += new System.EventHandler(this.btnadvanced_Click); - // - // label138 - // - this.label138.AutoSize = true; - this.label138.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.label138.Location = new System.Drawing.Point(13, 108); - this.label138.Name = "label138"; - this.label138.Size = new System.Drawing.Size(151, 16); - this.label138.TabIndex = 16; - this.label138.Text = "Pressed Gradient Begin"; - // - // pnlselectedbegin - // - this.pnlselectedbegin.BorderStyle = ShiftUI.BorderStyle.FixedSingle; - this.pnlselectedbegin.Location = new System.Drawing.Point(169, 29); - this.pnlselectedbegin.Name = "pnlselectedbegin"; - this.pnlselectedbegin.Size = new System.Drawing.Size(41, 20); - this.pnlselectedbegin.TabIndex = 11; - this.pnlselectedbegin.MouseDown += new ShiftUI.MouseEventHandler(this.SetSelectedBegin); - // - // pnlpressedend - // - this.pnlpressedend.BorderStyle = ShiftUI.BorderStyle.FixedSingle; - this.pnlpressedend.Location = new System.Drawing.Point(162, 159); - this.pnlpressedend.Name = "pnlpressedend"; - this.pnlpressedend.Size = new System.Drawing.Size(41, 20); - this.pnlpressedend.TabIndex = 15; - this.pnlpressedend.MouseDown += new ShiftUI.MouseEventHandler(this.SetPressedEnd); - // - // label137 - // - this.label137.AutoSize = true; - this.label137.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.label137.Location = new System.Drawing.Point(12, 30); - this.label137.Name = "label137"; - this.label137.Size = new System.Drawing.Size(154, 16); - this.label137.TabIndex = 10; - this.label137.Text = "Selected Gradient Begin"; - // - // label139 - // - this.label139.AutoSize = true; - this.label139.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.label139.Location = new System.Drawing.Point(15, 162); - this.label139.Name = "label139"; - this.label139.Size = new System.Drawing.Size(140, 16); - this.label139.TabIndex = 14; - this.label139.Text = "Pressed Gradient End"; - // - // pnlselectedend - // - this.pnlselectedend.BorderStyle = ShiftUI.BorderStyle.FixedSingle; - this.pnlselectedend.Location = new System.Drawing.Point(161, 81); - this.pnlselectedend.Name = "pnlselectedend"; - this.pnlselectedend.Size = new System.Drawing.Size(41, 20); - this.pnlselectedend.TabIndex = 9; - this.pnlselectedend.MouseDown += new ShiftUI.MouseEventHandler(this.SetSelectedEnd); - // - // pnlpressedmiddle - // - this.pnlpressedmiddle.BorderStyle = ShiftUI.BorderStyle.FixedSingle; - this.pnlpressedmiddle.Location = new System.Drawing.Point(179, 134); - this.pnlpressedmiddle.Name = "pnlpressedmiddle"; - this.pnlpressedmiddle.Size = new System.Drawing.Size(41, 20); - this.pnlpressedmiddle.TabIndex = 13; - this.pnlpressedmiddle.MouseDown += new ShiftUI.MouseEventHandler(this.SetPressedMiddle); - // - // label140 - // - this.label140.AutoSize = true; - this.label140.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.label140.Location = new System.Drawing.Point(16, 138); - this.label140.Name = "label140"; - this.label140.Size = new System.Drawing.Size(157, 16); - this.label140.TabIndex = 12; - this.label140.Text = "Pressed Gradient Middle"; - // - // label142 - // - this.label142.AutoSize = true; - this.label142.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.label142.Location = new System.Drawing.Point(14, 84); - this.label142.Name = "label142"; - this.label142.Size = new System.Drawing.Size(143, 16); - this.label142.TabIndex = 8; - this.label142.Text = "Selected Gradient End"; - // - // pnlselectedmiddle - // - this.pnlselectedmiddle.BorderStyle = ShiftUI.BorderStyle.FixedSingle; - this.pnlselectedmiddle.Location = new System.Drawing.Point(182, 56); - this.pnlselectedmiddle.Name = "pnlselectedmiddle"; - this.pnlselectedmiddle.Size = new System.Drawing.Size(41, 20); - this.pnlselectedmiddle.TabIndex = 5; - this.pnlselectedmiddle.MouseDown += new ShiftUI.MouseEventHandler(this.SetSelectedMiddle); - // - // label145 - // - this.label145.AutoSize = true; - this.label145.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.label145.Location = new System.Drawing.Point(18, 58); - this.label145.Name = "label145"; - this.label145.Size = new System.Drawing.Size(160, 16); - this.label145.TabIndex = 4; - this.label145.Text = "Selected Gradient Middle"; - // - // label147 - // - this.label147.Anchor = ((ShiftUI.AnchorStyles)(((ShiftUI.AnchorStyles.Top | ShiftUI.AnchorStyles.Left) - | ShiftUI.AnchorStyles.Right))); - this.label147.Font = new System.Drawing.Font("Microsoft Sans Serif", 16F, System.Drawing.FontStyle.Bold); - this.label147.Location = new System.Drawing.Point(6, 0); - this.label147.Name = "label147"; - this.label147.Size = new System.Drawing.Size(301, 29); - this.label147.TabIndex = 1; - this.label147.Text = "Advanced"; - this.label147.TextAlign = System.Drawing.ContentAlignment.TopCenter; - // - // pnldropdown - // - this.pnldropdown.Widgets.Add(this.pnlddborder); - this.pnldropdown.Widgets.Add(this.label117); - this.pnldropdown.Widgets.Add(this.pnlmarginend); - this.pnldropdown.Widgets.Add(this.label120); - this.pnldropdown.Widgets.Add(this.pnlmarginmiddle); - this.pnldropdown.Widgets.Add(this.label121); - this.pnldropdown.Widgets.Add(this.pnlmarginbegin); - this.pnldropdown.Widgets.Add(this.label122); - this.pnldropdown.Widgets.Add(this.pnlhcolor); - this.pnldropdown.Widgets.Add(this.label123); - this.pnldropdown.Widgets.Add(this.pnlhborder); - this.pnldropdown.Widgets.Add(this.label125); - this.pnldropdown.Widgets.Add(this.label126); - this.pnldropdown.Location = new System.Drawing.Point(139, 43); - this.pnldropdown.Name = "pnldropdown"; - this.pnldropdown.Size = new System.Drawing.Size(311, 256); - this.pnldropdown.TabIndex = 12; - // - // pnlddborder - // - this.pnlddborder.BorderStyle = ShiftUI.BorderStyle.FixedSingle; - this.pnlddborder.Location = new System.Drawing.Point(216, 80); - this.pnlddborder.Name = "pnlddborder"; - this.pnlddborder.Size = new System.Drawing.Size(41, 20); - this.pnlddborder.TabIndex = 11; - this.pnlddborder.MouseDown += new ShiftUI.MouseEventHandler(this.MenuBorder); - // - // label117 - // - this.label117.AutoSize = true; - this.label117.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.label117.Location = new System.Drawing.Point(167, 81); - this.label117.Name = "label117"; - this.label117.Size = new System.Drawing.Size(49, 16); - this.label117.TabIndex = 10; - this.label117.Text = "Border"; - // - // pnlmarginend - // - this.pnlmarginend.BorderStyle = ShiftUI.BorderStyle.FixedSingle; - this.pnlmarginend.Location = new System.Drawing.Point(224, 55); - this.pnlmarginend.Name = "pnlmarginend"; - this.pnlmarginend.Size = new System.Drawing.Size(41, 20); - this.pnlmarginend.TabIndex = 9; - this.pnlmarginend.MouseDown += new ShiftUI.MouseEventHandler(this.MarginEnd); - // - // label120 - // - this.label120.AutoSize = true; - this.label120.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.label120.Location = new System.Drawing.Point(148, 56); - this.label120.Name = "label120"; - this.label120.Size = new System.Drawing.Size(76, 16); - this.label120.TabIndex = 8; - this.label120.Text = "Margin End"; - // - // pnlmarginmiddle - // - this.pnlmarginmiddle.BorderStyle = ShiftUI.BorderStyle.FixedSingle; - this.pnlmarginmiddle.Location = new System.Drawing.Point(117, 80); - this.pnlmarginmiddle.Name = "pnlmarginmiddle"; - this.pnlmarginmiddle.Size = new System.Drawing.Size(41, 20); - this.pnlmarginmiddle.TabIndex = 7; - this.pnlmarginmiddle.MouseDown += new ShiftUI.MouseEventHandler(this.MarginMiddle); - // - // label121 - // - this.label121.AutoSize = true; - this.label121.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.label121.Location = new System.Drawing.Point(12, 80); - this.label121.Name = "label121"; - this.label121.Size = new System.Drawing.Size(93, 16); - this.label121.TabIndex = 6; - this.label121.Text = "Margin Middle"; - // - // pnlmarginbegin - // - this.pnlmarginbegin.BorderStyle = ShiftUI.BorderStyle.FixedSingle; - this.pnlmarginbegin.Location = new System.Drawing.Point(101, 55); - this.pnlmarginbegin.Name = "pnlmarginbegin"; - this.pnlmarginbegin.Size = new System.Drawing.Size(41, 20); - this.pnlmarginbegin.TabIndex = 5; - this.pnlmarginbegin.MouseDown += new ShiftUI.MouseEventHandler(this.MarginBegin); - // - // label122 - // - this.label122.AutoSize = true; - this.label122.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.label122.Location = new System.Drawing.Point(12, 55); - this.label122.Name = "label122"; - this.label122.Size = new System.Drawing.Size(87, 16); - this.label122.TabIndex = 4; - this.label122.Text = "Margin Begin"; - // - // pnlhcolor - // - this.pnlhcolor.BorderStyle = ShiftUI.BorderStyle.FixedSingle; - this.pnlhcolor.Location = new System.Drawing.Point(249, 29); - this.pnlhcolor.Name = "pnlhcolor"; - this.pnlhcolor.Size = new System.Drawing.Size(41, 20); - this.pnlhcolor.TabIndex = 5; - this.pnlhcolor.MouseDown += new ShiftUI.MouseEventHandler(this.HighlightColor); - // - // label123 - // - this.label123.AutoSize = true; - this.label123.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.label123.Location = new System.Drawing.Point(156, 29); - this.label123.Name = "label123"; - this.label123.Size = new System.Drawing.Size(95, 16); - this.label123.TabIndex = 4; - this.label123.Text = "Highlight Color"; - // - // pnlhborder - // - this.pnlhborder.BorderStyle = ShiftUI.BorderStyle.FixedSingle; - this.pnlhborder.Location = new System.Drawing.Point(115, 29); - this.pnlhborder.Name = "pnlhborder"; - this.pnlhborder.Size = new System.Drawing.Size(41, 20); - this.pnlhborder.TabIndex = 3; - this.pnlhborder.MouseDown += new ShiftUI.MouseEventHandler(this.HighlightBorder); - // - // label125 - // - this.label125.AutoSize = true; - this.label125.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.label125.Location = new System.Drawing.Point(10, 29); - this.label125.Name = "label125"; - this.label125.Size = new System.Drawing.Size(104, 16); - this.label125.TabIndex = 2; - this.label125.Text = "Highlight Border"; - // - // label126 - // - this.label126.Anchor = ((ShiftUI.AnchorStyles)(((ShiftUI.AnchorStyles.Top | ShiftUI.AnchorStyles.Left) - | ShiftUI.AnchorStyles.Right))); - this.label126.Font = new System.Drawing.Font("Microsoft Sans Serif", 16F, System.Drawing.FontStyle.Bold); - this.label126.Location = new System.Drawing.Point(6, 0); - this.label126.Name = "label126"; - this.label126.Size = new System.Drawing.Size(301, 29); - this.label126.TabIndex = 1; - this.label126.Text = "Drop-Down Menus"; - this.label126.TextAlign = System.Drawing.ContentAlignment.TopCenter; - // - // pnlbasic - // - this.pnlbasic.Widgets.Add(this.pnlmenutextcolor); - this.pnlbasic.Widgets.Add(this.label118); - this.pnlbasic.Widgets.Add(this.pnldropdownbg); - this.pnlbasic.Widgets.Add(this.label115); - this.pnlbasic.Widgets.Add(this.pnlstatusend); - this.pnlbasic.Widgets.Add(this.label114); - this.pnlbasic.Widgets.Add(this.pnlstatusbegin); - this.pnlbasic.Widgets.Add(this.label107); - this.pnlbasic.Widgets.Add(this.pnltoolbarend); - this.pnlbasic.Widgets.Add(this.label77); - this.pnlbasic.Widgets.Add(this.pnltoolbarmiddle); - this.pnlbasic.Widgets.Add(this.label76); - this.pnlbasic.Widgets.Add(this.pnltoolbarbegin); - this.pnlbasic.Widgets.Add(this.label75); - this.pnlbasic.Widgets.Add(this.pnlmenubarend); - this.pnlbasic.Widgets.Add(this.label73); - this.pnlbasic.Widgets.Add(this.pnlmenubarbegin); - this.pnlbasic.Widgets.Add(this.label42); - this.pnlbasic.Widgets.Add(this.label41); - this.pnlbasic.Location = new System.Drawing.Point(139, 43); - this.pnlbasic.Name = "pnlbasic"; - this.pnlbasic.Size = new System.Drawing.Size(311, 256); - this.pnlbasic.TabIndex = 10; - // - // pnlmenutextcolor - // - this.pnlmenutextcolor.BorderStyle = ShiftUI.BorderStyle.FixedSingle; - this.pnlmenutextcolor.Location = new System.Drawing.Point(85, 129); - this.pnlmenutextcolor.Name = "pnlmenutextcolor"; - this.pnlmenutextcolor.Size = new System.Drawing.Size(41, 20); - this.pnlmenutextcolor.TabIndex = 17; - this.pnlmenutextcolor.MouseDown += new ShiftUI.MouseEventHandler(this.SetMenuTextColor); - // - // label118 - // - this.label118.AutoSize = true; - this.label118.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.label118.Location = new System.Drawing.Point(11, 131); - this.label118.Name = "label118"; - this.label118.Size = new System.Drawing.Size(69, 16); - this.label118.TabIndex = 16; - this.label118.Text = "Text Color"; - // - // pnldropdownbg - // - this.pnldropdownbg.BorderStyle = ShiftUI.BorderStyle.FixedSingle; - this.pnldropdownbg.Location = new System.Drawing.Point(228, 104); - this.pnldropdownbg.Name = "pnldropdownbg"; - this.pnldropdownbg.Size = new System.Drawing.Size(41, 20); - this.pnldropdownbg.TabIndex = 15; - this.pnldropdownbg.MouseDown += new ShiftUI.MouseEventHandler(this.DropDownBG); - // - // label115 - // - this.label115.AutoSize = true; - this.label115.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.label115.Location = new System.Drawing.Point(132, 106); - this.label115.Name = "label115"; - this.label115.Size = new System.Drawing.Size(92, 16); - this.label115.TabIndex = 14; - this.label115.Text = "Dropdown BG"; - // - // pnlstatusend - // - this.pnlstatusend.BorderStyle = ShiftUI.BorderStyle.FixedSingle; - this.pnlstatusend.Location = new System.Drawing.Point(84, 104); - this.pnlstatusend.Name = "pnlstatusend"; - this.pnlstatusend.Size = new System.Drawing.Size(41, 20); - this.pnlstatusend.TabIndex = 13; - this.pnlstatusend.MouseDown += new ShiftUI.MouseEventHandler(this.StatusEnd); - // - // label114 - // - this.label114.AutoSize = true; - this.label114.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.label114.Location = new System.Drawing.Point(10, 106); - this.label114.Name = "label114"; - this.label114.Size = new System.Drawing.Size(72, 16); - this.label114.TabIndex = 12; - this.label114.Text = "Status End"; - // - // pnlstatusbegin - // - this.pnlstatusbegin.BorderStyle = ShiftUI.BorderStyle.FixedSingle; - this.pnlstatusbegin.Location = new System.Drawing.Point(254, 81); - this.pnlstatusbegin.Name = "pnlstatusbegin"; - this.pnlstatusbegin.Size = new System.Drawing.Size(41, 20); - this.pnlstatusbegin.TabIndex = 11; - this.pnlstatusbegin.MouseDown += new ShiftUI.MouseEventHandler(this.StatusBegin); - // - // label107 - // - this.label107.AutoSize = true; - this.label107.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.label107.Location = new System.Drawing.Point(169, 81); - this.label107.Name = "label107"; - this.label107.Size = new System.Drawing.Size(83, 16); - this.label107.TabIndex = 10; - this.label107.Text = "Status Begin"; - // - // pnltoolbarend - // - this.pnltoolbarend.BorderStyle = ShiftUI.BorderStyle.FixedSingle; - this.pnltoolbarend.Location = new System.Drawing.Point(254, 55); - this.pnltoolbarend.Name = "pnltoolbarend"; - this.pnltoolbarend.Size = new System.Drawing.Size(41, 20); - this.pnltoolbarend.TabIndex = 9; - this.pnltoolbarend.MouseDown += new ShiftUI.MouseEventHandler(this.ToolBarEnd); - // - // label77 - // - this.label77.AutoSize = true; - this.label77.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.label77.Location = new System.Drawing.Point(161, 55); - this.label77.Name = "label77"; - this.label77.Size = new System.Drawing.Size(87, 16); - this.label77.TabIndex = 8; - this.label77.Text = "Tool Bar End"; - // - // pnltoolbarmiddle - // - this.pnltoolbarmiddle.BorderStyle = ShiftUI.BorderStyle.FixedSingle; - this.pnltoolbarmiddle.Location = new System.Drawing.Point(117, 80); - this.pnltoolbarmiddle.Name = "pnltoolbarmiddle"; - this.pnltoolbarmiddle.Size = new System.Drawing.Size(41, 20); - this.pnltoolbarmiddle.TabIndex = 7; - this.pnltoolbarmiddle.MouseDown += new ShiftUI.MouseEventHandler(this.ToolBarMiddle); - // - // label76 - // - this.label76.AutoSize = true; - this.label76.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.label76.Location = new System.Drawing.Point(12, 80); - this.label76.Name = "label76"; - this.label76.Size = new System.Drawing.Size(104, 16); - this.label76.TabIndex = 6; - this.label76.Text = "Tool Bar Middle"; - // - // pnltoolbarbegin - // - this.pnltoolbarbegin.BorderStyle = ShiftUI.BorderStyle.FixedSingle; - this.pnltoolbarbegin.Location = new System.Drawing.Point(117, 55); - this.pnltoolbarbegin.Name = "pnltoolbarbegin"; - this.pnltoolbarbegin.Size = new System.Drawing.Size(41, 20); - this.pnltoolbarbegin.TabIndex = 5; - this.pnltoolbarbegin.MouseDown += new ShiftUI.MouseEventHandler(this.ToolBarBegin); - // - // label75 - // - this.label75.AutoSize = true; - this.label75.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.label75.Location = new System.Drawing.Point(12, 55); - this.label75.Name = "label75"; - this.label75.Size = new System.Drawing.Size(98, 16); - this.label75.TabIndex = 4; - this.label75.Text = "Tool Bar Begin"; - // - // pnlmenubarend - // - this.pnlmenubarend.BorderStyle = ShiftUI.BorderStyle.FixedSingle; - this.pnlmenubarend.Location = new System.Drawing.Point(249, 29); - this.pnlmenubarend.Name = "pnlmenubarend"; - this.pnlmenubarend.Size = new System.Drawing.Size(41, 20); - this.pnlmenubarend.TabIndex = 5; - this.pnlmenubarend.MouseDown += new ShiftUI.MouseEventHandler(this.MenuEnd); - // - // label73 - // - this.label73.AutoSize = true; - this.label73.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.label73.Location = new System.Drawing.Point(156, 29); - this.label73.Name = "label73"; - this.label73.Size = new System.Drawing.Size(92, 16); - this.label73.TabIndex = 4; - this.label73.Text = "Menu Bar End"; - // - // pnlmenubarbegin - // - this.pnlmenubarbegin.BorderStyle = ShiftUI.BorderStyle.FixedSingle; - this.pnlmenubarbegin.Location = new System.Drawing.Point(115, 29); - this.pnlmenubarbegin.Name = "pnlmenubarbegin"; - this.pnlmenubarbegin.Size = new System.Drawing.Size(41, 20); - this.pnlmenubarbegin.TabIndex = 3; - this.pnlmenubarbegin.MouseDown += new ShiftUI.MouseEventHandler(this.MenuBegin); - // - // label42 - // - this.label42.AutoSize = true; - this.label42.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.label42.Location = new System.Drawing.Point(10, 29); - this.label42.Name = "label42"; - this.label42.Size = new System.Drawing.Size(103, 16); - this.label42.TabIndex = 2; - this.label42.Text = "Menu Bar Begin"; - // - // label41 - // - this.label41.Anchor = ((ShiftUI.AnchorStyles)(((ShiftUI.AnchorStyles.Top | ShiftUI.AnchorStyles.Left) - | ShiftUI.AnchorStyles.Right))); - this.label41.Font = new System.Drawing.Font("Microsoft Sans Serif", 16F, System.Drawing.FontStyle.Bold); - this.label41.Location = new System.Drawing.Point(6, 0); - this.label41.Name = "label41"; - this.label41.Size = new System.Drawing.Size(301, 29); - this.label41.TabIndex = 1; - this.label41.Text = "The Basics"; - this.label41.TextAlign = System.Drawing.ContentAlignment.TopCenter; - // - // pnlmenusintro - // - this.pnlmenusintro.Widgets.Add(this.label116); - this.pnlmenusintro.Widgets.Add(this.label124); - this.pnlmenusintro.Location = new System.Drawing.Point(139, 43); - this.pnlmenusintro.Name = "pnlmenusintro"; - this.pnlmenusintro.Size = new System.Drawing.Size(311, 256); - this.pnlmenusintro.TabIndex = 11; - // - // label116 - // - this.label116.Anchor = ((ShiftUI.AnchorStyles)(((ShiftUI.AnchorStyles.Top | ShiftUI.AnchorStyles.Left) - | ShiftUI.AnchorStyles.Right))); - this.label116.BackColor = System.Drawing.Color.Transparent; - this.label116.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.label116.Location = new System.Drawing.Point(6, 29); - this.label116.Name = "label116"; - this.label116.Size = new System.Drawing.Size(300, 221); - this.label116.TabIndex = 4; - this.label116.Text = resources.GetString("label116.Text"); - this.label116.TextAlign = System.Drawing.ContentAlignment.TopCenter; - // - // label124 - // - this.label124.Anchor = ((ShiftUI.AnchorStyles)(((ShiftUI.AnchorStyles.Top | ShiftUI.AnchorStyles.Left) - | ShiftUI.AnchorStyles.Right))); - this.label124.Font = new System.Drawing.Font("Microsoft Sans Serif", 16F, System.Drawing.FontStyle.Bold); - this.label124.Location = new System.Drawing.Point(6, 0); - this.label124.Name = "label124"; - this.label124.Size = new System.Drawing.Size(301, 29); - this.label124.TabIndex = 1; - this.label124.Text = "Menus - Intro"; - this.label124.TextAlign = System.Drawing.ContentAlignment.TopCenter; - // - // pnlmenucategories - // - this.pnlmenucategories.Anchor = ((ShiftUI.AnchorStyles)(((ShiftUI.AnchorStyles.Top | ShiftUI.AnchorStyles.Bottom) - | ShiftUI.AnchorStyles.Left))); - this.pnlmenucategories.Widgets.Add(this.btnmisc); - this.pnlmenucategories.Widgets.Add(this.btnadvanced); - this.pnlmenucategories.Widgets.Add(this.btndropdown); - this.pnlmenucategories.Widgets.Add(this.btnbasic); - this.pnlmenucategories.Location = new System.Drawing.Point(6, 42); - this.pnlmenucategories.Name = "pnlmenucategories"; - this.pnlmenucategories.Size = new System.Drawing.Size(128, 257); - this.pnlmenucategories.TabIndex = 9; - // - // btnmisc - // - this.btnmisc.BackColor = System.Drawing.Color.White; - this.btnmisc.FlatStyle = ShiftUI.FlatStyle.Standard; - this.btnmisc.Font = new System.Drawing.Font("Cambria", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.btnmisc.Location = new System.Drawing.Point(4, 105); - this.btnmisc.Name = "btnmisc"; - this.btnmisc.Size = new System.Drawing.Size(119, 29); - this.btnmisc.TabIndex = 7; - this.btnmisc.Text = "Misc."; - this.btnmisc.UseVisualStyleBackColor = false; - // - // btnadvanced - // - this.btnadvanced.BackColor = System.Drawing.Color.White; - this.btnadvanced.FlatStyle = ShiftUI.FlatStyle.Standard; - this.btnadvanced.Font = new System.Drawing.Font("Cambria", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.btnadvanced.Location = new System.Drawing.Point(4, 70); - this.btnadvanced.Name = "btnadvanced"; - this.btnadvanced.Size = new System.Drawing.Size(119, 29); - this.btnadvanced.TabIndex = 6; - this.btnadvanced.Text = "Advanced"; - this.btnadvanced.UseVisualStyleBackColor = false; - this.btnadvanced.Click += new System.EventHandler(this.btnadvanced_Click); - // - // btndropdown - // - this.btndropdown.BackColor = System.Drawing.Color.White; - this.btndropdown.FlatStyle = ShiftUI.FlatStyle.Standard; - this.btndropdown.Font = new System.Drawing.Font("Cambria", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.btndropdown.Location = new System.Drawing.Point(4, 35); - this.btndropdown.Name = "btndropdown"; - this.btndropdown.Size = new System.Drawing.Size(119, 29); - this.btndropdown.TabIndex = 5; - this.btndropdown.Text = "Drop-Downs"; - this.btndropdown.UseVisualStyleBackColor = false; - this.btndropdown.Click += new System.EventHandler(this.btndropdown_Click); - // - // btnbasic - // - this.btnbasic.BackColor = System.Drawing.Color.White; - this.btnbasic.FlatStyle = ShiftUI.FlatStyle.Standard; - this.btnbasic.Font = new System.Drawing.Font("Cambria", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.btnbasic.Location = new System.Drawing.Point(4, 0); - this.btnbasic.Name = "btnbasic"; - this.btnbasic.Size = new System.Drawing.Size(119, 29); - this.btnbasic.TabIndex = 4; - this.btnbasic.Text = "Basic Customization"; - this.btnbasic.UseVisualStyleBackColor = false; - this.btnbasic.Click += new System.EventHandler(this.btnbasic_Click); - // - // label74 - // - this.label74.Font = new System.Drawing.Font("Microsoft Sans Serif", 20.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.label74.Location = new System.Drawing.Point(72, 0); - this.label74.Name = "label74"; - this.label74.Size = new System.Drawing.Size(332, 29); - this.label74.TabIndex = 0; - this.label74.Text = "Menu Customization"; - // - // tmrfix - // - this.tmrfix.Interval = 5000; - // - // pnlluaoptions - // - this.pnlluaoptions.Anchor = ((ShiftUI.AnchorStyles)((((ShiftUI.AnchorStyles.Top | ShiftUI.AnchorStyles.Bottom) - | ShiftUI.AnchorStyles.Left) - | ShiftUI.AnchorStyles.Right))); - this.pnlluaoptions.BackColor = System.Drawing.Color.White; - this.pnlluaoptions.Widgets.Add(this.pnlluafield); - this.pnlluaoptions.Widgets.Add(this.flmorebuttons); - this.pnlluaoptions.Location = new System.Drawing.Point(139, 9); - this.pnlluaoptions.Name = "pnlluaoptions"; - this.pnlluaoptions.Size = new System.Drawing.Size(457, 306); - this.pnlluaoptions.TabIndex = 21; - this.pnlluaoptions.Visible = false; - // - // flmorebuttons - // - this.flmorebuttons.AutoSize = true; - this.flmorebuttons.AutoSizeMode = ShiftUI.AutoSizeMode.GrowAndShrink; - this.flmorebuttons.Dock = ShiftUI.DockStyle.Top; - this.flmorebuttons.Location = new System.Drawing.Point(0, 0); - this.flmorebuttons.Name = "flmorebuttons"; - this.flmorebuttons.Size = new System.Drawing.Size(457, 0); - this.flmorebuttons.TabIndex = 0; - // - // pnlluafield - // - this.pnlluafield.Dock = ShiftUI.DockStyle.Fill; - this.pnlluafield.Location = new System.Drawing.Point(0, 0); - this.pnlluafield.Name = "pnlluafield"; - this.pnlluafield.Size = new System.Drawing.Size(457, 306); - this.pnlluafield.TabIndex = 1; - // - // Shifter - // - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); - this.AutoScaleMode = ShiftUI.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(600, 323); - this.Widgets.Add(this.pgcontents); - this.FormBorderStyle = ShiftUI.FormBorderStyle.None; - this.Name = "Shifter"; + this.AllowTransparency = false; + this.AutoScale = true; + this.AutoScaleBaseSize = new Size(5, 13); + this.AutoScroll = false; + this.AutoSize = false; + this.AutoSizeMode = AutoSizeMode.GrowOnly; + this.AutoValidate = AutoValidate.Inherit; + this.BackColor = Color.FromArgb(240, 240, 240); + this.ClientSize = new Size(805, 463); + this.WidgetBox = true; + this.DesktopLocation = new Point(0, 0); + this.DialogResult = DialogResult.None; + this.FormBorderStyle = FormBorderStyle.Sizable; + this.HelpButton = false; + this.IsMdiContainer = false; + this.KeyPreview = false; + this.MaximizeBox = true; + this.MaximumSize = new Size(0, 0); + this.MinimizeBox = true; + this.MinimumSize = new Size(0, 0); + this.RightToLeftLayout = false; + this.ShowIcon = true; + this.ShowInTaskbar = true; + this.Size = new Size(805, 463); + this.SizeGripStyle = SizeGripStyle.Auto; + this.StartPosition = FormStartPosition.WindowsDefaultLocation; + this.TabIndex = 0; + this.TabStop = true; + this.TopLevel = true; + this.TopMost = false; + this.WindowState = FormWindowState.Normal; this.Text = "Shifter"; - this.TopMost = true; - this.Load += new System.EventHandler(this.Shifter_Load); - this.catholder.ResumeLayout(false); - this.pnlshifterintro.ResumeLayout(false); - this.pnlshifterintro.PerformLayout(); - this.pnldesktopoptions.ResumeLayout(false); - this.pnldesktoppaneloptions.ResumeLayout(false); - this.pnldesktoppaneloptions.PerformLayout(); - //((System.ComponentModel.ISupportInitialize)(this.txtdesktoppanelheight)).EndInit(); - this.pnlapplauncheroptions.ResumeLayout(false); - this.pnlapplauncheroptions.PerformLayout(); - this.pnldesktopintro.ResumeLayout(false); - this.pnldesktopintro.PerformLayout(); - this.pnlpanelbuttonsoptions.ResumeLayout(false); - this.pnlpanelbuttonsoptions.PerformLayout(); - this.pnldesktopbackgroundoptions.ResumeLayout(false); - this.pnldesktopbackgroundoptions.PerformLayout(); - this.pnlpanelclockoptions.ResumeLayout(false); - this.pnlpanelclockoptions.PerformLayout(); - this.pnldesktoppreview.ResumeLayout(false); - this.predesktoppanel.ResumeLayout(false); - this.prepnlpanelbuttonholder.ResumeLayout(false); - this.prepnlpanelbutton.ResumeLayout(false); - this.prepnlpanelbutton.PerformLayout(); - //((System.ComponentModel.ISupportInitialize)(this.pretbicon)).EndInit(); - this.pretimepanel.ResumeLayout(false); - this.pretimepanel.PerformLayout(); - this.preapplaunchermenuholder.ResumeLayout(false); - this.predesktopappmenu.ResumeLayout(false); - this.predesktopappmenu.PerformLayout(); - this.Panel10.ResumeLayout(false); - this.pnlwindowsoptions.ResumeLayout(false); - this.pnlwindowsintro.ResumeLayout(false); - this.pnlwindowsintro.PerformLayout(); - this.pnlbuttonoptions.ResumeLayout(false); - this.pnlbuttonoptions.PerformLayout(); - this.pnlclosebuttonoptions.ResumeLayout(false); - this.pnlclosebuttonoptions.PerformLayout(); - this.pnlrollupbuttonoptions.ResumeLayout(false); - this.pnlrollupbuttonoptions.PerformLayout(); - this.pnlminimizebuttonoptions.ResumeLayout(false); - this.pnlminimizebuttonoptions.PerformLayout(); - this.pnltitlebaroptions.ResumeLayout(false); - this.pnltitlebaroptions.PerformLayout(); - this.pnlborderoptions.ResumeLayout(false); - this.pnlborderoptions.PerformLayout(); - this.pnltitletextoptions.ResumeLayout(false); - this.pnltitletextoptions.PerformLayout(); - this.pnlwindowsobjects.ResumeLayout(false); - this.pnlwindowpreview.ResumeLayout(false); - this.prepgleft.ResumeLayout(false); - this.prepgright.ResumeLayout(false); - this.pretitlebar.ResumeLayout(false); - this.pretitlebar.PerformLayout(); - //((System.ComponentModel.ISupportInitialize)(this.prepnlicon)).EndInit(); - this.pnlreset.ResumeLayout(false); - this.pgcontents.ResumeLayout(false); - this.pgcontents.PerformLayout(); - this.pnldesktopcomposition.ResumeLayout(false); - this.pnlfancywindows.ResumeLayout(false); - this.pnlfancywindows.PerformLayout(); - this.pnlfancydragging.ResumeLayout(false); - this.pnlfancydragging.PerformLayout(); - this.pnlfancyintro.ResumeLayout(false); - this.panel18.ResumeLayout(false); - this.panel18.PerformLayout(); - this.panel25.ResumeLayout(false); - this.panel25.PerformLayout(); - this.panel36.ResumeLayout(false); - this.pnlmenus.ResumeLayout(false); - this.pnladvanced.ResumeLayout(false); - this.pnladvanced.PerformLayout(); - this.pnlmore.ResumeLayout(false); - this.pnlmore.PerformLayout(); - this.pnldropdown.ResumeLayout(false); - this.pnldropdown.PerformLayout(); - this.pnlbasic.ResumeLayout(false); - this.pnlbasic.PerformLayout(); - this.pnlmenusintro.ResumeLayout(false); - this.pnlmenucategories.ResumeLayout(false); - this.pnlluaoptions.ResumeLayout(false); - this.pnlluaoptions.PerformLayout(); - this.ResumeLayout(false); + this.Location = new Point(0, 0); + this.AutoScaleMode = AutoScaleMode.Inherit; + this.AutoScrollMargin = new Size(0, 0); + this.AutoScrollMinSize = new Size(0, 0); + this.AutoScrollPosition = new Point(0, 0); + this.Alignment = (ContentAlignment)0; + this.AccessibleDefaultActionDescription = ""; + this.AccessibleDescription = ""; + this.AccessibleName = ""; + this.AccessibleRole = AccessibleRole.Default; + this.AllowDrop = false; + this.Anchor = AnchorStyles.Top | AnchorStyles.Left; + this.AutoScrollOffset = new Point(0, 0); + this.BackgroundImageLayout = ImageLayout.Tile; + this.Capture = false; + this.CausesValidation = true; + this.Dock = DockStyle.None; + this.Enabled = true; + this.Font = new Font("Microsoft Sans Serif", (float)8.25, (FontStyle)0); + this.ForeColor = Color.FromArgb(0, 0, 0); + this.Height = 463; + this.ImeMode = ImeMode.NoControl; + this.IsAccessible = false; + this.Left = 0; + this.Name = "ShifterNew"; + this.RightToLeft = RightToLeft.No; + this.Top = 0; + this.UseWaitCursor = false; + this.Visible = false; + this.Width = 805; + + pgshifter = new PropertyGrid(); + pgshifter.AutoScroll = false; + pgshifter.BackColor = Color.FromArgb(240, 240, 240); + pgshifter.BackgroundImageLayout = ImageLayout.Tile; + pgshifter.CategoryForeColor = Color.FromArgb(200, 200, 200); + pgshifter.CommandsBackColor = Color.FromArgb(0, 0, 0); + pgshifter.CommandsForeColor = Color.FromArgb(0, 0, 0); + pgshifter.CommandsActiveLinkColor = Color.FromArgb(0, 0, 0); + pgshifter.CommandsDisabledLinkColor = Color.FromArgb(0, 0, 0); + pgshifter.CommandsLinkColor = Color.FromArgb(0, 0, 0); + pgshifter.CommandsVisibleIfAvailable = false; + pgshifter.ForeColor = Color.FromArgb(0, 0, 0); + pgshifter.HelpBackColor = Color.FromArgb(240, 240, 240); + pgshifter.HelpForeColor = Color.FromArgb(0, 0, 0); + pgshifter.HelpVisible = true; + pgshifter.LargeButtons = false; + pgshifter.LineColor = Color.FromArgb(200, 200, 200); + pgshifter.PropertySort = PropertySort.CategorizedAlphabetical; + pgshifter.Text = ""; + pgshifter.ToolbarVisible = true; + pgshifter.ViewBackColor = Color.FromArgb(255, 255, 255); + pgshifter.ViewForeColor = Color.FromArgb(0, 0, 0); + pgshifter.UseCompatibleTextRendering = false; + pgshifter.AutoScaleMode = AutoScaleMode.Inherit; + pgshifter.AutoValidate = AutoValidate.Inherit; + pgshifter.AutoScrollMargin = new Size(0, 0); + pgshifter.AutoScrollMinSize = new Size(0, 0); + pgshifter.AutoScrollPosition = new Point(0, 0); + pgshifter.Alignment = (ContentAlignment)0; + pgshifter.AccessibleDefaultActionDescription = ""; + pgshifter.AccessibleDescription = ""; + pgshifter.AccessibleName = ""; + pgshifter.AccessibleRole = AccessibleRole.Default; + pgshifter.AllowDrop = false; + pgshifter.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right; + pgshifter.AutoScrollOffset = new Point(0, 0); + pgshifter.AutoSize = false; + pgshifter.MaximumSize = new Size(0, 0); + pgshifter.MinimumSize = new Size(0, 0); + pgshifter.Capture = false; + pgshifter.CausesValidation = true; + pgshifter.ClientSize = new Size(504, 411); + pgshifter.Dock = DockStyle.None; + pgshifter.Enabled = true; + pgshifter.Font = new Font("Microsoft Sans Serif", (float)8.25, (FontStyle)0); + pgshifter.Height = 411; + pgshifter.ImeMode = ImeMode.NoControl; + pgshifter.IsAccessible = false; + pgshifter.Left = 287; + pgshifter.Location = new Point(287, 8); + pgshifter.Name = "pgshifter"; + pgshifter.RightToLeft = RightToLeft.No; + pgshifter.Size = new Size(504, 411 - (API.CurrentSkin.titlebarheight * 2)); + pgshifter.TabIndex = 0; + pgshifter.TabStop = true; + pgshifter.Top = 8; + pgshifter.UseWaitCursor = false; + pgshifter.Visible = true; + pgshifter.Width = 504; + this.Widgets.Add(pgshifter); + pgshifter.Show(); + + pnlcategoryholder = new Panel(); + pnlcategoryholder.AutoSize = false; + pnlcategoryholder.AutoSizeMode = AutoSizeMode.GrowOnly; + pnlcategoryholder.BorderStyle = BorderStyle.FixedSingle; + pnlcategoryholder.TabStop = false; + pnlcategoryholder.Text = ""; + pnlcategoryholder.AutoScroll = false; + pnlcategoryholder.AutoScrollMargin = new Size(0, 0); + pnlcategoryholder.AutoScrollMinSize = new Size(0, 0); + pnlcategoryholder.AutoScrollPosition = new Point(0, 0); + pnlcategoryholder.Alignment = (ContentAlignment)0; + pnlcategoryholder.AccessibleDefaultActionDescription = ""; + pnlcategoryholder.AccessibleDescription = ""; + pnlcategoryholder.AccessibleName = ""; + pnlcategoryholder.AccessibleRole = AccessibleRole.Default; + pnlcategoryholder.AllowDrop = false; + pnlcategoryholder.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left; + pnlcategoryholder.AutoScrollOffset = new Point(0, 0); + pnlcategoryholder.MaximumSize = new Size(0, 0); + pnlcategoryholder.MinimumSize = new Size(0, 0); + pnlcategoryholder.BackColor = Color.FromArgb(240, 240, 240); + pnlcategoryholder.BackgroundImageLayout = ImageLayout.Tile; + pnlcategoryholder.Capture = false; + pnlcategoryholder.CausesValidation = true; + pnlcategoryholder.Dock = DockStyle.None; + pnlcategoryholder.Enabled = true; + pnlcategoryholder.Font = new Font("Microsoft Sans Serif", (float)8.25, (FontStyle)0); + pnlcategoryholder.ForeColor = Color.FromArgb(0, 0, 0); + pnlcategoryholder.ImeMode = ImeMode.NoControl; + pnlcategoryholder.IsAccessible = false; + pnlcategoryholder.Left = 8; + + pnlcategoryholder.Location = new Point(8, 8); + pnlcategoryholder.Name = "pnlcategories"; + pnlcategoryholder.RightToLeft = RightToLeft.No; + pnlcategoryholder.Size = new Size(271, 409); + pnlcategoryholder.Height = 409 - API.CurrentSkin.titlebarheight; + pnlcategoryholder.TabIndex = 1; + pnlcategoryholder.Top = 8 + API.CurrentSkin.titlebarheight; + pnlcategoryholder.UseWaitCursor = false; + pnlcategoryholder.Visible = true; + pnlcategoryholder.Width = 271; + this.Widgets.Add(pnlcategoryholder); + pnlcategoryholder.Show(); + btnapply = new Button(); + btnapply.AutoSizeMode = AutoSizeMode.GrowOnly; + btnapply.DialogResult = DialogResult.None; + btnapply.AutoEllipsis = false; + btnapply.AutoSize = false; + btnapply.BackColor = Color.FromArgb(240, 240, 240); + btnapply.FlatStyle = FlatStyle.Standard; + btnapply.ImageAlign = ContentAlignment.MiddleCenter; + btnapply.ImageIndex = -1; + btnapply.ImageKey = ""; + btnapply.ImeMode = ImeMode.Disable; + btnapply.Text = "Apply"; + btnapply.TextAlign = ContentAlignment.MiddleCenter; + btnapply.TextImageRelation = TextImageRelation.Overlay; + btnapply.UseCompatibleTextRendering = false; + btnapply.UseMnemonic = true; + btnapply.UseVisualStyleBackColor = true; + btnapply.Alignment = (ContentAlignment)0; + btnapply.AccessibleDefaultActionDescription = ""; + btnapply.AccessibleDescription = ""; + btnapply.AccessibleName = ""; + btnapply.AccessibleRole = AccessibleRole.Default; + btnapply.AllowDrop = false; + btnapply.Anchor = AnchorStyles.Top | AnchorStyles.Left; + btnapply.AutoScrollOffset = new Point(0, 0); + btnapply.MaximumSize = new Size(0, 0); + btnapply.MinimumSize = new Size(0, 0); + btnapply.BackgroundImageLayout = ImageLayout.Tile; + btnapply.Capture = false; + btnapply.CausesValidation = true; + btnapply.ClientSize = new Size(120, 36); + btnapply.Dock = DockStyle.None; + btnapply.Enabled = true; + btnapply.Font = new Font("Microsoft Sans Serif", (float)12, (FontStyle)0); + btnapply.ForeColor = Color.FromArgb(0, 0, 0); + btnapply.Height = 36; + btnapply.IsAccessible = false; + btnapply.Left = 6; + btnapply.Location = new Point(6, 365); + btnapply.Name = "btnapply"; + btnapply.RightToLeft = RightToLeft.No; + btnapply.Size = new Size(120, 36); + btnapply.TabIndex = 0; + btnapply.TabStop = true; + btnapply.Top = 365; + btnapply.UseWaitCursor = false; + btnapply.Visible = true; + btnapply.Width = 120; + pnlcategoryholder.Widgets.Add(btnapply); + btnapply.Show(); + pnlcategories = new FlowLayoutPanel(); + pnlcategories.FlowDirection = FlowDirection.TopDown; + pnlcategories.WrapContents = true; + pnlcategories.AutoSize = false; + pnlcategories.AutoSizeMode = AutoSizeMode.GrowOnly; + pnlcategories.BorderStyle = BorderStyle.FixedSingle; + pnlcategories.TabStop = false; + pnlcategories.Text = ""; + pnlcategories.AutoScroll = false; + pnlcategories.AutoScrollMargin = new Size(0, 0); + pnlcategories.AutoScrollMinSize = new Size(0, 0); + pnlcategories.AutoScrollPosition = new Point(0, 0); + pnlcategories.Alignment = (ContentAlignment)0; + pnlcategories.AccessibleDefaultActionDescription = ""; + pnlcategories.AccessibleDescription = ""; + pnlcategories.AccessibleName = ""; + pnlcategories.AccessibleRole = AccessibleRole.Default; + pnlcategories.AllowDrop = false; + pnlcategories.Anchor = AnchorStyles.Top | AnchorStyles.Left; + pnlcategories.AutoScrollOffset = new Point(0, 0); + pnlcategories.MaximumSize = new Size(0, 0); + pnlcategories.MinimumSize = new Size(0, 0); + pnlcategories.BackColor = Color.FromArgb(240, 240, 240); + pnlcategories.BackgroundImageLayout = ImageLayout.Tile; + pnlcategories.Capture = false; + pnlcategories.CausesValidation = true; + pnlcategories.ClientSize = new Size(121, 351); + pnlcategories.Dock = DockStyle.None; + pnlcategories.Enabled = true; + pnlcategories.Font = new Font("Microsoft Sans Serif", (float)8.25, (FontStyle)0); + pnlcategories.ForeColor = Color.FromArgb(0, 0, 0); + pnlcategories.Height = 353; + pnlcategories.ImeMode = ImeMode.NoControl; + pnlcategories.IsAccessible = false; + pnlcategories.Left = 6; + pnlcategories.Location = new Point(6, 6); + pnlcategories.Name = "pnlcategories"; + pnlcategories.RightToLeft = RightToLeft.No; + pnlcategories.Size = new Size(123, 353); + pnlcategories.TabIndex = 1; + pnlcategories.Top = 6; + pnlcategories.UseWaitCursor = false; + pnlcategories.Visible = true; + pnlcategories.Width = 123; + pnlcategoryholder.Widgets.Add(pnlcategories); + pnlcategories.Show(); + pnlsubcategories = new FlowLayoutPanel(); + pnlsubcategories.FlowDirection = FlowDirection.TopDown; + pnlsubcategories.WrapContents = true; + pnlsubcategories.AutoSize = false; + pnlsubcategories.AutoSizeMode = AutoSizeMode.GrowOnly; + pnlsubcategories.BorderStyle = BorderStyle.None; + pnlsubcategories.TabStop = false; + pnlsubcategories.Text = ""; + pnlsubcategories.AutoScroll = false; + pnlsubcategories.AutoScrollMargin = new Size(0, 0); + pnlsubcategories.AutoScrollMinSize = new Size(0, 0); + pnlsubcategories.AutoScrollPosition = new Point(0, 0); + pnlsubcategories.Alignment = (ContentAlignment)0; + pnlsubcategories.AccessibleDefaultActionDescription = ""; + pnlsubcategories.AccessibleDescription = ""; + pnlsubcategories.AccessibleName = ""; + pnlsubcategories.AccessibleRole = AccessibleRole.Default; + pnlsubcategories.AllowDrop = false; + pnlsubcategories.Anchor = AnchorStyles.Top | AnchorStyles.Left; + pnlsubcategories.AutoScrollOffset = new Point(0, 0); + pnlsubcategories.MaximumSize = new Size(0, 0); + pnlsubcategories.MinimumSize = new Size(0, 0); + pnlsubcategories.BackColor = Color.FromArgb(240, 240, 240); + pnlsubcategories.BackgroundImageLayout = ImageLayout.Tile; + pnlsubcategories.Capture = false; + pnlsubcategories.CausesValidation = true; + pnlsubcategories.ClientSize = new Size(124, 394); + pnlsubcategories.Dock = DockStyle.None; + pnlsubcategories.Enabled = true; + pnlsubcategories.Font = new Font("Microsoft Sans Serif", (float)8.25, (FontStyle)0); + pnlsubcategories.ForeColor = Color.FromArgb(0, 0, 0); + pnlsubcategories.Height = 394; + pnlsubcategories.ImeMode = ImeMode.NoControl; + pnlsubcategories.IsAccessible = false; + pnlsubcategories.Left = 135; + pnlsubcategories.Location = new Point(135, 6); + pnlsubcategories.Name = "pnlsubcategories"; + pnlsubcategories.RightToLeft = RightToLeft.No; + pnlsubcategories.Size = new Size(124, 394); + pnlsubcategories.TabIndex = 2; + pnlsubcategories.Top = 6; + pnlsubcategories.UseWaitCursor = false; + pnlsubcategories.Visible = true; + pnlsubcategories.Width = 124; + pnlcategories.Widgets.Add(pnlsubcategories); + pnlsubcategories.Show(); } - private ShiftUI.Timer clocktick; - private ShiftUI.Timer customizationtime; - private ShiftUI.Timer timerearned; - private ShiftUI.Label Label1; - private ShiftUI.Button btnapply; - private ShiftUI.Panel catholder; - private ShiftUI.Button btnreset; - private ShiftUI.Button btnmenus; - private ShiftUI.Button btnwindows; - private ShiftUI.Button btndesktop; - private ShiftUI.Panel pnlshifterintro; - private ShiftUI.Label Label66; - private ShiftUI.Label Label65; - private ShiftUI.Label Label64; - private ShiftUI.Label Label63; - private ShiftUI.Panel pnldesktopoptions; - private ShiftUI.Panel pnlpanelbuttonsoptions; - private ShiftUI.Panel pnlpanelbuttontextcolour; - private ShiftUI.Label Label101; - private ShiftUI.TextBox txtpanelbuttontexttop; - private ShiftUI.Label Label104; - private ShiftUI.TextBox txtpanelbuttontextside; - private ShiftUI.Label Label106; - private ShiftUI.Label Label93; - private ShiftUI.TextBox txtpanelbuttontop; - private ShiftUI.Label Label94; - private ShiftUI.TextBox txtpanelbuttoninitalgap; - private ShiftUI.Label Label108; - private ShiftUI.TextBox txtpanelbuttonicontop; - private ShiftUI.Label Label110; - private ShiftUI.TextBox txtpanelbuttoniconside; - private ShiftUI.Label Label112; - private ShiftUI.TextBox txtpanelbuttoniconsize; - private ShiftUI.TextBox txtpanelbuttoniconheight; - private ShiftUI.Label Label105; - private ShiftUI.ComboBox cbpanelbuttontextstyle; - private ShiftUI.ComboBox cbpanelbuttonfont; - private ShiftUI.Label Label100; - private ShiftUI.TextBox txtpaneltextbuttonsize; - private ShiftUI.Label Label102; - private ShiftUI.Label Label103; - private ShiftUI.Label Label98; - private ShiftUI.TextBox txtpanelbuttongap; - private ShiftUI.Label Label99; - private ShiftUI.Label Label96; - private ShiftUI.TextBox txtpanelbuttonheight; - private ShiftUI.Label Label97; - private ShiftUI.Label Label92; - private ShiftUI.TextBox txtpanelbuttonwidth; - private ShiftUI.Label Label91; - private ShiftUI.Panel pnlpanelbuttoncolour; - private ShiftUI.Label Label95; - private ShiftUI.Panel pnldesktoppaneloptions; - private ShiftUI.Button btnpanelbuttons; - private ShiftUI.Label lbwarning; - private ShiftUI.ComboBox combodesktoppanelposition; - private ShiftUI.Label lbposition; - private ShiftUI.Label Label47; - private ShiftUI.TextBox txtdesktoppanelheight; - private ShiftUI.Label lbheight; - private ShiftUI.Panel pnldesktoppanelcolour; - private ShiftUI.Label lbpanelcolor; - private ShiftUI.Panel pnlapplauncheroptions; - private ShiftUI.Label Label71; - private ShiftUI.TextBox txtapplauncherwidth; - private ShiftUI.Label Label72; - private ShiftUI.TextBox txtappbuttonlabel; - private ShiftUI.Label Label51; - private ShiftUI.Label Label50; - private ShiftUI.Panel pnlmaintextcolour; - private ShiftUI.ComboBox comboappbuttontextstyle; - private ShiftUI.ComboBox comboappbuttontextfont; - private ShiftUI.Label Label37; - private ShiftUI.Label Label38; - private ShiftUI.TextBox txtappbuttontextsize; - private ShiftUI.Label Label39; - private ShiftUI.Label Label40; - private ShiftUI.Panel pnlmainbuttonactivated; - private ShiftUI.Label Label28; - private ShiftUI.Label Label35; - private ShiftUI.TextBox txtapplicationsbuttonheight; - private ShiftUI.Label Label36; - private ShiftUI.Panel pnlmainbuttoncolour; - private ShiftUI.Label Label43; - private ShiftUI.Panel pnldesktopintro; - private ShiftUI.Label Label69; - private ShiftUI.Label Label70; - private ShiftUI.Panel pnlpanelclockoptions; - private ShiftUI.Panel pnlclockbackgroundcolour; - private ShiftUI.Label Label44; - private ShiftUI.ComboBox comboclocktextstyle; - private ShiftUI.ComboBox comboclocktextfont; - private ShiftUI.Label Label26; - private ShiftUI.Label Label29; - private ShiftUI.TextBox txtclocktextfromtop; - private ShiftUI.Label Label30; - private ShiftUI.Label Label31; - private ShiftUI.TextBox txtclocktextsize; - private ShiftUI.Label Label32; - private ShiftUI.Label Label33; - private ShiftUI.Panel pnlpanelclocktextcolour; - private ShiftUI.Label Label34; - private ShiftUI.Panel pnldesktopbackgroundoptions; - private ShiftUI.Panel pnldesktopcolour; - private ShiftUI.Label Label45; - private ShiftUI.Panel Panel10; - private ShiftUI.Button btndesktopitself; - private ShiftUI.Button btnpanelclock; - private ShiftUI.Button btnapplauncher; - private ShiftUI.Button btndesktoppanel; - private ShiftUI.Panel pnldesktoppreview; - private ShiftUI.Panel predesktoppanel; - private ShiftUI.FlowLayoutPanel prepnlpanelbuttonholder; - private ShiftUI.Panel prepnlpanelbutton; - private ShiftUI.PictureBox pretbicon; - private ShiftUI.Label pretbctext; - private ShiftUI.Panel pretimepanel; - private ShiftUI.Label prepaneltimetext; - private ShiftUI.Panel preapplaunchermenuholder; - private ShiftUI.MenuStrip predesktopappmenu; - private ShiftUI.ToolStripMenuItem ApplicationsToolStripMenuItem; - private ShiftUI.ToolStripMenuItem KnowledgeInputToolStripMenuItem; - private ShiftUI.ToolStripMenuItem ShiftoriumToolStripMenuItem; - private ShiftUI.ToolStripMenuItem ClockToolStripMenuItem; - private ShiftUI.ToolStripMenuItem TerminalToolStripMenuItem; - private ShiftUI.ToolStripMenuItem ShifterToolStripMenuItem; - private ShiftUI.ToolStripSeparator ToolStripSeparator1; - private ShiftUI.ToolStripMenuItem ShutdownToolStripMenuItem; - private ShiftUI.Panel pnlwindowsoptions; - private ShiftUI.Panel pnlbuttonoptions; - private ShiftUI.Panel pnlminimizebuttonoptions; - private ShiftUI.Label Label82; - private ShiftUI.Label Label83; - private ShiftUI.Panel pnlminimizebuttoncolour; - private ShiftUI.TextBox txtminimizebuttonside; - private ShiftUI.Label Label84; - private ShiftUI.Label Label85; - private ShiftUI.TextBox txtminimizebuttonheight; - private ShiftUI.Label Label86; - private ShiftUI.Label Label87; - private ShiftUI.TextBox txtminimizebuttontop; - private ShiftUI.Label Label88; - private ShiftUI.Label Label89; - private ShiftUI.TextBox txtminimizebuttonwidth; - private ShiftUI.Label Label90; - private ShiftUI.Panel pnlrollupbuttonoptions; - private ShiftUI.Label Label54; - private ShiftUI.Label Label55; - private ShiftUI.Panel pnlrollupbuttoncolour; - private ShiftUI.TextBox txtrollupbuttonside; - private ShiftUI.Label Label56; - private ShiftUI.Label Label57; - private ShiftUI.TextBox txtrollupbuttonheight; - private ShiftUI.Label Label58; - private ShiftUI.Label Label59; - private ShiftUI.TextBox txtrollupbuttontop; - private ShiftUI.Label Label60; - private ShiftUI.Label Label61; - private ShiftUI.TextBox txtrollupbuttonwidth; - private ShiftUI.Label Label62; - private ShiftUI.ComboBox combobuttonoption; - private ShiftUI.Label Label52; - private ShiftUI.Panel pnlclosebuttonoptions; - private ShiftUI.Label Label8; - private ShiftUI.Label Label11; - private ShiftUI.Panel pnlclosebuttoncolour; - private ShiftUI.TextBox txtclosebuttonfromside; - private ShiftUI.Label Label7; - private ShiftUI.Label Label12; - private ShiftUI.TextBox txtclosebuttonheight; - private ShiftUI.Label Label13; - private ShiftUI.Label Label6; - private ShiftUI.TextBox txtclosebuttonfromtop; - private ShiftUI.Label Label10; - private ShiftUI.Label Label14; - private ShiftUI.TextBox txtclosebuttonwidth; - private ShiftUI.Label Label9; - private ShiftUI.Panel pnltitlebaroptions; - private ShiftUI.Label Label80; - private ShiftUI.TextBox txticonfromtop; - private ShiftUI.Label Label81; - private ShiftUI.Label Label78; - private ShiftUI.TextBox txticonfromside; - private ShiftUI.Label Label79; - private ShiftUI.Label lbcornerwidthpx; - private ShiftUI.TextBox txttitlebarcornerwidth; - private ShiftUI.Label lbcornerwidth; - private ShiftUI.Panel pnltitlebarrightcornercolour; - private ShiftUI.Panel pnltitlebarleftcornercolour; - private ShiftUI.Label lbrightcornercolor; - private ShiftUI.Label lbleftcornercolor; - private ShiftUI.CheckBox cboxtitlebarcorners; - private ShiftUI.Label Label5; - private ShiftUI.TextBox txttitlebarheight; - private ShiftUI.Label Label4; - private ShiftUI.Panel pnltitlebarcolour; - private ShiftUI.Label Label2; - private ShiftUI.Panel pnlborderoptions; - private ShiftUI.CheckBox cbindividualbordercolours; - private ShiftUI.Panel pnlborderbottomrightcolour; - private ShiftUI.Label lbbright; - private ShiftUI.Panel pnlborderbottomcolour; - private ShiftUI.Label lbbottom; - private ShiftUI.Panel pnlborderbottomleftcolour; - private ShiftUI.Label lbbleft; - private ShiftUI.Panel pnlborderrightcolour; - private ShiftUI.Label lbright; - private ShiftUI.Panel pnlborderleftcolour; - private ShiftUI.Label lbleft; - private ShiftUI.Label Label15; - private ShiftUI.Panel pnlbordercolour; - private ShiftUI.TextBox txtbordersize; - private ShiftUI.Label Label3; - private ShiftUI.Label Label16; - private ShiftUI.Panel pnltitletextoptions; - private ShiftUI.ComboBox combotitletextposition; - private ShiftUI.Label Label53; - private ShiftUI.ComboBox combotitletextstyle; - private ShiftUI.ComboBox combotitletextfont; - private ShiftUI.Label Label23; - private ShiftUI.Label Label17; - private ShiftUI.TextBox txttitletextside; - private ShiftUI.Label Label18; - private ShiftUI.Label Label19; - private ShiftUI.TextBox txttitletexttop; - private ShiftUI.Label Label20; - private ShiftUI.Label Label21; - private ShiftUI.TextBox txttitletextsize; - private ShiftUI.Label Label22; - private ShiftUI.Label Label24; - private ShiftUI.Panel pnltitletextcolour; - private ShiftUI.Label Label25; - private ShiftUI.Panel pnlwindowsintro; - private ShiftUI.Label Label68; - private ShiftUI.Label Label67; - private ShiftUI.Panel pnlwindowsobjects; - private ShiftUI.Button btnborders; - private ShiftUI.Button btnbuttons; - private ShiftUI.Button btntitletext; - private ShiftUI.Button btntitlebar; - private ShiftUI.Panel pnlwindowpreview; - private ShiftUI.Panel prepgcontent; - private ShiftUI.Panel prepgbottom; - private ShiftUI.Panel prepgleft; - private ShiftUI.Panel prepgbottomlcorner; - private ShiftUI.Panel prepgright; - private ShiftUI.Panel prepgbottomrcorner; - private ShiftUI.Panel pretitlebar; - private ShiftUI.Panel preminimizebutton; - private ShiftUI.PictureBox prepnlicon; - private ShiftUI.Panel prerollupbutton; - private ShiftUI.Panel preclosebutton; - private ShiftUI.Label pretitletext; - private ShiftUI.Panel prepgtoplcorner; - private ShiftUI.Panel prepgtoprcorner; - private ShiftUI.Panel pnlreset; - private ShiftUI.Label Label113; - private ShiftUI.Button btnresetallsettings; - private ShiftUI.Label Label109; - private ShiftUI.Label Label111; - private ShiftUI.Panel pgcontents; - private ShiftUI.Timer tmrfix; - private ShiftUI.Timer tmrdelay; - private Panel pnlmenus; - private Label label74; - private Panel pnlmenucategories; - private Button btnmisc; - private Button btnadvanced; - private Button btndropdown; - private Button btnbasic; - private Panel pnlbasic; - private Panel pnlmenubarend; - private Label label73; - private Panel pnlmenubarbegin; - private Label label42; - private Label label41; - private Panel pnltoolbarend; - private Label label77; - private Panel pnltoolbarmiddle; - private Label label76; - private Panel pnltoolbarbegin; - private Label label75; - private Panel pnlstatusend; - private Label label114; - private Panel pnlstatusbegin; - private Label label107; - private Panel pnldropdownbg; - private Label label115; - private Panel pnlmenusintro; - private Label label116; - private Label label124; - private Panel pnldropdown; - private Panel pnlmarginend; - private Label label120; - private Panel pnlmarginmiddle; - private Label label121; - private Panel pnlmarginbegin; - private Label label122; - private Panel pnlhcolor; - private Label label123; - private Panel pnlhborder; - private Label label125; - private Label label126; - private Panel pnlddborder; - private Label label117; - private Panel pnlmenutextcolor; - private Label label118; - private Panel pnladvanced; - private Panel pnlitemselectedend; - private Label label129; - private Panel pnlbuttonpressed; - private Label label130; - private Panel pnlitemselectedbegin; - private Label label131; - private Panel pnlitemselected; - private Label label132; - private Panel pnlbuttonselected; - private Label label133; - private Panel pnlcheckbg; - private Label label134; - private Label label135; - private Panel pnlbuttonchecked; - private Label label136; - private Button btnmorebuttons; - private Panel pnlmore; - private Panel pnlpressedbegin; - private Button btnback; - private Label label138; - private Panel pnlselectedbegin; - private Panel pnlpressedend; - private Label label137; - private Label label139; - private Panel pnlselectedend; - private Panel pnlpressedmiddle; - private Label label140; - private Label label142; - private Panel pnlselectedmiddle; - private Label label145; - private Label label147; - private Panel pnlalhover; - private Label label119; - private Button btndesktopicons; - private Button btnwindowcomposition; - private Panel pnldesktopcomposition; - private Panel pnlfancywindows; - private Label label149; - private Panel pnlfancydragging; - private Label label156; - private Panel panel18; - private Panel panel19; - private Label label157; - private Panel panel20; - private Label label158; - private Panel panel21; - private Label label159; - private Panel panel22; - private Label label160; - private Panel panel23; - private Label label161; - private Panel panel24; - private Label label162; - private Label label163; - private Panel panel25; - private Panel panel26; - private Label label164; - private Panel panel27; - private Label label165; - private Panel panel28; - private Label label166; - private Panel panel29; - private Label label167; - private Panel panel30; - private Label label168; - private Panel panel31; - private Label label169; - private Panel panel32; - private Label label170; - private Panel panel33; - private Label label171; - private Panel panel34; - private Label label172; - private Label label173; - private Panel pnlfancyintro; - private Label label174; - private Label label175; - private Panel panel36; - private Button btnfancydragging; - private Button btnfancywindows; - private Label label176; - private ComboBox cbcloseanim; - private Label label128; - private ComboBox cbopenanim; - private Label label127; - private ComboBox cbdrageffect; - private Label label141; - private TextBox txtfadespeed; - private Label label155; - private TextBox txtdragfadedec; - private Label label143; - private TextBox txtdragopacitydec; - private Label label144; - private TextBox txtshakeminoffset; - private Label label148; - private TextBox txtshakemax; - private Label label146; - private TextBox txtwinfadedec; - private Label label150; - private TextBox txtwinfadespeed; - private Label label151; - private Button btnmore; - private Panel pnlluaoptions; - private FlowLayoutPanel flmorebuttons; - private Panel pnlluafield; + public PropertyGrid pgshifter = null; + public Panel pnlcategoryholder = null; + public Button btnapply = null; + public FlowLayoutPanel pnlcategories = null; + public FlowLayoutPanel pnlsubcategories = null; + + } } \ No newline at end of file diff --git a/source/WindowsFormsApplication1/Apps/Shifter.cs b/source/WindowsFormsApplication1/Apps/Shifter.cs index 2130b4b..68125db 100644 --- a/source/WindowsFormsApplication1/Apps/Shifter.cs +++ b/source/WindowsFormsApplication1/Apps/Shifter.cs @@ -19,6 +19,7 @@ namespace ShiftOS InitializeComponent(); } + /* public Skinning.Skin CustomizingSkin = null; public Skinning.Images CustomizingImages = null; private bool EarnCP = false; @@ -1442,7 +1443,7 @@ namespace ShiftOS HideAll(); pnlmenuoptions.Show(); pnlmenuoptions.BringToFront(); - SetPreviewSkin(true);*/ + SetPreviewSkin(true); } private void Button2_Click(object sender, EventArgs e) @@ -3088,6 +3089,6 @@ You can add options in the Lua interpreter using the shifter_add_category(string }; } - } + }*/ } } diff --git a/source/WindowsFormsApplication1/Apps/Shiftnet.cs b/source/WindowsFormsApplication1/Apps/Shiftnet.cs index 8e9a818..0c8b4b7 100644 --- a/source/WindowsFormsApplication1/Apps/Shiftnet.cs +++ b/source/WindowsFormsApplication1/Apps/Shiftnet.cs @@ -75,7 +75,7 @@ namespace ShiftOS { try { - string content = wc.DownloadString(url.Replace("shiftnet://", "http://www.playshiftos.ml/shiftnet/www/")); + string content = wc.DownloadString(url.Replace("shiftnet://", "http://releases.playshiftos.ml/shiftnet/www/")); if (content.StartsWith("")) { LastUrl = url; diff --git a/source/WindowsFormsApplication1/Apps/Terminal.cs b/source/WindowsFormsApplication1/Apps/Terminal.cs index f95025d..356e3de 100644 --- a/source/WindowsFormsApplication1/Apps/Terminal.cs +++ b/source/WindowsFormsApplication1/Apps/Terminal.cs @@ -14,6 +14,8 @@ using System.Text; using System.Threading; using System.Threading.Tasks; using ShiftUI; +using ShiftOS.FinalMission; +using ShiftOS; namespace ShiftOS { @@ -1383,894 +1385,1025 @@ Password: z7fjsd3"); public void DoCommand() { - API.LastRanCommand = command; - string[] args = command.ToLower().Split(' '); - switch (args[0]) + //Grab the type of this class using Reflection. + var terminal = this.GetType(); + string[] cmdargs = command.Split(' '); + var method_info = terminal.GetMethod("cmd_" + cmdargs[0].ToLower()); + if(method_info != null) { - case "ls": - case "dir": - if(API.Upgrades["fileskimmer"]) + method_info.Invoke(this, new object[] { cmdargs }); + } + else + { + terminal.GetMethod("cmd_default").Invoke(this, new object[] { cmdargs }); + } + } + + #region Terminal command methods + + /* + * Adding terminal commands has been changed. + * + * It's now done in a way that doesn't require hardcoding. + * + * Simply add a new method here with a prefix 'cmd_', for example 'cmd_05tray', and + * one argument of type 'string[]'. Then, put all the stuff you want your command to + * do in that method, and try running your command (without the 'cmd_' prefix) in the + * Terminal and it should work just fine. + * + * Thanks to @carverh for inspiring this by making all commands their own function. + */ + + public void cmd_dir(String[] args) + { + if (API.Upgrades["fileskimmer"]) + { + foreach (var d in Directory.GetDirectories(current_dir)) + { + WriteLine($"[DIR] {new DirectoryInfo(d).Name}"); + } + foreach (var d in Directory.GetFiles(current_dir)) + { + WriteLine($"{new FileInfo(d).Name}"); + } + } + else + { + wrongcommand(); + } + } + + public void cmd_cd(String[] args) + { + try + { + if (API.Upgrades["fileskimmer"]) + { + if (args[1] == "..") { - foreach(var d in Directory.GetDirectories(current_dir)) + if (GetPath(current_dir) != "/") { - WriteLine($"[DIR] {new DirectoryInfo(d).Name}"); + current_dir = GetParent(current_dir); + SetPrefix($"{API.Username}@{API.OSName} in {GetPath(current_dir)} $> "); } - foreach (var d in Directory.GetFiles(current_dir)) + else { - WriteLine($"{new FileInfo(d).Name}"); + WriteLine("cd: Can't go up past the root."); } } else { - wrongcommand(); - } - break; - case "cd": - if (API.Upgrades["fileskimmer"]) - { - if (args[1] == "..") + string newdir = current_dir + OSInfo.DirectorySeparator; + foreach (var dir in Directory.GetDirectories(current_dir)) { - if (GetPath(current_dir) != "/") - { - current_dir = GetParent(current_dir); - SetPrefix($"{API.Username}@{API.OSName} in {GetPath(current_dir)} $> "); - } - else - { - WriteLine("cd: Can't go up past the root."); - } - } - else - { - string newdir = current_dir + OSInfo.DirectorySeparator; - foreach (var dir in Directory.GetDirectories(current_dir)) - { - if (new DirectoryInfo(dir).Name.ToLower() == args[1]) - newdir = dir; - } - current_dir = newdir; - SetPrefix($"{API.Username}@{API.OSName} in {GetPath(current_dir)} $> "); + if (new DirectoryInfo(dir).Name.ToLower() == args[1]) + newdir = dir; } + current_dir = newdir; + SetPrefix($"{API.Username}@{API.OSName} in {GetPath(current_dir)} $> "); } - break; - case "upg": - if(API.DeveloperMode) - { - try - { - switch(args[1]) - { - case "get": - WriteLine(API.Upgrades[args[2]].ToString()); - break; - } - } - catch - { + } + } + catch (Exception e) + { + WriteLine("cd: " + e); + } + } - } - } - else - { - wrongcommand(); - } - break; - case "endgame_test": - if (API.DeveloperMode) + + public void cmd_upg(String[] args) + { + if (API.DeveloperMode) + { + try + { + switch (args[1]) { - try - { - switch (args[1]) - { - case "choice_screen": - var cscreen = new ShiftOS.FinalMission.ChooseYourApproach(); - cscreen.WindowState = FormWindowState.Maximized; - //cscreen.TopMost = true; - cscreen.Show(); - break; - case "limitedmode": - API.LimitedMode = !API.LimitedMode; - WriteLine($"Limited mode set to {API.LimitedMode}."); - break; - } - } - catch - { - WriteLine("Invalid arguments."); - } + case "get": + WriteLine(API.Upgrades[args[2]].ToString()); + break; } - else + } + catch + { + + } + } + else + { + wrongcommand(); + } + } + + public void cmd_endgame_test(String[] args) + { + if (API.DeveloperMode) + { + try + { + switch (args[1]) { - wrongcommand(); + case "choice_screen": + var cscreen = new ShiftOS.FinalMission.ChooseYourApproach(); + cscreen.WindowState = FormWindowState.Maximized; + //cscreen.TopMost = true; + cscreen.Show(); + break; + case "limitedmode": + API.LimitedMode = !API.LimitedMode; + WriteLine($"Limited mode set to {API.LimitedMode}."); + break; } - break; - case "htutorial": - ShiftOS.Hacking.StartBattleTutorial(); - break; - case "fake_buy": - if (API.DeveloperMode) + } + catch + { + WriteLine("Invalid arguments."); + } + } + else + { + wrongcommand(); + } + } + + public void cmd_htutorial(String[] args) + { + ShiftOS.Hacking.StartBattleTutorial(); + } + + public void cmd_fake_buy(String[] args) + { + if (API.DeveloperMode) + { + try + { + if (API.Upgrades.ContainsKey(args[1])) { - try - { - if (API.Upgrades.ContainsKey(args[1])) - { - API.Upgrades[args[1]] = true; - WriteLine($"Bought upgrade {args[1]}."); - API.CurrentSession.SetupAppLauncher(); - API.UpdateWindows(); - SaveSystem.Utilities.saveGame(); - } - else - { - WriteLine("Upgrade not found."); - } - } - catch - { - WriteLine("fake_buy: Bad arguments."); - } + API.Upgrades[args[1]] = true; + WriteLine($"Bought upgrade {args[1]}."); + API.CurrentSession.SetupAppLauncher(); + API.UpdateWindows(); + SaveSystem.Utilities.saveGame(); } else { - wrongcommand(); + WriteLine("Upgrade not found."); } - break; - case "connections": - try - { - switch(args[1]) - { - case "list": - foreach(var client in Package_Grabber.clients) - { - WriteLine($"Hostname: {client.Key}, Port: {client.Value.RemotePort}, Online: {client.Value.IsConnected}"); - } - break; - case "gui": - API.CreateForm(new ConnectionManager(), "Connections", API.GetIcon("Connections")); - break; - case "drop": - foreach(var client in Package_Grabber.clients) - { - Package_Grabber.Disconnect(client.Key); - } - break; - case "add": - string host = args[2]; - int port = 0; - int.TryParse(args[3], out port); - if (!Package_Grabber.clients.ContainsKey(host)) - { - Package_Grabber.ConnectToServer(host, port); - WriteLine("Connection to host established successfully."); - } - else - { - var c = Package_Grabber.clients[host]; - if (c.IsConnected == false) - { - c.Connect(host, port); - WriteLine("Re-established connection with host."); - } - else { - WriteLine("This host has been connected to already."); - } - } - break; - } - } - catch - { - WriteLine("connections: Missing arguments."); - } - break; - case "story": - if(API.DeveloperMode == true && API.Upgrades["shiftnet"]) - { - try + } + catch + { + WriteLine("fake_buy: Bad arguments."); + } + } + else + { + wrongcommand(); + } + } + + public void cmd_connections(String[] args) + { + try + { + switch (args[1]) + { + case "list": + foreach (var client in Package_Grabber.clients) { - switch(args[1]) - { - case "aidennirh": - StartAidenNirhStory(); - break; - case "devxfurious": - StartDevXFuriousStory(); - break; - case "battletut": - StartHackerBattleIntro(); - break; - case "otherplayer": - StartDevXFuriousStory(); - break; - case "hacker101": - StartHacker101Story(); - break; - } + WriteLine($"Hostname: {client.Key}, Port: {client.Value.RemotePort}, Online: {client.Value.IsConnected}"); } - catch + break; + case "gui": + API.CreateForm(new ConnectionManager(), "Connections", API.GetIcon("Connections")); + break; + case "drop": + foreach (var client in Package_Grabber.clients) { - WriteLine("Missing arguments."); + Package_Grabber.Disconnect(client.Key); } - } - else { wrongcommand(); } - break; - case "make": - try - { - string path = command.Replace("make ", ""); - string realpath = $"{Paths.SaveRoot}{path.Replace("/", OSInfo.DirectorySeparator)}"; - if (File.Exists(realpath + OSInfo.DirectorySeparator + "main.lua")) + break; + case "add": + string host = args[2]; + int port = 0; + int.TryParse(args[3], out port); + if (!Package_Grabber.clients.ContainsKey(host)) { - WriteLine("Compiling to " + path + ".saa"); - ZipFile.CreateFromDirectory(realpath, realpath + ".saa"); + Package_Grabber.ConnectToServer(host, port); + WriteLine("Connection to host established successfully."); } else { - WriteLine($"make: *** No rule to make target \"{realpath}\". Stop."); - } - } - catch - { - WriteLine("make: Invalid arguments."); - } - break; - case "linux": - if(API.DeveloperMode) - { - WriteLine("Upgrading your system..."); - foreach(var upg in Shiftorium.Utilities.GetAvailable()) - { - API.Upgrades[upg.id] = true; - WriteLine("Installed upgrade \"" + upg.Name + "\"..."); - } - API.UpdateWindows(); - API.CurrentSession.SetupDesktop(); - } - else - { - wrongcommand(); - } - break; - case "netgen": - WriteLine("Starting netgen..."); - API.CreateForm(new NetGen(), "Network Generator", API.GetIcon("Terminal")); - break; - case "lua": - if(API.DeveloperMode == true) - { - try - { - string f = args[1]; - WriteLine(f); - f = command.Remove(0, 4); - WriteLine(f); - string real = $"{Paths.SaveRoot}{f.Replace("/", OSInfo.DirectorySeparator)}"; - WriteLine(real); - if (File.Exists(real)) + var c = Package_Grabber.clients[host]; + if (c.IsConnected == false) { - WriteLine("Running Lua script at " + f + "."); - var l = new LuaInterpreter(real); + c.Connect(host, port); + WriteLine("Re-established connection with host."); } else { - WriteLine("Lua script file not found."); + WriteLine("This host has been connected to already."); } } - catch - { - this.LuaMode = true; - this.Interpreter = new LuaInterpreter(); - this.Interpreter.mod.print = new Action((text) => WriteLine(text)); - this.Interpreter.mod.exit = new Action(() => - { - this.LuaMode = false; - this.Interpreter = null; - WriteLine($"{API.CurrentSave.username}@{API.CurrentSave.osname} $> "); - }); - WriteLine("ShiftOS Lua Interpreter - v1.0"); - WriteLine("Created by Michael VanOverbeek"); - WriteLine(Environment.NewLine + "How to use: Simply type some Lua code and watch it come to life. Code can be executed on one line, and unlike most interpreters, you can access code from one line in another."); - WriteLine(Environment.NewLine + "When you're done, simply press the Enter key to execute the code." + Environment.NewLine); - } - } - else + break; + } + } + catch + { + WriteLine("connections: Missing arguments."); + } + } + + public void cmd_story(String[] args) + { + if (API.DeveloperMode == true && API.Upgrades["shiftnet"]) + { + try + { + switch (args[1]) { - wrongcommand(); + case "aidennirh": + StartAidenNirhStory(); + break; + case "devxfurious": + StartDevXFuriousStory(); + break; + case "battletut": + StartHackerBattleIntro(); + break; + case "otherplayer": + StartDevXFuriousStory(); + break; + case "hacker101": + StartHacker101Story(); + break; } - break; - case "hack": - if(API.Upgrades["hacking"] == true) + } + catch + { + WriteLine("Missing arguments."); + } + } + else { wrongcommand(); } + } + + public void cmd_make(String[] args) + { + try + { + string path = command.Replace("make ", ""); + string realpath = $"{Paths.SaveRoot}{path.Replace("/", OSInfo.DirectorySeparator)}"; + if (File.Exists(realpath + OSInfo.DirectorySeparator + "main.lua")) + { + WriteLine("Compiling to " + path + ".saa"); + ZipFile.CreateFromDirectory(realpath, realpath + ".saa"); + } + else + { + WriteLine($"make: *** No rule to make target \"{realpath}\". Stop."); + } + } + catch + { + WriteLine("make: Invalid arguments."); + } + } + + public void cmd_devupg(String[] args) + { + if (API.DeveloperMode) + { + WriteLine("Upgrading your system..."); + foreach (var upg in Shiftorium.Utilities.GetAvailable()) + { + API.Upgrades[upg.id] = true; + WriteLine("Installed upgrade \"" + upg.Name + "\"..."); + } + API.UpdateWindows(); + API.CurrentSession.SetupDesktop(); + } + else + { + wrongcommand(); + } + } + + public void cmd_netgen(String[] args) + { + WriteLine("Starting netgen..."); + API.CreateForm(new NetGen(), "Network Generator", API.GetIcon("Terminal")); + } + + public void cmd_lua(String[] args) + { + if (API.DeveloperMode == true) + { + try + { + string f = args[1]; + WriteLine(f); + f = command.Remove(0, 4); + WriteLine(f); + string real = $"{Paths.SaveRoot}{f.Replace("/", OSInfo.DirectorySeparator)}"; + WriteLine(real); + if (File.Exists(real)) { - StartHackingSession("random"); + WriteLine("Running Lua script at " + f + "."); + var l = new LuaInterpreter(real); } else { - wrongcommand(); + WriteLine("Lua script file not found."); } - break; - case "virusscanner": - case "vscan": - if(API.Upgrades["virusscanner"] == true) + } + catch + { + this.LuaMode = true; + this.Interpreter = new LuaInterpreter(); + this.Interpreter.mod.print = new Action((text) => WriteLine(text)); + this.Interpreter.mod.exit = new Action(() => + { + this.LuaMode = false; + this.Interpreter = null; + WriteLine($"{API.CurrentSave.username}@{API.CurrentSave.osname} $> "); + }); + WriteLine("ShiftOS Lua Interpreter - v1.0"); + WriteLine("Created by Michael VanOverbeek"); + WriteLine(Environment.NewLine + "How to use: Simply type some Lua code and watch it come to life. Code can be executed on one line, and unlike most interpreters, you can access code from one line in another."); + WriteLine(Environment.NewLine + "When you're done, simply press the Enter key to execute the code." + Environment.NewLine); + } + } + else + { + wrongcommand(); + } + } + + public void cmd_hack(String[] args) + { + if (API.Upgrades["hacking"] == true) + { + StartHackingSession("random"); + } + else + { + wrongcommand(); + } + } + + public void cmd_vscan(String[] args) + { + if (API.Upgrades["virusscanner"] == true) + { + WriteLine("Scanning for infected files..."); + var goodList = new Dictionary(); + foreach (KeyValuePair kv in Viruses.Infections) + { + if (kv.Value.Contains(";")) { - WriteLine("Scanning for infected files..."); - var goodList = new Dictionary(); - foreach (KeyValuePair kv in Viruses.Infections) + foreach (string file in kv.Value.Split(';')) { - if(kv.Value.Contains(";")) + if (goodList.ContainsKey(file)) { - foreach(string file in kv.Value.Split(';')) - { - if (goodList.ContainsKey(file)) - { - goodList[file] += ", " + kv.Key; - } - else { - goodList.Add(file, kv.Key); - } - } + goodList[file] += ", " + kv.Key; } else { - if (goodList.ContainsKey(kv.Value)) - { - goodList[kv.Value] += ", " + kv.Key; - } - else { - goodList.Add(kv.Value, kv.Key); - } + goodList.Add(file, kv.Key); } } - WriteLine("Scan complete."); - if (goodList.Count > 0) - { - foreach (KeyValuePair kv in goodList) - { - WriteLine("File " + kv.Key + " is infected with " + kv.Value + ". Disinfecting..."); - Viruses.DisInfect(kv.Key); - } - WriteLine("Disinfection complete."); - } - else - { - WriteLine("No infections found. You are safe."); - } - } - break; - case "infections": - if (API.DeveloperMode == true) - { - foreach (KeyValuePair kv in Viruses.Infections) - { - WriteLine(kv.Key + " @ " + kv.Value); - } - } - else - { - wrongcommand(); - } - break; - case "binarywater": - if (API.DeveloperMode) - { - ShiftOS.Hacking.AddCharacter(new Character("Philip Adams", "Hello, and welcome to another episode of OSFirstTimer.", 100, 100, 0)); - WriteLine("Philip Adams is now in the list of hirable hackers."); } else { - WriteLine("I see you went in the ShiftOS source code... ummm yeah... this isn't a developer mode release so I can't just give you a full-skilled hacker even if you beg."); - } - break; - case "color": - try - { - if(API.Upgrades["setterminalcolors"] == true) + if (goodList.ContainsKey(kv.Value)) { - - Color bcol = SetColor(args[1]); - Color tcol = SetColor(args[2]); - API.CurrentSkin.TerminalTextColor = tcol; - API.CurrentSkin.TerminalBackColor = bcol; - - } - } - catch(Exception) - { - WriteLine("color: Missing arguments."); - } - break; - case "encrypt": - if (API.DeveloperMode == true) - { - string messageToEncrypt = command.Replace("encrypt ", ""); - string encryptedMessage = API.Encryption.Encrypt(messageToEncrypt); - WriteLine("Encrypted Message: " + encryptedMessage); - } - else - { - wrongcommand(); - } - break; - case "font": - if(API.Upgrades["setterminalfont"] == true) - { - var fname = command.Replace("font ", ""); - if(GetFonts().Contains(fname)) - { - API.CurrentSkin.TerminalFontStyle = fname; + goodList[kv.Value] += ", " + kv.Key; } else { - WriteLine("font: Unrecognized font name \"" + fname + "\". Note: Font names are case sensitive."); + goodList.Add(kv.Value, kv.Key); } } - else - { - wrongcommand(); - } - break; - case "colorlist": - if(API.Upgrades["setterminalcolors"] == true) - { - foreach(string itm in GetColorList()) - { - WriteLine(itm); - } - } - else + } + WriteLine("Scan complete."); + if (goodList.Count > 0) + { + foreach (KeyValuePair kv in goodList) { - wrongcommand(); + WriteLine("File " + kv.Key + " is infected with " + kv.Value + ". Disinfecting..."); + Viruses.DisInfect(kv.Key); } - break; - case "spkg": - if (!API.LimitedMode) + WriteLine("Disinfection complete."); + } + else + { + WriteLine("No infections found. You are safe."); + } + } + } + + public void cmd_infections(String[] args) + { + if (API.DeveloperMode == true) + { + foreach (KeyValuePair kv in Viruses.Infections) + { + WriteLine(kv.Key + " @ " + kv.Value); + } + } + else + { + wrongcommand(); + } + } + + public void cmd_binarywater(String[] args) + { + if (API.DeveloperMode) + { + ShiftOS.Hacking.AddCharacter(new Character("Philip Adams", "Hello, and welcome to another episode of OSFirstTimer.", 100, 100, 0)); + WriteLine("Philip Adams is now in the list of hirable hackers."); + WriteLine("\" I Don't Think This is Canon \" -Carver"); + } + else + { + WriteLine("I see you went in the ShiftOS source code... ummm yeah... this isn't a developer mode release so I can't just give you a full-skilled hacker even if you beg."); + } + } + + public void cmd_color(String[] args) + { + try + { + if (API.Upgrades["setterminalcolors"] == true) + { + + Color bcol = SetColor(args[1]); + Color tcol = SetColor(args[2]); + API.CurrentSkin.TerminalTextColor = tcol; + API.CurrentSkin.TerminalBackColor = bcol; + + } + } + catch (Exception) + { + WriteLine("color: Missing arguments."); + } + } + + public void cmd_encrypt(String[] args) + { + if (API.DeveloperMode == true) + { + string messageToEncrypt = command.Replace("encrypt ", ""); + string encryptedMessage = API.Encryption.Encrypt(messageToEncrypt); + WriteLine("Encrypted Message: " + encryptedMessage); + } + else + { + wrongcommand(); + } + } + + public void cmd_font(String[] args) + { + if (API.Upgrades["setterminalfont"] == true) + { + var fname = command.Replace("font ", ""); + if (GetFonts().Contains(fname)) + { + API.CurrentSkin.TerminalFontStyle = fname; + } + else + { + WriteLine("font: Unrecognized font name \"" + fname + "\". Note: Font names are case sensitive."); + } + } + else + { + wrongcommand(); + } + } + + public void cmd_colorlist(String[] args) + { + if (API.Upgrades["setterminalcolors"] == true) + { + foreach (string itm in GetColorList()) + { + WriteLine(itm); + } + } + else + { + wrongcommand(); + } + } + + public void cmd_spkg(String[] args) + { + if (!API.LimitedMode) + { + if (API.Upgrades["shiftnet"] == true) + { + try { - if (API.Upgrades["shiftnet"] == true) + switch (args[1].ToLower()) { - try - { - switch (args[1].ToLower()) + case "install": + if (args[2] != null && args[2] != "") { - case "install": - if (args[2] != null && args[2] != "") + string pkgname = args[2].ToLower().Replace(".pkg", ""); + if (Package_Grabber.GetPackage(pkgname) == true) + { + WriteLine("Downloaded package '" + pkgname + "' from shiftnet://main/spkg/ successfully. Installing now."); + string r = Package_Grabber.ExtractPackage(); + if (r == "fail") + { + WriteLine("[FATAL] Could not install package."); + WriteLine("spkg: Killed."); + } + else { - string pkgname = args[2].ToLower().Replace(".pkg", ""); - if (Package_Grabber.GetPackage(pkgname) == true) + WriteLine("Extracted " + pkgname + " to " + r + "..."); + var res2 = Package_Grabber.InstallPackage(r + "\\"); + if (res2 != "success") { - WriteLine("Downloaded package '" + pkgname + "' from shiftnet://main/spkg/ successfully. Installing now."); - string r = Package_Grabber.ExtractPackage(); - if (r == "fail") - { - WriteLine("[FATAL] Could not install package."); - WriteLine("spkg: Killed."); - } - else - { - WriteLine("Extracted " + pkgname + " to " + r + "..."); - var res2 = Package_Grabber.InstallPackage(r + "\\"); - if (res2 != "success") - { - WriteLine("[FATAL] Could not install package. " + res2); - WriteLine("spkg: Killed."); - } - else - { - WriteLine("[DONE] Package installed."); - } - } + WriteLine("[FATAL] Could not install package. " + res2); + WriteLine("spkg: Killed."); } else { - WriteLine("spkg: Package '" + args[2] + "' not found."); + WriteLine("[DONE] Package installed."); } } - break; - default: - WriteLine("spkg: Invalid argument: " + args[1]); - break; - } - } - catch (Exception ex) - { - WriteLine("spkg: " + ex.Message); - } - } - else - { - wrongcommand(); - } - } - else - { - try - { - if(args[2] == "god_utils") - { - if(FinalMission.EndGameHandler.GodModeInstallEnabled == true) - { - var t = new Thread(new ThreadStart(new Action(() => + } + else { - WriteLine("Downloading package 'god_utils'... Please wait."); - Thread.Sleep(10000); - WriteLine("Download complete."); - Thread.Sleep(100); - WriteLine("Beginning installation."); - Thread.Sleep(1000); - WriteLine(@" == GOD MODE == - -God Mode gives you FULL control of ShiftOS. You can add/remove Codepoints, buy or unbuy Shiftorium upgrades, and can do whatever you want. - -Installing core applications..."); - Thread.Sleep(250); - WriteLine("Installing subpackage 'json_edit'..."); - Thread.Sleep(250); - WriteLine("Installing subpackage 'upgrade_mod'..."); - Thread.Sleep(100); - WriteLine("Installing subpackage 'hijacker'..."); - Thread.Sleep(500); - WriteLine(@" == HIJACKER by DevX == - -HIJACKER is a utility that allows you to hijack any system and install ShiftOS on it during a hacker battle."); - Thread.Sleep(100); - WriteLine("[hijacker] Injecting HIJACKER code into hbattleui.sft..."); - Thread.Sleep(150); - WriteLine("[hijacker] Done."); - this.Invoke(new Action(() => - { - StartChoice1EndStory(); - })); - }))); - t.Start(); - } - else - { - WriteLine("spkg: Package '" + args[2] + "' not found."); - } - } - else - { - WriteLine("spkg: Package '" + args[2] + "' not found."); - } - } - catch - { - WriteLine("spkg: Missing arguments."); - } - } - break; - case "alias": - try - { - switch(args[1]) - { - case "-?": - case "--help": - WriteLine("Aliases Help" + Environment.NewLine); - WriteLine("Alias is a command that lets you create aliases for other commands. You could make a command 'upgrade' alias 'shiftorium' if you wanted." + Environment.NewLine); - WriteLine("Arguments:"); - WriteLine(" -h, --help: Displays this screen."); - WriteLine("-a, --add : Adds a new alias."); - WriteLine("-d, --delete : Deletes an alias."); - WriteLine("-l, --list: Shows all available aliases."); - break; - case "--add": - case "-a": - if(API.AddAlias(args[2], command.Replace("alias " + args[1] + " " + args[2] + " ", ""))) - { - WriteLine("Alias added successfully."); - API.SaveAliases(); - } - else - { - WriteLine("That alias already exists."); - } - break; - case "--delete": - case "-d": - if(API.RemoveAlias(args[2]) == true) - { - WriteLine("Alias \"" + args[2] + "\" removed successfully."); - API.SaveAliases(); - } - else - { - WriteLine("That alias doesn't exist."); - } - break; - case "-l": - case "--list": - WriteLine("Aliases:"); - foreach(KeyValuePair kv in API.CommandAliases) - { - WriteLine(kv.Key + " => " + kv.Value); + WriteLine("spkg: Package '" + args[2] + "' not found."); + } } break; default: - WriteLine("alias: Invalid argument. Try alias --help for help with the Alias command."); + WriteLine("spkg: Invalid argument: " + args[1]); break; } } - catch + catch (Exception ex) { - WriteLine("alias: Missing arguments. Try alias --help for help with the Alias command."); + WriteLine("spkg: " + ex.Message); } - break; - case "username": - if(API.Upgrades["customusername"] == true) + } + else + { + wrongcommand(); + } + } + else + { + try + { + if (args[2] == "god_utils") { - try + if (FinalMission.EndGameHandler.GodModeInstallEnabled == true) { - API.CurrentSave.username = args[1]; + var t = new Thread(new ThreadStart(new Action(() => + { + WriteLine("Downloading package 'god_utils'... Please wait."); + Thread.Sleep(10000); + WriteLine("Download complete."); + Thread.Sleep(100); + WriteLine("Beginning installation."); + Thread.Sleep(1000); + WriteLine(@" == GOD MODE == +God Mode gives you FULL control of ShiftOS. You can add/remove Codepoints, buy or unbuy Shiftorium upgrades, and can do whatever you want. +Installing core applications..."); + Thread.Sleep(250); + WriteLine("Installing subpackage 'json_edit'..."); + Thread.Sleep(250); + WriteLine("Installing subpackage 'upgrade_mod'..."); + Thread.Sleep(100); + WriteLine("Installing subpackage 'hijacker'..."); + Thread.Sleep(500); + WriteLine(@" == HIJACKER by DevX == +HIJACKER is a utility that allows you to hijack any system and install ShiftOS on it during a hacker battle."); + Thread.Sleep(100); + WriteLine("[hijacker] Injecting HIJACKER code into hbattleui.sft..."); + Thread.Sleep(150); + WriteLine("[hijacker] Done."); + this.Invoke(new Action(() => + { + StartChoice1EndStory(); + })); + }))); + t.Start(); } - catch + else { - WriteLine("username: Missing arguments."); + WriteLine("spkg: Package '" + args[2] + "' not found."); } } else { - wrongcommand(); + WriteLine("spkg: Package '" + args[2] + "' not found."); } - break; - case "osname": - if (API.Upgrades["customusername"] == true) - { - try + } + catch + { + WriteLine("spkg: Missing arguments."); + } + } + } + + /// + /// Command Functions, to Be Used For ShiftBatch + /// + /// String[] args + public void cmd_alias(String[] args) + { + try + { + switch (args[1]) + { + case "-?": + case "--help": + WriteLine("Aliases Help" + Environment.NewLine); + WriteLine("Alias is a command that lets you create aliases for other commands. You could make a command 'upgrade' alias 'shiftorium' if you wanted." + Environment.NewLine); + WriteLine("Arguments:"); + WriteLine(" -h, --help: Displays this screen."); + WriteLine("-a, --add : Adds a new alias."); + WriteLine("-d, --delete : Deletes an alias."); + WriteLine("-l, --list: Shows all available aliases."); + break; + case "--add": + case "-a": + if (API.AddAlias(args[2], command.Replace("alias " + args[1] + " " + args[2] + " ", ""))) + { + WriteLine("Alias added successfully."); + API.SaveAliases(); + } + else { - API.CurrentSave.osname = args[1]; + WriteLine("That alias already exists."); } - catch + break; + case "--delete": + case "-d": + if (API.RemoveAlias(args[2]) == true) { - WriteLine("osname: Missing arguments."); + WriteLine("Alias \"" + args[2] + "\" removed successfully."); + API.SaveAliases(); } - } - else - { - wrongcommand(); - } - break; - - case "unity": - if (API.Upgrades["unitymode"] == true) - { - API.CurrentSession.SetUnityMode(); - API.CurrentSession.SetupDesktop(); - txtterm.Focus(); - } else - { - wrongcommand(); - } - break; - case "time": - if (API.Upgrades["pmandam"] == false) - { - if (API.Upgrades["hourssincemidnight"] == false) + else { - if (API.Upgrades["minutessincemidnight"] == false) - { - if (API.Upgrades["secondssincemidnight"] == true) { - WriteLine("Since midnight, " + API.GetTime() + " seconds have passed."); - } else { - wrongcommand(); - } - } else - { - WriteLine("Since midnight, " + API.GetTime() + " minutes have passed."); - } + WriteLine("That alias doesn't exist."); } - else + break; + case "-l": + case "--list": + WriteLine("Aliases:"); + foreach (KeyValuePair kv in API.CommandAliases) { - WriteLine("Since Midnight, " + API.GetTime() + " hours have passed."); + WriteLine(kv.Key + " => " + kv.Value); } - } else + break; + default: + WriteLine("alias: Invalid argument. Try alias --help for help with the Alias command."); + break; + } + } + catch + { + WriteLine("alias: Missing arguments. Try alias --help for help with the Alias command."); + } + } + + public void cmd_username(String[] args) + { + if (API.Upgrades["customusername"] == true) + { + try + { + API.CurrentSave.username = args[1]; + } + catch + { + WriteLine("username: Missing arguments."); + } + } + else + { + wrongcommand(); + } + } + + public void cmd_osname(String[] args) + { + if (API.Upgrades["customusername"] == true) + { + try + { + API.CurrentSave.osname = args[1]; + } + catch + { + WriteLine("osname: Missing arguments."); + } + } + else + { + wrongcommand(); + } + } + + public void cmd_unity(String[] args) + { + if (API.Upgrades["unitymode"] == true) + { + API.CurrentSession.SetUnityMode(); + API.CurrentSession.SetupDesktop(); + txtterm.Focus(); + } + else + { + wrongcommand(); + } + } + + public void cmd_time(String[] args) + { + if (API.Upgrades["pmandam"] == false) + { + if (API.Upgrades["hourssincemidnight"] == false) + { + if (API.Upgrades["minutessincemidnight"] == false) { - WriteLine("Current time: " + API.GetTime()); - } - break; - case "saa": - if (API.Upgrades["shiftnet"]) { - var f = command.Replace("saa ", ""); - if (f.StartsWith("/")) + if (API.Upgrades["secondssincemidnight"] == true) { - var withoutslash = f.Remove(0, 1); - var dirsep = OSInfo.DirectorySeparator; - var rightdir = $"{Paths.SaveRoot}{dirsep}{f.Replace("/", dirsep)}"; - if (File.Exists(rightdir)) - { - var finf = new FileInfo(rightdir); - if (finf.Extension == ".saa") - { - API.LaunchMod(finf.FullName); - } - else - { - WriteLine("saa: Cannot launch the file '" + finf.FullName + " because it isn't a valid stand-alone app."); - } - } - else - { - WriteLine("saa: Cannot launch the file '" + f + "' because it doesn't exist."); - } + WriteLine("Since midnight, " + API.GetTime() + " seconds have passed."); } else { - WriteLine("saa: Cannot launch the file '" + f + "' because it doesn't exist."); + wrongcommand(); } } else { - wrongcommand(); - } - break; - case "help": - try - { - showhelp(args[1]); - } - catch - { - showhelp(); + WriteLine("Since midnight, " + API.GetTime() + " minutes have passed."); } - break; - case "codepoints": - case "cp": - WriteLine("You have " + API.Codepoints.ToString() + " Codepoints."); - break; - case "shutdown": - API.ShutDownShiftOS(); - break; - case "clear": - txtterm.Text = ""; - break; - case "close": - if (command.Contains("close ")) + } + else + { + WriteLine("Since Midnight, " + API.GetTime() + " hours have passed."); + } + } + else + { + WriteLine("Current time: " + API.GetTime()); + } + } + + public void cmd_saa(String[] args) + { + if (API.Upgrades["shiftnet"]) + { + var f = command.Replace("saa ", ""); + if (f.StartsWith("/")) + { + var withoutslash = f.Remove(0, 1); + var dirsep = OSInfo.DirectorySeparator; + var rightdir = $"{Paths.SaveRoot}{dirsep}{f.Replace("/", dirsep)}"; + if (File.Exists(rightdir)) { - var pid = command.Replace("close ", ""); - if (API.CloseProgram(pid) == true) + var finf = new FileInfo(rightdir); + if (finf.Extension == ".saa") { - WriteLine("Closed all running " + pid + "s."); + API.LaunchMod(finf.FullName); } else { - WriteLine("No processes with id '" + pid + "' were found!"); + WriteLine("saa: Cannot launch the file '" + finf.FullName + " because it isn't a valid stand-alone app."); } } else { - WriteLine("Insufficient arguments."); + WriteLine("saa: Cannot launch the file '" + f + "' because it doesn't exist."); } - break; - case "05tray": - if (API.DeveloperMode == true) + } + else + { + WriteLine("saa: Cannot launch the file '" + f + "' because it doesn't exist."); + } + } + else + { + wrongcommand(); + } + } + + public void cmd_help(String[] args) + { + try + { + showhelp(args[1]); + } + catch + { + showhelp(); + } + } + + public void cmd_cp(String[] args) + { + WriteLine("You have " + API.Codepoints.ToString() + " Codepoints."); + } + + public void cmd_shutdown(String[] args) + { + API.ShutDownShiftOS(); + } + + public void cmd_clear(String[] args) + { + txtterm.Text = ""; + } + + public void cmd_close(String[] args) + { + if (command.Contains("close ")) + { + var pid = command.Replace("close ", ""); + if (API.CloseProgram(pid) == true) + { + WriteLine("Closed all running " + pid + "s."); + } + else + { + WriteLine("No processes with id '" + pid + "' were found!"); + } + } + else + { + WriteLine("Insufficient arguments."); + } + } + + public void cmd_05tray(String[] args) + { + if (API.DeveloperMode == true) + { + API.AddCodepoints(500); + WriteLine("You've been granted 500 Codepoints."); + } + else + { + wrongcommand(); + } + } + + public void cmd_debug(String[] args) + { + if (API.DeveloperMode == true) + { + try + { + switch (args[1].ToLower()) { - API.AddCodepoints(500); - WriteLine("You've been granted 500 Codepoints."); - } else + case "shiftnet-story": + WriteLine("Debugging Shiftnet Story..."); + StartShiftnetStory(); + break; + case "devmode": + API.DeveloperMode = false; + WriteLine("Turned off developer mode. Use the passcode to turn it back on."); + break; + default: + WriteLine("Invalid argument: " + args[1] + ". Debug can only debug the following: 'shiftnet-story'."); + break; + } + + } + catch (Exception ex) + { + WriteLine("debug: " + ex.Message); + } + } + else + { + try + { + switch (args[1].ToLower()) { - wrongcommand(); + case "developers123": + WriteLine("Turned Developer Mode on!"); + API.DeveloperMode = true; + break; + default: + WriteLine("debug: lp0 is on fire"); // Keeps Cheaters from Flooding The Fourms With "The Debug Mode Doesn't Work" + break; } + } + catch + { + WriteLine("debug: lp0 is on fire"); // Keeps Cheaters from Flooding The Fourms With "The Debug Mode Doesn't Work" + } + } + } - break; - case "debug": - if (API.DeveloperMode == true) + public void cmd_echo(String[] args) + { + if (command.Contains("echo ")) + { + WriteLine(command.Replace("echo ", "")); + } + else + { + WriteLine("echo: Insufficient Parameters."); + } + } + + public void cmd_default(String[] args) + { + if (API.OpenProgram(args[0]) == false) + { + if (API.Upgrades["trmfiles"] == false) + { + bool done = false; + foreach (KeyValuePair kv in API.CommandAliases) { - try + if (kv.Key == command) { - switch (args[1].ToLower()) - { - case "shiftnet-story": - WriteLine("Debugging Shiftnet Story..."); - StartShiftnetStory(); - break; - case "devmode": - API.DeveloperMode = false; - WriteLine("Turned off developer mode. Use the passcode to turn it back on."); - break; - default: - WriteLine("Invalid argument: " + args[1] + ". Debug can only debug the following: 'shiftnet-story'."); - break; - } - + command = kv.Value; + done = true; + DoCommand(); } - catch (Exception ex) + + } + if (done == false) + { + wrongcommand(); + } + } + else + { + var f = command.Replace("\\", "/"); + if (f.StartsWith("/")) + { + var withoutslash = f.Remove(0, 1); + var dirsep = OSInfo.DirectorySeparator; + var proper = $"{Paths.SaveRoot}{dirsep}{withoutslash.Replace("/", dirsep)}"; + if (File.Exists(proper)) { - WriteLine("debug: " + ex.Message); + runterminalfile(proper); } - } else { - try - { - switch (args[1].ToLower()) - { - case "developers123": - WriteLine("Turned Developer Mode on!"); - API.DeveloperMode = true; - break; - default: - wrongcommand(); - break; - } - } catch + else { - wrongcommand(); //Debug command pretends to be an invalid command if an exception is thrown. + wrongcommand(); } } - break; - case "echo": - if(command.Contains("echo ")) - { - WriteLine(command.Replace("echo ", "")); - } else { - WriteLine("echo: Insufficient Parameters."); - } - break; - case "syncsave": - WriteLine("Command removed."); - break; - - default: - if (API.OpenProgram(args[0]) == false) - { - if (API.Upgrades["trmfiles"] == false) + bool done = false; + foreach (KeyValuePair kv in API.CommandAliases) { - bool done = false; - foreach(KeyValuePair kv in API.CommandAliases) - { - if(kv.Key == command) - { - command = kv.Value; - done = true; - DoCommand(); - } - - } - if(done == false) + if (kv.Key == command) { - wrongcommand(); + command = kv.Value; + done = true; + DoCommand(); } + } - else + if (done == false) { - var f = command.Replace("\\", "/"); - if (f.StartsWith("/")) - { - var withoutslash = f.Remove(0, 1); - var dirsep = OSInfo.DirectorySeparator; - var proper = $"{Paths.SaveRoot}{dirsep}{withoutslash.Replace("/", dirsep)}"; - if (File.Exists(proper)) - { - runterminalfile(proper); - } - else - { - wrongcommand(); - } - } - else - { - bool done = false; - foreach (KeyValuePair kv in API.CommandAliases) - { - if (kv.Key == command) - { - command = kv.Value; - done = true; - DoCommand(); - } - - } - if (done == false) - { - wrongcommand(); - } - } + wrongcommand(); } } - break; + } } } + /// + /// About Box, Created By Carver Harrison + /// + /// String[] args + public void cmd_about(String[] args) + { + API.CreateInfoboxSession("About ShiftOS", "ShiftOS Version " + ProductVersion + "\n Copyright 2014-2016 ShiftOS Dev Team \n Type 'credits' in Terminal to Show Credits", infobox.InfoboxMode.Info); + } + + // HISTACOM REFERENCES, DO NOT REMOVE, CRUCIAL FOR SECRET STORY ARC + public void cmd_histacom_year(String[] args) + { + WriteLine("Year: 2002"); + } + + public void cmd_histacom_timedistorter(String[] args) + { + WriteLine("Install 'timedistorter' by going to shiftnet://12padams"); + } + + #endregion + private void StartChoice1EndStory() { var t = new ShiftUI.Timer(); diff --git a/source/WindowsFormsApplication1/Online/Package_Grabber.cs b/source/WindowsFormsApplication1/Online/Package_Grabber.cs index addf910..854e96f 100644 --- a/source/WindowsFormsApplication1/Online/Package_Grabber.cs +++ b/source/WindowsFormsApplication1/Online/Package_Grabber.cs @@ -188,7 +188,7 @@ namespace ShiftOS Directory.CreateDirectory(downloadpath); } WebClient wc = new WebClient(); - wc.DownloadFile("http://playshiftos.ml/shiftnet/packages/" + pkgname + ".pkg", downloadpath + pkgname + ".pkg"); + wc.DownloadFile("http://releases.playshiftos.ml/shiftnet/packages/" + pkgname + ".pkg", downloadpath + pkgname + ".pkg"); LastPackage_DownloadPath = downloadpath + pkgname + ".pkg"; } catch -- cgit v1.2.3