aboutsummaryrefslogtreecommitdiff
path: root/includes/js/dojox/gfx/demos/roundedPane.html
blob: 4abb7755674a6ef0ef35ae52be960f3cb589d886 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
    <head>

		<title>rounded skeleton page | The Dojo Toolkit</title>
			
		<script type="text/javascript" src="../../../dojo/dojo.js"
				djConfig="parseOnLoad:true, isDebug:true"></script>

		<script type="text/javascript">
		
			dojo.require("dijit.layout.ContentPane");
			dojo.require("dijit._Templated");
			dojo.require("dojox.gfx");
			dojo.require("dojo.dnd.TimedMoveable");
			
			dojo.declare("my.RoundedContentPane",[dijit.layout.ContentPane,dijit._Templated],{
				// radius: Integer
				//		radius of the corners
				radius:15,
				// moveable: Boolean
				// 		if true, the node is movable by either the containerNode, or an optional node
				//		found by the handle attribute
				moveable:false,
				// handle: String
				// 		a CSS3 selector query to match the handle for this node, scoped to this.domNode
				handle:".handle",
				
				// template:
				templateString:
					'<div><div style="position:relative;">' +
						'<div dojoAttachPoint="surfaceNode"></div>' +
						'<div dojoAttachPoint="containerNode"></div>' +
					'</div></div>',
				
				startup:function(){
					
					this.inherited(arguments);
					this._initSurface();
					dojo.style(this.surfaceNode,{
						position:"absolute",
						top:0,
						left:0
					});
					
					if(this.moveable){
						this._mover = new dojo.dnd.TimedMoveable(this.domNode,{
							handle: dojo.query(this.handle,this.domNode)[0] ||this.containerNode,
							timeout:69
						});
					}
			
				},
				
				_initSurface: function(){
			
					var s = dojo.marginBox(this.domNode);
					var stroke = 2;
					
					this.surface = dojox.gfx.createSurface(this.surfaceNode, s.w + stroke * 2, s.h + stroke * 2);
					this.roundedShape = this.surface.createRect({
							r: this.radius,
							width: s.w,
							height: s.h
						})
						.setFill([0, 0, 0, 0.5]) // black, 50% transparency
						.setStroke({ color:[255,255,255,1], width:stroke }) // solid white
					;
					this.resize(s);
					
				},
				
				resize:function(size){
					
					if(!this.surface){ this._initSurfce(); }
			
					this.surface.setDimensions(size.w,size.h);
					this.roundedShape.setShape({
						width: size.w,
						height: size.h
					});
			
					var _offset = Math.floor(this.radius / 2);		
					dojo.style(this.containerNode,{
						color: "#fff",
						position: "absolute",
						overflow: "auto",
						top: _offset + "px",
						left: _offset + "px",
						height: (size.h - _offset * 2) + "px",
						width: (size.w - _offset * 2) + "px"
					});
					
				}
				
			});
		</script>
			
		<style type="text/css">
			body { background:#ededed; }
		</style>
	
    </head>
    <body>
		
		<h1>Some gfx + ContentPane's</h1>

		<div dojoType="my.RoundedContentPane" radius="55" title="Pane 2" style="width:200px; height:400px; float:right">
			<h3>YO!</h3>
			<p>lorem</p><p>lorem</p><p>lorem</p><p>lorem</p><p>lorem</p><p>lorem</p><p>lorem</p><p>lorem</p><p>lorem</p><p>lorem</p><p>lorem</p><p>lorem</p><p>lorem</p><p>lorem</p><p>lorem</p><p>lorem</p><p>lorem</p><p>lorem</p><p>lorem</p><p>lorem</p><p>lorem</p><p>lorem</p><p>lorem</p><p>lorem</p>
		</div>

		<div style="width:400px; height:200px;" dojoType="my.RoundedContentPane">
			LOREM, ipsum, dollllllllllor:
			.roundedContent {
				padding: 31px;
				font-family: 'Tahoma';
				font-size: 12px;
				color:#fff; 
			}<p>.roundedContent {
				padding: 31px;
				font-family: 'Tahoma';
				font-size: 12px;
				color:#fff; 
			}</p><p>.roundedContent {
				padding: 31px;
				font-family: 'Tahoma';
				font-size: 12px;
				color:#fff; 
			}</p><p>.roundedContent {
				padding: 31px;
				font-family: 'Tahoma';
				font-size: 12px;
				color:#fff; 
			}</p><p>.roundedContent {
				padding: 31px;
				font-family: 'Tahoma';
				font-size: 12px;
				color:#fff; 
			}</p><p>.roundedContent {
				padding: 31px;
				font-family: 'Tahoma';
				font-size: 12px;
				color:#fff; 
			}</p><p>.roundedContent {
				padding: 31px;
				font-family: 'Tahoma';
				font-size: 12px;
				color:#fff; 
			}</p><p>.roundedContent {
				padding: 31px;
				font-family: 'Tahoma';
				font-size: 12px;
				color:#fff; 
			}</p><p>.roundedContent {
				padding: 31px;
				font-family: 'Tahoma';
				font-size: 12px;
				color:#fff; 
			}</p><p>.roundedContent {
				padding: 31px;
				font-family: 'Tahoma';
				font-size: 12px;
				color:#fff; 
			}</p><p>.roundedContent {
				padding: 31px;
				font-family: 'Tahoma';
				font-size: 12px;
				color:#fff; 
			}</p><p>.roundedContent {
				padding: 31px;
				font-family: 'Tahoma';
				font-size: 12px;
				color:#fff; 
			}</p>
			
		</div>
	
	
		<div radius="45" style="width:400px; height:200px;" moveable="true" dojoType="my.RoundedContentPane" handle=".myHandle">
			<h4 class="myHandle" style="cursor:move; margin-top:0; border:1px solid #666">Moveable Handle</h4>
			LOREM, ipsum, dollllllllllor:			
		</div>
	
	
		<div dojoType="my.RoundedContentPane" title="Pane 1" moveable="true" style="width:100px; height:100px;">
			lorem ipsum (small moveable)
		</div>		
	
    </body>
</html>