public WindowView(Main _view, Controller.Window _ctl) { View = _view; Window = _ctl; Homogeneous = false; Spacing = 0; BorderWidth = 0; var topLevelBox = new Gtk.VBox(); topLevelBox.Homogeneous = false; topLevelBox.Spacing = 0; topLevelBox.BorderWidth = 0; textView = new WindowTextView(Window); scroll = new Gtk.ScrolledWindow { HscrollbarPolicy = Gtk.PolicyType.Automatic, VscrollbarPolicy = Gtk.PolicyType.Automatic }; scroll.Add(textView); Window.CursorMovedByCommand.Add(i => { textView.ScrollToIter(i.GtkIter, 0, false, 0, 0); }); topLevelBox.PackStart(scroll, true, true, 0); status = new Gtk.Statusbar(); status.HasResizeGrip = false; status.Push(StatusbarMode, Window.CurrentMode.GetName()); Window.CurrentMode.Event.Changed += m => { status.Pop(StatusbarMode); status.Push(StatusbarMode, Window.CurrentMode.GetName()); }; Window.Model.Changed += m => { textView.Buffer = m; }; topLevelBox.PackStart(status, false, false, 0); // Wrap the topLevelBox with borders on the left and right var hlBox = new Gtk.DrawingArea(); NormalColor = hlBox.Style.Background(Gtk.StateType.Normal); hlBox.WidthRequest = 10; var borderBox = new Gtk.HBox(); borderBox.Homogeneous = false; borderBox.Spacing = 0; borderBox.BorderWidth = 0; borderBox.PackStart(hlBox, false, false, 0); borderBox.PackStart(topLevelBox, true, true, 0); textView.FocusInEvent += (object o, Gtk.FocusInEventArgs args) => { Window.Controller.FocusedWindow.Value = Window; hlBox.ModifyBg(Gtk.StateType.Normal, HighlightColor); }; textView.FocusOutEvent += (object o, Gtk.FocusOutEventArgs args) => { hlBox.ModifyBg(Gtk.StateType.Normal, NormalColor); }; Add(borderBox); }
// Constructor public MainWindow() : base("") { Stetic.Gui.Build(this, typeof(MainWindow)); SBCtxId = Statusbar.GetContextId("Card Status"); Statusbar.Push(SBCtxId, ""); // Try to open CardTerminal try { ct = new CT(1); OnCTConnected(); } catch (CTException ex) { Console.Error.WriteLine(ex); CTError(); } }
private void OnPushed(object sender, string message) { if (_statusBar != null) { var contextId = _statusBar.GetContextId(message); _statusBar.Push(contextId, message); _stackContextId.Push(contextId); } }
void HandleStatBarDragDrop (object sender, Gtk.DragDropArgs args) { isChecked = !isChecked; if (isChecked) { sBar.Push((uint)StatusType.Checked, "Checked"); } else { sBar.Pop((uint)StatusType.Checked); } }
void DetermineMessageToDisplay() { child.RemoveAll(0); if (messages.Count == 0) { return; } List <string> l = messages[messages.Keys.Max()]; string msg = l[l.Count - 1]; child.Push(0, msg); }
public App() : base("Drag And Drop Complete") { this.SetDefaultSize(250, 200); this.SetPosition(Gtk.WindowPosition.Center); this.DeleteEvent += OnTerminated; this.isChecked = false; this.sBar = new Gtk.Statusbar(); sBar.Push((uint)StatusType.NotChecked, "Not checked"); this.btnDrag = new Gtk.Button("Drag here"); Gtk.Drag.SourceSet (this.btnDrag, Gdk.ModifierType.Button1Mask | Gdk.ModifierType.Button3Mask, null, Gdk.DragAction.Copy | Gdk.DragAction.Move); this.btnDrag.DragDataGet += new Gtk.DragDataGetHandler (HandleSourceDragDataGet); this.btnDrag.DragDataDelete += new Gtk.DragDataDeleteHandler (HandleSourceDragDataDelete); // set drop label as destination this.lblDrop = new Gtk.Label("Drop here"); Gtk.Drag.DestSet(this.lblDrop, 0, null, 0); this.lblDrop.DragMotion += new Gtk.DragMotionHandler (HandleTargetDragMotion); this.lblDrop.DragDrop += new Gtk.DragDropHandler (HandleTargetDragDrop); this.lblDrop.DragDataReceived += new Gtk.DragDataReceivedHandler (this.HandleTargetDragDataReceived); this.lblDrop.DragDrop += new Gtk.DragDropHandler (this.HandleStatBarDragDrop); Gtk.MenuBar bar = new Gtk.MenuBar(); Gtk.MenuItem item = new Gtk.MenuItem("File"); Gtk.Menu menu = new Gtk.Menu(); item.Submenu = menu; bar.Append(item); // accel key Gtk.AccelGroup ag = new Gtk.AccelGroup(); this.AddAccelGroup(ag); item = new Gtk.MenuItem("Quit"); item.Activated += OnTerminated; item.AddAccelerator ("activate", ag, new Gtk.AccelKey (Gdk.Key.Q, Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible)); menu.Append(item); Gtk.VBox vbox = new Gtk.VBox(); vbox.PackStart(bar, false, false, 0); Gtk.HBox hbox = new Gtk.HBox(); hbox.PackStart(this.btnDrag, true, true, 0); hbox.PackStart(this.lblDrop, true, true, 0); vbox.PackStart(hbox, true, true, 0); vbox.PackStart(sBar, false, false, 0); this.Add(vbox); this.ShowAll(); }