home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Vectronix 2
/
VECTRONIX2.iso
/
FILES_07
/
ACS.ZIP
/
ACS
/
SCHIEBER
/
SCHIEBER.C
next >
Wrap
C/C++ Source or Header
|
1992-01-28
|
2KB
|
97 lines
/*
Beispielapplikation für ACS
"Schieber"
27.9.91 Stefan Bachert
*/
#include <stdio.h>
#include <string.h>
#include <acs.h>
#include <slider.h>
#include <slid.h>
static void show_ver (void);
static void show_hor (void);
static Awindow *slid_make (void *not_used);
# include <slider.ah>
static void show_ver (void)
/*
* Zeige Wert des Sliders an
*/
{
AOBJECT *aob;
SL_DATA *vsl;
aob = (AOBJECT *) ev_object + ev_obnr + 1;
vsl = aob-> userp1;
sprintf (ev_object [VER_VALUE]. ob_spec. free_string, "%d", vsl-> pos);
(ev_window-> obchange) (ev_window, VER_VALUE, ev_window-> work [VER_VALUE]. ob_state);
}
static void show_hor (void)
/*
* Zeige Wert des Sliders an
*/
{
AOBJECT *aob;
SL_DATA *hsl;
aob = (AOBJECT *) ev_object + ev_obnr + 1;
hsl = aob-> userp1;
sprintf (ev_object [HOR_VALUE]. ob_spec. free_string, "%d", hsl-> pos);
(ev_window-> obchange) (ev_window, HOR_VALUE, ev_window-> work [HOR_VALUE]. ob_state);
}
static Awindow *slid_make (void *not_used)
/*
* Erzeuge Schieber Fenster
*/
{
Awindow *wi;
AOBJECT *aob;
SL_DATA *hsl, *vsl;
static SL_DATA slider_proto = { 200, 30, 30, 10};
wi = Awi_create (&SCHIEBER);
if (wi == NULL) return NULL;
hsl = Ax_malloc (sizeof (SL_DATA)); /* fetch data struct */
vsl = Ax_malloc (sizeof (SL_DATA)); /* fetch data struct */
if (hsl == NULL || vsl == NULL) return NULL;
memcpy (hsl, &slider_proto, sizeof (SL_DATA));
memcpy (vsl, &slider_proto, sizeof (SL_DATA));
aob = (AOBJECT *) wi-> work + HOR_SLIDER + 1;
aob-> userp1 = hsl;
hsl_set (wi, HOR_SLIDER); /* initialisiere */
aob = (AOBJECT *) wi-> work + VER_SLIDER + 1;
aob-> userp1 = vsl;
vsl_set (wi, VER_SLIDER); /* initialisiere */
(wi-> open) (wi); /* öffne gleich */
return wi;
}
int ACSinit (void)
/*
* Doppelklick auf NEU erzeugt ein neues Fenster
*/
{
Awindow *window;
window = Awi_root (); /* root window */
if (window == NULL) return FAIL; /* lege NEU Icon an */
(window-> service) (window, AS_NEWCALL, &SCHIEBER. create);
return OK;
}