mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-03-18 21:30:38 +01:00
[themes] Color with pointers
This commit is contained in:
@@ -5,7 +5,14 @@ $(eval $(call rule_for, \
|
||||
THEME, \
|
||||
escher/palette.h, \
|
||||
$(addprefix themes/themes/local/, $(addsuffix .json, $(THEME_NAME))), \
|
||||
$$(PYTHON) themes/themes_manager.py $(THEME_REPO) $(THEME_NAME) $$@ $(BUILD_DIR)/, \
|
||||
$$(PYTHON) themes/themes_manager.py $(THEME_REPO) $(THEME_NAME) $$@ $(BUILD_DIR) --header, \
|
||||
global \
|
||||
))
|
||||
$(eval $(call rule_for, \
|
||||
THEME, \
|
||||
escher/palette_data.cpp, \
|
||||
$(addprefix themes/themes/local/, $(addsuffix .json, $(THEME_NAME))), \
|
||||
$$(PYTHON) themes/themes_manager.py $(THEME_REPO) $(THEME_NAME) $$@ $(BUILD_DIR) --cpp, \
|
||||
global \
|
||||
))
|
||||
else
|
||||
@@ -13,7 +20,14 @@ $(eval $(call rule_for, \
|
||||
THEME, \
|
||||
escher/palette.h, \
|
||||
themes/themes/git/.empty-folder, \
|
||||
$$(PYTHON) themes/themes_manager.py $(THEME_REPO) $(THEME_NAME) $$@ $(BUILD_DIR)/, \
|
||||
$$(PYTHON) themes/themes_manager.py $(THEME_REPO) $(THEME_NAME) $$@ $(BUILD_DIR) --header, \
|
||||
global \
|
||||
))
|
||||
$(eval $(call rule_for, \
|
||||
THEME, \
|
||||
escher/palette_data.cpp, \
|
||||
themes/themes/git/.empty-folder, \
|
||||
$$(PYTHON) themes/themes_manager.py $(THEME_REPO) $(THEME_NAME) $$@ $(BUILD_DIR) --cpp, \
|
||||
global \
|
||||
))
|
||||
endif
|
||||
@@ -113,6 +127,10 @@ escher_src += $(addprefix escher/src/,\
|
||||
window.cpp \
|
||||
)
|
||||
|
||||
escher_src += $(addprefix escher/,\
|
||||
palette_data.cpp\
|
||||
)
|
||||
|
||||
tests_src += $(addprefix escher/test/,\
|
||||
clipboard.cpp \
|
||||
layout_field.cpp\
|
||||
|
||||
@@ -17,7 +17,7 @@ public:
|
||||
|
||||
class AlternateEmptyViewDefaultDelegate : public AlternateEmptyViewDelegate {
|
||||
public:
|
||||
AlternateEmptyViewDefaultDelegate() : m_message(KDFont::SmallFont, (I18n::Message)0, 0.5f, 0.5f, Palette::PrimaryText, Palette::BackgroundApps) {}
|
||||
AlternateEmptyViewDefaultDelegate() : m_message(KDFont::SmallFont, (I18n::Message)0, 0.5f, 0.5f, *Palette::PrimaryText, *Palette::BackgroundApps) {}
|
||||
virtual I18n::Message emptyMessage() = 0;
|
||||
View * emptyView() override {
|
||||
m_message.setMessage(emptyMessage());
|
||||
|
||||
@@ -7,7 +7,7 @@ class BufferTextView : public TextView {
|
||||
public:
|
||||
static constexpr int k_maxNumberOfChar = 256;
|
||||
BufferTextView(const KDFont * font = KDFont::LargeFont, float horizontalAlignment = 0.5f, float verticalAlignment = 0.5f,
|
||||
KDColor textColor = Palette::PrimaryText, KDColor backgroundColor = Palette::ListCellBackground);
|
||||
KDColor textColor = *Palette::PrimaryText, KDColor backgroundColor = *Palette::ListCellBackground);
|
||||
void setText(const char * text) override;
|
||||
const char * text() const override;
|
||||
void appendText(const char * text);
|
||||
|
||||
@@ -10,11 +10,11 @@
|
||||
|
||||
class Button : public HighlightCell, public Responder {
|
||||
public:
|
||||
Button(Responder * parentResponder, I18n::Message textBody, Invocation invocation, const KDFont * font = KDFont::SmallFont, KDColor textColor = Palette::ButtonText);
|
||||
Button(Responder * parentResponder, I18n::Message textBody, Invocation invocation, const KDFont * font = KDFont::SmallFont, KDColor textColor = *Palette::ButtonText);
|
||||
void setMessage(I18n::Message message);
|
||||
bool handleEvent(Ion::Events::Event event) override;
|
||||
void setHighlighted(bool highlight) override;
|
||||
virtual KDColor highlightedBackgroundColor() const { return Palette::ButtonBackgroundSelected; }
|
||||
virtual KDColor highlightedBackgroundColor() const { return *Palette::ButtonBackgroundSelected; }
|
||||
Responder * responder() override {
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
class EditableTextCell : public HighlightCell, public Responder {
|
||||
public:
|
||||
EditableTextCell(Responder * parentResponder = nullptr, InputEventHandlerDelegate * inputEventHandlerDelegate = nullptr, TextFieldDelegate * delegate = nullptr, const KDFont * font = KDFont::LargeFont,
|
||||
float horizontalAlignment = 0.0f, float verticalAlignment = 0.5f, KDColor textColor = Palette::PrimaryText, KDColor = Palette::BackgroundHard, KDCoordinate topMargin = 0, KDCoordinate rightMargin = 0, KDCoordinate bottomMargin = 0, KDCoordinate leftMargin = 0);
|
||||
float horizontalAlignment = 0.0f, float verticalAlignment = 0.5f, KDColor textColor = *Palette::PrimaryText, KDColor = *Palette::BackgroundHard, KDCoordinate topMargin = 0, KDCoordinate rightMargin = 0, KDCoordinate bottomMargin = 0, KDCoordinate leftMargin = 0);
|
||||
TextField * textField();
|
||||
void setMargins(KDCoordinate topMargin = 0, KDCoordinate rightMargin = 0, KDCoordinate bottomMargin = 0, KDCoordinate leftMargin = 0);
|
||||
void setHighlighted(bool highlight) override;
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
class EvenOddExpressionCell : public EvenOddCell {
|
||||
public:
|
||||
EvenOddExpressionCell(float horizontalAlignment = 0.0f, float verticalAlignment = 0.5f,
|
||||
KDColor textColor = Palette::PrimaryText, KDColor backgroundColor = Palette::BackgroundHard);
|
||||
KDColor textColor = *Palette::PrimaryText, KDColor backgroundColor = *Palette::BackgroundHard);
|
||||
void setEven(bool even) override;
|
||||
void setHighlighted(bool highlight) override;
|
||||
void setLayout(Poincare::Layout layout);
|
||||
|
||||
@@ -11,7 +11,7 @@ public:
|
||||
EvenOddMessageTextCell(const KDFont * font = KDFont::LargeFont);
|
||||
void setEven(bool even) override;
|
||||
void setHighlighted(bool highlight) override;
|
||||
void setMessage(I18n::Message textContent, KDColor textColor = Palette::PrimaryText);
|
||||
void setMessage(I18n::Message textContent, KDColor textColor = *Palette::PrimaryText);
|
||||
void setAlignment(float horizontalAlignment, float verticalAlignment);
|
||||
void setMessageFont(const KDFont * font) { m_messageTextView.setFont(font); }
|
||||
protected:
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
class ExpressionView : public View {
|
||||
public:
|
||||
ExpressionView(float horizontalAlignment = 0.0f, float verticalAlignment = 0.5f,
|
||||
KDColor textColor = Palette::PrimaryText, KDColor backgroundColor = Palette::ListCellBackground, Poincare::Layout * selectionStart = nullptr, Poincare::Layout * selectionEnd = nullptr);
|
||||
KDColor textColor = *Palette::PrimaryText, KDColor backgroundColor = *Palette::ListCellBackground, Poincare::Layout * selectionStart = nullptr, Poincare::Layout * selectionEnd = nullptr);
|
||||
Poincare::Layout layout() const { return m_layout; }
|
||||
bool setLayout(Poincare::Layout layout);
|
||||
void drawRect(KDContext * ctx, KDRect rect) const override;
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
class MessageTableCellWithBuffer : public MessageTableCell {
|
||||
public:
|
||||
MessageTableCellWithBuffer(I18n::Message message = (I18n::Message)0, const KDFont * font = KDFont::SmallFont, const KDFont * accessoryFont = KDFont::LargeFont, KDColor accessoryTextColor = Palette::PrimaryText);
|
||||
MessageTableCellWithBuffer(I18n::Message message = (I18n::Message)0, const KDFont * font = KDFont::SmallFont, const KDFont * accessoryFont = KDFont::LargeFont, KDColor accessoryTextColor = *Palette::PrimaryText);
|
||||
View * accessoryView() const override;
|
||||
void setHighlighted(bool highlight) override;
|
||||
void setAccessoryText(const char * textBody);
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
class MessageTextView : public TextView {
|
||||
public:
|
||||
MessageTextView(const KDFont * font = KDFont::LargeFont, I18n::Message message = (I18n::Message)0, float horizontalAlignment = 0.0f, float verticalAlignment = 0.0f,
|
||||
KDColor textColor = Palette::PrimaryText, KDColor backgroundColor = Palette::ListCellBackground);
|
||||
KDColor textColor = *Palette::PrimaryText, KDColor backgroundColor = *Palette::ListCellBackground);
|
||||
void setText(const char * text) override;
|
||||
void setMessage(I18n::Message message);
|
||||
const char * text() const override;
|
||||
|
||||
@@ -21,7 +21,7 @@ protected:
|
||||
void drawRect(KDContext * ctx, KDRect rect) const override;
|
||||
private:
|
||||
constexpr static int k_expressionViewRowIndex = 2;
|
||||
constexpr static KDColor k_backgroundColor = Palette::WallScreen;
|
||||
static KDColor const * k_backgroundColor;
|
||||
int numberOfSubviews() const override;
|
||||
View * subviewAtIndex(int index) override;
|
||||
void layoutSubviews(bool force = false) override;
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
class PointerTextView : public TextView {
|
||||
public:
|
||||
PointerTextView(const KDFont * font = KDFont::LargeFont, const char * text = nullptr, float horizontalAlignment = 0.0f, float verticalAlignment = 0.0f,
|
||||
KDColor textColor = Palette::PrimaryText, KDColor backgroundColor = Palette::BackgroundHard);
|
||||
KDColor textColor = *Palette::PrimaryText, KDColor backgroundColor = *Palette::BackgroundHard);
|
||||
const char * text() const override { return m_text; }
|
||||
void setText(const char * text) override;
|
||||
private:
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
class HighContrastButton : public Button {
|
||||
public:
|
||||
using Button::Button;
|
||||
KDColor highlightedBackgroundColor() const override { return Palette::ButtonBackgroundSelectedHighContrast; }
|
||||
KDColor highlightedBackgroundColor() const override { return *Palette::ButtonBackgroundSelectedHighContrast; }
|
||||
};
|
||||
|
||||
class PopUpController : public ViewController {
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
class ScrollableExpressionView : public ScrollableView, public ScrollViewDataSource {
|
||||
public:
|
||||
ScrollableExpressionView(Responder * parentResponder, KDCoordinate leftRightMargin, KDCoordinate topBottomMargin, float horizontalAlignment = 0.0f, float verticalAlignment = 0.5f, KDColor textColor = Palette::PrimaryText, KDColor backgroundColor = Palette::BackgroundApps);
|
||||
ScrollableExpressionView(Responder * parentResponder, KDCoordinate leftRightMargin, KDCoordinate topBottomMargin, float horizontalAlignment = 0.0f, float verticalAlignment = 0.5f, KDColor textColor = *Palette::PrimaryText, KDColor backgroundColor = *Palette::BackgroundApps);
|
||||
Poincare::Layout layout() const;
|
||||
void setLayout(Poincare::Layout layout);
|
||||
void setBackgroundColor(KDColor backgroundColor) override;
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
class SolidTextArea : public TextArea {
|
||||
public:
|
||||
SolidTextArea(Responder * parentResponder, const KDFont * font = KDFont::LargeFont,
|
||||
KDColor textColor = Palette::PrimaryText, KDColor backgroundColor = Palette::BackgroundHard) :
|
||||
KDColor textColor = *Palette::PrimaryText, KDColor backgroundColor = *Palette::BackgroundHard) :
|
||||
TextArea(parentResponder, &m_contentView, font),
|
||||
m_contentView(font, textColor, backgroundColor) {}
|
||||
protected:
|
||||
|
||||
@@ -10,10 +10,10 @@ constexpr uint8_t kMaxNumberOfStacks = 4;
|
||||
class StackViewController : public ViewController {
|
||||
public:
|
||||
StackViewController(Responder * parentResponder, ViewController * rootViewController,
|
||||
KDColor textColor = Palette::SubMenuText, KDColor backgroundColor = Palette::SubMenuBackground, KDColor separatorColor = Palette::SubMenuBorder);
|
||||
KDColor textColor = *Palette::SubMenuText, KDColor backgroundColor = *Palette::SubMenuBackground, KDColor separatorColor = *Palette::SubMenuBorder);
|
||||
|
||||
/* Push creates a new StackView and adds it */
|
||||
void push(ViewController * vc, KDColor textColor = Palette::SubMenuText, KDColor backgroundColor = Palette::SubMenuBackground, KDColor separatorColor = Palette::SubMenuBorder);
|
||||
void push(ViewController * vc, KDColor textColor = *Palette::SubMenuText, KDColor backgroundColor = *Palette::SubMenuBackground, KDColor separatorColor = *Palette::SubMenuBorder);
|
||||
void pop();
|
||||
|
||||
int depth() const { return m_numberOfChildren; }
|
||||
@@ -28,7 +28,7 @@ public:
|
||||
private:
|
||||
class Frame {
|
||||
public:
|
||||
Frame(ViewController * viewController = nullptr, KDColor textColor = Palette::SubMenuText, KDColor backgroundColor = Palette::SubMenuBackground, KDColor separatorColor = Palette::SubMenuBorder) :
|
||||
Frame(ViewController * viewController = nullptr, KDColor textColor = *Palette::SubMenuText, KDColor backgroundColor = *Palette::SubMenuBackground, KDColor separatorColor = *Palette::SubMenuBorder) :
|
||||
m_viewController(viewController),
|
||||
m_textColor(textColor),
|
||||
m_backgroundColor(backgroundColor),
|
||||
|
||||
@@ -21,7 +21,7 @@ public:
|
||||
TextField(Responder * parentResponder, char * textBuffer, size_t textBufferSize, size_t draftTextBufferSize,
|
||||
InputEventHandlerDelegate * inputEventHandlerDelegate, TextFieldDelegate * delegate = nullptr,
|
||||
const KDFont * font = KDFont::LargeFont, float horizontalAlignment = 0.0f, float verticalAlignment = 0.5f,
|
||||
KDColor textColor = Palette::PrimaryText, KDColor backgroundColor = Palette::BackgroundHard);
|
||||
KDColor textColor = *Palette::PrimaryText, KDColor backgroundColor = *Palette::BackgroundHard);
|
||||
void setBackgroundColor(KDColor backgroundColor) override;
|
||||
void setTextColor(KDColor textColor);
|
||||
void setDelegates(InputEventHandlerDelegate * inputEventHandlerDelegate, TextFieldDelegate * delegate) { m_inputEventHandlerDelegate = inputEventHandlerDelegate; m_delegate = delegate; }
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
|
||||
class TextView : public View {
|
||||
public:
|
||||
TextView(const KDFont * font = KDFont::LargeFont, float horizontalAlignment = 0.0f, float verticalAlignment = 0.0f, KDColor textColor = Palette::PrimaryText, KDColor backgroundColor = Palette::BackgroundHard) :
|
||||
TextView(const KDFont * font = KDFont::LargeFont, float horizontalAlignment = 0.0f, float verticalAlignment = 0.0f, KDColor textColor = *Palette::PrimaryText, KDColor backgroundColor = *Palette::BackgroundHard) :
|
||||
View(),
|
||||
m_font(font),
|
||||
m_horizontalAlignment(horizontalAlignment),
|
||||
|
||||
@@ -22,7 +22,7 @@ struct OBMHeader
|
||||
BackgroundView::BackgroundView():
|
||||
m_data(nullptr),
|
||||
m_isDataValid(false),
|
||||
m_defaultColor(Palette::BackgroundHard)
|
||||
m_defaultColor(*Palette::BackgroundHard)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
Button::Button(Responder * parentResponder, I18n::Message textBody, Invocation invocation, const KDFont * font, KDColor textColor) :
|
||||
HighlightCell(),
|
||||
Responder(parentResponder),
|
||||
m_messageTextView(font, textBody, 0.5f, 0.5f, textColor, Palette::ButtonBackground),
|
||||
m_messageTextView(font, textBody, 0.5f, 0.5f, textColor, *Palette::ButtonBackground),
|
||||
m_invocation(invocation),
|
||||
m_font(font)
|
||||
{
|
||||
@@ -38,7 +38,7 @@ bool Button::handleEvent(Ion::Events::Event event) {
|
||||
|
||||
void Button::setHighlighted(bool highlight) {
|
||||
HighlightCell::setHighlighted(highlight);
|
||||
KDColor backgroundColor = highlight? highlightedBackgroundColor() : Palette::ButtonBackground;
|
||||
KDColor backgroundColor = highlight? highlightedBackgroundColor() : *Palette::ButtonBackground;
|
||||
m_messageTextView.setBackgroundColor(backgroundColor);
|
||||
markRectAsDirty(bounds());
|
||||
}
|
||||
|
||||
@@ -96,28 +96,28 @@ void ButtonRowController::ContentView::layoutSubviews(bool force) {
|
||||
void ButtonRowController::ContentView::drawRect(KDContext * ctx, KDRect rect) const {
|
||||
if (numberOfButtons() == 0) {
|
||||
if (m_position == Position::Top) {
|
||||
ctx->fillRect(KDRect(0, 0, bounds().width(), 1), Palette::ButtonBorderOut);
|
||||
ctx->fillRect(KDRect(0, 0, bounds().width(), 1), *Palette::ButtonBorderOut);
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (m_style == Style::PlainWhite) {
|
||||
if (m_position == Position::Top) {
|
||||
ctx->fillRect(KDRect(0, 0, bounds().width(), k_plainStyleHeight), Palette::SubTabBackground);
|
||||
ctx->fillRect(KDRect(0, k_plainStyleHeight, bounds().width(), 1), Palette::ButtonBorderOut);
|
||||
ctx->fillRect(KDRect(0, 0, bounds().width(), k_plainStyleHeight), *Palette::SubTabBackground);
|
||||
ctx->fillRect(KDRect(0, k_plainStyleHeight, bounds().width(), 1), *Palette::ButtonBorderOut);
|
||||
} else {
|
||||
ctx->fillRect(KDRect(0, bounds().height() - k_plainStyleHeight, bounds().width(), k_plainStyleHeight), Palette::SubTabBackground);
|
||||
ctx->fillRect(KDRect(0, bounds().height() - k_plainStyleHeight-1, bounds().width(), 1), Palette::ButtonBorderOut);
|
||||
ctx->fillRect(KDRect(0, bounds().height() - k_plainStyleHeight, bounds().width(), k_plainStyleHeight), *Palette::SubTabBackground);
|
||||
ctx->fillRect(KDRect(0, bounds().height() - k_plainStyleHeight-1, bounds().width(), 1), *Palette::ButtonBorderOut);
|
||||
}
|
||||
return;
|
||||
}
|
||||
int buttonHeight = m_size == Size::Small ? k_embossedStyleHeightSmall : k_embossedStyleHeightLarge;
|
||||
int buttonMargin = m_size == Size::Small ? k_embossedStyleHeightMarginSmall : k_embossedStyleHeightMarginLarge;
|
||||
if (m_position == Position::Top) {
|
||||
ctx->fillRect(KDRect(0, 0, bounds().width(), buttonHeight), Palette::ButtonBorderOut);
|
||||
ctx->fillRect(KDRect(0, buttonHeight, bounds().width(), 1), Palette::ButtonRowBorder);
|
||||
ctx->fillRect(KDRect(0, 0, bounds().width(), buttonHeight), *Palette::ButtonBorderOut);
|
||||
ctx->fillRect(KDRect(0, buttonHeight, bounds().width(), 1), *Palette::ButtonRowBorder);
|
||||
} else {
|
||||
ctx->fillRect(KDRect(0, bounds().height() - buttonHeight, bounds().width(), buttonHeight), Palette::ButtonBorderOut);
|
||||
ctx->fillRect(KDRect(0, bounds().height() - buttonHeight-1, bounds().width(), 1), Palette::ButtonRowBorder);
|
||||
ctx->fillRect(KDRect(0, bounds().height() - buttonHeight, bounds().width(), buttonHeight), *Palette::ButtonBorderOut);
|
||||
ctx->fillRect(KDRect(0, bounds().height() - buttonHeight-1, bounds().width(), 1), *Palette::ButtonRowBorder);
|
||||
}
|
||||
KDCoordinate y0 = m_position == Position::Top ? buttonMargin-1 : bounds().height()-buttonHeight+buttonMargin-1;
|
||||
KDCoordinate y1 = m_position == Position::Top ? buttonHeight-buttonMargin-2 : bounds().height()-buttonMargin;
|
||||
@@ -132,12 +132,12 @@ void ButtonRowController::ContentView::drawRect(KDContext * ctx, KDRect rect) co
|
||||
for (int i = 0; i < numberOfButtons(); i++) {
|
||||
Button * button = buttonAtIndex(i);
|
||||
KDCoordinate buttonWidth = button->minimalSizeForOptimalDisplay().width();
|
||||
ctx->fillRect(KDRect(currentXOrigin, y0, 1, y1-y0+1), Palette::ButtonRowBorder);
|
||||
ctx->fillRect(KDRect(currentXOrigin-1, y0, 1, y1-y0+2), Palette::SecondaryText);
|
||||
ctx->fillRect(KDRect(currentXOrigin, y0, buttonWidth+2, 1), Palette::ButtonRowBorder);
|
||||
ctx->fillRect(KDRect(currentXOrigin, y1, buttonWidth+2, 1), Palette::ButtonRowBorder);
|
||||
ctx->fillRect(KDRect(currentXOrigin, y1+1, buttonWidth+2, 1), Palette::SecondaryText);
|
||||
ctx->fillRect(KDRect(currentXOrigin+1+buttonWidth, y0, 1, y1-y0+1), Palette::ButtonRowBorder);
|
||||
ctx->fillRect(KDRect(currentXOrigin, y0, 1, y1-y0+1), *Palette::ButtonRowBorder);
|
||||
ctx->fillRect(KDRect(currentXOrigin-1, y0, 1, y1-y0+2), *Palette::SecondaryText);
|
||||
ctx->fillRect(KDRect(currentXOrigin, y0, buttonWidth+2, 1), *Palette::ButtonRowBorder);
|
||||
ctx->fillRect(KDRect(currentXOrigin, y1, buttonWidth+2, 1), *Palette::ButtonRowBorder);
|
||||
ctx->fillRect(KDRect(currentXOrigin, y1+1, buttonWidth+2, 1), *Palette::SecondaryText);
|
||||
ctx->fillRect(KDRect(currentXOrigin+1+buttonWidth, y0, 1, y1-y0+1), *Palette::ButtonRowBorder);
|
||||
currentXOrigin += buttonWidth + widthMargin;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ void ButtonState::layoutSubviews(bool force) {
|
||||
}
|
||||
|
||||
void ButtonState::drawRect(KDContext * ctx, KDRect rect) const {
|
||||
KDColor backColor = isHighlighted() ? highlightedBackgroundColor() : Palette::ButtonBackground;
|
||||
KDColor backColor = isHighlighted() ? highlightedBackgroundColor() : *Palette::ButtonBackground;
|
||||
ctx->fillRect(bounds(), backColor);
|
||||
}
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ void ChevronView::drawRect(KDContext * ctx, KDRect rect) const {
|
||||
KDCoordinate chevronHalfHeight = k_chevronHeight/2;
|
||||
KDRect frame(width - k_chevronWidth, heightCenter -chevronHalfHeight, k_chevronWidth, k_chevronHeight);
|
||||
KDColor workingBuffer[ChevronView::k_chevronWidth*ChevronView::k_chevronHeight];
|
||||
ctx->blendRectWithMask(frame, Palette::Control, (const uint8_t *)chevronMask, workingBuffer);
|
||||
ctx->blendRectWithMask(frame, *Palette::Control, (const uint8_t *)chevronMask, workingBuffer);
|
||||
}
|
||||
|
||||
KDSize ChevronView::minimalSizeForOptimalDisplay() const {
|
||||
|
||||
@@ -30,7 +30,7 @@ TextField * EditableTextCell::textField() {
|
||||
|
||||
void EditableTextCell::setHighlighted(bool highlight) {
|
||||
HighlightCell::setHighlighted(highlight);
|
||||
KDColor backgroundColor = highlight? Palette::ListCellBackgroundSelected : Palette::ListCellBackground;
|
||||
KDColor backgroundColor = highlight? *Palette::ListCellBackgroundSelected : *Palette::ListCellBackground;
|
||||
m_textField.setBackgroundColor(backgroundColor);
|
||||
}
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ void EllipsisView::drawRect(KDContext * ctx, KDRect rect) const {
|
||||
KDCoordinate ellipsisHalfHeight = k_ellipsisHeight/2;
|
||||
KDRect frame(widthCenter - ellipsisHalfWidth, heightCenter - ellipsisHalfHeight, k_ellipsisWidth, k_ellipsisHeight);
|
||||
KDColor ellipsisWorkingBuffer[EllipsisView::k_ellipsisWidth*EllipsisView::k_ellipsisHeight];
|
||||
ctx->blendRectWithMask(frame, Palette::PrimaryText, (const uint8_t *)ellipsisMask, ellipsisWorkingBuffer);
|
||||
ctx->blendRectWithMask(frame, *Palette::PrimaryText, (const uint8_t *)ellipsisMask, ellipsisWorkingBuffer);
|
||||
}
|
||||
|
||||
KDSize EllipsisView::minimalSizeForOptimalDisplay() const {
|
||||
|
||||
@@ -16,8 +16,8 @@ void EvenOddCell::setEven(bool even) {
|
||||
|
||||
KDColor EvenOddCell::backgroundColor() const {
|
||||
// Select the background color according to the even line and the cursor selection
|
||||
KDColor background = m_even ? Palette::BackgroundHard : Palette::BackgroundApps ;
|
||||
background = isHighlighted() ? Palette::ListCellBackgroundSelected : background;
|
||||
KDColor background = m_even ? *Palette::BackgroundHard : *Palette::BackgroundApps ;
|
||||
background = isHighlighted() ? *Palette::ListCellBackgroundSelected : background;
|
||||
return background;
|
||||
}
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
EvenOddEditableTextCell::EvenOddEditableTextCell(Responder * parentResponder, InputEventHandlerDelegate * inputEventHandlerDelegate, TextFieldDelegate * delegate, const KDFont * font, float horizontalAlignment, float verticalAlignment, KDCoordinate topMargin, KDCoordinate rightMargin, KDCoordinate bottomMargin, KDCoordinate leftMargin) :
|
||||
EvenOddCell(),
|
||||
Responder(parentResponder),
|
||||
m_editableCell(this, inputEventHandlerDelegate, delegate, font, horizontalAlignment, verticalAlignment, Palette::PrimaryText, Palette::BackgroundHard, topMargin, rightMargin, bottomMargin, leftMargin)
|
||||
m_editableCell(this, inputEventHandlerDelegate, delegate, font, horizontalAlignment, verticalAlignment, *Palette::PrimaryText, *Palette::BackgroundHard, topMargin, rightMargin, bottomMargin, leftMargin)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -10,15 +10,15 @@ ExpressionField::ExpressionField(Responder * parentResponder, InputEventHandlerD
|
||||
Responder(parentResponder),
|
||||
View(),
|
||||
m_inputViewMemoizedHeight(0),
|
||||
m_textField(parentResponder, nullptr, k_textFieldBufferSize, k_textFieldBufferSize, inputEventHandlerDelegate, textFieldDelegate, KDFont::LargeFont, 0.0f, 0.5f, Palette::PrimaryText, Palette::ExpressionInputBackground),
|
||||
m_textField(parentResponder, nullptr, k_textFieldBufferSize, k_textFieldBufferSize, inputEventHandlerDelegate, textFieldDelegate, KDFont::LargeFont, 0.0f, 0.5f, *Palette::PrimaryText, *Palette::ExpressionInputBackground),
|
||||
m_layoutField(parentResponder, inputEventHandlerDelegate, layoutFieldDelegate)
|
||||
{
|
||||
// Initialize text field
|
||||
m_textField.setMargins(0, k_horizontalMargin, 0, k_horizontalMargin);
|
||||
m_textField.setBackgroundColor(Palette::ExpressionInputBackground);
|
||||
m_textField.setBackgroundColor(*Palette::ExpressionInputBackground);
|
||||
// Initialize layout field
|
||||
m_layoutField.setMargins(k_verticalMargin, k_horizontalMargin, k_verticalMargin, k_horizontalMargin);
|
||||
m_layoutField.setBackgroundColor(Palette::ExpressionInputBackground);
|
||||
m_layoutField.setBackgroundColor(*Palette::ExpressionInputBackground);
|
||||
}
|
||||
|
||||
void ExpressionField::setEditing(bool isEditing, bool reinitDraftBuffer) {
|
||||
@@ -77,7 +77,7 @@ void ExpressionField::layoutSubviews(bool force) {
|
||||
|
||||
void ExpressionField::drawRect(KDContext * ctx, KDRect rect) const {
|
||||
// Draw the separator
|
||||
ctx->fillRect(KDRect(0, 0, bounds().width(), k_separatorThickness), Palette::ExpressionInputBorder);
|
||||
ctx->fillRect(KDRect(0, 0, bounds().width(), k_separatorThickness), *Palette::ExpressionInputBorder);
|
||||
}
|
||||
|
||||
bool ExpressionField::handleEvent(Ion::Events::Event event) {
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
ExpressionTableCell::ExpressionTableCell(Responder * parentResponder, Layout layout) :
|
||||
Responder(parentResponder),
|
||||
TableCell(layout),
|
||||
m_labelExpressionView(this, k_horizontalMargin, 0, 0.0f, 0.5f, Palette::PrimaryText, Palette::ListCellBackground)
|
||||
m_labelExpressionView(this, k_horizontalMargin, 0, 0.0f, 0.5f, *Palette::PrimaryText, *Palette::ListCellBackground)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@ View * ExpressionTableCell::labelView() const {
|
||||
|
||||
void ExpressionTableCell::setHighlighted(bool highlight) {
|
||||
TableCell::setHighlighted(highlight);
|
||||
KDColor backgroundColor = highlight? Palette::ListCellBackgroundSelected : Palette::ListCellBackground;
|
||||
KDColor backgroundColor = highlight? *Palette::ListCellBackgroundSelected : *Palette::ListCellBackground;
|
||||
m_labelExpressionView.setBackgroundColor(backgroundColor);
|
||||
}
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
ExpressionTableCellWithExpression::ExpressionTableCellWithExpression(Responder * parentResponder) :
|
||||
ExpressionTableCell(parentResponder, Layout::HorizontalLeftOverlap),
|
||||
m_accessoryExpressionView(this, k_horizontalMargin, 0, 1.0f, 0.5f, Palette::SecondaryText, Palette::ListCellBackground)
|
||||
m_accessoryExpressionView(this, k_horizontalMargin, 0, 1.0f, 0.5f, *Palette::SecondaryText, *Palette::ListCellBackground)
|
||||
{}
|
||||
|
||||
View * ExpressionTableCellWithExpression::accessoryView() const {
|
||||
@@ -14,7 +14,7 @@ View * ExpressionTableCellWithExpression::accessoryView() const {
|
||||
|
||||
void ExpressionTableCellWithExpression::setHighlighted(bool highlight) {
|
||||
ExpressionTableCell::setHighlighted(highlight);
|
||||
KDColor backgroundColor = highlight? Palette::ListCellBackgroundSelected : Palette::ListCellBackground;
|
||||
KDColor backgroundColor = highlight? *Palette::ListCellBackgroundSelected : *Palette::ListCellBackground;
|
||||
m_accessoryExpressionView.setBackgroundColor(backgroundColor);
|
||||
}
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
ExpressionTableCellWithPointer::ExpressionTableCellWithPointer(Responder * parentResponder, I18n::Message accessoryMessage, Layout layout) :
|
||||
ExpressionTableCell(parentResponder, layout),
|
||||
m_accessoryView(KDFont::SmallFont, accessoryMessage, 0.0f, 0.5f, Palette::SecondaryText, Palette::ListCellBackground)
|
||||
m_accessoryView(KDFont::SmallFont, accessoryMessage, 0.0f, 0.5f, *Palette::SecondaryText, *Palette::ListCellBackground)
|
||||
{
|
||||
if (layout != Layout::Vertical) {
|
||||
m_accessoryView.setAlignment(1.0f, 0.5f);
|
||||
@@ -17,7 +17,7 @@ View * ExpressionTableCellWithPointer::accessoryView() const {
|
||||
|
||||
void ExpressionTableCellWithPointer::setHighlighted(bool highlight) {
|
||||
ExpressionTableCell::setHighlighted(highlight);
|
||||
KDColor backgroundColor = highlight? Palette::ListCellBackgroundSelected : Palette::ListCellBackground;
|
||||
KDColor backgroundColor = highlight? *Palette::ListCellBackgroundSelected : *Palette::ListCellBackground;
|
||||
m_accessoryView.setBackgroundColor(backgroundColor);
|
||||
}
|
||||
|
||||
|
||||
@@ -72,6 +72,6 @@ KDPoint ExpressionView::absoluteDrawingOrigin() const {
|
||||
void ExpressionView::drawRect(KDContext * ctx, KDRect rect) const {
|
||||
ctx->fillRect(rect, m_backgroundColor);
|
||||
if (!m_layout.isUninitialized()) {
|
||||
m_layout.draw(ctx, drawingOrigin(), m_textColor, m_backgroundColor, m_selectionStart, m_selectionEnd, Palette::Select);
|
||||
m_layout.draw(ctx, drawingOrigin(), m_textColor, m_backgroundColor, m_selectionStart, m_selectionEnd, *Palette::Select);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@ const uint8_t gaugeIndicatorMask[GaugeView::k_indicatorDiameter][GaugeView::k_in
|
||||
|
||||
GaugeView::GaugeView() :
|
||||
m_level(1),
|
||||
m_backgroundColor(Palette::ListCellBackground)
|
||||
m_backgroundColor(*Palette::ListCellBackground)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -47,10 +47,10 @@ void GaugeView::drawRect(KDContext * ctx, KDRect rect) const {
|
||||
KDCoordinate height = bounds().height();
|
||||
KDColor gaugeIndicatorWorkingBuffer[GaugeView::k_indicatorDiameter*GaugeView::k_indicatorDiameter];
|
||||
|
||||
ctx->fillRect(KDRect(k_indicatorDiameter/2, (height-k_thickness)/2, width*m_level, k_thickness), Palette::ControlEnabled);
|
||||
ctx->fillRect(KDRect(k_indicatorDiameter/2+width*m_level, (height-k_thickness)/2, width*(1.0f-m_level), k_thickness), Palette::ControlDisabled);
|
||||
ctx->fillRect(KDRect(k_indicatorDiameter/2, (height-k_thickness)/2, width*m_level, k_thickness), *Palette::ControlEnabled);
|
||||
ctx->fillRect(KDRect(k_indicatorDiameter/2+width*m_level, (height-k_thickness)/2, width*(1.0f-m_level), k_thickness), *Palette::ControlDisabled);
|
||||
KDRect frame(width*m_level, (height-k_indicatorDiameter)/2, k_indicatorDiameter, k_indicatorDiameter);
|
||||
ctx->blendRectWithMask(frame, Palette::Control, (const uint8_t *)gaugeIndicatorMask, gaugeIndicatorWorkingBuffer);
|
||||
ctx->blendRectWithMask(frame, *Palette::Control, (const uint8_t *)gaugeIndicatorMask, gaugeIndicatorWorkingBuffer);
|
||||
}
|
||||
|
||||
KDSize GaugeView::minimalSizeForOptimalDisplay() const {
|
||||
|
||||
@@ -83,7 +83,7 @@ void KeyView::drawRect(KDContext * ctx, KDRect rect) const {
|
||||
KDCoordinate height = bounds().height();
|
||||
KDRect frame((width - k_keySize)/2, (height - k_keySize)/2, k_keySize, k_keySize);
|
||||
KDColor keyWorkingBuffer[KeyView::k_keySize*KeyView::k_keySize];
|
||||
ctx->blendRectWithMask(frame, Palette::PrimaryText, mask(), keyWorkingBuffer);
|
||||
ctx->blendRectWithMask(frame, *Palette::PrimaryText, mask(), keyWorkingBuffer);
|
||||
}
|
||||
|
||||
KDSize KeyView::minimalSizeForOptimalDisplay() const {
|
||||
|
||||
@@ -13,7 +13,7 @@ using namespace Poincare;
|
||||
LayoutField::ContentView::ContentView() :
|
||||
m_cursor(),
|
||||
m_insertionCursor(),
|
||||
m_expressionView(0.0f, 0.5f, Palette::PrimaryText, Palette::BackgroundHard, &m_selectionStart, &m_selectionEnd),
|
||||
m_expressionView(0.0f, 0.5f, *Palette::PrimaryText, *Palette::BackgroundHard, &m_selectionStart, &m_selectionEnd),
|
||||
m_cursorView(),
|
||||
m_selectionStart(),
|
||||
m_selectionEnd(),
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
MessageTableCell::MessageTableCell(I18n::Message label, const KDFont * font, Layout layout) :
|
||||
TableCell(layout),
|
||||
m_messageTextView(font, label, 0, 0.5, Palette::PrimaryText, Palette::ListCellBackground),
|
||||
m_messageTextView(font, label, 0, 0.5, *Palette::PrimaryText, *Palette::ListCellBackground),
|
||||
m_backgroundColor(KDColorWhite)
|
||||
{
|
||||
}
|
||||
@@ -15,7 +15,7 @@ View * MessageTableCell::labelView() const {
|
||||
|
||||
void MessageTableCell::setHighlighted(bool highlight) {
|
||||
HighlightCell::setHighlighted(highlight);
|
||||
KDColor backgroundColor = highlight? Palette::ListCellBackgroundSelected : Palette::ListCellBackground;
|
||||
KDColor backgroundColor = highlight? *Palette::ListCellBackgroundSelected : *Palette::ListCellBackground;
|
||||
m_messageTextView.setBackgroundColor(backgroundColor);
|
||||
}
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ View * MessageTableCellWithBuffer::accessoryView() const {
|
||||
|
||||
void MessageTableCellWithBuffer::setHighlighted(bool highlight) {
|
||||
MessageTableCell::setHighlighted(highlight);
|
||||
KDColor backgroundColor = isHighlighted()? Palette::ListCellBackgroundSelected : Palette::ListCellBackground;
|
||||
KDColor backgroundColor = isHighlighted()? *Palette::ListCellBackgroundSelected : *Palette::ListCellBackground;
|
||||
m_accessoryView.setBackgroundColor(backgroundColor);
|
||||
}
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
MessageTableCellWithChevronAndBuffer::MessageTableCellWithChevronAndBuffer(const KDFont * labelFont, const KDFont * subAccessoryFont) :
|
||||
MessageTableCellWithChevron((I18n::Message)0, labelFont),
|
||||
m_subAccessoryView(subAccessoryFont, 1.0f, 0.5f, Palette::SecondaryText)
|
||||
m_subAccessoryView(subAccessoryFont, 1.0f, 0.5f, *Palette::SecondaryText)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@ View * MessageTableCellWithChevronAndBuffer::subAccessoryView() const {
|
||||
|
||||
void MessageTableCellWithChevronAndBuffer::setHighlighted(bool highlight) {
|
||||
MessageTableCellWithChevron::setHighlighted(highlight);
|
||||
KDColor backgroundColor = isHighlighted()? Palette::ListCellBackgroundSelected : Palette::ListCellBackground;
|
||||
KDColor backgroundColor = isHighlighted()? *Palette::ListCellBackgroundSelected : *Palette::ListCellBackground;
|
||||
m_subAccessoryView.setBackgroundColor(backgroundColor);
|
||||
}
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
MessageTableCellWithChevronAndExpression::MessageTableCellWithChevronAndExpression(I18n::Message message, const KDFont * font) :
|
||||
MessageTableCellWithChevron(message, font),
|
||||
m_subtitleView(1.0f, 0.5f, Palette::SecondaryText)
|
||||
m_subtitleView(1.0f, 0.5f, *Palette::SecondaryText)
|
||||
{
|
||||
m_subtitleView.setHorizontalMargin(Metric::ExpressionViewHorizontalMargin);
|
||||
}
|
||||
@@ -15,7 +15,7 @@ View * MessageTableCellWithChevronAndExpression::subAccessoryView() const {
|
||||
|
||||
void MessageTableCellWithChevronAndExpression::setHighlighted(bool highlight) {
|
||||
MessageTableCellWithChevron::setHighlighted(highlight);
|
||||
KDColor backgroundColor = isHighlighted()? Palette::ListCellBackgroundSelected : Palette::ListCellBackground;
|
||||
KDColor backgroundColor = isHighlighted()? *Palette::ListCellBackgroundSelected : *Palette::ListCellBackground;
|
||||
m_subtitleView.setBackgroundColor(backgroundColor);
|
||||
}
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
MessageTableCellWithChevronAndMessage::MessageTableCellWithChevronAndMessage(const KDFont * labelFont, const KDFont * contentFont) :
|
||||
MessageTableCellWithChevron((I18n::Message)0, labelFont),
|
||||
m_subtitleView(contentFont, (I18n::Message)0, 1.0f, 0.5f, Palette::SecondaryText)
|
||||
m_subtitleView(contentFont, (I18n::Message)0, 1.0f, 0.5f, *Palette::SecondaryText)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@ View * MessageTableCellWithChevronAndMessage::subAccessoryView() const {
|
||||
|
||||
void MessageTableCellWithChevronAndMessage::setHighlighted(bool highlight) {
|
||||
MessageTableCellWithChevron::setHighlighted(highlight);
|
||||
KDColor backgroundColor = isHighlighted()? Palette::ListCellBackgroundSelected : Palette::ListCellBackground;
|
||||
KDColor backgroundColor = isHighlighted()? *Palette::ListCellBackgroundSelected : *Palette::ListCellBackground;
|
||||
m_subtitleView.setBackgroundColor(backgroundColor);
|
||||
}
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@ void MessageTableCellWithEditableText::setEditing(bool isEditing) {
|
||||
|
||||
void MessageTableCellWithEditableText::setHighlighted(bool highlight) {
|
||||
MessageTableCell::setHighlighted(highlight);
|
||||
KDColor backgroundColor = highlight? Palette::ListCellBackgroundSelected : Palette::ListCellBackground;
|
||||
KDColor backgroundColor = highlight? *Palette::ListCellBackgroundSelected : *Palette::ListCellBackground;
|
||||
m_textField.setBackgroundColor(backgroundColor);
|
||||
}
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
MessageTableCellWithExpression::MessageTableCellWithExpression(I18n::Message message, const KDFont * font) :
|
||||
MessageTableCell(message, font),
|
||||
m_subtitleView(1.0f, 0.5f, Palette::SecondaryText)
|
||||
m_subtitleView(1.0f, 0.5f, *Palette::SecondaryText)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@ View * MessageTableCellWithExpression::accessoryView() const {
|
||||
|
||||
void MessageTableCellWithExpression::setHighlighted(bool highlight) {
|
||||
MessageTableCell::setHighlighted(highlight);
|
||||
KDColor backgroundColor = isHighlighted()? Palette::ListCellBackgroundSelected : Palette::ListCellBackground;
|
||||
KDColor backgroundColor = isHighlighted()? *Palette::ListCellBackgroundSelected : *Palette::ListCellBackground;
|
||||
m_subtitleView.setBackgroundColor(backgroundColor);
|
||||
}
|
||||
|
||||
|
||||
@@ -13,6 +13,6 @@ View * MessageTableCellWithGauge::accessoryView() const {
|
||||
|
||||
void MessageTableCellWithGauge::setHighlighted(bool highlight) {
|
||||
MessageTableCell::setHighlighted(highlight);
|
||||
KDColor backgroundColor = highlight? Palette::ListCellBackgroundSelected : Palette::ListCellBackground;
|
||||
KDColor backgroundColor = highlight? *Palette::ListCellBackgroundSelected : *Palette::ListCellBackground;
|
||||
m_accessoryView.setBackgroundColor(backgroundColor);
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ View * MessageTableCellWithMessage::accessoryView() const {
|
||||
|
||||
void MessageTableCellWithMessage::setHighlighted(bool highlight) {
|
||||
MessageTableCell::setHighlighted(highlight);
|
||||
KDColor backgroundColor = isHighlighted()? Palette::ListCellBackgroundSelected : Palette::ListCellBackground;
|
||||
KDColor backgroundColor = isHighlighted()? *Palette::ListCellBackgroundSelected : *Palette::ListCellBackground;
|
||||
m_accessoryView.setBackgroundColor(backgroundColor);
|
||||
}
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
#include <apps/i18n.h>
|
||||
#include <assert.h>
|
||||
|
||||
constexpr KDColor ModalViewEmptyController::ModalViewEmptyView::k_backgroundColor;
|
||||
KDColor const * ModalViewEmptyController::ModalViewEmptyView::k_backgroundColor = Palette::WallScreen;
|
||||
|
||||
// ModalViewEmptyController::ModalViewEmptyView
|
||||
void ModalViewEmptyController::ModalViewEmptyView::initMessageViews() {
|
||||
@@ -10,7 +10,7 @@ void ModalViewEmptyController::ModalViewEmptyView::initMessageViews() {
|
||||
for (int i = 0; i < numberOfMessageViews; i++) {
|
||||
MessageTextView * message = messageTextViewAtIndex(i);
|
||||
message->setFont(k_font);
|
||||
message->setBackgroundColor(k_backgroundColor);
|
||||
message->setBackgroundColor(*k_backgroundColor);
|
||||
float verticalAlignment = 0.5f;
|
||||
if (i == 0) {
|
||||
verticalAlignment = 1.0f;
|
||||
@@ -29,8 +29,8 @@ void ModalViewEmptyController::ModalViewEmptyView::setMessages(I18n::Message * m
|
||||
}
|
||||
|
||||
void ModalViewEmptyController::ModalViewEmptyView::drawRect(KDContext * ctx, KDRect rect) const {
|
||||
ctx->fillRect(bounds(), k_backgroundColor);
|
||||
drawBorderOfRect(ctx, bounds(), Palette::ListCellBorder);
|
||||
ctx->fillRect(bounds(), *k_backgroundColor);
|
||||
drawBorderOfRect(ctx, bounds(), *Palette::ListCellBorder);
|
||||
}
|
||||
|
||||
int ModalViewEmptyController::ModalViewEmptyView::numberOfSubviews() const {
|
||||
|
||||
@@ -89,7 +89,7 @@ void NestedMenuController::ListController::setFirstSelectedRow(int firstSelected
|
||||
/* NestedMenuController */
|
||||
|
||||
NestedMenuController::NestedMenuController(Responder * parentResponder, I18n::Message title) :
|
||||
StackViewController(parentResponder, &m_listController, Palette::ToolboxHeaderText, Palette::ToolboxHeaderBackground, Palette::ToolboxHeaderBorder),
|
||||
StackViewController(parentResponder, &m_listController, *Palette::ToolboxHeaderText, *Palette::ToolboxHeaderBackground, *Palette::ToolboxHeaderBorder),
|
||||
m_selectableTableView(&m_listController, this, this, this),
|
||||
m_listController(this, &m_selectableTableView, title),
|
||||
m_sender(nullptr)
|
||||
|
||||
@@ -1,161 +1,10 @@
|
||||
#include <escher/palette.h>
|
||||
#include <assert.h>
|
||||
|
||||
constexpr KDColor Palette::PrimaryText;
|
||||
constexpr KDColor Palette::SecondaryText; // =GREYDARK
|
||||
constexpr KDColor Palette::AccentText;
|
||||
constexpr KDColor Palette::BackgroundHard;
|
||||
constexpr KDColor Palette::BackgroundApps;
|
||||
constexpr KDColor Palette::BackgroundAppsSecondary;
|
||||
constexpr KDColor Palette::Toolbar;
|
||||
constexpr KDColor Palette::ToolbarText;
|
||||
constexpr KDColor Palette::ExpressionInputBackground;
|
||||
constexpr KDColor Palette::ExpressionInputBorder;
|
||||
constexpr KDColor Palette::Battery;
|
||||
constexpr KDColor Palette::BatteryInCharge;
|
||||
constexpr KDColor Palette::BatteryLow;
|
||||
constexpr KDColor Palette::ApproximateSignText;
|
||||
constexpr KDColor Palette::ApproximateExpressionText;
|
||||
constexpr KDColor Palette::ScrollBarForeground;
|
||||
constexpr KDColor Palette::ScrollBarBackground;
|
||||
|
||||
constexpr KDColor Palette::Control;
|
||||
constexpr KDColor Palette::ControlEnabled;
|
||||
constexpr KDColor Palette::ControlDisabled;
|
||||
|
||||
constexpr KDColor Palette::CalculationBackgroundOdd;
|
||||
constexpr KDColor Palette::CalculationBackgroundEven;
|
||||
constexpr KDColor Palette::CalculationEmptyBox;
|
||||
constexpr KDColor Palette::CalculationEmptyBoxNeeded;
|
||||
constexpr KDColor Palette::CalculationTrigoAndComplexForeground;
|
||||
|
||||
constexpr KDColor Palette::CodeBackground;
|
||||
constexpr KDColor Palette::CodeBackgroundSelected;
|
||||
constexpr KDColor Palette::CodeText;
|
||||
constexpr KDColor Palette::CodeComment;
|
||||
constexpr KDColor Palette::CodeNumber;
|
||||
constexpr KDColor Palette::CodeKeyword;
|
||||
constexpr KDColor Palette::CodeOperator;
|
||||
constexpr KDColor Palette::CodeString;
|
||||
constexpr KDColor Palette::CodeGutterViewBackground;
|
||||
|
||||
constexpr KDColor Palette::ProbabilityCurve;
|
||||
constexpr KDColor Palette::ProbabilityCellBorder;
|
||||
constexpr KDColor Palette::ProbabilityHistogramBar;
|
||||
|
||||
constexpr KDColor Palette::StatisticsBox;
|
||||
constexpr KDColor Palette::StatisticsBoxVerticalLine;
|
||||
constexpr KDColor Palette::StatisticsSelected;
|
||||
constexpr KDColor Palette::StatisticsNotSelected;
|
||||
|
||||
constexpr KDColor Palette::GraphTangent;
|
||||
|
||||
constexpr KDColor Palette::SubMenuBackground;
|
||||
constexpr KDColor Palette::SubMenuBorder;
|
||||
constexpr KDColor Palette::SubMenuText;
|
||||
|
||||
constexpr KDColor Palette::ToolboxHeaderBackground;
|
||||
constexpr KDColor Palette::ToolboxHeaderText;
|
||||
constexpr KDColor Palette::ToolboxHeaderBorder;
|
||||
constexpr KDColor Palette::ToolboxBackground;
|
||||
|
||||
constexpr KDColor Palette::ListCellBackground;
|
||||
constexpr KDColor Palette::ListCellBackgroundSelected;
|
||||
constexpr KDColor Palette::ListCellBorder;
|
||||
|
||||
constexpr KDColor Palette::ButtonBackground;
|
||||
constexpr KDColor Palette::ButtonBackgroundSelected;
|
||||
constexpr KDColor Palette::ButtonBackgroundSelectedHighContrast;
|
||||
constexpr KDColor Palette::ButtonBorder;
|
||||
constexpr KDColor Palette::ButtonRowBorder;
|
||||
constexpr KDColor Palette::ButtonBorderOut;
|
||||
constexpr KDColor Palette::ButtonShadow;
|
||||
constexpr KDColor Palette::ButtonText;
|
||||
|
||||
constexpr KDColor Palette::TabBackground;
|
||||
constexpr KDColor Palette::TabBackgroundSelected;
|
||||
constexpr KDColor Palette::TabBackgroundActive;
|
||||
constexpr KDColor Palette::TabBackgroundSelectedAndActive;
|
||||
constexpr KDColor Palette::TabText;
|
||||
constexpr KDColor Palette::TabTextActive;
|
||||
|
||||
constexpr KDColor Palette::SubTabBackground;
|
||||
constexpr KDColor Palette::SubTabBackgroundSelected;
|
||||
constexpr KDColor Palette::SubTabText;
|
||||
|
||||
constexpr KDColor Palette::BannerFirstBackground;
|
||||
constexpr KDColor Palette::BannerFirstBorder;
|
||||
constexpr KDColor Palette::BannerFirstText;
|
||||
constexpr KDColor Palette::BannerFirstVariantBackground;
|
||||
constexpr KDColor Palette::BannerFirstVariantBorder;
|
||||
constexpr KDColor Palette::BannerFirstVariantText;
|
||||
constexpr KDColor Palette::BannerSecondBackground;
|
||||
constexpr KDColor Palette::BannerSecondBorder;
|
||||
constexpr KDColor Palette::BannerSecondText;
|
||||
constexpr KDColor Palette::GridPrimaryLine;
|
||||
constexpr KDColor Palette::GridSecondaryLine;
|
||||
|
||||
constexpr KDColor Palette::HomeBackground;
|
||||
constexpr KDColor Palette::HomeCellBackground;
|
||||
constexpr KDColor Palette::HomeCellBackgroundActive;
|
||||
constexpr KDColor Palette::HomeCellText;
|
||||
constexpr KDColor Palette::HomeCellTextActive;
|
||||
constexpr KDColor Palette::HomeCellTextExternal;
|
||||
constexpr KDColor Palette::HomeCellTextExternalActive;
|
||||
|
||||
constexpr KDColor Palette::YellowDark; // Done
|
||||
constexpr KDColor Palette::YellowLight; // Done
|
||||
constexpr KDColor Palette::PurpleBright; // Done
|
||||
constexpr KDColor Palette::PurpleDark; // Done
|
||||
constexpr KDColor Palette::GrayWhite; // Done
|
||||
constexpr KDColor Palette::GrayBright; // Done
|
||||
constexpr KDColor Palette::GrayMiddle; // Done
|
||||
constexpr KDColor Palette::GrayDark; // Done
|
||||
constexpr KDColor Palette::GrayVeryDark; // Done
|
||||
constexpr KDColor Palette::Select; // Done
|
||||
constexpr KDColor Palette::SelectDark; // Done
|
||||
constexpr KDColor Palette::WallScreen; // Done
|
||||
constexpr KDColor Palette::WallScreenDark; // Done
|
||||
constexpr KDColor Palette::SubTab; // Done
|
||||
constexpr KDColor Palette::LowBattery; // Done
|
||||
constexpr KDColor Palette::Red;
|
||||
constexpr KDColor Palette::RedLight;
|
||||
constexpr KDColor Palette::Magenta;
|
||||
constexpr KDColor Palette::Turquoise;
|
||||
constexpr KDColor Palette::Pink;
|
||||
constexpr KDColor Palette::Blue;
|
||||
constexpr KDColor Palette::BlueLight;
|
||||
constexpr KDColor Palette::Orange;
|
||||
constexpr KDColor Palette::Green;
|
||||
constexpr KDColor Palette::GreenLight;
|
||||
constexpr KDColor Palette::Brown;
|
||||
constexpr KDColor Palette::Purple;
|
||||
constexpr KDColor Palette::Cyan; // TODO Palette change
|
||||
constexpr KDColor Palette::BlueishGrey; // TODO Palette change
|
||||
constexpr KDColor Palette::DataColor[];
|
||||
constexpr KDColor Palette::DataColorLight[];
|
||||
|
||||
constexpr KDColor Palette::AtomUnknown;
|
||||
constexpr KDColor Palette::AtomText;
|
||||
constexpr KDColor Palette::AtomAlkaliMetal;
|
||||
constexpr KDColor Palette::AtomAlkaliEarthMetal;
|
||||
constexpr KDColor Palette::AtomLanthanide;
|
||||
constexpr KDColor Palette::AtomActinide;
|
||||
constexpr KDColor Palette::AtomTransitionMetal;
|
||||
constexpr KDColor Palette::AtomPostTransitionMetal;
|
||||
constexpr KDColor Palette::AtomMetalloid;
|
||||
constexpr KDColor Palette::AtomHalogen;
|
||||
constexpr KDColor Palette::AtomReactiveNonmetal;
|
||||
constexpr KDColor Palette::AtomNobleGas;
|
||||
constexpr KDColor Palette::AtomTableLines;
|
||||
constexpr KDColor Palette::AtomBackground;
|
||||
constexpr KDColor Palette::AtomHighlight;
|
||||
constexpr KDColor Palette::AtomColor[];
|
||||
|
||||
KDColor Palette::nextDataColor(int * colorIndex) {
|
||||
size_t nbOfColors = numberOfDataColors();
|
||||
assert(*colorIndex < nbOfColors);
|
||||
KDColor c = DataColor[*colorIndex];
|
||||
KDColor c = *DataColor[*colorIndex];
|
||||
*colorIndex = (*colorIndex + 1) % nbOfColors;
|
||||
return c;
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@ ScrollView::ScrollView(View * contentView, ScrollViewDataSource * dataSource) :
|
||||
m_bottomMargin(0),
|
||||
m_leftMargin(0),
|
||||
m_decorators(),
|
||||
m_backgroundColor(Palette::BackgroundApps)
|
||||
m_backgroundColor(*Palette::BackgroundApps)
|
||||
{
|
||||
assert(m_dataSource != nullptr);
|
||||
setDecoratorType(Decorator::Type::Bars);
|
||||
|
||||
@@ -8,7 +8,7 @@ extern "C" {
|
||||
|
||||
ScrollViewIndicator::ScrollViewIndicator() :
|
||||
View(),
|
||||
m_color(Palette::ScrollBarForeground),
|
||||
m_color(*Palette::ScrollBarForeground),
|
||||
m_margin(Metric::CommonTopMargin)
|
||||
{
|
||||
}
|
||||
@@ -17,7 +17,7 @@ ScrollViewBar::ScrollViewBar() :
|
||||
ScrollViewIndicator(),
|
||||
m_offset(0),
|
||||
m_visibleLength(0),
|
||||
m_trackColor(Palette::ScrollBarBackground)
|
||||
m_trackColor(*Palette::ScrollBarBackground)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -43,7 +43,7 @@ void SwitchView::drawRect(KDContext * ctx, KDRect rect) const {
|
||||
KDRect frame(width - k_switchWidth, heightCenter - halfHeight, k_switchWidth, k_switchHeight);
|
||||
ctx->blendRectWithMask(
|
||||
frame,
|
||||
m_state ? Palette::Control : Palette::ControlDisabled,
|
||||
m_state ? *Palette::Control : *Palette::ControlDisabled,
|
||||
reinterpret_cast<const uint8_t *>(switchMask),
|
||||
workingBuffer);
|
||||
|
||||
@@ -52,7 +52,7 @@ void SwitchView::drawRect(KDContext * ctx, KDRect rect) const {
|
||||
KDRect onOffFrame(onOffX, heightCenter - halfHeight, k_onOffSize, k_onOffSize);
|
||||
ctx->blendRectWithMask(
|
||||
onOffFrame,
|
||||
Palette::ListCellBackground,
|
||||
*Palette::ListCellBackground,
|
||||
reinterpret_cast<const uint8_t *>(onOffMask),
|
||||
workingBuffer);
|
||||
}
|
||||
@@ -20,7 +20,7 @@ void TabView::drawRect(KDContext * ctx, KDRect rect) const {
|
||||
KDCoordinate height = bounds().height();
|
||||
KDCoordinate width = bounds().width();
|
||||
// Draw a separator with the content
|
||||
ctx->fillRect(KDRect(0, height-k_activeTabHeight, width, k_activeTabHeight), Palette::BackgroundHard);
|
||||
ctx->fillRect(KDRect(0, height-k_activeTabHeight, width, k_activeTabHeight), *Palette::BackgroundHard);
|
||||
}
|
||||
|
||||
void TabView::addTab(ViewController * controller) {
|
||||
|
||||
@@ -35,13 +35,13 @@ void TabViewCell::drawRect(KDContext * ctx, KDRect rect) const {
|
||||
KDCoordinate height = bounds().height();
|
||||
KDCoordinate width = bounds().width();
|
||||
// choose the background color
|
||||
KDColor text = m_active ? Palette::TabTextActive : Palette::TabText;
|
||||
KDColor background = m_active ? Palette::TabBackgroundActive : Palette::TabBackground;
|
||||
KDColor selection = m_active ? Palette::TabBackgroundSelectedAndActive : Palette::TabBackgroundSelected;
|
||||
KDColor text = m_active ? *Palette::TabTextActive : *Palette::TabText;
|
||||
KDColor background = m_active ? *Palette::TabBackgroundActive : *Palette::TabBackground;
|
||||
KDColor selection = m_active ? *Palette::TabBackgroundSelectedAndActive : *Palette::TabBackgroundSelected;
|
||||
background = m_selected ? selection : background;
|
||||
// Color the background according to the state of the tab cell
|
||||
if (m_active || m_selected) {
|
||||
ctx->fillRect(KDRect(0, 0, width, 1), Palette::TabBackgroundSelected);
|
||||
ctx->fillRect(KDRect(0, 0, width, 1), *Palette::TabBackgroundSelected);
|
||||
ctx->fillRect(KDRect(0, 1, width, height-1), background);
|
||||
} else {
|
||||
ctx->fillRect(KDRect(0, 0, width, height), background);
|
||||
|
||||
@@ -165,7 +165,7 @@ void TableCell::layoutSubviews(bool force) {
|
||||
}
|
||||
|
||||
void TableCell::drawRect(KDContext * ctx, KDRect rect) const {
|
||||
KDColor backColor = isHighlighted() ? Palette::ListCellBackgroundSelected : Palette::ListCellBackground;
|
||||
KDColor backColor = isHighlighted() ? *Palette::ListCellBackgroundSelected : *Palette::ListCellBackground;
|
||||
drawInnerRect(ctx, bounds(), backColor);
|
||||
drawBorderOfRect(ctx, bounds(), Palette::ListCellBorder);
|
||||
drawBorderOfRect(ctx, bounds(), *Palette::ListCellBorder);
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
void TextCursorView::drawRect(KDContext * ctx, KDRect rect) const {
|
||||
KDCoordinate height = bounds().height();
|
||||
ctx->fillRect(KDRect(0, 0, 1, height), Palette::PrimaryText);
|
||||
ctx->fillRect(KDRect(0, 0, 1, height), *Palette::PrimaryText);
|
||||
}
|
||||
|
||||
KDSize TextCursorView::minimalSizeForOptimalDisplay() const {
|
||||
|
||||
@@ -42,7 +42,7 @@ void TextField::ContentView::setTextColor(KDColor textColor) {
|
||||
void TextField::ContentView::drawRect(KDContext * ctx, KDRect rect) const {
|
||||
KDColor backgroundColor = m_backgroundColor;
|
||||
/*if (m_isEditing) {
|
||||
backgroundColor = Palette::BackgroundHard;
|
||||
backgroundColor = *Palette::BackgroundHard;
|
||||
}*/
|
||||
ctx->fillRect(bounds(), backgroundColor);
|
||||
if (selectionIsEmpty()) {
|
||||
@@ -55,7 +55,7 @@ void TextField::ContentView::drawRect(KDContext * ctx, KDRect rect) const {
|
||||
int selectionLength = m_selectionEnd - m_selectionStart;
|
||||
textToDraw += selectionOffset;
|
||||
// Draw the selected text
|
||||
ctx->drawString(text() + selectionOffset, glyphFrameAtPosition(text(), textToDraw).origin(), m_font, m_textColor, Palette::Select, selectionLength);
|
||||
ctx->drawString(text() + selectionOffset, glyphFrameAtPosition(text(), textToDraw).origin(), m_font, m_textColor, *Palette::Select, selectionLength);
|
||||
textToDraw += selectionLength;
|
||||
// Draw the non selected text on the right of the selection
|
||||
ctx->drawString(text() + selectionOffset + selectionLength, glyphFrameAtPosition(text(), textToDraw).origin(), m_font, m_textColor, backgroundColor);
|
||||
|
||||
@@ -35,7 +35,7 @@ void ToggleableDotView::drawRect(KDContext * ctx, KDRect rect) const {
|
||||
KDRect frame(width - k_dotSize, heightCenter - halfHeight, k_dotSize, k_dotSize);
|
||||
ctx->blendRectWithMask(
|
||||
frame,
|
||||
m_state ? Palette::Control : Palette::GrayDark,
|
||||
m_state ? *Palette::Control : *Palette::GrayDark,
|
||||
m_state ? reinterpret_cast<const uint8_t *>(MediumDotMask) : reinterpret_cast<const uint8_t *>(MediumShallowDotMask),
|
||||
workingBuffer);
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@ void Toolbox::willDisplayCellForIndex(HighlightCell * cell, int index) {
|
||||
MessageTableCellWithMessage * myCell = (MessageTableCellWithMessage *)cell;
|
||||
myCell->setMessage(messageTree->label());
|
||||
myCell->setAccessoryMessage(messageTree->text());
|
||||
myCell->setAccessoryTextColor(Palette::SecondaryText);
|
||||
myCell->setAccessoryTextColor(*Palette::SecondaryText);
|
||||
return;
|
||||
}
|
||||
MessageTableCell * myCell = (MessageTableCell *)cell;
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
|
||||
WarningController::ContentView::ContentView() :
|
||||
SolidColorView(KDColorBlack),
|
||||
m_textView1(KDFont::SmallFont, (I18n::Message)0, k_middleAlignment, k_middleAlignment, Palette::BackgroundHard, Palette::PrimaryText),
|
||||
m_textView2(KDFont::SmallFont, (I18n::Message)0, k_middleAlignment, (1.0f-k_shiftedAlignment), Palette::BackgroundHard, Palette::PrimaryText)
|
||||
m_textView1(KDFont::SmallFont, (I18n::Message)0, k_middleAlignment, k_middleAlignment, *Palette::BackgroundHard, *Palette::PrimaryText),
|
||||
m_textView2(KDFont::SmallFont, (I18n::Message)0, k_middleAlignment, (1.0f-k_shiftedAlignment), *Palette::BackgroundHard, *Palette::PrimaryText)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user