Back to index

texmacs  1.0.7.15
attribute_event.cpp
Go to the documentation of this file.
00001 
00002 /******************************************************************************
00003 * MODULE     : attribute_event.cpp
00004 * DESCRIPTION: Events for setting and retrieving attributes of a widget.
00005 * COPYRIGHT  : (C) 1999  Joris van der Hoeven
00006 *******************************************************************************
00007 * This software falls under the GNU general public license version 3 or later.
00008 * It comes WITHOUT ANY WARRANTY WHATSOEVER. For details, see the file LICENSE
00009 * in the root directory or <http://www.gnu.org/licenses/gpl-3.0.html>.
00010 ******************************************************************************/
00011 
00012 #include "renderer.hpp"
00013 #include "Widkit/Event/attribute_event.hpp"
00014 
00015 /******************************************************************************
00016 * Events for getting attributes
00017 ******************************************************************************/
00018 
00019 get_integer_event_rep::get_integer_event_rep (string w2, int& i2):
00020   event_rep (GET_INTEGER_EVENT), which (w2), i (i2) {}
00021 get_integer_event_rep::operator tree () {
00022   return tree (TUPLE, "get_integer_event", which); }
00023 event get_integer (string which, int& i) {
00024   return tm_new<get_integer_event_rep> (which, i); }
00025 
00026 get_double_event_rep::get_double_event_rep (string w2, double& x2):
00027   event_rep (GET_DOUBLE_EVENT), which (w2), x (x2) {}
00028 get_double_event_rep::operator tree () {
00029   return tree (TUPLE, "get_double_event", which); }
00030 event get_double (string which, double& x) {
00031   return tm_new<get_double_event_rep> (which, x); }
00032 
00033 get_string_event_rep::get_string_event_rep (string w2, string& s2):
00034   event_rep (GET_STRING_EVENT), which (w2), s (s2) {}
00035 get_string_event_rep::operator tree () {
00036   return tree (TUPLE, "get_string_event", which); }
00037 event get_string (string which, string& s) {
00038   return tm_new<get_string_event_rep> (which, s); }
00039 
00040 get_coord1_event_rep::get_coord1_event_rep (string w2, SI& c1b):
00041   event_rep (GET_COORD1_EVENT), which (w2), c1 (c1b) {}
00042 get_coord1_event_rep::operator tree () {
00043   return tree (TUPLE, "get_coord1_event", which); }
00044 event get_coord1 (string which, SI& c1) {
00045   return tm_new<get_coord1_event_rep> (which, c1); }
00046 
00047 get_coord2_event_rep::get_coord2_event_rep (string w2, SI& c1b, SI& c2b):
00048   event_rep (GET_COORD2_EVENT), which (w2), c1 (c1b), c2 (c2b) {}
00049 get_coord2_event_rep::operator tree () {
00050   return tree (TUPLE, "get_coord2_event", which); }
00051 event get_coord2 (string which, SI& c1, SI& c2) {
00052   return tm_new<get_coord2_event_rep> (which, c1, c2); }
00053 
00054 get_coord3_event_rep::get_coord3_event_rep (string w2,
00055   SI& c1b, SI& c2b, SI& c3b): event_rep (GET_COORD3_EVENT),
00056     which (w2), c1 (c1b), c2 (c2b), c3 (c3b) {}
00057 get_coord3_event_rep::operator tree () {
00058   return tree (TUPLE, "get_coord3_event", which); }
00059 event get_coord3 (string which, SI& c1, SI& c2, SI& c3) {
00060   return tm_new<get_coord3_event_rep> (which, c1, c2, c3); }
00061 
00062 get_coord4_event_rep::get_coord4_event_rep (string w2,
00063   SI& c1b, SI& c2b, SI& c3b, SI& c4b): event_rep (GET_COORD4_EVENT),
00064     which (w2), c1 (c1b), c2 (c2b), c3 (c3b), c4 (c4b) {}
00065 get_coord4_event_rep::operator tree () {
00066   return tree (TUPLE, "get_coord4_event", which); }
00067 event get_coord4 (string which, SI& c1, SI& c2, SI& c3, SI& c4) {
00068   return tm_new<get_coord4_event_rep> (which, c1, c2, c3, c4); }
00069 
00070 /******************************************************************************
00071 * Events for setting attributes
00072 ******************************************************************************/
00073 
00074 set_integer_event_rep::set_integer_event_rep (string w2, int i2):
00075   event_rep (SET_INTEGER_EVENT), which (w2), i (i2) {}
00076 set_integer_event_rep::operator tree () {
00077   return tree (TUPLE, "set_integer_event", which, as_string (i)); }
00078 event set_integer (string which, int i) {
00079   return tm_new<set_integer_event_rep> (which, i); }
00080 
00081 set_double_event_rep::set_double_event_rep (string w2, double x2):
00082   event_rep (SET_DOUBLE_EVENT), which (w2), x (x2) {}
00083 set_double_event_rep::operator tree () {
00084   return tree (TUPLE, "set_double_event", which, as_string (x)); }
00085 event set_double (string which, double x) {
00086   return tm_new<set_double_event_rep> (which, x); }
00087 
00088 set_string_event_rep::set_string_event_rep (string w2, string s2):
00089   event_rep (SET_STRING_EVENT), which (w2), s (s2) {}
00090 set_string_event_rep::operator tree () {
00091   return tree (TUPLE, "set_string_event", which, s); }
00092 event set_string (string which, string s) {
00093   return tm_new<set_string_event_rep> (which, s); }
00094 
00095 set_coord1_event_rep::set_coord1_event_rep (string w2, SI c1b):
00096   event_rep (SET_COORD1_EVENT), which (w2), c1 (c1b) {}
00097 set_coord1_event_rep::operator tree () {
00098   return tree (TUPLE, "set_coord1_event", which, as_string (c1/PIXEL)); }
00099 event set_coord1 (string which, SI c1) {
00100   return tm_new<set_coord1_event_rep> (which, c1); }
00101 
00102 set_coord2_event_rep::set_coord2_event_rep (string w2, SI c1b, SI c2b):
00103   event_rep (SET_COORD2_EVENT), which (w2), c1 (c1b), c2 (c2b) {}
00104 set_coord2_event_rep::operator tree () {
00105   return tree (TUPLE, "set_coord2_event", which,
00106               as_string (c1/PIXEL), as_string (c2/PIXEL)); }
00107 event set_coord2 (string which, SI c1, SI c2) {
00108   return tm_new<set_coord2_event_rep> (which, c1, c2); }
00109 
00110 set_coord3_event_rep::set_coord3_event_rep (string w2,
00111   SI c1b, SI c2b, SI c3b): event_rep (SET_COORD3_EVENT),
00112     which (w2), c1 (c1b), c2 (c2b), c3 (c3b) {}
00113 set_coord3_event_rep::operator tree () {
00114   tree t (TUPLE, "set_coord3_event", which);
00115   t << as_string (c1/PIXEL) << as_string (c2/PIXEL) << as_string (c3/PIXEL);
00116   return t; }
00117 event set_coord3 (string which, SI c1, SI c2, SI c3) {
00118   return tm_new<set_coord3_event_rep> (which, c1, c2, c3); }
00119 
00120 set_coord4_event_rep::set_coord4_event_rep (string w2,
00121   SI c1b, SI c2b, SI c3b, SI c4b): event_rep (SET_COORD4_EVENT),
00122     which (w2), c1 (c1b), c2 (c2b), c3 (c3b), c4 (c4b) {}
00123 set_coord4_event_rep::operator tree () {
00124   tree t (TUPLE, 6);
00125   t[0]= "set_coord4_event";
00126   t[1]= which;
00127   t[2]= as_string (c1/PIXEL);
00128   t[3]= as_string (c2/PIXEL);
00129   t[4]= as_string (c3/PIXEL);
00130   t[5]= as_string (c4/PIXEL);
00131   return t; }
00132 event set_coord4 (string which, SI c1, SI c2, SI c3, SI c4) {
00133   return tm_new<set_coord4_event_rep> (which, c1, c2, c3, c4); }