| 1 |
sf-pippijn |
1.1 |
#include "dclient/widgets/query.h" |
| 2 |
|
|
|
| 3 |
|
|
#include "deliantra/data/counters.h" |
| 4 |
|
|
#include "deliantra/data/map.h" |
| 5 |
|
|
#include "deliantra/data/statistics.h" |
| 6 |
|
|
|
| 7 |
|
|
#include <ndk++/pen.hh> |
| 8 |
|
|
|
| 9 |
|
|
query_widget::query_widget (ndk::panel *parent) |
| 10 |
|
|
: frame ("", parent) |
| 11 |
|
|
{ |
| 12 |
|
|
} |
| 13 |
|
|
|
| 14 |
|
|
void |
| 15 |
|
|
query_widget::update (string_vector &&query) |
| 16 |
|
|
{ |
| 17 |
|
|
this->query = query; |
| 18 |
|
|
|
| 19 |
|
|
std::string::size_type maxlen = 0; |
| 20 |
sf-pippijn |
1.2 |
foreach (std::string const &line, query) |
| 21 |
sf-pippijn |
1.1 |
maxlen = std::max (maxlen, line.size ()); |
| 22 |
|
|
|
| 23 |
|
|
resize (maxlen + 2, query.size () + 4); |
| 24 |
|
|
} |
| 25 |
|
|
|
| 26 |
|
|
void |
| 27 |
|
|
query_widget::draw () |
| 28 |
|
|
{ |
| 29 |
|
|
frame::draw (); |
| 30 |
|
|
|
| 31 |
|
|
ndk::pen pen (*this); |
| 32 |
|
|
int col = 0; |
| 33 |
sf-pippijn |
1.2 |
foreach (std::string const &line, query) |
| 34 |
sf-pippijn |
1.1 |
{ |
| 35 |
|
|
pen.move (1, ++col); |
| 36 |
|
|
pen.write (line); |
| 37 |
|
|
} |
| 38 |
|
|
} |