|
3 | 3 | * This product is licensed under an Apache license, see the LICENSE file in the top-level directory. |
4 | 4 | */ |
5 | 5 |
|
| 6 | +/** |
| 7 | + * @file GfxMenuConfig.h |
| 8 | + * |
| 9 | + * This file contains the base drawing configuration structures and helper methods for |
| 10 | + * drawing onto graphical screens, be it mono or colour. Also there's some additional |
| 11 | + * structures for describing colours, coordinates and padding. |
| 12 | + */ |
| 13 | + |
6 | 14 | #ifndef _GFX_MENU_CONFIG_H_ |
7 | 15 | #define _GFX_MENU_CONFIG_H_ |
8 | 16 |
|
|
11 | 19 | #include "MenuItems.h" |
12 | 20 | #include "DrawingPrimitives.h" |
13 | 21 |
|
14 | | -/** |
15 | | - * @file GfxMenuConfig.h |
16 | | - * |
17 | | - * This file contains the base drawing configuration structures and helper methods for |
18 | | - * drawing onto graphical screens, be it mono or colour. Also there's some additional |
19 | | - * structures for describing colours, coordinates and padding. |
20 | | - */ |
21 | 22 |
|
22 | 23 | namespace tcgfx { |
23 | 24 |
|
@@ -158,14 +159,29 @@ namespace tcgfx { |
158 | 159 | int getRow() const { return rowPosition; } |
159 | 160 | }; |
160 | 161 |
|
| 162 | + /** |
| 163 | + * A helper function that checks if a particular justification includes the value |
| 164 | + * @param justification the justification to check |
| 165 | + * @return true if the value is needed |
| 166 | + */ |
161 | 167 | inline bool itemNeedsValue(GridPosition::GridJustification justification) { |
162 | 168 | return (justification & GridPosition::CORE_JUSTIFY_VALUE_REQUIRED) != 0; |
163 | 169 | } |
164 | 170 |
|
| 171 | + /** |
| 172 | + * A helper function that checks if a particular justification includes the name |
| 173 | + * @param justification the justification to check |
| 174 | + * @return true if the name is needed |
| 175 | + */ |
165 | 176 | inline bool itemNeedsName(GridPosition::GridJustification justification) { |
166 | 177 | return (justification & GridPosition::CORE_JUSTIFY_NAME_REQUIRED) != 0; |
167 | 178 | } |
168 | 179 |
|
| 180 | + /** |
| 181 | + * Get the core justification part, eg left, right centre |
| 182 | + * @param j the justification to check |
| 183 | + * @return the core part, just left, right centre etc. |
| 184 | + */ |
169 | 185 | inline GridPosition::GridJustification coreJustification(GridPosition::GridJustification j) { |
170 | 186 | return static_cast<GridPosition::GridJustification>(j & 0b11); |
171 | 187 | } |
@@ -331,10 +347,40 @@ namespace tcgfx { |
331 | 347 | */ |
332 | 348 | class ItemDisplayPropertiesFactory { |
333 | 349 | public: |
| 350 | + /** |
| 351 | + * Returns the configuration for the parameters below, it should never return nullptr. |
| 352 | + * @param pItem the item or null for default |
| 353 | + * @param compType the component type to get the rendering for |
| 354 | + * @return the properties for a given component. |
| 355 | + */ |
334 | 356 | virtual ItemDisplayProperties* configFor(MenuItem* pItem, ItemDisplayProperties::ComponentType compType) = 0; |
| 357 | + |
| 358 | + /** |
| 359 | + * Returns the icon associated with the menu item ID, there are two special IDs for the edit and active icons |
| 360 | + * @param id the menu item ID or the special ID for edit or active icon |
| 361 | + * @return the icon or nullptr if not available |
| 362 | + */ |
335 | 363 | virtual DrawableIcon* iconForMenuItem(uint16_t id) = 0; |
| 364 | + |
| 365 | + /** |
| 366 | + * Get the grid item for a given position if it is available |
| 367 | + * @param pItem the item to get the grid position for |
| 368 | + * @return the grid position if available |
| 369 | + */ |
336 | 370 | virtual GridPositionWithId* gridPositionForItem(MenuItem* pItem) = 0; |
| 371 | + |
| 372 | + /** |
| 373 | + * Get the selected color for a given palette entry |
| 374 | + * @param colorType |
| 375 | + * @return |
| 376 | + */ |
337 | 377 | virtual color_t getSelectedColor(ItemDisplayProperties::ColorType colorType) = 0; |
| 378 | + |
| 379 | + /** |
| 380 | + * add a new grid position for a given menu item |
| 381 | + * @param item the menu item the position is for |
| 382 | + * @param position the position to record |
| 383 | + */ |
338 | 384 | virtual void addGridPosition(MenuItem* item, const GridPosition& position) = 0; |
339 | 385 | }; |
340 | 386 |
|
|
0 commit comments