Implement a panel group system
Opened this issue · 0 comments
I have quite an elaborate plan for this, and I have no idea when I'll get a chance to implement this...
The feature will allow you to register a group panel type that behaves much like a single panel except that it contains its own set of panels inside it. These panels can be moved around and resized within the group as well as some other limited functionality.
The most important feature is that each panel inside the group can be aware of the group, and pass messages between each-other privately.
wcDocker.registerPanelGroup('group name', {
onCreate: function(myGroup) {
// Add panels identical to how you would add panels to the wcDocker object
var somePanel = myGroup.addPanel('some panel', wcDocker.DOCK.TOP);
myGroup.addPanel('other panel', wcDocker.DOCK.RIGHT, somePanel);
// Similar to the wcPanel class, you can initialize properties of the group
myGroup.minSize(300, 300);
myGroup.closeable(false);
},
// Determine what types of panels can be created within this group.
// Option 1: A true value allows all panels without restriction, any
// panel can be added or removed from this group.
allowedPanels: true,
// Option 2: using a false value will restrict the allowed panels to exactly
// what this group was initialized with above. You will neither
// be able to remove or add panels.
allowedPanels: false,
// Option 3: An array of panel names to allow
allowedPanels: ['some panel', 'other panel'],
// Option 4: A more complex array of objects that describe exactly how
// many of each panel you will allow
allowedPanels: [{
panel: 'some panel',
min: 2,
max: 2
}, {
panel: 'other panel',
min: 1,
max: 2
}],
// Option 5: A mixture of options 3 and 4
allowedPanels: ['some panel', {
panel: 'other panel',
min: 0,
max: 1
}],
// This feature will allow the user to drag a panel from an external
// location into the group, as long as it passes the panel type restrictions
// listed above.
adoptPanels: true,
// This is the opposite of the adoptPanels option, it allows panels inside
// the group to be moved out
releasePanels: true,
});
This is still just an idea. My goal is to make the grouping interface as close as I can to a normal panel, and most likely consider them to be panels themselves. You would be able to add a new group to wcDocker the same way you would add a new panel type.
wcDocker.addPanel('group name', wcDocker.DOCK.LEFT, somePanel);