42cf5bc1 |
1 | // Created by: NW,JPB,CAL |
2 | // Copyright (c) 1991-1999 Matra Datavision |
3 | // Copyright (c) 1999-2014 OPEN CASCADE SAS |
4 | // |
5 | // This file is part of Open CASCADE Technology software library. |
6 | // |
7 | // This library is free software; you can redistribute it and/or modify it under |
8 | // the terms of the GNU Lesser General Public License version 2.1 as published |
9 | // by the Free Software Foundation, with special exception defined in the file |
10 | // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT |
11 | // distribution for complete text of the license and disclaimer of any warranty. |
12 | // |
13 | // Alternatively, this file may be used under the terms of Open CASCADE |
14 | // commercial license or contractual agreement. |
15 | |
16 | #ifndef _Aspect_Window_HeaderFile |
17 | #define _Aspect_Window_HeaderFile |
18 | |
19 | #include <Standard.hxx> |
20 | #include <Standard_Type.hxx> |
21 | |
22 | #include <Aspect_Background.hxx> |
23 | #include <Aspect_GradientBackground.hxx> |
b6bf4ec1 |
24 | #include <Aspect_FBConfig.hxx> |
42cf5bc1 |
25 | #include <Aspect_FillMethod.hxx> |
26 | #include <Standard_Boolean.hxx> |
25e59720 |
27 | #include <Standard_Transient.hxx> |
87432b82 |
28 | #include <Quantity_Color.hxx> |
42cf5bc1 |
29 | #include <Aspect_GradientFillMethod.hxx> |
30 | #include <Aspect_TypeOfResize.hxx> |
42cf5bc1 |
31 | #include <Standard_Integer.hxx> |
32 | #include <Aspect_Drawable.hxx> |
8693dfd0 |
33 | |
34 | class Aspect_DisplayConnection; |
42cf5bc1 |
35 | class Aspect_WindowDefinitionError; |
36 | class Aspect_WindowError; |
37 | class Aspect_Background; |
42cf5bc1 |
38 | class Aspect_GradientBackground; |
39 | |
42cf5bc1 |
40 | class Aspect_Window; |
25e59720 |
41 | DEFINE_STANDARD_HANDLE(Aspect_Window, Standard_Transient) |
42cf5bc1 |
42 | |
43 | //! Defines a window. |
25e59720 |
44 | class Aspect_Window : public Standard_Transient |
42cf5bc1 |
45 | { |
46 | |
47 | public: |
8693dfd0 |
48 | |
42cf5bc1 |
49 | //! Modifies the window background. |
50 | Standard_EXPORT void SetBackground (const Aspect_Background& ABack); |
87432b82 |
51 | |
42cf5bc1 |
52 | //! Modifies the window background. |
53 | Standard_EXPORT void SetBackground (const Quantity_Color& color); |
8693dfd0 |
54 | |
42cf5bc1 |
55 | //! Modifies the window gradient background. |
56 | Standard_EXPORT void SetBackground (const Aspect_GradientBackground& ABackground); |
8693dfd0 |
57 | |
42cf5bc1 |
58 | //! Modifies the window gradient background. |
59 | Standard_EXPORT void SetBackground (const Quantity_Color& theFirstColor, const Quantity_Color& theSecondColor, const Aspect_GradientFillMethod theFillMethod); |
8693dfd0 |
60 | |
42cf5bc1 |
61 | //! Opens the window <me>. |
62 | Standard_EXPORT virtual void Map() const = 0; |
8693dfd0 |
63 | |
42cf5bc1 |
64 | //! Closes the window <me>. |
65 | Standard_EXPORT virtual void Unmap() const = 0; |
8693dfd0 |
66 | |
42cf5bc1 |
67 | //! Apply the resizing to the window <me>. |
68 | Standard_EXPORT virtual Aspect_TypeOfResize DoResize() const = 0; |
8693dfd0 |
69 | |
42cf5bc1 |
70 | //! Apply the mapping change to the window <me>. |
71 | //! and returns TRUE if the window is mapped at screen. |
72 | Standard_EXPORT virtual Standard_Boolean DoMapping() const = 0; |
8693dfd0 |
73 | |
42cf5bc1 |
74 | //! Returns the window background. |
75 | Standard_EXPORT Aspect_Background Background() const; |
8693dfd0 |
76 | |
42cf5bc1 |
77 | //! Returns the current image background fill mode. |
78 | Standard_EXPORT Aspect_FillMethod BackgroundFillMethod() const; |
8693dfd0 |
79 | |
42cf5bc1 |
80 | //! Returns the window gradient background. |
81 | Standard_EXPORT Aspect_GradientBackground GradientBackground() const; |
8693dfd0 |
82 | |
42cf5bc1 |
83 | //! Returns True if the window <me> is opened |
84 | //! and False if the window is closed. |
85 | Standard_EXPORT virtual Standard_Boolean IsMapped() const = 0; |
8693dfd0 |
86 | |
42cf5bc1 |
87 | //! Returns True if the window <me> is virtual |
88 | Standard_EXPORT Standard_Boolean IsVirtual() const; |
8693dfd0 |
89 | |
42cf5bc1 |
90 | //! Setup the virtual state |
91 | Standard_EXPORT void SetVirtual (const Standard_Boolean theVirtual); |
8693dfd0 |
92 | |
42cf5bc1 |
93 | //! Returns The Window RATIO equal to the physical |
94 | //! WIDTH/HEIGHT dimensions |
ee2be2a8 |
95 | Standard_EXPORT virtual Standard_Real Ratio() const = 0; |
8693dfd0 |
96 | |
42cf5bc1 |
97 | //! Returns The Window POSITION in PIXEL |
98 | Standard_EXPORT virtual void Position (Standard_Integer& X1, Standard_Integer& Y1, Standard_Integer& X2, Standard_Integer& Y2) const = 0; |
8693dfd0 |
99 | |
42cf5bc1 |
100 | //! Returns The Window SIZE in PIXEL |
101 | Standard_EXPORT virtual void Size (Standard_Integer& Width, Standard_Integer& Height) const = 0; |
8693dfd0 |
102 | |
42cf5bc1 |
103 | //! Returns native Window handle (HWND on Windows, Window with Xlib, and so on) |
104 | Standard_EXPORT virtual Aspect_Drawable NativeHandle() const = 0; |
8693dfd0 |
105 | |
42cf5bc1 |
106 | //! Returns parent of native Window handle (HWND on Windows, Window with Xlib, and so on) |
107 | Standard_EXPORT virtual Aspect_Drawable NativeParentHandle() const = 0; |
108 | |
b6bf4ec1 |
109 | //! Returns native Window FB config (GLXFBConfig on Xlib) |
110 | Standard_EXPORT virtual Aspect_FBConfig NativeFBConfig() const = 0; |
42cf5bc1 |
111 | |
8693dfd0 |
112 | //! Invalidate entire window content. |
113 | //! |
114 | //! Implementation is expected to allow calling this method from non-GUI thread, |
115 | //! e.g. by queuing exposure event into window message queue or in other thread-safe manner. |
116 | //! |
117 | //! Optional display argument should be passed when called from non-GUI thread |
118 | //! on platforms implementing thread-unsafe connections to display. |
119 | //! NULL can be passed instead otherwise. |
120 | virtual void InvalidateContent (const Handle(Aspect_DisplayConnection)& theDisp) { (void )theDisp; } |
121 | |
25e59720 |
122 | DEFINE_STANDARD_RTTIEXT(Aspect_Window,Standard_Transient) |
42cf5bc1 |
123 | |
124 | protected: |
125 | |
42cf5bc1 |
126 | //! Initializes the datas of a Window. |
127 | Standard_EXPORT Aspect_Window(); |
128 | |
87432b82 |
129 | protected: |
130 | |
42cf5bc1 |
131 | Aspect_Background MyBackground; |
132 | Aspect_GradientBackground MyGradientBackground; |
133 | Aspect_FillMethod MyBackgroundFillMethod; |
134 | Standard_Boolean MyIsVirtual; |
135 | |
42cf5bc1 |
136 | }; |
137 | |
42cf5bc1 |
138 | #endif // _Aspect_Window_HeaderFile |