📄 tabbedgroups.cs
字号:
[DefaultValue("New &Vertical Tab Group")]
public string NewVerticalMenuText
{
get { return _newVerticalMenuText; }
set { _newVerticalMenuText = value; }
}
public void ResetNewVerticalMenuText()
{
NewVerticalMenuText = "New &Vertical Tab Group";
}
[Localizable(true)]
[Category("Text String")]
[DefaultValue("New &Horizontal Tab Group")]
public string NewHorizontalMenuText
{
get { return _newHorizontalMenuText; }
set { _newHorizontalMenuText = value; }
}
public void ResetNewHorizontalMenuText()
{
NewHorizontalMenuText = "New &Horizontal Tab Group";
}
[Category("Shortcuts")]
public Shortcut CloseShortcut
{
get { return _closeShortcut; }
set { _closeShortcut = value; }
}
protected bool ShouldSerializeCloseShortcut()
{
return !_closeShortcut.Equals(Shortcut.CtrlShiftC);
}
public void ResetCloseShortcut()
{
CloseShortcut = Shortcut.CtrlShiftC;
}
[Category("Shortcuts")]
public Shortcut ProminentShortcut
{
get { return _prominentShortcut; }
set { _prominentShortcut = value; }
}
protected bool ShouldSerializeProminentShortcut()
{
return !_prominentShortcut.Equals(Shortcut.CtrlShiftT);
}
public void ResetProminentShortcut()
{
ProminentShortcut = Shortcut.CtrlShiftT;
}
[Category("Shortcuts")]
public Shortcut RebalanceShortcut
{
get { return _rebalanceShortcut; }
set { _rebalanceShortcut = value; }
}
protected bool ShouldSerializeRebalanceShortcut()
{
return !_rebalanceShortcut.Equals(Shortcut.CtrlShiftR);
}
public void ResetRebalanceShortcut()
{
RebalanceShortcut = Shortcut.CtrlShiftR;
}
[Category("Shortcuts")]
public Shortcut MovePreviousShortcut
{
get { return _movePreviousShortcut; }
set { _movePreviousShortcut = value; }
}
protected bool ShouldSerializeMovePreviousShortcut()
{
return !_movePreviousShortcut.Equals(Shortcut.CtrlShiftP);
}
public void ResetMovePreviousShortcut()
{
MovePreviousShortcut = Shortcut.CtrlShiftP;
}
[Category("Shortcuts")]
public Shortcut MoveNextShortcut
{
get { return _moveNextShortcut; }
set { _moveNextShortcut = value; }
}
protected bool ShouldSerializeMoveNextShortcut()
{
return !_moveNextShortcut.Equals(Shortcut.CtrlShiftN);
}
public void ResetMoveNextShortcut()
{
MoveNextShortcut = Shortcut.CtrlShiftN;
}
[Category("Shortcuts")]
public Shortcut SplitVerticalShortcut
{
get { return _splitVerticalShortcut; }
set { _splitVerticalShortcut = value; }
}
protected bool ShouldSerializeSplitVerticalShortcut()
{
return !_splitVerticalShortcut.Equals(Shortcut.CtrlShiftV);
}
public void ResetSplitVerticalShortcut()
{
SplitVerticalShortcut = Shortcut.CtrlShiftV;
}
[Category("Shortcuts")]
public Shortcut SplitHorizontalShortcut
{
get { return _splitHorizontalShortcut; }
set { _splitHorizontalShortcut = value; }
}
protected bool ShouldSerializeSplitHorizontalShortcut()
{
return !_splitHorizontalShortcut.Equals(Shortcut.CtrlShiftH);
}
public void ResetSplitHorizontalShortcut()
{
SplitHorizontalShortcut = Shortcut.CtrlShiftH;
}
[Category("TabbedGroups")]
public ImageList ImageList
{
get { return _imageList; }
set
{
if (_imageList != value)
{
// Propogate to all children
Notify(TabGroupBase.NotifyCode.ImageListChanging);
_imageList = value;
// Propogate to all children
Notify(TabGroupBase.NotifyCode.ImageListChanged);
}
}
}
protected bool ShouldSerializeImageList()
{
return _imageList != null;
}
public void ResetImageList()
{
ImageList = null;
}
[Category("TabbedGroups")]
[DefaultValue(typeof(DisplayTabModes), "ShowAll")]
public DisplayTabModes DisplayTabMode
{
get { return _displayTabMode; }
set
{
if (_displayTabMode != value)
{
_displayTabMode = value;
// Propogate to all children
Notify(TabGroupBase.NotifyCode.DisplayTabMode);
}
}
}
public void ResetDisplayTabMode()
{
DisplayTabMode = DisplayTabModes.ShowAll;
}
[Category("TabbedGroups")]
[DefaultValue(true)]
public bool SaveControls
{
get { return _saveControls; }
set { _saveControls = value; }
}
public void ResetSaveControls()
{
SaveControls = true;
}
[Category("TabbedGroups")]
public bool Dirty
{
get { return _dirty; }
set
{
if (_dirty != value)
{
_dirty = value;
OnDirtyChanged(EventArgs.Empty);
}
}
}
protected bool ShouldSerializeDirty()
{
return false;
}
public void ResetDirty()
{
Dirty = false;
}
[Category("TabbedGroups")]
[DefaultValue(true)]
public bool AutoCalculateDirty
{
get { return _autoCalculateDirty; }
set { _autoCalculateDirty = value; }
}
public void ResetAutoCalculateDirty()
{
AutoCalculateDirty = true;
}
[Category("TabbedGroups")]
public TabGroupLeaf ActiveLeaf
{
get { return _activeLeaf; }
set
{
if (_activeLeaf != value)
{
// Mark layout as dirty
if (_autoCalculateDirty)
_dirty = true;
// Remove selection highlight from old leaf
if (_activeLeaf != null)
{
// Get access to the contained tab control
TabControl tc = _activeLeaf.GroupControl as Controls.TabControl;
// Remove bold text for the selected page
tc.BoldSelectedPage = false;
_activeLeaf = null;
}
// Set selection highlight on new active leaf
if (value != null)
{
// Get access to the contained tab control
TabControl tc = value.GroupControl as Controls.TabControl;
// Remove bold text for the selected page
tc.BoldSelectedPage = true;
_activeLeaf = value;
}
// Is the tab mode dependant on the active leaf value
if ((_displayTabMode == DisplayTabModes.ShowActiveLeaf) ||
(_displayTabMode == DisplayTabModes.ShowActiveAndMouseOver))
{
// Yes, better notify a change in value so it can be applied
Notify(TabGroupBase.NotifyCode.DisplayTabMode);
}
OnActiveLeafChanged(EventArgs.Empty);
}
}
}
public void ResetActiveLeaf()
{
ActiveLeaf = null;
}
[Category("TabbedGroups")]
public bool AtLeastOneLeaf
{
get { return _atLeastOneLeaf; }
set
{
if (_atLeastOneLeaf != value)
{
_atLeastOneLeaf = value;
// Do always need at least one leaf?
if (_atLeastOneLeaf)
{
// Is there at least one?
if (_numLeafs == 0)
{
// No, create a default entry for the root sequence
_root.AddNewLeaf();
// Mark layout as dirty
if (_autoCalculateDirty)
_dirty = true;
}
}
else
{
// Are there some potential leaves not needed
if (_numLeafs > 0)
{
// Use compaction so only needed ones are retained
if (_autoCompact)
Compact();
}
}
}
}
}
public void ResetAtLeastOneLeaf()
{
AtLeastOneLeaf = true;
}
[Category("TabbedGroups")]
[DefaultValue(true)]
public bool AutoCompact
{
get { return _autoCompact; }
set { _autoCompact = value; }
}
public void ResetAutoCompact()
{
_autoCompact = true;
}
public void Rebalance()
{
_root.Rebalance(true);
}
public void Rebalance(bool recurse)
{
_root.Rebalance(recurse);
}
public void Compact()
{
Compact(_compactOptions);
}
public void Compact(CompactFlags flags)
{
// When entries are removed because of compacting this may cause the container object
// to start a compacting request. Prevent this recursion by using a simple varible.
if (!_compacting)
{
// We never compact when loading/initializing the contents
if (!_initializing)
{
_compacting = true;
_root.Compact(flags);
_compacting = false;
EnforceAtLeastOneLeaf();
}
}
}
public TabGroupLeaf FirstLeaf()
{
return RecursiveFindLeafInSequence(_root, true);
}
public TabGroupLeaf LastLeaf()
{
return RecursiveFindLeafInSequence(_root, false);
}
public TabGroupLeaf NextLeaf(TabGroupLeaf current)
{
// Get parent of the provided leaf
TabGroupSequence tgs = current.Parent as TabGroupSequence;
// Must have a valid parent sequence
if (tgs != null)
return RecursiveFindLeafInSequence(tgs, current, true);
else
return null;
}
public TabGroupLeaf PreviousLeaf(TabGroupLeaf current)
{
// Get parent of the provided leaf
TabGroupSequence tgs = current.Parent as TabGroupSequence;
// Must have a valid parent sequence
if (tgs != null)
return RecursiveFindLeafInSequence(tgs, current, false);
else
return null;
}
internal void MoveActiveToNearestFromLeaf(TabGroupBase oldLeaf)
{
// Must have a reference to begin movement
if (oldLeaf != null)
{
// Find the parent sequence of leaf, remember that a
// leaf must be contained within a sequence instance
TabGroupSequence tgs = oldLeaf.Parent as TabGroupSequence;
// Must be valid, but had better check anyway
if (tgs != null)
{
// Move relative to given base in the sequence
MoveActiveInSequence(tgs, oldLeaf);
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -