0023272: Image comparison algorithm
[occt.git] / src / WNT / WNT_Window.cdl
1 -- Created on: 1996-01-26
2 -- Created by: PLOTNIKOV Eugeny
3 -- Copyright (c) 1996-1999 Matra Datavision
4 -- Copyright (c) 1999-2012 OPEN CASCADE SAS
5 --
6 -- The content of this file is subject to the Open CASCADE Technology Public
7 -- License Version 6.5 (the "License"). You may not use the content of this file
8 -- except in compliance with the License. Please obtain a copy of the License
9 -- at http://www.opencascade.org and read it completely before using this file.
10 --
11 -- The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
12 -- main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
13 --
14 -- The Original Code and all software distributed under the License is
15 -- distributed on an "AS IS" basis, without warranty of any kind, and the
16 -- Initial Developer hereby disclaims all such warranties, including without
17 -- limitation, any warranties of merchantability, fitness for a particular
18 -- purpose or non-infringement. Please see the License for the specific terms
19 -- and conditions governing the rights and limitations under the License.
20
21 -- Modified:    FMN - 23/01/98 -> Add DoMapping
22 -- Modified :   GG 28/01/00 G004
23 --              Add gamma correction computation just before dumping an image.
24 --              GG  07/03/00 G004 Add MMSize() method
25 --              TCL 26/10/00 G002 SetBackground(aName: CString) method
26 --              GG - RIC120302 Add NEW HParentWindow methods.
27 --              SAV 24/11/01 SetBackground(Quantity_Color)
28
29 class Window from WNT inherits Window from Aspect
30
31         ---Purpose: This class defines Windows NT window
32         --  Warning: The position and size for the creation of the window
33         --          are defined in Device Screen Unit (DSU)
34         --          floating [0,1] space.
35         --
36         --          As 3D view window is the main purpose of this class,
37         --          and 3D view does not need its background to be drawn
38         --          by the system, by default the window background is not drawn.
39         --          This can be overridden by calling ClearFlags( WDF_NOERASEBKGRND ).
40         --          See also WNT_WndProc.cxx and InterfaceGraphic_WNT.hxx.
41
42  uses
43
44     Handle             from Aspect,
45     Background         from Aspect,
46     GradientBackground from Aspect,
47     TypeOfResize       from Aspect,
48     FillMethod         from Aspect,
49     GradientFillMethod from Aspect,
50     PixMap             from Image,
51     NameOfColor        from Quantity,
52     Color              from Quantity,
53     Parameter          from Quantity,
54     Ratio              from Quantity,
55     GraphicDevice      from WNT,
56     WClass             from WNT,
57     Uint               from WNT,
58     Long               from WNT,
59     Dword              from WNT,
60     WindowData         from WNT,
61     Icon               from WNT,
62     ImageManager       from WNT,
63     TypeOfImage        from WNT
64
65  raises
66
67     WindowDefinitionError from Aspect,
68     WindowError           from Aspect
69
70  is
71
72     Create (
73      aDevice       : GraphicDevice from WNT;
74      aTitle        : CString       from Standard;
75      aClass        : WClass        from WNT;
76      aStyle        : Dword         from WNT = 0;
77      Xc            : Parameter     from Quantity = 0.5;
78      Yc            : Parameter     from Quantity = 0.5;
79      aWidth        : Parameter     from Quantity = 0.5;
80      aHeight       : Parameter     from Quantity = 0.5;
81      aBackColor    : NameOfColor   from Quantity = Quantity_NOC_MATRAGRAY;
82      aParent       : Handle        from Aspect = 0;
83      aMenu         : Handle        from Aspect = 0;
84      aClientStruct : Address       from Standard = 0
85     )
86      returns mutable Window from WNT
87         ---Level:   Public
88         ---Purpose: Creates a Window defined by his Center and his Size
89         --          in DSU from the Parent Window. If <aParent> is 0 then
90         --          creates a window without parent.
91         --          Creation of an WNT_Window automatically determines the
92         --          smaller dimension of the screen (usually the height)
93         --          and parametrises it as 1.0.
94         --          The smaller dimension of the window is limited to 1.0
95         --          We can give a value greater than 1.0 to the larger
96         --          dimension.
97         --          No matter how large the values passed in argument, the
98         --          window is automatically limited to the maximum size of
99         --          the screen.
100         --          The ratio of width to height of a conventional screen is
101         --          of the order of 1.3.
102         --  Trigger: Raises WindowDefinitionError if the Position out of the
103         --          Screen Space or the window creation failed.
104      raises WindowDefinitionError from Aspect;
105
106     Create (theDevice       : GraphicDevice from WNT;
107             theTitle        : CString       from Standard;
108             theClass        : WClass        from WNT;
109             theStyle        : Dword         from WNT;
110             thePxLeft       : Integer       from Standard;
111             thePxTop        : Integer       from Standard;
112             thePxWidth      : Integer       from Standard;
113             thePxHeight     : Integer       from Standard;
114             theBackColor    : NameOfColor   from Quantity = Quantity_NOC_MATRAGRAY;
115             theParent       : Handle        from Aspect = 0;
116             theMenu         : Handle        from Aspect = 0;
117             theClientStruct : Address       from Standard = 0)
118      returns mutable Window from WNT
119      ---Level:   Public
120      ---Purpose: Creates a Window defined by his position and size
121      --     in pixles from the Parent Window.
122      --  Trigger: Raises WindowDefinitionError if the Position out of the
123      --          Screen Space or the window creation failed.
124      raises WindowDefinitionError from Aspect;
125
126     Create (
127      aDevice    : GraphicDevice from WNT;
128      aHandle    : Handle        from Aspect;
129      aBackColor : NameOfColor   from Quantity = Quantity_NOC_MATRAGRAY
130     )
131      returns mutable Window from WNT;
132         ---Level:   Public
133         ---Purpose: Creates a Window based on the existing window handle.
134         --          This handle equals ( aPart1 << 16 ) + aPart2.
135
136     Create (
137      aDevice    : GraphicDevice from WNT;
138      aPart1     : Integer       from Standard;
139      aPart2     : Integer       from Standard;
140      aBackColor : NameOfColor   from Quantity = Quantity_NOC_MATRAGRAY
141     )
142      returns mutable Window from WNT;
143         ---Level:   Public
144         ---Purpose: Creates a Window based on the existing window <aHandle>.
145
146     Destroy ( me : mutable )
147      is virtual;
148         ---Level:   Public
149         ---Purpose: Destroies the Window and all resourses attached to it.
150         ---C++:     alias ~
151
152
153     ---------------------------------------------------
154         -- Category: Methods to modify the class definition
155         ---------------------------------------------------
156
157
158     SetBackground (
159      me         : mutable;
160      Background : Background from Aspect
161     )
162      is virtual;
163         ---Level:   Public
164         ---Purpose: Modifies the window background.
165
166     SetBackground (
167      me        : mutable;
168      BackColor : NameOfColor from Quantity
169     )
170      is virtual;
171         ---Level:   Public
172         ---Purpose: Modifies the window background.
173
174     SetBackground (
175      me        : mutable;
176      color     : Color from Quantity
177     )
178      is virtual;
179         ---Level:   Public
180         ---Purpose: Modifies the window background.
181
182
183     SetBackground (
184      me          : mutable;
185      aBackPixmap : Handle from Aspect
186     ) is static;
187         ---Level:   Public
188         ---Purpose: Modifies the window background.
189
190     SetBackground (
191      me          : mutable;
192      aName : CString from Standard ;
193      aMethod: FillMethod from Aspect = Aspect_FM_CENTERED
194     )  returns Boolean from Standard;
195         ---Level: Public
196         ---Purpose: Loads the window background from an image file <aName>
197         -- defined with a supported format XWD,GIF or BMP
198         -- and returns TRUE if the operation is successfull.
199         --  Category: Methods to modify the class definition
200
201     SetBackground ( me : mutable ;
202                     Background : GradientBackground from Aspect ) is virtual;
203         ---Level: Public
204         ---Purpose: Modifies the window gradient background.
205         --  Warning: the gradient background colours is ignored when the quality
206         --         of this window is TRANSPARENT.
207         ---Category: Methods to modify the class definition
208
209     SetBackground( me      : mutable;
210                    aCol1   : Color from Quantity;
211                    aCol2   : Color from Quantity;
212                    aMethod : GradientFillMethod from Aspect = Aspect_GFM_HOR);
213         ---Level: Public
214         ---Purpose: Modifies the window gradient background.
215         --  Warning: the gradient background colours are ignored when the quality
216         --         of this window is TRANSPARENT.
217         ---Category: Methods to modify the class definition
218
219     SetCursor ( me; aCursor : Handle from Aspect )
220      is static;
221         ---Level:   Public
222         ---Purpose: Sets cursor <aCursor> for ENTIRE WINDOW CLASS to which
223         --          the Window belongs.
224
225     SetIcon (
226      me     : mutable;
227      anIcon : Handle  from Aspect;
228      aName  : CString from Standard = 0
229     )
230      is static;
231         ---Level:   Public
232         ---Purpose: Sets icon <anIcon> for window
233
234     SetIconName ( me : mutable; aName : CString from Standard )
235      is static;
236         ---Level:   Public
237         ---Purpose: Sets name for window's icon
238
239     SetDoubleBuffer (
240      me     : mutable;
241      DBmode : Boolean from Standard
242     )
243         ---Level:   Public
244         ---Purpose: Activates/Deactivates the Double Buffering capability
245         --          for this window.
246         --  Warning: Double Buffering is always DISABLE by default.
247         --  Trigger: Raises if BackingStore () isn't allowed for this Window
248      raises WindowError from Aspect is virtual;
249
250     Flush ( me )
251         ---Level:    Public
252         ---Purpose:  Flushes all graphics to the screen and Swap the Double
253         --           buffer if Enable
254         --  Trigger: Raises if Something is WRONG at Drawing Time.
255      raises WindowError from Aspect is virtual;
256
257     Map ( me )
258      is virtual;
259         ---Level:    Public
260         ---Purpose:  Opens the window <me>.
261
262     Map ( me; aMapMode : Integer from Standard )
263      is static;
264         ---Level:   Public
265         ---Purpose: Opens a window <me> according to <aMapMode>.
266         --          This method is specific to Windows NT.
267         --          <aMapMode> can be one of SW_xxx constants defined
268         --          in <windows.h>. See documentation.
269
270     Unmap ( me )
271      is virtual;
272         ---Level:   Public
273         ---Purpose: Closes the window <me>.
274
275     DoResize ( me )
276      returns TypeOfResize from Aspect
277         ---Level:   Public
278         ---Purpose: Applies the resizing to the window <me>.
279      raises WindowError from Aspect is virtual;
280
281     DoMapping ( me ) returns Boolean from Standard
282             raises WindowError from Aspect is virtual;
283         ---Level: Advanced
284         ---Purpose: Apply the mapping change to the window <me>
285         -- and returns TRUE if the window is mapped at screen.
286         ---Category: Methods to modify the class definition
287
288
289     Clear ( me )
290      is virtual;
291         ---Level:   Public
292         ---Purpose: Clears the Window in the Background color.
293
294     ClearArea (
295      me;
296      Xc     : Integer from Standard;
297      Yc     : Integer from Standard;
298      Width  : Integer from Standard;
299      Height : Integer from Standard
300     )
301         ---Level:    Public
302         ---Purpose:  Clears the Window Area defined by his center and PIXEL
303         --           size in the Background color
304         --  Trigger:  Raises if Window is not defined properly
305      raises WindowError from Aspect is virtual;
306
307     Restore ( me )
308         ---Level:   Public
309         ---Purpose: Restores The Window from the BackingStored Window
310         --          See BackingStore () method.
311      raises WindowError from Aspect is virtual;
312
313     RestoreArea (
314      me;
315      Xc     : Integer from Standard;
316      Yc     : Integer from Standard;
317      Width  : Integer from Standard;
318      Height : Integer from Standard
319     )
320         ---Level:   Public
321         ---Purpose: Restores The Window Area defined by his center
322         --          and PIXEL size from the BackingStored Window
323         --          See BackingStore () method.
324      raises WindowError from Aspect is virtual;
325
326     Dump (
327      me;
328      aFilename : CString from Standard;
329      aGammaValue: Real from Standard = 1.0
330     )
331      returns Boolean
332         ---Level:   Public
333         ---Purpose: Dumps the Window to an XWD,GIF or BMP filei with
334         -- an optional gamma correction value according to the graphic system.
335         -- and returns TRUE if the dump occurs normaly.
336         --  Trigger: Raises if Window is not defined properly
337      raises WindowError from Aspect is virtual;
338
339     DumpArea (
340      me;
341      aFilename : CString from Standard;
342      Xc        : Integer from Standard;
343      Yc        : Integer from Standard;
344      Width     : Integer from Standard;
345      Height    : Integer from Standard;
346      aGammaValue: Real from Standard = 1.0
347     )
348      returns Boolean from Standard
349         ---Level:   Public
350         ---Purpose: Dumps the Window Area defined by his center and PIXEL size
351         --      to an image file with an optional gamma correction value
352         --  and returns TRUE if the dump occurs normaly.
353         --  Trigger: Raises if Window is not defined properly
354         --          or the area is out of the Window.
355      raises WindowError from Aspect is virtual;
356
357     ToPixMap ( me ; theImage : in out PixMap from Image )
358     returns Boolean
359     ---Level   : Public
360     ---Purpose : dump the full contents of the window to a pixmap.
361     is virtual;
362
363     Load ( me; aFilename : CString from Standard )
364      returns Boolean from Standard
365         ---Level:   Public
366         ---Purpose: Loads the XWD file to this Window.
367         --          Returns TRUE if the loading occurs normaly.
368         --  Warning: Note that the Window is enlarged automatically
369         --          when the image size is too large for this window.
370         --  Trigger: Raises if Window is not defined properly
371      raises WindowError from Aspect is virtual;
372
373     LoadArea (
374      me;
375      aFilename : CString from Standard;
376      Xc        : Integer from Standard;
377      Yc        : Integer from Standard;
378      Width     : Integer from Standard;
379      Height    : Integer from Standard
380     )
381      returns Boolean from Standard
382         ---Purpose: Loads the XWD file to Window Area defined by his center
383         --          and PIXEL size.
384         --          Returns TRUE if the loading occurs normaly.
385         --  Warning: Note that the Image is zoomed automatically
386         --          when the image size is too large for this window area.
387         --  Trigger: Raises if Window is not defined properly
388         --          or the area is out of the Window.
389      raises WindowError from Aspect is virtual;
390
391     SetOutputFormat ( me : mutable; aFormat : TypeOfImage from WNT )
392      is static;
393         ---Level:   Public
394         ---Purpose: Sets format of the image file created by Dump or
395         --          DumpArea methods.
396
397     SetPos ( me : mutable; X, Y, X1, Y1 : Integer from Standard )
398      is static;
399         ---Level:   Internal
400         ---Purpose: Changes variables due to window position.
401
402     SetFlags ( me : mutable; aFlags : Integer from Standard )
403      is static;
404         ---Level:   Public
405         ---Purpose: Sets user defined flags in the extra window data area.
406         --          Supported flags WDF_* are listed in InterfaceGraphic_WNT.hxx
407         --          In particular, the window backround can be turned off using this method.
408
409     ResetFlags ( me : mutable; aFlags : Integer from Standard )
410      is static;
411         ---Level:   Public
412         ---Purpose: Reset specified flags in the extra window data area.
413         --          Supported flags WDF_* are listed in InterfaceGraphic_WNT.hxx
414         --          In particular, the window backround can be turned on using this method.
415
416
417         ----------------------------
418         -- Category: Inquire methods
419         ----------------------------
420
421
422     BackingStore ( me )
423      returns Boolean from Standard  is virtual;
424         ---Level:   Public
425         ---Purpose: Returns the BackingStore capability for this Window.
426         --          If Answer is True Exposure can be recovered by
427         --              Restore RestoreArea methods.
428         --          If Answer is False, Application must Redraw the
429         --              exposed area.
430
431     DoubleBuffer ( me )
432      returns Boolean from Standard  is virtual;
433         ---Level:   Public
434         ---Purpose: Returns the DoubleBuffer state.
435         ---C++:     inline
436
437     IsMapped ( me )
438      returns Boolean from Standard  is virtual;
439         ---Level:   Public
440         ---Purpose: Returns True if the window <me> is opened
441         --              and False if the window is closed.
442
443     Ratio ( me )
444      returns Ratio from Quantity  is virtual;
445         ---Level:   Public
446         ---Purpose: Returns The Window RATIO equal to the physical
447         --          WIDTH/HEIGHT dimensions.
448
449     Position (
450      me;
451      X1 : out Parameter from Quantity;
452      Y1 : out Parameter from Quantity;
453      X2 : out Parameter from Quantity;
454      Y2 : out Parameter from Quantity
455     )
456      is virtual;
457         ---Level:   Public
458         ---Purpose: Returns The Window POSITION in DSU
459
460     Position (
461      me;
462      X1 : out Integer from Standard;
463      Y1 : out Integer from Standard;
464      X2 : out Integer from Standard;
465      Y2 : out Integer from Standard
466     )
467      is virtual;
468         ---Level:   Public
469         ---Purpose: Returns The Window POSITION in PIXEL
470
471     Size (
472      me;
473      Width  : out Parameter from Quantity;
474      Height : out Parameter from Quantity
475     )
476      is virtual;
477         ---Level:   Public
478         ---Purpose: Returns The Window SIZE in DSU
479
480     Size (
481      me;
482      Width  : out Integer from Standard;
483      Height : out Integer from Standard
484     )
485      is virtual;
486         ---Level:   Public
487         ---Purpose: Returns The Window SIZE in PIXEL
488
489     MMSize (
490      me;
491      Width  : out Real from Standard;
492      Height : out Real from Standard
493     )
494      is virtual;
495         ---Level:   Public
496         ---Purpose: Returns The Window SIZE in MM
497
498     Convert (
499      me;
500      PV : Integer from Standard
501     )
502      returns Parameter from Quantity  is virtual;
503         ---Level:   Public
504         ---Purpose: Returns the DSU value depending of the PIXEL value.
505
506     Convert (
507      me;
508      DV : Parameter from Quantity
509     )
510      returns Integer from Standard  is virtual;
511         ---Level:   Public
512         ---Purpose: Returns the PIXEL value depending of the DSU value.
513
514     Convert (
515      me;
516      PX, PY : Integer       from Standard;
517      DX, DY : out Parameter from Quantity
518     )
519      is virtual;
520         ---Level:   Public
521         ---Purpose: Returns the DSU position depending of the PIXEL position.
522
523     Convert (
524      me;
525      DX, DY : Parameter   from Quantity;
526      PX, PY : out Integer from Standard
527     )
528      is virtual;
529         ---Level:   Public
530         ---Purpose: Returns the PIXEL position depending of the DSU position.
531
532     HWindow ( me )
533      returns Handle from Aspect is static;
534         ---Level:   Public
535         ---Purpose: Returns the Windows NT handle of the created window <me>.
536         ---C++:     inline
537
538     HParentWindow ( me )
539      returns Handle from Aspect is static;
540         ---Level:   Public
541         ---Purpose: Returns the Windows NT handle parent of the created window <me>.
542         ---C++:     inline
543
544     HPixmap ( me )
545      returns Handle from Aspect is static;
546         ---Level:   Internal
547         ---Purpose: Returns the Windows NT double buffer pixmap handle
548         --          of the created window <me>.
549         --          If BackingStore () is permitted.
550         ---C++:     inline
551
552     WndProc ( me )
553      returns Address from Standard;
554         ---Level:   Internal
555         ---Purpose: Returns address of the window procedure.
556         ---C++:     inline
557
558     ImageManager ( me )
559      returns ImageManager from WNT is static;
560         ---Level:   Internal
561         ---Purpose: Returns ImageManager of the Window.
562         ---C++:     inline
563
564     doCreate (
565      me         : mutable;
566      aDevice    : GraphicDevice from WNT;
567      aHandle    : Handle        from Aspect;
568      aBackColor : NameOfColor   from Quantity = Quantity_NOC_MATRAGRAY
569     ) is static private;
570         ---Level:   Private
571         ---Purpose: private method
572
573  fields
574
575     aXLeft          : Integer      from Standard is protected; -- Window coordinates
576     aYTop           : Integer      from Standard is protected;
577     aXRight         : Integer      from Standard is protected;
578     aYBottom        : Integer      from Standard is protected;
579     myWClass        : WClass       from WNT      is protected; -- Window class
580     myHWindow       : Handle       from Aspect   is protected; -- Window handle
581     myHParentWindow : Handle       from Aspect   is protected; -- Parent window handle
582     myHPixmap       : Handle       from Aspect   is protected; -- Bitmap handle
583     myDoubleBuffer  : Boolean      from Standard is protected; -- DoubleBuffer flag
584     myExtraData     : WindowData   from WNT      is protected; -- additional data
585     myFormat        : TypeOfImage  from WNT      is protected; -- type of output image
586     myImages        : ImageManager from WNT      is protected;
587     myIcon          : Icon         from WNT      is protected;
588     myWndProc       : Address      from Standard is protected; -- address of window procedure
589     myUsrData       : Address      from Standard is protected;
590
591  friends
592
593     class WDriver from WNT,
594     class IconBox from WNT,
595     class PixMap  from WNT
596
597 end Window;