PageRenderTime 19ms CodeModel.GetById 14ms RepoModel.GetById 0ms app.codeStats 0ms

/IZWebFileManager/CustomToolbarButton.cs

http://izwebfilemanager.googlecode.com/
C# | 95 lines | 64 code | 16 blank | 15 comment | 0 complexity | 815285f2279d2079631ea0438b0a7cbf MD5 | raw file
  1. // Copyright (C) 2008 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;
  20. using System.Diagnostics.CodeAnalysis;
  21. using System.ComponentModel;
  22. using System.Drawing.Design;
  23. namespace IZ.WebFileManager
  24. {
  25. public sealed class CustomToolbarButton : IStateManager
  26. {
  27. readonly StateBag _bag = new StateBag ();
  28. [SuppressMessage ("Microsoft.Design", "CA1056:UriPropertiesShouldNotBeStrings")]
  29. [Editor ("System.Web.UI.Design.ImageUrlEditor, System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", typeof (UITypeEditor))]
  30. [DefaultValue ("")]
  31. [UrlProperty]
  32. public string ImageUrl {
  33. get { return (string) (_bag ["ImageUrl"] ?? String.Empty); }
  34. set { _bag ["ImageUrl"] = value; }
  35. }
  36. [DefaultValue ("")]
  37. public string Text {
  38. get { return (string) (_bag ["Text"] ?? String.Empty); }
  39. set { _bag ["Text"] = value; }
  40. }
  41. [DefaultValue ("")]
  42. public string CommandName {
  43. get { return (string) (_bag ["CommandName"] ?? String.Empty); }
  44. set { _bag ["CommandName"] = value; }
  45. }
  46. [DefaultValue ("")]
  47. public string CommandArgument {
  48. get { return (string) (_bag ["CommandArgument"] ?? String.Empty); }
  49. set { _bag ["CommandArgument"] = value; }
  50. }
  51. [DefaultValue ("")]
  52. public string OnClientClick {
  53. get { return (string) (_bag ["OnClientClick"] ?? String.Empty); }
  54. set { _bag ["OnClientClick"] = value; }
  55. }
  56. [DefaultValue (true)]
  57. public bool PerformPostBack {
  58. get { return (bool) (_bag ["PerformPostBack"] ?? true); }
  59. set { _bag ["PerformPostBack"] = value; }
  60. }
  61. #region IStateManager Members
  62. bool IStateManager.IsTrackingViewState {
  63. get { return ((IStateManager) _bag).IsTrackingViewState; }
  64. }
  65. void IStateManager.LoadViewState (object state) {
  66. ((IStateManager) _bag).LoadViewState (state);
  67. }
  68. object IStateManager.SaveViewState () {
  69. return ((IStateManager) _bag).SaveViewState ();
  70. }
  71. void IStateManager.TrackViewState () {
  72. ((IStateManager) _bag).TrackViewState ();
  73. }
  74. #endregion
  75. internal void SetDirty () {
  76. _bag.SetDirty (true);
  77. }
  78. }
  79. }