CheeseBoard
A library for use with the CheeseBoard Cheddar platform
GfxSSIDListBox.h
1 #pragma once
2 
3 #include <Arduino.h>
4 #include <stdint.h>
5 #include "GfxItem.h"
6 #include "GfxNetInfo.h"
7 
8 class GfxSSIDListBox : public GfxItem {
9 public:
10  const static uint8_t MaxItems = 32;
11 
12 public:
13  GfxSSIDListBox(uint16_t x=0, uint16_t y=0);
14  ~GfxSSIDListBox();
15 
21  int16_t add(const GfxNetInfo s);
22 
29  bool remove(const uint8_t idx, bool compactAfter=true);
30 
34  void draw(uint16_t xOffset=0, uint16_t yOffset=0);
35  uint16_t width();
36  uint16_t height();
37  uint16_t lineHeight();
38 
44  GfxNetInfo* operator[](int16_t idx);
45 
51  GfxNetInfo* operator[](const String& ssid);
52 
57  int16_t find(const String& ssid, uint8_t n=1);
58 
63  bool select(int16_t idx);
64 
67  int16_t selected();
68 
72  uint8_t scrollDown(uint8_t rows);
73 
77  uint8_t scrollUp(uint8_t rows);
78 
83  bool scrollTo(uint8_t idx);
84 
95  int16_t update(String ssid, int8_t channel, uint8_t signal);
96 
102  int16_t findNext(uint8_t from=0);
103 
109  int16_t findPreceding(uint8_t from=MaxItems);
110 
115  uint8_t count();
116 
117 protected:
123  int16_t findGap(uint8_t startAt=0);
124 
127  //void sort();
129 
134  bool isCompacted();
135 
138  void compact();
139 
142  bool isOnScreen(uint8_t idx);
143 
146  uint8_t rowsFrom(uint8_t idx);
147 
148 
149 protected:
150  GfxNetInfo *_items[MaxItems];
151  int16_t _selected;
152  uint8_t _screenLines;
153  uint8_t _screenStart;
154  uint8_t _lineHeight;
155  // TODO: uint8_t _frameSize; uint8_t _frameStart;
156 
157 };
158 
int16_t add(const GfxNetInfo s)
void compact()
Make used items contiguous (remove gaps)
bool isOnScreen(uint8_t idx)
int16_t update(String ssid, int8_t channel, uint8_t signal)
Definition: GfxItem.h:5
uint8_t scrollUp(uint8_t rows)
int16_t findGap(uint8_t startAt=0)
bool scrollTo(uint8_t idx)
uint8_t rowsFrom(uint8_t idx)
void draw(uint16_t xOffset=0, uint16_t yOffset=0)
uint16_t height()
GfxNetInfo * operator[](int16_t idx)
uint8_t scrollDown(uint8_t rows)
int16_t findNext(uint8_t from=0)
bool select(int16_t idx)
bool isCompacted()
Sort the items contained in the list box using quicksort.
int16_t find(const String &ssid, uint8_t n=1)
int16_t findPreceding(uint8_t from=MaxItems)
uint16_t width()