@@ -29,8 +29,7 @@ class MenuSystem;
2929// !
3030// ! \see Menu
3131// ! \see MenuItem
32- class MenuComponent
33- {
32+ class MenuComponent {
3433 friend class MenuSystem ;
3534 friend class Menu ;
3635public:
@@ -186,8 +185,7 @@ class MenuComponent
186185// !
187186// ! \see MenuComponent
188187// ! \see Menu
189- class MenuItem : public MenuComponent
190- {
188+ class MenuItem : public MenuComponent {
191189public:
192190 // ! \brief Construct a MenuItem
193191 // ! \param[in] name The name of the menu component that is displayed in
@@ -222,8 +220,7 @@ class MenuItem : public MenuComponent
222220
223221// ! \brief A MenuItem that calls MenuSystem::back() when selected.
224222// ! \see MenuItem
225- class BackMenuItem : public MenuItem
226- {
223+ class BackMenuItem : public MenuItem {
227224public:
228225 BackMenuItem (const char * name, SelectFnPtr select_fn, MenuSystem* ms);
229226
@@ -233,12 +230,11 @@ class BackMenuItem : public MenuItem
233230 virtual Menu* select ();
234231
235232protected:
236- MenuSystem* menu_system ;
233+ MenuSystem* _menu_system ;
237234};
238235
239236
240- class NumericMenuItem : public MenuItem
241- {
237+ class NumericMenuItem : public MenuItem {
242238public:
243239 // ! \brief Callback for formatting the numeric value into a String.
244240 // !
@@ -247,39 +243,39 @@ class NumericMenuItem : public MenuItem
247243 using FormatValueFnPtr = const String (*)(const float value);
248244
249245public:
250- // / Constructor
251- // /
252- // / @param name The name of the menu item.
253- // / @param select_fn The function to call when this MenuItem is selected.
254- // / @param value Default value.
255- // / @param minValue The minimum value.
256- // / @param maxValue The maximum value.
257- // / @param increment How much the value should be incremented by.
258- // / @param valueFormatter The custom formatter. If nullptr the String float
259- // / formatter will be used.
246+ // ! Constructor
247+ // !
248+ // ! @param name The name of the menu item.
249+ // ! @param select_fn The function to call when this MenuItem is selected.
250+ // ! @param value Default value.
251+ // ! @param min_value The minimum value.
252+ // ! @param max_value The maximum value.
253+ // ! @param increment How much the value should be incremented by.
254+ // ! @param format_value_fn The custom formatter. If nullptr the String
255+ // ! float formatter will be used.
260256 NumericMenuItem (const char * name, SelectFnPtr select_fn,
261- float value, float minValue , float maxValue ,
257+ float value, float min_value , float max_value ,
262258 float increment=1.0 ,
263259 FormatValueFnPtr format_value_fn=nullptr );
264260
265- /* *
266- * Sets the custom number formatter.
267- *
268- * @ param numberFormat the custom formatter. If nullptr the String float
269- * formatter will be used (2 decimals)
270- */
261+ // !
262+ // ! \brief Sets the custom number formatter.
263+ // !
264+ // ! \ param numberFormat the custom formatter. If nullptr the String float
265+ // ! formatter will be used (2 decimals)
266+ // !
271267 void set_number_formatter (FormatValueFnPtr format_value_fn);
272268
273269 float get_value () const ;
274- float get_minValue () const ;
275- float get_maxValue () const ;
270+ float get_min_value () const ;
271+ float get_max_value () const ;
276272
277- // TODO: get_value_string is a poor name. get_formatted_value maybe?
278- String get_value_string () const ;
279273 void set_value (float value);
280274 void set_min_value (float value);
281275 void set_max_value (float value);
282276
277+ String get_formatted_value () const ;
278+
283279 virtual void render (MenuComponentRenderer const & renderer) const ;
284280
285281protected:
@@ -290,20 +286,30 @@ class NumericMenuItem : public MenuItem
290286
291287protected:
292288 float _value;
293- float _minValue ;
294- float _maxValue ;
289+ float _min_value ;
290+ float _max_value ;
295291 float _increment;
296292 FormatValueFnPtr _format_value_fn;
297293};
298294
299295
300- class Menu : public MenuComponent
301- {
296+ // ! \brief A MenuComponent that can contain other MenuComponents.
297+ // !
298+ // ! Menu represents the branch in the composite design pattern (see:
299+ // ! https://en.wikipedia.org/wiki/Composite_pattern). When a Menu is
300+ // ! selected, the user-defined Menu::_select_fn callback is called.
301+ // !
302+ // ! \see MenuComponent
303+ // ! \see MenuItem
304+ class Menu : public MenuComponent {
302305 friend class MenuSystem ;
303306public:
304307 Menu (const char * name, SelectFnPtr select_fn=nullptr );
305308
309+ // ! \brief Adds a MenuItem to the Menu
306310 void add_item (MenuItem* p_item);
311+
312+ // ! \brief Adds a Menu to the Menu
307313 void add_menu (Menu* p_menu);
308314
309315 MenuComponent const * get_current_component () const ;
@@ -313,16 +319,29 @@ class Menu : public MenuComponent
313319 uint8_t get_current_component_num () const ;
314320 uint8_t get_previous_component_num () const ;
315321
322+ // ! \copydoc MenuComponent::render
316323 void render (MenuComponentRenderer const & renderer) const ;
317324
318325protected:
319- void set_parent (Menu* pParent );
326+ void set_parent (Menu* p_parent );
320327 Menu const * get_parent () const ;
321328
329+ // ! \brief Activates the current selection
330+ // !
331+ // ! When a client makes a selection, activate is called on the current menu
332+ // ! which in turn calls the menu's current item's callback.
322333 Menu* activate ();
334+
335+ // ! \copydoc MenuComponent::next
323336 virtual bool next (bool loop=false );
337+
338+ // ! \copydoc MenuComponent::prev
324339 virtual bool prev (bool loop=false );
340+
341+ // ! \copydoc MenuComponent::select
325342 virtual Menu* select ();
343+
344+ // ! \copydoc MenuComponent::reset
326345 virtual void reset ();
327346
328347 void add_component (MenuComponent* p_component);
@@ -337,8 +356,7 @@ class Menu : public MenuComponent
337356};
338357
339358
340- class MenuSystem
341- {
359+ class MenuSystem {
342360public:
343361 MenuSystem (MenuComponentRenderer const & renderer);
344362
@@ -359,8 +377,7 @@ class MenuSystem
359377};
360378
361379
362- class MenuComponentRenderer
363- {
380+ class MenuComponentRenderer {
364381public:
365382 virtual void render (Menu const & menu) const = 0;
366383
0 commit comments