~ubuntu-branches/ubuntu/jaunty/fltk1.1/jaunty

« back to all changes in this revision

Viewing changes to src/Fl_Tabs.cxx

  • Committer: Bazaar Package Importer
  • Author(s): Aaron M. Ucko
  • Date: 2007-02-21 16:56:13 UTC
  • mfrom: (2.1.5 edgy)
  • Revision ID: james.westby@ubuntu.com-20070221165613-tgsyru29aprq97yj
Tags: 1.1.7-3
* debian/po/pt.po: new (European) Portuguese translation for
  libfltk1.1-dev, courtesy of Pedro Ribeiro <p.m42.ribeiro@gmail.com>.
  (Closes: #410733.)
* Declare (preexisting) compliance with Standards-Version: 3.7.2.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
//
2
 
// "$Id: Fl_Tabs.cxx,v 1.6.2.10.2.20 2004/07/27 16:02:21 easysw Exp $"
 
2
// "$Id: Fl_Tabs.cxx 4448 2005-07-23 12:21:58Z matt $"
3
3
//
4
4
// Tab widget for the Fast Light Tool Kit (FLTK).
5
5
//
6
 
// Copyright 1998-2004 by Bill Spitzak and others.
 
6
// Copyright 1998-2005 by Bill Spitzak and others.
7
7
//
8
8
// This library is free software; you can redistribute it and/or
9
9
// modify it under the terms of the GNU Library General Public
20
20
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
21
21
// USA.
22
22
//
23
 
// Please report all bugs and problems to "fltk-bugs@fltk.org".
 
23
// Please report all bugs and problems on the following page:
 
24
//
 
25
//     http://www.fltk.org/str.php
24
26
//
25
27
 
26
28
// This is the "file card tabs" interface to allow you to put lots and lots
147
149
    if (!Fl::visible_focus()) return Fl_Group::handle(event);
148
150
    if (Fl::event() == FL_RELEASE ||
149
151
        Fl::event() == FL_SHORTCUT ||
150
 
        Fl::event() == FL_KEYBOARD) {
 
152
        Fl::event() == FL_KEYBOARD ||
 
153
        Fl::event() == FL_FOCUS ||
 
154
        Fl::event() == FL_UNFOCUS) {
151
155
      int H = tab_height();
152
156
      if (H >= 0) {
153
157
        H += Fl::box_dy(box());
156
160
        H = Fl::box_dy(box()) - H;
157
161
        damage(FL_DAMAGE_SCROLL, x(), y() + h() - H, w(), H);
158
162
      }
159
 
      return 1;
 
163
      if (Fl::event() == FL_FOCUS || Fl::event() == FL_UNFOCUS) return 0;
 
164
      else return 1;
160
165
    } else return Fl_Group::handle(event);
161
166
  case FL_KEYBOARD:
162
167
    switch (Fl::event_key()) {
182
187
      default:
183
188
        break;
184
189
    }
 
190
  case FL_SHOW:
 
191
    value(); // update visibilities and fall through
185
192
  default:
186
193
    return Fl_Group::handle(event);
187
194
 
236
243
  int H = tab_height();
237
244
 
238
245
  if (damage() & FL_DAMAGE_ALL) { // redraw the entire thing:
239
 
    draw_box(box(), x(), y()+(H>=0?H:0), w(), h()-(H>=0?H:-H), v ? v->color() : color());
 
246
    Fl_Color c = v ? v->color() : color();
 
247
 
 
248
    draw_box(box(), x(), y()+(H>=0?H:0), w(), h()-(H>=0?H:-H), c);
 
249
 
 
250
    if (selection_color() != c) {
 
251
      // Draw the top 5 lines of the tab pane in the selection color so
 
252
      // that the user knows which tab is selected...
 
253
      if (H >= 0) fl_push_clip(x(), y() + H, w(), 5);
 
254
      else fl_push_clip(x(), y() + h() - H - 4, w(), 5);
 
255
 
 
256
      draw_box(box(), x(), y()+(H>=0?H:0), w(), h()-(H>=0?H:-H),
 
257
               selection_color());
 
258
 
 
259
      fl_pop_clip();
 
260
    }
240
261
    if (v) draw_child(*v);
241
262
  } else { // redraw the child
242
263
    if (v) update_child(*v);
262
283
  int dh = Fl::box_dh(box());
263
284
  int dy = Fl::box_dy(box());
264
285
 
 
286
  // compute offsets to make selected tab look bigger
 
287
  int yofs = sel ? 0 : BORDER;
 
288
 
265
289
  if ((x2 < x1+W) && what == RIGHT) x1 = x2 - W;
266
290
 
267
291
  if (H >= 0) {
270
294
 
271
295
    H += dh;
272
296
 
273
 
    draw_box(box(), x1, y(), W, H,
274
 
             sel ? fl_color_average(selection_color(), o->selection_color(), 0.5f)
275
 
                 : o->selection_color());
276
 
 
277
 
    o->draw_label(x1, y(), W, H, FL_ALIGN_CENTER);
 
297
    Fl_Color c = sel ? selection_color() : o->selection_color();
 
298
 
 
299
    draw_box(box(), x1, y() + yofs, W, H + 10 - yofs, c);
 
300
 
 
301
    // Save the previous label color
 
302
    Fl_Color oc = o->labelcolor();
 
303
 
 
304
    // Draw the label using the current color...
 
305
    o->labelcolor(sel ? labelcolor() : o->labelcolor());    
 
306
    o->draw_label(x1, y() + yofs, W, H - yofs, FL_ALIGN_CENTER);
 
307
 
 
308
    // Restore the original label color...
 
309
    o->labelcolor(oc);
278
310
 
279
311
    if (Fl::focus() == this && o->visible())
280
312
      draw_focus(box(), x1, y(), W, H);
288
320
 
289
321
    H += dh;
290
322
 
291
 
    draw_box(box(), x1, y() + h() - H, W, H,
292
 
             sel ? fl_color_average(selection_color(), o->selection_color(), 0.5f)
293
 
                 : o->selection_color());
294
 
 
295
 
    o->draw_label(x1, y() + h() - H, W, H, FL_ALIGN_CENTER);
 
323
    Fl_Color c = sel ? selection_color() : o->selection_color();
 
324
 
 
325
    draw_box(box(), x1, y() + h() - H - 10, W, H + 10 - yofs, c);
 
326
 
 
327
    // Save the previous label color
 
328
    Fl_Color oc = o->labelcolor();
 
329
 
 
330
    // Draw the label using the current color...
 
331
    o->labelcolor(sel ? labelcolor() : o->labelcolor());
 
332
    o->draw_label(x1, y() + h() - H, W, H - yofs, FL_ALIGN_CENTER);
 
333
 
 
334
    // Restore the original label color...
 
335
    o->labelcolor(oc);
296
336
 
297
337
    if (Fl::focus() == this && o->visible())
298
338
      draw_focus(box(), x1, y() + h() - H, W, H);
309
349
}
310
350
 
311
351
//
312
 
// End of "$Id: Fl_Tabs.cxx,v 1.6.2.10.2.20 2004/07/27 16:02:21 easysw Exp $".
 
352
// End of "$Id: Fl_Tabs.cxx 4448 2005-07-23 12:21:58Z matt $".
313
353
//