Back to index

texmacs  1.0.7.15
scroll_event.cpp
Go to the documentation of this file.
00001 
00002 /******************************************************************************
00003 * MODULE     : scroll_event.cpp
00004 * DESCRIPTION: Events for scrollbars and scrollable widgets
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/wk_widget.hpp"
00014 #include "Widkit/Event/scroll_event.hpp"
00015 
00016 /******************************************************************************
00017 * The scroll event
00018 ******************************************************************************/
00019 
00020 scroll_event_rep::scroll_event_rep (string which2, SI& c1b, SI& c2b, SI& c3b):
00021   event_rep (SCROLL_EVENT), which (which2), c1 (c1b), c2 (c2b), c3 (c3b) {}
00022 scroll_event_rep::operator tree () {
00023   tree t (TUPLE, "scroll_event", which);
00024   t << as_string (c1/PIXEL) << as_string (c2/PIXEL) << as_string (c3/PIXEL);
00025   return t; }
00026 
00027 /******************************************************************************
00028 * Other events for internal use
00029 ******************************************************************************/
00030 
00031 event get_width (SI& w) { return get_coord1 ("width", w); }
00032 event get_height (SI& h) { return get_coord1 ("height", h); }
00033 event set_hor_bar (wk_widget bar) { return set_widget ("hor-bar",bar); }
00034 event set_ver_bar (wk_widget bar) { return set_widget ("ver-bar",bar); }
00035 event emit_bar_set_extents (SI min, SI max) {
00036   return set_coord2 ("extents", min, max); }
00037 event emit_bar_scroll_to (SI pos) {
00038   return set_coord1 ("scroll position", pos); }
00039 event emit_scroll (SI& c1, SI& c2, SI& c3) {
00040   return tm_new<scroll_event_rep> ("this", c1, c2, c3); }
00041 event emit_hor_scroll (SI& c1, SI& c2, SI& c3) {
00042   return tm_new<scroll_event_rep> ("hor-bar", c1, c2, c3); }
00043 event emit_ver_scroll (SI& c1, SI& c2, SI& c3) {
00044   return tm_new<scroll_event_rep> ("ver-bar", c1, c2, c3); }
00045 
00046 /******************************************************************************
00047 * Exported events
00048 ******************************************************************************/
00049 
00050 event set_extents(SI x1, SI y1, SI x2, SI y2) {
00051   return set_coord4 ("extents", x1, y1, x2, y2); }
00052 event get_extents (SI& x1, SI& y1, SI& x2, SI& y2) {
00053   return get_coord4 ("extents", x1, y1, x2, y2); }
00054 event get_visible (SI& x1, SI& y1, SI& x2, SI& y2) {
00055   return get_coord4 ("visible", x1, y1, x2, y2); }
00056 event set_scroll_pos (SI x, SI y) {
00057   return set_coord2 ("scroll position", x, y); }
00058 event get_scroll_pos (SI& x, SI& y) {
00059   return get_coord2 ("scroll position", x, y); }