void SetContent() { if (mode == CalendarMode.Single) { if (box != null) { box.Remove(Control); } align.Remove(box); align.Child = Control; } else { align.Remove(Control); suppressRangeChanged++; if (endCalendar == null) { endCalendar = new Gtk.Calendar(); endCalendar.Show(); if (Control.Day == 0) { endCalendar.Day = 0; } else { endCalendar.Date = Control.Date; } endCalendar.DaySelected += HandleEndDaySelected; } if (Control.Day == 0) { endCalendar.Day = 0; } suppressRangeChanged--; if (box == null) { box = new Gtk.HBox(); } else { box.Remove(endCalendar); } box.PackStart(Control, true, true, 0); box.PackStart(endCalendar, true, true, 0); box.Show(); align.Child = box; } }
void Create() { Gtk.Paned old = Control; if (orientation == Orientation.Horizontal) { Control = new EtoHPaned() { Handler = this } } ; else { Control = new EtoVPaned() { Handler = this } }; if (container.Child != null) { container.Remove(container.Child); } container.Child = Control; if (old != null) { var child1 = old.Child1; var child2 = old.Child2; old.Remove(child2); old.Remove(child1); Control.Pack1(child1 ?? EmptyContainer(), fixedPanel != SplitterFixedPanel.Panel1, true); Control.Pack2(child2 ?? EmptyContainer(), fixedPanel != SplitterFixedPanel.Panel2, true); old.Destroy(); } else { Control.Pack1(EmptyContainer(), fixedPanel != SplitterFixedPanel.Panel1, true); Control.Pack2(EmptyContainer(), fixedPanel != SplitterFixedPanel.Panel2, true); } Control.Realized += (sender, e) => { SetInitialPosition(); HookEvents(); }; } void HookEvents() { Control.AddNotification("position", (o, args) => { if (Widget.ParentWindow == null || !Widget.Loaded || suppressSplitterMoved > 0) { return; } // keep track of the desired position (for removing/re-adding/resizing the control) UpdateRelative(); Callback.OnPositionChanged(Widget, EventArgs.Empty); }); }
void Create() { Gtk.Paned old = Control; if (orientation == SplitterOrientation.Horizontal) { Control = new EtoHPaned(); } else { Control = new EtoVPaned(); } if (container.Child != null) { container.Remove(container.Child); } container.Child = Control; if (old != null) { var child1 = old.Child1; var child2 = old.Child2; old.Remove(child2); old.Remove(child1); Control.Pack1(child1 ?? EmptyContainer(), fixedPanel != SplitterFixedPanel.Panel1, true); Control.Pack2(child2 ?? EmptyContainer(), fixedPanel != SplitterFixedPanel.Panel2, true); old.Destroy(); } else { Control.Pack1(EmptyContainer(), fixedPanel != SplitterFixedPanel.Panel1, true); Control.Pack2(EmptyContainer(), fixedPanel != SplitterFixedPanel.Panel2, true); } if (position != null) { Control.Position = position.Value; } }
void Create() { Gtk.Paned old = Control; if (orientation == Orientation.Horizontal) { Control = new EtoHPaned() { Handler = this } } ; else { Control = new EtoVPaned() { Handler = this } }; Control.ShowAll(); Control.Realized += Control_Realized; if (container.Child != null) { container.Remove(container.Child); } if (old != null) { old.Realized -= Control_Realized; var child1 = old.Child1; var child2 = old.Child2; old.Remove(child2); old.Remove(child1); Control.Pack1(child1 ?? EmptyContainer(), fixedPanel != SplitterFixedPanel.Panel1, true); Control.Pack2(child2 ?? EmptyContainer(), fixedPanel != SplitterFixedPanel.Panel2, true); old.Destroy(); } else { Control.Pack1(EmptyContainer(), fixedPanel != SplitterFixedPanel.Panel1, true); Control.Pack2(EmptyContainer(), fixedPanel != SplitterFixedPanel.Panel2, true); } container.Child = Control; } void Control_Realized(object sender, EventArgs e) { HookEvents(); #if !GTK2 EnsurePosition(); #endif } void HookEvents() { if (EtoEnvironment.Platform.IsMac) { Control.AddNotification("position", PositionChangedBefore); // macOS throw NRE when resizing the window without this } Control.AddNotification("position", PositionChanged); }