mirror of
https://github.com/esphome/esphome.git
synced 2024-12-12 08:24:55 +01:00
clang fixes
This commit is contained in:
parent
f749d26353
commit
2227a091c5
14 changed files with 72 additions and 75 deletions
|
@ -358,7 +358,6 @@ void Display::set_local_coordinates_relative_to_current(int x_offset, int y_offs
|
||||||
p.y += y_offset;
|
p.y += y_offset;
|
||||||
|
|
||||||
this->local_coordinate_.push_back(p);
|
this->local_coordinate_.push_back(p);
|
||||||
|
|
||||||
}
|
}
|
||||||
void Display::pop_local_coordinates() {
|
void Display::pop_local_coordinates() {
|
||||||
if (this->local_coordinate_.empty()) {
|
if (this->local_coordinate_.empty()) {
|
||||||
|
|
|
@ -2,9 +2,9 @@ import esphome.codegen as cg
|
||||||
import esphome.config_validation as cv
|
import esphome.config_validation as cv
|
||||||
from esphome.components import font, color
|
from esphome.components import font, color
|
||||||
from esphome.const import CONF_ID
|
from esphome.const import CONF_ID
|
||||||
from esphome.components.graphical_layout import horizontal_stack
|
from . import horizontal_stack
|
||||||
from esphome.components.graphical_layout import vertical_stack
|
from . import vertical_stack
|
||||||
from esphome.components.graphical_layout import text_panel
|
from . import text_panel
|
||||||
|
|
||||||
graphical_layout_ns = cg.esphome_ns.namespace("graphical_layout")
|
graphical_layout_ns = cg.esphome_ns.namespace("graphical_layout")
|
||||||
RootLayoutComponent = graphical_layout_ns.class_("RootLayoutComponent", cg.Component)
|
RootLayoutComponent = graphical_layout_ns.class_("RootLayoutComponent", cg.Component)
|
||||||
|
|
|
@ -17,9 +17,7 @@ class ContainerLayoutItem : public LayoutItem {
|
||||||
public:
|
public:
|
||||||
|
|
||||||
/** Adds an item to this container */
|
/** Adds an item to this container */
|
||||||
void add_item(LayoutItem *child) {
|
void add_item(LayoutItem *child) { this->children_.push_back(child); }
|
||||||
this->children_.push_back(child);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
std::vector<LayoutItem *> children_;
|
std::vector<LayoutItem *> children_;
|
||||||
|
|
|
@ -10,7 +10,7 @@ namespace esphome {
|
||||||
namespace display {
|
namespace display {
|
||||||
class Display;
|
class Display;
|
||||||
class Rect;
|
class Rect;
|
||||||
}
|
} // namespace display
|
||||||
|
|
||||||
namespace graphical_layout {
|
namespace graphical_layout {
|
||||||
|
|
||||||
|
|
|
@ -47,5 +47,5 @@ void HorizontalStack::render(display::Display *display, display::Rect bounds) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
} // namespace graphical_layout
|
||||||
}
|
} // namespace esphome
|
||||||
|
|
|
@ -21,5 +21,5 @@ protected:
|
||||||
int item_padding_{0};
|
int item_padding_{0};
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
} // namespace graphical_layout
|
||||||
}
|
} // namespace esphome
|
||||||
|
|
|
@ -33,5 +33,5 @@ class LayoutItem {
|
||||||
virtual void dump_config(int indent_depth, int additional_level_depth) = 0;
|
virtual void dump_config(int indent_depth, int additional_level_depth) = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
} // namespace graphical_layout
|
||||||
}
|
} // namespace esphome
|
||||||
|
|
|
@ -19,7 +19,8 @@ const display::Rect TextPanel::measure_item(display::Display *display) {
|
||||||
int width;
|
int width;
|
||||||
int height;
|
int height;
|
||||||
|
|
||||||
display->get_text_bounds(0, 0, this->text_.c_str(), this->font_, display::TextAlign::TOP_LEFT, &x1, &y1, &width, &height);
|
display->get_text_bounds(0, 0, this->text_.c_str(), this->font_, display::TextAlign::TOP_LEFT, &x1, &y1, &width,
|
||||||
|
&height);
|
||||||
|
|
||||||
return display::Rect(0, 0, width, height);
|
return display::Rect(0, 0, width, height);
|
||||||
}
|
}
|
||||||
|
@ -28,5 +29,5 @@ void TextPanel::render(display::Display *display, display::Rect bounds) {
|
||||||
display->print(0, 0, this->font_, this->foreground_color_, display::TextAlign::TOP_LEFT, this->text_.c_str());
|
display->print(0, 0, this->font_, this->foreground_color_, display::TextAlign::TOP_LEFT, this->text_.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
} // namespace graphical_layout
|
||||||
}
|
} // namespace esphome
|
||||||
|
|
|
@ -32,5 +32,5 @@ protected:
|
||||||
Color background_color_{COLOR_OFF};
|
Color background_color_{COLOR_OFF};
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
} // namespace graphical_layout
|
||||||
}
|
} // namespace esphome
|
||||||
|
|
|
@ -46,5 +46,5 @@ void VerticalStack::render(display::Display *display, display::Rect bounds) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
} // namespace graphical_layout
|
||||||
}
|
} // namespace esphome
|
||||||
|
|
|
@ -3,7 +3,6 @@
|
||||||
#include "esphome/components/graphical_layout/graphical_layout.h"
|
#include "esphome/components/graphical_layout/graphical_layout.h"
|
||||||
#include "esphome/components/graphical_layout/container_layout_item.h"
|
#include "esphome/components/graphical_layout/container_layout_item.h"
|
||||||
|
|
||||||
|
|
||||||
namespace esphome {
|
namespace esphome {
|
||||||
namespace graphical_layout {
|
namespace graphical_layout {
|
||||||
|
|
||||||
|
@ -21,5 +20,5 @@ protected:
|
||||||
int item_padding_{0};
|
int item_padding_{0};
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
} // namespace graphical_layout
|
||||||
}
|
} // namespace esphome
|
||||||
|
|
Loading…
Reference in a new issue