Ignore:
Timestamp:
Mar 15, 2008, 12:55:44 AM (11 years ago)
Author:
Sam Hocevar
Message:
  • Rename the "eh" variable to "wm" because it's a window manager, not an event handler.
  • No longer pass the window manager to functions, there's only one.

Inspired by Win32 Abuse changelog for January 28, 2001:

  • Starting work on singleton code; will get rid of all

references to an arbitrary window_manager* because
there's only going to be one, and it's not ever
going to change.

File:
1 edited

Legend:

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

    r57 r106  
    1313#include "filter.hpp"
    1414
     15extern window_manager *wm; /* FIXME: get rid of this if possible */
    1516
    1617class button : public ifield
     
    2526  button(int X, int Y, int ID, image *Depressed, image *Pressed, image *active, ifield *Next);
    2627
    27   virtual void area(int &x1, int &y1, int &x2, int &y2, window_manager *wm);
    28   virtual void draw_first(image *screen, window_manager *wm);
    29   virtual void draw(int active, image *screen, window_manager *wm);
    30   virtual void handle_event(event &ev, image *screen, window_manager *wm, input_manager *im);
     28  virtual void area(int &x1, int &y1, int &x2, int &y2);
     29  virtual void draw_first(image *screen);
     30  virtual void draw(int active, image *screen);
     31  virtual void handle_event(event &ev, image *screen, input_manager *im);
    3132  void change_visual(image *new_visual);
    3233  virtual void remap(filter *f);
     
    4748  void press_button(int id);      // if button box doesn't contain id, nothing happens
    4849  virtual void remap(filter *f);
    49   virtual void area(int &x1, int &y1, int &x2, int &y2, window_manager *wm);
    50   virtual void draw_first(image *screen, window_manager *wm);
    51   virtual void draw(int active, image *screen, window_manager *wm);
    52   virtual void handle_event(event &ev, image *screen, window_manager *wm, input_manager *im); 
     50  virtual void area(int &x1, int &y1, int &x2, int &y2);
     51  virtual void draw_first(image *screen);
     52  virtual void draw(int active, image *screen);
     53  virtual void handle_event(event &ev, image *screen, input_manager *im); 
    5354  virtual ~button_box();
    5455  virtual char *read();   // return pointer to first button which is depressed
    5556  virtual ifield *find(int search_id);  // should return pointer to item you control with this id
    56   void arrange_left_right(window_manager *wm);
    57   void arrange_up_down(window_manager *wm);
     57  void arrange_left_right();
     58  void arrange_up_down();
    5859} ;
    5960
     
    6263  int cur;
    6364  char *prompt,*data,*format;
    64   int xstart(window_manager *wm) { return x+wm->font()->width()*(strlen(prompt)+1)+3; }
    65   int xend(window_manager *wm) { return x+wm->font()->width()*(strlen(prompt)+1+strlen(format))+7; }
    66   int yend(window_manager *wm) { return y+wm->font()->height()+5; }
    67   void draw_cur(int color, image *screen, window_manager *wm);
     65  int xstart() { return x+wm->font()->width()*(strlen(prompt)+1)+3; }
     66  int xend() { return x+wm->font()->width()*(strlen(prompt)+1+strlen(format))+7; }
     67  int yend() { return y+wm->font()->height()+5; }
     68  void draw_cur(int color, image *screen);
    6869  int last_spot() { int x=strlen(data); while (x && data[x-1]==' ') x--; return x; }
    69   void draw_text(image *screen, window_manager *wm)
     70  void draw_text(image *screen)
    7071  {
    71     screen->bar(xstart(wm)+1,y+1,xend(wm)-1,yend(wm)-1,wm->dark_color());
    72     wm->font()->put_string(screen,xstart(wm)+1,y+3,data);
     72    screen->bar(xstart()+1,y+1,xend()-1,yend()-1,wm->dark_color());
     73    wm->font()->put_string(screen,xstart()+1,y+3,data);
    7374  }
    7475public :
     
    7879                               double Data, ifield *Next);
    7980
    80   virtual void area(int &x1, int &y1, int &x2, int &y2, window_manager *wm);
    81   virtual void draw_first(image *screen, window_manager *wm);
    82   virtual void draw(int active, image *screen, window_manager *wm);
    83   virtual void handle_event(event &ev, image *screen, window_manager *wm, input_manager *im);
     81  virtual void area(int &x1, int &y1, int &x2, int &y2);
     82  virtual void draw_first(image *screen);
     83  virtual void draw(int active, image *screen);
     84  virtual void handle_event(event &ev, image *screen, input_manager *im);
    8485 
    8586  virtual ~text_field() { jfree(prompt); jfree(format); jfree(data); }
    8687  virtual char *read();
    8788  void change_data(char const *new_data, int new_cursor,       // cursor==-1, does not change it.
    88                    int active, image *screen, window_manager *wm);
     89                   int active, image *screen);
    8990} ;
    9091
     
    9899public :
    99100  info_field(int X, int Y, int ID, char const *info, ifield *Next);
    100   virtual void area(int &x1, int &y1, int &x2, int &y2, window_manager *wm);
    101   virtual void draw_first(image *screen, window_manager *wm);
    102   virtual void draw(int active, image *screen, window_manager *wm) { ; }
    103   virtual void handle_event(event &ev, image *screen, window_manager *wm, input_manager *im) { ; }
     101  virtual void area(int &x1, int &y1, int &x2, int &y2);
     102  virtual void draw_first(image *screen);
     103  virtual void draw(int active, image *screen) { ; }
     104  virtual void handle_event(event &ev, image *screen, input_manager *im) { ; }
    104105  virtual char *read() { return text; }
    105106  virtual int selectable() { return 0; }
Note: See TracChangeset for help on using the changeset viewer.