1ce0716b |
1 | // Copyright (c) 2016 OPEN CASCADE SAS |
2 | // |
3 | // This file is part of Open CASCADE Technology software library. |
4 | // |
5 | // This library is free software; you can redistribute it and/or modify it under |
6 | // the terms of the GNU Lesser General Public License version 2.1 as published |
7 | // by the Free Software Foundation, with special exception defined in the file |
8 | // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT |
9 | // distribution for complete text of the license and disclaimer of any warranty. |
10 | // |
11 | // Alternatively, this file may be used under the terms of Open CASCADE |
12 | // commercial license or contractual agreement. |
13 | |
14 | #include <Aspect_NeutralWindow.hxx> |
15 | |
16 | IMPLEMENT_STANDARD_RTTIEXT(Aspect_NeutralWindow, Aspect_Window) |
17 | |
18 | // ======================================================================= |
19 | // function : Aspect_NeutralWindow |
20 | // purpose : |
21 | // ======================================================================= |
22 | Aspect_NeutralWindow::Aspect_NeutralWindow() |
23 | : myHandle (0), |
24 | myParentHandle (0), |
25 | myFBConfig (0), |
26 | myPosX (0), |
27 | myPosY (0), |
28 | myWidth (0), |
29 | myHeight (0), |
30 | myIsMapped (Standard_True) {} |
31 | |
32 | // ======================================================================= |
33 | // function : SetNativeHandles |
34 | // purpose : |
35 | // ======================================================================= |
36 | Standard_Boolean Aspect_NeutralWindow::SetNativeHandles (Aspect_Drawable theWindow, |
37 | Aspect_Drawable theParentWindow, |
38 | Aspect_FBConfig theFbConfig) |
39 | { |
40 | if (myHandle == theWindow |
41 | && myParentHandle == theParentWindow |
42 | && myFBConfig == theFbConfig) |
43 | { |
44 | return Standard_False; |
45 | } |
46 | |
47 | myHandle = theWindow; |
48 | myParentHandle = theParentWindow; |
49 | myFBConfig = theFbConfig; |
50 | return Standard_True; |
51 | } |
52 | |
53 | // ======================================================================= |
54 | // function : SetPosition |
55 | // purpose : |
56 | // ======================================================================= |
57 | Standard_Boolean Aspect_NeutralWindow::SetPosition (Standard_Integer theX1, |
58 | Standard_Integer theY1) |
59 | { |
60 | if (myPosX == theX1 |
61 | && myPosY == theY1) |
62 | { |
63 | return Standard_False; |
64 | } |
65 | |
66 | myPosX = theX1; |
67 | myPosY = theY1; |
68 | return Standard_True; |
69 | } |
70 | |
71 | // ======================================================================= |
72 | // function : SetPosition |
73 | // purpose : |
74 | // ======================================================================= |
75 | Standard_Boolean Aspect_NeutralWindow::SetPosition (Standard_Integer theX1, Standard_Integer theY1, |
76 | Standard_Integer theX2, Standard_Integer theY2) |
77 | { |
78 | Standard_Integer aWidthNew = theX2 - theX1; |
79 | Standard_Integer aHeightNew = theY2 - theY1; |
80 | if (myPosX == theX1 |
81 | && myPosY == theY1 |
82 | && myWidth == aWidthNew |
83 | && myHeight == aHeightNew) |
84 | { |
85 | return Standard_False; |
86 | } |
87 | |
88 | myPosX = theX1; |
89 | myWidth = aWidthNew; |
90 | myPosY = theY1; |
91 | myHeight = aHeightNew; |
92 | return Standard_True; |
93 | } |
94 | |
95 | // ======================================================================= |
96 | // function : SetSize |
97 | // purpose : |
98 | // ======================================================================= |
99 | Standard_Boolean Aspect_NeutralWindow::SetSize (const Standard_Integer theWidth, |
100 | const Standard_Integer theHeight) |
101 | { |
102 | if (myWidth == theWidth |
103 | && myHeight == theHeight) |
104 | { |
105 | return Standard_False; |
106 | } |
107 | |
108 | myWidth = theWidth; |
109 | myHeight = theHeight; |
110 | return Standard_True; |
111 | } |