source: abuse/trunk/src/imlib/include/pmenu.hpp @ 39

Last change on this file since 39 was 39, checked in by Sam Hocevar, 15 years ago
  • Fix almost 2,000 warnings by using proper "const" keywords where needed.
File size: 2.1 KB
Line 
1#ifndef __PMENU_HPP_
2#define __PMENU_HPP_
3
4#include "jmalloc.hpp"
5#include "input.hpp"
6
7class psub_menu;
8
9class pmenu_item
10{
11  int hotkey;
12public :
13  char *n;
14  char const *on_off;
15  psub_menu *sub;
16
17  int id,xp;
18  pmenu_item *next;
19  pmenu_item(int ID, char const *name, char const *on_off_flag, int Hotkey, pmenu_item *Next);
20  pmenu_item(char const *Name, psub_menu *Sub, pmenu_item *Next, int xpos=-1);
21  char *name() { return n; }
22  pmenu_item *find_id(int search_id);
23  pmenu_item *find_key(int key);
24  void draw       (jwindow *parent, int x, int y, int w, int top, window_manager *wm, int active);
25  void draw_self  (jwindow *parent, int x, int y, int w, int top, window_manager *wm, int active);
26  int handle_event(jwindow *parent, int x, int y, int w, int top, window_manager *wm, event &ev);
27  int own_event(event &ev);
28  ~pmenu_item();
29} ;
30
31
32class psub_menu
33{
34  pmenu_item *first;
35  psub_menu *next;
36  int active;
37  window_manager *wm;
38  jwindow *win;
39  pmenu_item *item_num(int x) { pmenu_item *p=first; while (x-- && p) p=p->next; return p; }
40public :
41  void calc_size(int &w, int &h, window_manager *wm);
42  pmenu_item *find_id(int search_id);
43  pmenu_item *find_key(int key);
44  psub_menu(pmenu_item *First, psub_menu *Next)
45  { first=First; Next=Next; win=0; active=0; }
46  int handle_event(jwindow *parent, int x, int y, window_manager *wm, event &ev);
47  void draw(jwindow *parent, int x, int y, window_manager *wm);
48  void hide(jwindow *parent, int x, int y, window_manager *wm);
49  int own_event(event &ev);
50  ~psub_menu();
51} ;
52
53class pmenu
54{
55  window_manager *wm;
56  jwindow *bar;
57  pmenu_item *top,*active;
58  int itemw(pmenu_item *p, window_manager *wm)
59  { return strlen(p->name())*wm->font()->width()+2; }
60  int itemx(pmenu_item *p, window_manager *wm);
61  pmenu_item *inarea(int mx, int my, image *screen, window_manager *wm);
62public :
63  ~pmenu();
64  pmenu(int X, int Y, pmenu_item *first, image *screen, window_manager *wm);
65  void move(int new_x, int new_y);
66  void draw(image *screen, window_manager *wm, int top_only=0);
67  int handle_event(event &ev, image *screen, window_manager *wm); 
68
69} ;
70
71#endif
72
73
Note: See TracBrowser for help on using the repository browser.