void HandleOnItemSelected (object sender, SettingCollection sc) { _current_sc = sc; foreach(Widget w in vbox3.AllChildren) { vbox3.Remove (w); w.Dispose(); } Label title = new Label (sc.Heading + " settings"); Pango.FontDescription tpf = new Pango.FontDescription (); tpf.Weight = Pango.Weight.Bold; title.ModifyFont (tpf); vbox3.Add (title); vbox3.Add (new HSeparator()); for(int i = sc.Settings.Length -1;i > -1; i --) { isettings_viewer v = _scf.get_control(sc.Settings[i].Type); v.set_setting(sc.Settings[i]); vbox3.Add((Widget)v); vbox3.Add (new HSeparator ()); } HSeparator h = new HSeparator(); h.HeightRequest = 300; vbox3.Add (h); vbox3.ShowAll (); }
public override Control GetVisualizerWidget (ObjectValue val) { string value = val.Value; Gdk.Color col = new Gdk.Color (85, 85, 85); if (!val.IsNull && (val.TypeName == "string" || val.TypeName == "char[]")) value = '"' + GetString (val) + '"'; if (DebuggingService.HasInlineVisualizer (val)) value = DebuggingService.GetInlineVisualizer (val).InlineVisualize (val); var label = new Gtk.Label (); label.Text = value; var font = label.Style.FontDescription.Copy (); if (font.SizeIsAbsolute) { font.AbsoluteSize = font.Size - 1; } else { font.Size -= (int)(Pango.Scale.PangoScale); } label.ModifyFont (font); label.ModifyFg (StateType.Normal, col); label.SetPadding (4, 4); if (label.SizeRequest ().Width > 500) { label.WidthRequest = 500; label.Wrap = true; label.LineWrapMode = Pango.WrapMode.WordChar; } else { label.Justify = Gtk.Justification.Center; } if (label.Layout.GetLine (1) != null) { label.Justify = Gtk.Justification.Left; var line15 = label.Layout.GetLine (15); if (line15 != null) { label.Text = value.Substring (0, line15.StartIndex).TrimEnd ('\r', '\n') + "\n…"; } } label.Show (); return label; }
public override void Init() { Gtk.Label label = new Gtk.Label(); Pango.FontDescription fontDescription = Pango.FontDescription.FromString(UIUtils.BUTTON_FONT); label.ModifyFont(fontDescription); label.ShowAll(); _button = new Gtk.Button(label); _button.CanFocus = true; _button.UseUnderline = true; _button.TooltipText = GetCommandDescriptor()._command; _button.WidthRequest = _buttonSize.X; _button.HeightRequest = _buttonSize.Y; _button.Show(); _button.ButtonPressEvent += OnButtonPressEvent; _button.ButtonReleaseEvent += OnButtonReleaseEvent; GetParent().Add(_button); _inputArguments = new Gtk.Entry(); _inputArguments.CanFocus = true; _inputArguments.Text = GetCommandDescriptor()._arguments; _inputArguments.Name = "_inputArguments"; _inputArguments.IsEditable = true; _inputArguments.InvisibleChar = '●'; _inputArguments.Show(); _inputArguments.WidthRequest = _inputSize.X; _inputArguments.HeightRequest = _inputSize.Y; _inputArguments.TextInserted += OnArgumentsTextInserted; GetParent().Add(_inputArguments); Refresh(); }
void InitTreeViewColumn(TreeView treeView, string[] title, ListStore list, int columnWidth) { IList <TreeViewColumn> Columns = new List <TreeViewColumn>(); for (int i = 0; i < title.Length; i++) { Columns.Add(new TreeViewColumn { MinWidth = columnWidth, Alignment = 0.50F }); } for (int i = 0; i < Columns.Count; i++) { var column = Columns[i]; var custom_header = new Gtk.Label(title[i]); custom_header.Show(); column.Widget = custom_header; custom_header.ModifyFont(Pango.FontDescription.FromString("Arial 13")); var CellRender = new CellRendererText { Xalign = 0.50F, Background = "White", Foreground = "Grey", Font = "Lucida Console 10" }; column.PackStart(CellRender, true); column.AddAttribute(CellRender, "text", i); treeView.AppendColumn(column); } treeView.Model = list; }
public void setLabelTextWithStyle(Gtk.Label label, String text, FontDescription style) { if (label != null && text != null) { label.Text = text; label.ModifyFont(style); } }
public override Control GetVisualizerWidget(ObjectValue val) { string value = val.Value; Gdk.Color col = new Gdk.Color(85, 85, 85); if (!val.IsNull && (val.TypeName == "string" || val.TypeName == "char[]")) { value = '"' + GetString(val) + '"'; } if (DebuggingService.HasInlineVisualizer(val)) { value = DebuggingService.GetInlineVisualizer(val).InlineVisualize(val); } var label = new Gtk.Label(); label.Text = value; var font = label.Style.FontDescription.Copy(); if (font.SizeIsAbsolute) { font.AbsoluteSize = font.Size - 1; } else { font.Size -= (int)(Pango.Scale.PangoScale); } label.ModifyFont(font); label.ModifyFg(StateType.Normal, col); label.SetPadding(4, 4); if (label.SizeRequest().Width > 500) { label.WidthRequest = 500; label.Wrap = true; label.LineWrapMode = Pango.WrapMode.WordChar; } else { label.Justify = Gtk.Justification.Center; } if (label.Layout.GetLine(1) != null) { label.Justify = Gtk.Justification.Left; var line15 = label.Layout.GetLine(15); if (line15 != null) { label.Text = value.Substring(0, line15.StartIndex).TrimEnd('\r', '\n') + "\n…"; } } label.Show(); return(label); }
static Gtk.Label CreateLabel(string text) { var label = new Gtk.Label(text); label.ModifyFont(new Pango.FontDescription { Weight = Pango.Weight.Bold }); return(label); }
public void ShowWord(string word) { imageCanvas.ModifyFg(Gtk.StateType.Normal, fontColor); eventBox.ModifyBg(Gtk.StateType.Normal, backgroundColor); imageCanvas.ModifyFont(Pango.FontDescription.FromString(fontName)); imageCanvas.Text = word; imageCanvas.UseMarkup = false; imageCanvas.CanFocus = false; imageCanvas.ShowAll(); }
public override Control GetVisualizerWidget(ObjectValue val) { var ops = DebuggingService.DebuggerSession.EvaluationOptions.Clone(); ops.AllowTargetInvoke = true; ops.ChunkRawStrings = true; ops.EllipsizedLength = 5000; //Preview window can hold aprox. 4700 chars val.Refresh(ops); //Refresh DebuggerDisplay/String value with full length instead of ellipsized string value = val.Value; Gdk.Color col = Styles.PreviewVisualizerTextColor.ToGdkColor(); if (DebuggingService.HasInlineVisualizer(val)) { value = DebuggingService.GetInlineVisualizer(val).InlineVisualize(val); } var label = new Gtk.Label(); label.Text = value; label.ModifyFont(FontService.SansFont.CopyModified(Ide.Gui.Styles.FontScale11)); label.ModifyFg(StateType.Normal, col); label.SetPadding(4, 4); if (label.SizeRequest().Width > 500) { label.WidthRequest = 500; label.Wrap = true; label.LineWrapMode = Pango.WrapMode.WordChar; } else { label.Justify = Gtk.Justification.Center; } if (label.Layout.GetLine(1) != null) { label.Justify = Gtk.Justification.Left; var trimmedLine = label.Layout.GetLine(50); if (trimmedLine != null) { label.Text = value.Substring(0, trimmedLine.StartIndex).TrimEnd('\r', '\n') + "\n…"; } } label.Selectable = true; label.CanFocus = false; label.Show(); return(label); }
private void AddSection(GameConfigSectionDescriptor sectionDescriptor) { Pango.FontDescription fontDescription = Pango.FontDescription.FromString(UIUtils.SECTION_FONT); _label = new Gtk.Label(); _label.Text = sectionDescriptor._tittle; _label.ModifyFont(fontDescription); _label.Show(); _parent.GetCanvas().Add(_label); foreach (GameConfigButtonDescriptor buttonDescriptor in sectionDescriptor._buttons) { AddButton(buttonDescriptor); } Dispose(); }
public override Control GetVisualizerWidget(ObjectValue val) { string value = val.Value; Gdk.Color col = Styles.PreviewVisualizerTextColor.ToGdkColor(); if (!val.IsNull && (val.TypeName == "string" || val.TypeName == "char[]")) { value = '"' + GetString(val) + '"'; } if (DebuggingService.HasInlineVisualizer(val)) { value = DebuggingService.GetInlineVisualizer(val).InlineVisualize(val); } var label = new Gtk.Label(); label.Text = value; label.ModifyFont(FontService.SansFont.CopyModified(Ide.Gui.Styles.FontScale11)); label.ModifyFg(StateType.Normal, col); label.SetPadding(4, 4); if (label.SizeRequest().Width > 500) { label.WidthRequest = 500; label.Wrap = true; label.LineWrapMode = Pango.WrapMode.WordChar; } else { label.Justify = Gtk.Justification.Center; } if (label.Layout.GetLine(1) != null) { label.Justify = Gtk.Justification.Left; var line15 = label.Layout.GetLine(15); if (line15 != null) { label.Text = value.Substring(0, line15.StartIndex).TrimEnd('\r', '\n') + "\n…"; } } label.Show(); return(label); }
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); }
void InitTreeView() { string[] Title = { "Id", "Title", "Author", "Press", "ISBN", "Price" }; IList <TreeViewColumn> Columns = new List <TreeViewColumn> { new TreeViewColumn { Title = "Id", Sizing = TreeViewColumnSizing.Fixed, MinWidth = 80, Alignment = 0.50F }, new TreeViewColumn { Title = "Title", Sizing = TreeViewColumnSizing.Fixed, MinWidth = 200, Alignment = 0.50F }, new TreeViewColumn { Title = "Author", Sizing = TreeViewColumnSizing.Fixed, MinWidth = 200, Alignment = 0.50F }, new TreeViewColumn { Title = "Press", Sizing = TreeViewColumnSizing.Fixed, MinWidth = 200, Alignment = 0.50F }, new TreeViewColumn { Title = "ISBN", Sizing = TreeViewColumnSizing.Fixed, MinWidth = 150, Alignment = 0.50F }, new TreeViewColumn { Title = "Price", Sizing = TreeViewColumnSizing.Fixed, MinWidth = 15, Alignment = 0.50F } }; for (int i = 0; i < Columns.Count; i++) { var column = Columns[i]; var custom_header = new Gtk.Label(Title[i]); custom_header.Show(); column.Widget = custom_header; custom_header.ModifyFont(Pango.FontDescription.FromString("Times Bold Italic 13")); var CellRender = new CellRendererText { Xalign = 0.50F, Background = "White", Foreground = "Black", Font = "Lucida Console" }; column.PackStart(CellRender, true); column.AddAttribute(CellRender, "text", i); BooksView.AppendColumn(column); } BookList.Clear(); BooksView.Model = BookList; }
public MainWindow(HttpAgent httpAgent, IRepositoryFactory repositoryFactory) : base(Gtk.WindowType.Toplevel) { this.httpAgent = httpAgent; WindowPosition = WindowPosition.Center; rekeningRepository = repositoryFactory.CreateRepository<IRekeningRepository>(); consumptieRepository = repositoryFactory.CreateRepository<IConsumptieRepository>(); // Rekeningen overzicht rekeningOverzichtWidget = new RekeningOverzichtWidget(); rekeningOverzichtWidget.Refresh(rekeningRepository.GetAll()); rekeningOverzichtWidget.RekeningClicked += handleRekeningClicked; // Afrekenen button Pango.FontDescription fontDescription = Pango.FontDescription.FromString("Arial"); fontDescription.Size = 13000; fontDescription.Weight = Pango.Weight.Bold; Label afrekenenLabel = new Label("Afrekenen"); afrekenenLabel.ModifyFont(fontDescription); afrekenenButton = new Button(); afrekenenButton.Add(afrekenenLabel); afrekenenButton.Clicked += handleAfrekenenButtonClicked; // Rechter panel (bestellingen) bestellingenOverzichtWidget = new BestellingenOverzichtWidget(); box = new HBox(false, 3); box.PackStart(rekeningOverzichtWidget); box.PackStart(bestellingenOverzichtWidget); // Main box vbox = new VBox(false, 0); vbox.PackStart(box); vbox.PackEnd(afrekenenButton); Add(vbox); ShowAll(); this.DeleteEvent += OnDeleteEvent; }
public override void Init() { Gtk.Label label = new Gtk.Label(); Pango.FontDescription fontDescription = Pango.FontDescription.FromString(UIUtils.BUTTON_FONT); label.ModifyFont(fontDescription); label.ShowAll(); _button = new Gtk.Button(label); _button.CanFocus = true; _button.UseUnderline = true; _button.TooltipText = GetCommandDescriptor()._command; _button.WidthRequest = _buttonSize.X; _button.HeightRequest = _buttonSize.Y; _button.Show(); _button.ButtonPressEvent += OnButtonPressEvent; _button.ButtonReleaseEvent += OnButtonReleaseEvent; GetParent().Add(_button); Refresh(); }
public Window CreateTooltipWindow(TextEditor editor, int offset, Gdk.ModifierType modifierState, TooltipItem item) { //create a message string from all the results var results = item.Item as AbstractTooltipContent[]; var win = new DToolTipWindow(); // Set white background win.ModifyBg(StateType.Normal,new Gdk.Color(0xff,0xff,0xff)); var pack = new Gtk.VBox(); foreach (var r in results) { var titleLabel = new Label(r.Title); // Make left-bound titleLabel.SetAlignment(0, 0); // Set bold font titleLabel.ModifyFont(new Pango.FontDescription() {Weight=Weight.Bold, AbsoluteSize=12*(int)Pango.Scale.PangoScale}); pack.Add(titleLabel); if (!string.IsNullOrEmpty( r.Description)) { const int maximumDescriptionLength = 300; var descLabel = new Label(r.Description.Length>maximumDescriptionLength ? (r.Description.Substring(0,maximumDescriptionLength)+"...") : r.Description); descLabel.ModifyFont(new Pango.FontDescription() { AbsoluteSize = 10 * (int)Pango.Scale.PangoScale }); descLabel.SetAlignment(0, 0); pack.Add(descLabel); } } win.Add(pack); return win; }
public void ShowSongInfoPopup(string filepath) { string sDuration = _parent.SecondsToHumanTime(_parent.oXbmc.Media.GetMusicTagByFilepath(filepath, "duration")); string songInfo = "\n\nartist: " + _parent.oXbmc.Media.GetMusicTagByFilepath(filepath, "artist"); songInfo += "\ntitle: " + _parent.oXbmc.Media.GetMusicTagByFilepath(filepath, "title"); songInfo += "\nalbum: " + _parent.oXbmc.Media.GetMusicTagByFilepath(filepath, "album"); songInfo += "\ngenre: " + _parent.oXbmc.Media.GetMusicTagByFilepath(filepath, "genre"); songInfo += "\nduration: " + sDuration; Gtk.Window wSongInfo = new Gtk.Window("Song Info"); wSongInfo.SetPosition(WindowPosition.CenterAlways); wSongInfo.SetIconFromFile("images/icon.png"); Pango.FontDescription fd = Pango.FontDescription.FromString("Verdana Bold 9"); /* string thumbLocation = _parent.oXbmc.Media.GetFileThumbnailLocation(filepath); if (thumbLocation != null) { MemoryStream msThumbnail = _parent.oXbmc.Media.FileDownload(thumbLocation); if (msThumbnail != null) wSongInfo.Add(new Gtk.Image(new Gdk.Pixbuf(msThumbnail))); } */ Label lArtist = new Label(songInfo); lArtist.ModifyFont(fd); lArtist.Xpad = 20; lArtist.Ypad = 20; wSongInfo.Add(lArtist); //Gtk.Image iCoverart = new Gtk.Image(new Gdk.Pixbuf(_parent.oXbmc.Media.GetFileThumbnailLocation(filepath))); //wSongInfo.Add(iCoverart); wSongInfo.ShowAll(); }
private void initialize() { VBox box = new VBox(); // Label label = new Label(rekening.Naam); Pango.FontDescription fontDescription = Pango.FontDescription.FromString("Arial"); fontDescription.Size = FontSize * 700; fontDescription.Weight = Pango.Weight.Bold; label.ModifyFont(fontDescription); box.PackStart(label); // Additional image Image image = getImage(); if (image != null) { box.PackStart(image); } Add(box); Refresh(); }
public override Control GetVisualizerWidget (ObjectValue val) { var ops = DebuggingService.DebuggerSession.EvaluationOptions.Clone (); ops.AllowTargetInvoke = true; ops.ChunkRawStrings = true; ops.EllipsizedLength = 5000;//Preview window can hold aprox. 4700 chars val.Refresh (ops);//Refresh DebuggerDisplay/String value with full length instead of ellipsized string value = val.Value; Gdk.Color col = Styles.PreviewVisualizerTextColor.ToGdkColor (); if (DebuggingService.HasInlineVisualizer (val)) value = DebuggingService.GetInlineVisualizer (val).InlineVisualize (val); var label = new Gtk.Label (); label.Text = value; label.ModifyFont (FontService.SansFont.CopyModified (Ide.Gui.Styles.FontScale11)); label.ModifyFg (StateType.Normal, col); label.SetPadding (4, 4); if (label.SizeRequest ().Width > 500) { label.WidthRequest = 500; label.Wrap = true; label.LineWrapMode = Pango.WrapMode.WordChar; } else { label.Justify = Gtk.Justification.Center; } if (label.Layout.GetLine (1) != null) { label.Justify = Gtk.Justification.Left; var trimmedLine = label.Layout.GetLine (50); if (trimmedLine != null) { label.Text = value.Substring (0, trimmedLine.StartIndex).TrimEnd ('\r', '\n') + "\n…"; } } label.Show (); return label; }
public MainWindow_Pango() : base("pango + unicode + font") { SetPosition(WindowPosition.Center); DeleteEvent += delegate { Application.Quit(); }; ScrolledWindow sw = new ScrolledWindow(); sw.ShadowType = ShadowType.EtchedIn; sw.SetPolicy(PolicyType.Automatic, PolicyType.Automatic); Context context = this.CreatePangoContext(); _fonts = context.Families; _store = CreateModel(); TreeView view = new TreeView(); view.RulesHint = true; sw.Add(view); CreateColumn(view); string text = @"하늘과 바람과 별과 시 - 윤동주\n1821 года в Москве.Был вторым из 7 детей. Отец, Михаил Андреевич"; _label = new Label(text); Pango.FontDescription fontDesc = Pango.FontDescription.FromString("SignPainter 20"); _label.ModifyFont(fontDesc); Fixed fix = new Fixed(); fix.Put(_label, 5, 5); Add(fix); //Add(sw); ShowAll(); }
public void GetFileInfo() { TreeModel selectedModel; TreeIter selectedIter = new TreeIter(); if (_parent._tvShares.Selection.GetSelected(out selectedModel, out selectedIter)) { string filepath = selectedModel.GetValue(selectedIter, 2).ToString(); string sDuration = _parent.oHelper.SecondsToHumanTime(_parent.oXbmc.Media.GetMusicTagByFilepath(filepath, "duration")); string songInfo = "artist: " + _parent.oXbmc.Media.GetMusicTagByFilepath(filepath, "artist"); songInfo += "\ntitle: " + _parent.oXbmc.Media.GetMusicTagByFilepath(filepath, "title"); songInfo += "\nalbum: " + _parent.oXbmc.Media.GetMusicTagByFilepath(filepath, "album"); songInfo += "\ngenre: " + _parent.oXbmc.Media.GetMusicTagByFilepath(filepath, "genre"); songInfo += "\nduration: " + sDuration; Window wSongInfo = new Window("Song Info"); wSongInfo.SetPosition(WindowPosition.CenterAlways); wSongInfo.SetIconFromFile("images/icon.png"); Pango.FontDescription fd = Pango.FontDescription.FromString("Verdana Bold 9"); Label lArtist = new Label(songInfo); lArtist.ModifyFont(fd); lArtist.Xpad = 20; lArtist.Ypad = 20; wSongInfo.Add(lArtist); //Gtk.Image iCoverart = new Gtk.Image(new Gdk.Pixbuf(_parent.oXbmc.Media.GetFileThumbnailLocation(filepath))); //wSongInfo.Add(iCoverart); wSongInfo.ShowAll(); //_parent.Messagebox(songInfo); } }
private void Build() { box = new HBox(false, 0); box.SetSizeRequest(40, 40); box.BorderWidth = 2; button = new Button(); button.Clicked += CyclePoint; lblpoints = new Label(); Pango.FontDescription desc = Pango.FontDescription.FromString("Bebas Neue 14"); lblpoints.ModifyFont(desc); lblpoints.Text = points[10]; button.Add(lblpoints); button.ShowAll(); box.Add(this.button); box.ShowAll(); // This damn this call is anoyingly needed otherwise it shant build this.Add(box); }
public override Control GetVisualizerWidget (ObjectValue val) { string value = val.Value; Gdk.Color col = Styles.PreviewVisualizerTextColor.ToGdkColor (); if (!val.IsNull && (val.TypeName == "string" || val.TypeName == "char[]")) value = '"' + GetString (val) + '"'; if (DebuggingService.HasInlineVisualizer (val)) value = DebuggingService.GetInlineVisualizer (val).InlineVisualize (val); var label = new Gtk.Label (); label.Text = value; label.ModifyFont (FontService.SansFont.CopyModified (Ide.Gui.Styles.FontScale11)); label.ModifyFg (StateType.Normal, col); label.SetPadding (4, 4); if (label.SizeRequest ().Width > 500) { label.WidthRequest = 500; label.Wrap = true; label.LineWrapMode = Pango.WrapMode.WordChar; } else { label.Justify = Gtk.Justification.Center; } if (label.Layout.GetLine (1) != null) { label.Justify = Gtk.Justification.Left; var line15 = label.Layout.GetLine (15); if (line15 != null) { label.Text = value.Substring (0, line15.StartIndex).TrimEnd ('\r', '\n') + "\n…"; } } label.Show (); return label; }
public CategoryBox(string labelText) : base() { var frame = new Frame (); var vbox = new VBox (); var label = new Label (labelText); label.ModifyFont (new Pango.FontDescription () { Size = 24, Weight = Pango.Weight.Bold }); Body = new HBox (); vbox.Add (label); vbox.Add (Body); frame.Add (vbox); Add (frame); DarkenBackground (this); }
Widget CreateExceptionHeader () { var icon = new ImageView (WarningIconPixbuf); icon.Yalign = 0; ExceptionTypeLabel = new Label { Xalign = 0.0f, Selectable = true }; ExceptionMessageLabel = new Label { Wrap = true, Xalign = 0.0f, Selectable = true }; ExceptionTypeLabel.ModifyFg (StateType.Normal, new Gdk.Color (255, 255, 255)); ExceptionMessageLabel.ModifyFg (StateType.Normal, new Gdk.Color (255, 255, 255)); if (Platform.IsWindows) { ExceptionTypeLabel.ModifyFont (Pango.FontDescription.FromString ("bold 19")); ExceptionMessageLabel.ModifyFont (Pango.FontDescription.FromString ("10")); } else { ExceptionTypeLabel.ModifyFont (Pango.FontDescription.FromString ("21")); ExceptionMessageLabel.ModifyFont (Pango.FontDescription.FromString ("12")); } //Force rendering of background with EventBox var eventBox = new EventBox (); var hBox = new HBox (); var leftVBox = new VBox (); rightVBox = new VBox (); leftVBox.PackStart (icon, false, false, (uint)(Platform.IsWindows ? 5 : 0)); // as we change frame.BorderWidth below, we need to compensate rightVBox.PackStart (ExceptionTypeLabel, false, false, (uint)(Platform.IsWindows ? 0 : 2)); rightVBox.PackStart (ExceptionMessageLabel, true, true, (uint)(Platform.IsWindows ? 6 : 5)); hBox.PackStart (leftVBox, false, false, (uint)(Platform.IsWindows ? 5 : 0)); // as we change frame.BorderWidth below, we need to compensate hBox.PackStart (rightVBox, true, true, (uint)(Platform.IsWindows ? 5 : 10)); var frame = new Frame (); frame.Add (hBox); frame.BorderWidth = (uint)(Platform.IsWindows ? 5 : 10); // on Windows we need to have smaller border due to ExceptionTypeLabel vertical misalignment frame.Shadow = ShadowType.None; frame.ShadowType = ShadowType.None; eventBox.Add (frame); eventBox.ShowAll (); eventBox.ModifyBg (StateType.Normal, new Gdk.Color (119, 130, 140)); return eventBox; }
Widget CreateInnerExceptionMessage () { var hboxMain = new HBox (); vboxAroundInnerExceptionMessage = new VBox (); var hbox = new HBox (); var icon = new ImageView (WarningIconPixbufInner); icon.Yalign = 0; hbox.PackStart (icon, false, false, 0); InnerExceptionTypeLabel = new Label (); InnerExceptionTypeLabel.UseMarkup = true; InnerExceptionTypeLabel.Xalign = 0; InnerExceptionTypeLabel.Selectable = true; hbox.PackStart (InnerExceptionTypeLabel, false, true, 4); InnerExceptionMessageLabel = new Label (); InnerExceptionMessageLabel.Wrap = true; InnerExceptionMessageLabel.Selectable = true; InnerExceptionMessageLabel.Xalign = 0; InnerExceptionMessageLabel.ModifyFont (Pango.FontDescription.FromString (Platform.IsWindows ? "9" : "11")); vboxAroundInnerExceptionMessage.PackStart (hbox, false, true, 0); vboxAroundInnerExceptionMessage.PackStart (InnerExceptionMessageLabel, true, true, 10); hboxMain.PackStart (vboxAroundInnerExceptionMessage, true, true, 10); hboxMain.ShowAll (); return hboxMain; }
private void build() { this.Title = "New Battlelords Character"; { // page 1 - intro Gtk.TextView tv = new Gtk.TextView(); Gtk.TextBuffer tb; tb = tv.Buffer; //tb.Text = MediaManager.GetHtml("intro.html"); tb.Text = "Welcome to the Battlelords Character Asistant.\n" + "\nThis will guide you thru the initial player character generation. " + "You will be presented with some initial options that can not change " + "once the character is created. " + "\nStep 1" + "\nStep 2" + "\nStep 3" + "\nStep 4" + "\nConculsion"; tv.WrapMode = WrapMode.Word; tv.Editable = false; this.AppendPage(tv); this.SetPageTitle(tv, "Introduction"); this.SetPageType(tv, AssistantPageType.Intro); this.SetPageComplete(tv, true); } { // page 2 - rolling method string method1 = "Percentile dice are rolled and marked down in order of the given visual statistics. " + "Eight rolls are initially made. The player then makes three additional dice rolls. " + "He has the option of replacing any three previously rolled statistics with one of these number. " + "Players may not move rolls around! First roll is Strength, second roll is Manual Dexterity, etc."; Gtk.VBox vb = new Gtk.VBox(); Gtk.HBox hb1 = new Gtk.HBox(); Gtk.Label lb1 = new Gtk.Label("Rolling Method"); string[] entries = { "Method 1", "Method 2", "Method 3", "Fill In" }; Gtk.ComboBox cb1 = new Gtk.ComboBox(entries); hb1.PackStart(lb1, true, false, 0); hb1.PackEnd(cb1, true, false, 0); cb1.Active = 0; Gtk.HBox hb2 = new Gtk.HBox(); Gtk.CheckButton b1 = new Gtk.CheckButton("Max Body Points"); Gtk.CheckButton b2 = new Gtk.CheckButton("Max Starting Money"); b1.Active = true; b2.Active = true; hb2.PackStart(b1, true, false, 1); hb2.PackEnd(b2, true, false, 1); Gtk.ScrolledWindow sw = new Gtk.ScrolledWindow(); Gtk.TextView tv = new Gtk.TextView(); tv.WrapMode = WrapMode.Word; tv.Editable = false; Gtk.TextBuffer tb = tv.Buffer; tb.Text = method1; sw.Add(tv); //vb.PackStart(hb1, false, false, 0); vb.PackStart(hb2, false, false, 0); //vb.PackEnd(sw, true, true, 0); this.AppendPage(vb); this.SetPageTitle(vb, "Rolling Options"); this.SetPageType(vb, AssistantPageType.Content); this.SetPageComplete(vb, true); } { // page 3 - race TreeStore ts = new TreeStore(typeof(string), typeof(string)); foreach (BattlelordsRace r in this.session.Races) { ts.AppendValues(r.Name, r.Name); } TreeView tv = new TreeView(ts); tv.HeadersVisible = true; tv.AppendColumn("Battlelords Race", new CellRendererText(), "text", 0); this.AppendPage(tv); this.SetPageTitle(tv, "Select Race"); this.SetPageType(tv, AssistantPageType.Content); this.SetPageComplete(tv, true); } { // page 4 - Basics page /* * 1 char name * 2 player name * 3 height * 4 weight * 5 body pts * 6 start money */ Gtk.VBox vb2 = new Gtk.VBox(); Gtk.HBox hb1 = new Gtk.HBox(); Gtk.Label lb1 = new Gtk.Label("Player's Name:"); Gtk.Entry en1 = new Gtk.Entry(); hb1.PackStart(lb1, false, false, 0); hb1.PackStart(new Gtk.HSeparator(), true, false, 0); hb1.PackEnd(en1, true, true, 0); Gtk.HBox hb2 = new Gtk.HBox(); Gtk.Label lb2 = new Gtk.Label("Character's Name:"); Gtk.Entry en2 = new Gtk.Entry(); hb2.PackStart(lb2, false, false, 0); hb2.PackStart(new Gtk.HSeparator(), true, false, 0); hb2.PackEnd(en2, true, true, 0); Gtk.HBox hb3 = new Gtk.HBox(); Gtk.Label lb3 = new Gtk.Label("Height (ft):"); Gtk.Entry en3 = new Gtk.Entry(); en3.Sensitive = false; Gtk.Button b3 = new Gtk.Button(); //b3.Label = "roll"; b3.TooltipText = "Click here to roll height."; b3.Image = MediaManager.GetImageFromBaseFile("dice.png"); hb3.PackStart(lb3, false, false, 0); hb3.PackStart(new Gtk.HSeparator(), true, false, 0); hb3.PackStart(en3, true, true, 0); hb3.PackEnd(b3, false, false, 0); Gtk.HBox hb4 = new Gtk.HBox(); Gtk.Label lb4 = new Gtk.Label("Weight (lbs):"); Gtk.Entry en4 = new Gtk.Entry(); en4.Sensitive = false; Gtk.Button b4 = new Gtk.Button(); //b4.Label = "roll"; b4.TooltipText = "Click here to roll for weight."; b4.Image = MediaManager.GetImageFromBaseFile("dice.png"); hb4.PackStart(lb4, false, false, 0); hb4.PackStart(new Gtk.HSeparator(), true, false, 0); hb4.PackStart(en4, true, true, 0); hb4.PackEnd(b4, false, false, 0); Gtk.HBox hb5 = new Gtk.HBox(); Gtk.Label lb5 = new Gtk.Label("Body Points:"); Gtk.Entry en5 = new Gtk.Entry(); en5.Sensitive = false; Gtk.Button b5 = new Gtk.Button(); b5.TooltipText = "Click here to roll for body points."; b5.Image = MediaManager.GetImageFromBaseFile("dice.png"); hb5.PackStart(lb5, false, false, 0); hb5.PackStart(new Gtk.HSeparator(), true, false, 0); hb5.PackStart(en5, true, true, 0); hb5.PackEnd(b5, false, false, 0); Gtk.HBox hb6 = new Gtk.HBox(); Gtk.Label lb6 = new Gtk.Label("Starting Money:"); Gtk.Entry en6 = new Gtk.Entry(); en6.Sensitive = false; Gtk.Button b6 = new Gtk.Button(); b6.TooltipText = "Click here to roll for starting money."; b6.Image = MediaManager.GetImageFromBaseFile("dice.png"); hb6.PackStart(lb6, false, false, 0); hb6.PackStart(new Gtk.HSeparator(), true, false, 0); hb6.PackStart(en6, true, true, 0); hb6.PackEnd(b6, false, false, 0); vb2.PackStart(hb1, false, false, 0); vb2.PackStart(hb2, false, false, 0); vb2.PackStart(hb3, false, false, 0); vb2.PackStart(hb4, false, false, 0); vb2.PackStart(hb5, false, false, 0); vb2.PackStart(hb6, false, false, 0); this.AppendPage(vb2); this.SetPageTitle(vb2, "Enter Basic Information"); this.SetPageType(vb2, AssistantPageType.Content); this.SetPageComplete(vb2, true); } { // page 5 - vitals VBox vb5 = new VBox(); Gtk.Notebook nb = new Gtk.Notebook(); //Battle.Gui.VitalsControl stvc = new Battle.Gui.VitalsControl(this.session); //stvc.Sensitive = false; VitalsControl m1vitals = new VitalsControl(this.session); VitalsControl m2vitals = new VitalsControl(this.session); VitalsControl m3vitals = new VitalsControl(this.session); VitalsControl fillvitals = new VitalsControl(this.session); m1vitals.Enabled = false; m2vitals.Enabled = false; m3vitals.Enabled = false; nb.AppendPage(m1vitals, new Gtk.Label("Method 1")); nb.AppendPage(m2vitals, new Gtk.Label("Method 2")); nb.AppendPage(m3vitals, new Gtk.Label("Method 3")); nb.AppendPage(fillvitals, new Gtk.Label("Fill In")); HButtonBox bb5 = new HButtonBox(); Button rollBtn = new Button(Stock.Execute); rollBtn.Clicked += delegate(object sender, EventArgs e) { Console.WriteLine("{0}", sender.GetType().ToString()); }; rollBtn.Label = "Roll"; Button saveBtn = new Button(Stock.Save); saveBtn.Label = "Save"; bb5.PackStart(rollBtn); bb5.PackEnd(saveBtn); nb.SwitchPage += delegate(object o, SwitchPageArgs args) { if (args.PageNum == 3) { rollBtn.Sensitive = false; } else { rollBtn.Sensitive = true; } }; vb5.Add(nb); vb5.Add(bb5); this.AppendPage(vb5); this.SetPageTitle(vb5, "Enter Vitals"); this.SetPageType(vb5, AssistantPageType.Content); this.SetPageComplete(vb5, true); } { // page 6 - secondaries Gtk.Label not_completed_label = new Gtk.Label("not completed"); Pango.FontDescription d = new Pango.FontDescription(); d.Style = Pango.Style.Italic; not_completed_label.ModifyFont(d); this.AppendPage(not_completed_label); this.SetPageTitle(not_completed_label, "Enter Secondary Attributes"); this.SetPageType(not_completed_label, AssistantPageType.Content); this.SetPageComplete(not_completed_label, true); } { // page 7 - fate Gtk.Label not_completed_label = new Gtk.Label("not completed"); Pango.FontDescription d = new Pango.FontDescription(); d.Style = Pango.Style.Italic; not_completed_label.ModifyFont(d); this.AppendPage(not_completed_label); this.SetPageTitle(not_completed_label, "Determine Fate"); this.SetPageType(not_completed_label, AssistantPageType.Content); this.SetPageComplete(not_completed_label, true); } { // page 8 - social Gtk.Label not_completed_label = new Gtk.Label("not completed"); Pango.FontDescription d = new Pango.FontDescription(); d.Style = Pango.Style.Italic; not_completed_label.ModifyFont(d); this.AppendPage(not_completed_label); this.SetPageTitle(not_completed_label, "Social Status"); this.SetPageType(not_completed_label, AssistantPageType.Content); this.SetPageComplete(not_completed_label, true); } { // page 9 - skills Gtk.Label not_completed_label = new Gtk.Label("not completed"); Pango.FontDescription d = new Pango.FontDescription(); d.Style = Pango.Style.Italic; not_completed_label.ModifyFont(d); this.AppendPage(not_completed_label); this.SetPageTitle(not_completed_label, "Choose Initial Skills"); this.SetPageType(not_completed_label, AssistantPageType.Content); this.SetPageComplete(not_completed_label, true); } { // page 10 - matrixes Gtk.Label not_completed_label = new Gtk.Label("not completed"); Pango.FontDescription d = new Pango.FontDescription(); d.Style = Pango.Style.Italic; not_completed_label.ModifyFont(d); this.AppendPage(not_completed_label); this.SetPageTitle(not_completed_label, "Choose Initial Matrixes"); this.SetPageType(not_completed_label, AssistantPageType.Content); this.SetPageComplete(not_completed_label, true); } { // page 11 - confirm TextView tv11 = new TextView(); TextBuffer b11 = tv11.Buffer; b11.Text = "Confirm this new character."; tv11.Editable = false; this.AppendPage(tv11); this.SetPageTitle(tv11, "Confirm New Character"); this.SetPageType(tv11, AssistantPageType.Confirm); this.SetPageComplete(tv11, true); } this.Close += HandleHandleClose; this.Cancel += HandleHandleCancel; this.ShowAll(); }
public PreviewVisualizerWindow (ObjectValue val, Gtk.Widget invokingWidget) : base (Gtk.WindowType.Toplevel) { this.TypeHint = WindowTypeHint.PopupMenu; this.Decorated = false; if (((Gtk.Window)invokingWidget.Toplevel).Modal) this.Modal = true; TransientFor = (Gtk.Window) invokingWidget.Toplevel; Theme.SetFlatColor (new Cairo.Color (245 / 256.0, 245 / 256.0, 245 / 256.0)); Theme.Padding = 3; ShowArrow = true; var mainBox = new VBox (); var headerTable = new Table (1, 3, false); headerTable.ColumnSpacing = 5; var closeButton = new ImageButton () { InactiveImage = ImageService.GetIcon ("md-popup-close", IconSize.Menu), Image = ImageService.GetIcon ("md-popup-close-hover", IconSize.Menu) }; closeButton.Clicked += delegate { this.Destroy (); }; var hb = new HBox (); var vb = new VBox (); hb.PackStart (vb, false, false, 0); vb.PackStart (closeButton, false, false, 0); headerTable.Attach (hb, 0, 1, 0, 1); var headerTitle = new Label (); headerTitle.ModifyFg (StateType.Normal, new Color (36, 36, 36)); var font = headerTitle.Style.FontDescription.Copy (); font.Weight = Pango.Weight.Bold; headerTitle.ModifyFont (font); headerTitle.Text = val.TypeName; var vbTitle = new VBox (); vbTitle.PackStart (headerTitle, false, false, 3); headerTable.Attach (vbTitle, 1, 2, 0, 1); if (DebuggingService.HasValueVisualizers (val)) { var openButton = new Button (); openButton.Label = "Open"; openButton.Relief = ReliefStyle.Half; openButton.Clicked += delegate { PreviewWindowManager.DestroyWindow (); DebuggingService.ShowValueVisualizer (val); }; var hbox = new HBox (); hbox.PackEnd (openButton, false, false, 2); headerTable.Attach (hbox, 2, 3, 0, 1); } else { headerTable.Attach (new Label (), 2, 3, 0, 1, AttachOptions.Fill | AttachOptions.Expand, AttachOptions.Fill | AttachOptions.Expand, 10, 0); } mainBox.PackStart (headerTable); mainBox.ShowAll (); var previewVisualizer = DebuggingService.GetPreviewVisualizer (val); if (previewVisualizer == null) previewVisualizer = new GenericPreviewVisualizer (); Control widget = null; try { widget = previewVisualizer.GetVisualizerWidget (val); } catch (Exception e) { DebuggingService.DebuggerSession.LogWriter (true, "Exception during preview widget creation: " + e.Message); } if (widget == null) { widget = new GenericPreviewVisualizer ().GetVisualizerWidget (val); } var alignment = new Alignment (0, 0, 1, 1); alignment.SetPadding (3, 5, 5, 5); alignment.Show (); alignment.Add (widget); mainBox.PackStart (alignment); ContentBox.Add (mainBox); }
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 void ModifyLabelFont(Pango.FontDescription font) { label.ModifyFont(font); }
public void UpdateTab () { if (Child != null) { Widget w = Child; Remove (w); w.Destroy (); } mainBox = new Alignment (0,0,1,1); if (bar.Orientation == Gtk.Orientation.Horizontal) { box = new HBox (); if (bar.AlignToEnd) mainBox.SetPadding (5, 5, 11, 9); else mainBox.SetPadding (5, 5, 9, 11); } else { box = new VBox (); if (bar.AlignToEnd) mainBox.SetPadding (11, 9, 5, 5); else mainBox.SetPadding (9, 11, 5, 5); } if (it.Icon != null) { var desat = it.Icon.WithAlpha (0.5); crossfade = new CrossfadeIcon (desat, it.Icon); box.PackStart (crossfade, false, false, 0); desat.Dispose (); } if (!string.IsNullOrEmpty (it.Label)) { label = new Label (it.Label); label.UseMarkup = true; label.ModifyFont (FontService.SansFont.CopyModified (Styles.FontScale11)); if (bar.Orientation == Orientation.Vertical) label.Angle = 270; // fine-tune label alignment issues if (Platform.IsMac) { if (bar.Orientation == Orientation.Horizontal) label.SetAlignment (0, 0.5f); else label.SetAlignment (0.6f, 0); } else { if (bar.Orientation == Orientation.Vertical) label.SetAlignment (1, 0); } // TODO: VV: Test Linux box.PackStart (label, true, true, 0); } else label = null; box.Spacing = 2; mainBox.Add (box); mainBox.ShowAll (); Add (mainBox); UpdateStyle (this, null); QueueDraw (); }
private void GenerateNotebookPages() { string platformName = MainClass.Settings.Platform.Name; foreach(Rule rl in MainClass.Settings.Platform.Rules){ bool iOsNoMac = false; if( (rl.Tag == -1 ) && !MainClass.Settings.ShowUnsupportedDevices) continue; if( (rl.Tag == -2 ) && !MainClass.Settings.ShowDebugDevices) continue; bool validDevice = true; if(!Device.CheckDevice(rl.Specific) ){ Tool.Logger.Debug("Invalid Device " + rl.Specific); validDevice = false; } ScrolledWindow sw= new ScrolledWindow(); sw.ShadowType = ShadowType.EtchedOut; TreeView tvList = new TreeView(); List<CombinePublish> lcp = project.ProjectUserSetting.CombinePublish.FindAll(x=> x.combineRule.FindIndex(y=>y.ConditionName==platformName && y.RuleId == rl.Id) >-1); List<CombinePublish> lcpDennied = new List<CombinePublish>(); string deviceName = rl.Name; int deviceTyp = rl.Id; ListStore ls = new ListStore(typeof(bool),typeof(string),typeof(CombinePublish),typeof(string),typeof(bool)); string ico="empty.png"; switch (deviceTyp) { case (int)DeviceType.Android_1_6:{ ico = "android.png"; break;} case (int)DeviceType.Android_2_2:{ ico = "android.png"; break;} case (int)DeviceType.Bada_1_0: case (int)DeviceType.Bada_1_1: case (int)DeviceType.Bada_1_2: case (int)DeviceType.Bada_2_0:{ ico = "bada.png"; break;} case (int)DeviceType.Symbian_9_4:{ ico = "symbian.png"; break;} case (int)DeviceType.iOS_5_0:{ ico = "apple.png"; if(!MainClass.Platform.IsMac){ iOsNoMac = true; } break; } case (int)DeviceType.PocketPC_2003SE: case (int)DeviceType.WindowsMobile_5: case (int)DeviceType.WindowsMobile_6:{ ico = "windows.png"; break;} case (int)DeviceType.Windows:{ ico = "win32.png"; break;} case (int)DeviceType.MacOs:{ ico = "macos.png"; break;} } List<CombinePublish> tmp = lcp.FindAll(x=>x.IsSelected == true); NotebookLabel nl = new NotebookLabel(ico,String.Format("{0} ({1})",deviceName,tmp.Count )); nl.Tag=deviceTyp; if(iOsNoMac){ Label lbl=new Label(MainClass.Languages.Translate("ios_available_Mac")); Pango.FontDescription customFont = Pango.FontDescription.FromString(MainClass.Settings.ConsoleTaskFont); customFont.Weight = Pango.Weight.Bold; lbl.ModifyFont(customFont); notebook.AppendPage(lbl, nl); continue; } if(!validDevice){ Label lbl=new Label(MainClass.Languages.Translate("publish_tool_missing")); Pango.FontDescription customFont = Pango.FontDescription.FromString(MainClass.Settings.ConsoleTaskFont); customFont.Weight = Pango.Weight.Bold; lbl.ModifyFont(customFont); notebook.AppendPage(lbl, nl); continue; } ; CellRendererToggle crt = new CellRendererToggle(); crt.Activatable = true; crt.Sensitive = true; tvList.AppendColumn ("", crt, "active", 0); Gtk.CellRendererText fileNameRenderer = new Gtk.CellRendererText(); Gtk.CellRendererText collumnResolRenderer = new Gtk.CellRendererText(); tvList.AppendColumn(MainClass.Languages.Translate("file_name"),fileNameRenderer, "text", 1); tvList.AppendColumn(MainClass.Languages.Translate("resolution_f1"), collumnResolRenderer, "text", 1); tvList.Columns[1].SetCellDataFunc(fileNameRenderer, new Gtk.TreeCellDataFunc(RenderCombine)); tvList.Columns[2].SetCellDataFunc(collumnResolRenderer, new Gtk.TreeCellDataFunc(RenderResolution)); // povolene resolution pre danu platformu PlatformResolution listPR = MainClass.Settings.PlatformResolutions.Find(x=>x.IdPlatform ==deviceTyp); Device dvc = project.DevicesSettings.Find(x=>x.TargetPlatformId ==deviceTyp); string stringTheme = ""; List<System.IO.DirectoryInfo> themeResolution = new List<System.IO.DirectoryInfo>(); // resolution z adresara themes po novom if((project.NewSkin) && (dvc != null)){ Skin skin =dvc.Includes.Skin; if((skin != null) && ( !String.IsNullOrEmpty(skin.Name)) && (!String.IsNullOrEmpty(skin.Theme)) ){ string skinDir = System.IO.Path.Combine(MainClass.Workspace.RootDirectory, MainClass.Settings.SkinDir); stringTheme = System.IO.Path.Combine(skinDir,skin.Name); stringTheme = System.IO.Path.Combine(stringTheme, "themes"); stringTheme = System.IO.Path.Combine(stringTheme, skin.Theme); if (System.IO.Directory.Exists(stringTheme)){ System.IO.DirectoryInfo di = new System.IO.DirectoryInfo(stringTheme); themeResolution = new List<System.IO.DirectoryInfo>(di.GetDirectories()); } } } crt.Toggled += delegate(object o, ToggledArgs args) { if((deviceTyp == (int)DeviceType.Windows)||(deviceTyp == (int)DeviceType.MacOs)){ if(!MainClass.LicencesSystem.CheckFunction("windowsandmac",this)){ return; } } TreeIter iter; if (ls.GetIter (out iter, new TreePath(args.Path))) { bool old = (bool) ls.GetValue(iter,0); CombinePublish cp =(CombinePublish) ls.GetValue(iter,2); cp.IsSelected = !old; ls.SetValue(iter,0,!old); List<CombinePublish> tmp2 = lcp.FindAll(x=>x.IsSelected == true); nl.SetLabel (String.Format("{0} ({1})",deviceName,tmp2.Count )); //if(dvc == null) return; //if(dvc.Includes == null) return; if(dvc.Includes.Skin == null) return; if(String.IsNullOrEmpty(dvc.Includes.Skin.Name) || String.IsNullOrEmpty(dvc.Includes.Skin.Theme)) return; if(cp.IsSelected){ // Najdem ake je rozlisenie v danej combinacii CombineCondition cc = cp.combineRule.Find(x=>x.ConditionId == MainClass.Settings.Resolution.Id); if(cc == null) return; /// nema ziadne rozlisenie v combinacii int indxResol = themeResolution.FindIndex(x=>x.Name.ToLower() == cc.RuleName.ToLower()); if(indxResol<0){ // theme chyba prislusne rozlisenie string error =String.Format("Invalid {0} Skin and {1} Theme, using in {2}. Missing resolutions: {3}. ",dvc.Includes.Skin.Name,dvc.Includes.Skin.Theme,deviceName,cc.RuleName.ToLower()); MainClass.MainWindow.OutputConsole.WriteError(error+"\n"); List<string> lst = new List<string>(); lst.Add(error); MainClass.MainWindow.ErrorWritte("","",lst); } } } }; int cntOfAdded = 0; foreach (CombinePublish cp in lcp){ bool isValid = cp.IsSelected; if (!validDevice) isValid = false; // Najdem ake je rozlisenie v danej combinacii CombineCondition cc = cp.combineRule.Find(x=>x.ConditionId == MainClass.Settings.Resolution.Id); if(cc == null) continue; /// nema ziadne rozlisenie v combinacii int indx = MainClass.Settings.Resolution.Rules.FindIndex(x=> x.Id == cc.RuleId ); if(indx<0) continue; /// rozlisenie pouzite v danej combinacii nexistuje if(cc!= null){ bool isValidResolution = false; //ak nema definovane ziadne povolenia, tak povolene su vsetky if((listPR==null) || (listPR.AllowResolution == null) || (listPR.AllowResolution.Count<1)){ isValidResolution = true; } else { isValidResolution = listPR.IsValidResolution(cc.RuleId); } if(isValidResolution){ // po novom vyhodom aj tie ktore niesu v adresaru themes - pokial je thema definovana if((project.NewSkin) && (themeResolution.Count > 0)){ //cntResolution = 0; int indxResol = themeResolution.FindIndex(x=>x.Name.ToLower() == cc.RuleName.ToLower()); if(indxResol>-1){ ls.AppendValues(isValid,cp.ProjectName,cp,cp.ProjectName,true); cntOfAdded++; } else { lcpDennied.Add(cp); } } else { ls.AppendValues(isValid,cp.ProjectName,cp,cp.ProjectName,true); cntOfAdded++; } } else { lcpDennied.Add(cp); } } //} } // pridam tie zakazane, ktore su vybrate na publish foreach (CombinePublish cp in lcpDennied){ if(cp.IsSelected){ ls.AppendValues(cp.IsSelected,cp.ProjectName,cp,cp.ProjectName,false); cntOfAdded++; } } if(cntOfAdded == 0){ MainClass.MainWindow.OutputConsole.WriteError(String.Format("Missing publish settings for {0}.\n",deviceName)); } bool showAll = false; tvList.ButtonReleaseEvent += delegate(object o, ButtonReleaseEventArgs args){ if (args.Event.Button == 3) { TreeSelection ts = tvList.Selection; Gtk.TreePath[] selRow = ts.GetSelectedRows(); if(selRow.Length<1){ TreeIter tiFirst= new TreeIter(); ls.GetIterFirst(out tiFirst); tvList.Selection.SelectIter(tiFirst); selRow = ts.GetSelectedRows(); } if(selRow.Length<1) return; Gtk.TreePath tp = selRow[0]; TreeIter ti = new TreeIter(); ls.GetIter(out ti,tp); CombinePublish combinePublish= (CombinePublish)ls.GetValue(ti,2); if(combinePublish!=null){ Menu popupMenu = new Menu(); if(!showAll){ MenuItem miShowDenied = new MenuItem( MainClass.Languages.Translate("show_denied" )); miShowDenied.Activated+= delegate(object sender, EventArgs e) { // odoberem zakazane, ktore sa zobrazuju kedze su zaceknute na publish List<TreeIter> lst= new List<TreeIter>(); ls.Foreach((model, path, iterr) => { bool cp =(bool) ls.GetValue(iterr,4); bool selected =(bool) ls.GetValue(iterr,0); if(!cp && selected){ lst.Add(iterr); } return false; }); foreach(TreeIter ti2 in lst){ TreeIter ti3 =ti2; ls.Remove(ref ti3); } // pridam zakazane if( (lcpDennied==null) || (lcpDennied.Count<1)) return; foreach (CombinePublish cp in lcpDennied){ ls.AppendValues(cp.IsSelected,cp.ProjectName,cp,cp.ProjectName,false); } showAll = true; }; popupMenu.Append(miShowDenied); } else { MenuItem miHideDenied = new MenuItem( MainClass.Languages.Translate("hide_denied" )); miHideDenied.Activated+= delegate(object sender, EventArgs e) { List<TreeIter> lst= new List<TreeIter>(); ls.Foreach((model, path, iterr) => { bool cp =(bool) ls.GetValue(iterr,4); bool selected =(bool) ls.GetValue(iterr,0); if(!cp && !selected){ lst.Add(iterr); } return false; }); foreach(TreeIter ti2 in lst){ TreeIter ti3 =ti2; ls.Remove(ref ti3); } showAll = false; }; popupMenu.Append(miHideDenied); } popupMenu.Append(new SeparatorMenuItem()); MenuItem miCheckAll = new MenuItem( MainClass.Languages.Translate("check_all" )); miCheckAll.Activated+= delegate(object sender, EventArgs e) { if((deviceTyp == (int)DeviceType.Windows)||(deviceTyp == (int)DeviceType.MacOs)){ if(!MainClass.LicencesSystem.CheckFunction("windowsandmac",this)){ return; } } int cnt = 0; ls.Foreach((model, path, iterr) => { CombinePublish cp =(CombinePublish) ls.GetValue(iterr,2); cp.IsSelected = true; ls.SetValue(iterr,0,true); cnt ++; return false; }); nl.SetLabel (String.Format("{0} ({1})",deviceName,cnt )); }; popupMenu.Append(miCheckAll); MenuItem miUnCheckAll = new MenuItem( MainClass.Languages.Translate("uncheck_all" )); miUnCheckAll.Activated+= delegate(object sender, EventArgs e) { ls.Foreach((model, path, iterr) => { CombinePublish cp =(CombinePublish) ls.GetValue(iterr,2); cp.IsSelected = false; ls.SetValue(iterr,0,false); return false; }); nl.SetLabel (String.Format("{0} ({1})",deviceName,0 )); }; popupMenu.Append(miUnCheckAll); popupMenu.Popup(); popupMenu.ShowAll(); } } }; tvList.Model = ls; if (!validDevice) tvList.Sensitive = false; sw.Add(tvList); notebook.AppendPage(sw, nl); } }
public Widget CreateBuildResultsWidget(Orientation orientation) { EventBox ebox = new EventBox (); Gtk.Box box; if (orientation == Orientation.Horizontal) box = new HBox (); else box = new VBox (); box.Spacing = 3; var errorIcon = ImageService.GetIcon (StockIcons.Error).WithSize (Xwt.IconSize.Small); var warningIcon = ImageService.GetIcon (StockIcons.Warning).WithSize (Xwt.IconSize.Small); var errorImage = new Xwt.ImageView (errorIcon); var warningImage = new Xwt.ImageView (warningIcon); box.PackStart (errorImage.ToGtkWidget (), false, false, 0); Label errors = new Gtk.Label (); box.PackStart (errors, false, false, 0); box.PackStart (warningImage.ToGtkWidget (), false, false, 0); Label warnings = new Gtk.Label (); box.PackStart (warnings, false, false, 0); box.NoShowAll = true; box.Show (); TaskEventHandler updateHandler = delegate { int ec=0, wc=0; foreach (Task t in TaskService.Errors) { if (t.Severity == TaskSeverity.Error) ec++; else if (t.Severity == TaskSeverity.Warning) wc++; } using (var font = FontService.SansFont.CopyModified (0.8d)) { errors.Visible = ec > 0; errors.ModifyFont (font); errors.Text = ec.ToString (); errorImage.Visible = ec > 0; warnings.Visible = wc > 0; warnings.ModifyFont (font); warnings.Text = wc.ToString (); warningImage.Visible = wc > 0; } ebox.Visible = ec > 0 || wc > 0; UpdateSeparators (); }; updateHandler (null, null); TaskService.Errors.TasksAdded += updateHandler; TaskService.Errors.TasksRemoved += updateHandler; box.Destroyed += delegate { TaskService.Errors.TasksAdded -= updateHandler; TaskService.Errors.TasksRemoved -= updateHandler; }; ebox.VisibleWindow = false; ebox.Add (box); ebox.ShowAll (); ebox.ButtonReleaseEvent += delegate { var pad = IdeApp.Workbench.GetPad<MonoDevelop.Ide.Gui.Pads.ErrorListPad> (); pad.BringToFront (); }; errors.Visible = false; errorImage.Visible = false; warnings.Visible = false; warningImage.Visible = false; return ebox; }
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(); }
/// <summary>Add a button to the button bar</summary> /// <param name="text">Text for button</param> /// <param name="image">Image for button</param> /// <param name="handler">Handler to call when user clicks on button</param> public void AddButton(string text, Image image, EventHandler handler) { if (ButtonsAreToolbar) { if (btnToolbar == null) { btnToolbar = new Toolbar(); btnToolbar.ToolbarStyle = ToolbarStyle.Both; buttonPanel.PackStart(btnToolbar, true, true, 0); } ToolButton button = new ToolButton(image, null); button.Homogeneous = false; Label btnLabel = new Label(text); Pango.FontDescription font = new Pango.FontDescription(); font.Size = (int)(8 * Pango.Scale.PangoScale); btnLabel.ModifyFont(font); btnLabel.LineWrap = true; btnLabel.LineWrapMode = Pango.WrapMode.Word; btnLabel.Justify = Justification.Center; btnLabel.HeightRequest = 38; btnLabel.WidthRequest = 80; btnLabel.Realized += BtnLabel_Realized; button.LabelWidget = btnLabel; if (handler != null) button.Clicked += handler; btnToolbar.Add(button); } else { Button button = new Button(text); button.Image = image; button.Clicked += handler; button.BorderWidth = 5; if (image != null) { button.ImagePosition = PositionType.Top; image.Show(); } buttonPanel.PackStart(button, false, false, 0); } buttonPanel.ShowAll(); }
private void build() { this.Title = "New Battlelords Character"; { // page 1 - intro Gtk.TextView tv = new Gtk.TextView(); Gtk.TextBuffer tb; tb = tv.Buffer; //tb.Text = MediaManager.GetHtml("intro.html"); tb.Text = "Welcome to the Battlelords Character Asistant.\n" + "\nThis will guide you thru the initial player character generation. " + "You will be presented with some initial options that can not change " + "once the character is created. " + "\nStep 1" + "\nStep 2" + "\nStep 3" + "\nStep 4" + "\nConculsion"; tv.WrapMode = WrapMode.Word; tv.Editable = false; this.AppendPage(tv); this.SetPageTitle(tv, "Introduction"); this.SetPageType(tv, AssistantPageType.Intro); this.SetPageComplete(tv, true); } { // page 2 - rolling method string method1 = "Percentile dice are rolled and marked down in order of the given visual statistics. " + "Eight rolls are initially made. The player then makes three additional dice rolls. " + "He has the option of replacing any three previously rolled statistics with one of these number. " + "Players may not move rolls around! First roll is Strength, second roll is Manual Dexterity, etc."; Gtk.VBox vb = new Gtk.VBox(); Gtk.HBox hb1 = new Gtk.HBox(); Gtk.Label lb1 = new Gtk.Label("Rolling Method"); string[] entries = {"Method 1", "Method 2", "Method 3", "Fill In"}; Gtk.ComboBox cb1 = new Gtk.ComboBox(entries); hb1.PackStart(lb1, true, false , 0); hb1.PackEnd(cb1, true, false, 0); cb1.Active = 0; Gtk.HBox hb2 = new Gtk.HBox(); Gtk.CheckButton b1 = new Gtk.CheckButton("Max Body Points"); Gtk.CheckButton b2 = new Gtk.CheckButton("Max Starting Money"); b1.Active = true; b2.Active = true; hb2.PackStart(b1, true, false, 1); hb2.PackEnd(b2, true, false, 1); Gtk.ScrolledWindow sw = new Gtk.ScrolledWindow(); Gtk.TextView tv = new Gtk.TextView(); tv.WrapMode = WrapMode.Word; tv.Editable = false; Gtk.TextBuffer tb = tv.Buffer; tb.Text = method1; sw.Add(tv); //vb.PackStart(hb1, false, false, 0); vb.PackStart(hb2, false, false, 0); //vb.PackEnd(sw, true, true, 0); this.AppendPage(vb); this.SetPageTitle(vb, "Rolling Options"); this.SetPageType(vb, AssistantPageType.Content); this.SetPageComplete(vb, true); } { // page 3 - race TreeStore ts = new TreeStore(typeof(string), typeof(string)); foreach (BattlelordsRace r in this.session.Races) { ts.AppendValues(r.Name, r.Name); } TreeView tv = new TreeView(ts); tv.HeadersVisible = true; tv.AppendColumn("Battlelords Race", new CellRendererText(), "text", 0); this.AppendPage(tv); this.SetPageTitle(tv, "Select Race"); this.SetPageType(tv, AssistantPageType.Content); this.SetPageComplete(tv, true); } { // page 4 - Basics page /* * 1 char name * 2 player name * 3 height * 4 weight * 5 body pts * 6 start money */ Gtk.VBox vb2 = new Gtk.VBox(); Gtk.HBox hb1 = new Gtk.HBox(); Gtk.Label lb1 = new Gtk.Label("Player's Name:"); Gtk.Entry en1 = new Gtk.Entry(); hb1.PackStart(lb1, false, false, 0); hb1.PackStart(new Gtk.HSeparator(), true, false, 0); hb1.PackEnd(en1, true, true, 0); Gtk.HBox hb2 = new Gtk.HBox(); Gtk.Label lb2 = new Gtk.Label("Character's Name:"); Gtk.Entry en2 = new Gtk.Entry(); hb2.PackStart(lb2, false, false, 0); hb2.PackStart(new Gtk.HSeparator(), true, false, 0); hb2.PackEnd(en2, true, true, 0); Gtk.HBox hb3 = new Gtk.HBox(); Gtk.Label lb3 = new Gtk.Label("Height (ft):"); Gtk.Entry en3 = new Gtk.Entry(); en3.Sensitive = false; Gtk.Button b3 = new Gtk.Button(); //b3.Label = "roll"; b3.TooltipText = "Click here to roll height."; b3.Image = MediaManager.GetImageFromBaseFile("dice.png"); hb3.PackStart(lb3, false, false, 0); hb3.PackStart(new Gtk.HSeparator(), true, false, 0); hb3.PackStart(en3, true, true, 0); hb3.PackEnd(b3, false, false, 0); Gtk.HBox hb4 = new Gtk.HBox(); Gtk.Label lb4 = new Gtk.Label("Weight (lbs):"); Gtk.Entry en4 = new Gtk.Entry(); en4.Sensitive = false; Gtk.Button b4 = new Gtk.Button(); //b4.Label = "roll"; b4.TooltipText = "Click here to roll for weight."; b4.Image = MediaManager.GetImageFromBaseFile("dice.png"); hb4.PackStart(lb4, false, false, 0); hb4.PackStart(new Gtk.HSeparator(), true, false, 0); hb4.PackStart(en4, true, true, 0); hb4.PackEnd(b4, false, false, 0); Gtk.HBox hb5 = new Gtk.HBox(); Gtk.Label lb5 = new Gtk.Label("Body Points:"); Gtk.Entry en5 = new Gtk.Entry(); en5.Sensitive = false; Gtk.Button b5 = new Gtk.Button(); b5.TooltipText = "Click here to roll for body points."; b5.Image = MediaManager.GetImageFromBaseFile("dice.png"); hb5.PackStart(lb5, false, false, 0); hb5.PackStart(new Gtk.HSeparator(), true, false, 0); hb5.PackStart(en5, true, true, 0); hb5.PackEnd(b5, false, false, 0); Gtk.HBox hb6 = new Gtk.HBox(); Gtk.Label lb6 = new Gtk.Label("Starting Money:"); Gtk.Entry en6 = new Gtk.Entry(); en6.Sensitive = false; Gtk.Button b6 = new Gtk.Button(); b6.TooltipText = "Click here to roll for starting money."; b6.Image = MediaManager.GetImageFromBaseFile("dice.png"); hb6.PackStart(lb6, false, false, 0); hb6.PackStart(new Gtk.HSeparator(), true, false, 0); hb6.PackStart(en6, true, true, 0); hb6.PackEnd(b6, false, false, 0); vb2.PackStart(hb1, false, false, 0); vb2.PackStart(hb2, false, false, 0); vb2.PackStart(hb3, false, false, 0); vb2.PackStart(hb4, false, false, 0); vb2.PackStart(hb5, false, false, 0); vb2.PackStart(hb6, false, false, 0); this.AppendPage(vb2); this.SetPageTitle(vb2, "Enter Basic Information"); this.SetPageType(vb2, AssistantPageType.Content); this.SetPageComplete(vb2, true); } { // page 5 - vitals VBox vb5 = new VBox(); Gtk.Notebook nb = new Gtk.Notebook(); //Battle.Gui.VitalsControl stvc = new Battle.Gui.VitalsControl(this.session); //stvc.Sensitive = false; VitalsControl m1vitals = new VitalsControl(this.session); VitalsControl m2vitals = new VitalsControl(this.session); VitalsControl m3vitals = new VitalsControl(this.session); VitalsControl fillvitals = new VitalsControl(this.session); m1vitals.Enabled = false; m2vitals.Enabled = false; m3vitals.Enabled = false; nb.AppendPage(m1vitals, new Gtk.Label("Method 1")); nb.AppendPage(m2vitals, new Gtk.Label("Method 2")); nb.AppendPage(m3vitals, new Gtk.Label("Method 3")); nb.AppendPage(fillvitals, new Gtk.Label("Fill In")); HButtonBox bb5 = new HButtonBox(); Button rollBtn = new Button(Stock.Execute); rollBtn.Clicked += delegate(object sender, EventArgs e) { Console.WriteLine("{0}", sender.GetType().ToString()); }; rollBtn.Label = "Roll"; Button saveBtn = new Button(Stock.Save); saveBtn.Label = "Save"; bb5.PackStart(rollBtn); bb5.PackEnd(saveBtn); nb.SwitchPage += delegate(object o, SwitchPageArgs args) { if (args.PageNum == 3) { rollBtn.Sensitive = false; } else { rollBtn.Sensitive = true; } }; vb5.Add(nb); vb5.Add(bb5); this.AppendPage(vb5); this.SetPageTitle(vb5, "Enter Vitals"); this.SetPageType(vb5, AssistantPageType.Content); this.SetPageComplete(vb5, true); } { // page 6 - secondaries Gtk.Label not_completed_label = new Gtk.Label("not completed"); Pango.FontDescription d = new Pango.FontDescription(); d.Style = Pango.Style.Italic; not_completed_label.ModifyFont(d); this.AppendPage(not_completed_label); this.SetPageTitle(not_completed_label, "Enter Secondary Attributes"); this.SetPageType(not_completed_label, AssistantPageType.Content); this.SetPageComplete(not_completed_label, true); } { // page 7 - fate Gtk.Label not_completed_label = new Gtk.Label("not completed"); Pango.FontDescription d = new Pango.FontDescription(); d.Style = Pango.Style.Italic; not_completed_label.ModifyFont(d); this.AppendPage(not_completed_label); this.SetPageTitle(not_completed_label, "Determine Fate"); this.SetPageType(not_completed_label, AssistantPageType.Content); this.SetPageComplete(not_completed_label, true); } { // page 8 - social Gtk.Label not_completed_label = new Gtk.Label("not completed"); Pango.FontDescription d = new Pango.FontDescription(); d.Style = Pango.Style.Italic; not_completed_label.ModifyFont(d); this.AppendPage(not_completed_label); this.SetPageTitle(not_completed_label, "Social Status"); this.SetPageType(not_completed_label, AssistantPageType.Content); this.SetPageComplete(not_completed_label, true); } { // page 9 - skills Gtk.Label not_completed_label = new Gtk.Label("not completed"); Pango.FontDescription d = new Pango.FontDescription(); d.Style = Pango.Style.Italic; not_completed_label.ModifyFont(d); this.AppendPage(not_completed_label); this.SetPageTitle(not_completed_label, "Choose Initial Skills"); this.SetPageType(not_completed_label, AssistantPageType.Content); this.SetPageComplete(not_completed_label, true); } { // page 10 - matrixes Gtk.Label not_completed_label = new Gtk.Label("not completed"); Pango.FontDescription d = new Pango.FontDescription(); d.Style = Pango.Style.Italic; not_completed_label.ModifyFont(d); this.AppendPage(not_completed_label); this.SetPageTitle(not_completed_label, "Choose Initial Matrixes"); this.SetPageType(not_completed_label, AssistantPageType.Content); this.SetPageComplete(not_completed_label, true); } { // page 11 - confirm TextView tv11 = new TextView(); TextBuffer b11 = tv11.Buffer; b11.Text = "Confirm this new character."; tv11.Editable = false; this.AppendPage(tv11); this.SetPageTitle(tv11, "Confirm New Character"); this.SetPageType(tv11, AssistantPageType.Confirm); this.SetPageComplete(tv11, true); } this.Close += HandleHandleClose; this.Cancel += HandleHandleCancel; this.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 Widget CreateBuildResultsWidget(Orientation orientation) { EventBox ebox = new EventBox(); Gtk.Box box; if (orientation == Orientation.Horizontal) { box = new HBox(); } else { box = new VBox(); } box.Spacing = 3; var errorIcon = ImageService.GetIcon(StockIcons.Error).WithSize(Xwt.IconSize.Small); var warningIcon = ImageService.GetIcon(StockIcons.Warning).WithSize(Xwt.IconSize.Small); var errorImage = new Xwt.ImageView(errorIcon); var warningImage = new Xwt.ImageView(warningIcon); box.PackStart(errorImage.ToGtkWidget(), false, false, 0); Label errors = new Gtk.Label(); box.PackStart(errors, false, false, 0); box.PackStart(warningImage.ToGtkWidget(), false, false, 0); Label warnings = new Gtk.Label(); box.PackStart(warnings, false, false, 0); box.NoShowAll = true; box.Show(); TaskEventHandler updateHandler = delegate { int ec = 0, wc = 0; foreach (Task t in TaskService.Errors) { if (t.Severity == TaskSeverity.Error) { ec++; } else if (t.Severity == TaskSeverity.Warning) { wc++; } } using (var font = FontService.SansFont.CopyModified(0.8d)) { errors.Visible = ec > 0; errors.ModifyFont(font); errors.Text = ec.ToString(); errorImage.Visible = ec > 0; warnings.Visible = wc > 0; warnings.ModifyFont(font); warnings.Text = wc.ToString(); warningImage.Visible = wc > 0; } ebox.Visible = ec > 0 || wc > 0; UpdateSeparators(); }; updateHandler(null, null); TaskService.Errors.TasksAdded += updateHandler; TaskService.Errors.TasksRemoved += updateHandler; box.Destroyed += delegate { TaskService.Errors.TasksAdded -= updateHandler; TaskService.Errors.TasksRemoved -= updateHandler; }; ebox.VisibleWindow = false; ebox.Add(box); ebox.ShowAll(); ebox.ButtonReleaseEvent += delegate { var pad = IdeApp.Workbench.GetPad <MonoDevelop.Ide.Gui.Pads.ErrorListPad> (); pad.BringToFront(); }; errors.Visible = false; errorImage.Visible = false; warnings.Visible = false; warningImage.Visible = false; return(ebox); }
Widget CreateButton(WelcomeButton b) { Button button; VBox box; Gtk.Image image; Gtk.Alignment alignment; Label label; if (b.Icon == null) { image = new Gtk.Image ( Helpers.Misc.LoadIcon (b.Name, StyleConf.WelcomeIconImageSize, 0)); } else { image = new Gtk.Image (b.Icon.Value); } button = new Button (); button.Clicked += (sender, e) => (b.Func ()); button.HeightRequest = StyleConf.WelcomeIconSize; button.WidthRequest = StyleConf.WelcomeIconSize; button.Add (image); if (buttonWidgets.Count == 0) { button.Realized += (sender, e) => button.GrabFocus (); } alignment = new Alignment (0.5f, 0.5f, 0.0f, 0.0f); alignment.Add (button); label = new Label (b.Text); label.ModifyFont (Pango.FontDescription.FromString ("Ubuntu 12")); label.LineWrap = true; label.LineWrapMode = Pango.WrapMode.Word; label.Justify = Justification.Center; sizegroup.AddWidget (label); box = new VBox (false, StyleConf.WelcomeIconsTextSpacing); box.PackStart (alignment, false, false, 0); box.PackStart (label, false, false, 0); box.Name = b.Name + "roundedbutton"; return box; }
public void SetFont(FontDescription fontDescription) { _entry.ModifyFont(fontDescription); _placeholder.ModifyFont(fontDescription); }
void Build () { BorderWidth = 0; WidthRequest = 901; HeightRequest = 632; Name = "wizard_dialog"; Title = GettextCatalog.GetString ("New Project"); WindowPosition = WindowPosition.CenterOnParent; TransientFor = IdeApp.Workbench.RootWindow; projectConfigurationWidget = new GtkProjectConfigurationWidget (); projectConfigurationWidget.Name = "projectConfigurationWidget"; // Top banner of dialog. var topLabelEventBox = new EventBox (); topLabelEventBox.Name = "topLabelEventBox"; topLabelEventBox.HeightRequest = 52; topLabelEventBox.ModifyBg (StateType.Normal, bannerBackgroundColor); topLabelEventBox.ModifyFg (StateType.Normal, whiteColor); topLabelEventBox.BorderWidth = 0; var topBannerTopEdgeLineEventBox = new EventBox (); topBannerTopEdgeLineEventBox.Name = "topBannerTopEdgeLineEventBox"; topBannerTopEdgeLineEventBox.HeightRequest = 1; topBannerTopEdgeLineEventBox.ModifyBg (StateType.Normal, bannerLineColor); topBannerTopEdgeLineEventBox.BorderWidth = 0; var topBannerBottomEdgeLineEventBox = new EventBox (); topBannerBottomEdgeLineEventBox.Name = "topBannerBottomEdgeLineEventBox"; topBannerBottomEdgeLineEventBox.HeightRequest = 1; topBannerBottomEdgeLineEventBox.ModifyBg (StateType.Normal, bannerLineColor); topBannerBottomEdgeLineEventBox.BorderWidth = 0; topBannerLabel = new Label (); topBannerLabel.Name = "topBannerLabel"; Pango.FontDescription font = topBannerLabel.Style.FontDescription.Copy (); // UNDONE: VV: Use FontService? font.Size = (int)(font.Size * 1.8); topBannerLabel.ModifyFont (font); topBannerLabel.ModifyFg (StateType.Normal, whiteColor); var topLabelHBox = new HBox (); topLabelHBox.Name = "topLabelHBox"; topLabelHBox.PackStart (topBannerLabel, false, false, 20); topLabelEventBox.Add (topLabelHBox); VBox.PackStart (topBannerTopEdgeLineEventBox, false, false, 0); VBox.PackStart (topLabelEventBox, false, false, 0); VBox.PackStart (topBannerBottomEdgeLineEventBox, false, false, 0); // Main templates section. centreVBox = new VBox (); centreVBox.Name = "centreVBox"; VBox.PackStart (centreVBox, true, true, 0); templatesHBox = new HBox (); templatesHBox.Name = "templatesHBox"; centreVBox.PackEnd (templatesHBox, true, true, 0); // Template categories. var templateCategoriesBgBox = new EventBox (); templateCategoriesBgBox.Name = "templateCategoriesVBox"; templateCategoriesBgBox.BorderWidth = 0; templateCategoriesBgBox.ModifyBg (StateType.Normal, categoriesBackgroundColor); templateCategoriesBgBox.WidthRequest = 220; var templateCategoriesScrolledWindow = new ScrolledWindow (); templateCategoriesScrolledWindow.Name = "templateCategoriesScrolledWindow"; templateCategoriesScrolledWindow.HscrollbarPolicy = PolicyType.Never; // Template categories tree view. templateCategoriesTreeView = new TreeView (); templateCategoriesTreeView.Name = "templateCategoriesTreeView"; templateCategoriesTreeView.BorderWidth = 0; templateCategoriesTreeView.HeadersVisible = false; templateCategoriesTreeView.Model = templateCategoriesListStore; templateCategoriesTreeView.SearchColumn = -1; // disable the interactive search templateCategoriesTreeView.AppendColumn (CreateTemplateCategoriesTreeViewColumn ()); templateCategoriesScrolledWindow.Add (templateCategoriesTreeView); templateCategoriesBgBox.Add (templateCategoriesScrolledWindow); templatesHBox.PackStart (templateCategoriesBgBox, false, false, 0); // Templates. var templatesBgBox = new EventBox (); templatesBgBox.ModifyBg (StateType.Normal, templateListBackgroundColor); templatesBgBox.Name = "templatesVBox"; templatesBgBox.WidthRequest = 400; templatesHBox.PackStart (templatesBgBox, false, false, 0); var templatesScrolledWindow = new ScrolledWindow (); templatesScrolledWindow.Name = "templatesScrolledWindow"; templatesScrolledWindow.HscrollbarPolicy = PolicyType.Never; // Templates tree view. templatesTreeView = new TreeView (); templatesTreeView.Name = "templatesTreeView"; templatesTreeView.HeadersVisible = false; templatesTreeView.Model = templatesListStore; templatesTreeView.SearchColumn = -1; // disable the interactive search templatesTreeView.AppendColumn (CreateTemplateListTreeViewColumn ()); templatesScrolledWindow.Add (templatesTreeView); templatesBgBox.Add (templatesScrolledWindow); // Template var templateEventBox = new EventBox (); templateEventBox.Name = "templateEventBox"; templateEventBox.ModifyBg (StateType.Normal, templateBackgroundColor); templatesHBox.PackStart (templateEventBox, true, true, 0); templateVBox = new VBox (); templateVBox.Visible = false; templateVBox.BorderWidth = 20; templateVBox.Spacing = 10; templateEventBox.Add (templateVBox); // Template large image. templateImage = new ImageView (); templateImage.Name = "templateImage"; templateImage.HeightRequest = 140; templateImage.WidthRequest = 240; templateVBox.PackStart (templateImage, false, false, 10); // Template description. templateNameLabel = new Label (); templateNameLabel.Name = "templateNameLabel"; templateNameLabel.WidthRequest = 240; templateNameLabel.Wrap = true; templateNameLabel.Xalign = 0; templateNameLabel.Markup = MarkupTemplateName ("TemplateName"); templateVBox.PackStart (templateNameLabel, false, false, 0); templateDescriptionLabel = new Label (); templateDescriptionLabel.Name = "templateDescriptionLabel"; templateDescriptionLabel.WidthRequest = 240; templateDescriptionLabel.Wrap = true; templateDescriptionLabel.Xalign = 0; templateVBox.PackStart (templateDescriptionLabel, false, false, 0); templateVBox.PackStart (new Label (), true, true, 0); // Template - button separator. var templateSectionSeparatorEventBox = new EventBox (); templateSectionSeparatorEventBox.Name = "templateSectionSeparatorEventBox"; templateSectionSeparatorEventBox.HeightRequest = 1; templateSectionSeparatorEventBox.ModifyBg (StateType.Normal, templateSectionSeparatorColor); VBox.PackStart (templateSectionSeparatorEventBox, false, false, 0); // Buttons at bottom of dialog. var bottomHBox = new HBox (); bottomHBox.Name = "bottomHBox"; VBox.PackStart (bottomHBox, false, false, 0); // Cancel button - bottom left. var cancelButtonBox = new HButtonBox (); cancelButtonBox.Name = "cancelButtonBox"; cancelButtonBox.BorderWidth = 16; cancelButton = new Button (); cancelButton.Name = "cancelButton"; cancelButton.Label = "gtk-cancel"; cancelButton.UseStock = true; cancelButtonBox.PackStart (cancelButton, false, false, 0); bottomHBox.PackStart (cancelButtonBox, false, false, 0); // Previous button - bottom right. var previousNextButtonBox = new HButtonBox (); previousNextButtonBox.Name = "previousNextButtonBox"; previousNextButtonBox.BorderWidth = 16; previousNextButtonBox.Spacing = 9; bottomHBox.PackStart (previousNextButtonBox); previousNextButtonBox.Layout = ButtonBoxStyle.End; previousButton = new Button (); previousButton.Name = "previousButton"; previousButton.Label = GettextCatalog.GetString ("Previous"); previousButton.Sensitive = false; previousNextButtonBox.PackEnd (previousButton); // Next button - bottom right. nextButton = new Button (); nextButton.Name = "nextButton"; nextButton.Label = GettextCatalog.GetString ("Next"); previousNextButtonBox.PackEnd (nextButton); // Remove default button action area. VBox.Remove (ActionArea); if (Child != null) { Child.ShowAll (); } Show (); templatesTreeView.HasFocus = true; Resizable = false; }