1 /********************************************************************
2 This file is part of the abs 0.907 distribution. abs is a spreadsheet
3 with graphical user interface.
4
5 Copyright (C) 1998-2001 Andr� Bertin (Andre.Bertin@ping.be)
6
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version if in the same spirit as version 2.
11
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20
21 Concact: abs@pi.be
22 http://home.pi.be/bertin/abs.shtml
23
24 *********************************************************************/
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54 #include "button_vb.h"
55 #include "application.h"
56 #include "libfct.h"
57
58 obj
vb_buttons_add(int narg,obj * arg)59 vb_buttons_add (int narg, obj * arg)
60 {
61 obj o;
62 int coord[4];
63 Worksheet *w;
64
65 o = arg[0];
66
67 if (o.type == MEMBER)
68 {
69 obj *workobj = (obj *) o.rec.s;
70 w = (Worksheet *) workobj->rec.s;
71 }
72 else
73 w = ActiveWorksheet;
74
75 if (narg == 5)
76 {
77 coord[0] = obj2int (arg[1]);
78 coord[1] = obj2int (arg[2]);
79 coord[2] = obj2int (arg[3]);
80 coord[3] = obj2int (arg[4]);
81 }
82
83 o.type = BUTTON;
84 o.label = arrayclass[BUTTON].name;
85 o.rec.s = (char *) worksheet_addbutton (w, coord, narg - 1);
86 return o;
87 }
88
89 obj
vb_button_getonaction(narg,arg)90 vb_button_getonaction (narg, arg)
91 int narg;
92 obj *arg;
93 {
94 obj o;
95 return o;
96 }
97
98 obj
vb_button_setonaction(narg,arg)99 vb_button_setonaction (narg, arg)
100 int narg;
101 obj *arg;
102 {
103 obj o;
104 obj *base = (obj *) arg[0].rec.s;
105 Button *btn = (Button *) base->rec.s;
106 o.rec.i = button_setmacro (btn, obj2string (arg[1]));
107 o.type = INTEGER;
108 o.label = NULL;
109 return o;
110 }
111
112 obj
vb_button_gettext(narg,arg)113 vb_button_gettext (narg, arg)
114 int narg;
115 obj *arg;
116 {
117 obj o;
118 return o;
119 }
120
121 obj
vb_button_settext(narg,arg)122 vb_button_settext (narg, arg)
123 int narg;
124 obj *arg;
125 {
126 obj o;
127 obj *base = (obj *) arg[0].rec.s;
128 Button *btn = (Button *) base->rec.s;
129 o.rec.i = button_setlabel (btn, obj2string (arg[1]));
130 o.type = INTEGER;
131 o.label = NULL;
132 return o;
133 }
134