Today's Menu  Portugal
journal and plan nutrition
Instance Methods | List of all members
U7ParamEditControlbarView Class Reference

#import <U7ParamEditControlbarView.h>

Inheritance diagram for U7ParamEditControlbarView:
Inheritance graph
[legend]
Collaboration diagram for U7ParamEditControlbarView:
Collaboration graph
[legend]

Instance Methods

(instancetype) - initWithDelegate:
 
(void) - showRemoveOption:
 
(void) - showEditButton:
 
(float) - heightRequirement [implementation]
 
(void) - appear: [implementation]
 
(void) - reconfigure [implementation]
 
(void) - fillViewOnAppearance: [implementation]
 
(void) - clickPlusButton [implementation]
 
(void) - clickEditButton [implementation]
 
(void) - clickAcceptButton [implementation]
 

Detailed Description

Definition at line 13 of file U7ParamEditControlbarView.h.

Method Documentation

◆ appear:()

- (void) appear: (CGRect)  bound
implementation

Definition at line 47 of file U7ParamEditControlbarView.m.

47  :(CGRect)bound
48 {
49  float viewWidth = bound.size.width;
50  NSLog(@"ParamEditControlBar.appear: bound: %3.2f/%3.2f %3.2f/%3.2f",
51  bound.origin.x, bound.origin.y, bound.size.width, bound.size.height);
52 
53  buttonSize = CGSizeMake(viewWidth * 0.50 - 4.0, 40.0);
54  [self fillViewOnAppearance:self.bounds];
55 }
CGSize buttonSize

◆ clickAcceptButton()

- (void) clickAcceptButton
implementation

Definition at line 142 of file U7ParamEditControlbarView.m.

143 {
144  NSLog(@"ParamEditControlBar: clickAcceptButton");
145  [delegate clickAcceptButton];
146 }

◆ clickEditButton()

- (void) clickEditButton
implementation

Definition at line 137 of file U7ParamEditControlbarView.m.

138 {
139  NSLog(@"ParamEditControlBar: clickEditButton");
140  [delegate configureToState:PICK_QUANTITY];
141 }

◆ clickPlusButton()

- (void) clickPlusButton
implementation

Definition at line 132 of file U7ParamEditControlbarView.m.

133 {
134  NSLog(@"ParamEditControlBar: clickPlusButton");
135  [delegate configureToState:PICK_COMPONENT];
136 }

◆ fillViewOnAppearance:()

- (void) fillViewOnAppearance: (CGRect)  parentBound
implementation

Definition at line 62 of file U7ParamEditControlbarView.m.

62  : (CGRect) parentBound
63 {
64  self.userInteractionEnabled = YES;
65  float viewWidth = parentBound.size.width;
66  // [self setBackgroundColor:[UIColor orangeColor]];
67  NSLog(@"ParamEditControlBar.fillViewForDelegate: viewWidth: %3.2f", viewWidth);
68  buttonSize = CGSizeMake(viewWidth * 0.5, 40.0);
69 
71  [controlbarRightButton removeFromSuperview];
73  }
75  [controlbarLeftButton removeFromSuperview];
77  }
78 
79  controlbarRightButtonFrame = CGRectMake(viewWidth - buttonSize.width - 2,
80  0,
81  buttonSize.width,
82  buttonSize.height);
83  controlbarLeftButtonFrame = CGRectMake(2.0,
84  0,
85  buttonSize.width - 10,
86  buttonSize.height);
87 
88  switch ([delegate getTotalEditState]) {
89  case INITIAL_STATE:
90  {
91  controlbarRightButton = [[UIButton alloc] initWithFrame:controlbarRightButtonFrame];
92  [controlbarRightButton setTitle:@"add parameter" forState:UIControlStateNormal];
93  [controlbarRightButton addTarget:self action:@selector(clickPlusButton) forControlEvents:UIControlEventTouchUpInside];
94  [self addSubview:controlbarRightButton];
95  }
96  break;
97  case PICK_COMPONENT:
98  {
99  controlbarRightButton = [[UIButton alloc] initWithFrame:controlbarRightButtonFrame];
100  [controlbarRightButton setTitle:@"Edit parmtr" forState:UIControlStateNormal];
101  [controlbarRightButton addTarget:self action:@selector(clickEditButton) forControlEvents:UIControlEventTouchUpInside];
102  [self addSubview:controlbarRightButton];
103 
104  controlbarLeftButton = [[UIButton alloc] initWithFrame:controlbarLeftButtonFrame];
105  [controlbarLeftButton setTitle:@"cancel" forState:UIControlStateNormal];
106  [controlbarLeftButton addTarget:delegate action:@selector(clickCancelButton) forControlEvents:UIControlEventTouchUpInside];
107  [self addSubview:controlbarLeftButton];
108  }
109  break;
110  case PICK_QUANTITY:
111  {
112  controlbarRightButton = [[UIButton alloc] initWithFrame:controlbarRightButtonFrame];
113  [controlbarRightButton setTitle:@"accept" forState:UIControlStateNormal];
114  [controlbarRightButton addTarget:self action:@selector(clickAcceptButton) forControlEvents:UIControlEventTouchUpInside];
115  [self addSubview:controlbarRightButton];
116 
117  controlbarLeftButton = [[UIButton alloc] initWithFrame:controlbarLeftButtonFrame];
118  [controlbarLeftButton setTitle:@"cancel" forState:UIControlStateNormal];
119  [controlbarLeftButton addTarget:delegate action:@selector(clickCancelButton) forControlEvents:UIControlEventTouchUpInside];
120  [self addSubview:controlbarLeftButton];
121 
122  }
123  break;
124  default:
125  {
126  NSLog(@"ParamEditControlBar.fillViewOnAppearance: SHOULD NOT BE HERE");
127  }
128  }
129 
130 }
UIButton * controlbarRightButton
UIButton * controlbarLeftButton
id< U7ParamEditControlDelegate > delegate
CGSize buttonSize
CGRect controlbarLeftButtonFrame
CGRect controlbarRightButtonFrame

◆ heightRequirement()

- (float) heightRequirement
implementation

Definition at line 43 of file U7ParamEditControlbarView.m.

44 {
45  return buttonSize.height + 2;
46 }
CGSize buttonSize

◆ initWithDelegate:()

- (instancetype) initWithDelegate: (id<U7ParamEditControlDelegate>)  delegate

Definition at line 30 of file U7ParamEditControlbarView.m.

30  :(id<U7ParamEditControlDelegate>) dele
31 {
32  self = [super init];
33  if (self) {
34  delegate = dele;
35  [self setClipsToBounds:YES];
36  NSLog(@"ParamEditControlbar.initWithDelegate: finish init");
37  }
38  return self;
39 }
id< U7ParamEditControlDelegate > delegate

◆ reconfigure()

- (void) reconfigure
implementation

Definition at line 57 of file U7ParamEditControlbarView.m.

58 {
59  CGRect delegateBound = CGRectMake(0, 0, [delegate viewWidth], 300);
60  [self fillViewOnAppearance:delegateBound];
61 }
id< U7ParamEditControlDelegate > delegate

◆ showEditButton:()

- (void) showEditButton: (Boolean)  flag

Definition at line 170 of file U7ParamEditControlbarView.m.

170  : (Boolean) flag
171 {
172  NSLog(@"ParameterEditControlbar.showEditButton: NO-OP");
173 }

◆ showRemoveOption:()

- (void) showRemoveOption: (Boolean)  flag

Definition at line 153 of file U7ParamEditControlbarView.m.

153  : (Boolean) flag
154 {
155  if (flag) {
156  controlbarLeftButtonFrame = CGRectMake(2.0,
157  0,
158  buttonSize.width - 10,
159  buttonSize.height);
160 
161  controlbarLeftButton = [[UIButton alloc] initWithFrame:controlbarLeftButtonFrame];
162  [controlbarLeftButton setTitle:@"remove" forState:UIControlStateNormal];
163  [controlbarLeftButton addTarget:delegate action:@selector(clickRemoveButton) forControlEvents:UIControlEventTouchUpInside];
164  [self addSubview:controlbarLeftButton];
165  } else {
166  [controlbarLeftButton removeFromSuperview];
167  }
168 
169 }
UIButton * controlbarLeftButton
CGSize buttonSize
CGRect controlbarLeftButtonFrame

The documentation for this class was generated from the following files: