/// <summary>A scroll bars to the sheet widget.</summary> private void Initialise() { //// Remove existing child. //if (sheet.Children.Length > 0) // sheet.Remove(sheet.Children[0]); var horizontalAdjustment = new Adjustment(1, 0, 100, 1, 1, 1); horizontalScrollbar = new HScrollbar(horizontalAdjustment); horizontalScrollbar.Value = 0; horizontalScrollbar.ValueChanged += OnHorizontalScrollbarChanged; //horizontalScrollbar.SetSizeRequest(sheet.Width, ScrollBarWidth); var verticalAdjustment = new Adjustment(1, 0, 100, 1, 1, 1); verticalScrollbar = new VScrollbar(verticalAdjustment); verticalScrollbar.Value = 0; verticalScrollbar.ValueChanged += OnVerticalScrollbarChanged; //verticalScrollbar.SetSizeRequest(ScrollBarWidth, sheet.Height); var hbox = new HBox(); var vbox = new VBox(); hbox.PackEnd(verticalScrollbar, false, true, 0); hbox.PackStart(sheet, true, true, 0); vbox.PackEnd(horizontalScrollbar, false, true, 0); vbox.PackStart(hbox, true, true, 0); MainWidget = vbox; }
public ListWindow() : base(Gtk.WindowType.Popup) { vbox = new VBox(); HBox box = new HBox(); list = new ListWidget(this); list.SelectionChanged += new EventHandler(OnSelectionChanged); list.ScrollEvent += new ScrollEventHandler(OnScrolled); box.PackStart(list, true, true, 0); this.BorderWidth = 1; scrollbar = new VScrollbar(null); scrollbar.ValueChanged += new EventHandler(OnScrollChanged); box.PackStart(scrollbar, false, false, 0); list.ButtonPressEvent += delegate(object o, ButtonPressEventArgs args) { if (args.Event.Button == 1 && args.Event.Type == Gdk.EventType.TwoButtonPress) { DoubleClick(); } }; list.WordsFiltered += delegate { UpdateScrollBar(); }; list.SizeAllocated += delegate { UpdateScrollBar(); }; vbox.PackStart(box, true, true, 0); Add(vbox); this.AutoSelect = true; this.TypeHint = WindowTypeHint.Menu; }
protected override void OnSizeAllocated(Gdk.Rectangle allocation) { //shrink the allocation we pass to the base layout, to allow for our extra border if (showBorderLine) { allocation.X += 1; allocation.Y += 1; allocation.Height -= HScrollbar.Visible? 1 : 2; allocation.Width -= VScrollbar.Visible? 1 : 2; } base.OnSizeAllocated(allocation); //expand the scrollbars so they render over the new border if (showBorderLine) { bool hasHScroll = HScrollbar.Visible; bool hasVScroll = VScrollbar.Visible; if (hasHScroll) { var alloc = HScrollbar.Allocation; alloc.X -= 1; alloc.Width += hasVScroll? 1 :2; HScrollbar.SizeAllocate(alloc); } if (hasVScroll) { var alloc = VScrollbar.Allocation; alloc.Y -= 1; alloc.Height += hasHScroll? 1 : 2; VScrollbar.SizeAllocate(alloc); } } }
public DropDownBoxListWindow(IListDataProvider provider) : base(Gtk.WindowType.Popup) { this.DataProvider = provider; this.TransientFor = MonoDevelop.Ide.IdeApp.Workbench.RootWindow; this.TypeHint = Gdk.WindowTypeHint.Menu; this.BorderWidth = 1; this.Events |= Gdk.EventMask.KeyPressMask; hBox = new HBox(); list = new ListWidget(this); list.SelectItem += delegate { var sel = list.Selection; if (sel >= 0 && sel < DataProvider.IconCount) { DataProvider.ActivateItem(sel); Destroy(); } }; list.ScrollEvent += HandleListScrollEvent; list.SizeAllocated += delegate { QueueResize(); }; list.PageChanged += HandleListPageChanged; hBox.PackStart(list, true, true, 0); vScrollbar = new VScrollbar(null); vScrollbar.ValueChanged += delegate { list.ForcePage((int)vScrollbar.Value); }; hBox.PackStart(vScrollbar, false, false, 0); Add(hBox); ShowAll(); }
// // glade signal handlers // // custom widget creation callback public Gtk.Widget GladeCustomWidgetHandler(Glade.XML xml, string func_name, string name, string s1, string s2, int i1, int i2) { Console.WriteLine("customWidgetHandler: widget for " + name); if (name == "browser_icon_list") { icon_list = new IconList(); Scrollbar scroll = new VScrollbar(icon_list.Adjustment); Box box = new HBox(false, 0); box.PackStart(icon_list, true, true, 0); box.PackStart(scroll, false, true, 0); box.ShowAll(); return(box); } #if HAVE_LIBEOG if (name == "eog_image_view") { image_ui = new EogUiImage(); Console.WriteLine("Handle: " + image_ui.Handle); image_ui.Show(); return(image_ui); } #else if (name == "eog_image_view") { Gtk.Widget w = new Gtk.Label("EOG support not enabled; Viewer is disabled."); w.Show(); return(w); } #endif if (name == "collections_tree_view") { collections_tree_view = new CollectionsTreeView(); collections_tree_view.Show(); return(collections_tree_view); } if (name == "imageinfo_tree_view") { imageinfo_tree_view = new ImageInfoTreeView(); imageinfo_tree_view.Show(); return(imageinfo_tree_view); } if (name == "keywords_widget") { keywords_widget = new KeywordsWidget(); keywords_widget.Show(); return(keywords_widget); } Console.WriteLine("Returning nil"); return(null); }
public windowVTETerminal(String Name, int Columns, int Rows, String FontString) { HBox hbox = new HBox(); term = new Terminal(); term.CursorBlinks = true; term.MouseAutohide = false; term.ScrollOnKeystroke = true; term.DeleteBinding = TerminalEraseBinding.Auto; term.BackspaceBinding = TerminalEraseBinding.Auto; term.FontFromString = FontString; term.Emulation = "xterm"; term.Encoding = "UTF-8"; term.SetSize(Columns, Rows); VScrollbar vscroll = new VScrollbar(term.Adjustment); hbox.PackStart(term); hbox.PackStart(vscroll); // Gdk.Color white = new Gdk.Color (); // Gdk.Color.Parse ("white", ref white); // // Gdk.Color black = new Gdk.Color (); // Gdk.Color.Parse ("black", ref black); // term.SetColors (black, white, new Gdk.Color[]{}, 16); term.ButtonPressEvent += (o, args) => { Write(args.Event.Button.ToString()); }; this.CanFocus = true; term.Show(); hbox.Show(); vscroll.Show(); this.Add(hbox); ShowAll(); KeyPress += (Gdk.Key key) => { if (LocalEcho) { Write(key.ToString()); } if (shellStream != null && shellStream.CanWrite) { shellStream.WriteByte((byte)key); shellStream.Flush(); } }; }
private Widget CreateObjectList() { HBox hbox = new HBox(false, 0); Adjustment vadjustment = new Adjustment(0, 0, 100, 1, 10, 10); VScrollbar scrollbar = new VScrollbar(vadjustment); hbox.PackStart(new ObjectListWidget(this, vadjustment), true, true, 0); hbox.PackEnd(scrollbar, false, true, 0); return(hbox); }
public void ReplaceVScrollBar(VScrollbar widget) { if (vScrollBar != null) { RemoveChild(vScrollBar); vScrollBar.Dispose(); } vScrollBar = widget; vScrollBar.Visible = true; AddChild(vScrollBar); }
public SmartScrolledWindow(VScrollbar vScrollBar = null) { vScrollBar = vScrollBar ?? new VScrollbar() { }; AddChild(vScrollBar); Vadjustment.ValueChanged += HandleAdjustmentChanged; hScrollBar = new HScrollbar(); AddChild(hScrollBar); Hadjustment.ValueChanged += HandleAdjustmentChanged; }
protected override void OnStyleSet(Style previous_style) { base.OnStyleSet(previous_style); if (Core.Platform.IsWindows) { using (var scrollstyle = Rc.GetStyleByPaths(Settings, null, null, VScrollbar.GType)) { var scrl = new VScrollbar(null); scrl.Style = scrollstyle; win81Slider = scrollstyle.Background(StateType.Normal).ToCairoColor(); win81SliderPrelight = scrollstyle.Background(StateType.Prelight).ToCairoColor(); win81ScrollbarWidth = (int)scrl.StyleGetProperty("slider-width"); scrl.Destroy(); } } }
public static int Main(string[] args) { // Window topwin; IconList icon_list; IImageCollection collection; IIconListAdapter adapter; if (args.Length == 0) { Console.WriteLine("Usage: GtkMphoto /path/to/files"); return(0); } Application.Init(); Window topwin = new Window("GtkMphoto"); topwin.DefaultSize = new Size(600, 400); topwin.DeleteEvent += new DeleteEventHandler(Window_Delete); icon_list = new IconList(); Scrollbar vsb = new VScrollbar(icon_list.Adjustment); Box box = new HBox(false, 0); box.PackStart(icon_list, true, true, 0); box.PackStart(vsb, false, true, 0); box.ShowAll(); topwin.Add(box); IImageRepository repo = new DirImageRepository(args); string[] collIds = repo.GetCollectionIDs(); string firstcid = collIds [0]; collection = repo.GetCollection(firstcid); icon_list.Adapter = new CollectionIconListAdapter(collection); topwin.Show(); Application.Run(); return(0); }
public ScrollBarRenderView(RenderView renderview) : base(2, 2, false) { this.renderview = renderview; Attach(renderview, 0, 1, 0, 1, AttachOptions.Expand | AttachOptions.Fill, AttachOptions.Expand | AttachOptions.Fill, 0, 0); Adjustment hadjustment = new Adjustment(0, -10, 10, 1, 2, 2); HScrollbar hscroll = new HScrollbar(hadjustment); Attach(hscroll, 0, 1, 1, 2, AttachOptions.Expand | AttachOptions.Fill, 0, 0, 0); Adjustment vadjustment = new Adjustment(0, -10, 10, 1, 2, 2); VScrollbar vscroll = new VScrollbar(vadjustment); Attach(vscroll, 1, 2, 0, 1, 0, AttachOptions.Expand | AttachOptions.Fill, 0, 0); renderview.SetAdjustments(hadjustment, vadjustment); }
public DropDownBoxListWindow(IListDataProvider provider) : base(Gtk.WindowType.Popup) { this.DataProvider = provider; this.TransientFor = MonoDevelop.Ide.IdeApp.Workbench.RootWindow; this.TypeHint = Gdk.WindowTypeHint.Menu; this.BorderWidth = 1; hBox = new HBox(); list = new ListWidget(this); list.SelectItem += delegate { DataProvider.ActivateItem(list.Selection); Destroy(); }; list.ScrollEvent += delegate(object o, ScrollEventArgs args) { if (args.Event.Direction == Gdk.ScrollDirection.Up) { vScrollbar.Value--; } else if (args.Event.Direction == Gdk.ScrollDirection.Down) { vScrollbar.Value++; } }; list.SizeAllocated += delegate { QueueResize(); }; list.PageChanged += HandleListPageChanged; hBox.PackStart(list, true, true, 0); vScrollbar = new VScrollbar(null); vScrollbar.ValueChanged += delegate { list.ForcePage((int)vScrollbar.Value); }; hBox.PackStart(vScrollbar, false, false, 0); Add(hBox); ShowAll(); }
void SetupMode() { if (adj == null || textEditor == null) { return; } if (vScrollBar != null) { vScrollBar.Destroy(); vScrollBar = null; } if (mapMode != null) { mapMode.Destroy(); mapMode = null; } switch (ScrollBarMode) { case ScrollBarMode.Normal: vScrollBar = new VScrollbar(adj); PackStart(vScrollBar, true, true, 0); break; case ScrollBarMode.Overview: mapMode = new QuickTaskOverviewMode(this); PackStart(mapMode, true, true, 0); break; case ScrollBarMode.Minimap: mapMode = new QuickTaskMiniMapMode(this); PackStart(mapMode, true, true, 0); break; default: throw new ArgumentOutOfRangeException(); } ShowAll(); }
private Widget CreateTileList() { VBox box = new VBox(); box.Homogeneous = false; Adjustment vadjustment = new Adjustment(0, 0, 100, 1, 10, 10); tileList = new TileListWidget(this, selection, vadjustment); TilegroupSelector selector = new TilegroupSelector(this, tileList); HBox hbox = new HBox(false, 0); VScrollbar scrollbar = new VScrollbar(vadjustment); hbox.PackStart(tileList, true, true, 0); hbox.PackEnd(scrollbar, false, true, 0); box.PackStart(selector, false, true, 0); box.PackStart(hbox, true, true, 0); return(box); }
public Terminal(Func <bool> focusProvider = null) { if (focusProvider == null) { this.focusProvider = () => canvas.HasFocus; } else { this.focusProvider = () => focusProvider() && canvas.HasFocus; } rows = new List <IRow>(); heightMap = new double[0]; layoutParameters = new LayoutParameters(Font, DefaultGray, Colors.LightSlateGray); DefaultBackground = Colors.Black; layoutParameters.Font = Font.SystemMonospaceFont; canvas = new TerminalCanvas(this); cursor = new Cursor(this, canvas); PackStart(canvas, true, true); scrollbar = new VScrollbar(); scrollbar.Sensitive = false; PackEnd(scrollbar); canvas.MouseScrolled += OnCanvasMouseScroll; canvas.BoundsChanged += OnCanvasBoundsChanged; canvas.ButtonPressed += OnCanvasButtonPressed; canvas.ButtonReleased += OnCanvasButtonReleased; canvas.MouseMoved += OnCanvasMouseMoved; scrollbar.ValueChanged += OnScrollbarValueChanged; autoscrollEnabled = new TaskCompletionSource <bool>(); HandleAutoscrollAsync(); canvas.CanGetFocus = true; scrollbar.StepIncrement = Utilities.GetLineSizeFromLayoutParams(layoutParameters).Height; }
public windowTerminalVTE(clsHost host) : base(String.Format("{0} - {1}:{2}", host.Name, host.RemoteHost, host.RemoteSSHPort)) { SSH = new clsSSHTerminal(host); Host = host; HBox hbox = new HBox(); term = new Terminal(); term.CursorBlinks = true; term.MouseAutohide = false; term.ScrollOnKeystroke = true; term.DeleteBinding = TerminalEraseBinding.Auto; term.BackspaceBinding = TerminalEraseBinding.Auto; term.FontFromString = host.TerminalFont; term.Emulation = "xterm"; term.Encoding = "UTF-8"; term.SetSize(host.TerminalCols, host.TerminalRows); VScrollbar vscroll = new VScrollbar(term.Adjustment); hbox.PackStart(term); hbox.PackStart(vscroll); this.CanFocus = true; this.Add(hbox); ShowAll(); SSH.TerminalData += (string text) => { Gtk.Application.Invoke(delegate { term.Feed(text); }); }; }
public GridView() { CanFocus = true; WidgetFlags |= WidgetFlags.NoWindow; selection = new GridSelection(this); orientation = Orientation.Vertical; StyleSet += new StyleSetHandler(OnStyleSet); StateChanged += new StateChangedHandler(OnStateChanged); FocusInEvent += new FocusInEventHandler(OnFocusInEvent); FocusOutEvent += new FocusOutEventHandler(OnFocusOutEvent); ButtonPressEvent += new ButtonPressEventHandler(OnButtonPressEvent); KeyPressEvent += new KeyPressEventHandler(OnKeyPressEvent); selection.Changed += new EventHandler(OnSelectionChanged); cda = new DrawingArea(); cda.ExposeEvent += new ExposeEventHandler(OnCDAExposeEvent); cda.AddEvents((int)EventMask.PointerMotionMask); cda.MotionNotifyEvent += new MotionNotifyEventHandler(OnYHeaderMotionNotifyEvent); cda.AddEvents((int)EventMask.ButtonPressMask); cda.ButtonPressEvent += new ButtonPressEventHandler(OnYHeaderButtonPressEvent); cda.AddEvents((int)EventMask.ButtonReleaseMask); cda.ButtonReleaseEvent += new ButtonReleaseEventHandler(OnYHeaderButtonReleaseEvent); cda.AddEvents((int)EventMask.ScrollMask); Add(cda); tda = new DrawingArea(); tda.ExposeEvent += new ExposeEventHandler(OnTDAExposeEvent); tda.AddEvents((int)EventMask.PointerMotionMask); tda.MotionNotifyEvent += new MotionNotifyEventHandler(OnYHeaderMotionNotifyEvent); tda.AddEvents((int)EventMask.ButtonPressMask); tda.ButtonPressEvent += new ButtonPressEventHandler(OnYHeaderButtonPressEvent); tda.AddEvents((int)EventMask.ButtonReleaseMask); tda.ButtonReleaseEvent += new ButtonReleaseEventHandler(OnYHeaderButtonReleaseEvent); tda.AddEvents((int)EventMask.ScrollMask); lda = new DrawingArea(); lda.ExposeEvent += new ExposeEventHandler(OnLDAExposeEvent); lda.AddEvents((int)EventMask.ScrollMask); lda.ButtonPressEvent += new ButtonPressEventHandler(OnLDAButtonPressEvent); fvp = new Viewport(); fvp.ShadowType = ShadowType.None; fda = new DrawingArea(); fda.StyleSet += new StyleSetHandler(OnFDAStyleSet); fda.Realized += new EventHandler(OnFDARealized); fda.ExposeEvent += new ExposeEventHandler(OnFDAExposeEvent); fda.AddEvents((int)EventMask.ButtonPressMask); fda.ButtonPressEvent += new ButtonPressEventHandler(OnFDAButtonPressEvent); fda.AddEvents((int)EventMask.ScrollMask); fvp.Add(fda); Add(fvp); tvp = new Viewport(fvp.Hadjustment, null); tvp.ShadowType = ShadowType.None; tvp.Add(tda); Add(tvp); lvp = new Viewport(null, fvp.Vadjustment); lvp.ShadowType = ShadowType.None; lvp.Add(lda); Add(lvp); hbar = new HScrollbar(fvp.Hadjustment); new LinkedScrollbar(hbar, tda, fda); Add(hbar); vbar = new VScrollbar(fvp.Vadjustment); new LinkedScrollbar(vbar, lda, fda); Add(vbar); }