Ignore:
Timestamp:
May 13, 2011, 9:13:53 AM (11 years ago)
Author:
Sam Hocevar
Message:

imlib: refactor Event and EventHandler?.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • abuse/trunk/src/imlib/jwindow.h

    r579 r643  
    1111#ifndef __JWIN__
    1212#define __JWIN__
     13
    1314#include "video.h"
    1415#include "image.h"
    1516#include "event.h"
    1617#include "filter.h"
    17 #include "event.h"
    1818#include "fonts.h"
    1919
     
    4040
    4141public:
    42   InputManager(image *Screen, ifield *First);
    43   InputManager(Jwindow *owner, ifield *First);
    44   void handle_event(event &ev, Jwindow *j);
     42  InputManager(image *screen, ifield *first);
     43  InputManager(Jwindow *owner, ifield *first);
     44  void handle_event(Event &ev, Jwindow *j);
    4545  ifield *get(int id);
    4646  void redraw();
     
    7474    virtual void draw_first(image *screen) = 0;
    7575    virtual void draw(int active, image *screen) = 0;
    76     virtual void handle_event(event &ev, image *screen, InputManager *im) = 0;
     76    virtual void handle_event(Event &ev, image *screen, InputManager *im) = 0;
    7777    virtual int selectable() { return 1; }
    7878    virtual void remap(Filter *f) { ; }
     
    133133};
    134134
    135 class WindowManager
     135class WindowManager : public EventHandler
    136136{
    137137    friend class Jwindow;
     
    142142
    143143public:
    144     event_handler *eh;
     144    WindowManager(image *, palette *, int hi, int med, int low, JCFont *);
     145    ~WindowManager();
     146
    145147    Jwindow *first, *grab;
    146     image *screen, *mouse_pic, *mouse_save;
    147     palette *pal;
     148    image *mouse_pic, *mouse_save;
    148149    int hi, med, low, bk; // bright, medium, dark and black colors
    149150    int key_state[512];
     
    152153    Jwindow *drag_window;
    153154    JCFont *fnt, *wframe_fnt;
    154 
    155     WindowManager(image *, palette *, int hi, int med, int low, JCFont *);
    156     ~WindowManager();
    157155
    158156    Jwindow *new_window(int x, int y, int l, int h,
     
    164162    void resize_window(Jwindow *j, int l, int h);
    165163    void move_window(Jwindow *j, int x, int y);
    166     void get_event(event &ev);
    167     void push_event(event *ev) { eh->push_event(ev); }
    168     int event_waiting() { return eh->event_waiting(); }
     164    void get_event(Event &ev);
    169165    void flush_screen();
    170166    int bright_color() { return hi; }
     
    174170    void set_colors(int Hi, int Med, int Low) { hi=Hi; med=Med; low=Low; }
    175171    JCFont *font() { return fnt; }
    176     int has_mouse() { return eh->has_mouse(); }
    177     void mouse_status(int &x, int &y, int &button) { eh->mouse_status(x,y,button); }
    178     void set_mouse_shape(image *im, int centerx, int centery)
    179     { eh->set_mouse_shape(im,centerx,centery); }
    180 
    181     void set_mouse_position(int mx, int my)
    182     { eh->set_mouse_position(mx,my); }
    183172
    184173    int key_pressed(int x) { return key_state[x]; }
     
    191180    void release_focus();
    192181    int window_in_area(int x1, int y1, int x2, int y2); // true if a window lies in this area
     182
     183private:
     184    palette *m_pal;
     185    image *m_screen;
    193186};
    194187
Note: See TracChangeset for help on using the changeset viewer.