hocclk: format code
use clang format file provided for optimal formatting
This commit is contained in:
1 parent
c6a8884c14
commit
88bfa9a4ec
118 files changed
+7111
-9615
No files matched your search
@@ -12,20 +12,24 @@
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include <tesla.hpp>
|
||||
|
||||
#include "../elements/base_frame.h"
|
||||
|
||||
|
||||
class TopAnchoredList : public tsl::elm::List {
|
||||
public:
|
||||
TopAnchoredList() { m_hasSetInitialFocusHack = true; }
|
||||
public:
|
||||
TopAnchoredList() {
|
||||
m_hasSetInitialFocusHack = true;
|
||||
}
|
||||
};
|
||||
class BoxClippedList : public tsl::elm::List {
|
||||
public:
|
||||
void draw(tsl::gfx::Renderer* renderer) override {
|
||||
public:
|
||||
void draw(tsl::gfx::Renderer *renderer) override {
|
||||
renderer->enableScissoring(0, HOC_BOX_BOTTOM, tsl::cfg::FramebufferWidth, tsl::cfg::FramebufferHeight - HOC_BOX_BOTTOM);
|
||||
tsl::elm::List::draw(renderer);
|
||||
renderer->disableScissoring();
|
||||
@@ -33,41 +37,37 @@ public:
|
||||
};
|
||||
|
||||
class CompactCategoryHeader : public tsl::elm::CategoryHeader {
|
||||
public:
|
||||
CompactCategoryHeader(const std::string& text) : tsl::elm::CategoryHeader(text) {}
|
||||
public:
|
||||
CompactCategoryHeader(const std::string &text) : tsl::elm::CategoryHeader(text) {
|
||||
}
|
||||
void layout(u16 parentX, u16 parentY, u16 parentWidth, u16 parentHeight) override {
|
||||
this->setBoundaries(this->getX(), this->getY(), this->getWidth(), 33);
|
||||
}
|
||||
};
|
||||
|
||||
class ImageElement : public tsl::elm::ListItem {
|
||||
private:
|
||||
const uint8_t* imgData;
|
||||
private:
|
||||
const uint8_t *imgData;
|
||||
uint32_t imgWidth, imgHeight;
|
||||
bool visible;
|
||||
|
||||
public:
|
||||
ImageElement(const uint8_t* data, uint32_t w, uint32_t h)
|
||||
: tsl::elm::ListItem(""), imgData(data), imgWidth(w), imgHeight(h), visible(true) {}
|
||||
|
||||
|
||||
public:
|
||||
ImageElement(const uint8_t *data, uint32_t w, uint32_t h) : tsl::elm::ListItem(""), imgData(data), imgWidth(w), imgHeight(h), visible(true) {
|
||||
}
|
||||
|
||||
void setVisible(bool v) {
|
||||
visible = v;
|
||||
}
|
||||
|
||||
|
||||
virtual void draw(tsl::gfx::Renderer *renderer) override {
|
||||
if (!visible) return;
|
||||
|
||||
if (!visible)
|
||||
return;
|
||||
|
||||
// Draw image centered horizontally
|
||||
u16 centerX = this->getX() + (this->getWidth() - imgWidth) / 2;
|
||||
renderer->drawBitmap(
|
||||
centerX,
|
||||
this->getY() + 10,
|
||||
imgWidth,
|
||||
imgHeight,
|
||||
imgData
|
||||
);
|
||||
renderer->drawBitmap(centerX, this->getY() + 10, imgWidth, imgHeight, imgData);
|
||||
}
|
||||
|
||||
|
||||
virtual void layout(u16 parentX, u16 parentY, u16 parentWidth, u16 parentHeight) override {
|
||||
if (!visible) {
|
||||
// Take up no space when hidden
|
||||
@@ -77,37 +77,38 @@ public:
|
||||
tsl::elm::ListItem::layout(parentX, parentY, parentWidth, parentHeight);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
virtual void drawHighlight(tsl::gfx::Renderer *renderer) override {
|
||||
// Do nothing - no highlight
|
||||
}
|
||||
|
||||
|
||||
virtual bool onClick(u64 keys) override {
|
||||
return false; // Non-clickable
|
||||
return false; // Non-clickable
|
||||
}
|
||||
|
||||
virtual Element* requestFocus(Element *oldFocus, tsl::FocusDirection direction) override {
|
||||
return nullptr; // Make it non-focusable
|
||||
|
||||
virtual Element *requestFocus(Element *oldFocus, tsl::FocusDirection direction) override {
|
||||
return nullptr; // Make it non-focusable
|
||||
}
|
||||
};
|
||||
|
||||
class HideableCategoryHeader : public tsl::elm::CategoryHeader {
|
||||
private:
|
||||
private:
|
||||
bool visible;
|
||||
|
||||
public:
|
||||
HideableCategoryHeader(const std::string& title)
|
||||
: tsl::elm::CategoryHeader(title), visible(true) {}
|
||||
|
||||
|
||||
public:
|
||||
HideableCategoryHeader(const std::string &title) : tsl::elm::CategoryHeader(title), visible(true) {
|
||||
}
|
||||
|
||||
void setVisible(bool v) {
|
||||
visible = v;
|
||||
}
|
||||
|
||||
|
||||
virtual void draw(tsl::gfx::Renderer *renderer) override {
|
||||
if (!visible) return;
|
||||
if (!visible)
|
||||
return;
|
||||
tsl::elm::CategoryHeader::draw(renderer);
|
||||
}
|
||||
|
||||
|
||||
virtual void layout(u16 parentX, u16 parentY, u16 parentWidth, u16 parentHeight) override {
|
||||
if (!visible) {
|
||||
this->setBoundaries(parentX, parentY, 0, 0);
|
||||
@@ -118,34 +119,34 @@ public:
|
||||
};
|
||||
|
||||
class FocusableDrawer : public tsl::elm::CustomDrawer {
|
||||
public:
|
||||
template<typename... Args>
|
||||
FocusableDrawer(Args&&... args) : tsl::elm::CustomDrawer(std::forward<Args>(args)...) {
|
||||
public:
|
||||
template <typename... Args> FocusableDrawer(Args &&...args) : tsl::elm::CustomDrawer(std::forward<Args>(args)...) {
|
||||
m_isItem = true;
|
||||
}
|
||||
Element* requestFocus(Element*, tsl::FocusDirection) override {
|
||||
Element *requestFocus(Element *, tsl::FocusDirection) override {
|
||||
return this;
|
||||
}
|
||||
void drawHighlight(tsl::gfx::Renderer*) override {}
|
||||
void drawHighlight(tsl::gfx::Renderer *) override {
|
||||
}
|
||||
};
|
||||
|
||||
class HideableCustomDrawer : public tsl::elm::Element {
|
||||
private:
|
||||
private:
|
||||
bool visible;
|
||||
u32 height;
|
||||
|
||||
public:
|
||||
HideableCustomDrawer(u32 h)
|
||||
: Element(), visible(true), height(h) {}
|
||||
|
||||
|
||||
public:
|
||||
HideableCustomDrawer(u32 h) : Element(), visible(true), height(h) {
|
||||
}
|
||||
|
||||
void setVisible(bool v) {
|
||||
visible = v;
|
||||
}
|
||||
|
||||
|
||||
virtual void draw(tsl::gfx::Renderer *renderer) override {
|
||||
// Empty drawer - just for spacing
|
||||
}
|
||||
|
||||
|
||||
virtual void layout(u16 parentX, u16 parentY, u16 parentWidth, u16 parentHeight) override {
|
||||
if (!visible) {
|
||||
this->setBoundaries(parentX, parentY, 0, 0);
|
||||
@@ -153,8 +154,8 @@ public:
|
||||
this->setBoundaries(parentX, parentY, parentWidth, height);
|
||||
}
|
||||
}
|
||||
|
||||
virtual Element* requestFocus(Element *oldFocus, tsl::FocusDirection direction) override {
|
||||
|
||||
virtual Element *requestFocus(Element *oldFocus, tsl::FocusDirection direction) override {
|
||||
return nullptr;
|
||||
}
|
||||
};
|
||||
Reference in new issue
Block a user