-
Notifications
You must be signed in to change notification settings - Fork 22
/
Copy pathAdBanner.h
157 lines (133 loc) · 3.47 KB
/
AdBanner.h
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
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
#pragma once
#include <string>
namespace ludei { namespace ads {
class AdBannerListener;
/**
* Defines the different possible sizes of a banner.
*/
enum class AdBannerSize {
/**
* Smart size.
*/
SMART_SIZE,
/**
* Banner size.
*/
BANNER_SIZE,
/**
* Medium rectangular size.
*/
MEDIUM_RECT_SIZE,
/**
* Leaderboard size.
*/
LEADERBOARD_SIZE
};
/**
* Defines the different possible layouts of a banner.
*/
enum class AdBannerLayout {
/**
* Top center.
*/
TOP_CENTER,
/**
* Bottom center.
*/
BOTTOM_CENTER,
/**
* Custom layout.
*/
CUSTOM
};
/**
* Defines a banner ad.
*/
class AdBanner {
public:
virtual ~AdBanner(){};
/**
* Shows the banner.
*/
virtual void show() = 0;
/**
* Hides the banner.
*/
virtual void hide() = 0;
/**
* Returns the width of the banner.
*
* @return The width of the banner.
*/
virtual int32_t getWidth() const = 0;
/**
* Returns the height of the banner.
*
* @return The height of the banner.
*/
virtual int32_t getHeight() const = 0;
/**
* Loads a new banner ad.
*/
virtual void load() = 0;
/**
* Sets a new listener for the banner.
*
* @param listener The listener to be set.
*/
virtual void setListener(AdBannerListener * listener) = 0;
/**
* Sets the layout of the banner.
*
* @param layout The layout of the banner.
*/
virtual void setLayout(AdBannerLayout layout) = 0;
/**
* Sets the position of the banner given x and y coords.
* For custom layouts only.
*
* @param x The x coord.
* @param y The y coord.
*/
virtual void setPosition(float x, float y) = 0;
};
/**
* Allows to listen to events regarding banner ads.
*/
class AdBannerListener {
public:
virtual ~AdBannerListener(){};
/**
* Triggered when the banner has loaded a new ad.
*
* @param banner The banner ad.
*/
virtual void onLoaded(AdBanner * banner) = 0;
/**
* Triggered when the banner has failed on loading a new ad.
*
* @param banner The banner ad.
* @param code The code of the error.
* @param message The error message.
*/
virtual void onFailed(AdBanner * banner, int32_t code, const std::string & message) = 0;
/**
* Triggered when the banner has been clicked.
*
* @param banner The banner ad.
*/
virtual void onClicked(AdBanner * banner) = 0;
/**
* Triggered when the banner has expanded to show the content.
*
* @param banner The banner ad.
*/
virtual void onExpanded(AdBanner * banner) = 0;
/**
* Triggered when the banner has been collapsed after showing the content.
*
* @param banner The banner ad.
*/
virtual void onCollapsed(AdBanner * banner) = 0;
};
} }