// Created with MonoDevelop
//
//    QuickStep: Acquire, view and identify spectra 
//    Copyright (C) 2021 Hiperscan GmbH Dresden, Germany
//
//    This program is free software: you can redistribute it and/or modify
//    it under the terms of the GNU General Public License as published by
//    the Free Software Foundation, either version 3 of the License, or
//    (at your option) any later version.
//
//    This program is distributed in the hope that it will be useful,
//    but WITHOUT ANY WARRANTY; without even the implied warranty of
//    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//    GNU General Public License for more details.
//
//    You should have received a copy of the GNU General Public License
//    along with this program.  If not, see <http://www.gnu.org/licenses/>.



using System;
using Hiperscan.Extensions.ApoIdent.Widgets;
using Hiperscan.GtkExtensions.Widgets;

namespace Hiperscan.Extensions.ApoIdent
{
    public partial class GuiDesigner
    { 
        public void ModifySectionMainLabel(Gtk.Label label)
        {
            Pango.FontDescription fd = label.Style.FontDesc.Copy();
            fd.Size = (int)(fd.Size * 1.6);
            label.ModifyFont(fd);
        }

        public LinkLabel CreateLinkLabel(ref Gtk.Label label)
        {
            LinkLabel link_label = new LinkLabel(label);
            link_label.BgColor = ApoIdentColors.WHITE;

            label = null;

            return link_label;
        }

        public OutLinedLabel CreateOutLinedLabel(ref Gtk.Label label)
        {
            OutLinedLabel tmp = new OutLinedLabel(label);
            label = null;

            tmp.BackGroundColer = ApoIdentColors.WHITE;
            tmp.ErrorColor = ApoIdentColors.LIGHT_RED;
            tmp.OkColor = ApoIdentColors.WHITE;
            tmp.IsValid = false;

            return tmp;
        }

        public void SetMeasuringAdviceColor(Gtk.Label label)
        {
            WidgetColor.SetFontColor(label, ApoIdentColors.HIPERSCAN_RED);
        }

        public void SetStatusLabelFontSize(Gtk.Label label)
        {
            Pango.FontDescription fd = label.Style.FontDesc.Copy();
            fd.Size = (int)(fd.Size * 0.8);
            label.ModifyFont(fd);
        }

        public void SetClassificationLabelFontSize(OutLinedLabel label)
        {
            label.ScaleFont(1.3);
        }

        public void SetMeasruringTimerLabelFontSize(Gtk.Label label)
        {
            Pango.FontDescription fd = label.Style.FontDesc.Copy();
            fd.Size = (int)(fd.Size * 0.9);
            label.ModifyFont(fd);
        }

        public void AdjustAdditionalTestLabel(Gtk.Label label, int height)
        {
            label.HeightRequest = height;
            label.Xpad = 5;
        }

        public void SetResultClassificationOutputColor(OutLinedLabel label,bool is_multiple)
        {
            if (is_multiple)
            {
                label.BackGroundColer = ApoIdentColors.SEARCH_ENTRY_YELLOW_BG;
                label.OkColor = ApoIdentColors.SEARCH_ENTRY_YELLOW_BG;
            }
            else
            {
                label.BackGroundColer = ApoIdentColors.WHITE;
                label.OkColor = ApoIdentColors.WHITE;
            }
        }

        public FlexLabel CreateFlexLabel(Gtk.EventBox eventbox)
        {
            FlexLabel flex_label = new FlexLabel(eventbox);
            flex_label.Background = GuiDesigner.ApoIdentColors.WHITE;
            flex_label.Rows = 1;
            return flex_label;
        }

        public FlexEllipsizeLabel CreateFlexEllipsizeLabel(ref Gtk.Label label)
        {
            FlexEllipsizeLabel tmp = new FlexEllipsizeLabel(label);
            label = null;
            return tmp;
        }
    }
}
