ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/cvsroot/deliantra/dclient/src/frontend/client/widgets/query_widget.cpp
Revision: 1.6
Committed: Mon Feb 7 19:20:10 2011 UTC (15 years, 9 months ago) by sf-pippijn
Branch: MAIN
CVS Tags: HEAD
Changes since 1.5: +2 -2 lines
Log Message:
rename col to row when counting lines

Jonathan Neuschäfer <j.neuschaefer@gmx.net>

File Contents

# Content
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 foreach (std::string const &line, query)
21 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 row = 0;
33 foreach (std::string const &line, query)
34 {
35 return_unless (pen.move (1, ++row));
36 pen.write (line);
37 }
38 }