StyledPageControl.h 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. //
  2. // PageControl.h
  3. // PageControlDemo
  4. //
  5. /**
  6. * Created by honcheng on 5/14/11.
  7. *
  8. * Permission is hereby granted, free of charge, to any person obtaining
  9. * a copy of this software and associated documentation files (the
  10. * "Software"), to deal in the Software without restriction, including
  11. * without limitation the rights to use, copy, modify, merge, publish,
  12. * distribute, sublicense, and/or sell copies of the Software, and to
  13. * permit persons to whom the Software is furnished to do so, subject
  14. * to the following conditions:
  15. *
  16. * The above copyright notice and this permission notice shall be
  17. * included in all copies or substantial portions of the Software.
  18. *
  19. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT
  20. * WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
  21. * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  22. * MERCHANTABILITY, FITNESS FOR A PARTICULAR
  23. * PURPOSE AND NONINFRINGEMENT. IN NO EVENT
  24. * SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
  25. * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  26. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
  27. * TORT OR OTHERWISE, ARISING FROM, OUT OF OR
  28. * IN CONNECTION WITH THE SOFTWARE OR
  29. * THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  30. *
  31. * @author Muh Hon Cheng <honcheng@gmail.com> http://twitter.com/honcheng
  32. * @copyright 2011 Muh Hon Cheng
  33. *
  34. */
  35. #import <UIKit/UIKit.h>
  36. typedef enum
  37. {
  38. PageControlStyleDefault = 0,
  39. PageControlStyleStrokedCircle = 1,
  40. PageControlStylePressed1 = 2,
  41. PageControlStylePressed2 = 3,
  42. PageControlStyleWithPageNumber = 4,
  43. PageControlStyleThumb = 5
  44. } PageControlStyle;
  45. @interface StyledPageControl : UIControl {
  46. int _currentPage, _numberOfPages;
  47. BOOL hidesForSinglePage;
  48. UIColor *coreNormalColor, *coreSelectedColor;
  49. UIColor *strokeNormalColor, *strokeSelectedColor;
  50. PageControlStyle _pageControlStyle;
  51. int _strokeWidth, diameter, gapWidth;
  52. }
  53. @property (nonatomic, retain) UIColor *coreNormalColor, *coreSelectedColor;
  54. @property (nonatomic, retain) UIColor *strokeNormalColor, *strokeSelectedColor;
  55. @property (nonatomic, assign) int _currentPage, _numberOfPages;
  56. @property (nonatomic, assign) BOOL hidesForSinglePage;
  57. @property (nonatomic, assign) PageControlStyle _pageControlStyle;
  58. @property (nonatomic, assign) int _strokeWidth, diameter, gapWidth;
  59. @property (nonatomic, retain) UIImage *thumbImage, *selectedThumbImage;
  60. - (void)setCurrentPage:(int)page;
  61. - (int)currentPage;
  62. - (void)setNumberOfPages:(int)numOfPages;
  63. - (int)numberOfPages;
  64. - (PageControlStyle)pageControlStyle;
  65. - (void)setPageControlStyle:(PageControlStyle)style;
  66. @end