using System;
using System.Diagnostics;
using System.Drawing;
using System.Windows.Forms;
// using Bunifu.UI.WinForms;

namespace XeroBrowser
{
    public partial class FrmSettings : Form
    {
        public FrmSettings()
        {
            InitializeComponent();
            tabControl1.DrawMode = TabDrawMode.OwnerDrawFixed;
            tabControl1.Padding = new Point(15, 8);
            tabControl1.Appearance = TabAppearance.FlatButtons;
            tabControl1.ItemSize = new Size(0, 34);
            tabControl1.SizeMode = TabSizeMode.Fixed;
        }

        private void tabControl1_DrawItem(object sender, DrawItemEventArgs e)
        {
            TabControl tabControl = (TabControl)sender;
            TabPage tabPage = tabControl.TabPages[e.Index];

            // Set the background color of the tab
            using (Brush brush = new SolidBrush(Color.FromArgb(224, 224, 224)))
            {
                e.Graphics.FillRectangle(brush, e.Bounds);
            }

            // Draw the icon for the tab, if available
            if (tabPage.ImageIndex >= 0)
            {
                Image icon = tabControl.ImageList.Images[tabPage.ImageIndex];
                Rectangle iconRect = new Rectangle(e.Bounds.X + 6, e.Bounds.Y + 6, 20, 20);
                e.Graphics.DrawImage(icon, iconRect);
            }

            // Draw the text for the tab
            using (Brush brush = new SolidBrush(Color.Black))
            {
                Font font = new Font("Segoe UI", 9, FontStyle.Regular);
                StringFormat format = new StringFormat();
                format.Alignment = StringAlignment.Center;
                format.LineAlignment = StringAlignment.Center;
                Rectangle textRect = new Rectangle(e.Bounds.X + 28, e.Bounds.Y, e.Bounds.Width - 28, e.Bounds.Height);
                e.Graphics.DrawString(tabPage.Text, font, brush, textRect, format);
            }
        }


        private void bunifuDropdown1_SelectedIndexChanged(object sender, EventArgs e)
        {
            
        }

        private void bunifuButton22_Click(object sender, EventArgs e)
        {
            Process.Start("ms-settings:network-proxy");
        }

        private void bunifuImageButton1_Click(object sender, EventArgs e)
        {
            Close();
        }

        private void bunifuTextBox1_TextChanged(object sender, EventArgs e)
        {
            bunifuRadioButton2.Checked = true;
            bunifuRadioButton1.Checked = false;
        }

        private void btnBrowser_Click(object sender, EventArgs e)
        {
            tabControl1.SelectedIndex = 0;
        }

        private void Appearance_Click(object sender, EventArgs e)
        {
            tabControl1.SelectedIndex = 1;
        }

        private void btnPrivacy_Click(object sender, EventArgs e)
        {
            tabControl1.SelectedIndex = 2;
        }

        private void btnBehavior_Click(object sender, EventArgs e)
        {
            tabControl1.SelectedIndex = 3;
        }

        private void btnAutofill_Click(object sender, EventArgs e)
        {
            tabControl1.SelectedIndex = 4;
        }

        private void btnLanguages_Click(object sender, EventArgs e)
        {
            tabControl1.SelectedIndex = 5;
        }

        private void btnAccessibility_Click(object sender, EventArgs e)
        {
            tabControl1.SelectedIndex = 6;
        }
    }
}