-
Notifications
You must be signed in to change notification settings - Fork 3
/
TransparentOverlay+Private.m
executable file
·129 lines (107 loc) · 3.95 KB
/
TransparentOverlay+Private.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
//
// TransparentOverlay+Private.m
// DropDownList1
//
// Created by Nick Marchenko on 01.10.10.
// Copyright 2010 __MyCompanyName__. All rights reserved.
//
#import "TransparentOverlay+Private.h"
#import "Configuration.h"
#import "BaseDataObject.h"
@implementation TransparentOverlay (Private)
- (void) _initBackgroundImage
{
if (bgView == nil)
{
CGFloat totalBGHeigth = 0;
if (cellDispAmount>[objects count])
cellDispAmount=[objects count];
totalBGHeigth=(bgUnderTableHeight+tableYMargin)+
cellBGHoverImage.size.height*cellDispAmount;
if (totalBGHeigth<(topMainBG.size.height+bottomMainBG.size.height))
totalBGHeigth=(topMainBG.size.height+bottomMainBG.size.height);
bgView=[[UIImageView alloc] initWithFrame:CGRectMake(buttonOrigin.x+xBGMargin, buttonOrigin.y+yBGMargin,topMainBG.size.width, totalBGHeigth)];
UIImageView *topBGImageView=[[UIImageView alloc] initWithImage:topMainBG];
UIImageView *middleBGImageView=[[UIImageView alloc] initWithFrame:
CGRectMake(0, topBGImageView.frame.size.height,
middleMainBG.size.width, totalBGHeigth-topMainBG.size.height-bottomMainBG.size.height)];
[middleBGImageView setImage:middleMainBG];
UIImageView *bottomBGImageView=[[UIImageView alloc]initWithImage:bottomMainBG];
CGRect frame=bottomBGImageView.frame;
frame.origin.y=topBGImageView.frame.size.height+middleBGImageView.frame.size.height;
bottomBGImageView.frame=frame;
// Add all
[bgView addSubview:topBGImageView];
[bgView addSubview:middleBGImageView];
[bgView addSubview:bottomBGImageView];
[topBGImageView release];
[middleBGImageView release];
[bottomBGImageView release];
}
[self addSubview:bgView];
}
- (void) _initTable
{
if (table == nil)
{
table=[[UITableView alloc] initWithFrame:CGRectMake(buttonOrigin.x+tableXMargin, buttonOrigin.y+tableYMargin,
cellBGHoverImage.size.width, cellDispAmount*cellBGHoverImage.size.height)];
[table setSeparatorStyle:UITableViewCellSeparatorStyleNone];
[table setBackgroundColor:[UIColor blackColor]];
table.delegate=self;
table.dataSource=self;
}
[table reloadData];
[self addSubview:table];
}
+ (void) _pasteData:(BaseItemObject*)_data To:(id)_destination WithType:(NSString*) type
{
UILabel *nameLabel;
UILabel *descriptionLabel;
UIImageView *imageView;
if ([type isEqual:@"BROWSEDROPDOWNBIG_TYPE"])
{
}
else if ([type isEqual:@"BROWSEDROPDOWNSMALL_TYPE"])
{
}
else
{
if ([_destination isKindOfClass:[UIButton class]])
{
nameLabel=[[UILabel alloc] initWithFrame:BUTTON_TITLE_LABEL_FRAME];
descriptionLabel=[[UILabel alloc] initWithFrame:BUTTON_DESCRIPTION_LABEL_FRAME];
imageView=[[UIImageView alloc] initWithFrame:BUTTON_IMAGE_VIEW_FRAME];
}
else
{
nameLabel=[[UILabel alloc] initWithFrame:ITEM_TITLE_LABEL_FRAME];
descriptionLabel=[[UILabel alloc] initWithFrame:ITEM_DESCRIPTION_LABEL_FRAME];
imageView=[[UIImageView alloc] initWithFrame:ITEM_IMAGE_VIEW_FRAME];
}
BaseDataObject *dataToFillTheitem = _data.dataObject;
[nameLabel setText:dataToFillTheitem.name];
[nameLabel setBackgroundColor:[UIColor clearColor]];
[nameLabel setTextColor:TITLE_LABEL_COLOR];
[nameLabel setFont:TITLE_LABEL_FONT];
[nameLabel setShadowColor:[UIColor blackColor]];
[nameLabel setShadowOffset:CGSizeMake(0.0, -1.0)];
[_destination addSubview:nameLabel];
[descriptionLabel setText:dataToFillTheitem.description];
[descriptionLabel setBackgroundColor:[UIColor clearColor]];
[descriptionLabel setTextColor:DESCRIPTION_LABEL_COLOR];
[descriptionLabel setFont:DESCRIPTION_LABEL_FONT];
[descriptionLabel setShadowColor:[UIColor blackColor]];
[descriptionLabel setShadowOffset:CGSizeMake(0.0, -1.0)];
[_destination addSubview:descriptionLabel];
[imageView setImage:dataToFillTheitem.image];
[_destination addSubview:imageView];
nameLabel.tag=1;
descriptionLabel.tag=1;
imageView.tag=1;
[nameLabel release];
[descriptionLabel release];
[imageView release];
}
}
@end