fxruby 1.2.2 → 1.2.3
Sign up to get free protection for your applications and to get access to all the features.
- data/ChangeLog +199 -0
- data/doc/apes02.html +2 -2
- data/doc/apes03.html +1 -1
- data/doc/book.html +1 -1
- data/doc/changes.html +48 -3
- data/doc/cvs.html +2 -2
- data/doc/differences.html +3 -3
- data/doc/gems.html +43 -43
- data/doc/implementation.html +1 -1
- data/doc/library.html +5 -5
- data/doc/opengl.html +5 -5
- data/doc/pt02.html +1 -1
- data/doc/scintilla.html +4 -4
- data/examples/browser.rb +1 -1
- data/examples/button.rb +59 -48
- data/examples/groupbox.rb +5 -4
- data/examples/ratio.rb +70 -0
- data/examples/table.rb +1 -1
- data/ext/fox12/FXRuby.cpp +2 -1
- data/ext/fox12/core_wrap.cpp +16 -6
- data/ext/fox12/dc_wrap.cpp +16 -6
- data/ext/fox12/dialogs_wrap.cpp +16 -6
- data/ext/fox12/frames_wrap.cpp +16 -6
- data/ext/fox12/fx3d_wrap.cpp +16 -6
- data/ext/fox12/iconlist_wrap.cpp +16 -6
- data/ext/fox12/icons_wrap.cpp +18 -7
- data/ext/fox12/image_wrap.cpp +16 -6
- data/ext/fox12/label_wrap.cpp +16 -6
- data/ext/fox12/layout_wrap.cpp +16 -6
- data/ext/fox12/librb.c +18 -7
- data/ext/fox12/list_wrap.cpp +16 -6
- data/ext/fox12/mdi_wrap.cpp +16 -6
- data/ext/fox12/menu_wrap.cpp +16 -6
- data/ext/fox12/scintilla_wrap.cpp +19 -12
- data/ext/fox12/table_wrap.cpp +16 -6
- data/ext/fox12/text_wrap.cpp +16 -6
- data/ext/fox12/treelist_wrap.cpp +16 -6
- data/ext/fox12/ui_wrap.cpp +16 -6
- data/lib/fox12/aliases.rb +32 -11
- data/lib/fox12/dialogs.rb +72 -0
- data/lib/fox12/execute_nonmodal.rb +70 -0
- data/lib/fox12/iterators.rb +3 -3
- data/lib/fox12/splashscreen.rb +83 -0
- data/lib/fox12/version.rb +1 -1
- data/rdoc-sources/FXDC.rb +14 -13
- data/rdoc-sources/FXDataTarget.rb +30 -5
- data/rdoc-sources/FXFileDialog.rb +50 -5
- data/rdoc-sources/FXList.rb +13 -13
- data/rdoc-sources/FXMemoryBuffer.rb +15 -10
- data/rdoc-sources/FXTable.rb +193 -107
- data/rdoc-sources/FXText.rb +2 -2
- data/rdoc-sources/FXToolBarTab.rb +69 -0
- data/rdoc-sources/FXToolTip.rb +1 -1
- data/tests/TC_FXMaterial.rb +14 -0
- metadata +10 -4
data/ext/fox12/text_wrap.cpp
CHANGED
@@ -86,13 +86,16 @@ private:
|
|
86
86
|
|
87
87
|
#ifdef __cplusplus
|
88
88
|
# ifndef RUBY_METHOD_FUNC /* These definitions should work for Ruby 1.4.6 */
|
89
|
+
# define PROTECTFUNC(f) ((VALUE (*)()) f)
|
89
90
|
# define VALUEFUNC(f) ((VALUE (*)()) f)
|
90
91
|
# define VOIDFUNC(f) ((void (*)()) f)
|
91
92
|
# else
|
92
93
|
# ifndef ANYARGS /* These definitions should work for Ruby 1.6 */
|
94
|
+
# define PROTECTFUNC(f) ((VALUE (*)()) f)
|
93
95
|
# define VALUEFUNC(f) ((VALUE (*)()) f)
|
94
96
|
# define VOIDFUNC(f) ((RUBY_DATA_FUNC) f)
|
95
|
-
# else /* These definitions should work for Ruby 1.7 */
|
97
|
+
# else /* These definitions should work for Ruby 1.7+ */
|
98
|
+
# define PROTECTFUNC(f) ((VALUE (*)(VALUE)) f)
|
96
99
|
# define VALUEFUNC(f) ((VALUE (*)(ANYARGS)) f)
|
97
100
|
# define VOIDFUNC(f) ((RUBY_DATA_FUNC) f)
|
98
101
|
# endif
|
@@ -265,13 +268,14 @@ SWIGIMPORT(char *) SWIG_UnpackData(char *, void *, int);
|
|
265
268
|
#else
|
266
269
|
|
267
270
|
static swig_type_info *swig_type_list = 0;
|
271
|
+
static swig_type_info **swig_type_list_handle = &swig_type_list;
|
268
272
|
|
269
273
|
/* Register a type mapping with the type-checking */
|
270
274
|
SWIGRUNTIME(swig_type_info *)
|
271
275
|
SWIG_TypeRegister(swig_type_info *ti) {
|
272
276
|
swig_type_info *tc, *head, *ret, *next;
|
273
277
|
/* Check to see if this type has already been registered */
|
274
|
-
tc =
|
278
|
+
tc = *swig_type_list_handle;
|
275
279
|
while (tc) {
|
276
280
|
if (strcmp(tc->name, ti->name) == 0) {
|
277
281
|
/* Already exists in the table. Just add additional types to the list */
|
@@ -286,8 +290,8 @@ SWIG_TypeRegister(swig_type_info *ti) {
|
|
286
290
|
next = 0;
|
287
291
|
|
288
292
|
/* Place in list */
|
289
|
-
ti->prev =
|
290
|
-
|
293
|
+
ti->prev = *swig_type_list_handle;
|
294
|
+
*swig_type_list_handle = ti;
|
291
295
|
|
292
296
|
/* Build linked lists */
|
293
297
|
l1:
|
@@ -416,7 +420,7 @@ SWIG_TypeEquiv(const char *nb, const char *tb) {
|
|
416
420
|
/* Search for a swig_type_info structure */
|
417
421
|
SWIGRUNTIME(swig_type_info *)
|
418
422
|
SWIG_TypeQuery(const char *name) {
|
419
|
-
swig_type_info *ty =
|
423
|
+
swig_type_info *ty = *swig_type_list_handle;
|
420
424
|
while (ty) {
|
421
425
|
if (ty->str && (SWIG_TypeEquiv(ty->str,name))) return ty;
|
422
426
|
if (ty->name && (strcmp(name,ty->name) == 0)) return ty;
|
@@ -434,7 +438,7 @@ SWIG_TypeClientData(swig_type_info *ti, void *clientdata) {
|
|
434
438
|
equiv = ti->next;
|
435
439
|
while (equiv) {
|
436
440
|
if (!equiv->converter) {
|
437
|
-
tc =
|
441
|
+
tc = *swig_type_list_handle;
|
438
442
|
while (tc) {
|
439
443
|
if ((strcmp(tc->name, equiv->name) == 0))
|
440
444
|
SWIG_TypeClientData(tc,clientdata);
|
@@ -531,6 +535,12 @@ static swig_type_info *swig_types[12];
|
|
531
535
|
#define SWIG_name "Text"
|
532
536
|
|
533
537
|
|
538
|
+
static void SWIG_AsVal(VALUE obj, int *val)
|
539
|
+
{
|
540
|
+
*val = (int) NUM2INT(obj);
|
541
|
+
}
|
542
|
+
|
543
|
+
|
534
544
|
#include "FXRbCommon.h"
|
535
545
|
|
536
546
|
|
data/ext/fox12/treelist_wrap.cpp
CHANGED
@@ -86,13 +86,16 @@ private:
|
|
86
86
|
|
87
87
|
#ifdef __cplusplus
|
88
88
|
# ifndef RUBY_METHOD_FUNC /* These definitions should work for Ruby 1.4.6 */
|
89
|
+
# define PROTECTFUNC(f) ((VALUE (*)()) f)
|
89
90
|
# define VALUEFUNC(f) ((VALUE (*)()) f)
|
90
91
|
# define VOIDFUNC(f) ((void (*)()) f)
|
91
92
|
# else
|
92
93
|
# ifndef ANYARGS /* These definitions should work for Ruby 1.6 */
|
94
|
+
# define PROTECTFUNC(f) ((VALUE (*)()) f)
|
93
95
|
# define VALUEFUNC(f) ((VALUE (*)()) f)
|
94
96
|
# define VOIDFUNC(f) ((RUBY_DATA_FUNC) f)
|
95
|
-
# else /* These definitions should work for Ruby 1.7 */
|
97
|
+
# else /* These definitions should work for Ruby 1.7+ */
|
98
|
+
# define PROTECTFUNC(f) ((VALUE (*)(VALUE)) f)
|
96
99
|
# define VALUEFUNC(f) ((VALUE (*)(ANYARGS)) f)
|
97
100
|
# define VOIDFUNC(f) ((RUBY_DATA_FUNC) f)
|
98
101
|
# endif
|
@@ -265,13 +268,14 @@ SWIGIMPORT(char *) SWIG_UnpackData(char *, void *, int);
|
|
265
268
|
#else
|
266
269
|
|
267
270
|
static swig_type_info *swig_type_list = 0;
|
271
|
+
static swig_type_info **swig_type_list_handle = &swig_type_list;
|
268
272
|
|
269
273
|
/* Register a type mapping with the type-checking */
|
270
274
|
SWIGRUNTIME(swig_type_info *)
|
271
275
|
SWIG_TypeRegister(swig_type_info *ti) {
|
272
276
|
swig_type_info *tc, *head, *ret, *next;
|
273
277
|
/* Check to see if this type has already been registered */
|
274
|
-
tc =
|
278
|
+
tc = *swig_type_list_handle;
|
275
279
|
while (tc) {
|
276
280
|
if (strcmp(tc->name, ti->name) == 0) {
|
277
281
|
/* Already exists in the table. Just add additional types to the list */
|
@@ -286,8 +290,8 @@ SWIG_TypeRegister(swig_type_info *ti) {
|
|
286
290
|
next = 0;
|
287
291
|
|
288
292
|
/* Place in list */
|
289
|
-
ti->prev =
|
290
|
-
|
293
|
+
ti->prev = *swig_type_list_handle;
|
294
|
+
*swig_type_list_handle = ti;
|
291
295
|
|
292
296
|
/* Build linked lists */
|
293
297
|
l1:
|
@@ -416,7 +420,7 @@ SWIG_TypeEquiv(const char *nb, const char *tb) {
|
|
416
420
|
/* Search for a swig_type_info structure */
|
417
421
|
SWIGRUNTIME(swig_type_info *)
|
418
422
|
SWIG_TypeQuery(const char *name) {
|
419
|
-
swig_type_info *ty =
|
423
|
+
swig_type_info *ty = *swig_type_list_handle;
|
420
424
|
while (ty) {
|
421
425
|
if (ty->str && (SWIG_TypeEquiv(ty->str,name))) return ty;
|
422
426
|
if (ty->name && (strcmp(name,ty->name) == 0)) return ty;
|
@@ -434,7 +438,7 @@ SWIG_TypeClientData(swig_type_info *ti, void *clientdata) {
|
|
434
438
|
equiv = ti->next;
|
435
439
|
while (equiv) {
|
436
440
|
if (!equiv->converter) {
|
437
|
-
tc =
|
441
|
+
tc = *swig_type_list_handle;
|
438
442
|
while (tc) {
|
439
443
|
if ((strcmp(tc->name, equiv->name) == 0))
|
440
444
|
SWIG_TypeClientData(tc,clientdata);
|
@@ -538,6 +542,12 @@ static swig_type_info *swig_types[19];
|
|
538
542
|
#define SWIG_name "Treelist"
|
539
543
|
|
540
544
|
|
545
|
+
static void SWIG_AsVal(VALUE obj, int *val)
|
546
|
+
{
|
547
|
+
*val = (int) NUM2INT(obj);
|
548
|
+
}
|
549
|
+
|
550
|
+
|
541
551
|
#include "FXRbCommon.h"
|
542
552
|
|
543
553
|
|
data/ext/fox12/ui_wrap.cpp
CHANGED
@@ -86,13 +86,16 @@ private:
|
|
86
86
|
|
87
87
|
#ifdef __cplusplus
|
88
88
|
# ifndef RUBY_METHOD_FUNC /* These definitions should work for Ruby 1.4.6 */
|
89
|
+
# define PROTECTFUNC(f) ((VALUE (*)()) f)
|
89
90
|
# define VALUEFUNC(f) ((VALUE (*)()) f)
|
90
91
|
# define VOIDFUNC(f) ((void (*)()) f)
|
91
92
|
# else
|
92
93
|
# ifndef ANYARGS /* These definitions should work for Ruby 1.6 */
|
94
|
+
# define PROTECTFUNC(f) ((VALUE (*)()) f)
|
93
95
|
# define VALUEFUNC(f) ((VALUE (*)()) f)
|
94
96
|
# define VOIDFUNC(f) ((RUBY_DATA_FUNC) f)
|
95
|
-
# else /* These definitions should work for Ruby 1.7 */
|
97
|
+
# else /* These definitions should work for Ruby 1.7+ */
|
98
|
+
# define PROTECTFUNC(f) ((VALUE (*)(VALUE)) f)
|
96
99
|
# define VALUEFUNC(f) ((VALUE (*)(ANYARGS)) f)
|
97
100
|
# define VOIDFUNC(f) ((RUBY_DATA_FUNC) f)
|
98
101
|
# endif
|
@@ -265,13 +268,14 @@ SWIGIMPORT(char *) SWIG_UnpackData(char *, void *, int);
|
|
265
268
|
#else
|
266
269
|
|
267
270
|
static swig_type_info *swig_type_list = 0;
|
271
|
+
static swig_type_info **swig_type_list_handle = &swig_type_list;
|
268
272
|
|
269
273
|
/* Register a type mapping with the type-checking */
|
270
274
|
SWIGRUNTIME(swig_type_info *)
|
271
275
|
SWIG_TypeRegister(swig_type_info *ti) {
|
272
276
|
swig_type_info *tc, *head, *ret, *next;
|
273
277
|
/* Check to see if this type has already been registered */
|
274
|
-
tc =
|
278
|
+
tc = *swig_type_list_handle;
|
275
279
|
while (tc) {
|
276
280
|
if (strcmp(tc->name, ti->name) == 0) {
|
277
281
|
/* Already exists in the table. Just add additional types to the list */
|
@@ -286,8 +290,8 @@ SWIG_TypeRegister(swig_type_info *ti) {
|
|
286
290
|
next = 0;
|
287
291
|
|
288
292
|
/* Place in list */
|
289
|
-
ti->prev =
|
290
|
-
|
293
|
+
ti->prev = *swig_type_list_handle;
|
294
|
+
*swig_type_list_handle = ti;
|
291
295
|
|
292
296
|
/* Build linked lists */
|
293
297
|
l1:
|
@@ -416,7 +420,7 @@ SWIG_TypeEquiv(const char *nb, const char *tb) {
|
|
416
420
|
/* Search for a swig_type_info structure */
|
417
421
|
SWIGRUNTIME(swig_type_info *)
|
418
422
|
SWIG_TypeQuery(const char *name) {
|
419
|
-
swig_type_info *ty =
|
423
|
+
swig_type_info *ty = *swig_type_list_handle;
|
420
424
|
while (ty) {
|
421
425
|
if (ty->str && (SWIG_TypeEquiv(ty->str,name))) return ty;
|
422
426
|
if (ty->name && (strcmp(name,ty->name) == 0)) return ty;
|
@@ -434,7 +438,7 @@ SWIG_TypeClientData(swig_type_info *ti, void *clientdata) {
|
|
434
438
|
equiv = ti->next;
|
435
439
|
while (equiv) {
|
436
440
|
if (!equiv->converter) {
|
437
|
-
tc =
|
441
|
+
tc = *swig_type_list_handle;
|
438
442
|
while (tc) {
|
439
443
|
if ((strcmp(tc->name, equiv->name) == 0))
|
440
444
|
SWIG_TypeClientData(tc,clientdata);
|
@@ -560,6 +564,12 @@ static swig_type_info *swig_types[41];
|
|
560
564
|
#define SWIG_name "Ui"
|
561
565
|
|
562
566
|
|
567
|
+
static void SWIG_AsVal(VALUE obj, int *val)
|
568
|
+
{
|
569
|
+
*val = (int) NUM2INT(obj);
|
570
|
+
}
|
571
|
+
|
572
|
+
|
563
573
|
#include "FXRbCommon.h"
|
564
574
|
|
565
575
|
|
data/lib/fox12/aliases.rb
CHANGED
@@ -152,6 +152,9 @@ module Fox
|
|
152
152
|
def menuPause=(*args) # :nodoc:
|
153
153
|
setMenuPause(*args)
|
154
154
|
end
|
155
|
+
def tooltipPause # :nodoc:
|
156
|
+
getTooltipPause()
|
157
|
+
end
|
155
158
|
def tooltipPause=(*args) # :nodoc:
|
156
159
|
setTooltipPause(*args)
|
157
160
|
end
|
@@ -1050,6 +1053,9 @@ module Fox
|
|
1050
1053
|
def filename(*args) # :nodoc:
|
1051
1054
|
getFilename(*args)
|
1052
1055
|
end
|
1056
|
+
def filenames # :nodoc:
|
1057
|
+
getFilenames()
|
1058
|
+
end
|
1053
1059
|
def pattern=(*args) # :nodoc:
|
1054
1060
|
setPattern(*args)
|
1055
1061
|
end
|
@@ -2048,7 +2054,7 @@ module Fox
|
|
2048
2054
|
getJustify()
|
2049
2055
|
end
|
2050
2056
|
def justification=(j) # :nodoc:
|
2051
|
-
|
2057
|
+
setJustify(j)
|
2052
2058
|
end
|
2053
2059
|
def iconPosition # :nodoc:
|
2054
2060
|
getIconPosition()
|
@@ -3297,7 +3303,7 @@ module Fox
|
|
3297
3303
|
getSelBackColor()
|
3298
3304
|
end
|
3299
3305
|
def selBackColor=(clr) # :nodoc:
|
3300
|
-
setSelBackColor()
|
3306
|
+
setSelBackColor(clr)
|
3301
3307
|
end
|
3302
3308
|
def selTextColor() # :nodoc:
|
3303
3309
|
getSelTextColor()
|
@@ -3711,7 +3717,7 @@ module Fox
|
|
3711
3717
|
getSelBackColor()
|
3712
3718
|
end
|
3713
3719
|
def selBackColor=(clr) # :nodoc:
|
3714
|
-
setSelBackColor()
|
3720
|
+
setSelBackColor(clr)
|
3715
3721
|
end
|
3716
3722
|
def selTextColor() # :nodoc:
|
3717
3723
|
getSelTextColor()
|
@@ -4045,6 +4051,12 @@ module Fox
|
|
4045
4051
|
def defRowHeight(*args) # :nodoc:
|
4046
4052
|
getDefRowHeight(*args)
|
4047
4053
|
end
|
4054
|
+
def minRowHeight(r) # :nodoc:
|
4055
|
+
getMinRowHeight(r)
|
4056
|
+
end
|
4057
|
+
def minColumnWidth(c) # :nodoc:
|
4058
|
+
getMinColumnWidth(c)
|
4059
|
+
end
|
4048
4060
|
def currentRow(*args) # :nodoc:
|
4049
4061
|
getCurrentRow(*args)
|
4050
4062
|
end
|
@@ -4069,6 +4081,15 @@ module Fox
|
|
4069
4081
|
def selEndColumn # :nodoc:
|
4070
4082
|
getSelEndColumn()
|
4071
4083
|
end
|
4084
|
+
def rowSelected?(r) # :nodoc:
|
4085
|
+
isRowSelected(r)
|
4086
|
+
end
|
4087
|
+
def columnSelected?(c) # :nodoc:
|
4088
|
+
isColumnSelected(c)
|
4089
|
+
end
|
4090
|
+
def anythingSelected? # :nodoc:
|
4091
|
+
isAnythingSelected
|
4092
|
+
end
|
4072
4093
|
def font=(*args) # :nodoc:
|
4073
4094
|
setFont(*args)
|
4074
4095
|
end
|
@@ -4359,17 +4380,17 @@ module Fox
|
|
4359
4380
|
def textStyle(*args) # :nodoc:
|
4360
4381
|
getTextStyle(*args)
|
4361
4382
|
end
|
4362
|
-
def
|
4363
|
-
|
4383
|
+
def visibleRows=(*args) # :nodoc:
|
4384
|
+
setVisibleRows(*args)
|
4364
4385
|
end
|
4365
|
-
def
|
4366
|
-
|
4386
|
+
def visibleRows(*args) # :nodoc:
|
4387
|
+
getVisibleRows(*args)
|
4367
4388
|
end
|
4368
|
-
def
|
4369
|
-
|
4389
|
+
def visibleColumns=(*args) # :nodoc:
|
4390
|
+
setVisibleColumns(*args)
|
4370
4391
|
end
|
4371
|
-
def
|
4372
|
-
|
4392
|
+
def visibleColumns(*args) # :nodoc:
|
4393
|
+
getVisibleColumns(*args)
|
4373
4394
|
end
|
4374
4395
|
def hiliteMatchTime=(*args) # :nodoc:
|
4375
4396
|
setHiliteMatchTime(*args)
|
@@ -0,0 +1,72 @@
|
|
1
|
+
module Fox
|
2
|
+
# Module to include in FXDialogBox to provide an easy nonmodal version
|
3
|
+
# of execute.
|
4
|
+
module FTNonModal
|
5
|
+
include Responder
|
6
|
+
|
7
|
+
def initialize(*args)
|
8
|
+
super if defined?(super)
|
9
|
+
FXMAPFUNC(SEL_COMMAND, FXDialogBox::ID_CANCEL, :onCmdCancel)
|
10
|
+
FXMAPFUNC(SEL_COMMAND, FXDialogBox::ID_ACCEPT, :onCmdAccept)
|
11
|
+
end
|
12
|
+
|
13
|
+
#
|
14
|
+
# Creates and shows the dialog, and registers the associated block to be
|
15
|
+
# called when the dialog is closed. The block is passed a boolean argument
|
16
|
+
# which is true if and only if the dialog was accepted.
|
17
|
+
#
|
18
|
+
# For example:
|
19
|
+
#
|
20
|
+
# dialogBox.execute_modal do |accepted|
|
21
|
+
# if accepted
|
22
|
+
# puts "Dialog accepted"
|
23
|
+
# else
|
24
|
+
# puts "Dialog cancelled"
|
25
|
+
# end
|
26
|
+
#
|
27
|
+
def execute_modal(placement = PLACEMENT_CURSOR, &block)
|
28
|
+
@__FTNonModal_block = block
|
29
|
+
execute(placement)
|
30
|
+
end
|
31
|
+
|
32
|
+
#
|
33
|
+
# Creates and shows the dialog, and registers the associated block to be
|
34
|
+
# called when the dialog is closed. The block is passed a boolean argument
|
35
|
+
# which is true if and only if the dialog was accepted.
|
36
|
+
#
|
37
|
+
# For example:
|
38
|
+
#
|
39
|
+
# dialogBox.execute_nonmodal do |accepted|
|
40
|
+
# if accepted
|
41
|
+
# puts "Dialog accepted"
|
42
|
+
# else
|
43
|
+
# puts "Dialog cancelled"
|
44
|
+
# end
|
45
|
+
#
|
46
|
+
def execute_nonmodal(placement = PLACEMENT_CURSOR, &block)
|
47
|
+
@__FTNonModal_block = block
|
48
|
+
create
|
49
|
+
show placement
|
50
|
+
end
|
51
|
+
|
52
|
+
def onCmdCancel(*args) # :nodoc:
|
53
|
+
on_nonmodal_close(false)
|
54
|
+
end
|
55
|
+
|
56
|
+
def onCmdAccept(*args) # :nodoc:
|
57
|
+
on_nonmodal_close(true)
|
58
|
+
end
|
59
|
+
|
60
|
+
# Called when dialog is closed, with _accepted_ equal to true if and only if
|
61
|
+
# the user accepted the dialog.
|
62
|
+
def on_nonmodal_close(accepted)
|
63
|
+
@__FTNonModal_block[accepted]
|
64
|
+
|
65
|
+
##return 0 -- why isn't this enough to close window?
|
66
|
+
## oh well, let's immitate FXTopWindow:
|
67
|
+
getApp().stopModal(self, accepted ? 1 : 0)
|
68
|
+
hide()
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
@@ -0,0 +1,70 @@
|
|
1
|
+
module Fox
|
2
|
+
# Module to include in FXDialogBox to provide an easy nonmodal version
|
3
|
+
# of execute.
|
4
|
+
module FTNonModal
|
5
|
+
|
6
|
+
def initialize(*args)
|
7
|
+
super if defined?(super)
|
8
|
+
FXMAPFUNC(SEL_COMMAND, FXDialogBox::ID_CANCEL, :onCmdCancel)
|
9
|
+
FXMAPFUNC(SEL_COMMAND, FXDialogBox::ID_ACCEPT, :onCmdAccept)
|
10
|
+
end
|
11
|
+
|
12
|
+
#
|
13
|
+
# Creates and shows the dialog, and registers the associated block to be
|
14
|
+
# called when the dialog is closed. The block is passed a boolean argument
|
15
|
+
# which is true if and only if the dialog was accepted.
|
16
|
+
#
|
17
|
+
# For example:
|
18
|
+
#
|
19
|
+
# dialogBox.execute_modal do |accepted|
|
20
|
+
# if accepted
|
21
|
+
# puts "Dialog accepted"
|
22
|
+
# else
|
23
|
+
# puts "Dialog cancelled"
|
24
|
+
# end
|
25
|
+
#
|
26
|
+
def execute_modal(placement = PLACEMENT_CURSOR, &block)
|
27
|
+
@__FTNonModal_block = block
|
28
|
+
execute(placement)
|
29
|
+
end
|
30
|
+
|
31
|
+
#
|
32
|
+
# Creates and shows the dialog, and registers the associated block to be
|
33
|
+
# called when the dialog is closed. The block is passed a boolean argument
|
34
|
+
# which is true if and only if the dialog was accepted.
|
35
|
+
#
|
36
|
+
# For example:
|
37
|
+
#
|
38
|
+
# dialogBox.execute_nonmodal do |accepted|
|
39
|
+
# if accepted
|
40
|
+
# puts "Dialog accepted"
|
41
|
+
# else
|
42
|
+
# puts "Dialog cancelled"
|
43
|
+
# end
|
44
|
+
#
|
45
|
+
def execute_nonmodal(placement = PLACEMENT_CURSOR, &block)
|
46
|
+
@__FTNonModal_block = block
|
47
|
+
create
|
48
|
+
show placement
|
49
|
+
end
|
50
|
+
|
51
|
+
def onCmdCancel(*args) # :nodoc:
|
52
|
+
on_nonmodal_close(false)
|
53
|
+
end
|
54
|
+
|
55
|
+
def onCmdAccept(*args) # :nodoc:
|
56
|
+
on_nonmodal_close(true)
|
57
|
+
end
|
58
|
+
|
59
|
+
# Called when dialog is closed, with _accepted_ equal to +true+ if and
|
60
|
+
# only if the user accepted the dialog.
|
61
|
+
def on_nonmodal_close(accepted)
|
62
|
+
@__FTNonModal_block[accepted]
|
63
|
+
|
64
|
+
##return 0 -- why isn't this enough to close window?
|
65
|
+
## oh well, let's imitate FXTopWindow:
|
66
|
+
getApp().stopModal(self, accepted ? 1 : 0)
|
67
|
+
hide()
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
data/lib/fox12/iterators.rb
CHANGED
@@ -27,7 +27,7 @@ module Fox
|
|
27
27
|
#
|
28
28
|
def each # :yields: aHeaderItem
|
29
29
|
0.upto(numItems - 1) do |i|
|
30
|
-
yield
|
30
|
+
yield getItem(i)
|
31
31
|
end
|
32
32
|
self
|
33
33
|
end
|
@@ -43,7 +43,7 @@ module Fox
|
|
43
43
|
#
|
44
44
|
def each # :yields: anIconItem
|
45
45
|
0.upto(numItems - 1) do |i|
|
46
|
-
yield
|
46
|
+
yield getItem(i)
|
47
47
|
end
|
48
48
|
self
|
49
49
|
end
|
@@ -59,7 +59,7 @@ module Fox
|
|
59
59
|
#
|
60
60
|
def each # :yields: aListItem
|
61
61
|
0.upto(numItems - 1) do |i|
|
62
|
-
yield
|
62
|
+
yield getItem(i)
|
63
63
|
end
|
64
64
|
self
|
65
65
|
end
|
@@ -0,0 +1,83 @@
|
|
1
|
+
#
|
2
|
+
# Splashscreen component, contributed by David Naseby.
|
3
|
+
#
|
4
|
+
|
5
|
+
require 'fox12'
|
6
|
+
require 'fox12/colors'
|
7
|
+
|
8
|
+
module Fox
|
9
|
+
#
|
10
|
+
# The FXSplashScreen window...
|
11
|
+
#
|
12
|
+
class FXSplashScreen < FXDialogBox
|
13
|
+
|
14
|
+
#
|
15
|
+
# Return an initialized FXSplashScreen instance.
|
16
|
+
#
|
17
|
+
# ==== Parameters:
|
18
|
+
#
|
19
|
+
# +owner+:: Owner window for this dialog box [FXWindow]
|
20
|
+
# +title+:: Title string for this dialog box [String]
|
21
|
+
# +text+:: Message text for this dialog box [String]
|
22
|
+
# +action+:: The action
|
23
|
+
#
|
24
|
+
def initialize( owner, title, text, action )
|
25
|
+
# Initialize the base class first
|
26
|
+
super(owner, title)
|
27
|
+
|
28
|
+
# Store the action block
|
29
|
+
@action = action
|
30
|
+
|
31
|
+
# Construct the window contents
|
32
|
+
FXVerticalFrame.new( self ) do |frame|
|
33
|
+
text.each_line do |line|
|
34
|
+
FXLabel.new( frame, line.strip )
|
35
|
+
end
|
36
|
+
FXLabel.new( frame, "Click OK to continue (this may take a few moments)...." )
|
37
|
+
@status = FXLabel.new( frame, " " )
|
38
|
+
@accept = FXButton.new( frame, "&OK", nil, self, ID_ACCEPT,
|
39
|
+
FRAME_RAISED|FRAME_THICK|LAYOUT_RIGHT|LAYOUT_CENTER_Y)
|
40
|
+
@accept.enabled = false
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
def execute(placement = PLACEMENT_OWNER)
|
45
|
+
Thread.new do
|
46
|
+
sleep 1
|
47
|
+
@action.call method( :update_status )
|
48
|
+
update_status "Completed"
|
49
|
+
@accept.enabled = true
|
50
|
+
end
|
51
|
+
super
|
52
|
+
end
|
53
|
+
|
54
|
+
def update_status(msg)
|
55
|
+
@status.text = msg
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
if $0 == __FILE__
|
61
|
+
class FakeSite
|
62
|
+
def open( &status )
|
63
|
+
yield ">>>>> Opening Site" if block_given?
|
64
|
+
sleep 5
|
65
|
+
yield "site open" if block_given?
|
66
|
+
end
|
67
|
+
end
|
68
|
+
fake_site = FakeSite.new
|
69
|
+
|
70
|
+
include Fox
|
71
|
+
|
72
|
+
FXApp.new( "Test SplashScreen" ) do |theApp|
|
73
|
+
FXMainWindow.new( theApp, "Hello" ) do |mainWin|
|
74
|
+
FXButton.new( mainWin, "Show Splash" ).connect( SEL_COMMAND ) do
|
75
|
+
lv = FXSplashScreen.new( mainWin, "Opening Site", "Welcome to Sitebuilder!\nOpening the site.\n", lambda{ |proc| fake_site.open( &proc ) } )
|
76
|
+
lv.execute
|
77
|
+
end
|
78
|
+
mainWin.show
|
79
|
+
end
|
80
|
+
theApp.create
|
81
|
+
theApp.run
|
82
|
+
end
|
83
|
+
end
|
data/lib/fox12/version.rb
CHANGED
data/rdoc-sources/FXDC.rb
CHANGED
@@ -35,7 +35,7 @@ module Fox
|
|
35
35
|
# Start of the arc, relative to the three-o'clock position from the center, in units of degrees * 64 [Integer]
|
36
36
|
attr_accessor :a
|
37
37
|
|
38
|
-
#
|
38
|
+
# Path and extent of the arc, relative to the three-o'clock position from the center, in units of degrees * 64 [Integer]
|
39
39
|
attr_accessor :b
|
40
40
|
end
|
41
41
|
|
@@ -324,12 +324,13 @@ module Fox
|
|
324
324
|
def drawRectangles(rectangles) ; end
|
325
325
|
|
326
326
|
#
|
327
|
-
# Draw
|
328
|
-
# The argument <em>
|
329
|
-
# three-o'clock position from the center, in units of degrees*64.
|
330
|
-
# The argument <em>
|
331
|
-
# to the start of the arc
|
332
|
-
# The arguments _x_, _y_, _w_, and _h_ specify the bounding rectangle
|
327
|
+
# Draw an arc.
|
328
|
+
# The argument <em>start</em> specifies the start of the arc relative to
|
329
|
+
# the three-o'clock position from the center, in units of degrees*64.
|
330
|
+
# The argument <em>extent</em> specifies the path and extent of the arc,
|
331
|
+
# relative to the start of the arc (also in units of degrees*64).
|
332
|
+
# The arguments _x_, _y_, _w_, and _h_ specify the bounding rectangle
|
333
|
+
# of the arc.
|
333
334
|
#
|
334
335
|
# === Parameters:
|
335
336
|
#
|
@@ -337,12 +338,12 @@ module Fox
|
|
337
338
|
# <tt>y</tt>:: y-coordinate of the upper left corner of the bounding rectangle [Integer]
|
338
339
|
# <tt>w</tt>:: width of the bounding rectangle, in pixels [Integer]
|
339
340
|
# <tt>h</tt>:: height of the bounding rectangle, in pixels [Integer]
|
340
|
-
# <tt>
|
341
|
-
# <tt>
|
341
|
+
# <tt>start</tt>:: starting angle of the arc, in 64ths of a degree [Integer]
|
342
|
+
# <tt>extent</tt>:: the path and extent of the arc, relative to the start of the arc (in 64ths of a degree) [Integer]
|
342
343
|
#
|
343
344
|
# See also #drawArcs, #fillArc and #fillArcs.
|
344
345
|
#
|
345
|
-
def drawArc(x, y, w, h,
|
346
|
+
def drawArc(x, y, w, h, start, extent) ; end
|
346
347
|
|
347
348
|
#
|
348
349
|
# Draw arcs, where _arcs_ is an array of FXArc instances.
|
@@ -392,12 +393,12 @@ module Fox
|
|
392
393
|
# <tt>y</tt>:: y-coordinate of the upper left corner of the bounding rectangle [Integer]
|
393
394
|
# <tt>w</tt>:: width of the bounding rectangle, in pixels [Integer]
|
394
395
|
# <tt>h</tt>:: height of the bounding rectangle, in pixels [Integer]
|
395
|
-
# <tt>
|
396
|
-
# <tt>
|
396
|
+
# <tt>start</tt>:: starting angle of the arc, in 64ths of a degree [Integer]
|
397
|
+
# <tt>extent</tt>:: the path and extent of the arc, relative to the start of the arc (in 64ths of a degree) [Integer]
|
397
398
|
#
|
398
399
|
# See also #drawArc, #drawArcs and #fillArcs.
|
399
400
|
#
|
400
|
-
def fillArc(x, y, w, h,
|
401
|
+
def fillArc(x, y, w, h, start, extent) ; end
|
401
402
|
|
402
403
|
#
|
403
404
|
# Draw filled arcs, where _arcs_ is an array of FXArc instances.
|