view icanvas.d @ 10:71ca82e0eb76

Checkpoint
author "David Bryant <bagnose@gmail.com>"
date Sat, 11 Jul 2009 22:49:41 +0930
parents 936feb16eed4
children fb571a3b1f0d
line wrap: on
line source

module icanvas;

import tk.geometry;
import tk.events;
import cairo.Context;

interface Viewport {
    void rel_zoom(Point screen_datum, double factor);
    void rel_pan(Vector screen_displacement);
    //void damage(Rectangle area);

    Point model_to_screen(Point model) const;
    Point screen_to_model(Point screen) const;
    Vector model_to_screen(Vector model) const;
    Vector screen_to_model(Vector screen) const;
    double model_to_screen(double model) const;
    double screen_to_model(double screen) const;
}

interface EventHandler {
    bool handle_button_press(Viewport viewport, in ButtonEvent event);
    bool handle_button_release(Viewport viewport, in ButtonEvent event);
    bool handle_motion(Viewport viewport, in MotionEvent event);
    bool handle_scroll(Viewport viewport, in ScrollEvent event);
    //bool handle_expose(Viewport viewport, ExposeEvent event);
    //bool handle_enter(Viewport viewport, CrossingEvent event);
    //bool handle_leave(Viewport viewport, CrossingEvent event);
    //bool handle_focus_in(Viewport viewport, FocusEvent event);
    //bool handle_focus_out(Viewport viewport, FocusEvent event);
    bool handle_key_press(Viewport viewport, in KeyEvent event);
    bool handle_key_release(Viewport viewport, in KeyEvent event);
}

abstract class Layer {
    void draw(const Viewport viewport, in Rectangle damage, Context cr) const;
}