[r9431]: ooDialog / trunk / ooDialog / PlainBaseDialog.cls  Maximize  Restore  History

Download this file

1011 lines (844 with data), 44.8 kB

   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
  66
  67
  68
  69
  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
  95
  96
  97
  98
  99
 100
 101
 102
 103
 104
 105
 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
 141
 142
 143
 144
 145
 146
 147
 148
 149
 150
 151
 152
 153
 154
 155
 156
 157
 158
 159
 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
 187
 188
 189
 190
 191
 192
 193
 194
 195
 196
 197
 198
 199
 200
 201
 202
 203
 204
 205
 206
 207
 208
 209
 210
 211
 212
 213
 214
 215
 216
 217
 218
 219
 220
 221
 222
 223
 224
 225
 226
 227
 228
 229
 230
 231
 232
 233
 234
 235
 236
 237
 238
 239
 240
 241
 242
 243
 244
 245
 246
 247
 248
 249
 250
 251
 252
 253
 254
 255
 256
 257
 258
 259
 260
 261
 262
 263
 264
 265
 266
 267
 268
 269
 270
 271
 272
 273
 274
 275
 276
 277
 278
 279
 280
 281
 282
 283
 284
 285
 286
 287
 288
 289
 290
 291
 292
 293
 294
 295
 296
 297
 298
 299
 300
 301
 302
 303
 304
 305
 306
 307
 308
 309
 310
 311
 312
 313
 314
 315
 316
 317
 318
 319
 320
 321
 322
 323
 324
 325
 326
 327
 328
 329
 330
 331
 332
 333
 334
 335
 336
 337
 338
 339
 340
 341
 342
 343
 344
 345
 346
 347
 348
 349
 350
 351
 352
 353
 354
 355
 356
 357
 358
 359
 360
 361
 362
 363
 364
 365
 366
 367
 368
 369
 370
 371
 372
 373
 374
 375
 376
 377
 378
 379
 380
 381
 382
 383
 384
 385
 386
 387
 388
 389
 390
 391
 392
 393
 394
 395
 396
 397
 398
 399
 400
 401
 402
 403
 404
 405
 406
 407
 408
 409
 410
 411
 412
 413
 414
 415
 416
 417
 418
 419
 420
 421
 422
 423
 424
 425
 426
 427
 428
 429
 430
 431
 432
 433
 434
 435
 436
 437
 438
 439
 440
 441
 442
 443
 444
 445
 446
 447
 448
 449
 450
 451
 452
 453
 454
 455
 456
 457
 458
 459
 460
 461
 462
 463
 464
 465
 466
 467
 468
 469
 470
 471
 472
 473
 474
 475
 476
 477
 478
 479
 480
 481
 482
 483
 484
 485
 486
 487
 488
 489
 490
 491
 492
 493
 494
 495
 496
 497
 498
 499
 500
 501
 502
 503
 504
 505
 506
 507
 508
 509
 510
 511
 512
 513
 514
 515
 516
 517
 518
 519
 520
 521
 522
 523
 524
 525
 526
 527
 528
 529
 530
 531
 532
 533
 534
 535
 536
 537
 538
 539
 540
 541
 542
 543
 544
 545
 546
 547
 548
 549
 550
 551
 552
 553
 554
 555
 556
 557
 558
 559
 560
 561
 562
 563
 564
 565
 566
 567
 568
 569
 570
 571
 572
 573
 574
 575
 576
 577
 578
 579
 580
 581
 582
 583
 584
 585
 586
 587
 588
 589
 590
 591
 592
 593
 594
 595
 596
 597
 598
 599
 600
 601
 602
 603
 604
 605
 606
 607
 608
 609
 610
 611
 612
 613
 614
 615
 616
 617
 618
 619
 620
 621
 622
 623
 624
 625
 626
 627
 628
 629
 630
 631
 632
 633
 634
 635
 636
 637
 638
 639
 640
 641
 642
 643
 644
 645
 646
 647
 648
 649
 650
 651
 652
 653
 654
 655
 656
 657
 658
 659
 660
 661
 662
 663
 664
 665
 666
 667
 668
 669
 670
 671
 672
 673
 674
 675
 676
 677
 678
 679
 680
 681
 682
 683
 684
 685
 686
 687
 688
 689
 690
 691
 692
 693
 694
 695
 696
 697
 698
 699
 700
 701
 702
 703
 704
 705
 706
 707
 708
 709
 710
 711
 712
 713
 714
 715
 716
 717
 718
 719
 720
 721
 722
 723
 724
 725
 726
 727
 728
 729
 730
 731
 732
 733
 734
 735
 736
 737
 738
 739
 740
 741
 742
 743
 744
 745
 746
 747
 748
 749
 750
 751
 752
 753
 754
 755
 756
 757
 758
 759
 760
 761
 762
 763
 764
 765
 766
 767
 768
 769
 770
 771
 772
 773
 774
 775
 776
 777
 778
 779
 780
 781
 782
 783
 784
 785
 786
 787
 788
 789
 790
 791
 792
 793
 794
 795
 796
 797
 798
 799
 800
 801
 802
 803
 804
 805
 806
 807
 808
 809
 810
 811
 812
 813
 814
 815
 816
 817
 818
 819
 820
 821
 822
 823
 824
 825
 826
 827
 828
 829
 830
 831
 832
 833
 834
 835
 836
 837
 838
 839
 840
 841
 842
 843
 844
 845
 846
 847
 848
 849
 850
 851
 852
 853
 854
 855
 856
 857
 858
 859
 860
 861
 862
 863
 864
 865
 866
 867
 868
 869
 870
 871
 872
 873
 874
 875
 876
 877
 878
 879
 880
 881
 882
 883
 884
 885
 886
 887
 888
 889
 890
 891
 892
 893
 894
 895
 896
 897
 898
 899
 900
 901
 902
 903
 904
 905
 906
 907
 908
 909
 910
 911
 912
 913
 914
 915
 916
 917
 918
 919
 920
 921
 922
 923
 924
 925
 926
 927
 928
 929
 930
 931
 932
 933
 934
 935
 936
 937
 938
 939
 940
 941
 942
 943
 944
 945
 946
 947
 948
 949
 950
 951
 952
 953
 954
 955
 956
 957
 958
 959
 960
 961
 962
 963
 964
 965
 966
 967
 968
 969
 970
 971
 972
 973
 974
 975
 976
 977
 978
 979
 980
 981
 982
 983
 984
 985
 986
 987
 988
 989
 990
 991
 992
 993
 994
 995
 996
 997
 998
 999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
/*----------------------------------------------------------------------------*/
/* */
/* Copyright (c) 1995, 2004 IBM Corporation. All rights reserved. */
/* Copyright (c) 2005-2013 Rexx Language Association. All rights reserved. */
/* */
/* This program and the accompanying materials are made available under */
/* the terms of the Common Public License v1.0 which accompanies this */
/* distribution. A copy is also available at the following address: */
/* http://www.oorexx.org/license.html */
/* */
/* Redistribution and use in source and binary forms, with or */
/* without modification, are permitted provided that the following */
/* conditions are met: */
/* */
/* Redistributions of source code must retain the above copyright */
/* notice, this list of conditions and the following disclaimer. */
/* Redistributions in binary form must reproduce the above copyright */
/* notice, this list of conditions and the following disclaimer in */
/* the documentation and/or other materials provided with the distribution. */
/* */
/* Neither the name of Rexx Language Association nor the names */
/* of its contributors may be used to endorse or promote products */
/* derived from this software without specific prior written permission. */
/* */
/* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS */
/* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT */
/* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS */
/* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT */
/* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, */
/* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED */
/* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, */
/* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY */
/* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING */
/* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS */
/* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
/* */
/*----------------------------------------------------------------------------*/
/**
* Windows Dialog Interface for Open Object Rexx (ooRexx.)
*
* The basic dialog class
*
* PlainBaseDialog with its two inherited mixin classes, WindowBase and
* ResourceUtils, is the base dialog for all dialogs in the ooDialog framwork.
*/
/* The WindowBase class implements methods that are common to all windows. The
* methods only require the operating system window handle to function.
*/
::class 'WindowBase' public mixinclass object
::method init_windowBase private external "LIBRARY oodialog wb_init_windowBase"
::attribute initCode get external "LIBRARY oodialog wb_getInitCode"
::attribute initCode set external "LIBRARY oodialog wb_setInitCode"
::attribute hwnd get external "LIBRARY oodialog wb_getHwnd"
-- Size and Dialog Unit Factor
::attribute sizeX get external "LIBRARY oodialog wb_getSizeX"
::attribute sizeX set external "LIBRARY oodialog wb_setSizeX"
::attribute sizeY get external "LIBRARY oodialog wb_getSizeY"
::attribute sizeY set external "LIBRARY oodialog wb_setSizeY"
::attribute factorX get external "LIBRARY oodialog wb_getFactorX"
::attribute factorX set external "LIBRARY oodialog wb_setFactorX"
::attribute factorY get external "LIBRARY oodialog wb_getFactorY"
::attribute factorY set external "LIBRARY oodialog wb_setFactorY"
-- True size in pixels
::attribute pixelCX get external "LIBRARY oodialog wb_getPixelCX"
::attribute pixelCY get external "LIBRARY oodialog wb_getPixelCY"
::method childWindowFromPoint unguarded external "LIBRARY oodialog wb_childWindowFromPoint"
::method clear unguarded external "LIBRARY oodialog wb_clear"
::method client2screen unguarded external "LIBRARY oodialog wb_screenClient"
::method clientRect unguarded external "LIBRARY oodialog wb_clientRect"
::method disable unguarded external "LIBRARY oodialog wb_enable"
::method display unguarded external "LIBRARY oodialog wb_display"
::method draw unguarded external "LIBRARY oodialog wb_redrawClient"
::method enable unguarded external "LIBRARY oodialog wb_enable"
::method foregroundWindow unguarded external "LIBRARY oodialog wb_foreGroundWindow"
::method hide unguarded external "LIBRARY oodialog wb_show"
::method getExStyleRaw unguarded
return self~getWindowLong(-20)
::method getID unguarded
return self~getWindowLong(-12)
::method getRealPos unguarded external "LIBRARY oodialog wb_getSizePos"
::method getRealSize unguarded external "LIBRARY oodialog wb_getSizePos"
::method getStyleRaw unguarded
return self~getWindowLong(-16)
::method getText unguarded external "LIBRARY oodialog wb_getText"
::method getTextSizePx unguarded external "LIBRARY oodialog wb_getTextSizePx"
::method getTextSizeScreen unguarded external "LIBRARY oodialog wb_getTextSizeScreen"
::method hideFast unguarded external "LIBRARY oodialog wb_showFast"
::method isEnabled unguarded external "LIBRARY oodialog wb_isEnabled"
::method isVisible unguarded external "LIBRARY oodialog wb_isVisible"
::method mapWindowPoints unguarded external "LIBRARY oodialog wb_mapWindowPoints"
::method moveTo unguarded external "LIBRARY oodialog wb_resizeMove"
::method moveWindow unguarded external "LIBRARY oodialog wb_moveSizeWindow"
::method redraw unguarded external "LIBRARY oodialog wb_redraw"
::method redrawClient unguarded external "LIBRARY oodialog wb_redrawClient"
::method resizeTo unguarded external "LIBRARY oodialog wb_resizeMove"
::method screen2client unguarded external "LIBRARY oodialog wb_screenClient"
::method sendMessage unguarded external "LIBRARY oodialog wb_sendMessage"
::method sendMessageHandle unguarded external "LIBRARY oodialog wb_sendMessage"
::method setRect unguarded external "LIBRARY oodialog wb_setRect"
::method setStyleRaw unguarded
use strict arg newValue
return self~setWindowLong(-16, newValue)
::method setText unguarded external "LIBRARY oodialog wb_setText"
::method setTitle unguarded external "LIBRARY oodialog wb_setText"
::method setWindowPos unguarded external "LIBRARY oodialog wb_setWindowPos"
::method show unguarded external "LIBRARY oodialog wb_show"
::method showFast unguarded external "LIBRARY oodialog wb_showFast"
::method sizeWindow unguarded external "LIBRARY oodialog wb_moveSizeWindow"
::method title unguarded external "LIBRARY oodialog wb_getText"
::method "title=" unguarded external "LIBRARY oodialog wb_setText"
::method update unguarded external "LIBRARY oodialog wb_redrawClient"
::method windowRect unguarded external "LIBRARY oodialog wb_windowRect"
::method clientToScreen unguarded -- old method returns coordinates as a string
use strict arg x, y
p = .Point~new(x, y)
if self~client2screen(p) then return p~x p~y
else return 0 0
::method getSize unguarded -- old method, this is not accurate.
forward message "getRealSize" continue
size = result
return (size~width % self~factorX) || " " || (size~height % self~factorY)
::method getPos unguarded -- old method, this is not accurate.
forward message "getRealPos" continue
p = result
return (p~x % self~factorX) || " " || (p~y % self~factorY)
::method getRect unguarded -- old method returns coordinates as a string
forward message "windowRect" continue
rect = result
return rect~left rect~top rect~right rect~bottom
::method getClientRect unguarded -- old method returns coordinates as a string
forward message "clientRect" continue
rect = result
return rect~left rect~top rect~right rect~bottom
::method move unguarded -- old method, this is not accurate.
use strict arg xPos, yPos, showOptions = ""
p = .Point~new(trunc(xPos * self~factorX), trunc(yPos * self~factorY))
s = .Size~new(0, 0)
if self~setRect(p, s, "NOSIZE " || showOptions) then return 0
else return 1
::method resize unguarded -- old method, this is not accurate.
use strict arg width, height, showOptions = ""
p = .Point~new(0, 0)
s = .Size~new(trunc(width * self~factorX), trunc(height * self~factorY))
if self~setRect(p, s, "NOMOVE " || showOptions) then return 0
else return 1
::method screenToClient unguarded -- old method returns coordinates as a string
use strict arg x, y
p = .Point~new(x, y)
if self~screen2client(p) then return p~x p~y
else return 0 0
-- These shortcut methods are for internal use, do not document.
::method getWindowLong private unguarded external "LIBRARY oodialog wb_getWindowLong_pvt" -- Not intending to document getWindowLong, at this point
::method setWindowLong private unguarded external "LIBRARY oodialog wb_setWindowLong_pvt" -- Not intending to document setWindowLong, at this point
::method sendWinHandle2Msg unguarded external "LIBRARY oodialog wb_sendWinHandle2Msg" -- Internal use do not document
::method sendWinHandle2MsgH unguarded external "LIBRARY oodialog wb_sendWinHandle2Msg" -- Internal use do not document
::method sendWinHandleMsg unguarded external "LIBRARY oodialog wb_sendWinHandleMsg" -- Internal use do not document
::method sendWinHandleMsgH unguarded external "LIBRARY oodialog wb_sendWinHandleMsg" -- Internal use do not document
::method sendWinIntMsg unguarded external "LIBRARY oodialog wb_sendWinIntMsg" -- Internal use do not document
::method sendWinIntMsgH unguarded external "LIBRARY oodialog wb_sendWinIntMsg" -- Internal use do not document
::method sendWinUintMsg unguarded external "LIBRARY oodialog wb_sendWinUintMsg" -- Internal use do not document
::method unknown unguarded
use arg msgname
call errorDialog msgname || " is not a method of " || self
::method assignWindow -- DEPRECATED
return 0
::method getSystemMetrics unguarded -- DEPRECATED
use strict arg index
return .DlgUtil~getSystemMetrics(index)
::class 'Window' public inherit WindowBase
::method init external "LIBRARY oodialog window_init"
::method unInit external "LIBRARY oodialog window_unInit"
/**
* Used to return an object that is not a dialog object. See the
* PlainBaseDialog::new() class method for details (pbdlg_new_cls.)
*/
::class 'DialogProxy' public
::attribute initCode get
return 1
/**
* The PlainBaseDialog class is the base class of all ooDialog dialogs. It
* implements those methods that are common to all dialogs, whether the dialog
* template comes from a binary resource, a resource script file, or is con-
* structed dynamically.
*/
::class 'PlainBaseDialog' public inherit WindowBase ResourceUtils EventNotification DialogExtensions WindowExtensions
::constant DM_REPOSITION "0x0402"
::constant WM_SETFONT "0x0030"
::constant WM_NEXTDLGCTL "0x0028"
::constant WM_USER_INTERRUPTSCROLL "0x0A02"
::constant SIZE_RESTORED 0
::constant SIZE_MINIMIZED 1
::constant SIZE_MAXIMIZED 2
::constant SIZE_MAXSHOW 3
::constant SIZE_MAXHIDE 4
::constant IDOK 1
::constant IDCANCEL 2
::constant IDABORT 3
::constant IDRETRY 4
::constant IDIGNORE 5
::constant IDYES 6
::constant IDNO 7
::constant IDCLOSE 8
::constant IDHELP 9
::constant IDTRYAGAIN 10
::constant IDCONTINUE 11
::constant IDTIMEOUT 32000
::method init class external "LIBRARY oodialog pbdlg_init_cls"
::method setDefaultFont class external "LIBRARY oodialog pbdlg_setDefaultFont_cls"
::method getFontName class external "LIBRARY oodialog pbdlg_getFontName_cls"
::method getFontSize class external "LIBRARY oodialog pbdlg_getFontSize_cls"
::method new class external "LIBRARY oodialog pbdlg_new_cls"
-- A queue containing the methods that will be started concurrently before execution of the dialog
::attribute automaticMethods private -- Protected in 3.0.1 do not document
::attribute dataConnection private -- store connections between ids and class attributes -- Protected in 3.0.1 do not document
::method dlgData private -- Internal use do not document
expose dlgData.
return dlgData.
::attribute library get unguarded private external "LIBRARY oodialog pbdlg_getLibrary" -- Internal use do not document
::attribute parentDlg get private external "LIBRARY oodialog pbdlg_getParentDlg_pvt" -- Protected in 3.0.1 do not document
::attribute parentDlg set private external "LIBRARY oodialog pbdlg_setParentDlg_pvt" -- Protected in 3.0.1 do not document
::attribute childDialogs -- Internal use do not document
::attribute resourceID get unguarded private external "LIBRARY oodialog pbdlg_getResourceID" -- Internal use do not document
::attribute useStem private -- flag whether to use a stem to set/get data or not -- Protected in 3.0.1 do not document
-- Documented attributes:
::attribute autoDetect get external "LIBRARY oodialog pbdlg_getAutoDetect"
::attribute autoDetect set external "LIBRARY oodialog pbdlg_setAutoDetect"
::attribute dlgHandle get unguarded external "LIBRARY oodialog pbdlg_getDlgHandle"
::attribute dlgID get external "LIBRARY oodialog pbdlg_getDlgID"
::attribute dlgID set external "LIBRARY oodialog pbdlg_setDlgID"
-- finsished is now a boolean, when set to .true, the dialog ends. Older ooDialog set it
-- to 2 on an abnormal termination of the underlying dialog. This is no longer done.
-- finished presents a problem because it was documented, mostly *incorrectly* in earlier
-- versions of ooDialog. The programmer should *not* set this attribute. It will no longer
-- be documented because it is really an internal use only attribute.
::attribute finished get external "LIBRARY oodialog pbdlg_getFinished"
::attribute finished set external "LIBRARY oodialog pbdlg_setFinished"
::attribute fontName get external "LIBRARY oodialog pbdlg_getFontNameSize"
::attribute fontName set private external "LIBRARY oodialog pbdlg_setFontName_pvt"
::attribute fontSize get external "LIBRARY oodialog pbdlg_getFontNameSize"
::attribute fontSize set private external "LIBRARY oodialog pbdlg_setFontSize_pvt"
::attribute ownerDialog get external "LIBRARY oodialog pbdlg_getOwnerDialog"
::attribute ownerDialog set external "LIBRARY oodialog pbdlg_setOwnerDialog"
/** PlainBaseDialog::init() Performs the necessary intialization, including the
* set up of the dialog management block, for all dialogs.
*/
::method init external "LIBRARY oodialog pbdlg_init"
::method setDlgFont external "LIBRARY oodialog pbdlg_setDlgFont"
-- Creates the dialog, shows it, and destroys it. Dialog "data" is set and received.
-- The sleepTime arg is ignored. This arg was never documented, but people might have
-- used it anyway, so it is left in the arg list. Do not document modeless, it is an
-- implementation detail that may be removed if true modal dialog are ever implemented
::method execute unguarded
expose dlgData.
use strict arg sh = "NORMAL", icon = 0, sleepTime = 1, modeless = .false
icon = self~resolveIconId(icon)
if self~startIt(icon, modeless) \= 0 then do
if self~useStem then self~setDataStem(dlgData.)
else self~setData
self~show(sh)
do while self~automaticMethods~Items > 0
p = self~automaticMethods~pull
m = self~automaticMethods~pull
c = self~automaticMethods~pull
o = c~new(p, self)
o~start(m)
end
self~waitForDialog
if self~initCode = 1 then do
if self~useStem then self~getDataStem(dlgData.)
self~getData
end
self~stopIt
return self~initCode
end
else do
self~finished = .true
self~stopIt
return 0
end
::method isDialogActive unguarded external "LIBRARY oodialog pbdlg_isDialogActive"
/*
* The following methods are the default implementations for methods that are
* intended to be over-ridden by the programmer if the default behavior needs
* to be altered.
*/
::method initDialog unguarded
return 0
/** ok()
* This method first invokes the validate() method. If validate returns
* true, self~initCode is set to 1 and self~finished is set to true,
* terminating the dialog.
*
* If validate returns false, the dialog continues to run.
*/
::method ok unguarded
okayToClose = self~validate
if okayToClose then do
self~initCode = 1
self~finished = .true
end
return self~finished
::method cancel unguarded
self~initCode = 2
self~finished = .true
return self~finished
::method help unguarded
return 0
::method leaving
return 0
/** validate()
* This method is an abstract method that will be called to determin whether the
* dialog can be closed or not. This function will be called by method OK. If
* the return value is true the dialog can be closed, if it is false the dialog
* should not be closed.
*/
::method validate unguarded
return .true
-- waitForDialog() replaces the run() method. run() now just spins doing nothing.
::method waitForDialog unguarded -- Not to be doumented.
expose finished
guard on when finished
::method ensureFinished unguarded -- Not to be doumented.
expose finished
use strict arg wasAbnormalHalt
if wasAbnormalHalt then self~initCode = 3
finished = .true
::method stopIt external "LIBRARY oodialog pbdlg_stopIt" -- Not to be doumented. Documented "internal use only" in 3.2.0
::method finalStopIt private -- Not to be doumented.
use arg caller
-- If we ourselves are a child dialog and not called by the parent's stopIt(), then
-- remove ourself from the parent dialog's child list. (Child dialogs are independent
-- and the user could close them at any time.)
if self~parentDlg \== .nil & caller \== "PARENT" then self~parentDlg~childDied(self)
-- If we have child dialogs, then stop all of them. Child dialogs are always started
-- through popupAsChild() and are always closed when the parent closes.
if self~childDialogs \== .nil then do
if self~childDialogs~items > 0 then
do child over self~childDialogs
child~stopit("PARENT")
end
self~childDialogs = .nil
end
return 0
-- Remove a child dialog from the chain of child dialogs.
::method childDied -- Not to be doumented.
use arg child
if self~childDialogs \== .nil then do
ndx = self~childDialogs~first
do while ndx \== .nil
if self~childDialogs[ndx] == child then do
self~childDialogs~remove(ndx)
ndx = .nil
end
else ndx = self~childDialogs~next(ndx)
end
end
::method unInit external "LIBRARY oodialog pbdlg_unInit" -- Not to be doumented.
::method sendMessageToWindow unguarded external "LIBRARY oodialog pbdlg_sendMessageToWindow"
::method sendMessageToWindowH unguarded external "LIBRARY oodialog pbdlg_sendMessageToWindow"
::method sendMessageToControl unguarded external "LIBRARY oodialog pbdlg_sendMessageToControl"
::method sendMessageToControlH unguarded external "LIBRARY oodialog pbdlg_sendMessageToControl"
::method get unguarded external "LIBRARY oodialog pbdlg_get"
::method getSelf unguarded external "LIBRARY oodialog pbdlg_getDlgHandle"
::method getControlID unguarded external "LIBRARY oodialog pbdlg_getControlID"
::method show unguarded external "LIBRARY oodialog pbdlg_show"
::method restore unguarded external "LIBRARY oodialog pbdlg_show"
::method toTheTop unguarded external "LIBRARY oodialog pbdlg_toTheTop"
::method minimize unguarded external "LIBRARY oodialog pbdlg_doMinMax"
::method maximize unguarded external "LIBRARY oodialog pbdlg_doMinMax"
::method isMaximized unguarded external "LIBRARY oodialog pbdlg_doMinMax"
::method isMinimized unguarded external "LIBRARY oodialog pbdlg_doMinMax"
::method getWindowText unguarded external "LIBRARY oodialog pbdlg_getWindowText"
::method setWindowText unguarded external "LIBRARY oodialog pbdlg_setWindowText"
::method getControlText unguarded external "LIBRARY oodialog pbdlg_getControlText"
::method setControlText unguarded external "LIBRARY oodialog pbdlg_setControlText"
::method getControlHandle unguarded external "LIBRARY oodialog pbdlg_getControlHandle"
::method getTextSizeDu unguarded external "LIBRARY oodialog pbdlg_getTextSizeDu"
::method getTextSizeDlg unguarded external "LIBRARY oodialog pbdlg_getTextSizeDlg"
::method getTextSizeTitleBar unguarded external "LIBRARY oodialog pbdlg_getTextSizeTitleBar"
::method pixel2dlgUnit external "LIBRARY oodialog pbdlg_pixel2dlgUnit"
::method dlgUnit2pixel external "LIBRARY oodialog pbdlg_dlgUnit2pixel"
::method backgroundBitmap external "LIBRARY oodialog pbdlg_backgroundBitmap"
::method tiledBackgroundBitmap external "LIBRARY oodialog pbdlg_tiledBackgroundBitmap"
::method backgroundColor external "LIBRARY oodialog pbdlg_backgroundColor"
::method backgroundSysColor external "LIBRARY oodialog pbdlg_backgroundColor"
::method ensureVisible unguarded
return self~sendWinIntMsg(self~DM_REPOSITION, 0, 0)
-- initAutoDetection() is invoked by init() to set the default for automatic data field detection.
::method initAutoDetection private -- First data attribute method
.application~initAutoDetection(self)
::method noAutoDetection
self~autoDetect = .false -- disable autodetection
::method autoDetection
self~autoDetect = .true -- enable autodetection
/* The following methods 'connect' a Windows dialog control with a 'data' attribute of the Rexx
* dialog object. For each dialog control an attribute of the dialog object is created and an
* entry is added to the data table to 'connect' the control and the attribute. When auto detection
* is on the 'data' (which is the value of the attribute) attribute is used to set the state of the
* control on start up of the dialog. Likewise, when the windows dialog is closed, the 'data' (the state)
* of the control is used to set the value of the attribute.
*/
::method connectCheckBox unguarded external "LIBRARY oodialog pbdlg_connect_ControName"
::method connectRadioButton unguarded external "LIBRARY oodialog pbdlg_connect_ControName"
::method connectEdit unguarded external "LIBRARY oodialog pbdlg_connect_ControName"
::method connectComboBox unguarded external "LIBRARY oodialog pbdlg_connect_ControName"
::method connectListBox unguarded external "LIBRARY oodialog pbdlg_connect_ControName"
::method connectTreeView unguarded external "LIBRARY oodialog pbdlg_connect_ControName"
::method connectListView unguarded external "LIBRARY oodialog pbdlg_connect_ControName"
::method connectTrackBar unguarded external "LIBRARY oodialog pbdlg_connect_ControName"
::method connectTab unguarded external "LIBRARY oodialog pbdlg_connect_ControName"
::method connectDateTimePicker unguarded external "LIBRARY oodialog pbdlg_connect_ControName"
::method connectMonthCalendar unguarded external "LIBRARY oodialog pbdlg_connect_ControName"
::method connectUpDown unguarded external "LIBRARY oodialog pbdlg_connect_ControName"
-- This method gets the 'data' of all the connected dialog controls and uses that data to set the value of the
-- associated attribute. See comment above for setData()
::method getData unguarded
self~putDlgDataInStem(InternDlgData.)
id = self~dataConnection~first
do while (id \== .nil)
self~sendWith(self~dataConnection[id]'=', .array~of(InternDlgData.id))
id = self~dataConnection~next(id)
end
-- This method sets the 'data' of all the connected dialog controls using the value of the associated attribute.
-- The Windows dialog controls are associated with with a data attribute of the Rexx dialog object through the
-- connectXXX methods. connectListBox(), connectComboBox(), etc..
::method setData unguarded
id = self~dataConnection~first
do while (id \== .nil)
data = self~send(self~dataConnection[id])
InternDlgData.id = data
id = self~dataConnection~next(id)
end
return self~setDlgDataFromStem(InternDlgData.)
-- This method gets the 'data' of all of the connected dialog controls and sets the indexes of the specified
-- stem with the 'data'. The resource ID of each dialog control is used as an index and the 'data' of that
-- dialog control is set as the value. In addition, if the numeric resource ID has a matching symbolic ID in
-- the constDir, then the symbolic ID is used as a second index and set with the 'data' of the the dialog control.
::method getDataStem unguarded
use arg dataStem.
self~putDlgDataInStem(InternDlgData.)
do k over InternDlgData.
dataStem.k = InternDlgData.k
symbolicID = self~resolveNumericID(k)
if symbolicID \== -1 then dataStem.symbolicID = InternDlgData.k
end
-- This method sets the 'data' of each of the connected dialog controls using the values of the specified stem.
-- Each index of the stem should be the resource ID of a connected dialog control and the value at that index is
-- the 'data' to set the control with.
::method setDataStem unguarded
use arg dataStem.
if dataStem.~items == 0 then return 1
do k over dataStem.
if k~dataType('W') then numericID = k
else numericID = self~resolveSymbolicID(k)
if numericID == -1 then iterate
InternDlgData.numericID = dataStem.k
if InternDlgData.numericID = "INTERNDLGDATA."numericID then InternDlgData.numericID = ""
end
return self~setDlgDataFromStem(InternDlgData.)
-- The following methods are used to get the 'data' from a single dialog control
-- This method gets the 'data' of a dialog control. You don't have to know what kind of control it is
-- if it has been 'connected' previously, i.e. connectTreeView(), connectTab(), etc..
::method getControlData unguarded external "LIBRARY oodialog pbdlg_getControlData"
::method getCheckBoxData unguarded external "LIBRARY oodialog pbdlg_getControlData"
::method getRadioButtonData unguarded external "LIBRARY oodialog pbdlg_getControlData"
::method getEditData unguarded external "LIBRARY oodialog pbdlg_getControlData"
::method getListBoxData unguarded external "LIBRARY oodialog pbdlg_getControlData"
::method getComboBoxData unguarded external "LIBRARY oodialog pbdlg_getControlData"
-- This method gets the 'data' of a dialog control and uses that data to set the value of the attribute
-- associated with the dialog control through one of the connectXXX methods. I.e., connectEdit(),
-- connectListBox(), etc.. It returns nothing to the caller, the action is setting the value of the
-- associated attribute.
::method getDataAttribute unguarded
use strict arg attributeName
id = self~dataConnection~First
do while (id \== .nil)
if self~dataConnection[id] = attributeName~space(0) then do
data = self~getControlData(id)
self~sendWith(attributeName'=', .array~of(data))
return
end
id = self~dataConnection~next(id)
end
-- The following methods are used to set the 'data' of a single dialog item
-- This method sets the 'data' of a dialog control. You don't have to know what kind of control it is
-- if it has been 'connected' previously, i.e. connectTreeView(), connectTab(), etc..
::method setControlData unguarded external "LIBRARY oodialog pbdlg_setControlData"
::method setCheckBoxData unguarded external "LIBRARY oodialog pbdlg_setControlData"
::method setRadioButtonData unguarded external "LIBRARY oodialog pbdlg_setControlData"
::method setEditData unguarded external "LIBRARY oodialog pbdlg_setControlData"
::method setListBoxData unguarded external "LIBRARY oodialog pbdlg_setControlData"
::method setComboBoxData unguarded external "LIBRARY oodialog pbdlg_setControlData"
-- This method sets the 'data' of a dialog control using the value of the attribute associated with
-- the dialog control through one of the connectXXX methods. I.e., connectEdit(), connectListBox()
::method setDataAttribute unguarded
use strict arg attributeName
id = self~dataConnection~first
do while (id \== .nil)
if self~dataConnection[id] = attributeName~space(0) then do
data = self~send(attributeName)
return self~setControlData(id, data)
end
id = self~dataConnection~next(id)
end
-- Documented "internal use only" in 3.2.0 - Do not document.
::method addAttribute private -- Not to be doumented.
use strict arg id, attributeName = ("DATA"id~space(0))
if \ id~dataType("W") then do
if self~processingLoad = 1 then attributeName = id
id = self~resolveSymbolicId(id)
end
if id < 1 then return -1
-- Remove any possible spaces, &, and :, then check for a valid name
attributeName = attributeName~space(0)~changestr('&','')~changestr(':','')
if attributeName == "" | self~HasMethod(attributeName) | \ attributeName~datatype('V') then
attributeName = "DATA"id~space(0)
self~dataConnection[id] = attributeName
self~setMethod(attributeName, "expose "attributeName"; return "attributeName)
self~setMethod(attributeName || "=", "expose "attributeName"; use arg "attributeName)
self~sendWith(attributeName || '=', .array~of("")) /* initial value = "" */
return id
-- The method returns an array that contains the value of each of the attributes associated with a dialog
-- control. MM What good is this, you don't know which control is associated with each of the 'data' pieces?
::method makeArray unguarded -- Never documented, do not intend to document now -- Last data attribute method.
a = .array~new(self~dataConnection~items)
id = self~dataConnection~first
do j = 1 while (id \== .nil)
attributeName = self~dataConnection~at(id)
data = self~send(attributeName)
a[j] = data
id = self~dataConnection~next(id)
end
return a
-- Internal use *only*, do *not* use. - Do not document.
::method setDlgDataFromStem private unguarded external "LIBRARY oodialog pbdlg_setDlgDataFromStem_pvt" -- Not to be doumented.
::method putDlgDataInStem private unguarded external "LIBRARY oodialog pbdlg_putDlgDataInStem_pvt" -- Not to be doumented.
::method putControl unguarded external "LIBRARY oodialog pbdlg_putControl" -- Not to be doumented.
-- Allow the user to dynamically add attributes or methods to a dialog.
::method addNewAttribute
use strict arg name, value = "", makeUnguarded = .false, makePrivate = .false
self~setMethod(name, "expose "name"; return "name, "OBJECT")
self~setMethod(name || "=", "expose "name"; use arg "name, "OBJECT")
if makeUnguarded then do
self~instanceMethod(name)~setUnguarded
self~instanceMethod(name || '=')~setUnguarded
end
if makePrivate then do
self~instanceMethod(name)~setPrivate
self~instanceMethod(name || '=')~setPrivate
end
self~sendWith(name || '=', .array~of(value))
::method addNewMethod
use strict arg name, src, makeUnguarded = .false, makePrivate = .false
self~setMethod(name, src, "OBJECT")
if makeUnguarded then self~instanceMethod(name)~setUnguarded
if makePrivate then self~instanceMethod(name)~setPrivate
return 0
-- Methods to manipulate a ComboBox
::method addComboEntry unguarded
use strict arg id, string
comboBox = self~newComboBox(id)
if comboBox == .nil then return -1
else return comboBox~add(string)
::method insertComboEntry unguarded
use strict arg id, index = 0, string
comboBox = self~newComboBox(id)
if comboBox == .nil then return -1
if arg(2, 'O') then return comboBox~insert( , string)
else return comboBox~insert(index, string)
::method findComboEntry unguarded
use strict arg id, string
comboBox = self~newComboBox(id)
if comboBox == .nil then return -1
return comboBox~find(string)
::method getComboEntry unguarded
use strict arg id, index
comboBox = self~newComboBox(id)
if comboBox == .nil then return -1
return comboBox~getText(index)
::method comboAddDirectory unguarded
use strict arg id, drivepath, fileAttributes = ""
comboBox = self~newComboBox(id)
if comboBox == .nil then return -1
return comboBox~addDirectory(drivePath, fileAttributes)
::method deleteComboEntry unguarded
use strict arg id, index = (self~getCurrentComboIndex(id))
if index <= 0 then return -1
comboBox = self~newComboBox(id)
if comboBox == .nil then return -1
return comboBox~delete(index)
::method getCurrentComboIndex unguarded
use strict arg id
comboBox = self~newComboBox(id)
if comboBox == .nil then return -1
return comboBox~selectedIndex
::method setCurrentComboIndex unguarded
use strict arg id, ndx = 0
comboBox = self~newComboBox(id)
if comboBox == .nil then return -1
return comboBox~selectIndex(ndx)
::method getComboItems unguarded
use strict arg id
comboBox = self~newComboBox(id)
if comboBox == .nil then return -1
return comboBox~items
::method changeComboEntry unguarded
use strict arg id, item = (self~getCurrentComboIndex(id)), string
if item <= 0 then return -1
self~deleteComboEntry(id, item)
return self~insertComboEntry(id, item, string)
::method comboDrop unguarded
use strict arg id
comboBox = self~newComboBox(id)
if comboBox == .nil then return -1
return comboBox~deleteAll
-- Methods to manipulate a ListBox
::method setListTabulators unguarded external "LIBRARY oodialog generic_setListTabulators"
::method addListEntry unguarded
use strict arg id, text
listBox = self~newListBox(id)
if listBox == .nil then return -1
else return listBox~add(text)
::method insertListEntry unguarded
use strict arg id, index = (-2), text
listBox = self~newListBox(id)
if listBox == .nil then return -1
if arg(2, 'O') then return listBox~insert( , text)
else return listBox~insert(index, text)
::method findListEntry unguarded
use strict arg id, text
listBox = self~newListBox(id)
if listBox == .nil then return -1
return listBox~find(text)
::method getListEntry unguarded
use strict arg id, index
listBox = self~newListBox(id)
if listBox == .nil then return -1
return listBox~getText(index)
::method listAddDirectory unguarded
use strict arg id, drivePath, fileAttributes = ""
listBox = self~newListBox(id)
if listBox == .nil then return -1
return listBox~addDirectory(drivePath, fileAttributes)
::method deleteListEntry unguarded
use strict arg id, index = (self~getCurrentListIndex(id))
if index == 0 then return -1
listBox = self~newListBox(id)
if listBox == .nil then return -1
return listBox~delete(index)
::method getCurrentListIndex unguarded
use strict arg id
listBox = self~newListBox(id)
if listBox == .nil then return -1
return listBox~selectedIndex
::method setCurrentListIndex unguarded
use strict arg id, ndx = 0
listBox = self~newListBox(id)
if listBox == .nil then return -1
return listBox~selectIndex(ndx)
::method getListItems unguarded
use strict arg id
listBox = self~newListBox(id)
if listBox == .nil then return -1
return listBox~items
::method changeListEntry unguarded
use strict arg id, index = (self~getCurrentListIndex(id)), newString
if index <= 0 then return -1
self~deleteListEntry(id, index)
return self~insertListEntry(id, index, newString)
::method listDrop unguarded
use strict arg id
listBox = self~newListBox(id)
if listBox == .nil then return -1
return listBox~deleteAll
::method enableControl unguarded external "LIBRARY oodialog pbdlg_enableDisableControl"
::method disableControl unguarded external "LIBRARY oodialog pbdlg_enableDisableControl"
::method showControl unguarded external "LIBRARY oodialog pbdlg_showControl"
::method hideControl unguarded external "LIBRARY oodialog pbdlg_showControl"
::method showControlFast unguarded external "LIBRARY oodialog pbdlg_showControl"
::method hideControlFast unguarded external "LIBRARY oodialog pbdlg_showControl"
::method showWindow unguarded external "LIBRARY oodialog pbdlg_showWindow"
::method showWindowFast unguarded external "LIBRARY oodialog pbdlg_showWindow"
::method hideWindow unguarded external "LIBRARY oodialog pbdlg_showWindow"
::method hideWindowFast unguarded external "LIBRARY oodialog pbdlg_showWindow"
::method focusControl unguarded external "LIBRARY oodialog pbdlg_focusControl"
::method setFocusToWindow unguarded external "LIBRARY oodialog pbdlg_setFocus"
::method tabToNext unguarded external "LIBRARY oodialog pbdlg_tabTo"
::method tabToPrevious unguarded external "LIBRARY oodialog pbdlg_tabTo"
::method setFocus unguarded external "LIBRARY oodialog pbdlg_setFocus"
::method getFocus unguarded external "LIBRARY oodialog pbdlg_getFocus"
::method setTabStop unguarded external "LIBRARY oodialog pbdlg_setTabGroup"
::method setGroup unguarded external "LIBRARY oodialog pbdlg_setTabGroup"
::method center unguarded external "LIBRARY oodialog pbdlg_center"
::method getMenuBar
return self~menuBar
::method hasMenuBar
return self~menuBar \== .nil & self~isLinked
::method createToolTip unguarded external "LIBRARY oodialog pbdlg_createToolTip"
::method newPushButton unguarded external "LIBRARY oodialog pbdlg_newControl"
::method newRadioButton unguarded external "LIBRARY oodialog pbdlg_newControl"
::method newCheckBox unguarded external "LIBRARY oodialog pbdlg_newControl"
::method newGroupBox unguarded external "LIBRARY oodialog pbdlg_newControl"
::method newEdit unguarded external "LIBRARY oodialog pbdlg_newControl"
::method newComboBox unguarded external "LIBRARY oodialog pbdlg_newControl"
::method newListBox unguarded external "LIBRARY oodialog pbdlg_newControl"
::method newReBar unguarded external "LIBRARY oodialog pbdlg_newControlEx"
::method newScrollBar unguarded external "LIBRARY oodialog pbdlg_newControl"
::method newStatic unguarded external "LIBRARY oodialog pbdlg_newControl"
::method newStatusBar unguarded external "LIBRARY oodialog pbdlg_newControlEx"
::method newToolBar unguarded external "LIBRARY oodialog pbdlg_newControlEx"
::method newToolTip unguarded external "LIBRARY oodialog pbdlg_newToolTip"
::method newTreeView unguarded external "LIBRARY oodialog pbdlg_newControl"
::method newListView unguarded external "LIBRARY oodialog pbdlg_newControl"
::method newTab unguarded external "LIBRARY oodialog pbdlg_newControl"
::method newProgressBar unguarded external "LIBRARY oodialog pbdlg_newControl"
::method newTrackBar unguarded external "LIBRARY oodialog pbdlg_newControl"
::method newMonthCalendar unguarded external "LIBRARY oodialog pbdlg_newControlEx"
::method newDateTimePicker unguarded external "LIBRARY oodialog pbdlg_newControlEx"
::method newUpDown unguarded external "LIBRARY oodialog pbdlg_newControlEx"
::method newControl unguarded external "LIBRARY oodialog pbdlg_getNewControl" -- Do not document for 4.2.0, maybe doc later
::method dumpMessageTable unguarded external "LIBRARY oodialog pbdlg_dumpMessageTable" -- Do not document for 4.2.0, maybe doc later
::method test unguarded external "LIBRARY oodialog pbdlg_test"
-- DEPRECATED (to end of file)
::method deInstall
return 0
-- There is no longer a message queue.
::method run unguarded private
do while \ self~finished
self~handleMessages
end
::method handleMessages unguarded
j = SysSleep(.010)
::method clearMessages unguarded
::method peekDialogMessage unguarded
return ""
-- There is no longer a DIALOGADMIN block.
::method dump
say "dump() deprecated."
-- adm was never documented and should just be removed, but it would have been
-- needed in the dump() method which was documented. (Even though the
-- documentation never explained where a 'dialogadmin' block would come from.)
::attribute adm get
return 0
::method connectEntryLine unguarded
forward message 'connectEdit'
::method connectMultiListBox unguarded
forward message 'connectListBox'
::method connectTreeControl unguarded
forward message 'connectTreeView'
::method connectListControl unguarded
forward message 'connectListView'
::method connectSliderControl unguarded
forward message 'connectTrackBar'
::method connectTabControl unguarded
forward message 'connectTab'
::method getEntryLine unguarded
forward message 'getEditData'
::method getListLine unguarded
forward message 'getListBoxData'
::method getComboLine unguarded
forward message 'getComboBoxData'
::method getCheckBox unguarded
forward message 'getCheckBoxData'
::method getRadioButton unguarded
forward message 'getRadioButtonData'
::method getMultiList unguarded
forward message 'getListBoxData'
::method getValue unguarded
forward message 'getControlData'
::method getAttrib unguarded
forward message 'getDataAttribute'
::method setEntryLine unguarded
forward message 'setEditData'
::method setListLine unguarded
forward message 'setListBoxData'
::method setComboLine unguarded
forward message 'setComboBoxData'
::method setCheckBox unguarded
forward message 'setCheckBoxData'
::method setRadioButton unguarded
forward message 'setRadioButtonData'
::method setMultiList unguarded
forward message 'setListBoxData'
::method setValue unguarded
forward message 'setControlData'
::method setAttrib unguarded
forward message 'setDataAttribute'
::method setWindowTitle unguarded
forward message 'setWindowText'
::method windowTitle unguarded
forward message 'getWindowText'
::method setStaticText unguarded
forward message 'setControlText'
::method sendMessageToItem unguarded
forward message "sendMessageToControl"
::method getItem unguarded
forward message "getControlHandle"
::method itemTitle unguarded -- Present but never documented in early ooDialog
forward message 'getControlText'
::method enableItem unguarded
forward message 'enableControl'
::method disableItem unguarded
forward message 'disableControl'
::method showItem unguarded
forward message "showControl"
::method hideItem unguarded
forward message "hideControl"
::method showItemFast unguarded
forward message "showControlFast"
::method hideItemFast unguarded
forward message "hideControlFast"
::method focusItem unguarded
forward message "focusControl"
::method getStaticControl unguarded
forward message 'newStatic'
::method getButtonControl unguarded
forward message 'newPushButton'
::method getRadioControl unguarded
forward message 'newRadioButton'
::method getCheckControl unguarded
forward message 'newCheckBox'
::method getGroupBox unguarded
forward message 'newGroupBox'
::method getEditControl unguarded
forward message 'newEdit'
::method getComboBox unguarded
forward message 'newComboBox'
::method getListBox unguarded
forward message 'newListBox'
::method getScrollBar unguarded
forward message 'newScrollBar'
::method getTreeControl unguarded
forward message 'newTreeView'
::method getListControl unguarded
forward message 'newListView'
::method getTabControl unguarded
forward message 'newTab'
::method getProgressBar unguarded
forward message 'newProgressBar'
::method getSliderControl unguarded
forward message 'newTrackBar'
::method getTextSize unguarded
forward message "getTextSizeDlg" continue
return result~width result~height