~ubuntu-branches/ubuntu/quantal/texmacs/quantal

« back to all changes in this revision

Viewing changes to src/Window/Widget/Composite/composite_widget.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Atsuhito KOHDA, Kamaraju Kusumanchi, kohda
  • Date: 2008-04-06 15:11:41 UTC
  • mfrom: (1.1.7 upstream) (4.1.1 lenny)
  • Revision ID: james.westby@ubuntu.com-20080406151141-w0sg20jnv86mlt6f
Tags: 1:1.0.6.14-1
[Kamaraju Kusumanchi <kamaraju@gmail.com>]
* New upstream release
* 01_american.dpatch is updated
* Since thread support in guile-1.8 is now disabled, the segmentation faults
  should not arise anymore. More info at #439923. (Closes: #450499, #458685)
[kohda]
* This version fixed menu problem.  (Closes: #447083)
* Reverted orig.tar.gz to the upstream tarball.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
 
2
 
/******************************************************************************
3
 
* MODULE     : composite_widget.cpp
4
 
* DESCRIPTION: abstract composite widgets accept events for
5
 
*              modifying the composite structure of a widget.
6
 
* COPYRIGHT  : (C) 1999  Joris van der Hoeven
7
 
*******************************************************************************
8
 
* This software falls under the GNU general public license and comes WITHOUT
9
 
* ANY WARRANTY WHATSOEVER. See the file $TEXMACS_PATH/LICENSE for more details.
10
 
* If you don't have this file, write to the Free Software Foundation, Inc.,
11
 
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
12
 
******************************************************************************/
13
 
 
14
 
#include "Widget/layout.hpp"
15
 
#include "Widget/composite_widget.hpp"
16
 
 
17
 
/******************************************************************************
18
 
* Routines for abstract composite widgets
19
 
******************************************************************************/
20
 
 
21
 
composite_widget_rep::composite_widget_rep (display dis, gravity grav):
22
 
  basic_widget_rep (dis, grav) {}
23
 
composite_widget_rep::composite_widget_rep (display dis, array<widget> a,
24
 
  gravity grav):
25
 
  basic_widget_rep (dis, a, grav) {}
26
 
composite_widget_rep::composite_widget_rep (display dis, array<widget> a,
27
 
  array<string> name, gravity grav):
28
 
  basic_widget_rep (dis, a, name, grav) {}
29
 
 
30
 
void
31
 
composite_widget_rep::handle_clean (clean_event ev) { (void) ev;
32
 
  a->resize (0);
33
 
  name->resize (0);
34
 
}
35
 
 
36
 
void
37
 
composite_widget_rep::handle_insert (insert_event ev) {
38
 
  a << ev->w;
39
 
  name << ev->s;
40
 
}
41
 
 
42
 
void
43
 
composite_widget_rep::handle_remove (remove_event ev) {
44
 
  int i, j, n= N(a);
45
 
  for (i=0; i<n; i++)
46
 
    if (name[i] == ev->s) {
47
 
      for (j=i; j<n-1; j++) {
48
 
        a[j]= a[j+1];
49
 
        name[j]= name[j+1];
50
 
      }
51
 
      a->resize (n-1);
52
 
      name->resize (n-1);
53
 
      return;
54
 
    }
55
 
}
56
 
 
57
 
bool
58
 
composite_widget_rep::handle (event ev) {
59
 
  switch (ev->type) {
60
 
  case CLEAN_EVENT:
61
 
    handle_clean (ev);
62
 
    return true;
63
 
  case INSERT_EVENT:
64
 
    handle_insert (ev);
65
 
    return true;
66
 
  case REMOVE_EVENT:
67
 
    handle_remove (ev);
68
 
    return true;
69
 
  }
70
 
  return basic_widget_rep::handle (ev);
71
 
}