-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathtext_view.cpp
95 lines (83 loc) · 3.21 KB
/
text_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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
/*************************
* text_view.cpp
*
*
* editor: amo
*************************/
#include <iostream>
#include <iomanip>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <text_view.h>
#include <screen.h>
#include <view.h>
#include <text.h>
/* -------------------------------------------------------------------- */
/* my define macro */
/* -------------------------------------------------------------------- */
/* -------------------------------------------------------------------- */
/* global variables */
/* -------------------------------------------------------------------- */
/* -------------------------------------------------------------------- */
/* implements */
/* -------------------------------------------------------------------- */
MyTextView::~MyTextView(){
std::cout << "[MyTextView::~MyTextView()]: >>>" << std::endl;
}
void MyTextView::onLayout(int changed, int l, int r, int t, int b)
{
int width;
int height;
std::cout << "[MyTextView::onLayout()]: >>> " << "text:" << text << std::endl;
if(l == getLeft()) {
std::cout << "[MyTextView::onLayout()]: ... no move on left" << std::endl;
if(r == getRight()){
std::cout << "[MyTextView::onLayout()]: ... no move on right" << std::endl;
if(t == getTop()){
std::cout << "[MyTextView::onLayout()]: ... no move on top" << std::endl;
if(b == getBottom()){
std::cout << "[MyTextView::onLayout()]: ... no move on bottom" << std::endl;
return;
}
}
}
}
setLeft(l);
setRight(r);
setTop(t);
setBottom(b);
width = r - l;
height = b - t;
if(changed) std::cout << "[MyTextView::onLayout()]: ... width:" << width << " and height:" << height << std::endl;
}
int MyTextView::addViewOnScreen(MyScreen &screen)
{
std::cout << "[MyTextView::addViewOnScreen()]: >>>" << std::endl;
return screen.getPixelX() - (getRight() - getLeft()) + screen.getPixelY() - (getBottom() - getTop());
}
void MyTextView::show()
{
std::cout << "[MyTextView::show()]: >>>" << std::endl;
showPosition();
}
void MyTextView::showSuperField()
{
std::cout << "[MyTextView::showSuperField()]: now at left :" << left << std::endl;
std::cout << "[MyTextView::showSuperField()]: now at right :" << right << std::endl;
std::cout << "[MyTextView::showSuperField()]: now at top :" << top << std::endl;
std::cout << "[MyTextView::showSuperField()]: now at bottom :" << bottom << std::endl;
}
/* Override */
void MyTextView::showPosition(){
std::cout << "[MyTextView::showPosition()]: >>>" << std::endl;
std::cout << "[MyTextView::showPosition()]: now at left :" << left << std::endl;
std::cout << "[MyTextView::showPosition()]: now at right :" << right << std::endl;
std::cout << "[MyTextView::showPosition()]: now at top :" << top << std::endl;
std::cout << "[MyTextView::showPosition()]: now at bottom :" << bottom << std::endl;
}
void MyTextView::displayLayout(int l, int r, int t, int b)
{
std::cout << "[MyTextView::displayLayout()]: >>>" << std::endl;
layout(l, r, t, b);
}