iup-ffi 0.13.0-x86_64-linux

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (70) hide show
  1. checksums.yaml +7 -0
  2. data/LICENCE.md +21 -0
  3. data/README.md +139 -0
  4. data/lib/iup-ffi-plain.rb +51 -0
  5. data/lib/iup-ffi.rb +70 -0
  6. data/lib/library/linux/libcd.so +0 -0
  7. data/lib/library/linux/libim.so +0 -0
  8. data/lib/library/linux/libiup.so +0 -0
  9. data/lib/library/linux/libiup_scintilla.so +0 -0
  10. data/lib/library/linux/libiupcd.so +0 -0
  11. data/lib/library/linux/libiupcontrols.so +0 -0
  12. data/lib/library/linux/libiupim.so +0 -0
  13. data/lib/library/linux/libiupimglib.so +0 -0
  14. data/lib/plain/iupcdlib.rb +158 -0
  15. data/lib/plain/iupcontrolslib.rb +28 -0
  16. data/lib/plain/iupimglib.rb +15 -0
  17. data/lib/plain/iupimlib.rb +18 -0
  18. data/lib/plain/iuplib.rb +354 -0
  19. data/lib/plain/scintilla-lib.rb +17 -0
  20. data/lib/wrapped/attribute-builders.rb +93 -0
  21. data/lib/wrapped/attribute-reference.rb +27 -0
  22. data/lib/wrapped/background-box.rb +37 -0
  23. data/lib/wrapped/button.rb +152 -0
  24. data/lib/wrapped/callback-setter.rb +78 -0
  25. data/lib/wrapped/canvas.rb +698 -0
  26. data/lib/wrapped/colorbar.rb +212 -0
  27. data/lib/wrapped/colordialog.rb +121 -0
  28. data/lib/wrapped/common-attributes.rb +34 -0
  29. data/lib/wrapped/constants.rb +504 -0
  30. data/lib/wrapped/dial.rb +129 -0
  31. data/lib/wrapped/dialog.rb +309 -0
  32. data/lib/wrapped/drag-drop-attributes.rb +98 -0
  33. data/lib/wrapped/dynamic-fill-methods.rb +22 -0
  34. data/lib/wrapped/expander.rb +128 -0
  35. data/lib/wrapped/filedialog.rb +168 -0
  36. data/lib/wrapped/fill.rb +29 -0
  37. data/lib/wrapped/fontdialog.rb +71 -0
  38. data/lib/wrapped/frame.rb +70 -0
  39. data/lib/wrapped/gridbox.rb +188 -0
  40. data/lib/wrapped/hbox.rb +90 -0
  41. data/lib/wrapped/image-attributes.rb +58 -0
  42. data/lib/wrapped/image.rb +178 -0
  43. data/lib/wrapped/iup-global.rb +46 -0
  44. data/lib/wrapped/label.rb +110 -0
  45. data/lib/wrapped/link.rb +54 -0
  46. data/lib/wrapped/list.rb +567 -0
  47. data/lib/wrapped/matrix.rb +575 -0
  48. data/lib/wrapped/menu.rb +91 -0
  49. data/lib/wrapped/menuitem.rb +150 -0
  50. data/lib/wrapped/messagedialog.rb +127 -0
  51. data/lib/wrapped/progressbar.rb +91 -0
  52. data/lib/wrapped/progressdialog.rb +85 -0
  53. data/lib/wrapped/radio.rb +74 -0
  54. data/lib/wrapped/scintilla.rb +1112 -0
  55. data/lib/wrapped/scrollbar-attributes.rb +178 -0
  56. data/lib/wrapped/scrollbox.rb +40 -0
  57. data/lib/wrapped/separator.rb +24 -0
  58. data/lib/wrapped/splitbox.rb +114 -0
  59. data/lib/wrapped/stretchbox.rb +70 -0
  60. data/lib/wrapped/submenu.rb +58 -0
  61. data/lib/wrapped/tabs.rb +223 -0
  62. data/lib/wrapped/text.rb +382 -0
  63. data/lib/wrapped/timer.rb +82 -0
  64. data/lib/wrapped/toggle.rb +150 -0
  65. data/lib/wrapped/tree.rb +612 -0
  66. data/lib/wrapped/val.rb +162 -0
  67. data/lib/wrapped/vbox.rb +93 -0
  68. data/lib/wrapped/widget.rb +282 -0
  69. data/lib/wrapped/zbox.rb +80 -0
  70. metadata +131 -0
@@ -0,0 +1,1112 @@
1
+ module Iup
2
+
3
+ # A powerful text element.
4
+ # The API documentation can only hint at the use of this control. For more
5
+ # information see Tecgraf's documentation on
6
+ # {IupScintilla}[https://www.tecgraf.puc-rio.br/iup/en/ctrl/iup_scintilla.html]
7
+ # and the {Scintilla}[http://www.scintilla.org/] website.
8
+ #
9
+ # === Example
10
+ #
11
+ # The following example sets up a Scintilla text widget handling some cpp
12
+ # code. Notice the setup of the keywords and styling settings.
13
+ # Also, the text widget must be placed into a dialog and mapped before
14
+ # its other attributes are set and the dialog shown.
15
+ #
16
+ # text = Iup::Scintilla.new
17
+ #
18
+ # dlg = Iup::Dialog.new(text) do |d|
19
+ # d.title = 'Scintilla example'
20
+ # d.size = '300x200'
21
+ # end.map
22
+ #
23
+ # text.expand = 'YES'
24
+ # text.lexerlanguage = 'cpp'
25
+ # text.keywords(0, "void struct union enum char short int long double float
26
+ # signed unsigned const static extern auto register volatile bool class
27
+ # private protected public friend inline template virtual asm explicit
28
+ # typename mutable if else switch case default break goto return for while
29
+ # do continue typedef sizeof NULL new delete throw try catch namespace
30
+ # operator this const_cast static_cast dynamic_cast reinterpret_cast true
31
+ # false using typeid and and_eq bitand bitor compl not not_eq or or_eq xor
32
+ # xor_eq")
33
+ # text.stylefont(32, 'Consolas')
34
+ # text.stylefontsize(32, 11)
35
+ # text.styleclearall = 'Yes'
36
+ # text.stylefgcolor(1, '0 128 0') # 1 - C Comment
37
+ # text.stylefgcolor(2, '0 128 0') # 2 - C++ Comment line
38
+ # text.stylefgcolor(4, '128 0 0') # 4 - Number
39
+ # text.stylefgcolor(5, '0 0 255') # 5 - Keyword
40
+ # text.stylefgcolor(6, '160 20 20') # 6 - String
41
+ # text.stylefgcolor(7, '128 0 0') # 7 - Character
42
+ # text.stylefgcolor(9, '0 0 255') # 9 - Preprocessor block
43
+ # text.stylefgcolor(10, '255 0 255') # 10 - Operator
44
+ # text.stylebold(10, 'YES')
45
+ # text.stylehotspot(6, 'YES')
46
+ # text.marginwidth(0, 50)
47
+ # text.property('fold', 1)
48
+ # text.property('fold.compact', 0)
49
+ # text.property('fold.comment', 1)
50
+ # text.property('fold.preprocessor', 1)
51
+ # text.marginwidth(1, 20)
52
+ # text.margintype(1, 'SYMBOL')
53
+ # text.marginmaskfolders(1, 'Yes')
54
+ #
55
+ # text.markerdefine('folder', 'plus')
56
+ # text.markerdefine('folderopen', 'minus')
57
+ # text.markerdefine('folderend', 'empty')
58
+ # text.markerdefine('foldermidtail', 'empty')
59
+ # text.markerdefine('folderopenmid', 'empty')
60
+ # text.markerdefine('foldersub', 'empty')
61
+ # text.markerdefine('foldertail', 'empty')
62
+ #
63
+ # text.foldflags = 'lineafter_contracted'
64
+ #
65
+ # text.marginsensitive(1, 'YES')
66
+ #
67
+ # dlg.show
68
+ #--
69
+ # TODO: This class's actions are incomplete
70
+ #
71
+ class Scintilla < Iup::Widget
72
+ @@opened = false
73
+
74
+ # Creates a new instance.
75
+ # If a block is given, the new instance is yielded to it.
76
+ def initialize
77
+ unless @@opened
78
+ # make sure the scintilla library is opened on first use
79
+ ScintillaLib.IupScintillaOpen
80
+ @@opened = true
81
+ end
82
+ @handle = ScintillaLib.IupScintilla
83
+
84
+ yield self if block_given?
85
+ end
86
+
87
+ # :section: General attributes
88
+
89
+ ##
90
+ # :attr: border
91
+ # Sets border around widget, values 'yes' / 'no'.
92
+ define_attribute :border
93
+
94
+ ##
95
+ # :attr: canfocus
96
+ # If set, the control can gain focus, values 'yes' / 'no'.
97
+ define_attribute :canfocus
98
+
99
+ ##
100
+ # :attr: clipboard
101
+ # 'clear' / 'copy' / 'cut' / 'paste', access the clipboard with the current selection.
102
+ define_attribute :clipboard
103
+
104
+ ##
105
+ # :attr: cursor
106
+ # Defines the mouse shape / cursor for the canvas.
107
+ # Available cursors are shown in the
108
+ # {Tecgraf documentation}[http://www.tecgraf.puc-rio.br/iup/en/attrib/iup_cursor.html].
109
+ define_attribute :cursor
110
+
111
+ ##
112
+ # :attr: overwrite
113
+ # 'off' / 'on', when enabled, new characters replace the one to the right
114
+ # of the text caret.
115
+ define_attribute :overwrite
116
+
117
+ ##
118
+ # :attr: readonly
119
+ # 'no' / 'yes' setting to restrict editing of text.
120
+ define_attribute :readonly
121
+
122
+ ##
123
+ # :attr: size
124
+ # Size of the container, in character units, value as "widthxheight".
125
+ define_attribute :size
126
+
127
+ ##
128
+ # :attr: usepopup
129
+ # 'yes' / 'no' controls visibility of right-click popup menu available to
130
+ # user.
131
+ define_attribute :usepopup
132
+
133
+ ##
134
+ # :attr: visiblecolumns
135
+ # Accesses the number of visible columns for the control's natural size.
136
+ define_attribute :visiblecolumns
137
+
138
+ ##
139
+ # :attr: visiblelines
140
+ # Accesses the number of visible lines for the control's natural size.
141
+ define_attribute :visiblelines
142
+
143
+ ##
144
+ # :attr_reader: visiblelinescount
145
+ # Returns the number of lines which are visible.
146
+ define_reader :visiblelinescount
147
+
148
+ ##
149
+ # :attr: wordwrap
150
+ # Values 'yes' / 'no'.
151
+ define_attribute :wordwrap
152
+
153
+ ##
154
+ # :attr: wordwrapvisualflags
155
+ # Controls the drawing of visual flags to show word-wrap has occurred.
156
+ # Values 'yes' / 'no'.
157
+ define_attribute :wordwrapvisualflags
158
+
159
+ # :section: Text retrieval and modification attributes
160
+
161
+ ##
162
+ # :attr_writer: add
163
+ # Inserts a string at the current position.
164
+ define_writer :add
165
+
166
+ ##
167
+ # :attr_writer: append
168
+ # Inserts a string at the end of the text.
169
+ define_writer :append
170
+
171
+ ##
172
+ # :method: char
173
+ # :call-seq:
174
+ # text.char(id)
175
+ #
176
+ # * +id+ - position in the text.
177
+ # Returns the character at a given position.
178
+ define_id_reader :char
179
+
180
+ ##
181
+ # :attr_writer: clearall
182
+ # Deletes all text, unless the control is readonly.
183
+ define_writer :clearall
184
+
185
+ ##
186
+ # :attr_reader: count
187
+ # Returns the number of characters in the text.
188
+ define_reader :count
189
+
190
+ ##
191
+ # Deletes a range of text:
192
+ # * +pos+ - position of start of range in text
193
+ # * +len+ - number of characters to delete
194
+ def deleterange(pos, len)
195
+ IupLib.IupSetAttribute(@handle, "DELETERANGE", "#{pos},#{len}")
196
+ end
197
+
198
+ ##
199
+ # :method: insert
200
+ # :call-seq:
201
+ # text.insert(id, str)
202
+ #
203
+ # * +id+ - position in the text
204
+ # * +str+ - text string
205
+ # Inserts a text string at position "id".
206
+ define_id_writer :insert
207
+
208
+ ##
209
+ # :method: line
210
+ # :call-seq:
211
+ # text.line(id)
212
+ #
213
+ # * +id+ - position in the text.
214
+ # Returns the text of the line referenced by given "id".
215
+ define_id_reader :line
216
+
217
+ ##
218
+ # :attr_reader: linecount
219
+ # Returns the number of lines in the text.
220
+ define_reader :linecount
221
+
222
+ ##
223
+ # :attr_reader: linevalue
224
+ # Returns the text of the line where the caret is.
225
+ define_reader :linevalue
226
+
227
+ ##
228
+ # :attr_writer: prepend
229
+ # Inserts a string at the beginning of the text.
230
+ define_writer :prepend
231
+
232
+ ##
233
+ # :attr: value
234
+ # \Text entered by the user.
235
+ define_attribute :value
236
+
237
+ # :section: Annotation attributes
238
+
239
+ ##
240
+ # :method: annotationtext
241
+ # :call-seq:
242
+ # text.annotationtext(id)
243
+ # text.annotationtext(id, val)
244
+ #
245
+ # For the "id" line number, accesses its annotation.
246
+ define_id_attribute :annotationtext
247
+
248
+ ##
249
+ # :method: annotationstyle
250
+ # :call-seq:
251
+ # text.annotationstyle(id)
252
+ # text.annotationstyle(id, val)
253
+ #
254
+ # For the "id" line number, accesses its style.
255
+ define_id_attribute :annotationstyle
256
+
257
+ ##
258
+ # :attr: annotationstyleoffset
259
+ # A style offset separates the annotation and text.
260
+ define_attribute :annotationstyleoffset
261
+
262
+ ##
263
+ # :attr: annotationvisible
264
+ # Setting to enable or display annotations.
265
+ # Values 'hidden' / 'standard' / 'boxed'.
266
+ define_attribute :annotationvisible
267
+
268
+ ##
269
+ # :attr: annotationclearall
270
+ # Deletes all annotations.
271
+ define_attribute :annotationclearall
272
+
273
+ # :section: Auto-completion attributes
274
+
275
+ ##
276
+ # :method: autocshow
277
+ # :call-seq:
278
+ # text.autocshow(id, val)
279
+ #
280
+ # Shows a list of words with "id" being the
281
+ # number of characters entered by user.
282
+ define_id_writer :autocshow
283
+
284
+ ##
285
+ # :attr_writer: autoccancel
286
+ # Removes any displayed auto-completion list.
287
+ define_writer :autoccancel
288
+
289
+ ##
290
+ # :attr_reader: autocactive
291
+ # Returns "YES" if there is an auto-completion list showing.
292
+ define_reader :autocactive
293
+
294
+ ##
295
+ # :attr_reader: autocposstart
296
+ # Returns current start position of auto-completion list.
297
+ define_reader :autocposstart
298
+
299
+ ##
300
+ # :attr_writer: autoccomplete
301
+ # Starts the auto-completion.
302
+ define_writer :autoccomplete
303
+
304
+ ##
305
+ # :attr_writer: autocselect
306
+ # Select an item from auto-completion list.
307
+ define_writer :autocselect
308
+
309
+ ##
310
+ # :attr_reader: autocselectedindex
311
+ # Returns index of currently selected item.
312
+ define_reader :autocselectedindex
313
+
314
+ ##
315
+ # :attr: autocdroprestofword
316
+ # Controls if remaining characters are deleted once an item is
317
+ # selected.
318
+ # Values 'yes' / 'no'.
319
+ define_attribute :autocdroprestofword
320
+
321
+ ##
322
+ # :attr: autocmaxheight
323
+ # Controls number of rows visible in auto-completion list.
324
+ define_attribute :autocmaxheight
325
+
326
+ ##
327
+ # :attr: autocmaxwidth
328
+ # Controls width of auto-completion list, in characters.
329
+ define_attribute :autocmaxwidth
330
+
331
+ # :section: Brace highlighting attributes
332
+
333
+ ##
334
+ # :attr_writer: bracehighlight
335
+ # Using format "pos1:pos2", highlights the brace.
336
+ define_writer :bracehighlight
337
+
338
+ ##
339
+ # :attr_writer: bracebadlight
340
+ # Using format "pos1:pos2", highlights a mis-matching brace.
341
+ define_writer :bracebadlight
342
+
343
+ ##
344
+ # :method: bracematch
345
+ # :call-seq:
346
+ # text.bracematch(id)
347
+ #
348
+ # Finds a match for the brace at character position "id".
349
+ define_id_reader :bracematch
350
+
351
+ # :section: Caret and selection attributes
352
+
353
+ ##
354
+ # :attr: caret
355
+ # Position of the insertion point, in "lin,col" format.
356
+ define_attribute :caret
357
+
358
+ ##
359
+ # :attr: caretpos
360
+ # Position of the insertion point, as a 0-based character position.
361
+ define_attribute :caretpos
362
+
363
+ ##
364
+ # :attr_writer: carettoview
365
+ # Ensures caret is on a visible line.
366
+ define_writer :carettoview
367
+
368
+ ##
369
+ # :attr: selectedtext
370
+ # Accesses the currently selected text.
371
+ define_attribute :selectedtext
372
+
373
+ ##
374
+ # :attr: selection
375
+ # Identifies selection in format "lin1,col1:lin2,col2" / 'all' / 'none'.
376
+ define_attribute :selection
377
+
378
+ ##
379
+ # :attr: selectionpos
380
+ # Identifies selection in 0-based character position format "pos1:pos2" /
381
+ # 'all' / 'none'.
382
+ define_attribute :selectionpos
383
+
384
+ # :section: Folding attributes
385
+
386
+ ##
387
+ # :attr_writer: foldflags
388
+ # Style of drawn fold lines, one of:
389
+ # 'LINEBEFORE_EXPANDED' / 'LINEBEFORE_CONTRACTED' / 'LINEAFTER_EXPANDED' /
390
+ # 'LINEAFTER_CONTRACTED'
391
+ define_writer :foldflags
392
+
393
+ ##
394
+ # :method: foldlevel
395
+ # :call-seq:
396
+ # text.foldlevel(id)
397
+ # text.foldlevel(id, val)
398
+ #
399
+ # The fold level of line "id".
400
+ define_id_attribute :foldlevel
401
+
402
+ ##
403
+ # :attr_writer: foldtoggle
404
+ # Expands or closes fold point, based on line number
405
+ define_writer :foldtoggle
406
+
407
+ # :section: Lexer attributes
408
+
409
+ ##
410
+ # :method: keywords
411
+ # :call-seq:
412
+ # text.keywords(id, val)
413
+ #
414
+ # Creates a keyword list with an id in range 0 to 8.
415
+ define_id_writer :keywords
416
+
417
+ ##
418
+ # :attr_reader: keywordsets
419
+ # Returns description of all keyword lists.
420
+ define_reader :keywordsets
421
+
422
+ ##
423
+ # :attr: lexerlanguage
424
+ # Any name supported by Scintilla, e.g. 'ruby' / 'bash' / 'tex'.
425
+ define_attribute :lexerlanguage
426
+
427
+ ##
428
+ # :attr_writer: loadlexerlibrary
429
+ # Loads a lexer from a given filename.
430
+ define_writer :loadlexerlibrary
431
+
432
+ ##
433
+ # :method: property
434
+ # :call-seq:
435
+ # text.property(name)
436
+ # text.property(name, value)
437
+ #
438
+ # Access lexer properties.
439
+ define_property_attribute :property
440
+
441
+ ##
442
+ # :attr_reader: propertynames
443
+ # Returns a list of property names.
444
+ define_reader :propertynames
445
+
446
+ # :section: Margin attributes
447
+
448
+ ##
449
+ # :method: marginmaskfolders
450
+ # :call-seq:
451
+ # text.marginmaskfolders(id)
452
+ # text.marginmaskfolders(id, val)
453
+ #
454
+ # Define if margin "id" is folding or non-folding,
455
+ # values 'yes' / 'no'.
456
+ define_id_attribute :marginmaskfolders
457
+
458
+ ##
459
+ # :method: marginsensitive
460
+ # :call-seq:
461
+ # text.marginsensitive(id)
462
+ # text.marginsensitive(id, val)
463
+ #
464
+ # Define if margin "id" is sensitive or not,
465
+ # values 'yes' / 'no'.
466
+ define_id_attribute :marginsensitive
467
+
468
+ ##
469
+ # :method: margintype
470
+ # Define and set type of margin "id".
471
+ # Values 'symbol' / 'number' / 'text' / 'rtext' / 'background' /
472
+ # 'foreground'
473
+ define_id_attribute :margintype
474
+
475
+ ##
476
+ # :method: marginwidth
477
+ # :call-seq:
478
+ # text.marginwidth(id)
479
+ # text.marginwidth(id, val)
480
+ #
481
+ # Defines width of a margin "id" in pixels.
482
+ define_id_attribute :marginwidth
483
+
484
+ ##
485
+ # :method: marginleft
486
+ # :call-seq:
487
+ # text.marginleft(id)
488
+ # text.marginleft(id, val)
489
+ #
490
+ # Defines size of blank margin on the left size.
491
+ define_id_attribute :marginleft
492
+
493
+ ##
494
+ # :method: marginright
495
+ # :call-seq:
496
+ # text.marginright(id)
497
+ # text.marginright(id, val)
498
+ #
499
+ # Defines size of blank margin on the right size.
500
+ define_id_attribute :marginright
501
+
502
+ ##
503
+ # :method: margintext
504
+ # :call-seq:
505
+ # text.margintext(id)
506
+ # text.margintext(id, val)
507
+ #
508
+ # * +id+ - the line number
509
+ # Controls text of each line.
510
+ define_id_attribute :margintext
511
+
512
+ ##
513
+ # :method: margintextstyle
514
+ # :call-seq:
515
+ # text.margintextstyle(id)
516
+ # text.margintextstyle(id, val)
517
+ #
518
+ # * +id+ - the line number
519
+ # Controls style of text of each line.
520
+ define_id_attribute :margintextstyle
521
+
522
+ ##
523
+ # :method: margintextclearall
524
+ # :call-seq:
525
+ # text.margintextclearall(id)
526
+ #
527
+ # Clears text and styles of given margin "id".
528
+ define_id_writer :margintextclearall
529
+
530
+ ##
531
+ # :method: margincursor
532
+ # :call-seq:
533
+ # text.margincursor(id)
534
+ # text.margincursor(id, val)
535
+ #
536
+ # Accesses the cursor for margin,
537
+ # values 'reversearrow' / 'arrow'.
538
+ define_id_attribute :margincursor
539
+
540
+ # :section: Marker attributes
541
+
542
+ ##
543
+ # :method: markerdefine
544
+ # :call-seq:
545
+ # text.markerdefine(number, marker)
546
+ #
547
+ # Sets marker for given number.
548
+ define_property_writer :markerdefine
549
+
550
+ ##
551
+ # :method: markersymbol
552
+ # :call-seq:
553
+ # text.marginsymbol(id)
554
+ # text.marginsymbol(id, val)
555
+ #
556
+ # Associates marker number with symbol.
557
+ define_id_attribute :markersymbol
558
+
559
+ ##
560
+ # :method: markerfgcolor
561
+ # :call-seq:
562
+ # text.markerfgcolor(id, val)
563
+ #
564
+ # Defines foreground color of given marker number.
565
+ # Values as 'r g b'.
566
+ define_id_writer :markerfgcolor
567
+
568
+ ##
569
+ # :method: bgcolor
570
+ # :call-seq:
571
+ # text.markerbgcolor(id, val)
572
+ #
573
+ # Defines background color of given marker number.
574
+ # Values as 'r g b'.
575
+ define_id_writer :bgcolor
576
+
577
+ ##
578
+ # :method: markerbgcolorsel
579
+ # :call-seq:
580
+ # text.markerbgcolorsel(id, val)
581
+ #
582
+ # Defines highlight background color of given marker number.
583
+ # Values as 'r g b'.
584
+ define_id_writer :markerbgcolorsel
585
+
586
+ ##
587
+ # :method: markeralpha
588
+ # :call-seq:
589
+ # text.markeralpha(id, val)
590
+ #
591
+ # Defines alpha value of given marker number.
592
+ define_id_writer :markeralpha
593
+
594
+ ##
595
+ # :method: markerrgbaimage
596
+ # :call-seq:
597
+ # text.markerrgbaimage(id, val)
598
+ #
599
+ # Defines image to be used on a marker number:
600
+ # must be an Iup::ImageRGBA.
601
+ define_id_writer :markerrgbaimage
602
+
603
+ ##
604
+ # :method: markerrgbaimagescale
605
+ # :call-seq:
606
+ # text.markerrgbaimagescale(id, val)
607
+ #
608
+ # Defines image scale factor, as a percent (1-100).
609
+ define_id_writer :markerrgbaimagescale
610
+
611
+ ##
612
+ # :attr: markerhighlight
613
+ # Accesses highlight of folding block when selected.
614
+ # Values 'yes' / 'no'.
615
+ define_attribute :markerhighlight
616
+
617
+ ##
618
+ # :method: markeradd
619
+ # :call-seq:
620
+ # text.markeradd(id, val)
621
+ #
622
+ # Adds marker number to given line "id".
623
+ define_id_writer :markeradd
624
+
625
+ ##
626
+ # :method: markerdelete
627
+ # :call-seq:
628
+ # text.markerdelete(id, val)
629
+ #
630
+ # Deletes marker number to given line "id".
631
+ define_id_writer :markerdelete
632
+
633
+ ##
634
+ # :call-seq:
635
+ # text.markerdeleteall(val)
636
+ #
637
+ # Removes given marker from all lines.
638
+ def markerdeleteall(val)
639
+ IupLib.IupSetAttribute(@handle, "MARKERDELETEALL", val.to_s)
640
+ end
641
+
642
+ ##
643
+ # :method: markerget
644
+ # :call-seq:
645
+ # text.markerget(id)
646
+ #
647
+ # Returns marker mask with markers for given line "id".
648
+ define_id_reader :markerget
649
+
650
+ ##
651
+ # :method: markernext
652
+ # :call-seq:
653
+ # text.markernext(id, mask)
654
+ #
655
+ # Searches for a given marker mask, starting from line "id"
656
+ # and moving forwards.
657
+ define_id_writer :markernext
658
+
659
+ ##
660
+ # :method: markerprevious
661
+ # :call-seq:
662
+ # text.markerprevious(id, mask)
663
+ #
664
+ # Searches for a given marker mask, starting from line "id"
665
+ # and moving backwards.
666
+ define_id_writer :markerprevious
667
+
668
+ ##
669
+ # :method: markerlinefromhandle
670
+ # :call-seq:
671
+ # text.markerlinefromhandle(id)
672
+ #
673
+ # Searches for a marker given its handle "id".
674
+ define_id_reader :markerlinefromhandle
675
+
676
+ ##
677
+ # :attr_writer: markerdeletehandle
678
+ # Searches for a marker given its handle "id" and deletes it, if found.
679
+ define_writer :markerdeletehandle
680
+
681
+ ##
682
+ # :attr_reader: lastmarkeraddhandle
683
+ # Returns the last handle created by #markeradd.
684
+ define_reader :lastmarkeraddhandle
685
+
686
+ ##
687
+ # :attr_reader: lastmarkerfound
688
+ # Returns last line number with marker found by #markernext.
689
+ define_reader :lastmarkerfound
690
+
691
+ # :section: Scrolling attributes
692
+
693
+ ##
694
+ # :attr: scrollbar
695
+ # Adds a scrollbar to the widget.
696
+ # Values 'horizontal' / 'vertical' / 'yes' / 'no'.
697
+ define_attribute :scrollbar
698
+
699
+ ##
700
+ # :attr_writer: scrolltocaret
701
+ # Make given caret position visible.
702
+ define_writer :scrolltocaret
703
+
704
+ ##
705
+ # :attr: scrollwidth
706
+ # Controls document width in pixels, default: 2000.
707
+ define_attribute :scrollwidth
708
+
709
+ # :section: Search and replace attributes
710
+
711
+ ##
712
+ # :attr_writer: searchintarget
713
+ # Searches for text string within #targetstart #targetend bounds.
714
+ define_writer :searchintarget
715
+
716
+ ##
717
+ # :attr: searchflags
718
+ # Accesses flags - possible values are 'MATCHCASE' / 'WHOLEWORD' /
719
+ # 'WORDSTART' / 'REGEXP' / 'POSIX'. Combine flags using '|', and
720
+ # clear with +nil+.
721
+ define_attribute :searchflags
722
+
723
+ ##
724
+ # :attr: targetstart
725
+ # Character position of start of target.
726
+ define_attribute :targetstart
727
+
728
+ ##
729
+ # :attr: targetend
730
+ # Character position of end of target.
731
+ define_attribute :targetend
732
+
733
+ ##
734
+ # :attr_writer: targetfromselection
735
+ # Sets target start and end based on current selection.
736
+ define_writer :targetfromselection
737
+
738
+ ##
739
+ # :attr_writer: targetwholedocument
740
+ # Sets target start and end to the whole document.
741
+ define_writer :targetwholedocument
742
+
743
+ ##
744
+ # :attr: replacetarget
745
+ # Replaces the target text.
746
+ define_writer :replacetarget
747
+
748
+ # :section: Style definition attributes
749
+
750
+ ##
751
+ # :method: stylebgcolor
752
+ # :call-seq:
753
+ # text.stylebgcolor(id)
754
+ # text.stylebgcolor(id, val)
755
+ #
756
+ # Background color for a style, as 'r g b'.
757
+ define_id_attribute :stylebgcolor
758
+
759
+ ##
760
+ # :method: stylebold
761
+ # :call-seq:
762
+ # text.stylebold(id)
763
+ # text.stylebold(id, val)
764
+ #
765
+ # Bold setting for a style.
766
+ define_id_attribute :stylebold
767
+
768
+ ##
769
+ # :method: stylecase
770
+ # :call-seq:
771
+ # text.stylecase(id)
772
+ # text.stylecase(id, val)
773
+ #
774
+ # \Text characteristics for a style.
775
+ define_id_attribute :stylecase
776
+
777
+ ##
778
+ # :method: stylecharset
779
+ # :call-seq:
780
+ # text.stylecharset(id)
781
+ # text.stylecharset(id, val)
782
+ #
783
+ # Alter charset for a style, values include 'ANSI' / 'EASTEUROPE' /
784
+ # 'RUSSIAN' / 'GB2312' / 'HANGUL' / 'SHIFTJIS'.
785
+ define_id_attribute :stylecharset
786
+
787
+ ##
788
+ # :attr: styleclearall
789
+ # Returns all styles to attributes of the default style.
790
+ define_attribute :styleclearall
791
+
792
+ ##
793
+ # :method: styleeolfilled
794
+ # :call-seq:
795
+ # text.styleeolfilled(id)
796
+ # text.styleeolfilled(id, val)
797
+ #
798
+ # Whether to set a line to same color set as last character on line,
799
+ # values 'yes' / 'no'.
800
+ define_id_attribute :styleeolfilled
801
+
802
+ ##
803
+ # :method: stylefgcolor
804
+ # :call-seq:
805
+ # text.stylefgcolor(id)
806
+ # text.stylefgcolor(id, val)
807
+ #
808
+ # Foreground color for a style, as 'r g b'.
809
+ define_id_attribute :stylefgcolor
810
+
811
+ ##
812
+ # :method: stylefont
813
+ # :call-seq:
814
+ # text.stylefont(id)
815
+ # text.stylefont(id, val)
816
+ #
817
+ # Font name for a style.
818
+ define_id_attribute :stylefont
819
+
820
+ ##
821
+ # :method: stylefontsize
822
+ # :call-seq:
823
+ # text.stylefontsize(id)
824
+ # text.stylefontsize(id, val)
825
+ #
826
+ # Font size for a style.
827
+ define_id_attribute :stylefontsize
828
+
829
+ ##
830
+ # :method: stylefontsizefrac
831
+ # :call-seq:
832
+ # text.stylefontsizefrac(id)
833
+ # text.stylefontsizefrac(id, val)
834
+ #
835
+ # Font size as a fractional point size for a style.
836
+ define_id_attribute :stylefontsizefrac
837
+
838
+ ##
839
+ # :method: stylehotspot
840
+ # :call-seq:
841
+ # text.stylehotspot(id)
842
+ # text.stylehotspot(id, val)
843
+ #
844
+ # Marks ranges to respond to mouse clicks.
845
+ define_id_attribute :stylehotspot
846
+
847
+ ##
848
+ # :method: styleitalic
849
+ # :call-seq:
850
+ # text.styleitalic(id)
851
+ # text.styleitalic(id, val)
852
+ #
853
+ # Italic setting for a style.
854
+ define_id_attribute :styleitalic
855
+
856
+ ##
857
+ # :method: stylereset
858
+ # :call-seq:
859
+ # text.stylereset(id)
860
+ # text.stylereset(id, val)
861
+ #
862
+ # Resets style to default.
863
+ define_id_attribute :stylereset
864
+
865
+ ##
866
+ # :method: styleunderline
867
+ # :call-seq:
868
+ # text.styleunderline(id)
869
+ # text.styleunderline(id, val)
870
+ #
871
+ # Underline setting for a style.
872
+ define_id_attribute :styleunderline
873
+
874
+ ##
875
+ # :method: stylevisible
876
+ # :call-seq:
877
+ # text.stylevisible(id)
878
+ # text.stylevisible(id, val)
879
+ #
880
+ # Values 'yes' / 'no', for visible text.
881
+ define_id_attribute :stylevisible
882
+
883
+ ##
884
+ # :method: styleweight
885
+ # :call-seq:
886
+ # text.styleweight(id)
887
+ # text.styleweight(id, val)
888
+ #
889
+ # Font weight for a style.
890
+ define_id_attribute :styleweight
891
+
892
+ # :section: Styling attributes
893
+
894
+ ##
895
+ # :attr_writer: cleardocumentstyle
896
+ # Resets and clears styling and folding.
897
+ define_writer :cleardocumentstyle
898
+
899
+ ##
900
+ # :attr_writer: startstyling
901
+ # Prepares for styling, setting the start position.
902
+ define_writer :startstyling
903
+
904
+ ##
905
+ # :method: styling
906
+ # :call-seq:
907
+ # text.styling(id, length)
908
+ #
909
+ # Sets style of given length characters using style "id".
910
+ define_id_writer :styling
911
+
912
+ # :section: Tabs and indentation attributes
913
+
914
+ ##
915
+ # :attr: tabsize
916
+ # Number of characters for a tab. Default is 8.
917
+ define_attribute :tabsize
918
+
919
+ ##
920
+ # :attr: indentationguides
921
+ # Controls dotted vertical lines to show indentation white space,
922
+ # values 'none' / 'real' / 'lookforward' / 'lookboth'.
923
+ define_attribute :indentationguides
924
+
925
+ ##
926
+ # :attr: highlightguide
927
+ # Highlights indentation guide of a given column.
928
+ define_attribute :highlightguide
929
+
930
+ ##
931
+ # :attr: usetabs
932
+ # Use tabs for indentation or only spaces,
933
+ # values 'yes' / 'no'.
934
+ define_attribute :usetabs
935
+
936
+ # :section: Undo and redo attributes
937
+
938
+ ##
939
+ # :attr: redo
940
+ # Redo the last operation if set to 'yes', or all operations if
941
+ # set to 'all'.
942
+ define_attribute :redo
943
+
944
+ ##
945
+ # :attr: undo
946
+ # Undo the last operation if set to 'yes', or all operations if
947
+ # set to 'all'.
948
+ define_attribute :undo
949
+
950
+ ##
951
+ # :attr: undocollect
952
+ # Controls collection of undo information, value 'yes' / 'no'.
953
+ define_attribute :undocollect
954
+
955
+ # :section: White space attributes
956
+
957
+ ##
958
+ # :attr: extraascent
959
+ # Controls extra space between lines, beyond maximum ascent.
960
+ define_attribute :extraascent
961
+
962
+ ##
963
+ # :attr: extradescent
964
+ # Controls extra space between lines, beyond maximum descent.
965
+ define_attribute :extradescent
966
+
967
+ ##
968
+ # :attr: whitespaceview
969
+ # Controls the display of white space, values 'invisible' / 'visiblealways'
970
+ # / 'visibleafterindent'.
971
+ define_attribute :whitespaceview
972
+
973
+ ##
974
+ # :attr: whitespacesize
975
+ # Size of dots when separating space characters, default is 3.
976
+ define_attribute :whitespacesize
977
+
978
+ ##
979
+ # :attr_writer: whitespacefgcolor
980
+ # Defines foreground color of visible white space, in 'r g b' format.
981
+ define_writer :whitespacefgcolor
982
+
983
+ ##
984
+ # :attr_writer: whitespacebgcolor
985
+ # Defines background color of visible white space, in 'r g b' format.
986
+ define_writer :whitespacebgcolor
987
+
988
+ # :section: Zooming attributes
989
+
990
+ ##
991
+ # :attr_writer: zoomin
992
+ # Increase zoom factor by one point.
993
+ define_writer :zoomin
994
+
995
+ ##
996
+ # :attr_writer: zoomout
997
+ # Decrease zoom factor by one point.
998
+ define_writer :zoomout
999
+
1000
+ ##
1001
+ # :attr: zoom
1002
+ # Accesses the zoom factor, range -10 to 20.
1003
+ define_attribute :zoom
1004
+
1005
+ # :section: Standard attributes
1006
+
1007
+ ##
1008
+ # :attr: expand
1009
+ # Allows control to fill available space in indicated direction.
1010
+ # Values 'no' / 'horizontal' / 'vertical' / 'yes'.
1011
+ define_attribute :expand
1012
+
1013
+ ##
1014
+ # :attr_reader: position
1015
+ # Returns position in pixels within client window as "x,y".
1016
+ define_reader :position
1017
+
1018
+ ##
1019
+ # :attr: rastersize
1020
+ # Size of the button, in pixels, value as "widthxheight".
1021
+ define_attribute :rastersize
1022
+
1023
+ ##
1024
+ # :attr_reader: screenposition
1025
+ # Returns position in pixels on screen as "x,y".
1026
+ define_reader :screenposition
1027
+
1028
+ ##
1029
+ # :attr: tip
1030
+ # Tooltip string.
1031
+ define_attribute :tip
1032
+
1033
+ # :section: Callbacks
1034
+
1035
+ ##
1036
+ # :attr_writer: action
1037
+ # Callback called when the text is edited, but before its value is actually changed.
1038
+ # Callback must respond to +call+ and takes a 4-argument callback: (insert, position, length, text)
1039
+ # * +insert+ - "1" for inserted text, "0" for deleted text
1040
+ # * +position+ - 0-base character position when change started
1041
+ # * +length+ - size of the cahange
1042
+ # * +text+ - the inserted text value, "" if text deleted
1043
+
1044
+ # --
1045
+ def action= callback
1046
+ unless callback.arity == 4
1047
+ raise ArgumentError, 'action callback must take 4 arguments: (insert, position, length, text)'
1048
+ end
1049
+ cb = Proc.new do |ih, insert, pos, length, text|
1050
+ callback.call insert, pos, length, text
1051
+ end
1052
+ define_callback cb, 'ACTION', :iiis_i
1053
+ end
1054
+
1055
+ include ButtonCallback
1056
+
1057
+ ##
1058
+ # :attr_writer: caret_cb
1059
+ # Callback called when the caret/cursor position is changed.
1060
+ # Callback must respond to +call+ and takes a callback which accepts 3 arguments: (line, column, position)
1061
+ # * +line+ - line number of caret
1062
+ # * +column+ - column number of caret
1063
+ # * +position+ - 0-based character position
1064
+
1065
+ # --
1066
+ def caret_cb= callback
1067
+ unless callback.arity == 3
1068
+ raise ArgumentError, 'caret_cb callback must take 3 arguments: (line, column, position)'
1069
+ end
1070
+ cb = Proc.new do |ih, lin, col, pos|
1071
+ callback.call lin, col, pos
1072
+ end
1073
+ define_callback cb, 'CARET_CB', :iii_i
1074
+ end
1075
+
1076
+ ##
1077
+ # :attr_writer: motion_cb
1078
+ # Callback called when the mouse is moved.
1079
+ # Callback must respond to +call+ and takes 3 arguments: (x, y, state)
1080
+ # * +x+ - x position of mouse
1081
+ # * +y+ - y position of mouse
1082
+ # * +state+ -status of mouse buttons and certain keyboard keys at the moment the event was generated.
1083
+
1084
+ #--
1085
+ def motion_cb= callback
1086
+ unless callback.arity == 3
1087
+ raise ArgumentError, 'motion_cb callback must take 3 arguments: (x, y, state)'
1088
+ end
1089
+ cb = Proc.new do |ih, x, y, state|
1090
+ callback.call x, y, state
1091
+ end
1092
+ define_callback cb, 'MOTION_CB', :iis_i
1093
+ end
1094
+
1095
+ ##
1096
+ # :attr_writer: valuechanged_cb
1097
+ # Called after the value was interactively changed by the user. Called when
1098
+ # the selection is changed or when the text is edited.
1099
+ # Callback must respond to +call+ and takes no arguments.
1100
+
1101
+ # --
1102
+ def valuechanged_cb= callback
1103
+ unless callback.arity.zero?
1104
+ raise ArgumentError, 'valuechanged_cb callback must take 0 arguments'
1105
+ end
1106
+ cb = Proc.new do |ih|
1107
+ callback.call
1108
+ end
1109
+ define_callback cb, 'VALUECHANGED_CB', :plain
1110
+ end
1111
+ end
1112
+ end