source: golgotha/src/i4/menu/menu.hh @ 80

Last change on this file since 80 was 80, checked in by Sam Hocevar, 11 years ago
  • Adding the Golgotha source code. Not sure what's going to be interesting in there, but since it's all public domain, there's certainly stuff to pick up.
File size: 2.6 KB
Line 
1/********************************************************************** <BR>
2  This file is part of Crack dot Com's free source code release of
3  Golgotha. <a href="http://www.crack.com/golgotha_release"> <BR> for
4  information about compiling & licensing issues visit this URL</a>
5  <PRE> If that doesn't help, contact Jonathan Clark at
6  golgotha_source@usa.net (Subject should have "GOLG" in it)
7***********************************************************************/
8
9#ifndef __MENU_HPP_
10#define __MENU_HPP_
11
12#include "window/window.hh"
13#include "error/error.hh"
14#include "menu/menuitem.hh"
15#include "string/string.hh"
16
17class i4_menu_class : public i4_menu_item_parent_class
18{
19  // when a menu_item sends it's a press event should the menu hide itself?
20  i4_bool           hide_on_pick; 
21  i4_bool           deleted;             // debugging tool so we can see if we already got events
22
23  i4_event_handler_class *focus_inform;
24public:
25
26  virtual void notify_focus_change(i4_event_handler_class *who)
27  { focus_inform=who; }
28
29  // show should make the menu visible on the screen
30  virtual void show(i4_parent_window_class *show_on, i4_coord x, i4_coord y) = 0;
31
32  virtual void hide() = 0;
33
34  // apps should call hide() before add_item()
35  virtual void add_item(i4_menu_item_class *item);
36 
37  virtual void receive_event(i4_event *ev);
38
39  i4_menu_class(i4_bool hide_on_pick)
40    : hide_on_pick(hide_on_pick)
41  {
42    focus_inform=0;
43    deleted=i4_F;
44  }
45  virtual ~i4_menu_class();
46
47
48  virtual void add_child(i4_coord x, i4_coord y, i4_window_class *child)
49  { i4_error("use add_item"); }
50
51  virtual void note_reaction_sent(i4_menu_item_class *who,       // this is who sent it
52                                  i4_event_reaction_class *ev,   // who it was to
53                                  i4_menu_item_class::reaction_type type);
54} ;
55
56class i4_menu_focus_event_class : public i4_object_message_event_class
57{
58public:
59  enum focus_state_type { got_focus, lost_focus } focus_state;
60  i4_window_class *lost_to;
61
62  i4_menu_focus_event_class(i4_menu_class *menu,
63                            focus_state_type state,
64                            i4_window_class *lost_to)
65    :  i4_object_message_event_class(menu),
66       focus_state(state),
67       lost_to(lost_to)
68  {}
69
70  virtual i4_event  *copy()
71  {
72    return new i4_menu_focus_event_class((i4_menu_class *)object,
73                                              focus_state,
74                                              lost_to);
75  }
76 
77  char *name() { return "menu lost focus"; }
78};
79
80
81#endif
Note: See TracBrowser for help on using the repository browser.