private TextView textView; // Textview to hold landmark information. #endregion Fields #region Constructors /// <summary> /// Initializes a new instance of the <see cref="SLAM.MapWindow"/> class. /// </summary> /// <param name="mapView">Map view contained in this window.</param> public MapWindow(MapView mapView) : base("Map") { robot = mapView.RobotView.Robot; this.mapView = mapView; // Subscribe to events. mapView.MapModel.MapUpdated += new EventHandler<MapUpdateEventArgs> (Map_Update); mapView.RobotView.Robot.RobotUpdated += new EventHandler<RobotUpdateEventArgs> (Robot_Update); SetPosition (WindowPosition.Center); Resizable = false; DeleteEvent += delegate { Application.Quit (); }; TextBuffer textBuffer = new TextBuffer (new TextTagTable ()); textView = new TextView (); textView.Indent = 10; textView.Editable = false; textView.Buffer = textBuffer; textView.CursorVisible = false; textView.SetSizeRequest (mapView.ViewWidth, 150); foreach (Landmark landmark in mapView.MapModel.Landmarks) { this.textView.Buffer.Text += landmark.ToString (); } ScrolledWindow scrolledWindow = new ScrolledWindow (); scrolledWindow.Add (textView); commandEntry = new Entry (); commandEntry.Activated += CommandEntry_OnActivated; sendButton = new Button ("Send"); sendButton.Clicked += SendButton_OnClick; HBox hbox = new HBox (false, 0); hbox.Add (commandEntry); hbox.Add (sendButton); VBox vbox = new VBox (false, 0); vbox.Add (this.mapView); vbox.Add (scrolledWindow); vbox.Add (hbox); Add (vbox); Shown += OnShown; }
private Gtk.Widget MakeEditPage() { Gtk.VBox vbox = new Gtk.VBox(false, 0); vbox.BorderWidth = 6; Gtk.ScrolledWindow sw = new Gtk.ScrolledWindow(); sw.ShadowType = Gtk.ShadowType.EtchedIn; sw.HscrollbarPolicy = Gtk.PolicyType.Automatic; sw.VscrollbarPolicy = Gtk.PolicyType.Automatic; textView = new Gtk.TextView(); textView.WrapMode = Gtk.WrapMode.Word; textView.Editable = true; textView.Buffer.Text = text; textView.CanFocus = true; textView.NoShowAll = true; textView.SetSizeRequest(-1, 60); sw.Add(textView); sw.Show(); vbox.PackStart(sw, true, true, 0); Gtk.HButtonBox hButtonBox = new Gtk.HButtonBox(); hButtonBox.Layout = Gtk.ButtonBoxStyle.End; cancelButton = new Gtk.Button(Gtk.Stock.Cancel); cancelButton.Clicked += OnEditCanceled; cancelButton.NoShowAll = true; hButtonBox.PackStart(cancelButton, false, false, 0); saveButton = new Gtk.Button(Gtk.Stock.Save); saveButton.Clicked += OnSaveButtonClicked; saveButton.NoShowAll = true; hButtonBox.PackStart(saveButton, false, false, 0); hButtonBox.Show(); vbox.PackStart(hButtonBox, false, false, 6); vbox.Show(); return(vbox); }
private Gtk.Widget MakeEditPage() { Gtk.VBox vbox = new Gtk.VBox (false, 0); vbox.BorderWidth = 6; Gtk.ScrolledWindow sw = new Gtk.ScrolledWindow (); sw.ShadowType = Gtk.ShadowType.EtchedIn; sw.HscrollbarPolicy = Gtk.PolicyType.Automatic; sw.VscrollbarPolicy = Gtk.PolicyType.Automatic; textView = new Gtk.TextView (); textView.WrapMode = Gtk.WrapMode.Word; textView.Editable = true; textView.Buffer.Text = text; textView.CanFocus = true; textView.NoShowAll = true; textView.SetSizeRequest (-1, 60); sw.Add (textView); sw.Show (); vbox.PackStart (sw, true, true, 0); Gtk.HButtonBox hButtonBox = new Gtk.HButtonBox (); hButtonBox.Layout = Gtk.ButtonBoxStyle.End; cancelButton = new Gtk.Button (Gtk.Stock.Cancel); cancelButton.Clicked += OnEditCanceled; cancelButton.NoShowAll = true; hButtonBox.PackStart (cancelButton, false, false, 0); saveButton = new Gtk.Button (Gtk.Stock.Save); saveButton.Clicked += OnSaveButtonClicked; saveButton.NoShowAll = true; hButtonBox.PackStart (saveButton, false, false, 0); hButtonBox.Show (); vbox.PackStart (hButtonBox, false, false, 6); vbox.Show (); return vbox; }
/// <summary> /// See SwitchContentView. /// This is an awkward solution and should be refactored. /// The only other way I can think if is creating two different /// EventHandlers, and they call with different parameters which /// Label and TextView to switch (Content or Title). /// </summary> /// <param name='edit'> /// If true, paint a TextView that can be edited. /// If false, paint a Label that displays memo. /// </param> public void SwitchTitleView(bool edit) { if (edit) { // Removing the label _titleLabelListener.Destroy(); // Setting up the textview _titleTextView = new TextView (); _titleTextView.FocusInEvent += new FocusInEventHandler(MemoTextViewGotFocus); _titleTextView.FocusOutEvent += new FocusOutEventHandler(MemoTitleTextViewLostFocus); TextBuffer contentBuffer = _titleTextView.Buffer; contentBuffer.Text = this._item.GetTitle(); _titleTextView.SetSizeRequest (200, 140); _titleTextView.Justification = Justification.Fill; _titleTextView.WrapMode = WrapMode.Word; _titleAlignment.Add (_titleTextView); _titleTextView.GrabFocus(); } else { // Saving information from textview and removing it this._item.SetTitle(_titleTextView.Buffer.Text); Console.WriteLine ("Setting memo title to " + _titleTextView.Buffer.Text); _titleTextView.Destroy(); // Creating label _titleLabel = new Label(); _titleLabel.Text = this._item.GetTitle (); _titleLabel.SetSizeRequest (200, 80); _titleLabel.SetAlignment (0, 0); _titleLabel.LineWrap = true; _titleLabel.Justify = Justification.Fill; // Label listener _titleLabelListener = new EventBox (); _titleLabelListener.ButtonPressEvent += new ButtonPressEventHandler (MemoTitlePressHandler); _titleLabelListener.Add (_titleLabel); _titleLabelListener.SetSizeRequest(200, 80); _titleAlignment.Add (_titleLabelListener); } this._container.ShowAll(); }
public MessageDialog(ArrayList list) : base(WindowType.Toplevel) { Title = "Error"; IconName = "dialog-error"; DeleteEvent += OnClose; Resizable = false; BorderWidth = 6; vbox = new VBox(false, 6); Add(vbox); hbox = new HBox(false, 6); vbox.PackStart(hbox); image = new Image(Stock.DialogError, IconSize.Dialog); hbox.PackStart(image); table = new Table(2, 3, false); table.RowSpacing = 6; hbox.PackEnd(table); label = new Label(); label.Markup = "<big><b>Some feeds failed to import</b></big>"; table.Attach(label, 1, 2, 0, 1); buffer = new TextBuffer(new TextTagTable()); foreach ( string feed in list ) { buffer.Text = buffer.Text + feed+"\n";; } textview = new TextView(buffer); textview.Editable = false; textview.WrapMode = WrapMode.Word; textview.SetSizeRequest(400, 150); textviewsw = new ScrolledWindow(new Adjustment(0, 0, 0, 0, 0, 0), new Adjustment(0, 0, 0, 0, 0, 0)); textviewsw.ShadowType = ShadowType.In; textviewsw.SetPolicy(PolicyType.Automatic, PolicyType.Automatic); textviewsw.Add(textview); table.Attach(textviewsw, 1, 2, 1, 2); bbox = new HButtonBox(); bbox.Layout = ButtonBoxStyle.End; bbox.Spacing = 6; vbox.PackEnd(bbox); close_button = new Button(Stock.Close); close_button.Clicked += new EventHandler(OnClose); bbox.PackStart(close_button); TransientFor = (Browser)Summa.Core.Application.Browsers[0]; }