forked from yvt/xtbook
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathXTBAboutDialog.cpp
66 lines (55 loc) · 1.44 KB
/
XTBAboutDialog.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
/*
* XTBAboutDialog.cpp
* XTBook
*
* Created by Nexhawks on 2/12/11.
* Copyright 2011 Nexhawks. All rights reserved.
*
*/
#include "XTBAboutDialog.h"
#include <tcw/twSDLDC.h>
#include "xpms/Nexhawks.xpm"
enum{
XTBControlIDClose=1
};
XTBAboutDialog::XTBAboutDialog(){
// setup the message label.
messageLabel.setParent(this);
messageLabel.setTitle(L"XTBook development version\n"
"Copyright 2011 Nexhawks.\n"
"Visit http://www.nexhawks.net/");
messageLabel.setRect(twRect(84, 13, 160, 50));
// setup the close button.
closeButton.setParent(this);
closeButton.setTitle(L"OK");
closeButton.setRect(twRect(170, 70, 80, 20));
// setup itself.
setRect(twRect(0, 0, 260, 100)+getBorderSize());
setTitle(L"About XTBook");
// set the close button as the default button.
setDefault(&closeButton);
// load the icon of Nexhawks.
iconDC=twSDLDC::loadFromXPM(Nexhawks);
// show the widgets.
messageLabel.show();
closeButton.show();
}
XTBAboutDialog::~XTBAboutDialog(){
// release the icon of Nexhawks.
delete iconDC;
}
void XTBAboutDialog::command(int){
// clock button was clicked; close the dialog.
endDialog(twDR_ok);
}
void XTBAboutDialog::clientPaint(const twPaintStruct& p){
// fill the background.
twDialog::clientPaint(p);
twDC *dc=p.dc;
// and then draw the icon.
dc->bitBlt(iconDC, twPoint(10, 10), twRect(0,0,64,64));
}
void XTBShowAboutDialog(twWnd *wnd){
XTBAboutDialog dlg;
dlg.showModal(wnd);
}