forked from Omega-Numworks/Omega-RPN
-
Notifications
You must be signed in to change notification settings - Fork 0
/
rpn_content_view.cpp
42 lines (35 loc) · 1.36 KB
/
rpn_content_view.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#include "rpn_content_view.h"
#include "rpn_input_controller.h"
#include "rpn_stack_controller.h"
namespace Rpn {
ContentView::ContentView(Responder * parentResponder, InputController * inputController, StackController * stackController) :
View(),
m_stackView(stackController, stackController, stackController),
m_inputView(parentResponder, m_textBuffer, sizeof(m_textBuffer), sizeof(m_textBuffer), inputController, inputController, KDFont::LargeFont, 0.0f, 0.5f, Palette::PrimaryText, Palette::ExpressionInputBackground),
m_textBuffer("")
{
m_stackView.setVerticalCellOverlap(0);
}
ContentView::~ContentView() {
}
View * ContentView::subviewAtIndex(int index) {
assert(index >= 0 && index < numberOfSubviews());
switch (index) {
case 0: return &m_stackView;
default: return &m_inputView;
}
}
void ContentView::layoutSubviews(bool force) {
KDCoordinate inputViewFrameHeight = 38;
KDRect mainViewFrame(0, 0, bounds().width(), bounds().height() - inputViewFrameHeight);
m_stackView.setFrame(mainViewFrame, force);
KDRect inputViewFrame(0, bounds().height() - inputViewFrameHeight, bounds().width(), inputViewFrameHeight);
m_inputView.setLeftMargin(5);
m_inputView.setFrame(inputViewFrame, force);
m_inputView.setBackgroundColor(Palette::ExpressionInputBackground);
}
void ContentView::reload() {
layoutSubviews();
markRectAsDirty(bounds());
}
}