Last change
on this file since 496 was
397,
checked in by garnier, 11 years ago
|
Améliorations de l'interface graphique
|
File size:
1.0 KB
|
Line | |
---|
1 | #include "GWt_console.h" |
---|
2 | |
---|
3 | #include <Wt/WApplication> |
---|
4 | #include <Wt/WText> |
---|
5 | #include <Wt/WBorder> |
---|
6 | #include <Wt/WLayout> |
---|
7 | #include <Wt/WPanel> |
---|
8 | #include <Wt/WScrollArea> |
---|
9 | |
---|
10 | GWt_console::GWt_console() |
---|
11 | :WContainerWidget() |
---|
12 | { |
---|
13 | setObjectName("console"); |
---|
14 | |
---|
15 | // le panel |
---|
16 | WPanel *panelConsole = new WPanel(this); |
---|
17 | WScrollArea* container = new WScrollArea(); |
---|
18 | |
---|
19 | panelConsole->setTitle(" output"); |
---|
20 | output_ = new WText(this); |
---|
21 | output_->setTextFormat(PlainText); |
---|
22 | output_->setInline(false); |
---|
23 | |
---|
24 | container->setWidget(output_); |
---|
25 | |
---|
26 | panelConsole->setCentralWidget(container); |
---|
27 | output_->setMinimumSize(270,100); |
---|
28 | output_->setMaximumSize(400,400); |
---|
29 | |
---|
30 | |
---|
31 | } |
---|
32 | |
---|
33 | |
---|
34 | GWt_console::~GWt_console() |
---|
35 | { |
---|
36 | } |
---|
37 | |
---|
38 | |
---|
39 | void GWt_console::addConsoleMessage(WString msg) { |
---|
40 | |
---|
41 | output_->setText(output_->text()+msg); |
---|
42 | |
---|
43 | /* |
---|
44 | * Little javascript trick to make sure we scroll along with new content |
---|
45 | */ |
---|
46 | wApp->doJavaScript(output_->jsRef() + ".scrollTop += " |
---|
47 | + output_->jsRef() + ".scrollHeight;"); |
---|
48 | |
---|
49 | } |
---|
50 | |
---|
Note: See
TracBrowser
for help on using the repository browser.