28
using System.Collections;
29
28
using System.Collections.ObjectModel;
30
29
using System.Collections.Generic;
31
30
using System.Drawing;
32
31
using System.Diagnostics;
33
using System.CodeDom.Compiler;
34
using System.ComponentModel;
37
34
using MonoDevelop.Projects;
39
36
using MonoDevelop.Core;
40
using MonoDevelop.Core.Gui;
41
using MonoDevelop.Core.Gui.Components;
42
using MonoDevelop.Ide.Gui.Content;
43
using MonoDevelop.Core.Gui.Dialogs;
44
using MonoDevelop.Ide.Commands;
37
using MonoDevelop.Ide.Gui.Dialogs;
45
38
using MonoDevelop.Ide.Codons;
46
using MonoDevelop.Ide.Gui.Dialogs;
47
using MonoDevelop.Projects.Dom.Parser;
48
39
using MonoDevelop.Components.Commands;
40
using MonoDevelop.Components.Docking;
43
using MonoDevelop.Components.DockToolbars;
45
using MonoDevelop.Components;
46
using MonoDevelop.Ide.Extensions;
52
48
namespace MonoDevelop.Ide.Gui
55
51
/// This is the a Workspace with a multiple document interface.
57
internal class DefaultWorkbench : Gtk.Window, IWorkbench
53
internal class DefaultWorkbench : WorkbenchWindow
59
55
readonly static string mainMenuPath = "/MonoDevelop/Ide/MainMenu";
60
56
readonly static string viewContentPath = "/MonoDevelop/Ide/Pads";
61
57
readonly static string toolbarsPath = "/MonoDevelop/Ide/Toolbar";
58
readonly static string stockLayoutsPath = "/MonoDevelop/Ide/WorkbenchLayouts";
60
static string configFile = System.IO.Path.Combine (PropertyService.ConfigPath, "EditingLayout2.xml");
61
const string fullViewModeTag = "[FullViewMode]";
62
const int MAX_LASTACTIVEWINDOWS = 10;
64
// list of layout names for the current context, without the context prefix
65
List<string> layouts = new List<string> ();
63
67
List<PadCodon> padContentCollection = new List<PadCodon> ();
64
68
List<IViewContent> viewContentCollection = new List<IViewContent> ();
66
bool closeAll = false;
69
Dictionary<PadCodon, IPadWindow> padWindows = new Dictionary<PadCodon, IPadWindow> ();
70
Dictionary<IPadWindow, PadCodon> padCodons = new Dictionary<IPadWindow, PadCodon> ();
72
IWorkbenchWindow lastActive;
73
LinkedList<IWorkbenchWindow> lastActiveWindows = new LinkedList<IWorkbenchWindow> ();
76
bool ignorePageSwitch;
69
79
Rectangle normalBounds = new Rectangle(0, 0, 640, 480);
71
private IWorkbenchLayout layout = null;
73
81
internal static GType gtype;
75
Gtk.MenuBar topMenu = null;
76
private Gtk.Toolbar[] toolbars = null;
77
MonoDevelopStatusBar statusBar = new MonoDevelop.Ide.MonoDevelopStatusBar ();
79
public MonoDevelopStatusBar StatusBar {
83
Gtk.Container rootWidget;
84
DockToolbarFrame toolbarFrame;
86
SdiDragNotebook tabControl;
88
Gtk.Toolbar[] toolbars;
89
MonoDevelopStatusBar statusBar;
90
Gtk.VBox fullViewVBox;
91
DockItem documentDockItem;
150
public IList<string> Layouts {
112
public string Title {
156
public string CurrentLayout {
158
if (dock != null && dock.CurrentLayout != null) {
159
string s = dock.CurrentLayout;
160
s = s.Substring (s.IndexOf (".") + 1);
161
if (s.EndsWith (fullViewModeTag))
162
return s.Substring (0, s.Length - fullViewModeTag.Length);
121
EventHandler windowChangeEventHandler;
123
public IWorkbenchLayout WorkbenchLayout {
125
//FIXME: i added this, we need to fix this shit
126
// if (layout == null) {
127
// layout = new SdiWorkbenchLayout ();
128
// layout.Attach(this);
134
public ReadOnlyCollection<PadCodon> PadContentCollection {
136
Debug.Assert(padContentCollection != null);
137
return padContentCollection.AsReadOnly ();
141
public List<PadCodon> ActivePadContentCollection {
144
return new List<PadCodon> ();
145
return layout.PadContentCollection;
149
public ReadOnlyCollection<IViewContent> ViewContentCollection {
151
Debug.Assert(viewContentCollection != null);
152
return viewContentCollection.AsReadOnly ();
169
// Leave dragging mode, to avoid problems due to widget relocating
170
tabControl.LeaveDragMode (0);
172
var oldLayout = dock.CurrentLayout;
174
InitializeLayout (value);
175
toolbarFrame.CurrentLayout = dock.CurrentLayout = value;
177
DestroyFullViewLayouts (oldLayout);
179
// persist the selected layout
180
PropertyService.Set ("MonoDevelop.Core.Gui.CurrentWorkbenchLayout", value);
184
public void DeleteLayout (string name)
186
string layout = name;
187
layouts.Remove (name);
188
dock.DeleteLayout (layout);
191
public List<PadCodon> PadContentCollection {
193
return padContentCollection;
253
283
void OnExtensionChanged (object s, ExtensionEventArgs args)
255
bool changed = false;
257
285
if (args.PathChanged (mainMenuPath)) {
258
if (DesktopService.SetGlobalMenu (MonoDevelop.Ide.Gui.IdeApp.CommandService, mainMenuPath))
286
if (DesktopService.SetGlobalMenu (IdeApp.CommandService, mainMenuPath))
261
290
topMenu = IdeApp.CommandService.CreateMenuBar (mainMenuPath);
265
294
if (args.PathChanged (toolbarsPath)) {
266
295
toolbars = IdeApp.CommandService.CreateToolbarSet (toolbarsPath);
267
foreach (Gtk.Toolbar t in toolbars)
268
t.ToolbarStyle = Gtk.ToolbarStyle.Icons;
296
string cl = toolbarFrame.CurrentLayout;
297
DockToolbarFrameStatus mem = toolbarFrame.GetStatus ();
298
toolbarFrame.ClearToolbars ();
299
foreach (DockToolbar tb in toolbars) {
300
tb.ToolbarStyle = Gtk.ToolbarStyle.Icons;
302
toolbarFrame.AddBar (tb);
304
toolbarFrame.SetStatus (mem);
305
toolbarFrame.CurrentLayout = cl;
309
void InstallMenuBar ()
311
if (topMenu != null) {
312
((VBox)rootWidget).PackStart (topMenu, false, false, 0);
313
((Gtk.Box.BoxChild) rootWidget [topMenu]).Position = 0;
318
void UninstallMenuBar ()
272
if (changed && layout != null)
273
layout.RedrawAllComponents();
323
rootWidget.Remove (topMenu);
276
327
public void CloseContent (IViewContent content)
278
329
if (viewContentCollection.Contains(content)) {
398
476
public virtual void BringToFront (PadCodon content, bool giveFocus)
400
if (!layout.IsVisible (content))
401
layout.ShowPad (content);
478
if (!IsVisible (content))
403
layout.ActivatePad (content, giveFocus);
481
ActivatePad (content, giveFocus);
406
public void RedrawAllComponents()
484
void SetWorkbenchTitle ()
408
foreach (IViewContent content in viewContentCollection) {
409
content.RedrawContent();
411
foreach (PadCodon content in padContentCollection) {
412
if (content.Initialized) {
413
content.PadContent.RedrawContent();
487
IWorkbenchWindow window = ActiveWorkbenchWindow;
488
if (window != null) {
489
if (window.ViewContent.IsUntitled) {
492
string post = String.Empty;
493
if (window.ViewContent.IsDirty) {
496
if (window.ViewContent.Project != null) {
497
Title = window.ViewContent.Project.Name + " - " + window.ViewContent.PathRelativeToProject + post + " - MonoDevelop";
499
Title = window.ViewContent.ContentName + post + " - MonoDevelop";
504
if (IsInFullViewMode)
505
this.ToggleFullViewMode ();
416
layout.RedrawAllComponents();
417
//statusBarManager.RedrawStatusbar();
507
} catch (Exception) {
512
void SetDefaultTitle ()
514
if (IdeApp.ProjectOperations.CurrentSelectedProject != null) {
515
Title = IdeApp.ProjectOperations.CurrentSelectedProject.Name + " - MonoDevelop";
517
Title = "MonoDevelop";
420
521
public Properties GetStoredMemento(IViewContent content)
626
739
initializing = false;
742
void CreateComponents ()
744
fullViewVBox = new VBox (false, 0);
745
rootWidget = fullViewVBox;
749
toolbarFrame = new CommandFrame (IdeApp.CommandService);
750
fullViewVBox.PackStart (toolbarFrame, true, true, 0);
752
foreach (DockToolbar t in toolbars)
753
toolbarFrame.AddBar (t);
755
// Create the docking widget and add it to the window.
756
dock = new DockFrame ();
758
dock.CompactGuiLevel = ((int)IdeApp.Preferences.WorkbenchCompactness) + 1;
759
IdeApp.Preferences.WorkbenchCompactnessChanged += delegate {
760
dock.CompactGuiLevel = ((int)IdeApp.Preferences.WorkbenchCompactness) + 1;
763
/* Side bar is experimental. Disabled for now
764
HBox hbox = new HBox ();
765
VBox sideBox = new VBox ();
766
sideBox.PackStart (new SideBar (workbench, Orientation.Vertical), false, false, 0);
767
hbox.PackStart (sideBox, false, false, 0);
769
sideBox.NoShowAll = true;
770
hbox.PackStart (dock, true, true, 0);
771
DockBar bar = dock.ExtractDockBar (PositionType.Left);
772
bar.AlwaysVisible = true;
773
sideBox.PackStart (bar, true, true, 0);
774
toolbarFrame.AddContent (hbox);
777
toolbarFrame.AddContent (dock);
779
// Create the notebook for the various documents.
780
tabControl = new SdiDragNotebook (dock.ShadedContainer);
781
tabControl.Scrollable = true;
782
tabControl.SwitchPage += OnActiveWindowChanged;
783
tabControl.PageAdded += delegate { OnActiveWindowChanged (null, null); };
784
tabControl.PageRemoved += delegate { OnActiveWindowChanged (null, null); };
786
tabControl.ButtonPressEvent += delegate(object sender, ButtonPressEventArgs e) {
787
int tab = tabControl.FindTabAtPosition (e.Event.XRoot, e.Event.YRoot);
790
tabControl.CurrentPage = tab;
791
if (e.Event.Type == Gdk.EventType.TwoButtonPress)
792
ToggleFullViewMode ();
795
this.tabControl.PopupMenu += delegate {
798
this.tabControl.ButtonReleaseEvent += delegate (object sender, Gtk.ButtonReleaseEventArgs e) {
799
int tab = tabControl.FindTabAtPosition (e.Event.XRoot, e.Event.YRoot);
802
if (e.Event.Button == 3)
806
tabControl.TabsReordered += new TabsReorderedHandler (OnTabsReordered);
808
// The main document area
809
documentDockItem = dock.AddItem ("Documents");
810
documentDockItem.Behavior = DockItemBehavior.Locked;
811
documentDockItem.Expand = true;
812
documentDockItem.DrawFrame = false;
813
documentDockItem.Label = GettextCatalog.GetString ("Documents");
814
documentDockItem.Content = tabControl;
816
// Add some hiden items to be used as position reference
817
DockItem dit = dock.AddItem ("__left");
818
dit.DefaultLocation = "Documents/Left";
819
dit.Behavior = DockItemBehavior.Locked;
820
dit.DefaultVisible = false;
822
dit = dock.AddItem ("__right");
823
dit.DefaultLocation = "Documents/Right";
824
dit.Behavior = DockItemBehavior.Locked;
825
dit.DefaultVisible = false;
827
dit = dock.AddItem ("__top");
828
dit.DefaultLocation = "Documents/Top";
829
dit.Behavior = DockItemBehavior.Locked;
830
dit.DefaultVisible = false;
832
dit = dock.AddItem ("__bottom");
833
dit.DefaultLocation = "Documents/Bottom";
834
dit.Behavior = DockItemBehavior.Locked;
835
dit.DefaultVisible = false;
838
fullViewVBox.ShowAll ();
840
fullViewVBox.PackEnd (this.StatusBar, false, true, 0);
842
if (MonoDevelop.Core.PropertyService.IsMac)
843
this.StatusBar.HasResizeGrip = true;
845
if (GdkWindow != null && GdkWindow.State == Gdk.WindowState.Maximized)
846
IdeApp.Workbench.StatusBar.HasResizeGrip = false;
847
SizeAllocated += delegate {
848
if (GdkWindow != null)
849
IdeApp.Workbench.StatusBar.HasResizeGrip = GdkWindow.State != Gdk.WindowState.Maximized;
853
// create DockItems for all the pads
854
foreach (PadCodon content in padContentCollection)
855
AddPad (content, content.DefaultPlacement, content.DefaultStatus);
858
if (System.IO.File.Exists (configFile)) {
859
dock.LoadLayouts (configFile);
860
foreach (string layout in dock.Layouts) {
861
if (!layouts.Contains (layout) && !layout.EndsWith (fullViewModeTag))
862
layouts.Add (layout);
865
} catch (Exception ex) {
866
LoggingService.LogError (ex.ToString ());
870
void InitializeLayout (string name)
872
if (!layouts.Contains (name))
875
if (dock.Layouts.Contains (name))
878
dock.CreateLayout (name, true);
879
dock.CurrentLayout = name;
880
documentDockItem.Visible = true;
882
LayoutExtensionNode stockLayout = null;
883
foreach (LayoutExtensionNode node in AddinManager.GetExtensionNodes (stockLayoutsPath)) {
884
if (node.Name == name) {
890
if (stockLayout == null)
893
HashSet<string> visible = new HashSet<string> ();
895
foreach (LayoutPadExtensionNode pad in stockLayout.ChildNodes) {
896
DockItem it = dock.GetItem (pad.Id);
899
string loc = pad.Placement ?? it.DefaultLocation;
900
if (!string.IsNullOrEmpty (loc))
901
it.SetDockLocation (ToDockLocation (loc));
902
DockItemStatus stat = pad.StatusSet ? pad.Status : it.DefaultStatus;
904
visible.Add (pad.Id);
908
foreach (PadCodon node in padContentCollection) {
909
if (!visible.Contains (node.Id) && node.DefaultLayouts != null && (node.DefaultLayouts.Contains (stockLayout.Id) || node.DefaultLayouts.Contains ("*"))) {
910
DockItem it = dock.GetItem (node.Id);
913
if (!string.IsNullOrEmpty (node.DefaultPlacement))
914
it.SetDockLocation (ToDockLocation (node.DefaultPlacement));
915
it.Status = node.DefaultStatus;
916
visible.Add (node.Id);
921
foreach (DockItem it in dock.GetItems ()) {
922
if (!visible.Contains (it.Id) && ((it.Behavior & DockItemBehavior.Sticky) == 0) && it != documentDockItem)
929
Gtk.Menu contextMenu = IdeApp.CommandService.CreateMenu ("/MonoDevelop/Ide/ContextMenu/DocumentTab");
930
if (contextMenu != null)
931
contextMenu.Popup ();
934
void OnTabsReordered (Widget widget, int oldPlacement, int newPlacement)
936
IdeApp.Workbench.ReorderDocuments (oldPlacement, newPlacement);
629
939
public void ResetToolbars ()
631
layout.ResetToolbars ();
941
toolbarFrame.ResetToolbarPositions ();
944
bool IsInFullViewMode {
946
return dock.CurrentLayout.EndsWith (fullViewModeTag);
950
//don't allow the "full view" layouts to persist - they are always derived from the "normal" layout
951
//else they will diverge
952
void DestroyFullViewLayouts (string oldLayout)
954
if (oldLayout != null && oldLayout.EndsWith (fullViewModeTag)) {
955
dock.DeleteLayout (oldLayout);
956
toolbarFrame.DeleteLayout (oldLayout);
960
public void ToggleFullViewMode ()
962
this.tabControl.LeaveDragMode (0);
964
if (IsInFullViewMode) {
965
var oldLayout = dock.CurrentLayout;
966
toolbarFrame.CurrentLayout = dock.CurrentLayout = CurrentLayout;
967
DestroyFullViewLayouts (oldLayout);
969
string fullViewLayout = CurrentLayout + fullViewModeTag;
970
if (!dock.HasLayout (fullViewLayout))
971
dock.CreateLayout (fullViewLayout, true);
972
toolbarFrame.CurrentLayout = dock.CurrentLayout = fullViewLayout;
973
foreach (DockItem it in dock.GetItems ()) {
974
if (it.Behavior != DockItemBehavior.Locked && it.Visible)
975
it.Status = DockItemStatus.AutoHide;
977
foreach (var tb in toolbarFrame.Toolbars)
978
tb.Status = new DockToolbarStatus (tb.Id, false, tb.Position);
634
982
protected override bool OnKeyPressEvent (Gdk.EventKey evnt)
636
//FIXME: Mac-ify this. The control key use is hardcoded into DocumentSwitcher too
637
Gdk.ModifierType tabSwitchModifier = Gdk.ModifierType.ControlMask;
639
984
// Handle Alt+1-0 keys
640
985
Gdk.ModifierType winSwitchModifier = PropertyService.IsMac
641
986
? KeyBindingManager.SelectionModifierControl
705
1050
if (args.Change == ExtensionChange.Add) {
706
1051
ShowPadNode (args.ExtensionNode);
707
RedrawAllComponents ();
710
1054
RemovePadNode (args.ExtensionNode);
714
// Handle keyboard shortcuts
717
public event EventHandler ActiveWorkbenchWindowChanged;
719
/// Context switching specific parts
720
WorkbenchContext context = WorkbenchContext.Edit;
722
public WorkbenchContext Context {
723
get { return context; }
726
if (ContextChanged != null)
727
ContextChanged (this, new EventArgs());
731
public event EventHandler ContextChanged;
1058
void OnLayoutsExtensionChanged (object s, ExtensionNodeEventArgs args)
1060
if (args.Change == ExtensionChange.Add)
1061
layouts.Add (((LayoutExtensionNode)args.ExtensionNode).Name);
1063
layouts.Remove (((LayoutExtensionNode)args.ExtensionNode).Name);
1066
#region View management
1068
bool SelectLastActiveWindow (IWorkbenchWindow cur)
1070
if (lastActiveWindows.Count == 0)
1072
IWorkbenchWindow last = null;
1074
last = lastActiveWindows.Last.Value;
1075
lastActiveWindows.RemoveLast ();
1076
} while (lastActiveWindows.Count > 0 && (last == cur || last == null || (last != null && last.ViewContent == null)));
1078
last.SelectWindow ();
1084
void CloseWindowEvent (object sender, WorkbenchWindowEventArgs e)
1086
SdiWorkspaceWindow f = (SdiWorkspaceWindow) sender;
1088
// Unsubscribe events to avoid memory leaks
1089
f.TabLabel.CloseClicked -= new EventHandler (closeClicked);
1091
if (f.ViewContent != null) {
1092
CloseContent (f.ViewContent);
1093
if (e.WasActive && !SelectLastActiveWindow (f))
1094
OnActiveWindowChanged(this, null);
1096
lastActiveWindows.Remove (f);
1099
void closeClicked (object o, EventArgs e)
1101
Widget tabLabel = ((Widget)o);
1102
foreach (Widget child in tabControl.Children) {
1103
if (tabControl.GetTabLabel (child) == tabLabel) {
1104
int pageNum = tabControl.PageNum (child);
1105
((SdiWorkspaceWindow)child).CloseWindow (false, false, pageNum);
1111
internal void RemoveTab (int pageNum) {
1113
// Weird switch page events are fired when a tab is removed.
1114
// This flag avoids unneeded events.
1115
ignorePageSwitch = true;
1116
IWorkbenchWindow w = ActiveWorkbenchWindow;
1117
tabControl.RemovePage (pageNum);
1118
ignorePageSwitch = false;
1119
if (w != ActiveWorkbenchWindow)
1120
OnActiveWindowChanged (null, null);
1122
ignorePageSwitch = false;
1128
#region Dock Item management
1130
public IPadWindow GetPadWindow (PadCodon content)
1133
padWindows.TryGetValue (content, out w);
1137
public bool IsVisible (PadCodon padContent)
1139
DockItem item = GetDockItem (padContent);
1141
return item.Visible;
1145
public bool IsContentVisible (PadCodon padContent)
1147
DockItem item = GetDockItem (padContent);
1149
return item.ContentVisible;
1153
public void HidePad (PadCodon padContent)
1155
DockItem item = GetDockItem (padContent);
1157
item.Visible = false;
1160
public void ActivatePad (PadCodon padContent, bool giveFocus)
1162
DockItem item = GetDockItem (padContent);
1164
item.Present (giveFocus);
1167
public bool IsSticky (PadCodon padContent)
1169
DockItem item = GetDockItem (padContent);
1170
return item != null && (item.Behavior & DockItemBehavior.Sticky) != 0;
1173
public void SetSticky (PadCodon padContent, bool sticky)
1175
DockItem item = GetDockItem (padContent);
1178
item.Behavior |= DockItemBehavior.Sticky;
1180
item.Behavior &= ~DockItemBehavior.Sticky;
1184
internal DockItem GetDockItem (PadCodon content)
1186
if (padContentCollection.Contains (content)) {
1187
DockItem item = dock.GetItem (content.PadId);
1193
void CreatePadContent (bool force, PadCodon padCodon, PadWindow window, DockItem item)
1195
if (force || item.Content == null) {
1196
IPadContent newContent = padCodon.InitializePadContent (window);
1198
Gtk.Widget pcontent;
1199
if (newContent is Widget) {
1200
pcontent = newContent.Control;
1202
PadCommandRouterContainer crc = new PadCommandRouterContainer (window, newContent.Control, newContent, true);
1207
PadCommandRouterContainer router = new PadCommandRouterContainer (window, pcontent, toolbarFrame, false);
1209
item.Content = router;
1213
string ToDockLocation (string loc)
1215
string location = "";
1216
foreach (string s in loc.Split (' ')) {
1217
if (string.IsNullOrEmpty (s))
1219
if (location.Length > 0)
1221
if (s.IndexOf ('/') == -1)
1222
location += "__" + s.ToLower () + "/CenterBefore";
1229
void AddPad (PadCodon padCodon, string placement, DockItemStatus defaultStatus)
1231
PadWindow window = new PadWindow (this, padCodon);
1232
window.Icon = padCodon.Icon;
1233
padWindows [padCodon] = window;
1234
padCodons [window] = padCodon;
1236
window.StatusChanged += new EventHandler (UpdatePad);
1238
string location = ToDockLocation (placement);
1240
DockItem item = dock.AddItem (padCodon.PadId);
1241
item.Label = GettextCatalog.GetString (padCodon.Label);
1242
item.Icon = ImageService.GetPixbuf (padCodon.Icon, IconSize.Menu);
1243
item.DefaultLocation = location;
1244
item.DefaultVisible = false;
1245
item.DefaultStatus = defaultStatus;
1246
item.DockLabelProvider = padCodon;
1249
if (padCodon.Initialized) {
1250
CreatePadContent (true, padCodon, window, item);
1252
item.ContentRequired += delegate {
1253
CreatePadContent (false, padCodon, window, item);
1257
item.VisibleChanged += delegate {
1259
window.NotifyShown ();
1261
window.NotifyHidden ();
1264
item.ContentVisibleChanged += delegate {
1265
if (item.ContentVisible)
1266
window.NotifyContentShown ();
1268
window.NotifyContentHidden ();
1271
if (!padContentCollection.Contains (padCodon))
1272
padContentCollection.Add (padCodon);
1275
void UpdatePad (object source, EventArgs args)
1277
IPadWindow window = (IPadWindow) source;
1278
if (!padCodons.ContainsKey (window))
1280
PadCodon codon = padCodons [window];
1281
DockItem item = GetDockItem (codon);
1283
string windowTitle = GettextCatalog.GetString (window.Title);
1284
if (String.IsNullOrEmpty (windowTitle))
1285
windowTitle = GettextCatalog.GetString (codon.Label);
1286
if (window.IsWorking)
1287
windowTitle = "<span foreground='blue'>" + windowTitle + "</span>";
1288
else if (window.HasErrors && !window.ContentVisible)
1289
windowTitle = "<span foreground='red'>" + windowTitle + "</span>";
1290
else if (window.HasNewData && !window.ContentVisible)
1291
windowTitle = "<b>" + windowTitle + "</b>";
1292
item.Label = windowTitle;
1293
item.Icon = ImageService.GetPixbuf (window.Icon, IconSize.Menu);
734
1300
class PadActivationHandler: CommandHandler
747
1313
wb.BringToFront (pad, true);
1317
class PadCommandRouterContainer: CommandRouterContainer
1319
public PadCommandRouterContainer (PadWindow window, Gtk.Widget child, object target, bool continueToParent): base (child, target, continueToParent)
1324
// The SdiDragNotebook class allows redirecting the command route to the ViewCommandHandler
1325
// object of the selected document, which implement some default commands.
1327
class SdiDragNotebook: DragNotebook, ICommandDelegatorRouter, IShadedWidget
1329
ShadedContainer shadedContainer;
1331
public SdiDragNotebook (ShadedContainer shadedContainer)
1333
this.shadedContainer = shadedContainer;
1334
shadedContainer.Add (this);
1336
PageAdded += delegate {
1337
if (AreasChanged != null)
1338
AreasChanged (this, EventArgs.Empty);
1340
PageRemoved += delegate {
1341
if (AreasChanged != null)
1342
AreasChanged (this, EventArgs.Empty);
1346
public object GetNextCommandTarget ()
1351
public object GetDelegatedCommandTarget ()
1353
SdiWorkspaceWindow win = (SdiWorkspaceWindow) CurrentPageWidget;
1354
return win != null ? win.CommandHandler : null;
1357
protected override bool OnExposeEvent (Gdk.EventExpose evnt)
1359
shadedContainer.DrawBackground (this);
1360
return base.OnExposeEvent (evnt);
1363
public event EventHandler AreasChanged;
1365
public IEnumerable<Gdk.Rectangle> GetShadedAreas ()
1367
Gdk.Rectangle rect = Allocation;
1368
if (CurrentPageWidget != null && CurrentPageWidget.Visible)
1369
rect.Height -= CurrentPageWidget.Allocation.Height;