1 // Copyright 2004-2008 Castle Project - http://www.castleproject.org/
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
7 // http://www.apache.org/licenses/LICENSE-2.0
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
15 namespace Castle
.MonoRail
.Framework
.Helpers
20 /// Exposes the effect script from Thomas Fuchs
21 /// (http://script.aculo.us, http://mir.aculo.us)
24 /// Before using it, you must install the scripts. See <see cref="ScriptaculousHelper.InstallScripts"/>
26 [Obsolete("Use ScriptaculousHelper instead")]
27 public class Effects2Helper
: ScriptaculousHelper
31 /// Initializes a new instance of the <see cref="Effects2Helper"/> class.
33 public Effects2Helper() { }
35 /// Initializes a new instance of the <see cref="Effects2Helper"/> class.
36 /// setting the Controller, Context and ControllerContext.
38 /// <param name="engineContext">The engine context.</param>
39 public Effects2Helper(IEngineContext engineContext
) : base(engineContext
) { }
43 /// Make an element appear. If the element was previously set to display:none;
44 /// inside the style attribute of the element, the effect will automatically
48 /// Microsoft Internet Explorer can only set opacity on elements that have a
49 /// 'layout'. To let an element have a layout, you must set some CSS
50 /// positional properties, like 'width' or 'height'.
52 /// <param name="elementId"></param>
53 /// <returns></returns>
54 public String
Appear(String elementId
)
56 return ScriptBlock( String
.Format( "new Effect.Appear('{0}');", elementId
) );
60 /// Makes an element fade away and takes it out of the document flow
61 /// at the end of the effect by setting the CSS display property to false.
64 /// Works safely with most HTML block elements (like DIV and LI).
65 /// Microsoft Internet Explorer can only set opacity on elements that
66 /// have a 'layout'. To let an element have a layout, you must set some
67 /// CSS positional properties, like 'width' or 'height'.
69 /// <param name="elementId"></param>
70 /// <returns></returns>
71 public String
Fade(String elementId
)
73 return ScriptBlock( String
.Format( "new Effect.Fade('{0}');", elementId
) );
77 /// Gives the illusion of the element puffing away (like a in a cloud of smoke).
80 /// Works safely with most HTML block elements (like DIV and LI).
82 /// <param name="elementId"></param>
83 /// <returns></returns>
84 public String
Puff(String elementId
)
86 return ScriptBlock( String
.Format( "new Effect.Puff('{0}');", elementId
) );
90 /// Makes the element drop and fade out at the same time.
93 /// Works safely with most HTML block elements (like DIV and LI).
95 /// <param name="elementId"></param>
96 /// <returns></returns>
97 public String
DropOut(String elementId
)
99 return ScriptBlock( String
.Format( "new Effect.DropOut('{0}');", elementId
) );
103 /// Moves the element slightly to the left, then to the right, repeatedly.
106 /// Works safely with most HTML block elements (like DIV and LI).
108 /// <param name="elementId"></param>
109 /// <returns></returns>
110 public String
Shake(String elementId
)
112 return ScriptBlock( String
.Format( "new Effect.Shake('{0}');", elementId
) );
116 /// Gives the illusion of a TV-style switch off.
119 /// Works safely with most HTML block elements (like DIV and LI).
121 /// <param name="elementId"></param>
122 /// <returns></returns>
123 public String
SwitchOff(String elementId
)
125 return ScriptBlock( String
.Format( "new Effect.SwitchOff('{0}');", elementId
) );
129 /// This pair of effects simulates a window blind, where the
130 /// contents of the affected elements stay in place.
133 /// Works safely with most HTML block elements (like DIV and LI),
134 /// except table rows, table bodies and table heads.
136 /// <param name="elementId"></param>
137 /// <returns></returns>
138 public String
BlindUp(String elementId
)
140 return ScriptBlock( String
.Format( "new Effect.BlindUp('{0}');", elementId
) );
144 /// This pair of effects simulates a window blind, where the
145 /// contents of the affected elements stay in place.
148 /// Works safely with most HTML block elements (like DIV and LI),
149 /// except table rows, table bodies and table heads.
151 /// <param name="elementId"></param>
152 /// <returns></returns>
153 public String
BlindDown(String elementId
)
155 return ScriptBlock( String
.Format( "new Effect.BlindDown('{0}');", elementId
) );
159 /// This pair of effects simulates a window blind, where the contents of
160 /// the affected elements scroll up and down accordingly.
163 /// You must include a second DIV element,
164 /// wrapping the contents of the outer DIV.
165 /// So, if you call new Effect.SlideDown('x'), your element must look like this:
167 /// <div id="x"><div>contents</div></div>
169 /// Because of a bug in Internet Explorer 6 (overflow not correctly hidden),
170 /// an additional wrapper div is needed if you want to use these effects on
171 /// absolutely positionend elements (wrapper is the absolutely positioned element,
172 /// x has position:relative; set; ):
174 /// <div id="wrapper">
175 /// <div id="x"><div>contents</div></div>
178 /// Works only on block elements.
180 /// <param name="elementId"></param>
181 /// <returns></returns>
182 public String
SlideUp(String elementId
)
184 return ScriptBlock( String
.Format( "new Effect.SlideUp('{0}');", elementId
) );
188 /// This pair of effects simulates a window blind, where the contents of
189 /// the affected elements scroll up and down accordingly.
192 /// You must include a second DIV element,
193 /// wrapping the contents of the outer DIV.
194 /// So, if you call new Effect.SlideDown('x'), your element must look like this:
196 /// <div id="x"><div>contents</div></div>
198 /// Because of a bug in Internet Explorer 6 (overflow not correctly hidden),
199 /// an additional wrapper div is needed if you want to use these effects on
200 /// absolutely positionend elements (wrapper is the absolutely positioned element,
201 /// x has position:relative; set; ):
203 /// <div id="wrapper">
204 /// <div id="x"><div>contents</div></div>
207 /// Works only on block elements.
209 /// <param name="elementId"></param>
210 /// <returns></returns>
211 public String
SlideDown(String elementId
)
213 return ScriptBlock( String
.Format( "new Effect.SlideDown('{0}');", elementId
) );