chiark / gitweb /
Initial revision
[ssr] / StraySrc / Libraries / Steel / c / baricon
1 /*
2  * baricon
3  *  stripped down version (uses ibicon)
4  *
5  * © 1993-1998 Straylight
6  *
7  */
8
9 /*----- Licensing note ----------------------------------------------------*
10  *
11  * This file is part of Straylight's Steel library.
12  *
13  * Steel is free software; you can redistribute it and/or modify
14  * it under the terms of the GNU General Public License as published by
15  * the Free Software Foundation; either version 2, or (at your option)
16  * any later version.
17  *
18  * Steel is distributed in the hope that it will be useful,
19  * but WITHOUT ANY WARRANTY; without even the implied warranty of
20  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
21  * GNU General Public License for more details.
22  *
23  * You should have received a copy of the GNU General Public License
24  * along with Steel.  If not, write to the Free Software Foundation,
25  * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
26  */
27
28 #include "baricon.h"
29
30 static ibicon baricon__icon;
31 static baricon_clickproc baricon__proc;
32
33 static void baricon__events(ibicon i,ibicon_eventType t,void *handle)
34 {
35   handle=handle;
36   i=i;
37   if (t==ibicon_LEFTCLICK)
38     baricon__proc(ibicon_syshandle(baricon__icon));
39 }
40
41 wimp_i baricon(char *spritename,int spritearea,baricon_clickproc p)
42 {
43   baricon__icon=ibicon_create
44   (
45     ibicon_RIGHT,
46     spritename,
47     (sprite_area *)spritearea,
48     0,
49     0
50   );
51   ibicon_eventHandler(baricon__icon,baricon__events,0);
52   baricon__proc=p;
53   return (ibicon_syshandle(baricon__icon));
54 }
55
56 wimp_i baricon_left(char *spritename,int spritearea,baricon_clickproc p)
57 {
58   baricon__icon=ibicon_create
59   (
60     ibicon_LEFT,
61     spritename,
62     (sprite_area *)spritearea,
63     0,
64     0
65   );
66   ibicon_eventHandler(baricon__icon,baricon__events,0);
67   baricon__proc=p;
68   return (ibicon_syshandle(baricon__icon));
69 }
70
71 wimp_i baricon_textandsprite
72 (
73   char *spritename,
74   char *text,
75   int bufflen,
76   int spritearea,
77   baricon_clickproc p
78 )
79 {
80   baricon__icon=ibicon_create
81   (
82     ibicon_RIGHT,
83     spritename,
84     (sprite_area *)spritearea,
85     text,
86     bufflen-1
87   );
88   ibicon_eventHandler(baricon__icon,baricon__events,0);
89   baricon__proc=p;
90   return (ibicon_syshandle(baricon__icon));
91 }  
92
93 wimp_i baricon_textandsprite_left
94 (
95   char *spritename,
96   char *text,
97   int bufflen,
98   int spritearea,
99   baricon_clickproc p
100 )
101 {
102   baricon__icon=ibicon_create
103   (
104     ibicon_LEFT,
105     spritename,
106     (sprite_area *)spritearea,
107     text,
108     bufflen-1
109   );
110   ibicon_eventHandler(baricon__icon,baricon__events,0);
111   baricon__proc=p;
112   return (ibicon_syshandle(baricon__icon));  
113 }  
114
115 wimp_i baricon_newsprite(char *newsprite)
116 {
117   ibicon_changeSprite(baricon__icon,newsprite);
118   return (ibicon_syshandle(baricon__icon));  
119 }
120
121 wimp_i baricon_newtext(char *newtext)
122 {
123   ibicon_changeText(baricon__icon,newtext);
124   return (ibicon_syshandle(baricon__icon));  
125 }