source: abuse/trunk/src/imlib/pmenu.h @ 481

Last change on this file since 481 was 481, checked in by Sam Hocevar, 11 years ago

Fuck the history, I'm renaming all .hpp files to .h for my own sanity.

  • Property svn:keywords set to Id
File size: 2.0 KB
Line 
1/*
2 *  Abuse - dark 2D side-scrolling platform game
3 *  Copyright (c) 1995 Crack dot Com
4 *
5 *  This software was released into the Public Domain. As with most public
6 *  domain software, no warranty is made or implied by Crack dot Com or
7 *  Jonathan Clark.
8 */
9
10#ifndef __PMENU_HPP_
11#define __PMENU_HPP_
12
13#include "input.h"
14
15class psub_menu;
16
17class pmenu_item
18{
19  int hotkey;
20public :
21  char *n;
22  char const *on_off;
23  psub_menu *sub;
24
25  int id,xp;
26  pmenu_item *next;
27  pmenu_item(int ID, char const *name, char const *on_off_flag, int Hotkey, pmenu_item *Next);
28  pmenu_item(char const *Name, psub_menu *Sub, pmenu_item *Next, int xpos=-1);
29  char *name() { return n; }
30  pmenu_item *find_id(int search_id);
31  pmenu_item *find_key(int key);
32  void draw       (Jwindow *parent, int x, int y, int w, int top, int active);
33  void draw_self  (Jwindow *parent, int x, int y, int w, int top, int active);
34  int handle_event(Jwindow *parent, int x, int y, int w, int top, event &ev);
35  int own_event(event &ev);
36  ~pmenu_item();
37} ;
38
39
40class psub_menu
41{
42  pmenu_item *first;
43  psub_menu *next;
44  int active;
45  Jwindow *win;
46  pmenu_item *item_num(int x) { pmenu_item *p=first; while (x-- && p) p=p->next; return p; }
47public :
48  void calc_size(int &w, int &h);
49  pmenu_item *find_id(int search_id);
50  pmenu_item *find_key(int key);
51  psub_menu(pmenu_item *First, psub_menu *Next)
52  { first=First; Next=Next; win=0; active=0; }
53  int handle_event(Jwindow *parent, int x, int y, event &ev);
54  void draw(Jwindow *parent, int x, int y);
55  void hide(Jwindow *parent, int x, int y);
56  int own_event(event &ev);
57  ~psub_menu();
58} ;
59
60class pmenu
61{
62  Jwindow *bar;
63  pmenu_item *top,*active;
64  int itemw(pmenu_item *p)
65  { return strlen(p->name())*wm->font()->width()+2; }
66  int itemx(pmenu_item *p);
67  pmenu_item *inarea(int mx, int my, image *screen);
68public :
69  ~pmenu();
70  pmenu(int X, int Y, pmenu_item *first, image *screen);
71  void move(int new_x, int new_y);
72  void draw(image *screen, int top_only=0);
73  int handle_event(event &ev, image *screen);
74
75} ;
76
77#endif
78
79
Note: See TracBrowser for help on using the repository browser.