mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-01-19 00:37:25 +01:00
[escher] EvenOddBufferTextCell wraps the text view with a 2-pixel margin
This commit is contained in:
committed by
LeaNumworks
parent
a3b3951eee
commit
6f70924893
@@ -25,7 +25,6 @@ app_regression_src = $(addprefix apps/regression/,\
|
||||
banner_view.cpp \
|
||||
calculation_controller.cpp \
|
||||
column_title_cell.cpp \
|
||||
even_odd_buffer_text_cell_with_margin.cpp \
|
||||
even_odd_double_buffer_text_cell_with_separator.cpp \
|
||||
graph_controller.cpp \
|
||||
graph_options_controller.cpp \
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
#include "even_odd_buffer_text_cell_with_margin.h"
|
||||
#include <assert.h>
|
||||
|
||||
namespace Regression {
|
||||
|
||||
void EvenOddBufferTextCellWithMargin::layoutSubviews() {
|
||||
KDRect boundsThis = bounds();
|
||||
KDRect boundsBuffer = KDRect(boundsThis.left() + k_horizontalMargin, boundsThis.top(), boundsThis.width() - 2*k_horizontalMargin, boundsThis.height());
|
||||
m_bufferTextView.setFrame(boundsBuffer);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,17 +0,0 @@
|
||||
#ifndef REGRESSION_EVEN_ODD_BUFFER_TEXT_CELL_WITH_MARGIN_H
|
||||
#define REGRESSION_EVEN_ODD_BUFFER_TEXT_CELL_WITH_MARGIN_H
|
||||
|
||||
#include <escher/even_odd_buffer_text_cell.h>
|
||||
|
||||
namespace Regression {
|
||||
|
||||
class EvenOddBufferTextCellWithMargin : public EvenOddBufferTextCell {
|
||||
public:
|
||||
using EvenOddBufferTextCell::EvenOddBufferTextCell;
|
||||
void layoutSubviews() override;
|
||||
private:
|
||||
static constexpr KDCoordinate k_horizontalMargin = 2;
|
||||
};
|
||||
|
||||
}
|
||||
#endif
|
||||
@@ -2,7 +2,6 @@
|
||||
#define REGRESSION_EVEN_ODD_DOUBLE_BUFFER_TEXT_CELL_WITH_SEPARATOR_H
|
||||
|
||||
#include <escher.h>
|
||||
#include "even_odd_buffer_text_cell_with_margin.h"
|
||||
|
||||
namespace Regression {
|
||||
|
||||
@@ -30,8 +29,8 @@ public:
|
||||
bool handleEvent(Ion::Events::Event event) override;
|
||||
protected:
|
||||
bool m_firstTextSelected;
|
||||
EvenOddBufferTextCellWithMargin m_firstBufferTextView;
|
||||
EvenOddBufferTextCellWithMargin m_secondBufferTextView;
|
||||
EvenOddBufferTextCell m_firstBufferTextView;
|
||||
EvenOddBufferTextCell m_secondBufferTextView;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@ void SeparatorEvenOddBufferTextCell::drawRect(KDContext * ctx, KDRect rect) cons
|
||||
|
||||
void SeparatorEvenOddBufferTextCell::layoutSubviews() {
|
||||
KDRect boundsThis = bounds();
|
||||
m_bufferTextView.setFrame(KDRect(boundsThis.left() + Metric::TableSeparatorThickness, boundsThis.top(), boundsThis.width() - Metric::TableSeparatorThickness - k_rightMargin, boundsThis.height()));
|
||||
m_bufferTextView.setFrame(KDRect(boundsThis.left() + Metric::TableSeparatorThickness + k_horizontalMargin, boundsThis.top(), boundsThis.width() - Metric::TableSeparatorThickness - 2*k_horizontalMargin, boundsThis.height()));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -22,6 +22,7 @@ public:
|
||||
void setText(const char * textContent);
|
||||
void setTextColor(KDColor textColor);
|
||||
protected:
|
||||
static constexpr KDCoordinate k_horizontalMargin = 2;
|
||||
int numberOfSubviews() const override;
|
||||
View * subviewAtIndex(int index) override;
|
||||
void layoutSubviews() override;
|
||||
|
||||
@@ -39,5 +39,7 @@ View * EvenOddBufferTextCell::subviewAtIndex(int index) {
|
||||
}
|
||||
|
||||
void EvenOddBufferTextCell::layoutSubviews() {
|
||||
m_bufferTextView.setFrame(bounds());
|
||||
KDRect boundsThis = bounds();
|
||||
KDRect boundsBuffer = KDRect(boundsThis.left() + k_horizontalMargin, boundsThis.top(), boundsThis.width() - 2*k_horizontalMargin, boundsThis.height());
|
||||
m_bufferTextView.setFrame(boundsBuffer);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user