forked from Omega-Numworks/Omega-RPN
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrpn_content_view.cpp
40 lines (33 loc) · 1.16 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
#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),
m_textBuffer("")
{
}
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() {
KDCoordinate inputViewFrameHeight = 32;
KDRect mainViewFrame(0, 0, bounds().width(), bounds().height() - inputViewFrameHeight);
m_stackView.setFrame(mainViewFrame);
KDRect inputViewFrame(0, bounds().height() - inputViewFrameHeight, bounds().width(), inputViewFrameHeight);
m_inputView.setLeftMargin(4);
m_inputView.setFrame(inputViewFrame);
}
void ContentView::reload() {
layoutSubviews();
markRectAsDirty(bounds());
}
}