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
|
Rev | Line | |
---|
[242] | 1 | #include "GWt_console.h" |
---|
[226] | 2 | |
---|
| 3 | #include <Wt/WApplication> |
---|
| 4 | #include <Wt/WText> |
---|
[397] | 5 | #include <Wt/WBorder> |
---|
| 6 | #include <Wt/WLayout> |
---|
| 7 | #include <Wt/WPanel> |
---|
| 8 | #include <Wt/WScrollArea> |
---|
[226] | 9 | |
---|
[240] | 10 | GWt_console::GWt_console() |
---|
| 11 | :WContainerWidget() |
---|
| 12 | { |
---|
[272] | 13 | setObjectName("console"); |
---|
[397] | 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 | |
---|
[240] | 31 | } |
---|
[227] | 32 | |
---|
[240] | 33 | |
---|
| 34 | GWt_console::~GWt_console() |
---|
| 35 | { |
---|
| 36 | } |
---|
| 37 | |
---|
| 38 | |
---|
| 39 | void GWt_console::addConsoleMessage(WString msg) { |
---|
[272] | 40 | |
---|
[397] | 41 | output_->setText(output_->text()+msg); |
---|
[272] | 42 | |
---|
[247] | 43 | /* |
---|
[272] | 44 | * Little javascript trick to make sure we scroll along with new content |
---|
| 45 | */ |
---|
[397] | 46 | wApp->doJavaScript(output_->jsRef() + ".scrollTop += " |
---|
| 47 | + output_->jsRef() + ".scrollHeight;"); |
---|
[272] | 48 | |
---|
[226] | 49 | } |
---|
[240] | 50 | |
---|
Note: See
TracBrowser
for help on using the repository browser.