Today's Menu  Portugal
journal and plan nutrition
Z3MenuConsumedView.m
Go to the documentation of this file.
1 //
2 // Z3MenuConsumedView.m
3 // TodaysMenu
4 //
5 // Created by Don Zeek on 4/28/17.
6 // Copyright © 2017 net.dzeek.y2015.ios.portfolio. All rights reserved.
7 //
8 
9 #import "Z3MenuConsumedView.h"
11 #import "DLStarRatingControl.h"
12 
13 @implementation Z3MenuConsumedView
14 {
15  UIButton *cancelButton;
16  UIButton *consumedButton;
17  UIDatePicker *mealConsumptionDateSet;
19 }
20 id<Z3MenuConsumedDelegate> menuConsumedDelegate;
22 
23 - (instancetype) initWithDelegate:(id<Z3MenuConsumedDelegate>) delegate
24 {
25  self = [super init];
26  if (self) {
28  }
29  return self;
30 }
31 
33 {
34  float ret = consumeMealBarViewHeight;
35  return ret;
36 }
37 - (void) appear:(CGRect)bound
38 {
39  [self setBackgroundColor:[UIColor lightGrayColor]];
40 
41  CGRect cancelButtonFrame = CGRectMake(2.0, 2.0, bound.size.width/2 - 4, consumeMealBarViewHeight - 4.0);
42  cancelButton = [[UIButton alloc] initWithFrame:cancelButtonFrame];
43  [cancelButton setTitle:@"skipped" forState:UIControlStateNormal];
44  [cancelButton addTarget:self action:@selector(clickedSkipped) forControlEvents:UIControlEventTouchUpInside];
45  [self addSubview:cancelButton];
46 
47  // add a button to consume the selected menu item for today's (right now) meal
48  CGRect consumedButtonFrame = CGRectMake(bound.size.width/2 + 2, 2.0, bound.size.width/2 - 4,consumeMealBarViewHeight - 4.0);
49  consumedButton = [[UIButton alloc] initWithFrame:consumedButtonFrame];
50  [consumedButton setTitle:@"finished" forState:UIControlStateNormal];
51  [consumedButton addTarget:self action:@selector(clickedConsumed) forControlEvents:UIControlEventTouchUpInside];
52  [self addSubview:consumedButton];
53  // end - add a button to consume the selected menu item for today's (right now) meal
54 /*
55  CGRect timePickerFrame = CGRectMake(2.0, consumeMealBarViewHeight + 4.0, bound.size.width - 6.0, timePickerHeight);
56  UIDatePicker *mealConsumptionDateSet = [[UIDatePicker alloc] initWithFrame:timePickerFrame];
57  [self addSubview:mealConsumptionDateSet];
58 
59  CGRect starRatingFrame = CGRectMake(2.0, consumeMealBarViewHeight + 4.0 + timePickerHeight + 4.0, bound.size.width - 6.0, starRatingHeight);
60  starRating = [[DLStarRatingControl alloc] initWithFrame:starRatingFrame];
61  [self addSubview:starRating];
62  */
63 
64 }
65 
67 {
68  NSLog(@"MenuConsumedBar.clickedSkipped");
69  [menuConsumedDelegate didTapSkippedFooter];
70 }
71 
73 {
74  NSLog(@"MenuConsumedBar.clickedConsumed");
75  [menuConsumedDelegate didTapConsumedFooter];
76 }
77 
78 /*
79 // Only override drawRect: if you perform custom drawing.
80 // An empty implementation adversely affects performance during animation.
81 - (void)drawRect:(CGRect)rect {
82  // Drawing code
83 }
84 */
85 
86 @end
DLStarRatingControl * starRating
id< Z3MenuConsumedDelegate > menuConsumedDelegate
UIButton * consumedButton
float consumeMealBarViewHeight
UIDatePicker * mealConsumptionDateSet
id< U7ParamEditControlDelegate > delegate