public DockContainer(DockFrame frame) { Mono.TextEditor.GtkWorkarounds.FixContainerLeak (this); this.Events = EventMask.ButtonPressMask | EventMask.ButtonReleaseMask | EventMask.PointerMotionMask | EventMask.LeaveNotifyMask; this.frame = frame; }
public void Initialize(DockFrame workspace, Menu padMenu) { var layers = new LayersListWidget (); DockItem layers_item = workspace.AddItem ("Layers"); DockItemToolbar layers_tb = layers_item.GetToolbar (PositionType.Bottom); layers_item.Label = Catalog.GetString ("Layers"); layers_item.Content = layers; layers_item.Icon = PintaCore.Resources.GetIcon ("Menu.Layers.MergeLayerDown.png"); layers_item.Behavior |= DockItemBehavior.CantClose; layers_tb.Add (PintaCore.Actions.Layers.AddNewLayer.CreateDockToolBarItem ()); layers_tb.Add (PintaCore.Actions.Layers.DeleteLayer.CreateDockToolBarItem ()); layers_tb.Add (PintaCore.Actions.Layers.DuplicateLayer.CreateDockToolBarItem ()); layers_tb.Add (PintaCore.Actions.Layers.MergeLayerDown.CreateDockToolBarItem ()); layers_tb.Add (PintaCore.Actions.Layers.MoveLayerUp.CreateDockToolBarItem ()); layers_tb.Add (PintaCore.Actions.Layers.MoveLayerDown.CreateDockToolBarItem ()); Gtk.ToggleAction show_layers = padMenu.AppendToggleAction ("Layers", Catalog.GetString ("Layers"), null, "Menu.Layers.MergeLayerDown.png"); show_layers.Activated += delegate { layers_item.Visible = show_layers.Active; }; layers_item.VisibleChanged += delegate { show_layers.Active = layers_item.Visible; }; show_layers.Active = layers_item.Visible; PintaCore.Workspace.ActiveDocumentChanged += delegate { layers.Reset (); }; }
public DockItemContainer (DockFrame frame, DockItem item) { this.item = item; mainBox = new VBox (); Add (mainBox); mainBox.ResizeMode = Gtk.ResizeMode.Queue; mainBox.Spacing = 0; ShowAll (); mainBox.PackStart (item.GetToolbar (PositionType.Top).Container, false, false, 0); HBox hbox = new HBox (); hbox.Show (); hbox.PackStart (item.GetToolbar (PositionType.Left).Container, false, false, 0); contentBox = new HBox (); contentBox.Show (); hbox.PackStart (contentBox, true, true, 0); hbox.PackStart (item.GetToolbar (PositionType.Right).Container, false, false, 0); mainBox.PackStart (hbox, true, true, 0); mainBox.PackStart (item.GetToolbar (PositionType.Bottom).Container, false, false, 0); }
/// <summary> /// Initializes a new instance of the <see cref="TraceLab.UI.GTK.MainWindow"/> class. /// </summary> public MainWindow(ApplicationContext dataContext) { m_applicationContext = dataContext; // Init dock frame m_dockFrame = new DockFrame(); m_dockFrame.CompactGuiLevel = 5; // Init component info panel m_infoPanelFactory = new InfoPanelFactory(m_applicationContext, m_dockFrame); //build the window CreateWindow(); //set window application view model to all UI panels in current chrome //note, that application vm should not be set before m_windowShell.ShowAll is called SetApplicationViewModel(m_applicationContext.Application); // initiate action handlers for all actions in application new ActionHandlers(dataContext); //attach handler to closing event of a main window this.WindowShell.DeleteEvent += MainWindow_DeleteEvent; m_mainWindowCounter++; }
public AutoHideBox (DockFrame frame, DockItem item, Gtk.PositionType pos, int size) { this.position = pos; this.frame = frame; this.targetSize = size; horiz = pos == PositionType.Left || pos == PositionType.Right; startPos = pos == PositionType.Top || pos == PositionType.Left; Events = Events | Gdk.EventMask.EnterNotifyMask | Gdk.EventMask.LeaveNotifyMask; Box fr; CustomFrame cframe = new CustomFrame (); switch (pos) { case PositionType.Left: cframe.SetMargins (1, 1, 0, 1); break; case PositionType.Right: cframe.SetMargins (1, 1, 1, 0); break; case PositionType.Top: cframe.SetMargins (0, 1, 1, 1); break; case PositionType.Bottom: cframe.SetMargins (1, 0, 1, 1); break; } EventBox sepBox = new EventBox (); cframe.Add (sepBox); if (horiz) { fr = new HBox (); sepBox.Realized += delegate { sepBox.GdkWindow.Cursor = resizeCursorW; }; sepBox.WidthRequest = gripSize; } else { fr = new VBox (); sepBox.Realized += delegate { sepBox.GdkWindow.Cursor = resizeCursorH; }; sepBox.HeightRequest = gripSize; } sepBox.Events = EventMask.AllEventsMask; if (pos == PositionType.Left || pos == PositionType.Top) fr.PackEnd (cframe, false, false, 0); else fr.PackStart (cframe, false, false, 0); Add (fr); ShowAll (); Hide (); scrollable = new ScrollableContainer (); scrollable.ScrollMode = false; scrollable.Show (); if (item.Widget.Parent != null) { ((Gtk.Container)item.Widget.Parent).Remove (item.Widget); } item.Widget.Show (); scrollable.Add (item.Widget); fr.PackStart (scrollable, true, true, 0); sepBox.ButtonPressEvent += OnSizeButtonPress; sepBox.ButtonReleaseEvent += OnSizeButtonRelease; sepBox.MotionNotifyEvent += OnSizeMotion; sepBox.ExposeEvent += OnGripExpose; sepBox.EnterNotifyEvent += delegate { insideGrip = true; sepBox.QueueDraw (); }; sepBox.LeaveNotifyEvent += delegate { insideGrip = false; sepBox.QueueDraw (); }; }
public void Initialize(DockFrame dockframe){ m_dockFrame = dockframe; m_experimentPad = m_dockFrame.AddItem ("ExperimentPad"); m_experimentPad.Label = Catalog.GetString ("ExperimentPad"); m_experimentPad.Behavior = DockItemBehavior.Locked; m_experimentPad.Expand = true; m_experimentPad.DrawFrame = false; m_initialized = true; }
/// <summary> /// Initialize the window pad in the given dock frame. /// </summary> /// <param name='dockFrame'> /// Dock frame. /// </param> public void Initialize(DockFrame dockFrame) { m_dockFrame = dockFrame; DockItem workspaceDockingWindow = m_dockFrame.AddItem("Workspace"); workspaceDockingWindow.Label = Catalog.GetString("Workspace"); workspaceDockingWindow.DefaultLocation = "ComponentsLibrary/Center"; workspaceDockingWindow.Behavior |= DockItemBehavior.CantClose; workspaceDockingWindow.Content = CreateWorkspaceView(); m_initialized = true; }
public TabStrip (DockFrame frame) { VBox vbox = new VBox (); box = new TabStripBox () { TabStrip = this }; vbox.PackStart (box, false, false, 0); // vbox.PackStart (bottomFiller, false, false, 0); Add (vbox); ShowAll (); bottomFiller.Hide (); BottomPadding = 3; WidthRequest = 0; box.Removed += HandleRemoved; }
public PlaceholderWindow (DockFrame frame): base (Gtk.WindowType.Popup) { SkipTaskbarHint = true; Decorated = false; TransientFor = (Gtk.Window) frame.Toplevel; TypeHint = WindowTypeHint.Utility; // Create the mask for the arrow Realize (); redgc = new Gdk.GC (GdkWindow); redgc.RgbFgColor = frame.Style.Background (StateType.Selected); }
/// <summary> /// Initialize the window pad in the given dock frame. /// </summary> /// <param name='dockFrame'> /// Dock frame. /// </param> public void Initialize(DockFrame dockFrame) { if (this.dockFrame != null) throw new ApplicationException ("This DockPad has already been initialized"); if (dockFrame == null) throw new ArgumentNullException ("Provided DockFrame is null"); this.dockFrame = dockFrame; DockItem componentLibraryDock = dockFrame.AddItem("ComponentsLibrary"); componentLibraryDock.Label = Catalog.GetString("Components Library"); componentLibraryDock.Behavior |= DockItemBehavior.CantClose; componentLibraryDock.DefaultWidth = 200; componentLibraryDock.Content = widget; }
public TabStrip (DockFrame frame) { this.frame = frame; frame.ShadedContainer.Add (this); VBox vbox = new VBox (); box = new HBox (); vbox.PackStart (box, false, false, 0); vbox.PackStart (bottomFiller, false, false, 0); AppendPage (vbox, null); ShowBorder = false; ShowTabs = false; ShowAll (); bottomFiller.Hide (); BottomPadding = 3; }
public DockItemTitleTab (DockItem item, DockFrame frame) { this.item = item; this.frame = frame; this.VisibleWindow = false; UpdateVisualStyle (); NoShowAll = true; Events |= Gdk.EventMask.EnterNotifyMask | Gdk.EventMask.LeaveNotifyMask | Gdk.EventMask.ButtonPressMask | Gdk.EventMask.ButtonReleaseMask | Gdk.EventMask.PointerMotionMask; KeyPressEvent += HeaderKeyPress; KeyReleaseEvent += HeaderKeyRelease; this.SubscribeLeaveEvent (OnLeave); }
/// <summary> /// Initialize the window pad in the given dock frame. /// </summary> /// <param name='dockFrame'> /// Dock frame. /// </param> public void Initialize(DockFrame dockFrame) { m_dockFrame = dockFrame; DockItem componentLibraryDockingWindow = m_dockFrame.AddItem("ComponentsLibrary"); componentLibraryDockingWindow.Label = Catalog.GetString("Components Library"); componentLibraryDockingWindow.Behavior |= DockItemBehavior.CantClose; componentLibraryDockingWindow.DefaultWidth = 200; componentLibraryDockingWindow.Content = CreateComponentsTreeView(); //DockItemToolbar libraryToolbar = componentLibraryDockingWindow.GetToolbar(PositionType.Top); //libraryToolbar.Add(ApplicationUICore.Actions.ComponentLibrary.Rescan.CreateDockToolBarItem()); EnableDrag(); m_initialized = true; }
public void Initialize(DockFrame workspace, Menu padMenu) { DockItem toolbox_item = workspace.AddItem ("Toolbox"); ToolBoxWidget toolbox = new ToolBoxWidget () { Name = "toolbox" }; toolbox_item.Label = Catalog.GetString ("Tools"); toolbox_item.Content = toolbox; toolbox_item.Icon = PintaCore.Resources.GetIcon ("Tools.Pencil.png"); toolbox_item.Behavior |= DockItemBehavior.CantClose; toolbox_item.DefaultWidth = 65; Gtk.ToggleAction show_toolbox = padMenu.AppendToggleAction ("Tools", Catalog.GetString ("Tools"), null, "Tools.Pencil.png"); show_toolbox.Activated += delegate { toolbox_item.Visible = show_toolbox.Active; }; toolbox_item.VisibleChanged += delegate { show_toolbox.Active = toolbox_item.Visible; }; show_toolbox.Active = toolbox_item.Visible; }
public void Initialize(DockFrame workspace, Menu padMenu) { DockItem palette_item = workspace.AddItem ("Palette"); ColorPaletteWidget palette = new ColorPaletteWidget (true) { Name = "palette" }; palette_item.Label = Catalog.GetString ("Palette"); palette_item.Content = palette; palette_item.Icon = PintaCore.Resources.GetIcon ("Pinta.png"); //palette_item.DefaultLocation = "Toolbox/Bottom"; palette_item.Behavior |= DockItemBehavior.CantClose; palette_item.DefaultWidth = 65; Gtk.ToggleAction show_palette = padMenu.AppendToggleAction ("Palette", Catalog.GetString ("Palette"), null, "Pinta.png"); show_palette.Activated += delegate { palette_item.Visible = show_palette.Active; }; palette_item.VisibleChanged += delegate { show_palette.Active = palette_item.Visible; }; palette.Initialize (); show_palette.Active = palette_item.Visible; }
public void Initialize(DockFrame workspace, Menu padMenu) { var history = new HistoryTreeView (); DockItem history_item = workspace.AddItem ("History"); DockItemToolbar history_tb = history_item.GetToolbar (PositionType.Bottom); history_item.Label = Catalog.GetString ("History"); history_item.DefaultLocation = "Images/Bottom"; history_item.Content = history; history_item.Icon = PintaCore.Resources.GetIcon ("Menu.Layers.DuplicateLayer.png"); history_tb.Add (PintaCore.Actions.Edit.Undo.CreateDockToolBarItem ()); history_tb.Add (PintaCore.Actions.Edit.Redo.CreateDockToolBarItem ()); Gtk.ToggleAction show_history = padMenu.AppendToggleAction ("History", Catalog.GetString ("History"), null, "Menu.Layers.DuplicateLayer.png"); show_history.Activated += delegate { history_item.Visible = show_history.Active; }; history_item.VisibleChanged += delegate { show_history.Active = history_item.Visible; }; show_history.Active = history_item.Visible; }
public void Initialize(DockFrame workspace, Menu padMenu) { const string pad_name = "Open Images"; DockItem open_images_item = workspace.AddItem (pad_name); open_images_item.Label = Catalog.GetString (pad_name); open_images_item.Content = new OpenImagesListWidget (); ToggleAction show_open_images = padMenu.AppendToggleAction (pad_name, Catalog.GetString (pad_name), null, null); show_open_images.Activated += delegate { open_images_item.Visible = show_open_images.Active; }; open_images_item.VisibleChanged += delegate { show_open_images.Active = open_images_item.Visible; }; show_open_images.Active = open_images_item.Visible; }
public void Initialize(DockFrame workspace, Menu padMenu) { DockItem open_images_item = workspace.AddItem ("Images"); open_images_item.DefaultLocation = "Layers/Bottom"; open_images_item.Label = Catalog.GetString ("Images"); open_images_item.Content = new OpenImagesListWidget (); open_images_item.Icon = PintaCore.Resources.GetIcon ("Menu.Effects.Default.png"); ToggleAction show_open_images = padMenu.AppendToggleAction ("Images", Catalog.GetString ("Images"), null, null); show_open_images.Activated += delegate { open_images_item.Visible = show_open_images.Active; }; open_images_item.VisibleChanged += delegate { show_open_images.Active = open_images_item.Visible; }; show_open_images.Active = open_images_item.Visible; }
internal DockBar (DockFrame frame, Gtk.PositionType position) { frame.ShadedContainer.Add (this); VisibleWindow = false; this.frame = frame; this.position = position; Gtk.Alignment al = new Alignment (0,0,0,0); if (Orientation == Gtk.Orientation.Horizontal) box = new HBox (); else box = new VBox (); uint sizePadding = 1; uint startPadding = 6; switch (Frame.CompactGuiLevel) { case 1: sizePadding = 2; break; case 4: startPadding = 3; break; case 5: startPadding = 0; sizePadding = 0; break; } switch (position) { case PositionType.Top: al.BottomPadding = sizePadding; al.LeftPadding = al.RightPadding = startPadding; break; case PositionType.Bottom: al.TopPadding = sizePadding; al.LeftPadding = al.RightPadding = startPadding; break; case PositionType.Left: al.RightPadding = sizePadding; al.TopPadding = al.BottomPadding = startPadding; break; case PositionType.Right: al.LeftPadding = sizePadding; al.TopPadding = al.BottomPadding = startPadding; break; } box.Spacing = 3; al.Add (box); Add (al); filler = new Label (); filler.WidthRequest = 4; filler.HeightRequest = 4; box.PackEnd (filler); ShowAll (); UpdateVisibility (); }
internal DockBar (DockFrame frame, Gtk.PositionType position) { VisibleWindow = false; this.frame = frame; this.position = position; Gtk.Alignment al = new Alignment (0,0,0,0); if (Orientation == Gtk.Orientation.Horizontal) box = new HBox (); else box = new VBox (); al.Add (box); Add (al); filler = new Label (); filler.WidthRequest = 4; filler.HeightRequest = 4; box.PackEnd (filler); ShowAll (); UpdateVisibility (); }
/// <summary> /// Initialize the window pad in the given dock frame. /// </summary> /// <param name='dockFrame'> /// Dock frame. /// </param> public void Initialize(DockFrame dockFrame) { m_dockFrame = dockFrame; DockItem outputDockingWindow = m_dockFrame.AddItem("Output"); outputDockingWindow.Label = Catalog.GetString("Output"); outputDockingWindow.DefaultHeight = 100; outputDockingWindow.DefaultLocation = "ExperimentPad/Bottom"; //or experiment outputDockingWindow.Behavior |= DockItemBehavior.CantClose; DockItemToolbar toolbar = outputDockingWindow.GetToolbar (PositionType.Top); m_buttonClear = new Button (new Gtk.Image ("gtk-clear", IconSize.Menu)); m_buttonClear.Clicked += new EventHandler (OnButtonClearClick); toolbar.Add(m_buttonClear); toolbar.ShowAll(); outputDockingWindow.Content = CreateOutputView(); LoadIcons(); m_initialized = true; }
// HERZUM SPRINT 2.4 TLAB-157 public static ExperimentCanvasPad CreateCompositeExperimentCanvasPad(ApplicationContext applicationContext, ExperimentCanvasWidget experimentCanvasWidget, CompositeComponentGraph experiment) { ExperimentCanvasPad experimentCanvasPad = null; if (m_mapPadToNodes.TryGetValue (applicationContext.GetHashCode() + experiment.ExperimentInfo.Id, out experimentCanvasPad)) return experimentCanvasPad; else { experimentCanvasPad = new ExperimentCanvasPad(applicationContext); m_mapPadToNodes.Add(applicationContext.GetHashCode() + experiment.ExperimentInfo.Id, experimentCanvasPad); } DockFrame m_dockFrame = new DockFrame(); Gdk.WindowAttr attributes = new Gdk.WindowAttr(); attributes.WindowType = Gdk.WindowType.Child; attributes.X = 100; attributes.Y = 100; attributes.Width = 100; attributes.Height = 100; Gdk.WindowAttributesType mask = WindowAttributesType.X | WindowAttributesType.Y; m_dockFrame.GdkWindow = new Gdk.Window(null, attributes, (int) mask); experimentCanvasPad.Initialize (m_dockFrame); experimentCanvasPad.SetApplicationModel(applicationContext.Application, experimentCanvasWidget, experiment); return experimentCanvasPad; }
internal DockItem (DockFrame frame, string id) { this.frame = frame; this.id = id; currentVisualStyle = regionStyle = frame.GetRegionStyleForItem (this); }
void CreateComponents () { fullViewVBox = new VBox (false, 0); rootWidget = fullViewVBox; InstallMenuBar (); toolbarFrame = new CommandFrame (IdeApp.CommandService); fullViewVBox.PackStart (toolbarFrame, true, true, 0); foreach (DockToolbar t in toolbars) toolbarFrame.AddBar (t); // Create the docking widget and add it to the window. dock = new DockFrame (); dock.CompactGuiLevel = ((int)IdeApp.Preferences.WorkbenchCompactness) + 1; IdeApp.Preferences.WorkbenchCompactnessChanged += delegate { dock.CompactGuiLevel = ((int)IdeApp.Preferences.WorkbenchCompactness) + 1; }; /* Side bar is experimental. Disabled for now HBox hbox = new HBox (); VBox sideBox = new VBox (); sideBox.PackStart (new SideBar (workbench, Orientation.Vertical), false, false, 0); hbox.PackStart (sideBox, false, false, 0); hbox.ShowAll (); sideBox.NoShowAll = true; hbox.PackStart (dock, true, true, 0); DockBar bar = dock.ExtractDockBar (PositionType.Left); bar.AlwaysVisible = true; sideBox.PackStart (bar, true, true, 0); toolbarFrame.AddContent (hbox); */ toolbarFrame.AddContent (dock); // Create the notebook for the various documents. tabControl = new SdiDragNotebook (dock.ShadedContainer); tabControl.Scrollable = true; tabControl.SwitchPage += OnActiveWindowChanged; tabControl.PageAdded += delegate { OnActiveWindowChanged (null, null); }; tabControl.PageRemoved += delegate { OnActiveWindowChanged (null, null); }; tabControl.ButtonPressEvent += delegate(object sender, ButtonPressEventArgs e) { int tab = tabControl.FindTabAtPosition (e.Event.XRoot, e.Event.YRoot); if (tab < 0) return; tabControl.CurrentPage = tab; if (e.Event.Type == Gdk.EventType.TwoButtonPress) ToggleFullViewMode (); }; this.tabControl.PopupMenu += delegate { ShowPopup (); }; this.tabControl.ButtonReleaseEvent += delegate (object sender, Gtk.ButtonReleaseEventArgs e) { int tab = tabControl.FindTabAtPosition (e.Event.XRoot, e.Event.YRoot); if (tab < 0) return; if (e.Event.Button == 3) ShowPopup (); }; tabControl.TabsReordered += new TabsReorderedHandler (OnTabsReordered); // The main document area documentDockItem = dock.AddItem ("Documents"); documentDockItem.Behavior = DockItemBehavior.Locked; documentDockItem.Expand = true; documentDockItem.DrawFrame = false; documentDockItem.Label = GettextCatalog.GetString ("Documents"); documentDockItem.Content = tabControl; // Add some hiden items to be used as position reference DockItem dit = dock.AddItem ("__left"); dit.DefaultLocation = "Documents/Left"; dit.Behavior = DockItemBehavior.Locked; dit.DefaultVisible = false; dit = dock.AddItem ("__right"); dit.DefaultLocation = "Documents/Right"; dit.Behavior = DockItemBehavior.Locked; dit.DefaultVisible = false; dit = dock.AddItem ("__top"); dit.DefaultLocation = "Documents/Top"; dit.Behavior = DockItemBehavior.Locked; dit.DefaultVisible = false; dit = dock.AddItem ("__bottom"); dit.DefaultLocation = "Documents/Bottom"; dit.Behavior = DockItemBehavior.Locked; dit.DefaultVisible = false; Add (fullViewVBox); fullViewVBox.ShowAll (); fullViewVBox.PackEnd (this.StatusBar, false, true, 0); if (MonoDevelop.Core.PropertyService.IsMac) this.StatusBar.HasResizeGrip = true; else { if (GdkWindow != null && GdkWindow.State == Gdk.WindowState.Maximized) IdeApp.Workbench.StatusBar.HasResizeGrip = false; SizeAllocated += delegate { if (GdkWindow != null) IdeApp.Workbench.StatusBar.HasResizeGrip = GdkWindow.State != Gdk.WindowState.Maximized; }; } // create DockItems for all the pads foreach (PadCodon content in padContentCollection) AddPad (content, content.DefaultPlacement, content.DefaultStatus); try { if (System.IO.File.Exists (configFile)) { dock.LoadLayouts (configFile); foreach (string layout in dock.Layouts) { if (!layouts.Contains (layout) && !layout.EndsWith (fullViewModeTag)) layouts.Add (layout); } } } catch (Exception ex) { LoggingService.LogError (ex.ToString ()); } }
public DockGroupItem(DockFrame frame, DockItem item) : base(frame) { this.item = item; visibleFlag = item.Visible; }
public PadTitleWindow (DockFrame frame, DockItem draggedItem): base (Gtk.WindowType.Popup) { SkipTaskbarHint = true; Decorated = false; TransientFor = (Gtk.Window) frame.Toplevel; TypeHint = WindowTypeHint.Utility; VBox mainBox = new VBox (); HBox box = new HBox (false, 3); if (draggedItem.Icon != null) { var img = new Xwt.ImageView (draggedItem.Icon); box.PackStart (img.ToGtkWidget (), false, false, 0); } Gtk.Label la = new Label (); la.Markup = draggedItem.Label; box.PackStart (la, false, false, 0); mainBox.PackStart (box, false, false, 0); /* if (draggedItem.Widget.IsRealized) { var win = draggedItem.Widget.GdkWindow; var alloc = draggedItem.Widget.Allocation; Gdk.Pixbuf img = Gdk.Pixbuf.FromDrawable (win, win.Colormap, alloc.X, alloc.Y, 0, 0, alloc.Width, alloc.Height); double mw = 140, mh = 140; if (img.Width > img.Height) mw *= 2; else mh *= 2; double r = Math.Min (mw / img.Width, mh / img.Height); img = img.ScaleSimple ((int)(img.Width * r), (int)(img.Height * r), Gdk.InterpType.Hyper); mainBox.PackStart (new Gtk.Image (img), false, false, 0); }*/ CustomFrame f = new CustomFrame (); f.SetPadding (12, 12, 12, 12); f.SetMargins (1, 1, 1, 1); f.Add (mainBox); Add (f); ShowAll (); }
public DockItemContainer (DockFrame frame, DockItem item) { this.frame = frame; this.item = item; ResizeMode = Gtk.ResizeMode.Queue; Spacing = 0; title = new Gtk.Label (); title.Xalign = 0; title.Xpad = 3; title.UseMarkup = true; title.Ellipsize = Pango.EllipsizeMode.End; btnDock = new Button (new Gtk.Image (pixAutoHide)); btnDock.Relief = ReliefStyle.None; btnDock.CanFocus = false; btnDock.WidthRequest = btnDock.HeightRequest = 17; btnDock.Clicked += OnClickDock; btnClose = new Button (new Gtk.Image (pixClose)); btnClose.TooltipText = Catalog.GetString ("Hide"); btnClose.Relief = ReliefStyle.None; btnClose.CanFocus = false; btnClose.WidthRequest = btnClose.HeightRequest = 17; btnClose.Clicked += delegate { item.Visible = false; }; HBox box = new HBox (false, 0); box.PackStart (title, true, true, 0); box.PackEnd (btnClose, false, false, 0); box.PackEnd (btnDock, false, false, 0); headerAlign = new Alignment (0.0f, 0.0f, 1.0f, 1.0f); headerAlign.TopPadding = headerAlign.BottomPadding = headerAlign.RightPadding = headerAlign.LeftPadding = 1; headerAlign.Add (box); header = new EventBox (); header.Events |= Gdk.EventMask.KeyPressMask | Gdk.EventMask.KeyReleaseMask; header.ButtonPressEvent += HeaderButtonPress; header.ButtonReleaseEvent += HeaderButtonRelease; header.MotionNotifyEvent += HeaderMotion; header.KeyPressEvent += HeaderKeyPress; header.KeyReleaseEvent += HeaderKeyRelease; header.Add (headerAlign); header.ExposeEvent += HeaderExpose; header.Realized += delegate { header.GdkWindow.Cursor = handCursor; }; foreach (Widget w in new Widget [] { header, btnDock, btnClose }) { w.EnterNotifyEvent += HeaderEnterNotify; w.LeaveNotifyEvent += HeaderLeaveNotify; } PackStart (header, false, false, 0); ShowAll (); PackStart (item.GetToolbar (PositionType.Top).Container, false, false, 0); HBox hbox = new HBox (); hbox.Show (); hbox.PackStart (item.GetToolbar (PositionType.Left).Container, false, false, 0); contentBox = new HBox (); contentBox.Show (); hbox.PackStart (contentBox, true, true, 0); hbox.PackStart (item.GetToolbar (PositionType.Right).Container, false, false, 0); PackStart (hbox, true, true, 0); PackStart (item.GetToolbar (PositionType.Bottom).Container, false, false, 0); UpdateBehavior (); }
private void CreateDockAndPads(HBox container) { Gtk.IconFactory fact = new Gtk.IconFactory (); fact.Add ("Tools.Pencil.png", new Gtk.IconSet (PintaCore.Resources.GetIcon ("Tools.Pencil.png"))); fact.Add ("Pinta.png", new Gtk.IconSet (PintaCore.Resources.GetIcon ("Pinta.png"))); fact.AddDefault (); // Dock widget dock = new DockFrame (); dock.CompactGuiLevel = 5; // Toolbox pad //var toolboxpad = new ToolBoxPad (); //toolboxpad.Initialize (dock, show_pad); // Palette pad var palettepad = new ColorPalettePad (); palettepad.Initialize (dock, show_pad); // Canvas pad canvas_pad = new CanvasPad (); canvas_pad.Initialize (dock, show_pad); sw = canvas_pad.ScrolledWindow; // Layer pad var layers_pad = new LayersPad (); layers_pad.Initialize (dock, show_pad); // Open Images pad var open_images_pad = new OpenImagesPad (); open_images_pad.Initialize (dock, show_pad); // History pad var history_pad = new HistoryPad (); history_pad.Initialize (dock, show_pad); container.PackStart (dock, true, true, 0); dock.CreateLayout ("Default", false); dock.CurrentLayout = "Default"; }
internal DockItem(DockFrame frame, string id) { this.frame = frame; this.id = id; currentVisualStyle = regionStyle = frame.GetRegionStyleForItem(this); }
internal DockItem (DockFrame frame, Widget w, string id): this (frame, id) { content = w; }
internal DockItem(DockFrame frame, Widget w, string id) : this(frame, id) { content = w; }
private void CreateDockAndPads(HBox container) { // Create canvas Table mainTable = new Table (2, 2, false); sw = new ScrolledWindow () { Name = "sw", ShadowType = ShadowType.EtchedOut }; Viewport vp = new Viewport () { ShadowType = ShadowType.None }; canvas = new PintaCanvas () { Name = "canvas", CanDefault = true, CanFocus = true, Events = (Gdk.EventMask)16134 }; // Dock widget dock = new DockFrame (); dock.CompactGuiLevel = 5; Gtk.IconFactory fact = new Gtk.IconFactory (); fact.Add ("Tools.Pencil.png", new Gtk.IconSet (PintaCore.Resources.GetIcon ("Tools.Pencil.png"))); fact.Add ("Pinta.png", new Gtk.IconSet (PintaCore.Resources.GetIcon ("Pinta.png"))); fact.AddDefault (); // Toolbox pad DockItem toolbox_item = dock.AddItem ("Toolbox"); toolbox = new ToolBoxWidget () { Name = "toolbox" }; toolbox_item.Label = Catalog.GetString ("Tools"); toolbox_item.Content = toolbox; toolbox_item.Icon = PintaCore.Resources.GetIcon ("Tools.Pencil.png"); toolbox_item.Behavior |= DockItemBehavior.CantClose; toolbox_item.DefaultWidth = 65; Gtk.Action show_toolbox = show_pad.AppendAction ("Tools", Catalog.GetString ("Tools"), null, "Tools.Pencil.png"); show_toolbox.Activated += delegate { toolbox_item.Visible = true; }; // Palette pad DockItem palette_item = dock.AddItem ("Palette"); color = new ColorPaletteWidget () { Name = "color" }; palette_item.Label = Catalog.GetString ("Palette"); palette_item.Content = color; palette_item.Icon = PintaCore.Resources.GetIcon ("Pinta.png"); palette_item.DefaultLocation = "Toolbox/Bottom"; palette_item.Behavior |= DockItemBehavior.CantClose; palette_item.DefaultWidth = 65; Gtk.Action show_palette = show_pad.AppendAction ("Palette", Catalog.GetString ("Palette"), null, "Pinta.png"); show_palette.Activated += delegate { palette_item.Visible = true; }; // Canvas pad DockItem documentDockItem = dock.AddItem ("Canvas"); documentDockItem.Behavior = DockItemBehavior.Locked; documentDockItem.Expand = true; documentDockItem.DrawFrame = false; documentDockItem.Label = Catalog.GetString ("Documents"); documentDockItem.Content = mainTable; //rulers hruler = new HRuler (); hruler.Metric = MetricType.Pixels; mainTable.Attach (hruler, 1, 2, 0, 1, AttachOptions.Shrink | AttachOptions.Fill, AttachOptions.Shrink | AttachOptions.Fill, 0, 0); vruler = new VRuler (); vruler.Metric = MetricType.Pixels; mainTable.Attach (vruler, 0, 1, 1, 2, AttachOptions.Shrink | AttachOptions.Fill, AttachOptions.Shrink | AttachOptions.Fill, 0, 0); sw.Hadjustment.ValueChanged += delegate { UpdateRulerRange (); }; sw.Vadjustment.ValueChanged += delegate { UpdateRulerRange (); }; PintaCore.Workspace.CanvasSizeChanged += delegate { UpdateRulerRange (); }; canvas.MotionNotifyEvent += delegate (object o, MotionNotifyEventArgs args) { if (!PintaCore.Workspace.HasOpenDocuments) return; Cairo.PointD point = PintaCore.Workspace.WindowPointToCanvas (args.Event.X, args.Event.Y); hruler.Position = point.X; vruler.Position = point.Y; }; mainTable.Attach (sw, 1, 2, 1, 2, AttachOptions.Expand | AttachOptions.Fill, AttachOptions.Expand | AttachOptions.Fill, 0, 0); sw.Add (vp); vp.Add (canvas); mainTable.ShowAll (); canvas.Show (); vp.Show (); HideRulers(); // Layer pad layers = new LayersListWidget (); DockItem layers_item = dock.AddItem ("Layers"); DockItemToolbar layers_tb = layers_item.GetToolbar (PositionType.Bottom); layers_item.Label = Catalog.GetString ("Layers"); layers_item.Content = layers; layers_item.Icon = PintaCore.Resources.GetIcon ("Menu.Layers.MergeLayerDown.png"); layers_tb.Add (PintaCore.Actions.Layers.AddNewLayer.CreateDockToolBarItem ()); layers_tb.Add (PintaCore.Actions.Layers.DeleteLayer.CreateDockToolBarItem ()); layers_tb.Add (PintaCore.Actions.Layers.DuplicateLayer.CreateDockToolBarItem ()); layers_tb.Add (PintaCore.Actions.Layers.MergeLayerDown.CreateDockToolBarItem ()); layers_tb.Add (PintaCore.Actions.Layers.MoveLayerUp.CreateDockToolBarItem ()); layers_tb.Add (PintaCore.Actions.Layers.MoveLayerDown.CreateDockToolBarItem ()); Gtk.Action show_layers = show_pad.AppendAction ("Layers", Catalog.GetString ("Layers"), null, "Menu.Layers.MergeLayerDown.png"); show_layers.Activated += delegate { layers_item.Visible = true; }; // History pad HistoryTreeView history = new HistoryTreeView (); DockItem history_item = dock.AddItem ("History"); DockItemToolbar history_tb = history_item.GetToolbar (PositionType.Bottom); history_item.Label = Catalog.GetString ("History"); history_item.DefaultLocation = "Layers/Bottom"; history_item.Content = history; history_item.Icon = PintaCore.Resources.GetIcon ("Menu.Layers.DuplicateLayer.png"); history_tb.Add (PintaCore.Actions.Edit.Undo.CreateDockToolBarItem ()); history_tb.Add (PintaCore.Actions.Edit.Redo.CreateDockToolBarItem ()); Gtk.Action show_history = show_pad.AppendAction ("History", Catalog.GetString ("History"), null, "Menu.Layers.DuplicateLayer.png"); show_history.Activated += delegate { history_item.Visible = true; }; container.PackStart (dock, true, true, 0); string layout_file = System.IO.Path.Combine (PintaCore.Settings.GetUserSettingsDirectory (), "layouts.xml"); if (System.IO.File.Exists (layout_file)) dock.LoadLayouts (layout_file); if (!dock.HasLayout ("Default")) dock.CreateLayout ("Default", false); dock.CurrentLayout = "Default"; }
internal DockItem(DockFrame frame, string id) { this.frame = frame; this.id = id; }
internal DockItem(DockFrame frame, Widget w, string id) { this.frame = frame; this.id = id; content = w; }
public AutoHideBox(DockFrame frame, DockItem item, Gtk.PositionType pos, int size) { this.item = item; this.position = pos; this.frame = frame; this.targetSize = size; horiz = pos == PositionType.Left || pos == PositionType.Right; startPos = pos == PositionType.Top || pos == PositionType.Left; Events = Events | Gdk.EventMask.EnterNotifyMask | Gdk.EventMask.LeaveNotifyMask; Box fr; CustomFrame cframe = new CustomFrame(); switch (pos) { case PositionType.Left: cframe.SetMargins(1, 1, 0, 1); break; case PositionType.Right: cframe.SetMargins(1, 1, 1, 0); break; case PositionType.Top: cframe.SetMargins(0, 1, 1, 1); break; case PositionType.Bottom: cframe.SetMargins(1, 0, 1, 1); break; } EventBox sepBox = new EventBox(); cframe.Add(sepBox); if (horiz) { fr = new HBox(); sepBox.Realized += delegate { sepBox.GdkWindow.Cursor = resizeCursorW; }; sepBox.WidthRequest = gripSize; } else { fr = new VBox(); sepBox.Realized += delegate { sepBox.GdkWindow.Cursor = resizeCursorH; }; sepBox.HeightRequest = gripSize; } sepBox.Events = EventMask.AllEventsMask; if (pos == PositionType.Left || pos == PositionType.Top) { fr.PackEnd(cframe, false, false, 0); } else { fr.PackStart(cframe, false, false, 0); } Add(fr); ShowAll(); Hide(); scrollable = new ScrollableContainer(); scrollable.ScrollMode = false; scrollable.Show(); item.Widget.Show(); scrollable.Add(item.Widget); fr.PackStart(scrollable, true, true, 0); sepBox.ButtonPressEvent += OnSizeButtonPress; sepBox.ButtonReleaseEvent += OnSizeButtonRelease; sepBox.MotionNotifyEvent += OnSizeMotion; sepBox.ExposeEvent += OnGripExpose; sepBox.EnterNotifyEvent += delegate { insideGrip = true; sepBox.QueueDraw(); }; sepBox.LeaveNotifyEvent += delegate { insideGrip = false; sepBox.QueueDraw(); }; }
internal DockGroup(DockFrame frame) : base(frame) { }
void CreateComponents() { fullViewVBox = new VBox (false, 0); rootWidget = fullViewVBox; InstallMenuBar (); Realize (); toolbar = DesktopService.CreateMainToolbar (this); DesktopService.SetMainWindowDecorations (this); var toolbarBox = new HBox (); fullViewVBox.PackStart (toolbarBox, false, false, 0); toolbarFrame = new CommandFrame (IdeApp.CommandService); fullViewVBox.PackStart (toolbarFrame, true, true, 0); // Create the docking widget and add it to the window. dock = new DockFrame (); dock.CompactGuiLevel = ((int)IdeApp.Preferences.WorkbenchCompactness) + 1; IdeApp.Preferences.WorkbenchCompactnessChanged += delegate { dock.CompactGuiLevel = ((int)IdeApp.Preferences.WorkbenchCompactness) + 1; }; /* Side bar is experimental. Disabled for now HBox hbox = new HBox (); VBox sideBox = new VBox (); sideBox.PackStart (new SideBar (workbench, Orientation.Vertical), false, false, 0); hbox.PackStart (sideBox, false, false, 0); hbox.ShowAll (); sideBox.NoShowAll = true; hbox.PackStart (dock, true, true, 0); DockBar bar = dock.ExtractDockBar (PositionType.Left); bar.AlwaysVisible = true; sideBox.PackStart (bar, true, true, 0); toolbarFrame.AddContent (hbox); */ toolbarFrame.AddContent (dock); // Create the notebook for the various documents. tabControl = new SdiDragNotebook (this); DockNotebook.ActiveNotebookChanged += delegate { OnActiveWindowChanged (null, null); }; Add (fullViewVBox); fullViewVBox.ShowAll (); bottomBar = new MonoDevelopStatusBar (); fullViewVBox.PackEnd (bottomBar, false, true, 0); bottomBar.ShowAll (); toolbarBox.PackStart (this.toolbar, true, true, 0); // In order to get the correct bar height we need to calculate the tab size using the // correct style (the style of the window). At this point the widget is not yet a child // of the window, so its style is not yet the correct one. tabControl.InitSize (); var barHeight = tabControl.BarHeight; // The main document area documentDockItem = dock.AddItem ("Documents"); documentDockItem.Behavior = DockItemBehavior.Locked; documentDockItem.Expand = true; documentDockItem.DrawFrame = false; documentDockItem.Label = GettextCatalog.GetString ("Documents"); documentDockItem.Content = new DockNotebookContainer (tabControl, true); DockVisualStyle style = new DockVisualStyle (); style.PadTitleLabelColor = Styles.PadLabelColor; style.PadBackgroundColor = Styles.PadBackground; style.InactivePadBackgroundColor = Styles.InactivePadBackground; style.PadTitleHeight = barHeight; dock.DefaultVisualStyle = style; style = new DockVisualStyle (); style.PadTitleLabelColor = Styles.PadLabelColor; style.PadTitleHeight = barHeight; style.ShowPadTitleIcon = false; style.UppercaseTitles = false; style.ExpandedTabs = true; style.PadBackgroundColor = Styles.BrowserPadBackground; style.InactivePadBackgroundColor = Styles.InactiveBrowserPadBackground; style.TreeBackgroundColor = Styles.BrowserPadBackground; dock.SetDockItemStyle ("ProjectPad", style); dock.SetDockItemStyle ("ClassPad", style); // dock.SetRegionStyle ("Documents/Left", style); //dock.SetRegionStyle ("Documents/Right", style); // style = new DockVisualStyle (); // style.SingleColumnMode = true; // dock.SetRegionStyle ("Documents/Left;Documents/Right", style); // dock.SetDockItemStyle ("Documents", style); // Add some hiden items to be used as position reference DockItem dit = dock.AddItem ("__left"); dit.DefaultLocation = "Documents/Left"; dit.Behavior = DockItemBehavior.Locked; dit.DefaultVisible = false; dit = dock.AddItem ("__right"); dit.DefaultLocation = "Documents/Right"; dit.Behavior = DockItemBehavior.Locked; dit.DefaultVisible = false; dit = dock.AddItem ("__top"); dit.DefaultLocation = "Documents/Top"; dit.Behavior = DockItemBehavior.Locked; dit.DefaultVisible = false; dit = dock.AddItem ("__bottom"); dit.DefaultLocation = "Documents/Bottom"; dit.Behavior = DockItemBehavior.Locked; dit.DefaultVisible = false; if (MonoDevelop.Core.Platform.IsMac) bottomBar.HasResizeGrip = true; else { if (GdkWindow != null && GdkWindow.State == Gdk.WindowState.Maximized) bottomBar.HasResizeGrip = false; SizeAllocated += delegate { if (GdkWindow != null) bottomBar.HasResizeGrip = GdkWindow.State != Gdk.WindowState.Maximized; }; } // create DockItems for all the pads ExtensionNodeList padCodons = AddinManager.GetExtensionNodes (viewContentPath); foreach (ExtensionNode node in padCodons) ShowPadNode (node); try { if (System.IO.File.Exists (configFile)) { dock.LoadLayouts (configFile); foreach (string layout in dock.Layouts) { if (!layouts.Contains (layout) && !layout.EndsWith (fullViewModeTag)) layouts.Add (layout); } } } catch (Exception ex) { LoggingService.LogError (ex.ToString ()); } }
public DockGroup(DockFrame frame, DockGroupType type) : base(frame) { this.type = type; }