tcMenu
CardLayoutPanel.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2018 https://www.thecoderscorner.com (Dave Cherry).
3  * This product is licensed under an Apache license, see the LICENSE file in the top-level directory.
4  */
5 
7 #include "DrawingPrimitives.h"
8 #include "GfxMenuConfig.h"
9 #include "TcDrawableButton.h"
10 
16 #ifndef TCMENU_CARDLAYOUTPANEL_H
17 #define TCMENU_CARDLAYOUTPANEL_H
18 
19 namespace tcgfx {
20 
22  private:
23  uint16_t key;
24  bool state;
25  public:
26  SubMenuUsingCardLayout() : key(-1), state(false) {}
27 
29 
30  SubMenuUsingCardLayout &operator=(const SubMenuUsingCardLayout &) = default;
31 
32  SubMenuUsingCardLayout(uint16_t key, bool state) : key(key), state(state) {}
33 
34  uint16_t getKey() const { return key; }
35 
36  uint16_t getState() const { return state; }
37 
38  void setState(bool onOrOff) { state = onOrOff; }
39  };
40 
42 
55  public:
56  enum CardLayoutDir {
57  DOING_NOTHING, GOING_LEFT, GOING_RIGHT
58  };
59  private:
60  TcDrawableButton leftButton;
61  TcDrawableButton rightButton;
62  const DrawableIcon *iconLeft;
63  BtreeList<uint16_t, SubMenuUsingCardLayout> usingCardLayout;
64  Coord menuItemLocation;
65  Coord menuItemSize;
66  Coord titleSize;
67  CardLayoutDir dirStatus = DOING_NOTHING;
68  bool inUse = false;
69  MenuTouchScreenManager *touchScreenManager = nullptr;
70  GraphicsDeviceRenderer* theRenderer;
71  public:
83  CardLayoutPane(const DrawableIcon *left, const DrawableIcon *right, MenuTouchScreenManager *optionalTouch, bool monoDisplay);
84 
92  void forMenu(ItemDisplayProperties *titleProps, ItemDisplayProperties *itemProps, GraphicsDeviceRenderer* gfxRenderer, bool titleNeeded);
93 
97  void notInUse();
98 
104  void setEnablementForSub(MenuItem *item, bool onOrOff);
105 
111  bool isSubMenuCardLayout(MenuItem *item);
112 
121  CardLayoutDir prepareAndPaintButtons(GraphicsDeviceRenderer *renderer, int active, int countOfItems, bool titleActive);
122 
127  void touched(const TouchNotification &notification);
128 
132  const Coord &getMenuLocation() { return menuItemLocation; }
133 
137  const Coord &getMenuSize() { return menuItemSize; }
138 
142  const Coord &getTitleSize() { return titleSize; }
143  };
144 
145 }
146 
147 #endif //TCMENU_CARDLAYOUTPANEL_H
contains a series of core components needed by all graphical renderers
contains the interface between the touch screen and tcMenu.
a button that can be rendered onto any drawable, remembers it's position, and can integrate with touc...
Definition: MenuItems.h:329
Definition: CardLayoutPanel.h:54
void setEnablementForSub(MenuItem *item, bool onOrOff)
Definition: CardLayoutPanel.cpp:24
void forMenu(ItemDisplayProperties *titleProps, ItemDisplayProperties *itemProps, GraphicsDeviceRenderer *gfxRenderer, bool titleNeeded)
Definition: CardLayoutPanel.cpp:35
const Coord & getMenuLocation()
Definition: CardLayoutPanel.h:132
void touched(const TouchNotification &notification)
Definition: CardLayoutPanel.cpp:89
bool isSubMenuCardLayout(MenuItem *item)
Definition: CardLayoutPanel.cpp:18
CardLayoutPane(const DrawableIcon *left, const DrawableIcon *right, MenuTouchScreenManager *optionalTouch, bool monoDisplay)
Definition: CardLayoutPanel.cpp:9
const Coord & getMenuSize()
Definition: CardLayoutPanel.h:137
CardLayoutDir prepareAndPaintButtons(GraphicsDeviceRenderer *renderer, int active, int countOfItems, bool titleActive)
Definition: CardLayoutPanel.cpp:75
void notInUse()
Definition: CardLayoutPanel.cpp:64
const Coord & getTitleSize()
Definition: CardLayoutPanel.h:142
Definition: DrawingPrimitives.h:152
Definition: GraphicsDeviceRenderer.h:59
Definition: GfxMenuConfig.h:245
Definition: MenuTouchScreenEncoder.h:84
Definition: CardLayoutPanel.h:21
Definition: TcDrawableButton.h:31
Definition: MenuTouchScreenEncoder.h:27
Definition: MenuTouchScreenEncoder.h:62
Definition: DrawingPrimitives.h:123