IUP

Check-in [951ad214a6]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Extended matrix functionality bindings
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 951ad214a610173fc9d0bade20f03f6c081d4dc7
User & Date: murphy 2015-05-02 13:38:39
Context
2015-05-02
14:20
Link control bindings check-in: 5c793b4936 user: murphy tags: trunk
13:38
Extended matrix functionality bindings check-in: 951ad214a6 user: murphy tags: trunk
12:58
Progress dialog bindings check-in: 804b23a5a7 user: murphy tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to api/controls.wiki.

70
71
72
73
74
75
76
77
78
79








80
81
82
83
84
85
86

<h3><a id="progress-bar"><code><nowiki>(progress-bar #:<name> <value> ...) → ihandle?</nowiki></code></a></h3>

Creates a progress bar control.

<h2>Extended Controls</h2>

<h3><a id="matrix"><code><nowiki>(matrix [action (or/c symbol? string? #f) #f] #:<name> <value> ...) → ihandle?</nowiki></code></a></h3>

Creates a matrix of alphanumeric fields with a given action callback name.









<h3><a id="cells"><code><nowiki>(cells #:<name> <value> ...) → ihandle?</nowiki></code></a></h3>

Creates an element containing a grid of cells.

<h3><a id="color-bar"><code><nowiki>(color-bar #:<name> <value> ...) → ihandle?</nowiki></code></a></h3>








|

|
>
>
>
>
>
>
>
>







70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94

<h3><a id="progress-bar"><code><nowiki>(progress-bar #:<name> <value> ...) → ihandle?</nowiki></code></a></h3>

Creates a progress bar control.

<h2>Extended Controls</h2>

<h3><a id="matrix"><code><nowiki>(matrix [action (or/c symbol? string? #f) #f] [extended? boolean? #t] #:<name> <value> ...) → ihandle?</nowiki></code></a></h3>

Creates a matrix of alphanumeric fields with a given action callback
name. If <code>extended?</code> is not given or not false, extended
features will be enabled on the matrix control in case the underlying
library functionality is available.

<h3><a id="matrix-listbox"><code><nowiki>(matrix-listbox #:<name> <value> ...) → ihandle?</nowiki></code></a></h3>

Creates an interface element that displays a list of items, which is
backed by a matrix of alphanumeric fields.

<h3><a id="cells"><code><nowiki>(cells #:<name> <value> ...) → ihandle?</nowiki></code></a></h3>

Creates an element containing a grid of cells.

<h3><a id="color-bar"><code><nowiki>(color-bar #:<name> <value> ...) → ihandle?</nowiki></code></a></h3>

Changes to chicken/iup-controls.scm.

1
2
3
4
5
6
7






8
9
10
11
12
13
14
..
76
77
78
79
80
81
82

83







84




85
86
87
88
89
90
91
...
105
106
107
108
109
110
111





112
;; -*- mode: Scheme; tab-width: 2; -*- ;;

;; {{{ Data types

(foreign-declare
	"#include <iup.h>\n"
	"#include <iupcontrols.h>\n")






	
(include "iup-types.scm")

;; }}}

;; {{{ Standard controls

................................................................................

;; }}}

;; {{{ Extended controls

(define matrix
  (make-constructor-procedure

  	(foreign-lambda nonnull-ihandle "IupMatrix" iname/upcase)







  	#:apply-args (optional-args [action #f])))





(define cells
  (make-constructor-procedure
  	(foreign-lambda nonnull-ihandle "IupCells")))

(define color-bar
  (make-constructor-procedure
................................................................................
;; {{{ Library setup

(let ([status (foreign-value "IupControlsOpen()" istatus)])
	(case status
		[(#t ignore) (void)]
		[else        (error 'iup "failed to initialize library (~s)" status)]))






;; }}}







>
>
>
>
>
>







 







>
|
>
>
>
>
>
>
>
|
>
>
>
>







 







>
>
>
>
>

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
..
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
...
123
124
125
126
127
128
129
130
131
132
133
134
135
;; -*- mode: Scheme; tab-width: 2; -*- ;;

;; {{{ Data types

(foreign-declare
	"#include <iup.h>\n"
	"#include <iupcontrols.h>\n")

(cond-expand
 [disable-iup-matrixex]
 [else
	(foreign-declare
	 "#include <iupmatrixex.h>\n")])
	
(include "iup-types.scm")

;; }}}

;; {{{ Standard controls

................................................................................

;; }}}

;; {{{ Extended controls

(define matrix
  (make-constructor-procedure
	  (lambda (action extended?)
			(let ([handle ((foreign-lambda nonnull-ihandle "IupMatrix" iname/upcase) action)])
				(cond-expand
				 [disable-iup-matrixex
					handle]
				 [else
					(when extended?
						((foreign-lambda void "IupMatrixExInit" nonnull-ihandle) handle))
					handle])))
  	#:apply-args (optional-args [action #f] [extended? #t])))

(define matrix-listbox
  (make-constructor-procedure
  	(foreign-lambda nonnull-ihandle "IupMatrixList")))

(define cells
  (make-constructor-procedure
  	(foreign-lambda nonnull-ihandle "IupCells")))

(define color-bar
  (make-constructor-procedure
................................................................................
;; {{{ Library setup

(let ([status (foreign-value "IupControlsOpen()" istatus)])
	(case status
		[(#t ignore) (void)]
		[else        (error 'iup "failed to initialize library (~s)" status)]))

(cond-expand
 [disable-iup-matrixex]
 [else
	(foreign-code "IupMatrixExOpen();")])

;; }}}

Changes to chicken/iup.scm.

38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
(module iup-controls
	(canvas
	 frame tabs
	 label button toggle
	 spin spinbox valuator
	 textbox listbox treebox
	 progress-bar
	 matrix cells
	 color-bar color-browser
	 dial)
	(import
		scheme chicken foreign
		iup-base)
	(include "iup-controls.scm"))








|







38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
(module iup-controls
	(canvas
	 frame tabs
	 label button toggle
	 spin spinbox valuator
	 textbox listbox treebox
	 progress-bar
	 matrix matrix-listbox cells
	 color-bar color-browser
	 dial)
	(import
		scheme chicken foreign
		iup-base)
	(include "iup-controls.scm"))

Changes to chicken/iup.setup.

67
68
69
70
71
72
73





74
75
76
77
78
79
80
				'()]
			 [else
				'("iup-web.import.so")])))

(define native-libraries
	`("-lcallback"
		"-liup" "-liupim" "-liupimglib" "-liupcontrols"





		,@(cond-expand
			 [disable-iup-glcanvas
				'()]
			 [else
				'("-liupgl")])
		,@(cond-expand
			 [disable-iup-plot







>
>
>
>
>







67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
				'()]
			 [else
				'("iup-web.import.so")])))

(define native-libraries
	`("-lcallback"
		"-liup" "-liupim" "-liupimglib" "-liupcontrols"
		,@(cond-expand
			 [disable-iup-matrixex
				'()]
			 [else
				'("-liupmatrixex")])
		,@(cond-expand
			 [disable-iup-glcanvas
				'()]
			 [else
				'("-liupgl")])
		,@(cond-expand
			 [disable-iup-plot

Changes to racket/controls.rkt.

13
14
15
16
17
18
19







20
21
22
23
24
25
26
..
99
100
101
102
103
104
105










106







107
108
109
110
111
112
113
114
115
116
...
136
137
138
139
140
141
142
143






144

145
146
147
148
149
150
151
152
153
154
155
(define libiup-controls
  (case (system-type 'os)
    [(windows)
     (ffi-lib "iupcontrols")]
    [else
     (ffi-lib "libiupcontrols")]))








;; Standard controls

(define canvas
  (make-constructor-procedure
   (get-ffi-obj
    "IupCanvas" libiup
    (_fun ([action #f]) :: [action : _iname/upcase] -> [handle : _ihandle]))))
................................................................................
   (get-ffi-obj
    "IupProgressBar" libiup
    (_fun -> [handle : _ihandle]))))

;; Extended controls

(define matrix










  (make-constructor-procedure







   (get-ffi-obj
    "IupMatrix" libiup-controls
    (_fun ([action #f]) :: [action : _iname/upcase] -> [handle : _ihandle]))))

(define cells
  (make-constructor-procedure
   (get-ffi-obj
    "IupCells" libiup-controls
    (_fun -> [handle : _ihandle]))))

................................................................................
  
(letrec ([open
          (get-ffi-obj
           "IupControlsOpen" libiup-controls
             (_fun -> [status : _istatus]
                   -> (case status
                        [(#t ignore) (void)]
                        [else        (error 'controls "failed to initialize library (~s)" status)])))])






  (open))


(provide
 canvas
 frame tabs
 label button toggle
 spin spinbox valuator
 textbox listbox treebox
 progress-bar
 matrix cells
 color-bar color-browser
 dial)







>
>
>
>
>
>
>







 







>
>
>
>
>
>
>
>
>
>
|
>
>
>
>
>
>
>

|
|







 







|
>
>
>
>
>
>
|
>








|


13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
...
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
...
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
(define libiup-controls
  (case (system-type 'os)
    [(windows)
     (ffi-lib "iupcontrols")]
    [else
     (ffi-lib "libiupcontrols")]))

(define libiup-matrixex
  (case (system-type 'os)
    [(windows)
     (ffi-lib "iupmatrixex" #:fail (λ () #f))]
    [else
     (ffi-lib "libiupmatrixex" #:fail (λ () #f))]))

;; Standard controls

(define canvas
  (make-constructor-procedure
   (get-ffi-obj
    "IupCanvas" libiup
    (_fun ([action #f]) :: [action : _iname/upcase] -> [handle : _ihandle]))))
................................................................................
   (get-ffi-obj
    "IupProgressBar" libiup
    (_fun -> [handle : _ihandle]))))

;; Extended controls

(define matrix
  (letrec ([create
            (get-ffi-obj
             "IupMatrix" libiup-controls
             (_fun [action : _iname/upcase] -> [handle : _ihandle]))]
           [extend!
            (and
             libiup-matrixex
             (get-ffi-obj
              "IupMatrixExInit" libiup-matrixex
              (_fun [handle : _ihandle] -> _void)))])
    (make-constructor-procedure
     (λ ([action #f] [extended? #t])
       (let ([handle (create action)])
         (when (and extend! extended?) (extend! handle))
         handle)))))

(define matrix-listbox
  (make-constructor-procedure
   (get-ffi-obj
    "IupMatrixList" libiup-controls
    (_fun -> [handle : _ihandle]))))

(define cells
  (make-constructor-procedure
   (get-ffi-obj
    "IupCells" libiup-controls
    (_fun -> [handle : _ihandle]))))

................................................................................
  
(letrec ([open
          (get-ffi-obj
           "IupControlsOpen" libiup-controls
             (_fun -> [status : _istatus]
                   -> (case status
                        [(#t ignore) (void)]
                        [else        (error 'controls "failed to initialize library (~s)" status)])))]
         [matrixex
          (and
           libiup-matrixex
           (get-ffi-obj
            "IupMatrixExOpen" libiup-matrixex
            (_fun -> _void)))])
  (open)
  (when matrixex (matrixex)))

(provide
 canvas
 frame tabs
 label button toggle
 spin spinbox valuator
 textbox listbox treebox
 progress-bar
 matrix matrix-listbox cells
 color-bar color-browser
 dial)