9 template<
class T, u
int16_t (T::*Method)(
void)>
10 static uint16_t pebble_callback_handler(struct ::MenuLayer *menu_layer,
void *callback_context)
12 return (((T*)callback_context)->*Method)();
15 template<
class T, u
int16_t (T::*Method)(u
int16_t)>
16 static uint16_t pebble_callback_handler(struct ::MenuLayer *menu_layer, uint16_t section_index,
void *callback_context)
18 uint16_t result = (((T*)callback_context)->*Method)(section_index);
22 template<
class T,
int16_t (T::*Method)(const MenuIndex&)>
23 static int16_t pebble_callback_handler(::MenuLayer *menu_layer, ::
MenuIndex *cell_index,
void *callback_context)
25 return (((T*)callback_context)->*Method)(*cell_index);
28 template<
class T,
int16_t (T::*Method)(u
int16_t)>
29 static int16_t pebble_callback_handler(struct ::MenuLayer *menu_layer, uint16_t section_index,
void *callback_context)
31 return (((T*)callback_context)->*Method)(section_index);
34 template<
class T,
void (T::*Method)(const GContext&, const Layer&, const MenuIndex&)>
35 static void pebble_callback_handler(::GContext* ctx, const ::Layer *cell_layer, ::
MenuIndex *cell_index,
void *callback_context)
37 typedef ::Layer* LayerPtr;
38 (((T*)callback_context)->*Method)(ctx, Layer(
const_cast<LayerPtr
>(cell_layer)), *cell_index);
41 template<
class T,
void (T::*Method)(const GContext&, const Layer&, u
int16_t)>
42 static void pebble_callback_handler(::GContext* ctx, const ::Layer *cell_layer, uint16_t section_index,
void *callback_context)
44 typedef ::Layer* LayerPtr;
45 (((T*)callback_context)->*Method)(ctx, Layer(
const_cast<LayerPtr
>(cell_layer)), section_index);
48 template<
class T,
void (T::*Method)(const MenuIndex&)>
49 static void pebble_callback_handler(::MenuLayer *menu_layer, ::
MenuIndex *cell_index,
void *callback_context)
51 (((T*)callback_context)->*Method)(*cell_index);
54 template<
class T,
void (T::*Method)(const MenuIndex&, const MenuIndex&)>
55 static void pebble_callback_handler(::MenuLayer *menu_layer, ::
MenuIndex new_index, ::
MenuIndex old_index,
void *callback_context)
57 (((T*)callback_context)->*Method)(new_index, old_index);
60 template<
class T,
void (T::*Method)(MenuIndex&, const MenuIndex&)>
61 static void pebble_callback_handler(::MenuLayer *menu_layer, ::
MenuIndex *new_index, ::
MenuIndex old_index,
void *callback_context)
63 (((T*)callback_context)->*Method)(*new_index, old_index);
66 template<
class T,
void (T::*Method)(const GContext&, const Layer&,
bool)>
67 static void pebble_callback_handler(::GContext* ctx, const ::Layer *bg_layer,
bool highlight,
void *callback_context)
69 typedef ::Layer* LayerPtr;
70 (((T*)callback_context)->*Method)(ctx, Layer(
const_cast<LayerPtr
>(bg_layer)), highlight);
89 inline operator ::MenuLayer*() {
return menu_layer_; }
99 inline void SetSelectedIndex(uint16_t section, uint16_t row,
MenuRowAlign scroll_align,
bool animated)
101 SetSelectedIndex({ .section = section, .row = row }, scroll_align, animated);
120 inline bool IsIndexSelected(uint16_t section, uint16_t row)
const
122 return IsIndexSelected({ .section = section, .row = row });
137 ::MenuLayer* menu_layer_;
154 .draw_header = hasHeaders ? CALLBACK(
OnDrawHeader) :
nullptr,
177 virtual uint16_t
OnGetNumRows(uint16_t section_index) = 0;