PageRenderTime 107ms CodeModel.GetById 21ms RepoModel.GetById 1ms app.codeStats 0ms

/IZWebFileManager/BorderedPanelStyle.cs

http://izwebfilemanager.googlecode.com/
C# | 759 lines | 623 code | 121 blank | 15 comment | 155 complexity | f6279eb1f761bcc93fe4bbf000539d9c MD5 | raw file
  1. // Copyright (C) 2006 Igor Zelmanovich <izwebfilemanager@gmail.com>
  2. //
  3. // This program is free software; you can redistribute it and/or modify
  4. // it under the terms of the GNU General Public License as published by
  5. // the Free Software Foundation; either version 2 of the License, or
  6. // (at your option) any later version.
  7. //
  8. // This program is distributed in the hope that it will be useful,
  9. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. // GNU General Public License for more details.
  12. //
  13. // You should have received a copy of the GNU General Public License
  14. // along with this program; if not, write to the Free Software
  15. // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  16. using System;
  17. using System.Collections.Generic;
  18. using System.Text;
  19. using System.Web.UI.WebControls;
  20. using System.Web.UI;
  21. using System.ComponentModel;
  22. using System.Web;
  23. using System.Drawing.Design;
  24. using System.Diagnostics.CodeAnalysis;
  25. using System.Globalization;
  26. using System.Drawing;
  27. namespace IZ.WebFileManager
  28. {
  29. [TypeConverter (typeof (ExpandableObjectConverter))]
  30. public class BorderedPanelStyle : PanelStyle
  31. {
  32. [Flags]
  33. enum StyleKey
  34. {
  35. OuterBorderBottomImageUrl = 0x0001,
  36. OuterBorderTopImageUrl = 0x0002,
  37. OuterBorderLeftImageUrl = 0x0004,
  38. OuterBorderRightImageUrl = 0x0008,
  39. OuterBorderLeftTopCornerImageUrl = 0x0010,
  40. OuterBorderLeftBottomCornerImageUrl = 0x0020,
  41. OuterBorderRightTopCornerImageUrl = 0x0040,
  42. OuterBorderRightBottomCornerImageUrl = 0x0080,
  43. OuterBorderLeftWidth = 0x0100,
  44. OuterBorderBottomWidth = 0x0200,
  45. OuterBorderRightWidth = 0x0400,
  46. OuterBorderTopWidth = 0x0800,
  47. OuterBorderStyle = 0x1000,
  48. OuterBorderBackColor = 0x2000,
  49. PaddingTop = 0x010000,
  50. PaddingBottom = 0x020000,
  51. PaddingLeft = 0x040000,
  52. PaddingRight = 0x080000,
  53. MarginTop = 0x100000,
  54. MarginBottom = 0x200000,
  55. MarginLeft = 0x400000,
  56. MarginRight = 0x800000,
  57. }
  58. #region Constructors
  59. public BorderedPanelStyle ()
  60. : base (new StateBag ()) {
  61. }
  62. public BorderedPanelStyle (StateBag bag)
  63. : base (bag) {
  64. }
  65. #endregion
  66. #region Fields
  67. int styles;
  68. #endregion
  69. #region Properties
  70. [DefaultValue (ContentDirection.NotSet)]
  71. public override ContentDirection Direction {
  72. get {
  73. return base.Direction;
  74. }
  75. set {
  76. base.Direction = value;
  77. }
  78. }
  79. [DefaultValue (HorizontalAlign.NotSet)]
  80. public override HorizontalAlign HorizontalAlign {
  81. get {
  82. return base.HorizontalAlign;
  83. }
  84. set {
  85. base.HorizontalAlign = value;
  86. }
  87. }
  88. [DefaultValue (ScrollBars.None)]
  89. public override ScrollBars ScrollBars {
  90. get {
  91. return base.ScrollBars;
  92. }
  93. set {
  94. base.ScrollBars = value;
  95. }
  96. }
  97. [DefaultValue (true)]
  98. public override bool Wrap {
  99. get {
  100. return base.Wrap;
  101. }
  102. set {
  103. base.Wrap = value;
  104. }
  105. }
  106. [Category ("Appearance")]
  107. [DefaultValue (typeof (Color), "")]
  108. [TypeConverter (typeof (WebColorConverter))]
  109. [NotifyParentProperty (true)]
  110. public Color OuterBorderBackColor {
  111. get {
  112. if (CheckStyle (StyleKey.OuterBorderBackColor))
  113. return (Color) this.ViewState ["OuterBorderBackColor"];
  114. return Color.Empty;
  115. }
  116. set {
  117. this.ViewState ["OuterBorderBackColor"] = value;
  118. SetStyle (StyleKey.OuterBorderBackColor);
  119. }
  120. }
  121. [SuppressMessage ("Microsoft.Design", "CA1056:UriPropertiesShouldNotBeStrings")]
  122. [UrlProperty]
  123. [DefaultValue ("")]
  124. [Category ("Appearance")]
  125. [Editor ("System.Web.UI.Design.ImageUrlEditor, System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", typeof (UITypeEditor))]
  126. public string OuterBorderBottomImageUrl {
  127. get {
  128. if (CheckStyle (StyleKey.OuterBorderBottomImageUrl))
  129. return (string) ViewState ["OuterBorderBottomImageUrl"];
  130. return String.Empty;
  131. }
  132. set {
  133. if (value == null)
  134. throw new ArgumentNullException ("value");
  135. ViewState ["OuterBorderBottomImageUrl"] = value;
  136. SetStyle (StyleKey.OuterBorderBottomImageUrl);
  137. }
  138. }
  139. [SuppressMessage ("Microsoft.Design", "CA1056:UriPropertiesShouldNotBeStrings")]
  140. [UrlProperty]
  141. [DefaultValue ("")]
  142. [Category ("Appearance")]
  143. [Editor ("System.Web.UI.Design.ImageUrlEditor, System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", typeof (UITypeEditor))]
  144. public string OuterBorderTopImageUrl {
  145. get {
  146. if (CheckStyle (StyleKey.OuterBorderTopImageUrl))
  147. return (string) ViewState ["OuterBorderTopImageUrl"];
  148. return String.Empty;
  149. }
  150. set {
  151. if (value == null)
  152. throw new ArgumentNullException ("value");
  153. ViewState ["OuterBorderTopImageUrl"] = value;
  154. SetStyle (StyleKey.OuterBorderTopImageUrl);
  155. }
  156. }
  157. [SuppressMessage ("Microsoft.Design", "CA1056:UriPropertiesShouldNotBeStrings")]
  158. [UrlProperty]
  159. [DefaultValue ("")]
  160. [Category ("Appearance")]
  161. [Editor ("System.Web.UI.Design.ImageUrlEditor, System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", typeof (UITypeEditor))]
  162. public string OuterBorderLeftImageUrl {
  163. get {
  164. if (CheckStyle (StyleKey.OuterBorderLeftImageUrl))
  165. return (string) ViewState ["OuterBorderLeftImageUrl"];
  166. return String.Empty;
  167. }
  168. set {
  169. if (value == null)
  170. throw new ArgumentNullException ("value");
  171. ViewState ["OuterBorderLeftImageUrl"] = value;
  172. SetStyle (StyleKey.OuterBorderLeftImageUrl);
  173. }
  174. }
  175. [SuppressMessage ("Microsoft.Design", "CA1056:UriPropertiesShouldNotBeStrings")]
  176. [UrlProperty]
  177. [DefaultValue ("")]
  178. [Category ("Appearance")]
  179. [Editor ("System.Web.UI.Design.ImageUrlEditor, System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", typeof (UITypeEditor))]
  180. public string OuterBorderRightImageUrl {
  181. get {
  182. if (CheckStyle (StyleKey.OuterBorderRightImageUrl))
  183. return (string) ViewState ["OuterBorderRightImageUrl"];
  184. return String.Empty;
  185. }
  186. set {
  187. if (value == null)
  188. throw new ArgumentNullException ("value");
  189. ViewState ["OuterBorderRightImageUrl"] = value;
  190. SetStyle (StyleKey.OuterBorderRightImageUrl);
  191. }
  192. }
  193. [SuppressMessage ("Microsoft.Design", "CA1056:UriPropertiesShouldNotBeStrings")]
  194. [UrlProperty]
  195. [DefaultValue ("")]
  196. [Category ("Appearance")]
  197. [Editor ("System.Web.UI.Design.ImageUrlEditor, System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", typeof (UITypeEditor))]
  198. public string OuterBorderRightBottomCornerImageUrl {
  199. get {
  200. if (CheckStyle (StyleKey.OuterBorderRightBottomCornerImageUrl))
  201. return (string) ViewState ["OuterBorderRightBottomCornerImageUrl"];
  202. return String.Empty;
  203. }
  204. set {
  205. if (value == null)
  206. throw new ArgumentNullException ("value");
  207. ViewState ["OuterBorderRightBottomCornerImageUrl"] = value;
  208. SetStyle (StyleKey.OuterBorderRightBottomCornerImageUrl);
  209. }
  210. }
  211. [SuppressMessage ("Microsoft.Design", "CA1056:UriPropertiesShouldNotBeStrings")]
  212. [UrlProperty]
  213. [DefaultValue ("")]
  214. [Category ("Appearance")]
  215. [Editor ("System.Web.UI.Design.ImageUrlEditor, System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", typeof (UITypeEditor))]
  216. public string OuterBorderRightTopCornerImageUrl {
  217. get {
  218. if (CheckStyle (StyleKey.OuterBorderRightTopCornerImageUrl))
  219. return (string) ViewState ["OuterBorderRightTopCornerImageUrl"];
  220. return String.Empty;
  221. }
  222. set {
  223. if (value == null)
  224. throw new ArgumentNullException ("value");
  225. ViewState ["OuterBorderRightTopCornerImageUrl"] = value;
  226. SetStyle (StyleKey.OuterBorderRightTopCornerImageUrl);
  227. }
  228. }
  229. [SuppressMessage ("Microsoft.Design", "CA1056:UriPropertiesShouldNotBeStrings")]
  230. [UrlProperty]
  231. [DefaultValue ("")]
  232. [Category ("Appearance")]
  233. [Editor ("System.Web.UI.Design.ImageUrlEditor, System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", typeof (UITypeEditor))]
  234. public string OuterBorderLeftBottomCornerImageUrl {
  235. get {
  236. if (CheckStyle (StyleKey.OuterBorderLeftBottomCornerImageUrl))
  237. return (string) ViewState ["OuterBorderLeftBottomCornerImageUrl"];
  238. return String.Empty;
  239. }
  240. set {
  241. if (value == null)
  242. throw new ArgumentNullException ("value");
  243. ViewState ["OuterBorderLeftBottomCornerImageUrl"] = value;
  244. SetStyle (StyleKey.OuterBorderLeftBottomCornerImageUrl);
  245. }
  246. }
  247. [SuppressMessage ("Microsoft.Design", "CA1056:UriPropertiesShouldNotBeStrings")]
  248. [UrlProperty]
  249. [DefaultValue ("")]
  250. [Category ("Appearance")]
  251. [Editor ("System.Web.UI.Design.ImageUrlEditor, System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", typeof (UITypeEditor))]
  252. public string OuterBorderLeftTopCornerImageUrl {
  253. get {
  254. if (CheckStyle (StyleKey.OuterBorderLeftTopCornerImageUrl))
  255. return (string) ViewState ["OuterBorderLeftTopCornerImageUrl"];
  256. return String.Empty;
  257. }
  258. set {
  259. if (value == null)
  260. throw new ArgumentNullException ("value");
  261. ViewState ["OuterBorderLeftTopCornerImageUrl"] = value;
  262. SetStyle (StyleKey.OuterBorderLeftTopCornerImageUrl);
  263. }
  264. }
  265. [DefaultValue (OuterBorderStyle.None)]
  266. [Category ("Layout")]
  267. public OuterBorderStyle OuterBorderStyle {
  268. get {
  269. if (CheckStyle (StyleKey.OuterBorderStyle))
  270. return (OuterBorderStyle) ViewState ["OuterBorderStyle"];
  271. return OuterBorderStyle.None;
  272. }
  273. set {
  274. if (value < OuterBorderStyle.None || value > OuterBorderStyle.AllSides)
  275. throw new ArgumentOutOfRangeException ("value");
  276. ViewState ["OuterBorderStyle"] = value;
  277. SetStyle (StyleKey.OuterBorderStyle);
  278. }
  279. }
  280. [DefaultValue (typeof (Unit), "")]
  281. [Category ("Layout")]
  282. public Unit OuterBorderTopWidth {
  283. get {
  284. if (CheckStyle (StyleKey.OuterBorderTopWidth))
  285. return (Unit) ViewState ["OuterBorderTopWidth"];
  286. return Unit.Empty;
  287. }
  288. set {
  289. if (value.Value < 0)
  290. throw new ArgumentOutOfRangeException ("value");
  291. ViewState ["OuterBorderTopWidth"] = value;
  292. SetStyle (StyleKey.OuterBorderTopWidth);
  293. }
  294. }
  295. [DefaultValue (typeof (Unit), "")]
  296. [Category ("Layout")]
  297. public Unit OuterBorderRightWidth {
  298. get {
  299. if (CheckStyle (StyleKey.OuterBorderRightWidth))
  300. return (Unit) ViewState ["OuterBorderRightWidth"];
  301. return Unit.Empty;
  302. }
  303. set {
  304. if (value.Value < 0)
  305. throw new ArgumentOutOfRangeException ("value");
  306. ViewState ["OuterBorderRightWidth"] = value;
  307. SetStyle (StyleKey.OuterBorderRightWidth);
  308. }
  309. }
  310. [DefaultValue (typeof (Unit), "")]
  311. [Category ("Layout")]
  312. public Unit OuterBorderBottomWidth {
  313. get {
  314. if (CheckStyle (StyleKey.OuterBorderBottomWidth))
  315. return (Unit) ViewState ["OuterBorderBottomWidth"];
  316. return Unit.Empty;
  317. }
  318. set {
  319. if (value.Value < 0)
  320. throw new ArgumentOutOfRangeException ("value");
  321. ViewState ["OuterBorderBottomWidth"] = value;
  322. SetStyle (StyleKey.OuterBorderBottomWidth);
  323. }
  324. }
  325. [DefaultValue (typeof (Unit), "")]
  326. [Category ("Layout")]
  327. public Unit OuterBorderLeftWidth {
  328. get {
  329. if (CheckStyle (StyleKey.OuterBorderLeftWidth))
  330. return (Unit) ViewState ["OuterBorderLeftWidth"];
  331. return Unit.Empty;
  332. }
  333. set {
  334. if (value.Value < 0)
  335. throw new ArgumentOutOfRangeException ("value");
  336. ViewState ["OuterBorderLeftWidth"] = value;
  337. SetStyle (StyleKey.OuterBorderLeftWidth);
  338. }
  339. }
  340. [DefaultValue (typeof (Unit), "")]
  341. [NotifyParentProperty (true)]
  342. [RefreshProperties (RefreshProperties.Repaint)]
  343. [Category ("Layout")]
  344. public Unit PaddingTop {
  345. get {
  346. if (CheckStyle (StyleKey.PaddingTop))
  347. return (Unit) ViewState ["PaddingTop"];
  348. return Unit.Empty;
  349. }
  350. set {
  351. ViewState ["PaddingTop"] = value;
  352. SetStyle (StyleKey.PaddingTop);
  353. }
  354. }
  355. [DefaultValue (typeof (Unit), "")]
  356. [NotifyParentProperty (true)]
  357. [RefreshProperties (RefreshProperties.Repaint)]
  358. [Category ("Layout")]
  359. public Unit PaddingBottom {
  360. get {
  361. if (CheckStyle (StyleKey.PaddingBottom))
  362. return (Unit) ViewState ["PaddingBottom"];
  363. return Unit.Empty;
  364. }
  365. set {
  366. ViewState ["PaddingBottom"] = value;
  367. SetStyle (StyleKey.PaddingBottom);
  368. }
  369. }
  370. [DefaultValue (typeof (Unit), "")]
  371. [NotifyParentProperty (true)]
  372. [RefreshProperties (RefreshProperties.Repaint)]
  373. [Category ("Layout")]
  374. public Unit PaddingLeft {
  375. get {
  376. if (CheckStyle (StyleKey.PaddingLeft))
  377. return (Unit) ViewState ["PaddingLeft"];
  378. return Unit.Empty;
  379. }
  380. set {
  381. ViewState ["PaddingLeft"] = value;
  382. SetStyle (StyleKey.PaddingLeft);
  383. }
  384. }
  385. [DefaultValue (typeof (Unit), "")]
  386. [NotifyParentProperty (true)]
  387. [RefreshProperties (RefreshProperties.Repaint)]
  388. [Category ("Layout")]
  389. public Unit PaddingRight {
  390. get {
  391. if (CheckStyle (StyleKey.PaddingRight))
  392. return (Unit) ViewState ["PaddingRight"];
  393. return Unit.Empty;
  394. }
  395. set {
  396. ViewState ["PaddingRight"] = value;
  397. SetStyle (StyleKey.PaddingRight);
  398. }
  399. }
  400. [DefaultValue (typeof (Unit), "")]
  401. [NotifyParentProperty (true)]
  402. [RefreshProperties (RefreshProperties.Repaint)]
  403. [Category ("Layout")]
  404. public Unit MarginTop {
  405. get {
  406. if (CheckStyle (StyleKey.MarginTop))
  407. return (Unit) ViewState ["MarginTop"];
  408. return Unit.Empty;
  409. }
  410. set {
  411. ViewState ["MarginTop"] = value;
  412. SetStyle (StyleKey.MarginTop);
  413. }
  414. }
  415. [DefaultValue (typeof (Unit), "")]
  416. [NotifyParentProperty (true)]
  417. [RefreshProperties (RefreshProperties.Repaint)]
  418. [Category ("Layout")]
  419. public Unit MarginBottom {
  420. get {
  421. if (CheckStyle (StyleKey.MarginBottom))
  422. return (Unit) ViewState ["MarginBottom"];
  423. return Unit.Empty;
  424. }
  425. set {
  426. ViewState ["MarginBottom"] = value;
  427. SetStyle (StyleKey.MarginBottom);
  428. }
  429. }
  430. [DefaultValue (typeof (Unit), "")]
  431. [NotifyParentProperty (true)]
  432. [RefreshProperties (RefreshProperties.Repaint)]
  433. [Category ("Layout")]
  434. public Unit MarginLeft {
  435. get {
  436. if (CheckStyle (StyleKey.MarginLeft))
  437. return (Unit) ViewState ["MarginLeft"];
  438. return Unit.Empty;
  439. }
  440. set {
  441. ViewState ["MarginLeft"] = value;
  442. SetStyle (StyleKey.MarginLeft);
  443. }
  444. }
  445. [DefaultValue (typeof (Unit), "")]
  446. [NotifyParentProperty (true)]
  447. [RefreshProperties (RefreshProperties.Repaint)]
  448. [Category ("Layout")]
  449. public Unit MarginRight {
  450. get {
  451. if (CheckStyle (StyleKey.MarginRight))
  452. return (Unit) ViewState ["MarginRight"];
  453. return Unit.Empty;
  454. }
  455. set {
  456. ViewState ["MarginRight"] = value;
  457. SetStyle (StyleKey.MarginRight);
  458. }
  459. }
  460. public override bool IsEmpty {
  461. get { return base.IsEmpty && styles == 0; }
  462. }
  463. #endregion
  464. void SetStyle (StyleKey styleKey) {
  465. styles |= (int) styleKey;
  466. }
  467. bool CheckStyle (StyleKey styleKey) {
  468. return ((styles & (int) styleKey) != 0);
  469. }
  470. protected override void FillStyleAttributes (CssStyleCollection attributes, IUrlResolutionService urlResolver) {
  471. base.FillStyleAttributes (attributes, urlResolver);
  472. if (PaddingTop != Unit.Empty)
  473. attributes.Add (HtmlTextWriterStyle.PaddingTop, PaddingTop.ToString ());
  474. if (PaddingLeft != Unit.Empty)
  475. attributes.Add (HtmlTextWriterStyle.PaddingLeft, PaddingLeft.ToString ());
  476. if (PaddingRight != Unit.Empty)
  477. attributes.Add (HtmlTextWriterStyle.PaddingRight, PaddingRight.ToString ());
  478. if (PaddingBottom != Unit.Empty)
  479. attributes.Add (HtmlTextWriterStyle.PaddingBottom, PaddingBottom.ToString ());
  480. if (MarginTop != Unit.Empty)
  481. attributes.Add (HtmlTextWriterStyle.MarginTop, MarginTop.ToString ());
  482. if (MarginLeft != Unit.Empty)
  483. attributes.Add (HtmlTextWriterStyle.MarginLeft, MarginLeft.ToString ());
  484. if (MarginRight != Unit.Empty)
  485. attributes.Add (HtmlTextWriterStyle.MarginRight, MarginRight.ToString ());
  486. if (MarginBottom != Unit.Empty)
  487. attributes.Add (HtmlTextWriterStyle.MarginBottom, MarginBottom.ToString ());
  488. }
  489. public override void CopyFrom (Style s) {
  490. base.CopyFrom (s);
  491. BorderedPanelStyle ps = s as BorderedPanelStyle;
  492. if (ps == null)
  493. return;
  494. if (ps.CheckStyle (StyleKey.OuterBorderBackColor))
  495. OuterBorderBackColor = ps.OuterBorderBackColor;
  496. if (ps.CheckStyle (StyleKey.PaddingBottom))
  497. PaddingBottom = ps.PaddingBottom;
  498. if (ps.CheckStyle (StyleKey.PaddingLeft))
  499. PaddingLeft = ps.PaddingLeft;
  500. if (ps.CheckStyle (StyleKey.PaddingRight))
  501. PaddingRight = ps.PaddingRight;
  502. if (ps.CheckStyle (StyleKey.PaddingTop))
  503. PaddingTop = ps.PaddingTop;
  504. if (ps.CheckStyle (StyleKey.MarginBottom))
  505. MarginBottom = ps.MarginBottom;
  506. if (ps.CheckStyle (StyleKey.MarginLeft))
  507. MarginLeft = ps.MarginLeft;
  508. if (ps.CheckStyle (StyleKey.MarginRight))
  509. MarginRight = ps.MarginRight;
  510. if (ps.CheckStyle (StyleKey.MarginTop))
  511. MarginTop = ps.MarginTop;
  512. if (ps.CheckStyle (StyleKey.OuterBorderBottomImageUrl))
  513. OuterBorderBottomImageUrl = ps.OuterBorderBottomImageUrl;
  514. if (ps.CheckStyle (StyleKey.OuterBorderBottomWidth))
  515. OuterBorderBottomWidth = ps.OuterBorderBottomWidth;
  516. if (ps.CheckStyle (StyleKey.OuterBorderLeftBottomCornerImageUrl))
  517. OuterBorderLeftBottomCornerImageUrl = ps.OuterBorderLeftBottomCornerImageUrl;
  518. if (ps.CheckStyle (StyleKey.OuterBorderLeftImageUrl))
  519. OuterBorderLeftImageUrl = ps.OuterBorderLeftImageUrl;
  520. if (ps.CheckStyle (StyleKey.OuterBorderLeftTopCornerImageUrl))
  521. OuterBorderLeftTopCornerImageUrl = ps.OuterBorderLeftTopCornerImageUrl;
  522. if (ps.CheckStyle (StyleKey.OuterBorderLeftWidth))
  523. OuterBorderLeftWidth = ps.OuterBorderLeftWidth;
  524. if (ps.CheckStyle (StyleKey.OuterBorderRightBottomCornerImageUrl))
  525. OuterBorderRightBottomCornerImageUrl = ps.OuterBorderRightBottomCornerImageUrl;
  526. if (ps.CheckStyle (StyleKey.OuterBorderRightImageUrl))
  527. OuterBorderRightImageUrl = ps.OuterBorderRightImageUrl;
  528. if (ps.CheckStyle (StyleKey.OuterBorderRightTopCornerImageUrl))
  529. OuterBorderRightTopCornerImageUrl = ps.OuterBorderRightTopCornerImageUrl;
  530. if (ps.CheckStyle (StyleKey.OuterBorderRightWidth))
  531. OuterBorderRightWidth = ps.OuterBorderRightWidth;
  532. if (ps.CheckStyle (StyleKey.OuterBorderStyle))
  533. OuterBorderStyle = ps.OuterBorderStyle;
  534. if (ps.CheckStyle (StyleKey.OuterBorderTopImageUrl))
  535. OuterBorderTopImageUrl = ps.OuterBorderTopImageUrl;
  536. if (ps.CheckStyle (StyleKey.OuterBorderTopWidth))
  537. OuterBorderTopWidth = ps.OuterBorderTopWidth;
  538. }
  539. public override void MergeWith (Style s) {
  540. base.MergeWith (s);
  541. BorderedPanelStyle ps = s as BorderedPanelStyle;
  542. if (ps == null)
  543. return;
  544. if (!CheckStyle (StyleKey.OuterBorderBackColor) && ps.CheckStyle (StyleKey.OuterBorderBackColor))
  545. OuterBorderBackColor = ps.OuterBorderBackColor;
  546. if (!CheckStyle (StyleKey.PaddingBottom) && ps.CheckStyle (StyleKey.PaddingBottom))
  547. PaddingBottom = ps.PaddingBottom;
  548. if (!CheckStyle (StyleKey.PaddingLeft) && ps.CheckStyle (StyleKey.PaddingLeft))
  549. PaddingLeft = ps.PaddingLeft;
  550. if (!CheckStyle (StyleKey.PaddingRight) && ps.CheckStyle (StyleKey.PaddingRight))
  551. PaddingRight = ps.PaddingRight;
  552. if (!CheckStyle (StyleKey.PaddingTop) && ps.CheckStyle (StyleKey.PaddingTop))
  553. PaddingTop = ps.PaddingTop;
  554. if (!CheckStyle (StyleKey.MarginBottom) && ps.CheckStyle (StyleKey.MarginBottom))
  555. MarginBottom = ps.MarginBottom;
  556. if (!CheckStyle (StyleKey.MarginLeft) && ps.CheckStyle (StyleKey.MarginLeft))
  557. MarginLeft = ps.MarginLeft;
  558. if (!CheckStyle (StyleKey.MarginRight) && ps.CheckStyle (StyleKey.MarginRight))
  559. MarginRight = ps.MarginRight;
  560. if (!CheckStyle (StyleKey.MarginTop) && ps.CheckStyle (StyleKey.MarginTop))
  561. MarginTop = ps.MarginTop;
  562. if (!CheckStyle (StyleKey.OuterBorderBottomImageUrl) && ps.CheckStyle (StyleKey.OuterBorderBottomImageUrl))
  563. OuterBorderBottomImageUrl = ps.OuterBorderBottomImageUrl;
  564. if (!CheckStyle (StyleKey.OuterBorderBottomWidth) && ps.CheckStyle (StyleKey.OuterBorderBottomWidth))
  565. OuterBorderBottomWidth = ps.OuterBorderBottomWidth;
  566. if (!CheckStyle (StyleKey.OuterBorderLeftBottomCornerImageUrl) && ps.CheckStyle (StyleKey.OuterBorderLeftBottomCornerImageUrl))
  567. OuterBorderLeftBottomCornerImageUrl = ps.OuterBorderLeftBottomCornerImageUrl;
  568. if (!CheckStyle (StyleKey.OuterBorderLeftImageUrl) && ps.CheckStyle (StyleKey.OuterBorderLeftImageUrl))
  569. OuterBorderLeftImageUrl = ps.OuterBorderLeftImageUrl;
  570. if (!CheckStyle (StyleKey.OuterBorderLeftTopCornerImageUrl) && ps.CheckStyle (StyleKey.OuterBorderLeftTopCornerImageUrl))
  571. OuterBorderLeftTopCornerImageUrl = ps.OuterBorderLeftTopCornerImageUrl;
  572. if (!CheckStyle (StyleKey.OuterBorderLeftWidth) && ps.CheckStyle (StyleKey.OuterBorderLeftWidth))
  573. OuterBorderLeftWidth = ps.OuterBorderLeftWidth;
  574. if (!CheckStyle (StyleKey.OuterBorderRightBottomCornerImageUrl) && ps.CheckStyle (StyleKey.OuterBorderRightBottomCornerImageUrl))
  575. OuterBorderRightBottomCornerImageUrl = ps.OuterBorderRightBottomCornerImageUrl;
  576. if (!CheckStyle (StyleKey.OuterBorderRightImageUrl) && ps.CheckStyle (StyleKey.OuterBorderRightImageUrl))
  577. OuterBorderRightImageUrl = ps.OuterBorderRightImageUrl;
  578. if (!CheckStyle (StyleKey.OuterBorderRightTopCornerImageUrl) && ps.CheckStyle (StyleKey.OuterBorderRightTopCornerImageUrl))
  579. OuterBorderRightTopCornerImageUrl = ps.OuterBorderRightTopCornerImageUrl;
  580. if (!CheckStyle (StyleKey.OuterBorderRightWidth) && ps.CheckStyle (StyleKey.OuterBorderRightWidth))
  581. OuterBorderRightWidth = ps.OuterBorderRightWidth;
  582. if (!CheckStyle (StyleKey.OuterBorderStyle) && ps.CheckStyle (StyleKey.OuterBorderStyle))
  583. OuterBorderStyle = ps.OuterBorderStyle;
  584. if (!CheckStyle (StyleKey.OuterBorderTopImageUrl) && ps.CheckStyle (StyleKey.OuterBorderTopImageUrl))
  585. OuterBorderTopImageUrl = ps.OuterBorderTopImageUrl;
  586. if (!CheckStyle (StyleKey.OuterBorderTopWidth) && ps.CheckStyle (StyleKey.OuterBorderTopWidth))
  587. OuterBorderTopWidth = ps.OuterBorderTopWidth;
  588. }
  589. public override void Reset () {
  590. base.Reset ();
  591. if (CheckStyle (StyleKey.OuterBorderBackColor))
  592. ViewState.Remove ("OuterBorderBackColor");
  593. if (CheckStyle (StyleKey.PaddingBottom))
  594. ViewState.Remove ("PaddingBottom");
  595. if (CheckStyle (StyleKey.PaddingLeft))
  596. ViewState.Remove ("PaddingLeft");
  597. if (CheckStyle (StyleKey.PaddingRight))
  598. ViewState.Remove ("PaddingRight");
  599. if (CheckStyle (StyleKey.PaddingTop))
  600. ViewState.Remove ("PaddingTop");
  601. if (CheckStyle (StyleKey.MarginBottom))
  602. ViewState.Remove ("MarginBottom");
  603. if (CheckStyle (StyleKey.MarginLeft))
  604. ViewState.Remove ("MarginLeft");
  605. if (CheckStyle (StyleKey.MarginRight))
  606. ViewState.Remove ("MarginRight");
  607. if (CheckStyle (StyleKey.MarginTop))
  608. ViewState.Remove ("MarginTop");
  609. if (CheckStyle (StyleKey.OuterBorderBottomImageUrl))
  610. ViewState.Remove ("OuterBorderBottomImageUrl");
  611. if (CheckStyle (StyleKey.OuterBorderBottomWidth))
  612. ViewState.Remove ("OuterBorderBackColor");
  613. if (CheckStyle (StyleKey.OuterBorderLeftBottomCornerImageUrl))
  614. ViewState.Remove ("OuterBorderLeftBottomCornerImageUrl");
  615. if (CheckStyle (StyleKey.OuterBorderLeftImageUrl))
  616. ViewState.Remove ("OuterBorderLeftImageUrl");
  617. if (CheckStyle (StyleKey.OuterBorderLeftTopCornerImageUrl))
  618. ViewState.Remove ("OuterBorderLeftTopCornerImageUrl");
  619. if (CheckStyle (StyleKey.OuterBorderLeftWidth))
  620. ViewState.Remove ("OuterBorderLeftWidth");
  621. if (CheckStyle (StyleKey.OuterBorderRightBottomCornerImageUrl))
  622. ViewState.Remove ("OuterBorderRightBottomCornerImageUrl");
  623. if (CheckStyle (StyleKey.OuterBorderRightImageUrl))
  624. ViewState.Remove ("OuterBorderRightImageUrl");
  625. if (CheckStyle (StyleKey.OuterBorderRightTopCornerImageUrl))
  626. ViewState.Remove ("OuterBorderRightTopCornerImageUrl");
  627. if (CheckStyle (StyleKey.OuterBorderRightWidth))
  628. ViewState.Remove ("OuterBorderRightWidth");
  629. if (CheckStyle (StyleKey.OuterBorderStyle))
  630. ViewState.Remove ("OuterBorderStyle");
  631. if (CheckStyle (StyleKey.OuterBorderTopImageUrl))
  632. ViewState.Remove ("OuterBorderTopImageUrl");
  633. if (CheckStyle (StyleKey.OuterBorderTopWidth))
  634. ViewState.Remove ("OuterBorderTopWidth");
  635. styles = 0;
  636. }
  637. }
  638. }