SSCheckBoxView.h 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. /*
  2. Copyright 2011 Ahmet Ardal
  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
  6. http://www.apache.org/licenses/LICENSE-2.0
  7. Unless required by applicable law or agreed to in writing, software
  8. distributed under the License is distributed on an "AS IS" BASIS,
  9. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  10. See the License for the specific language governing permissions and
  11. limitations under the License.
  12. */
  13. //
  14. // SSCheckBoxView.h
  15. // SSCheckBoxView
  16. //
  17. // Created by Ahmet Ardal on 12/6/11.
  18. // Copyright 2011 SpinningSphere Labs. All rights reserved.
  19. //
  20. #import <Foundation/Foundation.h>
  21. #import <UIKit/UIKit.h>
  22. typedef enum SSCheckBoxViewStyle_ {
  23. kSSCheckBoxViewStyleBox = 0,
  24. kSSCheckBoxViewStyleDark,
  25. kSSCheckBoxViewStyleGlossy,
  26. kSSCheckBoxViewStyleGreen,
  27. kSSCheckBoxViewStyleMono,
  28. kSSCheckBoxViewStyleClick,
  29. kSSCheckBoxViewStyleRound,
  30. kSSCheckBoxViewStylesCount
  31. } SSCheckBoxViewStyle;
  32. @interface SSCheckBoxView: UIView
  33. {
  34. SSCheckBoxViewStyle style;
  35. BOOL checked;
  36. BOOL enabled;
  37. UIImageView *checkBoxImageView;
  38. UILabel *textLabel;
  39. /* called when check box changes state */
  40. // this method would be in the following form:
  41. // - (void) checkBoxViewChangedState:(SSCheckBoxView *)cbv;
  42. SEL stateChangedSelector;
  43. id<NSObject> delegate;
  44. void (^stateChangedBlock)(SSCheckBoxView *cbv);
  45. }
  46. @property (nonatomic, readonly) SSCheckBoxViewStyle style;
  47. @property (nonatomic, readonly) BOOL checked;
  48. @property (nonatomic, getter=enabled, setter=setEnabled:) BOOL enabled;
  49. @property (nonatomic, copy) void (^stateChangedBlock)(SSCheckBoxView *cbv);
  50. - (id) initWithFrame:(CGRect)frame
  51. style:(SSCheckBoxViewStyle)aStyle
  52. checked:(BOOL)aChecked;
  53. - (void) setText:(NSString *)text;
  54. - (void) setChecked:(BOOL)isChecked;
  55. - (void) setStateChangedTarget:(id<NSObject>)target
  56. selector:(SEL)selector;
  57. @end