public TimePickerControl(ComboBox cmbHrs, ComboBox cmbMin, ComboBox cmbAmPm, Label label) { this.cmbHrs = cmbHrs; this.cmbMin = cmbMin; this.cmbAmPm = cmbAmPm; this.label = label; GtkHelper.PopulateComboBox(this.cmbHrs, Enumerable.Range(1, 12).Select(x => $"{x}").ToArray()); GtkHelper.PopulateComboBox(this.cmbMin, Enumerable.Range(0, 60).Select(x => x.ToString("D2")).ToArray()); GtkHelper.PopulateComboBox(this.cmbAmPm, "AM", "PM"); this.cmbHrs.Active = 10; this.cmbMin.Active = 5; this.cmbAmPm.Active = 0; this.cmbHrs.Changed += (_, _) => { if (!suppressEvent) { this.ValueChanged?.Invoke(this, EventArgs.Empty); } }; this.cmbMin.Changed += (_, _) => { if (!suppressEvent) { this.ValueChanged?.Invoke(this, EventArgs.Empty); } }; this.cmbAmPm.Changed += (_, _) => { if (!suppressEvent) { this.ValueChanged?.Invoke(this, EventArgs.Empty); } }; }
private NewDownloadWindow(Builder builder) : base(builder.GetRawOwnedObject("window")) { builder.Autoconnect(this); SetDefaultSize(500, 300); KeepAbove = true; Title = TextResource.GetText("ND_TITLE"); SetPosition(WindowPosition.CenterAlways); ImgFileIcon !.Pixbuf = GtkHelper.LoadSvg("file-download-line", 48); windowGroup = new WindowGroup(); windowGroup.AddWindow(this); dropdownItems = new ListStore(typeof(string)); //TxtUrl = (Entry)builder.GetObject("txtUrl"); //TxtFile = (Entry)builder.GetObject("txtFile"); //CmbLocation = (ComboBox)builder.GetObject("cmdFolder"); //lblFileSize = (Label)builder.GetObject("lblFileSize"); //lblIgnoreLabel = (LinkButton)builder.GetObject("lblIgnoreLabel"); //btnDownloadLater = (Button)builder.GetObject("btnDownloadLater"); //btnDownloadNow = (Button)builder.GetObject("btnDownloadNow"); //btnMore = (Button)builder.GetObject("btnMore"); //lblAddress = (Label)builder.GetObject("lblAddress"); //lblFile = (Label)builder.GetObject("lblFile"); //lblSaveIn = (Label)builder.GetObject("lblSaveIn"); lblAddress.Text = TextResource.GetText("ND_ADDRESS"); lblFile.Text = TextResource.GetText("ND_FILE"); lblSaveIn.Text = TextResource.GetText("LBL_SAVE_IN"); btnDownloadNow.Label = TextResource.GetText("ND_DOWNLOAD_NOW"); btnDownloadLater.Label = TextResource.GetText("ND_DOWNLOAD_LATER"); btnMore.Label = TextResource.GetText("ND_MORE"); lblIgnoreLabel.Label = TextResource.GetText("ND_IGNORE_URL"); CmbLocation.Changed += CmbLocation_Changed; this.Destroyed += Window_Closed; TxtUrl.Changed += TxtUrl_TextChanged; btnDownloadNow.Clicked += btnDownload_Click; btnDownloadLater.Clicked += btnDownloadLater_Click; btnMore.Clicked += btnAdvanced_Click; lblIgnoreLabel.Clicked += TextBlock_MouseDown; dropdownItems = GtkHelper.PopulateComboBox(CmbLocation); CmbLocation.Hexpand = true; //If there's available space, we use it //CellRendererText renderer = (CmbLocation.Cells[0] as CellRendererText); //Get the ComboBoxText only renderer //renderer.WrapWidth = 10; //Always show at least 20 chars //renderer.Ellipsize = Pango.EllipsizeMode.End; //CmbLocation.Model = dropdownItems; //var cmbRenderer = new CellRendererText(); //CmbLocation.PackStart(cmbRenderer, true); //CmbLocation.AddAttribute(cmbRenderer, "text", 0); PrepareMenu(); this.ShowAll(); GtkHelper.AttachSafeDispose(this); }
private SettingsDialog(Builder builder, Window parent, WindowGroup group) : base(builder.GetRawOwnedObject("dialog")) { builder.Autoconnect(this); Modal = true; SetDefaultSize(640, 480); SetPosition(WindowPosition.CenterAlways); TransientFor = parent; this.group = group; this.group.AddWindow(this); GtkHelper.AttachSafeDispose(this); LoadTexts(); Title = TextResource.GetText("TITLE_SETTINGS"); GtkHelper.PopulateComboBoxGeneric <int>(CmbMinVidSize, new int[] { 128, 256, 512, 1024, 2048, 4096, 8192, 16384, 32768 }); GtkHelper.PopulateComboBoxGeneric <int>(CmbMaxParallalDownloads, Enumerable.Range(1, 50).ToArray()); GtkHelper.PopulateComboBox(CmbDblClickAction, TextResource.GetText("CTX_OPEN_FOLDER"), TextResource.GetText("MSG_OPEN_FILE")); CreateCategoryListView(); GtkHelper.PopulateComboBoxGeneric <int>(CmbTimeOut, Enumerable.Range(1, 300).ToArray()); GtkHelper.PopulateComboBoxGeneric <int>(CmbMaxSegments, Enumerable.Range(1, 64).ToArray()); GtkHelper.PopulateComboBoxGeneric <int>(CmbMaxRetry, Enumerable.Range(1, 100).ToArray()); GtkHelper.PopulateComboBox(CmbProxyType, TextResource.GetText("NET_SYSTEM_PROXY"), TextResource.GetText("ND_NO_PROXY"), TextResource.GetText("ND_MANUAL_PROXY")); CreatePasswordManagerListView(); VideoWikiLink.Clicked += VideoWikiLink_Clicked; BtnChrome.Clicked += BtnChrome_Clicked; BtnFirefox.Clicked += BtnFirefox_Clicked; BtnEdge.Clicked += BtnEdge_Clicked; BtnOpera.Clicked += BtnOpera_Clicked; BtnCopy1.Clicked += BtnCopy1_Clicked; BtnCopy2.Clicked += BtnCopy2_Clicked; BtnDefault1.Clicked += BtnDefault1_Clicked; BtnDefault2.Clicked += BtnDefault2_Clicked; BtnDefault3.Clicked += BtnDefault3_Clicked; BtnCopy1.Image = new Image(GtkHelper.LoadSvg("file-copy-line")); BtnCopy2.Image = new Image(GtkHelper.LoadSvg("file-copy-line")); BtnOK.Clicked += BtnOK_Clicked; BtnCancel.Clicked += BtnCancel_Clicked; BtnTempFolderBrowse.Clicked += BtnTempFolderBrowse_Clicked; BtnDownloadFolderBrowse.Clicked += BtnDownloadFolderBrowse_Clicked; CatAdd.Clicked += CatAdd_Clicked; CatEdit.Clicked += CatEdit_Clicked; CatDel.Clicked += CatDel_Clicked; CatDef.Clicked += CatDef_Clicked; CmbProxyType.Changed += CmbProxyType_Changed; AddPass.Clicked += AddPass_Clicked; DelPass.Clicked += DelPass_Clicked; EditPass.Clicked += EditPass_Clicked; BtnBrowse.Clicked += BtnBrowse_Clicked; BtnUserAgentReset.Clicked += BtnUserAgentReset_Clicked; }