StyledTableViewCell.h 3.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. /**
  2. * Copyright (c) 2012 Muh Hon Cheng
  3. * Created by honcheng on 28/2/12.
  4. *
  5. * Permission is hereby granted, free of charge, to any person obtaining
  6. * a copy of this software and associated documentation files (the
  7. * "Software"), to deal in the Software without restriction, including
  8. * without limitation the rights to use, copy, modify, merge, publish,
  9. * distribute, sublicense, and/or sell copies of the Software, and to
  10. * permit persons to whom the Software is furnished to do so, subject
  11. * to the following conditions:
  12. *
  13. * The above copyright notice and this permission notice shall be
  14. * included in all copies or substantial portions of the Software.
  15. *
  16. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT
  17. * WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
  18. * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  19. * MERCHANTABILITY, FITNESS FOR A PARTICULAR
  20. * PURPOSE AND NONINFRINGEMENT. IN NO EVENT
  21. * SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
  22. * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  23. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
  24. * TORT OR OTHERWISE, ARISING FROM, OUT OF OR
  25. * IN CONNECTION WITH THE SOFTWARE OR
  26. * THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  27. *
  28. * @author Muh Hon Cheng <honcheng@gmail.com>
  29. * @copyright 2012 Muh Hon Cheng
  30. * @version
  31. *
  32. */
  33. #import <UIKit/UIKit.h>
  34. // available selection colors
  35. typedef enum
  36. {
  37. StyledTableViewCellSelectionStyleDefault = 0,
  38. StyledTableViewCellSelectionStyleCyan = 1,
  39. StyledTableViewCellSelectionStyleGreen = 2,
  40. StyledTableViewCellSelectionStyleYellow = 3,
  41. StyledTableViewCellSelectionStylePurple = 4,
  42. } StyledTableViewCellSelectionStyle;
  43. typedef enum
  44. {
  45. StyledTableViewCellSelectionGradientDirectionVertical = 0,
  46. StyledTableViewCellSelectionGradientDirectionHorizontal = 1,
  47. StyledTableViewCellSelectionGradientDirectionDiagonalTopLeftToBottomRight = 2,
  48. StyledTableViewCellSelectionGradientDirectionDiagonalBottomLeftToTopRight = 3,
  49. } StyledTableViewCellSelectionGradientDirection;
  50. // background view
  51. // use to draw separator line
  52. @interface StyledTableViewCellBackgroundView : UIView
  53. @property (nonatomic, strong) UIColor *separatorColor;
  54. @property (nonatomic, assign) int dashWidth, dashGap, dashStroke;
  55. @end
  56. // selected background view
  57. // subclass of background view, set the colors
  58. @interface StyledTableViewCellSelectedBackgroundView : StyledTableViewCellBackgroundView
  59. @property (nonatomic, strong) NSArray *selectedBackgroundGradientColors;
  60. @property (nonatomic, assign) StyledTableViewCellSelectionGradientDirection gradientDirection;
  61. @end
  62. @interface StyledTableViewCell : UITableViewCell
  63. // set the separator line property
  64. @property (nonatomic, assign) int dashWidth;
  65. @property (nonatomic, assign) int dashGap;
  66. @property (nonatomic, assign) int dashStroke;
  67. - (void)setDashWidth:(int)dashWidth dashGap:(int)dashGap dashStroke:(int)dashStroke;
  68. - (void)setSeparatorColor:(UIColor*)separatorColor;
  69. // set the selected background color by providing an array of colors
  70. // requires a list of CGColor
  71. - (void)setSelectedBackgroundViewGradientColors:(NSArray*)colors;
  72. // set the selected background color gradient direction
  73. - (void)setSelectionGradientDirection:(StyledTableViewCellSelectionGradientDirection)direction;
  74. // set the selected background color using style
  75. @property (nonatomic, assign, setter = setStyledTableViewCellSelectionStyle:) StyledTableViewCellSelectionStyle styledTableViewCellSelectionStyle;
  76. @end