ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/cvsroot/cf.schmorp.de/dclient/src/frontend/client/widgets/query_widget.cpp
Revision: 1.2
Committed: Mon Oct 18 06:54:04 2010 UTC (16 years ago) by sf-pippijn
Branch: MAIN
Changes since 1.1: +2 -2 lines
Log Message:
gcc 4.5; moved some code; background colour support

File Contents

# User Rev Content
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     }