Skip to content

Commit

Permalink
Passing reference of dock manager to all the dock containers
Browse files Browse the repository at this point in the history
  • Loading branch information
coderespawn committed Feb 15, 2013
1 parent 6cee046 commit 4eaf73d
Show file tree
Hide file tree
Showing 215 changed files with 33,014 additions and 32,975 deletions.
108 changes: 54 additions & 54 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,55 +1,55 @@
# Dart Excludes #
#################
*~
*.js
*.js_
.children
.project
.gitmodules
*.map
*.lock
*.tmp
packages/
out/

# Compiled source #
###################
*.com
*.class
*.exe
*.dll
*.o
*.obj
*.ncb
*.so

# Packages #
############
# it's better to unpack these files and commit the raw source
# git has its own built in compression methods
*.7z
*.dmg
*.gz
*.iso
*.jar
*.rar
*.tar
*.zip

# Logs and databases #
######################
*.log
*.sql
*.sqlite

# OS generated files #
######################
.DS_Store*
ehthumbs.db
Icon?
Thumbs.db

# Binary directories #
######################
bin/
# Dart Excludes #
#################
*~
*.js
*.js_
.children
.project
.gitmodules
*.map
*.lock
*.tmp
packages/
out/

# Compiled source #
###################
*.com
*.class
*.exe
*.dll
*.o
*.obj
*.ncb
*.so

# Packages #
############
# it's better to unpack these files and commit the raw source
# git has its own built in compression methods
*.7z
*.dmg
*.gz
*.iso
*.jar
*.rar
*.tar
*.zip

# Logs and databases #
######################
*.log
*.sql
*.sqlite

# OS generated files #
######################
.DS_Store*
ehthumbs.db
Icon?
Thumbs.db

# Binary directories #
######################
bin/
obj/
6 changes: 3 additions & 3 deletions AUTHORS
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# Dock Spawn Authors

Ali Akbar <[email protected]>
# Dock Spawn Authors
Ali Akbar <[email protected]>
38 changes: 19 additions & 19 deletions MIT-LICENSE.txt
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
Copyright (c) 2012 CodeRespawn.com and other contributors

Permission is hereby granted, free
of charge, to any person obtaining a copy of this software and associated
documentation files (the "Software"), to deal in the Software without
restriction, including without limitation the rights to use, copy, modify,
merge, publish, distribute, sublicense, and/or sell copies of the Software, and
to permit persons to whom the Software is furnished to do so, subject to the
following conditions:

The above copyright notice and this permission notice
shall be included in all copies or substantial portions of the Software.

THE
SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
Copyright (c) 2012 CodeRespawn.com and other contributors
Permission is hereby granted, free
of charge, to any person obtaining a copy of this software and associated
documentation files (the "Software"), to deal in the Software without
restriction, including without limitation the rights to use, copy, modify,
merge, publish, distribute, sublicense, and/or sell copies of the Software, and
to permit persons to whom the Software is furnished to do so, subject to the
following conditions:
The above copyright notice and this permission notice
shall be included in all copies or substantial portions of the Software.
THE
SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
2 changes: 1 addition & 1 deletion dock_spawn/.children
Original file line number Diff line number Diff line change
@@ -1 +1 @@
dock_spawn.dart
dock_spawn.dart
34 changes: 17 additions & 17 deletions dock_spawn/.project
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>DockManager</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>com.google.dart.tools.core.dartBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>com.google.dart.tools.core.dartNature</nature>
</natures>
</projectDescription>
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>DockManager</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>com.google.dart.tools.core.dartBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>com.google.dart.tools.core.dartNature</nature>
</natures>
</projectDescription>
54 changes: 27 additions & 27 deletions dock_spawn/containers/dock_container.dart
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
part of dock_spawn;

/**
* Any dockable entity needs to implement this inteface
*/
abstract class IDockContainer {
DockManager get dockManager;
void resize(int _width, int _height);
void performLayout(List<IDockContainer> children);
void destroy();
void setActiveChild(IDockContainer child);
void saveState(Map<String, Object> state);
void loadState(Map<String, Object> state);
Element get containerElement;
String containerType;
int get width;
int get height;
String name;

/**
* Indicates the minimum allowed child nodes a composite dock panel can have
* If it's children fall below this value, the composite panel is destroyed
* and it's children are moved one level up
*/
int get minimumAllowedChildNodes;
}

part of dock_spawn;

/**
* Any dockable entity needs to implement this inteface
*/
abstract class IDockContainer {
DockManager get dockManager;
void resize(int _width, int _height);
void performLayout(List<IDockContainer> children);
void destroy();
void setActiveChild(IDockContainer child);
void saveState(Map<String, Object> state);
void loadState(Map<String, Object> state);
Element get containerElement;
String containerType;
int get width;
int get height;
String name;

/**
* Indicates the minimum allowed child nodes a composite dock panel can have
* If it's children fall below this value, the composite panel is destroyed
* and it's children are moved one level up
*/
int get minimumAllowedChildNodes;
}

120 changes: 60 additions & 60 deletions dock_spawn/containers/document_dock_container.dart
Original file line number Diff line number Diff line change
@@ -1,60 +1,60 @@
part of dock_spawn;

/**
* The document manager is then central area of the dock layout hierarchy.
* This is where more important panels are placed (e.g. the text editor in an IDE,
* 3D view in a modelling package etc
*/
class DocumentManagerContainer extends FillDockContainer {

int get minimumAllowedChildNodes { return 0; }

DocumentManagerContainer(DockManager dockManager)
: super(dockManager, TabHost.DIRECTION_TOP)
{
element.classes.add("document-manager");
tabHost.createTabPage = _createDocumentTabPage;
tabHost.displayCloseButton = true;
}

TabPage _createDocumentTabPage(TabHost _tabHost, IDockContainer container) {
return new DocumentTabPage(_tabHost, container);
}

void saveState(Map<String, Object> state) {
super.saveState(state);
state['documentManager'] = true;
}

/** Returns the selected document tab */
TabPage get selectedTab => tabHost.activeTab;
}

/**
* Specialized tab page that doesn't display the panel's frame when docked in a tab page
*/
class DocumentTabPage extends TabPage {
PanelContainer panel = null;

DocumentTabPage(TabHost _host, IDockContainer _container) : super(_host, _container)
{
// If the container is a panel, extract the content element and set it as the tab's content
if (container.containerType == "panel") {
panel = container;
containerElement = panel.elementContent;

// detach the container element from the panel's frame.
// It will be reattached when this tab page is destroyed
// This enables the panel's frame (title bar etc) to be hidden
// inside the tab page
containerElement.remove();
}
}

void destroy() {
super.destroy();

// Restore the panel content element back into the panel frame
panel.elementContentHost.nodes.add(containerElement);
}
}
part of dock_spawn;

/**
* The document manager is then central area of the dock layout hierarchy.
* This is where more important panels are placed (e.g. the text editor in an IDE,
* 3D view in a modelling package etc
*/
class DocumentManagerContainer extends FillDockContainer {

int get minimumAllowedChildNodes { return 0; }

DocumentManagerContainer(DockManager dockManager)
: super(dockManager, TabHost.DIRECTION_TOP)
{
element.classes.add("document-manager");
tabHost.createTabPage = _createDocumentTabPage;
tabHost.displayCloseButton = true;
}

TabPage _createDocumentTabPage(TabHost _tabHost, IDockContainer container) {
return new DocumentTabPage(_tabHost, container);
}

void saveState(Map<String, Object> state) {
super.saveState(state);
state['documentManager'] = true;
}

/** Returns the selected document tab */
TabPage get selectedTab => tabHost.activeTab;
}

/**
* Specialized tab page that doesn't display the panel's frame when docked in a tab page
*/
class DocumentTabPage extends TabPage {
PanelContainer panel = null;

DocumentTabPage(TabHost _host, IDockContainer _container) : super(_host, _container)
{
// If the container is a panel, extract the content element and set it as the tab's content
if (container.containerType == "panel") {
panel = container;
containerElement = panel.elementContent;

// detach the container element from the panel's frame.
// It will be reattached when this tab page is destroyed
// This enables the panel's frame (title bar etc) to be hidden
// inside the tab page
containerElement.remove();
}
}

void destroy() {
super.destroy();

// Restore the panel content element back into the panel frame
panel.elementContentHost.nodes.add(containerElement);
}
}
Loading

0 comments on commit 4eaf73d

Please sign in to comment.