Pebble Foundation Classes  0.2.0
C++ for Pebble
pebble.hpp
1 #pragma once
2 
3 // Include the Pebble header
4 extern "C" {
5 #include <pebble.h>
6 }
7 
8 // Remove the constructor macros that aren't needed in C++
9 #undef GRect
10 #undef GSize
11 #undef GPoint
12 
13 // Fix for missing snprintf when compiling C++11
14 extern "C" int snprintf(char *, size_t, const char *, ...);
15 
16 #include <new>
17 #include <functional>
18 #include <memory>
19 #include <utility>
20 #include <string>
21 
22 #define MAIN extern "C" int main(void)
23 #define VARGS_(_10, _9, _8, _7, _6, _5, _4, _3, _2, _1, N, ...) N
24 #define VARGS(...) VARGS_(__VA_ARGS__, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0)
25 #define CONCAT_(a, b) a##b
26 #define CONCAT(a, b) CONCAT_(a, b)
27 #define CALLBACK_2(className, methodName) pebble_callback_handler<className, &className::methodName>
28 #define CALLBACK_1(methodName) CALLBACK_2(std::remove_pointer<decltype(this)>::type, methodName)
29 #define CALLBACK(...) CONCAT(CALLBACK_, VARGS(__VA_ARGS__))(__VA_ARGS__)
30 #define HAS_OVERRIDE(baseClassName, methodName) ((void*)(this->*(&baseClassName::methodName)) == (void*)(&baseClassName::methodName)); // TODO remove
31 
32 #include "pebble_graphics_types.hpp"
33 #include "pebble_graphics_context.hpp"
34 #include "pebble_time.hpp"
35 #include "pebble_layer.hpp"
36 #include "pebble_clicks.hpp"
37 #include "pebble_window.hpp"
38 #include "pebble_text_layer.hpp"
39 #include "pebble_scroll_layer.hpp"
40 #include "pebble_event_services.hpp"
41 #include "pebble_simplemenu_layer.hpp"
42 #include "pebble_statusbar_layer.hpp"
43 #include "pebble_menu_layer.hpp"
44 #include "pebble_actionbar_layer.hpp"