~ubuntu-branches/ubuntu/raring/simutrans/raring-proposed

« back to all changes in this revision

Viewing changes to gui/components/gui_scrolled_list.cc

  • Committer: Package Import Robot
  • Author(s): Ansgar Burchardt
  • Date: 2011-11-03 19:59:02 UTC
  • mfrom: (1.2.7)
  • Revision ID: package-import@ubuntu.com-20111103195902-uopgwf488mfctb75
Tags: 111.0-1
* New upstream release.
* debian/rules: Update get-orig-source target for new upstream release.
* Use xz compression for source and binary packages.
* Use override_* targets to simplify debian/rules.

Show diffs side-by-side

added added

removed removed

Lines of Context:
9
9
#include "gui_scrollbar.h"
10
10
#include "gui_scrolled_list.h"
11
11
 
12
 
#include "../../simworld.h"
13
12
#include "../../simgraph.h"
14
13
#include "../../simcolor.h"
15
14
#include "../../simwin.h"
16
 
#include "../../utils/simstring.h"
17
15
 
18
16
 
19
17
 
130
128
/* resizes scrollbar */
131
129
void gui_scrolled_list_t::adjust_scrollbar()
132
130
{
133
 
        sb.set_pos(koord(groesse.x-12,0));
 
131
        sb.set_pos(koord(groesse.x-scrollbar_t::BAR_SIZE,0));
134
132
 
135
133
        int vz = total_vertical_size();
136
134
        // need scrollbar?
137
135
        if ( groesse.y-border < vz) {
138
136
                sb.set_visible(true);
139
 
                sb.set_groesse(koord(10, (int)groesse.y+border));
 
137
                sb.set_groesse(koord(scrollbar_t::BAR_SIZE, (int)groesse.y+border-1));
140
138
                sb.set_knob(groesse.y-border, vz);
141
139
        }
142
140
        else {
151
149
        const int y = ev->cy;
152
150
 
153
151
        // size without scrollbar
154
 
        const int w = groesse.x - 13;
 
152
        const int w = groesse.x - scrollbar_t::BAR_SIZE+2;
155
153
        const int h = groesse.y;
156
154
        if(x <= w) { // inside list
157
155
                switch(type) {
202
200
 
203
201
        const int x = pos.x;
204
202
        const int y = pos.y;
205
 
        const int w = gr.x-13;
 
203
        const int w = gr.x-scrollbar_t::BAR_SIZE;
206
204
        const int h = gr.y;
207
205
 
208
206
        switch(type) {
221
219
        display_ddd_box(x,y-1,w,h+2, COL_BLACK, COL_WHITE);
222
220
 
223
221
        PUSH_CLIP(x+1,y+1,w-2,h-2);
224
 
        int ycum = y+4-offset; // y cumulative
 
222
        int ycum = y+2-offset; // y cumulative
225
223
        int i=0;
226
224
        slist_iterator_tpl<gui_scrolled_list_t::scrollitem_t *>iter( item_list );
227
225
        bool ok = iter.next();
245
243
                else {
246
244
                        if(i == selection) {
247
245
                                // the selection is grey on color
248
 
                                display_fillbox_wh_clip(x+3, ycum-1, w-5, 11, highlight_color, true);
 
246
                                display_fillbox_wh_clip(x+3, ycum-1, w-5, LINESPACE, highlight_color, true);
249
247
                                display_proportional_clip(x+7, ycum, item->get_text(), ALIGN_LEFT, (win_get_focus()==this ? COL_WHITE : MN_GREY3), true);
250
248
                        }
251
249
                        else {
252
250
                                // normal text
253
251
                                display_proportional_clip(x+7, ycum, item->get_text(), ALIGN_LEFT, item->get_color(), true);
254
252
                        }
255
 
                        ycum += 11;
 
253
                        ycum += LINESPACE;
256
254
                        i++;
257
255
                }
258
256
        }