source: golgotha/src/i4/lisp/li_dialog.hh @ 80

Last change on this file since 80 was 80, checked in by Sam Hocevar, 12 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: 4.0 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 LI_DIALOG_HH
10#define LI_DIALOG_HH
11
12
13#include "window/colorwin.hh"
14#include "lisp/lisp.hh"
15#include "lisp/li_optr.hh"
16
17class li_object;
18
19
20class li_type_edit_class
21{
22public:
23  // windows is a buffer of window *, maximum windows allowed is passed through max_windows
24  // and total # created is returned.
25  // o is the object being edited.  Property list is a generic 'looks' control parameter
26  virtual int create_edit_controls(const i4_const_str &name,
27                                   li_object *object,
28                                   li_object *property_list,
29                                   i4_window_class **windows,
30                                   int max_windows,
31                                   li_environment *env) = 0;
32
33  // returns true if user input is ok and 'apply' can be done : windows is the created
34  // window list from create_edit_controls
35  virtual i4_bool can_apply_edit_controls(li_object *objectw,
36                                          li_object *property_list,
37                                          i4_window_class **windows,
38                                          li_environment *env) { return i4_T; }
39
40  // returns a new instance of o (does not change o directly)
41  virtual li_object *apply_edit_controls(li_object *o,
42                                         li_object *property_list,
43                                         i4_window_class **windows,
44                                         li_environment *env) = 0;
45
46};
47
48
49class li_dialog_item : public i4_color_window_class
50{
51protected:
52  li_object_pointer o;
53  li_object *prop_list;
54
55public:
56  i4_window_class **windows;
57  int t_windows;
58
59  li_dialog_item();
60  li_dialog_item(const i4_const_str &name,
61                 li_object *o,
62                 li_object *prop_list,
63                 li_environment *env);
64
65  virtual i4_bool can_apply(li_environment *env);
66  virtual li_object *apply(li_environment *env);
67  virtual ~li_dialog_item();
68  char *name() { return "li_dialog_item"; }
69};
70
71
72class li_dialog_window_class : public i4_color_window_class
73{
74  i4_window_class *w[10]; 
75  li_object_pointer o, prop_list, new_value, enviroment;
76  li_function_type called_on_close;
77  li_environment *env() { return (li_environment *)enviroment.get(); }
78
79public:
80  i4_parent_window_class *mp_handle;
81
82  i4_graphical_style_class *style();
83  li_dialog_window_class(const i4_const_str &name,
84                         li_object *o,
85                         li_object *prop_list,
86                         li_function_type called_on_close,
87                         li_environment *env);
88
89
90  ~li_dialog_window_class();
91
92  void receive_event(i4_event *ev);
93  char *name() { return "li_dialog_window"; }
94};
95
96
97// function_called_on_delete (if supplied) gets 2 arguments, 1st is the new value,
98// 2nd is the old value
99li_dialog_window_class *li_create_dialog(const i4_const_str &name,
100                                         li_object *o,
101                                         li_object *prop_list=0,
102                                         char *function_called_on_close=0,
103                                         li_environment *env=0);  // for getting function
104
105li_dialog_window_class *li_create_dialog(const i4_const_str &name,
106                                         li_object *o,
107                                         li_object *prop_list=0,
108                                         li_function_type function_called_on_close=0,
109                                         li_environment *env=0);
110
111
112#endif
Note: See TracBrowser for help on using the repository browser.