File: men_choose.c

package info (click to toggle)
scilab 2.6-4
  • links: PTS
  • area: non-free
  • in suites: woody
  • size: 54,632 kB
  • ctags: 40,267
  • sloc: ansic: 267,851; fortran: 166,549; sh: 10,005; makefile: 4,119; tcl: 1,070; cpp: 233; csh: 143; asm: 135; perl: 130; java: 39
file content (65 lines) | stat: -rw-r--r-- 1,575 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
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
55
56
57
58
59
60
61
62
63
64
65
/* Copyright ENPC */
#ifdef WIN32 
#include "wmen_scilab.h" 
#else
#include "men_scilab.h"
#endif

int     ExposeChooseWindow();

/*****************************************
 * TestFunction 
 *****************************************/

int TestChoose()
{
  ChooseMenu Ch;
  int Rep;
  int nrep;
  static char *butn[]= { "But 1"," But 2",NULL};
  static char *strings[]= { "Str 1"," Str 2","Str 3",NULL};
  Ch.nstrings = 3;
  Ch.nb = 2; 
  Ch.choice = 0;
  Ch.description = " Title";
  Ch.buttonname = butn;
  Ch.strings = strings;
  Rep = ExposeChooseWindow(&Ch);
  if ( Rep == TRUE )
    nrep=(1+ Ch.choice);
  else nrep=0;
  return (nrep);
}

/*****************************************
 * Interface with a Scilab ``structure'' 
 *****************************************/

void C2F(xchoose)(desc,ptrdesc,nd,basstrings,ptrstrings,nstring,btn,ptrbtn,nb,nrep,ierr)
     int *desc,*ptrdesc,*nd,*basstrings,*nstring,*ptrstrings,*btn,*nb,*ptrbtn,*nrep,*ierr;
{
  ChooseMenu Ch;
  int Rep,i;
  *ierr=0;
  Ch.nstrings = *nstring;
  Ch.nb = *nb;
  Ch.choice = 0;
  ScilabMStr2C(desc,nd,ptrdesc,&(Ch.description),ierr);
  if ( *ierr == 1) return;
  ScilabMStr2CM(btn,nb,ptrbtn,&(Ch.buttonname),ierr);
  if ( *ierr == 1) return;
  ScilabMStr2CM(basstrings,&(Ch.nstrings),ptrstrings,&(Ch.strings),ierr);
  Rep = ExposeChooseWindow(&Ch);
  for (i=0 ; i < Ch.nstrings ; i++ ) FREE(Ch.strings[i]);
  FREE(Ch.strings); 
  FREE(Ch.description);
  for (i=0 ; i < Ch.nb ; i++ )FREE(Ch.buttonname[i]);
  FREE(Ch.buttonname);
  if ( Rep == TRUE )
    *nrep=(1+ Ch.choice);
  else *nrep=0;
}