public ComboBoxListViewDesktop(ComboBox cmbBox)
            : base(DesktopManager.ScreenWidth - 50, DesktopManager.ScreenHeight - 50)
        {
            _suspended = true;

            ComboBoxList _itemsList = new ComboBoxList(5, 5, _mWidth - 10, _mHeight - 40);
            foreach (object item in cmbBox.Items)
                _itemsList.AddItem(item);

            object initialSelectedItem = _itemsList.SelectedItem = cmbBox.SelectedItem;
            _itemsList.BringItemIntoView(cmbBox.SelectedIndex);
            _itemsList.SelectedItemChanged += (s) =>
                {
                    cmbBox.SelectedItem = _itemsList.SelectedItem;
                };

            base.AddChild(_itemsList);

            TextButton cancelBut = new TextButton("Cancel", _mWidth - 105, _mHeight - 30, 100, 25);
            cancelBut.ButtonPressed += (s) => { cmbBox.SelectedItem = initialSelectedItem; Close(); };
            base.AddChild(cancelBut);

            TextButton okBut = new TextButton("Ok", cancelBut.X - 105, _mHeight - 30, 100, 25);
            okBut.ButtonPressed += (s) => Close();
            base.AddChild(okBut);

            _suspended = false;
        }
        public GetTimeDialog()
            : base(string.Empty, string.Empty, MessageBoxButtons.OkCancel, MessageBoxIcons.Information, DesktopManager.ScreenWidth / 2, 170)
        {
            int txtWidth = (_mWidth - margin * 3) / 2;

            AddChild(new Label("Hour", margin, 55 + 15 - Fonts.ArialBold.Height / 2, txtWidth, 25) { CenterText = true, Font = Fonts.ArialBold });
            AddChild(new Label("Minute", margin * 2 + txtWidth, 55 + 15 - Fonts.Arial.Height / 2, txtWidth, 25) { CenterText = true, Font = Fonts.ArialBold });

            AddChild(cmbHour = new ComboBox(margin, 85, txtWidth, 30));
            AddChild(cmbMinute = new ComboBox(margin * 2 + txtWidth, 85, txtWidth, 30));

            for (int i = 0; i < 24; i++) cmbHour.AddItem(i);
            for (int i = 0; i < 60; i++) cmbMinute.AddItem(i);
        }
        public GetDateDialog()
            : base(string.Empty, string.Empty, MessageBoxButtons.OkCancel, MessageBoxIcons.Information, DesktopManager.ScreenWidth / 2, 170)
        {
            int availableWidth = _mWidth - margin * 4;

            const int dayRatio = 2;
            const int monthRatio = 3;
            const int yearRatio = 2;
            const int totalRatio = dayRatio + monthRatio + yearRatio;

            int dayWidth = availableWidth * dayRatio / totalRatio;
            int monthWidth = availableWidth * monthRatio / totalRatio;
            int yearWidth = availableWidth * yearRatio / totalRatio;

            AddChild(new Label("Day", margin, 55 + 15 - Fonts.ArialBold.Height / 2, dayWidth, 25) { CenterText = true, Font = Fonts.ArialBold });
            AddChild(new Label("Month", margin * 2 + dayWidth, 55 + 15 - Fonts.Arial.Height / 2, monthWidth, 25) { CenterText = true, Font = Fonts.ArialBold });
            AddChild(new Label("Year", margin * 3 + dayWidth + monthWidth, 55 + 15 - Fonts.Arial.Height / 2, yearWidth, 25) { CenterText = true, Font = Fonts.ArialBold });

            AddChild(cmbDay = new ComboBox(margin, 85, dayWidth, 30));
            AddChild(cmbMonth = new ComboBox(margin * 2 + dayWidth, 85, monthWidth, 30));
            AddChild(cmbYear = new ComboBox(margin * 3 + dayWidth + monthWidth, 85, yearWidth, 30));

            for (int i = 2009; i <= 2030; i++) cmbYear.AddItem(i);
            for (int i = 1; i <= 12; i++) cmbMonth.AddItem(_monthNames[i]);

            UiEventHandler remakeDaysEvent = (s) =>
            {
                int prevSelected = cmbDay.SelectedIndex;
                cmbDay.ClearItems();
                for (int i = 1; i <= DateTime.DaysInMonth((int)cmbYear.SelectedItem, (int)cmbMonth.SelectedIndex + 1); i++) cmbDay.AddItem(i);
                if (prevSelected != -1 && prevSelected < cmbDay.ItemsCount) cmbDay.SelectedIndex = prevSelected;
                else cmbDay.SelectedIndex = cmbDay.ItemsCount - 1;
            };

            cmbMonth.OnSelectedItemChanged += remakeDaysEvent;
            cmbYear.OnSelectedItemChanged += remakeDaysEvent;
        }