Ignore:
Timestamp:
Mar 15, 2008, 10:19:47 PM (11 years ago)
Author:
Sam Hocevar
Message:
  • Started cleaning up jwindow.cpp, preparing everything for future Abuse Win32 merges.
File:
1 edited

Legend:

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

    r106 r109  
    3333#define WINDOW_FRAME_RIGHT frame_right()
    3434
    35 
    3635class input_manager
    3736{
     37  friend class jwindow;
     38
     39private:
    3840  image *screen;
    39   ifield *first,*active,*grab;
    40   jwindow *cur;
     41  ifield *first, *active, *grab;
     42  jwindow *cur, *owner;
    4143  int no_selections_allowed;
    42 public :
     44
     45public:
    4346  input_manager(image *Screen, ifield *First);
     47  input_manager(jwindow *owner, ifield *First);
    4448  void handle_event(event &ev, jwindow *j);
    4549  ifield *get(int id);
     
    5862class ifield
    5963{
     64    friend class jwindow;
     65    friend class input_manager;
     66
     67protected:
     68    jwindow *owner;
     69
    6070public :
    61   int x,y;
     71    ifield();
     72    int x, y;
    6273
    63   int id;
    64   ifield *next;
    65   virtual void area(int &x1, int &y1, int &x2, int &y2) = 0;
    66   virtual void draw_first(image *screen)              = 0;
    67   virtual void draw(int active, image *screen)        = 0;
    68   virtual void handle_event(event &ev, image *screen, input_manager *im) = 0;
    69   virtual int selectable() { return 1; }
    70   virtual void remap(filter *f) { ; }
    71   virtual char *read() = 0;
    72   virtual ifield *find(int search_id) { if (id==search_id) return this; else return NULL; }
    73   virtual ifield *unlink(int id) { return NULL; }
    74   virtual ~ifield();
     74    int id;
     75    ifield *next;
     76    virtual void set_owner(jwindow *owner);
     77    virtual void move(int newx, int newy) { x = newx; y = newy; }
     78    virtual void area(int &x1, int &y1, int &x2, int &y2) = 0;
     79    virtual void draw_first(image *screen) = 0;
     80    virtual void draw(int active, image *screen) = 0;
     81    virtual void handle_event(event &ev, image *screen, input_manager *im) = 0;
     82    virtual int selectable() { return 1; }
     83    virtual void remap(filter *f) { ; }
     84    virtual char *read() = 0;
     85    virtual ifield *find(int search_id) { if (id==search_id) return this; else return NULL; }
     86    virtual ifield *unlink(int id) { return NULL; }
     87    virtual ~ifield();
    7588} ;
    7689
    7790struct jwindow_properties
    7891{
    79   uint8_t moveable,
    80           hidden;
    81 } ;
    82 
     92    bool moveable, hidden;
     93};
    8394
    8495class jwindow
    8596{
    86 public :
    87   jwindow_properties property;
    88   jwindow *next;
    89   char *name;
    90   int x,y,l,h,backg;
    91   image *screen;
    92   input_manager *inm;
    93   void *local_info;     // pointer to info block for local system (may support windows)
    94   jwindow(int X, int Y, int L, int H, ifield *fields, char const *Name=NULL);
    95   void redraw(int hi, int med, int low, JCFont *fnt);
    96   void resize(int L, int H);
    97   void clear(int color=0) { screen->bar(x1(),y1(),x2(),y2(),color); }
    98   int x1() { return WINDOW_FRAME_LEFT; }
    99   int y1() { return WINDOW_FRAME_TOP; }
    100   int x2() { return l-WINDOW_FRAME_RIGHT-1; }
    101   int y2() { return h-WINDOW_FRAME_BOTTOM-1; }
    102   void clip_in() { screen->set_clip(x1(),y1(),x2(),y2()); }
    103   void clip_out() { screen->set_clip(0,0,l-1,h-1); }
    104   char *read(int id) { return inm->get(id)->read(); } 
    105   void local_close();
    106   void set_moveability(int x);
    107   ~jwindow() { local_close(); delete screen; delete inm; jfree(name); }
     97    friend class input_manager;
     98
     99private:
     100    bool hidden;
     101    bool moveable;
     102
     103protected:
     104    jwindow *owner;
     105
     106public:
     107    jwindow *next;
     108    char *name;
     109    int x, y, l, h, backg;
     110    image *screen;
     111    input_manager *inm;
     112    void *local_info;  // pointer to info block for local system (may support windows)
     113    jwindow(int X, int Y, int L, int H, ifield *fields, char const *Name = NULL);
     114    void redraw(int hi, int med, int low, JCFont *fnt);
     115    void resize(int L, int H);
     116    void clear(int color = 0) { screen->bar(x1(), y1(), x2(), y2(), color); }
     117    void show() { hidden = false; }
     118    void hide() { hidden = true; }
     119    bool is_hidden() { return hidden; }
     120    void freeze() { moveable = false; }
     121    void thaw() { moveable = true; }
     122    bool is_moveable() { return moveable; }
     123    int x1() { return WINDOW_FRAME_LEFT; }
     124    int y1() { return WINDOW_FRAME_TOP; }
     125    int x2() { return l-WINDOW_FRAME_RIGHT-1; }
     126    int y2() { return h-WINDOW_FRAME_BOTTOM-1; }
     127    void clip_in() { screen->set_clip(x1(),y1(),x2(),y2()); }
     128    void clip_out() { screen->set_clip(0,0,l-1,h-1); }
     129    char *read(int id) { return inm->get(id)->read(); } 
     130    void local_close();
     131    ~jwindow() { local_close(); delete screen; delete inm; jfree(name); }
    108132} ;
    109133
    110134class window_manager
    111135{
    112 public :
     136  friend class jwindow;
     137
     138public:
    113139  event_handler *eh;
    114140  jwindow *first,*grab;
Note: See TracChangeset for help on using the changeset viewer.