示例#1
0
        static public void NewTime(VBox pg, string name)
        {
            var tbox = new HBox();
            var tp   = new Label("time"); tp.SetSizeRequest(200, 25); tp.SetAlignment(0, 0);
            var nm   = new Label(name.Replace("_", "__")); nm.SetSizeRequest(400, 25); nm.SetAlignment(0, 0);

#if RottenBackGround
            tp.ModifyFg(StateType.Normal, new Gdk.Color(125, 18, 0));
            nm.ModifyFg(StateType.Normal, new Gdk.Color(18, 125, 0));
#else
            tp.ModifyFg(StateType.Normal, new Gdk.Color(255, 180, 0));
            nm.ModifyFg(StateType.Normal, new Gdk.Color(180, 255, 0));
#endif
            var timebox = new HBox(); timebox.SetSizeRequest(400, 25);
            var uur     = new ComboBox(SR(0, 23, 2));
            var minuut  = new ComboBox(SR(0, 59, 2));
            var seconde = new ComboBox(SR(0, 59, 2));
            tbox.ModifyBg(StateType.Normal, new Gdk.Color(0, 0, 0));
            timebox.Add(uur);
            timebox.Add(new Label(":"));
            timebox.Add(minuut);
            timebox.Add(new Label(":"));
            timebox.Add(seconde);
            objlink[uur]     = name;
            objlink[minuut]  = name;
            objlink[seconde] = name;
            uur.Changed     += OnTime;
            minuut.Changed  += OnTime;
            seconde.Changed += OnTime;
            tbox.Add(tp);
            tbox.Add(nm);
            tbox.Add(timebox);
            MainClass.Times[name] = new MyTime(uur, minuut, seconde);
            pg.Add(tbox);
        }
示例#2
0
        static public void NewDate(VBox pg, string name)
        {
            var tbox = new HBox();
            var tp   = new Label("date"); tp.SetSizeRequest(200, 25); tp.SetAlignment(0, 0);
            var nm   = new Label(name.Replace("_", "__")); nm.SetSizeRequest(400, 25); nm.SetAlignment(0, 0);

#if RottenBackGround
            tp.ModifyFg(StateType.Normal, new Gdk.Color(125, 18, 0));
            nm.ModifyFg(StateType.Normal, new Gdk.Color(18, 125, 0));
#else
            tp.ModifyFg(StateType.Normal, new Gdk.Color(255, 180, 0));
            nm.ModifyFg(StateType.Normal, new Gdk.Color(180, 255, 0));
#endif
            var datebox = new HBox(); datebox.SetSizeRequest(400, 25);
            var month   = new ComboBox(months);
            var day     = new ComboBox(SR(1, 31));
            var year    = new ComboBox(SR(MyDate.yearmin, MyDate.yearmax));
            var week    = new Label("---");
            tbox.ModifyBg(StateType.Normal, new Gdk.Color(0, 0, 0));
            tbox.Add(tp);
            tbox.Add(nm);
            tbox.Add(datebox);
            datebox.Add(week);
            datebox.Add(month);
            datebox.Add(day);
            datebox.Add(year);
            objlink[day]          = name;
            objlink[month]        = name;
            objlink[year]         = name;
            MainClass.Dates[name] = new MyDate(week, day, month, year);
            day.Changed          += OnDate;
            month.Changed        += OnDate;
            year.Changed         += OnDate;
            pg.Add(tbox);
        }
            public void UpdateBackgroundColor(Gdk.Color?backgroundColor)
            {
                if (_root == null)
                {
                    return;
                }

                if (backgroundColor.HasValue)
                {
                    ModifyBg(StateType.Normal, backgroundColor.Value);
                    _root.ModifyBg(StateType.Normal, backgroundColor.Value);
                }
                else
                {
                    ModifyBg(StateType.Normal, _defaultBackgroundColor);
                    _root.ModifyBg(StateType.Normal, _defaultBackgroundColor);
                }
            }
示例#4
0
        /// <summary>
        /// Initializes a new instance of the <see cref="MainWindow"/> class.
        /// </summary>
        /// <param name="title">Title.</param>
        public MainWindow(string title) : base(title)
        {
            //Placeholder widgets.
            var newsLabel = new Label("News label.");

            newsLabel.Show();

            newsTabel = new NewsMessageView();
            //newsTabel.Sensitive = false;
            newsTabel.Show();

            var weatherLabel = new Label("Weather label.");

            weatherLabel.Show();

            this.clockLabel = new ClockLabel();
            this.clockLabel.Show();

            var birthdayLabel = new Label("Birthdays label.");

            birthdayLabel.Show();

            var traficLabel = new Label("Trafic label.");

            traficLabel.Show();

            //widget grid initialisation.
            var mainHbox = new HBox();  //divides the window vertically into n parts. (for our application two parts).

            mainHbox.Add(newsTabel);
            mainHbox.Show();
            var rightSideVbox = new VBox();  //divides the right part horizontally into n rows.

            rightSideVbox.Show();
            mainHbox.Add(rightSideVbox);
            mainHbox.ModifyBg(StateType.Normal, new Gdk.Color(0, 0, 0));
            mainHbox.ModifyFg(StateType.Normal, new Gdk.Color(0, 0, 0));
            var weatherAndTimeHbox = new HBox();

            weatherAndTimeHbox.Add(weatherLabel);
            weatherAndTimeHbox.Add(this.clockLabel);
            weatherAndTimeHbox.Show();
            rightSideVbox.Add(weatherAndTimeHbox);
            rightSideVbox.Add(birthdayLabel);
            rightSideVbox.Add(traficLabel);

            //Add the grid to the window.
            this.Add(mainHbox);

            base.ModifyBg(StateType.Normal, new Gdk.Color(0, 0, 0));

            newsTabel.newsMessageListStore.AppendValues("Klaas", "12-11-2017", "Ik neem een maandje vrij.");
            newsTabel.newsMessageListStore.AppendValues("Henkie", "11-11-2017", "Ik ben het helemaal beu, ik stop.");
        }
示例#5
0
        HBox GetSnackBarLayout(Container?container, SnackBarOptions arguments)
        {
            var snackBarLayout = new HBox();

            snackBarLayout.ModifyBg(StateType.Normal, arguments.BackgroundColor.ToGtkColor());

            var message = new Gtk.Label(arguments.MessageOptions.Message);

            message.ModifyFont(new FontDescription {
                AbsoluteSize = arguments.MessageOptions.Font.FontSize, Family = arguments.MessageOptions.Font.FontFamily
            });
            message.ModifyFg(StateType.Normal, arguments.MessageOptions.Foreground.ToGtkColor());
            message.SetPadding((int)arguments.MessageOptions.Padding.Left, (int)arguments.MessageOptions.Padding.Top);
            snackBarLayout.Add(message);
            snackBarLayout.SetChildPacking(message, false, false, 0, PackType.Start);

            foreach (var action in arguments.Actions)
            {
                var button = new Gtk.Button
                {
                    Label = action.Text
                };
                button.ModifyFont(new FontDescription {
                    AbsoluteSize = action.Font.FontSize, Family = action.Font.FontFamily
                });
                button.ModifyBg(StateType.Normal, action.BackgroundColor.ToGtkColor());
                button.ModifyFg(StateType.Normal, action.ForegroundColor.ToGtkColor());

                button.Clicked += async(sender, e) =>
                {
                    snackBarTimer?.Stop();

                    if (action.Action != null)
                    {
                        await action.Action();
                    }

                    arguments.SetResult(true);
                    container?.Remove(snackBarLayout);
                };

                snackBarLayout.Add(button);
                snackBarLayout.SetChildPacking(button, false, false, 0, PackType.End);
            }

            return(snackBarLayout);
        }