Created
June 22, 2012 21:43
-
-
Save qoh/2975368 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function generateWindow( %x, %y, %width, %height ) | |
{ | |
// Values. | |
%width_full = %width + 128; | |
%height_full = %height + 129; | |
%width_shape = %width + 2; | |
%height_shape = %height + 2; | |
// Base. | |
%window = new guiSwatchCtrl() | |
{ | |
position = %x - 63 SPC %y - 53; | |
extent = %width_full SPC %height_full; | |
visible = true; | |
color = "0 0 0 0"; | |
minExtent = "0 0"; | |
}; | |
// Content. | |
%window.content = new guiSwatchCtrl() | |
{ | |
position = "64 54"; | |
extent = %width SPC %height; | |
visible = true; | |
color = "255 255 255 255"; | |
minExtent = "0 0"; | |
}; | |
// Shadow. | |
%window.shadow = new guiSwatchCtrl() | |
{ | |
position = "0 0"; | |
extent = %width_full SPC %height_full; | |
visible = true; | |
color = "0 0 0 0"; | |
minExtent = "0 0"; | |
}; | |
%window.shadow.top_left = new guiBitmapCtrl() | |
{ | |
position = "0 0"; | |
extent = "134 134"; | |
visible = true; | |
bitmap = hazeResource( "images", "window/shadow/active_top_left" ); | |
}; | |
%window.shadow.top = new guiBitmapCtrl() | |
{ | |
position = "134 0"; | |
extent = %width_full - 134 * 2 SPC 54; | |
visible = true; | |
bitmap = hazeResource( "images", "window/shadow/active_top" ); | |
}; | |
%window.shadow.top_right = new guiBitmapCtrl() | |
{ | |
position = %width_full - 134 SPC 0; | |
extent = "134 134"; | |
visible = true; | |
bitmap = hazeResource( "images", "window/shadow/active_top_right" ); | |
}; | |
%window.shadow.bottom_left = new guiBitmapCtrl() | |
{ | |
position = 0 SPC %height_full - 134; | |
extent = "134 134"; | |
visible = true; | |
bitmap = hazeResource( "images", "window/shadow/active_bottom_left" ); | |
}; | |
%window.shadow.bottom = new guiBitmapCtrl() | |
{ | |
position = 134 SPC %height_full - 74; | |
extent = %width_full - 134 * 2 SPC 74; | |
visible = true; | |
bitmap = hazeResource( "images", "window/shadow/active_bottom" ); | |
}; | |
%window.shadow.bottom_right = new guiBitmapCtrl() | |
{ | |
position = %width_full - 134 SPC %height_full - 134; | |
extent = "134 134"; | |
visible = true; | |
bitmap = hazeResource( "images", "window/shadow/active_bottom_right" ); | |
}; | |
%window.shadow.left = new guiBitmapCtrl() | |
{ | |
position = "0 134"; | |
extent = 64 SPC %height_full - 134 * 2; | |
visible = true; | |
bitmap = hazeResource( "images", "window/shadow/active_left" ); | |
}; | |
%window.shadow.right = new guiBitmapCtrl() | |
{ | |
position = %width_full - 64 SPC 134; | |
extent = 64 SPC %height_full - 134 * 2; | |
visible = true; | |
bitmap = hazeResource( "images", "window/shadow/active_right" ); | |
}; | |
// Shape. | |
%window.shape = new guiSwatchCtrl() | |
{ | |
position = "63 53"; | |
extent = %width_shape SPC %height_shape; | |
visible = true; | |
color = "0 0 0 0"; | |
minExtent = "0 0"; | |
}; | |
%window.shape.top_left = new guiBitmapCtrl() | |
{ | |
position = "0 0"; | |
extent = "6 6"; | |
visible = true; | |
minExtent = "0 0"; | |
bitmap = hazeResource( "images", "window/shape/top_left" ); | |
}; | |
%window.shape.top = new guiBitmapCtrl() | |
{ | |
position = "6 0"; | |
extent = %width_shape - 6 * 2 SPC 6; | |
visible = true; | |
minExtent = "0 0"; | |
bitmap = hazeResource( "images", "window/shape/top" ); | |
}; | |
%window.shape.top_right = new guiBitmapCtrl() | |
{ | |
position = %width_shape - 6 SPC 0; | |
extent = "6 6"; | |
visible = true; | |
minExtent = "0 0"; | |
bitmap = hazeResource( "images", "window/shape/top_right" ); | |
}; | |
%window.shape.bottom_left = new guiBitmapCtrl() | |
{ | |
position = 0 SPC %height_shape - 5; | |
extent = "6 6"; | |
visible = true; | |
minExtent = "0 0"; | |
bitmap = hazeResource( "images", "window/shape/bottom_left" ); | |
}; | |
%window.shape.bottom = new guiBitmapCtrl() | |
{ | |
position = 6 SPC %height_shape - 5; | |
extent = %width_shape - 6 * 2 SPC 6; | |
visible = true; | |
minExtent = "0 0"; | |
bitmap = hazeResource( "images", "window/shape/bottom" ); | |
}; | |
%window.shape.bottom_right = new guiBitmapCtrl() | |
{ | |
position = %width_shape - 6 SPC %height_shape - 5; | |
extent = "6 6"; | |
visible = true; | |
minExtent = "0 0"; | |
bitmap = hazeResource( "images", "window/shape/bottom_right" ); | |
}; | |
%window.shape.left = new guiBitmapCtrl() | |
{ | |
position = "0 6"; | |
extent = 6 SPC %height_shape - 6 * 2; | |
visible = true; | |
minExtent = "0 0"; | |
bitmap = hazeResource( "images", "window/shape/left" ); | |
}; | |
%window.shape.right = new guiBitmapCtrl() | |
{ | |
position = %width_shape - 6 SPC 6; | |
extent = 6 SPC %height_shape - 6 * 2; | |
visible = true; | |
minExtent = "0 0"; | |
bitmap = hazeResource( "images", "window/shape/right" ); | |
}; | |
// Collect. | |
%window.add( %window.content ); | |
%window.add( %window.shadow ); | |
%window.add( %window.shape ); | |
%window.shadow.add( %window.shadow.top_left ); | |
%window.shadow.add( %window.shadow.top ); | |
%window.shadow.add( %window.shadow.top_right ); | |
%window.shadow.add( %window.shadow.bottom_left ); | |
%window.shadow.add( %window.shadow.bottom ); | |
%window.shadow.add( %window.shadow.bottom_right ); | |
%window.shadow.add( %window.shadow.left ); | |
%window.shadow.add( %window.shadow.right ); | |
%window.shape.add( %window.shape.top_left ); | |
%window.shape.add( %window.shape.top ); | |
%window.shape.add( %window.shape.top_right ); | |
%window.shape.add( %window.shape.bottom_left ); | |
%window.shape.add( %window.shape.bottom ); | |
%window.shape.add( %window.shape.bottom_right ); | |
%window.shape.add( %window.shape.left ); | |
%window.shape.add( %window.shape.right ); | |
// Finish. | |
return %window; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment