ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/cvsroot/cf.schmorp.de/dclient/src/frontend/client/widgets.cpp
Revision: 1.3
Committed: Mon Oct 18 07:28:36 2010 UTC (16 years ago) by sf-pippijn
Branch: MAIN
Changes since 1.2: +2 -2 lines
Log Message:
disabled menu for now

File Contents

# User Rev Content
1 sf-pippijn 1.1 #include "dclient/widgets.h"
2     #include "dclient/widgets/inventory.h"
3     #include "dclient/widgets/map.h"
4     #include "dclient/widgets/query.h"
5     #include "dclient/widgets/stats.h"
6    
7     #include <ndk++/application.hh>
8     #include <ndk++/frame.hh>
9    
10     // distance between boxes
11     static int const DX = 4;
12     static int const DY = 2;
13    
14     // stats height
15     static int const SH = 10;
16    
17     using ndk::app;
18    
19     void
20     widgets::repack ()
21     {
22     map->move (DX, DY, ndk::absolute);
23     map->resize (app ().width () / 2 - DX * 2, app ().height () / 3 * 2);
24    
25     info.move (map->right_x () + DX, DY, ndk::absolute);
26     info.resize (app ().width () - map->width () - DX * 3, map->height () - SH - DY);
27    
28     stats->move (info.x (), info.bottom_y () + DY, ndk::absolute);
29     stats->resize (info.width (), SH);
30    
31     input.move (map->x (), map->bottom_y () + 1, ndk::absolute);
32     input.resize (map->width () + DY + info.width () + DY);
33    
34     inventory->move (map->x (), input.bottom_y () + 1, ndk::absolute);
35     inventory->resize (app ().width () / 2 - DX * 2, app ().height () - map->height () - DY * 3);
36    
37     container->move (stats->x (), inventory->y (), ndk::absolute);
38     container->resize (inventory->width (), inventory->height ());
39    
40     query->move ( (app ().width () - query->width ()) / 2
41     , (app ().height () - query->height ()) / 2
42     , ndk::absolute
43     );
44    
45     query_input.resize (query->width () - 2);
46     query_input.move (query->x () + 1, query->bottom_y () - 2, ndk::absolute);
47     }
48    
49     void
50     widgets::resize ()
51     {
52     repack ();
53     info.visualize ();
54     }
55    
56     widgets::widgets ()
57     : map (new map_widget)
58     , stats (new stats_widget)
59     , inventory (new inventory_widget)
60     , container (new inventory_widget)
61     , query (new query_widget)
62     , query_input ("", query.get ())
63     {
64     query->resize (10, 5);
65    
66     repack ();
67    
68     map->visualize ();
69     info.visualize ();
70     stats->visualize ();
71     inventory->visualize ();
72     container->visualize ();
73    
74 sf-pippijn 1.3 map->focus ();
75     //invmenu.focus ();
76 sf-pippijn 1.1 }
77    
78     widgets::~widgets ()
79     {
80     }