forked from yvt/xtbook
-
Notifications
You must be signed in to change notification settings - Fork 1
/
XTBFootnoteView.cpp
67 lines (52 loc) · 1.42 KB
/
XTBFootnoteView.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
//
// XTBFootnoteView.cpp
// XTBook
//
// Created by Kawada Tomoaki on 8/3/11.
// Copyright 2011 Nexhawks. All rights reserved.
//
#include "XTBFootnoteView.h"
#include <tcw/twApp.h>
#include "TWiki/TWHTMLBodyElement.h"
#include "TWViewer.h"
twSize XTBFootnoteView::startupSize() const{
twSize scrSize=tw_app->getScrSize();
return twSize((scrSize.w*2)/3, scrSize.h/3);
}
XTBFootnoteView::XTBFootnoteView(TWHTMLElement *b){
m_footnoteBody=b;
// we are free to disconnect footnote body from
// the original dom.
m_footnoteView=new TWHTMLBodyElement();
m_footnoteView->addChild(m_footnoteBody);
// disable "display: none".
m_footnoteBody->setStyleAttr(L"");
// create viewer.
m_viewer=new TWViewer();
m_viewer->setRect(rectForViewer());
m_viewer->setHTMLDocument(m_footnoteView);
m_viewer->setParent(this);
m_viewer->show();
}
XTBFootnoteView::~XTBFootnoteView(){
// disconnect footnote body from the footnote view
// and return it to the original dom.
// footnote view is destroyed by viewer.
m_footnoteView->removeChild(m_footnoteBody);
// restore the "display: none".
m_footnoteBody->setStyleAttr(L"display: none");
delete m_viewer;
}
void XTBFootnoteView::backgroundTouched(){
endDialog();
}
twRect XTBFootnoteView::rectForViewer() const{
twSize startSize=startupSize();
twRect rt;
rt.x=0; rt.y=0;
rt.w=startSize.w-4;
rt.h=startSize.h-4;
return rt;
}
void XTBFootnoteView::command(int wndId){
}