tcMenu
Public Types | Public Member Functions | List of all members
tcgfx::CardLayoutPane Class Reference

#include <CardLayoutPanel.h>

Inheritance diagram for tcgfx::CardLayoutPane:
tcgfx::TouchObserver

Public Types

enum  CardLayoutDir { DOING_NOTHING , GOING_LEFT , GOING_RIGHT }
 

Public Member Functions

 CardLayoutPane (const DrawableIcon *left, const DrawableIcon *right, MenuTouchScreenManager *optionalTouch, bool monoDisplay)
 
void forMenu (ItemDisplayProperties *titleProps, ItemDisplayProperties *itemProps, GraphicsDeviceRenderer *gfxRenderer, bool titleNeeded)
 
void notInUse ()
 
void setEnablementForSub (MenuItem *item, bool onOrOff)
 
bool isSubMenuCardLayout (MenuItem *item)
 
CardLayoutDir prepareAndPaintButtons (GraphicsDeviceRenderer *renderer, int active, int countOfItems, bool titleActive)
 
void touched (const TouchNotification &notification)
 
const CoordgetMenuLocation ()
 
const CoordgetMenuSize ()
 
const CoordgetTitleSize ()
 

Detailed Description

Card layout is a layout where a single item (and possibly a title) are shown on the display with left and right indicators (or buttons on a touch screen). This class does most of the layout level calculations to make some attempt at taking new layouts outside of the core. If more new layouts are created, we'll formalize this into some kind of interface and tidy up the code in the renderer. On touch screens the buttons will work with touch.

Parameters
leftthe icon for the left button
rightthe icon for the right button
optionalTouchif using touch, provide the touch manager, otherwise null.

Constructor & Destructor Documentation

◆ CardLayoutPane()

CardLayoutPane::CardLayoutPane ( const DrawableIcon left,
const DrawableIcon right,
MenuTouchScreenManager optionalTouch,
bool  monoDisplay 
)

Creates a card layout with the left and right buttons, ready for use later when a card layout is presented. This class does most of the layout level calculations to make some attempt at taking new layouts outside of the core. If more new layouts are created, we'll formalize this into some kind of interface and tidy up the code in the renderer. On touch screens the buttons will work with touch.

Parameters
leftthe icon for the left button
rightthe icon for the right button
optionalTouchif using touch, provide the touch manager, otherwise null.
monoDisplayif the display is mono

Member Function Documentation

◆ forMenu()

void CardLayoutPane::forMenu ( ItemDisplayProperties titleProps,
ItemDisplayProperties itemProps,
GraphicsDeviceRenderer gfxRenderer,
bool  titleNeeded 
)

When a menu is presented in card layout this will be called when full re-draw is requested to set up the layout and prepare the available sizes.

Parameters
titlePropsthe display properties that the buttons should use
gfxRendererthe renderer used to draw with
titleNeededif the title is needed or not.

◆ notInUse()

void CardLayoutPane::notInUse ( )

When a card layout menu is going off display, this is called to reset anything adjust for the card layout.

◆ setEnablementForSub()

void CardLayoutPane::setEnablementForSub ( MenuItem item,
bool  onOrOff 
)

Use this to add or remove submenus from the card layout

Parameters
itemthe item to check (or null for root)
onOrOffif it should use card layout

◆ isSubMenuCardLayout()

bool CardLayoutPane::isSubMenuCardLayout ( MenuItem item)

Check if a given menu item is using card layout.

Parameters
itemthe item to check (or null for root)
Returns
true if card layout, otherwise false

◆ prepareAndPaintButtons()

CardLayoutPane::CardLayoutDir CardLayoutPane::prepareAndPaintButtons ( GraphicsDeviceRenderer renderer,
int  active,
int  countOfItems,
bool  titleActive 
)

Call this every time the renderer paint runs, it makes sure the buttons are up to date and also returns if any buttons have been pressed.

Parameters
rendererthe renderer
activethe currently active item index
countOfItemsthe number of items
Returns
the current button press mode.

◆ touched()

void CardLayoutPane::touched ( const TouchNotification notification)
virtual

Part of the touch observer interface, called when there is a touch event .

Parameters
notificationthe touch notification

Implements tcgfx::TouchObserver.

◆ getMenuLocation()

const Coord& tcgfx::CardLayoutPane::getMenuLocation ( )
inline
Returns
the location of the start of the item to be presented

◆ getMenuSize()

const Coord& tcgfx::CardLayoutPane::getMenuSize ( )
inline
Returns
the size of the item to be presented

◆ getTitleSize()

const Coord& tcgfx::CardLayoutPane::getTitleSize ( )
inline
Returns
the size of the title area

The documentation for this class was generated from the following files: