mirror of
https://github.com/esphome/esphome.git
synced 2024-12-13 08:54:54 +01:00
... more clang fixes
This commit is contained in:
parent
fc6aa95ac4
commit
a61343e8ec
7 changed files with 14 additions and 19 deletions
|
@ -419,7 +419,7 @@ class Display : public PollingComponent {
|
||||||
* @param y The y coordinate of the upper left corner
|
* @param y The y coordinate of the upper left corner
|
||||||
* @param layout The graphical layout to render
|
* @param layout The graphical layout to render
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
void render_layout(int x, int y, graphical_layout::RootLayoutComponent *layout);
|
void render_layout(int x, int y, graphical_layout::RootLayoutComponent *layout);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -516,7 +516,7 @@ class Display : public PollingComponent {
|
||||||
*
|
*
|
||||||
* @param[in] x: x coordinate as the new local. Absolute to the displays underlying 0
|
* @param[in] x: x coordinate as the new local. Absolute to the displays underlying 0
|
||||||
* @param[in] y: y coordinate as the new local. Absolute to the displays underlying 0
|
* @param[in] y: y coordinate as the new local. Absolute to the displays underlying 0
|
||||||
*/
|
*/
|
||||||
void set_local_coordinate(int x, int y) { this->local_coordinate_.push_back(Point(x, y)); };
|
void set_local_coordinate(int x, int y) { this->local_coordinate_.push_back(Point(x, y)); };
|
||||||
|
|
||||||
/** Changes the local coordinates to be to be (x_local + x_offset, y_local + y_offset)
|
/** Changes the local coordinates to be to be (x_local + x_offset, y_local + y_offset)
|
||||||
|
@ -525,11 +525,11 @@ class Display : public PollingComponent {
|
||||||
*
|
*
|
||||||
* @param[in] x_offset: x offset from the current local. Relative to the local x
|
* @param[in] x_offset: x offset from the current local. Relative to the local x
|
||||||
* @param[in] y_offset: y offset from the current local. Relative to the local y
|
* @param[in] y_offset: y offset from the current local. Relative to the local y
|
||||||
*/
|
*/
|
||||||
void set_local_coordinates_relative_to_current(int x_offset, int y_offset);
|
void set_local_coordinates_relative_to_current(int x_offset, int y_offset);
|
||||||
|
|
||||||
/** Removes the most recent local coordinate system from use
|
/** Removes the most recent local coordinate system from use
|
||||||
*/
|
*/
|
||||||
void pop_local_coordinates();
|
void pop_local_coordinates();
|
||||||
|
|
||||||
/** Gets the current local coordinates in the displays absolute coordinate system
|
/** Gets the current local coordinates in the displays absolute coordinate system
|
||||||
|
|
|
@ -10,8 +10,8 @@ class Point {
|
||||||
int16_t x;
|
int16_t x;
|
||||||
int16_t y;
|
int16_t y;
|
||||||
|
|
||||||
Point() : x(VALUE_NO_SET), y(VALUE_NO_SET) {};
|
Point() : x(VALUE_NO_SET), y(VALUE_NO_SET){};
|
||||||
inline Point(int16_t x, int16_t y) ALWAYS_INLINE : x(x), y(y) {};
|
inline Point(int16_t x, int16_t y) ALWAYS_INLINE : x(x), y(y){};
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace display
|
} // namespace display
|
||||||
|
|
|
@ -6,16 +6,15 @@ namespace esphome {
|
||||||
namespace display {
|
namespace display {
|
||||||
class Display;
|
class Display;
|
||||||
class Rect;
|
class Rect;
|
||||||
}
|
} // namespace display
|
||||||
|
|
||||||
namespace graphical_layout {
|
namespace graphical_layout {
|
||||||
|
|
||||||
/** The ContainerLayoutItem can be used to derive from when a layout item has children.
|
/** The ContainerLayoutItem can be used to derive from when a layout item has children.
|
||||||
* It does not define what or how child items get used just that they exist for the item
|
* It does not define what or how child items get used just that they exist for the item
|
||||||
*/
|
*/
|
||||||
class ContainerLayoutItem : public LayoutItem {
|
class ContainerLayoutItem : public LayoutItem {
|
||||||
public:
|
public:
|
||||||
|
|
||||||
/** Adds an item to this container */
|
/** Adds an item to this container */
|
||||||
void add_item(LayoutItem *child) { this->children_.push_back(child); }
|
void add_item(LayoutItem *child) { this->children_.push_back(child); }
|
||||||
|
|
||||||
|
@ -23,5 +22,5 @@ class ContainerLayoutItem : public LayoutItem {
|
||||||
std::vector<LayoutItem *> children_;
|
std::vector<LayoutItem *> children_;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
} // namespace graphical_layout
|
||||||
}
|
} // namespace esphome
|
||||||
|
|
|
@ -8,8 +8,7 @@ namespace graphical_layout {
|
||||||
|
|
||||||
static const char *const TAG = "rootlayoutcomponent";
|
static const char *const TAG = "rootlayoutcomponent";
|
||||||
|
|
||||||
void RootLayoutComponent::setup() {
|
void RootLayoutComponent::setup() {}
|
||||||
}
|
|
||||||
|
|
||||||
void RootLayoutComponent::dump_config() {
|
void RootLayoutComponent::dump_config() {
|
||||||
ESP_LOGCONFIG(TAG, "Graphical Layout");
|
ESP_LOGCONFIG(TAG, "Graphical Layout");
|
||||||
|
|
|
@ -16,7 +16,7 @@ namespace graphical_layout {
|
||||||
|
|
||||||
/** Component used for rendering the layout*/
|
/** Component used for rendering the layout*/
|
||||||
class RootLayoutComponent : public Component {
|
class RootLayoutComponent : public Component {
|
||||||
public:
|
public:
|
||||||
void setup() override;
|
void setup() override;
|
||||||
void dump_config() override;
|
void dump_config() override;
|
||||||
|
|
||||||
|
@ -30,7 +30,7 @@ public:
|
||||||
|
|
||||||
void set_layout_root(LayoutItem *layout) { this->layout_root_ = layout; };
|
void set_layout_root(LayoutItem *layout) { this->layout_root_ = layout; };
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
LayoutItem *layout_root_{nullptr};
|
LayoutItem *layout_root_{nullptr};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -4,14 +4,13 @@ namespace esphome {
|
||||||
namespace display {
|
namespace display {
|
||||||
class Display;
|
class Display;
|
||||||
class Rect;
|
class Rect;
|
||||||
}
|
} // namespace display
|
||||||
|
|
||||||
namespace graphical_layout {
|
namespace graphical_layout {
|
||||||
|
|
||||||
/** LayoutItem is the base from which all items derive from*/
|
/** LayoutItem is the base from which all items derive from*/
|
||||||
class LayoutItem {
|
class LayoutItem {
|
||||||
public:
|
public:
|
||||||
|
|
||||||
/** Measures the item as it would be drawn on the display and returns the bounds for it
|
/** Measures the item as it would be drawn on the display and returns the bounds for it
|
||||||
*
|
*
|
||||||
* param[in] display: Display that will be used for rendering. May be used to help with calculations
|
* param[in] display: Display that will be used for rendering. May be used to help with calculations
|
||||||
|
|
|
@ -3,7 +3,6 @@
|
||||||
#include "esphome/components/graphical_layout/graphical_layout.h"
|
#include "esphome/components/graphical_layout/graphical_layout.h"
|
||||||
#include "esphome/components/font/font.h"
|
#include "esphome/components/font/font.h"
|
||||||
|
|
||||||
|
|
||||||
namespace esphome {
|
namespace esphome {
|
||||||
namespace graphical_layout {
|
namespace graphical_layout {
|
||||||
|
|
||||||
|
@ -23,7 +22,6 @@ class TextPanel : public LayoutItem {
|
||||||
void set_foreground_color(Color foreground_color) { this->foreground_color_ = foreground_color; };
|
void set_foreground_color(Color foreground_color) { this->foreground_color_ = foreground_color; };
|
||||||
void set_background_color(Color background_color) { this->background_color_ = background_color; };
|
void set_background_color(Color background_color) { this->background_color_ = background_color; };
|
||||||
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
int item_padding_{0};
|
int item_padding_{0};
|
||||||
std::string text_{};
|
std::string text_{};
|
||||||
|
|
Loading…
Reference in a new issue