public RecentFileListWindow(string title, Gtk.Window parent, DialogFlags flags, params object[] button_data) : base(title, parent, flags, button_data) { _searchView = new Gtk.Entry (""); _searchView.SetSizeRequest (500, 40); _searchView.Changed += _searchView_Changed; _searchView.KeyReleaseEvent += HandleSearchViewKeyReleaseEvent; _searchView.KeyPressEvent += HandleKeyPressEvent; _searchView.FocusOutEvent += HandleFocusOutEvent; VBox.Add (_searchView); CreateTree (); VBox.Add (_treeView); _pathLabel = new Gtk.Label (); _pathLabel.SetSizeRequest (500, 40); VBox.Add (_pathLabel); MemberExtensionsHelper.Instance.IsDirty = true; UpdateDocuments (); this.SetSizeRequest (500, 700); CanFocus = true; _searchView.CanFocus = true; _searchView.IsEditable = true; _searchView.GrabFocus (); ShowAll (); }
public NotificationMessage (string t, string m) : base (false, 5) { this.Style = style; BorderWidth = 5; icon = new Image (Stock.DialogInfo, IconSize.Dialog); this.PackStart (icon, false, true, 5); VBox vbox = new VBox (false, 5); this.PackStart (vbox, true, true, 0); title = new Label (); title.SetAlignment (0.0f, 0.5f); this.Title = t; vbox.PackStart (title, false, true, 0); message = new Label (); message.LineWrap = true; message.SetSizeRequest (500, -1); // ugh, no way to sanely reflow a gtk label message.SetAlignment (0.0f, 0.0f); this.Message = m; vbox.PackStart (message, true, true, 0); action_box = new HBox (false, 3); Button hide_button = new Button (Catalog.GetString ("Hide")); hide_button.Clicked += OnHideClicked; action_box.PackEnd (hide_button, false, true, 0); Alignment action_align = new Alignment (1.0f, 0.5f, 0.0f, 0.0f); action_align.Add (action_box); vbox.PackStart (action_align, false, true, 0); }
public RecentFileListWindow(string title, Gtk.Window parent, DialogFlags flags, params object[] button_data) : base(title, parent, flags, button_data) { _searchView = new Gtk.Entry(""); _searchView.SetSizeRequest(500, 40); _searchView.Changed += _searchView_Changed; _searchView.KeyReleaseEvent += HandleSearchViewKeyReleaseEvent; _searchView.KeyPressEvent += HandleKeyPressEvent; _searchView.FocusOutEvent += HandleFocusOutEvent; VBox.Add(_searchView); CreateTree(); _scrolledWindow = new Gtk.ScrolledWindow(); _scrolledWindow.SetSizeRequest(500, 600); _scrolledWindow.Add(_treeView); VBox.Add(_scrolledWindow); _pathLabel = new Gtk.Label(); _pathLabel.SetSizeRequest(500, 40); VBox.Add(_pathLabel); MemberExtensionsHelper.Instance.IsDirty = true; UpdateDocuments(); VBox.SetSizeRequest(500, 700); this.SetSizeRequest(500, 700); CanFocus = true; _searchView.CanFocus = true; _searchView.IsEditable = true; _searchView.GrabFocus(); ShowAll(); }
/** * Add in all needed components to our welcome window * */ private void buildWindow() { //prevent resize on home screen this.Resizable = false; //create label and import button - put label in event box to allow setting of background EventBox labelContainer = new EventBox (); Label welcomeLabel = new Label (Constants.Constants.homeWindowWelcomeText); //set the style of the label Style labelStyle = welcomeLabel.Style.Copy(); labelStyle.FontDescription.Family = Constants.Constants.welcomeWindowFontFamily; labelStyle.FontDescription.Size = Constants.Constants.WELCOME_MESSAGE_FONT_SIZE; welcomeLabel.Style = labelStyle.Copy(); labelContainer.Add (welcomeLabel); labelContainer.WidthRequest = 100; importDataButton = new Button (Constants.Constants.homeWindowImportButtonText); importDataButton.Clicked += new EventHandler(OpenFileTree); //set the style of the button Style buttonStyle = importDataButton.Style.Copy (); buttonStyle.FontDescription.Family = Constants.Constants.welcomeWindowFontFamily; buttonStyle.FontDescription.Size = Constants.Constants.WELCOME_BUTTON_FONT_SIZE; importDataButton.Style = buttonStyle.Copy(); welcomeLabel.SetSizeRequest (100, 100); importDataButton.SetSizeRequest (100, 100); //create container for import button HBox masterContainer = new HBox (); VBox homeWindowContainer = new VBox (false, 100); homeWindowContainer.PackStart (labelContainer, false, false, 50); homeWindowContainer.PackStart (importDataButton, false, false, 50); masterContainer.PackStart (homeWindowContainer, true, true, 100); //set size of containers masterContainer.SetSizeRequest (1000, 1000); this.SetSizeRequest (1000, 500); this.Add (masterContainer); }
public void add_toolbar(string name, Toolbar toolbar) { Gtk.Label label = new Label(name); label.SetSizeRequest((int)Sugar.Style.TOOLBOX_TAB_LABEL_WIDTH, -1); label.SetAlignment(0.0f, 0.5f); Gtk.HBox toolbar_box = new HBox(); toolbar_box.PackStart(toolbar,true, true, Sugar.Style.TOOLBOX_HORIZONTAL_PADDING); toolbar_box.ExposeEvent += _toolbar_box_expose_cb; _notebook.AppendPage(toolbar_box, label); toolbar_box.Show(); if (_notebook.NPages>1) { _notebook.ShowTabs=true; // _separator.Show(); } }
public LevelRangeWidget(string label, int low, int high) { IConfigSource config = new DotNetConfigSource(DotNetConfigSource.GetFullConfigPath()); int entrySize = config.Configs["defaults"].GetInt("entrySize"); int entryWidth = config.Configs["defaults"].GetInt("entryWidth"); Low = new Entry(entrySize); Low.SetSizeRequest(entryWidth, Low.SizeRequest().Height); Low.WidthChars = entrySize; Low.IsEditable = false; Low.CanFocus = false; Label = new Label(label); Label.Justify = Justification.Center; Label.SetSizeRequest(150, Label.SizeRequest().Height); High = new Entry(entrySize); High.SetSizeRequest(entryWidth, High.SizeRequest().Height); High.WidthChars = entrySize; High.IsEditable = false; High.CanFocus = false; }
public NotificationMessage(string t, string m) : base(false, 5) { this.Style = style; BorderWidth = 5; icon = new Image(Stock.DialogInfo, IconSize.Dialog); this.PackStart(icon, false, true, 5); VBox vbox = new VBox(false, 5); this.PackStart(vbox, true, true, 0); title = new Label(); title.SetAlignment(0.0f, 0.5f); this.Title = t; vbox.PackStart(title, false, true, 0); message = new Label(); message.LineWrap = true; message.SetSizeRequest(500, -1); // ugh, no way to sanely reflow a gtk label message.SetAlignment(0.0f, 0.0f); this.Message = m; vbox.PackStart(message, true, true, 0); action_box = new HBox(false, 3); Button hide_button = new Button(Catalog.GetString("Hide")); hide_button.Clicked += OnHideClicked; action_box.PackEnd(hide_button, false, true, 0); Alignment action_align = new Alignment(1.0f, 0.5f, 0.0f, 0.0f); action_align.Add(action_box); vbox.PackStart(action_align, false, true, 0); }
private Widget CreateWidgets() { table = new Table(1, 2, false); table.ColumnSpacing = 12; table.BorderWidth = 4; image = new Image(normalPixbuf); table.Attach(image, 0, 1, 0, 1, AttachOptions.Shrink, 0, 0, 0); VBox vbox = new VBox(false, 0); table.Attach(vbox, 1, 2, 0, 1, AttachOptions.Expand | AttachOptions.Fill, 0, 0, 0); widthForLabels = (int)maxWidth - (int)normalPixbuf.Width - (int)table.ColumnSpacing - (int)(table.BorderWidth * 2); nameLabel = new Label("<span size=\"large\"></span>"); vbox.PackStart(nameLabel, false, false, 0); nameLabel.UseMarkup = true; nameLabel.UseUnderline = false; nameLabel.Xalign = 0; Requisition req = nameLabel.SizeRequest(); nameLabel.SetSizeRequest(widthForLabels, -1); Util.GtkLabelSetMaxWidthChars(nameLabel, widthForLabels); Util.GtkLabelSetEllipsize(nameLabel, true); locationLabel = new Label("<span size=\"small\"></span>"); vbox.PackStart(locationLabel, false, false, 0); locationLabel.UseMarkup = true; locationLabel.UseUnderline = false; locationLabel.ModifyFg(StateType.Normal, this.Style.Base(StateType.Active)); locationLabel.Xalign = 0; req = locationLabel.SizeRequest(); locationLabel.SetSizeRequest(widthForLabels, req.Height); Util.GtkLabelSetMaxWidthChars(locationLabel, widthForLabels); Util.GtkLabelSetEllipsize(locationLabel, true); statusLabel = new Label("<span size=\"small\"></span>"); vbox.PackStart(statusLabel, false, false, 0); statusLabel.UseMarkup = true; statusLabel.UseUnderline = false; statusLabel.ModifyFg(StateType.Normal, this.Style.Base(StateType.Active)); statusLabel.Xalign = 0; req = statusLabel.SizeRequest(); statusLabel.SetSizeRequest(widthForLabels, req.Height); Util.GtkLabelSetMaxWidthChars(statusLabel, widthForLabels); Util.GtkLabelSetEllipsize(statusLabel, true); return table; }
// TODO: Possible to make Tomboy not crash if quit while dialog is up? public SyncDialog() : base(string.Empty, null, Gtk.DialogFlags.DestroyWithParent) { progressBarTimeoutId = 0; SetSizeRequest(400, -1); HasSeparator = false; // Outer box. Surrounds all of our content. VBox outerVBox = new VBox(false, 12); outerVBox.BorderWidth = 6; outerVBox.Show(); VBox.PackStart(outerVBox, true, true, 0); // Top image and label HBox hbox = new HBox(false, 12); hbox.Show(); outerVBox.PackStart(hbox, false, false, 0); image = new Image(GuiUtils.GetIcon("tomboy", 48)); image.Xalign = 0; image.Yalign = 0; image.Show(); hbox.PackStart(image, false, false, 0); // Label header and message VBox vbox = new VBox(false, 6); vbox.Show(); hbox.PackStart(vbox, true, true, 0); headerLabel = new Label(); headerLabel.UseMarkup = true; headerLabel.Xalign = 0; headerLabel.UseUnderline = false; headerLabel.LineWrap = true; headerLabel.Show(); vbox.PackStart(headerLabel, false, false, 0); messageLabel = new Label(); messageLabel.Xalign = 0; messageLabel.UseUnderline = false; messageLabel.LineWrap = true; messageLabel.SetSizeRequest(250, -1); messageLabel.Show(); vbox.PackStart(messageLabel, false, false, 0); progressBar = new Gtk.ProgressBar(); progressBar.Orientation = Gtk.ProgressBarOrientation.LeftToRight; progressBar.BarStyle = ProgressBarStyle.Continuous; progressBar.ActivityBlocks = 30; progressBar.Show(); outerVBox.PackStart(progressBar, false, false, 0); progressLabel = new Label(); progressLabel.UseMarkup = true; progressLabel.Xalign = 0; progressLabel.UseUnderline = false; progressLabel.LineWrap = true; progressLabel.Wrap = true; progressLabel.Show(); outerVBox.PackStart(progressLabel, false, false, 0); // Expander containing TreeView expander = new Gtk.Expander(Catalog.GetString("Details")); expander.Spacing = 6; expander.Activated += OnExpanderActivated; expander.Show(); outerVBox.PackStart(expander, true, true, 0); // Contents of expander Gtk.VBox expandVBox = new Gtk.VBox(); expandVBox.Show(); expander.Add(expandVBox); // Scrolled window around TreeView Gtk.ScrolledWindow scrolledWindow = new Gtk.ScrolledWindow(); scrolledWindow.ShadowType = Gtk.ShadowType.In; scrolledWindow.SetSizeRequest(-1, 200); scrolledWindow.Show(); expandVBox.PackStart(scrolledWindow, true, true, 0); // Create model for TreeView model = new Gtk.TreeStore(typeof(string), typeof(string)); // Create TreeView, attach model Gtk.TreeView treeView = new Gtk.TreeView(); treeView.Model = model; treeView.RowActivated += OnRowActivated; treeView.Show(); scrolledWindow.Add(treeView); // Set up TreeViewColumns Gtk.TreeViewColumn column = new Gtk.TreeViewColumn( Catalog.GetString("Note Title"), new Gtk.CellRendererText(), "text", 0); column.SortColumnId = 0; column.Resizable = true; treeView.AppendColumn(column); column = new Gtk.TreeViewColumn( Catalog.GetString("Status"), new Gtk.CellRendererText(), "text", 1); column.SortColumnId = 1; column.Resizable = true; treeView.AppendColumn(column); // Button to close dialog. closeButton = (Gtk.Button)AddButton(Gtk.Stock.Close, Gtk.ResponseType.Close); closeButton.Sensitive = false; }
/// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> private void Build() { System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(LoginWindow)); this.panel5 = new Fixed(); //this.groupBox1 = new Gtk.Box(); this.checkBox2 = new Gtk.CheckButton(); this.checkBox1 = new Gtk.CheckButton(); this.nickname_label = new Gtk.Label(); this.nickname_ent = new Gtk.Entry(); this.username_label = new Gtk.Label(); this.username_ent = new Gtk.Entry(); this.password_label = new Gtk.Label(); this.password_ent = new Gtk.Entry(); this.button1 = new Gtk.Button(); this.LoginButton = new Gtk.Button(); this.port = new Gtk.Entry(); this.port_label = new Gtk.Label(); this.server = new Gtk.Entry(); this.server_label = new Gtk.Label(); // Standard strings string nickName = "Guest"; string accountName = "guest"; string password = "******"; bool rcmode = true; if (this.settings != null) { accountName = this.settings.Account; password = this.settings.Password; if (!this.settings2.Loaded) nickName = this.settings.Nickname; else nickName = this.settings2.Nickname; rcmode = this.settings.RCMode; } else { //return null; } // // checkBox2 // this.checkBox2.Active = true; this.checkBox2.Name = "checkBox2"; this.checkBox2.Label = "RC Mode?"; this.checkBox2.Xalign = 0; this.checkBox2.Active = rcmode; // // checkBox1 // this.checkBox1.Active = false; this.checkBox1.Name = "checkBox1"; this.checkBox1.Label = "Don\'t save password"; this.checkBox1.Xalign = 0; // // nickname_label // this.nickname_label.Name = "nickname_label"; this.nickname_label.Xalign = 0; this.nickname_label.SetSizeRequest(73, 23); this.nickname_label.Text = "Nickname:"; // // nickname // this.nickname_ent.Name = "nickname"; this.nickname_ent.Text = nickName; // // username_label // this.username_label.Name = "username_label"; this.username_label.Xalign = 0; this.username_label.SetSizeRequest(73, 23); this.username_label.Text = "Account:"; // // username // this.username_ent.Name = "username"; this.username_ent.Text = accountName; //this.username.Changed += new System.EventHandler(this.username_TextChanged); // // password_label // this.password_label.Name = "password_label"; this.password_label.Xalign = 0; this.password_label.SetSizeRequest(73, 23); this.password_label.Text = "Password:"******"password"; //this.password_ent.SetSizeRequest(82, 23); this.password_ent.Text = password; this.password_ent.Visibility = false; // // button1 // this.button1.SetSizeRequest(80, 25); this.button1.Label = "Cancel"; this.button1.Clicked += new System.EventHandler(this.Close); // // LoginButton // this.LoginButton.Name = "LoginButton"; this.LoginButton.SetSizeRequest(80, 25); this.LoginButton.Label = "OK"; this.LoginButton.Clicked += new System.EventHandler(this.LoginButton_Click); // // LoginWindow // Table table = new Table(2, 1, false); Table table2 = new Table(7, 2, false); table2.RowSpacing = 1; Label spacer = new Label(); spacer.SetSizeRequest(10, 1); table2.Attach(spacer, 0, 1, 0, 1, AttachOptions.Fill, AttachOptions.Fill, 5, 1); table2.Attach(this.nickname_label, 0, 1, 1, 2, AttachOptions.Fill, AttachOptions.Fill, 5, 1); table2.Attach(this.nickname_ent, 1, 2, 1, 2, AttachOptions.Fill | AttachOptions.Expand, AttachOptions.Fill, 5, 1); table2.Attach(this.username_label, 0, 1, 2, 3, AttachOptions.Fill, AttachOptions.Fill, 5, 1); table2.Attach(this.username_ent, 1, 2, 2, 3, AttachOptions.Fill | AttachOptions.Expand, AttachOptions.Fill, 5, 1); table2.Attach(this.password_label, 0, 1, 3, 4, AttachOptions.Fill, AttachOptions.Fill, 5, 1); table2.Attach(this.password_ent, 1, 2, 3, 4, AttachOptions.Fill | AttachOptions.Expand, AttachOptions.Fill, 5, 1); table2.Attach(this.checkBox1, 0, 2, 4, 5, AttachOptions.Fill, AttachOptions.Fill, 5, 1); table2.Attach(this.checkBox2, 0, 2, 5, 6, AttachOptions.Fill, AttachOptions.Fill, 5, 1); HBox hbox = new HBox(true, 5); table.BorderWidth = 0; table.SetSizeRequest(100, 100); Frame frame = new Frame(); frame.Label = " Options "; frame.Add(table2); table.Attach(frame, 0, 1, 0, 1, AttachOptions.Fill | AttachOptions.Expand, AttachOptions.Fill | AttachOptions.Expand, 5, 5); hbox.Add(this.LoginButton); hbox.Add(this.button1); Alignment halign = new Alignment(1, 0, 0, 0); halign.Add(hbox); table.Attach(halign, 0, 1, 1, 2, AttachOptions.Fill, AttachOptions.Fill, 5, 5); this.Add(table); this.SetSizeRequest(280, 220); this.DoubleBuffered = true; this.Name = "LoginWindow"; this.SetPosition(Gtk.WindowPosition.Center); this.Title = "Graal Server Remote Control"; this.Icon = global::Gdk.Pixbuf.LoadFromResource("OpenGraal.GraalIM.Resources.rcicon.ico"); this.DeleteEvent += LoginWindow_Closed; }
/// <summary> /// See SwitchContentView. /// This is an awkward solution and should be refactored. /// The only other way I can think if is creating two different /// EventHandlers, and they call with different parameters which /// Label and TextView to switch (Content or Title). /// </summary> /// <param name='edit'> /// If true, paint a TextView that can be edited. /// If false, paint a Label that displays memo. /// </param> public void SwitchTitleView(bool edit) { if (edit) { // Removing the label _titleLabelListener.Destroy(); // Setting up the textview _titleTextView = new TextView (); _titleTextView.FocusInEvent += new FocusInEventHandler(MemoTextViewGotFocus); _titleTextView.FocusOutEvent += new FocusOutEventHandler(MemoTitleTextViewLostFocus); TextBuffer contentBuffer = _titleTextView.Buffer; contentBuffer.Text = this._item.GetTitle(); _titleTextView.SetSizeRequest (200, 140); _titleTextView.Justification = Justification.Fill; _titleTextView.WrapMode = WrapMode.Word; _titleAlignment.Add (_titleTextView); _titleTextView.GrabFocus(); } else { // Saving information from textview and removing it this._item.SetTitle(_titleTextView.Buffer.Text); Console.WriteLine ("Setting memo title to " + _titleTextView.Buffer.Text); _titleTextView.Destroy(); // Creating label _titleLabel = new Label(); _titleLabel.Text = this._item.GetTitle (); _titleLabel.SetSizeRequest (200, 80); _titleLabel.SetAlignment (0, 0); _titleLabel.LineWrap = true; _titleLabel.Justify = Justification.Fill; // Label listener _titleLabelListener = new EventBox (); _titleLabelListener.ButtonPressEvent += new ButtonPressEventHandler (MemoTitlePressHandler); _titleLabelListener.Add (_titleLabel); _titleLabelListener.SetSizeRequest(200, 80); _titleAlignment.Add (_titleLabelListener); } this._container.ShowAll(); }
public static void FetchForm(Container Parent, XmlNode Nodes) { int cIndex = 0; string[] UFont; XmlNodeList original = Nodes.ChildNodes; XmlNodeList reverse = new ReverseXmlList(original); foreach (XmlNode C in reverse) { if (C.Name == "Object") { cIndex++; if (C.Attributes[0].Name == "type") { if (C.Attributes["type"].Value.StartsWith("System.Windows.Forms.PictureBox") || C.Attributes["type"].Value.StartsWith("System.Windows.Forms.Button")) { var PB = new Gtk.Button(); global::Gtk.Fixed.FixedChild PBC1 = ((global::Gtk.Fixed.FixedChild)(Parent[PB])); Parent.Add(PB); foreach (XmlNode V in C.ChildNodes) { if (V.Name == "Property") { switch (V.Attributes["name"].Value) { case "BorderStyle": if (V.InnerText == "Solid") { //PB.ModifierStyle = } break; case "Name": PB.Name = V.InnerText; break; case "ForeColor": var FColor = V.InnerText.GetXColor().ToNative(); PB.Children[0].ModifyFg(StateType.Normal, FColor); PB.Children[0].ModifyFg(StateType.Active, FColor); PB.Children[0].ModifyFg(StateType.Prelight, FColor); PB.Children[0].ModifyFg(StateType.Selected, FColor); break; case "Caption": case "Text": PB.Label = global::Mono.Unix.Catalog.GetString(System.Environment.ExpandEnvironmentVariables(V.InnerText).Replace("%DATE%", System.DateTime.Now.ToString("dd.MM.yyyy")).Replace("%TIME%", System.DateTime.Now.ToString("hh:mm:ss"))); break; case "BackColor": var BColor = V.InnerText.GetXColor().ToNative(); PB.ModifyBg(StateType.Normal, BColor); PB.ModifyBg(StateType.Active, BColor); PB.ModifyBg(StateType.Insensitive, BColor); PB.ModifyBg(StateType.Prelight, BColor); PB.ModifyBg(StateType.Selected, BColor); break; case "SizeMode": //PB.SizeMode = Enum.Parse(typeof(PictureBoxSizeMode), V.InnerText); break; case "Location": PBC1.X = (int)(Convert.ToInt32(V.InnerText.Substring(0, V.InnerText.IndexOf(","))) * App.ScaleFactorX); PBC1.Y = (int)(Convert.ToInt32(V.InnerText.Substring(V.InnerText.IndexOf(",") + 1)) * App.ScaleFactorY); break; case "Size": PB.SetSizeRequest((int)(Convert.ToInt32(V.InnerText.Substring(0, V.InnerText.IndexOf(","))) * App.ScaleFactorX), (int)(Convert.ToInt32(V.InnerText.Substring(V.InnerText.IndexOf(",") + 1)) * App.ScaleFactorY)); break; case "Font": string VC = V.InnerText; UFont = VC.Replace("style=", "").Split(new[] { "," }, StringSplitOptions.RemoveEmptyEntries); string VCFName = UFont[0]; float VCSize = float.Parse(UFont[1].Replace("pt", "")); float Z = (float)(VCSize * App.ScaleFactorY); PB.Children[0].ModifyFont(Pango.FontDescription.FromString(VCFName + " " + ((int)Z).ToString())); break; case "Image": if (V.HasChildNodes) { string IMGData = V.FirstChild.InnerText; byte[] B = System.Convert.FromBase64String(IMGData); Pixbuf P = new Pixbuf(B); P = P.ScaleSimple(PB.WidthRequest - 10, PB.HeightRequest, InterpType.Bilinear); PB.Image = new Gtk.Image(P); } break; } } else if (V.Name == "Object") { //FetchForm(PB, V.ParentNode); } } } else if (C.Attributes["type"].Value.StartsWith("System.Windows.Forms.Label")) { var CE = new Gtk.EventBox(); CE.ResizeMode = ResizeMode.Parent; var CC = new Gtk.Label(); CE.Add(CC); Parent.Add(CE); CC.LineWrapMode = Pango.WrapMode.Word; CC.LineWrap = true; CC.Wrap = true; CC.Justify = Justification.Fill; global::Gtk.Fixed.FixedChild PBC1; if ((Parent[CE]).GetType().ToString() == "Gtk.Container+ContainerChild") { var XVC = Parent[CE].Parent.Parent; PBC1 = (global::Gtk.Fixed.FixedChild)(Parent[XVC]); } else { PBC1 = ((global::Gtk.Fixed.FixedChild)(Parent[CE])); } foreach (XmlNode V in C.ChildNodes) { if (V.Name == "Property") { switch (V.Attributes["name"].Value) { case "BorderStyle": if (V.InnerText == "Solid") { //PB.ModifierStyle = } break; case "Name": CC.Name = V.InnerText; break; case "Font": string VC = V.InnerText; UFont = VC.Replace("style=", "").Split(new[] { "," }, StringSplitOptions.RemoveEmptyEntries); string VCFName = UFont[0]; float VCSize = float.Parse(UFont[1].Replace("pt", "")); float Z = (float)(VCSize * App.ScaleFactorY); CC.ModifyFont(Pango.FontDescription.FromString(VCFName + " " + (int)Z)); break; case "ForeColor": var FColor = V.InnerText.GetXColor().ToNative(); CC.ModifyFg(StateType.Normal, FColor); CC.ModifyFg(StateType.Active, FColor); CC.ModifyFg(StateType.Insensitive, FColor); CC.ModifyFg(StateType.Prelight, FColor); CC.ModifyFg(StateType.Selected, FColor); CE.ModifyFg(StateType.Normal, FColor); CE.ModifyFg(StateType.Active, FColor); CE.ModifyFg(StateType.Insensitive, FColor); CE.ModifyFg(StateType.Prelight, FColor); CE.ModifyFg(StateType.Selected, FColor); CC.Markup = "<span foreground=\"" + V.InnerText + "\">" + CC.Text + "</span>"; break; case "Caption": case "Text": CC.Text = global::Mono.Unix.Catalog.GetString(System.Environment.ExpandEnvironmentVariables(V.InnerText).Replace("%DATE%", System.DateTime.Now.ToString("dd.MM.yyyy")).Replace("%TIME%", System.DateTime.Now.ToString("hh:mm:ss")).Replace("##", "\r\n")); break; case "BackColor": if (V.InnerText != "Transparent") { var BColor = V.InnerText.GetXColor().ToNative(); CE.ModifyBg(StateType.Normal, BColor); CE.ModifyBg(StateType.Active, BColor); CE.ModifyBg(StateType.Insensitive, BColor); CE.ModifyBg(StateType.Prelight, BColor); CE.ModifyBg(StateType.Selected, BColor); } else { CE.Visible = false; CE.VisibleWindow = false; } break; case "SizeMode": //PB.SizeMode = Enum.Parse(typeof(PictureBoxSizeMode), V.InnerText); break; case "Location": PBC1.X = (int)(Convert.ToInt32(V.InnerText.Substring(0, V.InnerText.IndexOf(","))) * App.ScaleFactorX); PBC1.Y = (int)(Convert.ToInt32(V.InnerText.Substring(V.InnerText.IndexOf(",") + 1)) * App.ScaleFactorY); break; case "TextAlign": CC.Justify = (V.InnerText == "MiddleCenter" || V.InnerText == "TopCenter" || V.InnerText == "BottomCenter" ? Justification.Center : (V.InnerText == "MiddleRight" || V.InnerText == "TopRight" || V.InnerText == "BottomRight" ? Justification.Right : Justification.Left)); break; case "Size": CE.SetSizeRequest((int)(Convert.ToInt32(V.InnerText.Substring(0, V.InnerText.IndexOf(","))) * App.ScaleFactorX), (int)(Convert.ToInt32(V.InnerText.Substring(V.InnerText.IndexOf(",") + 1)) * App.ScaleFactorY)); CC.SetSizeRequest((int)(Convert.ToInt32(V.InnerText.Substring(0, V.InnerText.IndexOf(","))) * App.ScaleFactorX), (int)(Convert.ToInt32(V.InnerText.Substring(V.InnerText.IndexOf(",") + 1)) * App.ScaleFactorY)); break; } } else if (V.Name == "Object") { var TZJE = new Fixed(); } } } else if (C.Attributes ["type"].Value.StartsWith("System.Windows.Forms.TextBox")) { if (C.InnerXml.IndexOf("\"Multiline\">True") > -1) { var CC = new Gtk.Entry(); global::Gtk.Fixed.FixedChild PBC1 = ((global::Gtk.Fixed.FixedChild)(Parent [CC])); Parent.Add(CC); foreach (XmlNode V in C.ChildNodes) { { if (V.Name == "Property") { switch (V.Attributes ["name"].Value) { case "Text": { if (V.InnerText.Contains("%")) { CC.Text = System.Environment.ExpandEnvironmentVariables(V.InnerText); CC.Position = CC.Text.Length; } break; } case "Location": PBC1.X = (int)(Convert.ToInt32(V.InnerText.Substring(0, V.InnerText.IndexOf(","))) * App.ScaleFactorX); PBC1.Y = (int)(Convert.ToInt32(V.InnerText.Substring(V.InnerText.IndexOf(",") + 1)) * App.ScaleFactorY); break; case "Size": CC.SetSizeRequest((int)(Convert.ToInt32(V.InnerText.Substring(0, V.InnerText.IndexOf(","))) * App.ScaleFactorX), (int)(Convert.ToInt32(V.InnerText.Substring(V.InnerText.IndexOf(",") + 1)) * App.ScaleFactorY)); break; case "Name": CC.Name = V.InnerText; break; case "Font": string VC = V.InnerText; UFont = VC.Replace("style=", "").Split(new[] { "," }, StringSplitOptions.RemoveEmptyEntries); string VCFName = UFont[0]; float VCSize = float.Parse(UFont[1].Replace("pt", "")); float Z = (float)(VCSize * App.ScaleFactorY); CC.ModifyFont(Pango.FontDescription.FromString(VCFName + " " + ((int)Z).ToString())); System.Diagnostics.Debug.WriteLine(VCFName + " " + ((int)Z).ToString()); break; } } } } } else { var CC = new Gtk.Entry(); global::Gtk.Fixed.FixedChild PBC1 = ((global::Gtk.Fixed.FixedChild)(Parent [CC])); Parent.Add(CC); foreach (XmlNode V in C.ChildNodes) { { if (V.Name == "Property") { switch (V.Attributes ["name"].Value) { case "Name": CC.Name = V.InnerText; break; case "Text": { if (V.InnerText.Contains("%")) { CC.Text = System.Environment.ExpandEnvironmentVariables(V.InnerText); CC.Position = CC.Text.Length; } break; } case "Location": PBC1.X = (int)(Convert.ToInt32(V.InnerText.Substring(0, V.InnerText.IndexOf(","))) * App.ScaleFactorX); PBC1.Y = (int)(Convert.ToInt32(V.InnerText.Substring(V.InnerText.IndexOf(",") + 1)) * App.ScaleFactorY); break; case "Size": CC.SetSizeRequest((int)(Convert.ToInt32(V.InnerText.Substring(0, V.InnerText.IndexOf(","))) * App.ScaleFactorX), (int)(Convert.ToInt32(V.InnerText.Substring(V.InnerText.IndexOf(",") + 1)) * App.ScaleFactorY)); break; case "PasswordChar": CC.InvisibleChar = '*'; CC.Visibility = false; break; case "Font": string VC = V.InnerText; UFont = VC.Replace("style=", "").Split(new[] { "," }, StringSplitOptions.RemoveEmptyEntries); string VCFName = UFont[0]; float VCSize = float.Parse(UFont[1].Replace("pt", "")); float Z = (float)(VCSize * App.ScaleFactorY); CC.ModifyFont(Pango.FontDescription.FromString(VCFName + " " + ((int)Z).ToString())); System.Diagnostics.Debug.WriteLine(VCFName + " " + ((int)Z).ToString()); break; } } } } } } else if (C.Attributes ["type"].Value.StartsWith("System.Windows.Forms.Panel")) { var CP = new Gtk.Fixed(); //CP.Clicked += HandleClick; global::Gtk.Fixed.FixedChild PBC1 = ((global::Gtk.Fixed.FixedChild)(Parent [CP])); Parent.Add(CP); foreach (XmlNode V in C.ChildNodes) { if (V.Name == "Property") { switch (V.Attributes ["name"].Value) { case "Name": CP.Name = V.InnerText; break; case "BorderStyle": if (V.InnerText == "Solid") { //PB.ModifierStyle = } break; case "ForeColor": CP.Children [0].ModifyFg(StateType.Normal, V.InnerText.GetXColor().ToNative()); break; case "BackColor": CP.ModifyBg(StateType.Normal, V.InnerText.GetXColor().ToNative()); break; case "SizeMode": //PB.SizeMode = Enum.Parse(typeof(PictureBoxSizeMode), V.InnerText); break; case "Location": PBC1.X = (int)(Convert.ToInt32(V.InnerText.Substring(0, V.InnerText.IndexOf(","))) * App.ScaleFactorX); PBC1.Y = (int)(Convert.ToInt32(V.InnerText.Substring(V.InnerText.IndexOf(",") + 1)) * App.ScaleFactorY); break; case "Size": CP.SetSizeRequest((int)(Convert.ToInt32(V.InnerText.Substring(0, V.InnerText.IndexOf(","))) * App.ScaleFactorX), (int)(Convert.ToInt32(V.InnerText.Substring(V.InnerText.IndexOf(",") + 1)) * App.ScaleFactorY)); break; } } else if (V.Name == "Object") { //FetchForm(PB, V.ParentNode); } } } else { System.Diagnostics.Debug.WriteLine(C.Attributes ["type"].Value); } } } } Parent.ShowAll(); }
public DemoUIManager () : base ("UI Manager") { ActionEntry[] entries = new ActionEntry[] { new ActionEntry ("FileMenu", null, "_File", null, null, null), new ActionEntry ("PreferencesMenu", null, "_Preferences", null, null, null), new ActionEntry ("ColorMenu", null, "_Color", null, null, null), new ActionEntry ("ShapeMenu", null, "_Shape", null, null, null), new ActionEntry ("HelpMenu", null, "_Help", null, null, null), new ActionEntry ("New", Stock.New, "_New", "<control>N", "Create a new file", new EventHandler (ActionActivated)), new ActionEntry ("Open", Stock.Open, "_Open", "<control>O", "Open a file", new EventHandler (ActionActivated)), new ActionEntry ("Save", Stock.Save, "_Save", "<control>S", "Save current file", new EventHandler (ActionActivated)), new ActionEntry ("SaveAs", Stock.SaveAs, "Save _As", null, "Save to a file", new EventHandler (ActionActivated)), new ActionEntry ("Quit", Stock.Quit, "_Quit", "<control>Q", "Quit", new EventHandler (ActionActivated)), new ActionEntry ("About", null, "_About", "<control>A", "About", new EventHandler (ActionActivated)), new ActionEntry ("Logo", "demo-gtk-logo", null, null, "Gtk#", new EventHandler (ActionActivated)) }; ToggleActionEntry[] toggleEntries = new ToggleActionEntry[] { new ToggleActionEntry ("Bold", Stock.Bold, "_Bold", "<control>B", "Bold", new EventHandler (ActionActivated), true) }; RadioActionEntry[] colorEntries = new RadioActionEntry[] { new RadioActionEntry ("Red", null, "_Red", "<control>R", "Blood", (int)Color.Red), new RadioActionEntry ("Green", null, "_Green", "<control>G", "Grass", (int)Color.Green), new RadioActionEntry ("Blue", null, "_Blue", "<control>B", "Sky", (int)Color.Blue) }; RadioActionEntry[] shapeEntries = new RadioActionEntry[] { new RadioActionEntry ("Square", null, "_Square", "<control>S", "Square", (int)Shape.Square), new RadioActionEntry ("Rectangle", null, "_Rectangle", "<control>R", "Rectangle", (int)Shape.Rectangle), new RadioActionEntry ("Oval", null, "_Oval", "<control>O", "Egg", (int)Shape.Oval) }; ActionGroup actions = new ActionGroup ("group"); actions.Add (entries); actions.Add (toggleEntries); actions.Add (colorEntries, (int)Color.Red, new ChangedHandler (RadioActionActivated)); actions.Add (shapeEntries, (int)Shape.Oval, new ChangedHandler (RadioActionActivated)); UIManager uim = new UIManager (); uim.InsertActionGroup (actions, 0); AddAccelGroup (uim.AccelGroup); uim.AddUiFromString (uiInfo); VBox box1 = new VBox (false, 0); Add (box1); box1.PackStart (uim.GetWidget ("/MenuBar"), false, false, 0); Label label = new Label ("Type\n<alt>\nto start"); label.SetSizeRequest (200, 200); label.SetAlignment (0.5f, 0.5f); box1.PackStart (label, true, true, 0); HSeparator separator = new HSeparator (); box1.PackStart (separator, false, true, 0); VBox box2 = new VBox (false, 10); box2.BorderWidth = 10; box1.PackStart (box2, false, true, 0); Button button = new Button ("close"); button.Clicked += new EventHandler (CloseClicked); box2.PackStart (button, true, true, 0); button.CanDefault = true; button.GrabDefault (); ShowAll (); }
public void set_setting (Setting s) { if(_s != null) throw new Exception("set_setting may only be used once per instance!"); _s = s; name_label.Text = _s.Name; if (_s.Choices != null && _s.Limited) { // TODO: This is broken, code was originally written to store a string // but in this particular case there is a setting with string type // and you are given an array of choices, so what should really be // stored is a value between 0 and the length of the array; to // indicate which choice is selected. As I am changing User-Agent // switcher to "Un Limited" I do not have a use case for this yet. ComboBox cobo = new ComboBox ((String[])_s.Choices); cobo.SetSizeRequest (100, 20); cobo.Name = _s.Name; cobo.Changed += cobo_changed; vbox2.Add (cobo); } else if (_s.Choices != null && !_s.Limited) { ComboBoxEntry combo = new ComboBoxEntry ((String[])_s.Choices); combo.SetSizeRequest (100, 20); combo.Name = _s.Name; combo.Entry.Text = (String)_s.Value; combo.Changed += combo_changed; vbox2.Add (combo); } else { Entry e = new Entry ((string)_s.Value); e.Name = _s.Name; e.Changed += e_changed; vbox2.Add (e); } Label l = new Label (_s.Description); l.SetSizeRequest (315, 100); l.SetAlignment (0, 0); l.LineWrap = true; l.SingleLineMode = false; l.SetPadding (10, 2); Pango.FontDescription pf2 = new Pango.FontDescription (); pf2.Weight = Pango.Weight.Light; l.ModifyFont (pf2); vbox2.Add(l); }
public static void FetchForm(Container Parent, XmlNode Nodes) { int cIndex = 0; string[] UFont; XmlNodeList original = Nodes.ChildNodes; XmlNodeList reverse = new ReverseXmlList(original); foreach (XmlNode C in reverse) { if (C.Name == "Object") { cIndex++; if (C.Attributes[0].Name == "type") { if (C.Attributes["type"].Value.StartsWith("System.Windows.Forms.PictureBox") || C.Attributes["type"].Value.StartsWith("System.Windows.Forms.Button")) { var PB = new Gtk.Button(); global::Gtk.Fixed.FixedChild PBC1 = ((global::Gtk.Fixed.FixedChild)(Parent[PB])); Parent.Add(PB); foreach (XmlNode V in C.ChildNodes) { if (V.Name == "Property") { switch (V.Attributes["name"].Value) { case "BorderStyle": if (V.InnerText == "Solid") { //PB.ModifierStyle = } break; case "Name": PB.Name = V.InnerText; break; case "ForeColor": var FColor = V.InnerText.GetXColor().ToNative(); PB.Children[0].ModifyFg(StateType.Normal, FColor); PB.Children[0].ModifyFg(StateType.Active, FColor); PB.Children[0].ModifyFg(StateType.Prelight, FColor); PB.Children[0].ModifyFg(StateType.Selected, FColor); break; case "Caption": case "Text": PB.Label = global::Mono.Unix.Catalog.GetString(System.Environment.ExpandEnvironmentVariables(V.InnerText).Replace("%DATE%", System.DateTime.Now.ToString("dd.MM.yyyy")).Replace("%TIME%", System.DateTime.Now.ToString("hh:mm:ss"))); break; case "BackColor": var BColor = V.InnerText.GetXColor().ToNative(); PB.ModifyBg(StateType.Normal, BColor); PB.ModifyBg(StateType.Active, BColor); PB.ModifyBg(StateType.Insensitive, BColor); PB.ModifyBg(StateType.Prelight, BColor); PB.ModifyBg(StateType.Selected, BColor); break; case "SizeMode": //PB.SizeMode = Enum.Parse(typeof(PictureBoxSizeMode), V.InnerText); break; case "Location": PBC1.X = (int)(Convert.ToInt32(V.InnerText.Substring(0, V.InnerText.IndexOf(","))) * App.ScaleFactorX); PBC1.Y = (int)(Convert.ToInt32(V.InnerText.Substring(V.InnerText.IndexOf(",") + 1)) * App.ScaleFactorY); break; case "Size": PB.SetSizeRequest((int)(Convert.ToInt32(V.InnerText.Substring(0, V.InnerText.IndexOf(","))) * App.ScaleFactorX), (int)(Convert.ToInt32(V.InnerText.Substring(V.InnerText.IndexOf(",") + 1)) * App.ScaleFactorY)); break; case "Font": string VC = V.InnerText; UFont = VC.Replace("style=", "").Split(new[] {","}, StringSplitOptions.RemoveEmptyEntries); string VCFName = UFont[0]; float VCSize = float.Parse(UFont[1].Replace("pt", "")); float Z = (float)(VCSize * App.ScaleFactorY); PB.Children[0].ModifyFont(Pango.FontDescription.FromString(VCFName + " " + ((int)Z).ToString())); break; case "Image": if (V.HasChildNodes) { string IMGData = V.FirstChild.InnerText; byte[] B = System.Convert.FromBase64String(IMGData); Pixbuf P = new Pixbuf(B); P=P.ScaleSimple(PB.WidthRequest-10, PB.HeightRequest, InterpType.Bilinear); PB.Image = new Gtk.Image(P); } break; } } else if (V.Name == "Object") { //FetchForm(PB, V.ParentNode); } } } else if (C.Attributes["type"].Value.StartsWith("System.Windows.Forms.Label")) { var CE = new Gtk.EventBox(); CE.ResizeMode = ResizeMode.Parent; var CC = new Gtk.Label(); CE.Add(CC); Parent.Add(CE); CC.LineWrapMode = Pango.WrapMode.Word; CC.LineWrap = true; CC.Wrap = true; CC.Justify = Justification.Fill; global::Gtk.Fixed.FixedChild PBC1; if ((Parent[CE]).GetType().ToString() == "Gtk.Container+ContainerChild") { var XVC = Parent[CE].Parent.Parent; PBC1 = (global::Gtk.Fixed.FixedChild)(Parent[XVC]); } else { PBC1 = ((global::Gtk.Fixed.FixedChild)(Parent[CE])); } foreach (XmlNode V in C.ChildNodes) { if (V.Name == "Property") { switch (V.Attributes["name"].Value) { case "BorderStyle": if (V.InnerText == "Solid") { //PB.ModifierStyle = } break; case "Name": CC.Name = V.InnerText; break; case "Font": string VC = V.InnerText; UFont = VC.Replace("style=", "").Split(new[] {","}, StringSplitOptions.RemoveEmptyEntries); string VCFName = UFont[0]; float VCSize = float.Parse(UFont[1].Replace("pt", "")); float Z = (float)(VCSize * App.ScaleFactorY); CC.ModifyFont(Pango.FontDescription.FromString(VCFName + " " + (int)Z)); break; case "ForeColor": var FColor = V.InnerText.GetXColor().ToNative(); CC.ModifyFg(StateType.Normal, FColor); CC.ModifyFg(StateType.Active, FColor); CC.ModifyFg(StateType.Insensitive, FColor); CC.ModifyFg(StateType.Prelight,FColor); CC.ModifyFg(StateType.Selected, FColor); CE.ModifyFg(StateType.Normal, FColor); CE.ModifyFg(StateType.Active, FColor); CE.ModifyFg(StateType.Insensitive, FColor); CE.ModifyFg(StateType.Prelight, FColor); CE.ModifyFg(StateType.Selected, FColor); CC.Markup = "<span foreground=\"" + V.InnerText + "\">" + CC.Text + "</span>"; break; case "Caption": case "Text": CC.Text = global::Mono.Unix.Catalog.GetString(System.Environment.ExpandEnvironmentVariables(V.InnerText).Replace("%DATE%", System.DateTime.Now.ToString("dd.MM.yyyy")).Replace("%TIME%", System.DateTime.Now.ToString("hh:mm:ss")).Replace("##", "\r\n")); break; case "BackColor": if (V.InnerText != "Transparent") { var BColor = V.InnerText.GetXColor().ToNative(); CE.ModifyBg(StateType.Normal, BColor); CE.ModifyBg(StateType.Active, BColor); CE.ModifyBg(StateType.Insensitive, BColor); CE.ModifyBg(StateType.Prelight, BColor); CE.ModifyBg(StateType.Selected, BColor); } else { CE.Visible = false; CE.VisibleWindow = false; } break; case "SizeMode": //PB.SizeMode = Enum.Parse(typeof(PictureBoxSizeMode), V.InnerText); break; case "Location": PBC1.X = (int)(Convert.ToInt32(V.InnerText.Substring(0, V.InnerText.IndexOf(","))) * App.ScaleFactorX); PBC1.Y = (int)(Convert.ToInt32(V.InnerText.Substring(V.InnerText.IndexOf(",") + 1)) * App.ScaleFactorY); break; case "TextAlign": CC.Justify = (V.InnerText == "MiddleCenter" || V.InnerText == "TopCenter" || V.InnerText == "BottomCenter" ? Justification.Center : (V.InnerText == "MiddleRight" || V.InnerText == "TopRight" || V.InnerText == "BottomRight" ? Justification.Right : Justification.Left)); break; case "Size": CE.SetSizeRequest((int)(Convert.ToInt32(V.InnerText.Substring(0, V.InnerText.IndexOf(","))) * App.ScaleFactorX), (int)(Convert.ToInt32(V.InnerText.Substring(V.InnerText.IndexOf(",") + 1)) * App.ScaleFactorY)); CC.SetSizeRequest((int)(Convert.ToInt32(V.InnerText.Substring(0, V.InnerText.IndexOf(","))) * App.ScaleFactorX), (int)(Convert.ToInt32(V.InnerText.Substring(V.InnerText.IndexOf(",") + 1)) * App.ScaleFactorY)); break; } } else if (V.Name == "Object") { var TZJE = new Fixed(); } } } else if (C.Attributes ["type"].Value.StartsWith("System.Windows.Forms.TextBox")) { if (C.InnerXml.IndexOf("\"Multiline\">True") > -1) { var CC = new Gtk.Entry (); global::Gtk.Fixed.FixedChild PBC1 = ((global::Gtk.Fixed.FixedChild)(Parent [CC])); Parent.Add (CC); foreach (XmlNode V in C.ChildNodes) { { if (V.Name == "Property") { switch (V.Attributes ["name"].Value) { case "Text": { if (V.InnerText.Contains ("%")) { CC.Text = System.Environment.ExpandEnvironmentVariables (V.InnerText); CC.Position = CC.Text.Length; } break; } case "Location": PBC1.X = (int)(Convert.ToInt32 (V.InnerText.Substring (0, V.InnerText.IndexOf (","))) * App.ScaleFactorX); PBC1.Y = (int)(Convert.ToInt32 (V.InnerText.Substring (V.InnerText.IndexOf (",") + 1)) * App.ScaleFactorY); break; case "Size": CC.SetSizeRequest ((int)(Convert.ToInt32 (V.InnerText.Substring (0, V.InnerText.IndexOf (",")))* App.ScaleFactorX), (int)(Convert.ToInt32 (V.InnerText.Substring (V.InnerText.IndexOf (",") + 1))* App.ScaleFactorY)); break; case "Name": CC.Name = V.InnerText; break; case "Font": string VC = V.InnerText; UFont = VC.Replace("style=", "").Split(new[] {","}, StringSplitOptions.RemoveEmptyEntries); string VCFName = UFont[0]; float VCSize = float.Parse(UFont[1].Replace("pt", "")); float Z = (float)(VCSize * App.ScaleFactorY); CC.ModifyFont (Pango.FontDescription.FromString (VCFName+" "+((int)Z).ToString())); System.Diagnostics.Debug.WriteLine(VCFName+" "+((int)Z).ToString()); break; } } } } } else { var CC= new Gtk.Entry(); global::Gtk.Fixed.FixedChild PBC1 = ((global::Gtk.Fixed.FixedChild)(Parent [CC])); Parent.Add (CC); foreach (XmlNode V in C.ChildNodes) { { if (V.Name == "Property") { switch (V.Attributes ["name"].Value) { case "Name": CC.Name = V.InnerText; break; case "Text": { if (V.InnerText.Contains ("%")) { CC.Text = System.Environment.ExpandEnvironmentVariables (V.InnerText); CC.Position = CC.Text.Length; } break; } case "Location": PBC1.X = (int)(Convert.ToInt32 (V.InnerText.Substring (0, V.InnerText.IndexOf (","))) * App.ScaleFactorX); PBC1.Y = (int)(Convert.ToInt32 (V.InnerText.Substring (V.InnerText.IndexOf (",") + 1)) * App.ScaleFactorY); break; case "Size": CC.SetSizeRequest ((int)(Convert.ToInt32 (V.InnerText.Substring (0, V.InnerText.IndexOf (",")))* App.ScaleFactorX), (int)(Convert.ToInt32 (V.InnerText.Substring (V.InnerText.IndexOf (",") + 1))* App.ScaleFactorY)); break; case "PasswordChar": CC.InvisibleChar = '*'; CC.Visibility = false; break; case "Font": string VC = V.InnerText; UFont = VC.Replace("style=", "").Split(new[] {","}, StringSplitOptions.RemoveEmptyEntries); string VCFName = UFont[0]; float VCSize = float.Parse(UFont[1].Replace("pt", "")); float Z = (float)(VCSize * App.ScaleFactorY); CC.ModifyFont (Pango.FontDescription.FromString (VCFName+" "+((int)Z).ToString())); System.Diagnostics.Debug.WriteLine(VCFName+" "+((int)Z).ToString()); break; } } } } } } else if (C.Attributes ["type"].Value.StartsWith ("System.Windows.Forms.Panel")) { var CP = new Gtk.Fixed (); //CP.Clicked += HandleClick; global::Gtk.Fixed.FixedChild PBC1 = ((global::Gtk.Fixed.FixedChild)(Parent [CP])); Parent.Add (CP); foreach (XmlNode V in C.ChildNodes) { if (V.Name == "Property") { switch (V.Attributes ["name"].Value) { case "Name": CP.Name = V.InnerText; break; case "BorderStyle": if (V.InnerText == "Solid") { //PB.ModifierStyle = } break; case "ForeColor": CP.Children [0].ModifyFg (StateType.Normal, V.InnerText.GetXColor ().ToNative ()); break; case "BackColor": CP.ModifyBg (StateType.Normal, V.InnerText.GetXColor().ToNative ()); break; case "SizeMode": //PB.SizeMode = Enum.Parse(typeof(PictureBoxSizeMode), V.InnerText); break; case "Location": PBC1.X = (int)(Convert.ToInt32 (V.InnerText.Substring (0, V.InnerText.IndexOf (","))) * App.ScaleFactorX); PBC1.Y = (int)(Convert.ToInt32 (V.InnerText.Substring (V.InnerText.IndexOf (",") + 1)) * App.ScaleFactorY); break; case "Size": CP.SetSizeRequest ((int)(Convert.ToInt32 (V.InnerText.Substring (0, V.InnerText.IndexOf (",")))* App.ScaleFactorX), (int)(Convert.ToInt32 (V.InnerText.Substring (V.InnerText.IndexOf (",") + 1))* App.ScaleFactorY)); break; } } else if (V.Name == "Object") { //FetchForm(PB, V.ParentNode); } } } else { System.Diagnostics.Debug.WriteLine (C.Attributes ["type"].Value); } } } } Parent.ShowAll(); }
public static void Main(string[] args) { Application.Init(); Gtk.Window w = new Gtk.Window("Encodroyd"); HBox mainHBox = new HBox(); HBox dropHBox = new HBox(); HBox spinVideoHBox = new HBox(); HBox spinAudioHBox = new HBox(); HBox statusButtonHBox = new HBox(); VBox mainVBox = new VBox(); VBox leftVBox = new VBox(); VBox rightVBox = new VBox(); VBox prefVBox = new VBox(); VBox statusVBox = new VBox(); MenuBar mb = new MenuBar (); //Gtk.Frame dndFrame = new Gtk.Frame(); Gtk.Frame prefFrame = new Gtk.Frame("Preferences"); Gtk.Frame statusFrame = new Gtk.Frame("Status"); icon = new Pixbuf(null, "encodroyd.png"); Gtk.EventBox image = new Gtk.EventBox(); Gtk.Label dropLabel = new Gtk.Label("Drop videos here\nto convert"); highQualityRadio = new RadioButton(null, "High Quality (H.264)"); prefVBox.PackStart(highQualityRadio, true, true, 0); lowQualityRadio = new RadioButton(highQualityRadio, "Low Quality (MPEG4)"); lowQualityRadio.Active = true; prefVBox.PackStart(lowQualityRadio, true, true, 0); statusLabel = new Gtk.Label("Idle"); pBar = new ProgressBar(); skipCurrentButton = new Gtk.Button(); Gtk.ScrolledWindow scrollWin = new Gtk.ScrolledWindow(); Gtk.TreeView tree = new TreeView(); listStore = new ListStore(typeof (String)); // set properties w.Icon = icon; // transparence //if (w.Screen.RgbaColormap != null) // Gtk.Widget.DefaultColormap = w.Screen.RgbaColormap; mainHBox.BorderWidth = 6; mainHBox.Spacing = 6; dropHBox.BorderWidth = 6; dropHBox.Spacing = 6; spinVideoHBox.BorderWidth = 6; spinVideoHBox.Spacing = 6; spinAudioHBox.BorderWidth = 6; spinAudioHBox.Spacing = 6; statusButtonHBox.BorderWidth = 0; statusButtonHBox.Spacing = 6; leftVBox.BorderWidth = 6; leftVBox.Spacing = 6; rightVBox.BorderWidth = 6; rightVBox.Spacing = 6; prefVBox.BorderWidth = 6; prefVBox.Spacing = 6; statusVBox.BorderWidth = 6; statusVBox.Spacing = 6; statusLabel.Ellipsize = Pango.EllipsizeMode.Middle; scrollWin.ShadowType = ShadowType.In; statusLabel.SetSizeRequest(120,-1); skipCurrentButton.Sensitive = false; skipCurrentButton.Label = "Skip"; // first hbox image.Add(new Gtk.Image(icon)); dropHBox.Add(image); dropHBox.Add(dropLabel); // preferences frame prefFrame.Add(prefVBox); prefVBox.Add(spinVideoHBox); prefVBox.Add(spinAudioHBox); // status frame statusFrame.Add(statusVBox); statusVBox.Add(statusButtonHBox); statusVBox.Add(pBar); statusButtonHBox.Add(statusLabel); statusButtonHBox.Add(skipCurrentButton); // leftvbox leftVBox.Add(dropHBox); leftVBox.Add(prefFrame); leftVBox.Add(statusFrame); // right tree.Model = listStore; tree.HeadersVisible = true; tree.AppendColumn ("Queue", new CellRendererText (), "text", 0); // scrolledwindow scrollWin.Add(tree); // rightvbox rightVBox.Add(scrollWin); rightVBox.SetSizeRequest(200,-1); // menubar Menu fileMenu = new Menu (); MenuItem exitItem = new MenuItem("Exit"); exitItem.Activated += new EventHandler (OnExitItemActivate); fileMenu.Append (exitItem); MenuItem fileItem = new MenuItem("File"); fileItem.Submenu = fileMenu; mb.Append (fileItem); Menu helpMenu = new Menu (); MenuItem aboutItem = new MenuItem("About"); aboutItem.Activated += new EventHandler (OnAboutItemActivate); helpMenu.Append (aboutItem); MenuItem helpItem = new MenuItem("Help"); helpItem.Submenu = helpMenu; mb.Append (helpItem); // mainHBox mainVBox.Add(mb); mainVBox.Add(mainHBox); mainHBox.Add(leftVBox); mainHBox.Add(rightVBox); // window w.Add(mainVBox); w.ShowAll(); // events Gtk.Drag.DestSet(dropHBox, DestDefaults.All, targetTable, Gdk.DragAction.Copy); dropHBox.DragDataReceived += DataReceived; skipCurrentButton.Clicked += new EventHandler(OnSkipOneButtonClicked); w.DeleteEvent += OnWindowDelete; Application.Run(); }
public override Widget SeparatorWidget() { Widget separator = new Label (String.Empty); separator.SetSizeRequest (3, 1); separator.Show (); return separator; }
// TODO: Possible to make Tomboy not crash if quit while dialog is up? public SyncDialog () : base (string.Empty, null, Gtk.DialogFlags.DestroyWithParent) { progressBarTimeoutId = 0; SetSizeRequest (400, -1); HasSeparator = false; // Outer box. Surrounds all of our content. VBox outerVBox = new VBox (false, 12); outerVBox.BorderWidth = 6; outerVBox.Show (); VBox.PackStart (outerVBox, true, true, 0); // Top image and label HBox hbox = new HBox (false, 12); hbox.Show (); outerVBox.PackStart (hbox, false, false, 0); image = new Image (GuiUtils.GetIcon ("tomboy", 48)); image.Xalign = 0; image.Yalign = 0; image.Show (); hbox.PackStart (image, false, false, 0); // Label header and message VBox vbox = new VBox (false, 6); vbox.Show (); hbox.PackStart (vbox, true, true, 0); headerLabel = new Label (); headerLabel.UseMarkup = true; headerLabel.Xalign = 0; headerLabel.UseUnderline = false; headerLabel.LineWrap = true; headerLabel.Show (); vbox.PackStart (headerLabel, false, false, 0); messageLabel = new Label (); messageLabel.Xalign = 0; messageLabel.UseUnderline = false; messageLabel.LineWrap = true; messageLabel.SetSizeRequest (250, -1); messageLabel.Show (); vbox.PackStart (messageLabel, false, false, 0); progressBar = new Gtk.ProgressBar (); progressBar.Orientation = Gtk.ProgressBarOrientation.LeftToRight; progressBar.BarStyle = ProgressBarStyle.Continuous; progressBar.ActivityBlocks = 30; progressBar.Show (); outerVBox.PackStart (progressBar, false, false, 0); progressLabel = new Label (); progressLabel.UseMarkup = true; progressLabel.Xalign = 0; progressLabel.UseUnderline = false; progressLabel.LineWrap = true; progressLabel.Wrap = true; progressLabel.Show (); outerVBox.PackStart (progressLabel, false, false, 0); // Expander containing TreeView expander = new Gtk.Expander (Catalog.GetString ("Details")); expander.Spacing = 6; expander.Activated += OnExpanderActivated; expander.Show (); outerVBox.PackStart (expander, true, true, 0); // Contents of expander Gtk.VBox expandVBox = new Gtk.VBox (); expandVBox.Show (); expander.Add (expandVBox); // Scrolled window around TreeView Gtk.ScrolledWindow scrolledWindow = new Gtk.ScrolledWindow (); scrolledWindow.ShadowType = Gtk.ShadowType.In; scrolledWindow.SetSizeRequest (-1, 200); scrolledWindow.Show (); expandVBox.PackStart (scrolledWindow, true, true, 0); // Create model for TreeView model = new Gtk.TreeStore (typeof (string), typeof (string)); // Create TreeView, attach model Gtk.TreeView treeView = new Gtk.TreeView (); treeView.Model = model; treeView.RowActivated += OnRowActivated; treeView.Show (); scrolledWindow.Add (treeView); // Set up TreeViewColumns Gtk.TreeViewColumn column = new Gtk.TreeViewColumn ( Catalog.GetString ("Note Title"), new Gtk.CellRendererText (), "text", 0); column.SortColumnId = 0; column.Resizable = true; treeView.AppendColumn (column); column = new Gtk.TreeViewColumn ( Catalog.GetString ("Status"), new Gtk.CellRendererText (), "text", 1); column.SortColumnId = 1; column.Resizable = true; treeView.AppendColumn (column); // Button to close dialog. closeButton = (Gtk.Button) AddButton (Gtk.Stock.Close, Gtk.ResponseType.Close); closeButton.Sensitive = false; }
/// <summary> /// Required designer variable. /// </summary> //private System.ComponentModel.IContainer components = null; /* /// <summary> /// Clean up any resources being used. /// </summary> /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param> protected override void Dispose(bool disposing) { if (disposing && (components != null)) { components.Dispose(); } base.Dispose(); } */ #region Windows Form Designer generated code /// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> private void InitializeComponent() { System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(LoginWindow)); this.checkBox2 = new Gtk.CheckButton(); this.checkBox1 = new Gtk.CheckButton(); this.cancelButton = new Gtk.Button(); this.loginButton = new Gtk.Button(); // // checkBox2 // this.checkBox2.Active = true; this.checkBox2.Name = "checkBox2"; this.checkBox2.Label = "Graphical Menu"; this.checkBox2.Xalign = 0; // // checkBox1 // this.checkBox1.Active = false; this.checkBox1.Name = "checkBox1"; this.checkBox1.Label = "Don\'t save password"; this.checkBox1.Xalign = 0; /* // // nickname_label // this.nickname_label.Name = "nickname_label"; this.nickname_label.Xalign = 0; this.nickname_label.SetSizeRequest(73, 23); this.nickname_label.Text = "Nickname:"; // // nickname // this.nickname.Name = "nickname"; this.nickname.Text = "Guest"; */ // // button1 // this.cancelButton.SetSizeRequest(80, 25); this.cancelButton.Label = "Cancel"; this.cancelButton.Clicked += new System.EventHandler(this.Close); // // refreshButton // this.refreshButton = new Gtk.Button(); this.refreshButton.Name = "refreshButton"; this.refreshButton.SetSizeRequest(80, 25); this.refreshButton.Label = "Refresh"; this.refreshButton.Clicked += new System.EventHandler(this.refreshButton_Click); // // LoginButton // this.loginButton.Name = "LoginButton"; this.loginButton.SetSizeRequest(80, 25); this.loginButton.Label = "Connect"; this.loginButton.Clicked += new System.EventHandler(this.loginButton_Click); /* // // port // this.port.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(155)))), ((int)(((byte)(123)))), ((int)(((byte)(76))))); this.port.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; this.port.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(213)))), ((int)(((byte)(184)))), ((int)(((byte)(142))))); this.port.Location = new System.Drawing.Point(215, 101); this.port.Margin = new System.Windows.Forms.Padding(0); this.port.MaximumSize = new System.Drawing.Size(50, 25); this.port.Name = "port"; this.port.Size = new System.Drawing.Size(50, 21); this.port.TabIndex = 9; this.port.Text = "14922"; this.port.TextChanged += new System.EventHandler(this.port_TextChanged); // // port_label // this.port_label.AutoSize = true; this.port_label.BackColor = System.Drawing.Color.Transparent; this.port_label.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(76)))), ((int)(((byte)(52)))), ((int)(((byte)(16))))); this.port_label.Location = new System.Drawing.Point(183, 101); this.port_label.Name = "port_label"; this.port_label.Size = new System.Drawing.Size(29, 15); this.port_label.TabIndex = 8; this.port_label.Text = "Port"; // // server // this.server.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(155)))), ((int)(((byte)(123)))), ((int)(((byte)(76))))); this.server.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; this.server.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(213)))), ((int)(((byte)(184)))), ((int)(((byte)(142))))); this.server.Location = new System.Drawing.Point(27, 119); this.server.Name = "server"; this.server.Size = new System.Drawing.Size(170, 21); this.server.TabIndex = 7; this.server.Text = "listserver.graalonline.com"; // // server_label // this.server_label.AutoSize = true; this.server_label.BackColor = System.Drawing.Color.Transparent; this.server_label.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(76)))), ((int)(((byte)(52)))), ((int)(((byte)(16))))); this.server_label.Location = new System.Drawing.Point(36, 94); this.server_label.Name = "server_label"; this.server_label.Size = new System.Drawing.Size(42, 15); this.server_label.TabIndex = 6; this.server_label.Text = "Server"; this.server_label.Click += new System.EventHandler(this.server_label_Click); * */ // // ServerWindow // Table table = new Table(2, 1, false); Table table2 = new Table(1, 2, false); table2.RowSpacing = 1; Label spacer = new Label(); spacer.SetSizeRequest(10, 1); table2.Attach(spacer, 0, 1, 0, 1, AttachOptions.Fill, AttachOptions.Fill, 5, 1); //table2.Attach(this.nickname_label, 0, 1, 1, 2, AttachOptions.Fill, AttachOptions.Fill, 5, 1); this.logText = new Gtk.Entry(); this.logText.SetSizeRequest(230, 230); this.tree = new Gtk.NodeView(); this.tree.SetSizeRequest(230, 230); this.musicListStore = new Gtk.ListStore(typeof(Gdk.Pixbuf), typeof(string), typeof(int)); //this.tree.Selection.Changed += new System.EventHandler(OnSelectionChanged); this.tree.CursorChanged += new System.EventHandler(OnSelectionChanged); this.tree.ButtonPressEvent += new ButtonPressEventHandler(delegate(object o, ButtonPressEventArgs args) { System.Console.WriteLine(args.ToString()); }); Gtk.CellRendererPixbuf pixbufrender = new Gtk.CellRendererPixbuf(); TreeViewColumn TypeCol = this.tree.AppendColumn("", new Gtk.CellRendererPixbuf(), "pixbuf", 0); TypeCol.SortIndicator = true; TypeCol.SortColumnId = 0; Gtk.CellRendererPixbuf cellpb = new Gtk.CellRendererPixbuf(); Gtk.CellRendererText cell = new Gtk.CellRendererText(); TypeCol.PackStart(cellpb, false); TypeCol.PackStart(cell, false); TreeViewColumn NameCol = this.tree.AppendColumn("Name", new Gtk.CellRendererText(), "text", 1); NameCol.SortIndicator = true; NameCol.SortColumnId = 1; TreeViewColumn PCCol = this.tree.AppendColumn("Players", new Gtk.CellRendererText(), "text", 2); PCCol.SortIndicator = true; PCCol.SortColumnId = 2; this.tree.FixedHeightMode = false; this.tree.HeadersClickable = true; this.tree.SearchColumn = 1; this.tree.EnableSearch = true; this.tree.EnableTreeLines = true; this.tree.ShowExpanders = true; //this.tree.Vadjustment. musicListStore.AppendValues("", "Loading...", ""); Gtk.Frame frame2 = new Gtk.Frame(); this.tree.Model = musicListStore; this.GtkScrolledWindow = new global::Gtk.ScrolledWindow(); this.GtkScrolledWindow.Name = "GtkScrolledWindow"; this.GtkScrolledWindow.ShadowType = ((global::Gtk.ShadowType)(1)); // Container child GtkScrolledWindow.Gtk.Container+ContainerChild this.GtkScrolledWindow.Add(this.tree); frame2.Add(this.GtkScrolledWindow); table2.Attach(this.logText, 1, 2, 0, 1, AttachOptions.Fill | AttachOptions.Expand, AttachOptions.Fill | AttachOptions.Expand, 5, 1); table2.Attach(frame2, 0, 1, 0, 1, AttachOptions.Fill, AttachOptions.Fill, 5, 1); HBox hbox = new HBox(true, 5); table.BorderWidth = 0; table.SetSizeRequest(100, 100); Frame frame = new Frame(); frame.Label = " Servers "; //frame.Add(new Label()); frame.Add(table2); table.Attach(frame, 0, 1, 0, 1, AttachOptions.Fill | AttachOptions.Expand, AttachOptions.Fill | AttachOptions.Expand, 5, 5); hbox.Add(this.cancelButton); hbox.Add(this.refreshButton); hbox.Add(this.loginButton); Alignment halign = new Alignment(1, 0, 0, 0); halign.Add(hbox); table.Attach(halign, 0, 1, 1, 2, AttachOptions.Fill, AttachOptions.Fill, 5, 5); this.Add(table); this.SetSizeRequest(520, 350); this.DoubleBuffered = true; this.Icon = global::Gdk.Pixbuf.LoadFromResource("OpenGraal.GraalIM.Resources.rcicon.ico"); this.Name = "ServerWindow"; this.SetPosition(Gtk.WindowPosition.Center); this.Title = "Graal Servers"; this.DeleteEvent += ServerWindow_Closed; this.Hidden += ServerWindow_hide; }